'use strict';var Li;var Mi=chrome.i18n.getMessage("545449835455981095");v("mr.IssueSeverity",{qE:"fatal",GO:"warning",vI:"notification"});v("mr.IssueAction",{dE:"dismiss",MG:"learn_more"});
var Ni=function(a,b){this.sinkId=this.routeId=null;this.severity=b;this.isBlocking="fatal"==this.severity?!0:!1;this.title=a;this.message=null;this.defaultAction="dismiss";this.helpPageId=this.secondaryActions=null},Pi=function(){var a=new Ni(Oi,"notification");a.helpPageId=6320939;a.defaultAction="learn_more";a.secondaryActions=["dismiss"];return a},Qi=function(a,b){a.routeId=b;return a},Ri=function(a,b){a.sinkId=b;return a};var Si=function(a,b){var c=this;this.g=void 0===b?null:b;this.promise=new Promise(function(d,e){var f=function(g){c.g=null;e(g)};c.h=f;a(function(g){c.g=null;d(g)},f)})};Si.prototype.cancel=function(a){this.h(a);if(this.g){var b=this.g;this.g=null;setTimeout(function(){return b(a)},0)}};var Ti=function(a,b,c){c=void 0===c?null:c;return new Si(function(d,e){a.promise.then(function(f){if(b)try{d(b(f))}catch(g){e(g)}else d(f)},function(f){if(c)try{d(c(f))}catch(g){e(g)}else e(f)})},function(d){a.cancel(d)})};
Si.prototype.then=function(a,b){return Ti(this,a,void 0===b?null:b)};Si.prototype.catch=function(a){return Ti(this,null,a)};var Ui=function(a){return new Si(function(b){b(a)})},Vi=function(a){return new Si(function(b,c){c(a)})},Wi=function(a){return new Si(function(b,c){a.then(b,c)})},Xi=function(a,b){var c=!1,d=null;return new Si(function(e,f){a.then(function(g){c||(d=b(g),d.promise.then(e,f))},f)},function(e){d?d.cancel(e):c=!0})};var Yi={CC:0,AC:1,EC:2,BC:3,aB:4,DC:5,PF:6,ZM:7,YD:8,UNKNOWN:9},Zi=function(a,b){a=Error.call(this,a);this.message=a.message;"stack"in a&&(this.stack=a.stack);this.reason=0<=b&&9>=b?b:9};t(Zi,Error);var $i=function(){var a=n(navigator.userAgent.match(/Windows NT (\d+.\d+)/)||[]);a.next();a=a.next().value;return 6.2<=parseFloat(a)},aj=function(){var a=navigator.userAgent;return a.includes("CrOS")?"ChromeOS":a.includes("Windows")?"Windows":a.includes("Macintosh")?"Mac":a.includes("Linux")?"Linux":"Other"};var bj=["ChromeOS","Windows"].includes(aj());var cj=function(a,b,c,d){this.h=a;this.g=b;this.j=c||null;this.presentationId=d||null},fj=function(a,b){if("tab"==a.h)a=dj(a);else if("offscreen_tab"==a.h)b=dj(a),b.presentationId=a.presentationId,a=b;else{var c={audio:!1,video:!1};a.g.shouldCaptureVideo?(c.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:b}},ej(a,c.video.mandatory),bj&&a.g.shouldCaptureAudio&&(c.audio={mandatory:{chromeMediaSource:"system",chromeMediaSourceId:b}})):a.g.shouldCaptureAudio&&(c.audio={mandatory:{chromeMediaSource:"system"}});
a=c}return a},dj=function(a){var b={audio:a.g.shouldCaptureAudio,video:a.g.shouldCaptureVideo};a.g.shouldCaptureVideo&&(b.videoConstraints={mandatory:{enableAutoThrottling:!0}},ej(a,b.videoConstraints.mandatory));return b},ej=function(a,b){var c=a.g.minWidth,d=a.g.minHeight;if(a.g.senderSideLetterboxing){c=a.g;if(0==c.minHeight||0==c.maxHeight?0:Math.floor(100*c.minWidth/c.minHeight)==Math.floor(100*c.maxWidth/c.maxHeight))c={width:c.minWidth,height:c.minHeight};else{d=c.maxWidth;for(var e=c.maxHeight;0!=
e;){var f=d%e;d=e;e=f}e=c.maxWidth/d;d=c.maxHeight/d;if(e<c.minWidth||d<c.minHeight)if(f=Math.max(c.minWidth/e,c.minHeight/d),e*=f,d*=f,e>c.maxWidth||d>c.maxHeight)e=c.maxWidth,d=c.maxHeight;e=Math.round(e);d=Math.round(d);c={width:e,height:d}}d=c;c=d.width;d=d.height}Object.assign(b,{minWidth:c,minHeight:d,maxWidth:a.g.maxWidth,maxHeight:a.g.maxHeight,minFrameRate:a.g.minFrameRate,maxFrameRate:a.g.maxFrameRate})};var gj=function(a){this.g=a;this.h=this.Fg=null;this.o=eb("mr.mirror.MirrorMediaStream")};gj.prototype.start=function(){return"tab"==this.g.h?hj(this):"offscreen_tab"==this.g.h?ij(this):jj(this)};var hj=function(a){var b=fj(a.g);a.o.info("Starting tab capture with constraints "+JSON.stringify(b));return new Promise(function(c,d){chrome.tabCapture.capture(b,function(e){e?(kj(a,e),c(a)):d(lj())});window.setTimeout(function(){d(new Zi("chrome.tabCapture.capture failed to call its callback",2))},5E3)})};
gj.prototype.j=function(a){a&&this.o.info(function(){return"Track "+JSON.stringify(a.target)+" ended"});this.stop()};
var lj=function(){return chrome.runtime.lastError&&chrome.runtime.lastError.message?new Zi(chrome.runtime.lastError.message,7):new Zi("empty_stream",0)},mj=function(a){a=void 0===a?!0:a;return new Promise(function(b,c){var d=["screen"];a&&d.push("audio");"Linux"==aj()&&d.push("window");var e=window.setTimeout(function(){f&&chrome.desktopCapture.cancelChooseDesktopMedia(f);c(new Zi("timeout",1))},6E4);var f=chrome.desktopCapture.chooseDesktopMedia(d,null,function(g){window.clearTimeout(e);g?b(g):c(new Zi("User cancelled capture dialog",
3))})})},nj=function(a,b){return new Promise(function(c,d){a.o.info(function(){return"Starting desktop capture with constraints "+JSON.stringify(b)});navigator.mediaDevices.getUserMedia(b).then(function(e){e||d(new Zi("empty_stream",8));kj(a,e);c(e)},function(e){var f=8;"NotAllowedError"==e.name&&(f=3);d(new Zi(e.name+" "+e.constraintName+": "+e.message,f))})})},jj=function(a){return bj&&a.g.g.shouldCaptureAudio&&!a.g.g.shouldCaptureVideo?nj(a,fj(a.g)).then(function(){return a}):mj().then(function(b){b=
fj(a.g,b);return nj(a,b).then(function(){return a})})},ij=function(a){var b=fj(a.g);a.o.info(function(){return"Starting offscreen tab capture with constraints "+JSON.stringify(b)});return new Promise(function(c,d){chrome.tabCapture.captureOffscreenTab(a.g.j.toString(),b,function(e){e?(kj(a,e),c(a)):d(lj())})})},kj=function(a,b){a.h=b;b.getAudioTracks().length||b.getVideoTracks();b.getTracks().forEach(function(c){c.onended=a.j.bind(a)})};
gj.prototype.stop=function(){this.h&&(this.h.getTracks().forEach(function(a){a.onended=null;a.stop()}),this.h=null,this.Fg&&this.Fg())};var oj=function(){},sj=function(a){var b=pj.get(a)||null;if(b)return Promise.resolve(b);b=qj.get(a);b||(b=new Fb,qj.set(a,b),rj(a,b));return b.promise},rj=function(a,b){var c=tj.get(a)||null;if(!c)b.reject(Error("No corresponding bundle for "+a));else if(!uj.has(c)){var d=vj.get(c);d||(wj.info("Loading bundle "+c+" for module "+a),d=xj(c),vj.set(c,d));d.catch(function(e){b.reject(e)})}},xj=function(a){var b=new Fb;b.promise.then(function(){wj.info("Bundle "+a+" loaded")},function(d){wj.error("Failed to load bundle "+
a);throw d;});var c=document.createElement("script");c.src=chrome.extension.getURL(a);c.setAttribute("type","text/javascript");c.async=!0;c.onload=function(){return b.resolve(void 0)};c.onerror=function(){return b.reject(Error("Failed to load bundle "+a))};document.head.appendChild(c);return b.promise},yj=function(a,b){if(pj.has(a))throw Error("Duplicate module "+a);pj.set(a,b);(a=qj.get(a))&&a.resolve(b)};
oj.prototype.handleEvent=function(a,b){for(var c=1;c<arguments.length;++c);throw Error("Not implemented");};
var tj=new Map([["mr.cast.ChannelService","background_script.js"],["mr.cast.SinkDiscoveryService","background_script.js"],["mr.mirror.cast.Service","mirroring_cast_streaming.js"],["mr.cloud.slarti.SinkDiscoveryService","background_script.js"],["mr.mirror.hangouts.HangoutsService","mirroring_hangouts.js"],["mr.mirror.hangouts.MeetingsService","mirroring_hangouts.js"],["mr.ProviderManager","background_script.js"],["mr.mirror.webrtc.WebRtcService","mirroring_webrtc.js"]]),uj=new Set(["background_script.js"]),
wj=eb("mr.Module"),pj=new Map,qj=new Map,vj=new Map;var zj,Aj={kH:0,FC:1,GC:2,ZD:3,aE:4,XE:5,RF:6,iH:7,jI:8,kI:9,JJ:10,AL:11,BL:12,jM:13,YM:14},Bj=function(a){void 0==zj&&(Ab("MediaRouter.Provider.WakeEvent",a,Aj),zj=a)};var Cj=function(a){try{var b=new URL(a);return"http:"!=b.protocol&&"https:"!=b.protocol?!1:-1==b.hash.indexOf("__castAppId__")}catch(c){return!1}},Dj=["https://docs.google.com","https://meet.google.com"],Ej=function(a){return a.startsWith("urn:x-org.chromium.media:source:tab:")||-1!=a.indexOf("0F5096E8")},Fj=function(a){return"urn:x-org.chromium.media:source:desktop"==a},Gj=function(a){var b=a.search("urn:x-org.chromium.media:source:tab:");return-1==b?null:parseInt(a.substr(b+36),10)||null};var Hj=function(a,b){this.xa=a;this.j=b||null;this.h=this.g=null;this.M=eb("mr.mirror.Service."+a);this.rd=this.Aa.bind(this);this.D=!1};t(Hj,oj);Hj.prototype.th=function(){};Hj.prototype.getName=function(){return this.xa};
Hj.prototype.Al=function(a,b,c,d,e){var f=this;this.M.info("Start mirroring on route "+a.id);if(!this.D)return Vi(Error("Not initialized"));var g=new Promise(function(h,m){f.s().then(function(){var q=Ij(b,c,d);return(new gj(q)).start()}).then(function(q){if(f.h)throw q.stop(),new Zi("Cannot start multiple streams");f.h=q;q=f.G.bind(f);f.h.Fg=q;return e?e(a).promise:a}).then(function(q){if(f.g)throw new Zi("Cannot start multiple sessions");if(!f.h)throw new Zi("Media stream ended before session could start.");
f.g=f.Bi(c,q);q.yb.Oc=f.g.Oc;q=f.j.N.bind(f.j);f.g.K=q;Jj(f.g);return f.g.start(f.h.h)}).then(function(){Ej(b)&&!chrome.tabs.onUpdated.hasListener(f.rd)&&chrome.tabs.onUpdated.addListener(f.rd);return f.qa(a,b,c)}).then(function(){h(a)}).catch(function(q){Kj(f,q);return f.G().then(function(){m(q)})})});return Wi(g)};Hj.prototype.oa=function(a,b,c,d,e,f){this.M.info("Update mirroring on route "+a.id);return this.D?Wi(Lj(this,a,b,c,d,f)):Vi(Error("Not initialized"))};
var Lj=function(a,b,c,d,e,f){if(!a.g)return Promise.reject(new Zi("No session to update streams on",7));if(!a.g.Br())return Promise.reject(new Zi("Session does not support updating stream",7));var g=!1;return new Promise(function(h,m){var q=Ij(c,d,e);(new gj(q)).start().then(function(r){a.h&&(a.h.Fg=null,a.h.stop(),a.Zh());a.h=r;r=a.G.bind(a);a.h.Fg=r;g=!0;return f?f(b).promise:b}).then(function(){if(!a.g)throw new Zi("Session ended while updating stream");if(!a.h)throw new Zi("Media stream ended before session could be updated.");
return a.g.Ir(a.h.h)}).then(a.qa.bind(a,b,c,d)).then(function(){return h(b)}).catch(function(r){Kj(a,r);if(g)return a.G().then(function(){m(r)});m(r)})})};
Hj.prototype.qa=function(a,b,c){var d=this;return new Promise(function(e,f){if(d.g){Ej(b)?(Mj(d.g,a.yb.tabId),d.ai()):Cj(b)?(Mj(d.g,a.yb.tabId),d.wj()):d.Xh();f=d.h;var g=a.sinkId;c.shouldCaptureAudio&&f.h&&!f.h.getAudioTracks().length&&(f=Ri(new Ni(Mi,"notification"),g),d.j.g.onIssue(f));Jj(d.g);e()}else f(new Zi("Session gone before executing post-startup steps",7))})};
var Kj=function(a,b){b.reason=null!=b.reason?b.reason:9;a.M.error("Failed to start mirroring: "+b.message+(",  reason = "+b.reason+": "+b.stack));a.Kg(b.reason)};Hj.prototype.s=function(){var a=this;return this.D?this.G().then(function(b){b&&a.Yh();return b}):Promise.reject("Not initialized")};
Hj.prototype.G=function(){var a=this;chrome.tabs.onUpdated.removeListener(this.rd);var b=this.h;this.h=null;b&&(b.Fg=null);var c=this.g;this.g=null;var d;c?d=this.pk(c).catch(function(e){return a.M.error("Error in before-cleanup steps",e)}).then(function(){return c.stop()}).catch(function(e){return a.M.error("Error stopping session",e)}).then(function(){Nj(a.j,c.h.id)}).catch(function(e){return a.M.error("Error in ended callbacks",e)}).then(function(){return!0}):d=Promise.resolve(!1);b&&(d=d.then(function(e){b.stop();
a.Zh();return e}));return d};Hj.prototype.pk=function(){return Promise.resolve()};Hj.prototype.Aa=function(a,b,c){Bj(14);this.g&&Oj(this.g,a,b,c)};var Ij=function(a,b,c){if(Ej(a))return new cj("tab",b);if(Fj(a))return new cj("desktop",b);if(Cj(a)){if(!c)throw new Zi("Missing offscreen tab presentation id");return new cj("offscreen_tab",b,a,c)}throw new Zi("Source URN does not suggest a known capture type.");};k=Hj.prototype;k.Bi=function(){};k.ai=function(){};k.Xh=function(){};k.wj=function(){};
k.Yh=function(){};k.Kg=function(){};k.Zh=function(){};k.zl=function(){return bb()};k.createMediaRouteController=function(){return bb()};var Pj=function(a,b,c){this.h=a;this.l=b;this.g=void 0===c?null:c;this.j=null},Qj=function(a){switch(a.h){case "mirror_tab":return a.g?"Casting tab ("+a.g+")":"Casting tab";case "mirror_desktop":return"Casting desktop";case "mirror_file":return"Casting local content";case "media_remoting":return a.g?"Casting media ("+a.g+")":"Casting media";case "presentation":return"Casting "+(a.g||"site");default:return""}},Rj=function(a){if(a.l)return"Casting active";switch(a.h){case "mirror_tab":return"Casting tab";
case "mirror_desktop":return"Casting desktop";case "mirror_file":return"Casting local content";case "media_remoting":return"Casting media";case "presentation":return"Casting site";default:return""}};var Sj=function(a){return(new Promise(function(b){chrome.tabs.get(a,b)})).then(function(b){if(!b)throw Error("No such tab "+a);return b})};var Tj=function(a,b){this.h=a;this.K=void 0===b?null:b;b=null;var c=a.mediaSource;if(Cj(c)){var d="presentation";b=(new URL(c)).origin}else Ej(c)?d="mirror_tab":Fj(c)&&(d="mirror_desktop");this.Oc=new Pj(d,a.offTheRecord,b);this.j=this.tabId=null;this.G=!1},Mj=function(a,b){a.tabId!=b?(a.tabId=b,Sj(b).then(function(c){a.j=c;Jj(a)})):Promise.resolve()},Oj=function(a,b,c,d){b==a.tabId&&("complete"==c.status||c.favIconUrl&&"complete"==d.status)&&(a.j=d,Jj(a))},Jj=function(a){if(a.j){a.Oc.j=a.j.title;
a.Oc.l=a.j.incognito;var b=new URL(a.j.url);"file:"==b.protocol?(a.Oc.h="mirror_file",a.Oc.g=null):(a.Oc.h=a.G?"media_remoting":"mirror_tab",a.Oc.g="https:"==b.protocol?b.origin.substr(8):b.origin)}a.h.description=Qj(a.Oc);a.K&&a.K(a.h,a.Oc);a.Bq()};k=Tj.prototype;k.start=function(){};k.Br=function(){return!1};k.Ir=function(){};k.stop=function(){return Promise.resolve()};k.Bq=function(){};var Xj=function(){var a=this;this.h=1920;this.g=1080;this.maxWidth=this.h;this.maxHeight=this.g;this.minHeight=this.minWidth=180;this.senderSideLetterboxing=!1;this.minFrameRate=0;this.maxFrameRate=30;this.minVideoBitrate=300;this.maxVideoBitrate=5E3;this.audioBitrate=0;this.animatedLatencyMillis=this.minLatencyMillis=this.maxLatencyMillis=400;this.dscpEnabled=["Mac","Linux","ChromeOS"].includes(aj())||$i();this.shouldCaptureAudio=this.shouldCaptureVideo=this.enableLogging=!0;var b=window.localStorage?
window.localStorage.getItem(Uj):null;if(b)try{var c=JSON.parse(String(b));if(c instanceof Object)Vj(this,c),eb("mr.mirror.Settings").L(function(){return"Initial mr.mirror.Settings overridden to: "+Wj(a)});else throw Error("localStorage["+Uj+"] does not parse as an Object: "+b);}catch(d){throw eb("mr.mirror.Settings").error(Uj+' must be of the form \'{"maxWidth":640, "maxHeight":360}\'.',d),Error("Overrides not parseable.  See ERROR log for details.");}};
Xj.prototype.clone=function(){var a=new Xj;Vj(a,this);return a};
var Wj=function(a){return JSON.stringify(a,function(b,c){if(0==b.length||!b.endsWith("_"))return c})},Vj=function(a,b){for(var c=n(Object.keys(b)),d=c.next();!d.done;d=c.next())d=d.value,d.endsWith("_")||typeof b[d]!==typeof a[d]||(a[d]=b[d])},Yj=function(a){var b=Math.round(screen.width*window.devicePixelRatio),c=Math.round(screen.height*window.devicePixelRatio);c>b&&(c=n([c,b]),b=c.next().value,c=c.next().value);a.maxHeight*b<a.maxWidth*c?(b=Math.min(a.maxWidth,b),b-=b%160,c=90*b/160):(c=Math.min(a.maxHeight,
c),c-=c%90,b=160*c/90);if(b<Math.max(160,a.minWidth)||c<Math.max(90,a.minHeight))b=Math.max(160,a.minWidth),c=Math.max(90,a.minHeight);a.maxWidth=b;a.maxHeight=c},Uj="mr.mirror.Settings.Overrides";var Zj=function(a,b){this.type=a;this.data=b},ak=function(a){a=JSON.parse(a);if(!a.type)throw Error("Invalid message");return new Zj(a.type,a.data)},bk=function(a,b,c,d,e){this.description=a;this.settings=b||null;this.mediaConstraints=c||null;this.presentationUrl=d||null;this.presentationId=e||null};var ek=function(a,b){this.o=eb("cv2.PeerConnection");this.V=ck;this.ca=dk(this,b);this.l=this.ca.createDataChannel(a,{reliable:!1});this.H=new Fb;this.s=!1;this.j=0;this.h=null;this.u=this.C=0;this.g=!1;this.G=function(){};this.m=function(){};this.D=function(){};this.F=function(){}},fk=function(a,b){a.m=b},gk=function(a,b){a.D=b},hk=function(a,b){a.F=b},ik=function(a,b){a.G=b},jk=function(a,b){a.l.onmessage=function(c){b(c.data)}},kk=function(a){var b={};b.iceServers=[{url:"stun:stun.l.google.com:19302"}].concat(a);
return b},dk=function(a,b){var c=kk(b);b=new webkitRTCPeerConnection(c);b.onicecandidate=a.N.bind(a);b.onicegatheringstatechange=a.Y.bind(a);b.oniceconnectionstatechange=a.W.bind(a);a.o.info(function(){return"Created webkitRTCPeerConnnection with config: "+JSON.stringify(c)});return b};ek.prototype.start=function(){this.g||(this.g=!0,lk(this))};ek.prototype.stop=function(){this.o.info("Stopping peer connection...");this.g&&(this.g=!1,"closed"!=this.ca.signalingState&&this.ca.close());this.ca=null};
var lk=function(a){a.o.info("Sending offer to peer.");a.C=Date.now();a.ca.createOffer(a.K.bind(a),function(b){a.o.L("Error creating offer.",b)},a.V);a.H.promise.then(function(b){a.G(b)})};ek.prototype.K=function(a){var b=this;this.o.info(function(){return"Setting local description: "+JSON.stringify(a)});this.ca.setLocalDescription(a,function(){b.o.info("Local description set successfully")},function(c){b.o.L("Error setting local description.",c)})};
var mk=function(a,b){mb(a.o,function(){return"<===: "+JSON.stringify(b)});var c=new RTCSessionDescription(b);a.o.info(function(){return"Setting remote description: "+JSON.stringify(c)});a.ca.setRemoteDescription(c,function(){a.o.info("Remote description set successfully.")},function(d){a.o.L("Error setting remote description.",d)})};
ek.prototype.N=function(a){var b=this;a.candidate?(this.j++,this.u=Date.now(),1==this.j?this.h=setTimeout(function(){b.o.info("ICE candidate gathering timed out.");b.h=null;nk(b)},5E3):this.s&&this.o.L("Received ICE candidate after resolving session description.")):(this.o.info("End of ICE candidates."),sb("MediaRouter.WebRtc.IceCandidateGathering.Duration.Reported",Date.now()-this.C),nk(this),0<this.j&&sb("MediaRouter.WebRtc.IceCandidateGathering.Duration.Real",this.u-this.C))};
ek.prototype.Y=function(){"completed"==this.ca.iceGatheringState&&nk(this)};var nk=function(a){clearTimeout(a.h);a.h=null;if(!a.s){a.o.info("Resolving sesion description after gathering "+a.j+" ICE candidates.");var b=a.ca.localDescription;a.H.resolve({type:b.type,sdp:b.sdp});a.s=!0}};
ek.prototype.W=function(a){var b=this;if(this.ca){var c=this.ca.iceConnectionState;this.o.info("New ICE connection state: "+c+".");"connected"==c?this.m("iceconnected"):"completed"==c?this.m("icecompleted"):"failed"==c?(this.o.L(function(){return"Ice connection failed: "+JSON.stringify(a)}),this.D("icefailed")):"closed"==c?this.F("iceclosed"):"disconnected"==c&&(this.o.L("Ice connection state is bad."),this.g&&(this.o.info("Restarting ICE."),this.ca.createOffer(this.K.bind(this),function(d){b.o.L("Error creating new offer.",
d)},ok)))}};var ck={mandatory:{OfferToReceiveAudio:!0,OfferToReceiveVideo:!0}},ok={mandatory:{IceRestart:!0,OfferToReceiveAudio:!0,OfferToReceiveVideo:!0}};/*

 Copyright The Closure Library Authors.
 SPDX-License-Identifier: Apache-2.0
*/
var pk=function(){var a=window.crypto.getRandomValues(new Uint8Array(16));return Tb(a,function(b){b=b.toString(16);return 1<b.length?b:"0"+b}).join("")},qk=function(a){for(var b=[],c=0,d=0;d<a.length;d++){var e=a.charCodeAt(d);128>e?b[c++]=e:(2048>e?b[c++]=e>>6|192:(55296==(e&64512)&&d+1<a.length&&56320==(a.charCodeAt(d+1)&64512)?(e=65536+((e&1023)<<10)+(a.charCodeAt(++d)&1023),b[c++]=e>>18|240,b[c++]=e>>12&63|128):b[c++]=e>>12|224,b[c++]=e>>6&63|128),b[c++]=e&63|128)}return b},rk=function(a){for(var b=
[],c=0,d=0;c<a.length;){var e=a[c++];if(128>e)b[d++]=String.fromCharCode(e);else if(191<e&&224>e){var f=a[c++];b[d++]=String.fromCharCode((e&31)<<6|f&63)}else if(239<e&&365>e){f=a[c++];var g=a[c++],h=a[c++];e=((e&7)<<18|(f&63)<<12|(g&63)<<6|h&63)-65536;b[d++]=String.fromCharCode(55296+(e>>10));b[d++]=String.fromCharCode(56320+(e&1023))}else f=a[c++],g=a[c++],b[d++]=String.fromCharCode((e&15)<<12|(f&63)<<6|g&63)}return b.join("")};var sk=0,tk=0;function uk(a){var b=0>a;a=Math.abs(a);var c=a>>>0;a=Math.floor((a-c)/4294967296);a>>>=0;b&&(a=~a>>>0,c=(~c>>>0)+1,4294967295<c&&(c=0,a++,4294967295<a&&(a=0)));sk=c;tk=a}
function vk(a){var b=0>a?1:0;a=b?-a:a;if(0===a)0<1/a?sk=tk=0:(tk=0,sk=2147483648);else if(isNaN(a))tk=0,sk=2147483647;else if(3.4028234663852886E38<a)tk=0,sk=(b<<31|2139095040)>>>0;else if(1.1754943508222875E-38>a)a=Math.round(a/Math.pow(2,-149)),tk=0,sk=(b<<31|a)>>>0;else{var c=Math.floor(Math.log(a)/Math.LN2);a*=Math.pow(2,-c);a=Math.round(8388608*a)&8388607;tk=0;sk=(b<<31|c+127<<23|a)>>>0}}function wk(a,b){return 4294967296*b+(a>>>0)}
function xk(a,b){var c=b&2147483648;c&&(a=~a+1>>>0,b=~b>>>0,0==a&&(b=b+1>>>0));a=wk(a,b);return c?-a:a}function yk(a,b){function c(e,f){e=e?String(e):"";return f?"0000000".slice(e.length)+e:e}if(2097151>=b)return""+(4294967296*b+a);var d=(a>>>24|b<<8)>>>0&16777215;b=b>>16&65535;a=(a&16777215)+6777216*d+6710656*b;d+=8147497*b;b*=2;1E7<=a&&(d+=Math.floor(a/1E7),a%=1E7);1E7<=d&&(b+=Math.floor(d/1E7),d%=1E7);return c(b,0)+c(d,b)+c(a,1)}
function zk(a,b){var c=b&2147483648;c&&(a=~a+1>>>0,b=~b+(0==a?1:0)>>>0);a=yk(a,b);return c?"-"+a:a}function Ak(a){if(a.constructor===Uint8Array)return a;if(a.constructor===ArrayBuffer||a.constructor===Array)return new Uint8Array(a);if(a.constructor===String)return Bk(a);Mb("Type not convertible to Uint8Array.");return new Uint8Array(0)};var Dk=function(a,b,c){this.j=null;this.g=this.l=this.C=0;this.m=!1;a&&Ck(this,a,b,c)},Fk=function(a,b,c){if(Ek.length){var d=Ek.pop();a&&Ck(d,a,b,c);return d}return new Dk(a,b,c)};Dk.prototype.clone=function(){return Fk(this.j,this.C,this.l-this.C)};Dk.prototype.clear=function(){this.j=null;this.g=this.l=this.C=0;this.m=!1};var Ck=function(a,b,c,d){a.j=Ak(b);a.C=void 0!==c?c:0;a.l=void 0!==d?a.C+d:a.j.length;a.g=a.C};Dk.prototype.reset=function(){this.g=this.C};
var Gk=function(a,b){for(var c=128,d=0,e=0,f=0;4>f&&128<=c;f++)c=a.j[a.g++],d|=(c&127)<<7*f;128<=c&&(c=a.j[a.g++],d|=(c&127)<<28,e|=(c&127)>>4);if(128<=c)for(f=0;5>f&&128<=c;f++)c=a.j[a.g++],e|=(c&127)<<7*f+3;if(128>c)return b(d>>>0,e>>>0);Mb("Failed to read varint, encoding is invalid.");a.m=!0};
Dk.prototype.h=function(){var a=this.j;var b=a[this.g+0];var c=b&127;if(128>b)return this.g+=1,c;b=a[this.g+1];c|=(b&127)<<7;if(128>b)return this.g+=2,c;b=a[this.g+2];c|=(b&127)<<14;if(128>b)return this.g+=3,c;b=a[this.g+3];c|=(b&127)<<21;if(128>b)return this.g+=4,c;b=a[this.g+4];c|=(b&15)<<28;if(128>b)return this.g+=5,c>>>0;this.g+=5;128<=a[this.g++]&&128<=a[this.g++]&&128<=a[this.g++]&&128<=a[this.g++]&&this.g++;return c};Dk.prototype.s=function(){return this.h()};
var Hk=function(a){var b=a.j[a.g+0],c=a.j[a.g+1],d=a.j[a.g+2],e=a.j[a.g+3];a.g+=4;return(b<<0|c<<8|d<<16|e<<24)>>>0},Ik=function(a){var b=Hk(a);a=2*(b>>31)+1;var c=b>>>23&255;b&=8388607;return 255==c?b?NaN:Infinity*a:0==c?a*Math.pow(2,-149)*b:a*Math.pow(2,c-150)*(b+Math.pow(2,23))};Dk.prototype.u=function(){return this.s()};var Ek=[];var Jk=function(a){this.h=Fk(a,void 0,void 0);this.C=this.h.g;this.j=this.g=-1;this.l=!1},x=function(a){return 4==a.j};Jk.prototype.reset=function(){this.h.reset();this.j=this.g=-1};
var y=function(a){var b=a.h;if(b.g==b.l)return!1;(b=a.l)||(b=a.h,b=b.m||0>b.g||b.g>b.l);if(b)return Mb("Decoder hit an error"),!1;a.C=a.h.g;var c=a.h.h();b=c>>>3;c&=7;if(0!=c&&5!=c&&1!=c&&2!=c&&3!=c&&4!=c)return Mb("Invalid wire type: %s (at position %s)",c,a.C),a.l=!0,!1;a.g=b;a.j=c;return!0},A=function(a){switch(a.j){case 0:if(0!=a.j)Mb("Invalid wire type for skipVarintField"),A(a);else{for(a=a.h;a.j[a.g]&128;)a.g++;a.g++}break;case 1:1!=a.j?(Mb("Invalid wire type for skipFixed64Field"),A(a)):(a=
a.h,a.g+=8);break;case 2:if(2!=a.j)Mb("Invalid wire type for skipDelimitedField"),A(a);else{var b=a.h.h();a=a.h;a.g+=b}break;case 5:5!=a.j?(Mb("Invalid wire type for skipFixed32Field"),A(a)):(a=a.h,a.g+=4);break;case 3:b=a.g;do{if(!y(a)){Mb("Unmatched start-group tag: stream EOF");a.l=!0;break}if(4==a.j){a.g!=b&&(Mb("Unmatched end-group tag"),a.l=!0);break}A(a)}while(1);break;default:a.l=!0,Mb("Invalid wire encoding for field.")}},B=function(a,b,c){var d=a.h.l,e=a.h.h();e=a.h.g+e;a.h.l=e;c(b,a);a.h.g=
e;a.h.l=d},Kk=function(a){return a.h.s()},Lk=function(a){return Gk(a.h,xk)},Mk=function(a){return!!a.h.h()},E=function(a){return Gk(a.h,xk)},F=function(a){var b=a.h.h();a=a.h;var c=a.j,d=a.g,e=d+b,f=[];for(b="";d<e;){var g=c[d++];if(128>g)f.push(g);else if(192>g)continue;else if(224>g){var h=c[d++];f.push((g&31)<<6|h&63)}else if(240>g){h=c[d++];var m=c[d++];f.push((g&15)<<12|(h&63)<<6|m&63)}else if(248>g){h=c[d++];m=c[d++];var q=c[d++];g=(g&7)<<18|(h&63)<<12|(m&63)<<6|q&63;g-=65536;f.push((g>>10&
1023)+55296,(g&1023)+56320)}8192<=f.length&&(b+=String.fromCharCode.apply(null,f),f.length=0)}if(8192>=f.length)f=String.fromCharCode.apply(null,f);else{c="";for(e=0;e<f.length;e+=8192)c+=String.fromCharCode.apply(null,mc(f,e,e+8192));f=c}a.g=d;return b+f},Nk=function(a,b){var c=a.h.h();c=a.h.g+c;for(var d=[];a.h.g<c;)d.push(b.call(a.h));return d},Ok=function(a){return Nk(a,a.h.u)};var Pk=function(){this.g=[]};Pk.prototype.length=function(){return this.g.length};Pk.prototype.end=function(){var a=this.g;this.g=[];return a};
var Qk=function(a){for(var b=sk,c=tk;0<c||127<b;)a.g.push(b&127|128),b=(b>>>7|c<<25)>>>0,c>>>=7;a.g.push(b)},Rk=function(a,b){for(;127<b;)a.g.push(b&127|128),b>>>=7;a.g.push(b)},Sk=function(a,b){if(0<=b)Rk(a,b);else{for(var c=0;9>c;c++)a.g.push(b&127|128),b>>=7;a.g.push(1)}},Tk=function(a,b){a.g.push(b>>>0&255);a.g.push(b>>>8&255);a.g.push(b>>>16&255);a.g.push(b>>>24&255)};var Uk={},Vk=null,Xk=function(a){var b;void 0===b&&(b=0);Wk();b=Uk[b];for(var c=[],d=0;d<a.length;d+=3){var e=a[d],f=d+1<a.length,g=f?a[d+1]:0,h=d+2<a.length,m=h?a[d+2]:0,q=e>>2;e=(e&3)<<4|g>>4;g=(g&15)<<2|m>>6;m&=63;h||(m=64,f||(g=64));c.push(b[q],b[e],b[g]||"",b[m]||"")}return c.join("")},Bk=function(a){var b=a.length,c=3*b/4;c%3?c=Math.floor(c):-1!="=.".indexOf(a[b-1])&&(c=-1!="=.".indexOf(a[b-2])?c-2:c-1);var d=new Uint8Array(c),e=0;Yk(a,function(f){d[e++]=f});return d.subarray(0,e)},Yk=function(a,
b){function c(m){for(;d<a.length;){var q=a.charAt(d++),r=Vk[q];if(null!=r)return r;if(!td(q))throw Error("Unknown base64 encoding at char: "+q);}return m}Wk();for(var d=0;;){var e=c(-1),f=c(0),g=c(64),h=c(64);if(64===h&&-1===e)break;b(e<<2|f>>4);64!=g&&(b(f<<4&240|g>>2),64!=h&&b(g<<6&192|h))}},Wk=function(){if(!Vk){Vk={};for(var a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),b=["+/=","+/","-_=","-_.","-_"],c=0;5>c;c++){var d=a.concat(b[c].split(""));Uk[c]=d;for(var e=
0;e<d.length;e++){var f=d[e];void 0===Vk[f]&&(Vk[f]=e)}}}};var Zk=function(){this.l=[];this.j=0;this.h=new Pk;this.m=[]},al=function(a,b){$k(a,b,2);b=a.h.end();a.l.push(b);a.j+=b.length;b.push(a.j);return b},bl=function(a,b){var c=b.pop();for(c=a.j+a.h.length()-c;127<c;)b.push(c&127|128),c>>>=7,a.j++;b.push(c);a.j++};Zk.prototype.reset=function(){this.l=[];this.h.end();this.j=0;this.m=[]};
var cl=function(a){for(var b=new Uint8Array(a.j+a.h.length()),c=a.l,d=c.length,e=0,f=0;f<d;f++){var g=c[f];b.set(g,e);e+=g.length}c=a.h.end();b.set(c,e);a.l=[b];return b},$k=function(a,b,c){Rk(a.h,8*b+c)};Zk.prototype.g=function(a,b){null!=b&&(dl(a,b,-2147483648<=b&&2147483648>b),null!=b&&(el(a,b),$k(this,a,0),Sk(this.h,b)))};var fl=function(a,b,c){null!=c&&(dl(b,c,-9223372036854775808<=c&&0x7fffffffffffffff>c),null!=c&&($k(a,b,0),a=a.h,uk(c),Qk(a)))};
Zk.prototype.C=function(a,b){null!=b&&(dl(a,b,0<=b&&4294967296>b),null!=b&&($k(this,a,0),Rk(this.h,b)))};
var gl=function(a,b,c){null!=c&&(dl(b,c,0<=c&&1.8446744073709552E19>c),null!=c&&($k(a,b,0),a=a.h,uk(c),Qk(a)))},hl=function(a,b,c){null!=c&&(dl(b,c,0<=c&&4294967296>c),$k(a,b,5),Tk(a.h,c))},il=function(a,b,c){null!=c&&($k(a,b,5),a=a.h,vk(c),Tk(a,sk))},jl=function(a,b,c){if(null!=c){$k(a,b,1);a=a.h;var d=c;d=(c=0>d?1:0)?-d:d;if(0===d)tk=0<1/d?0:2147483648,sk=0;else if(isNaN(d))tk=2147483647,sk=4294967295;else if(1.7976931348623157E308<d)tk=(c<<31|2146435072)>>>0,sk=0;else if(2.2250738585072014E-308>
d)d/=Math.pow(2,-1074),tk=(c<<31|d/4294967296)>>>0,sk=d>>>0;else{var e=d;b=0;if(2<=e)for(;2<=e&&1023>b;)b++,e/=2;else for(;1>e&&-1022<b;)e*=2,b--;d*=Math.pow(2,-b);tk=(c<<31|b+1023<<20|1048576*d&1048575)>>>0;sk=4503599627370496*d>>>0}Tk(a,sk);Tk(a,tk)}},kl=function(a,b,c){null!=c&&(dl(b,c,"boolean"===typeof c||"number"===typeof c),$k(a,b,0),a.h.g.push(c?1:0))},G=function(a,b,c){null!=c&&(c=parseInt(c,10),el(b,c),$k(a,b,0),Sk(a.h,c))},H=function(a,b,c){if(null!=c){b=al(a,b);for(var d=a.h,e=0;e<c.length;e++){var f=
c.charCodeAt(e);if(128>f)d.g.push(f);else if(2048>f)d.g.push(f>>6|192),d.g.push(f&63|128);else if(65536>f)if(55296<=f&&56319>=f&&e+1<c.length){var g=c.charCodeAt(e+1);56320<=g&&57343>=g&&(f=1024*(f-55296)+g-56320+65536,d.g.push(f>>18|240),d.g.push(f>>12&63|128),d.g.push(f>>6&63|128),d.g.push(f&63|128),e++)}else d.g.push(f>>12|224),d.g.push(f>>6&63|128),d.g.push(f&63|128)}bl(a,b)}},I=function(a,b,c,d){null!=c&&(b=al(a,b),d(c,a),bl(a,b))},ll=function(a,b,c){if(null!=c)for(var d=0;d<c.length;d++){var e=
a,f=b,g=c[d];null!=g&&(el(f,g),$k(e,f,0),Sk(e.h,g))}},ml=function(a,b,c){if(null!=c)for(var d=0;d<c.length;d++)hl(a,b,c[d])},nl=function(a,b,c){if(null!=c)for(var d=0;d<c.length;d++)G(a,b,c[d])},ol=function(a,b,c){if(null!=c)for(var d=0;d<c.length;d++)H(a,b,c[d])},pl=function(a,b,c,d){if(null!=c)for(var e=0;e<c.length;e++){var f=al(a,b);d(c[e],a);bl(a,f)}},ql=function(a,b,c,d){if(null!=c)for(var e=0;e<c.length;e++)$k(a,b,3),d(c[e],a),$k(a,b,4)},rl=function(a,b,c){if(null!=c&&c.length){for(var d=al(a,
b),e=0;e<c.length;e++)el(b,c[e]),Sk(a.h,c[e]);bl(a,d)}},sl=function(a,b,c){if(null!=c&&c.length)for($k(a,b,2),Rk(a.h,4*c.length),b=0;b<c.length;b++){var d=a.h;vk(c[b]);Tk(d,sk)}},tl=function(a,b,c){if(null!=c&&c.length){b=al(a,b);for(var d=0;d<c.length;d++)Sk(a.h,c[d]);bl(a,b)}};function el(a,b){dl(a,b,b===Math.floor(b));dl(a,b,-2147483648<=b&&2147483648>b)}function dl(a,b,c){c||Mb("for ["+b+"] at ["+a+"]")};var vl=function(a){this.h=a;this.g={};this.j=!0;if(0<this.h.length){for(a=0;a<this.h.length;a++){var b=this.h[a],c=b[0];this.g[c.toString()]=new ul(c,b[1])}this.j=!0}};k=vl.prototype;k.Mc=function(){var a;if(!this.j){this.h.length=0;var b=wl(this);b.sort();for(var c=0;c<b.length;c++){var d=this.g[b[c]];(a=d.g)&&a.Mc();this.h.push([d.key,d.value])}this.j=!0}return this.h};k.clear=function(){this.g={};this.j=!1};
k.entries=function(){var a=[],b=wl(this);b.sort();for(var c=0;c<b.length;c++){var d=this.g[b[c]];a.push([d.key,d.value])}return new xl(a)};k.keys=function(){var a=[],b=wl(this);b.sort();for(var c=0;c<b.length;c++)a.push(this.g[b[c]].key);return new xl(a)};k.values=function(){var a=[],b=wl(this);b.sort();for(var c=0;c<b.length;c++)a.push(this.g[b[c]].value);return new xl(a)};k.forEach=function(a,b){var c=wl(this);c.sort();for(var d=0;d<c.length;d++){var e=this.g[c[d]];a.call(b,e.value,e.key,this)}};
k.set=function(a,b){var c=new ul(a);c.value=b;this.g[a.toString()]=c;this.j=!1;return this};k.get=function(a){if(a=this.g[a.toString()])return a.value};k.has=function(a){return a.toString()in this.g};var wl=function(a){a=a.g;var b=[],c;for(c in a)Object.prototype.hasOwnProperty.call(a,c)&&b.push(c);return b},ul=function(a,b){this.key=a;this.value=b;this.g=void 0},xl=function(a){this.g=0;this.h=a};xl.prototype.next=function(){return this.g<this.h.length?{done:!1,value:this.h[this.g++]}:{done:!0,value:void 0}};
"undefined"!=typeof Symbol&&"undefined"!=typeof Symbol.iterator&&(xl.prototype[Symbol.iterator]=function(){return this});var J=function(){},yl="function"==typeof Uint8Array,L=function(a,b,c,d,e,f){a.g=null;b||(b=c?[c]:[]);a.D=c?String(c):void 0;a.C=0===c?-1:0;a.h=b;a:{c=a.h.length;b=-1;if(c&&(b=c-1,c=a.h[b],!(null===c||"object"!=typeof c||Array.isArray(c)||yl&&c instanceof Uint8Array))){a.m=b-a.C;a.j=c;break a}-1<d?(a.m=Math.max(d,b+1-a.C),a.j=null):a.m=Number.MAX_VALUE}a.s={};if(e)for(d=0;d<e.length;d++)b=e[d],b<a.m?(b+=a.C,a.h[b]=a.h[b]||zl):(Al(a),a.j[b]=a.j[b]||zl);if(f&&f.length)for(d=0;d<f.length;d++)Bl(a,f[d])},
zl=Object.freeze?Object.freeze([]):[],Al=function(a){var b=a.m+a.C;a.h[b]||(a.j=a.h[b]={})},M=function(a,b){if(b<a.m){b+=a.C;var c=a.h[b];return c===zl?a.h[b]=[]:c}if(a.j)return c=a.j[b],c===zl?a.j[b]=[]:c},Cl=function(a,b){a=M(a,b);return null==a?a:+a},Dl=function(a,b){a=M(a,b);return null==a?a:!!a},El=function(a,b){var c=M(a,b);a.s||(a.s={});if(!a.s[b]){for(var d=0;d<c.length;d++)c[d]=+c[d];a.s[b]=!0}return c},N=function(a,b,c){a=M(a,b);return null==a?c:a},O=function(a,b,c){a=Dl(a,b);return null==
a?c:a},Fl=function(a,b){a=Cl(a,b);return null==a?0:a},P=function(a,b,c){b<a.m?a.h[b+a.C]=c:(Al(a),a.j[b]=c);return a},Hl=function(a,b,c){return Gl(a,b,c,!1)},Q=function(a,b,c){return Gl(a,b,c,"")},Il=function(a,b,c){return Gl(a,b,c,0)},Gl=function(a,b,c,d){c!==d?P(a,b,c):b<a.m?a.h[b+a.C]=null:(Al(a),delete a.j[b]);return a},Jl=function(a,b,c){M(a,b).push(c)},Kl=function(a,b,c,d){(c=Bl(a,c))&&c!==b&&void 0!==d&&(a.g&&c in a.g&&(a.g[c]=void 0),P(a,c,void 0));P(a,b,d)},Bl=function(a,b){for(var c,d,e=
0;e<b.length;e++){var f=b[e],g=M(a,f);null!=g&&(c=f,d=g,P(a,f,void 0))}return c?(P(a,c,d),c):0},R=function(a,b,c,d){a.g||(a.g={});if(!a.g[c]){var e=M(a,c);if(d||e)a.g[c]=new b(e)}return a.g[c]},S=function(a,b,c){Ll(a,b,c);b=a.g[c];b==zl&&(b=a.g[c]=[]);return b},Ll=function(a,b,c){a.g||(a.g={});if(!a.g[c]){for(var d=M(a,c),e=[],f=0;f<d.length;f++)e[f]=new b(d[f]);a.g[c]=e}},U=function(a,b,c){a.g||(a.g={});var d=c?c.Mc():c;a.g[b]=c;return P(a,b,d)},Ml=function(a,b,c,d){a.g||(a.g={});var e=d?d.Mc():
d;a.g[b]=d;Kl(a,b,c,e)},Nl=function(a,b,c){a.g||(a.g={});c=c||[];for(var d=[],e=0;e<c.length;e++)d[e]=c[e].Mc();a.g[b]=c;return P(a,b,d)},Ol=function(a,b,c,d){Ll(a,d,b);var e=a.g[b];e||(e=a.g[b]=[]);c=c?c:new d;a=M(a,b);e.push(c);a.push(c.Mc());return c},Pl=function(a){if(a.g)for(var b in a.g){var c=a.g[b];if(Array.isArray(c))for(var d=0;d<c.length;d++)c[d]&&c[d].Mc();else c&&c.Mc()}};J.prototype.Mc=function(){Pl(this);return this.h};
J.prototype.va=yl?function(){var a=Uint8Array.prototype.toJSON;Uint8Array.prototype.toJSON=function(){return Xk(this)};try{return JSON.stringify(this.h&&this.Mc(),Ql)}finally{Uint8Array.prototype.toJSON=a}}:function(){return JSON.stringify(this.h&&this.Mc(),Ql)};var Ql=function(a,b){return"number"!==typeof b||!isNaN(b)&&Infinity!==b&&-Infinity!==b?b:String(b)};J.prototype.toString=function(){Pl(this);return this.h.toString()};
J.prototype.getExtension=function(a){Al(this);this.g||(this.g={});return a.ed?(!this.g[175237375]&&this.j[175237375]&&(this.g[175237375]=new a.ed(this.j[175237375])),this.g[175237375]):this.j[175237375]};J.prototype.G=function(a,b){this.g||(this.g={});Al(this);a.ed?(this.g[175237375]=b,this.j[175237375]=b?b.Mc():b):this.j[175237375]=b;return this};
var Sl=function(a,b){return a==b||!(!a||!b)&&a instanceof b.constructor&&Rl(a.Mc(),b.Mc())},Tl=function(a,b){a=a||{};b=b||{};var c={},d;for(d in a)c[d]=0;for(d in b)c[d]=0;for(d in c)if(!Rl(a[d],b[d]))return!1;return!0},Rl=function(a,b){if(a==b)return!0;if(!Ra(a)||!Ra(b))return"number"===typeof a&&isNaN(a)||"number"===typeof b&&isNaN(b)?String(a)==String(b):!1;if(a.constructor!=b.constructor)return!1;if(yl&&a.constructor===Uint8Array){if(a.length!=b.length)return!1;for(var c=0;c<a.length;c++)if(a[c]!=
b[c])return!1;return!0}if(a.constructor===Array){var d=void 0,e=void 0,f=Math.max(a.length,b.length);for(c=0;c<f;c++){var g=a[c],h=b[c];g&&g.constructor==Object&&(d=g,g=void 0);h&&h.constructor==Object&&(e=h,h=void 0);if(!Rl(g,h))return!1}return d||e?(d=d||{},e=e||{},Tl(d,e)):!0}if(a.constructor===Object)return Tl(a,b);throw Error("Invalid type in JSPB array");};J.prototype.clone=function(){return Ul(this)};
var Ul=function(a){return new a.constructor(Vl(a.Mc()))},Vl=function(a){if(Array.isArray(a)){for(var b=Array(a.length),c=0;c<a.length;c++){var d=a[c];null!=d&&(b[c]="object"==typeof d?Vl(d):d)}return b}if(yl&&a instanceof Uint8Array)return new Uint8Array(a);b={};for(c in a)d=a[c],null!=d&&(b[c]="object"==typeof d?Vl(d):d);return b};var Wl=function(a){L(this,a,0,-1,null,null)};w(Wl,J);var Xl=function(a){L(this,a,0,-1,null,null)};w(Xl,J);
var $l=function(a,b){for(;y(b)&&!x(b);)switch(b.g){case 1:var c=Lk(b);Yl(a,c);break;case 2:c=F(b);P(a,2,c);break;case 3:c=new Xl;B(b,c,Zl);U(a,3,c);break;default:A(b)}return a},bm=function(a,b){var c=M(a,1);null!=c&&fl(b,1,c);c=M(a,2);null!=c&&H(b,2,c);c=R(a,Xl,3);null!=c&&I(b,3,c,am)},Zl=function(a,b){for(;y(b)&&!x(b);)switch(b.g){case 1:var c=F(b);P(a,1,c);break;case 2:c=Lk(b);P(a,2,c);break;default:A(b)}return a},am=function(a,b){var c=M(a,1);null!=c&&H(b,1,c);c=M(a,2);null!=c&&fl(b,2,c)};
Wl.prototype.vb=function(){return M(this,1)};var Yl=function(a,b){return P(a,1,b)};var cm=function(a,b){this.type="cast_app";this.originId=window["castApp.eventPage.Message.OriginID"]||void 0;this.subtype=a;this.devices=b;this.logRecord=this.deviceJustSetUp=void 0};v("castApp.eventPage.Message",cm);var dm=function(a,b,c){this.ipAddress=a;this.appId=b;this.sessionId=c};cm.DeviceData=dm;cm.DeviceJustSetUp=function(a,b,c,d){this.ipAddress=a;this.name=b;this.udn=c;this.modelName=d};cm.DeviceCapabilities=function(){};
cm.LogRecord=function(a,b,c,d){this.levelValue=a;this.msg=b;this.loggerName=c;this.time=d};var em=function(a,b){this.type=a;this.entryPoint=b};v("castApp.frontEnd.ExtensionMessage",em);var fm=function(a){return"urn:x-cast:com.google.cast."+a},gm=fm("tp.connection"),hm=fm("receiver"),im=fm("remoting"),jm=fm("media"),km=fm("webrtc"),lm=fm("broadcast"),mm=Sc({GN:gm,HN:fm("tp.heartbeat"),YJ:hm,tK:im,jH:jm,qH:fm("media.universalRemote.optIn"),JO:km,HB:lm});var nm=function(a){return"available"==a||"available_rescan"==a};var om=function(a,b,c,d,e){this.id=a;this.friendlyName=b;this.iconType=c||"generic";this.description=void 0===d?null:d;this.domain=void 0===e?null:e};var pm=window.localStorage,qm=0,sm=function(a){return(a=window.localStorage.getItem(rm(a,!1)))?JSON.parse(a):null},tm=function(a){return(a=window.localStorage.getItem(rm(a,!0)))?JSON.parse(a):null},vm=function(a){if(um.has(a.Ya()))throw Error("Duplicate instance name "+a.Ya());um.set(a.Ya(),a);a.Nb()},Bm=function(a){for(var b=0,c=n(Object.keys(pm)),d=c.next();!d.done;d=c.next()){d=d.value;var e=d.length+window.localStorage.getItem(d).length;d.startsWith("mr.")?qm+=e:b+=e}wm=a;(window.localStorage.getItem("version")&&
window.localStorage.getItem("version")!==chrome.runtime.getManifest().version||xm(a))&&ym();zm.info("initialize: "+qm+" chars used, "+b+" other chars");chrome.runtime.onSuspend.addListener(Am)},wm=null,zm=eb("mr.PersistentDataManager"),um=new Map,rm=function(a,b){return"mr."+(b?"persistent.":"temp.")+a.Ya()},xm=function(a){return!!window.localStorage.getItem("mrInstanceId")&&window.localStorage.getItem("mrInstanceId")!==a},Am=function(){zm.info("onSuspend");Cm("version",chrome.runtime.getManifest().version);
wm&&Cm("mrInstanceId",wm);for(var a=um.get("LogManager"),b=n(um),c=b.next();!c.done;c=b.next())c=n(c.value),c.next(),c=c.next().value,c!=a&&Dm(c);a&&Dm(a)},Dm=function(a){try{var b=a.Ob();b&&void 0!=b[0]&&Cm(rm(a,!1),JSON.stringify(b[0]));b&&void 0!=b[1]&&Cm(rm(a,!0),JSON.stringify(b[1]))}catch(c){zm.error("Error while saving data for "+a.Ya()+": "+c.message)}},Cm=function(a,b){var c=window.localStorage.getItem(a);c=null!=c?b.length-c.length:a.length+b.length;52E5<qm+c&&(zm.L("Unable to write "+c+
" chars"),ym());if(52E5<qm+c)throw zm.error("Unable to write "+c+" chars after clearing temporary"),Error("Setting the value of '"+a+"' would exceed the quota, according to accounting.");try{window.localStorage.setItem(a,b)}catch(d){throw Error("Setting the value of '"+a+"' would exceed the quota, according to the browser.");}qm+=c},Em=function(a){a=0==a.size%2?new Blob([a,new Uint8Array([0,0])]):new Blob([a,new Uint8Array([1])]);return new Promise(function(b,c){var d=new FileReader;d.onloadend=function(){if(d.error)c(d.error);
else try{for(var e=d.result,f=[],g=0,h=e.byteLength;g<h;g+=8192)f.push(String.fromCharCode.apply(null,new Uint16Array(e,g,Math.min(h-g,8192)/2)));Cm("mr.temp.mirror.cast.Service.eventsBlob",f.join(""));b()}catch(m){c(m)}};d.readAsArrayBuffer(a)})},ym=function(){for(var a=n(Object.keys(pm)),b=a.next();!b.done;b=a.next())b=b.value,b.startsWith("mr.temp.")&&(qm-=b.length+window.localStorage.getItem(b).length,delete window.localStorage[b]);zm.info("removeTemporary_: "+qm+" chars used")};var Fm=(new Map).set("+","-").set("/","_").set("=",".");(new Map).set("-","+").set("_","/").set(".","=");function Gm(a){return btoa(String.fromCharCode.apply(String,p(a))).replace(/[+/=]/g,function(b){return Fm.get(b)})};var Hm=function(){this.g=[];this.C=[];this.m=[];this.j=[];this.j[0]=128;for(var a=1;64>a;++a)this.j[a]=0;this.l=this.h=0;this.reset()};Hm.prototype.reset=function(){this.g[0]=1732584193;this.g[1]=4023233417;this.g[2]=2562383102;this.g[3]=271733878;this.g[4]=3285377520;this.l=this.h=0};
var Im=function(a,b,c){c=void 0===c?0:c;var d=a.m;if("string"===typeof b)for(var e=0;16>e;e++)d[e]=b.charCodeAt(c)<<24|b.charCodeAt(c+1)<<16|b.charCodeAt(c+2)<<8|b.charCodeAt(c+3),c+=4;else for(e=0;16>e;e++)d[e]=b[c]<<24|b[c+1]<<16|b[c+2]<<8|b[c+3],c+=4;for(b=16;80>b;b++)c=d[b-3]^d[b-8]^d[b-14]^d[b-16],d[b]=(c<<1|c>>>31)&4294967295;b=a.g[0];c=a.g[1];e=a.g[2];for(var f=a.g[3],g=a.g[4],h,m,q=0;80>q;q++)40>q?20>q?(h=f^c&(e^f),m=1518500249):(h=c^e^f,m=1859775393):60>q?(h=c&e|f&(c|e),m=2400959708):(h=
c^e^f,m=3395469782),h=(b<<5|b>>>27)+h+g+m+d[q]&4294967295,g=f,f=e,e=(c<<30|c>>>2)&4294967295,c=b,b=h;a.g[0]=a.g[0]+b&4294967295;a.g[1]=a.g[1]+c&4294967295;a.g[2]=a.g[2]+e&4294967295;a.g[3]=a.g[3]+f&4294967295;a.g[4]=a.g[4]+g&4294967295};
Hm.prototype.update=function(a,b){b=void 0===b?a.length:b;for(var c=b-64,d=0,e=this.C,f=this.h;d<b;){if(0==f)for(;d<=c;)Im(this,a,d),d+=64;if("string"===typeof a)for(;d<b;){if(e[f]=a.charCodeAt(d),++f,++d,64==f){Im(this,e);f=0;break}}else for(;d<b;)if(e[f]=a[d],++f,++d,64==f){Im(this,e);f=0;break}}this.h=f;this.l+=b};
Hm.prototype.digest=function(){var a=[],b=8*this.l;56>this.h?this.update(this.j,56-this.h):this.update(this.j,64-(this.h-56));for(var c=63;56<=c;c--)this.C[c]=b&255,b/=256;Im(this,this.C);for(c=b=0;5>c;c++)for(var d=24;0<=d;d-=8)a[b]=this.g[c]>>d&255,++b;return a};var Jm=function(){return Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)};var Lm=function(){this.l=Jm();this.h=new Km(null,null);this.g=new Km(null,null);this.C=[];this.j=0;vm(this)},Nm=function(){Mm||(Mm=new Lm);return Mm},Om=function(a,b){b=b.toLowerCase();var c=new Hm;c.update(b);c.update(a.l);return"r"+Gm(c.digest())},Pm=function(){var a=Nm();return a.h.model?a.h:a.g.model?a.g:new Km(null,null)};Lm.prototype.Ya=function(){return"SinkUtils"};
Lm.prototype.Ob=function(){return[{recentLaunchedDevice:this.h,recentDiscoveredDevice:this.g},{receiverIdToken:this.l,fixedIpList:this.C.join(","),castControlPort:this.j}]};Lm.prototype.Nb=function(){var a=sm(this);a&&(this.h=a.recentLaunchedDevice||new Km(null,null),this.g=a.recentDiscoveredDevice||new Km(null,null));if(a=tm(this))this.l=a.receiverIdToken||Jm(),this.C=a.fixedIpList&&a.fixedIpList.split(",")||[],this.j=a.castControlPort||0};var Mm=null,Km=function(a,b){this.model=a;this.ip=b};var Qm=function(a,b,c,d,e,f){this.h=new om(a,b,d&1?"cast":d&32?"cast_audio_group":"cast_audio");this.l=c||null;this.g=d||null;this.C=e||null;this.m=f||null;this.j={};this.Ak=!1};Qm.prototype.update=function(a,b,c,d){var e=!1;this.h.friendlyName!=a&&(this.h.friendlyName=a,e=!0);null!=b&&this.C!=b&&(this.C=b,e=!0);null!=c&&this.m!=c&&(this.m=c,e=!0);null!=d&&this.g!=d&&(this.g=d,e=!0);return e};Qm.prototype.getId=function(){return this.h.id};Qm.prototype.hd=function(){return this.C};
Qm.prototype.Hb=function(){return this.m};var Rm=function(a,b){return a.j[b]||"unknown"};var Sm="StopIteration"in Fa?Fa.StopIteration:{message:"StopIteration",stack:""},Tm=function(){};Tm.prototype.next=function(){throw Sm;};Tm.prototype.Zb=function(){return this};
var Um=function(a){if(a instanceof Tm)return a;if("function"==typeof a.Zb)return a.Zb(!1);if(Qa(a)){var b=0,c=new Tm;c.next=function(){for(;;){if(b>=a.length)throw Sm;if(b in a)return a[b++];b++}};return c}throw Error("Not implemented");},Vm=function(a,b,c){if(Qa(a))try{Qb(a,b,c)}catch(d){if(d!==Sm)throw d;}else{a=Um(a);try{for(;;)b.call(c,a.next(),void 0,a)}catch(d){if(d!==Sm)throw d;}}},Wm=function(a,b){a=Um(a);try{for(;!b.call(void 0,a.next(),void 0,a););}catch(c){if(c!==Sm)throw c;}},Xm=function(a){if(Qa(a))return kc(a);
a=Um(a);var b=[];Vm(a,function(c){b.push(c)});return b};var Zm=function(a,b){this.h={};this.g=[];this.l=this.j=0;var c=arguments.length;if(1<c){if(c%2)throw Error("Uneven number of arguments");for(var d=0;d<c;d+=2)this.set(arguments[d],arguments[d+1])}else a&&Ym(this,a)};Zm.prototype.wa=function(){return this.j};Zm.prototype.Ja=function(){$m(this);for(var a=[],b=0;b<this.g.length;b++)a.push(this.h[this.g[b]]);return a};Zm.prototype.Ub=function(){$m(this);return this.g.concat()};var bn=function(a,b){return an(a.h,b)};
Zm.prototype.ng=function(a){for(var b=0;b<this.g.length;b++){var c=this.g[b];if(an(this.h,c)&&this.h[c]==a)return!0}return!1};Zm.prototype.equals=function(a,b){if(this===a)return!0;if(this.j!=a.wa())return!1;b=b||cn;$m(this);for(var c,d=0;c=this.g[d];d++)if(!b(this.get(c),a.get(c)))return!1;return!0};var cn=function(a,b){return a===b};Zm.prototype.ec=function(){return 0==this.j};Zm.prototype.clear=function(){this.h={};this.l=this.j=this.g.length=0};
Zm.prototype.remove=function(a){return an(this.h,a)?(delete this.h[a],this.j--,this.l++,this.g.length>2*this.j&&$m(this),!0):!1};var $m=function(a){if(a.j!=a.g.length){for(var b=0,c=0;b<a.g.length;){var d=a.g[b];an(a.h,d)&&(a.g[c++]=d);b++}a.g.length=c}if(a.j!=a.g.length){var e={};for(c=b=0;b<a.g.length;)d=a.g[b],an(e,d)||(a.g[c++]=d,e[d]=1),b++;a.g.length=c}};Zm.prototype.get=function(a,b){return an(this.h,a)?this.h[a]:b};
Zm.prototype.set=function(a,b){an(this.h,a)||(this.j++,this.g.push(a),this.l++);this.h[a]=b};var Ym=function(a,b){if(b instanceof Zm)for(var c=b.Ub(),d=0;d<c.length;d++)a.set(c[d],b.get(c[d]));else for(c in b)a.set(c,b[c])};Zm.prototype.forEach=function(a,b){for(var c=this.Ub(),d=0;d<c.length;d++){var e=c[d],f=this.get(e);a.call(b,f,e,this)}};Zm.prototype.clone=function(){return new Zm(this)};var dn=function(a){$m(a);for(var b={},c=0;c<a.g.length;c++){var d=a.g[c];b[d]=a.h[d]}return b};
Zm.prototype.Zb=function(a){$m(this);var b=0,c=this.l,d=this,e=new Tm;e.next=function(){if(c!=d.l)throw Error("The map has changed since the iterator was created");if(b>=d.g.length)throw Sm;var f=d.g[b++];return a?f:d.h[f]};return e};var an=function(a,b){return Object.prototype.hasOwnProperty.call(a,b)};var en=function(a,b){this.l=b;this.j=a;this.j.m=this.h.bind(this);this.g=new Zm;this.C=new Zm;this.o=eb("mr.cast.SinkDiscoveryService");this.Gi={Ln:0,Yo:0}};t(en,oj);en.prototype.init=function(){vm(this);yj("mr.cast.SinkDiscoveryService",this)};
var nn=function(a,b){a.o.info("addSinks returned "+b.length+" sinks");mb(a.o,function(){return"....the list is: "+JSON.stringify(b)});var c=new Set(a.g.Ub());b.forEach(function(e){var f=e.sink_id;var g=e.extra_data.cast_media_sink,h=g.ip_endpoint?g.ip_endpoint.address:g.ip_address,m=g.ip_endpoint?g.ip_endpoint.port:Nm().j||8009;f=new Qm(f,e.name,g.model_name,g.capabilities,h.address_bytes.join("."),m);g=a.g.get(f.getId());h=a.j;e=e.extra_data.cast_media_sink.cast_channel_id;m=f.getId();var q=h.h.get(m);
if(!q||q.channelId!=e){fn.info("Added cast channel "+e+" to receiver: "+m);q&&h.g.remove(q.channelId);q={auth:"ssl_verified",ipAddress:f.hd(),port:f.Hb()};q={channelId:e,readyState:"open",keepAlive:!0,audioOnly:!(f.g&1),connectInfo:q};h.h.set(m,q);h.g.set(e,m);var r=h.l.get(m);r&&r.channelId!=e&&(fn.info("Re-connected to receiver: "+f.getId()),gn(h.j,r,q),hn(h.C.C,f,!0));h.l.set(m,q)}if(g){if(h=g.update(f.h.friendlyName,f.hd(),f.Hb(),f.g))g.Ak=!1;h&&jn(a.l,g)}else a.o.info("Adding sink "+f.getId()),
kn(a,f),g=a.l,g.j.onSinkAvailabilityUpdated(g,1),jn(g,f),hn(g.C,f),Nm().g=new Km(f.l,f.hd());c.delete(f.getId())});c.forEach(function(e){var f=a.j,g=f.l.get(e);g&&(ln(f.j,g),f.l.remove(e));mn(a,e)});var d=a.g.wa();a.Gi={Ln:d,Yo:d}},kn=function(a,b){var c=a.g.get(b.getId()),d=null,e=b.hd(),f=b.Hb();null!=e&&null!=f&&(d=a.C.get(e+":"+f));if(c&&!d){var g=b.hd(),h=b.Hb();g&&h&&a.C.remove(g+":"+h)}d&&!c&&a.g.remove(d.getId());a.g.set(b.getId(),b);null!=e&&null!=f&&a.C.set(e+":"+f,b)},mn=function(a,b){var c=
a.g.get(b);if(c){a.o.info("Removing sink "+b);a.g.remove(b);b=c.hd();var d=c.Hb();null!=b&&null!=d&&a.C.remove(b+":"+d);a=a.l;if(0==a.g.g.wa())a.j.onSinkAvailabilityUpdated(a,0);b=a.C;c=c.getId();(c=on(b.g,c))&&c.session&&pn(b,c.session.sessionId);qn(a.H);rn(a.j)}},tn=function(a){a.o.info("Pruning inactive sinks.");var b=new Set;a.g.forEach(function(c){sn(a.j,c)||b.add(c.getId())});b.forEach(function(c){return mn(a,c)})};en.prototype.h=function(a){return this.g.get(a,null)};
var un=function(a,b){var c=[];Vm(a.g.Zb(!1),function(d){nm(Rm(d,b))&&c.push(d)});return c};en.prototype.Ya=function(){return"cast.SinkDiscoveryService"};en.prototype.Ob=function(){var a=this,b={};Vm(this.g.Zb(!0),function(c){var d=a.g.get(c);d={id:d.getId(),ip:d.hd(),port:d.Hb(),friendlyName:d.h.friendlyName,modelName:d.l,capabilities:d.g,discoveredByDial:d.Ak,appStatusMap:d.j};b[c]=d});return[new vn(b,this.Gi)]};
en.prototype.Nb=function(){var a=sm(this);if(a&&4==a.version){this.Gi=a.deviceCounts;a=a.sinkMap;for(var b in a){var c=void 0,d=a[b],e=new Qm("",d.friendlyName,d.modelName,d.capabilities,d.ip,d.port);e.h.id=d.id;e.Ak=d.discoveredByDial;e.j=d.appStatusMap;for(c in e.j)"unavailable"==e.j[c]&&(e.j[c]="unavailable_rescan");c=e;this.h(c.getId())||kn(this,c)}tn(this)}};var vn=function(a,b){this.sinkMap=a;this.deviceCounts=b;this.version=4};var wn={STOP_MEDIA:"STOP",MEDIA_SET_VOLUME:"SET_VOLUME",MEDIA_GET_STATUS:"GET_STATUS"};var xn=function(){this.type="GET_STATUS";this.requestId=0};var yn=function(a,b){this.requestId=a;this.Uf=b;this.Dr=null};yn.prototype.g=function(){};var zn=function(){this.g=new Zm},An=function(a,b){a.g.set(b.requestId,b);b.Dr=setTimeout(function(){a.g.remove(b.requestId);b.g()},b.Uf)},Bn=function(a,b){var c=a.g.get(b);if(!c)return null;clearTimeout(c.Dr);a.g.remove(b);return c};var Cn=function(a,b,c){this.type="APPLICATION_BROADCAST";this.requestId=0;this.appIds=a;this.namespace=b;this.message=c};var Dn=function(a){this.type="LAUNCH";this.requestId=0;this.appId=a;this.language=null};var En=function(a){this.type="STOP";this.requestId=0;this.sessionId=a||null};var Fn=function(a){this.h=a;this.g=1E3*Math.floor(1E6*Math.random())},Gn=function(a){var b=a.g++;0==b&&(b=a.g++);return b};Fn.prototype.Ya=function(){return"IdGenerator."+this.h};Fn.prototype.Ob=function(){return[this.g]};Fn.prototype.Nb=function(){var a=sm(this);a&&(this.g=a)};var Hn=function(a,b){this.h=a;this.j=b;this.g=new zn;this.l=new Fn("cast.RequestIdGenerator")};Hn.prototype.init=function(){vm(this.l)};var Jn=function(a,b,c,d){var e=Gn(a.l);b.requestId=e;b=new Fb;c=new In(e,b,"number"===typeof c&&0<c?c:6E5,d);An(a.g,c);return c};
Hn.prototype.sendRequest=function(a,b,c,d,e,f){var g=this;if(!mm.hasOwnProperty(c))return Promise.reject(Error("Custom namespace is not supported"));var h=Jn(this,a,void 0!==d?d:3E3,e),m=h.Fb;Kn(this.h,b,c,a,e||this.j,f).then(null,function(){Bn(g.g,h.requestId);m.reject(Ln)});return m.promise};
Hn.prototype.sendMessage=function(a,b,c,d,e,f){var g=this,h=Jn(this,a,void 0!==d?d:3E3,e),m=h.Fb;Kn(this.h,b,c,a,e||this.j,f).then(function(){Bn(g.g,h.requestId);m.resolve(!0)},function(){Bn(g.g,h.requestId);m.reject(Ln)});return m.promise};
var Mn=function(a,b,c){var d=new Dn(b.appId);d.language=b.language?b.language:chrome.i18n.getUILanguage?chrome.i18n.getUILanguage():chrome.runtime.getManifest().default_locale;return a.sendRequest(d,c,hm,b.requestSessionTimeout)},Nn=Error("Timeout"),Ln=Error("Failed to send message"),In=function(a,b,c,d){yn.call(this,a,c);this.Fb=b;this.sourceId=d};t(In,yn);In.prototype.g=function(){this.Fb.reject(Nn)};var On=function(a){return a.wa&&"function"==typeof a.wa?a.wa():Qa(a)||"string"===typeof a?a.length:Ic(a)},Pn=function(a){if(a.Ja&&"function"==typeof a.Ja)return a.Ja();if("string"===typeof a)return a.split("");if(Qa(a)){for(var b=[],c=a.length,d=0;d<c;d++)b.push(a[d]);return b}return Kc(a)},Qn=function(a){if(a.Ub&&"function"==typeof a.Ub)return a.Ub();if(!a.Ja||"function"!=typeof a.Ja){if(Qa(a)||"string"===typeof a){var b=[];a=a.length;for(var c=0;c<a;c++)b.push(c);return b}return Lc(a)}},Rn=function(a){return a.ec&&
"function"==typeof a.ec?a.ec():Qa(a)||"string"===typeof a?ac(a):Oc(a)},Sn=function(a,b,c){if(a.forEach&&"function"==typeof a.forEach)a.forEach(b,c);else if(Qa(a)||"string"===typeof a)Qb(a,b,c);else for(var d=Qn(a),e=Pn(a),f=e.length,g=0;g<f;g++)b.call(c,e[g],d&&d[g],a)},Tn=function(a,b,c){if("function"==typeof a.map)return a.map(b,c);if(Qa(a)||"string"===typeof a)return Tb(a,b,c);var d=Qn(a),e=Pn(a),f=e.length;if(d){var g={};for(var h=0;h<f;h++)g[d[h]]=b.call(c,e[h],d[h],a)}else for(g=[],h=0;h<f;h++)g[h]=
b.call(c,e[h],void 0,a);return g},Un=function(a,b){if("function"==typeof a.every)return a.every(b,void 0);if(Qa(a)||"string"===typeof a)return Wb(a,b,void 0);for(var c=Qn(a),d=Pn(a),e=d.length,f=0;f<e;f++)if(!b.call(void 0,d[f],c&&c[f],a))return!1;return!0};var Vn=function(a){this.g=new Zm;if(a){a=Pn(a);for(var b=a.length,c=0;c<b;c++)this.add(a[c])}},Wn=function(a){var b=typeof a;return"object"==b&&a||"function"==b?"o"+Ua(a):b.substr(0,1)+a};k=Vn.prototype;k.wa=function(){return this.g.wa()};k.add=function(a){this.g.set(Wn(a),a)};k.removeAll=function(a){a=Pn(a);for(var b=a.length,c=0;c<b;c++)this.remove(a[c])};k.remove=function(a){return this.g.remove(Wn(a))};k.clear=function(){this.g.clear()};k.ec=function(){return this.g.ec()};
k.contains=function(a){return bn(this.g,Wn(a))};k.Ja=function(){return this.g.Ja()};k.clone=function(){return new Vn(this)};k.equals=function(a){return this.wa()==On(a)&&Xn(this,a)};var Xn=function(a,b){var c=On(b);if(a.wa()>c)return!1;!(b instanceof Vn)&&5<c&&(b=new Vn(b));return Un(a,function(d){var e=b;return e.contains&&"function"==typeof e.contains?e.contains(d):e.ng&&"function"==typeof e.ng?e.ng(d):Qa(e)||"string"===typeof e?$b(e,d):Nc(e,d)})};Vn.prototype.Zb=function(){return this.g.Zb(!1)};var Zn=function(a,b){this.C=a;this.j=b;this.h=new Zm;this.g=new Vn;this.l=0;this.u=new Zm("serviceCheck",this.Sv.bind(this),"startDeviceMonitor",this.Tv.bind(this),"releaseDeviceMonitor",this.Rv.bind(this),"deviceJustSetUp",this.Pv.bind(this),"logRecord",this.Qv.bind(this));chrome.runtime.onMessage.addListener(this.s.bind(this));chrome.runtime.onMessageExternal.addListener(this.m.bind(this));Yn(this,"serviceReady")},qn=function(a){if($n(a)){var b=new Vn;Vm(a.C.g.Zb(!1),function(d){var e=d.hd();b.add(e);
bn(this.h,e)||this.j.sendRequest(new xn,d,hm)}.bind(a));var c=!1;a.h.Ub().forEach(function(d){b.contains(d)||(this.h.remove(d),c=!0)}.bind(a));c&&ao(a)}},$n=function(a){if(0===a.g.wa())return!1;var b=$a();3E4<b-a.l&&(a.l=b,chrome.tabs.query({url:["chrome://cast/*","chrome-extension://"+chrome.runtime.id+"/cast_setup/*"]},function(c){0===c.length?(this.o.info("No tabs found. Clearing device monitor clients."),this.g.clear()):this.o.info(function(){return"Tab check found active tabs: "+c.map(function(d){return d.id})})}.bind(a)));
b=a.g.wa();a.o.info("Monitor client count: "+b);return 0<b};Zn.prototype.s=function(a,b,c){if("object"!==typeof a||"cast_app"!==a.type)return!1;var d=this.u.get(a.subtype);if(!d)return!1;if(!a.originId)return Mb("Missing origin ID in the incoming message."),!1;try{var e=d(a,b,c);e&&c(e)}catch(f){this.o.error("Error while handling request",f)}return!1};var Yn=function(a,b,c){var d=new cm(b,c);mb(a.o,function(){return"Sending message: "+JSON.stringify(d)});chrome.runtime.sendMessage(d)};k=Zn.prototype;
k.Sv=function(){Yn(this,"serviceReady")};k.Tv=function(a){this.g.contains(a.originId)?this.o.info("Client: "+a.originId+"already registered, dispatching current device list."):(this.o.info("Registering monitor client: "+a.originId),this.g.add(a.originId));ao(this);bo(this)};k.Rv=function(a){this.o.info("Unregistering monitor client: "+a.originId);this.g.remove(a.originId)};k.Pv=function(a){a=a.deviceJustSetUp.udn.replace(/-/g,"").toLowerCase();this.o.info("Device just set up: "+a.slice(-4))};
k.Qv=function(a){a=a.logRecord;ib({level:pb(a.levelValue),M:a.loggerName,time:a.time,message:a.msg})};var ao=function(a){var b=a.h.Ja();Yn(a,"devices",b)},bo=function(a){a.C.g.Ja().forEach(function(b){this.j.sendRequest(new xn,b,hm)}.bind(a))};
Zn.prototype.m=function(a,b,c){switch(a.type){case "handshake":c(new em("handshake"));break;case "launch":b=b.tab&&"number"===typeof b.tab.id?b.tab.id:null,null===b||"setup"!==a.entryPoint&&"offers"!==a.entryPoint&&"devices"!==a.entryPoint||chrome.tabs.update(b,{url:"chrome://cast#"+a.entryPoint})}};Zn.prototype.o=eb("castApp.eventPage.Service");chrome.cast.VERSION=[1,2];v("chrome.cast.VERSION",chrome.cast.VERSION);chrome.cast.qA=!0;v("chrome.cast.usingPresentationApi",chrome.cast.qA);chrome.cast.hs=function(a,b){this.credentials=a;this.credentialsType=void 0===b?"web":b};v("chrome.cast.CredentialsData",chrome.cast.hs);chrome.cast.Error=function(a,b,c){this.code=a;this.description=b||null;this.details=c||null};v("chrome.cast.Error",chrome.cast.Error);chrome.cast.ot=function(a){this.platform=a;this.packageId=this.url=null};
v("chrome.cast.SenderApplication",chrome.cast.ot);chrome.cast.Image=function(a){this.url=a;this.width=this.height=null};v("chrome.cast.Image",chrome.cast.Image);chrome.cast.Volume=function(a,b){this.level=void 0!==a?a:null;this.muted=void 0!==b?b:null};v("chrome.cast.Volume",chrome.cast.Volume);chrome.cast.ke={CUSTOM_CONTROLLER_SCOPED:"custom_controller_scoped",TAB_AND_ORIGIN_SCOPED:"tab_and_origin_scoped",ORIGIN_SCOPED:"origin_scoped",PAGE_SCOPED:"page_scoped"};v("chrome.cast.AutoJoinPolicy",chrome.cast.ke);chrome.cast.oi={CREATE_SESSION:"create_session",CAST_THIS_TAB:"cast_this_tab"};v("chrome.cast.DefaultActionPolicy",chrome.cast.oi);chrome.cast.Ee={VIDEO_OUT:"video_out",AUDIO_OUT:"audio_out",VIDEO_IN:"video_in",AUDIO_IN:"audio_in",MULTIZONE_GROUP:"multizone_group"};
v("chrome.cast.Capability",chrome.cast.Ee);chrome.cast.pe={CANCEL:"cancel",TIMEOUT:"timeout",API_NOT_INITIALIZED:"api_not_initialized",INVALID_PARAMETER:"invalid_parameter",EXTENSION_NOT_COMPATIBLE:"extension_not_compatible",EXTENSION_MISSING:"extension_missing",RECEIVER_UNAVAILABLE:"receiver_unavailable",SESSION_ERROR:"session_error",CHANNEL_ERROR:"channel_error",LOAD_MEDIA_FAILED:"load_media_failed"};v("chrome.cast.ErrorCode",chrome.cast.pe);chrome.cast.bt={AVAILABLE:"available",UNAVAILABLE:"unavailable"};
v("chrome.cast.ReceiverAvailability",chrome.cast.bt);chrome.cast.pt={CHROME:"chrome",IOS:"ios",ANDROID:"android"};v("chrome.cast.SenderPlatform",chrome.cast.pt);chrome.cast.rn={CAST:"cast",DIAL:"dial",HANGOUT:"hangout",CUSTOM:"custom"};v("chrome.cast.ReceiverType",chrome.cast.rn);chrome.cast.ps={RUNNING:"running",STOPPED:"stopped",ERROR:"error"};v("chrome.cast.DialAppState",chrome.cast.ps);chrome.cast.Uj={CAST:"cast",STOP:"stop"};v("chrome.cast.ReceiverAction",chrome.cast.Uj);
chrome.cast.vn={CONNECTED:"connected",DISCONNECTED:"disconnected",STOPPED:"stopped"};v("chrome.cast.SessionStatus",chrome.cast.vn);chrome.cast.zn={ATTENUATION:"attenuation",FIXED:"fixed",MASTER:"master"};v("chrome.cast.VolumeControlType",chrome.cast.zn);chrome.cast.Xr=function(a,b,c,d,e){this.sessionRequest=a;this.sessionListener=b;this.receiverListener=c;this.autoJoinPolicy=d||chrome.cast.ke.TAB_AND_ORIGIN_SCOPED;this.defaultActionPolicy=e||chrome.cast.oi.CREATE_SESSION;this.customDialLaunchCallback=null;this.invisibleSender=!1;this.additionalSessionRequests=[]};v("chrome.cast.ApiConfig",chrome.cast.Xr);chrome.cast.ss=function(a,b){this.appName=a;this.launchParameter=b||null};v("chrome.cast.DialRequest",chrome.cast.ss);
chrome.cast.qs=function(a,b,c){this.receiver=a;this.appState=b;this.extraData=c||null};v("chrome.cast.DialLaunchData",chrome.cast.qs);chrome.cast.rs=function(a,b){this.doLaunch=a;this.launchParameter=b||null};v("chrome.cast.DialLaunchResponse",chrome.cast.rs);
chrome.cast.un=function(a,b,c,d,e){c=void 0===c?chrome.cast.timeout.requestSession:c;d=void 0===d?!1:d;e=void 0===e?null:e;this.appId=a;this.capabilities=Array.isArray(b)?b:[chrome.cast.Ee.VIDEO_OUT,chrome.cast.Ee.AUDIO_OUT];this.requestSessionTimeout=c;this.dialRequest=this.language=null;this.androidReceiverCompatible=d;this.credentialsData=e};v("chrome.cast.SessionRequest",chrome.cast.un);
chrome.cast.qn=function(a,b,c,d){this.label=a;this.friendlyName=Ae(b);this.capabilities=c||[];this.volume=d||null;this.receiverType=chrome.cast.rn.CAST;this.displayStatus=this.isActiveInput=null};v("chrome.cast.Receiver",chrome.cast.qn);chrome.cast.ct=function(a,b){this.statusText=a;this.appImages=b;this.showStop=null};v("chrome.cast.ReceiverDisplayStatus",chrome.cast.ct);
chrome.cast.xn=function(){this.requestSession=6E4;this.sendCustomMessage=this.setReceiverVolume=this.stopSession=this.leaveSession=3E3};v("chrome.cast.Timeout",chrome.cast.xn);chrome.cast.timeout=new chrome.cast.xn;v("chrome.cast.timeout",chrome.cast.timeout);chrome.cast.Tm="auto-join";chrome.cast.nn="cast-session_";chrome.cast.media.ys={SDR:"sdr",HDR:"hdr",DV:"dv"};v("chrome.cast.media.HdrType",chrome.cast.media.ys);chrome.cast.media.zs={AAC:"aac",AC3:"ac3",MP3:"mp3",TS:"ts",TS_AAC:"ts_aac",E_AC3:"e_ac3",FMP4:"fmp4"};v("chrome.cast.media.HlsSegmentFormat",chrome.cast.media.zs);chrome.cast.media.As={MPEG2_TS:"mpeg2_ts",FMP4:"fmp4"};v("chrome.cast.media.HlsVideoSegmentFormat",chrome.cast.media.As);chrome.cast.media.mf={PAUSE:"pause",SEEK:"seek",STREAM_VOLUME:"stream_volume",STREAM_MUTE:"stream_mute"};
v("chrome.cast.media.MediaCommand",chrome.cast.media.mf);chrome.cast.media.Ys={ALBUM:"ALBUM",PLAYLIST:"PLAYLIST",AUDIOBOOK:"AUDIOBOOK",RADIO_STATION:"RADIO_STATION",PODCAST_SERIES:"PODCAST_SERIES",TV_SERIES:"TV_SERIES",VIDEO_PLAYLIST:"VIDEO_PLAYLIST",LIVE_TV:"LIVE_TV",MOVIE:"MOVIE"};v("chrome.cast.media.QueueType",chrome.cast.media.Ys);chrome.cast.media.Pj={GENERIC_CONTAINER:0,AUDIOBOOK_CONTAINER:1};v("chrome.cast.media.ContainerType",chrome.cast.media.Pj);
chrome.cast.media.nf={GENERIC:0,MOVIE:1,TV_SHOW:2,MUSIC_TRACK:3,PHOTO:4,AUDIOBOOK_CHAPTER:5};v("chrome.cast.media.MetadataType",chrome.cast.media.nf);chrome.cast.media.cg={IDLE:"IDLE",PLAYING:"PLAYING",PAUSED:"PAUSED",BUFFERING:"BUFFERING"};v("chrome.cast.media.PlayerState",chrome.cast.media.cg);chrome.cast.media.Vj={OFF:"REPEAT_OFF",ALL:"REPEAT_ALL",SINGLE:"REPEAT_SINGLE",ALL_AND_SHUFFLE:"REPEAT_ALL_AND_SHUFFLE"};v("chrome.cast.media.RepeatMode",chrome.cast.media.Vj);
chrome.cast.media.dt={PLAYBACK_START:"PLAYBACK_START",PLAYBACK_PAUSE:"PLAYBACK_PAUSE"};v("chrome.cast.media.ResumeState",chrome.cast.media.dt);chrome.cast.media.wn={BUFFERED:"BUFFERED",LIVE:"LIVE",OTHER:"OTHER"};v("chrome.cast.media.StreamType",chrome.cast.media.wn);chrome.cast.media.Cs={CANCELLED:"CANCELLED",INTERRUPTED:"INTERRUPTED",FINISHED:"FINISHED",ERROR:"ERROR"};v("chrome.cast.media.IdleReason",chrome.cast.media.Cs);chrome.cast.media.xt={TEXT:"TEXT",AUDIO:"AUDIO",VIDEO:"VIDEO"};
v("chrome.cast.media.TrackType",chrome.cast.media.xt);chrome.cast.media.ut={SUBTITLES:"SUBTITLES",CAPTIONS:"CAPTIONS",DESCRIPTIONS:"DESCRIPTIONS",CHAPTERS:"CHAPTERS",METADATA:"METADATA"};v("chrome.cast.media.TextTrackType",chrome.cast.media.ut);chrome.cast.media.qt={NONE:"NONE",OUTLINE:"OUTLINE",DROP_SHADOW:"DROP_SHADOW",RAISED:"RAISED",DEPRESSED:"DEPRESSED"};v("chrome.cast.media.TextTrackEdgeType",chrome.cast.media.qt);chrome.cast.media.vt={NONE:"NONE",NORMAL:"NORMAL",ROUNDED_CORNERS:"ROUNDED_CORNERS"};
v("chrome.cast.media.TextTrackWindowType",chrome.cast.media.vt);chrome.cast.media.rt={SANS_SERIF:"SANS_SERIF",MONOSPACED_SANS_SERIF:"MONOSPACED_SANS_SERIF",SERIF:"SERIF",MONOSPACED_SERIF:"MONOSPACED_SERIF",CASUAL:"CASUAL",CURSIVE:"CURSIVE",SMALL_CAPITALS:"SMALL_CAPITALS"};v("chrome.cast.media.TextTrackFontGenericFamily",chrome.cast.media.rt);chrome.cast.media.st={NORMAL:"NORMAL",BOLD:"BOLD",BOLD_ITALIC:"BOLD_ITALIC",ITALIC:"ITALIC"};v("chrome.cast.media.TextTrackFontStyle",chrome.cast.media.st);
chrome.cast.media.zt={LIKE:"LIKE",DISLIKE:"DISLIKE",FOLLOW:"FOLLOW",UNFOLLOW:"UNFOLLOW"};v("chrome.cast.media.UserAction",chrome.cast.media.zt);chrome.cast.media.ws=function(){this.customData=null};v("chrome.cast.media.GetStatusRequest",chrome.cast.media.ws);chrome.cast.media.Ns=function(){this.customData=null};v("chrome.cast.media.PauseRequest",chrome.cast.media.Ns);chrome.cast.media.Os=function(){this.customData=null};v("chrome.cast.media.PlayRequest",chrome.cast.media.Os);chrome.cast.media.nt=function(){this.customData=this.resumeState=this.currentTime=null};v("chrome.cast.media.SeekRequest",chrome.cast.media.nt);
chrome.cast.media.StopRequest=function(){this.customData=null};v("chrome.cast.media.StopRequest",chrome.cast.media.StopRequest);chrome.cast.media.Dt=function(a){this.volume=a;this.customData=null};v("chrome.cast.media.VolumeRequest",chrome.cast.media.Dt);
chrome.cast.media.Es=function(a){this.type="LOAD";this.requestId=0;this.sessionId=null;this.media=a;this.activeTrackIds=null;this.autoplay=!0;this.atvCredentialsType=this.atvCredentials=this.credentialsType=this.credentials=void 0;this.customData=this.currentTime=null;this.queueData=this.playbackRate=void 0};v("chrome.cast.media.LoadRequest",chrome.cast.media.Es);chrome.cast.media.PJ=function(a){this.type="PRECACHE";this.requestId=0;this.precacheData=a};
chrome.cast.media.vs=function(a,b){this.requestId=0;this.activeTrackIds=a||null;this.textTrackStyle=b||null};v("chrome.cast.media.EditTracksInfoRequest",chrome.cast.media.vs);chrome.cast.media.Oj=function(a){this.containerType=a=void 0===a?chrome.cast.media.Pj.GENERIC_CONTAINER:a;this.containerDuration=this.containerImages=this.sections=this.title=void 0};v("chrome.cast.media.ContainerMetadata",chrome.cast.media.Oj);
chrome.cast.media.Nc=function(a){this.metadataType=this.type=a;this.queueItemId=this.sectionStartTimeInContainer=this.sectionStartAbsoluteTime=this.sectionStartTimeInMedia=this.sectionDuration=void 0};v("chrome.cast.media.MediaMetadata",chrome.cast.media.Nc);chrome.cast.media.en=function(){chrome.cast.media.Nc.call(this,chrome.cast.media.nf.GENERIC);this.releaseDate=this.releaseYear=this.images=this.subtitle=this.title=void 0};t(chrome.cast.media.en,chrome.cast.media.Nc);
v("chrome.cast.media.GenericMediaMetadata",chrome.cast.media.en);chrome.cast.media.gn=function(){chrome.cast.media.Nc.call(this,chrome.cast.media.nf.MOVIE);this.releaseDate=this.releaseYear=this.images=this.subtitle=this.studio=this.title=void 0};t(chrome.cast.media.gn,chrome.cast.media.Nc);v("chrome.cast.media.MovieMediaMetadata",chrome.cast.media.gn);
chrome.cast.media.yn=function(){chrome.cast.media.Nc.call(this,chrome.cast.media.nf.TV_SHOW);this.originalAirdate=this.releaseYear=this.images=this.episode=this.episodeNumber=this.season=this.seasonNumber=this.episodeTitle=this.title=this.seriesTitle=void 0};t(chrome.cast.media.yn,chrome.cast.media.Nc);v("chrome.cast.media.TvShowMediaMetadata",chrome.cast.media.yn);
chrome.cast.media.hn=function(){chrome.cast.media.Nc.call(this,chrome.cast.media.nf.MUSIC_TRACK);this.releaseDate=this.releaseYear=this.images=this.discNumber=this.trackNumber=this.artistName=this.songName=this.composer=this.artist=this.albumArtist=this.title=this.albumName=void 0};t(chrome.cast.media.hn,chrome.cast.media.Nc);v("chrome.cast.media.MusicTrackMediaMetadata",chrome.cast.media.hn);
chrome.cast.media.pn=function(){chrome.cast.media.Nc.call(this,chrome.cast.media.nf.PHOTO);this.creationDateTime=this.height=this.width=this.longitude=this.latitude=this.images=this.location=this.artist=this.title=void 0};t(chrome.cast.media.pn,chrome.cast.media.Nc);v("chrome.cast.media.PhotoMediaMetadata",chrome.cast.media.pn);chrome.cast.media.Vm=function(){chrome.cast.media.Oj.call(this,chrome.cast.media.Pj.AUDIOBOOK_CONTAINER);this.releaseDate=this.publisher=this.narrators=this.authors=void 0};
t(chrome.cast.media.Vm,chrome.cast.media.Oj);v("chrome.cast.media.AudiobookContainerMetadata",chrome.cast.media.Vm);chrome.cast.media.Um=function(){chrome.cast.media.Nc.call(this,chrome.cast.media.nf.AUDIOBOOK_CHAPTER);this.images=this.subtitle=this.bookTitle=this.chapterNumber=this.title=this.chapterTitle=void 0};t(chrome.cast.media.Um,chrome.cast.media.Nc);v("chrome.cast.media.AudiobookChapterMediaMetadata",chrome.cast.media.Um);
chrome.cast.media.Gs=function(a,b){this.contentId=a;this.contentUrl=void 0;this.streamType=chrome.cast.media.wn.BUFFERED;this.contentType=b;this.metadata=null;this.atvEntity=this.entity=void 0;this.duration=null;this.startAbsoluteTime=void 0;this.customData=this.textTrackStyle=this.tracks=null;this.userActionStates=this.hlsVideoSegmentFormat=this.hlsSegmentFormat=this.vmapAdsRequest=this.breakClips=this.breaks=void 0};v("chrome.cast.media.MediaInfo",chrome.cast.media.Gs);
chrome.cast.media.Ss=function(a){this.itemId=null;this.media=a;this.autoplay=!0;this.startTime=0;this.playbackDuration=null;this.preloadTime=0;this.customData=this.activeTrackIds=null};v("chrome.cast.media.QueueItem",chrome.cast.media.Ss);chrome.cast.media.ms="CC1AD845";v("chrome.cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID",chrome.cast.media.ms);chrome.cast.media.timeout={};chrome.cast.media.timeout.load=0;v("chrome.cast.media.timeout.load",chrome.cast.media.timeout.load);
chrome.cast.media.timeout.Ha=0;v("chrome.cast.media.timeout.getStatus",chrome.cast.media.timeout.Ha);chrome.cast.media.timeout.play=0;v("chrome.cast.media.timeout.play",chrome.cast.media.timeout.play);chrome.cast.media.timeout.pause=0;v("chrome.cast.media.timeout.pause",chrome.cast.media.timeout.pause);chrome.cast.media.timeout.seek=0;v("chrome.cast.media.timeout.seek",chrome.cast.media.timeout.seek);chrome.cast.media.timeout.stop=0;v("chrome.cast.media.timeout.stop",chrome.cast.media.timeout.stop);
chrome.cast.media.timeout.ic=0;v("chrome.cast.media.timeout.setVolume",chrome.cast.media.timeout.ic);chrome.cast.media.timeout.Ck=0;v("chrome.cast.media.timeout.editTracksInfo",chrome.cast.media.timeout.Ck);chrome.cast.media.timeout.Yy=0;v("chrome.cast.media.timeout.queue",chrome.cast.media.timeout.Yy);chrome.cast.media.wt=function(a,b){this.trackId=a;this.trackContentType=this.trackContentId=null;this.type=b;this.customData=this.subtype=this.language=this.name=null};v("chrome.cast.media.Track",chrome.cast.media.wt);
chrome.cast.media.tt=function(){this.customData=this.fontStyle=this.fontGenericFamily=this.fontFamily=this.fontScale=this.windowRoundedCornerRadius=this.windowColor=this.windowType=this.edgeColor=this.edgeType=this.backgroundColor=this.foregroundColor=null};v("chrome.cast.media.TextTrackStyle",chrome.cast.media.tt);chrome.cast.media.Us=function(a){this.type="QUEUE_LOAD";this.sessionId=this.requestId=null;this.items=a;this.startIndex=0;this.repeatMode=chrome.cast.media.Vj.OFF;this.customData=null};
v("chrome.cast.media.QueueLoadRequest",chrome.cast.media.Us);chrome.cast.media.Rs=function(a){this.type="QUEUE_INSERT";this.sessionId=this.requestId=null;this.items=a;this.customData=this.insertBefore=null};v("chrome.cast.media.QueueInsertItemsRequest",chrome.cast.media.Rs);chrome.cast.media.Zs=function(a){this.type="QUEUE_UPDATE";this.sessionId=this.requestId=null;this.items=a;this.customData=null};v("chrome.cast.media.QueueUpdateItemsRequest",chrome.cast.media.Zs);
chrome.cast.media.Ts=function(){this.type="QUEUE_UPDATE";this.customData=this.jump=this.currentItemId=this.sessionId=this.requestId=null};v("chrome.cast.media.QueueJumpRequest",chrome.cast.media.Ts);chrome.cast.media.Xs=function(){this.type="QUEUE_UPDATE";this.customData=this.repeatMode=this.sessionId=this.requestId=null};v("chrome.cast.media.QueueSetPropertiesRequest",chrome.cast.media.Xs);
chrome.cast.media.Vs=function(a){this.type="QUEUE_REMOVE";this.sessionId=this.requestId=null;this.itemIds=a;this.customData=null};v("chrome.cast.media.QueueRemoveItemsRequest",chrome.cast.media.Vs);chrome.cast.media.Ws=function(a){this.type="QUEUE_REORDER";this.sessionId=this.requestId=null;this.itemIds=a;this.customData=this.insertBefore=null};v("chrome.cast.media.QueueReorderItemsRequest",chrome.cast.media.Ws);
chrome.cast.media.bs=function(a,b,c){this.id=a;this.breakClipIds=b;this.position=c;this.duration=void 0;this.isWatched=!1;this.isEmbedded=void 0};v("chrome.cast.media.Break",chrome.cast.media.bs);chrome.cast.media.cs=function(a){this.id=a;this.vastAdsRequest=this.customData=this.hlsSegmentFormat=this.clickThroughUrl=this.posterUrl=this.whenSkippable=this.duration=this.title=this.contentType=this.contentUrl=this.contentId=void 0};v("chrome.cast.media.BreakClip",chrome.cast.media.cs);
chrome.cast.media.Bt=function(){this.adsResponse=this.adTagUrl=void 0};v("chrome.cast.media.VastAdsRequest",chrome.cast.media.Bt);chrome.cast.media.ds=function(){this.whenSkippable=this.breakClipId=this.breakId=this.currentBreakClipTime=this.currentBreakTime=void 0};v("chrome.cast.media.BreakStatus",chrome.cast.media.ds);chrome.cast.media.Ds=function(a,b,c,d){this.start=a;this.end=b;this.isMovingWindow=c;this.isLiveDone=d};v("chrome.cast.media.LiveSeekableRange",chrome.cast.media.Ds);
chrome.cast.media.Qs=function(a,b,c,d,e,f,g){this.id=a;this.queueType=this.entity=void 0;this.name=b;this.description=c;this.repeatMode=d;this.shuffle=!1;this.items=e;this.startIndex=f;this.startTime=g;this.containerMetadata=void 0};v("chrome.cast.media.QueueData",chrome.cast.media.Qs);chrome.cast.media.At=function(a){this.userAction=a;this.customData=void 0};v("chrome.cast.media.UserActionState",chrome.cast.media.At);chrome.cast.media.Ct=function(a,b,c){this.width=a;this.height=b;this.hdrType=c};
v("chrome.cast.media.VideoInformation",chrome.cast.media.Ct);chrome.cast.media.ma=function(a,b){this.sessionId=a;this.mediaSessionId=b;this.media=null;this.videoInfo=this.queueData=void 0;this.playbackRate=1;this.playerState=chrome.cast.media.cg.IDLE;this.currentTime=0;this.supportedMediaCommands=[];this.volume=new chrome.cast.Volume;this.items=this.preloadedItemId=this.loadingItemId=this.currentItemId=this.customData=this.activeTrackIds=this.idleReason=null;this.repeatMode=chrome.cast.media.Vj.OFF;this.liveSeekableRange=this.breakStatus=void 0};k=chrome.cast.media.ma.prototype;
k.Ha=function(){};k.play=function(){};k.ky=function(){};k.pause=function(){};k.jy=function(){};k.seek=function(){};k.stop=function(a){a||new chrome.cast.media.StopRequest};k.ic=function(){};k.Ck=function(){};k.az=function(){};k.Zy=function(){};k.kz=function(){};k.fz=function(){};k.ez=function(){};k.bz=function(a){co(this,a)};k.jz=function(){};k.hz=function(){};k.gz=function(a){co(this,a)};k.iz=function(){};
k.dz=function(a,b,c,d){a=co(this,a);0>a||(0>b?d&&d(new chrome.cast.Error(chrome.cast.pe.INVALID_PARAMETER)):a==b&&c&&c())};k.dA=function(a){return-1<this.supportedMediaCommands.indexOf(a)};k.Lu=function(){return this.currentTime};k.Ju=function(){if(this.breakStatus&&void 0!==this.breakStatus.currentBreakTime)return this.breakStatus.currentBreakTime};k.Iu=function(){if(this.breakStatus&&void 0!==this.breakStatus.currentBreakClipTime)return this.breakStatus.currentBreakClipTime};
k.Ku=function(){if(this.liveSeekableRange&&void 0!==this.liveSeekableRange.start&&void 0!==this.liveSeekableRange.end)return this.liveSeekableRange};k.fk=function(){};k.gk=function(){};k.bm=function(){};k.cm=function(){};var co=function(a,b){return Yb(a.items,function(c){return c.itemId==b})};v("chrome.cast.media.Media",chrome.cast.media.ma);chrome.cast.media.ma.prototype.removeUpdateListenerWithContext=chrome.cast.media.ma.prototype.cm;chrome.cast.media.ma.prototype.removeUpdateListener=chrome.cast.media.ma.prototype.bm;
chrome.cast.media.ma.prototype.addUpdateListenerWithContext=chrome.cast.media.ma.prototype.gk;chrome.cast.media.ma.prototype.addUpdateListener=chrome.cast.media.ma.prototype.fk;chrome.cast.media.ma.prototype.getEstimatedLiveSeekableRange=chrome.cast.media.ma.prototype.Ku;chrome.cast.media.ma.prototype.getEstimatedBreakClipTime=chrome.cast.media.ma.prototype.Iu;chrome.cast.media.ma.prototype.getEstimatedBreakTime=chrome.cast.media.ma.prototype.Ju;chrome.cast.media.ma.prototype.getEstimatedTime=chrome.cast.media.ma.prototype.Lu;
chrome.cast.media.ma.prototype.supportsCommand=chrome.cast.media.ma.prototype.dA;chrome.cast.media.ma.prototype.queueMoveItemToNewIndex=chrome.cast.media.ma.prototype.dz;chrome.cast.media.ma.prototype.queueReorderItems=chrome.cast.media.ma.prototype.iz;chrome.cast.media.ma.prototype.queueRemoveItem=chrome.cast.media.ma.prototype.gz;chrome.cast.media.ma.prototype.queueRemoveItems=chrome.cast.media.ma.prototype.hz;chrome.cast.media.ma.prototype.queueSetRepeatMode=chrome.cast.media.ma.prototype.jz;
chrome.cast.media.ma.prototype.queueJumpToItem=chrome.cast.media.ma.prototype.bz;chrome.cast.media.ma.prototype.queueNext=chrome.cast.media.ma.prototype.ez;chrome.cast.media.ma.prototype.queuePrev=chrome.cast.media.ma.prototype.fz;chrome.cast.media.ma.prototype.queueUpdateItems=chrome.cast.media.ma.prototype.kz;chrome.cast.media.ma.prototype.queueAppendItem=chrome.cast.media.ma.prototype.Zy;chrome.cast.media.ma.prototype.queueInsertItems=chrome.cast.media.ma.prototype.az;
chrome.cast.media.ma.prototype.editTracksInfo=chrome.cast.media.ma.prototype.Ck;chrome.cast.media.ma.prototype.setVolume=chrome.cast.media.ma.prototype.ic;chrome.cast.media.ma.prototype.stop=chrome.cast.media.ma.prototype.stop;chrome.cast.media.ma.prototype.seek=chrome.cast.media.ma.prototype.seek;chrome.cast.media.ma.prototype.pauseWithContext=chrome.cast.media.ma.prototype.jy;chrome.cast.media.ma.prototype.pause=chrome.cast.media.ma.prototype.pause;
chrome.cast.media.ma.prototype.playWithContext=chrome.cast.media.ma.prototype.ky;chrome.cast.media.ma.prototype.play=chrome.cast.media.ma.prototype.play;chrome.cast.media.ma.prototype.getStatus=chrome.cast.media.ma.prototype.Ha;var eo=function(a,b,c){this.sessionId=a;this.namespaceName=b;this.message=c};var fo=function(a,b){this.type="SET_VOLUME";this.requestId=0;this.volume=a;this.expectedVolume=b||null};chrome.cast.ua=function(a,b,c,d,e){this.sessionId=a;this.appId=b;this.displayName=c;this.statusText=null;this.appImages=d;this.receiver=e;this.senderApps=[];this.namespaces=[];this.media=[];this.status=chrome.cast.vn.CONNECTED;this.transportId=""};k=chrome.cast.ua.prototype;k.Rz=function(a,b,c){this.ur(null,a,b,c)};k.ur=function(a,b,c,d){b=new fo(new chrome.cast.Volume(b,null),this.receiver.volume);a.setReceiverVolume(this.sessionId,b,c,d)};k.Qz=function(a,b,c){this.tr(null,a,b,c)};
k.tr=function(a,b,c,d){a=new fo(new chrome.cast.Volume(null,b),this.receiver.volume);null.setReceiverVolume(this.sessionId,a,c,d)};k.leave=function(a,b){null.leaveSession(this.sessionId,a,b)};k.stop=function(){};k.cA=function(){};k.sendMessage=function(){};k.Bz=function(){};k.fk=function(){};k.gk=function(){};k.bm=function(){};k.cm=function(){};k.Nt=function(){};k.Ot=function(){};k.Lt=function(){};k.Mt=function(){};k.sz=function(){};k.uz=function(){};k.vz=function(){};k.wz=function(){};
k.lx=function(a){a.sessionId=this.sessionId};k.cz=function(a){a.sessionId=this.sessionId};v("chrome.cast.Session",chrome.cast.ua);chrome.cast.ua.prototype.queueLoad=chrome.cast.ua.prototype.cz;chrome.cast.ua.prototype.loadMedia=chrome.cast.ua.prototype.lx;chrome.cast.ua.prototype.removeMessageListenerWithContext=chrome.cast.ua.prototype.wz;chrome.cast.ua.prototype.removeMessageListener=chrome.cast.ua.prototype.vz;chrome.cast.ua.prototype.removeMediaListenerWithContext=chrome.cast.ua.prototype.uz;
chrome.cast.ua.prototype.removeMediaListener=chrome.cast.ua.prototype.sz;chrome.cast.ua.prototype.addMediaListenerWithContext=chrome.cast.ua.prototype.Mt;chrome.cast.ua.prototype.addMediaListener=chrome.cast.ua.prototype.Lt;chrome.cast.ua.prototype.addMessageListenerWithContext=chrome.cast.ua.prototype.Ot;chrome.cast.ua.prototype.addMessageListener=chrome.cast.ua.prototype.Nt;chrome.cast.ua.prototype.removeUpdateListenerWithContext=chrome.cast.ua.prototype.cm;
chrome.cast.ua.prototype.removeUpdateListener=chrome.cast.ua.prototype.bm;chrome.cast.ua.prototype.addUpdateListenerWithContext=chrome.cast.ua.prototype.gk;chrome.cast.ua.prototype.addUpdateListener=chrome.cast.ua.prototype.fk;chrome.cast.ua.prototype.sendMessageWithContext=chrome.cast.ua.prototype.Bz;chrome.cast.ua.prototype.sendMessage=chrome.cast.ua.prototype.sendMessage;chrome.cast.ua.prototype.stopWithContext=chrome.cast.ua.prototype.cA;chrome.cast.ua.prototype.stop=chrome.cast.ua.prototype.stop;
chrome.cast.ua.prototype.leave=chrome.cast.ua.prototype.leave;chrome.cast.ua.prototype.setReceiverMutedWithContext=chrome.cast.ua.prototype.tr;chrome.cast.ua.prototype.setReceiverMuted=chrome.cast.ua.prototype.Qz;chrome.cast.ua.prototype.setReceiverVolumeLevelWithContext=chrome.cast.ua.prototype.ur;chrome.cast.ua.prototype.setReceiverVolumeLevel=chrome.cast.ua.prototype.Rz;var io=function(a,b){if(!b.applications||1!=b.applications.length)return null;var c=b.applications[0];a=go(a);a=new chrome.cast.ua(c.sessionId,c.appId,c.displayName,c.appImages,a);a.senderApps=c.senderApps;a.namespaces=c.namespaces||[];a.transportId=c.transportId;a.statusText=c.statusText;if(!a.sessionId||!(a.namespaces&&0!=a.namespaces.length||ho(a)))return null;a.receiver.volume=b.volume;"boolean"===typeof b.isActiveInput&&(a.receiver.isActiveInput=b.isActiveInput);return a},jo=function(a){var b=
[];if(!a)return b;a&1&&b.push(chrome.cast.Ee.VIDEO_OUT);a&2&&b.push(chrome.cast.Ee.VIDEO_IN);a&4&&b.push(chrome.cast.Ee.AUDIO_OUT);a&8&&b.push(chrome.cast.Ee.AUDIO_IN);a&32&&b.push(chrome.cast.Ee.MULTIZONE_GROUP);return b},go=function(a){var b=Om(Nm(),a.getId());return new chrome.cast.qn(b,a.h.friendlyName,jo(a.g))},ko=function(a,b){if(a.statusText!=b.statusText)return!0;var c=a.namespaces||[],d=b.namespaces||[];if(c.length!=d.length)return!0;for(var e={Vg:0};e.Vg<c.length;e={Vg:e.Vg},e.Vg++)if(!d.some(function(f){return function(g){return g.name==
c[f.Vg].name}}(e)))return!0;return a.receiver.volume.level!==b.receiver.volume.level||a.receiver.volume.muted!==b.receiver.volume.muted?!0:!1},lo=function(a){Array.isArray(a)?a.forEach(lo):Ra(a)&&Object.keys(a).forEach(function(b){null===a[b]?delete a[b]:(Ra(a[b])||Array.isArray(a[b]))&&lo(a[b])})},mo=function(a){return a.namespaces.some(function(b){return b.name==jm})},ho=function(a){return null!==a&&"MultizoneLeader"==a.appId},no=function(a){return"E8C28D3C"==a||"00000000-0000-0000-0000-000000000000"==
a};var oo=function(a,b,c){this.type=a;this.message=b;this.sequenceNumber=void 0!==c?c:-1;this.timeoutMillis=0;this.clientId=""};var po=function(a,b){this.l=a;this.g=b;this.j=[];this.h=new zn},ro=function(a,b){return(a=qo(a.g,b))?a.routeId:null};po.prototype.listen=function(a,b){this.j[a]=b};var uo=function(a,b,c,d){mb(so,"Sending to "+c);mb(so,JSON.stringify(d));d.clientId=c;to(a.l.j,b,d)},vo=function(a,b,c){var d=qo(a.g,b);d&&d.g?uo(a,d.routeId,b,c):a.connect(b).then(function(e){e?(e=ro(a,b))?uo(a,e,b,c):so.L("No route for "+b):so.L("No connected client "+b)},null)};
po.prototype.connect=function(a){var b=qo(this.g,a);if(null!=b&&b.g)return Promise.resolve(!0);b=ro(this,a);if(!b)return so.L("No route for client "+a),Promise.resolve(!1);if(a=this.h.g.get(b,null))return a.Fb.promise;a=new Fb;An(this.h,new wo(b,a));return a.promise};var so=eb("mr.cast.ApiMessenger"),wo=function(a,b){yn.call(this,a,3E4);this.Fb=b};t(wo,yn);wo.prototype.g=function(){this.Fb.resolve(!1)};var xo=function(a,b,c){this.j=a;this.h=b;this.g=c},yo=function(a){var b="cast-dial:"+a.j,c=new URLSearchParams;a.h&&c.set("dialPostData",a.h);a.g&&c.set("clientId",a.g);(a=c.toString())&&(b+="?"+a);return b};var zo=function(a,b,c,d,e,f,g,h,m,q){this.C=a;this.g=b||null;this.h=c||null;this.j=d||null;this.l=void 0!==e?e:null;this.D=f||null;this.G=g||null;this.u=h||!1;this.s=m||null;this.m=q||null;this.H=["WEB"];this.F=null},Ao=function(a,b){return(a=a.match(b+"=([^/]*)"))?a[1]:null},Co=function(a){a=a.match(/__castAppId__=([^/]*)/g);return null==a?[]:Sb(Tb(a,function(b){b=Ao(b,"__castAppId__");if(!b)return null;b=b.match(Bo);if(!b||0==b.length)return null;var c=[];3==b.length&&b[2]&&(c=b[2].split(","));
return{appId:b[1],capabilities:c}}),function(b){return null!=b})},Do=function(a){return Tb(a.C,function(b){return b.appId})},Eo=function(a){var b={launchCheckerParams:{}};a.F&&(b.launchCheckerParams.credentialsData=a.F);return b},Fo=function(a){return a.h?a.h:chrome.cast.ke.TAB_AND_ORIGIN_SCOPED},Go=function(a){var b=a.C.map(function(c){var d="cast:"+c.appId,e=new URLSearchParams;c.capabilities&&0<c.capabilities.length&&e.set("capabilities",c.capabilities.join(","));a.g&&e.set("clientId",a.g);a.h&&
e.set("autoJoinPolicy",a.h);a.j&&e.set("defaultActionPolicy",a.j);null!=a.l&&e.set("launchTimeout",String(a.l));a.u&&e.set("invisibleSender","true");a.s&&(e.set("broadcastNamespace",a.s),e.set("broadcastId",String(Math.random())));a.m&&e.set("broadcastMessage",encodeURIComponent(JSON.stringify(a.m)));e.set("supportedAppTypes",a.H.join(","));e.set("appParams",JSON.stringify(Eo(a)));return d+"?"+e.toString()});a.D&&b.push(yo(new xo(a.D,a.G,a.g)));return b},Io=function(a,b){a=Do(a);var c=Ho(b);return Vb(a,
function(d){return $b(c,d)})},Jo=function(a){try{var b=new URL(a)}catch(r){return null}if("https:"==b.protocol)if("https:"!=b.protocol||"google.com"!=b.host||"/cast"!=b.pathname)a=null;else{var c=b.hash;if((a=Co(c))&&0!=a.length){b=Ao(c,"__castClientId__");var d=Ao(c,"__castAutoJoinPolicy__"),e=Ao(c,"__castDefaultActionPolicy__");var f=Ao(c,"__castLaunchTimeout__");null==f?f=null:(f=Number(f),f=!isNaN(f)&&0<f?f:null);var g=Ao(c,"__dialAppName__"),h=Ao(c,"__dialPostData__");var m=Ao(c,"__castInvisibleSender__");
m=null===m?null:"true"==m;var q=Ao(c,"__castBroadcastNamespace__");c=(c=Ao(c,"__castBroadcastMessage__"))?JSON.parse(decodeURIComponent(c)):null;a=new zo(a,b,d,e,f,g,h,m,q,c)}else a=null}else if("cast:"==b.protocol){a=b.pathname;d=b.searchParams.get("capabilities");a={appId:a,capabilities:d?d.split(","):[]};h=b.searchParams;b=h.get("clientId");d=h.get("autoJoinPolicy");e=h.get("defaultActionPolicy");c=Number(h.get("launchTimeout"));if(isNaN(c)||0>=c)c=null;f="true"==h.get("invisibleSender");g=h.get("broadcastNamespace");
h=(h=h.get("broadcastMessage"))?JSON.parse(decodeURIComponent(h)):null;a=new zo([a],b,d,e,c,void 0,void 0,f,g,h)}else a=null;return a},Ho=function(a){return(a=Jo(a))?Do(a):null},Ko=function(a){return(a=Jo(a))?a.g:null},Bo=/(^\w+)(?:\(([\w, ]*)\))?$/;var Lo={LG:0,nG:1},Mo={rO:0,at:1,ZJ:2},No={FI:0,TIMEOUT:1,FAILED:2},Oo={YF:0,yJ:1,SEEK:2,gI:3,kM:4,bB:5},Po=function(a){Ab("MediaRouter.Cast.Session.Ended",a,Mo)},Qo=function(a){Ab("MediaRouter.Cast.Controller.ActionType",a,Oo)},Ro=function(a){Ab("MediaRouter.Cast.Session.Fail",a,No)};var So=function(a,b,c){this.M=eb("mr.MediaRouteController."+a);this.l=new mojo.Binding(mojo.MediaController,this,b);this.h=c;this.g=new mojo.MediaStatus({title:"",description:"",duration:new mojo.TimeDelta({microseconds:0}),current_time:new mojo.TimeDelta({microseconds:0})});this.u=!1;this.l.setConnectionErrorHandler(this.Cp.bind(this));this.h.ptr.setConnectionErrorHandler(this.Cp.bind(this))};k=So.prototype;k.Cp=function(){this.dispose();this.Ap()};
k.dispose=function(){this.u||(this.u=!0,this.ba(),this.l&&(this.l.close(),this.l=null),this.h&&(this.h.ptr.reset(),this.h=null))};k.ba=function(){};k.Ap=function(){};k.play=function(){};k.pause=function(){};k.rm=function(){};k.ic=function(){};k.seek=function(){};k.mu=function(a){a.close();throw Error("Not implemented");};So.prototype.connectHangoutsMediaRouteController=So.prototype.mu;So.prototype.seek=So.prototype.seek;So.prototype.setVolume=So.prototype.ic;So.prototype.setMute=So.prototype.rm;
So.prototype.pause=So.prototype.pause;So.prototype.play=So.prototype.play;var To=function(a){var b=new URL(a);a={};a.scheme=b.protocol.replace(":","");a.host=b.hostname;b=b.port?Number.parseInt(b.port,10):0;switch(a.scheme){case "http":a.port=b||80;break;case "https":a.port=b||443;break;default:throw Error("Scheme must be http or https");}a.suborigin="";return new mojo.Origin(a)},Uo=function(a){return new mojo.TimeDelta({microseconds:Math.floor(1E6*a)})};var Vo=function(a,b,c,d){this.type=a;this.mediaSessionId=b;this.requestId=0;this.sessionId=c;this.currentTime=d},Xo=function(a,b,c,d,e){So.call(this,"CastRouteController",a,b);this.session=c;this.j=d;this.C=e;this.s=new Date;this.m=new Set;Wo(this);Qo(0)};t(Xo,So);
var Wo=function(a){var b=Yo(a);b&&Zo(a,b);b&&a.C||!a.session.statusText||(a.g.title=a.session.statusText.substring(0,256));a.g.volume=null===a.session.receiver.volume.level?0:a.session.receiver.volume.level;a.g.is_muted=!!a.session.receiver.volume.muted;a.g.can_mute=a.session.receiver.volume.controlType!==chrome.cast.zn.FIXED;a.g.can_set_volume=a.g.can_mute;if(a.h)a.h.onMediaStatusUpdated(a.g)};k=Xo.prototype;k.Ap=function(){$o(this.j.g,this.session.sessionId)};
k.play=function(){var a=Yo(this);this.g.can_play_pause&&a&&this.g.play_state===mojo.MediaStatus.PlayState.PAUSED&&ap(this.j,this.session,new Vo("PLAY",a.mediaSessionId,this.session.sessionId));bp(this,1)};k.pause=function(){var a=Yo(this);this.g.can_play_pause&&a&&this.g.play_state!==mojo.MediaStatus.PlayState.PAUSED&&ap(this.j,this.session,new Vo("PAUSE",a.mediaSessionId,this.session.sessionId));bp(this,1)};
k.seek=function(a){var b=Yo(this);a=a?a.microseconds/1E6:0;var c;if(c=this.g.can_seek&&b&&0<=a)c=this.g.duration,c=a<=(c?c.microseconds/1E6:0);c&&ap(this.j,this.session,new Vo("SEEK",b.mediaSessionId,this.session.sessionId,a));bp(this,2)};k.rm=function(a){this.g.can_mute&&a!==this.g.is_muted&&cp(this.j,this.session,new chrome.cast.Volume(null,a));bp(this,3)};k.ic=function(a){this.g.can_set_volume&&0<=a&&1>=a&&cp(this.j,this.session,new chrome.cast.Volume(a));bp(this,4)};
var Yo=function(a){return a.session.media.find(function(b){return!b.idleReason})||null},Zo=function(a,b){a.C&&b.media&&b.media.metadata&&b.media.metadata.title&&(a.g.title=b.media.metadata.title.substring(0,256));a.g.can_play_pause=b.supportedMediaCommands.includes(chrome.cast.media.mf.PAUSE);a.g.can_seek=b.supportedMediaCommands.includes(chrome.cast.media.mf.SEEK);var c=b.playerState;a.g.play_state=c===chrome.cast.media.cg.PLAYING?mojo.MediaStatus.PlayState.PLAYING:c===chrome.cast.media.cg.PAUSED?
mojo.MediaStatus.PlayState.PAUSED:mojo.MediaStatus.PlayState.BUFFERING;a.g.current_time=b.currentTime?Uo(b.playerState===chrome.cast.media.cg.PLAYING?b.currentTime+(new Date-a.s)/1E3:b.currentTime):Uo(0);a.g.duration=b.media&&b.media.duration?Uo(b.media.duration):Uo(0)},bp=function(a,b){0==a.m.size&&Qo(5);a.m.has(b)||(Qo(b),a.m.add(b))};Xo.prototype.setVolume=Xo.prototype.ic;Xo.prototype.setMute=Xo.prototype.rm;Xo.prototype.seek=Xo.prototype.seek;Xo.prototype.pause=Xo.prototype.pause;
Xo.prototype.play=Xo.prototype.play;var dp=function(a){this.h=a;this.o=eb("mr.cast.SessionLauncher")},ep=function(a,b,c){Ab("MediaRouter.Cast.Session.Type",0,Lo);return Mn(a.h,b,c).then(a.g.bind(a,c),function(d){d&&Nn==d?Ro(1):Ro(0);throw d;})};dp.prototype.g=function(a,b){mb(this.o,"Got launch result from "+a.getId());if("LAUNCH_ERROR"==b.type)throw Ro(2),Error(b.reason);a=io(a,b.status);this.o.info("Launched session: "+a.sessionId);return a};var fp=function(a){this.g=a;this.o=eb("mr.cast.ReceiverStatusQuerier")},gp=function(a,b){return(new yf(Ya(a.h,a,b),3500,5)).start().then(null,function(c){a.o.info("Failed to get receiver status from "+b.getId());throw c;})};fp.prototype.h=function(a){this.o.info("Query receiver status: "+a.getId());return this.g.sendRequest(new xn,a,hm)};var hp=function(a,b,c,d,e,f){this.j=a;this.m=b;this.C=c;this.g=d;this.s=e;this.l=f;this.h=new po(f,c);this.G=new fp(this.j);this.H=new dp(this.j)};hp.prototype.init=function(){this.C.init();this.h.listen("v2_message",this.D.bind(this));this.h.listen("app_message",this.u.bind(this));this.h.listen("leave_session",this.F.bind(this))};
var kp=function(a,b,c,d){ip(a.g,b).slice().forEach(function(e){e!=d&&jp(a,e,c)})},jp=function(a,b,c){c.clientId=b;vo(a.h,b,c)},lp=function(a,b,c,d){c={receiver:go(c),action:d};jp(a,b,new oo("receiver_action",c))};
hp.prototype.D=function(a){var b=a.message,c=b.sessionId;if(c){var d=mp(this.g,c);if(d)if(c=np(this.g,c))if(c=this.m.h(c))switch(b.type){case "STOP":op(this,a,c);break;case "LOAD":case "PAUSE":case "PLAY":case "SEEK":case "STOP_MEDIA":case "MEDIA_SET_VOLUME":case "MEDIA_GET_STATUS":case "EDIT_TRACKS_INFO":case "QUEUE_LOAD":case "QUEUE_INSERT":case "QUEUE_UPDATE":case "QUEUE_REMOVE":case "QUEUE_REORDER":case "PRECACHE":pp(this,a,c,d);break;case "SET_VOLUME":qp(this,a,c);break;default:rp.L("Unknown request")}else sp(this,
a,chrome.cast.pe.INVALID_PARAMETER,"No receiver");else sp(this,a,chrome.cast.pe.INVALID_PARAMETER,"No sink ID");else sp(this,a,chrome.cast.pe.INVALID_PARAMETER,"Unknown session ID")}else sp(this,a,chrome.cast.pe.INVALID_PARAMETER,"No session ID")};
var sp=function(a,b,c,d){c=new chrome.cast.Error(c,d);tp(a,b,c)},tp=function(a,b,c){vo(a.h,b.clientId,new oo("error",c,b.sequenceNumber))},op=function(a,b,c){var d=b.message;zb("MediaRouter.Cast.Session.End");var e=d.sessionId,f=up(a.g,e);f&&(f.C=!0);f=function(){pn(a,e,b)};a.j.sendRequest(d,c,hm,b.timeoutMillis,b.clientId).then(f,f)},pp=function(a,b,c,d){var e=b.message,f=e.type;f in wn&&(e.type=wn[f]);a.j.sendRequest(e,c,jm,b.timeoutMillis,b.clientId,d.transportId).then(function(g){vp(a,d,g);vo(a.h,
b.clientId,new oo("v2_message",g,b.sequenceNumber))},function(g){tp(a,b,g)})},qp=function(a,b,c){var d=b.message;delete d.sessionId;a.j.sendRequest(d,c,hm,b.timeoutMillis,b.clientId).then(function(){vo(a.h,b.clientId,new oo("v2_message",null,b.sequenceNumber))},function(e){tp(a,b,e)})};
hp.prototype.u=function(a){var b=this,c=a.message,d=c.sessionId;if(d){var e=np(this.g,d);e?(e=this.m.h(e))?(d=mp(this.g,d),Xb(d.namespaces,function(f){return f.name==c.namespaceName})?Kn(this.s,e,c.namespaceName,c.message,a.clientId,d.transportId).then(function(){vo(b.h,a.clientId,new oo("app_message",null,a.sequenceNumber))},function(){sp(b,a,chrome.cast.pe.CHANNEL_ERROR,"Channel to receiver not available")}):sp(this,a,chrome.cast.pe.INVALID_PARAMETER,"Invalid namespace")):rp.L("No receiver from sinkId"):
rp.L("No sinkId from sessionId")}else rp.L("No sessionId")};
hp.prototype.F=function(a){var b=this;rp.info("Leave session");var c=up(this.g,a.message);if(c){var d=a.clientId,e=qo(this.C,d);if(e){var f=[],g=[],h=e.tabId,m=e.origin,q=e.autoJoinPolicy;c.h.forEach(function(r){var z=qo(b.C,r);q==chrome.cast.ke.TAB_AND_ORIGIN_SCOPED&&h==z.tabId&&m==z.origin||q==chrome.cast.ke.ORIGIN_SCOPED&&m==z.origin?(z.h=!0,f.push(r)):g.push(r)});vo(this.h,d,new oo("leave_session",null,a.sequenceNumber));f.forEach(function(r){(r=qo(b.C,r))&&wp(b.l,r.routeId,!0,!0)});c.h=g}else rp.L("No client record")}else rp.L("No session")};
var xp=function(a,b,c){mo(b)&&a.j.sendRequest(new xn,c,jm,void 0,void 0,b.transportId).catch(Ma)},hn=function(a,b,c){var d=b.getId();rp.info("Query status for "+d);gp(a.G,b).then(function(e){yp(a,d,e);c&&(e=zp(a.g,d))&&xp(a,e,b)},Ma)},Ap=function(a,b){if("*"==b.destinationId)return!0;b=b.destinationId;if(b==a.s.s||null!=qo(a.C,b))return!0;rp.info("Invalid destination "+b);return!1},Gp=function(a,b,c){mb(rp,function(){return"Cast message: "+JSON.stringify(c)});if(Ap(a,c))if(c.namespace_==im||c.namespace_==
km)(b=on(a.g,b))&&b.g.forEach(function(f){var g=a.l,h=g.h.get(f);h&&h.og&&Bp(g.j.K,new Cp(f,c))});else{var d=JSON.parse(c.data),e=Dp(a,d);e=e?e.sourceId:void 0;switch(d.type){case "RECEIVER_STATUS":yp(a,b,d);break;case "MEDIA_STATUS":Ep(a,b,c,e)}}else Fp(a.s,b,c.destinationId,c.sourceId,!1)},Dp=function(a,b){a=Bn(a.j.g,b.requestId);if(!a)return null;var c=a.Fb;switch(b.type){case "LAUNCH_ERROR":case "INVALID_REQUEST":case "LOAD_CANCELLED":case "LOAD_FAILED":case "INVALID_PLAYER_STATE":delete b.requestId;
c.reject(new chrome.cast.Error(chrome.cast.pe.SESSION_ERROR,b.reason||b.type,b));break;default:c.resolve(b)}return a},Hp=function(a,b,c){mb(rp,function(){return"App message: "+JSON.stringify(c)});if(b=zp(a.g,b)){var d;"*"==c.destinationId?d=ip(a.g,b.sessionId):d=[c.destinationId];var e=new eo(b.sessionId,c.namespace_,c.data);d.forEach(function(f){vo(a.h,f,new oo("app_message",e))})}else rp.L("No session for incoming app message")},Ip=function(a,b){a.forEach(function(c){c.sessionId=b;var d=c.supportedMediaCommands,
e=[];d&1&&e.push(chrome.cast.media.mf.PAUSE);d&2&&e.push(chrome.cast.media.mf.SEEK);d&4&&e.push(chrome.cast.media.mf.STREAM_VOLUME);d&8&&e.push(chrome.cast.media.mf.STREAM_MUTE);c.supportedMediaCommands=e});return a},vp=function(a,b,c){b=b.sessionId;c.sessionId=b;c=Ip(c.status,b);Jp(a.g,b,c);if((a=up(a.g,b))&&a.controller&&(a=a.controller,a.s=new Date,(c=Yo(a))?Zo(a,c):(a.C&&(a.g.title=""),a.g.can_play_pause=!1,a.g.can_seek=!1),a.h))a.h.onMediaStatusUpdated(a.g)},Kp=function(a,b){if(b=zp(a.g,b)){b=
b.sessionId;var c=up(a.g,b);c&&c.C||pn(a,b)}},pn=function(a,b,c){c&&jp(a,c.clientId,c);(c=up(a.g,b))&&c.g.slice().forEach(function(d){wp(a.l,d,!0)});Lp(a.g,b);Mp(a.l)},yp=function(a,b,c){mb(rp,"Receiver status for "+b);var d=c.status;if(d)if(c=a.m.h(b)){d=io(c,d);var e=on(a.g,b);e?d?d.sessionId==e.session.sessionId?(b=e.session,ko(b,d)&&(mb(rp,"Updating session "+d.sessionId),e.j&&(b.statusText=d.statusText),b.namespaces=d.namespaces,b.receiver.volume=d.receiver.volume,Np(a.l,e),kp(a,b.sessionId,
new oo("update_session",b)),e.controller&&Wo(e.controller))):(Kp(a,b),Po(1),Op(a.l,null,c,null,d)):(Kp(a,b),Po(1)):d&&Op(a.l,null,c,null,d)}else zb("MediaRouter.Cast.Error.Sink.Missing.From.Discovery.Service"),rp.L("Got message from receiver "+b+", but sink is no longer available.")},Ep=function(a,b,c,d){if(b=zp(a.g,b))if(c=JSON.parse(c.data))vp(a,b,c),kp(a,c.sessionId,new oo("v2_message",c),d)},Pp=function(a,b){var c=jo(b.g);return(b=Xb(a.C,function(d){return Wb(d.capabilities,function(e){return $b(c,
e)})}))?b.appId:Do(a)[0]},Qp=function(a,b,c){var d=Jo(b);if(!d)return Promise.reject(Error("Invalid source "+b));var e=Pp(d,c);b=null==d.l?chrome.cast.timeout.requestSession:d.l;var f=new qb("MediaRouter.Cast.Session.Launch");return ep(a.H,new chrome.cast.un(e,void 0,b),c).then(function(g){rp.info("Launched session "+g.sessionId+" for appId "+e);f.end("Success");return g},function(g){rp.error("Failed to session for appId "+e);f.end("Failure");throw g;})};
hp.prototype.createMediaRouteController=function(a,b,c){a=Rp(this.g,a);if(!a)return Error("Session not found for the route");var d=a.session;if(a.controller)return Error("Controller already exists for the route");var e=Sp(this,d.sessionId);if(!e)return Error("Sink not found for the route");a.controller=new Xo(b,c,d,this,a.j);xp(this,d,e);return null};
var ap=function(a,b,c){var d=Sp(a,b.sessionId);d&&a.j.sendRequest(c,d,jm,0,"",b.transportId).catch(function(e){rp.L("Failed to send a media control request: "+e)})},cp=function(a,b,c){c=new fo(c);(b=Sp(a,b.sessionId))&&a.j.sendRequest(c,b,hm).catch(function(d){rp.L("Failed to send a volume control request: "+d)})},Sp=function(a,b){return(b=np(a.g,b))?a.m.h(b):null},rp=eb("mr.cast.ApiHandler");var Tp=function(a){return"0F5096E8"==a||"85CDB22F"==a};var Up=function(a,b,c,d,e){for(var f=[],g=4;g<arguments.length;++g)f[g-4]=arguments[g];var h=this;this.C=a;this.s=b;this.m=c;this.h=d;this.l=f;this.g=!1;this.j=function(m){for(var q=[],r=0;r<arguments.length;++r)q[r-0]=arguments[r];return h.qu.apply(h,p(q))}};k=Up.prototype;k.addListener=function(){this.g||(this.g=!0,this.h.addListener.apply(this.h,[this.j].concat(p(this.l))))};k.removeListener=function(){this.g&&(this.h.removeListener(this.j),this.g=!1)};
k.Mj=function(a){for(var b=0;b<arguments.length;++b);return!0};k.qu=function(a){for(var b=[],c=0;c<arguments.length;++c)b[c-0]=arguments[c];var d=this;Bj(this.C);if(!this.Mj.apply(this,p(b)))return!1;sj(this.m).then(function(e){return e.handleEvent.apply(e,[d.h].concat(p(b)))});return this.wk()};k.Ya=function(){return"mr.EventListener."+this.s};k.Ob=function(){return[this.g]};k.Nb=function(){sm(this)&&this.addListener()};k.wk=function(){};var Vp=null,Wp=null,Xp=function(){Vp||(Vp=new Up(2,"CastChannelMessageListener","mr.cast.ChannelService",chrome.cast.channel.onMessage));Wp||(Wp=new Up(1,"CastChannelErrorListener","mr.cast.ChannelService",chrome.cast.channel.onError));return[Vp,Wp]};var Yp=function(){},Zp=function(a){if(!a.startsWith("urn:x-org.chromium:media:route:"))return null;var b=a.substring(31);if(!b)return null;var c=b.match(/([^/]*)\/([^-/]*)-([^/]*)\/(.*)/);if(!c)return null;b=new Yp;b.h=a;a=n(c);a.next();b.g=a.next().value;b.l=a.next().value;b.C=a.next().value;b.j=a.next().value;return b};var $p=function(a,b,c,d,e){this.id=a;this.presentationId=b;this.sinkId=c;this.mediaSource=d;this.isLocal=e;this.description="";this.iconUrl=null;this.allowStop=!0;this.customControllerPath=null;this.supportsMediaRouteController=!1;this.controllerType=mojo&&mojo.RouteControllerType&&mojo.RouteControllerType.kNone;this.forDisplay=!0;this.offTheRecord=!1;this.og=e;this.isOffscreenPresentation=!1},aq=function(a,b,c,d,e){b=d&&Cj(d)?a:"urn:x-org.chromium:media:route:"+a+"/"+b+"-"+c+"/"+d;return new $p(b,
a,c,d,e)};var bq=function(a,b,c,d){c=aq(c,"cast",b.getId(),a,d);c.supportsMediaRouteController=!0;mojo&&mojo.RouteControllerType&&(c.controllerType=d&&Ej(a)&&b.g&1&&mojo.RouteControllerType.kMirroring?mojo.RouteControllerType.kMirroring:mojo.RouteControllerType.kGeneric);return c},cq=function(a,b){var c=b.yb.Oc;c&&(b.description=Qj(c),a.displayName="",a.statusText="mirror_desktop"==c.h?"":c.j||"")};var dq=function(a,b,c,d){return{namespace_:a,data:"string"===typeof b?b:JSON.stringify(b),sourceId:c,destinationId:d}};var eq=function(a){this.type="CLOSE";this.reasonCode=a};var fq=function(a){return(a=a.exec(fe))?a[1]:""},gq=function(){if(pf)return fq(/Firefox\/([0-9.]+)/);if(Pe||Qe||Oe)return jf;if(tf)return He()?fq(/CriOS\/([0-9.]+)/):fq(/Chrome\/([0-9.]+)/);if(uf&&!He())return fq(/Version\/([0-9.]+)/);if(qf||rf){var a=/Version\/(\S+).*Mobile\/(\S+)/.exec(fe);if(a)return a[1]+"."+a[2]}else if(sf)return(a=fq(/Android\s+([0-9.]+)/))?a:fq(/Version\/([0-9.]+)/);return""}(),hq=function(a){return 0<=Fd(gq,a)};var jq=function(a){this.type="CONNECT";this.origin={};this.userAgent=fe;var b=this.userAgent.indexOf("(")+1;b=this.userAgent.substr(b,this.userAgent.indexOf(")",b)-1-b+1);this.senderInfo={sdkType:2,version:chrome.runtime.getManifest().version,browserVersion:gq,platform:iq(),systemVersion:b,connectionType:1};this.connType=a?0:2},iq=function(){switch(aj()){case "ChromeOS":return 5;case "Windows":return 3;case "Mac":return 4;case "Linux":return 6}return 0};var kq=function(a){if(!chrome.runtime.lastError)return null;var b="chrome.cast.channel.send failed, chrome.runtime.lastError: "+(chrome.runtime.lastError.message||"Unknown error");a&&mb(a,b);return Error(b)};var lq=function(){this.g=new Zm};lq.prototype.init=function(){vm(this)};var mq=function(a,b,c,d,e){if(!bn(a.g,[b.channelId,c,d].join("#"))){var f=dq(gm,new jq(e),c,d);chrome.cast.channel.send(b,f,a.h.bind(a));a.g.set([b.channelId,c,d].join("#"),e)}};lq.prototype.h=function(){kq(nq)};
var ln=function(a,b){a.g.Ub().forEach(function(c){c.split("#")[0]==b.channelId.toString()&&a.g.remove(c)})},gn=function(a,b,c){a.g.forEach(function(d,e){var f=e.split("#");f[0]==b.channelId.toString()&&(mq(a,c,f[1],f[2],d),a.g.remove(e))})};lq.prototype.Ya=function(){return"cast.VirtualConnectionManager"};lq.prototype.Ob=function(){var a=dn(this.g);return[new oq(a)]};lq.prototype.Nb=function(){var a=sm(this);if(a)for(var b in a.g)this.g.set(b,a.g[b])};Na(lq);
var nq=eb("mr.cast.VirtualConnectionManager"),oq=function(a){this.g=a};var pq=function(a,b){this.C=b;this.s=a;this.h=new Zm;this.g=new Zm;this.j=lq.Tb();this.m=null;this.l=new Zm};t(pq,oj);pq.prototype.handleEvent=function(a,b){for(var c=[],d=1;d<arguments.length;++d)c[d-1]=arguments[d];a==chrome.cast.channel.onMessage?this.F.apply(this,p(c)):a==chrome.cast.channel.onError&&this.u.apply(this,p(c))};pq.prototype.init=function(){this.j.init();vm(this);yj("mr.cast.ChannelService",this);Xp().forEach(function(a){return a.addListener()})};
var Kn=function(a,b,c,d,e,f){e=e||a.s;f=f||"receiver-0";var g=sn(a,b);return g?qq(a,g,c,d,e,f):Promise.reject("Channel not found for "+b.getId())},Fp=function(a,b,c,d,e){if(b=a.h.get(b))a=a.j,bn(a.g,[b.channelId,c,d].join("#"))&&(a.g.remove([b.channelId,c,d].join("#")),c=dq(gm,new eq(e?5:0),c,d),chrome.cast.channel.send(b,c,a.h.bind(a)))};
pq.prototype.F=function(a,b){var c=this.g.get(a.channelId);if(c){var d=this.m(c);if(d){if(mm.hasOwnProperty(b.namespace_)){var e=JSON.parse(b.data);switch(e.type){case "CLOSE":this.j.g.remove([a.channelId,b.destinationId,b.sourceId].join("#"));return;case "RPC":break;default:mb(fn,function(){return"Got message "+(e.type||e.responseType)+" from "+d.getId()})}}else mb(fn,"Got message in "+b.namespace_+" from "+d.getId());rq(this.C,d,b)}else fn.L("Got message for unknown receiver (receiverId="+c+").")}else fn.L("Got message for unknown channel (channelId="+
a.channelId+").")};var sq=function(a,b){var c=a.g.get(b.channelId);c&&(a.g.remove(b.channelId),a.h.remove(c))};pq.prototype.u=function(a,b){fn.L(function(){return"Channel error: "+JSON.stringify(a)+(b?", "+JSON.stringify(b):"")});sq(this,a)};
var sn=function(a,b){b=b.getId();(a=a.h.get(b))||fn.info("Channel not found for receiver: "+b);return a},qq=function(a,b,c,d,e,f){mq(a.j,b,e,f,0==f.indexOf("receiver-0"));lo(d);var g=dq(c,d,e,f);"object"===typeof d&&"RPC"==d.type||mb(fn,function(){return"Channel is sending message: "+JSON.stringify(g)});return new Promise(function(h,m){chrome.cast.channel.send(b,g,function(q){q?q.errorState?(m(Error("Failed to send message")),sq(a,q)):h(!0):(q=kq(fn||void 0),m(q))})})};pq.prototype.Ya=function(){return"cast.ChannelService"};
pq.prototype.Ob=function(){return[new tq(dn(this.h),dn(this.g),dn(this.l))]};pq.prototype.Nb=function(){var a=sm(this);a&&(Ym(this.h,a.h),Ym(this.g,a.g),Ym(this.l,a.j))};var fn=eb("mr.cast.ChannelService"),tq=function(a,b,c){this.h=a;this.g=b;this.j=c};var uq=function(a,b,c,d,e,f){this.routeId=a;this.clientId=b;this.appIds=c;this.autoJoinPolicy=d;this.origin=e;this.tabId=f;this.h=this.g=!1},vq=function(){this.g=[]};vq.prototype.init=function(){vm(this)};vq.prototype.wa=function(){return this.g.length};var qo=function(a,b){return Xb(a.g,function(c){return c.clientId==b})},wq=function(a,b){return Xb(a.g,function(c){return c.routeId==b})},xq=function(a,b){a.g=Sb(a.g,function(c){return c.clientId!=b})};vq.prototype.Ya=function(){return"cast.ClientRecords"};
vq.prototype.Ob=function(){return[new yq(this.g)]};vq.prototype.Nb=function(){var a=sm(this);a&&(this.g=a.g)};var yq=function(a){this.g=a};var zq=function(){this.requestId=0;this.type="GET_APP_AVAILABILITY";this.appId=[]};var Aq=function(a,b){this.l=a;this.h=b;this.j=new Vn;this.g=new Zm};Aq.prototype.init=function(){vm(this)};var Bq=function(a,b){var c=a.g.get(b);c&&(c.Zl--,0<c.Zl||(Vm(a.h.g.Zb(!1),function(d){switch(Rm(d,b)){case "available":d.j[b]="available_rescan";break;case "unavailable":d.j[b]="unavailable_rescan"}}),a.g.remove(b)))};k=Aq.prototype;
k.zq=function(a){var b=this;Vm(this.g.Zb(!0),function(c){a:{switch(Rm(a,c)){case "unknown":case "available_rescan":case "unavailable_rescan":var d=!0;break a}d=!1}if(d){var e=a.getId()+":"+c;b.j.contains(e)||(b.j.add(e),d=function(){b.j.remove(e)},(new yf(b.hu.bind(b,a,c),5500,3)).start().then(b.Hr.bind(b,a,c),function(){b.o.error("Failed to get app availability response for "+a.getId()+", appId "+c+" after 3 attempts.");b.Hr(a,c,"unknown")}).then(d,d))}})};
k.Hr=function(a,b,c){c!=Rm(a,b)&&(this.o.info(b+" on "+a.getId()+" is "+c),a.j[b]=c,jn(this.h.l,a))};
k.hu=function(a,b){var c=this,d=new zq;d.appId=[b];var e=new qb("MediaRouter.Cast.App.Availability");return this.l.sendRequest(d,a,hm,5E3).then(function(f){e.end("Success");mb(c.o,function(){return"App availability response "+JSON.stringify(f)});for(var g in f.availability){if("APP_AVAILABLE"==f.availability[g])return"available";if("APP_UNAVAILABLE"==f.availability[g])return"unavailable"}return"unknown"},function(f){e.end("Failure");c.o.error("checkAppAvailability_ failed for "+a.getId()+", appId "+
b);throw f;})};k.Ya=function(){return"cast.AppDiscoveryService"};k.Ob=function(){return[new Cq(dn(this.g))]};k.Nb=function(){var a=sm(this);a&&Ym(this.g,a.g)};k.o=eb("mr.cast.AppDiscoveryService");var Cq=function(a){this.g=a};var Dq=chrome.i18n.getMessage("4528089202128275824");chrome.i18n.getMessage("2810417817914017289");chrome.i18n.getMessage("3413021810593924462");chrome.i18n.getMessage("7603034707785674700");chrome.i18n.getMessage("8009014317872238527");chrome.i18n.getMessage("8636962961150071298");chrome.i18n.getMessage("1802762746589457177");var Eq=function(a,b){this.h=[];this.g=[];this.sinkId=a;this.session=b;this.m=this.l=null;this.offTheRecord=this.C=!1;this.controller=null;this.j=!0},Fq=function(){this.o=eb("mr.cast.SessionRecords");this.g=[]};Fq.prototype.init=function(){vm(this)};
var Lp=function(a,b){a.o.info("Removing session "+b);$o(a,b);a.g=Sb(a.g,function(c){return c.session.sessionId!=b})},ip=function(a,b){return(a=up(a,b))?a.h:[]},zp=function(a,b){return(a=on(a,b))?a.session:null},Gq=function(a,b){return Xb(a.g,function(c){return $b(c.h,b)})},Rp=function(a,b){return Xb(a.g,function(c){return $b(c.g,b)})},Hq=function(a,b){return Xb(a.g,function(c){return null!=Xb(c.g,function(d){return Zp(d).g==b})})},on=function(a,b){return Xb(a.g,function(c){return c.sinkId==b||c.l==
b})},up=function(a,b){return Xb(a.g,function(c){return c.session.sessionId==b})},np=function(a,b){return(a=up(a,b))?a.sinkId:null},mp=function(a,b){return(a=up(a,b))?a.session:null},Jp=function(a,b,c){var d=mp(a,b);d&&(a=Sb(c,function(e){return e.playerState!=chrome.cast.media.cg.IDLE}),a.forEach(function(e){if(!e.media){var f=Xb(d.media,function(g){return g.mediaSessionId==e.mediaSessionId});f&&(e.media=f.media)}}),d.media=a)};Fq.prototype.Ya=function(){return"cast.SessionRecords"};
Fq.prototype.Ob=function(){return[new Iq(this.g)]};Fq.prototype.Nb=function(){var a=sm(this);if(a)for(var b=0;b<a.g.length;b++){var c=a.g[b],d=new Eq(c.sinkId,c.session);d.h=c.h;d.g=c.g;d.C=c.C;d.m=c.m;d.l=c.l;d.j=c.j;this.g.push(d)}};
var $o=function(a,b){(a=up(a,b))&&a.controller&&(a.controller.dispose(),a.controller=null)},Iq=function(a){var b=[];a=n(a);for(var c=a.next();!c.done;c=a.next()){c=c.value;var d=new Eq(c.sinkId,c.session);d.h=c.h;d.g=c.g;d.C=c.C;d.m=c.m;d.l=c.l;d.offTheRecord=c.offTheRecord;d.j=c.j;b.push(d)}this.g=b};var Jq=function(a,b,c){var d=Error.call(this);this.message=d.message;"stack"in d&&(this.stack=d.stack);this.name="RouteRequestError";this.message=b||"";if(c)this.stack=c;else if(Error.captureStackTrace)Error.captureStackTrace(this,Jq);else if(b=Error().stack)this.stack=b;this.errorCode=a};t(Jq,Error);var Kq=function(a,b){this.sinks=a;this.origins=b||null},Lq=new Kq([]);var Mq=function(a){this.D="sender-"+Ee();this.h=new Zm;this.u=null;vm(this);this.j=a;this.s=new vq;this.l=new Fq;this.F=new pq(this.D,this);this.g=new en(this.F,this);this.G=new Hn(this.F,this.D);this.m=null;this.C=new hp(this.G,this.g,this.s,this.l,this.F,this);this.H=new Zn(this.g,this.G)};k=Mq.prototype;k.getName=function(){return"cast"};
k.rp=function(a){a=a&&"boolean"===typeof a.enable_cast_sink_query?a.enable_cast_sink_query:!0;this.o.info("Query enabled: "+a);this.G.init();this.l.init();this.C.init();this.F.init();this.g.init();a&&(this.m=new Aq(this.G,this.g),this.m.init())};k.Vi=function(){return this.h.Ja()};
k.ro=function(a){var b=this;if(null!=Nq(a))return new Kq([]);var c=new Vn;Oq(a).forEach(function(d){un(b.g,d).map(function(e){return e.h}).forEach(function(e){c.add(e)})});return new Kq(c.Ja(),-1!=a.indexOf("0F5096E8")?Dj:null)};
k.startObservingMediaSinks=function(a){var b=this,c=Nq(a);c?(this.o.info("Received broadcast request "+a),Vm(this.g.g.Zb(!1),function(d){b.G.sendMessage(c,d,lm).catch(function(e){b.o.error("Broadcast failed "+e.message)})})):this.m&&Oq(a).forEach(function(d){var e=b.m,f=e.g.get(d);f?f.Zl++:e.g.set(d,{Zl:1});e.o.info("Scanning sinks for app availability");Vm(e.h.g.Zb(!1),e.zq,e)})};k.stopObservingMediaSinks=function(a){var b=this;null!=Nq(a)||this.m&&Oq(a).forEach(function(c){Bq(b.m,c)})};
k.startObservingMediaRoutes=function(){};k.stopObservingMediaRoutes=function(){};k.qp=function(a){return(a=this.g.h(a))?a.h:null};
var Pq=function(a,b,c){a.o.error("Error launching.",c);wp(a,b.id,!1,!0,"error");c=new Ni(Dq,"warning");Qi(c,b.id);Ri(c,b.sinkId);a.j.g.onIssue(c)},Uq=function(a,b,c,d,e,f,g,h){Nm().h=new Km(c.l,c.hd());var m=bq(b,c,d,!0);m.forDisplay=!1;m.offTheRecord=e;a.h.set(m.id,m);Qq(a.j,a,m);Mp(a);(e=Jo(b))&&e.g&&Rq(a,e,m.id,g,h);return new Promise(function(q,r){Ej(b)||Fj(b)||Cj(b)?(m.yb={tabId:h,sessionId:"",gi:c.hd()||"",We:c.l||"",Vz:c.h.friendlyName||""},Cj(b)&&(m.isOffscreenPresentation=!0),Sq(a.j,a,m,
d,function(z){return Wi(Tq(a,b,c,d,f,g,h,z))}).promise.then(function(){var z=Rp(a.l,m.id);z.j=!1;cq(z.session,m);z.controller&&(z.controller.C=!1,Wo(z.controller));q(m)},function(z){Pq(a,m,z);r(z)})):Tq(a,b,c,d,f,g,h,m).then(function(){q(m)},function(z){Pq(a,m,z);r(z)})})},Tq=function(a,b,c,d,e,f,g,h){return Qp(a.C,Vq(b,c,e),c).then(function(m){Op(a,b,c,d,m,f,g,h);return h})};
Mq.prototype.createRoute=function(a,b,c,d,e,f,g){var h=this,m=this.g.h(b);if(!m)return Vi(Error("No sink with ID "+b));var q=Ko(a);if(q){setTimeout(function(){lp(h.C,q,m,chrome.cast.Uj.CAST)},0);var r=function(){return Uq(h,a,m,c,d,e,f,g)},z=qo(this.s,q);if(z)return Wi(this.terminateRoute(z.routeId).then(r,r));if(f&&g&&(b=Wq(this,a,f,g,d,e,b)))return b}return Wi(Uq(this,a,m,c,d,e,f,g))};
var wp=function(a,b,c,d,e){d=void 0===d?!1:d;e=void 0===e?"closed":e;a.o.info("Remove route "+b);var f=wq(a.s,b);if(f){c=c||f.h;var g=f.clientId;a.o.info("Remove client "+g);for(var h=a.l,m=0;m<h.g.length;m++)fc(h.g[m].h,g);xq(a.s,g)}if(g=Rp(a.l,b))fc(g.g,b),Xq(a,g.g);if(h=a.h.get(b))if(h.og&&g&&(Fp(a.F,h.sinkId,f?f.clientId:a.D,g.session.transportId,c),h.forDisplay&&f&&(a.u={mg:f,Iq:g})),a.h.remove(b),Yq(a.j,h),Mp(a),d)a.j.onPresentationConnectionClosed(b,e,"Remove route");else a.j.onPresentationConnectionStateChanged(b,
"terminated")},Np=function(a,b){b.g.forEach(function(c){if(c=a.h.get(c)){var d=b.session;if(c.forDisplay){var e=Tp(d.appId);e&&!c.isLocal?(c.description=d.statusText||"",d.displayName="",d.statusText=""):e||(c.description=d.statusText||d.displayName);b.controller&&Wo(b.controller)}Zq(a.j)}})},$q=function(a,b){Vb(b,function(c){c=a.h.get(c,null);if(!c||!c.mediaSource)return!1;var d=Jo(c.mediaSource);d=d?d.u:!1;return c.isLocal&&!d})&&Qb(b,function(c){if(c=a.h.get(c,null))c.isLocal=!0})},Xq=function(a,
b){var c=[],d=[],e=null;b.forEach(function(f){if(f=a.h.get(f)){f.forDisplay=!1;var g=Jo(f.mediaSource);g&&Xb(Do(g),no)||(f.og?(g=g?Fo(g):null,e||g==chrome.cast.ke.CUSTOM_CONTROLLER_SCOPED||(c.push(f),e=f.sinkId)):e&&e!=f.sinkId?c.push(f):d.push(f))}});Qb(0<c.length?c:d,function(f){f.forDisplay=!0})},Rq=function(a,b,c,d,e){var f=b.g;if(f&&!qo(a.s,f)){a.o.info("Add client "+f);var g=Do(b);a.s.g.push(new uq(c,f,g,Fo(b),d||null,void 0!==e?e:null))}},Op=function(a,b,c,d,e,f,g,h){var m=on(a.l,c.getId());
if(!m){var q=a.l;m=c.getId();q.o.info("Adding new session: "+m+", "+e.sessionId);var r=up(q,e.sessionId);r?(ho(e)?(r.m=e,r.l=m):ho(r.session)&&(r.m=r.session,r.l=r.sinkId,r.session=e,r.sinkId=m),m=r):(m=new Eq(m,e),q.g.push(m))}h&&h.isLocal&&h.yb&&(m.j=!1);var z=null!=b;if(!z&&no(e.appId))return null;null==b?(r=new zo([{appId:e.appId,capabilities:e.capabilities}]),b=Go(r)[0]):r=Jo(b);if(q=h){if(!a.h.get(q.id))return a.o.L("Route "+q.id+" not added"),q}else q=bq(b,c,d||e.sessionId,z),a.h.set(q.id,
q);d=q.id;a.o.info("Add route "+d);b=null;r&&(b=r.g,Rq(a,r,d,f,g));$b(m.g,d)||m.g.push(d);q.og&&(f=a.F,g=b||a.D,d=e.transportId,r=!(r&&r.u),(z=sn(f,c))&&mq(f.j,z,g,d,r));m.offTheRecord=q.offTheRecord;f=m.g;$q(a,f);Xq(a,f);f=q;g=e.sessionId;Tp(e.appId)?f.isLocal&&g&&f.yb?f.yb.sessionId=g:(f.description=e.statusText||"",e.displayName="",e.statusText=""):f.description=e.statusText||e.displayName;h?Zq(a.j):Qq(a.j,a,q);Mp(a);if(h=b)$b(m.h,b)?h=!1:(m.h.push(b),h=!0);h&&(a=a.C,vo(a.h,b,new oo("new_session",
e)),xp(a,e,c));return q};
Mq.prototype.terminateRoute=function(a){var b=this,c=this.h.get(a);if(!c)return Promise.reject(new Jq(3,"Route in Cast provider not found for routeId  "+a));var d=Rp(this.l,a);if(!d)return wp(this,a,!0),Promise.resolve();var e=d.session.sessionId,f=this.g.h(c.sinkId);if(!f)return pn(this.C,e),Promise.resolve();(a=wq(this.s,a))&&lp(this.C,a.clientId,f,chrome.cast.Uj.STOP);Po(0);return new Promise(function(g){var h=function(){Kp(b.C,f.getId());g()};b.G.sendRequest(new En(e),f,hm).then(h,h)})};
var ar=function(a,b){var c=null;Wm(a.h.Zb(!1),function(f){if(!f.og)return!1;var g=a.g.h(f.sinkId);if(!g||!Io(b,Vq(f.mediaSource,g)))return!1;c=f;return!0});if(!c||!c.mediaSource)return null;var d=Ko(c.mediaSource);if(!d)return null;var e=qo(a.s,d);return e?(d=Gq(a.l,d))?{mg:e,Iq:d}:null:null},Wq=function(a,b,c,d,e,f,g){var h=null;Wm(a.h.Zb(!1),function(q){var r=q.yb;return r&&null!=r.tabId&&r.tabId==d&&Ej(q.mediaSource)?(h=q,!0):!1});if(!h)return null;var m=function(){return a.createRoute(b,g||h.sinkId,
"",e,f,c,null==d?void 0:d)};return Wi(a.terminateRoute(h.id).then(m,m))};k=Mq.prototype;k.connectRouteByRouteId=function(a,b,c,d,e){if(!Jo(a))return Vi(Error("Unsupported presentation URL"));if(!b)return Vi(Error("No routeId"));b=Zp(b);b=up(this.l,b.g);if(!b)return Vi(Error("No matching route"));var f=this.g.h(b.sinkId);return f?(a=Op(this,a,f,c,b.session,d,e))?Ui(a):Vi(Error("Failed to create route")):Vi(Error("No sink"))};
k.joinRoute=function(a,b,c,d,e,f){var g=Jo(a);if(!g)return Vi(Error("Unsupported presentation URL"));if(b==chrome.cast.Tm){a:{var h=ar(this,g);if(!h){if(!this.u||this.u.mg.origin!=e||this.u.mg.tabId!=f){h=null;break a}h=this.u}switch(Fo(g)){case chrome.cast.ke.PAGE_SCOPED:h=null;break a;case chrome.cast.ke.ORIGIN_SCOPED:if(e!=h.mg.origin){h=null;break a}break;case chrome.cast.ke.TAB_AND_ORIGIN_SCOPED:if(e!=h.mg.origin||f!=h.mg.tabId){h=null;break a}}h=up(this.l,h.Iq.session.sessionId)}if(!h&&(g.j?
g.j:chrome.cast.oi.CREATE_SESSION)!=chrome.cast.oi.CAST_THIS_TAB&&(d=Wq(this,a,e,f,c,d)))return d}else h=br(this,b);if(!h)return Vi(Error("No matching route"));if(h.offTheRecord!=c)return Vi(Error("Off the record mismatch"));d=this.g.h(h.sinkId);if(!d)return Vi(Error("No sink"));a=Op(this,a,d,b,h.session,e,f);a.offTheRecord=c;return Ui(a)};k.detachRoute=function(a){wp(this,a,!1,!0)};
k.Jk=function(a){var b=this.g.h(a);if(!b)throw Error("Cannot mirror with no sink.");var c=new Xj;b=b.g;b&1||(c.shouldCaptureVideo=!1);b&4||(c.shouldCaptureAudio=!1);c.shouldCaptureAudio&&!c.shouldCaptureVideo&&(c.minLatencyMillis=c.maxLatencyMillis,c.animatedLatencyMillis=c.maxLatencyMillis);c.senderSideLetterboxing=!0;Yj(c);Object.freeze(c);this.o.info(function(){return"Settings for "+a+": "+Wj(c)});if(!c.shouldCaptureAudio&&!c.shouldCaptureVideo)throw Error("Cannot start mirroring without video or audio capture");
return c};k.Ik=function(){return"cast_streaming"};k.Bp=function(a){var b=this.h.get(a);b&&b.yb&&b.yb.Oc&&(a=Rp(this.l,a))&&(cq(a.session,b),a.controller&&Wo(a.controller))};
k.sendRouteMessage=function(a,b,c){var d=this;if(!c)return new Promise(function(h,m){"string"!==typeof b&&m(Error("Cannot send non-string messages via ApiHandler."));m=d.C.h;mb(so,"Received: "+b);var q=JSON.parse(b),r=q.clientId;"client_connect"==q.type?(mb(so,"App "+r),(q=qo(m.g,r))?(q.g=!0,(m=Bn(m.h,q.routeId))&&m.Fb.resolve(!0)):so.L("Client not found "+r)):ro(m,r)?(m=m.j[q.type])&&m(q):so.L("No route for "+r);h()});var e=Rp(this.l,a);if(!e)return Promise.reject(Error("Not managing the route "+
a));var f=this.g.h(e.sinkId);if(!f)return Promise.reject(Error("Sink no longer accessible"));var g=(a=wq(this.s,a))?a.clientId:this.D;return new Promise(function(h){Kn(d.F,f,c.namespace,b,g,e.session.transportId).then(h,h)})};k.sendRouteBinaryMessage=function(a){return Promise.reject(Error("Route "+a+" does not support sending binary data."))};k.Rn=function(a,b){var c=this.g.h(b);if(!c)return!1;if(!this.m)return!0;a=Vq(a,c);return(a=Ho(a))&&0!=a.length?Vb(a,function(d){return nm(Rm(c,d))}):!1};
k.sk=function(a,b,c){var d=Oq(a);return d&&0!=d.length?b==chrome.cast.Tm?!0:c&&c.mediaSource?(a=Ho(c.mediaSource),Vb(a,function(e){return $b(d,e)})):void 0==b||br(this,b)?!0:!1:!1};
var Vq=function(a,b,c){return Jo(a)?a:Ej(a)||Fj(a)||Cj(a)?(a={appId:0==(b.g&1)?"85CDB22F":"0F5096E8",capabilities:jo(b.g)},Go(new zo([a],void 0,void 0,void 0,c))[0]):a},Oq=function(a){var b=[],c=Jo(a);if(c)b=Do(c);else if(Ej(a)||Fj(a)||Cj(a))Fj(a)||b.push("85CDB22F"),b.push("0F5096E8");return b},Nq=function(a){var b=Jo(a);if(!b)return null;a=Oq(a);var c=b.s||"";b=b.m;return c&&b?new Cn(a,c,JSON.stringify(b)):null},br=function(a,b){return 0==b.indexOf(chrome.cast.nn)?up(a.l,b.substr(chrome.cast.nn.length)):
Hq(a.l,b)},rq=function(a,b,c){var d=a.H;if($n(d)&&mm.hasOwnProperty(c.namespace_)){var e=b.hd();if(e){var f=JSON.parse(c.data);if("RECEIVER_STATUS"===f.type){var g=f.status&&f.status.applications&&f.status.applications[0],h=f=null;g&&(g.appId&&(f=g.appId),g.sessionId&&(h=g.sessionId));g=d.h.get(e);d.h.set(e,new dm(e,f,h));g&&g.appId===f||ao(d)}}}a=a.C;b=b.getId();mm.hasOwnProperty(c.namespace_)?Gp(a,b,c):Hp(a,b,c)},jn=function(a,b){a.m&&a.m.zq(b);qn(a.H);rn(a.j)};k=Mq.prototype;k.Ya=function(){return"cast.Provider"};
k.Ob=function(){return[new cr(this.D,dn(this.h),this.u)]};k.Nb=function(){var a=sm(this);a&&(this.D=a.senderId,Ym(this.h,a.h),this.u=a.g)};k.searchSinks=function(){return bb()};k.createMediaRouteController=function(a,b,c){return(a=this.C.createMediaRouteController(a,b,c))?Promise.reject(a):Promise.resolve()};k.provideSinks=function(a){nn(this.g,a)};var Mp=function(a){var b=a.Vi().some(function(c){return c.isLocal});dr(a.j,a.Ya(),b)};Mq.prototype.o=eb("mr.CastProvider");
var cr=function(a,b,c){this.senderId=a;this.h=b;this.g=c};var er=/^(?:([^:/?#.]+):)?(?:\/\/(?:([^\\/?#]*)@)?([^\\/?#]*?)(?::([0-9]+))?(?=[\\/?#]|$))?([^?#]+)?(?:\?([^#]*))?(?:#([\s\S]*))?$/,gr=function(a,b){if(a){a=a.split("&");for(var c=0;c<a.length;c++){var d=a[c].indexOf("="),e=null;if(0<=d){var f=a[c].substring(0,d);e=a[c].substring(d+1)}else f=a[c];b(f,e?decodeURIComponent(e.replace(/\+/g," ")):"")}}},hr=function(a,b){if(!b)return a;var c=a.indexOf("#");0>c&&(c=a.length);var d=a.indexOf("?");if(0>d||d>c){d=c;var e=""}else e=a.substring(d+1,c);a=[a.substr(0,
d),e,a.substr(c)];c=a[1];a[1]=b?c?c+"&"+b:b:c;return a[0]+(a[1]?"?"+a[1]:"")+a[2]},ir=function(a,b,c){if(Array.isArray(b))for(var d=0;d<b.length;d++)ir(a,String(b[d]),c);else null!=b&&c.push(a+(""===b?"":"="+encodeURIComponent(String(b))))},jr=function(a,b){var c=[];for(b=b||0;b<a.length;b+=2)ir(a[b],a[b+1],c);return c.join("&")},kr=function(a){var b=[],c;for(c in a)ir(c,a[c],b);return b.join("&")},lr=function(a,b){var c=2==arguments.length?jr(arguments[1],0):jr(arguments,1);return hr(a,c)},nr=function(a,
b){b=kr(b);return hr(a,b)},or=function(a,b,c){c=null!=c?"="+encodeURIComponent(String(c)):"";return hr(a,b+c)},pr=function(a,b,c,d){for(var e=c.length;0<=(b=a.indexOf(c,b))&&b<d;){var f=a.charCodeAt(b-1);if(38==f||63==f)if(f=a.charCodeAt(b+e),!f||61==f||38==f||35==f)return b;b+=e+1}return-1},qr=/#|$/,rr=function(a,b){var c=a.search(qr),d=pr(a,0,b,c);if(0>d)return null;var e=a.indexOf("&",d);if(0>e||e>c)e=c;d+=b.length+1;return decodeURIComponent(a.substr(d,e-d).replace(/\+/g," "))},sr=/[?&]($|#)/,
tr=function(a,b){var c=a.length-1;0<=c&&a.indexOf("/",c)==c&&(a=a.substr(0,a.length-1));rd(b,"/")&&(b=b.substr(1));return""+a+"/"+b};var ur=function(a){this.yc=this.m=this.j="";this.s=null;this.l=this.g="";this.C=!1;var b;a instanceof ur?(this.C=a.C,vr(this,a.j),this.m=a.m,this.yc=a.yc,wr(this,a.Hb()),this.g=a.g,xr(this,a.h.clone()),this.l=a.l):a&&(b=String(a).match(er))?(this.C=!1,vr(this,b[1]||"",!0),this.m=yr(b[2]||""),this.yc=yr(b[3]||"",!0),wr(this,b[4]),this.g=yr(b[5]||"",!0),xr(this,b[6]||"",!0),this.l=yr(b[7]||"")):(this.C=!1,this.h=new zr(null,this.C))};
ur.prototype.toString=function(){var a=[],b=this.j;b&&a.push(Ar(b,Br,!0),":");var c=this.yc;if(c||"file"==b)a.push("//"),(b=this.m)&&a.push(Ar(b,Br,!0),"@"),a.push(encodeURIComponent(String(c)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),c=this.Hb(),null!=c&&a.push(":",String(c));if(c=this.g)this.yc&&"/"!=c.charAt(0)&&a.push("/"),a.push(Ar(c,"/"==c.charAt(0)?Cr:Dr,!0));(c=this.h.toString())&&a.push("?",c);(c=this.l)&&a.push("#",Ar(c,Er));return a.join("")};
ur.prototype.resolve=function(a){var b=this.clone(),c=!!a.j;c?vr(b,a.j):c=!!a.m;c?b.m=a.m:c=!!a.yc;c?b.yc=a.yc:c=null!=a.s;var d=a.g;if(c)wr(b,a.Hb());else if(c=!!a.g){if("/"!=d.charAt(0))if(this.yc&&!this.g)d="/"+d;else{var e=b.g.lastIndexOf("/");-1!=e&&(d=b.g.substr(0,e+1)+d)}e=d;if(".."==e||"."==e)d="";else if(-1!=e.indexOf("./")||-1!=e.indexOf("/.")){d=rd(e,"/");e=e.split("/");for(var f=[],g=0;g<e.length;){var h=e[g++];"."==h?d&&g==e.length&&f.push(""):".."==h?((1<f.length||1==f.length&&""!=f[0])&&
f.pop(),d&&g==e.length&&f.push("")):(f.push(h),d=!0)}d=f.join("/")}else d=e}c?b.g=d:c=""!==a.h.toString();c?xr(b,a.h.clone()):c=!!a.l;c&&(b.l=a.l);return b};ur.prototype.clone=function(){return new ur(this)};var vr=function(a,b,c){a.j=c?yr(b,!0):b;a.j&&(a.j=a.j.replace(/:$/,""))};ur.prototype.Hb=function(){return this.s};
var wr=function(a,b){if(b){b=Number(b);if(isNaN(b)||0>b)throw Error("Bad port number "+b);a.s=b}else a.s=null},xr=function(a,b,c){b instanceof zr?(a.h=b,Fr(a.h,a.C)):(c||(b=Ar(b,Gr)),a.h=new zr(b,a.C))},yr=function(a,b){return a?b?decodeURI(a.replace(/%25/g,"%2525")):decodeURIComponent(a):""},Ar=function(a,b,c){return"string"===typeof a?(a=encodeURI(a).replace(b,Hr),c&&(a=a.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),a):null},Hr=function(a){a=a.charCodeAt(0);return"%"+(a>>4&15).toString(16)+(a&15).toString(16)},
Br=/[#\/\?@]/g,Dr=/[#\?:]/g,Cr=/[#\?]/g,Gr=/[#\?@]/g,Er=/#/g,zr=function(a,b){this.h=this.g=null;this.j=a||null;this.l=!!b},Ir=function(a){a.g||(a.g=new Zm,a.h=0,a.j&&gr(a.j,function(b,c){a.add(decodeURIComponent(b.replace(/\+/g," ")),c)}))},Kr=function(a){var b=Qn(a);if("undefined"==typeof b)throw Error("Keys are undefined");var c=new zr(null,void 0);a=Pn(a);for(var d=0;d<b.length;d++){var e=b[d],f=a[d];Array.isArray(f)?Jr(c,e,f):c.add(e,f)}return c};k=zr.prototype;k.wa=function(){Ir(this);return this.h};
k.add=function(a,b){Ir(this);this.j=null;a=Lr(this,a);var c=this.g.get(a);c||this.g.set(a,c=[]);c.push(b);this.h+=1;return this};k.remove=function(a){Ir(this);a=Lr(this,a);return bn(this.g,a)?(this.j=null,this.h-=this.g.get(a).length,this.g.remove(a)):!1};k.clear=function(){this.g=this.j=null;this.h=0};k.ec=function(){Ir(this);return 0==this.h};var Mr=function(a,b){Ir(a);b=Lr(a,b);return bn(a.g,b)};k=zr.prototype;k.ng=function(a){var b=this.Ja();return $b(b,a)};
k.forEach=function(a,b){Ir(this);this.g.forEach(function(c,d){Qb(c,function(e){a.call(b,e,d,this)},this)},this)};k.Ub=function(){Ir(this);for(var a=this.g.Ja(),b=this.g.Ub(),c=[],d=0;d<b.length;d++)for(var e=a[d],f=0;f<e.length;f++)c.push(b[d]);return c};k.Ja=function(a){Ir(this);var b=[];if("string"===typeof a)Mr(this,a)&&(b=jc(b,this.g.get(Lr(this,a))));else{a=this.g.Ja();for(var c=0;c<a.length;c++)b=jc(b,a[c])}return b};
k.set=function(a,b){Ir(this);this.j=null;a=Lr(this,a);Mr(this,a)&&(this.h-=this.g.get(a).length);this.g.set(a,[b]);this.h+=1;return this};k.get=function(a,b){if(!a)return b;a=this.Ja(a);return 0<a.length?String(a[0]):b};var Jr=function(a,b,c){a.remove(b);0<c.length&&(a.j=null,a.g.set(Lr(a,b),kc(c)),a.h+=c.length)};
zr.prototype.toString=function(){if(this.j)return this.j;if(!this.g)return"";for(var a=[],b=this.g.Ub(),c=0;c<b.length;c++){var d=b[c],e=encodeURIComponent(String(d));d=this.Ja(d);for(var f=0;f<d.length;f++){var g=e;""!==d[f]&&(g+="="+encodeURIComponent(String(d[f])));a.push(g)}}return this.j=a.join("&")};zr.prototype.clone=function(){var a=new zr;a.j=this.j;this.g&&(a.g=this.g.clone(),a.h=this.h);return a};
var Lr=function(a,b){b=String(b);a.l&&(b=b.toLowerCase());return b},Fr=function(a,b){b&&!a.l&&(Ir(a),a.j=null,a.g.forEach(function(c,d){var e=d.toLowerCase();d!=e&&(this.remove(d),Jr(this,e,c))},a));a.l=b};zr.prototype.extend=function(a){for(var b=0;b<arguments.length;b++)Sn(arguments[b],function(c,d){this.add(d,c)},this)};var Nr=function(a,b){this.input=a;this.domain=b};var Or=function(a){this.g=a;this.o=eb("mr.ExternalMessageHandler")};
Or.prototype.onMessage=function(a,b,c){var d=this;this.o.info("Received a message from "+b.id+" type: "+a.type);var e=chrome.runtime.id;"start"==a.type?(a=a.message,this.g.searchSinks("pseudo:cloud","urn:x-org.chromium.media:source:desktop",new Nr(a.meetingName,a.domain)).then(function(f){var g="PresentationId"+b.id+Pr++;d.g.createRoute("urn:x-org.chromium.media:source:desktop",f,g).then(function(h){c(new Jf(e,"route",h.id))}).catch(function(h){c(new Jf(e,"error",h))})},function(){c(new Jf(e,"error",
Error("Failed to find sink.")))})):"stop"==a.type?this.g.terminateRoute(a.message.routeId).then(function(){c(new Jf(e,"stopped"))}):"subscribe_log_data"==a.type?(hb.push(function(f){chrome.runtime.sendMessage(b.id,new Jf(e,"log_message",f))}),c(new Jf(e,"subscribed"))):(c(new Jf(e,"error",Error("Unhandled message type"))),this.o.error("Unhandled message type "+a.type))};var Pr=0;var Qr=function(){this.g=[];this.h=[]};k=Qr.prototype;k.enqueue=function(a){if(1E3<=this.wa()){if(this.ec())throw Error("Empty queue");0==this.g.length&&(this.g=this.h,this.g.reverse(),this.h=[]);this.g.pop()}this.h.push(a)};k.wa=function(){return this.g.length+this.h.length};k.ec=function(){return 0==this.wa()};k.Ja=function(){var a=this.g.slice();a.reverse();a.push.apply(a,p(this.h));return a};k.clear=function(){this.g=[];this.h=[]};var Rr=function(){this.g=new Qr;this.j=Date.now()},Tr=function(){null==Sr&&(Sr=new Rr);return Sr};
Rr.prototype.init=function(){gb=1;var a=eb("browser"),b=window.onerror;window.onerror=function(d,e,f,g,h){try{var m=h.result.error.errors[0];if("usageLimits"==m.domain&&"accessNotConfigured"==m.reason)return!0}catch(q){}b&&b(d,e,f,g,h);a.error("Error: "+d+" ("+e+" @ Line: "+f+")",h)};hb.push(this.l.bind(this));var c=window.localStorage["debug.logs"];c&&(gb=ob(c.toUpperCase()));(c=window.localStorage["debug.console"])&&"false"!=c.toLowerCase()&&hb.push(this.h.bind(this))};
Rr.prototype.l=function(a){this.g.enqueue(Ur(this,a,!1));a=a.fd;a instanceof Error&&a.stack&&this.g.enqueue(a.stack)};Rr.prototype.h=function(a){var b=[Ur(this,a,!0)];a.fd&&b.push(a.fd);switch(a.level){case 3:console.error.apply(console,p(b));break;case 2:console.warn.apply(console,p(b));break;case 1:console.log.apply(console,p(b));break;default:console.debug.apply(console,p(b))}};
var Ur=function(a,b,c){var d=["["];if(c)a=(Date.now()-a.j)/1E3,d.push(("       "+a.toFixed(3)).slice(-7));else{a=new Date(b.time);var e=function(f){return 10>f?"0"+f:f};d.push(a.getFullYear().toString(),"-",e(a.getMonth()+1),"-",e(a.getDate())," ",e(a.getHours()),":",e(a.getMinutes()),":",e(a.getSeconds()),".",e(Math.floor(a.getMilliseconds()/10)))}d.push("][",nb[b.level],"][",b.M,"] ",b.message);if(!c&&null!=b.fd)if(d.push("\n"),b.fd instanceof Error)d.push(b.fd.message);else try{d.push(JSON.stringify(b.fd))}catch(f){d.push(b.fd.toString())}d.push("\n");
return d.join("")},Vr=function(){var a=Tr();return 0==a.g.wa()?"NA":a.g.Ja().join("")},Wr=function(){var a=Tr();vm(a)};Rr.prototype.Ya=function(){return"LogManager"};Rr.prototype.Ob=function(){return[this.g.Ja()]};Rr.prototype.Nb=function(){var a=this.g.Ja();this.g.clear();for(var b=n(sm(this)||[]),c=b.next();!c.done;c=b.next())this.g.enqueue(c.value);a=n(a);for(c=a.next();!c.done;c=a.next())this.g.enqueue(c.value)};var Sr=null;var Xr=function(a){return Promise.all(a.map(function(b){return b.then(function(c){return{Pe:!0,value:c}},function(c){return{Pe:!1,reason:c}})}))};var Yr=function(a){this.g=a;this.o=eb("mr.InternalMessageHandler")};
Yr.prototype.onMessage=function(a,b,c){var d=this;if("retrieve_log_data"!=a.type)c(new Jf(chrome.runtime.id,"error",Error("Unhandled message type")));else{var e={logs:Vr(),device:Pm()};b=[];var f=If(e.device.ip).then(function(h){h.g&&(e.device.version=h.g)});b.push(f);var g=this.g.F;g&&(a=Zr(this,g,a.source).then(function(h){h&&(e.castStreamingLogs=h)},function(){d.o.error("Log upload failed for service: "+g)}),b.push(a));this.g.config&&(this.g.config.enable_cast_sink_query?b.push($r(this,e)):e.castDeviceCounts=
"See b/151090350");e.dialDeviceCounts="See b/151090350";a=this.g.getMediaSinkServiceStatus().then(function(h){e.mediaSinkServiceStatus=h.status},function(){d.o.error("Failed to get media sink service status")});b.push(a);a=as(this.g).then(function(h){e.mediaRouterLogs=h.logs},function(){d.o.error("Failed to get Media Router logs")});b.push(a);this.g.config&&(e.mirroringServiceEnabled=this.g.config.use_mirroring_service,e.nativeCastMrpEnabled=!this.g.config.enable_cast_sink_query,e.nativeDialMrpEnabled=
!this.g.config.enable_dial_sink_query);Xr(b).then(function(){c(e)})}};var $r=function(a,b){return sj("mr.cast.SinkDiscoveryService").then(function(c){c=c.Gi;b.castDeviceCounts=c.Yo+"."+c.Ln},function(){a.o.error("Failed to get device counts for castDeviceCounts.")})},Zr=function(a,b,c){return bs(a.g,b).then(function(d){return d.zl(c)})};var cs={ACCEPTED:0,XD:1,TIMEOUT:2},ds={SUCCESS:0,pE:1},es={yt:0,at:1,LO:2,CF:3,BF:4,VH:5,TIMEOUT:6,HJ:7},fs={xF:0,CM:1},gs=function(a){Ab("MediaRouter.Cloud.Knock.Result",a,cs)},hs=function(a){Ab("MediaRouter.Cloud.Session.Start",a,ds)},is=function(a){Ab("MediaRouter.Cloud.Session.Type",a,fs)};var js=function(a,b){this.g=a;this.h=b},ks=new js("https://castedumessaging-pa.googleapis.com/v1","AIzaSyAOZM8ZYeov685QMjXT3sC7XNizfrTEKjA"),ls=new js("https://www.googleapis.com/calendar/v3",""),ms=new js("https://www.googleapis.com/hangouts/v1",""),ns=new js("https://networktraversal.googleapis.com/v1alpha","AIzaSyAOZM8ZYeov685QMjXT3sC7XNizfrTEKjA");var os=function(a,b,c,d,e,f){c=void 0===c?null:c;a||null==c&&(c="default");this.To=a;this.Va=b;this.yc=c;this.Dg=void 0===d?null:d;this.Fd=void 0===e?null:e;this.Rf=void 0===f?null:f},ps=function(a){var b="";a.Fd?b=a.Fd:a.Dg&&(b=a.Dg);return b};os.prototype.ye=function(){return this.To};os.prototype.getId=function(){return this.Va};os.prototype.merge=function(a){!this.Rf&&a.Rf&&(this.Rf=a.Rf);!this.Fd&&a.Fd&&(this.Fd=a.Fd);this.Fd&&a.Fd&&this.Rf&&(this.Fd=a.Fd)};var qs=function(a,b){this.h=a;this.j=b;this.o=eb("mr.cloud.calendar.CalendarService")},us=function(a){var b=a.j.h;return b?rs(a,b).then(function(c){a.o.info(ss(c.length)+" events discovered before filtering.");return ts(a,c)},function(c){a.o.L("Error getting Hangouts from calendar.",c);return[]}):(a.o.error("No user email to use as calendar id to query for events."),Promise.resolve([]))},ss=function(a){return 20<a?"20+":a.toString()},rs=function(a,b){var c=Date.now();return vs(a,b,new Date(c),new Date(c+
9E5)).then(function(d){return d.filter(a.g)})};qs.prototype.g=function(a){return!(!a.start||!a.end||a.start.date||a.end.date||!a.start.dateTime||!a.end.dateTime)};
var vs=function(a,b,c,d){b=ws(ls.g,["calendars",b,"events"],{timeMin:c.toJSON(),timeMax:d.toJSON(),singleEvents:!0});mb(a.o,"Retrieving Hangouts from Calendar: "+b);Ab("MediaRouter.Cloud.CalendarApiCaller",Bb,Cb);null!=Db&&(clearTimeout(Db),Db=null);return xs(a.h,b,"GET").then(function(e){return e.items?e.items:[]})},ts=function(a,b){var c=[];b.filter(function(d){return d.hangoutLink}).forEach(function(d){var e=new ur(d.hangoutLink);if("meet.google.com"==e.yc)c.push(new os(!0,e.g.substring(1),void 0,
void 0,d.summary));else if(e=e.g.substring(12).split("/"),2==e.length){var f=n(e);e=f.next().value;f=f.next().value;if(-1!=e.indexOf(".")){var g=f;var h=e}c.push(new os(!1,f+"@"+e,h,g,d.summary,void 0))}else a.o.L("Invalid hangout link from calendar event: "+d.hangoutLink)});a.o.info(ss(c.length)+" events discovered with Hangout links.");return c};var ys=function(a,b,c,d,e,f,g,h){var m=Om(Nm(),a);this.Pb=new om(m,b,g,h,e);this.deviceId=a;this.g=c;this.model=d;this.isAvailable=f};ea.Object.defineProperties(ys.prototype,{id:{configurable:!0,enumerable:!0,get:function(){return this.Pb.id}},displayName:{configurable:!0,enumerable:!0,set:function(a){this.Pb.friendlyName=a}}});var zs=function(a){var b=a.yc,c;a.Dg&&ps(a)!=a.Dg&&(c=a.Dg);ys.call(this,a.getId(),ps(a),"mesi","Hangout",b,!1,a.ye()?"meeting":"hangout",c);this.ye=a.ye();this.bi=a.Rf||""};
t(zs,ys);var As=function(a,b,c){ys.call(this,a,b,"slarti","Cast Receiver for Education","default",c,"education")};t(As,ys);var Bs=function(a,b,c){this.u=a;this.m=b;this.g=new Map;this.C=new Map;this.l=null;this.s=c};Bs.prototype.j=function(){var a=this.l+this.s;if(null==this.l||a<Date.now())this.l=Date.now(),Cs(this);return Array.from(this.g.values())};Bs.prototype.h=function(a){return this.g.get(a)||null};
var Cs=function(a){a.u().then(function(b){Ds(a,b)})},Ds=function(a,b){var c=new Map(a.g),d=new Map,e=new Map,f=[],g=[];b.forEach(function(h){var m=h.id;d.set(m,h);e.set(m,h.deviceId);c.has(m)?c.has(m)&&JSON.stringify(c.get(m))!=JSON.stringify(h)&&g.push(h.Pb):f.push(h.Pb);c.delete(m)});b=[].concat(p(c.values())).map(function(h){return h.Pb});a.C.clear();a.C=e;a.g.clear();a.g=d;Es(a,f,g,b)},Es=function(a,b,c,d){0<b.length&&Fs(a.m,b);0<c.length&&Gs(a.m,c);0<d.length&&Hs(a.m,d)},Js=function(a){for(var b=
{},c=n(a.g.entries()),d=c.next();!d.done;d=c.next()){var e=n(d.value);d=e.next().value;e=e.next().value;b[d]=e}c={};d=n(a.C.entries());for(e=d.next();!e.done;e=d.next()){var f=n(e.value);e=f.next().value;f=f.next().value;c[e]=f}return new Is(b,c,a.l)},Ks=function(a,b){for(var c in b.sinks){var d=b.sinks[c],e=null;"Hangout"==d.model?e=new zs(new os(d.ye,d.deviceId,d.Pb.domain,d.Pb.description,d.Pb.friendlyName,d.bi)):"Cast Receiver for Education"==d.model&&(e=new As(d.deviceId,d.Pb.friendlyName,d.isAvailable));
a.g.set(c,e)}for(c in b.g)a.C.set(c,b.g[c]);b.h&&(a.l=b.h)},Is=function(a,b,c){this.sinks=a;this.g=b;this.h=c};var Ns=function(a,b,c){if(!Ls){ig();var d=hg;d.h=dg;var e=Ms;d.g||(d.g=[]);d.g.push(e);Ls=!0}this.C=a;this.m=b;this.g=new Bs(this.s.bind(this),c,2E4);this.l=new Map;vm(this)},Ms=function(a){ib({M:a.j,level:pb(a.h.value),time:a.C,message:a.getMessage(),fd:a.g})};Ns.prototype.j=function(){return this.g.j()};Ns.prototype.h=function(a){return this.g.h(a)};
Ns.prototype.s=function(){var a=this;this.o.info("Fetching hangouts");return Xr([Os(this.m),us(this.C)]).then(function(b){var c=Array.from(a.l.values());b.forEach(function(e){e.Pe?c=c.concat(e.value):a.o.error("Error discovering Hangouts",e.reason)});var d=c.reduce(function(e,f){var g=e[f.getId()];g?g.merge(f):g=f;e[g.getId()]=g;return e},{});return Object.keys(d).map(function(e){e=d[e];zb("MediaRouter.Cloud.Hangout.Sink.Discovered");return new zs(e)})})};
var Qs=function(a,b){return sj("mr.mirror.hangouts.MeetingsService").then(function(c){return c.Gb(b)}).then(function(c){return Ps(a,c)},function(){return b.input.match(/^#/)?Promise.reject(Error("Failed to resolve meeting alias.")):Ps(a,b.input,b.domain)})},Ps=function(a,b,c){c=c||void 0;var d=!c;b=new os(d,d?b:b+"@"+c,c,b,void 0,void 0);a.l.set(b.getId(),b);b=new zs(b);a.g.g.set(b.id,b);return b.Pb};Ns.prototype.Ya=function(){return"HangoutSinkDiscoveryService"};
Ns.prototype.Ob=function(){for(var a={},b=n(this.l.entries()),c=b.next();!c.done;c=b.next()){var d=n(c.value);c=d.next().value;d=d.next().value;a[c]=d}return[{cache:Js(this.g),manualHangouts:a}]};Ns.prototype.Nb=function(){var a=sm(this);if(a){Ks(this.g,a.cache);for(var b in a.manualHangouts){var c=a.manualHangouts[b];this.l.set(b,new os(c.To,c.Va,c.yc,c.Dg,c.Fd,c.Rf))}}};Ns.prototype.o=eb("mr.cloud.discovery.HangoutSinkDiscoveryService");var Ls=!1;var V=function(){this.rd=this.rd;this.Ab=this.Ab};V.prototype.rd=!1;V.prototype.C=function(){return this.rd};V.prototype.dispose=function(){this.rd||(this.rd=!0,this.ba())};V.prototype.T=function(a){Rs(this,Za(Ss,a))};var Rs=function(a,b){a.rd?b():(a.Ab||(a.Ab=[]),a.Ab.push(b))};V.prototype.ba=function(){if(this.Ab)for(;this.Ab.length;)this.Ab.shift()()};
var Ss=function(a){a&&"function"==typeof a.dispose&&a.dispose()},Ts=function(a){for(var b=0,c=arguments.length;b<c;++b){var d=arguments[b];Qa(d)?Ts.apply(null,d):Ss(d)}};var Us=Fa.JSON.parse,Vs=Fa.JSON.stringify;var Ws=function(a,b){this.j=a;this.l=b;this.h=0;this.g=null};Ws.prototype.get=function(){if(0<this.h){this.h--;var a=this.g;this.g=a.next;a.next=null}else a=this.j();return a};var Xs=function(a,b){a.l(b);100>a.h&&(a.h++,b.next=a.g,a.g=b)};var Ys=function(a){Fa.setTimeout(function(){throw a;},0)},Zs,$s=function(){var a=Fa.MessageChannel;"undefined"===typeof a&&"undefined"!==typeof window&&window.postMessage&&window.addEventListener&&!ie("Presto")&&(a=function(){var e=zg(document,"IFRAME");e.style.display="none";document.documentElement.appendChild(e);var f=e.contentWindow;e=f.document;e.open();e.close();var g="callImmediate"+Math.random(),h="file:"==f.location.protocol?"*":f.location.protocol+"//"+f.location.host;e=Ya(function(m){if(("*"==
h||m.origin==h)&&m.data==g)this.port1.onmessage()},this);f.addEventListener("message",e,!1);this.port1={};this.port2={postMessage:function(){f.postMessage(g,h)}}});if("undefined"!==typeof a&&!ke()){var b=new a,c={},d=c;b.port1.onmessage=function(){if(void 0!==c.next){c=c.next;var e=c.Sn;c.Sn=null;e()}};return function(e){d.next={Sn:e};d=d.next;b.port2.postMessage(0)}}return function(e){Fa.setTimeout(e,0)}};var at=function(){this.h=this.g=null},ct=new Ws(function(){return new bt},function(a){a.reset()});at.prototype.add=function(a,b){var c=ct.get();c.set(a,b);this.h?this.h.next=c:this.g=c;this.h=c};at.prototype.remove=function(){var a=null;this.g&&(a=this.g,this.g=this.g.next,this.g||(this.h=null),a.next=null);return a};var bt=function(){this.next=this.scope=this.g=null};bt.prototype.set=function(a,b){this.g=a;this.scope=b;this.next=null};bt.prototype.reset=function(){this.next=this.scope=this.g=null};var ht=function(a,b){dt||et();ft||(dt(),ft=!0);gt.add(a,b)},dt,et=function(){if(Fa.Promise&&Fa.Promise.resolve){var a=Fa.Promise.resolve(void 0);dt=function(){a.then(it)}}else dt=function(){var b=it;"function"!==typeof Fa.setImmediate||Fa.Window&&Fa.Window.prototype&&!ie("Edge")&&Fa.Window.prototype.setImmediate==Fa.setImmediate?(Zs||(Zs=$s()),Zs(b)):Fa.setImmediate(b)}},ft=!1,gt=new at,it=function(){for(var a;a=gt.remove();){try{a.g.call(a.scope)}catch(b){Ys(b)}Xs(ct,a)}ft=!1};var jt=function(a){a.prototype.$goog_Thenable=!0},kt=function(a){if(!a)return!1;try{return!!a.$goog_Thenable}catch(b){return!1}};var nt=function(a,b){this.g=0;this.s=void 0;this.l=this.h=this.j=null;this.C=this.m=!1;if(a!=Ma)try{var c=this;a.call(b,function(d){lt(c,2,d)},function(d){if(!(d instanceof mt))try{if(d instanceof Error)throw d;throw Error("Promise rejected.");}catch(e){}lt(c,3,d)})}catch(d){lt(this,3,d)}},ot=function(){this.next=this.context=this.h=this.l=this.g=null;this.j=!1};ot.prototype.reset=function(){this.context=this.h=this.l=this.g=null;this.j=!1};
var pt=new Ws(function(){return new ot},function(a){a.reset()}),qt=function(a,b,c){var d=pt.get();d.l=a;d.h=b;d.context=c;return d},rt=function(a){if(a instanceof nt)return a;var b=new nt(Ma);lt(b,2,a);return b},st=function(a){return new nt(function(b,c){c(a)})},ut=function(a,b,c){tt(a,b,c,null)||ht(Za(b,a))},vt=function(a){return new nt(function(b,c){a.length||b(void 0);for(var d=0,e;d<a.length;d++)e=a[d],ut(e,b,c)})},wt=function(a){return new nt(function(b,c){var d=a.length,e=[];if(d)for(var f=
function(q,r){d--;e[q]=r;0==d&&b(e)},g=function(q){c(q)},h=0,m;h<a.length;h++)m=a[h],ut(m,Za(f,h),g);else b(e)})},xt=function(a){return new nt(function(b){var c=a.length,d=[];if(c)for(var e=function(h,m,q){c--;d[h]=m?{Pe:!0,value:q}:{Pe:!1,reason:q};0==c&&b(d)},f=0,g;f<a.length;f++)g=a[f],ut(g,Za(e,f,!0),Za(e,f,!1));else b(d)})},zt=function(){var a,b,c=new nt(function(d,e){a=d;b=e});return new yt(c,a,b)};
nt.prototype.then=function(a,b,c){return At(this,"function"===typeof a?a:null,"function"===typeof b?b:null,c)};jt(nt);var Ct=function(a,b,c){b=qt(b,b,c);b.j=!0;Bt(a,b);return a},Dt=function(a,b){return At(a,null,b,void 0)};nt.prototype.cancel=function(a){if(0==this.g){var b=new mt(a);ht(function(){Et(this,b)},this)}};
var Et=function(a,b){if(0==a.g)if(a.j){var c=a.j;if(c.h){for(var d=0,e=null,f=null,g=c.h;g&&(g.j||(d++,g.g==a&&(e=g),!(e&&1<d)));g=g.next)e||(f=g);e&&(0==c.g&&1==d?Et(c,b):(f?(d=f,d.next==c.l&&(c.l=d),d.next=d.next.next):Ft(c),Gt(c,e,3,b)))}a.j=null}else lt(a,3,b)},Bt=function(a,b){a.h||2!=a.g&&3!=a.g||Ht(a);a.l?a.l.next=b:a.h=b;a.l=b},At=function(a,b,c,d){var e=qt(null,null,null);e.g=new nt(function(f,g){e.l=b?function(h){try{var m=b.call(d,h);f(m)}catch(q){g(q)}}:f;e.h=c?function(h){try{var m=c.call(d,
h);void 0===m&&h instanceof mt?g(h):f(m)}catch(q){g(q)}}:g});e.g.j=a;Bt(a,e);return e.g};nt.prototype.F=function(a){this.g=0;lt(this,2,a)};nt.prototype.D=function(a){this.g=0;lt(this,3,a)};
var lt=function(a,b,c){0==a.g&&(a===c&&(b=3,c=new TypeError("Promise cannot resolve to itself")),a.g=1,tt(c,a.F,a.D,a)||(a.s=c,a.g=b,a.j=null,Ht(a),3!=b||c instanceof mt||It(a,c)))},tt=function(a,b,c,d){if(a instanceof nt)return Bt(a,qt(b||Ma,c||null,d)),!0;if(kt(a))return a.then(b,c,d),!0;if(Ra(a))try{var e=a.then;if("function"===typeof e)return Jt(a,e,b,c,d),!0}catch(f){return c.call(d,f),!0}return!1},Jt=function(a,b,c,d,e){var f=!1,g=function(m){f||(f=!0,c.call(e,m))},h=function(m){f||(f=!0,d.call(e,
m))};try{b.call(a,g,h)}catch(m){h(m)}},Ht=function(a){a.m||(a.m=!0,ht(a.u,a))},Ft=function(a){var b=null;a.h&&(b=a.h,a.h=b.next,b.next=null);a.h||(a.l=null);return b};nt.prototype.u=function(){for(var a;a=Ft(this);)Gt(this,a,this.g,this.s);this.m=!1};
var Gt=function(a,b,c,d){if(3==c&&b.h&&!b.j)for(;a&&a.C;a=a.j)a.C=!1;if(b.g)b.g.j=null,Kt(b,c,d);else try{b.j?b.l.call(b.context):Kt(b,c,d)}catch(e){Lt.call(null,e)}Xs(pt,b)},Kt=function(a,b,c){2==b?a.l.call(a.context,c):a.h&&a.h.call(a.context,c)},It=function(a,b){a.C=!0;ht(function(){a.C&&Lt.call(null,b)})},Lt=Ys,mt=function(a){Gb.call(this,a)};w(mt,Gb);mt.prototype.name="cancel";var yt=function(a,b,c){this.promise=a;this.resolve=b;this.reject=c};var Mt=function(a,b,c,d,e,f,g,h,m){V.call(this);this.o=jg("apps.apiary.ApiaryClient");this.h=null;this.D=!1;this.F=zt();this.j=[];this.g=a?encodeURIComponent(String(a)):null;this.G=null;!d&&b&&(this.G=b);this.V=c||null;this.l=!d;this.m=null!=e?e:null;this.u=f||null;this.N=!!g;this.H=h||null;this.s=null!=m?m:null};t(Mt,V);
Mt.prototype.init=function(){og(this.o,"init - API key: "+this.g);var a=Ya(function(c){this.h=c;var d=La("client.request",c),e=La("auth",c);d&&e?this.K():c.load("client",Ya(this.K,this));og(this.o,"loadCallback - API key: "+this.g+", clientRequest: "+d+", auth: "+e)},this),b=Nt("gapi");b?a(b.gapi):Ot(this,a);return this.F.promise};
var Nt=function(a){for(var b=window,c=La(a,b);!c&&b!=window.top&&Pt(b.parent,a);)b=b.parent,c=La(a,b);return c?b:null},Pt=function(a,b){try{return!!a&&null!=a.location.href&&Le(a,b)}catch(c){return!1}},Ot=function(a,b){og(a.o,"loadGapi_ - API key: "+a.g);var c=Nt("gapi_onload");if(c){var d=c.gapi_onload;c.gapi_onload=function(){d();b(c.gapi)};og(a.o,"found already loading GAPI - API key: "+a.g)}else{window.gapi_onload=function(){b(window.gapi)};var e=zg(document,"SCRIPT");ze(e,Qt);a.H&&Cg(e,Vs(a.H));
document.getElementsByTagName("head")[0].appendChild(e)}};Mt.prototype.K=function(){og(this.o,"client loaded - API key: "+this.g);for(var a=0;a<this.j.length;a++)this.j[a].Fb.resolve(Rt(this,this.j[a].requestData));this.D=!0;this.F.resolve(this.h)};Mt.prototype.sendRequest=function(a){if(this.D)return Rt(this,a);var b=zt();this.j.push({requestData:a,Fb:b});return b.promise};
var Rt=function(a,b){var c=La("config.get",a.h);if(!a.l){var d=c("googleapis.config/auth/useFirstPartyAuth");var e=c("googleapis.config/auth/useOriginToken")}var f;null!=a.m&&(f=c("client/cors"));var g;null!=a.s&&(g=c("client/xd4"));try{var h=La("config.update",a.h);a.l||(h("googleapis.config/auth/useFirstPartyAuth",!1),h("googleapis.config/auth/useOriginToken",!1));null!=a.m&&h("client/cors",a.m);null!=a.s&&h("client/xd4",a.s);var m=St(a);b.headers&&Uc(m,b.headers);var q={headers:m,root:a.V,path:b.path,
method:b.method,body:b.body},r=b.params||{};a.g&&!a.u?Uc(r,{key:a.g}):a.u&&Uc(r,{key:null});Oc(r)||(q.params=r);var z=rt(La("client.request",a.h)(q));b.callback&&z.then(function(D){b.callback.apply(null,[D.result,D])},function(D){b.callback.apply(null,[D.result,D])});return z}finally{c=La("config.update",a.h),a.l||(c("googleapis.config/auth/useFirstPartyAuth",d),c("googleapis.config/auth/useOriginToken",e)),null!=a.m&&c("client/cors",f),null!=a.s&&c("client/xd4",g)}},St=function(a){if(a.l){if(a.u)return{Authorization:"Bearer "+
a.u};var b=La("auth.getAuthHeaderValueForFirstParty",a.h);return{Authorization:a.N?b([]):b(),"X-Goog-AuthUser":a.G}}return{}},Qt=pd(ad(new $c(Yc,"https://apis.google.com/js/client.js")));var Tt=function(a){this.g=a},ws=function(a,b,c){var d="";b.forEach(function(e){d+="/"+encodeURIComponent(e)});a=new ur(a+d);c&&(c=Kr(c),xr(a,c));return a},xs=function(a,b,c,d,e){e=void 0===e?1:e;return a.g.getAuthToken().then(function(f){return Ut(a,b,c,f,d).catch(function(g){if("INVALID_ACCESS_ERROR"==g&&0<e)return Vt(a,f,b,c,d,e-1);throw g;})})},Vt=function(a,b,c,d,e,f){return Wt(b).then(function(){return xs(a,c,d,e,f)})},Ut=function(a,b,c,d,e){var f=Xt;d=new Mt(void 0,void 0,void 0,!1,!1,d);d.init();
return f(a,d,b,c,e)},Xt=function(a,b,c,d,e){return new Promise(function(f,g){b.sendRequest(Yt(c,d,function(h){h&&!h.error?f(h):h&&401==h.error.code?g("INVALID_ACCESS_ERROR"):g(h&&h.error?h.error.errors?h.error.errors[0]:h:Error(h))},e))})},Yt=function(a,b,c,d){a={callback:c,method:b,path:a.toString()};d&&(a.body=d);return a};var au=function(){this.g=!1;this.h=null;this.j=!1;this.o=eb("mr.cloud.identity.IdentityService");vm(this);Zt(this);$t(this)};au.prototype.getAuthToken=function(){return chrome.identity?new Promise(function(a,b){chrome.identity.getAuthToken({interactive:!1},function(c){chrome.runtime.lastError?b(Error("Unable to get user auth token: "+chrome.runtime.lastError.message)):null==c?b(Error("User is not logged in (no token found)")):a(c)})}):Promise.reject(Error("chrome.identity permission required for auth."))};
var Wt=function(a){return new Promise(function(b){chrome.identity.removeCachedAuthToken({token:a},function(){b()})})},$t=function(a){a.getAuthToken().then(function(b){chrome.identity.getProfileUserInfo(function(c){a.g=!!c.email||!!c.id;a.h=c.email||null;b&&!a.g&&(a.j=!0)})},function(b){mb(a.o,"Unable to set sign in and email.",b)})},Zt=function(a){chrome.identity.onSignInChanged.addListener(function(b,c){Bj(6);a.g=c;a.o.info("Signed in change: "+a.g);a.g?$t(a):(a.h=null,a.j=!1)})},bu=function(a){return a.getAuthToken().then(function(b){var c=
window.gapi;if(!c)return a.o.error("gapi not loaded."),!1;a.o.info("Setting gapi auth token");c.auth.setToken({access_token:b});return!0})};au.prototype.Ya=function(){return"IdentityService"};au.prototype.Ob=function(){return[null,{signedIn:this.g,userEmail:this.h,kioskAuth:this.j}]};au.prototype.Nb=function(){var a=tm(this);a&&(a.signedIn&&(this.g=a.signedIn),a.userEmail&&(this.h=a.userEmail),a.kioskAuth&&(this.j=a.kioskAuth))};var cu={iD:{1E3:{other:"0K"},1E4:{other:"00K"},1E5:{other:"000K"},1E6:{other:"0M"},1E7:{other:"00M"},1E8:{other:"000M"},1E9:{other:"0B"},1E10:{other:"00B"},1E11:{other:"000B"},1E12:{other:"0T"},1E13:{other:"00T"},1E14:{other:"000T"}},hD:{1E3:{other:"0 thousand"},1E4:{other:"00 thousand"},1E5:{other:"000 thousand"},1E6:{other:"0 million"},1E7:{other:"00 million"},1E8:{other:"000 million"},1E9:{other:"0 billion"},1E10:{other:"00 billion"},1E11:{other:"000 billion"},1E12:{other:"0 trillion"},1E13:{other:"00 trillion"},
1E14:{other:"000 trillion"}}},du=cu;du=cu;var eu={AED:[2,"dh","\u062f.\u0625."],ALL:[0,"Lek","Lek"],AUD:[2,"$","AU$"],BDT:[2,"\u09f3","Tk"],BGN:[2,"lev","lev"],BRL:[2,"R$","R$"],CAD:[2,"$","C$"],CDF:[2,"FrCD","CDF"],CHF:[2,"CHF","CHF"],CLP:[0,"$","CL$"],CNY:[2,"\u00a5","RMB\u00a5"],COP:[32,"$","COL$"],CRC:[0,"\u20a1","CR\u20a1"],CZK:[50,"K\u010d","K\u010d"],DKK:[50,"kr.","kr."],DOP:[2,"RD$","RD$"],EGP:[2,"\u00a3","LE"],ETB:[2,"Birr","Birr"],EUR:[2,"\u20ac","\u20ac"],GBP:[2,"\u00a3","GB\u00a3"],HKD:[2,"$","HK$"],HRK:[2,"kn","kn"],HUF:[34,
"Ft","Ft"],IDR:[0,"Rp","Rp"],ILS:[34,"\u20aa","IL\u20aa"],INR:[2,"\u20b9","Rs"],IRR:[0,"Rial","IRR"],ISK:[0,"kr","kr"],JMD:[2,"$","JA$"],JPY:[0,"\u00a5","JP\u00a5"],KRW:[0,"\u20a9","KR\u20a9"],LKR:[2,"Rs","SLRs"],LTL:[2,"Lt","Lt"],MNT:[0,"\u20ae","MN\u20ae"],MVR:[2,"Rf","MVR"],MXN:[2,"$","Mex$"],MYR:[2,"RM","RM"],NOK:[50,"kr","NOkr"],PAB:[2,"B/.","B/."],PEN:[2,"S/.","S/."],PHP:[2,"\u20b1","PHP"],PKR:[0,"Rs","PKRs."],PLN:[50,"z\u0142","z\u0142"],RON:[2,"RON","RON"],RSD:[0,"din","RSD"],RUB:[50,"\u20bd",
"RUB"],SAR:[2,"Rial","Rial"],SEK:[50,"kr","kr"],SGD:[2,"$","S$"],THB:[2,"\u0e3f","THB"],TRY:[2,"\u20ba","TRY"],TWD:[2,"$","NT$"],TZS:[0,"TSh","TSh"],UAH:[2,"\u0433\u0440\u043d.","UAH"],USD:[2,"$","US$"],UYU:[2,"$","$U"],VND:[48,"\u20ab","VN\u20ab"],YER:[0,"Rial","Rial"],ZAR:[2,"R","ZAR"]};var fu={Wm:".",Qj:",",ln:"%",Wj:"0",Ms:"+",fn:"-",Zm:"E",mn:"\u2030",Rj:"\u221e",Hs:"NaN",ks:"#,##0.###",CL:"#E0",uJ:"#,##0%",UD:"\u00a4#,##0.00",Xm:"USD"},gu=fu;gu=fu;var iu=function(){this.D=40;this.h=1;this.j=3;this.H=this.m=0;this.N=!1;this.G=this.u="";this.l=gu.fn;this.F="";this.g=1;this.s=!1;this.C=[];this.K=this.V=!1;var a=gu.ks;a.replace(/ /g,"\u00a0");var b=[0];this.u=hu(this,a,b);for(var c=b[0],d=-1,e=0,f=0,g=0,h=-1,m=a.length,q=!0;b[0]<m&&q;b[0]++)switch(a.charAt(b[0])){case "#":0<f?g++:e++;0<=h&&0>d&&h++;break;case "0":if(0<g)throw Error('Unexpected "0" in pattern "'+a+'"');f++;0<=h&&0>d&&h++;break;case ",":0<h&&this.C.push(h);h=0;break;case ".":if(0<=
d)throw Error('Multiple decimal separators in pattern "'+a+'"');d=e+f+g;break;case "E":if(this.K)throw Error('Multiple exponential symbols in pattern "'+a+'"');this.K=!0;this.H=0;b[0]+1<m&&"+"==a.charAt(b[0]+1)&&(b[0]++,this.N=!0);for(;b[0]+1<m&&"0"==a.charAt(b[0]+1);)b[0]++,this.H++;if(1>e+f||1>this.H)throw Error('Malformed exponential pattern "'+a+'"');q=!1;break;default:b[0]--,q=!1}0==f&&0<e&&0<=d&&(f=d,0==f&&f++,g=e-f,e=f-1,f=1);if(0>d&&0<g||0<=d&&(d<e||d>e+f)||0==h)throw Error('Malformed pattern "'+
a+'"');g=e+f+g;this.j=0<=d?g-d:0;0<=d&&(this.m=e+f-d,0>this.m&&(this.m=0));this.h=(0<=d?d:g)-e;this.K&&(this.D=e+this.h,0==this.j&&0==this.h&&(this.h=1));this.C.push(Math.max(0,h));this.V=0==d||d==g;c=b[0]-c;this.G=hu(this,a,b);b[0]<a.length&&";"==a.charAt(b[0])?(b[0]++,1!=this.g&&(this.s=!0),this.l=hu(this,a,b),b[0]+=c,this.F=hu(this,a,b)):(this.l+=this.u,this.F+=this.G)};
iu.prototype.parse=function(a,b){b=b||[0];a=a.replace(/ |\u202f/g,"\u00a0");var c=a.indexOf(this.u,b[0])==b[0],d=a.indexOf(this.l,b[0])==b[0];c&&d&&(this.u.length>this.l.length?d=!1:this.u.length<this.l.length&&(c=!1));c?b[0]+=this.u.length:d&&(b[0]+=this.l.length);if(a.indexOf(gu.Rj,b[0])==b[0]){b[0]+=gu.Rj.length;var e=Infinity}else{e=a;var f=!1,g=!1,h=!1,m=-1,q=1,r=gu.Wm,z=gu.Qj,D=gu.Zm;z=z.replace(/\u202f/g,"\u00a0");for(var C="";b[0]<e.length;b[0]++){var K=e.charAt(b[0]),T=ju(K);if(0<=T&&9>=
T)C+=T,h=!0;else if(K==r.charAt(0)){if(f||g)break;C+=".";f=!0}else if(K==z.charAt(0)&&("\u00a0"!=z.charAt(0)||b[0]+1<e.length&&0<=ju(e.charAt(b[0]+1)))){if(f||g)break}else if(K==D.charAt(0)){if(g)break;C+="E";g=!0;m=b[0]}else if("+"==K||"-"==K){if(h&&m!=b[0]-1)break;C+=K}else if(1==this.g&&K==gu.ln.charAt(0)){if(1!=q)break;q=100;if(h){b[0]++;break}}else if(1==this.g&&K==gu.mn.charAt(0)){if(1!=q)break;q=1E3;if(h){b[0]++;break}}else break}1!=this.g&&(q=this.g);e=parseFloat(C)/q}if(c){if(a.indexOf(this.G,
b[0])!=b[0])return NaN;b[0]+=this.G.length}else if(d){if(a.indexOf(this.F,b[0])!=b[0])return NaN;b[0]+=this.F.length}return d?-e:e};
iu.prototype.format=function(a){if(isNaN(a))return gu.Hs;var b=[];var c=ku;a=lu(a,-c.ru);var d=0>a||0==a&&0>1/a;d?c.tp?b.push(c.tp):(b.push(c.prefix),b.push(this.l)):(b.push(c.prefix),b.push(this.u));if(isFinite(a))if(a=a*(d?-1:1)*this.g,this.K)if(0==a)mu(this,a,this.h,b),nu(this,0,b);else{var e=Math.floor(Math.log(a)/Math.log(10)+2E-15);a=lu(a,-e);var f=this.h;1<this.D&&this.D>this.h?(f=e%this.D,0>f&&(f=this.D+f),a=lu(a,f),e-=f,f=1):1>this.h?(e++,a=lu(a,-1)):(e-=this.h-1,a=lu(a,this.h-1));mu(this,
a,f,b);nu(this,e,b)}else mu(this,a,this.h,b);else b.push(gu.Rj);d?c.up?b.push(c.up):(b.push(c.Ar),b.push(this.F)):(b.push(c.Ar),b.push(this.G));return b.join("")};
var mu=function(a,b,c,d){if(a.m>a.j)throw Error("Min value must be less than max value");d||(d=[]);var e=lu(b,a.j);e=Math.round(e);if(isFinite(e)){b=Math.floor(lu(e,-a.j));var f=Math.floor(e-lu(b,a.j))}else f=0;e=b;b=f;var g=e;f=b;var h=0<a.m||0<f||!1;e=a.m;h&&(e=a.m);var m="";for(b=g;1E20<b;)m="0"+m,b=Math.round(lu(b,-1));m=b+m;var q=gu.Wm;b=gu.Wj.charCodeAt(0);var r=m.length,z=0;if(0<g||0<c){for(g=r;g<c;g++)d.push(String.fromCharCode(b));if(2<=a.C.length)for(c=1;c<a.C.length;c++)z+=a.C[c];c=r-z;
if(0<c){g=a.C;z=r=0;for(var D,C=gu.Qj,K=m.length,T=0;T<K;T++)if(d.push(String.fromCharCode(b+1*Number(m.charAt(T)))),1<K-T)if(D=g[z],T<c){var da=c-T;(1===D||0<D&&1===da%D)&&d.push(C)}else z<g.length&&(T===c?z+=1:D===T-c-r+1&&(d.push(C),r+=D,z+=1))}else{c=m;m=a.C;g=gu.Qj;D=c.length;C=[];for(r=m.length-1;0<=r&&0<D;r--){z=m[r];for(K=0;K<z&&0<=D-K-1;K++)C.push(String.fromCharCode(b+1*Number(c.charAt(D-K-1))));D-=z;0<D&&C.push(g)}d.push.apply(d,C.reverse())}}else h||d.push(String.fromCharCode(b));(a.V||
h)&&d.push(q);h=String(f);f=h.split("e+");if(2==f.length){if(h=parseFloat(f[0])){q=h;if(isFinite(q)){for(c=0;1<=(q/=10);)c++;q=c}else q=0<q?q:0;q=0-q-1;h=-1>q?h&&isFinite(h)?lu(Math.round(lu(h,-1)),1):h:h&&isFinite(h)?lu(Math.round(lu(h,q)),-q):h}h=String(h);h=h.replace(".","");h+=Be("0",parseInt(f[1],10)-h.length+1)}a.j+1>h.length&&(h="1"+Be("0",a.j-h.length)+h);for(a=h.length;"0"==h.charAt(a-1)&&a>e+1;)a--;for(g=1;g<a;g++)d.push(String.fromCharCode(b+1*Number(h.charAt(g))))},nu=function(a,b,c){c.push(gu.Zm);
0>b?(b=-b,c.push(gu.fn)):a.N&&c.push(gu.Ms);b=""+b;for(var d=gu.Wj,e=b.length;e<a.H;e++)c.push(d);c.push(b)},ju=function(a){a=a.charCodeAt(0);if(48<=a&&58>a)return a-48;var b=gu.Wj.charCodeAt(0);return b<=a&&a<b+10?a-b:-1},hu=function(a,b,c){for(var d="",e=!1,f=b.length;c[0]<f;c[0]++){var g=b.charAt(c[0]);if("'"==g)c[0]+1<f&&"'"==b.charAt(c[0]+1)?(c[0]++,d+="'"):e=!e;else if(e)d+=g;else switch(g){case "#":case "0":case ",":case ".":case ";":return d;case "\u00a4":c[0]+1<f&&"\u00a4"==b.charAt(c[0]+
1)?(c[0]++,d+=gu.Xm):(g=gu.Xm,d+=g in eu?eu[g][1]:g);break;case "%":if(!a.s&&1!=a.g)throw Error("Too many percent/permill");if(a.s&&100!=a.g)throw Error("Inconsistent use of percent/permill characters");a.g=100;a.s=!1;d+=gu.ln;break;case "\u2030":if(!a.s&&1!=a.g)throw Error("Too many percent/permill");if(a.s&&1E3!=a.g)throw Error("Inconsistent use of percent/permill characters");a.g=1E3;a.s=!1;d+=gu.mn;break;default:d+=g}}return d},ku={ru:0,tp:"",up:"",prefix:"",Ar:""},lu=function(a,b){if(!a||!isFinite(a)||
0==b)return a;a=String(a).split("e");return parseFloat(a[0]+"e"+(parseInt(a[1]||0,10)+b))};var ou=function(a){return 1==a%10&&11!=a%100?"one":2==a%10&&12!=a%100?"two":3==a%10&&13!=a%100?"few":"other"},pu=ou;pu=ou;var qu=function(a,b){if(void 0===b){b=a+"";var c=b.indexOf(".");b=Math.min(-1==c?0:b.length-c-1,3)}return 1==(a|0)&&0==b?"one":"other"},ru=qu;ru=qu;var wu=function(){this.l=su;this.h=this.g=this.C=null;var a=gu,b=du;if(tu!==a||uu!==b)tu=a,uu=b,vu=new iu;this.m=vu},tu=null,uu=null,vu=null,xu=/'([{}#].*?)'/g,yu=/''/g;wu.prototype.format=function(a){if(this.l){this.C=[];var b=zu(this,this.l);this.h=Au(this,b);this.l=null}if(this.h&&0!=this.h.length)for(this.g=kc(this.C),b=[],Bu(this,this.h,a,!1,b),a=b.join("");0<this.g.length;)a=a.replace(this.j(this.g),this.g.pop());else a="";return a};
var Bu=function(a,b,c,d,e){for(var f=0;f<b.length;f++)switch(b[f].type){case 4:e.push(b[f].value);break;case 3:var g=b[f].value,h=a,m=e,q=c[g];void 0===q?m.push("Undefined parameter - "+g):(h.g.push(q),m.push(h.j(h.g)));break;case 2:g=b[f].value;h=a;m=c;q=d;var r=e,z=g.xi;void 0===m[z]?r.push("Undefined parameter - "+z):(z=g[m[z]],void 0===z&&(z=g.other),Bu(h,z,m,q,r));break;case 0:g=b[f].value;Cu(a,g,c,ru,d,e);break;case 1:g=b[f].value;Cu(a,g,c,pu,d,e);break;default:Mb("Unrecognized block type: "+
b[f].type)}},Cu=function(a,b,c,d,e,f){var g=b.xi,h=b.In,m=+c[g];isNaN(m)?f.push("Undefined or invalid parameter - "+g):(h=m-h,g=b[c[g]],void 0===g&&(d=d(Math.abs(h)),g=b[d],void 0===g&&(g=b.other)),b=[],Bu(a,g,c,e,b),c=b.join(""),e?f.push(c):(a=a.m.format(h),f.push(c.replace(/#/g,a))))},zu=function(a,b){var c=a.C,d=Ya(a.j,a);b=b.replace(yu,function(){c.push("'");return d(c)});return b=b.replace(xu,function(e,f){c.push(f);return d(c)})},Du=function(a){var b=0,c=[],d=[],e=/[{}]/g;e.lastIndex=0;for(var f;f=
e.exec(a);){var g=f.index;"}"==f[0]?(c.pop(),0==c.length&&(f={type:1},f.value=a.substring(b,g),d.push(f),b=g+1)):(0==c.length&&(b=a.substring(b,g),""!=b&&d.push({type:0,value:b}),b=g+1),c.push("{"))}b=a.substring(b);""!=b&&d.push({type:0,value:b});return d},Eu=/^\s*(\w+)\s*,\s*plural\s*,(?:\s*offset:(\d+))?/,Fu=/^\s*(\w+)\s*,\s*selectordinal\s*,/,Gu=/^\s*(\w+)\s*,\s*select\s*,/,Au=function(a,b){var c=[];b=Du(b);for(var d=0;d<b.length;d++){var e={};if(0==b[d].type)e.type=4,e.value=b[d].value;else if(1==
b[d].type){var f=b[d].value;switch(Eu.test(f)?0:Fu.test(f)?1:Gu.test(f)?2:/^\s*\w+\s*/.test(f)?3:5){case 2:e.type=2;e.value=Hu(a,b[d].value);break;case 0:e.type=0;e.value=Iu(a,b[d].value);break;case 1:e.type=1;e.value=Ju(a,b[d].value);break;case 3:e.type=3;e.value=b[d].value;break;default:Mb("Unknown block type for pattern: "+b[d].value)}}else Mb("Unknown part of the pattern.");c.push(e)}return c},Hu=function(a,b){var c="";b=b.replace(Gu,function(h,m){c=m;return""});var d={};d.xi=c;b=Du(b);for(var e=
0;e<b.length;){var f=b[e].value;e++;var g;1==b[e].type?g=Au(a,b[e].value):Mb("Expected block type.");d[f.replace(/\s/g,"")]=g;e++}return d},Iu=function(a,b){var c="",d=0;b=b.replace(Eu,function(m,q,r){c=q;r&&(d=parseInt(r,10));return""});var e={};e.xi=c;e.In=d;b=Du(b);for(var f=0;f<b.length;){var g=b[f].value;f++;var h;1==b[f].type?h=Au(a,b[f].value):Mb("Expected block type.");e[g.replace(/\s*(?:=)?(\w+)\s*/,"$1")]=h;f++}return e},Ju=function(a,b){var c="";b=b.replace(Fu,function(h,m){c=m;return""});
var d={};d.xi=c;d.In=0;b=Du(b);for(var e=0;e<b.length;){var f=b[e].value;e++;if(1==b[e].type)var g=Au(a,b[e].value);else Mb("Expected block type.");d[f.replace(/\s*(?:=)?(\w+)\s*/,"$1")]=g;e++}return d};wu.prototype.j=function(a){return"\ufddf_"+(a.length-1).toString(10)+"_"};var Ku=chrome.i18n.getMessage("1522140683318860351"),Lu=chrome.i18n.getMessage("4246483347873264186"),Mu=chrome.i18n.getMessage("5991427458288444010"),Oi=chrome.i18n.getMessage("6063910461797960050"),Nu=chrome.i18n.getMessage("7735695102441495789"),Ou=chrome.i18n.getMessage("4575332923598659024"),su=chrome.i18n.getMessage("2297080986956220930"),Pu=new wu;var Qu=function(a){this.g=a;this.o=eb("mr.cloud.mesi.MesiService")},Os=function(a){var b=ws(ms.g,["hangouts","search"]);a.o.info("Retrieving Hangouts from MESI: "+b);return xs(a.g,b,"POST",Ru).then(function(c){var d=[];c.result&&(d=c.result.map(function(e){var f=e.hangout,g=f.meeting_room_name,h;f.meeting_domain?h=f.meeting_domain:"BUSINESS"==f.type&&f.company_title&&(h=f.company_title.toLowerCase());var m=Pu.format({ORGANIZER:"",PARTICIPANTS:0});if((e=e.participant)&&0<e.length){var q=e[0].display_name;
m=e.reduce(function(r,z){r.add(z.user_id);"ORGANIZER"==z.role&&(q=z.display_name);return r},new Set);m=Pu.format({ORGANIZER:q,PARTICIPANTS:m.size})}return g&&h?new os(!1,g+"@"+h,h,g,m,f.hangout_id):new os(!1,f.hangout_id,h,g,m,f.hangout_id)}));return d})},Ru={request_header:{client_version:{client_id:"39"}},search_sources:["0"]};var Su=function(a,b){this.h=a;this.g=b},Vu=function(a,b,c,d){switch(b.type){case "REFRESH_AUTH":var e=d.ye,f=d.deviceId,g=d.bi;return bu(a.h).then(function(){Tu(a.g,new Zj("AUTH_READY",{ye:e,ib:f,bi:g}),c.id)});case "STATUS_REQUEST":return Tu(a.g,b,c.id),Promise.resolve();case "STATUS_RESPONSE":return Tu(a.g,b,c.id,!0),b.data.routeDescription||Tu(a.g,b,c.id),Promise.resolve();case "HANGOUT_INACTIVE":return Uu(a.g,c,4,Ri(new Ni(Nu,"warning"),c.sinkId));case "HANGOUT_INVALID":return Uu(a.g,c,3,Ri(new Ni(Ou,
"warning"),c.sinkId));default:return Promise.reject(Error("Unknown type: "+b.type))}};var Wu=function(a){var b=a.method,c=a.uri,d=a.bd,e=a.kd,f=a.qq,g=a.headers,h=a.body,m=a.start,q=a.apiKey,r=a.Uf;a=a.nb;this.method=b&&b.toUpperCase()||"GET";(b=c)||(d=[d].concat(p(e||[])).join("/"),d=new ur(encodeURI(d)),f&&(f=Kr(f),xr(d,f)),b=d);this.uri=b;q&&this.uri.h.add("key",q);this.g=a||null;this.headers=g||{};(this.body=h)&&(this.headers["Content-Type"]="application/json");this.Uf=void 0!==r?r:1E4;this.start=m||$a()},Xu=function(a){return(a.g?a.g.getAuthToken():Promise.resolve(null)).then(function(b){b&&
(a.headers.Authorization="Bearer "+b);b={method:a.method,headers:a.headers};a.body&&(b.body=JSON.stringify(a.body));return new Request(a.uri.toString(),b)})};var Yu={BD:100,QM:101,OK:200,CD:201,ACCEPTED:202,tI:203,GI:204,zK:205,jJ:206,fI:207,eI:300,bI:301,HE:302,NL:303,DI:304,tO:305,aN:307,vJ:308,Yr:400,XN:401,Ls:402,GE:403,NOT_FOUND:404,QH:405,wI:406,LJ:407,xK:408,pD:409,jF:410,PG:411,DJ:412,uK:413,yK:414,gO:415,wK:416,iE:417,dO:422,YG:423,kE:424,EJ:428,DN:429,vK:431,Bs:500,AI:501,mB:502,bM:503,WE:504,OF:505,eG:507,lI:511,UJ:1223};var Zu=function(a,b){Gb.call(this,b&&b.message||a.statusText);this.code=a.status;this.response=a;this.status=(this.g=b)&&b.status};t(Zu,Gb);var cv=function(a){if($u.has(a.code))return!0;var b=a.g||{};return a.g?av.has(b.status)?!0:!!(b.errors||[]).find(function(c){return bv.has(c)}):!1},dv=function(a,b){a=new Response(void 0,{status:b||408,statusText:a});return new Zu(a)},$u=new Set([400,401,403,404,405,406,501]),av=new Set(["PERMISSION_DENIED"]),bv=new Set("authError command_is_in_terminal_state forbidden notFound unmanaged_group_acl acl_entry_bad_scope network_error".split(" "));var ev=function(a){this.id=a};ev.prototype.toString=function(){return this.id};var W=function(a,b){this.type=a instanceof ev?String(a):a;this.h=this.target=b;this.defaultPrevented=!1};W.prototype.l=function(){this.defaultPrevented=!0};var fv=!Pe||9<=Number(of),gv=Pe&&!lf("9"),hv=function(){if(!Fa.addEventListener||!Object.defineProperty)return!1;var a=!1,b=Object.defineProperty({},"passive",{get:function(){a=!0}});try{Fa.addEventListener("test",Ma,b),Fa.removeEventListener("test",Ma,b)}catch(c){}return a}();var iv=function(a,b){W.call(this,a?a.type:"");this.relatedTarget=this.h=this.target=null;this.button=this.screenY=this.screenX=this.clientY=this.clientX=0;this.key="";this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1;this.state=null;this.pointerId=0;this.pointerType="";this.g=null;a&&this.init(a,b)};w(iv,W);var jv=Tf({2:"touch",3:"pen",4:"mouse"});
iv.prototype.init=function(a,b){var c=this.type=a.type,d=a.changedTouches&&a.changedTouches.length?a.changedTouches[0]:null;this.target=a.target||a.srcElement;this.h=b;(b=a.relatedTarget)?Re&&(Le(b,"nodeName")||(b=null)):"mouseover"==c?b=a.fromElement:"mouseout"==c&&(b=a.toElement);this.relatedTarget=b;d?(this.clientX=void 0!==d.clientX?d.clientX:d.pageX,this.clientY=void 0!==d.clientY?d.clientY:d.pageY,this.screenX=d.screenX||0,this.screenY=d.screenY||0):(this.clientX=void 0!==a.clientX?a.clientX:
a.pageX,this.clientY=void 0!==a.clientY?a.clientY:a.pageY,this.screenX=a.screenX||0,this.screenY=a.screenY||0);this.button=a.button;this.key=a.key||"";this.ctrlKey=a.ctrlKey;this.altKey=a.altKey;this.shiftKey=a.shiftKey;this.metaKey=a.metaKey;this.pointerId=a.pointerId||0;this.pointerType="string"===typeof a.pointerType?a.pointerType:jv[a.pointerType]||"";this.state=a.state;this.g=a;a.defaultPrevented&&this.l()};
iv.prototype.l=function(){iv.Kb.l.call(this);var a=this.g;if(a.preventDefault)a.preventDefault();else if(a.returnValue=!1,gv)try{if(a.ctrlKey||112<=a.keyCode&&123>=a.keyCode)a.keyCode=-1}catch(b){}};var kv="closure_listenable_"+(1E6*Math.random()|0),lv=function(a){return!(!a||!a[kv])},mv=0;var nv=function(a,b,c,d,e){this.listener=a;this.proxy=null;this.src=b;this.type=c;this.capture=!!d;this.Ad=e;this.key=++mv;this.removed=this.zi=!1},ov=function(a){a.removed=!0;a.listener=null;a.proxy=null;a.src=null;a.Ad=null};var pv=function(a){this.src=a;this.g={};this.h=0};pv.prototype.add=function(a,b,c,d,e){var f=a.toString();a=this.g[f];a||(a=this.g[f]=[],this.h++);var g=qv(a,b,d,e);-1<g?(b=a[g],c||(b.zi=!1)):(b=new nv(b,this.src,f,!!d,e),b.zi=c,a.push(b));return b};pv.prototype.remove=function(a,b,c,d){a=a.toString();if(!(a in this.g))return!1;var e=this.g[a];b=qv(e,b,c,d);return-1<b?(ov(e[b]),gc(e,b),0==e.length&&(delete this.g[a],this.h--),!0):!1};
var rv=function(a,b){var c=b.type;if(!(c in a.g))return!1;var d=fc(a.g[c],b);d&&(ov(b),0==a.g[c].length&&(delete a.g[c],a.h--));return d};pv.prototype.removeAll=function(a){a=a&&a.toString();var b=0,c;for(c in this.g)if(!a||c==a){for(var d=this.g[c],e=0;e<d.length;e++)++b,ov(d[e]);delete this.g[c];this.h--}return b};var sv=function(a,b,c,d,e){a=a.g[b.toString()];b=-1;a&&(b=qv(a,c,d,e));return-1<b?a[b]:null};
pv.prototype.hasListener=function(a,b){var c=void 0!==a,d=c?a.toString():"",e=void 0!==b;return Hc(this.g,function(f){for(var g=0;g<f.length;++g)if(!(c&&f[g].type!=d||e&&f[g].capture!=b))return!0;return!1})};var qv=function(a,b,c,d){for(var e=0;e<a.length;++e){var f=a[e];if(!f.removed&&f.listener==b&&f.capture==!!c&&f.Ad==d)return e}return-1};var tv="closure_lm_"+(1E6*Math.random()|0),uv={},vv=0,xv=function(a,b,c,d,e){if(d&&d.once)return wv(a,b,c,d,e);if(Array.isArray(b)){for(var f=0;f<b.length;f++)xv(a,b[f],c,d,e);return null}c=yv(c);return lv(a)?a.listen(b,c,Ra(d)?!!d.capture:!!d,e):zv(a,b,c,!1,d,e)},zv=function(a,b,c,d,e,f){if(!b)throw Error("Invalid event type");var g=Ra(e)?!!e.capture:!!e,h=Av(a);h||(a[tv]=h=new pv(a));c=h.add(b,c,d,g,f);if(c.proxy)return c;d=Bv();c.proxy=d;d.src=a;d.listener=c;if(a.addEventListener)hv||(e=g),void 0===
e&&(e=!1),a.addEventListener(b.toString(),d,e);else if(a.attachEvent)a.attachEvent(Cv(b.toString()),d);else if(a.addListener&&a.removeListener)a.addListener(d);else throw Error("addEventListener and attachEvent are unavailable.");vv++;return c},Bv=function(){var a=Dv,b=fv?function(c){return a.call(b.src,b.listener,c)}:function(c){c=a.call(b.src,b.listener,c);if(!c)return c};return b},wv=function(a,b,c,d,e){if(Array.isArray(b)){for(var f=0;f<b.length;f++)wv(a,b[f],c,d,e);return null}c=yv(c);return lv(a)?
Ev(a,b,c,Ra(d)?!!d.capture:!!d,e):zv(a,b,c,!0,d,e)},Fv=function(a,b,c,d,e){if(Array.isArray(b))for(var f=0;f<b.length;f++)Fv(a,b[f],c,d,e);else d=Ra(d)?!!d.capture:!!d,c=yv(c),lv(a)?a.V.remove(String(b),c,d,e):a&&(a=Av(a))&&(b=sv(a,b,c,d,e))&&Gv(b)},Gv=function(a){if("number"===typeof a||!a||a.removed)return!1;var b=a.src;if(lv(b))return rv(b.V,a);var c=a.type,d=a.proxy;b.removeEventListener?b.removeEventListener(c,d,a.capture):b.detachEvent?b.detachEvent(Cv(c),d):b.addListener&&b.removeListener&&
b.removeListener(d);vv--;(c=Av(b))?(rv(c,a),0==c.h&&(c.src=null,b[tv]=null)):ov(a);return!0},Hv=function(a){if(a)if(lv(a))a.am(void 0);else if(a=Av(a)){var b=0,c;for(c in a.g)for(var d=a.g[c].concat(),e=0;e<d.length;++e)Gv(d[e])&&++b}},Cv=function(a){return a in uv?uv[a]:uv[a]="on"+a},Jv=function(a,b,c,d){var e=!0;if(a=Av(a))if(b=a.g[b.toString()])for(b=b.concat(),a=0;a<b.length;a++){var f=b[a];f&&f.capture==c&&!f.removed&&(f=Iv(f,d),e=e&&!1!==f)}return e},Iv=function(a,b){var c=a.listener,d=a.Ad||
a.src;a.zi&&Gv(a);return c.call(d,b)},Dv=function(a,b){if(a.removed)return!0;if(!fv){var c=b||La("window.event");b=new iv(c,this);var d=!0;if(!(0>c.keyCode||void 0!=c.returnValue)){a:{var e=!1;if(0==c.keyCode)try{c.keyCode=-1;break a}catch(g){e=!0}if(e||void 0==c.returnValue)c.returnValue=!0}c=[];for(e=b.h;e;e=e.parentNode)c.push(e);a=a.type;for(e=c.length-1;0<=e;e--){b.h=c[e];var f=Jv(c[e],a,!0,b);d=d&&f}for(e=0;e<c.length;e++)b.h=c[e],f=Jv(c[e],a,!1,b),d=d&&f}return d}return Iv(a,new iv(b,this))},
Av=function(a){a=a[tv];return a instanceof pv?a:null},Kv="__closure_events_fn_"+(1E9*Math.random()>>>0),yv=function(a){if("function"===typeof a)return a;a[Kv]||(a[Kv]=function(b){return a.handleEvent(b)});return a[Kv]};var Lv=function(){V.call(this);this.V=new pv(this);this.pi=this;this.F=null};w(Lv,V);Lv.prototype[kv]=!0;k=Lv.prototype;k.addEventListener=function(a,b,c,d){xv(this,a,b,c,d)};k.removeEventListener=function(a,b,c,d){Fv(this,a,b,c,d)};
k.O=function(a){var b,c=this.F;if(c)for(b=[];c;c=c.F)b.push(c);c=this.pi;var d=a.type||a;if("string"===typeof a)a=new W(a,c);else if(a instanceof W)a.target=a.target||c;else{var e=a;a=new W(d,c);Uc(a,e)}e=!0;if(b)for(var f=b.length-1;0<=f;f--){var g=a.h=b[f];e=g.qg(d,!0,a)&&e}g=a.h=c;e=g.qg(d,!0,a)&&e;e=g.qg(d,!1,a)&&e;if(b)for(f=0;f<b.length;f++)g=a.h=b[f],e=g.qg(d,!1,a)&&e;return e};k.ba=function(){Lv.Kb.ba.call(this);this.am();this.F=null};
k.listen=function(a,b,c,d){return this.V.add(String(a),b,!1,c,d)};var Ev=function(a,b,c,d,e){return a.V.add(String(b),c,!0,d,e)};Lv.prototype.am=function(a){this.V&&this.V.removeAll(a)};Lv.prototype.qg=function(a,b,c){a=this.V.g[String(a)];if(!a)return!0;a=a.concat();for(var d=!0,e=0;e<a.length;++e){var f=a[e];if(f&&!f.removed&&f.capture==b){var g=f.listener,h=f.Ad||f.src;f.zi&&rv(this.V,f);d=!1!==g.call(h,c)&&d}}return d&&!c.defaultPrevented};
Lv.prototype.hasListener=function(a,b){return this.V.hasListener(void 0!==a?String(a):void 0,b)};var Mv=function(a,b){Lv.call(this);this.j=a||1;this.h=b||Fa;this.l=Ya(this.s,this);this.m=$a()};w(Mv,Lv);Mv.prototype.enabled=!1;Mv.prototype.g=null;var Nv=function(a,b){a.j=b;a.g&&a.enabled?(a.stop(),a.start()):a.g&&a.stop()};Mv.prototype.s=function(){if(this.enabled){var a=$a()-this.m;0<a&&a<.8*this.j?this.g=this.h.setTimeout(this.l,this.j-a):(this.g&&(this.h.clearTimeout(this.g),this.g=null),this.O("tick"),this.enabled&&(this.stop(),this.start()))}};
Mv.prototype.start=function(){this.enabled=!0;this.g||(this.g=this.h.setTimeout(this.l,this.j),this.m=$a())};Mv.prototype.stop=function(){this.enabled=!1;this.g&&(this.h.clearTimeout(this.g),this.g=null)};Mv.prototype.ba=function(){Mv.Kb.ba.call(this);this.stop();delete this.h};
var Ov=function(a,b,c){if("function"===typeof a)c&&(a=Ya(a,c));else if(a&&"function"==typeof a.handleEvent)a=Ya(a.handleEvent,a);else throw Error("Invalid listener argument");return 2147483647<Number(b)?-1:Fa.setTimeout(a,b||0)},Pv=function(a){Fa.clearTimeout(a)},Qv=function(a,b){var c=null;return Dt(new nt(function(d,e){c=Ov(function(){d(b)},a);-1==c&&e(Error("Failed to schedule timer."))}),function(d){Pv(c);throw d;})};var Rv=function(){var a=void 0===a?!0:a;this.o=jg("mr.cloud.slarti.Fetcher");this.g=0;this.h=a};Rv.prototype.execute=function(a){var b=this,c="Fetch call "+ ++this.g,d=new yf(function(){return Sv(b,c,a,function(e){return d.abort(e)})},1E3,this.h?5:1);return d.start()};
var Sv=function(a,b,c,d){var e=c.uri.toString().replace(/\?.*/,"?<redacted>"),f=c.method+" "+e;og(a.o,b+": "+f);e=[Xu(c).then(function(g){return Promise.resolve(fetch(g))})];c.Uf&&e.push(Qv(c.Uf).then(function(){throw dv("API call timed out",504);}));return Promise.race(e).then(function(g){if(!g.ok)return g.json().then(function(m){return m},function(){return null}).then(function(m){var q;m&&m instanceof Object&&m.error&&(q=m.error);throw new Zu(g,q);});var h=($a()-c.start)/1E3;og(a.o,b+" succeeded: "+
f+" duration = "+h+"s");return(h=g.headers.get("content-type"))&&h.includes("application/json")?g.json():h&&(h.includes("image")||h.includes("application/octet-stream"))?g.blob():g.text()},function(g){var h="";if(g instanceof Zu)h=", ("+g.status+"): "+g.message,cv(g)&&d(g);else{try{h=", "+JSON.stringify(g,null,2)}catch(m){}g instanceof Error&&"Failed to fetch"==g.message&&(g=dv(g.message))}lg(a.o,b+" failed: "+h);throw g;})};var Tv=function(a,b){this.g=ks.g;this.nb=a;this.h=b};var Uv=new Map([["status","status"],["results","result"],["expirationTime","expiration_time"]]),Vv=function(a,b){Tv.call(this,a,b);this.o=jg("mr.cloud.slarti.CommandsService")};t(Vv,Tv);Vv.prototype.get=function(a){a=new Wu({method:"GET",bd:this.g,kd:["commands",a],nb:this.nb});return this.h.execute(a).then(function(b){return b})};
Vv.prototype.list=function(a){a=new Wu({method:"GET",bd:this.g,kd:["commands"],qq:{deviceId:a},nb:this.nb});return this.h.execute(a).then(function(b){return b.command||[]})};Vv.prototype.send=function(a,b){var c=this;a=new Wu({method:"POST",bd:this.g,kd:["commands:send"],nb:this.nb,body:{command:b,deviceId:a}});return this.h.execute(a).then(function(d){og(c.o,"Sent Slarti command with ID "+d.id);return d})};
Vv.prototype.update=function(a,b){for(var c=[],d={},e=n(Uv.keys()),f=e.next();!f.done;f=e.next())f=f.value,b[f]&&(d[f]=b[f],c.push(Uv.get(f)));d.id=a;a=new Wu({method:"PUT",bd:this.g,kd:["commands",a],nb:this.nb,body:{command:d,updateMask:c}});return this.h.execute(a).then(function(g){return g})};var Wv=Fa.JSON.parse;var Xv=function(){};Xv.prototype.g=null;var Zv=function(a){var b;(b=a.g)||(b={},Yv(a)&&(b[0]=!0,b[1]=!0),b=a.g=b);return b};var $v,aw=function(){};w(aw,Xv);var bw=function(a){return(a=Yv(a))?new ActiveXObject(a):new XMLHttpRequest},Yv=function(a){if(!a.h&&"undefined"==typeof XMLHttpRequest&&"undefined"!=typeof ActiveXObject){for(var b=["MSXML2.XMLHTTP.6.0","MSXML2.XMLHTTP.3.0","MSXML2.XMLHTTP","Microsoft.XMLHTTP"],c=0;c<b.length;c++){var d=b[c];try{return new ActiveXObject(d),a.h=d}catch(e){}}throw Error("Could not create ActiveXObject. ActiveX might be disabled, or MSXML might not be installed");}return a.h};$v=new aw;var cw=function(a){Lv.call(this);this.headers=new Zm;this.Y=a||null;this.h=!1;this.W=this.g=null;this.oa=this.K="";this.m=0;this.j="";this.l=this.ja=this.H=this.ea=!1;this.s=0;this.D=null;this.u="";this.N=this.G=!1};w(cw,Lv);cw.prototype.o=jg("goog.net.XhrIo");var dw=/^https?$/i,ew=["POST","PUT"],fw=[],gw=function(a,b,c,d,e,f,g){var h=new cw;fw.push(h);b&&h.listen("complete",b);Ev(h,"ready",h.qa);f&&(h.s=Math.max(0,f));g&&(h.G=g);h.send(a,c,d,e);return h};
cw.prototype.qa=function(){this.dispose();fc(fw,this)};
cw.prototype.send=function(a,b,c,d){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.K+"; newUri="+a);b=b?b.toUpperCase():"GET";this.K=a;this.j="";this.m=0;this.oa=b;this.ea=!1;this.h=!0;this.g=this.Y?bw(this.Y):bw($v);this.W=this.Y?Zv(this.Y):Zv($v);this.g.onreadystatechange=Ya(this.sa,this);try{pg(this.o,hw(this,"Opening Xhr")),this.ja=!0,this.g.open(b,String(a),!0),this.ja=!1}catch(f){pg(this.o,hw(this,"Error opening Xhr: "+f.message));iw(this,f);return}a=c||
"";var e=this.headers.clone();d&&Sn(d,function(f,g){e.set(g,f)});d=Xb(e.Ub(),jw);c=Fa.FormData&&a instanceof Fa.FormData;!$b(ew,b)||d||c||e.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");e.forEach(function(f,g){this.g.setRequestHeader(g,f)},this);this.u&&(this.g.responseType=this.u);"withCredentials"in this.g&&this.g.withCredentials!==this.G&&(this.g.withCredentials=this.G);try{kw(this),0<this.s&&(this.N=lw(this.g),pg(this.o,hw(this,"Will abort after "+this.s+"ms if incomplete, xhr2 "+
this.N)),this.N?(this.g.timeout=this.s,this.g.ontimeout=Ya(this.hi,this)):this.D=Ov(this.hi,this.s,this)),pg(this.o,hw(this,"Sending request")),this.H=!0,this.g.send(a),this.H=!1}catch(f){pg(this.o,hw(this,"Send error: "+f.message)),iw(this,f)}};var lw=function(a){return Pe&&lf(9)&&"number"===typeof a.timeout&&void 0!==a.ontimeout},jw=function(a){return sd("Content-Type",a)};
cw.prototype.hi=function(){"undefined"!=typeof Ea&&this.g&&(this.j="Timed out after "+this.s+"ms, aborting",this.m=8,pg(this.o,hw(this,this.j)),this.O("timeout"),this.abort(8))};var iw=function(a,b){a.h=!1;a.g&&(a.l=!0,a.g.abort(),a.l=!1);a.j=b;a.m=5;mw(a);nw(a)},mw=function(a){a.ea||(a.ea=!0,a.O("complete"),a.O("error"))};cw.prototype.abort=function(a){this.g&&this.h&&(pg(this.o,hw(this,"Aborting")),this.h=!1,this.l=!0,this.g.abort(),this.l=!1,this.m=a||7,this.O("complete"),this.O("abort"),nw(this))};
cw.prototype.ba=function(){this.g&&(this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1),nw(this,!0));cw.Kb.ba.call(this)};cw.prototype.sa=function(){this.C()||(this.ja||this.H||this.l?ow(this):this.Aa())};cw.prototype.Aa=function(){ow(this)};
var ow=function(a){if(a.h&&"undefined"!=typeof Ea)if(a.W[1]&&4==pw(a)&&2==a.Ha())pg(a.o,hw(a,"Local request error detected and ignored"));else if(a.H&&4==pw(a))Ov(a.sa,0,a);else if(a.O("readystatechange"),4==pw(a)){pg(a.o,hw(a,"Request complete"));a.h=!1;try{qw(a)?(a.O("complete"),a.O("success")):(a.m=6,a.j=rw(a)+" ["+a.Ha()+"]",mw(a))}finally{nw(a)}}},nw=function(a,b){if(a.g){kw(a);var c=a.g,d=a.W[0]?Ma:null;a.g=null;a.W=null;b||a.O("ready");try{c.onreadystatechange=d}catch(e){lg(a.o,"Problem encountered resetting onreadystatechange: "+
e.message)}}},kw=function(a){a.g&&a.N&&(a.g.ontimeout=null);a.D&&(Pv(a.D),a.D=null)},qw=function(a){var b=a.Ha();a:switch(b){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:var c=!0;break a;default:c=!1}if(!c){if(b=0===b)a=String(a.K).match(er)[1]||null,!a&&Fa.self&&Fa.self.location&&(a=Fa.self.location.protocol,a=a.substr(0,a.length-1)),b=!dw.test(a?a.toLowerCase():"");c=b}return c},pw=function(a){return a.g?a.g.readyState:0};
cw.prototype.Ha=function(){try{return 2<pw(this)?this.g.status:-1}catch(a){return-1}};
var rw=function(a){try{return 2<pw(a)?a.g.statusText:""}catch(b){return pg(a.o,"Can not get status: "+b.message),""}},sw=function(a){try{return a.g?a.g.responseText:""}catch(b){return pg(a.o,"Can not get responseText: "+b.message),""}},tw=function(a){if(a.g)return Wv(a.g.responseText)},uw=function(a){try{if(!a.g)return null;if("response"in a.g)return a.g.response;switch(a.u){case "":case "text":return a.g.responseText;case "arraybuffer":if("mozResponseArrayBuffer"in a.g)return a.g.mozResponseArrayBuffer}lg(a.o,
"Response type "+a.u+" is not supported on this browser");return null}catch(b){return pg(a.o,"Can not get response: "+b.message),null}};cw.prototype.getResponseHeader=function(a){if(this.g&&4==pw(this))return a=this.g.getResponseHeader(a),null===a?void 0:a};
var vw=function(a){var b={};a=(a.g&&4==pw(a)?a.g.getAllResponseHeaders()||"":"").split("\r\n");for(var c=0;c<a.length;c++)if(!td(a[c])){var d=Fe(a[c],":",1),e=d[0];d=d[1];if("string"===typeof d){d=d.trim();var f=b[e]||[];b[e]=f;f.push(d)}}return Gc(b,function(g){return g.join(", ")})},hw=function(a,b){return b+" ["+a.oa+" "+a.K+" "+a.Ha()+"]"};var ww=function(){this.o=eb("mr.cloud.CredentialService")},zw=function(a){var b=new Fb,c=ns.g+"/iceconfig?key="+ns.h;a.o.info("Requesting TURN credentials from "+c);var d=gw(c,function(){qw(d)?(a.o.info("Got TURN credentials: "+sw(d)),b.resolve(xw(a,tw(d)))):b.resolve(yw(a))},"POST",void 0,{"Content-Type":"application/json"});return b.promise},xw=function(a,b){try{var c=[];b.iceServers.forEach(function(d){d.urls.forEach(function(e){0==e.indexOf("turn:")&&c.push({url:e,credential:d.credential,username:d.username})})});
return c}catch(d){return a.o.error("Error parsing TURN credentials.",d),[]}},yw=function(a){a.o.error("XHR failed fetching TURN credentials.",null);return[]};var Aw=function(a,b,c){this.o=eb("mr.cloud.slarti.MessageHandler");this.j=a;this.l=b;this.g=c;this.h=new Map},Bw=function(a){if(Fj(a.mediaSource))return Promise.resolve({title:"screen"});var b=a.yb&&a.yb.tabId;return null==b?Promise.resolve({title:"",url:""}):new Promise(function(c){chrome.tabs.get(b,function(d){c({title:d&&d.title||"",url:d&&d.url||""})})})},Cw=function(a,b,c,d){var e=d.deviceId,f=b.data;return Bw(c).then(function(g){g={id:null,issuer:null,name:"stream",status:null,results:null,
expirationTime:null,parameters:JSON.stringify({info:g,sessionDescription:f.description,mediaConstraints:f.mediaConstraints,settings:f.settings})};return a.j.send(e,g).then(function(h){return new Promise(function(m,q){a.h.set(h.id,{routeId:c.id,sinkId:d.id,resolve:m,reject:q,bx:"PENDING_APPROVAL"==h.status})})},function(){var h=a.g,m=c.id,q=new Ni(Ku,"warning");q.isBlocking=!0;Uu(h,m,7,Ri(Qi(q,c.id),d.id))})})},Dw=function(a,b){return zw(a.l).then(function(c){Tu(a.g,new Zj("TURN_CREDENTIALS",{credentials:c}),
b.id)})};var Ew=function(a,b,c){this.h=a;this.j=b;this.g=c},Fw=function(a,b,c,d,e){return new Promise(function(f){switch(b){case "slarti":case "mesi":break;default:throw Error("Unrecognized channel type: "+b);}if(!c.type)throw Error("Message has no type");switch(c.type){case "STOP":f(Uu(a.g,d,1,null));return;case "SESSION_START_SUCCESS":hs(0);break;case "SESSION_END":break;case "SESSION_FAILURE":hs(1);f(Uu(a.g,d,2,Ri(new Ni(Ku,"warning"),d?d.sinkId:"")));return;case "__webrtc_stats__":break;case "PRESENTATION_CONNECTION_MESSAGE":Tu(a.g,
c.data,d.id,!0);break;case "OFFER":switch(b){case "slarti":f(Cw(a.h,c,d,e));return;default:throw Error("Unexpected channel type: "+b);}case "GET_TURN_CREDENTIALS":switch(b){case "slarti":f(Dw(a.h,d));return;default:throw Error("Unexpected channel type: "+b);}case "REFRESH_AUTH":case "LOCAL_PRESENT":case "MUTE":case "STATUS_REQUEST":case "STATUS_RESPONSE":case "HANGOUT_INACTIVE":case "HANGOUT_INVALID":f(Vu(a.j,c,d,e));return;case "new_session":Tu(a.g,c,d.id,!0);break;case "remove_session":Tu(a.g,c,
d.id,!0);a.g.terminateRoute(d.id);break;default:throw Error("Unknown type: "+c.type);}f()})};var Gw=function(){var a=this;this.o=eb("mr.cloud.settings.SettingsService");this.g=null;chrome.settingsPrivate.onPrefsChanged.addListener(function(b){Bj(13);if(a.g){b=n(b);for(var c=b.next();!c.done;c=b.next())if(c=c.value,"media_router.cloudservices.enabled"==c.key){Eb(5);a.g.call(null,c.value);break}}})},Hw=function(a,b){a.g=b},Iw=function(){return new Promise(function(a,b){chrome.storage.sync.get("mr.cloud.notifiedHangouts",function(c){chrome.runtime.lastError?b(chrome.runtime.lastError):a(c)})})},
Kw=function(a){return Jw().catch(function(){return Jw().catch(function(b){a.o.L("Error retrieving cloud enabled setting.",b);return!1})})},Jw=function(){return Lw().then(function(a){return!!a.value})},Lw=function(){return new Promise(function(a,b){chrome.settingsPrivate.getPref("media_router.cloudservices.enabled",function(c){chrome.runtime.lastError?b(chrome.runtime.lastError):a(c)})})},Mw=function(a){var b=a.o;chrome.storage.sync.set({"mr.cloud.notifiedHangouts":!0},function(){chrome.runtime.lastError&&
b.L("Error setting notified Hangout privacy.",chrome.runtime.lastError)})},Ow=function(a){return Nw().catch(function(){return Nw().catch(function(b){a.o.L("Error retrieving hangouts notified setting.",b);return!1})})},Nw=function(){return Iw().then(function(a){return!!a["mr.cloud.notifiedHangouts"]})};var Pw=new Map([["displayName","display_name"],["description","description"],["type","type"],["status","status"],["state","state"],["commandDefs","command_defs"]]),Qw=function(a,b){Tv.call(this,a,b)};t(Qw,Tv);k=Qw.prototype;k.act=function(a,b){a=new Wu({method:"POST",bd:this.g,kd:["devices:act"],nb:this.nb,body:{gcmId:b,id:a}});return this.h.execute(a).then(function(c){return c})};k.create=function(a){a=new Wu({method:"POST",bd:this.g,kd:["devices"],nb:this.nb,body:a});return this.h.execute(a).then(function(b){return b})};
k.delete=function(a){a=new Wu({method:"DELETE",bd:this.g,kd:["devices",a],nb:this.nb});return this.h.execute(a)};k.get=function(a){a=new Wu({method:"GET",bd:this.g,kd:["devices",a],nb:this.nb});return this.h.execute(a).then(function(b){return b})};k.list=function(a){var b=a.type,c=a.status;a=a.permission;var d={};b&&(d.type=b);c&&(d.status=c);a&&(d.permission=a);b=new Wu({method:"GET",bd:this.g,kd:["devices"],qq:d,nb:this.nb});return this.h.execute(b).then(function(e){return e.device||[]})};
k.update=function(a,b){for(var c=[],d={},e=n(Pw.keys()),f=e.next();!f.done;f=e.next())f=f.value,b[f]&&(d[f]=b[f],c.push(Pw.get(f)));d.id=a;a=new Wu({method:"PUT",bd:this.g,kd:["devices",a],nb:this.nb,body:{device:d,updateMask:c}});return this.h.execute(a).then(function(g){return g})};var Rw=function(a,b){Tv.call(this,a,b)};t(Rw,Tv);Rw.prototype.register=function(a){a=new Wu({method:"POST",bd:this.g,kd:["user:register"],nb:this.nb,body:{gcmId:a}});return this.h.execute(a)};Rw.prototype.unregister=function(a){a=new Wu({method:"POST",bd:this.g,kd:["user:unregister"],nb:this.nb,body:{gcmId:a}});return this.h.execute(a)};var Sw=function(a){var b=window.localStorage;this.o=eb("mr.cloud.slarti.GcmRegistration");this.j=a;this.h=b;this.g=null},Uw=function(a){if(!a.g){var b=a.h["mr.cloud.slarti.GcmRegistration.ID"];a.g=new Promise(function(c,d){return chrome.gcm.register(["307539924703"],function(e){a.g=null;if(e)if(e==b)mb(a.o,"Slarti GCM ID unchanged: "+e),c();else{mb(a.o,"Got new Slarti GCM ID: "+e);var f=b?Tw(a,b):Promise.resolve();c(f.then(function(){return a.j.register(e).then(function(){a.h["mr.cloud.slarti.GcmRegistration.ID"]=
e})}))}else f=chrome.runtime.lastError&&chrome.runtime.lastError.message||"unknown error",a.o.L("Error registering for GCM notifications: "+f),b&&Tw(a,b),d(Error(f))})})}return a.g},Tw=function(a,b){return a.j.unregister(b).then(function(){delete a.h["mr.cloud.slarti.GcmRegistration.ID"]},function(c){a.o.L("Failed to unregister GCM ID with Slarti",c)})};var Vw=null,Ww=function(){Up.call(this,5,"mr.cloud.slarti.GcmEventListener","mr.cloud.slarti.SinkDiscoveryService",chrome.gcm.onMessage);this.o=eb("mr.cloud.slarti.GcmEventListener")};t(Ww,Up);Ww.prototype.Mj=function(a){if(a&&"307539924703"==a.from&&"object"==typeof a.data&&"string"==typeof a.data.data){var b=JSON.parse(a.data.data);a=b.type;b=b.id;if(a)return this.o.info("Received Slarti GCM notification: "+a+" ("+b+")"),!0}return!1};var Xw=function(){null==Vw&&(Vw=new Ww);return Vw};var Yw=function(a,b,c,d,e,f){f=void 0===f?null:f;this.o=eb("mr.cloud.slarti.SinkDiscoveryService");this.u=a;this.C=b;this.l=c;this.s=d;this.m=e;this.g=f||new Bs(this.F.bind(this),c,36E5);Xw().addListener();vm(this);yj("mr.cloud.slarti.SinkDiscoveryService",this)};t(Yw,oj);Yw.prototype.j=function(){Uw(this.m).catch(function(){});return this.g.j().filter(function(a){return a.isAvailable})};Yw.prototype.h=function(a){return this.g.h(a)};
Yw.prototype.handleEvent=function(a,b){if(a!=chrome.gcm.onMessage)throw Error("Unhandled event: expected chrome.gcm.onMessage");Zw(this,b)};
var Zw=function(a,b){var c=JSON.parse(b.data.data);a.o.info("Received Slarti GCM notification: "+c.type);mb(a.o,function(){return"Got notification: "+JSON.stringify(c)});switch(c.type){case "DEVICE_ADDED":$w(a,c).then(function(d){"cast-receiver"==d.type&&(d=new As(d.id,d.displayName,"ONLINE"==d.status),a.g.g.set(d.id,d),Fs(a.l,[d.Pb]))});break;case "DEVICE_CHANGED":$w(a,c).then(function(d){if("cast-receiver"==d.type){var e=Om(Nm(),d.id);if(e=a.g.h(e))e.displayName=d.displayName,e.isAvailable="ONLINE"==
d.status,Gs(a.l,[e.Pb])}});break;case "DEVICE_REMOVED":ax(a,bx(c));Promise.resolve();break;case "COMMAND_CHANGED":cx(a,c).then(function(d){var e=a.s,f=d.id,g=e.h.get(f);if(g){var h=g.routeId,m=g.sinkId,q=g.resolve,r=g.reject,z=g.bx;g=!0;try{var D=JSON.parse(d.results||"{}"),C=D.sessionDescription,K=D.errorCode,T=D.errorText;switch(d.status){case "SUCCESS":q(Tu(e.g,new Zj("ANSWER",C),h));z&&gs(0);break;case "ERROR":case "TIMEOUT":var da="TIMEOUT"==d.status;q=Ku;"KNOCK_DENIED"==K&&(gs(da?2:1),q=da?
Mu:Lu);var Ka=e.g,fb=new Ni(q,"warning");fb.isBlocking=!0;Uu(Ka,h,7,Ri(Qi(fb,h),m));throw Error("Slarti command "+f+" failed with status: "+(d.status+", errorCode: "+K+", errorText: ")+T);default:g=!1}}catch(Oa){r(Oa)}finally{g&&e.h.delete(f)}}else e.o.L("Received update to unknown command with name = "+(d.name+" and id = "+f))});break;default:Promise.resolve()}};
Yw.prototype.F=function(){return this.C.list({type:"cast-receiver"}).then(function(a){return a.map(function(b){return new As(b.id,b.displayName,"ONLINE"==b.status)})})};Yw.prototype.Ya=function(){return"SlartiSinkDiscoveryService"};Yw.prototype.Ob=function(){return[{cache:Js(this.g)}]};Yw.prototype.Nb=function(){var a=sm(this);a&&Ks(this.g,a.cache)};
var ax=function(a,b){b=Om(Nm(),b);var c=a.g.h(b);c&&(a.g.g.delete(b),Hs(a.l,[c.Pb]))},bx=function(a){a=a.deviceInfo;return a.device?a.device.id:a.deviceId},$w=function(a,b){b=b.deviceInfo;return b.device?Promise.resolve(b.device):a.C.get(b.deviceId)},cx=function(a,b){b=b.commandInfo;return b.command?Promise.resolve(b.command):a.u.get(b.commandId)};var dx=function(){this.g=null},ex=function(a,b){if(!a.g||M(a.g,2)<M(b,2))a.g=Ul(b)},fx=function(a){return a.g?M(a.g,2)+";"+M(a.g,1):null};var gx=function(){this.C=this.H=this.D=this.F=this.u=this.j=this.h=this.l=this.N=this.G=this.W=this.Y=this.V=this.K=this.m=this.s=this.g=null},hx=function(){var a=gx.Tb();null==a.C&&(a.C=new dx);return a.C},ix=function(a){null==a.g&&(a.g=new au);return a.g},jx=function(a){null==a.s&&(a.s=new Tt(ix(a)));return a.s},kx=function(a){null==a.m&&(a.m=new Rv);return a.m},lx=function(a){null==a.K&&(a.K=new Vv(ix(a),kx(a)));return a.K},mx=function(a,b){if(null==a.G){var c=lx(a);null==a.H&&(a.H=new ww(jx(a)));
a.G=new Aw(c,a.H,b)}return a.G};Na(gx);var qx=function(a,b){this.j=a;this.m=b;this.C=new Fb;this.ca=this.C.promise;this.g=nx(a.id);this.h=new Fb;this.l=!1;ox(this);px(this);this.g.sendMessage(new Zj("GET_TURN_CREDENTIALS"))};qx.prototype.start=function(){var a=this;return this.ca.then(function(b){if(b.g)return Promise.reject(Error("Presentation already started"));b.start();return a.h.promise})};qx.prototype.stop=function(){var a=this;this.l=!1;return this.ca.then(function(b){b.stop();a.ca=Promise.reject(Error("Peer connection has already been stopped"))})};
var ox=function(a){a.g.onMessage=function(b){if(b.type)switch(b.type){case "TURN_CREDENTIALS":a.C.resolve(new ek(a.j.id,b.data.credentials));break;case "ANSWER":a.ca.then(function(c){mk(c,b.data)});break;case "STOP":a.h.reject("Stop signal received");a.stop();break;default:throw Error("Unknown message type: "+b.type);}else a.ca.then(function(c){var d={type:"PRESENTATION_CONNECTION_MESSAGE",data:b};"string"==typeof d?c.l.send(d):c.l.send(JSON.stringify(d))})}},px=function(a){a.ca.then(function(b){ik(b,
function(c){a.g.sendMessage(new Zj("OFFER",new bk(c,null,null,a.m,a.j.id)))});jk(b,function(c){c=ak(c);"STOP"==c.type&&a.stop();a.g.sendMessage(c)});fk(b,function(){a.l=!0;a.g.sendMessage(new Zj("SESSION_START_SUCCESS"));a.h.resolve(a.j)});hk(b,function(){a.g.sendMessage(new Zj("SESSION_END"))});gk(b,function(c){a.l||a.h.reject(c);a.g.sendMessage(new Zj("SESSION_FAILURE"))})})};var rx=function(a){this.g=a;this.h=new Map;this.G=new Map;this.H=new Map;this.u=[];this.s=this.K=this.D=this.l=null;this.C=this.j=!1;this.F=new Map;this.m=new Map;vm(this)};rx.prototype.getName=function(){return"cloud"};
rx.prototype.rp=function(){var a=this;this.o.info("Initializing Cloud MRP");var b=gx.Tb();if(Date.now()<sx){if(null==b.W){var c=lx(b);null==b.V&&(b.V=new Qw(ix(b),kx(b)));var d=b.V,e=mx(b,this);null==b.N&&(null==b.Y&&(b.Y=new Rw(ix(b),kx(b))),b.N=new Sw(b.Y));b.W=new Yw(c,d,this,e,b.N)}this.u.push(b.W);mx(b,this)}null==b.j&&(null==b.h&&(b.h=new qs(jx(b),ix(b))),c=b.h,null==b.l&&(b.l=new Qu(jx(b))),b.j=new Ns(c,b.l,this));this.l=b.j;this.u.push(this.l);this.D=ix(b);null==b.F&&(c=mx(b,this),null==b.u&&
(b.u=new Su(ix(b),this)),b.F=new Ew(c,b.u,this));this.K=b.F;null==b.D&&(b.D=new Gw);this.s=b.D;Kw(this.s).then(function(f){a.j=f;a.o.info("Cloud enabled setting: "+a.j)});Hw(this.s,function(f){a.j=f;a.o.info("Cloud enabled setting: "+a.j);a.j&&tx(a)});Ow(this.s).then(function(f){a.C=f;a.o.info("Privacy notified setting: "+a.C)})};rx.prototype.Vi=function(){return Array.from(this.h.values())};
rx.prototype.ro=function(a){if(!ux(this,a)||-1!=a.indexOf("0F5096E8"))return Lq;mb(this.o,"GetAvailableSinks for "+a);var b=tx(this);this.m.clear();for(var c={},d=n(this.F.values()),e=d.next();!e.done;c={bg:c.bg,mi:c.mi},e=d.next())c.bg=e.value,c.mi=!1,b.forEach(function(f){return function(g){g.id==f.bg.Pb.id&&(f.mi=!0,g.friendlyName=f.bg.Pb.friendlyName)}}(c)),c.mi||this.m.set(c.bg.id,c.bg.Pb);b=b.concat.apply(b,p(this.m.values()));mb(this.o,function(){return"Available sinks are..."+JSON.stringify(b)});
this.l&&(b=b.concat(vx));return new Kq(b,-1!=a.indexOf("0F5096E8")?Dj:null)};var tx=function(a){var b=[];a.o.info("Checking cloud discovery services");a.u.forEach(function(c){c=c.j().map(function(d){return d.Pb});b.push.apply(b,p(c))});return b};k=rx.prototype;k.startObservingMediaSinks=function(){};k.stopObservingMediaSinks=function(){};k.startObservingMediaRoutes=function(){};k.stopObservingMediaRoutes=function(){};k.qp=function(a){return(a=wx(this,a))?a.Pb:null};
k.createRoute=function(a,b,c,d,e,f,g){var h=this;this.o.info("createRoute called");mb(this.o,"urn: "+a+" sinkId:"+b);if(e=this.G.get(b))return Ti(xx(this.g,this,e,a,c,g,function(m){m.mediaSource=a;m.yb.tabId=g;return Ui(m)}),function(m){Zq(h.g);return m});e=wx(this,b);return yx(this,a,e,b,c,d,g)};
var zx=function(a,b,c,d,e){b instanceof Jq&&2==b.errorCode?Uu(a,c,6,null):(a.o.error("Error on start session",b instanceof Error?b:Error("Expected an Error value, got "+b)),a.h.has(c.id)&&Uu(a,c,e,Ri(new Ni(Ku,"warning"),c.sinkId)));if(b=a.l)b=a.l,b.l.delete(d.deviceId)?(b.g.g.delete(d.id),b=!0):b=!1;b&&Hs(a,[d.Pb])},yx=function(a,b,c,d,e,f,g){if(f)return Vi(Error("not supported"));f=!1;switch(c.g){case "slarti":is(1);break;case "mesi":f=!0;if(!a.C){a.C=!0;Mw(a.s);var h=Ri(Pi(),d);a.g.g.onIssue(h)}is(0)}Nm().h=
new Km(c.model,null);var m=aq(e,a.getName(),d,b,!0);a.h.set(m.id,m);a.G.set(d,m);a.F.set(m.id,c);a.H.set(m.id,c.g);Qq(a.g,a,m);dr(a.g,a.Ya(),!0);if(Cj(b)&&!f)return a.o.info("starting presentation on route: "+m.id),Ax(m,b).catch(function(q){zx(a,q,m,c,7);throw q;});a.o.info("starting mirroring on route: "+m.id);m.yb={tabId:g,sessionId:"",gi:"",We:c.model};Cj(b)&&(m.isOffscreenPresentation=!0);return Sq(a.g,a,m,e).catch(function(q){zx(a,q,m,c,5);throw q;})};
rx.prototype.terminateRoute=function(a){return Uu(this,a,0,null)};
var Uu=function(a,b,c,d){var e="string"==typeof b?a.h.get(b):b;if(!e)return Promise.reject(new Jq(3,"Route in cloud provider not found for routeId "+b));a.o.info("terminating route: "+e.id);a.h.delete(e.id);a.G.delete(e.sinkId);a.F.get(e.id);a.F.delete(e.id);if(d)a.g.g.onIssue(d);Ab("MediaRouter.Cloud.Session.End",c,es);Yq(a.g,e);0==a.h.size&&dr(a.g,a.Ya(),!1);a.g.onPresentationConnectionStateChanged(e.id,"terminated");a.m.has(e.sinkId)&&(b=a.m.get(e.sinkId),Hs(a,[b]),a.m.delete(e.sinkId));return Promise.resolve()};
k=rx.prototype;k.sendRouteMessage=function(a,b){var c=this.H.get(a);if(c){var d=(a=this.h.get(a)||void 0)?wx(this,a.sinkId):void 0;return Fw(this.K,c,b,a,d)}return"string"===typeof b?(Tu(this,b,a),Promise.resolve()):Promise.reject(Error("Channel type missing"))};k.sendRouteBinaryMessage=function(a){return Promise.reject(Error("Route "+a+" does not support sending binary data."))};
k.Jk=function(a){var b=new Xj;5>b.minFrameRate&&(b.minFrameRate=5);var c=this.Ik(a);"hangouts"==c||"meetings"==c?(b.maxWidth=Math.min(window.screen&&window.screen.width||Infinity,2880),b.maxHeight=Math.min(window.screen&&window.screen.height||Infinity,1800)):b.senderSideLetterboxing=!0;Yj(b);Object.freeze(b);this.o.info("Settings for "+a+": "+Wj(b));if(!b.shouldCaptureAudio&&!b.shouldCaptureVideo)throw Error("Cannot start mirroring without video or audio capture.");return b};
k.Ik=function(a){var b=null;a=wx(this,a);switch(a.g){case "slarti":b="webrtc";break;case "mesi":b=a.ye?"meetings":"hangouts"}return b};k.Bp=function(){};k.Rn=function(a,b){mb(this.o,"Checking canRoute: "+a+" for sinkId: "+b);return ux(this,a)&&!!this.qp(b)};k.sk=function(a,b){return Cj(a)&&this.h.has(b)};k.joinRoute=function(a,b){return(a=this.h.get(b))?(this.o.info("joining route: "+a.id),Ui(a)):Vi(Error("not supported"))};k.connectRouteByRouteId=function(){return Vi(Error("not supported"))};
k.detachRoute=function(){};
var Fs=function(a,b){a.o.info(b.length+" sinks added");b=wx(a,b[0].id);Nm().g=new Km(b.model,null);rn(a.g);a.g.onSinkAvailabilityUpdated(a,2);a.o.info("sinkAvailability changed to AVAILABLE")},Hs=function(a,b){a.o.info(b.length+" sinks removed");Eb(2);a.u.some(function(c){return 0<c.j().length})||(a.g.onSinkAvailabilityUpdated(a,0),a.o.info("sinkAvailability changed to UNAVAILABLE"));rn(a.g)},Gs=function(a,b){a.o.info(b.length+" sinks updated");rn(a.g)},Tu=function(a,b,c,d){(void 0===d?0:d)?to(a.g,
c,b):Bp(a.g.K,new Cp(c,b))},wx=function(a,b){var c=Bx(a,b);c||(c=null,(b=a.G.get(b))&&(c=a.F.get(b.id)));return c},Bx=function(a,b){var c=null;a.u.some(function(d){c=d.h(b);return!!c});return c},ux=function(a,b){var c=Ej(b)||Fj(b);b=Cj(b);if(a.D.j&&!a.D.g&&c)return a.g.onSinkAvailabilityUpdated(a,2),!0;var d=!1;a.j&&a.D.g&&(d=!0);return d&&(c||b)};k=rx.prototype;
k.searchSinks=function(a,b){var c=this;if(!ux(this,a))return Promise.reject(Error("err"));a=Qs(this.l,b);a.then(function(d){Fs(c,[d])});return a};k.createMediaRouteController=function(){return bb()};k.provideSinks=function(){};k.Ya=function(){return"CloudProvider"};k.Ob=function(){return[void 0,{cloudEnabled:this.j,notifiedHangoutsPrivacy:this.C}]};k.Nb=function(){var a=tm(this);a&&(a.cloudEnabled&&(this.j=a.cloudEnabled),a.notifiedHangoutsPrivacy&&(this.C=a.notifiedHangoutsPrivacy))};
var Ax=function(a,b){a=new qx(a,b);return Wi(a.start())};rx.prototype.o=eb("mr.CloudProvider");var vx=new om("pseudo:cloud","","meeting","","default"),sx=Date.parse("15 Aug 2020 00:00:00 GMT");var Cx=function(){Up.call(this,12,"ExternalMessageListener","mr.ProviderManager",chrome.runtime.onMessageExternal)};t(Cx,Up);Cx.prototype.Mj=function(a,b){return b.origin&&b.origin.startsWith("chrome-extension://")&&Dx.includes(b.origin.substring(19))?"start"==a.type||"stop"==a.type||"subscribe_log_data"==a.type:!1};Cx.prototype.wk=function(){return!0};var Fx=function(){Ex||(Ex=new Cx);return Ex},Ex=null,Dx=["idmofbkcelhplfjnmmdolenpigiiiecc","ggedfkijiiammpnbdadhllnehapomdge","njjegkblellcjnakomndbaloifhcoccg"];var Gx=function(){Up.call(this,11,"InternalMessageListener","mr.ProviderManager",chrome.runtime.onMessage)};t(Gx,Up);Gx.prototype.Mj=function(a,b){return"retrieve_log_data"==a.type&&b.origin=="chrome-extension://"+chrome.runtime.id&&b.url==b.origin+"/feedback.html"};Gx.prototype.wk=function(){return!0};var Ix=function(){Hx||(Hx=new Gx);return Hx},Hx=null;function Jx(a){var b=Kx,c=[];a&&c.push(new Mq(b));c.push(new rx(b));return c};var Lx=function(a,b){this.routeId=a;this.message=b},Mx=function(a){return"string"!=typeof a.message};var Nx=function(a){this.D=a;this.l=this.C=null},Ox=function(a){if(null==a.l)if(null==a.C||Date.now()-a.C>=a.D)a.m();else{var b=Math.max(a.C+a.D-Date.now(),5);a.l=setTimeout(a.m.bind(a),b)}};Nx.prototype.m=function(){null!=this.l&&(clearTimeout(this.l),this.l=null);this.F();this.C=Date.now()};Nx.prototype.F=function(){};var Px=function(a,b){Nx.call(this,20);this.g=new Map;this.h=new Set;this.u=null;this.s=this.j=0;this.G=!1;this.K=a;this.H=b;this.o=eb("mr.RouteMessageSender")};t(Px,Nx);Px.prototype.init=function(a){this.u=a;vm(this)};Px.prototype.stopListeningForRouteMessages=function(a){this.h.delete(a)};
Px.prototype.send=function(a,b){var c=this.g.get(a);c||(c=[],this.g.set(a,c));b=new Lx(a,b);c.push(b);50<c.length&&1==c.length%50&&this.o.L(function(){return"Message queue length is excessively large ("+(c.length+") for route "+a)});this.j+=Mx(b)?0:b.message.length;Mx(b)&&this.s++;Qx(this);this.h.has(a)&&Ox(this)};
var Rx=function(a,b){if(0!=b.length){b=n(b);for(var c=b.next();!c.done;c=b.next())c=c.value,a.j-=Mx(c)?0:c.message.length,Mx(c)&&a.s--}},Qx=function(a){var b=0<a.s||a.j>a.H;b!=a.G&&(a.G=b,dr(a.K,a.Ya(),b))};Px.prototype.F=function(){if(this.u){for(var a=n(this.h),b=a.next();!b.done;b=a.next()){b=b.value;var c=this.g.get(b);c&&0!=c.length&&(this.u(b,c),Rx(this,c),this.g.set(b,[]))}Qx(this)}else this.o.error("sendMessagesCallback not set. Messages not delivered.")};Px.prototype.Ya=function(){return"mr.RouteMessageSender"};
Px.prototype.Ob=function(){var a=[].concat(p(this.g.entries())).map(function(b){return[b[0],b[1].map(function(c){return c.message})]});return[new Sx(a,Array.from(this.h),this.j)]};Px.prototype.Nb=function(){var a=sm(this);if(a){this.g=new Map;for(var b={},c=n(a.h),d=c.next();!d.done;b={ni:b.ni},d=c.next())d=d.value,b.ni=d[0],d=d[1].map(function(e){return function(f){return new Lx(e.ni,f)}}(b)),this.g.set(b.ni,d);this.h=new Set(a.g);this.j=a.j}};var Sx=function(a,b,c){this.h=a;this.g=b;this.j=c};var Cp=function(a,b){this.type="internal_message";this.routeId=a;this.message=b};var Tx=function(){this.g=[]};Tx.prototype.listen=function(a,b,c){this.g.push({type:a,Ad:b,target:c})};var Ux=function(a,b,c){var d=a.g.findIndex(function(e){return"internal_message"==e.type&&e.Ad==b&&e.target==c});-1!=d&&a.g.splice(d,1)},Bp=function(a,b){a.g.forEach(function(c){c.type==b.type&&Promise.resolve().then(function(){return c.Ad.call(c.target,b)})})};var Vx=function(a,b,c){this.g=a;this.l=b;this.j=c;this.onMessage=function(){};c.listen("internal_message",this.h,this)};Vx.prototype.sendMessage=function(a,b){return this.l(this.g,a,b)};Vx.prototype.h=function(a){if(a.routeId==this.g)this.onMessage(a.message)};Vx.prototype.dispose=function(){this.onMessage=function(){};Ux(this.j,this.h,this)};
var Wx=new Vx("",function(){return Promise.resolve()},new Tx),Xx=function(a){this.g=a},nx=function(a){var b=Li,c=b.g.h.get(a);return c?new Vx(a,c.sendRouteMessage.bind(c),b.g.K):Wx};var Yx=function(a,b){this.m=null!=b?a.bind(b):a;this.C=this.s.bind(this);this.l=[];this.g=!1;this.h=null};Yx.prototype.j=function(a){for(var b=[],c=0;c<arguments.length;++c)b[c-0]=arguments[c];this.l=[].concat(p(b));null==this.h?Zx(this):this.g=!0};var Zx=function(a){a.h=setTimeout(a.C,500);a.m.apply(a,p(a.l))};Yx.prototype.s=function(){this.h=null;this.g&&(this.g=!1,Zx(this))};var $x=function(){this.config=null;this.o=eb("mr.ProviderManager");this.j=[];this.h=new Map;this.s=new Map;this.C=new Set;this.l=new Set;this.D=new Map;this.g=this.F=null;this.K=new Tx;this.W=new Yx(this.Eq,this);this.ea=new Yx(this.V,this);this.m=new Px(this,524288);this.H=0;this.u=new Map;this.G=[];var a=new Yr(this);this.Ab=a.onMessage.bind(a);a=new Or(this);this.Y=a.onMessage.bind(a);this.onBeforeInvokeHandler=this.onBeforeInvokeHandler;this.createRoute=this.createRoute;this.joinRoute=this.joinRoute;
this.connectRouteByRouteId=this.connectRouteByRouteId;this.terminateRoute=this.terminateRoute;this.startObservingMediaSinks=this.startObservingMediaSinks;this.stopObservingMediaSinks=this.stopObservingMediaSinks;this.sendRouteMessage=this.sendRouteMessage;this.sendRouteBinaryMessage=this.sendRouteBinaryMessage;this.startListeningForRouteMessages=this.startListeningForRouteMessages;this.stopListeningForRouteMessages=this.stopListeningForRouteMessages;this.startObservingMediaRoutes=this.startObservingMediaRoutes;
this.stopObservingMediaRoutes=this.stopObservingMediaRoutes;this.detachRoute=this.detachRoute;this.searchSinks=this.searchSinks;this.provideSinks=this.provideSinks;this.updateMediaSinks=this.updateMediaSinks;this.createMediaRouteController=this.createMediaRouteController};t($x,oj);
$x.prototype.handleEvent=function(a,b){for(var c=[],d=1;d<arguments.length;++d)c[d-1]=arguments[d];if(a==chrome.runtime.onMessage)this.Ab.apply(this,p(c));else if(a==chrome.runtime.onMessageExternal)this.Y.apply(this,p(c));else throw Error("Unhandled event");};
var bs=function(a,b){b=a.D.get(b);return sj(b).then(function(c){var d=!!a.config&&a.config.use_mirroring_service;c.D||(c.j=a,c.D=!0,c.th(d));return c})},by=function(a,b,c){b.forEach(function(d){if(ay(a,d.getName()))a.o.L("Provider "+d.getName()+" already registered.");else try{d.rp(c),a.j.push(d),a.u.set(d.getName(),0)}catch(e){a.o.L("Provider "+d.getName()+" failed to initialize.",e)}})},cy=function(a,b,c){var d=Kx;d.D.set("webrtc","mr.mirror.webrtc.WebRtcService");d.D.set("cast_streaming","mr.mirror.cast.Service");
d.D.set("hangouts","mr.mirror.hangouts.HangoutsService");d.D.set("meetings","mr.mirror.hangouts.MeetingsService");var e=new Xx(d);Li||(Li=e);d.g=a;d.m.init(d.g.onRouteMessagesReceived.bind(d.g));by(d,b,c);d.config=c;vm(d);yj("mr.ProviderManager",d)},ey=function(a,b,c){return new Promise(function(d,e){var f=null;a.H++;dy(a);f=window.setTimeout(function(){f=null;b.cancel(new Jq(2,"timeout after "+c+" ms."))},c);b.promise.then(function(g){a.H--;dy(a);null!=f&&window.clearTimeout(f);d(g)},function(g){a.H--;
dy(a);null!=f&&window.clearTimeout(f);e(g instanceof Jq?g:g instanceof Error?new Jq(0,g.message,g.stack):new Jq(0))})})};$x.prototype.onBeforeInvokeHandler=function(){Bj(0)};var fy=function(a){return"string"==typeof a?a:a.unique?"":a.scheme+"://"+a.host+"\n       "+(a.port?":"+a.port:"")+"/"};k=$x.prototype;
k.createRoute=function(a,b,c,d,e,f,g){var h=this;g=void 0===g?!1:g;var m=gy(this,a,b);if(!m)return Promise.reject(new Jq(7,"No provider supports createRoute with source: "+a+" and sink: "+b));var q=void 0;void 0!==d&&(q=fy(d));f=f&&0<f?f:6E4;a=m.createRoute(a,b,c,g,f,q,e);return ey(this,a,f).then(function(r){return r},function(r){h.o.error("Error creating route.",r);throw r;})};
k.connectRouteByRouteId=function(a,b,c,d,e,f){var g=this.h.get(b);if(!g)return Promise.reject(new Jq(7,"No provider supports join "+b));a=g.connectRouteByRouteId(a,b,c,fy(d),e);return ey(this,a,f&&0<f?f:3E4)};k.joinRoute=function(a,b,c,d,e,f){f=void 0===f?!1:f;var g=hy(this,a,b);if(!g)return Promise.reject(new Jq(7,"No provider supports join "+b));e=e&&0<e?e:3E4;a=g.joinRoute(a,b,f,e,fy(c),d);return ey(this,a,e)};
k.terminateRoute=function(a){var b=this.h.get(a);return b?iy(this,a).then(function(){return b.terminateRoute(a)}):Promise.reject(new Jq(3,"Route not found for routeId "+a))};k.startObservingMediaSinks=function(a){Eb(1);this.C.has(a)||(this.C.add(a),this.j.forEach(function(b){b.startObservingMediaSinks(a)}));jy(this,a)};k.stopObservingMediaSinks=function(a){this.C.delete(a)?ky(this,a):this.o.info("No existing query "+a)};
var ky=function(a,b){a.j.forEach(function(c){c.stopObservingMediaSinks(b)})},jy=function(a,b){if("urn:x-org.chromium.media:source:tab:-1"==b)a.o.L("No sinks for sourceUrn: "+b);else{var c=new Map,d=[];a.j.forEach(function(e){var f=e.ro(b);0<f.sinks.length&&(d=f.origins);f.sinks.forEach(function(g){c.has(g.id)?a.o.L("Detected duplicate sink "+g.id+" from provider: "+e.getName()):c.set(g.id,g)})});ly(a,b,Array.from(c.values()),d||[])}},ly=function(a,b,c,d){a.o.info("Sending "+c.length+" sinks to MR for "+
b);a.g.onSinksReceived(b,c,d.map(To))};k=$x.prototype;k.sendRouteMessage=function(a,b,c){var d=this.h.get(a);d?(a=d.sendRouteMessage(a,b,c),a=ey(this,Wi(a),3E4)):a=Promise.reject(Error("Invalid route ID "+a));return a};k.sendRouteBinaryMessage=function(a,b){var c=this.h.get(a);c?(a=c.sendRouteBinaryMessage(a,b),a=ey(this,Wi(a),3E4)):a=Promise.reject(Error("Invalid route ID "+a));return a};
k.startListeningForRouteMessages=function(a){var b=this.m;b.h.has(a)||(b.h.add(a),(a=b.g.get(a))&&0<a.length&&Ox(b))};k.stopListeningForRouteMessages=function(a){this.m.stopListeningForRouteMessages(a)};k.detachRoute=function(a){var b=this.h.get(a);b?b.detachRoute(a):this.o.info("Route "+a+" does not exist.")};k.enableMdnsDiscovery=function(){};var gy=function(a,b,c){return a.j.find(function(d){return d.Rn(b,c)})||null},hy=function(a,b,c){return a.j.find(function(d){return d.sk(b,c)})||null};
$x.prototype.V=function(){var a=this;this.C.forEach(function(b){jy(a,b)})};var dy=function(a){a.g.setKeepAlive(0<a.H||0<a.G.length)};k=$x.prototype;k.startObservingMediaRoutes=function(a){this.l.has(a)||(this.l.add(a),this.j.forEach(function(b){b.startObservingMediaRoutes(a)}));this.W.j()};k.stopObservingMediaRoutes=function(a){this.l.delete(a)?this.j.forEach(function(b){b.stopObservingMediaRoutes(a)}):this.o.info("No existing route query "+a)};
k.Eq=function(){var a=this;if(0!=this.l.size){var b=[];this.j.forEach(function(c){b=b.concat(c.Vi())});this.l.forEach(function(c){var d=[];a.j.forEach(function(e){e.Vi().forEach(function(f){!f.og&&e.sk(c,void 0,f)&&d.push(f.id)})});a.g.onRoutesUpdated(b,c,d)})}};k.Ya=function(){return"ProviderManager"};
k.Ob=function(){return[new my(this.j.map(function(a){return a.getName()}),Array.from(this.C),Array.from(this.l),Array.from(this.h,function(a){var b=n(a);a=b.next().value;b=b.next().value;return[a,b.getName()]}),Array.from(this.u),this.F)]};k.Nb=function(){var a=sm(this);if(a){this.C=new Set(a.C);this.l=new Set(a.j);for(var b=n(a.h),c=b.next();!c.done;c=b.next()){var d=n(c.value);c=d.next().value;d=d.next().value;d=ay(this,d);this.h.set(c,d)}this.u=new Map(a.l);this.F=a.g||null}};
var Qq=function(a,b,c){a.h.set(c.id,b);Zq(a)},Yq=function(a,b){iy(a,b.id);a.h.delete(b.id);var c=a.m;b=b.id;c.h.delete(b);var d=c.g.get(b);d&&(c.g.delete(b),Rx(c,d),Qx(c));Zq(a)},Zq=function(a){0<a.l.size&&a.W.j()};$x.prototype.N=function(a){var b=this.h.get(a.id);b&&(b.Bp(a.id),0<this.l.size&&this.Eq())};var to=function(a,b,c){a.h.has(b)?("string"===typeof c||c instanceof Uint8Array||(c=JSON.stringify(c)),a.m.send(b,c)):a.o.L("Got route message for closed route "+b)};
$x.prototype.onPresentationConnectionStateChanged=function(a,b){"terminated"==b&&this.m.m();this.g.onPresentationConnectionStateChanged(a,b)};$x.prototype.onPresentationConnectionClosed=function(a,b,c){this.m.m();this.g.onPresentationConnectionClosed(a,b,c)};var Nj=function(a,b){a.s.delete(b);(a=a.h.get(b))&&a.terminateRoute(b)},rn=function(a){Eb(4);a.ea.j()};
$x.prototype.onSinkAvailabilityUpdated=function(a,b){var c=this;if(this.u.get(a.getName())!=b){var d=ny(this);this.u.set(a.getName(),b);a=ny(this);d!=a&&(Eb(3),0==a&&this.V(),this.g.onSinkAvailabilityUpdated(a),0==a&&(this.C.forEach(function(e){ky(c,e)}),this.C.clear()))}};
var ny=function(a){return Array.from(a.u.values()).reduce(function(b,c){return Math.max(b,c)},0)},iy=function(a,b){return a.s.has(b)?bs(a,a.s.get(b)).then(function(c){a.s.delete(b);return c.s()}):Promise.resolve(!1)},Sq=function(a,b,c,d,e){var f=b.Ik(c.sinkId);a.o.info("Starting mirroring using service: "+f);a.s.set(c.id,f);return Xi(bs(a,f),function(g){a.F=f;return g.Al(c,c.mediaSource,b.Jk(c.sinkId),d,e).catch(function(h){if(h instanceof Zi&&3==h.reason)throw new Jq(8);throw h;})})},xx=function(a,
b,c,d,e,f,g){var h=a.s.get(c.id);return h?Xi(bs(a,h),function(m){a.F=h;return m.oa(c,d,b.Jk(c.sinkId),e,f,g)}):Vi(Error("Route "+c.id+" is not mirroring"))},dr=function(a,b,c){var d=a.G.indexOf(b),e=0<=d;c&&!e?a.G.push(b):!c&&e&&a.G.splice(d,1);dy(a)},ay=function(a,b){return a.j.find(function(c){return c.getName()==b})||null};k=$x.prototype;
k.searchSinks=function(a,b,c){var d=a.startsWith("pseudo:")?a.substring(7):null;return(d=d?ay(this,d):null)?d.searchSinks(b,c).then(function(e){return e.id}):Promise.reject(Error("No provider supports "+a))};k.provideSinks=function(a,b){var c=ay(this,a);c?c.provideSinks(b):this.o.info("provideSinks: Provider not found for providerName "+a)};k.updateMediaSinks=function(a){this.C.has(a)||jy(this,a)};
k.createMediaRouteController=function(a,b,c){var d=this,e=this.h.get(a);return e?e.createMediaRouteController(a,b,c).catch(function(f){d.o.error("createMediaRouteController failed: "+f.message);b.close();c.ptr.reset();throw f;}):(a="createMediaRouteController: Provider not found for "+a,this.o.error(a),b.close(),c.ptr.reset(),Promise.reject(Error(a)))};k.onMediaRemoterCreated=function(a,b,c){this.g.onMediaRemoterCreated(a,b,c)};k.getMediaSinkServiceStatus=function(){return this.g.getMediaSinkServiceStatus()};
var as=function(a){return"function"!=typeof a.g.getLogsAsString?Promise.resolve({Tc:""}):a.g.getLogsAsString()};$x.prototype.getMirroringServiceHostForTab=function(a,b){this.g.getMirroringServiceHostForTab(a,b)};$x.prototype.getMirroringServiceHostForDesktop=function(a,b,c){this.g.getMirroringServiceHostForDesktop(a,b,c)};$x.prototype.getMirroringServiceHostForOffscreenTab=function(a,b,c){this.g.getMirroringServiceHostForOffscreenTab(a,b,c)};
var my=function(a,b,c,d,e,f){this.C=b;this.j=c;this.h=d;this.l=e;this.g=f};
