varChannel=function(){"use strict";functiona(a,b,c,d){functionf(b){for(varc=0;c<b.length;c++)if(b[c].win===a)return!0;return!1}varg=!1;if("*"===b){for(varhine)if(e.hasOwnProperty(h)&&"*"!==h&&"object"==typeofe[h][c]&&(g=f(e[h][c])))break}elsee["*"]&&e["*"][c]&&(g=f(e["*"][c])),!g&&e[b]&&e[b][c]&&(g=f(e[b][c]));if(g)throw"A channel is already bound to the same window which overlaps with origin '"+b+"' and has scope '"+c+"'";"object"!=typeofe[b]&&(e[b]={}),"object"!=typeofe[b][c]&&(e[b][c]=[]),e[b][c].push({win:a,handler:d})}functionb(a,b,c){for(vard=e[b][c],f=0;f<d.length;f++)d[f].win===a&&d.splice(f,1);0===e[b][c].length&&deletee[b][c]}functionc(a){returnArray.isArray?Array.isArray(a):-1!=a.constructor.toString().indexOf("Array")}vard=Math.floor(1000001*Math.random()),e={},f={},g=function(a){try{varb=JSON.parse(a.data);if("object"!=typeofb||null===b)throw"malformed"}catch(a){return}varc,d,g,h=a.source,i=a.origin;if("string"==typeofb.method){varj=b.method.split("::");2==j.length?(c=j[0],g=j[1]):g=b.method}if("undefined"!=typeofb.id&&(d=b.id),"string"==typeofg){vark=!1;if(e[i]&&e[i][c])for(varl=0;l<e[i][c].length;l++)if(e[i][c][l].win===h){e[i][c][l].handler(i,g,b),k=!0;break}if(!k&&e["*"]&&e["*"][c])for(varl=0;l<e["*"][c].length;l++)if(e["*"][c][l].win===h){e["*"][c][l].handler(i,g,b);break}}else"undefined"!=typeofd&&f[d]&&f[d](i,g,b)};returnwindow.addEventListener?window.addEventListener("message",g,!1):window.attachEvent&&window.attachEvent("onmessage",g),{build:function(e){varg=function(a){if(e.debugOutput&&window.console&&window.console.log){try{"string"!=typeofa&&(a=JSON.stringify(a))}catch(b){}console.log("["+j+"] "+a)}};if(!window.postMessage)throw"jschannel cannot run this browser, no postMessage";if(!window.JSON||!window.JSON.stringify||!window.JSON.parse)throw"jschannel cannot run this browser, no JSON parsing/serialization";if("object"!=typeofe)throw"Channel build invoked without a proper object argument";if(!e.window||!e.window.postMessage)throw"Channel.build() called without a valid window argument";if(window===e.window)throw"target window is same as present window -- not allowed";varh=!1;if("string"==typeofe.origin){vari;"*"===e.origin?h=!0:null!==(i=e.origin.match(/^https?:\/\/(?:[-a-zA-Z0-9_\.])+(?::\d+)?/))&&(e.origin=i[0].toLowerCase(),h=!0)}if(!h)throw"Channel.build() called with an invalid origin";if("undefined"!=typeofe.scope){if("string"!=typeofe.scope)throw"scope, when specified, must be a string";if(e.scope.split("::").length>1)throw"scope may not contain double colons: '::'"}varj=function(){for(vara="",b="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",c=0;5>c;c++)a+=b.charAt(Math.floor(Math.random()*b.length));returna}(),k={},l={},m={},n=!1,o=[],p=function(a,b,c){vard=!1,e=!1;return{origin:b,invoke:function(b,d){if(!m[a])throw"attempting to invoke a callback of a nonexistent transaction: "+a;for(vare=!1,f=0;f<c.length;f++)if(b===c[f]){e=!0;break}if(!e)throw"request supports no such callback '"+b+"'";t({id:a,callback:b,params:d})},error:function(b,c){if(e=!0,!m[a])throw"error called for nonexistent message: "+a;deletem[a],t({id:a,error:b,message:c})},complete:function(b){if(e=!0,!m[a])throw"complete called for nonexistent message: "+a;deletem[a],t({id:a,result:b})},delayReturn:function(a){return"boolean"==typeofa&&(d=a===!0),d},completed:function(){returne}}},q=function(a,b,c){returnwindow.setTimeout(function(){if(l[a]){vard="timeout ("+b+"ms) exceeded on method '"+c+"'";l[a].error("timeout_error",d),deletel[a],deletef[a]}},b)},r=function(a,b,d){if("function"==typeofe.gotMessageObserver)try{e.gotMessageObserver(a,d)}catch(h){g("gotMessageObserver() raised an exception: "+h.toString())}if(d.id&&b){if(k[b]){vari=p(d.id,a,d.callbacks?d.callbacks:[]);m[d.id]={};try{if(d.callbacks&&c(d.callbacks)&&d.callbacks.length>0)for(varj=0;j<d.callbacks.length;j++){for(varn=d.callbacks[j],o=d.params,q=n.split("/"),r=0;r<q.length-1;r++){vars=q[r];"object"!=typeofo[s]&&(o[s]={}),o=o[s]}o[q[q.length-1]]=function(){vara=n;returnfunction(b){returni.invoke(a,b)}}()}vart=k[b](i,d.params);i.delayReturn()||i.completed()||i.complete(t)}catch(h){varu="runtime_error",v=null;if("string"==typeofh?v=h:"object"==typeofh&&(h&&c(h)&&2==h.length?(u=h[0],v=h[1]):"string"==typeofh.error&&(u=h.error,h.message?"string"==typeofh.message?v=h.message:h=h.message:v="")),null===v)try{v=JSON.stringify(h),"undefined"==typeofv&&(v=h.toString())}catch(w){v=h.toString()}i.error(u,v)}}}elsed.id&&d.callback?l[d.id]&&l[d.id].callbacks&&l[d.id].callbacks[d.callback]?l[d.id].callbacks[d.callback](d.params):g("ignoring invalid callback, id:"+d.id+" ("+d.callback+")"):d.id?l[d.id]?(d.error?l[d.id].error(d.error,d.message):void0!==d.result?l[d.id].success(d.result):l[d.id].success(),deletel[d.id],deletef[d.id]):g("ignoring invalid response: "+d.id):b&&k[b]&&k[b]({origin:a},d.params)};a(e.window,e.origin,"string"==typeofe.scope?e.scope:"",r);vars=function(a){return"string"==typeofe.scope&&e.scope.length&&(a=[e.scope,a].join("::")),a},t=function(a,b){if(!a)throw"postMessage called with null message";varc=n?"post ":"queue ";if(g(c+" message: "+JSON.stringify(a)),b||n){if("function"==typeofe.postMessageObserver)try{e.postMessageObserver(e.origin,a)}catch(d){g("postMessageObserver() raised an exception: "+d.toString())}e.window.postMessage(JSON.stringify(a),e.origin)}elseo.push(a)},u=function(a,b){if(g("ready msg received"),n)throw"received ready message while in ready state. help!";for(j+="ping"===b?"-R":"-L",v.unbind("__ready"),n=!0,g("ready msg accepted."),"ping"===b&&v.notify({method:"__ready",params:"pong"});o.length;)t(o.pop());"function"==typeofe.onReady&&e.onReady(v)},v={unbind:function(a){if(k[a]){if(!deletek[a])throw"can't delete method: "+a;return!0}return!1},bind:function(a,b){if(!a||"string"!=typeofa)throw"'method' argument to bind must be string";if(!b||"function"!=typeofb)throw"callback missing from bind params";if(k[a])throw"method '"+a+"' is already bound!";returnk[a]=b,this},call:function(a){if(!a)throw"missing arguments to call function";if(!a.method||"string"!=typeofa.method)throw"'method' argument to call must be string";if(!a.success||"function"!=typeofa.success)throw"'success' callback missing from call";varb={},c=[],e=function(a,d){if("object"==typeofd)for(varfind)if(d.hasOwnProperty(f)){varg=a+(a.length?"/":"")+f;"function"==typeofd[f]?(b[g]=d[f],c.push(g),deleted[f]):"object"==typeofd[f]&&e(g,d[f])}};e("",a.params);varg={id:d,method:s(a.method),params:a.params};c.length&&(g.callbacks=c),a.timeout&&q(d,a.timeout,s(a.method)),l[d]={callbacks:b,error:a.error,success:a.success},f[d]=r,d++,t(g)},notify:function(a){if(!a)throw"missing arguments to notify function";if(!a.method||"string"!=typeofa.method)throw"'method' argument to notify must be string";t({method:s(a.method),params:a.params})},destroy:function(){b(e.window,e.origin,"string"==typeofe.scope?e.scope:""),window.removeEventListener?window.removeEventListener("message",r,!1):window.detachEvent&&window.detachEvent("onmessage",r),n=!1,k={},m={},l={},e.origin=null,o=[],g("channel destroyed"),j=""}};returnv.bind("__ready",u),setTimeout(function(){t({method:s("__ready"),params:"ping"},!0)},0),v}}}();!function(a){"use strict";varb=a.prototype,c=b.parseFromString;try{if((newa).parseFromString("","text/html"))return}catch(d){}b.parseFromString=function(a,b){vard,e,f,g;return/^\s*text\/html\s*(?:;|$)/i.test(b)?(e=document.implementation.createHTMLDocument(""),f=e.documentElement,f.innerHTML=a,g=f.firstElementChild,1===f.childElementCount&&"html"===g.localName.toLowerCase()&&e.replaceChild(g,f),d=e):d=c.apply(this,arguments),d}}(DOMParser),"function"!=typeofdocument.contains&&(Document.prototype.contains=function(a){returna===this||a.parentNode===this?!0:this.documentElement.contains(a)}),function(a,b,c,d,e,f,g,h,i,j,k,l){"use strict";functionm(a){varb=newh;returnnewc.Promise(function(c,d){b.addEventListener("load",function(a){c(a.target.result)}),b.addEventListener("error",d),b.readAsDataURL(a)},function(){b.abort()})}functionn(a,b,d,e,f){functiong(){void0!==k&&"function"==typeofk.cancel&&k.cancel()}functionh(){void0!==j&&a.removeEventListener(b,j,d),g()}functioni(i,l){varm;j=function(a){f&&(a.stopPropagation(),a.preventDefault()),g();try{m=e(a)}catch(b){m=c.reject(b)}k=m,(newc.Queue).push(function(){returnm}).push(void0,function(a){ainstanceofc.CancellationError||(h(),l(a))})},a.addEventListener(b,j,d)}varj,k;returnvoid0===f&&(f=!0),newc.Promise(i,h)}functiono(){functiona(){b.cancelAnimationFrame(e)}functiond(a){e=b.requestAnimationFrame(a)}vare;returnnewc.Promise(d,a)}functionp(a){functionb(b,c){functiond(){try{0===e.readyState?c(e):4===e.readyState&&(e.status<200||e.status>=300||!/^text\/html[;]?/.test(e.getResponseHeader("Content-Type")||"")?c(e):b(e))}catch(a){c(a)}}e=newXMLHttpRequest,e.open("GET",a),e.onreadystatechange=d,e.setRequestHeader("Accept","text/html"),e.withCredentials=!0,e.send()}functiond(){void0!==e&&e.readyState!==e.DONE&&e.abort()}vare;returnnewc.Promise(b,d)}functionq(a){varb=a.indexOf("#");returnb>0&&(a=a.substring(0,b)),a}functionr(c){vard,e,f,g,h,i;if(W)returnconsole.info("-- Error dropped, as page is unloaded"),voidconsole.info(c);for(X.push(c),X.push(newError("stopping renderJS")),e=a.getElementsByTagName("body")[0];e.firstChild;)e.removeChild(e.firstChild);for(f=a.createElement("section"),g=a.createElement("h1"),g.textContent="Unhandled Error",f.appendChild(g),g=a.createElement("p"),g.textContent="Please report this error to the support team",f.appendChild(g),g=a.createElement("p"),g.textContent="Location: ",h=a.createElement("a"),h.href=h.textContent=b.location.toString(),g.appendChild(h),f.appendChild(g),g=a.createElement("p"),g.textContent="User-agent: "+j.userAgent,f.appendChild(g),g=a.createElement("p"),g.textContent="Date: "+newDate(Date.now()).toISOString(),f.appendChild(g),e.appendChild(f),d=0;d<X.length;d+=1){if(i=X[d],iinstanceofk&&(i={string:i.toString(),message:i.message,type:i.type,target:i.target},void0!==i.target&&X.splice(d+1,0,i.target)),iinstanceofXMLHttpRequest&&(i={message:i.toString(),readyState:i.readyState,status:i.status,statusText:i.statusText,response:i.response,responseUrl:i.responseUrl,response_headers:i.getAllResponseHeaders()}),i.constructor===Array||i.constructor===String||i.constructor===Object)try{i=JSON.stringify(i)}catch(l){}f=a.createElement("section"),g=a.createElement("h2"),g.textContent=i.message||i,f.appendChild(g),void0!==i.fileName&&(g=a.createElement("p"),g.textContent="File: "+i.fileName+": "+i.lineNumber,f.appendChild(g)),void0!==i.stack&&(g=a.createElement("pre"),g.textContent="Stack: "+i.stack,f.appendChild(g)),e.appendChild(f)}console.error(c.stack),console.error(c)}functions(a){if(this.name="resolved",void0!==a&&"string"!=typeofa)thrownewTypeError("You must pass a string.");this.message=a||"Default Message"}functiont(){returnthisinstanceoft?void0:newt}functionu(a){void0!==a.__monitor&&a.__monitor.cancel(),a.__monitor=newO,a.__job_dict={},a.__job_list=[],a.__job_triggered=!1,a.__monitor.fail(function(b){returnbinstanceofc.CancellationError?void0:a.aq_reportServiceError(b)}).fail(function(a){returnr(a)})}functionv(){this.__sub_gadget_dict={},u(this)}functionw(){functiona(a){returnfunction(b){varc=j.__acquired_method_dict||{},d="reportGadgetDeclarationError";if(c.hasOwnProperty(d))returnc[d].apply(j,[arguments,a]);throwb}}varb,d,e,f,g,h=this.element.querySelectorAll("[data-gadget-url]"),i=[],j=this;for(g=0;g<h.length;g+=1)b=h[g],d=b.getAttribute("data-gadget-scope"),e=b.getAttribute("data-gadget-url"),f=b.getAttribute("data-gadget-sandbox"),null!==e&&i.push(j.declareGadget(e,{element:b,scope:d||void0,sandbox:f||void0}).push(void0,a(d)));returnc.all(i)}functionx(a,b,d,e){varf=(newc.Queue).push(function(){returnd.apply(a,e)});a.__job_dict.hasOwnProperty(b)&&a.__job_dict[b].cancel(),a.__job_dict[b]=f,a.__monitor.monitor((newc.Queue).push(function(){returnf}).push(void0,function(a){if(!(ainstanceofc.CancellationError))throwa}))}functiony(a){a.__monitor.monitor((newc.Queue).push(function(){varb,c=a.constructor.__service_list,d=a.__job_list;for(b=0;b<c.length;b+=1)a.__monitor.monitor(c[b].apply(a));for(b=0;b<d.length;b+=1)x(a,d[b][0],d[b][1],d[b][2]);a.__job_list=[],a.__job_triggered=!0}))}functionz(a,b,d){vare,f,g=this;for(eing.__sub_gadget_dict)g.__sub_gadget_dict.hasOwnProperty(e)&&g.__sub_gadget_dict[e]===a&&(f=e);return(newc.Queue).push(function(){vara=g.__acquired_method_dict||{};if(a.hasOwnProperty(b))returna[b].apply(g,[d,f]);thrownewN.AcquisitionError("aq_dynamic is not defined")}).push(void0,function(a){if(ainstanceofN.AcquisitionError)returng.__aq_parent(b,d);throwa})}functionA(a,b){a.__aq_parent=function(c,d){returnz.apply(b,[a,c,d])}}functionB(){returnthisinstanceofB?voidt.call(this):newB}functionC(b,d,e){return(newc.Queue).push(function(){returnN.declareGadgetKlass(b).then(function(a){returna})}).push(function(b){void0===d.element&&(d.element=a.createElement("div"));varc,f,g=b.__template_element.body.childNodes,h=a.createDocumentFragment();for(f=newb,f.element=d.element,f.state={},c=0;c<g.length;c+=1)h.appendChild(g[c].cloneNode(!0));returnf.element.appendChild(h),A(f,e),f})}functionD(){returnthisinstanceofD?voidt.call(this):newD}functionE(b,d,f){varg,h,i=c.defer();if(void0===d.element)thrownewError("DOM element is required to create Iframe Gadget "+b);if(!a.contains(d.element))thrownewError("The parent element is not attached to the DOM for "+b);returng=newD,A(g,f),h=a.createElement("iframe"),h.addEventListener("error",function(a){i.reject(a)}),h.addEventListener("load",function(){returnc.timeout(5e3).fail(function(){i.reject(newError("Timeout while loading: "+b))})}),h.setAttribute("src",b),g.__path=b,g.element=d.element,g.state={},d.element.appendChild(h),g.__chan=e.build({window:h.contentWindow,origin:"*",scope:"renderJS"}),g.__chan.bind("declareMethod",function(a,b){returng[b]=function(){vara=arguments,d=newc.Promise(function(c,d){g.__chan.call({method:"methodCall",params:[b,Array.prototype.slice.call(a,0)],success:c,error:d})});return(newc.Queue).push(function(){returnd})},"OK"}),g.__chan.bind("ready",function(a){returni.resolve(g),"OK"}),g.__chan.bind("failed",function(a,b){returni.reject(b),"OK"}),g.__chan.bind("acquire",function(a,b){g.__aq_parent.apply(g,b).then(function(b){a.complete(b)}).fail(function(b){a.error(b.toString())}),a.delayReturn(!0)}),i.promise}functionF(a,b,e){return(newc.Queue).push(function(){returnp(a)}).push(function(b){varc,e=(newd).parseFromString(b.responseText,"text/html"),f=e.createElement("base");returnf.href=a,e.head.insertBefore(f,e.head.firstChild),c=newi([e.documentElement.outerHTML],{type:"text/html;charset=UTF-8"}),m(c)}).push(function(a){returnE(a,b,e)})}functionG(a,b){varc,e,f;c=function(){t.call(this)},c.__ready_list=t.__ready_list.slice(),c.__service_list=t.__service_list.slice(),c.declareMethod=t.declareMethod,c.declareJob=t.declareJob,c.declareAcquiredMethod=t.declareAcquiredMethod,c.allowPublicAcquisition=t.allowPublicAcquisition,c.ready=t.ready,c.setState=t.setState,c.onStateChange=t.onStateChange,c.declareService=t.declareService,c.onEvent=t.onEvent,c.onLoop=t.onLoop,c.prototype=newt,c.prototype.constructor=c,c.prototype.__path=b,c.prototype.__acquired_method_dict={},c.__template_element=(newd).parseFromString(a.responseText,"text/html"),f=N.parseGadgetHTMLDocument(c.__template_element,b);for(einf)f.hasOwnProperty(e)&&(c.prototype["__"+e]=f[e]);returnc}functionH(b,d,e){varh,i,j=N.parseGadgetHTMLDocument(a,d),k=a.createDocumentFragment();for(iinj)j.hasOwnProperty(i)&&(b.prototype["__"+i]=j[i]);for(b.__template_element=a.createElement("div"),e.element=a.body,e.state={},h=0;h<e.element.childNodes.length;h+=1)k.appendChild(e.element.childNodes[h].cloneNode(!0));returnb.__template_element.appendChild(k),c.all([e.getRequiredJSList(),e.getRequiredCSSList()]).then(function(a){varb,c=a[0],d=a[1];for(b=0;b<c.length;b+=1)R[c[b]]=null;for(b=0;b<d.length;b+=1)S[d[b]]=null;T.shift()}).then(function(){varb=a.querySelector("body"),c=newf(function(b){varc,d,e,f,h,i;b.forEach(function(b){if("childList"===b.type){for(e=b.removedNodes.length,c=0;e>c;c+=1)if(h=b.removedNodes[c],h.nodeType===g.ELEMENT_NODE)for(h.hasAttribute("data-gadget-url")&&void0!==h._gadget&&u(h._gadget),i=h.querySelectorAll("[data-gadget-url]"),f=i.length,d=0;f>d;d+=1)h=i[d],void0!==h._gadget&&u(h._gadget);for(e=b.addedNodes.length,c=0;e>c;c+=1)if(h=b.addedNodes[c],h.nodeType===g.ELEMENT_NODE)for(h.hasAttribute("data-gadget-url")&&void0!==h._gadget&&a.contains(h)&&y(h._gadget),i=h.querySelectorAll("[data-gadget-url]"),f=i.length,d=0;f>d;d+=1)h=i[d],a.contains(h)&&void0!==h._gadget&&y(h._gadget)}})}),d={childList:!0,subtree:!0,attributes:!1,characterData:!1};returnc.observe(b,d),e})}functionI(){vara=newt;returna.__acquired_method_dict={reportServiceError:function(a){r(a[0])}},a.__aq_parent=function(a){thrownewN.AcquisitionError("No gadget provides "+a)},a}functionJ(a){vard,f,g,h,i,j,k,l;if(Q.hasOwnProperty(a))thrownewError("bootstrap should not be called twice");returnd=B,d.__ready_list=t.__ready_list.slice(),d.__service_list=t.__service_list.slice(),d.prototype.__path=a,f=newB,A(f,I()),i=["getInterfaceList","getRequiredCSSList","getRequiredJSList","getPath","getTitle"],h=function(a){i.push(a)},l=[d,f,g,i],b.self===b.top?j=l:(k=c.defer(),j=c.any([k.promise,(newc.Queue).push(function(){returnc.delay(1e3)}).push(function(){returnl[2]=void0,l})]),g=e.build({window:b.parent,origin:"*",scope:"renderJS",onReady:function(){vara,b;for(h=function(a){i.push(newc.Promise(function(b,c){g.call({method:"declareMethod",params:a,success:b,error:c})}))},b=i.length,a=0;b>a;a+=1)h(i[a]);k.resolve(l)}}),l[2]=g),d.declareMethod=function(a,b){varc=t.declareMethod.apply(this,[a,b]);returnh(a),c},d.declareService=t.declareService,d.declareJob=t.declareJob,d.onEvent=t.onEvent,d.onLoop=t.onLoop,d.declareAcquiredMethod=t.declareAcquiredMethod,d.allowPublicAcquisition=t.allowPublicAcquisition,d.prototype.__acquired_method_dict={},T.push(d),j}functionK(a,b){functiond(){returnb}functione(a){returnfunction(b){returna.call(b,b)}}varf,g=newc.Queue;for(a.ready(function(){returny(this)}),g.push(d),f=0;f<a.__ready_list.length;f+=1)g.push(e(a.__ready_list[f])).push(d);returng}functionL(a,b,d){b.__aq_parent=a.prototype.__aq_parent=function(a,b,e){returnnewc.Promise(function(c,f){d.call({method:"acquire",params:[a,b],success:function(a){c(a)},error:function(a){f(a)},timeout:e})})},d.bind("methodCall",function(a,c){b[c[0]].apply(b,c[1]).push(function(b){a.complete(b)},function(b){a.error(b.toString())}),a.delayReturn(!0)})}functionM(a){varb,d,e,f,g=J(a);return(newc.Queue).push(function(){returng}).push(function(a){returnb=a[0],d=a[1],e=a[2],f=a[3],P.promise}).push(function(){returnc.all(f)}).push(function(c){returnvoid0!==e&&L(b,d,e),H(b,a,d)}).push(function(){returnK(b,d)}).push(function(){void0!==e&&e.notify({method:"ready"})}).push(void0,function(a){throwr(a),void0!==e&&e.notify({method:"failed",params:a.toString()}),a})}varN,O,P,Q={},R={},S={},T=[],U=0,V=newRegExp("^(?:[a-z]+:)?//|data:","i"),W=!1,X=[];b.addEventListener("error",function(a){X.push(a)}),b.addEventListener("beforeunload",function(){W=!0}),s.prototype=newError,s.prototype.constructor=s,O=function(){functiona(){vara,b=h.length;for(a=0;b>a;a+=1)h[a].cancel();h=[]}varb,d,e,f,g=this,h=[];returnthisinstanceofO?(b=newc.Promise(function(b,c,h){d=function(b){returnf?void0:(g.isRejected=!0,g.rejectedReason=b,f=!0,a(),c(b))},e=h},a),g.cancel=function(){f||(f=!0,b.cancel(),b.fail(function(a){g.isRejected=!0,g.rejectedReason=a}))},g.then=function(){returnb.then.apply(b,arguments)},g.fail=function(){returnb.fail.apply(b,arguments)},void(g.monitor=function(a){if(f)thrownews;varb=(newc.Queue).push(function(){returna}).push(function(a){varb,c,d=h.length,e=[];for(c=0;d>c;c+=1)b=h[c],b.isFulfilled||b.isRejected||e.push(b);h=e},function(b){throwbinstanceofc.CancellationError&&(a.isFulfilled&&a.isRejected||a.cancel()),d(b),b},function(a){returne(a),a});returnh.push(b),this})):newO},O.prototype=Object.create(c.Promise.prototype),O.prototype.constructor=O,t.prototype.__title="",t.prototype.__interface_list=[],t.prototype.__path="",t.prototype.__html="",t.prototype.__required_css_list=[],t.prototype.__required_js_list=[],t.__ready_list=[v,w],t.ready=function(a){returnthis.__ready_list.push(a),this},t.setState=function(a){varb=JSON.stringify(a);returnthis.__ready_list.unshift(function(){this.state=JSON.parse(b)}),this},t.onStateChange=function(a){returnthis.prototype.__state_change_callback=a,this},t.__service_list=[],t.declareService=function(a){returnthis.__service_list.push(a),this},t.onEvent=function(a,b,c,d){returnthis.__service_list.push(function(){returnn(this.element,a,c,b.bind(this),d)}),this},t.onLoop=function(a,b){returnvoid0===b&&(b=0),this.__service_list.push(function(){vard=newc.Queue,e=this,f=function(){d.push(function(){returnc.delay(b)}).push(function(){returno()}).push(function(){returna.apply(e,[])}).push(function(){f()})};returnf(),d}),this},t.declareJob=function(a,b){returnthis.prototype[a]=function(){varc=this,d=arguments;c.__job_triggered?x(c,a,b,d):c.__job_list.push([a,b,d])},this},t.declareMethod=function(a,b){returnthis.prototype[a]=function(){vara=this,d=arguments;return(newc.Queue).push(function(){returnb.apply(a,d)})},this},t.declareMethod("getInterfaceList",function(){returnthis.__interface_list}).declareMethod("getRequiredCSSList",function(){returnthis.__required_css_list}).declareMethod("getRequiredJSList",function(){returnthis.__required_js_list}).declareMethod("getPath",function(){returnthis.__path}).declareMethod("getTitle",function(){returnthis.__title}).declareMethod("getElement",function(){if(void0===this.element)thrownewError("No element defined");returnthis.element}).declareMethod("changeState",function(a){varb,d=newc.Queue,e=this;returne.hasOwnProperty("__previous_onStateChange")&&(b=e.__previous_onStateChange,d.push(function(){returnb}).push(void0,function(){})),e.__previous_onStateChange=d,d.push(function(){varb,d,f=!1,g=e.hasOwnProperty("__modification_dict");g?(d=e.__modification_dict,f=!0):d={};for(bina)a.hasOwnProperty(b)&&a[b]!==e.state[b]&&(e.state[b]=a[b],d[b]=a[b],f=!0);returnf&&void0!==e.__state_change_callback?(e.__modification_dict=d,(newc.Queue).push(function(){returne.__state_change_callback(d)}).push(function(a){returndeletee.__modification_dict,a})):void0})}),t.declareAcquiredMethod=function(a,b){returnthis.prototype[a]=function(){vara=Array.prototype.slice.call(arguments,0),d=this;return(newc.Queue).push(function(){returnd.__aq_parent(b,a)})},this},t.declareAcquiredMethod("aq_reportServiceError","reportServiceError"),t.declareAcquiredMethod("aq_reportGadgetDeclarationError","reportGadgetDeclarationError"),t.allowPublicAcquisition=function(a,b){returnthis.prototype.__acquired_method_dict[a]=b,this},B.__ready_list=t.__ready_list.slice(),B.__service_list=t.__service_list.slice(),B.ready=t.ready,B.setState=t.setState,B.onStateChange=t.onStateChange,B.declareService=t.declareService,B.onEvent=t.onEvent,B.onLoop=t.onLoop,B.prototype=newt,B.prototype.constructor=B,D.__ready_list=t.__ready_list.slice(),D.ready=t.ready,D.setState=t.setState,D.onStateChange=t.onStateChange,D.__service_list=t.__service_list.slice(),D.declareService=t.declareService,D.onEvent=t.onEvent,D.onLoop=t.onLoop,D.prototype=newt,D.prototype.constructor=D,t.declareMethod("declareGadget",function(b,d){vare=this;returnvoid0===d&&(d={}),void0===d.sandbox&&(d.sandbox="public"),b=N.getAbsoluteURL(b,this.__path),(newc.Queue).push(function(){vara;if("public"===d.sandbox)a=C;elseif("iframe"===d.sandbox)a=E;else{if("dataurl"!==d.sandbox)thrownewError("Unsupported sandbox options '"+d.sandbox+"'");a=F}returna(b,d,e)}).push(function(f){functiong(){returnf}functionh(a){returnfunction(){returna.call(f,f)}}vari,j,k=newc.Queue;for(i=0;i<f.constructor.__ready_list.length;i+=1)k.push(h(f.constructor.__ready_list[i])),k.push(g);if(j=d.scope,void0===j)for(j="RJS_"+U,U+=1;e.__sub_gadget_dict.hasOwnProperty(j);)j="RJS_"+U,U+=1;returne.__sub_gadget_dict[j]=f,f.element.setAttribute("data-gadget-scope",j),f.element.setAttribute("data-gadget-url",b),f.element.setAttribute("data-gadget-sandbox",d.sandbox),f.element._gadget=f,a.contains(f.element)&&k.push(y),k.push(g),k})}).declareMethod("getDeclaredGadget",function(a){if(!this.__sub_gadget_dict.hasOwnProperty(a))thrownewError("Gadget scope '"+a+"' is not known.");returnthis.__sub_gadget_dict[a]}).declareMethod("dropGadget",function(a){if(!this.__sub_gadget_dict.hasOwnProperty(a))thrownewError("Gadget scope '"+a+"' is not known.");deletethis.__sub_gadget_dict[a]}),N=function(a){varc;if(a===b&&(c=T[0]),void0===c)thrownewError("Unknown selector '"+a+"'");returnc},N.AcquisitionError=function(a){if(this.name="AcquisitionError",void0!==a&&"string"!=typeofa)thrownewTypeError("You must pass a string.");this.message=a||"Acquisition failed"},N.AcquisitionError.prototype=newError,N.AcquisitionError.prototype.constructor=N.AcquisitionError,N.getAbsoluteURL=function(a,b){returnb&&a?newl(a,b).href:a},N.declareJS=function(b,d,e){varf;returnR.hasOwnProperty(b)?f=c.resolve():(R[b]=null,f=newc.Promise(function(c,f){varg;g=a.createElement("script"),g.async=!1,g.type="text/javascript",g.onload=function(){e===!0&&T.shift(),c()},g.onerror=function(a){e===!0&&T.shift(),f(a)},g.src=b,d.appendChild(g)})),f},N.declareCSS=function(b,d){vare;returne=S.hasOwnProperty(b)?c.resolve():newc.Promise(function(c,e){varf;f=a.createElement("link"),f.rel="stylesheet",f.type="text/css",f.href=b,f.onload=function(){S[b]=null,c()},f.onerror=function(a){e(a)},d.appendChild(f)})},N.declareGadgetKlass=function(b){if(Q.hasOwnProperty(b))returnQ[b].promise;vard,e=c.defer();returnQ[b]=e,(newc.Queue).push(function(){returnp(b)}).push(function(e){d=G(e,b);varf,g=a.createDocumentFragment(),h=[],i=d.prototype.__required_js_list,j=d.prototype.__required_css_list;if(i.length){for(T.push(d),f=0;f<i.length-1;f+=1)h.push(N.declareJS(i[f],g));h.push(N.declareJS(i[f],g,!0))}for(f=0;f<j.length;f+=1)h.push(N.declareCSS(j[f],g));returna.head.appendChild(g),c.all(h)}).push(function(){returne.resolve(d),d}).push(void0,function(a){throwe.reject(a),a})},N.clearGadgetKlassList=function(){Q={},R={},S={}},N.parseGadgetHTMLDocument=function(a,b){varc,d,e={title:"",interface_list:[],required_css_list:[],required_js_list:[]};if(!b||!V.test(b))thrownewError("The url should be absolute: "+b);if(9!==a.nodeType)thrownewError("The first parameter should be an HTMLDocument");if(e.title=a.title,null!==a.head)for(c=0;c<a.head.children.length;c+=1)d=a.head.children[c],null!==d.href&&("stylesheet"===d.rel?e.required_css_list.push(N.getAbsoluteURL(d.getAttribute("href"),b)):"SCRIPT"!==d.nodeName||"text/javascript"!==d.type&&d.type?"http://www.renderjs.org/rel/interface"===d.rel&&e.interface_list.push(N.getAbsoluteURL(d.getAttribute("href"),b)):e.required_js_list.push(N.getAbsoluteURL(d.getAttribute("src"),b)));returne},b.rJS=b.renderJS=N,b.__RenderJSGadget=t,b.__RenderJSEmbeddedGadget=B,b.__RenderJSIframeGadget=D,P=newc.defer,N.manualBootstrap=function(){P.resolve()},a.addEventListener("DOMContentLoaded",P.resolve,!1),M(q(b.location.href))}(document,window,RSVP,DOMParser,Channel,MutationObserver,Node,FileReader,Blob,navigator,Event,URL);
varChannel=function(){"use strict";functiona(a,b,c,d){functionf(b){for(varc=0;c<b.length;c++)if(b[c].win===a)return!0;return!1}varg=!1;if("*"===b){for(varhine)if(e.hasOwnProperty(h)&&"*"!==h&&"object"==typeofe[h][c]&&(g=f(e[h][c])))break}elsee["*"]&&e["*"][c]&&(g=f(e["*"][c])),!g&&e[b]&&e[b][c]&&(g=f(e[b][c]));if(g)throw"A channel is already bound to the same window which overlaps with origin '"+b+"' and has scope '"+c+"'";"object"!=typeofe[b]&&(e[b]={}),"object"!=typeofe[b][c]&&(e[b][c]=[]),e[b][c].push({win:a,handler:d})}functionb(a,b,c){for(vard=e[b][c],f=0;f<d.length;f++)d[f].win===a&&d.splice(f,1);0===e[b][c].length&&deletee[b][c]}functionc(a){returnArray.isArray?Array.isArray(a):-1!=a.constructor.toString().indexOf("Array")}vard=Math.floor(1000001*Math.random()),e={},f={},g=function(a){try{varb=JSON.parse(a.data);if("object"!=typeofb||null===b)throw"malformed"}catch(a){return}varc,d,g,h=a.source,i=a.origin;if("string"==typeofb.method){varj=b.method.split("::");2==j.length?(c=j[0],g=j[1]):g=b.method}if("undefined"!=typeofb.id&&(d=b.id),"string"==typeofg){vark=!1;if(e[i]&&e[i][c])for(varl=0;l<e[i][c].length;l++)if(e[i][c][l].win===h){e[i][c][l].handler(i,g,b),k=!0;break}if(!k&&e["*"]&&e["*"][c])for(varl=0;l<e["*"][c].length;l++)if(e["*"][c][l].win===h){e["*"][c][l].handler(i,g,b);break}}else"undefined"!=typeofd&&f[d]&&f[d](i,g,b)};returnwindow.addEventListener?window.addEventListener("message",g,!1):window.attachEvent&&window.attachEvent("onmessage",g),{build:function(e){varg=function(a){if(e.debugOutput&&window.console&&window.console.log){try{"string"!=typeofa&&(a=JSON.stringify(a))}catch(b){}console.log("["+j+"] "+a)}};if(!window.postMessage)throw"jschannel cannot run this browser, no postMessage";if(!window.JSON||!window.JSON.stringify||!window.JSON.parse)throw"jschannel cannot run this browser, no JSON parsing/serialization";if("object"!=typeofe)throw"Channel build invoked without a proper object argument";if(!e.window||!e.window.postMessage)throw"Channel.build() called without a valid window argument";if(window===e.window)throw"target window is same as present window -- not allowed";varh=!1;if("string"==typeofe.origin){vari;"*"===e.origin?h=!0:null!==(i=e.origin.match(/^https?:\/\/(?:[-a-zA-Z0-9_\.])+(?::\d+)?/))&&(e.origin=i[0].toLowerCase(),h=!0)}if(!h)throw"Channel.build() called with an invalid origin";if("undefined"!=typeofe.scope){if("string"!=typeofe.scope)throw"scope, when specified, must be a string";if(e.scope.split("::").length>1)throw"scope may not contain double colons: '::'"}varj=function(){for(vara="",b="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",c=0;5>c;c++)a+=b.charAt(Math.floor(Math.random()*b.length));returna}(),k={},l={},m={},n=!1,o=[],p=function(a,b,c){vard=!1,e=!1;return{origin:b,invoke:function(b,d){if(!m[a])throw"attempting to invoke a callback of a nonexistent transaction: "+a;for(vare=!1,f=0;f<c.length;f++)if(b===c[f]){e=!0;break}if(!e)throw"request supports no such callback '"+b+"'";t({id:a,callback:b,params:d})},error:function(b,c){if(e=!0,!m[a])throw"error called for nonexistent message: "+a;deletem[a],t({id:a,error:b,message:c})},complete:function(b){if(e=!0,!m[a])throw"complete called for nonexistent message: "+a;deletem[a],t({id:a,result:b})},delayReturn:function(a){return"boolean"==typeofa&&(d=a===!0),d},completed:function(){returne}}},q=function(a,b,c){returnwindow.setTimeout(function(){if(l[a]){vard="timeout ("+b+"ms) exceeded on method '"+c+"'";l[a].error("timeout_error",d),deletel[a],deletef[a]}},b)},r=function(a,b,d){if("function"==typeofe.gotMessageObserver)try{e.gotMessageObserver(a,d)}catch(h){g("gotMessageObserver() raised an exception: "+h.toString())}if(d.id&&b){if(k[b]){vari=p(d.id,a,d.callbacks?d.callbacks:[]);m[d.id]={};try{if(d.callbacks&&c(d.callbacks)&&d.callbacks.length>0)for(varj=0;j<d.callbacks.length;j++){for(varn=d.callbacks[j],o=d.params,q=n.split("/"),r=0;r<q.length-1;r++){vars=q[r];"object"!=typeofo[s]&&(o[s]={}),o=o[s]}o[q[q.length-1]]=function(){vara=n;returnfunction(b){returni.invoke(a,b)}}()}vart=k[b](i,d.params);i.delayReturn()||i.completed()||i.complete(t)}catch(h){varu="runtime_error",v=null;if("string"==typeofh?v=h:"object"==typeofh&&(h&&c(h)&&2==h.length?(u=h[0],v=h[1]):"string"==typeofh.error&&(u=h.error,h.message?"string"==typeofh.message?v=h.message:h=h.message:v="")),null===v)try{v=JSON.stringify(h),"undefined"==typeofv&&(v=h.toString())}catch(w){v=h.toString()}i.error(u,v)}}}elsed.id&&d.callback?l[d.id]&&l[d.id].callbacks&&l[d.id].callbacks[d.callback]?l[d.id].callbacks[d.callback](d.params):g("ignoring invalid callback, id:"+d.id+" ("+d.callback+")"):d.id?l[d.id]?(d.error?l[d.id].error(d.error,d.message):void0!==d.result?l[d.id].success(d.result):l[d.id].success(),deletel[d.id],deletef[d.id]):g("ignoring invalid response: "+d.id):b&&k[b]&&k[b]({origin:a},d.params)};a(e.window,e.origin,"string"==typeofe.scope?e.scope:"",r);vars=function(a){return"string"==typeofe.scope&&e.scope.length&&(a=[e.scope,a].join("::")),a},t=function(a,b){if(!a)throw"postMessage called with null message";varc=n?"post ":"queue ";if(g(c+" message: "+JSON.stringify(a)),b||n){if("function"==typeofe.postMessageObserver)try{e.postMessageObserver(e.origin,a)}catch(d){g("postMessageObserver() raised an exception: "+d.toString())}e.window.postMessage(JSON.stringify(a),e.origin)}elseo.push(a)},u=function(a,b){if(g("ready msg received"),n)throw"received ready message while in ready state. help!";for(j+="ping"===b?"-R":"-L",v.unbind("__ready"),n=!0,g("ready msg accepted."),"ping"===b&&v.notify({method:"__ready",params:"pong"});o.length;)t(o.pop());"function"==typeofe.onReady&&e.onReady(v)},v={unbind:function(a){if(k[a]){if(!deletek[a])throw"can't delete method: "+a;return!0}return!1},bind:function(a,b){if(!a||"string"!=typeofa)throw"'method' argument to bind must be string";if(!b||"function"!=typeofb)throw"callback missing from bind params";if(k[a])throw"method '"+a+"' is already bound!";returnk[a]=b,this},call:function(a){if(!a)throw"missing arguments to call function";if(!a.method||"string"!=typeofa.method)throw"'method' argument to call must be string";if(!a.success||"function"!=typeofa.success)throw"'success' callback missing from call";varb={},c=[],e=function(a,d){if("object"==typeofd)for(varfind)if(d.hasOwnProperty(f)){varg=a+(a.length?"/":"")+f;"function"==typeofd[f]?(b[g]=d[f],c.push(g),deleted[f]):"object"==typeofd[f]&&e(g,d[f])}};e("",a.params);varg={id:d,method:s(a.method),params:a.params};c.length&&(g.callbacks=c),a.timeout&&q(d,a.timeout,s(a.method)),l[d]={callbacks:b,error:a.error,success:a.success},f[d]=r,d++,t(g)},notify:function(a){if(!a)throw"missing arguments to notify function";if(!a.method||"string"!=typeofa.method)throw"'method' argument to notify must be string";t({method:s(a.method),params:a.params})},destroy:function(){b(e.window,e.origin,"string"==typeofe.scope?e.scope:""),window.removeEventListener?window.removeEventListener("message",r,!1):window.detachEvent&&window.detachEvent("onmessage",r),n=!1,k={},m={},l={},e.origin=null,o=[],g("channel destroyed"),j=""}};returnv.bind("__ready",u),setTimeout(function(){t({method:s("__ready"),params:"ping"},!0)},0),v}}}();!function(a){"use strict";varb=a.prototype,c=b.parseFromString;try{if((newa).parseFromString("","text/html"))return}catch(d){}b.parseFromString=function(a,b){vard,e,f,g;return/^\s*text\/html\s*(?:;|$)/i.test(b)?(e=document.implementation.createHTMLDocument(""),f=e.documentElement,f.innerHTML=a,g=f.firstElementChild,1===f.childElementCount&&"html"===g.localName.toLowerCase()&&e.replaceChild(g,f),d=e):d=c.apply(this,arguments),d}}(DOMParser),"function"!=typeofdocument.contains&&(Document.prototype.contains=function(a){returna===this||a.parentNode===this?!0:this.documentElement.contains(a)}),function(a,b,c,d,e,f,g,h,i,j,k,l){"use strict";functionm(a){varb=newh;returnnewc.Promise(function(c,d){b.addEventListener("load",function(a){c(a.target.result)}),b.addEventListener("error",d),b.readAsDataURL(a)},function(){b.abort()})}functionn(a,b,d,e,f){functiong(){void0!==k&&"function"==typeofk.cancel&&k.cancel()}functionh(){void0!==j&&a.removeEventListener(b,j,d),g()}functioni(i,l){varm;j=function(a){f&&(a.stopPropagation(),a.preventDefault()),g();try{m=e(a)}catch(b){m=c.reject(b)}k=m,(newc.Queue).push(function(){returnm}).push(void0,function(a){ainstanceofc.CancellationError||(h(),l(a))})},a.addEventListener(b,j,d)}varj,k;returnvoid0===f&&(f=!0),newc.Promise(i,h)}functiono(){functiona(){b.cancelAnimationFrame(e)}functiond(a){e=b.requestAnimationFrame(a)}vare;returnnewc.Promise(d,a)}functionp(a){functionb(b,c){functiond(){try{0===e.readyState?c(e):4===e.readyState&&(e.status<200||e.status>=300||!/^text\/html[;]?/.test(e.getResponseHeader("Content-Type")||"")?c(e):b(e))}catch(a){c(a)}}e=newXMLHttpRequest,e.open("GET",a),e.onreadystatechange=d,e.setRequestHeader("Accept","text/html"),e.withCredentials=!0,e.send()}functiond(){void0!==e&&e.readyState!==e.DONE&&e.abort()}vare;returnnewc.Promise(b,d)}functionq(a){varb=a.indexOf("#");returnb>0&&(a=a.substring(0,b)),a}functionr(c){vard,e,f,g,h,i;if(W)returnconsole.info("-- Error dropped, as page is unloaded"),voidconsole.info(c);for(X.push(c),X.push(newError("stopping renderJS")),e=a.getElementsByTagName("body")[0];e.firstChild;)e.removeChild(e.firstChild);for(f=a.createElement("section"),g=a.createElement("h1"),g.textContent="Unhandled Error",f.appendChild(g),g=a.createElement("p"),g.textContent="Please report this error to the support team",f.appendChild(g),g=a.createElement("p"),g.textContent="Location: ",h=a.createElement("a"),h.href=h.textContent=b.location.toString(),g.appendChild(h),f.appendChild(g),g=a.createElement("p"),g.textContent="User-agent: "+j.userAgent,f.appendChild(g),g=a.createElement("p"),g.textContent="Date: "+newDate(Date.now()).toISOString(),f.appendChild(g),e.appendChild(f),d=0;d<X.length;d+=1){if(i=X[d],iinstanceofk&&(i={string:i.toString(),message:i.message,type:i.type,target:i.target},void0!==i.target&&X.splice(d+1,0,i.target)),iinstanceofXMLHttpRequest&&(i={message:i.toString(),readyState:i.readyState,status:i.status,statusText:i.statusText,response:i.response,responseUrl:i.responseUrl,response_headers:i.getAllResponseHeaders()}),i.constructor===Array||i.constructor===String||i.constructor===Object)try{i=JSON.stringify(i)}catch(l){}f=a.createElement("section"),g=a.createElement("h2"),g.textContent=i.message||i,f.appendChild(g),void0!==i.fileName&&(g=a.createElement("p"),g.textContent="File: "+i.fileName+": "+i.lineNumber,f.appendChild(g)),void0!==i.stack&&(g=a.createElement("pre"),g.textContent="Stack: "+i.stack,f.appendChild(g)),e.appendChild(f)}console.error(c.stack),console.error(c)}functions(a){if(this.name="resolved",void0!==a&&"string"!=typeofa)thrownewTypeError("You must pass a string.");this.message=a||"Default Message"}functiont(){returnthisinstanceoft?void0:newt}functionu(a){void0!==a.__monitor&&a.__monitor.cancel(),a.__monitor=newO,a.__job_dict={},a.__job_list=[],a.__job_triggered=!1,a.__monitor.fail(function(b){returnbinstanceofc.CancellationError?void0:a.aq_reportServiceError(b)}).fail(function(a){returnr(a)})}functionv(){this.__sub_gadget_dict={},u(this)}functionw(){functiona(a){returnfunction(b){varc=j.__acquired_method_dict||{},d="reportGadgetDeclarationError";if(c.hasOwnProperty(d))returnc[d].apply(j,[arguments,a]);throwb}}varb,d,e,f,g,h=this.element.querySelectorAll("[data-gadget-url]"),i=[],j=this;for(g=0;g<h.length;g+=1)b=h[g],d=b.getAttribute("data-gadget-scope"),e=b.getAttribute("data-gadget-url"),f=b.getAttribute("data-gadget-sandbox"),null!==e&&i.push(j.declareGadget(e,{element:b,scope:d||void0,sandbox:f||void0}).push(void0,a(d)));returnc.all(i)}functionx(a,b,d,e){varf=(newc.Queue).push(function(){returnd.apply(a,e)});a.__job_dict.hasOwnProperty(b)&&a.__job_dict[b].cancel(),a.__job_dict[b]=f,a.__monitor.monitor((newc.Queue).push(function(){returnf}).push(void0,function(a){if(!(ainstanceofc.CancellationError))throwa}))}functiony(a){a.__monitor.monitor((newc.Queue).push(function(){varb,c=a.constructor.__service_list,d=a.__job_list;for(b=0;b<c.length;b+=1)a.__monitor.monitor(c[b].apply(a));for(b=0;b<d.length;b+=1)x(a,d[b][0],d[b][1],d[b][2]);a.__job_list=[],a.__job_triggered=!0}))}functionz(a,b,d){vare,f,g=this;for(eing.__sub_gadget_dict)g.__sub_gadget_dict.hasOwnProperty(e)&&g.__sub_gadget_dict[e]===a&&(f=e);return(newc.Queue).push(function(){vara=g.__acquired_method_dict||{};if(a.hasOwnProperty(b))returna[b].apply(g,[d,f]);thrownewN.AcquisitionError("aq_dynamic is not defined")}).push(void0,function(a){if(ainstanceofN.AcquisitionError)returng.__aq_parent(b,d);throwa})}functionA(a,b){a.__aq_parent=function(c,d){returnz.apply(b,[a,c,d])}}functionB(){returnthisinstanceofB?voidt.call(this):newB}functionC(b,d,e){return(newc.Queue).push(function(){returnN.declareGadgetKlass(b).then(function(a){returna})}).push(function(b){void0===d.element&&(d.element=a.createElement("div"));varc,f,g=b.__template_element.body.childNodes,h=a.createDocumentFragment();for(f=newb,f.element=d.element,f.state={},c=0;c<g.length;c+=1)h.appendChild(g[c].cloneNode(!0));returnf.element.appendChild(h),A(f,e),f})}functionD(){returnthisinstanceofD?voidt.call(this):newD}functionE(b,d,f){varg,h,i=c.defer();if(void0===d.element)thrownewError("DOM element is required to create Iframe Gadget "+b);if(!a.contains(d.element))thrownewError("The parent element is not attached to the DOM for "+b);returng=newD,A(g,f),h=a.createElement("iframe"),h.addEventListener("error",function(a){i.reject(a)}),h.addEventListener("load",function(){returnc.timeout(5e3).fail(function(){i.reject(newError("Timeout while loading: "+b))})}),h.setAttribute("src",b),g.__path=b,g.element=d.element,g.state={},d.element.appendChild(h),g.__chan=e.build({window:h.contentWindow,origin:"*",scope:"renderJS"}),g.__chan.bind("declareMethod",function(a,b){returng[b]=function(){vara=arguments,d=newc.Promise(function(c,d){g.__chan.call({method:"methodCall",params:[b,Array.prototype.slice.call(a,0)],success:c,error:d})});return(newc.Queue).push(function(){returnd})},"OK"}),g.__chan.bind("ready",function(a){returni.resolve(g),"OK"}),g.__chan.bind("failed",function(a,b){returni.reject(b),"OK"}),g.__chan.bind("acquire",function(a,b){g.__aq_parent.apply(g,b).then(function(b){a.complete(b)}).fail(function(b){a.error(b.toString())}),a.delayReturn(!0)}),i.promise}functionF(a,b,e){return(newc.Queue).push(function(){returnp(a)}).push(function(b){varc,e=(newd).parseFromString(b.responseText,"text/html"),f=e.createElement("base");returnf.href=a,e.head.insertBefore(f,e.head.firstChild),c=newi([e.documentElement.outerHTML],{type:"text/html;charset=UTF-8"}),m(c)}).push(function(a){returnE(a,b,e)})}functionG(a,b){varc,e,f;c=function(){t.call(this)},c.__ready_list=t.__ready_list.slice(),c.__service_list=t.__service_list.slice(),c.declareMethod=t.declareMethod,c.declareJob=t.declareJob,c.declareAcquiredMethod=t.declareAcquiredMethod,c.allowPublicAcquisition=t.allowPublicAcquisition,c.ready=t.ready,c.setState=t.setState,c.onStateChange=t.onStateChange,c.declareService=t.declareService,c.onEvent=t.onEvent,c.onLoop=t.onLoop,c.prototype=newt,c.prototype.constructor=c,c.prototype.__path=b,c.prototype.__acquired_method_dict={},c.__template_element=(newd).parseFromString(a.responseText,"text/html"),f=N.parseGadgetHTMLDocument(c.__template_element,b);for(einf)f.hasOwnProperty(e)&&(c.prototype["__"+e]=f[e]);returnc}functionH(b,d,e){varh,i,j=N.parseGadgetHTMLDocument(a,d),k=a.createDocumentFragment();for(iinj)j.hasOwnProperty(i)&&(b.prototype["__"+i]=j[i]);for(b.__template_element=a.createElement("div"),e.element=a.body,e.state={},h=0;h<e.element.childNodes.length;h+=1)k.appendChild(e.element.childNodes[h].cloneNode(!0));returnb.__template_element.appendChild(k),c.all([e.getRequiredJSList(),e.getRequiredCSSList()]).then(function(a){varb,c=a[0],d=a[1];for(b=0;b<c.length;b+=1)R[c[b]]=null;for(b=0;b<d.length;b+=1)S[d[b]]=null;T.shift()}).then(function(){varb=a.querySelector("body"),c=newf(function(b){varc,d,e,f,h,i;b.forEach(function(b){if("childList"===b.type){for(e=b.removedNodes.length,c=0;e>c;c+=1)if(h=b.removedNodes[c],h.nodeType===g.ELEMENT_NODE)for(h.hasAttribute("data-gadget-url")&&void0!==h._gadget&&u(h._gadget),i=h.querySelectorAll("[data-gadget-url]"),f=i.length,d=0;f>d;d+=1)h=i[d],void0!==h._gadget&&u(h._gadget);for(e=b.addedNodes.length,c=0;e>c;c+=1)if(h=b.addedNodes[c],h.nodeType===g.ELEMENT_NODE)for(h.hasAttribute("data-gadget-url")&&void0!==h._gadget&&a.contains(h)&&y(h._gadget),i=h.querySelectorAll("[data-gadget-url]"),f=i.length,d=0;f>d;d+=1)h=i[d],a.contains(h)&&void0!==h._gadget&&y(h._gadget)}})}),d={childList:!0,subtree:!0,attributes:!1,characterData:!1};returnc.observe(b,d),e})}functionI(){vara=newt;returna.__acquired_method_dict={reportServiceError:function(a){r(a[0])}},a.__aq_parent=function(a){thrownewN.AcquisitionError("No gadget provides "+a)},a}functionJ(a){vard,f,g,h,i,j,k,l;if(Q.hasOwnProperty(a))thrownewError("bootstrap should not be called twice");returnd=B,d.__ready_list=t.__ready_list.slice(),d.__service_list=t.__service_list.slice(),d.prototype.__path=a,f=newB,A(f,I()),i=["getInterfaceList","getRequiredCSSList","getRequiredJSList","getPath","getTitle"],h=function(a){i.push(a)},l=[d,f,g,i],b.self===b.top?j=l:(k=c.defer(),j=c.any([k.promise,(newc.Queue).push(function(){returnc.delay(1e3)}).push(function(){returnl[2]=void0,l})]),g=e.build({window:b.parent,origin:"*",scope:"renderJS",onReady:function(){vara,b;for(h=function(a){i.push(newc.Promise(function(b,c){g.call({method:"declareMethod",params:a,success:b,error:c})}))},b=i.length,a=0;b>a;a+=1)h(i[a]);k.resolve(l)}}),l[2]=g),d.declareMethod=function(a,b){varc=t.declareMethod.apply(this,[a,b]);returnh(a),c},d.declareService=t.declareService,d.declareJob=t.declareJob,d.onEvent=t.onEvent,d.onLoop=t.onLoop,d.declareAcquiredMethod=t.declareAcquiredMethod,d.allowPublicAcquisition=t.allowPublicAcquisition,d.prototype.__acquired_method_dict={},T.push(d),j}functionK(a,b){functiond(){returnb}functione(a){returnfunction(b){returna.call(b,b)}}varf,g=newc.Queue;for(a.ready(function(){returny(this)}),g.push(d),f=0;f<a.__ready_list.length;f+=1)g.push(e(a.__ready_list[f])).push(d);returng}functionL(a,b,d){b.__aq_parent=a.prototype.__aq_parent=function(a,b,e){returnnewc.Promise(function(c,f){d.call({method:"acquire",params:[a,b],success:function(a){c(a)},error:function(a){f(a)},timeout:e})})},d.bind("methodCall",function(a,c){b[c[0]].apply(b,c[1]).push(function(b){a.complete(b)},function(b){a.error(b.toString())}),a.delayReturn(!0)})}functionM(a){varb,d,e,f,g=J(a);return(newc.Queue).push(function(){returng}).push(function(a){returnb=a[0],d=a[1],e=a[2],f=a[3],P.promise}).push(function(){returnc.all(f)}).push(function(c){returnvoid0!==e&&L(b,d,e),H(b,a,d)}).push(function(){returnK(b,d)}).push(function(){void0!==e&&e.notify({method:"ready"})}).push(void0,function(a){throwr(a),void0!==e&&e.notify({method:"failed",params:a.toString()}),a})}varN,O,P,Q={},R={},S={},T=[],U=0,V=newRegExp("^(?:[a-z]+:)?//|data:","i"),W=!1,X=[];b.addEventListener("error",function(a){X.push(a)}),b.addEventListener("beforeunload",function(){W=!0}),s.prototype=newError,s.prototype.constructor=s,O=function(){functiona(){vara,b=h.length;for(a=0;b>a;a+=1)h[a].cancel();h=[]}varb,d,e,f,g=this,h=[];returnthisinstanceofO?(b=newc.Promise(function(b,c,h){d=function(b){returnf?void0:(g.isRejected=!0,g.rejectedReason=b,f=!0,a(),c(b))},e=h},a),g.cancel=function(){f||(f=!0,b.cancel(),b.fail(function(a){g.isRejected=!0,g.rejectedReason=a}))},g.then=function(){returnb.then.apply(b,arguments)},g.fail=function(){returnb.fail.apply(b,arguments)},void(g.monitor=function(a){if(f)thrownews;varb=(newc.Queue).push(function(){returna}).push(function(a){varb,c,d=h.length,e=[];for(c=0;d>c;c+=1)b=h[c],b.isFulfilled||b.isRejected||e.push(b);h=e},function(b){throwbinstanceofc.CancellationError&&(a.isFulfilled&&a.isRejected||a.cancel()),d(b),b},function(a){returne(a),a});returnh.push(b),this})):newO},O.prototype=Object.create(c.Promise.prototype),O.prototype.constructor=O,t.prototype.__title="",t.prototype.__interface_list=[],t.prototype.__path="",t.prototype.__html="",t.prototype.__required_css_list=[],t.prototype.__required_js_list=[],t.__ready_list=[v,w],t.ready=function(a){returnthis.__ready_list.push(a),this},t.setState=function(a){varb=JSON.stringify(a);returnthis.__ready_list.unshift(function(){this.state=JSON.parse(b)}),this},t.onStateChange=function(a){returnthis.prototype.__state_change_callback=a,this},t.__service_list=[],t.declareService=function(a){returnthis.__service_list.push(a),this},t.onEvent=function(a,b,c,d){returnthis.__service_list.push(function(){returnn(this.element,a,c,b.bind(this),d)}),this},t.onLoop=function(a,b){returnvoid0===b&&(b=0),this.__service_list.push(function(){vard=newc.Queue,e=function(){d.push(function(){returnc.delay(b)}).push(function(){returno()}).push(function(){returna.apply(this,[])}).push(function(){e()})};returne(),d}),this},t.declareJob=function(a,b){returnthis.prototype[a]=function(){varc=this,d=arguments;c.__job_triggered?x(c,a,b,d):c.__job_list.push([a,b,d])},this},t.declareMethod=function(a,b){returnthis.prototype[a]=function(){vara=this,d=arguments;return(newc.Queue).push(function(){returnb.apply(a,d)})},this},t.declareMethod("getInterfaceList",function(){returnthis.__interface_list}).declareMethod("getRequiredCSSList",function(){returnthis.__required_css_list}).declareMethod("getRequiredJSList",function(){returnthis.__required_js_list}).declareMethod("getPath",function(){returnthis.__path}).declareMethod("getTitle",function(){returnthis.__title}).declareMethod("getElement",function(){if(void0===this.element)thrownewError("No element defined");returnthis.element}).declareMethod("changeState",function(a){varb,d=newc.Queue,e=this;returne.hasOwnProperty("__previous_onStateChange")&&(b=e.__previous_onStateChange,d.push(function(){returnb}).push(void0,function(){})),e.__previous_onStateChange=d,d.push(function(){varb,d,f=!1,g=e.hasOwnProperty("__modification_dict");g?(d=e.__modification_dict,f=!0):d={};for(bina)a.hasOwnProperty(b)&&a[b]!==e.state[b]&&(e.state[b]=a[b],d[b]=a[b],f=!0);returnf&&void0!==e.__state_change_callback?(e.__modification_dict=d,(newc.Queue).push(function(){returne.__state_change_callback(d)}).push(function(a){returndeletee.__modification_dict,a})):void0})}),t.declareAcquiredMethod=function(a,b){returnthis.prototype[a]=function(){vara=Array.prototype.slice.call(arguments,0),d=this;return(newc.Queue).push(function(){returnd.__aq_parent(b,a)})},this},t.declareAcquiredMethod("aq_reportServiceError","reportServiceError"),t.declareAcquiredMethod("aq_reportGadgetDeclarationError","reportGadgetDeclarationError"),t.allowPublicAcquisition=function(a,b){returnthis.prototype.__acquired_method_dict[a]=b,this},B.__ready_list=t.__ready_list.slice(),B.__service_list=t.__service_list.slice(),B.ready=t.ready,B.setState=t.setState,B.onStateChange=t.onStateChange,B.declareService=t.declareService,B.onEvent=t.onEvent,B.onLoop=t.onLoop,B.prototype=newt,B.prototype.constructor=B,D.__ready_list=t.__ready_list.slice(),D.ready=t.ready,D.setState=t.setState,D.onStateChange=t.onStateChange,D.__service_list=t.__service_list.slice(),D.declareService=t.declareService,D.onEvent=t.onEvent,D.onLoop=t.onLoop,D.prototype=newt,D.prototype.constructor=D,t.declareMethod("declareGadget",function(b,d){vare=this;returnvoid0===d&&(d={}),void0===d.sandbox&&(d.sandbox="public"),b=N.getAbsoluteURL(b,this.__path),(newc.Queue).push(function(){vara;if("public"===d.sandbox)a=C;elseif("iframe"===d.sandbox)a=E;else{if("dataurl"!==d.sandbox)thrownewError("Unsupported sandbox options '"+d.sandbox+"'");a=F}returna(b,d,e)}).push(function(f){functiong(){returnf}functionh(a){returnfunction(){returna.call(f,f)}}vari,j,k=newc.Queue;for(i=0;i<f.constructor.__ready_list.length;i+=1)k.push(h(f.constructor.__ready_list[i])),k.push(g);if(j=d.scope,void0===j)for(j="RJS_"+U,U+=1;e.__sub_gadget_dict.hasOwnProperty(j);)j="RJS_"+U,U+=1;returne.__sub_gadget_dict[j]=f,f.element.setAttribute("data-gadget-scope",j),f.element.setAttribute("data-gadget-url",b),f.element.setAttribute("data-gadget-sandbox",d.sandbox),f.element._gadget=f,a.contains(f.element)&&k.push(y),k.push(g),k})}).declareMethod("getDeclaredGadget",function(a){if(!this.__sub_gadget_dict.hasOwnProperty(a))thrownewError("Gadget scope '"+a+"' is not known.");returnthis.__sub_gadget_dict[a]}).declareMethod("dropGadget",function(a){if(!this.__sub_gadget_dict.hasOwnProperty(a))thrownewError("Gadget scope '"+a+"' is not known.");deletethis.__sub_gadget_dict[a]}),N=function(a){varc;if(a===b&&(c=T[0]),void0===c)thrownewError("Unknown selector '"+a+"'");returnc},N.AcquisitionError=function(a){if(this.name="AcquisitionError",void0!==a&&"string"!=typeofa)thrownewTypeError("You must pass a string.");this.message=a||"Acquisition failed"},N.AcquisitionError.prototype=newError,N.AcquisitionError.prototype.constructor=N.AcquisitionError,N.getAbsoluteURL=function(a,b){returnb&&a?newl(a,b).href:a},N.declareJS=function(b,d,e){varf;returnR.hasOwnProperty(b)?f=c.resolve():(R[b]=null,f=newc.Promise(function(c,f){varg;g=a.createElement("script"),g.async=!1,g.type="text/javascript",g.onload=function(){e===!0&&T.shift(),c()},g.onerror=function(a){e===!0&&T.shift(),f(a)},g.src=b,d.appendChild(g)})),f},N.declareCSS=function(b,d){vare;returne=S.hasOwnProperty(b)?c.resolve():newc.Promise(function(c,e){varf;f=a.createElement("link"),f.rel="stylesheet",f.type="text/css",f.href=b,f.onload=function(){S[b]=null,c()},f.onerror=function(a){e(a)},d.appendChild(f)})},N.declareGadgetKlass=function(b){if(Q.hasOwnProperty(b))returnQ[b].promise;vard,e=c.defer();returnQ[b]=e,(newc.Queue).push(function(){returnp(b)}).push(function(e){d=G(e,b);varf,g=a.createDocumentFragment(),h=[],i=d.prototype.__required_js_list,j=d.prototype.__required_css_list;if(i.length){for(T.push(d),f=0;f<i.length-1;f+=1)h.push(N.declareJS(i[f],g));h.push(N.declareJS(i[f],g,!0))}for(f=0;f<j.length;f+=1)h.push(N.declareCSS(j[f],g));returna.head.appendChild(g),c.all(h)}).push(function(){returne.resolve(d),d}).push(void0,function(a){throwe.reject(a),a})},N.clearGadgetKlassList=function(){Q={},R={},S={}},N.parseGadgetHTMLDocument=function(a,b){varc,d,e={title:"",interface_list:[],required_css_list:[],required_js_list:[]};if(!b||!V.test(b))thrownewError("The url should be absolute: "+b);if(9!==a.nodeType)thrownewError("The first parameter should be an HTMLDocument");if(e.title=a.title,null!==a.head)for(c=0;c<a.head.children.length;c+=1)d=a.head.children[c],null!==d.href&&("stylesheet"===d.rel?e.required_css_list.push(N.getAbsoluteURL(d.getAttribute("href"),b)):"SCRIPT"!==d.nodeName||"text/javascript"!==d.type&&d.type?"http://www.renderjs.org/rel/interface"===d.rel&&e.interface_list.push(N.getAbsoluteURL(d.getAttribute("href"),b)):e.required_js_list.push(N.getAbsoluteURL(d.getAttribute("src"),b)));returne},b.rJS=b.renderJS=N,b.__RenderJSGadget=t,b.__RenderJSEmbeddedGadget=B,b.__RenderJSIframeGadget=D,P=newc.defer,N.manualBootstrap=function(){P.resolve()},a.addEventListener("DOMContentLoaded",P.resolve,!1),M(q(b.location.href))}(document,window,RSVP,DOMParser,Channel,MutationObserver,Node,FileReader,Blob,navigator,Event,URL);
varChannel=function(){"use strict";functiona(a,b,c,d){functionf(b){for(varc=0;c<b.length;c++)if(b[c].win===a)return!0;return!1}varg=!1;if("*"===b){for(varhine)if(e.hasOwnProperty(h)&&"*"!==h&&"object"==typeofe[h][c]&&(g=f(e[h][c])))break}elsee["*"]&&e["*"][c]&&(g=f(e["*"][c])),!g&&e[b]&&e[b][c]&&(g=f(e[b][c]));if(g)throw"A channel is already bound to the same window which overlaps with origin '"+b+"' and has scope '"+c+"'";"object"!=typeofe[b]&&(e[b]={}),"object"!=typeofe[b][c]&&(e[b][c]=[]),e[b][c].push({win:a,handler:d})}functionb(a,b,c){for(vard=e[b][c],f=0;f<d.length;f++)d[f].win===a&&d.splice(f,1);0===e[b][c].length&&deletee[b][c]}functionc(a){returnArray.isArray?Array.isArray(a):-1!=a.constructor.toString().indexOf("Array")}vard=Math.floor(1000001*Math.random()),e={},f={},g=function(a){try{varb=JSON.parse(a.data);if("object"!=typeofb||null===b)throw"malformed"}catch(a){return}varc,d,g,h=a.source,i=a.origin;if("string"==typeofb.method){varj=b.method.split("::");2==j.length?(c=j[0],g=j[1]):g=b.method}if("undefined"!=typeofb.id&&(d=b.id),"string"==typeofg){vark=!1;if(e[i]&&e[i][c])for(varl=0;l<e[i][c].length;l++)if(e[i][c][l].win===h){e[i][c][l].handler(i,g,b),k=!0;break}if(!k&&e["*"]&&e["*"][c])for(varl=0;l<e["*"][c].length;l++)if(e["*"][c][l].win===h){e["*"][c][l].handler(i,g,b);break}}else"undefined"!=typeofd&&f[d]&&f[d](i,g,b)};returnwindow.addEventListener?window.addEventListener("message",g,!1):window.attachEvent&&window.attachEvent("onmessage",g),{build:function(e){varg=function(a){if(e.debugOutput&&window.console&&window.console.log){try{"string"!=typeofa&&(a=JSON.stringify(a))}catch(b){}console.log("["+j+"] "+a)}};if(!window.postMessage)throw"jschannel cannot run this browser, no postMessage";if(!window.JSON||!window.JSON.stringify||!window.JSON.parse)throw"jschannel cannot run this browser, no JSON parsing/serialization";if("object"!=typeofe)throw"Channel build invoked without a proper object argument";if(!e.window||!e.window.postMessage)throw"Channel.build() called without a valid window argument";if(window===e.window)throw"target window is same as present window -- not allowed";varh=!1;if("string"==typeofe.origin){vari;"*"===e.origin?h=!0:null!==(i=e.origin.match(/^https?:\/\/(?:[-a-zA-Z0-9_\.])+(?::\d+)?/))&&(e.origin=i[0].toLowerCase(),h=!0)}if(!h)throw"Channel.build() called with an invalid origin";if("undefined"!=typeofe.scope){if("string"!=typeofe.scope)throw"scope, when specified, must be a string";if(e.scope.split("::").length>1)throw"scope may not contain double colons: '::'"}varj=function(){for(vara="",b="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789",c=0;5>c;c++)a+=b.charAt(Math.floor(Math.random()*b.length));returna}(),k={},l={},m={},n=!1,o=[],p=function(a,b,c){vard=!1,e=!1;return{origin:b,invoke:function(b,d){if(!m[a])throw"attempting to invoke a callback of a nonexistent transaction: "+a;for(vare=!1,f=0;f<c.length;f++)if(b===c[f]){e=!0;break}if(!e)throw"request supports no such callback '"+b+"'";t({id:a,callback:b,params:d})},error:function(b,c){if(e=!0,!m[a])throw"error called for nonexistent message: "+a;deletem[a],t({id:a,error:b,message:c})},complete:function(b){if(e=!0,!m[a])throw"complete called for nonexistent message: "+a;deletem[a],t({id:a,result:b})},delayReturn:function(a){return"boolean"==typeofa&&(d=a===!0),d},completed:function(){returne}}},q=function(a,b,c){returnwindow.setTimeout(function(){if(l[a]){vard="timeout ("+b+"ms) exceeded on method '"+c+"'";l[a].error("timeout_error",d),deletel[a],deletef[a]}},b)},r=function(a,b,d){if("function"==typeofe.gotMessageObserver)try{e.gotMessageObserver(a,d)}catch(h){g("gotMessageObserver() raised an exception: "+h.toString())}if(d.id&&b){if(k[b]){vari=p(d.id,a,d.callbacks?d.callbacks:[]);m[d.id]={};try{if(d.callbacks&&c(d.callbacks)&&d.callbacks.length>0)for(varj=0;j<d.callbacks.length;j++){for(varn=d.callbacks[j],o=d.params,q=n.split("/"),r=0;r<q.length-1;r++){vars=q[r];"object"!=typeofo[s]&&(o[s]={}),o=o[s]}o[q[q.length-1]]=function(){vara=n;returnfunction(b){returni.invoke(a,b)}}()}vart=k[b](i,d.params);i.delayReturn()||i.completed()||i.complete(t)}catch(h){varu="runtime_error",v=null;if("string"==typeofh?v=h:"object"==typeofh&&(h&&c(h)&&2==h.length?(u=h[0],v=h[1]):"string"==typeofh.error&&(u=h.error,h.message?"string"==typeofh.message?v=h.message:h=h.message:v="")),null===v)try{v=JSON.stringify(h),"undefined"==typeofv&&(v=h.toString())}catch(w){v=h.toString()}i.error(u,v)}}}elsed.id&&d.callback?l[d.id]&&l[d.id].callbacks&&l[d.id].callbacks[d.callback]?l[d.id].callbacks[d.callback](d.params):g("ignoring invalid callback, id:"+d.id+" ("+d.callback+")"):d.id?l[d.id]?(d.error?l[d.id].error(d.error,d.message):void0!==d.result?l[d.id].success(d.result):l[d.id].success(),deletel[d.id],deletef[d.id]):g("ignoring invalid response: "+d.id):b&&k[b]&&k[b]({origin:a},d.params)};a(e.window,e.origin,"string"==typeofe.scope?e.scope:"",r);vars=function(a){return"string"==typeofe.scope&&e.scope.length&&(a=[e.scope,a].join("::")),a},t=function(a,b){if(!a)throw"postMessage called with null message";varc=n?"post ":"queue ";if(g(c+" message: "+JSON.stringify(a)),b||n){if("function"==typeofe.postMessageObserver)try{e.postMessageObserver(e.origin,a)}catch(d){g("postMessageObserver() raised an exception: "+d.toString())}e.window.postMessage(JSON.stringify(a),e.origin)}elseo.push(a)},u=function(a,b){if(g("ready msg received"),n)throw"received ready message while in ready state. help!";for(j+="ping"===b?"-R":"-L",v.unbind("__ready"),n=!0,g("ready msg accepted."),"ping"===b&&v.notify({method:"__ready",params:"pong"});o.length;)t(o.pop());"function"==typeofe.onReady&&e.onReady(v)},v={unbind:function(a){if(k[a]){if(!deletek[a])throw"can't delete method: "+a;return!0}return!1},bind:function(a,b){if(!a||"string"!=typeofa)throw"'method' argument to bind must be string";if(!b||"function"!=typeofb)throw"callback missing from bind params";if(k[a])throw"method '"+a+"' is already bound!";returnk[a]=b,this},call:function(a){if(!a)throw"missing arguments to call function";if(!a.method||"string"!=typeofa.method)throw"'method' argument to call must be string";if(!a.success||"function"!=typeofa.success)throw"'success' callback missing from call";varb={},c=[],e=function(a,d){if("object"==typeofd)for(varfind)if(d.hasOwnProperty(f)){varg=a+(a.length?"/":"")+f;"function"==typeofd[f]?(b[g]=d[f],c.push(g),deleted[f]):"object"==typeofd[f]&&e(g,d[f])}};e("",a.params);varg={id:d,method:s(a.method),params:a.params};c.length&&(g.callbacks=c),a.timeout&&q(d,a.timeout,s(a.method)),l[d]={callbacks:b,error:a.error,success:a.success},f[d]=r,d++,t(g)},notify:function(a){if(!a)throw"missing arguments to notify function";if(!a.method||"string"!=typeofa.method)throw"'method' argument to notify must be string";t({method:s(a.method),params:a.params})},destroy:function(){b(e.window,e.origin,"string"==typeofe.scope?e.scope:""),window.removeEventListener?window.removeEventListener("message",r,!1):window.detachEvent&&window.detachEvent("onmessage",r),n=!1,k={},m={},l={},e.origin=null,o=[],g("channel destroyed"),j=""}};returnv.bind("__ready",u),setTimeout(function(){t({method:s("__ready"),params:"ping"},!0)},0),v}}}();!function(a){"use strict";varb=a.prototype,c=b.parseFromString;try{if((newa).parseFromString("","text/html"))return}catch(d){}b.parseFromString=function(a,b){vard,e,f,g;return/^\s*text\/html\s*(?:;|$)/i.test(b)?(e=document.implementation.createHTMLDocument(""),f=e.documentElement,f.innerHTML=a,g=f.firstElementChild,1===f.childElementCount&&"html"===g.localName.toLowerCase()&&e.replaceChild(g,f),d=e):d=c.apply(this,arguments),d}}(DOMParser),"function"!=typeofdocument.contains&&(Document.prototype.contains=function(a){returna===this||a.parentNode===this?!0:this.documentElement.contains(a)}),function(a,b,c,d,e,f,g,h,i,j,k,l){"use strict";functionm(a){varb=newh;returnnewc.Promise(function(c,d){b.addEventListener("load",function(a){c(a.target.result)}),b.addEventListener("error",d),b.readAsDataURL(a)},function(){b.abort()})}functionn(a,b,d,e,f){functiong(){void0!==k&&"function"==typeofk.cancel&&k.cancel()}functionh(){void0!==j&&a.removeEventListener(b,j,d),g()}functioni(i,l){varm;j=function(a){f&&(a.stopPropagation(),a.preventDefault()),g();try{m=e(a)}catch(b){m=c.reject(b)}k=m,(newc.Queue).push(function(){returnm}).push(void0,function(a){ainstanceofc.CancellationError||(h(),l(a))})},a.addEventListener(b,j,d)}varj,k;returnvoid0===f&&(f=!0),newc.Promise(i,h)}functiono(){functiona(){b.cancelAnimationFrame(e)}functiond(a){e=b.requestAnimationFrame(a)}vare;returnnewc.Promise(d,a)}functionp(a){functionb(b,c){functiond(){try{0===e.readyState?c(e):4===e.readyState&&(e.status<200||e.status>=300||!/^text\/html[;]?/.test(e.getResponseHeader("Content-Type")||"")?c(e):b(e))}catch(a){c(a)}}e=newXMLHttpRequest,e.open("GET",a),e.onreadystatechange=d,e.setRequestHeader("Accept","text/html"),e.withCredentials=!0,e.send()}functiond(){void0!==e&&e.readyState!==e.DONE&&e.abort()}vare;returnnewc.Promise(b,d)}functionq(a){varb=a.indexOf("#");returnb>0&&(a=a.substring(0,b)),a}functionr(c){vard,e,f,g,h,i;if(W)returnconsole.info("-- Error dropped, as page is unloaded"),voidconsole.info(c);for(X.push(c),X.push(newError("stopping renderJS")),e=a.getElementsByTagName("body")[0];e.firstChild;)e.removeChild(e.firstChild);for(f=a.createElement("section"),g=a.createElement("h1"),g.textContent="Unhandled Error",f.appendChild(g),g=a.createElement("p"),g.textContent="Please report this error to the support team",f.appendChild(g),g=a.createElement("p"),g.textContent="Location: ",h=a.createElement("a"),h.href=h.textContent=b.location.toString(),g.appendChild(h),f.appendChild(g),g=a.createElement("p"),g.textContent="User-agent: "+j.userAgent,f.appendChild(g),g=a.createElement("p"),g.textContent="Date: "+newDate(Date.now()).toISOString(),f.appendChild(g),e.appendChild(f),d=0;d<X.length;d+=1){if(i=X[d],iinstanceofk&&(i={string:i.toString(),message:i.message,type:i.type,target:i.target},void0!==i.target&&X.splice(d+1,0,i.target)),iinstanceofXMLHttpRequest&&(i={message:i.toString(),readyState:i.readyState,status:i.status,statusText:i.statusText,response:i.response,responseUrl:i.responseUrl,response_headers:i.getAllResponseHeaders()}),i.constructor===Array||i.constructor===String||i.constructor===Object)try{i=JSON.stringify(i)}catch(l){}f=a.createElement("section"),g=a.createElement("h2"),g.textContent=i.message||i,f.appendChild(g),void0!==i.fileName&&(g=a.createElement("p"),g.textContent="File: "+i.fileName+": "+i.lineNumber,f.appendChild(g)),void0!==i.stack&&(g=a.createElement("pre"),g.textContent="Stack: "+i.stack,f.appendChild(g)),e.appendChild(f)}console.error(c.stack),console.error(c)}functions(a){if(this.name="resolved",void0!==a&&"string"!=typeofa)thrownewTypeError("You must pass a string.");this.message=a||"Default Message"}functiont(){returnthisinstanceoft?void0:newt}functionu(a){void0!==a.__monitor&&a.__monitor.cancel(),a.__monitor=newO,a.__job_dict={},a.__job_list=[],a.__job_triggered=!1,a.__monitor.fail(function(b){returnbinstanceofc.CancellationError?void0:a.aq_reportServiceError(b)}).fail(function(a){returnr(a)})}functionv(){this.__sub_gadget_dict={},u(this)}functionw(){functiona(a){returnfunction(b){varc=j.__acquired_method_dict||{},d="reportGadgetDeclarationError";if(c.hasOwnProperty(d))returnc[d].apply(j,[arguments,a]);throwb}}varb,d,e,f,g,h=this.element.querySelectorAll("[data-gadget-url]"),i=[],j=this;for(g=0;g<h.length;g+=1)b=h[g],d=b.getAttribute("data-gadget-scope"),e=b.getAttribute("data-gadget-url"),f=b.getAttribute("data-gadget-sandbox"),null!==e&&i.push(j.declareGadget(e,{element:b,scope:d||void0,sandbox:f||void0}).push(void0,a(d)));returnc.all(i)}functionx(a,b,d,e){varf=(newc.Queue).push(function(){returnd.apply(a,e)});a.__job_dict.hasOwnProperty(b)&&a.__job_dict[b].cancel(),a.__job_dict[b]=f,a.__monitor.monitor((newc.Queue).push(function(){returnf}).push(void0,function(a){if(!(ainstanceofc.CancellationError))throwa}))}functiony(a){a.__monitor.monitor((newc.Queue).push(function(){varb,c=a.constructor.__service_list,d=a.__job_list;for(b=0;b<c.length;b+=1)a.__monitor.monitor(c[b].apply(a));for(b=0;b<d.length;b+=1)x(a,d[b][0],d[b][1],d[b][2]);a.__job_list=[],a.__job_triggered=!0}))}functionz(a,b,d){vare,f,g=this;for(eing.__sub_gadget_dict)g.__sub_gadget_dict.hasOwnProperty(e)&&g.__sub_gadget_dict[e]===a&&(f=e);return(newc.Queue).push(function(){vara=g.__acquired_method_dict||{};if(a.hasOwnProperty(b))returna[b].apply(g,[d,f]);thrownewN.AcquisitionError("aq_dynamic is not defined")}).push(void0,function(a){if(ainstanceofN.AcquisitionError)returng.__aq_parent(b,d);throwa})}functionA(a,b){a.__aq_parent=function(c,d){returnz.apply(b,[a,c,d])}}functionB(){returnthisinstanceofB?voidt.call(this):newB}functionC(b,d,e){return(newc.Queue).push(function(){returnN.declareGadgetKlass(b).then(function(a){returna})}).push(function(b){void0===d.element&&(d.element=a.createElement("div"));varc,f,g=b.__template_element.body.childNodes,h=a.createDocumentFragment();for(f=newb,f.element=d.element,f.state={},c=0;c<g.length;c+=1)h.appendChild(g[c].cloneNode(!0));returnf.element.appendChild(h),A(f,e),f})}functionD(){returnthisinstanceofD?voidt.call(this):newD}functionE(b,d,f){varg,h,i=c.defer();if(void0===d.element)thrownewError("DOM element is required to create Iframe Gadget "+b);if(!a.contains(d.element))thrownewError("The parent element is not attached to the DOM for "+b);returng=newD,A(g,f),h=a.createElement("iframe"),h.addEventListener("error",function(a){i.reject(a)}),h.addEventListener("load",function(){returnc.timeout(5e3).fail(function(){i.reject(newError("Timeout while loading: "+b))})}),h.setAttribute("src",b),g.__path=b,g.element=d.element,g.state={},d.element.appendChild(h),g.__chan=e.build({window:h.contentWindow,origin:"*",scope:"renderJS"}),g.__chan.bind("declareMethod",function(a,b){returng[b]=function(){vara=arguments,d=newc.Promise(function(c,d){g.__chan.call({method:"methodCall",params:[b,Array.prototype.slice.call(a,0)],success:c,error:d})});return(newc.Queue).push(function(){returnd})},"OK"}),g.__chan.bind("ready",function(a){returni.resolve(g),"OK"}),g.__chan.bind("failed",function(a,b){returni.reject(b),"OK"}),g.__chan.bind("acquire",function(a,b){g.__aq_parent.apply(g,b).then(function(b){a.complete(b)}).fail(function(b){a.error(b.toString())}),a.delayReturn(!0)}),i.promise}functionF(a,b,e){return(newc.Queue).push(function(){returnp(a)}).push(function(b){varc,e=(newd).parseFromString(b.responseText,"text/html"),f=e.createElement("base");returnf.href=a,e.head.insertBefore(f,e.head.firstChild),c=newi([e.documentElement.outerHTML],{type:"text/html;charset=UTF-8"}),m(c)}).push(function(a){returnE(a,b,e)})}functionG(a,b){varc,e,f;c=function(){t.call(this)},c.__ready_list=t.__ready_list.slice(),c.__service_list=t.__service_list.slice(),c.declareMethod=t.declareMethod,c.declareJob=t.declareJob,c.declareAcquiredMethod=t.declareAcquiredMethod,c.allowPublicAcquisition=t.allowPublicAcquisition,c.ready=t.ready,c.setState=t.setState,c.onStateChange=t.onStateChange,c.declareService=t.declareService,c.onEvent=t.onEvent,c.onLoop=t.onLoop,c.prototype=newt,c.prototype.constructor=c,c.prototype.__path=b,c.prototype.__acquired_method_dict={},c.__template_element=(newd).parseFromString(a.responseText,"text/html"),f=N.parseGadgetHTMLDocument(c.__template_element,b);for(einf)f.hasOwnProperty(e)&&(c.prototype["__"+e]=f[e]);returnc}functionH(b,d,e){varh,i,j=N.parseGadgetHTMLDocument(a,d),k=a.createDocumentFragment();for(iinj)j.hasOwnProperty(i)&&(b.prototype["__"+i]=j[i]);for(b.__template_element=a.createElement("div"),e.element=a.body,e.state={},h=0;h<e.element.childNodes.length;h+=1)k.appendChild(e.element.childNodes[h].cloneNode(!0));returnb.__template_element.appendChild(k),c.all([e.getRequiredJSList(),e.getRequiredCSSList()]).then(function(a){varb,c=a[0],d=a[1];for(b=0;b<c.length;b+=1)R[c[b]]=null;for(b=0;b<d.length;b+=1)S[d[b]]=null;T.shift()}).then(function(){varb=a.querySelector("body"),c=newf(function(b){varc,d,e,f,h,i;b.forEach(function(b){if("childList"===b.type){for(e=b.removedNodes.length,c=0;e>c;c+=1)if(h=b.removedNodes[c],h.nodeType===g.ELEMENT_NODE)for(h.hasAttribute("data-gadget-url")&&void0!==h._gadget&&u(h._gadget),i=h.querySelectorAll("[data-gadget-url]"),f=i.length,d=0;f>d;d+=1)h=i[d],void0!==h._gadget&&u(h._gadget);for(e=b.addedNodes.length,c=0;e>c;c+=1)if(h=b.addedNodes[c],h.nodeType===g.ELEMENT_NODE)for(h.hasAttribute("data-gadget-url")&&void0!==h._gadget&&a.contains(h)&&y(h._gadget),i=h.querySelectorAll("[data-gadget-url]"),f=i.length,d=0;f>d;d+=1)h=i[d],a.contains(h)&&void0!==h._gadget&&y(h._gadget)}})}),d={childList:!0,subtree:!0,attributes:!1,characterData:!1};returnc.observe(b,d),e})}functionI(){vara=newt;returna.__acquired_method_dict={reportServiceError:function(a){r(a[0])}},a.__aq_parent=function(a){thrownewN.AcquisitionError("No gadget provides "+a)},a}functionJ(a){vard,f,g,h,i,j,k,l;if(Q.hasOwnProperty(a))thrownewError("bootstrap should not be called twice");returnd=B,d.__ready_list=t.__ready_list.slice(),d.__service_list=t.__service_list.slice(),d.prototype.__path=a,f=newB,A(f,I()),i=["getInterfaceList","getRequiredCSSList","getRequiredJSList","getPath","getTitle"],h=function(a){i.push(a)},l=[d,f,g,i],b.self===b.top?j=l:(k=c.defer(),j=c.any([k.promise,(newc.Queue).push(function(){returnc.delay(1e3)}).push(function(){returnl[2]=void0,l})]),g=e.build({window:b.parent,origin:"*",scope:"renderJS",onReady:function(){vara,b;for(h=function(a){i.push(newc.Promise(function(b,c){g.call({method:"declareMethod",params:a,success:b,error:c})}))},b=i.length,a=0;b>a;a+=1)h(i[a]);k.resolve(l)}}),l[2]=g),d.declareMethod=function(a,b){varc=t.declareMethod.apply(this,[a,b]);returnh(a),c},d.declareService=t.declareService,d.declareJob=t.declareJob,d.onEvent=t.onEvent,d.onLoop=t.onLoop,d.declareAcquiredMethod=t.declareAcquiredMethod,d.allowPublicAcquisition=t.allowPublicAcquisition,d.prototype.__acquired_method_dict={},T.push(d),j}functionK(a,b){functiond(){returnb}functione(a){returnfunction(b){returna.call(b,b)}}varf,g=newc.Queue;for(a.ready(function(){returny(this)}),g.push(d),f=0;f<a.__ready_list.length;f+=1)g.push(e(a.__ready_list[f])).push(d);returng}functionL(a,b,d){b.__aq_parent=a.prototype.__aq_parent=function(a,b,e){returnnewc.Promise(function(c,f){d.call({method:"acquire",params:[a,b],success:function(a){c(a)},error:function(a){f(a)},timeout:e})})},d.bind("methodCall",function(a,c){b[c[0]].apply(b,c[1]).push(function(b){a.complete(b)},function(b){a.error(b.toString())}),a.delayReturn(!0)})}functionM(a){varb,d,e,f,g=J(a);return(newc.Queue).push(function(){returng}).push(function(a){returnb=a[0],d=a[1],e=a[2],f=a[3],P.promise}).push(function(){returnc.all(f)}).push(function(c){returnvoid0!==e&&L(b,d,e),H(b,a,d)}).push(function(){returnK(b,d)}).push(function(){void0!==e&&e.notify({method:"ready"})}).push(void0,function(a){throwr(a),void0!==e&&e.notify({method:"failed",params:a.toString()}),a})}varN,O,P,Q={},R={},S={},T=[],U=0,V=newRegExp("^(?:[a-z]+:)?//|data:","i"),W=!1,X=[];b.addEventListener("error",function(a){X.push(a)}),b.addEventListener("beforeunload",function(){W=!0}),s.prototype=newError,s.prototype.constructor=s,O=function(){functiona(){vara,b=h.length;for(a=0;b>a;a+=1)h[a].cancel();h=[]}varb,d,e,f,g=this,h=[];returnthisinstanceofO?(b=newc.Promise(function(b,c,h){d=function(b){returnf?void0:(g.isRejected=!0,g.rejectedReason=b,f=!0,a(),c(b))},e=h},a),g.cancel=function(){f||(f=!0,b.cancel(),b.fail(function(a){g.isRejected=!0,g.rejectedReason=a}))},g.then=function(){returnb.then.apply(b,arguments)},g.fail=function(){returnb.fail.apply(b,arguments)},void(g.monitor=function(a){if(f)thrownews;varb=(newc.Queue).push(function(){returna}).push(function(a){varb,c,d=h.length,e=[];for(c=0;d>c;c+=1)b=h[c],b.isFulfilled||b.isRejected||e.push(b);h=e},function(b){throwbinstanceofc.CancellationError&&(a.isFulfilled&&a.isRejected||a.cancel()),d(b),b},function(a){returne(a),a});returnh.push(b),this})):newO},O.prototype=Object.create(c.Promise.prototype),O.prototype.constructor=O,t.prototype.__title="",t.prototype.__interface_list=[],t.prototype.__path="",t.prototype.__html="",t.prototype.__required_css_list=[],t.prototype.__required_js_list=[],t.__ready_list=[v,w],t.ready=function(a){returnthis.__ready_list.push(a),this},t.setState=function(a){varb=JSON.stringify(a);returnthis.__ready_list.unshift(function(){this.state=JSON.parse(b)}),this},t.onStateChange=function(a){returnthis.prototype.__state_change_callback=a,this},t.__service_list=[],t.declareService=function(a){returnthis.__service_list.push(a),this},t.onEvent=function(a,b,c,d){returnthis.__service_list.push(function(){returnn(this.element,a,c,b.bind(this),d)}),this},t.onLoop=function(a,b){returnvoid0===b&&(b=0),this.__service_list.push(function(){vard=newc.Queue,e=this,f=function(){d.push(function(){returnc.delay(b)}).push(function(){returno()}).push(function(){returna.apply(e,[])}).push(function(){f()})};returnf(),d}),this},t.declareJob=function(a,b){returnthis.prototype[a]=function(){varc=this,d=arguments;c.__job_triggered?x(c,a,b,d):c.__job_list.push([a,b,d])},this},t.declareMethod=function(a,b){returnthis.prototype[a]=function(){vara=this,d=arguments;return(newc.Queue).push(function(){returnb.apply(a,d)})},this},t.declareMethod("getInterfaceList",function(){returnthis.__interface_list}).declareMethod("getRequiredCSSList",function(){returnthis.__required_css_list}).declareMethod("getRequiredJSList",function(){returnthis.__required_js_list}).declareMethod("getPath",function(){returnthis.__path}).declareMethod("getTitle",function(){returnthis.__title}).declareMethod("getElement",function(){if(void0===this.element)thrownewError("No element defined");returnthis.element}).declareMethod("changeState",function(a){varb,d=newc.Queue,e=this;returne.hasOwnProperty("__previous_onStateChange")&&(b=e.__previous_onStateChange,d.push(function(){returnb}).push(void0,function(){})),e.__previous_onStateChange=d,d.push(function(){varb,d,f=!1,g=e.hasOwnProperty("__modification_dict");g?(d=e.__modification_dict,f=!0):d={};for(bina)a.hasOwnProperty(b)&&a[b]!==e.state[b]&&(e.state[b]=a[b],d[b]=a[b],f=!0);returnf&&void0!==e.__state_change_callback?(e.__modification_dict=d,(newc.Queue).push(function(){returne.__state_change_callback(d)}).push(function(a){returndeletee.__modification_dict,a})):void0})}),t.declareAcquiredMethod=function(a,b){returnthis.prototype[a]=function(){vara=Array.prototype.slice.call(arguments,0),d=this;return(newc.Queue).push(function(){returnd.__aq_parent(b,a)})},this},t.declareAcquiredMethod("aq_reportServiceError","reportServiceError"),t.declareAcquiredMethod("aq_reportGadgetDeclarationError","reportGadgetDeclarationError"),t.allowPublicAcquisition=function(a,b){returnthis.prototype.__acquired_method_dict[a]=b,this},B.__ready_list=t.__ready_list.slice(),B.__service_list=t.__service_list.slice(),B.ready=t.ready,B.setState=t.setState,B.onStateChange=t.onStateChange,B.declareService=t.declareService,B.onEvent=t.onEvent,B.onLoop=t.onLoop,B.prototype=newt,B.prototype.constructor=B,D.__ready_list=t.__ready_list.slice(),D.ready=t.ready,D.setState=t.setState,D.onStateChange=t.onStateChange,D.__service_list=t.__service_list.slice(),D.declareService=t.declareService,D.onEvent=t.onEvent,D.onLoop=t.onLoop,D.prototype=newt,D.prototype.constructor=D,t.declareMethod("declareGadget",function(b,d){vare=this;returnvoid0===d&&(d={}),void0===d.sandbox&&(d.sandbox="public"),b=N.getAbsoluteURL(b,this.__path),(newc.Queue).push(function(){vara;if("public"===d.sandbox)a=C;elseif("iframe"===d.sandbox)a=E;else{if("dataurl"!==d.sandbox)thrownewError("Unsupported sandbox options '"+d.sandbox+"'");a=F}returna(b,d,e)}).push(function(f){functiong(){returnf}functionh(a){returnfunction(){returna.call(f,f)}}vari,j,k=newc.Queue;for(i=0;i<f.constructor.__ready_list.length;i+=1)k.push(h(f.constructor.__ready_list[i])),k.push(g);if(j=d.scope,void0===j)for(j="RJS_"+U,U+=1;e.__sub_gadget_dict.hasOwnProperty(j);)j="RJS_"+U,U+=1;returne.__sub_gadget_dict[j]=f,f.element.setAttribute("data-gadget-scope",j),f.element.setAttribute("data-gadget-url",b),f.element.setAttribute("data-gadget-sandbox",d.sandbox),f.element._gadget=f,a.contains(f.element)&&k.push(y),k.push(g),k})}).declareMethod("getDeclaredGadget",function(a){if(!this.__sub_gadget_dict.hasOwnProperty(a))thrownewError("Gadget scope '"+a+"' is not known.");returnthis.__sub_gadget_dict[a]}).declareMethod("dropGadget",function(a){if(!this.__sub_gadget_dict.hasOwnProperty(a))thrownewError("Gadget scope '"+a+"' is not known.");deletethis.__sub_gadget_dict[a]}),N=function(a){varc;if(a===b&&(c=T[0]),void0===c)thrownewError("Unknown selector '"+a+"'");returnc},N.AcquisitionError=function(a){if(this.name="AcquisitionError",void0!==a&&"string"!=typeofa)thrownewTypeError("You must pass a string.");this.message=a||"Acquisition failed"},N.AcquisitionError.prototype=newError,N.AcquisitionError.prototype.constructor=N.AcquisitionError,N.getAbsoluteURL=function(a,b){returnb&&a?newl(a,b).href:a},N.declareJS=function(b,d,e){varf;returnR.hasOwnProperty(b)?f=c.resolve():(R[b]=null,f=newc.Promise(function(c,f){varg;g=a.createElement("script"),g.async=!1,g.type="text/javascript",g.onload=function(){e===!0&&T.shift(),c()},g.onerror=function(a){e===!0&&T.shift(),f(a)},g.src=b,d.appendChild(g)})),f},N.declareCSS=function(b,d){vare;returne=S.hasOwnProperty(b)?c.resolve():newc.Promise(function(c,e){varf;f=a.createElement("link"),f.rel="stylesheet",f.type="text/css",f.href=b,f.onload=function(){S[b]=null,c()},f.onerror=function(a){e(a)},d.appendChild(f)})},N.declareGadgetKlass=function(b){if(Q.hasOwnProperty(b))returnQ[b].promise;vard,e=c.defer();returnQ[b]=e,(newc.Queue).push(function(){returnp(b)}).push(function(e){d=G(e,b);varf,g=a.createDocumentFragment(),h=[],i=d.prototype.__required_js_list,j=d.prototype.__required_css_list;if(i.length){for(T.push(d),f=0;f<i.length-1;f+=1)h.push(N.declareJS(i[f],g));h.push(N.declareJS(i[f],g,!0))}for(f=0;f<j.length;f+=1)h.push(N.declareCSS(j[f],g));returna.head.appendChild(g),c.all(h)}).push(function(){returne.resolve(d),d}).push(void0,function(a){throwe.reject(a),a})},N.clearGadgetKlassList=function(){Q={},R={},S={}},N.parseGadgetHTMLDocument=function(a,b){varc,d,e={title:"",interface_list:[],required_css_list:[],required_js_list:[]};if(!b||!V.test(b))thrownewError("The url should be absolute: "+b);if(9!==a.nodeType)thrownewError("The first parameter should be an HTMLDocument");if(e.title=a.title,null!==a.head)for(c=0;c<a.head.children.length;c+=1)d=a.head.children[c],null!==d.href&&("stylesheet"===d.rel?e.required_css_list.push(N.getAbsoluteURL(d.getAttribute("href"),b)):"SCRIPT"!==d.nodeName||"text/javascript"!==d.type&&d.type?"http://www.renderjs.org/rel/interface"===d.rel&&e.interface_list.push(N.getAbsoluteURL(d.getAttribute("href"),b)):e.required_js_list.push(N.getAbsoluteURL(d.getAttribute("src"),b)));returne},b.rJS=b.renderJS=N,b.__RenderJSGadget=t,b.__RenderJSEmbeddedGadget=B,b.__RenderJSIframeGadget=D,P=newc.defer,N.manualBootstrap=function(){P.resolve()},a.addEventListener("DOMContentLoaded",P.resolve,!1),M(q(b.location.href))}(document,window,RSVP,DOMParser,Channel,MutationObserver,Node,FileReader,Blob,navigator,Event,URL);