xmp.CONTROL_STREAM_NODE_PATH="/PlayerContexts/Global/ControlStream";xmp.CONTROL_STREAM_SERVICE="ControlStream";xmp.CONTROL_STREAM_ENVIRONMENT_LABEL="Environment Label";xmp.CONTROL_STREAM_URL="Url";xmp.CONTROL_STREAM_RECONNECT_RETRIES="Reconnect Retries";xmp.CONTROL_STREAM_RECONNECT_RETRY_INTERVAL="Reconnect Retry Interval";xmp.CONTROL_STREAM_REFRESH_INTERVAL="RefreshInterval";xmp.CONTROL_STREAM_START_DELAY="Start Delay";xmp.CONTROL_STREAM_RESOURCE_TRANSPORT="controlStreamResource";xmp.ENVIRONMENT_LABEL="{{environment_label}}";xmp.RESOURCE_NAME="name";xmp.RESOURCE_LABEL="label";xmp.RESOURCE_WEB_URL="webUrl";xmp.RESOURCE="resource";xmp.WEB_RESOURCE_CACHING_CONTEXT="retrieved from the web";xmp.TRIGGER_RESOURCE_CACHING_CONTEXT="received from trigger";xmp.START_DELAY_TIMER="StartDelay";xmp.REFRESH_RESOURCE_TIMER="RefreshResources";xmp.RECONNECT_TIMER="Reconnect";xmp.ControlStream=function(){this.listener=null;};xmp.ControlStream.prototype.init=function(aa){try{this.logger=new xmp.util.internals.CategoryLogger(xmp.CONTROL_STREAM_SERVICE);this._validateListener(aa);this.listener=aa;this._resetReconnect();this.reader=xmp.ControlStreamReaderFactory.createReader(xmp.util.internals.BrowserDetect.OS,this);var ba=xmp.util.SettingsManager.getInstance().getGlobalContextNode().getNodeForPath(xmp.CONTROL_STREAM_NODE_PATH);this._initProperties(ba);this._initResources(ba);this._start();}
catch(e){this._handleError("Initializing.",e);}};xmp.ControlStream.prototype.fini=function(){if(this.reader){this.reader.close();}
if(this.startDelayTimer){this.startDelayTimer.stop();this.startDelayTimer=null;}
if(this.refreshResourcesTimer){this.refreshResourcesTimer.stop();this.refreshResourcesTimer=null;}
this._resetReconnect();};xmp.ControlStream.prototype._start=function(){if(0===this.startDelay){this._handleStart();}
else{this.startDelayTimer=this._createTimer({id:xmp.START_DELAY_TIMER,interval:this.startDelay,handler:this._onDelayedStart});this.startDelayTimer.start();}};xmp.ControlStream.prototype._validateListener=function(ca){if(!ca){throw new xmp.ControlStreamError("Validating listener.","Missing control stream listener.");}
if(false===xmp.isDefined(ca.onControlStreamError)){throw new xmp.ControlStreamError("Validating listener.","Invalid control stream listener.  Missing \"onControlStreamError\" handler.");}
if(false===xmp.isDefined(ca.onControlStreamTrigger)){throw new xmp.ControlStreamError("Validating listener.","Invalid control stream listener.  Missing \"onControlStreamTrigger\" handler.");}
if(false===xmp.isDefined(ca.onControlStreamTriggerInit)){throw new xmp.ControlStreamError("Validating listener.","Invalid control stream listener.  Missing \"onControlStreamTriggerInit\" handler.");}};xmp.ControlStream.prototype._validateResource=function(da){if(da.name.length===0){throw new xmp.ControlStreamError("Validating resource.","Missing control stream resource name.");}
if(da.label.length===0){throw new xmp.ControlStreamError("Validating resource.","Missing control stream resource label.");}
if(da.webUrl.length===0){throw new xmp.ControlStreamError("Validating resource.","Missing control stream \""+da.name+"\" web url.");}};xmp.ControlStream.prototype._initProperties=function(ea){this.url=ea.getString(xmp.CONTROL_STREAM_URL,xmp.NO_DEFAULT_VALUE);if(this.url.length===0){throw new xmp.ControlStreamError("Initializing properties.","Missing control stream url.");}
this.reconnectRetryInterval=ea.getInt(xmp.CONTROL_STREAM_RECONNECT_RETRY_INTERVAL,0);if(this.reconnectRetryInterval===0){throw new xmp.ControlStreamError("Initializing properties.","Missing control stream reconnect retry interval.");}
this.maxReconnectRetryCount=ea.getInt(xmp.CONTROL_STREAM_RECONNECT_RETRIES,0);this.startDelay=ea.getInt(xmp.CONTROL_STREAM_START_DELAY,0);var fa=ea.getNodeForPath(xmp.CONTROL_STREAM_REFRESH_INTERVAL);this.refreshInterval=fa.getInt(xmp.util.internals.BrowserDetect.OS,0);if(this.refreshInterval===0){throw new xmp.ControlStreamError("Initializing properties.","Missing control stream refresh interval for the \""+xmp.util.internals.BrowserDetect.OS+"\" platform.");}};xmp.ControlStream.prototype._initResources=function(ga){this.resources={};var ha=ga.getString(xmp.CONTROL_STREAM_ENVIRONMENT_LABEL,xmp.NO_DEFAULT_VALUE);if(ha.Length===0){throw new xmp.ControlStreamError("Initializing resources.","Missing control stream environment label.");}
var ia=ga.retrieveChildren();var ja=ia.length;for(var i=0;i<ja;i++){var ka=ia[i];if(ka.getName()===xmp.CONTROL_STREAM_REFRESH_INTERVAL){continue;}
var la=ka.getString(xmp.RESOURCE_LABEL,xmp.NO_DEFAULT_VALUE);la=la.replace(xmp.ENVIRONMENT_LABEL,ha);var ma={initialized:false,name:ka.getString(xmp.RESOURCE_NAME,xmp.NO_DEFAULT_VALUE),label:la,webUrl:ka.getString(xmp.RESOURCE_WEB_URL,xmp.NO_DEFAULT_VALUE),data:null};this._validateResource(ma);this.resources[ma.name]=ma;}};xmp.ControlStream.prototype._refreshResources=function(na){for(var oa in this.resources){this._getResourceFromWeb(this.resources[oa],na);}};xmp.ControlStream.prototype._getResourceFromWeb=function(pa,qa){var ra=((true===qa)?this._onInitResource:this._onResourceLoadedFromWeb);var sa=new xmp.util.Callback(xmp.CONTROL_STREAM_SERVICE,ra,this);sa.setMetadata(xmp.RESOURCE,pa);var ta=xmp.net.AjaxRequestManager.getInstance();ta.request(xmp.CONTROL_STREAM_SERVICE,sa,xmp.CONTROL_STREAM_RESOURCE_TRANSPORT,pa.webUrl,xmp.net.ContentTypes.JSON,null);};xmp.ControlStream.prototype._onResourceLoadedFromWeb=function(ua,va){this._setWebResource(ua,va,this.listener.onControlStreamTrigger,true);};xmp.ControlStream.prototype._onInitResource=function(wa,xa){var ya=null;try{ya=wa.getMetadata(xmp.RESOURCE,{});this._setWebResource(wa,xa,this.listener.onControlStreamTriggerInit,false);ya.initialized=true;}
catch(e){if(ya){if(false===ya.initialized){try{this.listener.onControlStreamTriggerInit(ya.name,null);}
catch(e){}
ya.initialized=true;}}}};xmp.ControlStream.prototype._setResource=function(za,Aa,Ba,Ca,Da){this._validateResourceData(Aa,Ba);if(true===Ca&&false===this.checkResourceVersion(Aa,Ba)){this.logger.info((new Date()).toString()+" - Ignoring resource \""+Aa.name+"\" "+za+".  Already up to date ("+Ba.modifiedDate+").");return;}
Aa.data=Ba;this.logger.info((new Date()).toString()+" - Resource \""+Aa.name+"\" "+za+".");Da.call(this.listener,Aa.name,Ba);};xmp.ControlStream.prototype.checkResourceVersion=function(Ea,Fa){if(!Ea.data){return true;}
return(Fa.modifiedDate>Ea.data.modifiedDate);};xmp.ControlStream.prototype._validateResourceData=function(Ga,Ha){if(!Ha){throw new xmp.ControlStreamError("Validating resource data.","NULL resource data.");}
if(!Ha.id||Ha.id.length===0){throw new xmp.ControlStreamError("Validating resource data.","Invalid control stream resource \""+Ga.name+"\" data.  Missing resource id.");}
if(Ga.label!==Ha.id){throw new xmp.ControlStreamError("Validating resource data.","Invalid control stream resource \""+Ga.name+"\" data id \""+Ha.id+"\".  Expected \""+Ga.label+"\".");}};xmp.ControlStream.prototype._createTimer=function(Ia){var Ja=new xmp.util.Callback(Ia.id,Ia.handler,this);return new xmp.util.Timer(Ia.id,Ia.interval,-1,Ja);};xmp.ControlStream.prototype._handleStart=function(){this._connect();this._refreshResources(true);this.refreshResourcesTimer=this._createTimer({id:xmp.REFRESH_RESOURCE_TIMER,interval:this.refreshInterval,handler:this._onRefreshResources});this.refreshResourcesTimer.start();};xmp.ControlStream.prototype._onDelayedStart=function(Ka,La){try{this.startDelayTimer.stop();this.startDelayTimer=null;this._handleStart();}
catch(e){this._handleError("Starting after delay.",e);}};xmp.ControlStream.prototype._onRefreshResources=function(Ma,Na){try{this._refreshResources(false);}
catch(e){this._handleError("Refreshing all resources.",e);}};xmp.ControlStream.prototype._handleError=function(Oa,e){var Pa=e;if(false===(Pa instanceof xmp.ControlStreamError)){Pa=new xmp.ControlStreamError(((e.context)?e.context:Oa),((e.rawMessage)?e.rawMessage:e.message));Pa.setInnerError(e);}
this._logError(Pa);if(!this.listener){xmp.handleFatalError(Pa);}
else if(true===xmp.isDefined(this.listener.onControlStreamError)){this.reader.close();this.listener.onControlStreamError(Pa);}};xmp.ControlStream.prototype.onReaderError=function(e){this._logError(e);this._reconnect();};xmp.ControlStream.prototype.onReaderTrigger=function(Qa,Ra){var Sa=null;try{Sa=this._getResourceFromLabel(Qa);this._validateTrigger(Qa,Sa);var Ta=Base64.decode(Ra);var Ua=this._parseJson(Ta);this._setResource(xmp.TRIGGER_RESOURCE_CACHING_CONTEXT,Sa,Ua,false,this.listener.onControlStreamTrigger);this.logger.info(Ta);}
catch(e){var Va="TRIGGER PROCESSING ERROR.";if(Sa){Va="TRIGGER \""+Sa.name+"\" PROCESSING ERROR.";}
this._logError(e);this._getResourceFromWeb(this._getResourceFromLabel(Qa));}};xmp.ControlStream.prototype.onReaderConnected=function(){this.logger.info("Connected.");this._resetReconnect();};xmp.ControlStream.prototype.onReaderPlugInError=function(e){this.listener.onPlugInError(e);};xmp.ControlStream.prototype.onReaderUnsupportedPlatformError=function(e){this.listener.onUnsupportedPlatformError(e);};xmp.ControlStream.prototype._reconnect=function(){if(!this.reconnectTimer){this.reconnectRetryCount=0;this.reconnectTimer=this._createTimer({id:xmp.RECONNECT_TIMER,interval:this.reconnectRetryInterval,handler:this._onReconnect});this.reconnectTimer.start();}};xmp.ControlStream.prototype._onReconnect=function(Wa,Xa){try{if(true===this.reader.isConnected()||(this.maxReconnectRetryCount>0&&this.reconnectRetryCount===this.maxReconnectRetryCount)){if(this.reconnectRetryCount===this.maxReconnectRetryCount&&false===this.reader.isConnected()){this.logger.warn("Control stream reconnect retry maximum "+this.maxReconnectRetryCount+" limit reached...");}
this._resetReconnect();return;}
this.reconnectRetryCount++;this.logger.warn("Control stream reconnect retry "+this.reconnectRetryCount+"...");this._connect();this._refreshResources(false);}
catch(e){this._logError(e);}};xmp.ControlStream.prototype._getResourceFromLabel=function(Ya){for(var Za in this.resources){var $a=this.resources[Za];if($a.label===Ya){return $a;}}
return null;};xmp.ControlStream.prototype._logError=function(e){this.logger.warn(e.message);};xmp.ControlStream.prototype._connect=function(){var ab=this.reader.open(this.url);if(ab){this.logger.info("Connecting to \""+ab+"\".");}};xmp.ControlStream.prototype._resetReconnect=function(){if(this.reconnectTimer){this.reconnectTimer.stop();this.reconnectTimer=null;}
this.reconnectRetryCount=0;};xmp.ControlStream.prototype._validateTrigger=function(bb,cb){if(!cb){throw new xmp.ControlStreamError("Validating trigger.","Missing control stream resource configuration for \""+bb+"\" trigger.");}};xmp.ControlStream.prototype._parseJson=function(db){var eb=xmp.trimString(db);return this._parseJavaScript('('+eb+')');};xmp.ControlStream.prototype._parseJavaScript=function(fb){return eval(fb);};xmp.ControlStream.prototype._setWebResource=function(gb,hb,ib,jb){try{var kb=gb.getMetadata(xmp.RESOURCE,{});if(true===hb.isError()){throw new xmp.ControlStreamError("Initializing resources.","Unable to retrieve control stream resource \""+kb.name+"\" from url \""+kb.webUrl+"\". \n\n"+hb.makeReport());}
this._setResource(xmp.WEB_RESOURCE_CACHING_CONTEXT,kb,hb.getJsonObject(),true,ib);}
catch(e){var lb="";if(e instanceof xmp.ControlStreamError){lb=e.message;}
else{lb="Unable to retrieve control stream resource \""+kb.name+"\" from url \""+kb.webUrl+"\". \n\n"+e.message;}
this.logger.warn(lb);if(false===jb){throw e;}}};xmp.CONTROL_STREAM_READER="ControlStreamReader";xmp.ControlStreamReader=function(mb){this.listener=mb;this.connected=false;this.registry=new xmp.PlayerModeRegistry();this.state=this.registry.findMode(xmp.IDLE);this.player=xmp.NativePlayerRegistry.getNullPlayer();this.viewManager=new xmp.ViewManager(this.getName());this.viewManager.setViewportConfig(xmp.NULL_MIME_TYPE,xmp.DHTML_VIEWPORT);this.viewManager.setViewportConfig(xmp.WINDOWS_MEDIA_MIME_TYPE,xmp.DHTML_VIEWPORT);xmp.NativePlayerRegistry.createGroup(this.getName(),this);};xmp.ControlStreamReader.prototype.open=function(nb){var ob=this.createPlayableNode(nb);if(false===this._initNativePlayer(ob)){this.state.open(this,ob);}
return ob.getURI();};xmp.ControlStreamReader.prototype.close=function(){this.state.close(this);this.connected=false;};xmp.ControlStreamReader.prototype.createPlayableNode=function(pb){var qb=new xmp.util.PlayableNode();qb.setMimeTypes([xmp.WINDOWS_MEDIA_MIME_TYPE]);qb.setURI(pb);qb.setStreamingMode(xmp.CONTROL_STREAMING_MODE);qb.setEndedFrame(xmp.LAST_FRAME);xmp.PlayerPolicy.apply(this,qb);return qb;};xmp.ControlStreamReader.prototype.onNativePlayerStateChange=function(rb,sb){try{if(rb===xmp.OPEN){this.state.play(this);this.connected=true;this.listener.onReaderConnected();}
else if(rb===xmp.ENDED){throw new xmp.ControlStreamReaderError("Handling native player state change.","Control stream ended.");}}
catch(e){this._handleError("Handling native player state change.",e);}};xmp.ControlStreamReader.prototype.onNativePlayerTrigger=function(tb,ub){try{this.listener.onReaderTrigger(tb,ub);}
catch(e){this._handleError("Forwarding trigger to listener.",e);}};xmp.ControlStreamReader.prototype.onNativePlayerError=function(e){this._handleError("Forwarding native player error to listener.",e);};xmp.ControlStreamReader.prototype.onNativePlayerTimelineChange=function(vb,wb){};xmp.ControlStreamReader.prototype.onNativePlayerCreated=function(xb,yb){if(this.state.type===xmp.ERRORS){return;}
this.state.open(this,yb.node);};xmp.ControlStreamReader.prototype.onNativePlayerExecuteCommand=function(zb,Ab){return null;};xmp.ControlStreamReader.prototype.onViewportOpened=function(Bb,Cb){Cb.data.viewport=Bb;Cb.player.create(Cb.data);this.player=Cb.player;};xmp.ControlStreamReader.prototype.onCreateViewport=function(Db,Eb,Fb,Gb){var Hb=document.createElement("div");Hb.setAttribute(xmp.ID_ATTRIBUTE,Eb);Hb.setAttribute(xmp.NAME_ATTRIBUTE,Eb);Hb.style.width="1px";Hb.style.height="1px";if(navigator.appName.indexOf(xmp.MICROSOFT_BROWSER)!==-1){document.body.insertAdjacentElement("beforeEnd",Hb);}
else{document.body.insertBefore(Hb,null);}
return Hb;};xmp.ControlStreamReader.prototype.onDestroyViewport=function(Ib,Jb){var Kb=((navigator.appName.indexOf(xmp.MICROSOFT_BROWSER)!==-1||navigator.appName.indexOf(xmp.OPERA_BROWSER)!==-1)?window[Jb]:document[Jb]);if(Kb){var Lb=((navigator.appName.indexOf(xmp.MICROSOFT_BROWSER)!==-1||navigator.appName.indexOf(xmp.OPERA_BROWSER)!==-1)?Kb.parentElement:Kb.parentNode);Lb.removeChild(Kb);}};xmp.ControlStreamReader.prototype.onViewportCreated=function(Mb,Nb){if(this.state.type===xmp.ERRORS){return;}
if(Nb===null){return;}
this.viewManager.openViewport(this,this.getName(),Mb.mime_type,Nb);};xmp.ControlStreamReader.prototype.onViewportError=function(e){this._handleError("Forwarding viewport error to listener.",e);};xmp.ControlStreamReader.prototype.onError=function(Ob,e){this.listener.onReaderError(e);};xmp.ControlStreamReader.prototype.onPlugInError=function(e){this.listener.onReaderPlugInError(e);};xmp.ControlStreamReader.prototype.onUnsupportedPlatformError=function(e){this.listener.onReaderUnsupportedPlatformError(e);};xmp.ControlStreamReader.prototype._handleError=function(Pb,e){this.connected=false;this.state.error(this);this._setNullPlayer();var Qb=e;if(false===(Qb instanceof xmp.ControlStreamReaderError)){Qb=new xmp.ControlStreamReaderError(((e.context)?e.context:Pb),((e.rawMessage)?e.rawMessage:e.message));Qb.setInnerError(e);}
this.listener.onReaderError(Qb);};xmp.ControlStreamReader.prototype._initNativePlayer=function(Rb){try{this.state.close(this);var Sb=Rb.getMimeType();var Tb=xmp.NativePlayerRegistry.findPlayerByMIMEType(this.getName(),Sb);if(!Tb){throw new xmp.InvalidMimeTypeError("Initializing native player..","Unable to find native player for MIME type \""+Sb+"\".");}
var Ub={player:Tb,data:{group:this.getName(),viewport:null,volume:0,mute:true,fullscreen:false,node:Rb}};if(false===this.viewManager.openViewport(this,this.getName(),Rb.getMimeType(),Ub)){if(Tb.type!==this.player.type){Tb.create({group:this.getName(),viewport:this.viewManager.getActiveViewport(),volume:0,mute:true,fullscreen:false,node:Rb});this.player=Tb;return true;}
return false;}
return true;}
catch(e){this._setNullPlayer();throw e;}
return false;};xmp.ControlStreamReader.prototype._setNullPlayer=function(){var Vb=xmp.NativePlayerRegistry.getNullPlayer();if(this.viewManager.getActiveViewport()===null){this.viewManager.createViewport(this,this.getName(),xmp.NULL_MIME_TYPE,null);}
Vb.create({group:this.getName(),viewport:this.viewManager.getActiveViewport(),volume:0,mute:true,fullscreen:false,node:null});this.player=Vb;};xmp.ControlStreamReader.prototype.getName=function(){return xmp.CONTROL_STREAM_READER;};xmp.ControlStreamReader.prototype._getPlayer=function(){return this.player;};xmp.ControlStreamReader.prototype._changeState=function(Wb,Xb){var Yb=this.registry.findMode(Wb);this._transitionState(Yb,Xb);this.state=Yb;};xmp.ControlStreamReader.prototype._transitionState=function(Zb,$b){return Zb.transition(this,$b,this.state);};xmp.ControlStreamReader.prototype.isConnected=function(){return this.connected;};xmp.ControlStreamReaderFactory=function(){return{createReader:function(ac,bc){if(ac===xmp.WINDOWS_PLATFORM){return new xmp.ControlStreamReader(bc);}
else{return new xmp.NullStreamReader(bc);}}};}();xmp.NullStreamReader=function(cc){};xmp.NullStreamReader.prototype.open=function(dc){return null;};xmp.NullStreamReader.prototype.close=function(){};xmp.NullStreamReader.prototype.isConnected=function(){return false;};xmp.IMAGE_RETRIEVER_NODE_PATH="/PlayerContexts/Global/ImageRetriever";xmp.IMAGE_RETRIEVER_SERVICE="ImageRetriever";xmp.IMAGE_RETRIEVER_REFRESH_INTERVAL="Refresh Interval";xmp.IMAGE_RETRIEVER_START_DELAY="Start Delay";xmp.RESOURCE_NAME="name";xmp.RESOURCE_URL="url";xmp.ImageRetriever=function(){this.listener=null;};xmp.ImageRetriever.prototype.init=function(ec){try{this.logger=new xmp.util.internals.CategoryLogger(xmp.IMAGE_RETRIEVER_SERVICE);this._validateListener(ec);this.listener=ec;this.cacheID=(Math.round(Math.random()*(10000000-1))+1);var fc=xmp.util.SettingsManager.getInstance().getGlobalContextNode().getNodeForPath(xmp.IMAGE_RETRIEVER_NODE_PATH);this._initProperties(fc);this._initResources(fc);this._start();}
catch(e){this._handleError("Initializing.",e);}};xmp.ImageRetriever.prototype.fini=function(){if(this.startDelayTimer){this.startDelayTimer.stop();this.startDelayTimer=null;}
if(this.refreshResourcesTimer){this.refreshResourcesTimer.stop();this.refreshResourcesTimer=null;}};xmp.ImageRetriever.prototype._start=function(){if(0===this.startDelay){this._refreshResources();}
else{this.startDelayTimer=this._createTimer({id:xmp.START_DELAY_TIMER,interval:this.startDelay,handler:this._onDelayedStart});this.startDelayTimer.start();}};xmp.ImageRetriever.prototype._validateListener=function(gc){if(!gc){throw new xmp.ImageRetrieverError("Validating listener.","Missing image retriever listener.");}
if(false===xmp.isDefined(gc.onRetrieveImage)){throw new xmp.ImageRetrieverError("Validating listener.","Invalid image retriever listener.  Missing \"onRetrieveImage\" handler.");}
if(false===xmp.isDefined(gc.onImageRetrieverError)){throw new xmp.ImageRetrieverError("Validating listener.","Invalid image retriever listener.  Missing \"onImageRetrieverError\" handler.");}};xmp.ImageRetriever.prototype._validateResource=function(hc){if(hc.name.length===0){throw new xmp.ImageRetrieverError("Validating resource.","Missing image retriever resource name.");}
if(hc.url.length===0){throw new xmp.ImageRetrieverError("Validating resource.","Missing image retriever \""+hc.name+"\" url.");}};xmp.ImageRetriever.prototype._initProperties=function(ic){this.refreshInterval=ic.getInt(xmp.IMAGE_RETRIEVER_REFRESH_INTERVAL,0);if(this.refreshInterval===0){throw new xmp.ImageRetrieverError("Initializing properties.","Missing image retriever refresh interval.");}
this.startDelay=ic.getInt(xmp.IMAGE_RETRIEVER_START_DELAY,0);};xmp.ImageRetriever.prototype._initResources=function(jc){this.resources={};var kc=jc.retrieveChildren();var lc=kc.length;for(var i=0;i<lc;i++){var mc=kc[i];var nc={name:mc.getString(xmp.RESOURCE_NAME,xmp.NO_DEFAULT_VALUE),url:mc.getString(xmp.RESOURCE_URL,xmp.NO_DEFAULT_VALUE)};this._validateResource(nc);this.resources[nc.name]=nc;}};xmp.ImageRetriever.prototype._refreshResources=function(){try{var oc=xmp.getImageRoot();var pc=this._newCacheId();for(var qc in this.resources){try{var rc=this.resources[qc];var sc=oc+rc.url+"?"+pc;this.listener.onRetrieveImage(rc.name,sc);this.logger.info((new Date()).toString()+" - Image resource \""+rc.name+"\" retrieval refresh ("+pc+").");}
catch(e){var tc="";if(e instanceof xmp.ImageRetrieverError){tc=e.message;}
else{tc="Error retrieving image resource \""+rc.name+"\" from url \""+sc+"\". \n\n"+e.message;}
this.logger.warn(tc);}}}
catch(e){this._handleError("Refreshing all resources.",e);}};xmp.ImageRetriever.prototype._createTimer=function(uc){var vc=new xmp.util.Callback(uc.id,uc.handler,this);return new xmp.util.Timer(uc.id,uc.interval,-1,vc);};xmp.ImageRetriever.prototype._onRefreshResources=function(wc,xc){this._refreshResources();};xmp.ImageRetriever.prototype._handleError=function(yc,e){var zc=e;if(false===(zc instanceof xmp.ImageRetrieverError)){zc=new xmp.ImageRetrieverError(((e.context)?e.context:yc),((e.rawMessage)?e.rawMessage:e.message));zc.setInnerError(e);}
this._logError(zc);if(!this.listener){xmp.handleFatalError(zc);}
else if(true===xmp.isDefined(this.listener.onImageRetrieverError)){this.listener.onImageRetrieverError(zc);}};xmp.ImageRetriever.prototype._logError=function(e){this.logger.warn(e.message);};xmp.ImageRetriever.prototype._onDelayedStart=function(Ac,Bc){var Cc="";try{this.startDelayTimer.stop();this.startDelayTimer=null;this.refreshResourcesTimer=this._createTimer({id:xmp.REFRESH_RESOURCE_TIMER,interval:this.refreshInterval,handler:this._onRefreshResources});this.refreshResourcesTimer.start();this._refreshResources();}
catch(e){this._handleError("Starting after delay.",e);}};xmp.ImageRetriever.prototype._newCacheId=function(){return"cacheID="+this.cacheID++;};xmp.ServiceRegistry=function(){var Dc={};return{getService:function(Ec){if(!Ec){throw new xmp.util.internals.InvalidArgsError("Missing service name.");}
if(!this.services){this.services={};}
var Fc=this.services[Ec];if(Fc){return Fc;}
if(Ec===xmp.CONTROL_STREAM_SERVICE){Fc=new xmp.ControlStream();this.services[Ec]=Fc;return Fc;}
else if(Ec===xmp.IMAGE_RETRIEVER_SERVICE){Fc=new xmp.ImageRetriever();this.services[Ec]=Fc;return Fc;}
throw new xmp.ServiceError("Retrieving service.","Unable to create service \""+Ec+"\".");},init:function(Gc,Dc){var Hc=Dc.length;for(var i=0;i<Hc;i++){this.getService(Dc[i]).init(Gc);}},fini:function(){for(var Ic in this.services){this.services[Ic].fini();}}};}();xmp.ControlStreamError=function(Jc,Kc){xmp.ControlStreamError.ctor.call(this,"ControlStreamError",Jc,Kc);};xmp.DERIVE_CLASS(xmp.util.internals.XMPError,xmp.ControlStreamError);xmp.ControlStreamReaderError=function(Lc,Mc){xmp.ControlStreamReaderError.ctor.call(this,"ControlStreamReaderError",Lc,Mc);};xmp.DERIVE_CLASS(xmp.util.internals.XMPError,xmp.ControlStreamReaderError);xmp.ImageRetrieverError=function(Nc,Oc){xmp.ImageRetrieverError.ctor.call(this,"ImageRetrieverError",Nc,Oc);};xmp.DERIVE_CLASS(xmp.util.internals.XMPError,xmp.ImageRetrieverError);