nrdp={classname:"NrdpBridge",_init:!1,_isError:!1,_classes:{},_backchannel:void 0,_MAX_STACK_SIZE:16384,get isReady(){return this._init&&!this._isError},get debug(){return this._syncData.debug},get options(){return this._syncData.options},get js_options(){if(!this._syncData.js_options&&this.isReady){this._syncData.js_options={};for(var a=this.options.js_opts.split(","),b=0;b<a.length;++b){var c=a[b],d=!0,e=c.indexOf("=");-1!=e&&(d=c.substr(e+1),"true"===d?d=!0:"false"===d&&(d=!1),c=c.substr(0,e));
var e=c.split("."),f=this._syncData.js_options;if(e.length)for(var c=e[e.length-1],g=0;g<e.length-1;++g){var h=e[g];f[h]||(f[h]={});f=f[h]}f[c]=d}}return this._syncData.js_options},get uiQueryString(){return this.system.uiQueryString},set uiQueryString(a){nrdp.system.uiQueryString=a},get bootURL(){return this.system.bootURL},get started(){return this._syncData.started},get trustStoreHash(){return this._syncData.trustStoreHash},get trustStore(){return this._syncData.trustStore},set trustStore(a){nrdp._setProperty(null,
"trustStore",a)},get capabilities(){return this._syncData.capabilities},get cwd(){return nrdp._invoke(null,"cwd")},get READY(){return"READY"},get COMPLETE(){return"COMPLETE"},get NETWORK_ERROR(){return"NETWORK_ERROR"},get ACTION_ID(){return"ACTION_ID"},get ERROR(){return"ERROR"},get hasSuspendHandler(){return this._syncData.hasSuspendHandler},set hasSuspendHandler(a){this._syncData.hasSuspendHandler=a;nrdp._setProperty(null,"hasSuspendHandler",a)},get cipherList(){return this._syncData.cipherList},
set cipherList(a){this._syncData.cipherList=a;nrdp._setProperty(null,"cipherList",a)},_mapProperty:function(a,b){var c=a;return"string"===typeof c||(c=c.classname,c)?(c=this._classes[c])?"string"===typeof b?c.properties.byName[b]:c.properties.byIndex[b]:void 0:void 0},_mapMethod:function(a,b){var c=a;if("string"!==typeof c&&(c=c.classname,!c)){nrdp.log.error("Could not find object classname "+a,"NRDP_SCRIPT");return}return(c=this._classes[c])?"string"===typeof b?c.methods.byName[b]:c.methods.byIndex[b]:
void 0},setupBackchannel:function(){return nrdp._backchannel.init()?(nrdp.log.createArea("EVENT_DELAY","event",{warning:!0}),!0):!1},shutdownBackchannel:function(){nrdp.log.trace("nrdp.shutdownBackchannel called","NRDP_SCRIPT");this._sendSyncdEvent(function(){this._callEventListeners(this,{type:"shutdown"})},this);nrdp.storage.flush();nrdp._backchannel.shutdown&&nrdp._backchannel.shutdown()},_sendSyncdEvent:function(a,b,c){a.call(b,c)},hookInit:function(a){nrdp._hookInitFunction=a},_sendInitEvent:function(){var a=
this._sendSyncdEvent.bind(this,function(){this._callEventListeners(nrdp,{type:"init",status:this.READY},!0)},this);this._hookInitFunction?(this._hookInitFunction(a),delete this._hookInitFunction):a()},init:function(){nrdp._init||(nrdp._init=!0,nrdp.log.trace("nrdp.init called","NRDP_SCRIPT"));nrdp._sendInitEvent()},now:function(){return nrdp._invoke(null,"now")},objects:function(a){nrdp._fn("objects",{},a)},locks:function(a,b){nrdp._fn("locks",{flags:b?b:0},a)},exit:function(a){nrdp._invoke(null,
"exit",{code:a})},ping:function(a){var b=nrdp.mono();nrdp._fn("ping",{},function(c){var d=nrdp.mono();a?a(b,c,d):nrdp.log.warn("Bridge ping : JS -> bridge = "+(c-b)+" : bridge -> JS = "+(d-c)+" : roundtrip = "+(d-b))})},assert:function(a,b){if(!a){b="JS ASSERTION FAILED"+(b?" : "+b:"");var c=nrdp.stacktrace();nrdp.log.fatal(b+(c?"\n"+c:""),"NRDP_SCRIPT");nrdp._invoke(null,"assert")}},stacktrace:function(){try{throw Error();}catch(a){return a.stack}},backtrace:function(){try{throw Error();}catch(a){return a.stack}},
mono:function(){return nrdp._backchannel?nrdp._backchannel.mono():void 0},pmono:function(){return nrdp._backchannel?nrdp._backchannel.pmono():void 0},drmTime:function(){return nrdp.drmsystem.getDrmTime()},atob:function(a,b){return nrdp._backchannel.atob(a,b)},btoa:function(a,b,c){return nrdp._backchannel.btoa(a,b,c)},atoutf8:function(a){return nrdp._backchannel.atoutf8(a)},utf8toa:function(a){return nrdp._backchannel.utf8toa(a)},atoutf32:function(a){return nrdp._backchannel.atoutf32(a)},utf32toa:function(a,
b,c){return nrdp._backchannel.utf32toa(a,b,c)},compress:function(a,b,c){return nrdp._backchannel.compress(a,b,c)},uncompress:function(a,b,c){return nrdp._backchannel.uncompress(a,b,c)},random:function(a){return nrdp._backchannel.random(a)},gctag:function(a){return nrdp._backchannel.gctag(a)},getConfigList:function(){this._callEventListeners(this,{type:"config",list:this._syncData.configList})},get config(){return this._syncData.config},setConfigData:function(a,b){nrdp.config[a]=b;nrdp._invoke(null,
"setConfigData",{name:a,data:b});this._callEventListeners(this,{type:"configChanged",name:a,data:b})},traceRoute:function(a,b){a instanceof Object||(a={host:a});nrdp._fn("traceRoute",a,b)},_path:"nrdp",addEventListener:function(a,b){"suspendChanged"==a&&(this.hasSuspendHandler=!0);nrdp._addEventListener(this,a,b)},removeEventListener:function(a,b){return nrdp._removeEventListener(this,a,b)},_findObject:function(a){if(a instanceof Object)return a;var b=nrdp;if("nrdp"!=a){a=a.split(".");for(var c=1;b&&
c<a.length;++c)b=b[a[c]]}return b},_setProperty:function(a,b,c){nrdp._backchannel||nrdp.log.info("unhandled _setProperty "+a+" "+b,"NRDP_SCRIPT");var d=a?"nrdp."+a:"nrdp",e=nrdp._findObject(d);e?e._setProperty_current&&e._setProperty_current[b]?(e._setProperty_pending||(e._setProperty_pending={}),e._setProperty_pending[b]={object:a,property:b,value:c}):nrdp._backchannel.setProperty(a,b,c)&&(e._setProperty_current||(e._setProperty_current={}),e._setProperty_current[b]=!0):nrdp.log.error("could not find object "+
d+" to set property "+b+" on","NRDP_SCRIPT")},_invoke:function(a,b,c){nrdp._backchannel||nrdp_platform&&nrdp_platform.log("unhandled _invoke "+a+" "+b,"NRDP_SCRIPT");return nrdp._backchannel.invoke(a,b,c)},_addEventListener:function(a,b,c){if(!c)return!1;var d;"string"===typeof a?(nrdp._oldStyleListeners||(nrdp._oldStyleListeners={}),d=nrdp._oldStyleListeners,a=b=a+"."+b):(a._eventListeners||(a._eventListeners={}),d=a._eventListeners,a=a._path+"."+b);nrdp.log.verbose("add listener for "+a,"NRDP_SCRIPT");
d[b]||(d[b]=[]);d[b].push(c);return!0},_removeEventListener:function(a,b,c){if(!c)return!1;var d,e;"string"===typeof a?(b=a+"."+b,d=nrdp._oldStyleListeners,e=b):a instanceof Object&&(d=a._eventListeners,e=a._path+"."+b);if(!d)return nrdp.log.verbose("remove listener, no parent","NRDP_SCRIPT"),!1;a=d[b];if(!a)return nrdp.log.verbose("remove listener, no listeners","NRDP_SCRIPT"),!1;c=a.indexOf(c);if(0>c)return nrdp.log.verbose("remove listener, listener not found","NRDP_SCRIPT"),!1;0<=c&&(1==a.length?
delete d[b]:a.splice(c,1));nrdp.log.verbose("remove listener for "+e+", length is "+(d[b]?d[b].length:0),"NRDP_SCRIPT");return!0},_hasEventListener:function(a,b){return"string"===typeof a?(b=a+"."+b,nrdp._oldStyleListeners&&nrdp._oldStyleListeners[b]&&nrdp._oldStyleListeners[b].length):a._eventListeners&&a._eventListeners[b]&&a._eventListeners[b].length},_callEventListeners:function(a,b,c){if("string"===typeof a){var d=a+"."+b.type;if(!nrdp._oldStyleListeners||!nrdp._oldStyleListeners[d])return;c?
(c=nrdp._oldStyleListeners[d],delete nrdp._oldStyleListeners[d]):c=nrdp._oldStyleListeners[d].slice(0)}else{if(!a._eventListeners||!a._eventListeners[b.type])return;c?(c=a._eventListeners[b.type],delete a._eventListeners[b.type]):c=a._eventListeners[b.type].slice(0);a=a._path}for(d=0;d<c.length;d++){var e=c[d];e&&(nrdp.log.verbose("call listener for "+a+"."+b.type,"NRDP_SCRIPT"),e(b))}},_urlEncode:function(a){var b="",c;for(c in a)b&&(b+="&"),b+=c+"="+encodeURIComponent(a[c]);return b},describeEvent:function(a){return nrdp._describeEvent(a)},
_describeEvent:function(a){if(a&&a.type){var b;b=a.object instanceof Object?a.object._path:a.object;return"Event"==a.type?b+"::"+a.name:"PropertyUpdate"==a.type?b+"::"+a.type+JSON.stringify(a.properties):"SetProperty"==a.type?b+"::"+a.type+"("+a.property+")":b+"::"+a.type}},_gotEvent:function(a){var b,c;if(nrdp._syncData&&nrdp.debug&&nrdp._init&&(b=nrdp.mono(),50<b-a.time)){var d="JS event waited "+(b-a.time)+"ms: "+nrdp.describeEvent(a);a.timerPreemption&&(d+=" timerPreemption: "+a.timerPreemption);
nrdp.log.debug(d)}try{"Event"==a.type?this._gotEventEvent(a):"ClassSync"==a.type?this._gotClassSyncEvent(a):"PropertyUpdate"==a.type?this._gotPropertyUpdateEvent(a):"SetProperty"==a.type?this._gotSetPropertyEvent(a):"Method"==a.type?this._gotMethodEvent(a):"EventSourceError"==a.type?(nrdp._isError=!0,nrdp.log.info("EventSource went away, sending fatalerror","NRDP_SCRIPT"),c={type:"fatalerror"},this._callEventListeners(this,c)):nrdp.log.error("unhandled eventsource type "+a.type,"NRDP_SCRIPT")}catch(e){c=
{};var f;if("string"!==typeof e)for(f in e)e.hasOwnProperty(f)&&(c[f]=e[f]);!c.stack&&e.stack&&(c.stack=e.stack);"string"==typeof c.stack&&(f=c.stack.length)&&f>nrdp._MAX_STACK_SIZE&&(c.stack=c.stack.substr(0,nrdp._MAX_STACK_SIZE/2)+"\n...[stack truncated, it was "+f+" characters]...\n"+c.stack.substr(-nrdp._MAX_STACK_SIZE/2));nrdp.log.error("JAVASCRIPT EXCEPTION: "+e.toString(),"NRDP_SCRIPT",void 0,c);c={type:"exception",exception:e};this._callEventListeners(this,c)}void 0!==b&&(f=nrdp.mono(),nrdp._syncData&&
f-b>nrdp.options.js_delay&&nrdp.log.warn("handling JS event took "+(f-b)+"ms: "+nrdp.describeEvent(a),"EVENT_DELAY"))},_gotEventEvent:function(a){if(a.object){var b=this._findObject(a.object);b&&b._handleEvent&&b._handleEvent(a)||nrdp.log.warn("unhandled event "+a.object+" "+a.name,"NRDP_SCRIPT")}else"factoryReset"==a.name&&this._callEventListeners(this,{type:a.name})},_gotClassSyncEvent:function(a){var b={methods:{byIndex:[],byName:{}},properties:{byIndex:[],byName:{}}},c;for(c in a.value.methods)b.methods.byIndex.push(a.value.methods[c]),
b.methods.byName[a.value.methods[c]]=parseInt(c);for(var d in a.value.properties)b.properties.byIndex.push(a.value.properties[d]),b.properties.byName[a.value.properties[d]]=parseInt(d);this._classes[a.name]=b},_gotPropertyUpdateEvent:function(a){var b=this._findObject(a.object);if(b){var c;b._updateProperty?c=b._updateProperty:b._syncData||(b._syncData={});for(var d in a.properties){if("string"!==typeof d){var e=this._mapProperty(b,d);if(!e){nrdp.log.error("Could not map PropertyUpdate: "+a.object+
" "+d,"NRDP_SCRIPT");continue}d=e}a.properties[d]instanceof Function||(c?c.call(b,d,a.properties[d]):b._syncData[d]=a.properties[d])}}else nrdp.log.error("Could not find object "+a.object+" for sync data","NRDP_SCRIPT")},_gotSetPropertyEvent:function(a){var b=this._findObject(a.object);if(b){var c=a.property;if("string"!==typeof c){var d=this._mapProperty(b,c);if(!d){nrdp.log.error("Could not map SetProperty: "+a.object+" "+c,"NRDP_SCRIPT");return}c=d}b._setProperty_current&&delete b._setProperty_current[c];
b._setProperty_pending&&b._setProperty_pending[c]&&(a=b._setProperty_pending[c],delete b._setProperty_pending[c],nrdp._setProperty(a.object,a.property,a.value))}},_gotMethodEvent:function(a){var b=a.method;if("string"!==typeof b){var c=this._mapMethod(a.object,b);if(!c){nrdp.log.error("Could not map Method: "+a.object+" "+b,"NRDP_SCRIPT");return}b=c}this._callEventListeners(this,{type:"invalidargument",object:a.object,method:b,argument:a.returnValue})},_nextIdx:1,_cbs:{},_fn:function(a,b,c){b||(b=
{});b.id=this._nextIdx++;this._cbs[b.id]=c;nrdp._invoke(null,a,b)},parseXml:function(a,b){if(b)nrdp._fn("parseXML",{xml:a},b);else return nrdp._backchannel.parseXML(a)},parseJSON:function(a,b){if(b)nrdp._fn("parseJSON",{json:a},b);else return nrdp._backchannel.parseJSON(a)},setTrustStore:function(a){nrdp.trustStore=a},setServerTime:function(a){nrdp._invoke(null,"setServerTime",{time:a})},setTestDriverIpAddress:function(a){nrdp._invoke(null,"setTestDriverIpAddress",{address:a})},get suspended(){return this._syncData.suspended},
requestSuspend:function(a){nrdp._invoke(null,"requestSuspend",{reason:a})},suspendComplete:function(){nrdp._fn("suspendComplete")},_fixXml:function(a){var b=a.$children,c,d;if(b&&b.length){c=b.length;for(var e=0;e<c;e++){d=b[e];d.$parent=a;d.$sibling=b[e+1];var f=d.$name;void 0!==f&&void 0===a[f]&&(a[f]=d);this._fixXml(d)}}},console:{_log:function(a,b){for(var c="",d=0;d<b.length;){var e=b[d++];1!=d&&(c+=" ");if(e&&e instanceof Object)try{c=e instanceof Array?c+JSON.stringify(e):c+("Object "+JSON.stringify(e))}catch(f){c+=
e}else c+=e}a(c)},error:function(){this._log(nrdp.log.error,arguments)},debug:function(){this._log(nrdp.log.debug,arguments)},log:function(){this._log(nrdp.log.debug,arguments)},warn:function(){this._log(nrdp.log.warn,arguments)},info:function(){this._log(nrdp.log.info,arguments)}},_eventBrokers:{commandReceived:function(a){this._callEventListeners(this,{type:"command",parameters:a.data})},parsedXML:function(a){a.data.success&&this._fixXml(a.data.object);return{data:a.data}},suspendChanged:function(a){this._callEventListeners(this,
{type:"suspendChanged",data:a.data,time:a.time})},requestedResume:function(a){return{data:a.data}},parsedJSON:function(a){return{data:a.data.object}},pong:function(a){return{data:a.data.received}},objects:function(a){return{data:a.data.objects}},traceRoute:function(a){return{data:a.data}},locks:function(a){return{data:a.data.locks}}},_dumpEvent:function(){for(var a=0;a<arguments.length;++a){var b;try{b=JSON.stringify(arguments[a],null,4)}catch(c){b=arguments[a]}nrdp.log.error(b)}},_dumpKeys:function(){for(var a=
0;a<arguments.length;++a){nrdp.log.error("object: "+a);for(var b in arguments[a])nrdp.log.error(b)}},_handleEvent:function(a){var b=this._eventBrokers[a.name],c;if(!b)return!1;if(b=b.call(this,a)){a=a.data.id;c=this._cbs[a];try{c instanceof Function&&c(b.data)}finally{delete this._cbs[a]}}return!0},audio:{classname:"AudioBridge",get codecs(){return this._syncData.codecs},get urls(){return this._syncData.urls},get capability(){return this._syncData.capability},load:function(a,b){nrdp.audio._fn("load",
{src:nrdp.gibbon._prepareNetworkRequest(a)},b)},unload:function(a,b){nrdp.audio._fn("unload",{url:nrdp.gibbon._resolveUrl(a)},b)},unloadAll:function(a){nrdp.audio._fn("unloadAll",void 0,a)},play:function(a,b,c,d,e,f,g){nrdp.audio._fn("play",{url:nrdp.gibbon._resolveUrl(a),volume:b,fadeInMs:d||0,fadeOutMs:e||0,fadeInEase:f||0,fadeOutEase:g||0},c)},stop:function(a,b,c,d){nrdp.audio._fn("stop",{url:nrdp.gibbon._resolveUrl(a),fadeOutMs:c||0,fadeOutEase:d||0},b)},getVolume:function(a){nrdp.audio._fn("getVolume",
null,a)},setVolume:function(a,b,c){nrdp.audio._fn("setVolume",{volume:a,transitionMs:b||0,ease:c||0})},get EASE_LINEAR(){return 0},get EASE_IN_CUBIC(){return 1},get EASE_OUT_CUBIC(){return 2},_nextIdx:1,_cbs:{},_fn:function(a,b,c){b||(b={});b.id=this._nextIdx++;c&&(this._cbs[b.id]=c);nrdp._invoke("audio",a,b)},_handleEvent:function(a){if(a.data&&a.data.id){if("function"==typeof this._cbs[a.data.id]){if(a.data.hasOwnProperty("success")){var b=[a.data.success,a.data.size];a.data.hasOwnProperty("url")&&
b.unshift(a.data.url);this._cbs[a.data.id].apply(void 0,b)}else this._cbs[a.data.id](a.data.data);delete this._cbs[a.data.id]}}else return!1;return!0}},device:{classname:"DeviceBridge",_path:"device",addEventListener:function(a,b){nrdp._addEventListener(this,a,b)},removeEventListener:function(a,b){nrdp._removeEventListener(this,a,b)},get VOLUME_NONE(){return 0},get VOLUME_SPEAKER(){return 1},get VOLUME_STREAM(){return 2},get PLAY_READY(){return 0},get SESSION_DH1(){return 1},get WIDEVINE_CEF(){return 2},
get ANYCAST(){return 3},get drmType(){return this._syncData.capability.drmType},get currentViewMode(){return this._syncData.currentViewMode},get availableViewModes(){return this._syncData.availableViewModes},get softwareVersion(){return this._syncData.softwareVersion},get certificationVersion(){return this._syncData.certificationVersion},get deviceModel(){return this._syncData.deviceModel},get ESNPrefix(){return this._syncData.ESNPrefix},get SDKVersion(){return this._syncData.SDKVersion},get ESN(){return this._syncData.ESN},
get language(){return this._syncData.language},get friendlyName(){return this._syncData.friendlyName},get startupTags(){return this._syncData.startupTags},get volumeControlType(){return this._syncData.volumeControlType},get volumeStep(){return this._syncData.volumeStep},get mute(){return this._syncData.mute},set mute(a){nrdp._setProperty("device","mute",a)},get capability(){return this._syncData.capability},get videoOutput(){return this._syncData.videoOutput},get supportedVideoOutput(){return this._syncData.supportedVideoOutput},
get activeVideoOutput(){return this._syncData.activeVideoOutput},get dnslist(){return this._syncData.network.dnslist},get iflist(){return this._syncData.network.iflist},get ipversions(){return this._syncData.network.ipversions},get ipConnectivityMode(){return this._syncData.network.ipConnectivityMode},get ipv6Supported(){return this._syncData.ipv6Supported},get UIVersion(){return this._syncData.UIVersion},set UIVersion(a){nrdp._setProperty("device","UIVersion",a)},addLibrary:function(a,b,c){nrdp._invoke("device",
"addLibrary",{name:a,version:b,component:c})},setUIVersion:function(a){nrdp._setProperty("device","UIVersion",a)},get UILanguages(){return this._syncData.UILanguages},set UILanguages(a){a=Array.isArray(a)?a:[];a=a.join(",");nrdp._setProperty("device","UILanguages",a)},isScreensaverOn:function(){return this._syncData.screensaverOn},factoryReset:function(a){nrdp.storage._clearAll();nrdp.device._fn("factoryReset",null,a)},setViewMode:function(a){nrdp._invoke("device","setViewMode",{viewMode:a})},getVolume:function(a){nrdp.device._fn("getVolume",
null,a)},setVolume:function(a){nrdp._invoke("device","setVolume",{targetVolume:a})},setRegistered:function(a){nrdp._setProperty("device","registered",!!a)},get registered(){return this._syncData.registered},getSignatures:function(a){nrdp.device._fn("getSignatures",null,a)},getUptime:function(a){nrdp.device._fn("getUptime",null,a)},getSystemValue:function(a,b){nrdp.device._fn("getSystemValue",{key:a},b)},_nextIdx:1,_cbs:{},_fn:function(a,b,c){b||(b={});b.idx=this._nextIdx++;c&&(this._cbs[b.idx]=c);
nrdp._invoke("device",a,b)},_handleEvent:function(a){if(a.data&&a.data.idx)"function"==typeof this._cbs[a.data.idx]&&(this._cbs[a.data.idx](a.data.data),delete this._cbs[a.data.idx]);else return!1;return!0},_syncData:{},_updateProperty:function(a,b){var c;if(nrdp.isReady)if("screensaverOn"==a)c={type:"screensaverchange"};else if("capability"==a)c={type:"capabilitychange",old:this.capability};else if("videoOutput"==a)c={type:"videooutputchange",old:this.videoOutput};else if("activeVideoOutput"==a)c=
{type:"videooutputstatuschange",old:this.activeVideoOutput};else if("language"==a)c={type:"languagechange",old:this.language};else if("currentViewMode"==a)c={type:"viewmodechange"};else if("network"==a)c={type:"networkchange"};else if(a.match(/^volume/)||"mute"==a)c={type:"volumechange",oldvolume:this.volume,oldmute:this.mute};this._syncData[a]=b;c&&nrdp._callEventListeners(this,c)}},drmsystem:{_path:"drmsystem",addEventListener:function(a,b){nrdp._addEventListener(this,a,b)},removeEventListener:function(a,
b){nrdp._removeEventListener(this,a,b)},get INVALID_LICENSE(){return 0},get LIMITED_DURATION_LICENSE(){return 1},get STANDARD_LICENSE(){return 2},get drmType(){return this._syncData.drmType},get supportSecureStop(){return this._syncData.supportSecureStop},get supportStorageDeletion(){return this._syncData.supportStorageDeletion},get isOpen(){return this._syncData.isOpen},get DRMSESSION_LICENSE_ACQUISITION_STATE(){return 0},get DRMSESSION_INACTIVE_DECRYPTION_STATE(){return 1},get DRMSESSION_ACTIVE_DECRYPTION_STATE(){return 2},
get DRMSESSION_INVALID_STATE(){return 3},openDrmSystem:function(a,b){nrdp.drmsystem._fn("openDrmSystem",{drmType:a},b)},closeDrmSystem:function(a,b){nrdp.drmsystem._fn("closeDrmSystem",{drmType:a},b)},getSecureStopIds:function(a){nrdp.drmsystem._fn("getSecureStopIds",{},a)},getSecureStop:function(a,b){nrdp.drmsystem._fn("getSecureStop",{secureStopId:a},b)},commitSecureStop:function(a,b){nrdp.drmsystem._fn("commitSecureStop",{secureStopId:a,serverResponse:b})},resetSecureStops:function(){nrdp.drmsystem._fn("resetSecureStops")},
useSecureStop:function(a){nrdp.drmsystem._fn("enableSecureStop",{enable:a})},isSecureStopEnabled:function(){return nrdp._invoke("drmsystem","isSecureStopEnabled")},deleteDrmStore:function(a){nrdp.drmsystem._fn("deleteDrmStore",{},a)},deleteKeyStore:function(a){nrdp.drmsystem._fn("deleteKeyStore",{},a)},getDrmStoreHash:function(a){nrdp.drmsystem._fn("getDrmStoreHash",{},a)},getKeyStoreHash:function(a){nrdp.drmsystem._fn("getKeyStoreHash",{},a)},getDrmTime:function(){return nrdp._invoke("drmsystem",
"getDrmTime")},getDrmVersion:function(a){nrdp.drmsystem._fn("getDrmVersion",{},a)},generateChallenge:function(){"object"==typeof arguments[0]&&2==arguments.length?nrdp.drmsystem._fn("generateChallenge",arguments[0],arguments[1]):nrdp.drmsystem._fn("generateChallenge",{drmType:arguments[0],contentId:arguments[1],licenseType:arguments[2],drmHeader:arguments[3]},arguments[4])},provideLicense:function(a,b,c){nrdp.drmsystem._fn("provideLicense",{sessionId:a,license:b},c)},getDrmSessionIds:function(a){nrdp.drmsystem._fn("getDrmSessionIds",
{},a)},createDrmSession:function(a){nrdp.drmsystem._fn("createDrmSession",{},a)},deleteDrmSession:function(a,b){nrdp.drmsystem._fn("deleteDrmSession",{sessionId:a},b)},flushDrmSessions:function(a){nrdp.drmsystem._fn("flushDrmSessions",{},a)},getLdlSessionsLimit:function(a){nrdp.drmsystem._fn("getLdlSessionsLimit",{},a)},_fn:function(a,b,c){b||(b={});b.idx=this._nextIdx++;c&&(this._cbs[b.idx]=c);nrdp._invoke("drmsystem",a,b);return b.idx},_handleEvent:function(a){var b,c;if("result"==a.name)c=a.data.idx,
"function"==typeof this._cbs[c]&&(b=this._cbs[c],delete a.data.idx,b(a.data)),delete this._cbs[c];else if("drmsystemevent"==a.name)nrdp._callEventListeners(this,a.data);else return!1;return!0},_nextIdx:1,_cbs:{}},instrumentation:{classname:"InstrumentationBridge",_path:"instrumentation",addEventListener:function(a,b){nrdp._addEventListener(this,a,b)},removeEventListener:function(a,b){nrdp._removeEventListener(this,a,b)},setParams:function(a,b){nrdp._invoke("instrumentation","setParams",{enabled:a,
events:b})},get ON(){return 0},get SWITCHED(){return 1},get TEST(){return 2},get DEBUG(){return 3},get WATCHDOG(){return 4},get verbose(){return this._syncData.verbose},generateEvent:function(a,b,c){nrdp._invoke("instrumentation","event",{category:a,name:b,value:c})},startInterval:function(a,b,c,d){nrdp._invoke("instrumentation","intervalStart",{category:a,name:b,value:c,reset:d})},incIntervalCounter:function(a,b,c,d){nrdp._invoke("instrumentation","intervalCount",{category:a,name:b,counter:c,increment:d})},
tagInterval:function(a,b,c){nrdp._invoke("instrumentation","intervalTag",{category:a,name:b,value:c})},endInterval:function(a,b,c){nrdp._invoke("instrumentation","intervalEnd",{category:a,name:b,value:c})},cancelInterval:function(a,b){nrdp._invoke("instrumentation","intervalCancel",{category:a,name:b})},stashOn:function(){nrdp._invoke("instrumentation","stash",{on:!0})},stashOff:function(){nrdp._invoke("instrumentation","stash",{on:!1})},popStash:function(a){var b=this._nextIdx++;this._cbs[b]=a;nrdp._invoke("instrumentation",
"popStash",{idx:b})},_flush:function(a){var b=this._nextIdx++;this._cbs[b]=a;nrdp._invoke("instrumentation","flush",{idx:b})},_handleEvent:function(a){if(a.data&&a.data.idx){if(this._cbs[a.data.idx]instanceof Function)this._cbs[a.data.idx](a.data.events);delete this._cbs[a.data.idx]}else if("verboseChanged"==a.name)nrdp._callEventListeners(this,{type:a.name});else return!1;return!0},_nextIdx:1,_cbs:{}},log:{classname:"LogBridge",_path:"log",addEventListener:function(a,b){nrdp._addEventListener(this,
a,b)},removeEventListener:function(a,b){nrdp._removeEventListener(this,a,b)},get UIContext(){return this._syncData.UIContext},set UIContext(a){nrdp._setProperty("log","UIContext",a)},get appid(){return this._syncData.appid},get areas(){return this._syncData.areas},get aseCodes(){return this._syncData.aseCodes},get errorCodes(){return this._syncData.errorCodes},get haveTracing(){return this._syncData.haveTracing},get level(){return this._syncData.level},set level(a){nrdp._setProperty("log","level",
a)},get levels(){return this._syncData.levels},get sessionid(){return this._syncData.sessionid},get traceAreas(){return this._syncData.traceAreas},set traceAreas(a){nrdp._setProperty("log","traceAreas",a)},flush:function(){nrdp._invoke("log","flush")},_traceAreaMap:null,_log:function(a,b){var c=b[0],d=b[1],e=b[2],f=b[3],g=b[4],h=b[5]?b[5]:!1,k;if(!nrdp._isError&&this._syncData.levels){if("trace"!=a&&"verbose"!=a||nrdp.debug||this.haveTracing)k=this.levels[a],"object"===typeof b[1]&&null!==b[1]&&/^\w*Error$/.test(b[1].name)&&
(d=void 0,f||(f={}),f.exception=b[1].message||""+b[1],f.stack=b[1].stack),nrdp._invoke("log","log",{logLevel:k,msg:c,traceArea:d,type:e,tags:f,critical:g,sendtoappboot:h}),!g&&(e||nrdp.log.level>nrdp.log.levels.trace&&k>=nrdp.log.level)&&nrdp._callEventListeners(this,{type:"logMsgsReady",data:[{monotime:nrdp.mono(),area:d,level:k,msg:c,tags:f,logtype:e,threadname:"UI_THREAD",threadid:"1",critical:!1}]})}else 1!=b.length&&(c=b[1]+": "+b[0]),this.console(c)},milestone:function(){},console:function(a){nrdp._backchannel&&
nrdp._backchannel.console?nrdp._backchannel.console(a):"undefined"!==typeof nrdp_platform&&nrdp_platform.console?nrdp_platform.console(a):"undefined"!==typeof window&&window.console.log&&window.console.log(a)},debug:function(){nrdp.log._log("debug",arguments)},info:function(){nrdp.log._log("info",arguments)},warn:function(){nrdp.log._log("warn",arguments)},error:function(){nrdp.log._log("error",arguments)},success:function(){nrdp.log._log("success",arguments)},fatal:function(){nrdp.log._log("fatal",
arguments)},trace:function(){nrdp.log._log("trace",arguments)},verbose:function(){nrdp.log._log("verbose",arguments)},resetAppID:function(a){nrdp.log.error("Resetting Appid:"+nrdp.log.appid);nrdp._invoke("log","resetAppID",{appid:a})},createArea:function(a,b,c){nrdp._invoke("log","createArea",{area:a,groups:b,flags:c});this._traceAreaMap&&(this._traceAreaMap[a]=a)},resetSessionID:function(){return nrdp._invoke("log","resetSessionID")},getLogMessages:function(){nrdp._invoke("log","getLogMessages")},
getCriticalMessages:function(){nrdp._invoke("log","getCriticalMessages")},deleteCriticalMessages:function(a){nrdp._invoke("log","deleteCriticalMessages",{criticalMessages:a})},addSink:function(a,b){a instanceof Object||(a={spec:a});var c=nrdp._invoke("log","addSink",a);void 0!=c&&(this._sinks[c]=b);return c},removeSink:function(a){a instanceof Object||(a={id:a});nrdp._invoke("log","removeSink",a)&&delete this._sinks[a.id]},get sinks(){return this._sinks},_sinks:{},_syncData:{},_updateProperty:function(a,
b){var c;nrdp.isReady&&"sessionid"==a&&(c={type:"sessionIDChanged",data:b});this._syncData[a]=b;c&&nrdp._callEventListeners(this,c)},_handleEvent:function(a){var b;if("logMsgsReady"==a.name)b={data:a.data},b.type=a.name,nrdp._callEventListeners(this,b);else if("criticalMsgsReady"==a.name)b={data:a.data},b.type=a.name,nrdp._callEventListeners(this,b);else if("logflush"==a.name)b={name:"logflush",type:"logflush"},nrdp._callEventListeners(this,b);else if("appIdResetComplete"==a.name)b={type:"appIdResetComplete",
data:a.data},nrdp._callEventListeners(this,b);else if("logSink"==a.name)(b=this._sinks[a.data.id])&&b(a.data);else return!1;return!0}},mediarequest:{_path:"mediarequest",addEventListener:function(a,b){nrdp._addEventListener(this,a,b)},removeEventListener:function(a,b){nrdp._removeEventListener(this,a,b)},get MEDIA_AUDIO(){return 0},get MEDIA_VIDEO(){return 1},get MEDIA_TEXT(){return 2},get MEDIA_HEADERS(){return 3},get RESPONSE_DATABUFFER(){return 0},get RESPONSE_STREAM(){return 1},createMediaSource:function(a,
b){return this._fn("mediaSourceCreate",{player:b},a)},destroyMediaSource:function(a,b){return this._fn("mediaSourceDestroy",{sourceid:a},b)},createMediaBufferPool:function(a){return this._fnAsync("mediaBufferPoolCreate",{},a)},createSourceBuffers:function(a,b,c){return this._fn("sourceBuffersCreate",{sourceid:a,mediatypes:b},c)},attachDrmHeaderToSourceBuffer:function(){},attachHeaderToSourceBuffer:function(a,b,c,d,e,f,g,h,k,l){return this.attachDataToSourceBuffer(a,l,c,k)},attachDataToSourceBuffer:function(a,
b,c,d){return this._fn("sourceBufferAttachData",{sourceid:b,bufferid:c,data:a},d)},attachRequestToSourceBuffer:function(a,b,c,d){return this._fn("sourceBufferAttachRequest",{sourceid:d,bufferid:b,requestid:a},c)},sourceBufferSetTimestampOffset:function(a,b,c,d,e){return this._fn("sourceBufferSetTimestampOffset",{sourceid:a,bufferid:b,timeoffset:c,timescale:d},e)},get synchronousTrackCreate(){return!0},addDownloadTracks:function(a,b){return this._fn("downloadTracksCreate",{configs:a},b)},pauseDownloadTrack:function(a,
b){return this._fnAsync("downloadTrackPause",{trackid:a},b)},resumeDownloadTrack:function(a,b){return this._fnAsync("downloadTrackResume",{trackid:a},b)},reconfigureDownloadTrack:function(a,b,c){return this._fnAsync("downloadTrackReconfigure",{trackid:a,config:b},c)},removeDownloadTracks:function(a,b){return this._fn("downloadTracksDestroy",{trackids:a},b)},createRequest:function(a,b,c,d,e,f,g,h,k){nrdp.assert(e>d,"nrdp.mediarequest.createRequest: invalid range, "+d+"-"+e);return this._fn("requestCreate",
{requestid:a,trackid:b,url:c,start:d,end:e,responsetype:f,ptsStart:g,ptsEnd:h},k)},abortRequest:function(a,b){return this._fn("requestAbort",{requestid:a},b)},removeRequest:function(a,b){return this._fn("requestRemove",{requestid:a},b)},swapRequestURL:function(a,b,c){return this._fn("requestSwapURL",{requestid:a,url:b},c)},endOfStream:function(a,b,c){return this._fn("endOfStream",{sourceid:c,bufferid:a},b)},parseSegmentIndex:function(a,b){return this._fn("parseSegmentIndex",{data:a,anchor:b})},_nextIdx:1,
_cbs:{},_fn:function(a,b,c){b||(b={});a=nrdp._invoke("mediarequest",a,b);if(c)c(a);else return a},_fnAsync:function(a,b,c){b||(b={});b.idx=this._nextIdx++;this._cbs[b.idx]=c;nrdp._invoke("mediarequest",a,b);return b.idx},_handleEvent:function(a){var b,c;return"result"==a.name?(c=a.data.idx,"function"==typeof this._cbs[c]&&(b=this._cbs[c],delete a.data.idx,b(a.data)),delete this._cbs[c],!0):"onloadstart"===a.name||"onfirstbyte"===a.name||"onprogress"===a.name||"oncomplete"===a.name||"onerror"===a.name||
"downloadpaused"===a.name||"downloadresumed"===a.name||"pipelinedetection"===a.name||"networkfailing"===a.name||"trackfailed"===a.name||"TransportReporter"===a.name||"mediabufferdestroyed"===a.name?(nrdp._callEventListeners(this,a.data),!0):!1}}};function MediaSourcePlayer(a,b){this._path=a;this._shortpath=b}MediaSourcePlayer.constructor=MediaSourcePlayer;
Object.defineProperties(MediaSourcePlayer.prototype,{classname:{value:"MediaSourcePlayerBridge"},path:{get:function(){return this._shortpath}},OPENING:{value:0},PLAYING:{value:1},PAUSED:{value:2},STOPPED:{value:3},CLOSED:{value:4},MEDIA_UNKNOWN:{value:-1},MEDIA_AUDIO:{value:0},MEDIA_VIDEO:{value:1},MEDIA_TEXT:{value:2},bufferPoolSize:{get:function(){return this._syncData.bufferPoolSize}},state:{get:function(){return this._syncData.state}}});
MediaSourcePlayer.prototype.addEventListener=function(a,b){nrdp._addEventListener(this,a,b)};MediaSourcePlayer.prototype.removeEventListener=function(a,b){nrdp._removeEventListener(this,a,b)};MediaSourcePlayer.prototype._handleEvent=function(a){for(var b in a.data._propups)this._syncData[b]=a.data._propups[b];return"MediaSourcePlayer"==a.name||"PlaybackReporter"==a.name?(a.data.time=a.time,nrdp._callEventListeners(this,a.data),!0):!1};
MediaSourcePlayer.prototype.open=function(a){nrdp._invoke(this._path,"open",a)};MediaSourcePlayer.prototype.play=function(a,b){var c={};void 0!=a&&null!=a&&(c.pts=a);void 0!=b&&null!=b&&(c.openAndPause=b);nrdp._invoke(this._path,"play",c)};MediaSourcePlayer.prototype.stop=function(){nrdp._invoke(this._path,"stop")};MediaSourcePlayer.prototype.pause=function(){nrdp._invoke(this._path,"pause")};MediaSourcePlayer.prototype.unpause=function(){nrdp._invoke(this._path,"unpause")};
MediaSourcePlayer.prototype.skip=function(a){nrdp._invoke(this._path,"skip",{pts:a})};MediaSourcePlayer.prototype.swim=function(a,b,c,d){a={pts:a};"boolean"==typeof b&&(a.absolute=b);"number"!=typeof c||isNaN(c)||(a.fuzz=c);"boolean"==typeof d&&(a.allowRebuffer=d);nrdp._invoke(this._path,"swim",a)};MediaSourcePlayer.prototype.close=function(){nrdp._invoke(this._path,"close")};MediaSourcePlayer.prototype.disableAudio=function(){nrdp._invoke(this._path,"disableAudio")};
MediaSourcePlayer.prototype.enableAudio=function(){nrdp._invoke(this._path,"enableAudio")};MediaSourcePlayer.prototype.getVolume=function(a){nrdp._invoke(this._path,"getVolume")};MediaSourcePlayer.prototype.setVolume=function(a,b,c){nrdp._invoke(this._path,"setVolume",{targetVolume:a,transitionDuration:b,ease:c})};MediaSourcePlayer.prototype.getBufferRange=function(a){nrdp._invoke(this._path,"getBufferRange")};MediaSourcePlayer.prototype.obtainPlaybackStat=function(){nrdp._invoke(this._path,"obtainPlaybackStat")};
nrdp.mediasourceplayerfactory={classname:"MediaSourcePlayerFactoryBridge",_path:"mediasourceplayerfactory",createPlayer:function(a,b){var c="mediasourceplayer"+a;if(nrdp[this._path][c])return b({success:!0,path:c,player:nrdp[this._path][c]}),nrdp[this._path][c];var d=new MediaSourcePlayer(this._path+"."+c,c);nrdp[this._path][c]=d;this._fn("createPlayer",{name:c},function(a){a.success&&(a.path=c,a.player=d);"function"==typeof b&&b(a)});return d},destroyPlayer:function(a,b){var c="mediasourceplayer"+
a;if(nrdp[this._path][c])return delete nrdp[this._path][c],this._fn("destroyPlayer",{name:c},b)},_nextIdx:0,_cbs:{},_fn:function(a,b,c){b||(b={});b.idx=this._nextIdx++;this._cbs[b.idx]=c;nrdp._invoke(this._path,a,b);return b.idx},_handleEvent:function(a){var b,c;return"result"==a.name?(c=a.data.idx,"function"==typeof this._cbs[c]&&(b=this._cbs[c],delete a.data.idx,b(a.data)),delete this._cbs[c],!0):!1}};
nrdp.storage={classname:"StorageBridge",_path:"storage",addEventListener:function(a,b){nrdp._addEventListener(this,a,b)},removeEventListener:function(a,b){nrdp._removeEventListener(this,a,b)},get NO_DEVICE_ACCOUNT(){return"NDAKADN"},get size(){return this._syncData.data?JSON.stringify(this._syncData.data).length:0},get flushCount(){return this._syncData.flushCount},get secureStoreSize(){return this._syncData.secureStoreSize},get transientData(){return this._syncData.transientData},set transientData(a){this._syncData.transientData=
a},length:function(a){a=nrdp.storage._getData(a);var b=0,c;for(c in a)void 0!=a[c]&&b++;return b},key:function(a,b){var c=nrdp.storage._getData(a),d;for(d in c)if(void 0!=c[d]){if(0==b)return d;b--}},_normalizeKey:function(a){return void 0===a?"undefined":null===a?"null":a.toString()},getItem:function(a,b){var c=nrdp.storage;return c._getData(a)[c._normalizeKey(b)]},setItem:function(a,b,c){var d=nrdp.storage,e=d._getData(a);b=d._normalizeKey(b);e[b]=c;nrdp._invoke("storage","setItem",{dak:a,key:b,
value:c})},removeItem:function(a,b){var c=nrdp.storage,d=c._getData(a);b=c._normalizeKey(b);d.hasOwnProperty(b)&&delete d[b];nrdp._invoke("storage","removeItem",{dak:a,key:b})},clear:function(a){nrdp.storage._syncData.data&&delete nrdp.storage._syncData.data[a];nrdp._invoke("storage","clear",{dak:a});nrdp.storage.disk.clear(a)},_clearAll:function(){nrdp.storage._syncData={data:{}};nrdp._invoke("storage","clearAll");nrdp.storage.disk.clearAll()},get disk(){return nrdp.options.ui_cache_capacity&&!this._diskContexts["ui-cache"]?
nrdp.storage.createDiskStoreContext({context:"ui-cache",size:nrdp.options.ui_cache_capacity,encrypted:!0,signature:!0}):nrdp.storage._diskContexts["ui-cache"]},_diskContextPrototype:{size:void 0,valid:void 0,signature:void 0,encrypted:void 0,getSize:function(a){if(!this.valid)throw"getSize called on destroyed context";nrdp.storage._fn("diskStoreGetSize",{context:this.context},a)},create:function(a,b,c,d){if(!this.valid)throw"create called on destroyed context";nrdp.storage._fn("diskStoreCreate",{context:this.context,
dak:a,key:b,value:c},d)},clear:function(a,b){if(!this.valid)throw"clear called on destroyed context";nrdp.storage._fn("diskStoreClear",{context:this.context,dak:a},b)},clearAll:function(a){if(!this.valid)throw"clearAll called on destroyed context";nrdp.storage._fn("diskStoreClearAll",{context:this.context},a)},append:function(a,b,c,d){if(!this.valid)throw"append called on destroyed context";nrdp.storage._fn("diskStoreAppend",{context:this.context,dak:a,key:b,value:c},d)},remove:function(a,b,c){if(!this.valid)throw"remove called on destroyed context";
nrdp.storage._fn("diskStoreRemove",{context:this.context,dak:a,key:b},c)},read:function(a,b,c,d,e){if(!this.valid)throw"read called on destroyed context";nrdp.storage._fn("diskStoreRead",{context:this.context,dak:a,key:b,begin:c||0,end:d||-1},e)},query:function(a,b,c,d){if(!this.valid)throw"query called on destroyed context";nrdp.storage._fn("diskStoreQuery",{context:this.context,dak:a,prefix:b,validate:d},function(a){c&&c(a.keys)})},validate:function(a){if(!this.valid)throw"query called on destroyed context";
nrdp.storage._fn("diskStoreQuery",{context:this.context,validate:!0},function(b){a&&a(b.keys)})},info:function(a){if(!this.valid)throw"info called on destroyed context";nrdp.storage._fn("diskStoreInfo",{context:this.context},function(b){a(b.info)})},corrupt:function(a,b,c,d){if(!this.valid)throw"corrupt called on destroyed context";nrdp.storage._fn("diskStoreCorrupt",{context:this.context,mode:c,dak:a,key:b},d)}},_diskContext:function(a){this.context=a.context;this.encrypted=a.encrypted||!1;this.signature=
a.signature||!1;this.size=a.size;this.valid=!0},createDiskStoreContext:function(a,b){if(!a.context||this._diskContexts.hasOwnProperty(a.context)){var c="Invalid context: "+a.context;nrdp.log.error(c);b&&b({success:!1,error:c})}else{c=nrdp._invoke("storage","diskStoreCreateContext",a);if(c.success)return c=new nrdp.storage._diskContext(a),this._diskContexts[a.context]=c,b&&b({success:!0}),c;b&&b({success:!1,error:c.error})}},destroyDiskStoreContext:function(a,b){var c;c=a instanceof Object?a:this._diskContexts[a];
if(!c||!c.valid)return b&&b({success:!1,error:"destroyDiskStoreContext called on destroyed context"}),!1;c.valid=!1;delete this._diskContexts[c.context];c=nrdp._invoke("storage","diskStoreDestroyContext",{context:c.context});b&&b(c);return c&&c.success},get diskStoreContexts(){return this._diskContexts},_getData:function(a){this._syncData?this._syncData.data||(this._syncData.data={}):this._syncData={data:{}};this._syncData.data[a]||(this._syncData.data[a]={});return this._syncData.data[a]},setPersistentData:function(a,
b,c,d,e){nrdp.storage._fn("setPersistentData",{dak:a,key:b,data:c,deflate:d},e)},unsetPersistentData:function(a,b,c){nrdp.storage._fn("unsetPersistentData",{dak:a,key:b},c)},getPersistentData:function(a,b,c,d){nrdp.storage._fn("getPersistentData",{dak:a,key:b,inflate:c},d)},getFlushCount:function(){nrdp._invoke("storage","getFlushCount")},flush:function(){nrdp._setProperty("storage","transientData",nrdp.storage._syncData.transientData);nrdp._invoke("storage","flush")},getUsedSecureStoreSize:function(){return nrdp._invoke("storage",
"getUsedSecureStoreSize")},_nextIdx:1,_cbs:{},_syncData:{},_diskContexts:{},_fn:function(a,b,c){b||(b={});b.idx=this._nextIdx++;c&&(this._cbs[b.idx]=c);nrdp._invoke("storage",a,b)},_handleEvent:function(a){if(a.data&&a.data.idx){if("function"==typeof this._cbs[a.data.idx])this._cbs[a.data.idx](a.data);delete this._cbs[a.data.idx]}else if("overbudget"==a.name)a.data.type=a.name,nrdp._callEventListeners(this,a.data);else if("flushCount"==a.name)a.data.type=a.name,nrdp._callEventListeners(this,a.data);
else return!1;return!0},_updateProperty:function(a,b){if("diskStoreInfo"===a){var c=this._diskContexts;this._diskContexts={};for(var d in b)if(c.hasOwnProperty(d))this._diskContexts[d]=c[d],delete c[d];else{var e=b[d];e.context=d;this._diskContexts[d]=new nrdp.storage._diskContext(e)}for(var f in c)c[f].valid=!1}else this._syncData[a]=b}};nrdp.storage._diskContext.prototype=nrdp.storage._diskContextPrototype;
nrdp.texttospeech={classname:"TextToSpeechBridge",_path:"texttospeech",addEventListener:function(a,b){nrdp._addEventListener(this,a,b)},removeEventListener:function(a,b){nrdp._removeEventListener(this,a,b)},get languages(){return this._syncData.languages},get language(){return this._syncData.language},set language(a){nrdp._setProperty("texttospeech","language",a)},get voices(){return this._syncData.voices},get voice(){return this._syncData.voice},get rate(){return this._syncData.rate},get pitch(){return this._syncData.pitch},
get capabilities(){return this._syncData.capabilities},VERBOSITY_LOW:0,VERBOSITY_HIGH:1,get verbosity(){return this._syncData.verbosity},say:function(a,b){"string"===typeof a?nrdp.texttospeech._fn("say",{text:a},{cb:b,time:nrdp.mono()}):b&&b("said",a)},stopAndFlush:function(a){nrdp.texttospeech._fn("stopAndFlush",{},a)},silence:function(a,b){0>a?b&&b("said"):nrdp.texttospeech._fn("silence",{ms:a},b)},_nextIdx:1,_cbs:{},_fn:function(a,b,c){b||(b={});b.id=this._nextIdx++;c&&(this._cbs[b.id]=c);nrdp._invoke("texttospeech",
a,b)},_handleEvent:function(a){if(a.data&&a.data.id){var b=this._cbs[a.data.id];"function"===typeof b?(b(a.name,a.data.data),"saying"!==a.name&&delete this._cbs[a.data.id]):"object"===typeof b&&b.hasOwnProperty("time")&&("saying"!==a.name&&delete this._cbs[a.data.id],"function"===typeof b.cb&&(void 0===a.data.data&&(a.data.data={}),a.data.data.elapsed=nrdp.mono()-b.time,b.cb(a.name,a.data.data)))}else return!1;return!0},_syncData:{},_updateProperty:function(a,b){var c;nrdp.isReady&&("capabilities"==
a?c={type:"capabilities",old:this.capabilities}:"language"==a?c={type:"language",old:this.language}:"voice"==a?c={type:"voice",old:this.voice}:"rate"==a?c={type:"rate",old:this.rate}:"pitch"==a?c={type:"pitch",old:this.pitch}:"verbosity"==a&&(c={type:"verbosity",old:this.verbosity}));this._syncData[a]=b;c&&nrdp._callEventListeners(this,c)}};
nrdp.webcrypto={_nextIdx:1,_cbs:{},get authenticationType(){return this._syncData.authenticationType},_fn:function(a,b,c){b||(b={});b.idx=this._nextIdx++;this._cbs[b.idx]=c;nrdp._invoke("webcrypto",a,b);return b.idx},_handleEvent:function(a){var b,c;if("result"!=a.name)return!1;c=a.data.idx;"function"==typeof this._cbs[c]&&(b=this._cbs[c],delete a.data.idx,b(a.data));delete this._cbs[c];return!0},get RAW(){return 0},get PKCS8(){return 1},get SPKI(){return 2},get JWK(){return 3},get ENCRYPT(){return 1},
get DECRYPT(){return 2},get SIGN(){return 4},get VERIFY(){return 8},get DERIVE(){return 16},get WRAP(){return 32},get UNWRAP(){return 64},get SECRET(){return 0},get PUBLIC(){return 1},get PRIVATE(){return 2},get A128GCM(){return 0},get A256GCM(){return 1},setBinary:function(a,b){return nrdp.webcrypto._fn("setBinary",{binary:a},b)},importKey:function(a,b,c,d,e,f){return nrdp.webcrypto._fn("importKey",{data:a,keyformat:b,algorithm:c,extractable:d,usage:e},f)},exportKey:function(a,b,c){return nrdp.webcrypto._fn("exportKey",
{key:a,keyformat:b},c)},getKeyInfo:function(a,b){return nrdp.webcrypto._fn("getKeyInfo",{key:a},b)},digest:function(a,b,c){return nrdp.webcrypto._fn("digest",{data:a,algorithm:b},c)},aesEncrypt:function(a,b,c,d){return nrdp.webcrypto._fn("aesCrypt",{key:a,init:b,data:c,operation:0},d)},aesDecrypt:function(a,b,c,d){return nrdp.webcrypto._fn("aesCrypt",{key:a,init:b,data:c,operation:1},d)},aesCtrCrypt:function(a,b,c,d){return nrdp.webcrypto._fn("aesCtrCrypt",{key:a,init:b,data:c},d)},aesUnwrap:function(a,
b,c,d,e){return nrdp.webcrypto._fn("aesUnwrap",{data:a,algorithm:b,key:c,usage:d},e)},symKeyGen:function(a,b,c,d){return nrdp.webcrypto._fn("symKeyGen",{algorithm:a,extractable:b,usage:c},d)},rsaKeyGen:function(a,b,c,d){return nrdp.webcrypto._fn("rsaKeyGen",{algorithm:a,extractable:b,usage:c},d)},rsaEncrypt:function(a,b,c){return nrdp.webcrypto._fn("rsaCrypt",{key:a,data:b,operation:0},c)},rsaDecrypt:function(a,b,c){return nrdp.webcrypto._fn("rsaCrypt",{key:a,data:b,operation:1},c)},rsaSign:function(a,
b,c,d){return nrdp.webcrypto._fn("rsaSign",{key:a,data:b,algorithm:c},d)},rsaVerify:function(a,b,c,d,e){return nrdp.webcrypto._fn("rsaVerify",{key:a,data:b,algorithm:c,signature:d},e)},dhKeyGen:function(a,b,c,d){return nrdp.webcrypto._fn("dhKeyGen",{algorithm:a,extractable:b,usage:c},d)},dhDerive:function(a,b,c,d,e,f){return nrdp.webcrypto._fn("dhDerive",{basekey:a,peerkey:b,algorithm:c,extractable:d,usage:e},f)},nflxDhDerive:function(a,b,c,d){return nrdp.webcrypto._fn("nflxDhDerive",{basekey:a,peerkey:b,
derivationKey:c},d)},hmac:function(a,b,c,d){return nrdp.webcrypto._fn("hmac",{key:a,data:b,algorithm:c},d)},hmacVerify:function(a,b,c,d,e){return nrdp.webcrypto._fn("hmacVerify",{key:a,data:b,algorithm:c,signature:d},e)},unwrapJwe:function(a,b,c,d,e,f){return nrdp.webcrypto._fn("unwrapJwe",{data:a,key:b,algorithm:c,extractable:d,usage:e},f)},wrapJwe:function(a,b,c,d,e){return nrdp.webcrypto._fn("wrapJwe",{key:a,keytowrap:b,algorithm:c,meth:d},e)},eccSign:function(a,b,c,d){return nrdp.webcrypto._fn("eccSign",
{key:a,data:b,algorithm:c},d)},getKeyByName:function(a,b){return nrdp.webcrypto._fn("getKeyByName",{name:a},b)},persistKeys:function(a,b){return nrdp.webcrypto._fn("persistKeys",{keys:a},b)},deleteKey:function(a,b){return nrdp.webcrypto._fn("deleteKey",{key:a},b)}};
nrdp.websocket={_nextWebSocket:0,_websockets:{},_nextIdx:1,_cbs:[],_fn:function(a,b,c){b||(b={});b.idx=this._nextIdx++;this._cbs[b.idx]=c;nrdp._invoke("websocket",a,b);return b.idx},_handleEvent:function(a){var b;if("result"===a.name){if(!a.data||!a.data.idx)return!1;if("function"===typeof this._cbs[a.data.idx])this._cbs[a.data.idx](a.data);delete this._cbs[a.data.idx]}else if("open"==a.name){b=this._websockets[a.data.websocket];if(!b)return nrdp.log.trace("ws: couldn't find websocket: "+a.data.websocket+
" at: 40","NRDP_SCRIPT"),!0;b._protocol=a.data.protocol;b._url=a.data.url;b._readyState=b.OPEN;"function"===typeof b.onopen&&(nrdp.log.trace("ws: calling "+b._websocket+" onopen()","NRDP_SCRIPT"),b.onopen())}else if("message"==a.name){b=this._websockets[a.data.websocket];if(!b)return nrdp.log.trace("ws: couldn't find websocket: "+a.data.websocket+" at: 53","NRDP_SCRIPT"),!0;b.readyState===b.OPEN&&"function"===typeof b.onmessage&&(nrdp.log.trace("ws: calling "+b._websocket+" onmessage()","NRDP_SCRIPT"),
b.onmessage(a.data))}else if("error"==a.name){b=this._websockets[a.data.websocket];if(!b)return nrdp.log.trace("ws: couldn't find websocket: "+a.data.websocket+" at: 65","NRDP_SCRIPT"),!0;b._readyState=b.CLOSING;"function"===typeof b.onerror&&(nrdp.log.trace("ws: calling "+b._websocket+" onerror()","NRDP_SCRIPT"),b.onerror())}else if("close"==a.name){b=this._websockets[a.data.websocket];if(!b)return nrdp.log.trace("ws: couldn't find websocket: "+a.data.websocket+" at: 76","NRDP_SCRIPT"),!0;b._readyState=
b.CLOSED;delete this._websockets[b._websocket];b.onclose instanceof Function&&(nrdp.log.trace("ws: calling "+b._websocket+" onclose()","NRDP_SCRIPT"),b.onclose());b._websocket=null}else return!1;return!0},_onShutdown:function(){for(var a in nrdp.websocket._websockets)nrdp.websocket._websockets[a].close()},test:function(a,b){this._fn("test",{url:a},b)}};
nrdp.WebSocket=function(a,b){var c=this;nrdp.websocket._nextWebSocket||nrdp.addEventListener("shutdown",nrdp.websocket._onShutdown);this._websocket=++nrdp.websocket._nextWebSocket;nrdp.websocket._websockets[c._websocket]=this;nrdp.websocket._fn("create",{websocket:this._websocket,url:nrdp.gibbon._prepareNetworkRequest(a),protocols:b||""},function(a){a.success&&(c._readyState=c.CONNECTING)})};
nrdp.WebSocket.prototype=function(){return{_websocket:null,_readyState:3,_protocol:"",_url:"",get protocol(){return this._protocol},get url(){return this._url},get URL(){return this._url},get readyState(){return this._readyState},get CONNECTING(){return 0},get OPEN(){return 1},get CLOSING(){return 2},get CLOSED(){return 3},onclose:null,onerror:null,onmessage:null,onopen:null,send:function(a,b){this.readyState===this.OPEN?(b instanceof Object||(b={}),b.message=a,b.websocket=this._websocket,nrdp.websocket._fn("send",
b)):nrdp.log.trace("WebSocket "+this._websocket+" not OPEN","NRDP_SCRIPT")},close:function(){if(this._websocket){var a=this;this._readyState=nrdp.WebSocket.CLOSING;nrdp.websocket._fn("close",{websocket:this._websocket},function(){a._readyState=nrdp.WebSocket.CLOSED})}}}}();
nrdp.cert={http:{addEventListener:function(a,b){nrdp._addEventListener("cert.http",a,b)},removeEventListener:function(a,b){nrdp._removeEventListener("cert.http",a,b)},_nextIdx:0,_cbs:{},_invoke:function(a,b,c,d){c||(c={});c.idx=this._nextIdx++;this._cbs[c.idx]=d;nrdp._invoke(a,b,c)},_handleEvent:function(a){nrdp._callEventListeners("cert.http",{type:a.name,data:a.data});"function"==typeof this._cbs[a.data.idx]&&(this._cbs[a.data.idx](a.data),delete this._cbs[a.data.idx]);return!0},makeRequest:function(a,
b){this._invoke("cert.http","makeRequest",a,b)},openClient:function(){this._invoke("cert.http","openClient")},closeClient:function(){this._invoke("cert.http","closeClient")}}};
nrdp.tile={classname:"TileBridge",_path:"tile",get properties(){return this._syncData.properties},get capabilities(){return nrdp.capabilities.tile},get enabled(){return nrdp.options.tilesEnabled},get errorCodes(){return this._syncData.errorCodes},setSplash:function(a,b){function c(a,c){b&&b({success:!1,error:a,errorCode:c})}a||(a=[]);for(var d=[{name:"width",type:"number"},{name:"height",type:"number"},{name:"data",type:function(a){return a instanceof ArrayBuffer||a instanceof Uint8Array||"string"===
typeof a}}],e=0;e<a.length;++e)for(var f=a[e],g=0;g<d.length;++g){var h=d[g].name;if(f.hasOwnProperty(h)){if(d[g].type instanceof Function?!d[g].type(f[h]):typeof f[h]!=d[g].type){c("Splash property: "+h+" has wrong type",this.errorCodes.InvalidPropertyType);return}if(d[g].maxSize&&f[h].length>d[g].maxSize)f[h]=f[h].substr(0,d[g].maxSize);else if("number"==typeof f[h]&&0>f[h]){c("Invalid integral negative property "+h,this.errorCodes.InvalidPropertyValue);return}}else if(!d[g].optional){c("Splash is missing required field: "+
h,this.errorCodes.RequiredFieldMissing);return}}d=this._nextIdx++;this._cbs[d]=b;nrdp._invoke(this._path,"setSplash",{id:d,splashes:a},function(a){a.success?b&&b({success:!0,errorCode:nrdp.tile.errorCodes.Success}):c(a.error,a.errorCode)})},get configuration(){return this._syncData.configuration},set configuration(a){this._syncData.configuration=a;nrdp._setProperty("tile","configuration",a)},setTiles:function(a,b){function c(a,c){b&&b({success:!1,error:a,errorCode:c})}if(a){if(!(a instanceof Object)){c("Invalid tile type",
this.errorCodes.InvalidTileType);return}if(!(a.groups instanceof Array&&a.groups.length)){c("Invalid tile object, no groups",this.errorCodes.NoTileGroups);return}if(a.groups.length>this.capabilities.maxNumGroups){c("Too many groups",this.errorCodes.GroupMaximumExceeded);return}for(var d=[{name:"url",type:"string",maxSize:1024},{name:"width",type:"number"},{name:"height",type:"number"},{name:"expiry",type:"number"},{name:"title",type:"string",maxSize:50,optional:!0},{name:"description",type:"string",
maxSize:150,optional:!0},{name:"shortText",type:"string",maxSize:150,optional:!0},{name:"deepLink",type:"string",maxSize:4096,optional:!0},{name:"playable",type:"boolean",optional:!0}],e=0;e<a.groups.length;++e){var f=a.groups[e];if(!(f.tiles instanceof Array&&f.tiles.length)){c("Invalid tile group, no tiles in group",this.errorCodes.EmptyTileGroup);return}if(f.tiles.length>this.capabilities.maxTilesPerGroup){c("Too many tiles",this.errorCodes.TileMaximumExceeded);return}for(var g=0;g<f.tiles.length;++g)for(var h=
f.tiles[g],k=0;k<d.length;++k){var l=d[k].name;if(h.hasOwnProperty(l)){if(typeof h[l]!=d[k].type){c("Tile property: "+l+" has wrong type",this.errorCodes.InvalidPropertyType);return}if(d[k].maxSize&&h[l].length>d[k].maxSize)h[l]=h[l].substr(0,d[k].maxSize);else if("number"==typeof h[l]&&0>h[l]){c("Invalid integral negative property "+l,this.errorCodes.InvalidPropertyValue);return}}else if(!d[k].optional){c("Tile is missing required field: "+l,this.errorCodes.RequiredFieldMissing);return}}}}d=this._nextIdx++;
this._cbs[d]=b;nrdp._invoke(this._path,"setTiles",{id:d,tiles:a},function(a){a.success?b&&b({success:!0,errorCode:this.errorCodes.Success}):c(a.error,a.errorCodes)})},validateTiles:function(a){var b=this._nextIdx++;this._cbs[b]=a;nrdp._invoke(this._path,"validateTiles",{id:b})},validateSplash:function(a){var b=this._nextIdx++;this._cbs[b]=a;nrdp._invoke(this._path,"validateSplash",{id:b})},_handleEvent:function(a){var b=this._cbs[a.data.id];delete this._cbs[a.data.id];b instanceof Function&&b(a.data);
return!0},_syncData:{},_nextIdx:1,_cbs:{}};
nrdp.mdx={_path:"mdx",addEventListener:function(a,b){nrdp._addEventListener(this,a,b)},removeEventListener:function(a,b){nrdp._removeEventListener(this,a,b)},_encodedList:[{list:"body url USN friendlyName serviceType location".split(" "),decodeFn:decodeURIComponent},{list:["responseHeaders"],decodeFn:function(a){var b={},c;for(c in a)b[c]=decodeURIComponent(a[c]);return b}}],get NOT_INITIALIZED(){return 0},get INITIALIZED(){return 1},get NOT_ADVERTISING(){return 0},get ADVERTISING(){return 1},get NOT_DISCOVERING(){return 0},
get DISCOVERING(){return 1},get interfaceName(){return this._syncData?this._syncData.interfaceName:void 0},get localIPAddress(){return this._syncData?this._syncData.localIPAddress:void 0},get nativeVersion(){return this._syncData?this._syncData.nativeVersion:void 0},get state(){return this._syncData?this._syncData.state:void 0},MdxConfigure:function(a,b,c,d,e,f){nrdp.mdx._fn("MdxConfigure",{advertisingPeriod:a,advertisingTTL:b,advertisingPort:c,listeningPort:d,numSsdpReplies:e,msgLimit:f})},MdxInit:function(a,
b,c,d,e,f){nrdp.mdx._fn("MdxInit",{host:encodeURIComponent(a),port:b,serviceType:encodeURIComponent(c),uuid:encodeURIComponent(d),asyncHttpRequests:e,webSocketServer:f})},MdxDeinit:function(){nrdp.mdx._fn("MdxDeinit")},AddInterfaceName:function(a){nrdp.mdx._fn("AddInterfaceName",{name:encodeURIComponent(a)})},InterfaceChanged:function(a,b,c,d){nrdp.mdx._fn("InterfaceChanged",{newInterface:encodeURIComponent(a),connected:b,ipaddress:c,ssid:d})},SearchForMdxDevices:function(a,b,c,d){nrdp.mdx._fn("SearchForMdxDevices",
{serviceType:encodeURIComponent(a),headerPatterns:nrdp.mdx._encodeArray(b),mx:c,numSsdpSearches:d})},StopMdxDiscovery:function(a){nrdp.mdx._fn("StopMdxDiscovery",void 0,a)},RevealTargetPresence:function(a){nrdp.mdx._fn("RevealTargetPresence",void 0,a)},SetDeviceReplyHeaders:function(a,b){nrdp.mdx._fn("SetDeviceReplyHeaders",{deviceReplyHeaders:nrdp.mdx._encodeArray(a)},b)},HideTargetPresence:function(a){nrdp.mdx._fn("HideTargetPresence",void 0,a)},StartMdxAdvertising:function(a){nrdp.mdx._fn("StartMdxAdvertising",
void 0,a)},StopMdxAdvertising:function(){nrdp.mdx._fn("StopMdxAdvertising")},SendMdxHttpRequest:function(a,b,c,d,e,f){nrdp.mdx._fn("SendMdxHttpRequest",{url:encodeURIComponent(a),requestType:b,xid:c,curltimeout:d,requestHeader:encodeURIComponent(e),requestBody:encodeURIComponent(f)})},SendSessionMessage:function(a,b,c,d,e,f,g,h,k){nrdp.mdx._fn("SendSessionMessage",{url:encodeURIComponent(a),requestType:b,xid:c,curltimeout:d,context:encodeURIComponent(e),requestHeader:encodeURIComponent(f),requestBody:encodeURIComponent(g),
message:encodeURIComponent(h),plaintext:encodeURIComponent(k)})},SendWebSocketMessage:function(a,b,c){nrdp.mdx._fn("SendWebSocketMessage",{host:encodeURIComponent(a),xid:b,body:encodeURIComponent(c)})},ProcessSessionMessage:function(a,b,c,d,e,f){nrdp.mdx._fn("ProcessSessionMessage",{context:encodeURIComponent(a),xid:b,message:encodeURIComponent(c),messageHmac:encodeURIComponent(d),ciphertext:encodeURIComponent(e)},f)},DialGetDeviceInfo:function(a,b,c,d){nrdp.mdx._fn("DialGetDeviceInfo",{url:encodeURIComponent(a),
USN:encodeURIComponent(b),serviceType:encodeURIComponent(c),timeout:d})},beginContext:function(a,b,c){nrdp.mdx._fn("beginContext",{sharedSecret:a},c)},decrypt:function(a,b,c){nrdp.mdx._fn("decrypt",{context:a,data:b},c)},encrypt:function(a,b,c){nrdp.mdx._fn("encrypt",{context:a,data:b},c)},endContext:function(a,b){nrdp.mdx._fn("endContext",{context:a},b)},hmac:function(a,b,c){nrdp.mdx._fn("hmac",{context:a,data:b},c)},_nextIdx:1,_cbs:[],_fn:function(a,b,c){if(this._syncData)return"function"===typeof c&&
(b||(b={}),b.idx=this._nextIdx++,this._cbs[b.idx]=c),nrdp._invoke("mdx",a,b),b?b.idx:void 0},_isEncodedString:function(a){for(var b in nrdp.mdx._encodedStringList)if(a==nrdp.mdx._encodedStringList[b])return!0;return!1},_decodeEventData:function(a,b){var c,d,e,f,g;g=a[b];if(null!=typeof g)for(c in nrdp.mdx._encodedList)if(nrdp.mdx._encodedList.hasOwnProperty(c))for(e in d=nrdp.mdx._encodedList[c],d.list)if(d.list.hasOwnProperty(e)&&(f=d.list[e],f===b))return d.decodeFn(g);return g},_handleEvent:function(a){var b=
{},c;for(c in a.data)b[c]=nrdp.mdx._decodeEventData(a.data,c);if("returnValue"===a.name){if(!a.data||!a.data.idx)return!1;"function"===typeof this._cbs[a.data.idx]&&(c=this._cbs[a.data.idx],delete this._cbs[a.data.idx],c(b.data,b.data?b.data.idx:void 0))}else nrdp._callEventListeners(this,b);return!0},_encodeArray:function(a){var b=[],c;for(c in a)a.hasOwnProperty(c)&&b.push(encodeURIComponent(a[c]));return b}};
nrdp.system={get bootURL(){return this._syncData.bootUrl},get bootURLTime(){return this._syncData.bootUrlTime},get uiQueryString(){return this._syncData.uiQueryString},set uiQueryString(a){nrdp._setProperty("system","uiQueryString",a)},_handleEvent:function(a){if("keypress"==a.name){var b=-1,c;for(c in nrdpPartner.Keys)if(nrdpPartner.Keys[c]==a.data){b=c;break}if(-1==b)return nrdp.log.warn("Unknown key: "+a.data),!1;nrdp.log.trace("Dispatching key "+a.data+", keycode "+b);null!=window.nrdp_platform&&
null!=window.nrdp_platform.sendKey?nrdp_platform.sendKey(b):(a=document.createEvent("Event"),a.initEvent("keydown",!0,!0),a.which=b,document.dispatchEvent(a),a=document.createEvent("Event"),a.initEvent("keyup",!0,!0),a.which=b,document.dispatchEvent(a));return!0}return!1},_syncData:{}};
nrdp.network={_path:"network",addEventListener:function(a,b){nrdp._addEventListener(this,a,b)},removeEventListener:function(a,b){nrdp._removeEventListener(this,a,b)},CONNTIMEOUT:6E3,DATATIMEOUT:4E3,CONNECTIONSTATE:{CONNECTED:0,DISCONNECTED:1,UNKNOWN:2},get ERRORGROUP(){return this._syncData.ERRORGROUP},get ERRORCODE(){return this._syncData.ERRORCODE},RECOMMENDEDACTION:{RETRY:0,RESTART:1,REACTIVATE:2,MODIFY_DNS:3,REDIRECT_SETTINGS:4,REINSTALL:5,RUNDIAGTOOL:6,LOG_ERROR:7},DNSERRORS:{SUCCESS:0,NODATA:1,
EFORMERR:2,SERVFAIL:3,NOTFOUND:4,NOTIMP:5,REFUSED:6,BADQUERY:7,BADNAME:8,BADFAMILY:9,BADRESP:10,CONNREFUSED:11,TIMEOUT:12,EOF:13,EFILE:14,NOMEM:15,NODNSSERVER:16,OTHER:17},isValidIpAvailable:function(){var a=nrdp.device.iflist,b=!1,c;for(c in a)if(a[c].ipAddress){if(0!=a[c].ipAddress.indexOf("127",0)&&"0.0.0.0"!=a[c].ipAddress&&""!=a[c].ipAddress&&0!=a[c].ipAddress.indexOf("169.254",0)){b=!0;nrdp.log.trace("IP address is "+a[c].ipAddress);break}}else if(a[c].ipv6Addresses&&0<a[c].ipv6Addresses.length){b=
!0;nrdp.log.trace("IPV6 address is "+JSON.stringify(a[c].ipv6Addresses));break}return b},diagnose:function(a){nrdp.network.isValidIpAvailable()?nrdp.network._abortDiagnosis?(nrdp.network._abortDiagnosis=!1,nrdp.network._abortDiagnosisCb(!0)):(nrdp.network._isDiagnoseRunning=!0,nrdp.network._urlList=a,nrdp.network.getOperation(nrdp.options.appboot_url,nrdp.network.CONNTIMEOUT,nrdp.network.DATATIMEOUT,function(a){nrdp.network._nflxUrlCallback(a,nrdp.options.appboot_url)})):(a={URL:"",errorgroup:nrdp.network.ERRORGROUP.NO_IP_ADDRESS,
errorcode:nrdp.network.ERRORCODE.UNKNOWN_ERROR,nativeerrorcode:-1,type:"diagnosisStatus",success:!1},nrdp.log.debug("diagnosis status event "+JSON.stringify(a)),nrdp._callEventListeners(nrdp.network,a),nrdp.network._errorStack.push(a),nrdp.network._sendCompletedEvent(nrdp.network.RECOMMENDEDACTION.REDIRECT_SETTINGS))},abortDiagnosis:function(a){nrdp.network._isDiagnoseRunning&&(nrdp.network._abortDiagnosis=!0,nrdp.network._abortDiagnosisCb=a)},getOperation:function(a,b,c,d){a=nrdp.gibbon._prepareNetworkRequest(a instanceof
Object?a:{url:a});a.connectionTimeout=b;a.timeOut=c;a.idx=++this._nextIdx;nrdp.network._callbacks[a.idx]={cb:d,results:{}};nrdp._invoke("network","get",a)},checkDNS:function(a,b,c){var d=++this._nextIdx;nrdp.network._callbacks[d]={cb:c,results:{}};nrdp._invoke("network","checkdns",{dnsip:a,url:b,idx:d})},useFallbackDnsOnly:function(a){nrdp._invoke("network","useFallbackDnsOnly",{fallback:a})},_handleEvent:function(a){if("INetwork"!=a.name||"dnsresult"!==a.data.type&&"getresult"!==a.data.type)return!1;
var b=this._callbacks[a.data.idx];b&&(delete this._callbacks[a.data.idx],b.cb(a.data));return!0},_sendCompletedEvent:function(a){this._dnsIndex=this._urlIndex=0;this._urlList=[];a={type:"diagnosisResult",resultArray:this._errorStack,recommendedAction:a};this._errorStack=[];this._isDiagnoseRunning=!1;nrdp._callEventListeners(this,a)},_sendAbortCb:function(){this._dnsIndex=this._urlIndex=0;this._urlList=[];this._errorStack=[];this._abortDiagnosis=this._isDiagnoseRunning=!1;nrdp.network._abortDiagnosisCb&&
nrdp.network._abortDiagnosisCb(!0)},_getDomain:function(a){return(a=a.match(/:\/\/(www[0-9]?\.)?(.[^\/:]+)/))?a[2]:""},_dnsCallback:function(a,b){if(this._abortDiagnosis)this._sendAbortCb();else{var c={URL:a.url,errorgroup:this.ERRORGROUP.DNS_CHECK,errorcode:a.result>this.DNSERRORS.NOMEM?this.DNSERRORS.OTHER:a.result,dnsip:b,type:"diagnosisStatus",success:!a.result};nrdp._callEventListeners(this,c);this._errorStack.push(c);if(b==this._googleDNS&&nrdp.device.dnslist.length<this._dnsIndex)this._dnsIndex=
0,this._continueDiag();else if(nrdp.device.dnslist.length>this._dnsIndex){var d=nrdp.device.dnslist[this._dnsIndex++];this.checkDNS(d,c.URL,function(a){nrdp.network._dnsCallback(a,d)})}else this._dnsIndex++,this.checkDNS(this._googleDNS,c.URL,function(a){nrdp.network._dnsCallback(a,nrdp.network._googleDNS)})}},_continueDiag:function(){if(this._abortDiagnosis)this._sendAbortCb();else if(this._urlList.length>this._urlIndex)this.getOperation(this._urlList[this._urlIndex++],this.CONNTIMEOUT,this.DATATIMEOUT,
function(a){nrdp.network._getCallback(a)});else{var a=this.RECOMMENDEDACTION.RETRY,b;for(b in this._errorStack)this._errorStack[b].errorcode==this.ERRORCODE.DNS_ERROR&&a==this.RECOMMENDEDACTION.RETRY?a=this.RECOMMENDEDACTION.REDIRECT_SETTINGS:this._errorStack[b].errorcode==this.ERRORCODE.CERT_STATUS_PEW_REVOKED&&a==this.RECOMMENDEDACTION.RETRY&&(a=this.RECOMMENDEDACTION.REACTIVATE);this._sendCompletedEvent(a)}},_nflxUrlCallback:function(a,b){if(this._isDiagnoseRunning)if(this._abortDiagnosis)this._sendAbortCb();
else{var c={URL:a.url,errorgroup:a.errorgroup,errorcode:a.errorcode,nativeerrorcode:a.nativeerrorcode,type:"diagnosisStatus",success:!a.result};if(c.errorcode==this.ERRORCODE.DNS_ERROR)if(0>=nrdp.device.dnslist.length)c.errorcode=this.ERRORCODE.NO_DNS_SERVER,nrdp._callEventListeners(this,c),this._errorStack.push(c),this._sendCompletedEvent(this.RECOMMENDEDACTION.REDIRECT_SETTINGS);else{nrdp._callEventListeners(this,c);this._errorStack.push(c);var d=nrdp.device.dnslist[this._dnsIndex++];""!=nrdp.network._getDomain(c.URL)?
this.checkDNS(d,nrdp.network._getDomain(c.URL),function(a){nrdp.network._dnsCallback(a,d)}):this._continueDiag()}else nrdp._callEventListeners(this,c),this._errorStack.push(c),this._continueDiag()}},_getCallback:function(a){if(this._isDiagnoseRunning)if(this._abortDiagnosis)this._sendAbortCb();else if(a={URL:a.url,errorgroup:a.errorgroup,errorcode:a.errorcode,nativeerrorcode:a.nativeerrorcode,type:"diagnosisStatus",success:!a.result},nrdp._callEventListeners(this,a),this._errorStack.push(a),this._urlList.length>
this._urlIndex)this.getOperation(this._urlList[this._urlIndex++],this.CONNTIMEOUT,this.DATATIMEOUT,function(a){nrdp.network._getCallback(a)});else{a=this.RECOMMENDEDACTION.RETRY;for(var b in this._errorStack)this._errorStack[b].errorcode==this.ERRORCODE.DNS_ERROR&&a==this.RECOMMENDEDACTION.RETRY?a=this.RECOMMENDEDACTION.REDIRECT_SETTINGS:this._errorStack[b].errorcode==this.ERRORCODE.CERT_STATUS_PEW_REVOKED&&a==this.RECOMMENDEDACTION.RETRY&&(a=this.RECOMMENDEDACTION.REACTIVATE);this._sendCompletedEvent(a)}},
_nextIdx:0,_urlIndex:0,_dnsIndex:0,_urlList:[],_callbacks:{},_errorStack:[],_googleDNS:"8.8.8.8",_netflixDomain:"netflix.com",_isDiagnoseRunning:!1,_abortDiagnosis:!1,_abortDiagnosisCb:0};
nrdp.gibbon={_callback:1,_callbacks:{},_nextPlayerId:1,_nextThreadId:1,_nextWidgetId:1,_nextEffectId:1,_nextImageId:1,_nextChildId:1,_nextAnimId:1,_nextDebugEvent:0,_debugEvents:0,_debugKeyEvents:0,_debugAnimations:0,_debugMouseEvents:0,_debugReplayAnimations:0,_sync_Widget:1,_sync_Effect:2,_sync_Image:3,_sync_Text:4,_sync_Player:5,INT_MAX:2147483647,init:function(a,b){function c(){if(0==d.length)a&&a();else{var b=d.shift();nrdp.gibbon.loadScript({url:b},c)}}var d=b?Array.isArray(b)?b:[b]:[];nrdp.isReady?
c():(nrdp.addEventListener("init",c),nrdp.init())},_proxyObject:function(a,b){function c(c,e){Object.defineProperty(d,c,{enumerable:!0,get:function(){return e},set:function(c){e=c;d._recurse||(d._recurse=!0,a[b]=d,d._recurse=!1)}})}var d={_object:a,_recurse:!1},e=a._defaults?a._defaults(b):a.constructor._defaults[b],f=a._syncData.hasOwnProperty(b)?a._syncData[b]:e;if(!(f instanceof Object))return f;var g=void 0;if(g=e?Object.keys(e):Object.keys(f))for(e=0;e<g.length;++e){var h=g[e];if("_recurse"!=
h){var k=f[h];k&&-1!=h.toLowerCase().indexOf("color")&&(k={r:k.r,g:k.g,b:k.b,a:void 0===k.a?255:k.a});c(h,k)}}return d},get CURL_INIT_ERROR(){return-1},get DEBUGGER_ATTRIBUTE_MODIFIED(){return 1},get DEBUGGER_SUBTREE_MODIFIED(){return 2},get DEBUGGER_NODE_REMOVED(){return 3},fonts:{get entries(){return nrdp.gibbon._syncData.font_entries},set entries(a){nrdp._setProperty("gibbon","fonts",a)},get scripts(){return nrdp.gibbon._syncData.font_scripts},get storeCapacity(){return nrdp.gibbon._syncData.fontStoreCapacity},
attributes:{get NONE(){return 0},get EMBOLDEN(){return 1},get SLANT(){return 2},get MONOSPACE(){return 4},get SYNTHESIZE(){return 8},get SINGLEUSE(){return 16},get HINTING(){return 256},get AUTOHINTER(){return 512},get HINTNORMAL(){return 1024},get HINTLIGHT(){return 2048},get HINTMONO(){return 4096},get HINTLCD(){return 8192},get HINTLCDV(){return 16384}},weight:{get NORMAL(){return 0},get BOLD(){return 1}},style:{get NORMAL(){return 0},get ITALIC(){return 1}},info:{get NORMAL(){return 0},get CACHE(){return 1},
types:{get Url(){return 1},get Buffer(){return 2},get Mmap(){return 3}},get:function(a,b){var c=nrdp.gibbon._setValue(b);void 0===a&&(a=nrdp.gibbon.fonts.info.NORMAL);nrdp._invoke("gibbon","fontManagerInfo",{mode:a,id:c})}},get initialized(){return 2===this._inited},_initFont:function(a,b){nrdp.gibbon._syncData.downloadableFonts||(nrdp.gibbon._syncData.downloadableFonts={});var c=nrdp.gibbon.fonts._makeKey(a.params);nrdp.gibbon._syncData.downloadableFonts[c]=a;var d=a.params&&a.params instanceof Object&&
a.params.priority;void 0===d&&(d=100);var e=!0;a.params&&a.params instanceof Object&&"relayout"in a.params&&!a.params.relayout&&(e=!1);nrdp._invoke("gibbon","loadFont",{key:c,relayout:e,priority:d,font:a.params,fileName:b})},init:function(){if(0==nrdp.gibbon.fonts._inited){nrdp.gibbon.fonts._inited=1;var a=nrdp.gibbon.fonts._store;a?a.query(nrdp.storage.NO_DEVICE_ACCOUNT,"",function(b){var c=Object.keys(b);if(0===c.length)nrdp.gibbon.fonts._inited=2,nrdp._callEventListeners(nrdp.gibbon,{type:"fontsInitialized",
data:{count:0}});else{var d=0,e=0,f=function(){--d||(nrdp.gibbon.fonts._inited=2,nrdp._callEventListeners(nrdp.gibbon,{type:"fontsInitialized",data:{count:e}}))};c.forEach(function(c){var h=function(a,b){return b?a.substr(0,a.length-5):a+"_info"};-1!==c.indexOf("_info",c.length-5)?b.hasOwnProperty(h(c,!0))?(++d,a.read(nrdp.storage.NO_DEVICE_ACCOUNT,c,0,-1,function(b){if(b.success){try{var d=nrdp.utf8toa(b.value),u=JSON.parse(d)}catch(s){a.remove(nrdp.storage.NO_DEVICE_ACCOUNT,h(c,!0));nrdp.log.error("Unable to JSON parse font data from "+
c);f();return}var m=c.substr(0,c.length-5);a.query(nrdp.storage.NO_DEVICE_ACCOUNT,m,function(b){b.hasOwnProperty(m)?(++e,nrdp.gibbon.fonts._initFont(u,b[m].fileName)):(a.remove(nrdp.storage.NO_DEVICE_ACCOUNT,c),nrdp.log.error("Unable to query font store for font "+m));f()},!0)}else a.remove(nrdp.storage.NO_DEVICE_ACCOUNT,h(c,!0)),nrdp.log.error("Unable to read info for "+c),f()})):a.remove(nrdp.storage.NO_DEVICE_ACCOUNT,c):b.hasOwnProperty(h(c,!1))||a.remove(nrdp.storage.NO_DEVICE_ACCOUNT,c)})}}):
(nrdp.gibbon.fonts._inited=2,nrdp._callEventListeners(nrdp.gibbon,{type:"fontsInitialized",data:{count:0}}))}},get _store(){if(!nrdp.gibbon.fonts._storeContext||!nrdp.gibbon.fonts._storeContext.valid){if(!nrdp.gibbon.fonts.storeCapacity||0>nrdp.gibbon.fonts.storeCapacity)return;nrdp.gibbon.fonts._storeContext=nrdp.storage.diskStoreContexts["font-store"]||nrdp.storage.createDiskStoreContext({context:"font-store",size:nrdp.gibbon.fonts.storeCapacity,encrypted:!1,signature:!0})}return nrdp.gibbon.fonts._storeContext},
_makeKey:function(a){return!a instanceof Object||!a.hasOwnProperty("family")||!a.hasOwnProperty("style")||!a.hasOwnProperty("weight")?void 0:a.family+"-"+a.style+"-"+a.weight},_storeContext:void 0,_inited:0},get focused(){return this._syncData.focused},get email(){return this._syncData.email},dnsManager:{info:function(){return nrdp._invoke("gibbon","dnsManagerInfo",void 0)},clear:function(){return nrdp._invoke("gibbon","dnsManagerClear",void 0)}},diskCache:{get capacity(){return nrdp.gibbon._syncData.diskCacheConfiguration?
nrdp.gibbon._syncData.diskCacheConfiguration.capacity:0},get maxPending(){return nrdp.gibbon._syncData.diskCacheConfiguration?nrdp.gibbon._syncData.diskCacheConfiguration.maxPending:0},get writeLimit(){return nrdp.gibbon._syncData.diskCacheConfiguration?nrdp.gibbon._syncData.diskCacheConfiguration.writeLimit:0},set writeLimit(a){nrdp._invoke("gibbon","diskCacheSetWriteLimit",{limit:a})},get catalogTimer(){return nrdp.gibbon._syncData.diskCacheConfiguration?nrdp.gibbon._syncData.diskCacheConfiguration.catalogTimer:
0},get writeSpeed(){return nrdp.gibbon._syncData.diskCacheConfiguration?nrdp.gibbon._syncData.diskCacheConfiguration.writeSpeed:0},insert:function(a,b){a.id=nrdp.gibbon._setValue(b);nrdp._invoke("gibbon","diskCacheInsert",a)},clear:function(a){a=nrdp.gibbon._setValue(a);nrdp._invoke("gibbon","clearDiskCache",{id:a})},clearStats:function(a){a=nrdp.gibbon._setValue(a);nrdp._invoke("gibbon","clearDiskCacheStats",{id:a})},flush:function(a){a=nrdp.gibbon._setValue(a);nrdp._invoke("gibbon","flushDiskCache",
{id:a})},reinit:function(a,b){var c=nrdp.gibbon._setValue(b);nrdp._invoke("gibbon","reinitDiskCache",{spec:a,id:c})},info:function(a,b){a||(a={});a.id=nrdp.gibbon._setValue(b);nrdp._invoke("gibbon","diskCacheInfo",a)},remove:function(a,b){var c=nrdp.gibbon._setValue(b);nrdp._invoke("gibbon","diskCacheRemove",{cacheKey:a,id:c})},purgeExpired:function(a){a=nrdp.gibbon._setValue(a);nrdp._invoke("gibbon","diskCachePurgeExpired",{id:a})},_dump:function(a){a=nrdp.gibbon._setValue(a);nrdp._invoke("gibbon",
"dumpDiskCache",{id:a})}},surfaceCache:{get capacity(){if(nrdp.gibbon._syncData.surfaceCacheCapacity)return nrdp.gibbon._syncData.surfaceCacheCapacity},set capacity(a){nrdp._invoke("gibbon","surfaceCacheSetCapacity",{capacity:a})},info:function(a){a=nrdp.gibbon._setValue(a);nrdp._invoke("gibbon","surfaceCacheInfo",{id:a})}},resourceManager:{get capacity(){return nrdp.gibbon._syncData.resourceManagerCapacity},set capacity(a){nrdp._invoke("gibbon","resourceManagerSetCapacity",{capacity:a})},info:function(a){a=
nrdp.gibbon._setValue(a);nrdp._invoke("gibbon","resourceManagerInfo",{id:a})},disable:function(a){a=nrdp.gibbon._setValue(a);nrdp._invoke("gibbon","resourceManagerDisable",{id:a})},remove:function(a,b){var c=nrdp.gibbon._setValue(b);nrdp._invoke("gibbon","resourceManagerRemove",{id:c,cacheKey:a})},clear:function(a){a=nrdp.gibbon._setValue(a);nrdp._invoke("gibbon","resourceManagerClear",{id:a})},dumpNetwork:function(a){a=nrdp.gibbon._setValue(a);nrdp._invoke("gibbon","dumpNetwork",{id:a})},getNetworkStatistics:function(a,
b){var c=nrdp.gibbon._setValue(b);a||(a={});a.id=c;nrdp._invoke("gibbon","getNetworkStatistics",a)},options:{get maxTotalConnections(){return nrdp.gibbon._syncData.resourceManagerOptions.maxTotalConnections},get maxHostConnections(){return nrdp.gibbon._syncData.resourceManagerOptions.maxHostConnections},get maxPipelineLength(){return nrdp.gibbon._syncData.resourceManagerOptions.maxPipelineLength},set maxTotalConnections(a){nrdp._invoke("gibbon","resourceManagerSetOption",{maxTotalConnections:a})},
set maxHostConnections(a){nrdp._invoke("gibbon","resourceManagerSetOption",{maxHostConnections:a})},set maxPipelineLength(a){nrdp._invoke("gibbon","resourceManagerSetOption",{maxPipelineLength:a})}}},get debugFlags(){return this._syncData.debugFlags},get password(){return this._syncData.password},get imageFormats(){return this._syncData.imageFormats},localeInfo:function(a){return nrdp._invoke("gibbon","localeInfo",{locale:a})},get sendSyncObjectDestroy(){return this._syncData.sendSyncObjectDestroy},
set sendSyncObjectDestroy(a){a!=this.sendSyncObjectDestroy&&(this._syncData._sendSyncObjectDestroy=a,nrdp._setProperty("gibbon","sendSyncObjectDestroy",a))},set defaultLocale(a){nrdp.log.error("nrdp.gibbon.defaultLocale has been deprecated!")},set defaultDirection(a){nrdp.log.error("nrdp.gibbon.defaultDirection has been deprecated!")},get garbageCollectTimeout(){return this._syncData.garbageCollectTimeout},set garbageCollectTimeout(a){nrdp._setProperty("gibbon","garbageCollectTimeout",a)},get prefetchUrls(){return this._syncData.prefetchUrls},
get prefetchKey(){return this._syncData.prefetchKey},get effectivePrefetchUrls(){return this._syncData.effectivePrefetchUrls},set prefetchUrls(a){!a||a instanceof Object?(this._syncData.prefetchUrls=a,nrdp._setProperty("gibbon","prefetchUrls",a)):nrdp.log.error("Invalid prefetch urls")},_path:"gibbon",addEventListener:function(a,b){nrdp._addEventListener(this,a,b)&&"syncObjectDestroy"==a&&(nrdp.gibbon.sendSyncObjectDestroy=!0)},removeEventListener:function(a,b){nrdp._removeEventListener(this,a,b)},
get effects(){return this.capabilities.effects},get capabilities(){return nrdp.capabilities.gibbon},setStat:function(a,b){nrdp._invoke("gibbon","setStat",{name:a,value:b})},get cookie(){return this._syncData?this._syncData.cookie:""},set cookie(a){nrdp._invoke("gibbon","setCookie",{cookie:a})},setCookie:function(a,b){var c=nrdp.gibbon._setValue(b);nrdp._invoke("gibbon","setCookie",{cookie:a,id:c})},_createAnimation:function(a,b,c,d,e,f,g){f?!0===f&&(f="append"):f="start";b instanceof Object&&b.relative&&
(b.relative=b.relative._id);a={value:c,animate:{start:b,end:c,duration:d,ease:e,reason:f,flags:g}};"stop"!=f&&(a.animate.id=nrdp.gibbon._nextAnimId++);return a},_loadSplash:function(a){if(/^https?:/.test(nrdp.options.splash_screen)&&!nrdp.gibbon._splashUrl){var b=nrdp.options.splash_screen;if(a&&a.url&&a.url.length){var c=nrdp.storage.transientData||{};c.splash=a;nrdp.storage.transientData=c}else nrdp.storage.transientData&&(a=nrdp.storage.transientData.splash),a&&a.url&&a.url.length||(a={url:b});
nrdp.gibbon._splashUrl=a.url;nrdp.gibbon.loadScript(a,function(a){a.exception||200!=a.statusCode?(nrdp.log.info("falling back to splash screen "+b),nrdp.gibbon._splashUrl=b,nrdp.gibbon.loadScript({url:b})):nrdp.gibbon.sync()})}},get locations(){var a;"undefined"!==typeof nrdp_platform&&"function"===typeof nrdp_platform.location?(a=nrdp_platform.location(),a=a.url,a instanceof Array||(a=[a])):a=[this._syncData.location];this._baseUrl&&(a[0]=this._baseUrl);return a},get location(){var a=this._baseUrl;
a||(a=this.locations[0]);return a},set location(a){this._baseUrl=void 0;nrdp._setProperty("gibbon","location",nrdp.gibbon._prepareNetworkRequest(a))},get _locationCount(){var a;a="undefined"!==typeof nrdp_platform&&"function"===typeof nrdp_platform.location?nrdp_platform.location():this._syncData.location;return"object"==typeof a?a.count:0},get queryParams(){var a=this._syncData.queryParams;return a?a:this._syncData.queryParams=nrdp.gibbon._parseQueryParams(this.location)},loaded:function(){nrdp._invoke("gibbon",
"uiLoaded")},startTask:function(a,b,c){!c&&nrdp.gibbon.debugFlags.debugScriptEvents&&(c=nrdp.backtrace());a=nrdp.gibbon._setValue({callback:a,name:c});nrdp._invoke("gibbon","startTask",{id:a,name:c,priority:b});nrdp.gibbon.debugFlags.debugScriptEvents&&nrdp.log.error("StartTask "+a);return a},stopTask:function(a){void 0!==nrdp.gibbon._getValue(a)&&(nrdp.gibbon.debugFlags.debugScriptEvents&&nrdp.log.error("StopTask "+a),nrdp.gibbon._deleteValue(a),nrdp._invoke("gibbon","stopTask",{id:a}))},setTimeout:function(a,
b,c,d){if("number"!==typeof b)nrdp.log.error("Invalid timer!");else{!d&&nrdp.gibbon.debugFlags.debugScriptEvents&&(d=nrdp.backtrace());void 0===c&&(c=!0);a={callback:a,singleShot:c,interval:b,name:d};var e=nrdp.gibbon._setValue(a);nrdp._invoke("gibbon","startTimer",{id:e,singleShot:c,interval:b,name:d});nrdp.gibbon.debugFlags.logZeroTimeouts&&0===b&&(nrdp.log.info("Created["+e+"]: "+c+"::"+b,"TIMER"),nrdp.stacktrace().split("\n").forEach(function(a){nrdp.log.info(a,"TIMER")}));nrdp.gibbon.debugFlags.debugScriptEvents&&
nrdp.log.error("StartTimer "+JSON.stringify(a));return e}},clearTimeout:function(a){void 0!==nrdp.gibbon._getValue(a)&&(nrdp.gibbon.debugFlags.debugScriptEvents&&nrdp.log.error("StopTimer "+a),nrdp.gibbon._deleteValue(a),nrdp._invoke("gibbon","stopTimer",{id:a}))},garbageCollect:function(a,b){var c=a?nrdp.gibbon._setValue(a):0;nrdp._invoke("gibbon","garbageCollect",{id:c,type:b})},eval:function(a,b){return nrdp._invoke("gibbon","eval",{script:a,file:b})},get defaultNetworkTimeout(){return nrdp.gibbon._syncData.defaultNetworkTimeouts.timeout},
set defaultNetworkTimeout(a){nrdp.gibbon._syncData.defaultNetworkTimeouts.timeout=a;nrdp.gibbon._updateTimeouts()},get defaultConnectTimeout(){return nrdp.gibbon._syncData.defaultNetworkTimeouts.connectTimeout},set defaultConnectTimeout(a){nrdp.gibbon._syncData.defaultNetworkTimeouts.connectTimeout=a;nrdp.gibbon._updateTimeouts()},get defaultIpv4FallbackConnectTimeout(){return nrdp.gibbon._syncData.defaultIpv4FallbackConnectTimeout.connectTimeout},set defaultIpv4FallbackConnectTimeout(a){nrdp.gibbon._syncData.defaultIpv4FallbackConnectTimeout.connectTimeout=
a;nrdp.gibbon._updateTimeouts()},get defaultDnsTimeout(){return nrdp.gibbon._syncData.defaultNetworkTimeouts.dnsTimeout},set defaultDnsTimeout(a){nrdp.gibbon._syncData.defaultNetworkTimeouts.dnsTimeout=a;nrdp.gibbon._updateTimeouts()},get defaultDnsIpV4FallbackTimeout(){return nrdp.gibbon._syncData.defaultNetworkTimeouts.dnsIpV4FallbackTimeout},set defaultDnsIpV4FallbackTimeout(a){nrdp.gibbon._syncData.defaultNetworkTimeouts.dnsIpV4FallbackTimeout=a;nrdp.gibbon._updateTimeouts()},get defaultLowSpeedTime(){return nrdp.gibbon._syncData.defaultNetworkTimeouts.lowSpeedTime},
set defaultLowSpeedTime(a){nrdp.gibbon._syncData.defaultNetworkTimeouts.lowSpeedTime=a;nrdp.gibbon._updateTimeouts()},get defaultLowSpeedLimit(){return nrdp.gibbon._syncData.defaultNetworkTimeouts.lowSpeedLimit},set defaultLowSpeedLimit(a){nrdp.gibbon._syncData.defaultNetworkTimeouts.lowSpeedLimit=a;nrdp.gibbon._updateTimeouts()},_updateTimeouts:function(){nrdp._setProperty("gibbon","defaultNetworkTimeouts",nrdp.gibbon._syncData.defaultNetworkTimeouts)},get HTTP2_OPT_IN(){return 0},get HTTP2_OPT_OUT(){return 1},
get HTTP2_FORCE_IN(){return 2},get HTTP2_FORCE_OUT(){return 3},get http2Mode(){return nrdp.gibbon._syncData.http2Mode},set http2Mode(a){nrdp.gibbon._syncData.http2Mode=a;nrdp._setProperty("gibbon","http2Mode",a)},_resolveDepends:function(a){if(a instanceof Object&&a.dependsOn instanceof Object)if(a.dependsOn instanceof nrdp.gibbon.Image)a.dependsOn=a.dependsOn.src;else if(a.dependsOn instanceof nrdp.gibbon.Effect){var b=a.dependsOn.params;b instanceof Object?a.dependsOn=b.image instanceof Object?
b.image.url:b.image:delete a.dependsOn}},_load:function(a,b){a.url=this._resolveUrl(a.url);a.id=nrdp.gibbon._setValue({callback:b,url:a.url});a=nrdp.gibbon._prepareNetworkRequest(a);nrdp._invoke("gibbon","startRequest",a);nrdp.gibbon.debugFlags.debugScriptEvents&&nrdp.log.error("StartRequest "+a.id+"@"+a.url);return a.id},load:function(a,b){if("object"!==typeof a)return"function"===typeof b&&b({}),-1;a.eval=!1;void 0===a.async&&(a.async=!0);return nrdp.gibbon._load(a,b)},loadScript:function(a,b){if("object"!==
typeof a)return"function"===typeof b&&b({}),-1;a.eval=!0;void 0===a.async&&(a.async=!1);return nrdp.gibbon._load(a,b)},stopLoad:function(a){nrdp.gibbon._deleteValue(a);nrdp.gibbon.debugFlags.debugScriptEvents&&nrdp.log.error("StopRequest "+a);nrdp._invoke("gibbon","stopRequest",{id:a});return a},get ipVersionRules(){return nrdp.gibbon._syncData.ipVersionRules},set ipVersionRules(a){nrdp.gibbon._syncData||(nrdp.gibbon._syncData={});nrdp.log.trace("Setting ipVersionRules: "+JSON.stringify(a,null,4));
nrdp.gibbon._syncData.ipVersionRules=a},_prepareNetworkRequest:function(a){if(void 0===a)return a;a instanceof Object?a.url=nrdp.gibbon._resolveUrl(a.url):a=nrdp.gibbon._resolveUrl(a);if(!(a instanceof Object&&void 0!==a.ipv6||"dual"!==nrdp.device.ipConnectivityMode)){var b=!0;if(nrdp.gibbon._syncData.ipVersionRules instanceof Array){var b=!1,c=nrdp.gibbon._syncData.ipVersionRules.length,d=a instanceof Object?a.url:a,e=nrdp.gibbon._hostNameFromUrl(d);if(0<c&&e)for(var f=0;f<c;++f){var g=nrdp.gibbon._syncData.ipVersionRules[f];
if(g instanceof Function){if(g(e,d)){b=!0;nrdp.log.trace("Rule "+f+" (function) matched "+e+" "+d);break}}else if(g instanceof RegExp){if(g.exec(e)){nrdp.log.trace("Rule "+f+" (regexp) matched "+e+" "+d);b=!0;break}}else if(g===e){nrdp.log.trace("Rule "+f+" (string) matched "+e+" "+d);b=!0;break}}}b&&(a instanceof Object?a.ipv6=!1:a={url:a,ipv6:!1})}return a},addInjectJS:function(a,b){nrdp._invoke("gibbon","addInjectJS",{js:a,options:b})},removeInjectJS:function(a){nrdp._invoke("gibbon","removeInjectJS",
{url:a})},setAtlasSize:function(a,b,c){nrdp._invoke("gibbon","setAtlasSize",{group:a,width:b,height:c})},setGlyphAtlasSize:function(a,b){nrdp._invoke("gibbon","setGlyphAtlasSize",{width:a,height:b})},sync:function(){nrdp._invoke("gibbon","sync")},beginPendingSync:function(){nrdp._invoke("gibbon","beginPendingSync")},endPendingSync:function(){nrdp._invoke("gibbon","endPendingSync")},_parseQueryParams:function(a){var b={};if(a){var c=a.indexOf("?");0<c&&a.substr(c+1).split("&").forEach(function(a){a&&
(a=a.split("="),b[a[0]]=1<a.length?decodeURIComponent(a[1]):!0)})}return b},_parseColor:function(a){if("string"===typeof a){if(a.length)return a}else if(a instanceof Object)return{r:a.r,g:a.g,b:a.b,a:a.a}},_compareColor:function(a,b){return a&&b&&a instanceof Object&&b instanceof Object?a.r==b.r&&a.g==b.g&&a.b==b.b&&a.a==b.a:a==b},_encodeColor:function(a){if(a instanceof Object){var b=0;a.r&&(b|=(a.r&255)<<16);a.g&&(b|=(a.g&255)<<8);a.b&&(b|=(a.b&255)<<0);void 0===a.a?b|=-16777216:a.a&&(b|=(a.a&255)<<
24);return b}return a},_needPendingSync:function(){return nrdp.gibbon._pendingSync},_addDOMBreakpoint:function(a,b){void 0===nrdp.gibbon._breaks&&(nrdp.gibbon._breaks={});void 0==nrdp.gibbon._breaks[a]&&(nrdp.gibbon._breaks[a]={});nrdp.gibbon._breaks[a][b]=function(){nrdp.log.error("calling debugger!");debugger}},_removeDOMBreakpoint:function(a,b){var c=function(a){for(var b in a)if(void 0!==a[b])return!0;return!1};delete nrdp.gibbon._breaks[a][b];c(nrdp.gibbon._breaks[a])||delete nrdp.gibbon._breaks[a];
c(nrdp.gibbon._breaks)||(nrdp.gibbon._breaks=void 0)},_debugObject:function(a,b,c){if("object"===typeof a){var d=!1;a instanceof Array&&(d=!0);var e=[],f,g,h,k,l;for(l in a)f=typeof a[l],g=void 0,"object"===f?(a[l]instanceof Array?g="array":a[l]instanceof Date?g="date":a[l]instanceof RegExp&&(g="regexp"),h=!0):h=!1,k=d?b+"["+l+"]":b+"."+l,e.push({name:l,value:{objectId:h?k+":"+c:void 0,type:f,subtype:g,description:"object"===typeof a[l]?a[l]instanceof Array?"Array["+a[l].length+"]":a[l]instanceof
Date?"Date":a[l]instanceof RegExp?"RegExp":"Object":a[l]+""}});return e}},get widgets(){function a(c){if(c){b[c._name]=c;for(var d=0;d<c.children.length;++d)a(c.children[d])}}var b={};a(nrdp.gibbon.scene.root);a(nrdp.gibbon.scene.overlay);return b},findWidget:function(a){var b;if(nrdp.gibbon.scene.root&&(b=nrdp.gibbon.scene.root.findWidget(a))||nrdp.gibbon.scene.overlay&&(b=nrdp.gibbon.scene.overlay.findWidget(a)))return b},makeWidget:function(a){function b(a){var e;!a||"number"!==typeof a.id||a.id<
nrdp.gibbon._nextWidgetId||(e=a.id,nrdp.gibbon._nextWidgetId=e+1);void 0===e&&(e=nrdp.gibbon._nextWidgetId++,e>nrdp.gibbon.INT_MAX&&(e=1));var f=new nrdp.gibbon.Widget(e);c[e]=f;if(a)for(var g in a)if("children"==g)for(var h in a.children)b(a.children[h]).parent=f;else if("animations"==g)for(var k in a.animations)f.animate(a.animations[k].property,a.animations[k].duration,a.animations[k].ease);else if("effects"==g)for(var l in a.effects)for(eproperty2 in e=f.addEffect(a.effects[l].type,a.effects[l].params),
a.effects[l])"type"!=eproperty2&&"params"!=eproperty2&&(e[eproperty2]=a.effects[l][eproperty2]);else if("images"==g)for(var u in a.images)f.addImage(a.images[u].background,a.images[u]);else if("parent"==g||"clone"==g)if(a[g]instanceof nrdp.gibbon.Widget)f[g]=a[g];else{e=a[g];var s=nrdp.gibbon.findWidget(e);void 0===s&&(s=c[e]);f[g]=s}else"image"==g?f.addForegroundImage(a[g]):"backgroundImage"==g?f.addBackgroundImage(a[g]):f[g]=a[g];return f}var c=[];return b(a)},dump:function(a){nrdp.gibbon.scene.dump(a)},
_hookProperty:function(a,b,c){var d=Object.getOwnPropertyDescriptor(a,b),e=Object.create(d);e.set=function(a){c.call(this,a,d.set)};Object.defineProperty(a,b,e)},startFpsTimer:function(){nrdp._invoke("gibbon","startFpsTimer")},stopFpsTimer:function(){nrdp._invoke("gibbon","stopFpsTimer")},getRenderedFps:function(a){a=nrdp.gibbon._setValue(a);nrdp._invoke("gibbon","getRenderedFps",{id:a})},getHeapSize:function(a){if(nrdp.ps3&&nrdp.ps3.getMemoryStats)nrdp.ps3.getMemoryStats(function(b){var d=nrdp.gibbon._setValue(function(d){d.systemallocated=
b.heap.mmap.used+b.heap.used;d.systemused=b.heap.mmap.total+b.heap.total;a(d)});nrdp._invoke("gibbon","getHeapSize",{id:d})});else{var b=nrdp.gibbon._setValue(a);nrdp._invoke("gibbon","getHeapSize",{id:b})}},moveMouse:function(a,b){nrdp._invoke("gibbon","moveMouse",{x:a,y:b})},widgetsAt:function(a,b,c){c=nrdp.gibbon._setValue(c);nrdp._invoke("gibbon","widgetsAt",{x:a,y:b,id:c})},reloadFonts:function(){nrdp._invoke("gibbon","reloadFonts")},_fontTTFCallback:function(a,b){if(nrdp.gibbon._syncData.downloadableFonts.hasOwnProperty(a)){var c=
nrdp.gibbon._syncData.downloadableFonts[a],d=c.params;d.hasOwnProperty("attributes")||(d.attributes=nrdp.gibbon.fonts.attributes.HINTING|nrdp.gibbon.fonts.attributes.HINTNORMAL);if(0!==b.errorcode||200>b.statusCode||300<=b.statusCode||!b.data.byteLength)c.callback&&c.callback({success:!1,error:"Error in download of TTF"}),delete nrdp.gibbon._syncData.downloadableFonts[a];else{var e=d&&d instanceof Object&&!0==d.persist,f=d&&d instanceof Object&&d.priority;void 0===f&&(f=100);var g=!0;c.params&&c.params instanceof
Object&&"relayout"in c.params&&!c.params.relayout&&(g=!1);if(e){var h=nrdp.gibbon.fonts._store;h?h.create(nrdp.storage.NO_DEVICE_ACCOUNT,a,b.data,function(b){b.success?(h.query(nrdp.storage.NO_DEVICE_ACCOUNT,a,function(b){if(b.hasOwnProperty(a)){b=b[a].fileName;var e=c.callback;delete c.callback;e=nrdp.gibbon._setValue(e);nrdp._invoke("gibbon","loadFont",{id:e,relayout:g,priority:f,key:a,font:d,fileName:b})}else c.callback&&c.callback({success:!1,error:"Unable to query font from font store"}),delete nrdp.gibbon._syncData.downloadableFonts[a]},
!0),h.create(nrdp.storage.NO_DEVICE_ACCOUNT,a+"_info",JSON.stringify(c))):(c.callback&&c.callback({success:!1,error:"Unable to store font in font store"}),delete nrdp.gibbon._syncData.downloadableFonts[a])}):(c.callback&&c.callback({success:!1,error:"Font store could not be created"}),delete nrdp.gibbon._syncData.downloadableFonts[a])}else e=c.callback,delete c.callback,e=nrdp.gibbon._setValue(e),nrdp._invoke("gibbon","loadFont",{id:e,relayout:g,priority:f,key:a,font:d,data:b.data})}}},addFont:function(a,
b){if(a instanceof Object)if(nrdp.gibbon._syncData.downloadableFonts||(nrdp.gibbon._syncData.downloadableFonts={}),a.hasOwnProperty("request")&&a.request instanceof Object){var c=nrdp.gibbon.fonts._makeKey(a);void 0===c?b&&b({success:!1,error:"Unable to make font key"}):nrdp.gibbon._syncData.downloadableFonts.hasOwnProperty(c)?b&&b({success:!1,error:"Font exists"}):(a.request.format="arraybuffer",a._key=c,nrdp.gibbon._syncData.downloadableFonts[c]={callback:b,params:a},nrdp.gibbon.load(a.request,
function(a){nrdp.gibbon._fontTTFCallback(c,a)}))}else b&&b({success:!1,error:"Request missing"});else b&&b({success:!1,error:"Params is not an object"})},removeFont:function(a,b){if(nrdp.gibbon._syncData.downloadableFonts){var c=nrdp.gibbon.fonts._makeKey(a);if(void 0===c&&b)b({success:!1,error:"Unable to make font key"});else if(nrdp.gibbon._syncData.downloadableFonts.hasOwnProperty(c)){delete nrdp.gibbon._syncData.downloadableFonts[c];var d=nrdp.gibbon.fonts._store;d.remove(nrdp.storage.NO_DEVICE_ACCOUNT,
c);d.remove(nrdp.storage.NO_DEVICE_ACCOUNT,c+"_info");c=!0;"relayout"in a&&!a.relayout&&(c=!1);d=nrdp.gibbon._setValue(b);nrdp._invoke("gibbon","removeFont",{relayout:c,family:a.family,weight:a.weight,style:a.style,id:d})}else b&&b({success:!1,error:"No such font: "+c})}else b&&b({success:!1,error:"No downloadable fonts"})},cpuProfileStart:function(a){nrdp._invoke("gibbon","cpuProfileStart",{profileId:a})},cpuProfileStop:function(a,b){var c=nrdp.gibbon._setValue(b);nrdp._invoke("gibbon","cpuProfileStop",
{id:c,profileId:a})},_runConsole:function(a){nrdp._invoke("gibbon","runConsole",{command:a})},get _baseUrl(){if(this._baseUrlVar)return this._baseUrlVar.url},set _baseUrl(a){if(a){var b=a,c=b.indexOf("?");-1!=c&&(b=b.substr(0,c));c=b.lastIndexOf("/");-1!=c&&(b=b.substr(0,c+1));this._baseUrlVar={dir:b,url:a}}else this._baseUrlVar=void 0},_hostNameFromUrl:function(a){if(a){var b=a.indexOf("://");if(-1!==b){var c=a.indexOf("/",b+3),d=a.indexOf(":",b+3);-1!=d&&(-1==c||d<c)&&(c=d);return-1===c?a.substr(b+
3,d):a.substring(b+3,c)}}},_resolveUrl:function(a){if(this._baseUrlVar&&"string"==typeof a&&-1==a.indexOf("://")&&0!=a.indexOf("data:")){var b=this._baseUrlVar.dir;if("/"==a[0]){var c=b.indexOf("/",8);-1!=c&&(b=b.substr(0,c))}return b+a}return a},_syncData:{debugFlags:{}},_updateProperty:function(a,b){if("networkErrorCodes"==a||"networkErrorGroups"==a)for(var c in b)nrdp.gibbon[c]=b[c];else{var d;"location"==a?this._syncData.queryParams=void 0:"fonts"==a?(d={type:"fontschange"},nrdp.gibbon._syncData.font_scripts=
b.scripts,delete b.scripts,a="font_entries"):nrdp.isReady&&"cookie"==a&&nrdp.gibbon.cookie!=b?d={type:"cookiechange",old:nrdp.gibbon.cookie}:"diskCacheConfiguration"==a&&b&&b.writeSpeed!=this.diskCache.writeSpeed&&(d={type:"writeSpeedMeasured",writeSpeed:b.writeSpeed});this._syncData[a]=b;d&&nrdp._callEventListeners(this,d)}},sendKey:function(a,b){var c=a.type,d;a:{d=a.name;if(nrdp.nrdpPartner&&nrdp.nrdpPartner.Keys)for(var e in nrdp.nrdpPartner.Keys)if(nrdp.nrdpPartner.Keys[e]==d){d=parseInt(e);
break a}d=void 0}nrdp._callEventListeners(this,{type:"key",data:{type:c,code:d,uiEvent:a.name,userData:b}})},_handleEvent:function(a){var b=!0,c;if("gibbonEvent"==a.name)if(c=a.data.type,"click"==c||"press"==c||"release"==c){var d={type:"key",time:a.time,data:a.data};if(nrdp.gibbon._debugKeyEvents){var e=a.data.repeat?"repeat":c,f=nrdp.mono();void 0===nrdp.gibbon._keyEventLastMonoTime&&(nrdp.gibbon._keyEventLastMonoTime=f);e+=": "+(f-nrdp.gibbon._keyEventLastMonoTime);nrdp.gibbon._keyEventLastMonoTime=
f;void 0===nrdp.gibbon._keyEventLastTime&&(nrdp.gibbon._keyEventLastTime=a.data.time);e+=" ("+(a.time-nrdp.gibbon._keyEventLastTime)+":"+(f-a.time)+")";nrdp.gibbon._keyEventLastTime=a.time;nrdp.log.error("Sending keyevent("+nrdp.gibbon._debugKeyEvents++ +"): "+e+" ["+JSON.stringify(a)+"]")}nrdpPartner&&nrdpPartner.Keys&&!d.data.uiEvent&&(d.data.uiEvent=nrdpPartner.Keys[d.data.code]);"click"==c&&(d.data.type="press",nrdp._callEventListeners(this,d),a.data.repeat?d=0:d.data.type="release");d&&nrdp._callEventListeners(this,
d)}else if("focusChange"==c)nrdp.gibbon._syncData.focused=a.data.focus,nrdp._callEventListeners(this,{type:"focus",time:a.time,data:a.data});else if("mouseChange"==c)nrdp._callEventListeners(this,{type:"mouse",time:a.time,data:a.data});else if("mouseMove"==c||"mousePress"==c||"mouseRelease"==c){if(nrdp.gibbon._debugMouseEvents)for(nrdp.log.error("Sending mouseevent("+nrdp.gibbon._debugKeyEvents++ +"): @ "+a.data.global.x+","+a.data.global.y),c=0;c<a.data.widgets.length;++c)nrdp.log.error(" + "+a.data.widgets[c].id+
" @ "+a.data.widgets[c].x+","+a.data.widgets[c].y);if(a.data.widgets)for(c=0;c<a.data.widgets.length;++c)a.data.widgets[c].widget=nrdp.gibbon.findWidget(a.data.widgets[c].id);nrdp._callEventListeners(this,{type:"mouse",time:a.time,data:a.data})}else if("touchMove"==c||"touchPress"==c||"touchRelease"==c){if(a.data.widgets)for(c=0;c<a.data.widgets.length;++c)a.data.widgets[c].widget=nrdp.gibbon.findWidget(a.data.widgets[c].id);nrdp._callEventListeners(this,{type:"touch",time:a.time,data:a.data})}else nrdp.log.error("unhandled gibbonEvent "+
c);else if("requestFinished"==a.name)c=this._getValue(a.data.id),a.data.refresh&&"refresh"!=a.data.state||this._deleteValue(a.data.id),a.data.parsed&&a.data.xml&&nrdp._fixXml(a.data.xml),c&&void 0!==c.callback&&c.callback(a.data);else if("ipv4Failover"==a.name)nrdp._callEventListeners(this,{type:"ipv4Failover",data:a.data});else if("task"==a.name)a=a.data,c=this._getValue(a),void 0!==c&&(void 0!==c.callback&&c.callback(),this._deleteValue(a));else if("timer"==a.name)a=a.data,c=this._getValue(a),void 0!==
c&&(void 0!==c.callback&&c.callback(),c.singleShot&&this._deleteValue(a));else if("getRenderedFps"==a.name||"diskCacheCleared"==a.name||"diskCacheStatsCleared"==a.name||"diskCacheFlushed"==a.name||"diskCacheReinited"==a.name||"diskCacheDumped"==a.name||"diskCacheInfo"==a.name||"diskCacheInsert"==a.name||"diskCachePurgeExpired"==a.name||"diskCacheRemove"==a.name||"garbageCollected"==a.name||"hash"==a.name||"networkDumped"==a.name||"widgetsAt"==a.name||"heapsize"==a.name||"networkStatistics"==a.name||
"resourceManagerDisable"==a.name||"resourceManagerInfo"==a.name||"resourceManagerRemove"==a.name||"resourceManagerClear"==a.name||"setCookie"==a.name||"cpuProfile"==a.name||"fontLoaded"==a.name||"fontRemoved"==a.name||"fontManagerInfo"==a.name||"surfaceCacheInfo"==a.name){c=this._getValue(a.data.id);if(void 0!==c)if("widgetsAt"==a.name){if(a.data.widgets)for(d=0;d<a.data.widgets.length;++d)a.data.widgets[d].widget=nrdp.gibbon.findWidget(a.data.widgets[d].id);c(a.data)}else"getRenderFps"==a.name?c(a.data.fps):
"heapsize"==a.name||"cpuProfile"==a.name?c(a.data):"diskCacheDumped"==a.name?c(a.data.dump,a.data.stats):"networkStatistics"==a.name?c(a.data.statistics):"diskCacheInfo"==a.name||"fontLoaded"==a.name||"fontRemoved"==a.name?c(a.data.data):"diskCacheInsert"==a.name||"diskCacheRemove"==a.name||"resourceManagerRemove"==a.name?c(a.data.success):"diskCachePurgeExpired"==a.name?c(a.data.count):"hash"==a.name?c(a.data.hash):"networkDumped"==a.name?c(a.data.requests):"surfaceCacheInfo"==a.name||"fontManagerInfo"==
a.name||"resourceManagerInfo"==a.name?c(a.data.info):c();this._deleteValue(a.data.id)}else"capacityReached"==a.name?nrdp._callEventListeners(this,{type:"capacityReached",data:a.data}):"codepointMissing"==a.name?nrdp._callEventListeners(this,{type:"codepointMissing",data:a.data}):"syncObjectDestroy"==a.name?nrdp._callEventListeners(this,{type:"syncObjectDestroy",data:a.data}):"diskCacheWriteLimiter"==a.name?nrdp._callEventListeners(this,{type:"diskCacheWriteLimiter",data:a.data}):b=!1;return b},_setValue:function(a){do++nrdp.gibbon._callback,
nrdp.gibbon._callback>=nrdp.gibbon.INT_MAX&&(nrdp.gibbon._callback=1);while(void 0!==nrdp.gibbon._callbacks[nrdp.gibbon._callback]);a&&(a.id=nrdp.gibbon._callback);nrdp.gibbon._callbacks[nrdp.gibbon._callback]=a;return nrdp.gibbon._callback},_getValue:function(a){return nrdp.gibbon._callbacks[a]},_deleteValue:function(a){delete nrdp.gibbon._callbacks[a]},_invoke:function(a,b,c){nrdp._invoke("gibbon","invoke",{subObject:a,subMethod:b,subArgs:c})},addSocketizerConditions:function(a){nrdp._invoke("gibbon",
"addSocketizerConditions",{conditions:a})},_hash:function(a,b){var c=a instanceof Object?a:{url:a};c.id=nrdp.gibbon._setValue(b);nrdp._invoke("gibbon","hash",c)}};
nrdp.addEventListener("init",function(){nrdp.log.createArea("WIDGET_ZERO_DURATION","widget|gibbon",{warning:!0});var a=nrdp.js_options.gibbon;a&&a.debug&&(a.debug.events&&(nrdp.gibbon._debugEvents=1),a.debug.keyEvents&&(nrdp.gibbon._debugKeyEvents=1),a.debug.mouseEvents&&(nrdp.gibbon._debugMouseEvents=1),a.debug.animations&&(nrdp.gibbon._debugAnimations=1),a.debug.replayAnimations&&(nrdp.gibbon._debugReplayAnimations=1));nrdp.gibbon.location!=nrdp.system.bootURL&&nrdp.gibbon._loadSplash();nrdp.gibbon.fonts.init()});
nrdp.addEventListener("factoryReset",function(){nrdp.gibbon&&nrdp.gibbon._syncData&&(nrdp.gibbon._syncData.downloadableFonts={})});
nrdp.describeEvent=function(a){if(a&&"Event"==a.type){if("animationFinished"==a.name)return"animationFinished:"+a.data.id;if("timer"==a.name&&"nrdp.gibbon"==a.object){var b=nrdp.gibbon._getValue(a.data);b||(b=a.data);return"timer:"+JSON.stringify(b)}if("task"==a.name&&"nrdp.gibbon"==a.object)return b=nrdp.gibbon._getValue(a.data),b||(b=a.data),"task:"+JSON.stringify(b);if("requestFinished"==a.name&&"nrdp.gibbon"==a.object)return b=nrdp.gibbon._getValue(a.data.id),b||(b=a.data.id),"requestFinished:"+
JSON.stringify(b);if("gibbonEvent"==a.name&&"nrdp.gibbon"==a.object)return"gibbonEvent:"+JSON.stringify(a.data)}return nrdp._describeEvent(a)};nrdp._sendSyncdEvent=function(a,b,c){if(nrdp.gibbon.debugFlags.debugScriptEvents||nrdp.gibbon._debugEvents){var d=nrdp.mono();++nrdp.gibbon._nextDebugEvent;nrdp.log.error("Sending event("+nrdp.gibbon._nextDebugEvent+") "+nrdp.describeEvent(c));a.call(b,c);nrdp.log.error("~Sending event("+nrdp.gibbon._nextDebugEvent+") "+(nrdp.mono()-d))}else a.call(b,c)};
"undefined"===typeof nrdpPartner&&(nrdpPartner={});
nrdp.gibbon.scene={classname:"ScreenBridge",_callbacks:{},_nextCallbackId:1,addEventListener:function(a,b){nrdp._addEventListener(this,a,b)},removeEventListener:function(a,b){nrdp._removeEventListener(this,a,b)},get suspend(){return void 0===this._suspendPending?this._syncData.suspend:this._suspendPending},set suspend(a){a!=this.suspend&&(void 0===this._suspendPending&&(this._syncData.suspend=a,nrdp._setProperty("gibbon.scene","suspend",a)),this._suspendPending=a)},get widget(){return this.root},
set widget(a){this.root=a},get root(){var a=this._syncData.root;return"object"===typeof a?a:null},set root(a){a&&this.root&&a._id==this.root._id||(this._syncData.root=a,nrdp._setProperty("gibbon.scene","root",a?a._id:void 0),this._rootChanged())},get overlay(){var a=this._syncData.overlay;return"object"===typeof a?a:null},set overlay(a){a&&this.overlay&&a._id==this.overlay._id||(this._syncData.overlay=a,nrdp._setProperty("gibbon.scene","overlay",a?a._id:void 0))},get scale(){return this._syncData.scale},
get width(){return this._syncData.width},get height(){return this._syncData.height},dump:function(a){this.widget.dump(a)},grab:function(a,b){var c=this._registerCallback(a);nrdp._invoke("gibbon.scene","grab",{id:c,options:b})},update:function(a){nrdp._invoke("gibbon.scene","update",{id:a?a._id:this.widget._id})},_rootChanged:function(){nrdp._hasEventListener(this,"rootChanged")&&nrdp._callEventListeners(this,{type:"rootChanged"})},_handleEvent:function(a){if("grab"==a.name)return this._callCallback(a),
!0;if("suspendChanged"==a.name){this._syncData.suspend=a.data.suspended;nrdp._callEventListeners(this,{type:a.name,data:a.data});if(void 0!==this._suspendPending){var b=this._suspendPending;this._suspendPending=void 0;b!==a.data.suspended&&(this.suspend=b)}return!0}return!1},_registerCallback:function(a){var b=this._nextCallbackId++;this._callbacks[b]=a;return b},_callCallback:function(a){if(void 0!==a.data.id){var b=this._callbacks[a.data.id];delete this._callbacks[a.data.id];b&&b(a.data.data)}}};
nrdp.gibbon.Widget=function(a){this._object=new GibbonSyncObject(this,a,nrdp.gibbon._sync_Widget);this._id=a;this._animations={pending:{}};this._name=nrdp.gibbon.Widget._createName(this._id);this._path="nrdp.gibbon.widgets."+this._name;this._children=[];this._callbacks={};this._syncData={};this._properties=nrdp._classes[this.classname].properties.byName};nrdp.gibbon.Widget._createName=function(a){return"widget"+a};nrdp.gibbon.Widget.ALIGN_LEFT=1;nrdp.gibbon.Widget.ALIGN_RIGHT=2;
nrdp.gibbon.Widget.ALIGN_CENTER_HORIZONTAL=4;nrdp.gibbon.Widget.ALIGN_TOP=16;nrdp.gibbon.Widget.ALIGN_BOTTOM=32;nrdp.gibbon.Widget.ALIGN_CENTER_VERTICAL=64;
nrdp.gibbon.Widget._encodeAlignment=function(a){var b;if(a instanceof Array)for(var c=b=0;c<a.length;++c)b|=this._encodeAlignment(a[c]);else if("string"===typeof a)for(b=0,a=a.split(" "),c=0;c<a.length;++c){var d=a[c];"right"==d?b|=nrdp.gibbon.Widget.ALIGN_RIGHT:"left"==d?b|=nrdp.gibbon.Widget.ALIGN_LEFT:"top"==d?b|=nrdp.gibbon.Widget.ALIGN_TOP:"bottom"==d?b|=nrdp.gibbon.Widget.ALIGN_BOTTOM:"center"==d||"center-both"==d?b=b|nrdp.gibbon.Widget.ALIGN_CENTER_HORIZONTAL|nrdp.gibbon.Widget.ALIGN_CENTER_VERTICAL:
"center-horizontal"==d?b|=nrdp.gibbon.Widget.ALIGN_CENTER_HORIZONTAL:"center-vertical"==d&&(b|=nrdp.gibbon.Widget.ALIGN_CENTER_VERTICAL)}else b=a;return b};
nrdp.gibbon.Widget._defaults={push_warnedPendingSync:!1,effects:void 0,name:void 0,tooltip:void 0,x:void 0,y:void 0,width:void 0,height:void 0,minWidth:void 0,minHeight:void 0,maxWidth:void 0,maxHeight:void 0,padding:{left:0,top:0,bottom:0,right:0,wrap:0},layout:void 0,parent:void 0,layoutStretch:0,layoutSpacing:0,opacity:1,backface:!0,rotateX:0,rotateY:0,rotateZ:0,drawOrder:0,scale:void 0,scaleX:1,scaleY:1,scaleZ:1,clip:!0,cache:void 0,mirror:void 0,opaque:!1,erase:!1,video:!1,visible:!0,loadImages:void 0,
smoothScale:!1,sendRenderProperties:!1,sendAnimationFinished:!1,backgroundColor:{r:0,g:0,b:0,a:0},scrollX:0,scrollY:0,transformOriginX:0,transformOriginY:0,plane:0};
nrdp.gibbon.Widget.prototype={classname:"WidgetBridge",constructor:nrdp.gibbon.Widget,_describe:function(){var a;a=this.name?this.name:"UNNAMED";return a+="("+this._id+")"},value:function(a){var b=this._syncData.hasOwnProperty(a)?this._syncData[a]:this._defaults?this._defaults(a):this.constructor._defaults[a];if(void 0===b&&"mirror"==a){for(var c=this.parent;void 0===b&&c;c=c.parent)c._syncData.hasOwnProperty(a)&&(b=c._syncData[a]);void 0===b&&(b=nrdp.options.screen_mirror?!0:nrdp.gibbon.debugFlags.testWidgetMirror?
!0:!1)}return void 0!==b?b:nrdp.gibbon.Widget._defaults[a]},get effects(){return this._effects},addEffect:function(a,b){this._effects||(this._effects={});var c=nrdp.gibbon._nextEffectId++;c>nrdp.gibbon.INT_MAX&&(c=1);c=new nrdp.gibbon.Effect(this,a,c);b&&(c.params=b);return this._effects[c._name]=c},removeEffect:function(a){var b=a;a instanceof Object&&(b=a._id);for(var c in this._effects)if(this._effects[c]._id==b){nrdp.gibbon._invoke(this._path,"removeEffect",{effect:b});delete this._effects[c];
break}},findWidget:function(a){if("number"===typeof a){if(this._id==a)return this}else if(this.name==a)return this;for(var b=0;b<this._children.length;++b){var c=this._children[b].findWidget(a);if(c)return c}},addEventListener:function(a,b){if(nrdp._addEventListener(this,a,b))if("renderpropertychange"==a)this.sendRenderProperties=!0;else if("animationFinished"==a)this.sendAnimationFinished=!0;else if("imageLoaded"==a||"backgroundImageLoaded"==a){var c="imageLoaded"==a?this.image:this.backgroundImage;
c._widgetImageLoadedHandler||(c._widgetImageLoadedHandler=function(b){nrdp._callEventListeners(c._widget,{type:a,data:b.data})},c.addEventListener("imageLoaded",c._widgetImageLoadedHandler))}},removeEventListener:function(a,b){nrdp._removeEventListener(this,a,b)},_sendRenderProperty:function(a,b,c){nrdp._callEventListeners(this,{type:"renderpropertychange",property:a,renderProperty:b,value:c});void 0!==nrdp.gibbon._breaks&&this._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED)},_renderProperty:function(a){this.sendRenderProperties||
(nrdp.log.error("RenderProperty("+a+"): Used but WIDGET("+this._id+") has not set sendRenderProperties!"),this.sendRenderProperties=!0);return this._syncData.hasOwnProperty(a)?this._syncData[a]:this._defaults?this._defaults(a):this.constructor._defaults[a]},get sendRenderProperties(){return this._syncData.hasOwnProperty("sendRenderProperties")?this._syncData.sendRenderProperties:this._defaults?this._defaults("sendRenderProperties"):this.constructor._defaults.sendRenderProperties},set sendRenderProperties(a){a!=
this.sendRenderProperties&&(this._text&&(this._text.sendRenderProperties=a),this._syncData.sendRenderProperties=a,this._object.setSyncProperty(this._properties.sendRenderProperties,a),void 0!==nrdp.gibbon._breaks&&this._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED))},get sendAnimationFinished(){return this._syncData.hasOwnProperty("sendAnimationFinished")?this._syncData.sendAnimationFinished:this._defaults?this._defaults("sendAnimationFinished"):this.constructor._defaults.sendAnimationFinished},
set sendAnimationFinished(a){a!=this.sendAnimationFinished&&(this._syncData.sendAnimationFinished=a,this._object.setSyncProperty(this._properties.sendAnimationFinished,a),void 0!==nrdp.gibbon._breaks&&this._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED))},get color(){return this.backgroundColor},set color(a){this.backgroundColor=a},get backgroundColor(){return this._syncData.hasOwnProperty("backgroundColor")?this._syncData.backgroundColor:this._defaults?this._defaults("backgroundColor"):this.constructor._defaults.backgroundColor},
set backgroundColor(a){void 0===a&&(a={r:0,g:0,b:0,a:0});a=nrdp.gibbon._parseColor(a);nrdp.gibbon._compareColor(a,this._syncData.hasOwnProperty("backgroundColor")?this._syncData.backgroundColor:this._defaults?this._defaults("backgroundColor"):this.constructor._defaults.backgroundColor)||(this._syncData.backgroundColor=a,this._object.setSyncProperty(this._properties.backgroundColor,nrdp.gibbon._encodeColor(a)),void 0!==nrdp.gibbon._breaks&&this._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED))},
get padding(){return this._syncData.hasOwnProperty("padding")?this._syncData.padding:this._defaults?this._defaults("padding"):this.constructor._defaults.padding},set padding(a){var b=a,c=this._syncData.hasOwnProperty("padding")?this._syncData.padding:this._defaults?this._defaults("padding"):this.constructor._defaults.padding;if(a instanceof Object){if(c instanceof Object&&a.top==c.top&&a.left==c.left&&a.bottom==c.bottom&&a.right==c.right&&a.wrap==c.wrap)return;a={top:a.top,left:a.left,bottom:a.bottom,
right:a.right,wrap:a.wrap};b=[a.top,a.left,a.bottom,a.right,a.wrap]}else if("number"==typeof a){if(a==c)return}else return;this._syncData.padding=a;this._object.setSyncProperty(this._properties.padding,b);void 0!==nrdp.gibbon._breaks&&this._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED)},get name(){return this._syncData.hasOwnProperty("name")?this._syncData.name:this._defaults?this._defaults("name"):this.constructor._defaults.name},set name(a){"number"==typeof a&&(a+="");a&&!a.length&&(a=void 0);
a!=this.name&&(this._syncData.name=a,this._object.setSyncProperty(this._properties.name,a),void 0!==nrdp.gibbon._breaks&&this._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED))},get tooltip(){return this._syncData.hasOwnProperty("tooltip")?this._syncData.tooltip:this._defaults?this._defaults("tooltip"):this.constructor._defaults.tooltip},set tooltip(a){"number"==typeof a&&(a+="");a&&!a.length&&(a=void 0);a!=this.tooltip&&(this._syncData.tooltip=a,this._object.setSyncProperty(this._properties.tooltip,
a),void 0!==nrdp.gibbon._breaks&&this._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED))},get image(){void 0===this._image&&(this._image=this.addForegroundImage());return this._image},get backgroundImage(){void 0===this._backgroundImage&&(this._backgroundImage=this.addBackgroundImage());return this._backgroundImage},get images(){return this._images},addForegroundImage:function(a){return this.addImage(!1,a)},addBackgroundImage:function(a){return this.addImage(!0,a)},addImage:function(a,b){this._images||
(this._images={});var c=nrdp.gibbon._nextImageId++;c>nrdp.gibbon.INT_MAX&&(c=1);c=new nrdp.gibbon.Image(this,a,c);if(b)for(var d in b)c[d]=b[d];this._images[c._name]=c;a?this._backgroundImage||(this._backgroundImage=c):this._image||(this._image=c);return c},removeImage:function(a){var b=a;a instanceof Object&&(b=a._id);a._background?this._backgroundImage&&this._backgroundImage._id==b&&(this._backgroundImage=void 0):this._image&&this._image._id==b&&(this._image=void 0);for(var c in this._images)if(this._images[c]._id==
b){nrdp.gibbon._invoke(this._path,"removeImage",{image:b});delete this._images[c];break}},get renderX(){return this._renderProperty("renderX")},get renderY(){return this._renderProperty("renderY")},get renderWidth(){return this._renderProperty("renderWidth")},get renderHeight(){return this._renderProperty("renderHeight")},get renderTextLines(){return this.text.renderLines},get renderTextFirstLine(){return this.text.renderFirstLine},get drawOrder(){return this._syncData.hasOwnProperty("drawOrder")?
this._syncData.drawOrder:this._defaults?this._defaults("drawOrder"):this.constructor._defaults.drawOrder},set drawOrder(a){a!=this.drawOrder&&(this._syncData.drawOrder=a,this._object.setSyncProperty(this._properties.drawOrder,a),void 0!==nrdp.gibbon._breaks&&this._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED))},get minHeight(){return this._syncData.hasOwnProperty("minHeight")?this._syncData.minHeight:this._defaults?this._defaults("minHeight"):this.constructor._defaults.minHeight},set minHeight(a){a!=
this.minHeight&&(this._syncData.minHeight=a,this._object.setSyncProperty(this._properties.minHeight,a),void 0!==nrdp.gibbon._breaks&&this._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED))},get minWidth(){return this._syncData.hasOwnProperty("minWidth")?this._syncData.minWidth:this._defaults?this._defaults("minWidth"):this.constructor._defaults.minWidth},set minWidth(a){a!=this.minWidth&&(this._syncData.minWidth=a,this._object.setSyncProperty(this._properties.minWidth,a),void 0!==nrdp.gibbon._breaks&&
this._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED))},get maxHeight(){return this._syncData.hasOwnProperty("maxHeight")?this._syncData.maxHeight:this._defaults?this._defaults("maxHeight"):this.constructor._defaults.maxHeight},set maxHeight(a){a!=this.maxHeight&&(this._syncData.maxHeight=a,this._object.setSyncProperty(this._properties.maxHeight,a),void 0!==nrdp.gibbon._breaks&&this._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED))},get maxWidth(){return this._syncData.hasOwnProperty("maxWidth")?
this._syncData.maxWidth:this._defaults?this._defaults("maxWidth"):this.constructor._defaults.maxWidth},set maxWidth(a){a!=this.maxWidth&&(this._syncData.maxWidth=a,this._object.setSyncProperty(this._properties.maxWidth,a),void 0!==nrdp.gibbon._breaks&&this._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED))},get loadImages(){return this._syncData.hasOwnProperty("loadImages")?this._syncData.loadImages:this._defaults?this._defaults("loadImages"):this.constructor._defaults.loadImages},set loadImages(a){a!=
this.loadImages&&(this._syncData.loadImages=a,this._object.setSyncProperty(this._properties.loadImages,a),void 0!==nrdp.gibbon._breaks&&this._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED))},get visible(){return this._syncData.hasOwnProperty("visible")?this._syncData.visible:this._defaults?this._defaults("visible"):this.constructor._defaults.visible},set visible(a){a!=this.visible&&(this._syncData.visible=a,this._object.setSyncProperty(this._properties.visible,a),nrdp.gibbon.scene.root&&nrdp.gibbon.scene.root._id==
this._id&&nrdp.gibbon.scene._rootChanged(),void 0!==nrdp.gibbon._breaks&&this._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED))},get backface(){return this._syncData.hasOwnProperty("backface")?this._syncData.backface:this._defaults?this._defaults("backface"):this.constructor._defaults.backface},set backface(a){a!=this.backface&&(this._syncData.backface=a,this._object.setSyncProperty(this._properties.backface,a),void 0!==nrdp.gibbon._breaks&&this._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED))},
get smoothScale(){return this._syncData.hasOwnProperty("smoothScale")?this._syncData.smoothScale:this._defaults?this._defaults("smoothScale"):this.constructor._defaults.smoothScale},set smoothScale(a){a!=this.smoothScale&&(this._syncData.smoothScale=a,this._object.setSyncProperty(this._properties.smoothScale,a),void 0!==nrdp.gibbon._breaks&&this._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED))},get hidden(){return!this.visible},set hidden(a){this.visible=!a},get opacity(){var a=this._syncData.hasOwnProperty("opacity")?
this._syncData.opacity:this._defaults?this._defaults("opacity"):this.constructor._defaults.opacity;return a&&a instanceof Object?a.value:a},set opacity(a){isNaN(a)?a=void 0:1<a?a=1:0>a&&(a=0);a!=this.opacity&&(this._setAnimatedValue("opacity",a),void 0!==nrdp.gibbon._breaks&&this._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED))},get rotateX(){var a=this._syncData.hasOwnProperty("rotateX")?this._syncData.rotateX:this._defaults?this._defaults("rotateX"):this.constructor._defaults.rotateX;return a&&
a instanceof Object?a.value:a},set rotateX(a){a!=this.rotateX&&(this._setAnimatedValue("rotateX",a),void 0!==nrdp.gibbon._breaks&&this._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED))},get rotateY(){var a=this._syncData.hasOwnProperty("rotateY")?this._syncData.rotateY:this._defaults?this._defaults("rotateY"):this.constructor._defaults.rotateY;return a&&a instanceof Object?a.value:a},set rotateY(a){a!=this.rotateY&&(this._setAnimatedValue("rotateY",a),void 0!==nrdp.gibbon._breaks&&this._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED))},
get rotateZ(){var a=this._syncData.hasOwnProperty("rotateZ")?this._syncData.rotateZ:this._defaults?this._defaults("rotateZ"):this.constructor._defaults.rotateZ;return a&&a instanceof Object?a.value:a},set rotateZ(a){a!=this.rotateZ&&(this._setAnimatedValue("rotateZ",a),void 0!==nrdp.gibbon._breaks&&this._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED))},get clone(){return this._syncData.hasOwnProperty("clone")?this._syncData.clone:this._defaults?this._defaults("clone"):this.constructor._defaults.clone},
set clone(a){"number"===typeof a&&(a=nrdp.gibbon.findWidget(a));if(a||this.clone)a&&this.clone&&a._id==this.clone._id||(this._syncData.clone=a,this._object.setSyncProperty(this._properties.clone,a?a._id:void 0),void 0!==nrdp.gibbon._breaks&&this._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED))},_addChild:function(a){this._children.push(a)},_removeChild:function(a){for(var b in this._children)if(this._children[b]._id==a._id){this._children.splice(b,1);break}},get _isRoot(){return nrdp.gibbon.scene.root&&
nrdp.gibbon.scene.root._id==this._id||nrdp.gibbon.scene.overlay&&nrdp.gibbon.scene.overlay._id==this._id?!0:!1},get children(){return this._children},get parent(){return this._syncData.hasOwnProperty("parent")?this._syncData.parent:this._defaults?this._defaults("parent"):this.constructor._defaults.parent},set parent(a){"number"===typeof a&&(a=nrdp.gibbon.findWidget(a));if(a||this.parent)a&&this.parent&&a._id==this.parent._id||(this.parent&&this.parent._removeChild(this),a?(this._syncData.parent=a,
this._object.setSyncProperty(this._properties.parent,[a._id,nrdp.gibbon._nextChildId++]),a._addChild(this)):(this._syncData.parent=a,this._object.setSyncProperty(this._properties.parent,a)),void 0!==nrdp.gibbon._breaks&&a._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED))},get scale(){var a=this._syncData.hasOwnProperty("scale")?this._syncData.scale:this._defaults?this._defaults("scale"):this.constructor._defaults.scale;if(void 0===a){if(a=this.scaleX,a==this.scaleY)return a}else return a&&a instanceof
Object?a.value:a},set scale(a){var b=this._syncData.hasOwnProperty("scale")?this._syncData.scale:this._defaults?this._defaults("scale"):this.constructor._defaults.scale;if(b!==a){if(void 0===b&&(b=this.scaleX,b==this.scaleY&&b==a))return;this._setAnimatedValue("scale",a);void 0!==nrdp.gibbon._breaks&&this._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED)}},get scaleX(){var a=this._syncData.hasOwnProperty("scaleX")?this._syncData.scaleX:this._defaults?this._defaults("scaleX"):this.constructor._defaults.scaleX;
return a&&a instanceof Object?a.value:a},set scaleX(a){a!=this.scaleX&&(this._setAnimatedValue("scaleX",a),void 0!==nrdp.gibbon._breaks&&this._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED))},get scaleY(){var a=this._syncData.hasOwnProperty("scaleY")?this._syncData.scaleY:this._defaults?this._defaults("scaleY"):this.constructor._defaults.scaleY;return a&&a instanceof Object?a.value:a},set scaleY(a){a!=this.scaleY&&(this._setAnimatedValue("scaleY",a),void 0!==nrdp.gibbon._breaks&&this._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED))},
get scaleZ(){var a=this._syncData.hasOwnProperty("scaleZ")?this._syncData.scaleZ:this._defaults?this._defaults("scaleZ"):this.constructor._defaults.scaleZ;return a&&a instanceof Object?a.value:a},set scaleZ(a){a!=this.scaleZ&&(this._setAnimatedValue("scaleZ",a),void 0!==nrdp.gibbon._breaks&&this._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED))},get text(){this._text||(this._text=new nrdp.gibbon.Text(this),this._text.sendRenderProperties=this.sendRenderProperties);return this._text},set text(a){if(a&&
a instanceof Object)for(var b in a)void 0!==a[b]&&(this.text[b]=a[b]);else this.text.contents=a;void 0!==nrdp.gibbon._breaks&&this._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED)},get clip(){return this._syncData.hasOwnProperty("clip")?this._syncData.clip:this._defaults?this._defaults("clip"):this.constructor._defaults.clip},set clip(a){a!=this.clip&&(this._syncData.clip=a,this._object.setSyncProperty(this._properties.clip,a),void 0!==nrdp.gibbon._breaks&&this._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED))},
get mirror(){return this._syncData.hasOwnProperty("mirror")?this._syncData.mirror:this._defaults?this._defaults("mirror"):this.constructor._defaults.mirror},set mirror(a){a!=this.mirror&&(this._syncData.mirror=a,this._object.setSyncProperty(this._properties.mirror,a),void 0!==nrdp.gibbon._breaks&&this._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED))},get cache(){return this._syncData.hasOwnProperty("cache")?this._syncData.cache:this._defaults?this._defaults("cache"):this.constructor._defaults.cache},
set cache(a){a!=this.cache&&(this._syncData.cache=a,this._object.setSyncProperty(this._properties.cache,a),void 0!==nrdp.gibbon._breaks&&this._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED))},get textFirstLine(){return this._text?this._text.firstLine:nrdp.gibbon.Text._default.firstLine},set textFirstLine(a){this.text.firstLine=a},get textCursorPosition(){return this._text?this._text.cursorPosition:nrdp.gibbon.Text._default.cursorPosition},set textCursorPosition(a){this.text.cursorPosition=a},
get textStyle(){return this.text},set textStyle(a){if(this.textStyle!=a){void 0!==a._widget&&a._widget!==this&&nrdp.log.error("CopyTextStyle("+this._id+"): From different WIDGET("+a._widget._id+")!");for(var b in a)void 0!==a[b]&&(this.text[b]=a[b])}},get transformOriginX(){return this._syncData.hasOwnProperty("transformOriginX")?this._syncData.transformOriginX:this._defaults?this._defaults("transformOriginX"):this.constructor._defaults.transformOriginX},set transformOriginX(a){a!=this.transformOriginX&&
(this._syncData.transformOriginX=a,this._object.setSyncProperty(this._properties.transformOriginX,a),void 0!==nrdp.gibbon._breaks&&this._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED))},get transformOriginY(){return this._syncData.hasOwnProperty("transformOriginY")?this._syncData.transformOriginY:this._defaults?this._defaults("transformOriginY"):this.constructor._defaults.transformOriginY},set transformOriginY(a){a!=this.transformOriginY&&(this._syncData.transformOriginY=a,this._object.setSyncProperty(this._properties.transformOriginY,
a),void 0!==nrdp.gibbon._breaks&&this._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED))},get scrollX(){var a=this._syncData.hasOwnProperty("scrollX")?this._syncData.scrollX:this._defaults?this._defaults("scrollX"):this.constructor._defaults.scrollX;return a&&a instanceof Object?a.value:a},set scrollX(a){a!=this.scrollX&&(this._setAnimatedValue("scrollX",a),void 0!==nrdp.gibbon._breaks&&this._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED))},get scrollY(){var a=this._syncData.hasOwnProperty("scrollY")?
this._syncData.scrollY:this._defaults?this._defaults("scrollY"):this.constructor._defaults.scrollY;return a&&a instanceof Object?a.value:a},set scrollY(a){a!=this.scrollY&&(this._setAnimatedValue("scrollY",a),void 0!==nrdp.gibbon._breaks&&this._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED))},get erase(){return this._syncData.hasOwnProperty("erase")?this._syncData.erase:this._defaults?this._defaults("erase"):this.constructor._defaults.erase},set erase(a){a!=this.erase&&(this._syncData.erase=
a,this._object.setSyncProperty(this._properties.erase,a),void 0!==nrdp.gibbon._breaks&&this._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED))},get video(){return this.player?this.player.name.length?this.player.name:!0:!1},set video(a){this.player=a},get player(){return this._player},set player(a){var b;if(a&&a instanceof Object){if(this._player&&this._player.name!=a.name&&this.removePlayer(),a.name){this._player||(b=nrdp.gibbon._nextPlayerId++,b>nrdp.gibbon.INT_MAX&&(b=1),this._player=new nrdp.gibbon.Player(this,
a.name,b));for(var c in a)void 0!==a[c]&&"name"!=c&&(this._player[c]=a[c])}}else a?(this._player&&this._player.name!=a&&this.removePlayer(),this._player||(b=nrdp.gibbon._nextPlayerId++,b>nrdp.gibbon.INT_MAX&&(b=1),this._player=new nrdp.gibbon.Player(this,a,void 0,b))):this.removePlayer();void 0!==nrdp.gibbon._breaks&&this._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED)},removePlayer:function(){this._player&&(nrdp.gibbon._invoke(this._path,"removePlayer",{player:this._player._id}),this._player=
void 0)},get opaque(){return this._syncData.hasOwnProperty("opaque")?this._syncData.opaque:this._defaults?this._defaults("opaque"):this.constructor._defaults.opaque},set opaque(a){a!=this.opaque&&(this._syncData.opaque=a,this._object.setSyncProperty(this._properties.opaque,a),void 0!==nrdp.gibbon._breaks&&this._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED))},get layout(){return this._syncData.hasOwnProperty("layout")?this._syncData.layout:this._defaults?this._defaults("layout"):this.constructor._defaults.layout},
set layout(a){var b=this.layout;if(a instanceof Object){if(a={layout:a.layout,align:nrdp.gibbon.Widget._encodeAlignment(a.align)},b instanceof Object&&a.align==b.align&&a.layout==b.layout)return}else if(a==b)return;this._syncData.layout=a;this._object.setSyncProperty(this._properties.layout,a);void 0!==nrdp.gibbon._breaks&&this._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED)},get layoutSpacing(){return this._syncData.hasOwnProperty("layoutSpacing")?this._syncData.layoutSpacing:this._defaults?
this._defaults("layoutSpacing"):this.constructor._defaults.layoutSpacing},set layoutSpacing(a){a!=this.layoutSpacing&&(this._syncData.layoutSpacing=a,this._object.setSyncProperty(this._properties.layoutSpacing,a),void 0!==nrdp.gibbon._breaks&&this._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED))},get layoutStretch(){return this._syncData.hasOwnProperty("layoutStretch")?this._syncData.layoutStretch:this._defaults?this._defaults("layoutStretch"):this.constructor._defaults.layoutStretch},set layoutStretch(a){a!=
this.layoutStretch&&(this._syncData.layoutStretch=a,this._object.setSyncProperty(this._properties.layoutStretch,a),void 0!==nrdp.gibbon._breaks&&this._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED))},get rect(){return{x:this.x,y:this.y,width:this.width,height:this.height,minWidth:this.minWidth,minHeight:this.minHeight,maxWidth:this.maxWidth,maxHeight:this.maxHeight}},set rect(a){var b;a.hasOwnProperty("animate")?b=a.animate:this._canAnimate()||(b=!1);var c={x:1,y:1,width:1,height:1,minWidth:0,
minHeight:0,maxWidth:0,maxHeight:0},d;for(d in c)if(d in a&&a[d]!=this[d]){var e=a[d];if(c[d]&&void 0!==a[d]){var f=b?b:this._findAnimation(d);if(f){this.startAnimation(d,void 0,e,f.duration,f.ease,!1,f.flags);continue}}this._syncData[d]=e;this._object.setSyncProperty(this._properties[d],e)}void 0!==nrdp.gibbon._breaks&&this._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED)},get x(){var a=this._syncData.hasOwnProperty("x")?this._syncData.x:this._defaults?this._defaults("x"):this.constructor._defaults.x;
return a&&a instanceof Object?a.value:a},set x(a){isNaN(a)&&(a=void 0);a!=this.x&&(this._setAnimatedValue("x",a),void 0!==nrdp.gibbon._breaks&&this._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED))},get y(){var a=this._syncData.hasOwnProperty("y")?this._syncData.y:this._defaults?this._defaults("y"):this.constructor._defaults.y;return a&&a instanceof Object?a.value:a},set y(a){isNaN(a)&&(a=void 0);a!=this.y&&(this._setAnimatedValue("y",a),void 0!==nrdp.gibbon._breaks&&this._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED))},
get plane(){var a=this._syncData.hasOwnProperty("plane")?this._syncData.plane:this._defaults?this._defaults("plane"):this.constructor._defaults.plane;return a&&a instanceof Object?a.value:a},set plane(a){isNaN(a)&&(a=void 0);a!=this.plane&&(this._setAnimatedValue("plane",a),void 0!==nrdp.gibbon._breaks&&this._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED))},get width(){var a=this._syncData.hasOwnProperty("width")?this._syncData.width:this._defaults?this._defaults("width"):this.constructor._defaults.width;
return a&&a instanceof Object?a.value:a},set width(a){isNaN(a)&&(a=void 0);a!=this.width&&(this._setAnimatedValue("width",a),void 0!==nrdp.gibbon._breaks&&this._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED))},get height(){var a=this._syncData.hasOwnProperty("height")?this._syncData.height:this._defaults?this._defaults("height"):this.constructor._defaults.height;return a&&a instanceof Object?a.value:a},set height(a){isNaN(a)&&(a=void 0);a!=this.height&&(this._setAnimatedValue("height",a),void 0!==
nrdp.gibbon._breaks&&this._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED))},dump:function(a){void 0!==a?(a=this._registerCallback(a),nrdp.gibbon._invoke(this._path,"dump",{id:a})):nrdp.gibbon._invoke(this._path,"dump")},grab:function(a,b){var c=this._registerCallback(a);nrdp.gibbon._invoke(this._path,"grab",{id:c,options:b})},setDisplayFlags:function(a){var b=!1,c=!1,d=nrdp.gibbon.Image.ALIGN_NORMAL;a=a.split(" ");for(var e in a){var f=a[e];"opaque"==f?b=!0:"erase"==f?c=!0:"scale"==f?d=nrdp.gibbon.Image.ALIGN_STRETCH:
"tile"==f?d=nrdp.gibbon.Image.ALIGN_TILE:"center"==f&&(d=nrdp.gibbon.Image.ALIGN_CENTER)}this.erase=c;this.opaque=b;this.image.halign=d;this.image.valign=d},_setAnimatedValue:function(a,b){if(!(b instanceof Object)&&void 0!==b){var c=this._findAnimation(a);if(c&&this._canAnimate())return this.startAnimation(a,void 0,b,c.duration,c.ease,!1,c.flags)}nrdp.gibbon._debugAnimations&&nrdp.log.error("SetAnimatedValue: "+this._id+" -> "+JSON.stringify(b));this._animations.pending[a]=void 0;this._syncData[a]=
b;this._object.setSyncProperty(this._properties[a],b)},_canAnimate:function(){if(!this.parent&&!this._isRoot)return!1;for(var a=this;a;a=a.parent)if(!a.visible)return!1;return!0},_findAnimation:function(a){var b=this._animations;return b[a]&&b[a].duration?b[a]:!1},stopAnimation:function(a,b){void 0===b&&(b=!0);var c=nrdp.gibbon._createAnimation(a,void 0,void 0,0,void 0,"stop",{end:b});this._syncData[a]=c;this._object.setSyncProperty(this._properties[a],c,!0)},startAnimation:function(a,b,c,d,e,f,g){if(d||
f){e=nrdp.gibbon._createAnimation(a,b,c,d,e,f,g);void 0===b&&(e.animate.previous=this[a]);if(nrdp.gibbon._debugReplayAnimations){c=a+", "+b+", "+c+", "+d;if(void 0!==f||void 0!==g)c+=", "+f,void 0!==g&&(c+=", "+JSON.stringify(g));nrdp.log.error("nrdp.gibbon.findWidget("+this._id+").startAnimation("+c+")")}nrdp.gibbon._debugAnimations&&nrdp.log.error("AnimationStarted:"+this._id+":"+JSON.stringify(b)+":"+e.animate.id+":"+a+" == "+JSON.stringify(e));this._animations.pending[a]=e.animate.id;this._syncData[a]=
e;this._object.setSyncProperty(this._properties[a],e,!0);return e.animate.id}nrdp.log.warn("StartAnimation("+a+"): With 0 duration for WIDGET("+this._id+")!","WIDGET_ZERO_DURATION");this._setAnimatedValue(a,{value:c})},animate:function(a,b,c,d){if(!this._animations[a]){if(!b)return}else if(this._animations[a].duration==b&&this._animations[a].ease==c)return;this._animations[a]={duration:b,ease:c,flags:d}},_updateProperty:function(a,b){this._syncData[a]=b;if(0==a.lastIndexOf("render",0)&&nrdp._hasEventListener(this,
"renderpropertychange")){var c;"renderX"==a?c="x":"renderY"==a?c="y":"renderWidth"==a?c="width":"renderHeight"==a&&(c="height");if(c){this._sendRenderProperty(a,c,b);return}nrdp.log.error("Unhandled widget.renderProperty: "+a)}void 0!==nrdp.gibbon._breaks&&this._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED)},_maybeBreakSubtree:function _maybeBreakSubtree(b){if(void 0!==b&&(_maybeBreakSubtree(b.parent),nrdp.gibbon._breaks[b._id]&&nrdp.gibbon._breaks[b._id][nrdp.gibbon.DEBUGGER_SUBTREE_MODIFIED]))nrdp.gibbon._breaks[b._id][nrdp.gibbon.DEBUGGER_SUBTREE_MODIFIED]()},
_maybeBreak:function(a){if(nrdp.gibbon._breaks[this._id]&&nrdp.gibbon._breaks[this._id][a])nrdp.gibbon._breaks[this._id][a]();this._maybeBreakSubtree(this.parent)},_handleEvent:function(a){var b=!0;if("animationFinished"==a.name){a.data.property=nrdp._classes[this.classname].properties.byIndex[a.data.propertyID];var c=a.data.property;nrdp.gibbon._debugAnimations&&nrdp.log.error((a.data.aborted?"AnimationAborted:":"AnimationFinished:")+this._id+":"+a.data.id+":"+c+" == "+a.data.value+(this._animations.pending[c]==
a.data.id?"*":""));a.data.id&&this._animations.pending[c]==a.data.id&&(void 0!==nrdp.gibbon._breaks&&this._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED),this._syncData[c]=a.data.value);nrdp._callEventListeners(this,{type:a.name,data:a.data})}else"grab"==a.name||"dump"==a.name?this._callCallback(a):b=!1;return b},_registerCallback:function(a){return nrdp.gibbon._setValue(a)},_callCallback:function(a){if(void 0!==a.data.id){var b=nrdp.gibbon._getValue(a.data.id);nrdp.gibbon._deleteValue(a.data.id);
b&&b(a.data.data)}}};nrdp.gibbon.Image=function(a,b,c){a._syncData.images||(a._syncData.images={});this._object=new GibbonSyncObject(this,a._id,nrdp.gibbon._sync_Image,c,b);this._id=c;this._widget=a;this._background=b;this._name=nrdp.gibbon.Image._createName(this._id);this._path=a._path+".images."+this._name;this._syncData||(this._syncData=a._syncData.images[this._name]={});this._properties=nrdp._classes[this.classname].properties.byName};nrdp.gibbon.Image._createName=function(a){return"image"+a};
nrdp.gibbon.Image.LAZY_DECODE=1;nrdp.gibbon.Image.LAZY_DOWNLOAD=2;nrdp.gibbon.Image.ALIGN_NORMAL=0;nrdp.gibbon.Image.ALIGN_LEFT=nrdp.gibbon.Image.ALIGN_NORMAL;nrdp.gibbon.Image.ALIGN_TOP=nrdp.gibbon.Image.ALIGN_NORMAL;nrdp.gibbon.Image.ALIGN_CENTER=1;nrdp.gibbon.Image.ALIGN_RIGHT=2;nrdp.gibbon.Image.ALIGN_BOTTOM=nrdp.gibbon.Image.ALIGN_RIGHT;nrdp.gibbon.Image.ALIGN_TILE=4;nrdp.gibbon.Image.ALIGN_STRETCH=8;nrdp.gibbon.Image.ALIGN_ASPECT=24;
nrdp.gibbon.Image._defaults={src:"",mirror:!1,purge:!0,player:void 0,sendImageLoaded:!1,sourceRect:{x:0,y:0,width:void 0,height:void 0},verticalAlignment:nrdp.gibbon.Image.ALIGN_NORMAL,horizontalAlignment:nrdp.gibbon.Image.ALIGN_NORMAL};
nrdp.gibbon.Image.prototype={classname:"ImageBridge",constructor:nrdp.gibbon.Image,get sendImageLoaded(){return this._syncData.hasOwnProperty("sendImageLoaded")?this._syncData.sendImageLoaded:this._defaults?this._defaults("sendImageLoaded"):this.constructor._defaults.sendImageLoaded},set sendImageLoaded(a){a!=this.sendImageLoaded&&(this._syncData.sendImageLoaded=a,this._object.setSyncProperty(this._properties.sendImageLoaded,a))},addEventListener:function(a,b){nrdp._addEventListener(this,a,b)&&"imageLoaded"==
a&&(this.sendImageLoaded=!0)},removeEventListener:function(a,b){nrdp._removeEventListener(this,a,b)},get height(){return this._syncData.hasOwnProperty("height")?this._syncData.height:this._defaults?this._defaults("height"):this.constructor._defaults.height},get width(){return this._syncData.hasOwnProperty("width")?this._syncData.width:this._defaults?this._defaults("width"):this.constructor._defaults.width},get visible(){return this._syncData.hasOwnProperty("visible")?this._syncData.visible:this._defaults?
this._defaults("visible"):this.constructor._defaults.visible},set visible(a){a!=this.visible&&(this._syncData.visible=a,this._object.setSyncProperty(this._properties.visible,a))},get sourceRect(){return this._syncData.hasOwnProperty("sourceRect")?this._syncData.sourceRect:this._defaults?this._defaults("sourceRect"):this.constructor._defaults.sourceRect},set sourceRect(a){var b=this._syncData.hasOwnProperty("sourceRect")?this._syncData.sourceRect:this._defaults?this._defaults("sourceRect"):this.constructor._defaults.sourceRect;
b&&a.x==b.x&&a.y==b.y&&a.width==b.width&&a.height==b.height||(this._syncData.sourceRect=a,this._object.setSyncProperty(this._properties.sourceRect,[a.x,a.y,a.width,a.height]))},get purge(){return this._syncData.hasOwnProperty("purge")?this._syncData.purge:this._defaults?this._defaults("purge"):this.constructor._defaults.purge},set purge(a){a!=this.purge&&(this._syncData.purge=a,this._object.setSyncProperty(this._properties.purge,a))},_encodeAlignment:function(a){var b;if(a instanceof Array)for(var c=
b=0;c<a.length;++c)b|=this._encodeAlignment(a[c]);else if("string"===typeof a)for(b=0,a=a.split(" "),c=0;c<a.length;++c){var d=a[c];"normal"===d?b|=nrdp.gibbon.Image.ALIGN_NORMAL:"left"===d?b|=nrdp.gibbon.Image.ALIGN_LEFT:"top"===d?b|=nrdp.gibbon.Image.ALIGN_TOP:"center"===d?b|=nrdp.gibbon.Image.ALIGN_CENTER:"right"===d?b|=nrdp.gibbon.Image.ALIGN_RIGHT:"bottom"===d?b|=nrdp.gibbon.Image.ALIGN_BOTTOM:"tile"===d?b|=nrdp.gibbon.Image.ALIGN_TILE:"stretch"===d?b|=nrdp.gibbon.Image.ALIGN_STRETCH:"aspect"===
d&&(b|=nrdp.gibbon.Image.ALIGN_ASPECT)}else b=a;return b},get halign(){return this.horizontalAlignment},set halign(a){this.horizontalAlignment=a},get horizontalAlignment(){return this._syncData.hasOwnProperty("horizontalAlignment")?this._syncData.horizontalAlignment:this._defaults?this._defaults("horizontalAlignment"):this.constructor._defaults.horizontalAlignment},set horizontalAlignment(a){a=this._encodeAlignment(a);a!=this.halign&&(this._syncData.horizontalAlignment=a,this._object.setSyncProperty(this._properties.horizontalAlignment,
a))},get valign(){return this.verticalAlignment},set valign(a){this.verticalAlignment=a},get verticalAlignment(){return this._syncData.hasOwnProperty("verticalAlignment")?this._syncData.verticalAlignment:this._defaults?this._defaults("verticalAlignment"):this.constructor._defaults.verticalAlignment},set verticalAlignment(a){a=this._encodeAlignment(a);a!=this.valign&&(this._syncData.verticalAlignment=a,this._object.setSyncProperty(this._properties.verticalAlignment,this._encodeAlignment(a)))},reload:function(){var a=
this.url;if(a instanceof Object){if(!a.url||!a.url.length)return;a.lazy=!1}else if(!a||!a.length)return;this._syncData.src=a;this._object.setSyncProperty(this._properties.src,a)},start:function(){nrdp.gibbon._invoke(this._path,"start")},stop:function(){nrdp.gibbon._invoke(this._path,"stop")},get params(){return this._syncData.hasOwnProperty("params")?this._syncData.params:this._defaults?this._defaults("params"):this.constructor._defaults.params},set params(a){this._syncData.params=a;this._object.setSyncProperty(this._properties.params,
a,!0)},get mirror(){return this._syncData.hasOwnProperty("mirror")?this._syncData.mirror:this._defaults?this._defaults("mirror"):this.constructor._defaults.mirror},set mirror(a){a!=this.mirror&&(this._syncData.mirror=a,this._object.setSyncProperty(this._properties.mirror,a))},get url(){return this.src},set url(a){this.src=a},get src(){return this._syncData.hasOwnProperty("src")?this._syncData.src:this._defaults?this._defaults("src"):this.constructor._defaults.src},set src(a){var b=this._syncData.hasOwnProperty("src")?
this._syncData.src:this._defaults?this._defaults("src"):this.constructor._defaults.src,c=a;if(c instanceof Object){c.url&&(c.url=nrdp.gibbon._resolveUrl(c.url));"boolean"==typeof c.lazy&&(c.lazy=c.lazy?nrdp.gibbon.Image.LAZY_DOWNLOAD:void 0);nrdp.gibbon._resolveDepends(c);if(b instanceof Object&&(c.url&&c.url==b.url||c.data&&c.data==b.data)&&c.params&&c.params==b.params&&c.lazy==b.lazy&&c.async==b.async&&c.scale==b.scale&&c.required==b.required&&c.timeout==b.timeout&&c.start==b.start&&c.highPriority==
b.highPriority&&c.connectTimeout==b.connectTimeout&&c.lowSpeedLimit==b.lowSpeedLimit&&c.lowSpeedTime==b.lowSpeedTime&&c.dependsOn==b.dependsOn&&c.exclusiveDepends==b.exclusiveDepends&&c.dnsTimeout==b.dnsTimeout&&c.ipv6==b.ipv6)if(c.headers instanceof Object&&b.headers instanceof Object){var d=!0,e;for(e in c.headers)if(c.headers.hasOwnProperty(e)){if(b.headers[e]!=c.headers[e])break;if(d){for(e in b.headers)if(b.headers.hasOwnProperty(e)&&c.headers[e]!=b.headers[e]){d=!1;break}if(d)return}}}else{if(!c.headers&&
!b.headers)return}else if(!(b||c.url&&c.url.length||c.data&&c.data.length))return;d=0;!0===c.fast?++d:delete c.fast;!1===c.start?++d:delete c.start;void 0!==c.lazy?++d:delete c.lazy;!1===c.async?++d:delete c.async;void 0!==c.scale?++d:delete c.scale;!1===c.required?++d:delete c.required;!0===c.highPriority?++d:delete c.highPriority;c.timeout?++d:delete c.timeout;c.connectTimeout?++d:delete c.connectTimeout;c.lowSpeedTime?++d:delete c.lowSpeedTime;c.lowSpeedLimit?++d:delete c.lowSpeedLimit;c.dnsTimeout?
++d:delete c.dnsTimeout;void 0!==c.ipv6?++d:delete c.ipv6;c.url?++d:delete c.url;c.data?++d:delete c.data;c.params?++d:delete c.params;c.dependsOn?++d:delete c.dependsOn;c.exclusiveDepends?++d:delete c.exclusiveDepends;if(c.headers){e=!1;for(var f in c.headers)c.headers.hasOwnProperty(f)&&(void 0!==c.headers[f]?e=!0:delete c.headers[f]);e?++d:delete c.headers}if((1>=d||!c.url)&&!c.data&&(c=c.url?c.url:"",b==c))return}else if(c=nrdp.gibbon._resolveUrl(c),c==b)return;c=nrdp.gibbon._prepareNetworkRequest(c);
this._syncData.src=a;this._object.setSyncProperty(this._properties.src,c);delete this._syncData.width;delete this._syncData.height},_handleEvent:function(a){var b=!0;"imageLoaded"==a.name?(a.data.success&&(void 0!==nrdp.gibbon._breaks&&this._widget._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED),this._syncData.width=a.data.width,this._syncData.height=a.data.height),nrdp._callEventListeners(this,{type:a.name,data:a.data})):"imageEvent"==a.name?nrdp._callEventListeners(this,{type:a.name,data:a.data}):
b=!1;return b}};nrdp.gibbon.Text=function(a){this._object=new GibbonSyncObject(this,a._id,nrdp.gibbon._sync_Text);this._widget=a;this._path=a._path+".text";this._syncData||(this._syncData=a._syncData.text={});this._properties=nrdp._classes[this.classname].properties.byName;this._cursor=this._cursorPosition=void 0};nrdp.gibbon.Text.ClusterLevels={MonotoneGraphemes:0,MonotoneCharacters:1,Characters:2};
nrdp.gibbon.Text._baseDefaults={inherits:!0,size:30,lineHeight:void 0,sendTextLoaded:!1,sendRenderProperties:!1,collapseWhiteSpace:!0,weight:"bold",variant:"normal",align:nrdp.gibbon.Widget.ALIGN_LEFT,color:{r:0,g:0,b:0,a:255},backgroundColor:{r:0,g:0,b:0,a:0},padding:0,indent:0,shadow:{offsetX:0,offsetY:0,color:{r:0,g:0,b:0,a:255}},truncation:{position:"none",ellipsis:"\u2026"},edgeEffect:{type:"none",width:1,lightColor:{r:0,g:0,b:0,a:255},darkColor:{r:0,g:0,b:0,a:255},outlineColor:{r:0,g:0,b:0,
a:255}},cursor:{visible:!1,style:"none",color:{r:0,g:0,b:0,a:255},weakColor:{r:100,g:100,b:100,a:255},interval:500,width:1},typography:{kerning:!0,tracking:0,fontFeatures:"",clusterLevel:nrdp.gibbon.Text.ClusterLevels.MonotoneCharacters},wrap:!1,underline:!1,strikethrough:!1,richText:!1,text:void 0,firstLine:0,renderFirstLine:0};
nrdp.gibbon.Text._defaults={inherits:!0,size:void 0,lineHeight:void 0,sendTextLoaded:!1,sendRenderProperties:!1,collapseWhiteSpace:!0,weight:void 0,variant:void 0,align:void 0,color:void 0,backgroundColor:void 0,padding:void 0,indent:void 0,shadow:{offsetX:void 0,offsetY:void 0,color:void 0},truncation:{position:void 0,ellipsis:void 0},edgeEffect:{type:void 0,width:void 0,lightColor:void 0,darkColor:void 0,outlineColor:void 0},cursor:{visible:void 0,style:void 0,color:void 0,weakColor:void 0,interval:void 0,
width:void 0},typography:{kerning:void 0,tracking:void 0,fontFeatures:void 0,clusterLevel:void 0},wrap:void 0,underline:void 0,strikethrough:void 0,richText:void 0,text:void 0,firstLine:0,renderFirstLine:0};
nrdp.gibbon.Text.prototype={classname:"TextBridge",constructor:nrdp.gibbon.Text,_defaults:function(a){return!this._widget.parent||this._syncData.hasOwnProperty("inherits")&&!this._syncData.inherits?nrdp.gibbon.Text._baseDefaults[a]:nrdp.gibbon.Text._defaults[a]},_cursor:void 0,_cursorPosition:void 0,_cursorSubstitutionScripts:void 0,toString:function(){var a=this._syncData.hasOwnProperty("contents")?this._syncData.contents:this._defaults?this._defaults("contents"):this.constructor._defaults.contents;
return void 0===a?"":a},addEventListener:function(a,b){nrdp._addEventListener(this,a,b)&&("renderpropertychange"==a?this.sendRenderProperties=!0:"textLoaded"==a&&(this.sendTextLoaded=!0))},removeEventListener:function(a,b){nrdp._removeEventListener(this,a,b)},_mergeValues:function(a,b,c){var d={},e;for(e in c){var f=c[e],g=void 0;a&&a.hasOwnProperty(f)?(g=a[f])&&-1!=f.toLowerCase().indexOf("color")&&(g=nrdp.gibbon._parseColor(g))&&g instanceof Object&&void 0===g.a&&(g.a=255):b&&(g=b[f]);d[f]=g}return d},
_sendRenderProperty:function(a,b,c){nrdp._callEventListeners(this,{type:"renderpropertychange",property:a,renderProperty:b,value:c});void 0!==nrdp.gibbon._breaks&&this._widget._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED)},_renderProperty:function(a){this.sendRenderProperties||(nrdp.log.error("RenderProperty("+a+"): Used but TEXT("+this._widget._id+") has not set sendRenderProperties!"),this.sendRenderProperties=!0);return this._syncData.hasOwnProperty(a)?this._syncData[a]:this._defaults?this._defaults(a):
this.constructor._defaults[a]},get widget(){return this._widget},get textCursor(){return this._cursor},get sendRenderProperties(){return this._syncData.hasOwnProperty("sendRenderProperties")?this._syncData.sendRenderProperties:this._defaults?this._defaults("sendRenderProperties"):this.constructor._defaults.sendRenderProperties},set sendRenderProperties(a){a!=this.sendRenderProperties&&(this._text&&(this._text.sendRenderProperties=a),this._syncData.sendRenderProperties=a,this._object.setSyncProperty(this._properties.sendRenderProperties,
a),void 0!==nrdp.gibbon._breaks&&this._widget._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED))},get sendTextLoaded(){return this._syncData.hasOwnProperty("sendTextLoaded")?this._syncData.sendTextLoaded:this._defaults?this._defaults("sendTextLoaded"):this.constructor._defaults.sendTextLoaded},set sendTextLoaded(a){a!=this.sendTextLoaded&&(this._syncData.sendTextLoaded=a,this._object.setSyncProperty(this._properties.sendTextLoaded,a))},value:function(a){var b;this._syncData.hasOwnProperty(a)&&
(b=this._syncData[a]);if(void 0===b&&this.inherits)for(var c=this._widget.parent;void 0===b&&c&&(!c._text||(c._text._syncData.hasOwnProperty(a)&&(b=c._text._syncData[a]),c._text.inherits));c=c.parent);return void 0!==b?b:nrdp.gibbon.Text._baseDefaults[a]},get inherits(){return this._syncData.hasOwnProperty("inherits")?this._syncData.inherits:this._defaults?this._defaults("inherits"):this.constructor._defaults.inherits},set inherits(a){void 0===a&&(a=!0);this._syncData.hasOwnProperty("inherits")&&
a==(this._syncData.hasOwnProperty("inherits")?this._syncData.inherits:this._defaults?this._defaults("inherits"):this.constructor._defaults.inherits)||(this._syncData.inherits=a,this._object.setSyncProperty(this._properties.inherits,a),void 0!==nrdp.gibbon._breaks&&this._widget._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED))},get renderLines(){return this._renderProperty("renderLines")},get renderTextLines(){return this.renderLines},get renderFirstLine(){return this._renderProperty("renderFirstLine")},
get renderPadding(){return this._renderProperty("renderPadding")},get renderTextFirstLine(){return this.renderFirstLine},get renderCursorPosition(){return this._renderProperty("renderCursorPosition")},get contents(){return this._syncData.hasOwnProperty("contents")?this._syncData.contents:this._defaults?this._defaults("contents"):this.constructor._defaults.contents},set contents(a){if(null===a||"undefined"===typeof a)a="";a!=(this._syncData.hasOwnProperty("contents")?this._syncData.contents:this._defaults?
this._defaults("contents"):this.constructor._defaults.contents)&&(nrdp._callEventListeners(this,{type:"contentsChanged",data:a}),this._syncData.contents=a,this._object.setSyncProperty(this._properties.contents,a),void 0!==nrdp.gibbon._breaks&&this._widget._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED))},get firstLine(){return this._syncData.hasOwnProperty("firstLine")?this._syncData.firstLine:this._defaults?this._defaults("firstLine"):this.constructor._defaults.firstLine},set firstLine(a){this._syncData.hasOwnProperty("firstLine")&&
a==(this._syncData.hasOwnProperty("firstLine")?this._syncData.firstLine:this._defaults?this._defaults("firstLine"):this.constructor._defaults.firstLine)||(this._syncData.firstLine=a,this._object.setSyncProperty(this._properties.firstLine,a),void 0!==nrdp.gibbon._breaks&&this._widget._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED))},get _collapseWhiteSpace(){return this._syncData.hasOwnProperty("collapseWhiteSpace")?this._syncData.collapseWhiteSpace:this._defaults?this._defaults("collapseWhiteSpace"):
this.constructor._defaults.collapseWhiteSpace},set _collapseWhiteSpace(a){this._syncData.hasOwnProperty("collapseWhiteSpace")&&a==(this._syncData.hasOwnProperty("collapseWhiteSpace")?this._syncData.collapseWhiteSpace:this._defaults?this._defaults("collapseWhiteSpace"):this.constructor._defaults.collapseWhiteSpace)||(this._syncData.collapseWhiteSpace=a,this._object.setSyncProperty(this._properties.collapseWhiteSpace,a),void 0!==nrdp.gibbon._breaks&&this._widget._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED))},
get cursorPosition(){return this._cursor?this._cursor._pos:this._cursorPosition},set cursorPosition(a){this._cursorPosition=a;this._cursor&&this._cursor.set(a);void 0!==nrdp.gibbon._breaks&&this._widget._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED)},get cursorInformation(){return this._syncData.hasOwnProperty("cursorInformation")?this._syncData.cursorInformation:this._defaults?this._defaults("cursorInformation"):this.constructor._defaults.cursorInformation},set cursorInformation(a){this._syncData.cursorInformation=
a;this._object.setSyncProperty(this._properties.cursorInformation,a);void 0!==nrdp.gibbon._breaks&&this._widget._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED)},get _cursorBounds(){return this._syncData.hasOwnProperty("cursorBounds")?this._syncData.cursorBounds:this._defaults?this._defaults("cursorBounds"):this.constructor._defaults.cursorBounds},get family(){return this._syncData.hasOwnProperty("family")?this._syncData.family:this._defaults?this._defaults("family"):this.constructor._defaults.family},
set family(a){this._syncData.hasOwnProperty("family")&&a==(this._syncData.hasOwnProperty("family")?this._syncData.family:this._defaults?this._defaults("family"):this.constructor._defaults.family)||(this._syncData.family=a,this._object.setSyncProperty(this._properties.family,a),void 0!==nrdp.gibbon._breaks&&this._widget._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED))},get locale(){return this._syncData.hasOwnProperty("locale")?this._syncData.locale:this._defaults?this._defaults("locale"):this.constructor._defaults.locale},
set locale(a){this._syncData.hasOwnProperty("locale")&&a==(this._syncData.hasOwnProperty("locale")?this._syncData.locale:this._defaults?this._defaults("locale"):this.constructor._defaults.locale)||(this._syncData.locale=a,this._object.setSyncProperty(this._properties.locale,a),void 0!==nrdp.gibbon._breaks&&this._widget._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED))},get direction(){return this._syncData.hasOwnProperty("direction")?this._syncData.direction:this._defaults?this._defaults("direction"):
this.constructor._defaults.direction},set direction(a){this._syncData.hasOwnProperty("direction")&&a==(this._syncData.hasOwnProperty("direction")?this._syncData.direction:this._defaults?this._defaults("direction"):this.constructor._defaults.direction)||(this._syncData.direction=a,this._object.setSyncProperty(this._properties.direction,a),void 0!==nrdp.gibbon._breaks&&this._widget._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED))},get script(){return this._syncData.hasOwnProperty("script")?this._syncData.script:
this._defaults?this._defaults("script"):this.constructor._defaults.script},set script(a){this._syncData.hasOwnProperty("script")&&a==(this._syncData.hasOwnProperty("script")?this._syncData.script:this._defaults?this._defaults("script"):this.constructor._defaults.script)||(this._syncData.script=a,this._object.setSyncProperty(this._properties.script,a),void 0!==nrdp.gibbon._breaks&&this._widget._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED))},get size(){return this._syncData.hasOwnProperty("size")?
this._syncData.size:this._defaults?this._defaults("size"):this.constructor._defaults.size},set size(a){"number"!=typeof a&&(a=this._defaults("size"));this._syncData.hasOwnProperty("size")&&a==(this._syncData.hasOwnProperty("size")?this._syncData.size:this._defaults?this._defaults("size"):this.constructor._defaults.size)&&1==nrdp.gibbon.scene.scale||(this._syncData.size=a,this._object.setSyncProperty(this._properties.size,a),void 0!==nrdp.gibbon._breaks&&this._widget._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED))},
get padding(){return this._syncData.hasOwnProperty("padding")?this._syncData.padding:this._defaults?this._defaults("padding"):this.constructor._defaults.padding},set padding(a){if(a instanceof Array)if(2<a.length)a=this._defaults("padding");else for(var b=0;b<a.length;++b){if("number"!=typeof a[b]&&"undefined"!=typeof a[b]){a=this._defaults("padding");break}}else"number"!=typeof a&&"undefined"!=typeof a&&"object"!=typeof a&&(a=this._defaults("padding"));this._syncData.hasOwnProperty("padding")&&a==
(this._syncData.hasOwnProperty("padding")?this._syncData.padding:this._defaults?this._defaults("padding"):this.constructor._defaults.padding)||(this._syncData.padding=a,this._object.setSyncProperty(this._properties.padding,a),void 0!==nrdp.gibbon._breaks&&this._widget._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED))},get indent(){return this._syncData.hasOwnProperty("indent")?this._syncData.indent:this._defaults?this._defaults("indent"):this.constructor._defaults.indent},set indent(a){a!=this.indent&&
(this._syncData.indent=a,this._object.setSyncProperty(this._properties.indent,a),void 0!==nrdp.gibbon._breaks&&this._widget._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED))},get lineHeight(){return this._syncData.hasOwnProperty("lineHeight")?this._syncData.lineHeight:this._defaults?this._defaults("lineHeight"):this.constructor._defaults.lineHeight},set lineHeight(a){this._syncData.hasOwnProperty("lineHeight")&&a==(this._syncData.hasOwnProperty("lineHeight")?this._syncData.lineHeight:this._defaults?
this._defaults("lineHeight"):this.constructor._defaults.lineHeight)||(this._syncData.lineHeight=a,this._object.setSyncProperty(this._properties.lineHeight,a),void 0!==nrdp.gibbon._breaks&&this._widget._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED))},get wrap(){return this._syncData.hasOwnProperty("wrap")?this._syncData.wrap:this._defaults?this._defaults("wrap"):this.constructor._defaults.wrap},set wrap(a){this._syncData.hasOwnProperty("wrap")&&a==(this._syncData.hasOwnProperty("wrap")?this._syncData.wrap:
this._defaults?this._defaults("wrap"):this.constructor._defaults.wrap)||(this._syncData.wrap=a,this._object.setSyncProperty(this._properties.wrap,a),void 0!==nrdp.gibbon._breaks&&this._widget._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED))},get richText(){return this._syncData.hasOwnProperty("richText")?this._syncData.richText:this._defaults?this._defaults("richText"):this.constructor._defaults.richText},set richText(a){this._syncData.hasOwnProperty("richText")&&a==(this._syncData.hasOwnProperty("richText")?
this._syncData.richText:this._defaults?this._defaults("richText"):this.constructor._defaults.richText)||(this._syncData.richText=a,this._object.setSyncProperty(this._properties.richText,a),void 0!==nrdp.gibbon._breaks&&this._widget._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED))},get maxLines(){return this._syncData.hasOwnProperty("maxLines")?this._syncData.maxLines:this._defaults?this._defaults("maxLines"):this.constructor._defaults.maxLines},set maxLines(a){this._syncData.hasOwnProperty("maxLines")&&
a==(this._syncData.hasOwnProperty("maxLines")?this._syncData.maxLines:this._defaults?this._defaults("maxLines"):this.constructor._defaults.maxLines)||(this._syncData.maxLines=a,this._object.setSyncProperty(this._properties.maxLines,a),void 0!==nrdp.gibbon._breaks&&this._widget._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED))},get underline(){return this._syncData.hasOwnProperty("underline")?this._syncData.underline:this._defaults?this._defaults("underline"):this.constructor._defaults.underline},
set underline(a){this._syncData.hasOwnProperty("underline")&&a==(this._syncData.hasOwnProperty("underline")?this._syncData.underline:this._defaults?this._defaults("underline"):this.constructor._defaults.underline)||(this._syncData.underline=a,this._object.setSyncProperty(this._properties.underline,a),void 0!==nrdp.gibbon._breaks&&this._widget._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED))},get strikethrough(){return this._syncData.hasOwnProperty("strikethrough")?this._syncData.strikethrough:
this._defaults?this._defaults("strikethrough"):this.constructor._defaults.strikethrough},set strikethrough(a){this._syncData.hasOwnProperty("strikethrough")&&a==(this._syncData.hasOwnProperty("strikethrough")?this._syncData.strikethrough:this._defaults?this._defaults("strikethrough"):this.constructor._defaults.strikethrough)||(this._syncData.strikethrough=a,this._object.setSyncProperty(this._properties.strikethrough,a),void 0!==nrdp.gibbon._breaks&&this._widget._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED))},
get bold(){return void 0===this.weight?void 0:"bold"==this.weight},set bold(a){this.weight=void 0===a?void 0:a?"bold":"normal"},get weight(){return this._syncData.hasOwnProperty("weight")?this._syncData.weight:this._defaults?this._defaults("weight"):this.constructor._defaults.weight},set weight(a){this._syncData.hasOwnProperty("weight")&&a==(this._syncData.hasOwnProperty("weight")?this._syncData.weight:this._defaults?this._defaults("weight"):this.constructor._defaults.weight)||(this._syncData.weight=
a,this._object.setSyncProperty(this._properties.weight,a),void 0!==nrdp.gibbon._breaks&&this._widget._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED))},get align(){return this._syncData.hasOwnProperty("align")?this._syncData.align:this._defaults?this._defaults("align"):this.constructor._defaults.align},set align(a){a=nrdp.gibbon.Widget._encodeAlignment(a);this._syncData.hasOwnProperty("align")&&a==(this._syncData.hasOwnProperty("align")?this._syncData.align:this._defaults?this._defaults("align"):
this.constructor._defaults.align)||(this._syncData.align=a,this._object.setSyncProperty(this._properties.align,a),void 0!==nrdp.gibbon._breaks&&this._widget._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED))},get italic(){return void 0===this.variant?void 0:"italic"==this.variant},set italic(a){this.variant=void 0===a?void 0:a?"italic":"normal"},get variant(){return this._syncData.hasOwnProperty("variant")?this._syncData.variant:this._defaults?this._defaults("variant"):this.constructor._defaults.variant},
set variant(a){this._syncData.hasOwnProperty("variant")&&a==(this._syncData.hasOwnProperty("variant")?this._syncData.variant:this._defaults?this._defaults("variant"):this.constructor._defaults.variant)||(this._syncData.variant=a,this._object.setSyncProperty(this._properties.variant,a),void 0!==nrdp.gibbon._breaks&&this._widget._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED))},get color(){return this._syncData.hasOwnProperty("color")?this._syncData.color:this._defaults?this._defaults("color"):
this.constructor._defaults.color},set color(a){a=nrdp.gibbon._parseColor(a);this._syncData.hasOwnProperty("color")&&nrdp.gibbon._compareColor(a,this._syncData.hasOwnProperty("color")?this._syncData.color:this._defaults?this._defaults("color"):this.constructor._defaults.color)||(this._syncData.color=a,this._object.setSyncProperty(this._properties.color,nrdp.gibbon._encodeColor(a)),void 0!==nrdp.gibbon._breaks&&this._widget._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED))},get backgroundColor(){return this._syncData.hasOwnProperty("backgroundColor")?
this._syncData.backgroundColor:this._defaults?this._defaults("backgroundColor"):this.constructor._defaults.backgroundColor},set backgroundColor(a){a=nrdp.gibbon._parseColor(a);this._syncData.hasOwnProperty("backgroundColor")&&nrdp.gibbon._compareColor(a,this._syncData.hasOwnProperty("backgroundColor")?this._syncData.backgroundColor:this._defaults?this._defaults("backgroundColor"):this.constructor._defaults.backgroundColor)||(this._syncData.backgroundColor=a,this._object.setSyncProperty(this._properties.backgroundColor,
nrdp.gibbon._encodeColor(a)),void 0!==nrdp.gibbon._breaks&&this._widget._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED))},get cursor(){return this._syncData.hasOwnProperty("cursor")?this._syncData.cursor:this._defaults?this._defaults("cursor"):this.constructor._defaults.cursor},set cursor(a){var b=this._syncData.hasOwnProperty("cursor")?this._syncData.cursor:this._defaults?this._defaults("cursor"):this.constructor._defaults.cursor;if((a||b)&&!(this._syncData.hasOwnProperty("cursor")&&b&&a&&b.style==
a.style&&b.width==a.width&&b.interval==a.interval&&nrdp.gibbon._compareColor(b.color,a.color)&&nrdp.gibbon._compareColor(b.weakColor,a.weakColor)&&b.visible==a.visible)){if(a){a=this._mergeValues(a,b,"style width visible interval color weakColor".split(" "));if("none"!=a.style){if(void 0===this._cursor&&(this._cursor=new nrdp.gibbon.TextCursor(this),!this._cursor.valid)){this._cursor&&(this._collapseWhiteSpace=this._cursor._wasCollapsed);this._cursor=void 0;return}}else void 0!==this._cursor&&(this._cursorPosition=
void 0),this._cursor&&(this._collapseWhiteSpace=this._cursor._wasCollapsed),this._cursor=void 0;this._syncData.cursor=a;this._object.setSyncProperty(this._properties.cursor,[a.style,a.visible,a.interval,a.width,nrdp.gibbon._encodeColor(a.color),nrdp.gibbon._encodeColor(a.weakColor)])}else void 0!==this._cursor&&(this._cursorPosition=void 0),this._cursor&&(this._collapseWhiteSpace=this._cursor._wasCollapsed),this._cursor=void 0,this._syncData.cursor=void 0,this._object.setSyncProperty(this._properties.cursor,
void 0);void 0!==nrdp.gibbon._breaks&&this._widget._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED)}},get edgeEffect(){return this._syncData.hasOwnProperty("edgeEffect")?this._syncData.edgeEffect:this._defaults?this._defaults("edgeEffect"):this.constructor._defaults.edgeEffect},set edgeEffect(a){var b=this._syncData.hasOwnProperty("edgeEffect")?this._syncData.edgeEffect:this._defaults?this._defaults("edgeEffect"):this.constructor._defaults.edgeEffect;if(a||b){if(a){var c=this._mergeValues(a,b,
"type width color1 color2 lightColor darkColor outlineColor".split(" "));if("raised"==c.type||"depressed"==c.type){if(a.lightColor instanceof Object?c.color1=a.lightColor:"lightColor"in a&&!a.lightColor&&(c.color1=void 0),a.darkColor instanceof Object?c.color2=a.darkColor:"darkColor"in a&&!a.darkColor&&(c.color2=void 0),c.width=c.width?1:0,this._syncData.hasOwnProperty("edgeEffect")&&b&&b.type==c.type&&b.width==c.width&&nrdp.gibbon._compareColor(b.lightColor,c.color1)&&nrdp.gibbon._compareColor(b.darkColor,
c.color2))return}else if("outline"==c.type&&(a.outlineColor instanceof Object?c.color1=a.outlineColor:"outlineColor"in a&&!a.outlineColor&&(c.color1=void 0),this._syncData.hasOwnProperty("edgeEffect")&&b&&b.type==c.type&&b.width==c.width&&nrdp.gibbon._compareColor(b.outlineColor,c.color1)))return;this._syncData.edgeEffect=c;this._object.setSyncProperty(this._properties.edgeEffect,[c.type,c.width,nrdp.gibbon._encodeColor(c.color1),nrdp.gibbon._encodeColor(c.color2)])}else this._syncData.edgeEffect=
void 0,this._object.setSyncProperty(this._properties.edgeEffect,void 0);void 0!==nrdp.gibbon._breaks&&this._widget._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED)}},get shadow(){return this._syncData.hasOwnProperty("shadow")?this._syncData.shadow:this._defaults?this._defaults("shadow"):this.constructor._defaults.shadow},set shadow(a){var b=this._syncData.hasOwnProperty("shadow")?this._syncData.shadow:this._defaults?this._defaults("shadow"):this.constructor._defaults.shadow;!a&&!b||this._syncData.hasOwnProperty("shadow")&&
b&&a&&b.color&&b.offsetX==a.offsetX&&b.offsetY==a.offsetY&&nrdp.gibbon._compareColor(b.color,a.color)||(a?(a=this._mergeValues(a,b,["offsetX","offsetY","color"]),this._syncData.shadow=a,this._object.setSyncProperty(this._properties.shadow,[a.offsetX,a.offsetY,nrdp.gibbon._encodeColor(a.color)])):(this._syncData.shadow=void 0,this._object.setSyncProperty(this._properties.shadow,void 0)),void 0!==nrdp.gibbon._breaks&&this._widget._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED))},get truncation(){return this._syncData.hasOwnProperty("truncation")?
this._syncData.truncation:this._defaults?this._defaults("truncation"):this.constructor._defaults.truncation},set truncation(a){var b=this._syncData.hasOwnProperty("truncation")?this._syncData.truncation:this._defaults?this._defaults("truncation"):this.constructor._defaults.truncation;this._syncData.hasOwnProperty("truncation")&&(!a&&!b||b&&a&&b.position==a.position&&b.ellipsis==a.ellipsis)||(a?(a=this._mergeValues(a,b,["position","ellipsis"]),this._syncData.truncation=a,this._object.setSyncProperty(this._properties.truncation,
[a.position,a.ellipsis])):(this._syncData.truncation=void 0,this._object.setSyncProperty(this._properties.truncation,void 0)),void 0!==nrdp.gibbon._breaks&&this._widget._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED))},get typography(){return this._syncData.hasOwnProperty("typography")?this._syncData.typography:this._defaults?this._defaults("typography"):this.constructor._defaults.typography},set typography(a){var b=this._syncData.hasOwnProperty("typography")?this._syncData.typography:this._defaults?
this._defaults("typography"):this.constructor._defaults.typography;this._syncData.hasOwnProperty("typography")&&(!a&&!b||b&&a&&b.kerning==a.kerning&&b.tracking==a.tracking&&b.clusterLevel==a.clusterLevel&&b.fontFeatures==a.fontFeatures)||(a?(a=this._mergeValues(a,b,["kerning","tracking","fontFeatures","clusterLevel"]),this._syncData.typography=a,this._object.setSyncProperty(this._properties.typography,a)):(this._syncData.typography=void 0,this._object.setSyncProperty(this._properties.typography,void 0)),
void 0!==nrdp.gibbon._breaks&&this._widget._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED))},info:function(a){a=nrdp.gibbon._setValue(a);nrdp.gibbon._invoke(this._path,"textInfo",{id:a})},requestLayout:function(a){a=nrdp.gibbon._setValue(a);nrdp.gibbon._invoke(this._path,"requestLayout",{id:a})},_cursorClusterForPosition:function(a){var b=this._path.indexOf("gibbon.");return-1===b?void 0:nrdp._invoke(this._path.substr(b),"cursorClusterForPosition",a)},_updateProperty:function(a,b){this._syncData[a]=
b;if(0==a.lastIndexOf("render",0)&&(nrdp._hasEventListener(this._widget,"renderpropertychange")||nrdp._hasEventListener(this,"renderpropertychange"))){var c,d;"renderLines"==a?(c=a,d={property:"renderTextLines",renderProperty:"renderTextLines"}):"renderFirstLine"==a?(c="firstLine",d={property:"renderTextFirstLine",renderProperty:"textFirstLine"}):"renderPadding"==a?(c=a,d={property:"renderPadding",renderProperty:"renderPadding"}):"renderCursorPosition"==a&&(c=a,d={property:"renderCursorPosition",
renderProperty:"renderCursorPosition"});c?(this._sendRenderProperty(a,c,b),d&&this._widget.sendRenderProperties&&this._widget._sendRenderProperty(d.property,d.renderProperty,b)):nrdp.log.error("Unhandled text.renderProperty: "+a)}},_handleEvent:function(a){var b=!0;if("textLoaded"==a.name||"layoutChanged"==a.name)nrdp._callEventListeners(this,{type:a.name,data:a.data});else if("textInfo"==a.name||"requestLayout"==a.name){var c=nrdp.gibbon._getValue(a.data.id);c&&c(a.data.data)}else b=!1;return b}};
nrdp.gibbon.Text.directionForText=function(a){return nrdp._invoke("gibbon","directionForText",{text:a})};
nrdp.gibbon.TextCursor=function(a){this._wasCollapsed=a._collapseWhiteSpace;if(a.truncation&&"end"==a.truncation.position)nrdp.log.error("Cursor enabled with truncated text, not supported"),this._valid=!1;else{a._collapseWhiteSpace=!1;this._valid=!0;var b=this;b._text=a;b._pos=void 0;var c=function(a){"lines"in a.data.layout&&void 0!==a.data.layout.lines&&"characterBreaks"in a.data.layout&&void 0!==a.data.layout.characterBreaks&&(b._dir=b._text.direction,void 0===b._dir&&(b._dir="ltr"),b._extractBuffer(a),
b._extractLayout(a),b._reposition?(b._refind(b._reposition),b._reposition=void 0):void 0!==b._cluster&&b._refind({cluster:b._cluster}),b._updatePosition(),b._applyPending())};a.addEventListener("layoutChanged",c);a.addEventListener("contentsChanged",function(){b._pending=[];b._cluster=void 0});b._pending=[];a.requestLayout(function(a){c({data:{layout:a}})})}};nrdp.gibbon.TextCursor.Embedder=function(){};
nrdp.gibbon.TextCursor.Embedder.prototype={_first:void 0,feed:function(a){return void 0===this._first?(this._first=a,!1):this._first%2?a<this._first:a!==this._first}};nrdp.gibbon.TextCursor.FORWARD=1;nrdp.gibbon.TextCursor.BACKWARD=-1;nrdp.gibbon.TextCursor.RIGHT=1;nrdp.gibbon.TextCursor.LEFT=-1;nrdp.gibbon.TextCursor.GRAPHEME=0;nrdp.gibbon.TextCursor.CHARACTER=1;
nrdp.gibbon.TextCursor.prototype={_layout:void 0,_logical:void 0,_visual:void 0,_attrs:void 0,_text:void 0,_dir:void 0,_pos:void 0,_cluster:void 0,_lineX:void 0,_reposition:void 0,_buffer:void 0,_breaks:void 0,_pending:void 0,_extractLayout:function(a){function b(a){var b;for(b=0;b<m.length;++b)for(var c=0;c<m[b].line.length;++c)for(var d=0;d<m[b].line[c].clusters.length;++d)m[b].line[c].clusters[d]>a&&--m[b].line[c].clusters[d];for(b=0;b<k.length;++b)k[b]>a&&--k[b];for(b=0;b<g.length;++b)g[b]>a&&
--g[b];for(b=0;b<h.length;++b)h[b].start>a&&--h[b].start,h[b].end>a&&--h[b].end}if(void 0!==a.data.layout.lines&&void 0!==a.data.layout.characterBreaks){var c=[],d,e,f=[],g=[],h=[],k=a.data.layout.characterBreaks.slice(0);if(void 0!==a.data.layout.lineBreaks){var l=a.data.layout.lineBreaks;for(d=0;d<l.length;++d)e=k.indexOf(l[d].start),-1!==e&&k.splice(e,1),g.push(l[d].start)}if(void 0!==a.data.layout.wordBreaks)for(e=a.data.layout.wordBreaks,d=0;d<e.length-1;++d)h.push({start:e[d],end:e[d+1]-1});
var l=Object.create(null),u=a.data.layout.lines,s=0,m=[];for(d=0;d<u.length;++d){var n=[],v=[],q=void 0,D=void 0,B=0,E=u[d].runs;for(a=0;a<E.length;++a){var y=E[a],t=y.item.attribute.style.direction,C=y.item.attribute.level,w=y.clusters.slice(0),A=void 0,z=0,B=B+(y.end-y.start+1);for(e=0;e<w.length;++e)w[e]===A?(w.splice(e,1),--e,++z):(0<z&&(l[A]=z,z=0),A=w[e]);for(0<z&&(l[A]=z);s<g.length;){e=w.indexOf(g[s]);if(-1===e)break;w.splice(e,1);++s}t===q&&C==D?n[n.length-1].clusters.push.apply(n[n.length-
1].clusters,w):(n.push({direction:t,clusters:w,level:C}),q=t,D=C);v.push({script:y.item.attribute.style.script,clusters:w.slice(0).sort(function(a,b){return a-b})})}m.push({line:n,clusterCount:B,scripts:v})}for(d=0;d<this._buffer.length;++d)65535<this._buffer[d]&&b(d+1);for(d=0;d<g.length;++d)this._buffer[g[d]]=10;for(d=0;d<m.length;++d)for(a=0;a<m[d].line.length;++a)c.push.apply(c,m[d].line[a].clusters);for(d=0;d<h.length;++d){a=!1;for(e=h[d].start;e<h[d].end+1;++e)if(-1!==c.indexOf(e)){a=!0;break}a||
(h[d].trimmed=!0)}var u=c.slice(0).sort(function(a,b){return a-b}),s=function(a){for(var b=0;b<m.length;++b)for(var c=0;c<m[b].line.length;++c)if(-1!==m[b].line[c].clusters.indexOf(a))return m[b].line[c].level;return-1},x=[],r,p;for(d=0;d<k.length;++d){e=k[d];if(void 0!==p&&e>p+1)for(p+=1;p<e;++p)if(-1===c.indexOf(p))if(-1!==g.indexOf(p))f[p]={type:"linebreak",cursor:!1};else{a=!1;for(n=0;n<h.length;++n)if(h[n].start<=p&&h[n].end>=p){h[n].trimmed&&(f[p]={type:"trimmed"},a=!0);break}a||(f[p]={type:"substitution",
for:r,cursor:!1,embed:s(r)},void 0===f[r].refs?f[r].refs=[p]:f[r].refs.push(p),x.push(p))}else f[p]={type:"diacritic",for:r,cursor:!1,embed:s(r)},void 0===f[r].refs?f[r].refs=[p]:f[r].refs.push(p);if(d===k.length-1)break;p=e;if(-1===c.indexOf(e)){a=!1;for(n=0;n<h.length;++n)if(h[n].start<=e&&h[n].end>=e){h[n].trimmed&&(f[e]={type:"trimmed"},a=!0);break}a||(f[e]={type:"substitution",for:r,cursor:function(a){var b=this._text._cursorSubstitutionScripts||"Beng Deva Gujr Guru Knda Mlym Orya Taml Telu".split(" ");
if(!(b instanceof Array))return!0;for(var c=0;c<m.length;++c)for(var d=0;d<m[c].scripts.length;++d)if(m[c].scripts[d].clusters[0]>a&&0<d)return-1!==b.indexOf(m[c].scripts[d-1].script)?!1:!0;a=m[m.length-1].scripts;return-1!==b.indexOf(a[a.length-1].script)?!1:!0}.call(this,e),embed:s(r)},void 0===f[r].refs?f[r].refs=[e]:f[r].refs.push(e),x.push(e))}else r=e,f[e]={type:"normal",cursor:!0,embed:s(e)}}r=function(a,b,c){var d,e,g,h,k;for(d=0;d<x.length;++d){var m=f[x[d]];e=a.indexOf(m.for);if(-1!==e){t=
f[m.for].embed%2?-1:1;if(1==t)for(;0<=e&&e<a.length&&a[e]<x[d];)e+=t;else if(k=!1,0<=e+t&&f[a[e+t]].embed!==m.embed&&(k=!0),!k)for(;0<=e+t&&e+t<a.length&&a[e+t]<x[d];)e+=t;a.splice(e,0,x[d])}}e=[[]];k=void 0;for(d=0;d<a.length;++d)m=f[a[d]],m.embed===k||void 0===k?void 0===k&&(k=m.embed):(e.push([]),k=m.embed),e[e.length-1].push(d);var m=function(b,c){for(var d=1,e=1,g=f[a[b]],h=b+1;h<a.length;++h){var k=a[h];if("for"in f[k]&&f[k].for===g.for)++e,f[k].type===c&&++d;else break}return{num:e,cnt:d}},
l=function(b,c){var d=a[b],e=0;if("refs"in f[d])for(var g=0;g<f[d].refs.length;++g)"diacritic"===f[f[d].refs[g]].type&&++e;return e};k=[];var q=0;for(d=0;d<e.length;++d)if(g=f[a[e[d][0]]])if(g.embed%2)for(g=0;g<e[d].length;++g){h=e[d][g];switch(f[a[h]].type){case "normal":k.push(q++-l(h));break;case "diacritic":k.push(void 0);++q;break;case "substitution":k.push(void 0)}a[h]in b&&(q+=b[a[h]])}else for(g=0;g<e[d].length;++g){h=e[d][g];switch(f[a[h]].type){case "normal":k.push(q++);break;case "diacritic":k.push(void 0);
++q;break;case "substitution":k.push(void 0)}a[h]in b&&(q+=b[a[h]])}k.push(q);for(d=0;d<a.length;++d)switch(e=a[d],f[e].type){case "substitution":g=f[e];if(g.fixed||!g.cursor)break;b=m(d,"substitution");l=c.indexOf(e);e=0;0<l&&(e=c[l]-c[l-1]-1,b.cnt+=e);l=1/(b.cnt+1);q=e*l;e=a.indexOf(g.for);if(e>d)for(h=k[e],k[d]=h,g=d+1;g<d+1+b.num;++g)"diacritic"!==f[a[g]].type&&(q&&(h+=q,q=0),h+=l,k[g]=h,f[a[g]].fixed=!0);else for(h=k[e],g=e+1;g<e+1+b.num;++g)"substitution"===f[a[g]].type&&(f[a[g]].cursor?(q&&
(h+=q,q=0),h+=l,k[g]=h,f[a[g]].fixed=!0):++b.num)}for(d=0;d<a.length;++d)0<d&&d+1<a.length&&(c=f[a[d]],m=f[a[d+1]],"diacritic"!==c.type||c.embed%2||c.embed%2==m.embed%2||(k[d]=k[d+1]-1));return k};p=function(a,b){for(var c=[],d=0;d<a.length;++d)c.push(f[a[d]].embed);return c};s=function(a,b){for(var c=0;c<b.visual.length;++c)f[b.visual[c]].pos={row:a,col:b.pos[c]}};n=function(a,b){var c=this._toEmbed(this._dir);if(b[0]%2===c){for(var d=!0,e=1;e<b.length;++e)if(b[e]%2!==b[0]%2){d=!1;break}if(d)return a.slice(0)}var f,
d=[];f=0;var g,h=[];if("rtl"===this._dir){for(e=a.length-1;0<=e;--e)if(b[e]===c)f&&(f=0),d.push(a[e]);else if(f)d.push(a[e+f]);else{f=new nrdp.gibbon.TextCursor.Embedder;for(g=e;0<=g&&!f.feed(b[g]);--g);++g;d.push(a[g]);f=1}d.reverse()}else{for(e=0;e<a.length;++e)if(b[e]!==c&&(!e||0<e&&b[e-1]<b[e]))if(1<b[e]){f=new nrdp.gibbon.TextCursor.Embedder;for(g=e;g<a.length&&!f.feed(b[g]);++g);h.push({start:g,end:e-1})}else{f=new nrdp.gibbon.TextCursor.Embedder;for(g=e;g<a.length&&!f.feed(b[g]);++g);--g;h.push({start:e,
end:g})}h.sort(function(a,b){return a.start-b.start});c=0;d=a.slice(0);for(e=0;e<a.length;++e)0<h.length&&h[0].start+c===e&&(f=d[h[0].end+c],h[0].end>h[0].start?(d.splice(h[0].end+c,1),d.splice(h[0].start+c,0,f)):(d.splice(h[0].start+c,0,f),d.splice(h[0].end+c,1)),h[0].start>h[0].end&&++c,h.splice(0,1),++e)}return d};for(d=0;d<m.length;++d){v=[];for(a=0;a<m[d].line.length;++a)for(e=0;e<m[d].line[a].clusters.length;++e)v.push(m[d].line[a].clusters[e]);m[d].pos=r(v,l,k);m[d].embed=p(v);m[d].visual=
v;m[d].fixedVisual=n.call(this,v,m[d].embed);e=v.slice(0);e.sort(function(a,b){return a-b});m[d].logical=e;s(d,m[d])}this._layout=m;this._attrs=f;void 0===this._pos&&(void 0!==this._text._cursorPosition?this._pos={row:0,col:this._text._cursorPosition}:(d=this._text.cursorInformation)?"cluster"in d?(d=this._positionForCluster(d.cluster),void 0!==d&&(this._pos=d,this._updatePosition())):this._pos={row:m.length-1,col:-1}:this._pos={row:0,col:0},this._pos&&(e=m[this._pos.row].logical[this._pos.col],d=
m[this._pos.row].fixedVisual.indexOf(e),-1!==d&&d!==m[this._pos.row].visual.indexOf(e)&&(this._pos.moveInfo={index:d})));this._visual=c;this._logical=u;this._breaks=k;this._lineBreaks=g}},_extractBuffer:function(a){this._buffer=nrdp.atoutf32(a.data.layout.text,!0)},_applyPending:function(){if(void 0!==this._pending){var a=this._pending;this._pending=void 0;for(var b=0;b<a.length;++b)this[a[b].func].apply(this,a[b].args)}},_positionInformation:function(a){if(void 0!==a&&void 0!==this._layout){if(0>
a.row||a.row>=this._layout.length)return null;var b=this._layout[a.row];return{visual:b.visual,fixedVisual:b.fixedVisual,logical:b.logical,embed:b.embed,pos:b.pos,dir:b.dir,clusterCount:b.clusterCount,cluster:0>a.col?void 0:b.logical[a.col]}}},_updatePosition:function(){var a=function(a,b,c){if(c)for(;0<=b+c&&b+c<a.pos.length;)if(void 0===a.pos[b+c])b+=c;else return a.pos[b+c];else{for(;void 0===a.pos[b]&&b+1<a.pos.length;)++b;return a.pos[b]}},b=this._positionInformation(this._pos);if(b){var c,d,
e,f,g,h="ltr"===this._dir;if(void 0===b.cluster){c=b.logical.length-1;e=void 0;if(this._pos.row+1<this._layout.length){for(e=b.logical[c];0<=c-1&&b.logical[c-1]===e;)--c;e+=b.logical.length-c}c={x:"ltr"===this._dir?b.clusterCount:0,y:this._pos.row};void 0!==e&&(b.cluster=e);e=h?b.visual.length:-1;d=this._toEmbed(this._dir);this._cluster=void 0}else{this._cluster=b.cluster;e=b.visual.indexOf(b.cluster);if(-1===e){nrdp.log.error("update: visual -1 for cluster "+b.cluster);return}d=b.embed[e];if(d%2)for(c=
{x:a(b,e,1),y:this._pos.row};e+1<b.pos.length&&void 0===b.pos[e+1];)++e;else c={x:a(b,e),y:this._pos.row}}var k=function(c,d,e,f,g){var h=b.embed[c],k=new nrdp.gibbon.TextCursor.Embedder;for(k.feed(h);0<=c+d&&c+d<b.embed.length&&(c+=d,!k.feed(b.embed[c])););k=0;"rtl"!==g||c!==b.embed.length-1||b.embed[c]%2||(k=1);g=a(b,c,k);f&&b.embed[c]%2!==h%2&&(g=Math.floor(g-d));return{x:g,y:e}},l=this._toEmbed(this._dir);if(l%2===d%2)d=h?-1:1,0<=e+d&&e+d<b.embed.length&&l%2!==b.embed[e+d]%2&&(f=c,h&&e+1<b.embed.length&&
1<b.embed[e+1]&&(g=k(e+1,1,this._pos.row,!1,this._dir)),g||(g=k(e+d,d,this._pos.row,h,this._dir)));else if(d=h?1:-1,0>e+d||e+d>=b.embed.length||0<=e+d&&e+d<b.embed.length&&l%2===b.embed[e+d]%2)g=c,h&&e+1<b.embed.length&&1<b.embed[e+1]&&(f=k(e+1,1,this._pos.row,!1,this._dir)),f||(f=k(e,-1*d,this._pos.row,h,this._dir));this._text.cursorInformation={strong:f?f:c,weak:g,cluster:b.cluster}}},_refind:function(a){if("cluster"in a){for(var b=function(a,b){var c=b.logical[a],d=b.fixedVisual.indexOf(c);-1!==
d&&d!==b.visual.indexOf(c)&&(this._pos.moveInfo={index:d})},c=0;c<this._layout.length;++c){var d=this._layout[c],e=d.logical.indexOf(a.cluster);if(-1!==e){a.offset&&(e+=a.offset);this._pos={row:c,col:e};b.call(this,e,d);return}if(0<c&&(e=this._layout[c-1],a.cluster<d.logical[0]&&a.cluster<=e.logical[e.logical.length-1])){this._pos={row:c-1,col:-1};return}if(a.cluster<d.logical[d.logical.length-1])for(e=0;e<d.logical.length;++e)if(d.logical[e]>a.cluster){if(e){a.offset&&(e+=a.offset);this._pos={row:c,
col:e};b.call(this,e,d);return}if(0<c){this._pos={row:c-1,col:-1};return}}}this._pos={row:this._layout.length-1,col:-1}}else this._pos=a},_toEmbed:function(a){return"ltr"===a?0:1},_skip:function(a,b,c){var d=1,e;if(b===nrdp.gibbon.TextCursor.BACKWARD){if(void 0===a.cluster)b=a.logical.length-1;else{if(0>=this._pos.col)return 0>this._pos.col||0>=this._pos.row?void 0:{cluster:a.logical[0]-1,count:1};b=this._pos.col-1}if(c===nrdp.gibbon.TextCursor.GRAPHEME){e=a.logical[b];var f=function(a){return"normal"===
a.type||"substitution"===a.type&&a.cursor?!0:!1};if(!f(this._attrs[e]))for(;0<b&&(c=a.logical[b-1],--b,++d,!f(this._attrs[c])););else if(void 0!==this._attrs[e].refs)for(;0<b;)if(c=a.logical[b-1],-1!==this._attrs[e].refs.indexOf(c))--b,++d;else break}}else{e=a.cluster;if(void 0===e){if(this._pos.row+1<this._layout.length)return{cluster:a.logical[a.logical.length-1]+1,count:1};return}b=this._pos.col;if(c===nrdp.gibbon.TextCursor.GRAPHEME){var f=a.logical.length,g=b,h=!1;if("normal"!==this._attrs[e].type)for(;g<
f-1&&(c=a.logical[g+1],++g,++d,"diacritic"===this._attrs[c].type?h=!0:"substitution"!==this._attrs[c].type||this._attrs[c].cursor||(h=!0),"normal"!==this._attrs[c].type););else if(void 0!==this._attrs[e].refs)for(;g<f-1;)if(c=a.logical[g+1],"diacritic"===this._attrs[c].type?h=!0:"substitution"!==this._attrs[c].type||this._attrs[c].cursor||(h=!0),-1!==this._attrs[e].refs.indexOf(c))++g,++d;else break;h||(d=1)}}return{cluster:a.logical[b],count:d}},_dump:function(){for(var a="",b=this._text.contents,
c=0,d=b.length;c<d;c++){var e;e=b.charCodeAt(c);e=Number(e).toString(16);e="0000".substr(0,4-e.length)+e;a+=e+" "}nrdp.log.error(a)},_verifyDir:function(a){if(a!==nrdp.gibbon.TextCursor.FORWARD&&a!==nrdp.gibbon.TextCursor.BACKWARD&&a!==nrdp.gibbon.TextCursor.LEFT&&a!==nrdp.gibbon.TextCursor.RIGHT)throw"Invalid direction: "+a;},_verifyFlag:function(a){if(a!==nrdp.gibbon.TextCursor.CHARACTER&&a!==nrdp.gibbon.TextCursor.GRAPHEME)throw"Invalid flag: "+a;},_positionForCluster:function(a){if(this._layout&&
this._layout.length){var b,c;for(b=0;b<this._layout.length;++b)if(c=this._layout[b].logical.indexOf(a),-1!==c)return{row:b,col:c};for(b=0;b<this._layout.length;++b)if(this._layout[b].logical[this._layout[b].logical.length-1]>a)for(c=0;c<this._layout[b].logical.length;++c)if(this._layout[b].logical[c]>a)return{row:b,col:c};b=this._layout.length-1;c=this._layout[b].logical[this._layout[b].logical.length-1];return{row:b,col:c}}},get valid(){return this._valid},line:function(a,b){this._verifyDir(a);if(void 0!==
this._pending)this._pending.push({func:"line",args:arguments});else if(void 0!==this._pos){var c=this._pos.row;if(void 0!==c&&!(0>c+a||c+a>=this._layout.length))if(void 0!==b)this._reposition={row:c+a,col:b};else{void 0===this._lineX&&(this._lineX=this._text._cursorBounds.x+this._text._cursorBounds.width);var c=c+a,d=this._positionInformation({row:c,col:-1});if(d){var e=this._text._cursorClusterForPosition({row:c,x:this._lineX});b=void 0==e.cluster?-1:d.logical.indexOf(e.cluster);"rtl"===this._dir&&
(0===b?(b=-1,e=4294967295):-1===b&&(b=0,e=d.logical[0]));this._pos={row:c,col:b};c=d.fixedVisual.indexOf(e);-1!==c&&c!==d.visual.indexOf(e)&&(this._pos.moveInfo={index:c});this._updatePosition()}}}},move:function(a){this._verifyDir(a);if(void 0!==this._pending)this._pending.push({func:"move",args:arguments});else{void 0!==this._lineX&&(this._lineX=void 0);var b=this._positionInformation(this._pos);if(b){var c;if(void 0===b.cluster){if(this._pos.row===this._layout.length-1&&("ltr"===this._dir&&a===
nrdp.gibbon.TextCursor.FORWARD||"rtl"===this._dir&&a===nrdp.gibbon.TextCursor.BACKWARD))return;if("ltr"===this._dir&&a===nrdp.gibbon.TextCursor.FORWARD||"rtl"===this._dir&&a===nrdp.gibbon.TextCursor.BACKWARD){this._pos.col=0;this._pos.row+=1;"rtl"===this._dir&&(b=this._positionInformation(this._pos),c=b.fixedVisual.length-1,b.fixedVisual[c]!==b.visual[c]&&(this._pos.moveInfo={index:c}));this._updatePosition();return}"rtl"===this._dir&&a===nrdp.gibbon.TextCursor.FORWARD?c=-1:"ltr"===this._dir&&a===
nrdp.gibbon.TextCursor.BACKWARD&&(c=b.visual.length)}this._pos.moveInfo?(void 0===c&&(c=this._pos.moveInfo.index),delete this._pos.moveInfo):void 0===c&&(c=b.visual.indexOf(b.cluster));if(0>c+a)"ltr"===this._dir?0<this._pos.row?(this._pos.row-=1,this._pos.col=-1,this._updatePosition()):this._pos.moveInfo={index:c}:"rtl"===this._dir&&(this._pos.col=-1,this._updatePosition());else if(c+a>=b.visual.length)"rtl"===this._dir?0<this._pos.row?(this._pos.row-=1,this._pos.col=-1,this._updatePosition()):this._pos.moveInfo=
{index:c}:"ltr"===this._dir&&(this._pos.col=-1,this._updatePosition());else{for(var d,e=0;;){c+=a;if(0>c||c>=b.fixedVisual.length)break;d=b.fixedVisual[c];var f=c-a;0<=f&&f<b.fixedVisual.length?d===b.fixedVisual[f]?++e:e=0:e=0;if(this._attrs[d+e].cursor)break}0>c?(this._pos.col="rtl"===this._dir?-1:0,this._updatePosition()):c>=b.fixedVisual.length?(this._pos.col="ltr"===this._dir?-1:0,this._updatePosition()):(b.fixedVisual[c]!==b.visual[c]&&(this._pos.moveInfo={index:c}),b=b.logical.indexOf(d),-1===
b?nrdp.log.error("move: couldn't find logical for cluster "+d):(this._pos.col=b,this._updatePosition()))}}}},insert:function(a){if("string"!==typeof a)throw"insert needs a text string";if(a.length)if(void 0!==this._pending)this._pending.push({func:"insert",args:arguments});else{var b=this._positionInformation(this._pos);if(b){var c=b.cluster;if(void 0===c){for(var d=b.logical.length-1,c=b.logical[d];0<=d-1&&b.logical[d-1]===c;)--d;c+=b.logical.length-d}b=nrdp.utf32toa(this._buffer,0,c);d=nrdp.utf32toa(this._buffer,
c);this._pending=[];this._reposition={cluster:c,offset:a.length};this._text.contents=b+a+d}}},remove:function(a,b){this._verifyDir(a);1<arguments.length&&this._verifyFlag(b);if(void 0!==this._pending)this._pending.push({func:"remove",args:arguments});else{var c=this._positionInformation(this._pos);if(c&&(c=this._skip(c,a,b),void 0!==c)){var d=nrdp.utf32toa(this._buffer,0,c.cluster),e=nrdp.utf32toa(this._buffer,c.cluster+c.count);this._pending=[];this._reposition={cluster:c.cluster};this._text.contents=
d+e}}},set:function(a){if(void 0!==this._pending)this._pending.push({func:"set",args:arguments});else{void 0===a&&(a=0);var b=function(a,b){if(!(0>a.row||a.row>=b.length)){var c=a.col,g=b[a.row];if(!(0>c||c>=g.logical.length)){var c=g.logical[c],h=g.fixedVisual.indexOf(c);-1!==h&&h!==g.visual.indexOf(c)&&(a.moveInfo={index:h})}}},c;"number"===typeof a?(this._pos={row:0,col:0<a?a:0},b(this._pos,this._layout),this._updatePosition()):"cluster"in a?(c=this._layout[this._layout.length-1],c=a.cluster>c.logical[c.logical.length-
1]?{row:this._layout.length-1,col:-1}:this._positionForCluster(a.cluster),void 0!==c&&(this._pos=c,b(this._pos,this._layout),this._updatePosition())):"x"in a&&"y"in a?(c=this._text._cursorClusterForPosition({y:a.y,x:a.x}),void 0==c.cluster?(this._pos={col:"rtl"===this._dir?0:-1,row:c.line},this._updatePosition()):(c=this._positionForCluster(c.cluster),void 0!==c&&(this._pos=c,b(this._pos,this._layout),this._updatePosition()))):"row"in a&&"col"in a&&(this._pos={row:a.row,col:a.col},b(this._pos,this._layout),
this._updatePosition())}}};nrdp.gibbon.Player=function(a,b,c){this._object=new GibbonSyncObject(this,a._id,nrdp.gibbon._sync_Player,c,b);this._id=c;this._name=b;this._widget=a;this._path=a._path+".player";this._syncData||(this._syncData=a._syncData.player={});this._properties=nrdp._classes[this.classname].properties.byName};nrdp.gibbon.Player._defaults={name:void 0,texture:void 0};
nrdp.gibbon.Player.prototype={classname:"PlayerBridge",constructor:nrdp.gibbon.Player,addEventListener:function(a,b){nrdp._addEventListener(this,a,b)},removeEventListener:function(a,b){nrdp._removeEventListener(this,a,b)},get name(){return this._name},get texture(){return this._syncData.hasOwnProperty("texture")?this._syncData.texture:this._defaults?this._defaults("texture"):this.constructor._defaults.texture},set texture(a){this._syncData.hasOwnProperty("texture")&&a==(this._syncData.hasOwnProperty("texture")?
this._syncData.texture:this._defaults?this._defaults("texture"):this.constructor._defaults.texture)||(this._syncData.texture=a,this._object.setSyncProperty(this._properties.texture,a),void 0!==nrdp.gibbon._breaks&&this._widget._maybeBreak(nrdp.gibbon.DEBUGGER_ATTRIBUTE_MODIFIED))},_updateProperty:function(a,b){this._syncData[a]=b},_handleEvent:function(a){var b=!0;"textLoaded"!=a.name&&(b=!1);return b}};
nrdp.gibbon.Effect=function(a,b,c){a._syncData.effects||(a._syncData.effects={});this._object=new GibbonSyncObject(this,a._id,nrdp.gibbon._sync_Effect,c,b);this._id=c;this._type=b;this._widget=a;this._name=nrdp.gibbon.Effect._createName(this._id);this._path=a._path+".effects."+this._name;this._syncData=a._syncData.effects[this._name];this._syncData||(this._syncData=a._syncData.effects[this._name]={});this._properties=nrdp._classes[this.classname].properties.byName};
nrdp.gibbon.Effect._createName=function(a){return"effect"+a};nrdp.gibbon.Effect._defaults={visible:!0,accelerated:void 0,params:{}};
nrdp.gibbon.Effect.prototype={classname:"EffectBridge",constructor:nrdp.gibbon.Effect,addEventListener:function(a,b){nrdp._addEventListener(this,a,b)},removeEventListener:function(a,b){nrdp._removeEventListener(this,a,b)},stopAnimation:function(a,b){void 0===b&&(b=!0);this.startAnimation(a,void 0,void 0,0,void 0,"stop",{end:b})},startAnimation:function(a,b,c,d,e,f,g){c=nrdp.gibbon._createAnimation(a,b,c,d,e,f,g);d=this._syncData.hasOwnProperty("params")?this._syncData.params:this._defaults?this._defaults("params"):
this.constructor._defaults.params;void 0===b&&((b=d[a])&&b instanceof Object&&(b=b.value),c.animate.previous=b);d[a]=c;b={};b[a]=c;this._syncData.params=d;this._object.setSyncProperty(this._properties.params,b,!0);return c.animate.id},get type(){return this._type},get accelerated(){return this._syncData.hasOwnProperty("accelerated")?this._syncData.accelerated:this._defaults?this._defaults("accelerated"):this.constructor._defaults.accelerated},get visible(){return this._syncData.hasOwnProperty("visible")?
this._syncData.visible:this._defaults?this._defaults("visible"):this.constructor._defaults.visible},set visible(a){this._syncData.visible=a;this._object.setSyncProperty(this._properties.visible,a)},get params(){return this._syncData.hasOwnProperty("params")?this._syncData.params:this._defaults?this._defaults("params"):this.constructor._defaults.params},set params(a){"mask"==this.type&&a.widget&&(a.widget=a.widget._id);a.image&&(a.image=nrdp.gibbon._prepareNetworkRequest(a.image),nrdp.gibbon._resolveDepends(a.image));
this._syncData.params=a;this._object.setSyncProperty(this._properties.params,a,!0)},_handleEvent:function(a){var b=!0;"animationFinished"==a.name?(this._syncData[a.data.property]=a.data.value,nrdp._callEventListeners(this,{type:a.name,data:a.data})):"effectChanged"==a.name?nrdp._callEventListeners(this,{type:a.name,data:a.data}):b=!1;return b}};
(function(){function a(a){nrdp._sendSyncdEvent(nrdp._gotEvent,nrdp,a)}function b(){return"undefined"!==typeof nrdp_platform&&"undefined"!==typeof this.platform.jscBridgeEnabled&&this.platform.jscBridgeEnabled()?this.platform.jscBridgeInit(a):!1}function c(a,b,c){return this.platform.jscBridgeSetProperty(a?"nrdp."+a:"nrdp",b,c)}function d(a,b,c){return this.platform.jscBridgeInvoke(a?"nrdp."+a:"nrdp",b,c)}function e(a){this.platform.log(a)}function f(a,b){return this.platform.atob(a,b)}function g(a,
b,c){return this.platform.btoa(a,b,c)}function h(a){return this.platform.parseJSON(a)}function k(){return this.platform.mono()}function l(){return this.platform.pmono()}function u(a){(a=this.platform.parseXML(a))&&nrdp._fixXml(a);return a}function s(a,b,c){return this.platform.compress(a,b,c)}function m(a,b,c){return this.platform.uncompress(a,b,c)}function n(a){return this.platform.random(a)}function v(a){return this.platform.gctag(a)}nrdp_platform.jsc&&(nrdp._backchannel={name:"GibbonJavaScriptCore",
isNative:!0,init:b,console:e,setProperty:c,invoke:d,atob:f,btoa:g,mono:k,pmono:l,atoutf8:function(a){return this.platform.atoutf8(a)},utf8toa:function(a){return this.platform.utf8toa(a)},atoutf32:function(a){return this.platform.atoutf32(a)},utf32toa:function(a,b,c){return this.platform.utf32toa(a,b,c)},parseJSON:h,parseXML:u,compress:s,uncompress:m,random:n,gctag:v,platform:"undefined"===typeof nrdp_platform?void 0:nrdp_platform})})();
nrdp.signup={getToken:function(a,b,c){nrdp.signup._fn("getToken",{endpoint:a,userdata:b},c)},authorizeCredentials:function(a,b,c){nrdp.signup._fn("authorizeCredentials",{endpoint:a,userdata:b},c)},getPaymentAPIVersion:function(){return 4},_nextIdx:1,_cbs:{},_fn:function(a,b,c){b||(b={});b.idx=this._nextIdx++;this._cbs[b.idx]=c;nrdp._invoke("signup",a,b)},_handleEvent:function(a){if(a.data&&a.data.idx){if("object"==typeof this._cbs[a.data.idx]&&null!=this._cbs[a.data.idx]&&"function"==typeof this._cbs[a.data.idx][a.name])switch(a.name){case "onSuccess":var b=
a.data.idx,c=a.data;delete c.idx;this._cbs[b][a.name](c);break;case "onFailure":this._cbs[a.data.idx][a.name](a.data.error);break;case "onComplete":this._cbs[a.data.idx][a.name](),delete this._cbs[a.data.idx]}}else return!1;return!0},_syncData:{}};
