'use strict';var ui;var vi=chrome.i18n.getMessage("545449835455981095");x("mr.IssueSeverity",{kA:"fatal",dK:"warning",hE:"notification"});x("mr.IssueAction",{Yz:"dismiss",AC:"learn_more"});
var wi=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},yi=function(){var a=new wi(xi,"notification");a.helpPageId=6320939;a.defaultAction="learn_more";a.secondaryActions=["dismiss"];return a},zi=function(a,b){a.routeId=b;return a},Ai=function(a,b){a.sinkId=b;return a};var Bi=function(a,b){var c=this;this.h=void 0===b?null:b;this.g=new Promise(function(d,e){var f=function(g){c.h=null;e(g)};c.j=f;a(function(g){c.h=null;d(g)},f)})};Bi.prototype.cancel=function(a){this.j(a);if(this.h){var b=this.h;this.h=null;setTimeout(function(){return b(a)},0)}};var Ci=function(a,b,c){c=void 0===c?null:c;return new Bi(function(d,e){a.g.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)})};
Bi.prototype.then=function(a,b){return Ci(this,a,void 0===b?null:b)};var Di=function(a,b){return Ci(a,null,b)},Ei=function(a){return new Bi(function(b){b(a)})},Fi=function(a){return new Bi(function(b,c){c(a)})},Gi=function(a){return new Bi(function(b,c){a.then(b,c)})},Hi=function(a,b){var c=!1,d=null;return new Bi(function(e,f){a.then(function(g){c||(d=b(g),d.g.then(e,f))},f)},function(e){d?d.cancel(e):c=!0})};var Ii={Ey:0,Cy:1,Gy:2,Dy:3,gx:4,Fy:5,IB:6,AI:7,Tz:8,UNKNOWN:9},Ji=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};u(Ji,Error);var Ki=function(){var a=n(navigator.userAgent.match(/Windows NT (\d+.\d+)/)||[]);a.next();a=a.next().value;return 6.2<=parseFloat(a)},Li=function(){var a=navigator.userAgent;return a.includes("CrOS")?"ChromeOS":a.includes("Windows")?"Windows":a.includes("Macintosh")?"Mac":a.includes("Linux")?"Linux":"Other"};var Mi=["ChromeOS","Windows"].includes(Li());var Ni=function(a,b,c,d){this.h=a;this.g=b;this.j=c||null;this.presentationId=d||null},Qi=function(a,b){if("tab"==a.h)a=Oi(a);else if("offscreen_tab"==a.h)b=Oi(a),b.presentationId=a.presentationId,a=b;else{var c={audio:!1,video:!1};a.g.shouldCaptureVideo?(c.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:b}},Pi(a,c.video.mandatory),Mi&&a.g.shouldCaptureAudio&&(c.audio={mandatory:{chromeMediaSource:"system",chromeMediaSourceId:b}})):a.g.shouldCaptureAudio&&(c.audio={mandatory:{chromeMediaSource:"system"}});
a=c}return a},Oi=function(a){var b={audio:a.g.shouldCaptureAudio,video:a.g.shouldCaptureVideo};a.g.shouldCaptureVideo&&(b.videoConstraints={mandatory:{enableAutoThrottling:!0}},Pi(a,b.videoConstraints.mandatory));return b},Pi=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 Ri=function(a){this.g=a;this.h=this.Bf=null;this.u=ab("mr.mirror.MirrorMediaStream")};Ri.prototype.start=function(){return"tab"==this.g.h?Si(this):"offscreen_tab"==this.g.h?Ti(this):Ui(this)};var Si=function(a){var b=Qi(a.g);B(a.u,"Starting tab capture with constraints "+JSON.stringify(b));return new Promise(function(c,d){chrome.tabCapture.capture(b,function(e){e?(Vi(a,e),c(a)):d(Wi())});window.setTimeout(function(){d(new Ji("chrome.tabCapture.capture failed to call its callback",2))},5E3)})};
Ri.prototype.j=function(a){a&&B(this.u,function(){return"Track "+JSON.stringify(a.target)+" ended"});this.stop()};
var Wi=function(){return chrome.runtime.lastError&&chrome.runtime.lastError.message?new Ji(chrome.runtime.lastError.message,7):new Ji("empty_stream",0)},Xi=function(a){a=void 0===a?!0:a;return new Promise(function(b,c){var d=["screen"];a&&d.push("audio");"Linux"==Li()&&d.push("window");var e=window.setTimeout(function(){f&&chrome.desktopCapture.cancelChooseDesktopMedia(f);c(new Ji("timeout",1))},6E4);var f=chrome.desktopCapture.chooseDesktopMedia(d,null,function(g){window.clearTimeout(e);g?b(g):c(new Ji("User cancelled capture dialog",
3))})})},Yi=function(a,b){return new Promise(function(c,d){B(a.u,function(){return"Starting desktop capture with constraints "+JSON.stringify(b)});navigator.mediaDevices.getUserMedia(b).then(function(e){e||d(new Ji("empty_stream",8));Vi(a,e);c(e)},function(e){var f=8;"NotAllowedError"==e.name&&(f=3);d(new Ji(e.name+" "+e.constraintName+": "+e.message,f))})})},Ui=function(a){return Mi&&a.g.g.shouldCaptureAudio&&!a.g.g.shouldCaptureVideo?Yi(a,Qi(a.g)).then(function(){return a}):Xi().then(function(b){b=
Qi(a.g,b);return Yi(a,b).then(function(){return a})})},Ti=function(a){var b=Qi(a.g);B(a.u,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?(Vi(a,e),c(a)):d(Wi())})})},Vi=function(a,b){a.h=b;b.getAudioTracks().length||b.getVideoTracks();b.getTracks().forEach(function(c){c.onended=a.j.bind(a)})};
Ri.prototype.stop=function(){this.h&&(this.h.getTracks().forEach(function(a){a.onended=null;a.stop()}),this.h=null,this.Bf&&this.Bf())};var Zi=function(){},cj=function(a){var b=$i.get(a)||null;if(b)return Promise.resolve(b);b=aj.get(a);b||(b=new Ab,aj.set(a,b),bj(a,b));return b.g},bj=function(a,b){var c=dj.get(a)||null;if(!c)b.reject(Error("No corresponding bundle for "+a));else if(!ej.has(c)){var d=fj.get(c);d||(B(gj,"Loading bundle "+c+" for module "+a),d=hj(c),fj.set(c,d));d.catch(function(e){b.reject(e)})}},hj=function(a){var b=new Ab;b.g.then(function(){B(gj,"Bundle "+a+" loaded")},function(d){gj.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.g},ij=function(a,b){if($i.has(a))throw Error("Duplicate module "+a);$i.set(a,b);(a=aj.get(a))&&a.resolve(b)};
Zi.prototype.handleEvent=function(a,b){for(var c=1;c<arguments.length;++c);throw Error("Not implemented");};
var dj=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"]]),ej=new Set(["background_script.js"]),
gj=ab("mr.Module"),$i=new Map,aj=new Map,fj=new Map;var jj,kj={WC:0,Hy:1,Iy:2,Uz:3,Vz:4,QA:5,KB:6,UC:7,VD:8,WD:9,pF:10,eH:11,fH:12,KH:13,zI:14},lj=function(a){void 0==jj&&(vb("MediaRouter.Provider.WakeEvent",a,kj),jj=a)};var mj=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}},nj=["https://docs.google.com","https://meet.google.com"],oj=function(a){return a.startsWith("urn:x-org.chromium.media:source:tab:")||-1!=a.indexOf("0F5096E8")},pj=function(a){return"urn:x-org.chromium.media:source:desktop"==a},qj=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 rj=function(a,b){this.Aa=a;this.j=b||null;this.h=this.g=null;this.T=ab("mr.mirror.Service."+a);this.Oc=this.sa.bind(this);this.C=!1};u(rj,Zi);rj.prototype.pg=function(){};rj.prototype.getName=function(){return this.Aa};
rj.prototype.ik=function(a,b,c,d,e){var f=this;B(this.T,"Start mirroring on route "+a.id);if(!this.C)return Fi(Error("Not initialized"));var g=new Promise(function(h,l){f.o().then(function(){var p=sj(b,c,d);return(new Ri(p)).start()}).then(function(p){if(f.h)throw p.stop(),new Ji("Cannot start multiple streams");f.h=p;p=f.F.bind(f);f.h.Bf=p;return e?e(a).g:a}).then(function(p){if(f.g)throw new Ji("Cannot start multiple sessions");if(!f.h)throw new Ji("Media stream ended before session could start.");
f.g=f.zh(c,p);p.sb.nc=f.g.nc;p=f.j.L.bind(f.j);f.g.K=p;tj(f.g);return f.g.start(f.h.h)}).then(function(){oj(b)&&!chrome.tabs.onUpdated.hasListener(f.Oc)&&chrome.tabs.onUpdated.addListener(f.Oc);return f.ta(a,b,c)}).then(function(){h(a)}).catch(function(p){uj(f,p);return f.F().then(function(){l(p)})})});return Gi(g)};rj.prototype.oa=function(a,b,c,d,e,f){B(this.T,"Update mirroring on route "+a.id);return this.C?Gi(vj(this,a,b,c,d,f)):Fi(Error("Not initialized"))};
var vj=function(a,b,c,d,e,f){if(!a.g)return Promise.reject(new Ji("No session to update streams on",7));if(!a.g.ap())return Promise.reject(new Ji("Session does not support updating stream",7));var g=!1;return new Promise(function(h,l){var p=sj(c,d,e);(new Ri(p)).start().then(function(r){a.h&&(a.h.Bf=null,a.h.stop(),a.Vg());a.h=r;r=a.F.bind(a);a.h.Bf=r;g=!0;return f?f(b).g:b}).then(function(){if(!a.g)throw new Ji("Session ended while updating stream");if(!a.h)throw new Ji("Media stream ended before session could be updated.");
return a.g.gp(a.h.h)}).then(a.ta.bind(a,b,c,d)).then(function(){return h(b)}).catch(function(r){uj(a,r);if(g)return a.F().then(function(){l(r)});l(r)})})};
rj.prototype.ta=function(a,b,c){var d=this;return new Promise(function(e,f){if(d.g){oj(b)?(wj(d.g,a.sb.tabId),d.Wg()):mj(b)?(wj(d.g,a.sb.tabId),d.di()):d.Tg();f=d.h;var g=a.sinkId;c.shouldCaptureAudio&&f.h&&!f.h.getAudioTracks().length&&(f=Ai(new wi(vi,"notification"),g),d.j.g.onIssue(f));tj(d.g);e()}else f(new Ji("Session gone before executing post-startup steps",7))})};
var uj=function(a,b){b.reason=null!=b.reason?b.reason:9;a.T.error("Failed to start mirroring: "+b.message+(",  reason = "+b.reason+": "+b.stack));a.Ff(b.reason)};rj.prototype.o=function(){var a=this;return this.C?this.F().then(function(b){b&&a.Ug();return b}):Promise.reject("Not initialized")};
rj.prototype.F=function(){var a=this;chrome.tabs.onUpdated.removeListener(this.Oc);var b=this.h;this.h=null;b&&(b.Bf=null);var c=this.g;this.g=null;var d;c?d=this.Oi(c).catch(function(e){return a.T.error("Error in before-cleanup steps",e)}).then(function(){return c.stop()}).catch(function(e){return a.T.error("Error stopping session",e)}).then(function(){xj(a.j,c.h.id)}).catch(function(e){return a.T.error("Error in ended callbacks",e)}).then(function(){return!0}):d=Promise.resolve(!1);b&&(d=d.then(function(e){b.stop();
a.Vg();return e}));return d};rj.prototype.Oi=function(){return Promise.resolve()};rj.prototype.sa=function(a,b,c){lj(14);this.g&&yj(this.g,a,b,c)};var sj=function(a,b,c){if(oj(a))return new Ni("tab",b);if(pj(a))return new Ni("desktop",b);if(mj(a)){if(!c)throw new Ji("Missing offscreen tab presentation id");return new Ni("offscreen_tab",b,a,c)}throw new Ji("Source URN does not suggest a known capture type.");};k=rj.prototype;k.zh=function(){};k.Wg=function(){};k.Tg=function(){};k.di=function(){};
k.Ug=function(){};k.Ff=function(){};k.Vg=function(){};k.hk=function(){return Ya()};k.createMediaRouteController=function(){return Ya()};var zj=function(a,b,c){this.h=a;this.l=b;this.g=void 0===c?null:c;this.j=null},Aj=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""}},Bj=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 Cj=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 Dj=function(a,b){this.h=a;this.K=void 0===b?null:b;b=null;var c=a.mediaSource;if(mj(c)){var d="presentation";b=(new URL(c)).origin}else oj(c)?d="mirror_tab":pj(c)&&(d="mirror_desktop");this.nc=new zj(d,a.offTheRecord,b);this.j=this.tabId=null;this.F=!1},wj=function(a,b){a.tabId!=b?(a.tabId=b,Cj(b).then(function(c){a.j=c;tj(a)})):Promise.resolve()},yj=function(a,b,c,d){b==a.tabId&&("complete"==c.status||c.favIconUrl&&"complete"==d.status)&&(a.j=d,tj(a))},tj=function(a){if(a.j){a.nc.j=a.j.title;
a.nc.l=a.j.incognito;var b=new URL(a.j.url);"file:"==b.protocol?(a.nc.h="mirror_file",a.nc.g=null):(a.nc.h=a.F?"media_remoting":"mirror_tab",a.nc.g="https:"==b.protocol?b.origin.substr(8):b.origin)}a.h.description=Aj(a.nc);a.K&&a.K(a.h,a.nc);a.yo()};k=Dj.prototype;k.start=function(){};k.ap=function(){return!1};k.gp=function(){};k.stop=function(){return Promise.resolve()};k.yo=function(){};var Hj=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(Li())||Ki();this.shouldCaptureAudio=this.shouldCaptureVideo=this.enableLogging=!0;var b=window.localStorage?
window.localStorage.getItem(Ej):null;if(b)try{var c=JSON.parse(String(b));if(c instanceof Object)Fj(this,c),ab("mr.mirror.Settings").J(function(){return"Initial mr.mirror.Settings overridden to: "+Gj(a)});else throw Error("localStorage["+Ej+"] does not parse as an Object: "+b);}catch(d){throw ab("mr.mirror.Settings").error(Ej+' must be of the form \'{"maxWidth":640, "maxHeight":360}\'.',d),Error("Overrides not parseable.  See ERROR log for details.");}};
Hj.prototype.clone=function(){var a=new Hj;Fj(a,this);return a};
var Gj=function(a){return JSON.stringify(a,function(b,c){if(0==b.length||!b.endsWith("_"))return c})},Fj=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])},Ij=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},Ej="mr.mirror.Settings.Overrides";var Jj=function(a,b){this.type=a;this.data=b},Kj=function(a){a=JSON.parse(a);if(!a.type)throw Error("Invalid message");return new Jj(a.type,a.data)},Lj=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 Pj=function(a,b){this.u=ab("cv2.PeerConnection");this.H=Nj;this.ga=Oj(this,b);this.l=this.ga.createDataChannel(a,{reliable:!1});this.G=new Ab;this.o=!1;this.j=0;this.h=null;this.s=this.m=0;this.g=!1;this.F=function(){};this.w=function(){};this.C=function(){};this.D=function(){}},Qj=function(a,b){a.w=b},Rj=function(a,b){a.C=b},Sj=function(a,b){a.D=b},Tj=function(a,b){a.F=b},Uj=function(a,b){a.l.onmessage=function(c){b(c.data)}},Vj=function(a){var b={};b.iceServers=[{url:"stun:stun.l.google.com:19302"}].concat(a);
return b},Oj=function(a,b){var c=Vj(b);b=new webkitRTCPeerConnection(c);b.onicecandidate=a.L.bind(a);b.onicegatheringstatechange=a.W.bind(a);b.oniceconnectionstatechange=a.R.bind(a);B(a.u,function(){return"Created webkitRTCPeerConnnection with config: "+JSON.stringify(c)});return b};Pj.prototype.start=function(){this.g||(this.g=!0,Wj(this))};Pj.prototype.stop=function(){B(this.u,"Stopping peer connection...");this.g&&(this.g=!1,"closed"!=this.ga.signalingState&&this.ga.close());this.ga=null};
var Wj=function(a){B(a.u,"Sending offer to peer.");a.m=Date.now();a.ga.createOffer(a.K.bind(a),function(b){a.u.J("Error creating offer.",b)},a.H);a.G.g.then(function(b){a.F(b)})};Pj.prototype.K=function(a){var b=this;B(this.u,function(){return"Setting local description: "+JSON.stringify(a)});this.ga.setLocalDescription(a,function(){B(b.u,"Local description set successfully")},function(c){b.u.J("Error setting local description.",c)})};
var Xj=function(a,b){hb(a.u,function(){return"<===: "+JSON.stringify(b)});var c=new RTCSessionDescription(b);B(a.u,function(){return"Setting remote description: "+JSON.stringify(c)});a.ga.setRemoteDescription(c,function(){B(a.u,"Remote description set successfully.")},function(d){a.u.J("Error setting remote description.",d)})};
Pj.prototype.L=function(a){var b=this;a.candidate?(this.j++,this.s=Date.now(),1==this.j?this.h=setTimeout(function(){B(b.u,"ICE candidate gathering timed out.");b.h=null;Yj(b)},5E3):this.o&&this.u.J("Received ICE candidate after resolving session description.")):(B(this.u,"End of ICE candidates."),nb("MediaRouter.WebRtc.IceCandidateGathering.Duration.Reported",Date.now()-this.m),Yj(this),0<this.j&&nb("MediaRouter.WebRtc.IceCandidateGathering.Duration.Real",this.s-this.m))};
Pj.prototype.W=function(){"completed"==this.ga.iceGatheringState&&Yj(this)};var Yj=function(a){clearTimeout(a.h);a.h=null;if(!a.o){B(a.u,"Resolving sesion description after gathering "+a.j+" ICE candidates.");var b=a.ga.localDescription;a.G.resolve({type:b.type,sdp:b.sdp});a.o=!0}};
Pj.prototype.R=function(a){var b=this;if(this.ga){var c=this.ga.iceConnectionState;B(this.u,"New ICE connection state: "+c+".");"connected"==c?this.w("iceconnected"):"completed"==c?this.w("icecompleted"):"failed"==c?(this.u.J(function(){return"Ice connection failed: "+JSON.stringify(a)}),this.C("icefailed")):"closed"==c?this.D("iceclosed"):"disconnected"==c&&(this.u.J("Ice connection state is bad."),this.g&&(B(this.u,"Restarting ICE."),this.ga.createOffer(this.K.bind(this),function(d){b.u.J("Error creating new offer.",
d)},Zj)))}};var Nj={mandatory:{OfferToReceiveAudio:!0,OfferToReceiveVideo:!0}},Zj={mandatory:{IceRestart:!0,OfferToReceiveAudio:!0,OfferToReceiveVideo:!0}};/*

 Copyright The Closure Library Authors.
 SPDX-License-Identifier: Apache-2.0
*/
var ak=function(){var a=window.crypto.getRandomValues(new Uint8Array(16));return Kb(a,function(b){b=b.toString(16);return 1<b.length?b:"0"+b}).join("")},bk=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},ck=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 dk={},ek=null,gk=function(a){var b;void 0===b&&(b=0);fk();b=dk[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,l=h?a[d+2]:0,p=e>>2;e=(e&3)<<4|g>>4;g=(g&15)<<2|l>>6;l&=63;h||(l=64,f||(g=64));c.push(b[p],b[e],b[g]||"",b[l]||"")}return c.join("")},ik=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;hk(a,function(f){d[e++]=f});return d.subarray(0,e)},hk=function(a,
b){function c(l){for(;d<a.length;){var p=a.charAt(d++),r=ek[p];if(null!=r)return r;if(!id(p))throw Error("Unknown base64 encoding at char: "+p);}return l}fk();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))}},fk=function(){if(!ek){ek={};for(var a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789".split(""),b=["+/=","+/","-_=","-_.","-_"],c=0;5>c;c++){var d=a.concat(b[c].split(""));dk[c]=d;for(var e=
0;e<d.length;e++){var f=d[e];void 0===ek[f]&&(ek[f]=e)}}}};var jk=0,kk=0,lk=function(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)));jk=c;kk=a},mk=function(a){var b=0>a?1:0;a=b?-a:a;if(0===a)0<1/a?jk=kk=0:(kk=0,jk=2147483648);else if(isNaN(a))kk=0,jk=2147483647;else if(3.4028234663852886E38<a)kk=0,jk=(b<<31|2139095040)>>>0;else if(1.1754943508222875E-38>a)a=Math.round(a/Math.pow(2,-149)),kk=0,jk=(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;kk=0;jk=(b<<31|c+127<<23|a)>>>0}},nk=function(a){var b=0>a?1:0;a=b?-a:a;if(0===a)kk=0<1/a?0:2147483648,jk=0;else if(isNaN(a))kk=2147483647,jk=4294967295;else if(1.7976931348623157E308<a)kk=(b<<31|2146435072)>>>0,jk=0;else if(2.2250738585072014E-308>a)a/=Math.pow(2,-1074),kk=(b<<31|a/4294967296)>>>0,jk=a>>>0;else{var c=a,d=0;if(2<=c)for(;2<=c&&1023>d;)d++,c/=2;else for(;1>c&&-1022<d;)c*=2,d--;a*=Math.pow(2,-d);kk=(b<<31|d+1023<<20|1048576*a&1048575)>>>
0;jk=4503599627370496*a>>>0}},ok=function(a,b){return 4294967296*b+(a>>>0)},pk=function(a,b){var c=b&2147483648;c&&(a=~a+1>>>0,b=~b>>>0,0==a&&(b=b+1>>>0));a=ok(a,b);return c?-a:a},qk=function(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)},rk=function(a,b){var c=b&2147483648;c&&(a=~a+1>>>0,b=~b+(0==a?1:0)>>>0);a=qk(a,b);return c?"-"+a:a},sk=function(a){if(a.constructor===Uint8Array)return a;if(a.constructor===ArrayBuffer)return new Uint8Array(a);if(a.constructor===Array)return new Uint8Array(a);if(a.constructor===String)return ik(a);Eb("Type not convertible to Uint8Array.");return new Uint8Array(0)};var uk=function(a,b,c){this.h=null;this.g=this.j=this.m=0;this.o=!1;a&&tk(this,a,b,c)},vk=[],wk=function(a,b,c){if(vk.length){var d=vk.pop();a&&tk(d,a,b,c);return d}return new uk(a,b,c)};uk.prototype.clone=function(){return wk(this.h,this.m,this.j-this.m)};uk.prototype.clear=function(){this.h=null;this.g=this.j=this.m=0;this.o=!1};var tk=function(a,b,c,d){a.h=sk(b);a.m=void 0!==c?c:0;a.j=void 0!==d?a.m+d:a.h.length;a.g=a.m};uk.prototype.reset=function(){this.g=this.m};
var xk=function(a,b){for(var c=128,d=0,e=0,f=0;4>f&&128<=c;f++)c=a.h[a.g++],d|=(c&127)<<7*f;128<=c&&(c=a.h[a.g++],d|=(c&127)<<28,e|=(c&127)>>4);if(128<=c)for(f=0;5>f&&128<=c;f++)c=a.h[a.g++],e|=(c&127)<<7*f+3;if(128>c)return b(d>>>0,e>>>0);Eb("Failed to read varint, encoding is invalid.");a.o=!0};
uk.prototype.l=function(){var a=this.h;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};uk.prototype.w=uk.prototype.l;
var yk=function(a){var b=a.h[a.g+0];var c=a.h[a.g+1];var d=a.h[a.g+2],e=a.h[a.g+3];a.g+=4;c=(b<<0|c<<8|d<<16|e<<24)>>>0;a=2*(c>>31)+1;b=c>>>23&255;c&=8388607;return 255==b?c?NaN:Infinity*a:0==b?a*Math.pow(2,-149)*c:a*Math.pow(2,b-150)*(c+Math.pow(2,23))};uk.prototype.s=function(){return this.w()};var zk=function(a){this.g=wk(a,void 0,void 0);this.m=this.g.g;this.j=this.h=-1;this.l=!1},Ak=function(a){return 4==a.j};zk.prototype.reset=function(){this.g.reset();this.j=this.h=-1};
var Bk=function(a){var b=a.g;if(b.g==b.j)return!1;(b=a.l)||(b=a.g,b=b.o||0>b.g||b.g>b.j);if(b)return Eb("Decoder hit an error"),!1;a.m=a.g.g;var c=a.g.l();b=c>>>3;c&=7;if(0!=c&&5!=c&&1!=c&&2!=c&&3!=c&&4!=c)return Eb("Invalid wire type: %s (at position %s)",c,a.m),a.l=!0,!1;a.h=b;a.j=c;return!0},Ck=function(a){switch(a.j){case 0:if(0!=a.j)Eb("Invalid wire type for skipVarintField"),Ck(a);else{for(a=a.g;a.h[a.g]&128;)a.g++;a.g++}break;case 1:1!=a.j?(Eb("Invalid wire type for skipFixed64Field"),Ck(a)):
(a=a.g,a.g+=8);break;case 2:if(2!=a.j)Eb("Invalid wire type for skipDelimitedField"),Ck(a);else{var b=a.g.l();a=a.g;a.g+=b}break;case 5:5!=a.j?(Eb("Invalid wire type for skipFixed32Field"),Ck(a)):(a=a.g,a.g+=4);break;case 3:b=a.h;do{if(!Bk(a)){Eb("Unmatched start-group tag: stream EOF");a.l=!0;break}if(4==a.j){a.h!=b&&(Eb("Unmatched end-group tag"),a.l=!0);break}Ck(a)}while(1);break;default:a.l=!0,Eb("Invalid wire encoding for field.")}},Dk=function(a,b,c){var d=a.g.j,e=a.g.l();e=a.g.g+e;a.g.j=e;
c(b,a);a.g.g=e;a.g.j=d},Ek=function(a){return!!a.g.l()},Fk=function(a){return xk(a.g,pk)},Gk=function(a){var b=a.g.l();a=a.g;var c=a.h,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 l=c[d++];f.push((g&15)<<12|(h&63)<<6|l&63)}else if(248>g){h=c[d++];l=c[d++];var p=c[d++];g=(g&7)<<18|(h&63)<<12|(l&63)<<6|p&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,ec(f,e,e+8192));f=c}a.g=d;return b+f},Hk=function(a,b){var c=a.g.l();c=a.g.g+c;for(var d=[];a.g.g<c;)d.push(b.call(a.g));return d};var Ik=function(){this.g=[]};Ik.prototype.length=function(){return this.g.length};Ik.prototype.end=function(){var a=this.g;this.g=[];return a};
var Jk=function(a){for(var b=jk,c=kk;0<c||127<b;)a.g.push(b&127|128),b=(b>>>7|c<<25)>>>0,c>>>=7;a.g.push(b)},Kk=function(a,b){for(;127<b;)a.g.push(b&127|128),b>>>=7;a.g.push(b)},Lk=function(a,b){if(0<=b)Kk(a,b);else{for(var c=0;9>c;c++)a.g.push(b&127|128),b>>=7;a.g.push(1)}},Mk=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 Nk=function(){this.l=[];this.j=0;this.h=new Ik;this.w=[]},Pk=function(a,b){Ok(a,b,2);b=a.h.end();a.l.push(b);a.j+=b.length;b.push(a.j);return b},Qk=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++};Nk.prototype.reset=function(){this.l=[];this.h.end();this.j=0;this.w=[]};
var Rk=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},Ok=function(a,b,c){Kk(a.h,8*b+c)},Sk=function(a,b,c){null!=c&&(Ok(a,b,0),a=a.h,lk(c),Jk(a))};Nk.prototype.g=function(a,b){null!=b&&null!=b&&(Ok(this,a,0),Lk(this.h,b))};var Tk=function(a,b,c){null!=c&&null!=c&&(Ok(a,b,0),a=a.h,lk(c),Jk(a))};Nk.prototype.m=function(a,b){null!=b&&null!=b&&(Ok(this,a,0),Kk(this.h,b))};
var Uk=function(a,b,c){null!=c&&(Ok(a,b,5),Mk(a.h,c))},Vk=function(a,b,c){null!=c&&(Ok(a,b,5),a=a.h,mk(c),Mk(a,jk))},E=function(a,b,c){null!=c&&(Ok(a,b,0),a.h.g.push(c?1:0))},F=function(a,b,c){null!=c&&(Ok(a,b,0),Lk(a.h,c))},H=function(a,b,c){if(null!=c){b=Pk(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)}Qk(a,b)}},I=function(a,b,c,d){null!=c&&(b=Pk(a,b),d(c,a),Qk(a,b))},Wk=function(a,b,c){if(null!=c)for(var d=0;d<c.length;d++){var e=a,f=c[d];null!=f&&(Ok(e,b,0),Lk(e.h,f))}},Xk=function(a,b,c){if(null!=c)for(var d=0;d<c.length;d++)Uk(a,b,c[d])},Yk=function(a,b,c){if(null!=c)for(var d=0;d<c.length;d++)H(a,b,c[d])},Zk=function(a,
b,c,d){if(null!=c)for(var e=0;e<c.length;e++){var f=Pk(a,b);d(c[e],a);Qk(a,f)}},$k=function(a,b,c,d){if(null!=c)for(var e=0;e<c.length;e++)Ok(a,b,3),d(c[e],a),Ok(a,b,4)},al=function(a,b,c){if(null!=c&&c.length){b=Pk(a,b);for(var d=0;d<c.length;d++)Lk(a.h,c[d]);Qk(a,b)}},bl=function(a,b,c){if(null!=c&&c.length)for(Ok(a,b,2),Kk(a.h,4*c.length),b=0;b<c.length;b++){var d=a.h;mk(c[b]);Mk(d,jk)}},cl=function(a,b,c){if(null!=c&&c.length){b=Pk(a,b);for(var d=0;d<c.length;d++)Lk(a.h,c[d]);Qk(a,b)}};var el=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 dl(c,b[1])}this.j=!0}};el.prototype.Ac=function(){var a;if(!this.j){this.h.length=0;var b=fl(this);b.sort();for(var c=0;c<b.length;c++){var d=this.g[b[c]];(a=d.g)&&a.Ac();this.h.push([d.key,d.value])}this.j=!0}return this.h};var gl=function(a){this.g=0;this.h=a};
gl.prototype.next=function(){return this.g<this.h.length?{done:!1,value:this.h[this.g++]}:{done:!0,value:void 0}};"undefined"!=typeof Symbol&&(gl.prototype[Symbol.iterator]=function(){return this});k=el.prototype;k.clear=function(){this.g={};this.j=!1};k.entries=function(){var a=[],b=fl(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 gl(a)};k.keys=function(){var a=[],b=fl(this);b.sort();for(var c=0;c<b.length;c++)a.push(this.g[b[c]].key);return new gl(a)};
k.values=function(){var a=[],b=fl(this);b.sort();for(var c=0;c<b.length;c++)a.push(this.g[b[c]].value);return new gl(a)};k.forEach=function(a,b){var c=fl(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 dl(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 fl=function(a){a=a.g;var b=[],c;for(c in a)Object.prototype.hasOwnProperty.call(a,c)&&b.push(c);return b},dl=function(a,b){this.key=a;this.value=b;this.g=void 0};var J=function(){},hl="function"==typeof Uint8Array,K=function(a,b,c,d,e,f){a.g=null;b||(b=c?[c]:[]);a.K=c?String(c):void 0;a.m=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)||hl&&c instanceof Uint8Array))){a.w=b-a.m;a.l=c;break a}-1<d?(a.w=Math.max(d,b+1-a.m),a.l=null):a.w=Number.MAX_VALUE}a.s={};if(e)for(d=0;d<e.length;d++)b=e[d],b<a.w?(b+=a.m,a.h[b]=a.h[b]||il):(jl(a),a.l[b]=a.l[b]||il);if(f&&f.length)for(d=0;d<f.length;d++)kl(a,f[d])},
il=Object.freeze?Object.freeze([]):[],jl=function(a){var b=a.w+a.m;a.h[b]||(a.l=a.h[b]={})},L=function(a,b){if(b<a.w){b+=a.m;var c=a.h[b];return c===il?a.h[b]=[]:c}if(a.l)return c=a.l[b],c===il?a.l[b]=[]:c},ll=function(a,b){a=L(a,b);return null==a?a:+a},ml=function(a,b){a=L(a,b);return null==a?a:!!a},nl=function(a,b){var c=L(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},M=function(a,b,c){a=L(a,b);return null==a?c:a},ol=function(a,b,c){a=ml(a,b);return null==
a?c:a},pl=function(a,b){a=ll(a,b);return null==a?0:a},O=function(a,b,c){b<a.w?a.h[b+a.m]=c:(jl(a),a.l[b]=c);return a},P=function(a,b,c){return ql(a,b,c,"")},rl=function(a,b,c){ql(a,b,c,0)},ql=function(a,b,c,d){c!==d?O(a,b,c):b<a.w?a.h[b+a.m]=null:(jl(a),delete a.l[b]);return a},sl=function(a,b,c,d){(c=kl(a,c))&&c!==b&&void 0!==d&&(a.g&&c in a.g&&(a.g[c]=void 0),O(a,c,void 0));O(a,b,d)},kl=function(a,b){for(var c,d,e=0;e<b.length;e++){var f=b[e],g=L(a,f);null!=g&&(c=f,d=g,O(a,f,void 0))}return c?(O(a,
c,d),c):0},Q=function(a,b,c,d){a.g||(a.g={});if(!a.g[c]){var e=L(a,c);if(d||e)a.g[c]=new b(e)}return a.g[c]},R=function(a,b,c){tl(a,b,c);b=a.g[c];b==il&&(b=a.g[c]=[]);return b},tl=function(a,b,c){a.g||(a.g={});if(!a.g[c]){for(var d=L(a,c),e=[],f=0;f<d.length;f++)e[f]=new b(d[f]);a.g[c]=e}},S=function(a,b,c){a.g||(a.g={});var d=c?c.Ac():c;a.g[b]=c;return O(a,b,d)},vl=function(a,b,c){var d=ul[0];a.g||(a.g={});var e=c?c.Ac():c;a.g[b]=c;sl(a,b,d,e)},wl=function(a,b,c){a.g||(a.g={});c=c||[];for(var d=
[],e=0;e<c.length;e++)d[e]=c[e].Ac();a.g[b]=c;return O(a,b,d)},xl=function(a,b,c,d){tl(a,d,b);var e=a.g[b];e||(e=a.g[b]=[]);c=c?c:new d;a=L(a,b);e.push(c);a.push(c.Ac());return c},yl=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].Ac();else c&&c.Ac()}};J.prototype.Ac=function(){yl(this);return this.h};
J.prototype.va=hl?function(){var a=Uint8Array.prototype.toJSON;Uint8Array.prototype.toJSON=function(){return gk(this)};try{return JSON.stringify(this.h&&this.Ac(),zl)}finally{Uint8Array.prototype.toJSON=a}}:function(){return JSON.stringify(this.h&&this.Ac(),zl)};var zl=function(a,b){return"number"!==typeof b||!isNaN(b)&&Infinity!==b&&-Infinity!==b?b:String(b)};J.prototype.toString=function(){yl(this);return this.h.toString()};
var Bl=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(!Al(a[d],b[d]))return!1;return!0},Al=function(a,b){if(a==b)return!0;if(!Pa(a)||!Pa(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(hl&&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(!Al(g,h))return!1}return d||e?(d=d||{},e=e||{},Bl(d,e)):!0}if(a.constructor===Object)return Bl(a,b);throw Error("Invalid type in JSPB array");};J.prototype.clone=function(){return Cl(this)};
var Cl=function(a){return new a.constructor(Dl(a.Ac()))},Dl=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?Dl(d):d)}return b}if(hl&&a instanceof Uint8Array)return new Uint8Array(a);b={};for(c in a)d=a[c],null!=d&&(b[c]="object"==typeof d?Dl(d):d);return b};var El=function(a){K(this,a,0,-1,null,null)};y(El,J);var Fl=function(a){K(this,a,0,-1,null,null)};y(Fl,J);
var Il=function(a,b){for(;Bk(b)&&!Ak(b);)switch(b.h){case 1:var c=xk(b.g,pk);Gl(a,c);break;case 2:c=Gk(b);O(a,2,c);break;case 3:c=new Fl;Dk(b,c,Hl);S(a,3,c);break;default:Ck(b)}return a},Kl=function(a,b){var c=L(a,1);null!=c&&Tk(b,1,c);c=L(a,2);null!=c&&H(b,2,c);c=Q(a,Fl,3);null!=c&&I(b,3,c,Jl)},Hl=function(a,b){for(;Bk(b)&&!Ak(b);)switch(b.h){case 1:var c=Gk(b);O(a,1,c);break;case 2:c=xk(b.g,pk);O(a,2,c);break;default:Ck(b)}return a},Jl=function(a,b){var c=L(a,1);null!=c&&H(b,1,c);c=L(a,2);null!=
c&&Tk(b,2,c)};El.prototype.dc=function(){return L(this,1)};var Gl=function(a,b){return O(a,1,b)};var Ll=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};x("castApp.eventPage.Message",Ll);var Ml=function(a,b,c){this.ipAddress=a;this.appId=b;this.sessionId=c};Ll.DeviceData=Ml;Ll.DeviceJustSetUp=function(a,b,c,d){this.ipAddress=a;this.name=b;this.udn=c;this.modelName=d};Ll.DeviceCapabilities=function(){};
Ll.LogRecord=function(a,b,c,d){this.levelValue=a;this.msg=b;this.loggerName=c;this.time=d};var Nl=function(a,b){this.type=a;this.entryPoint=b};x("castApp.frontEnd.ExtensionMessage",Nl);var Ol=function(a){return"urn:x-cast:com.google.cast."+a},Pl=Ol("tp.connection"),Ql=Ol("receiver"),Rl=Ol("remoting"),Sl=Ol("media"),Tl=Ol("webrtc"),Ul=Ol("broadcast"),Vl=Kc({hJ:Pl,iJ:Ol("tp.heartbeat"),EF:Ql,ZF:Rl,VC:Sl,cD:Ol("media.universalRemote.optIn"),fK:Tl,Fx:Ul});var Wl=function(a){return"available"==a||"available_rescan"==a};var Xl=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 Yl=window.localStorage,Zl=0,am=function(a){return(a=window.localStorage.getItem($l(a,!1)))?JSON.parse(a):null},bm=function(a){return(a=window.localStorage.getItem($l(a,!0)))?JSON.parse(a):null},dm=function(a){if(cm.has(a.Ta()))throw Error("Duplicate instance name "+a.Ta());cm.set(a.Ta(),a);a.Db()},jm=function(a){for(var b=0,c=n(Object.keys(Yl)),d=c.next();!d.done;d=c.next()){d=d.value;var e=d.length+window.localStorage.getItem(d).length;d.startsWith("mr.")?Zl+=e:b+=e}em=a;(window.localStorage.getItem("version")&&
window.localStorage.getItem("version")!==chrome.runtime.getManifest().version||fm(a))&&gm();B(hm,"initialize: "+Zl+" chars used, "+b+" other chars");chrome.runtime.onSuspend.addListener(im)},em=null,hm=ab("mr.PersistentDataManager"),cm=new Map,$l=function(a,b){return"mr."+(b?"persistent.":"temp.")+a.Ta()},fm=function(a){return!!window.localStorage.getItem("mrInstanceId")&&window.localStorage.getItem("mrInstanceId")!==a},im=function(){B(hm,"onSuspend");km("version",chrome.runtime.getManifest().version);
em&&km("mrInstanceId",em);for(var a=cm.get("LogManager"),b=n(cm),c=b.next();!c.done;c=b.next())c=n(c.value),c.next(),c=c.next().value,c!=a&&lm(c);a&&lm(a)},lm=function(a){try{var b=a.Fb();b&&void 0!=b[0]&&km($l(a,!1),JSON.stringify(b[0]));b&&void 0!=b[1]&&km($l(a,!0),JSON.stringify(b[1]))}catch(c){hm.error("Error while saving data for "+a.Ta()+": "+c.message)}},km=function(a,b){var c=window.localStorage.getItem(a);c=null!=c?b.length-c.length:a.length+b.length;52E5<Zl+c&&(hm.J("Unable to write "+c+
" chars"),gm());if(52E5<Zl+c)throw hm.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.");}Zl+=c},mm=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)));km("mr.temp.mirror.cast.Service.eventsBlob",f.join(""));b()}catch(l){c(l)}};d.readAsArrayBuffer(a)})},gm=function(){for(var a=n(Object.keys(Yl)),b=a.next();!b.done;b=a.next())b=b.value,b.startsWith("mr.temp.")&&(Zl-=b.length+window.localStorage.getItem(b).length,delete window.localStorage[b]);B(hm,"removeTemporary_: "+Zl+" chars used")};var nm=(new Map).set("+","-").set("/","_").set("=",".");(new Map).set("-","+").set("_","/").set(".","=");function om(a){return btoa(String.fromCharCode.apply(String,q(a))).replace(/[+/=]/g,function(b){return nm.get(b)})};var pm=function(){this.g=[];this.m=[];this.w=[];this.j=[];this.j[0]=128;for(var a=1;64>a;++a)this.j[a]=0;this.l=this.h=0;this.reset()};pm.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 qm=function(a,b,c){c=void 0===c?0:c;var d=a.w;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,l,p=0;80>p;p++)40>p?20>p?(h=f^c&(e^f),l=1518500249):(h=c^e^f,l=1859775393):60>p?(h=c&e|f&(c|e),l=2400959708):(h=
c^e^f,l=3395469782),h=(b<<5|b>>>27)+h+g+l+d[p]&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};
pm.prototype.update=function(a,b){b=void 0===b?a.length:b;for(var c=b-64,d=0,e=this.m,f=this.h;d<b;){if(0==f)for(;d<=c;)qm(this,a,d),d+=64;if("string"===typeof a)for(;d<b;){if(e[f]=a.charCodeAt(d),++f,++d,64==f){qm(this,e);f=0;break}}else for(;d<b;)if(e[f]=a[d],++f,++d,64==f){qm(this,e);f=0;break}}this.h=f;this.l+=b};
pm.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.m[c]=b&255,b/=256;qm(this,this.m);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 rm=function(){return Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^Date.now()).toString(36)};var tm=function(){this.l=rm();this.h=new sm(null,null);this.g=new sm(null,null);this.m=[];this.j=0;dm(this)},vm=function(){um||(um=new tm);return um},wm=function(a,b){b=b.toLowerCase();var c=new pm;c.update(b);c.update(a.l);return"r"+om(c.digest())},xm=function(){var a=vm();return a.h.model?a.h:a.g.model?a.g:new sm(null,null)};tm.prototype.Ta=function(){return"SinkUtils"};
tm.prototype.Fb=function(){return[{recentLaunchedDevice:this.h,recentDiscoveredDevice:this.g},{receiverIdToken:this.l,fixedIpList:this.m.join(","),castControlPort:this.j}]};tm.prototype.Db=function(){var a=am(this);a&&(this.h=a.recentLaunchedDevice||new sm(null,null),this.g=a.recentDiscoveredDevice||new sm(null,null));if(a=bm(this))this.l=a.receiverIdToken||rm(),this.m=a.fixedIpList&&a.fixedIpList.split(",")||[],this.j=a.castControlPort||0};var um=null,sm=function(a,b){this.model=a;this.ip=b};var ym=function(a,b,c,d,e,f){this.h=new Xl(a,b,d&1?"cast":d&32?"cast_audio_group":"cast_audio");this.l=c||null;this.g=d||null;this.m=e||null;this.w=f||null;this.j={};this.Yi=!1};ym.prototype.update=function(a,b,c,d){var e=!1;this.h.friendlyName!=a&&(this.h.friendlyName=a,e=!0);null!=b&&this.m!=b&&(this.m=b,e=!0);null!=c&&this.w!=c&&(this.w=c,e=!0);null!=d&&this.g!=d&&(this.g=d,e=!0);return e};ym.prototype.getId=function(){return this.h.id};ym.prototype.Gc=function(){return this.m};
ym.prototype.zb=function(){return this.w};var zm=function(a,b){return a.j[b]||"unknown"};var Am="StopIteration"in Ea?Ea.StopIteration:{message:"StopIteration",stack:""},Bm=function(){};Bm.prototype.next=function(){throw Am;};Bm.prototype.Pb=function(){return this};
var Cm=function(a){if(a instanceof Bm)return a;if("function"==typeof a.Pb)return a.Pb(!1);if(Na(a)){var b=0,c=new Bm;c.next=function(){for(;;){if(b>=a.length)throw Am;if(b in a)return a[b++];b++}};return c}throw Error("Not implemented");},Dm=function(a,b,c){if(Na(a))try{Hb(a,b,c)}catch(d){if(d!==Am)throw d;}else{a=Cm(a);try{for(;;)b.call(c,a.next(),void 0,a)}catch(d){if(d!==Am)throw d;}}},Em=function(a,b){a=Cm(a);try{for(;!b.call(void 0,a.next(),void 0,a););}catch(c){if(c!==Am)throw c;}},Fm=function(a){if(Na(a))return cc(a);
a=Cm(a);var b=[];Dm(a,function(c){b.push(c)});return b};var Hm=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&&Gm(this,a)};Hm.prototype.wa=function(){return this.j};Hm.prototype.Ja=function(){Im(this);for(var a=[],b=0;b<this.g.length;b++)a.push(this.h[this.g[b]]);return a};Hm.prototype.Lb=function(){Im(this);return this.g.concat()};var Km=function(a,b){return Jm(a.h,b)};
Hm.prototype.kf=function(a){for(var b=0;b<this.g.length;b++){var c=this.g[b];if(Jm(this.h,c)&&this.h[c]==a)return!0}return!1};Hm.prototype.equals=function(a,b){if(this===a)return!0;if(this.j!=a.wa())return!1;b=b||Lm;Im(this);for(var c,d=0;c=this.g[d];d++)if(!b(this.get(c),a.get(c)))return!1;return!0};var Lm=function(a,b){return a===b};Hm.prototype.uc=function(){return 0==this.j};Hm.prototype.clear=function(){this.h={};this.l=this.j=this.g.length=0};
Hm.prototype.remove=function(a){return Jm(this.h,a)?(delete this.h[a],this.j--,this.l++,this.g.length>2*this.j&&Im(this),!0):!1};var Im=function(a){if(a.j!=a.g.length){for(var b=0,c=0;b<a.g.length;){var d=a.g[b];Jm(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],Jm(e,d)||(a.g[c++]=d,e[d]=1),b++;a.g.length=c}};Hm.prototype.get=function(a,b){return Jm(this.h,a)?this.h[a]:b};
Hm.prototype.set=function(a,b){Jm(this.h,a)||(this.j++,this.g.push(a),this.l++);this.h[a]=b};var Gm=function(a,b){if(b instanceof Hm)for(var c=b.Lb(),d=0;d<c.length;d++)a.set(c[d],b.get(c[d]));else for(c in b)a.set(c,b[c])};Hm.prototype.forEach=function(a,b){for(var c=this.Lb(),d=0;d<c.length;d++){var e=c[d],f=this.get(e);a.call(b,f,e,this)}};Hm.prototype.clone=function(){return new Hm(this)};var Mm=function(a){Im(a);for(var b={},c=0;c<a.g.length;c++){var d=a.g[c];b[d]=a.h[d]}return b};
Hm.prototype.Pb=function(a){Im(this);var b=0,c=this.l,d=this,e=new Bm;e.next=function(){if(c!=d.l)throw Error("The map has changed since the iterator was created");if(b>=d.g.length)throw Am;var f=d.g[b++];return a?f:d.h[f]};return e};var Jm=function(a,b){return Object.prototype.hasOwnProperty.call(a,b)};var Nm=function(a,b){this.l=b;this.j=a;this.j.w=this.h.bind(this);this.g=new Hm;this.m=new Hm;this.u=ab("mr.cast.SinkDiscoveryService");this.Eh={dm:0,gn:0}};u(Nm,Zi);Nm.prototype.init=function(){dm(this);ij("mr.cast.SinkDiscoveryService",this)};
var Vm=function(a,b){B(a.u,"addSinks returned "+b.length+" sinks");hb(a.u,function(){return"....the list is: "+JSON.stringify(b)});var c=new Set(a.g.Lb());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,l=g.ip_endpoint?g.ip_endpoint.port:vm().j||8009;f=new ym(f,e.name,g.model_name,g.capabilities,h.address_bytes.join("."),l);g=a.g.get(f.getId());h=a.j;e=e.extra_data.cast_media_sink.cast_channel_id;l=f.getId();var p=h.h.get(l);
if(!p||p.channelId!=e){B(Om,"Added cast channel "+e+" to receiver: "+l);p&&h.g.remove(p.channelId);p={auth:"ssl_verified",ipAddress:f.Gc(),port:f.zb()};p={channelId:e,readyState:"open",keepAlive:!0,audioOnly:!(f.g&1),connectInfo:p};h.h.set(l,p);h.g.set(e,l);var r=h.l.get(l);r&&r.channelId!=e&&(B(Om,"Re-connected to receiver: "+f.getId()),Pm(h.j,r,p),Qm(h.m.m,f,!0));h.l.set(l,p)}if(g){if(h=g.update(f.h.friendlyName,f.Gc(),f.zb(),f.g))g.Yi=!1;h&&Rm(a.l,g)}else B(a.u,"Adding sink "+f.getId()),Sm(a,f),
g=a.l,g.j.onSinkAvailabilityUpdated(g,1),Rm(g,f),Qm(g.m,f),vm().g=new sm(f.l,f.Gc());c.delete(f.getId())});c.forEach(function(e){var f=a.j,g=f.l.get(e);g&&(Tm(f.j,g),f.l.remove(e));Um(a,e)});var d=a.g.wa();a.Eh={dm:d,gn:d}},Sm=function(a,b){var c=a.g.get(b.getId()),d=null,e=b.Gc(),f=b.zb();null!=e&&null!=f&&(d=a.m.get(e+":"+f));if(c&&!d){var g=b.Gc(),h=b.zb();g&&h&&a.m.remove(g+":"+h)}d&&!c&&a.g.remove(d.getId());a.g.set(b.getId(),b);null!=e&&null!=f&&a.m.set(e+":"+f,b)},Um=function(a,b){var c=a.g.get(b);
if(c){B(a.u,"Removing sink "+b);a.g.remove(b);b=c.Gc();var d=c.zb();null!=b&&null!=d&&a.m.remove(b+":"+d);a=a.l;if(0==a.g.g.wa())a.j.onSinkAvailabilityUpdated(a,0);b=a.m;c=c.getId();(c=Wm(b.g,c))&&c.session&&Xm(b,c.session.sessionId);Ym(a.G);Zm(a.j)}},an=function(a){B(a.u,"Pruning inactive sinks.");var b=new Set;a.g.forEach(function(c){$m(a.j,c)||b.add(c.getId())});b.forEach(function(c){return Um(a,c)})};Nm.prototype.h=function(a){return this.g.get(a,null)};
var bn=function(a,b){var c=[];Dm(a.g.Pb(!1),function(d){Wl(zm(d,b))&&c.push(d)});return c};Nm.prototype.Ta=function(){return"cast.SinkDiscoveryService"};Nm.prototype.Fb=function(){var a=this,b={};Dm(this.g.Pb(!0),function(c){var d=a.g.get(c);d={id:d.getId(),ip:d.Gc(),port:d.zb(),friendlyName:d.h.friendlyName,modelName:d.l,capabilities:d.g,discoveredByDial:d.Yi,appStatusMap:d.j};b[c]=d});return[new cn(b,this.Eh)]};
Nm.prototype.Db=function(){var a=am(this);if(a&&4==a.version){this.Eh=a.deviceCounts;a=a.sinkMap;for(var b in a){var c=void 0,d=a[b],e=new ym("",d.friendlyName,d.modelName,d.capabilities,d.ip,d.port);e.h.id=d.id;e.Yi=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())||Sm(this,c)}an(this)}};var cn=function(a,b){this.sinkMap=a;this.deviceCounts=b;this.version=4};var dn={STOP_MEDIA:"STOP",MEDIA_SET_VOLUME:"SET_VOLUME",MEDIA_GET_STATUS:"GET_STATUS"};var en=function(){this.type="GET_STATUS";this.requestId=0};var fn=function(a,b){this.requestId=a;this.Xe=b;this.bp=null};fn.prototype.g=function(){};var gn=function(){this.g=new Hm},hn=function(a,b){a.g.set(b.requestId,b);b.bp=setTimeout(function(){a.g.remove(b.requestId);b.g()},b.Xe)},jn=function(a,b){var c=a.g.get(b);if(!c)return null;clearTimeout(c.bp);a.g.remove(b);return c};var kn=function(a,b,c){this.type="APPLICATION_BROADCAST";this.requestId=0;this.appIds=a;this.namespace=b;this.message=c};var ln=function(a){this.type="LAUNCH";this.requestId=0;this.appId=a;this.language=null};var mn=function(a){this.type="STOP";this.requestId=0;this.sessionId=a||null};var nn=function(a){this.h=a;this.g=1E3*Math.floor(1E6*Math.random())},on=function(a){var b=a.g++;0==b&&(b=a.g++);return b};nn.prototype.Ta=function(){return"IdGenerator."+this.h};nn.prototype.Fb=function(){return[this.g]};nn.prototype.Db=function(){var a=am(this);a&&(this.g=a)};var pn=function(a,b){this.h=a;this.j=b;this.g=new gn;this.l=new nn("cast.RequestIdGenerator")};pn.prototype.init=function(){dm(this.l)};var rn=function(a,b,c,d){var e=on(a.l);b.requestId=e;b=new Ab;c=new qn(e,b,"number"===typeof c&&0<c?c:6E5,d);hn(a.g,c);return c};
pn.prototype.sendRequest=function(a,b,c,d,e,f){var g=this;if(!Vl.hasOwnProperty(c))return Promise.reject(Error("Custom namespace is not supported"));var h=rn(this,a,void 0!==d?d:3E3,e),l=h.yb;sn(this.h,b,c,a,e||this.j,f).then(null,function(){jn(g.g,h.requestId);l.reject(tn)});return l.g};
pn.prototype.sendMessage=function(a,b,c,d,e,f){var g=this,h=rn(this,a,void 0!==d?d:3E3,e),l=h.yb;sn(this.h,b,c,a,e||this.j,f).then(function(){jn(g.g,h.requestId);l.resolve(!0)},function(){jn(g.g,h.requestId);l.reject(tn)});return l.g};
var un=function(a,b,c){var d=new ln(b.appId);d.language=b.language?b.language:chrome.i18n.getUILanguage?chrome.i18n.getUILanguage():chrome.runtime.getManifest().default_locale;return a.sendRequest(d,c,Ql,b.requestSessionTimeout)},vn=Error("Timeout"),tn=Error("Failed to send message"),qn=function(a,b,c,d){fn.call(this,a,c);this.yb=b;this.sourceId=d};u(qn,fn);qn.prototype.g=function(){this.yb.reject(vn)};var wn=function(a){return a.wa&&"function"==typeof a.wa?a.wa():Na(a)||"string"===typeof a?a.length:Ac(a)},xn=function(a){if(a.Ja&&"function"==typeof a.Ja)return a.Ja();if("string"===typeof a)return a.split("");if(Na(a)){for(var b=[],c=a.length,d=0;d<c;d++)b.push(a[d]);return b}return Cc(a)},yn=function(a){if(a.Lb&&"function"==typeof a.Lb)return a.Lb();if(!a.Ja||"function"!=typeof a.Ja){if(Na(a)||"string"===typeof a){var b=[];a=a.length;for(var c=0;c<a;c++)b.push(c);return b}return Dc(a)}},zn=function(a){return a.uc&&
"function"==typeof a.uc?a.uc():Na(a)||"string"===typeof a?0==a.length:Gc(a)},An=function(a,b,c){if(a.forEach&&"function"==typeof a.forEach)a.forEach(b,c);else if(Na(a)||"string"===typeof a)Hb(a,b,c);else for(var d=yn(a),e=xn(a),f=e.length,g=0;g<f;g++)b.call(c,e[g],d&&d[g],a)},Bn=function(a,b,c){if("function"==typeof a.map)return a.map(b,c);if(Na(a)||"string"===typeof a)return Kb(a,b,c);var d=yn(a),e=xn(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},Cn=function(a,b){if("function"==typeof a.every)return a.every(b,void 0);if(Na(a)||"string"===typeof a)return Pb(a,b,void 0);for(var c=yn(a),d=xn(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 Dn=function(a){this.g=new Hm;if(a){a=xn(a);for(var b=a.length,c=0;c<b;c++)this.add(a[c])}},En=function(a){var b=typeof a;return"object"==b&&a||"function"==b?"o"+Sa(a):b.substr(0,1)+a};k=Dn.prototype;k.wa=function(){return this.g.wa()};k.add=function(a){this.g.set(En(a),a)};k.removeAll=function(a){a=xn(a);for(var b=a.length,c=0;c<b;c++)this.remove(a[c])};k.remove=function(a){return this.g.remove(En(a))};k.clear=function(){this.g.clear()};k.uc=function(){return this.g.uc()};
k.contains=function(a){return Km(this.g,En(a))};k.Ja=function(){return this.g.Ja()};k.clone=function(){return new Dn(this)};k.equals=function(a){return this.wa()==wn(a)&&Fn(this,a)};var Fn=function(a,b){var c=wn(b);if(a.wa()>c)return!1;!(b instanceof Dn)&&5<c&&(b=new Dn(b));return Cn(a,function(d){var e=b;return e.contains&&"function"==typeof e.contains?e.contains(d):e.kf&&"function"==typeof e.kf?e.kf(d):Na(e)||"string"===typeof e?Tb(e,d):Fc(e,d)})};Dn.prototype.Pb=function(){return this.g.Pb(!1)};var Hn=function(a,b){this.m=a;this.j=b;this.h=new Hm;this.g=new Dn;this.l=0;this.s=new Hm("serviceCheck",this.Es.bind(this),"startDeviceMonitor",this.Fs.bind(this),"releaseDeviceMonitor",this.Ds.bind(this),"deviceJustSetUp",this.Bs.bind(this),"logRecord",this.Cs.bind(this));chrome.runtime.onMessage.addListener(this.o.bind(this));chrome.runtime.onMessageExternal.addListener(this.w.bind(this));Gn(this,"serviceReady")};Hn.prototype.u=ab("castApp.eventPage.Service");
var Ym=function(a){if(In(a)){var b=new Dn;Dm(a.m.g.Pb(!1),function(d){var e=d.Gc();b.add(e);Km(this.h,e)||this.j.sendRequest(new en,d,Ql)}.bind(a));var c=!1;a.h.Lb().forEach(function(d){b.contains(d)||(this.h.remove(d),c=!0)}.bind(a));c&&Jn(a)}},In=function(a){if(0===a.g.wa())return!1;var b=Xa();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?(B(this.u,"No tabs found. Clearing device monitor clients."),
this.g.clear()):B(this.u,function(){return"Tab check found active tabs: "+c.map(function(d){return d.id})})}.bind(a)));b=a.g.wa();B(a.u,"Monitor client count: "+b);return 0<b};Hn.prototype.o=function(a,b,c){if("object"!==typeof a||"cast_app"!==a.type)return!1;var d=this.s.get(a.subtype);if(!d)return!1;if(!a.originId)return Eb("Missing origin ID in the incoming message."),!1;try{var e=d(a,b,c);e&&c(e)}catch(f){this.u.error("Error while handling request",f)}return!1};
var Gn=function(a,b,c){var d=new Ll(b,c);hb(a.u,function(){return"Sending message: "+JSON.stringify(d)});chrome.runtime.sendMessage(d)};k=Hn.prototype;k.Es=function(){Gn(this,"serviceReady")};k.Fs=function(a){this.g.contains(a.originId)?B(this.u,"Client: "+a.originId+"already registered, dispatching current device list."):(B(this.u,"Registering monitor client: "+a.originId),this.g.add(a.originId));Jn(this);Kn(this)};k.Ds=function(a){B(this.u,"Unregistering monitor client: "+a.originId);this.g.remove(a.originId)};
k.Bs=function(a){a=a.deviceJustSetUp.udn.replace(/-/g,"").toLowerCase();B(this.u,"Device just set up: "+a.slice(-4))};k.Cs=function(a){a=a.logRecord;db({level:kb(a.levelValue),T:a.loggerName,time:a.time,message:a.msg})};var Jn=function(a){var b=a.h.Ja();Gn(a,"devices",b)},Kn=function(a){a.m.g.Ja().forEach(function(b){this.j.sendRequest(new en,b,Ql)}.bind(a))};
Hn.prototype.w=function(a,b,c){switch(a.type){case "handshake":c(new Nl("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})}};chrome.cast.VERSION=[1,2];x("chrome.cast.VERSION",chrome.cast.VERSION);chrome.cast.Dw=!0;x("chrome.cast.usingPresentationApi",chrome.cast.Dw);chrome.cast.Cp=function(a,b){this.credentials=a;this.credentialsType=void 0===b?"web":b};x("chrome.cast.CredentialsData",chrome.cast.Cp);chrome.cast.Error=function(a,b,c){this.code=a;this.description=b||null;this.details=c||null};x("chrome.cast.Error",chrome.cast.Error);chrome.cast.Iq=function(a){this.platform=a;this.packageId=this.url=null};
x("chrome.cast.SenderApplication",chrome.cast.Iq);chrome.cast.Image=function(a){this.url=a;this.width=this.height=null};x("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};x("chrome.cast.Volume",chrome.cast.Volume);chrome.cast.qd={CUSTOM_CONTROLLER_SCOPED:"custom_controller_scoped",TAB_AND_ORIGIN_SCOPED:"tab_and_origin_scoped",ORIGIN_SCOPED:"origin_scoped",PAGE_SCOPED:"page_scoped"};x("chrome.cast.AutoJoinPolicy",chrome.cast.qd);chrome.cast.ih={CREATE_SESSION:"create_session",CAST_THIS_TAB:"cast_this_tab"};x("chrome.cast.DefaultActionPolicy",chrome.cast.ih);chrome.cast.Jd={VIDEO_OUT:"video_out",AUDIO_OUT:"audio_out",VIDEO_IN:"video_in",AUDIO_IN:"audio_in",MULTIZONE_GROUP:"multizone_group"};
x("chrome.cast.Capability",chrome.cast.Jd);chrome.cast.td={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"};x("chrome.cast.ErrorCode",chrome.cast.td);chrome.cast.vq={AVAILABLE:"available",UNAVAILABLE:"unavailable"};
x("chrome.cast.ReceiverAvailability",chrome.cast.vq);chrome.cast.Jq={CHROME:"chrome",IOS:"ios",ANDROID:"android"};x("chrome.cast.SenderPlatform",chrome.cast.Jq);chrome.cast.Kl={CAST:"cast",DIAL:"dial",HANGOUT:"hangout",CUSTOM:"custom"};x("chrome.cast.ReceiverType",chrome.cast.Kl);chrome.cast.Hp={RUNNING:"running",STOPPED:"stopped",ERROR:"error"};x("chrome.cast.DialAppState",chrome.cast.Hp);chrome.cast.Di={CAST:"cast",STOP:"stop"};x("chrome.cast.ReceiverAction",chrome.cast.Di);
chrome.cast.Ol={CONNECTED:"connected",DISCONNECTED:"disconnected",STOPPED:"stopped"};x("chrome.cast.SessionStatus",chrome.cast.Ol);chrome.cast.Sl={ATTENUATION:"attenuation",FIXED:"fixed",MASTER:"master"};x("chrome.cast.VolumeControlType",chrome.cast.Sl);chrome.cast.up=function(a,b,c,d,e){this.sessionRequest=a;this.sessionListener=b;this.receiverListener=c;this.autoJoinPolicy=d||chrome.cast.qd.TAB_AND_ORIGIN_SCOPED;this.defaultActionPolicy=e||chrome.cast.ih.CREATE_SESSION;this.customDialLaunchCallback=null;this.invisibleSender=!1;this.additionalSessionRequests=[]};x("chrome.cast.ApiConfig",chrome.cast.up);chrome.cast.Kp=function(a,b){this.appName=a;this.launchParameter=b||null};x("chrome.cast.DialRequest",chrome.cast.Kp);
chrome.cast.Ip=function(a,b,c){this.receiver=a;this.appState=b;this.extraData=c||null};x("chrome.cast.DialLaunchData",chrome.cast.Ip);chrome.cast.Jp=function(a,b){this.doLaunch=a;this.launchParameter=b||null};x("chrome.cast.DialLaunchResponse",chrome.cast.Jp);
chrome.cast.Nl=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.Jd.VIDEO_OUT,chrome.cast.Jd.AUDIO_OUT];this.requestSessionTimeout=c;this.dialRequest=this.language=null;this.androidReceiverCompatible=d;this.credentialsData=e};x("chrome.cast.SessionRequest",chrome.cast.Nl);
chrome.cast.Jl=function(a,b,c,d){this.label=a;this.friendlyName=re(b);this.capabilities=c||[];this.volume=d||null;this.receiverType=chrome.cast.Kl.CAST;this.displayStatus=this.isActiveInput=null};x("chrome.cast.Receiver",chrome.cast.Jl);chrome.cast.wq=function(a,b){this.statusText=a;this.appImages=b;this.showStop=null};x("chrome.cast.ReceiverDisplayStatus",chrome.cast.wq);
chrome.cast.Ql=function(){this.requestSession=6E4;this.sendCustomMessage=this.setReceiverVolume=this.stopSession=this.leaveSession=3E3};x("chrome.cast.Timeout",chrome.cast.Ql);chrome.cast.timeout=new chrome.cast.Ql;x("chrome.cast.timeout",chrome.cast.timeout);chrome.cast.ol="auto-join";chrome.cast.Hl="cast-session_";chrome.cast.media.Qp={SDR:"sdr",HDR:"hdr",DV:"dv"};x("chrome.cast.media.HdrType",chrome.cast.media.Qp);chrome.cast.media.Rp={AAC:"aac",AC3:"ac3",MP3:"mp3",TS:"ts",TS_AAC:"ts_aac",E_AC3:"e_ac3",FMP4:"fmp4"};x("chrome.cast.media.HlsSegmentFormat",chrome.cast.media.Rp);chrome.cast.media.Sp={MPEG2_TS:"mpeg2_ts",FMP4:"fmp4"};x("chrome.cast.media.HlsVideoSegmentFormat",chrome.cast.media.Sp);chrome.cast.media.oe={PAUSE:"pause",SEEK:"seek",STREAM_VOLUME:"stream_volume",STREAM_MUTE:"stream_mute"};
x("chrome.cast.media.MediaCommand",chrome.cast.media.oe);chrome.cast.media.sq={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"};x("chrome.cast.media.QueueType",chrome.cast.media.sq);chrome.cast.media.yi={GENERIC_CONTAINER:0,AUDIOBOOK_CONTAINER:1};x("chrome.cast.media.ContainerType",chrome.cast.media.yi);
chrome.cast.media.pe={GENERIC:0,MOVIE:1,TV_SHOW:2,MUSIC_TRACK:3,PHOTO:4,AUDIOBOOK_CHAPTER:5};x("chrome.cast.media.MetadataType",chrome.cast.media.pe);chrome.cast.media.ff={IDLE:"IDLE",PLAYING:"PLAYING",PAUSED:"PAUSED",BUFFERING:"BUFFERING"};x("chrome.cast.media.PlayerState",chrome.cast.media.ff);chrome.cast.media.Ei={OFF:"REPEAT_OFF",ALL:"REPEAT_ALL",SINGLE:"REPEAT_SINGLE",ALL_AND_SHUFFLE:"REPEAT_ALL_AND_SHUFFLE"};x("chrome.cast.media.RepeatMode",chrome.cast.media.Ei);
chrome.cast.media.xq={PLAYBACK_START:"PLAYBACK_START",PLAYBACK_PAUSE:"PLAYBACK_PAUSE"};x("chrome.cast.media.ResumeState",chrome.cast.media.xq);chrome.cast.media.Pl={BUFFERED:"BUFFERED",LIVE:"LIVE",OTHER:"OTHER"};x("chrome.cast.media.StreamType",chrome.cast.media.Pl);chrome.cast.media.Up={CANCELLED:"CANCELLED",INTERRUPTED:"INTERRUPTED",FINISHED:"FINISHED",ERROR:"ERROR"};x("chrome.cast.media.IdleReason",chrome.cast.media.Up);chrome.cast.media.Rq={TEXT:"TEXT",AUDIO:"AUDIO",VIDEO:"VIDEO"};
x("chrome.cast.media.TrackType",chrome.cast.media.Rq);chrome.cast.media.Oq={SUBTITLES:"SUBTITLES",CAPTIONS:"CAPTIONS",DESCRIPTIONS:"DESCRIPTIONS",CHAPTERS:"CHAPTERS",METADATA:"METADATA"};x("chrome.cast.media.TextTrackType",chrome.cast.media.Oq);chrome.cast.media.Kq={NONE:"NONE",OUTLINE:"OUTLINE",DROP_SHADOW:"DROP_SHADOW",RAISED:"RAISED",DEPRESSED:"DEPRESSED"};x("chrome.cast.media.TextTrackEdgeType",chrome.cast.media.Kq);chrome.cast.media.Pq={NONE:"NONE",NORMAL:"NORMAL",ROUNDED_CORNERS:"ROUNDED_CORNERS"};
x("chrome.cast.media.TextTrackWindowType",chrome.cast.media.Pq);chrome.cast.media.Lq={SANS_SERIF:"SANS_SERIF",MONOSPACED_SANS_SERIF:"MONOSPACED_SANS_SERIF",SERIF:"SERIF",MONOSPACED_SERIF:"MONOSPACED_SERIF",CASUAL:"CASUAL",CURSIVE:"CURSIVE",SMALL_CAPITALS:"SMALL_CAPITALS"};x("chrome.cast.media.TextTrackFontGenericFamily",chrome.cast.media.Lq);chrome.cast.media.Mq={NORMAL:"NORMAL",BOLD:"BOLD",BOLD_ITALIC:"BOLD_ITALIC",ITALIC:"ITALIC"};x("chrome.cast.media.TextTrackFontStyle",chrome.cast.media.Mq);
chrome.cast.media.Tq={LIKE:"LIKE",DISLIKE:"DISLIKE",FOLLOW:"FOLLOW",UNFOLLOW:"UNFOLLOW"};x("chrome.cast.media.UserAction",chrome.cast.media.Tq);chrome.cast.media.Op=function(){this.customData=null};x("chrome.cast.media.GetStatusRequest",chrome.cast.media.Op);chrome.cast.media.hq=function(){this.customData=null};x("chrome.cast.media.PauseRequest",chrome.cast.media.hq);chrome.cast.media.iq=function(){this.customData=null};x("chrome.cast.media.PlayRequest",chrome.cast.media.iq);chrome.cast.media.Hq=function(){this.customData=this.resumeState=this.currentTime=null};x("chrome.cast.media.SeekRequest",chrome.cast.media.Hq);
chrome.cast.media.StopRequest=function(){this.customData=null};x("chrome.cast.media.StopRequest",chrome.cast.media.StopRequest);chrome.cast.media.Xq=function(a){this.volume=a;this.customData=null};x("chrome.cast.media.VolumeRequest",chrome.cast.media.Xq);chrome.cast.media.Wp=function(a){this.type="LOAD";this.requestId=0;this.sessionId=null;this.media=a;this.activeTrackIds=null;this.autoplay=!0;this.customData=this.currentTime=null};x("chrome.cast.media.LoadRequest",chrome.cast.media.Wp);
chrome.cast.media.vF=function(a){this.type="PRECACHE";this.requestId=0;this.precacheData=a};chrome.cast.media.Np=function(a,b){this.requestId=0;this.activeTrackIds=a||null;this.textTrackStyle=b||null};x("chrome.cast.media.EditTracksInfoRequest",chrome.cast.media.Np);chrome.cast.media.xi=function(a){this.containerType=a=void 0===a?chrome.cast.media.yi.GENERIC_CONTAINER:a;this.containerDuration=this.containerImages=this.sections=this.title=void 0};x("chrome.cast.media.ContainerMetadata",chrome.cast.media.xi);
chrome.cast.media.mc=function(a){this.metadataType=this.type=a;this.queueItemId=this.sectionStartTimeInContainer=this.sectionStartAbsoluteTime=this.sectionStartTimeInMedia=this.sectionDuration=void 0};x("chrome.cast.media.MediaMetadata",chrome.cast.media.mc);chrome.cast.media.zl=function(){chrome.cast.media.mc.call(this,chrome.cast.media.pe.GENERIC);this.releaseDate=this.releaseYear=this.images=this.subtitle=this.title=void 0};u(chrome.cast.media.zl,chrome.cast.media.mc);
x("chrome.cast.media.GenericMediaMetadata",chrome.cast.media.zl);chrome.cast.media.Bl=function(){chrome.cast.media.mc.call(this,chrome.cast.media.pe.MOVIE);this.releaseDate=this.releaseYear=this.images=this.subtitle=this.studio=this.title=void 0};u(chrome.cast.media.Bl,chrome.cast.media.mc);x("chrome.cast.media.MovieMediaMetadata",chrome.cast.media.Bl);
chrome.cast.media.Rl=function(){chrome.cast.media.mc.call(this,chrome.cast.media.pe.TV_SHOW);this.originalAirdate=this.releaseYear=this.images=this.episode=this.episodeNumber=this.season=this.seasonNumber=this.episodeTitle=this.title=this.seriesTitle=void 0};u(chrome.cast.media.Rl,chrome.cast.media.mc);x("chrome.cast.media.TvShowMediaMetadata",chrome.cast.media.Rl);
chrome.cast.media.Cl=function(){chrome.cast.media.mc.call(this,chrome.cast.media.pe.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};u(chrome.cast.media.Cl,chrome.cast.media.mc);x("chrome.cast.media.MusicTrackMediaMetadata",chrome.cast.media.Cl);
chrome.cast.media.Il=function(){chrome.cast.media.mc.call(this,chrome.cast.media.pe.PHOTO);this.creationDateTime=this.height=this.width=this.longitude=this.latitude=this.images=this.location=this.artist=this.title=void 0};u(chrome.cast.media.Il,chrome.cast.media.mc);x("chrome.cast.media.PhotoMediaMetadata",chrome.cast.media.Il);chrome.cast.media.ql=function(){chrome.cast.media.xi.call(this,chrome.cast.media.yi.AUDIOBOOK_CONTAINER);this.releaseDate=this.publisher=this.narrators=this.authors=void 0};
u(chrome.cast.media.ql,chrome.cast.media.xi);x("chrome.cast.media.AudiobookContainerMetadata",chrome.cast.media.ql);chrome.cast.media.pl=function(){chrome.cast.media.mc.call(this,chrome.cast.media.pe.AUDIOBOOK_CHAPTER);this.images=this.subtitle=this.bookTitle=this.chapterNumber=this.title=this.chapterTitle=void 0};u(chrome.cast.media.pl,chrome.cast.media.mc);x("chrome.cast.media.AudiobookChapterMediaMetadata",chrome.cast.media.pl);
chrome.cast.media.Yp=function(a,b){this.contentId=a;this.contentUrl=void 0;this.streamType=chrome.cast.media.Pl.BUFFERED;this.contentType=b;this.metadata=null;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};x("chrome.cast.media.MediaInfo",chrome.cast.media.Yp);
chrome.cast.media.mq=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};x("chrome.cast.media.QueueItem",chrome.cast.media.mq);chrome.cast.media.Fp="CC1AD845";x("chrome.cast.media.DEFAULT_MEDIA_RECEIVER_APP_ID",chrome.cast.media.Fp);chrome.cast.media.timeout={};chrome.cast.media.timeout.load=0;x("chrome.cast.media.timeout.load",chrome.cast.media.timeout.load);
chrome.cast.media.timeout.Ia=0;x("chrome.cast.media.timeout.getStatus",chrome.cast.media.timeout.Ia);chrome.cast.media.timeout.play=0;x("chrome.cast.media.timeout.play",chrome.cast.media.timeout.play);chrome.cast.media.timeout.pause=0;x("chrome.cast.media.timeout.pause",chrome.cast.media.timeout.pause);chrome.cast.media.timeout.seek=0;x("chrome.cast.media.timeout.seek",chrome.cast.media.timeout.seek);chrome.cast.media.timeout.stop=0;x("chrome.cast.media.timeout.stop",chrome.cast.media.timeout.stop);
chrome.cast.media.timeout.Sb=0;x("chrome.cast.media.timeout.setVolume",chrome.cast.media.timeout.Sb);chrome.cast.media.timeout.aj=0;x("chrome.cast.media.timeout.editTracksInfo",chrome.cast.media.timeout.aj);chrome.cast.media.timeout.kv=0;x("chrome.cast.media.timeout.queue",chrome.cast.media.timeout.kv);chrome.cast.media.Qq=function(a,b){this.trackId=a;this.trackContentType=this.trackContentId=null;this.type=b;this.customData=this.subtype=this.language=this.name=null};x("chrome.cast.media.Track",chrome.cast.media.Qq);
chrome.cast.media.Nq=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};x("chrome.cast.media.TextTrackStyle",chrome.cast.media.Nq);chrome.cast.media.oq=function(a){this.type="QUEUE_LOAD";this.sessionId=this.requestId=null;this.items=a;this.startIndex=0;this.repeatMode=chrome.cast.media.Ei.OFF;this.customData=null};
x("chrome.cast.media.QueueLoadRequest",chrome.cast.media.oq);chrome.cast.media.lq=function(a){this.type="QUEUE_INSERT";this.sessionId=this.requestId=null;this.items=a;this.customData=this.insertBefore=null};x("chrome.cast.media.QueueInsertItemsRequest",chrome.cast.media.lq);chrome.cast.media.tq=function(a){this.type="QUEUE_UPDATE";this.sessionId=this.requestId=null;this.items=a;this.customData=null};x("chrome.cast.media.QueueUpdateItemsRequest",chrome.cast.media.tq);
chrome.cast.media.nq=function(){this.type="QUEUE_UPDATE";this.customData=this.jump=this.currentItemId=this.sessionId=this.requestId=null};x("chrome.cast.media.QueueJumpRequest",chrome.cast.media.nq);chrome.cast.media.rq=function(){this.type="QUEUE_UPDATE";this.customData=this.repeatMode=this.sessionId=this.requestId=null};x("chrome.cast.media.QueueSetPropertiesRequest",chrome.cast.media.rq);
chrome.cast.media.pq=function(a){this.type="QUEUE_REMOVE";this.sessionId=this.requestId=null;this.itemIds=a;this.customData=null};x("chrome.cast.media.QueueRemoveItemsRequest",chrome.cast.media.pq);chrome.cast.media.qq=function(a){this.type="QUEUE_REORDER";this.sessionId=this.requestId=null;this.itemIds=a;this.customData=this.insertBefore=null};x("chrome.cast.media.QueueReorderItemsRequest",chrome.cast.media.qq);
chrome.cast.media.xp=function(a,b,c){this.id=a;this.breakClipIds=b;this.position=c;this.duration=void 0;this.isWatched=!1;this.isEmbedded=void 0};x("chrome.cast.media.Break",chrome.cast.media.xp);chrome.cast.media.yp=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};x("chrome.cast.media.BreakClip",chrome.cast.media.yp);
chrome.cast.media.Vq=function(){this.adsResponse=this.adTagUrl=void 0};x("chrome.cast.media.VastAdsRequest",chrome.cast.media.Vq);chrome.cast.media.zp=function(){this.whenSkippable=this.breakClipId=this.breakId=this.currentBreakClipTime=this.currentBreakTime=void 0};x("chrome.cast.media.BreakStatus",chrome.cast.media.zp);chrome.cast.media.Vp=function(a,b,c,d){this.start=a;this.end=b;this.isMovingWindow=c;this.isLiveDone=d};x("chrome.cast.media.LiveSeekableRange",chrome.cast.media.Vp);
chrome.cast.media.kq=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};x("chrome.cast.media.QueueData",chrome.cast.media.kq);chrome.cast.media.Uq=function(a){this.userAction=a;this.customData=void 0};x("chrome.cast.media.UserActionState",chrome.cast.media.Uq);chrome.cast.media.Wq=function(a,b,c){this.width=a;this.height=b;this.hdrType=c};
x("chrome.cast.media.VideoInformation",chrome.cast.media.Wq);chrome.cast.media.X=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.ff.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.Ei.OFF;this.liveSeekableRange=this.breakStatus=void 0};
x("chrome.cast.media.Media",chrome.cast.media.X);chrome.cast.media.X.prototype.Ia=function(){};chrome.cast.media.X.prototype.getStatus=chrome.cast.media.X.prototype.Ia;chrome.cast.media.X.prototype.play=function(){};chrome.cast.media.X.prototype.play=chrome.cast.media.X.prototype.play;chrome.cast.media.X.prototype.ou=function(){};chrome.cast.media.X.prototype.playWithContext=chrome.cast.media.X.prototype.ou;chrome.cast.media.X.prototype.pause=function(){};chrome.cast.media.X.prototype.pause=chrome.cast.media.X.prototype.pause;
chrome.cast.media.X.prototype.nu=function(){};chrome.cast.media.X.prototype.pauseWithContext=chrome.cast.media.X.prototype.nu;chrome.cast.media.X.prototype.seek=function(){};chrome.cast.media.X.prototype.seek=chrome.cast.media.X.prototype.seek;chrome.cast.media.X.prototype.stop=function(a){a||new chrome.cast.media.StopRequest};chrome.cast.media.X.prototype.stop=chrome.cast.media.X.prototype.stop;chrome.cast.media.X.prototype.Sb=function(){};chrome.cast.media.X.prototype.setVolume=chrome.cast.media.X.prototype.Sb;
chrome.cast.media.X.prototype.aj=function(){};chrome.cast.media.X.prototype.editTracksInfo=chrome.cast.media.X.prototype.aj;chrome.cast.media.X.prototype.mv=function(){};chrome.cast.media.X.prototype.queueInsertItems=chrome.cast.media.X.prototype.mv;chrome.cast.media.X.prototype.lv=function(){};chrome.cast.media.X.prototype.queueAppendItem=chrome.cast.media.X.prototype.lv;chrome.cast.media.X.prototype.wv=function(){};chrome.cast.media.X.prototype.queueUpdateItems=chrome.cast.media.X.prototype.wv;
chrome.cast.media.X.prototype.rv=function(){};chrome.cast.media.X.prototype.queuePrev=chrome.cast.media.X.prototype.rv;chrome.cast.media.X.prototype.qv=function(){};chrome.cast.media.X.prototype.queueNext=chrome.cast.media.X.prototype.qv;chrome.cast.media.X.prototype.nv=function(a){Ln(this,a)};chrome.cast.media.X.prototype.queueJumpToItem=chrome.cast.media.X.prototype.nv;chrome.cast.media.X.prototype.vv=function(){};chrome.cast.media.X.prototype.queueSetRepeatMode=chrome.cast.media.X.prototype.vv;
chrome.cast.media.X.prototype.tv=function(){};chrome.cast.media.X.prototype.queueRemoveItems=chrome.cast.media.X.prototype.tv;chrome.cast.media.X.prototype.sv=function(a){Ln(this,a)};chrome.cast.media.X.prototype.queueRemoveItem=chrome.cast.media.X.prototype.sv;chrome.cast.media.X.prototype.uv=function(){};chrome.cast.media.X.prototype.queueReorderItems=chrome.cast.media.X.prototype.uv;
chrome.cast.media.X.prototype.pv=function(a,b,c,d){a=Ln(this,a);0>a||(0>b?d&&d(new chrome.cast.Error(chrome.cast.td.INVALID_PARAMETER)):a==b&&c&&c())};chrome.cast.media.X.prototype.queueMoveItemToNewIndex=chrome.cast.media.X.prototype.pv;chrome.cast.media.X.prototype.rw=function(a){return-1<this.supportedMediaCommands.indexOf(a)};chrome.cast.media.X.prototype.supportsCommand=chrome.cast.media.X.prototype.rw;chrome.cast.media.X.prototype.Qr=function(){return this.currentTime};
chrome.cast.media.X.prototype.getEstimatedTime=chrome.cast.media.X.prototype.Qr;chrome.cast.media.X.prototype.Or=function(){if(this.breakStatus&&void 0!==this.breakStatus.currentBreakTime)return this.breakStatus.currentBreakTime};chrome.cast.media.X.prototype.getEstimatedBreakTime=chrome.cast.media.X.prototype.Or;chrome.cast.media.X.prototype.Nr=function(){if(this.breakStatus&&void 0!==this.breakStatus.currentBreakClipTime)return this.breakStatus.currentBreakClipTime};
chrome.cast.media.X.prototype.getEstimatedBreakClipTime=chrome.cast.media.X.prototype.Nr;chrome.cast.media.X.prototype.Pr=function(){if(this.liveSeekableRange&&void 0!==this.liveSeekableRange.start&&void 0!==this.liveSeekableRange.end)return this.liveSeekableRange};chrome.cast.media.X.prototype.getEstimatedLiveSeekableRange=chrome.cast.media.X.prototype.Pr;chrome.cast.media.X.prototype.Gi=function(){};chrome.cast.media.X.prototype.addUpdateListener=chrome.cast.media.X.prototype.Gi;
chrome.cast.media.X.prototype.Hi=function(){};chrome.cast.media.X.prototype.addUpdateListenerWithContext=chrome.cast.media.X.prototype.Hi;chrome.cast.media.X.prototype.Gk=function(){};chrome.cast.media.X.prototype.removeUpdateListener=chrome.cast.media.X.prototype.Gk;chrome.cast.media.X.prototype.Hk=function(){};chrome.cast.media.X.prototype.removeUpdateListenerWithContext=chrome.cast.media.X.prototype.Hk;var Ln=function(a,b){return Qb(a.items,function(c){return c.itemId==b})};var Mn=function(a,b,c){this.sessionId=a;this.namespaceName=b;this.message=c};var Nn=function(a,b){this.type="SET_VOLUME";this.requestId=0;this.volume=a;this.expectedVolume=b||null};chrome.cast.ca=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.Ol.CONNECTED;this.transportId=""};x("chrome.cast.Session",chrome.cast.ca);chrome.cast.ca.prototype.fw=function(a,b,c){this.Uo(null,a,b,c)};chrome.cast.ca.prototype.setReceiverVolumeLevel=chrome.cast.ca.prototype.fw;
chrome.cast.ca.prototype.Uo=function(a,b,c,d){b=new Nn(new chrome.cast.Volume(b,null),this.receiver.volume);a.setReceiverVolume(this.sessionId,b,c,d)};chrome.cast.ca.prototype.setReceiverVolumeLevelWithContext=chrome.cast.ca.prototype.Uo;chrome.cast.ca.prototype.ew=function(a,b,c){this.To(null,a,b,c)};chrome.cast.ca.prototype.setReceiverMuted=chrome.cast.ca.prototype.ew;
chrome.cast.ca.prototype.To=function(a,b,c,d){a=new Nn(new chrome.cast.Volume(null,b),this.receiver.volume);null.setReceiverVolume(this.sessionId,a,c,d)};chrome.cast.ca.prototype.setReceiverMutedWithContext=chrome.cast.ca.prototype.To;chrome.cast.ca.prototype.leave=function(a,b){null.leaveSession(this.sessionId,a,b)};chrome.cast.ca.prototype.leave=chrome.cast.ca.prototype.leave;chrome.cast.ca.prototype.stop=function(){};chrome.cast.ca.prototype.stop=chrome.cast.ca.prototype.stop;
chrome.cast.ca.prototype.qw=function(){};chrome.cast.ca.prototype.stopWithContext=chrome.cast.ca.prototype.qw;chrome.cast.ca.prototype.sendMessage=function(){};chrome.cast.ca.prototype.sendMessage=chrome.cast.ca.prototype.sendMessage;chrome.cast.ca.prototype.Nv=function(){};chrome.cast.ca.prototype.sendMessageWithContext=chrome.cast.ca.prototype.Nv;chrome.cast.ca.prototype.Gi=function(){};chrome.cast.ca.prototype.addUpdateListener=chrome.cast.ca.prototype.Gi;chrome.cast.ca.prototype.Hi=function(){};
chrome.cast.ca.prototype.addUpdateListenerWithContext=chrome.cast.ca.prototype.Hi;chrome.cast.ca.prototype.Gk=function(){};chrome.cast.ca.prototype.removeUpdateListener=chrome.cast.ca.prototype.Gk;chrome.cast.ca.prototype.Hk=function(){};chrome.cast.ca.prototype.removeUpdateListenerWithContext=chrome.cast.ca.prototype.Hk;chrome.cast.ca.prototype.dr=function(){};chrome.cast.ca.prototype.addMessageListener=chrome.cast.ca.prototype.dr;chrome.cast.ca.prototype.er=function(){};
chrome.cast.ca.prototype.addMessageListenerWithContext=chrome.cast.ca.prototype.er;chrome.cast.ca.prototype.br=function(){};chrome.cast.ca.prototype.addMediaListener=chrome.cast.ca.prototype.br;chrome.cast.ca.prototype.cr=function(){};chrome.cast.ca.prototype.addMediaListenerWithContext=chrome.cast.ca.prototype.cr;chrome.cast.ca.prototype.Ev=function(){};chrome.cast.ca.prototype.removeMediaListener=chrome.cast.ca.prototype.Ev;chrome.cast.ca.prototype.Fv=function(){};
chrome.cast.ca.prototype.removeMediaListenerWithContext=chrome.cast.ca.prototype.Fv;chrome.cast.ca.prototype.Gv=function(){};chrome.cast.ca.prototype.removeMessageListener=chrome.cast.ca.prototype.Gv;chrome.cast.ca.prototype.Hv=function(){};chrome.cast.ca.prototype.removeMessageListenerWithContext=chrome.cast.ca.prototype.Hv;chrome.cast.ca.prototype.ut=function(a){a.sessionId=this.sessionId};chrome.cast.ca.prototype.loadMedia=chrome.cast.ca.prototype.ut;
chrome.cast.ca.prototype.ov=function(a){a.sessionId=this.sessionId};chrome.cast.ca.prototype.queueLoad=chrome.cast.ca.prototype.ov;var Qn=function(a,b){if(!b.applications||1!=b.applications.length)return null;var c=b.applications[0];a=On(a);a=new chrome.cast.ca(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||Pn(a)))return null;a.receiver.volume=b.volume;"boolean"===typeof b.isActiveInput&&(a.receiver.isActiveInput=b.isActiveInput);return a},Rn=function(a){var b=
[];if(!a)return b;a&1&&b.push(chrome.cast.Jd.VIDEO_OUT);a&2&&b.push(chrome.cast.Jd.VIDEO_IN);a&4&&b.push(chrome.cast.Jd.AUDIO_OUT);a&8&&b.push(chrome.cast.Jd.AUDIO_IN);a&32&&b.push(chrome.cast.Jd.MULTIZONE_GROUP);return b},On=function(a){var b=wm(vm(),a.getId());return new chrome.cast.Jl(b,a.h.friendlyName,Rn(a.g))},Sn=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={Qf:0};e.Qf<c.length;e={Qf:e.Qf},e.Qf++)if(!d.some(function(f){return function(g){return g.name==
c[f.Qf].name}}(e)))return!0;return a.receiver.volume.level!==b.receiver.volume.level||a.receiver.volume.muted!==b.receiver.volume.muted?!0:!1},Tn=function(a){Array.isArray(a)?a.forEach(Tn):Pa(a)&&Object.keys(a).forEach(function(b){null===a[b]?delete a[b]:(Pa(a[b])||Array.isArray(a[b]))&&Tn(a[b])})},Un=function(a){return a.namespaces.some(function(b){return b.name==Sl})},Pn=function(a){return null!==a&&"MultizoneLeader"==a.appId},Vn=function(a){return"E8C28D3C"==a||"00000000-0000-0000-0000-000000000000"==
a};var Wn=function(a,b,c){this.type=a;this.message=b;this.sequenceNumber=void 0!==c?c:-1;this.timeoutMillis=0;this.clientId=""};var Xn=function(a,b){this.l=a;this.g=b;this.j=[];this.h=new gn},Zn=function(a,b){return(a=Yn(a.g,b))?a.routeId:null};Xn.prototype.listen=function(a,b){this.j[a]=b};var bo=function(a,b,c,d){hb($n,"Sending to "+c);hb($n,JSON.stringify(d));d.clientId=c;ao(a.l.j,b,d)},co=function(a,b,c){var d=Yn(a.g,b);d&&d.g?bo(a,d.routeId,b,c):a.connect(b).then(function(e){e?(e=Zn(a,b))?bo(a,e,b,c):$n.J("No route for "+b):$n.J("No connected client "+b)},null)};
Xn.prototype.connect=function(a){var b=Yn(this.g,a);if(null!=b&&b.g)return Promise.resolve(!0);b=Zn(this,a);if(!b)return $n.J("No route for client "+a),Promise.resolve(!1);if(a=this.h.g.get(b,null))return a.yb.g;a=new Ab;hn(this.h,new eo(b,a));return a.g};var $n=ab("mr.cast.ApiMessenger"),eo=function(a,b){fn.call(this,a,3E4);this.yb=b};u(eo,fn);eo.prototype.g=function(){this.yb.resolve(!1)};var fo=function(a,b,c){this.j=a;this.h=b;this.g=c},go=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 ho=function(a,b,c,d,e,f,g,h,l,p){this.m=a;this.g=b||null;this.h=c||null;this.j=d||null;this.l=void 0!==e?e:null;this.C=f||null;this.F=g||null;this.s=h||!1;this.o=l||null;this.w=p||null;this.G=["WEB"];this.D=null},io=function(a,b){return(a=a.match(b+"=([^/]*)"))?a[1]:null},ko=function(a){a=a.match(/__castAppId__=([^/]*)/g);return null==a?[]:Jb(Kb(a,function(b){b=io(b,"__castAppId__");if(!b)return null;b=b.match(jo);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})},lo=function(a){return Kb(a.m,function(b){return b.appId})},mo=function(a){var b={launchCheckerParams:{}};a.D&&(b.launchCheckerParams.credentialsData=a.D);return b},no=function(a){return a.h?a.h:chrome.cast.qd.TAB_AND_ORIGIN_SCOPED},oo=function(a){var b=a.m.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.s&&e.set("invisibleSender","true");a.o&&(e.set("broadcastNamespace",a.o),e.set("broadcastId",String(Math.random())));a.w&&e.set("broadcastMessage",encodeURIComponent(JSON.stringify(a.w)));e.set("supportedAppTypes",encodeURIComponent(JSON.stringify(a.G)));e.set("appParams",encodeURIComponent(JSON.stringify(mo(a))));return d+"?"+e.toString()});a.C&&b.push(go(new fo(a.C,a.F,a.g)));return b},
qo=function(a,b){a=lo(a);var c=po(b);return Ob(a,function(d){return Tb(c,d)})},ro=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=ko(c))&&0!=a.length){b=io(c,"__castClientId__");var d=io(c,"__castAutoJoinPolicy__"),e=io(c,"__castDefaultActionPolicy__");var f=io(c,"__castLaunchTimeout__");null==f?f=null:(f=Number(f),f=!isNaN(f)&&0<f?f:null);var g=io(c,"__dialAppName__"),h=
io(c,"__dialPostData__");var l=io(c,"__castInvisibleSender__");l=null===l?null:"true"==l;var p=io(c,"__castBroadcastNamespace__");c=(c=io(c,"__castBroadcastMessage__"))?JSON.parse(decodeURIComponent(c)):null;a=new ho(a,b,d,e,f,g,h,l,p,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 ho([a],b,d,e,c,void 0,void 0,f,g,h)}else a=null;return a},po=function(a){return(a=ro(a))?lo(a):null},so=function(a){return(a=ro(a))?a.g:null},jo=/(^\w+)(?:\(([\w, ]*)\))?$/;var to={zC:0,gC:1},uo={PJ:0,uq:1,FF:2},vo={rE:0,TIMEOUT:1,FAILED:2},wo={RB:0,fF:1,SEEK:2,RD:3,LH:4,hx:5},xo=function(a){vb("MediaRouter.Cast.Session.Ended",a,uo)},yo=function(a){vb("MediaRouter.Cast.Controller.ActionType",a,wo)},zo=function(a){vb("MediaRouter.Cast.Session.Fail",a,vo)};var Ao=function(a,b,c){this.T=ab("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.s=!1;this.l.setConnectionErrorHandler(this.Mn.bind(this));this.h.ptr.setConnectionErrorHandler(this.Mn.bind(this))};k=Ao.prototype;k.Mn=function(){this.dispose();this.Kn()};
k.dispose=function(){this.s||(this.s=!0,this.l&&(this.l.close(),this.l=null),this.h&&(this.h.ptr.reset(),this.h=null))};k.Kn=function(){};k.play=function(){};k.pause=function(){};k.Sk=function(){};k.Sb=function(){};k.seek=function(){};k.xr=function(a){a.close();throw Error("Not implemented");};Ao.prototype.connectHangoutsMediaRouteController=Ao.prototype.xr;Ao.prototype.seek=Ao.prototype.seek;Ao.prototype.setVolume=Ao.prototype.Sb;Ao.prototype.setMute=Ao.prototype.Sk;Ao.prototype.pause=Ao.prototype.pause;
Ao.prototype.play=Ao.prototype.play;var Bo=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)},Co=function(a){return new mojo.TimeDelta({microseconds:Math.floor(1E6*a)})};var Do=function(a,b,c,d){this.type=a;this.mediaSessionId=b;this.requestId=0;this.sessionId=c;this.currentTime=d},Fo=function(a,b,c,d,e){Ao.call(this,"CastRouteController",a,b);this.session=c;this.j=d;this.m=e;this.o=new Date;this.w=new Set;Eo(this);yo(0)};u(Fo,Ao);
var Eo=function(a){var b=Go(a);b&&Ho(a,b);b&&a.m||!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.Sl.FIXED;a.g.can_set_volume=a.g.can_mute;if(a.h)a.h.onMediaStatusUpdated(a.g)};k=Fo.prototype;k.Kn=function(){Io(this.j.g,this.session.sessionId)};
k.play=function(){var a=Go(this);this.g.can_play_pause&&a&&this.g.play_state===mojo.MediaStatus.PlayState.PAUSED&&Jo(this.j,this.session,new Do("PLAY",a.mediaSessionId,this.session.sessionId));Ko(this,1)};k.pause=function(){var a=Go(this);this.g.can_play_pause&&a&&this.g.play_state!==mojo.MediaStatus.PlayState.PAUSED&&Jo(this.j,this.session,new Do("PAUSE",a.mediaSessionId,this.session.sessionId));Ko(this,1)};
k.seek=function(a){var b=Go(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&&Jo(this.j,this.session,new Do("SEEK",b.mediaSessionId,this.session.sessionId,a));Ko(this,2)};k.Sk=function(a){this.g.can_mute&&a!==this.g.is_muted&&Lo(this.j,this.session,new chrome.cast.Volume(null,a));Ko(this,3)};k.Sb=function(a){this.g.can_set_volume&&0<=a&&1>=a&&Lo(this.j,this.session,new chrome.cast.Volume(a));Ko(this,4)};
var Go=function(a){return a.session.media.find(function(b){return!b.idleReason})||null},Ho=function(a,b){a.m&&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.oe.PAUSE);a.g.can_seek=b.supportedMediaCommands.includes(chrome.cast.media.oe.SEEK);var c=b.playerState;a.g.play_state=c===chrome.cast.media.ff.PLAYING?mojo.MediaStatus.PlayState.PLAYING:c===chrome.cast.media.ff.PAUSED?
mojo.MediaStatus.PlayState.PAUSED:mojo.MediaStatus.PlayState.BUFFERING;a.g.current_time=b.currentTime?Co(b.playerState===chrome.cast.media.ff.PLAYING?b.currentTime+(new Date-a.o)/1E3:b.currentTime):Co(0);a.g.duration=b.media&&b.media.duration?Co(b.media.duration):Co(0)},Ko=function(a,b){0==a.w.size&&yo(5);a.w.has(b)||(yo(b),a.w.add(b))};Fo.prototype.setVolume=Fo.prototype.Sb;Fo.prototype.setMute=Fo.prototype.Sk;Fo.prototype.seek=Fo.prototype.seek;Fo.prototype.pause=Fo.prototype.pause;
Fo.prototype.play=Fo.prototype.play;var Mo=function(a){this.h=a;this.u=ab("mr.cast.SessionLauncher")},No=function(a,b,c){vb("MediaRouter.Cast.Session.Type",0,to);return un(a.h,b,c).then(a.g.bind(a,c),function(d){d&&vn==d?zo(1):zo(0);throw d;})};Mo.prototype.g=function(a,b){hb(this.u,"Got launch result from "+a.getId());if("LAUNCH_ERROR"==b.type)throw zo(2),Error(b.reason);a=Qn(a,b.status);B(this.u,"Launched session: "+a.sessionId);return a};var Oo=function(a){this.g=a;this.u=ab("mr.cast.ReceiverStatusQuerier")},Po=function(a,b){return(new mf(w(a.h,a,b),3500,5)).start().then(null,function(c){B(a.u,"Failed to get receiver status from "+b.getId());throw c;})};Oo.prototype.h=function(a){B(this.u,"Query receiver status: "+a.getId());return this.g.sendRequest(new en,a,Ql)};var Qo=function(a,b,c,d,e,f){this.j=a;this.w=b;this.m=c;this.g=d;this.o=e;this.l=f;this.h=new Xn(f,c);this.F=new Oo(this.j);this.G=new Mo(this.j)};Qo.prototype.init=function(){this.m.init();this.h.listen("v2_message",this.C.bind(this));this.h.listen("app_message",this.s.bind(this));this.h.listen("leave_session",this.D.bind(this))};
var To=function(a,b,c,d){Ro(a.g,b).slice().forEach(function(e){e!=d&&So(a,e,c)})},So=function(a,b,c){c.clientId=b;co(a.h,b,c)},Uo=function(a,b,c,d){c={receiver:On(c),action:d};So(a,b,new Wn("receiver_action",c))};
Qo.prototype.C=function(a){var b=a.message,c=b.sessionId;if(c){var d=Vo(this.g,c);if(d)if(c=Wo(this.g,c))if(c=this.w.h(c))switch(b.type){case "STOP":Xo(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":Yo(this,a,c,d);break;case "SET_VOLUME":Zo(this,a,c);break;default:$o.J("Unknown request")}else ap(this,
a,chrome.cast.td.INVALID_PARAMETER,"No receiver");else ap(this,a,chrome.cast.td.INVALID_PARAMETER,"No sink ID");else ap(this,a,chrome.cast.td.INVALID_PARAMETER,"Unknown session ID")}else ap(this,a,chrome.cast.td.INVALID_PARAMETER,"No session ID")};
var ap=function(a,b,c,d){c=new chrome.cast.Error(c,d);bp(a,b,c)},bp=function(a,b,c){co(a.h,b.clientId,new Wn("error",c,b.sequenceNumber))},Xo=function(a,b,c){var d=b.message;ub("MediaRouter.Cast.Session.End");var e=d.sessionId,f=cp(a.g,e);f&&(f.m=!0);f=function(){Xm(a,e,b)};a.j.sendRequest(d,c,Ql,b.timeoutMillis,b.clientId).then(f,f)},Yo=function(a,b,c,d){var e=b.message,f=e.type;f in dn&&(e.type=dn[f]);a.j.sendRequest(e,c,Sl,b.timeoutMillis,b.clientId,d.transportId).then(function(g){dp(a,d,g);co(a.h,
b.clientId,new Wn("v2_message",g,b.sequenceNumber))},function(g){bp(a,b,g)})},Zo=function(a,b,c){var d=b.message;delete d.sessionId;a.j.sendRequest(d,c,Ql,b.timeoutMillis,b.clientId).then(function(){co(a.h,b.clientId,new Wn("v2_message",null,b.sequenceNumber))},function(e){bp(a,b,e)})};
Qo.prototype.s=function(a){var b=this,c=a.message,d=c.sessionId;if(d){var e=Wo(this.g,d);e?(e=this.w.h(e))?(d=Vo(this.g,d),Rb(d.namespaces,function(f){return f.name==c.namespaceName})?sn(this.o,e,c.namespaceName,c.message,a.clientId,d.transportId).then(function(){co(b.h,a.clientId,new Wn("app_message",null,a.sequenceNumber))},function(){ap(b,a,chrome.cast.td.CHANNEL_ERROR,"Channel to receiver not available")}):ap(this,a,chrome.cast.td.INVALID_PARAMETER,"Invalid namespace")):$o.J("No receiver from sinkId"):
$o.J("No sinkId from sessionId")}else $o.J("No sessionId")};
Qo.prototype.D=function(a){var b=this;B($o,"Leave session");var c=cp(this.g,a.message);if(c){var d=a.clientId,e=Yn(this.m,d);if(e){var f=[],g=[],h=e.tabId,l=e.origin,p=e.autoJoinPolicy;c.h.forEach(function(r){var t=Yn(b.m,r);p==chrome.cast.qd.TAB_AND_ORIGIN_SCOPED&&h==t.tabId&&l==t.origin||p==chrome.cast.qd.ORIGIN_SCOPED&&l==t.origin?(t.h=!0,f.push(r)):g.push(r)});co(this.h,d,new Wn("leave_session",null,a.sequenceNumber));f.forEach(function(r){(r=Yn(b.m,r))&&ep(b.l,r.routeId,!0,!0)});c.h=g}else $o.J("No client record")}else $o.J("No session")};
var fp=function(a,b,c){Un(b)&&a.j.sendRequest(new en,c,Sl,void 0,void 0,b.transportId).catch(Ka)},Qm=function(a,b,c){var d=b.getId();B($o,"Query status for "+d);Po(a.F,b).then(function(e){gp(a,d,e);c&&(e=hp(a.g,d))&&fp(a,e,b)},Ka)},ip=function(a,b){if("*"==b.destinationId)return!0;b=b.destinationId;if(b==a.o.o||null!=Yn(a.m,b))return!0;B($o,"Invalid destination "+b);return!1},op=function(a,b,c){hb($o,function(){return"Cast message: "+JSON.stringify(c)});if(ip(a,c))if(c.namespace_==Rl||c.namespace_==
Tl)(b=Wm(a.g,b))&&b.g.forEach(function(f){var g=a.l,h=g.h.get(f);h&&h.lf&&jp(g.j.K,new kp(f,c))});else{var d=JSON.parse(c.data),e=lp(a,d);e=e?e.sourceId:void 0;switch(d.type){case "RECEIVER_STATUS":gp(a,b,d);break;case "MEDIA_STATUS":mp(a,b,c,e)}}else np(a.o,b,c.destinationId,c.sourceId,!1)},lp=function(a,b){a=jn(a.j.g,b.requestId);if(!a)return null;var c=a.yb;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.td.SESSION_ERROR,b.reason||b.type,b));break;default:c.resolve(b)}return a},pp=function(a,b,c){hb($o,function(){return"App message: "+JSON.stringify(c)});if(b=hp(a.g,b)){var d;"*"==c.destinationId?d=Ro(a.g,b.sessionId):d=[c.destinationId];var e=new Mn(b.sessionId,c.namespace_,c.data);d.forEach(function(f){co(a.h,f,new Wn("app_message",e))})}else $o.J("No session for incoming app message")},qp=function(a,b){a.forEach(function(c){c.sessionId=b;var d=c.supportedMediaCommands,
e=[];d&1&&e.push(chrome.cast.media.oe.PAUSE);d&2&&e.push(chrome.cast.media.oe.SEEK);d&4&&e.push(chrome.cast.media.oe.STREAM_VOLUME);d&8&&e.push(chrome.cast.media.oe.STREAM_MUTE);c.supportedMediaCommands=e});return a},dp=function(a,b,c){b=b.sessionId;c.sessionId=b;c=qp(c.status,b);rp(a.g,b,c);if((a=cp(a.g,b))&&a.controller&&(a=a.controller,a.o=new Date,(c=Go(a))?Ho(a,c):(a.m&&(a.g.title=""),a.g.can_play_pause=!1,a.g.can_seek=!1),a.h))a.h.onMediaStatusUpdated(a.g)},sp=function(a,b){if(b=hp(a.g,b)){b=
b.sessionId;var c=cp(a.g,b);c&&c.m||Xm(a,b)}},Xm=function(a,b,c){c&&So(a,c.clientId,c);(c=cp(a.g,b))&&c.g.slice().forEach(function(d){ep(a.l,d,!0)});tp(a.g,b);up(a.l)},gp=function(a,b,c){hb($o,"Receiver status for "+b);var d=c.status;if(d)if(c=a.w.h(b)){d=Qn(c,d);var e=Wm(a.g,b);e?d?d.sessionId==e.session.sessionId?(b=e.session,Sn(b,d)&&(hb($o,"Updating session "+d.sessionId),e.j&&(b.statusText=d.statusText),b.namespaces=d.namespaces,b.receiver.volume=d.receiver.volume,vp(a.l,e),To(a,b.sessionId,
new Wn("update_session",b)),e.controller&&Eo(e.controller))):(sp(a,b),xo(1),wp(a.l,null,c,null,d)):(sp(a,b),xo(1)):d&&wp(a.l,null,c,null,d)}else ub("MediaRouter.Cast.Error.Sink.Missing.From.Discovery.Service"),$o.J("Got message from receiver "+b+", but sink is no longer available.")},mp=function(a,b,c,d){if(b=hp(a.g,b))if(c=JSON.parse(c.data))dp(a,b,c),To(a,c.sessionId,new Wn("v2_message",c),d)},xp=function(a,b){var c=Rn(b.g);return(b=Rb(a.m,function(d){return Pb(d.capabilities,function(e){return Tb(c,
e)})}))?b.appId:lo(a)[0]},yp=function(a,b,c){var d=ro(b);if(!d)return Promise.reject(Error("Invalid source "+b));var e=xp(d,c);b=null==d.l?chrome.cast.timeout.requestSession:d.l;var f=new lb("MediaRouter.Cast.Session.Launch");return No(a.G,new chrome.cast.Nl(e,void 0,b),c).then(function(g){B($o,"Launched session "+g.sessionId+" for appId "+e);f.end("Success");return g},function(g){$o.error("Failed to session for appId "+e);f.end("Failure");throw g;})};
Qo.prototype.createMediaRouteController=function(a,b,c){a=zp(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=Ap(this,d.sessionId);if(!e)return Error("Sink not found for the route");a.controller=new Fo(b,c,d,this,a.j);fp(this,d,e);return null};
var Jo=function(a,b,c){var d=Ap(a,b.sessionId);d&&a.j.sendRequest(c,d,Sl,0,"",b.transportId).catch(function(e){$o.J("Failed to send a media control request: "+e)})},Lo=function(a,b,c){c=new Nn(c);(b=Ap(a,b.sessionId))&&a.j.sendRequest(c,b,Ql).catch(function(d){$o.J("Failed to send a volume control request: "+d)})},Ap=function(a,b){return(b=Wo(a.g,b))?a.w.h(b):null},$o=ab("mr.cast.ApiHandler");var Bp=function(a){return"0F5096E8"==a||"85CDB22F"==a};var Cp=function(a,b,c,d,e){for(var f=[],g=4;g<arguments.length;++g)f[g-4]=arguments[g];var h=this;this.m=a;this.o=b;this.w=c;this.h=d;this.l=f;this.g=!1;this.j=function(l){for(var p=[],r=0;r<arguments.length;++r)p[r-0]=arguments[r];return h.Br.apply(h,q(p))}};k=Cp.prototype;k.addListener=function(){this.g||(this.g=!0,this.h.addListener.apply(this.h,[this.j].concat(q(this.l))))};k.removeListener=function(){this.g&&(this.h.removeListener(this.j),this.g=!1)};
k.ui=function(a){for(var b=0;b<arguments.length;++b);return!0};k.Br=function(a){for(var b=[],c=0;c<arguments.length;++c)b[c-0]=arguments[c];var d=this;lj(this.m);if(!this.ui.apply(this,q(b)))return!1;cj(this.w).then(function(e){return e.handleEvent.apply(e,[d.h].concat(q(b)))});return this.Vi()};k.Ta=function(){return"mr.EventListener."+this.o};k.Fb=function(){return[this.g]};k.Db=function(){am(this)&&this.addListener()};k.Vi=function(){};var Dp=null,Ep=null,Fp=function(){Dp||(Dp=new Cp(2,"CastChannelMessageListener","mr.cast.ChannelService",chrome.cast.channel.onMessage));Ep||(Ep=new Cp(1,"CastChannelErrorListener","mr.cast.ChannelService",chrome.cast.channel.onError));return[Dp,Ep]};var Gp=function(){},Hp=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 Gp;b.h=a;a=n(c);a.next();b.g=a.next().value;b.l=a.next().value;b.m=a.next().value;b.j=a.next().value;return b};var Ip=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.lf=e;this.isOffscreenPresentation=!1},Jp=function(a,b,c,d,e){b=d&&mj(d)?a:"urn:x-org.chromium:media:route:"+a+"/"+b+"-"+c+"/"+d;return new Ip(b,
a,c,d,e)};var Kp=function(a,b,c,d){c=Jp(c,"cast",b.getId(),a,d);c.supportsMediaRouteController=!0;mojo&&mojo.RouteControllerType&&(c.controllerType=d&&oj(a)&&b.g&1&&mojo.RouteControllerType.kMirroring?mojo.RouteControllerType.kMirroring:mojo.RouteControllerType.kGeneric);return c},Lp=function(a,b){var c=b.sb.nc;c&&(b.description=Aj(c),a.displayName="",a.statusText="mirror_desktop"==c.h?"":c.j||"")};var Mp=function(a,b,c,d){return{namespace_:a,data:"string"===typeof b?b:JSON.stringify(b),sourceId:c,destinationId:d}};var Np=function(a){this.type="CLOSE";this.reasonCode=a};var Op=function(a){return(a=a.exec(Wd))?a[1]:""},Pp=function(){if(ef)return Op(/Firefox\/([0-9.]+)/);if(He||Ie||Ge)return $e;if(jf)return ze()?Op(/CriOS\/([0-9.]+)/):Op(/Chrome\/([0-9.]+)/);if(kf&&!ze())return Op(/Version\/([0-9.]+)/);if(ff||gf){var a=/Version\/(\S+).*Mobile\/(\S+)/.exec(Wd);if(a)return a[1]+"."+a[2]}else if(hf)return(a=Op(/Android\s+([0-9.]+)/))?a:Op(/Version\/([0-9.]+)/);return""}(),Qp=function(a){return 0<=vd(Pp,a)};var Sp=function(a){this.type="CONNECT";this.origin={};this.userAgent=Wd;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:Pp,platform:Rp(),systemVersion:b,connectionType:1};this.connType=a?0:2},Rp=function(){switch(Li()){case "ChromeOS":return 5;case "Windows":return 3;case "Mac":return 4;case "Linux":return 6}return 0};var Tp=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&&hb(a,b);return Error(b)};var Up=function(){this.g=new Hm};Up.prototype.init=function(){dm(this)};var Vp=function(a,b,c,d,e){if(!Km(a.g,[b.channelId,c,d].join("#"))){var f=Mp(Pl,new Sp(e),c,d);chrome.cast.channel.send(b,f,a.h.bind(a));a.g.set([b.channelId,c,d].join("#"),e)}};Up.prototype.h=function(){Tp(Wp)};
var Tm=function(a,b){a.g.Lb().forEach(function(c){c.split("#")[0]==b.channelId.toString()&&a.g.remove(c)})},Pm=function(a,b,c){a.g.forEach(function(d,e){var f=e.split("#");f[0]==b.channelId.toString()&&(Vp(a,c,f[1],f[2],d),a.g.remove(e))})};Up.prototype.Ta=function(){return"cast.VirtualConnectionManager"};Up.prototype.Fb=function(){var a=Mm(this.g);return[new Xp(a)]};Up.prototype.Db=function(){var a=am(this);if(a)for(var b in a.g)this.g.set(b,a.g[b])};La(Up);
var Wp=ab("mr.cast.VirtualConnectionManager"),Xp=function(a){this.g=a};var Yp=function(a,b){this.m=b;this.o=a;this.h=new Hm;this.g=new Hm;this.j=Up.Kb();this.w=null;this.l=new Hm};u(Yp,Zi);Yp.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.D.apply(this,q(c)):a==chrome.cast.channel.onError&&this.s.apply(this,q(c))};Yp.prototype.init=function(){this.j.init();dm(this);ij("mr.cast.ChannelService",this);Fp().forEach(function(a){return a.addListener()})};
var sn=function(a,b,c,d,e,f){e=e||a.o;f=f||"receiver-0";var g=$m(a,b);return g?Zp(a,g,c,d,e,f):Promise.reject("Channel not found for "+b.getId())},np=function(a,b,c,d,e){if(b=a.h.get(b))a=a.j,Km(a.g,[b.channelId,c,d].join("#"))&&(a.g.remove([b.channelId,c,d].join("#")),c=Mp(Pl,new Np(e?5:0),c,d),chrome.cast.channel.send(b,c,a.h.bind(a)))};
Yp.prototype.D=function(a,b){var c=this.g.get(a.channelId);if(c){var d=this.w(c);if(d){if(Vl.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:hb(Om,function(){return"Got message "+(e.type||e.responseType)+" from "+d.getId()})}}else hb(Om,"Got message in "+b.namespace_+" from "+d.getId());$p(this.m,d,b)}else Om.J("Got message for unknown receiver (receiverId="+c+").")}else Om.J("Got message for unknown channel (channelId="+
a.channelId+").")};var aq=function(a,b){var c=a.g.get(b.channelId);c&&(a.g.remove(b.channelId),a.h.remove(c))};Yp.prototype.s=function(a,b){Om.J(function(){return"Channel error: "+JSON.stringify(a)+(b?", "+JSON.stringify(b):"")});aq(this,a)};
var $m=function(a,b){b=b.getId();(a=a.h.get(b))||B(Om,"Channel not found for receiver: "+b);return a},Zp=function(a,b,c,d,e,f){Vp(a.j,b,e,f,0==f.indexOf("receiver-0"));Tn(d);var g=Mp(c,d,e,f);"object"===typeof d&&"RPC"==d.type||hb(Om,function(){return"Channel is sending message: "+JSON.stringify(g)});return new Promise(function(h,l){chrome.cast.channel.send(b,g,function(p){p?p.errorState?(l(Error("Failed to send message")),aq(a,p)):h(!0):(p=Tp(Om||void 0),l(p))})})};Yp.prototype.Ta=function(){return"cast.ChannelService"};
Yp.prototype.Fb=function(){return[new bq(Mm(this.h),Mm(this.g),Mm(this.l))]};Yp.prototype.Db=function(){var a=am(this);a&&(Gm(this.h,a.h),Gm(this.g,a.g),Gm(this.l,a.j))};var Om=ab("mr.cast.ChannelService"),bq=function(a,b,c){this.h=a;this.g=b;this.j=c};var cq=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},dq=function(){this.g=[]};dq.prototype.init=function(){dm(this)};dq.prototype.wa=function(){return this.g.length};var Yn=function(a,b){return Rb(a.g,function(c){return c.clientId==b})},eq=function(a,b){return Rb(a.g,function(c){return c.routeId==b})},fq=function(a,b){a.g=Jb(a.g,function(c){return c.clientId!=b})};dq.prototype.Ta=function(){return"cast.ClientRecords"};
dq.prototype.Fb=function(){return[new gq(this.g)]};dq.prototype.Db=function(){var a=am(this);a&&(this.g=a.g)};var gq=function(a){this.g=a};var hq=function(){this.requestId=0;this.type="GET_APP_AVAILABILITY";this.appId=[]};var iq=function(a,b){this.l=a;this.h=b;this.j=new Dn;this.g=new Hm};iq.prototype.init=function(){dm(this)};var jq=function(a,b){var c=a.g.get(b);c&&(c.Ek--,0<c.Ek||(Dm(a.h.g.Pb(!1),function(d){switch(zm(d,b)){case "available":d.j[b]="available_rescan";break;case "unavailable":d.j[b]="unavailable_rescan"}}),a.g.remove(b)))};k=iq.prototype;
k.wo=function(a){var b=this;Dm(this.g.Pb(!0),function(c){a:{switch(zm(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 mf(b.tr.bind(b,a,c),5500,3)).start().then(b.fp.bind(b,a,c),function(){b.u.error("Failed to get app availability response for "+a.getId()+", appId "+c+" after 3 attempts.");b.fp(a,c,"unknown")}).then(d,d))}})};
k.fp=function(a,b,c){c!=zm(a,b)&&(B(this.u,b+" on "+a.getId()+" is "+c),a.j[b]=c,Rm(this.h.l,a))};
k.tr=function(a,b){var c=this,d=new hq;d.appId=[b];var e=new lb("MediaRouter.Cast.App.Availability");return this.l.sendRequest(d,a,Ql,5E3).then(function(f){e.end("Success");hb(c.u,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.u.error("checkAppAvailability_ failed for "+a.getId()+", appId "+
b);throw f;})};k.Ta=function(){return"cast.AppDiscoveryService"};k.Fb=function(){return[new kq(Mm(this.g))]};k.Db=function(){var a=am(this);a&&Gm(this.g,a.g)};k.u=ab("mr.cast.AppDiscoveryService");var kq=function(a){this.g=a};var lq=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 mq=function(a,b){this.h=[];this.g=[];this.sinkId=a;this.session=b;this.w=this.l=null;this.offTheRecord=this.m=!1;this.controller=null;this.j=!0},nq=function(){this.u=ab("mr.cast.SessionRecords");this.g=[]};nq.prototype.init=function(){dm(this)};
var tp=function(a,b){B(a.u,"Removing session "+b);Io(a,b);a.g=Jb(a.g,function(c){return c.session.sessionId!=b})},Ro=function(a,b){return(a=cp(a,b))?a.h:[]},hp=function(a,b){return(a=Wm(a,b))?a.session:null},oq=function(a,b){return Rb(a.g,function(c){return Tb(c.h,b)})},zp=function(a,b){return Rb(a.g,function(c){return Tb(c.g,b)})},pq=function(a,b){return Rb(a.g,function(c){return null!=Rb(c.g,function(d){return Hp(d).g==b})})},Wm=function(a,b){return Rb(a.g,function(c){return c.sinkId==b||c.l==b})},
cp=function(a,b){return Rb(a.g,function(c){return c.session.sessionId==b})},Wo=function(a,b){return(a=cp(a,b))?a.sinkId:null},Vo=function(a,b){return(a=cp(a,b))?a.session:null},rp=function(a,b,c){var d=Vo(a,b);d&&(a=Jb(c,function(e){return e.playerState!=chrome.cast.media.ff.IDLE}),a.forEach(function(e){if(!e.media){var f=Rb(d.media,function(g){return g.mediaSessionId==e.mediaSessionId});f&&(e.media=f.media)}}),d.media=a)};nq.prototype.Ta=function(){return"cast.SessionRecords"};nq.prototype.Fb=function(){return[new qq(this.g)]};
nq.prototype.Db=function(){var a=am(this);if(a)for(var b=0;b<a.g.length;b++){var c=a.g[b],d=new mq(c.sinkId,c.session);d.h=c.h;d.g=c.g;d.m=c.m;d.w=c.w;d.l=c.l;d.j=c.j;this.g.push(d)}};var Io=function(a,b){(a=cp(a,b))&&a.controller&&(a.controller.dispose(),a.controller=null)},qq=function(a){var b=[];a=n(a);for(var c=a.next();!c.done;c=a.next()){c=c.value;var d=new mq(c.sinkId,c.session);d.h=c.h;d.g=c.g;d.m=c.m;d.w=c.w;d.l=c.l;d.offTheRecord=c.offTheRecord;d.j=c.j;b.push(d)}this.g=b};var rq=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,rq);else if(b=Error().stack)this.stack=b;this.errorCode=a};u(rq,Error);var sq=function(a,b){this.sinks=a;this.origins=b||null},tq=new sq([]);var uq=function(a){this.C="sender-"+we();this.h=new Hm;this.s=null;dm(this);this.j=a;this.o=new dq;this.l=new nq;this.D=new Yp(this.C,this);this.g=new Nm(this.D,this);this.F=new pn(this.D,this.C);this.w=null;this.m=new Qo(this.F,this.g,this.o,this.l,this.D,this);this.G=new Hn(this.g,this.F)};k=uq.prototype;k.getName=function(){return"cast"};
k.Cn=function(a){a=a&&"boolean"===typeof a.enable_cast_sink_query?a.enable_cast_sink_query:!0;B(this.u,"Query enabled: "+a);this.F.init();this.l.init();this.m.init();this.D.init();this.g.init();a&&(this.w=new iq(this.F,this.g),this.w.init())};k.Nh=function(){return this.h.Ja()};
k.Em=function(a){var b=this;if(null!=vq(a))return new sq([]);var c=new Dn;wq(a).forEach(function(d){bn(b.g,d).map(function(e){return e.h}).forEach(function(e){c.add(e)})});return new sq(c.Ja(),-1!=a.indexOf("0F5096E8")?nj:null)};
k.startObservingMediaSinks=function(a){var b=this,c=vq(a);c?(B(this.u,"Received broadcast request "+a),Dm(this.g.g.Pb(!1),function(d){b.F.sendMessage(c,d,Ul).catch(function(e){b.u.error("Broadcast failed "+e.message)})})):this.w&&wq(a).forEach(function(d){var e=b.w,f=e.g.get(d);f?f.Ek++:e.g.set(d,{Ek:1});B(e.u,"Scanning sinks for app availability");Dm(e.h.g.Pb(!1),e.wo,e)})};k.stopObservingMediaSinks=function(a){var b=this;null!=vq(a)||this.w&&wq(a).forEach(function(c){jq(b.w,c)})};
k.startObservingMediaRoutes=function(){};k.stopObservingMediaRoutes=function(){};k.Bn=function(a){return(a=this.g.h(a))?a.h:null};
var xq=function(a,b,c){a.u.error("Error launching.",c);ep(a,b.id,!1,!0,"error");c=new wi(lq,"warning");zi(c,b.id);Ai(c,b.sinkId);a.j.g.onIssue(c)},Cq=function(a,b,c,d,e,f,g,h){vm().h=new sm(c.l,c.Gc());var l=Kp(b,c,d,!0);l.forDisplay=!1;l.offTheRecord=e;a.h.set(l.id,l);yq(a.j,a,l);up(a);(e=ro(b))&&e.g&&zq(a,e,l.id,g,h);return new Promise(function(p,r){oj(b)||pj(b)||mj(b)?(l.sb={tabId:h,sessionId:"",Zg:c.Gc()||"",ee:c.l||"",jw:c.h.friendlyName||""},mj(b)&&(l.isOffscreenPresentation=!0),Aq(a.j,a,l,
d,function(t){return Gi(Bq(a,b,c,d,f,g,h,t))}).g.then(function(){var t=zp(a.l,l.id);t.j=!1;Lp(t.session,l);t.controller&&(t.controller.m=!1,Eo(t.controller));p(l)},function(t){xq(a,l,t);r(t)})):Bq(a,b,c,d,f,g,h,l).then(function(){p(l)},function(t){xq(a,l,t);r(t)})})},Bq=function(a,b,c,d,e,f,g,h){return yp(a.m,Dq(b,c,e),c).then(function(l){wp(a,b,c,d,l,f,g,h);return h})};
uq.prototype.createRoute=function(a,b,c,d,e,f,g){var h=this,l=this.g.h(b);if(!l)return Fi(Error("No sink with ID "+b));var p=so(a);if(p){setTimeout(function(){Uo(h.m,p,l,chrome.cast.Di.CAST)},0);var r=function(){return Cq(h,a,l,c,d,e,f,g)},t=Yn(this.o,p);if(t)return Gi(this.terminateRoute(t.routeId).then(r,r));if(f&&g&&(b=Eq(this,a,f,g,d,e,b)))return b}return Gi(Cq(this,a,l,c,d,e,f,g))};
var ep=function(a,b,c,d,e){d=void 0===d?!1:d;e=void 0===e?"closed":e;B(a.u,"Remove route "+b);var f=eq(a.o,b);if(f){c=c||f.h;var g=f.clientId;B(a.u,"Remove client "+g);for(var h=a.l,l=0;l<h.g.length;l++)Zb(h.g[l].h,g);fq(a.o,g)}if(g=zp(a.l,b))Zb(g.g,b),Fq(a,g.g);if(h=a.h.get(b))if(h.lf&&g&&(np(a.D,h.sinkId,f?f.clientId:a.C,g.session.transportId,c),h.forDisplay&&f&&(a.s={jf:f,Eo:g})),a.h.remove(b),Gq(a.j,h),up(a),d)a.j.onPresentationConnectionClosed(b,e,"Remove route");else a.j.onPresentationConnectionStateChanged(b,
"terminated")},vp=function(a,b){b.g.forEach(function(c){if(c=a.h.get(c)){var d=b.session;if(c.forDisplay){var e=Bp(d.appId);e&&!c.isLocal?(c.description=d.statusText||"",d.displayName="",d.statusText=""):e||(c.description=d.statusText||d.displayName);b.controller&&Eo(b.controller)}Hq(a.j)}})},Iq=function(a,b){Ob(b,function(c){c=a.h.get(c,null);if(!c||!c.mediaSource)return!1;var d=ro(c.mediaSource);d=d?d.s:!1;return c.isLocal&&!d})&&Hb(b,function(c){if(c=a.h.get(c,null))c.isLocal=!0})},Fq=function(a,
b){var c=[],d=[],e=null;b.forEach(function(f){if(f=a.h.get(f)){f.forDisplay=!1;var g=ro(f.mediaSource);g&&Rb(lo(g),Vn)||(f.lf?(g=g?no(g):null,e||g==chrome.cast.qd.CUSTOM_CONTROLLER_SCOPED||(c.push(f),e=f.sinkId)):e&&e!=f.sinkId?c.push(f):d.push(f))}});Hb(0<c.length?c:d,function(f){f.forDisplay=!0})},zq=function(a,b,c,d,e){var f=b.g;if(f&&!Yn(a.o,f)){B(a.u,"Add client "+f);var g=lo(b);a.o.g.push(new cq(c,f,g,no(b),d||null,void 0!==e?e:null))}},wp=function(a,b,c,d,e,f,g,h){var l=Wm(a.l,c.getId());if(!l){var p=
a.l;l=c.getId();B(p.u,"Adding new session: "+l+", "+e.sessionId);var r=cp(p,e.sessionId);r?(Pn(e)?(r.w=e,r.l=l):Pn(r.session)&&(r.w=r.session,r.l=r.sinkId,r.session=e,r.sinkId=l),l=r):(l=new mq(l,e),p.g.push(l))}h&&h.isLocal&&h.sb&&(l.j=!1);var t=null!=b;if(!t&&Vn(e.appId))return null;null==b?(r=new ho([{appId:e.appId,capabilities:e.capabilities}]),b=oo(r)[0]):r=ro(b);if(p=h){if(!a.h.get(p.id))return a.u.J("Route "+p.id+" not added"),p}else p=Kp(b,c,d||e.sessionId,t),a.h.set(p.id,p);d=p.id;B(a.u,
"Add route "+d);b=null;r&&(b=r.g,zq(a,r,d,f,g));Tb(l.g,d)||l.g.push(d);p.lf&&(f=a.D,g=b||a.C,d=e.transportId,r=!(r&&r.s),(t=$m(f,c))&&Vp(f.j,t,g,d,r));l.offTheRecord=p.offTheRecord;f=l.g;Iq(a,f);Fq(a,f);f=p;g=e.sessionId;Bp(e.appId)?f.isLocal&&g&&f.sb?f.sb.sessionId=g:(f.description=e.statusText||"",e.displayName="",e.statusText=""):f.description=e.statusText||e.displayName;h?Hq(a.j):yq(a.j,a,p);up(a);if(h=b)Tb(l.h,b)?h=!1:(l.h.push(b),h=!0);h&&(a=a.m,co(a.h,b,new Wn("new_session",e)),fp(a,e,c));
return p};uq.prototype.terminateRoute=function(a){var b=this,c=this.h.get(a);if(!c)return Promise.reject(new rq(3,"Route in Cast provider not found for routeId  "+a));var d=zp(this.l,a);if(!d)return ep(this,a,!0),Promise.resolve();var e=d.session.sessionId,f=this.g.h(c.sinkId);if(!f)return Xm(this.m,e),Promise.resolve();(a=eq(this.o,a))&&Uo(this.m,a.clientId,f,chrome.cast.Di.STOP);xo(0);return new Promise(function(g){var h=function(){sp(b.m,f.getId());g()};b.F.sendRequest(new mn(e),f,Ql).then(h,h)})};
var Jq=function(a,b){var c=null;Em(a.h.Pb(!1),function(f){if(!f.lf)return!1;var g=a.g.h(f.sinkId);if(!g||!qo(b,Dq(f.mediaSource,g)))return!1;c=f;return!0});if(!c||!c.mediaSource)return null;var d=so(c.mediaSource);if(!d)return null;var e=Yn(a.o,d);return e?(d=oq(a.l,d))?{jf:e,Eo:d}:null:null},Eq=function(a,b,c,d,e,f,g){var h=null;Em(a.h.Pb(!1),function(p){var r=p.sb;return r&&null!=r.tabId&&r.tabId==d&&oj(p.mediaSource)?(h=p,!0):!1});if(!h)return null;var l=function(){return a.createRoute(b,g||h.sinkId,
"",e,f,c,null==d?void 0:d)};return Gi(a.terminateRoute(h.id).then(l,l))};k=uq.prototype;k.connectRouteByRouteId=function(a,b,c,d,e){if(!ro(a))return Fi(Error("Unsupported presentation URL"));if(!b)return Fi(Error("No routeId"));b=Hp(b);b=cp(this.l,b.g);if(!b)return Fi(Error("No matching route"));var f=this.g.h(b.sinkId);return f?(a=wp(this,a,f,c,b.session,d,e))?Ei(a):Fi(Error("Failed to create route")):Fi(Error("No sink"))};
k.joinRoute=function(a,b,c,d,e,f){var g=ro(a);if(!g)return Fi(Error("Unsupported presentation URL"));if(b==chrome.cast.ol){a:{var h=Jq(this,g);if(!h){if(!this.s||this.s.jf.origin!=e||this.s.jf.tabId!=f){h=null;break a}h=this.s}switch(no(g)){case chrome.cast.qd.PAGE_SCOPED:h=null;break a;case chrome.cast.qd.ORIGIN_SCOPED:if(e!=h.jf.origin){h=null;break a}break;case chrome.cast.qd.TAB_AND_ORIGIN_SCOPED:if(e!=h.jf.origin||f!=h.jf.tabId){h=null;break a}}h=cp(this.l,h.Eo.session.sessionId)}if(!h&&(g.j?
g.j:chrome.cast.ih.CREATE_SESSION)!=chrome.cast.ih.CAST_THIS_TAB&&(d=Eq(this,a,e,f,c,d)))return d}else h=Kq(this,b);if(!h)return Fi(Error("No matching route"));if(h.offTheRecord!=c)return Fi(Error("Off the record mismatch"));d=this.g.h(h.sinkId);if(!d)return Fi(Error("No sink"));a=wp(this,a,d,b,h.session,e,f);a.offTheRecord=c;return Ei(a)};k.detachRoute=function(a){ep(this,a,!1,!0)};
k.nj=function(a){var b=this.g.h(a);if(!b)throw Error("Cannot mirror with no sink.");var c=new Hj;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;Ij(c);Object.freeze(c);B(this.u,function(){return"Settings for "+a+": "+Gj(c)});if(!c.shouldCaptureAudio&&!c.shouldCaptureVideo)throw Error("Cannot start mirroring without video or audio capture");
return c};k.mj=function(){return"cast_streaming"};k.Ln=function(a){var b=this.h.get(a);b&&b.sb&&b.sb.nc&&(a=zp(this.l,a))&&(Lp(a.session,b),a.controller&&Eo(a.controller))};
k.sendRouteMessage=function(a,b,c){var d=this;if(!c)return new Promise(function(h,l){"string"!==typeof b&&l(Error("Cannot send non-string messages via ApiHandler."));l=d.m.h;hb($n,"Received: "+b);var p=JSON.parse(b),r=p.clientId;"client_connect"==p.type?(hb($n,"App "+r),(p=Yn(l.g,r))?(p.g=!0,(l=jn(l.h,p.routeId))&&l.yb.resolve(!0)):$n.J("Client not found "+r)):Zn(l,r)?(l=l.j[p.type])&&l(p):$n.J("No route for "+r);h()});var e=zp(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=eq(this.o,a))?a.clientId:this.C;return new Promise(function(h){sn(d.D,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.jm=function(a,b){var c=this.g.h(b);if(!c)return!1;if(!this.w)return!0;a=Dq(a,c);return(a=po(a))&&0!=a.length?Ob(a,function(d){return Wl(zm(c,d))}):!1};
k.Ri=function(a,b,c){var d=wq(a);return d&&0!=d.length?b==chrome.cast.ol?!0:c&&c.mediaSource?(a=po(c.mediaSource),Ob(a,function(e){return Tb(d,e)})):void 0==b||Kq(this,b)?!0:!1:!1};
var Dq=function(a,b,c){return ro(a)?a:oj(a)||pj(a)||mj(a)?(a={appId:0==(b.g&1)?"85CDB22F":"0F5096E8",capabilities:Rn(b.g)},oo(new ho([a],void 0,void 0,void 0,c))[0]):a},wq=function(a){var b=[],c=ro(a);if(c)b=lo(c);else if(oj(a)||pj(a)||mj(a))pj(a)||b.push("85CDB22F"),b.push("0F5096E8");return b},vq=function(a){var b=ro(a);if(!b)return null;a=wq(a);var c=b.o||"";b=b.w;return c&&b?new kn(a,c,JSON.stringify(b)):null},Kq=function(a,b){return 0==b.indexOf(chrome.cast.Hl)?cp(a.l,b.substr(chrome.cast.Hl.length)):
pq(a.l,b)},$p=function(a,b,c){var d=a.G;if(In(d)&&Vl.hasOwnProperty(c.namespace_)){var e=b.Gc();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 Ml(e,f,h));g&&g.appId===f||Jn(d)}}}a=a.m;b=b.getId();Vl.hasOwnProperty(c.namespace_)?op(a,b,c):pp(a,b,c)},Rm=function(a,b){a.w&&a.w.wo(b);Ym(a.G);Zm(a.j)};k=uq.prototype;k.Ta=function(){return"cast.Provider"};
k.Fb=function(){return[new Lq(this.C,Mm(this.h),this.s)]};k.Db=function(){var a=am(this);a&&(this.C=a.senderId,Gm(this.h,a.h),this.s=a.g)};k.searchSinks=function(){return Ya()};k.createMediaRouteController=function(a,b,c){return(a=this.m.createMediaRouteController(a,b,c))?Promise.reject(a):Promise.resolve()};k.provideSinks=function(a){Vm(this.g,a)};var up=function(a){var b=a.Nh().some(function(c){return c.isLocal});Mq(a.j,a.Ta(),b)};uq.prototype.u=ab("mr.CastProvider");
var Lq=function(a,b,c){this.senderId=a;this.h=b;this.g=c};var Nq=/^(?:([^:/?#.]+):)?(?:\/\/(?:([^\\/?#]*)@)?([^\\/?#]*?)(?::([0-9]+))?(?=[\\/?#]|$))?([^?#]+)?(?:\?([^#]*))?(?:#([\s\S]*))?$/,Oq=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," ")):"")}}},Pq=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]},Qq=function(a,b,c){if(Array.isArray(b))for(var d=0;d<b.length;d++)Qq(a,String(b[d]),c);else null!=b&&c.push(a+(""===b?"":"="+encodeURIComponent(String(b))))},Rq=function(a){var b=[],c;for(c in a)Qq(c,a[c],b);return b.join("&")},Sq=function(a,b){b=Rq(b);return Pq(a,b)},Tq=function(a,b,c){c=null!=c?"="+encodeURIComponent(String(c)):"";return Pq(a,b+c)},Uq=/#|$/,Vq=function(a,b){var c=a.search(Uq);a:{var d=0;for(var e=
b.length;0<=(d=a.indexOf(b,d))&&d<c;){var f=a.charCodeAt(d-1);if(38==f||63==f)if(f=a.charCodeAt(d+e),!f||61==f||38==f||35==f)break a;d+=e+1}d=-1}if(0>d)return null;e=a.indexOf("&",d);if(0>e||e>c)e=c;d+=b.length+1;return decodeURIComponent(a.substr(d,e-d).replace(/\+/g," "))},Wq=function(a,b){var c=a.length-1;0<=c&&a.indexOf("/",c)==c&&(a=a.substr(0,a.length-1));gd(b,"/")&&(b=b.substr(1));return ve(a,"/",b)};var Xq=function(a){this.ac=this.w=this.j="";this.o=null;this.l=this.g="";this.m=!1;var b;a instanceof Xq?(this.m=a.m,Yq(this,a.j),this.w=a.w,this.ac=a.ac,Zq(this,a.zb()),this.g=a.g,$q(this,a.h.clone()),this.l=a.l):a&&(b=String(a).match(Nq))?(this.m=!1,Yq(this,b[1]||"",!0),this.w=ar(b[2]||""),this.ac=ar(b[3]||"",!0),Zq(this,b[4]),this.g=ar(b[5]||"",!0),$q(this,b[6]||"",!0),this.l=ar(b[7]||"")):(this.m=!1,this.h=new br(null,this.m))};
Xq.prototype.toString=function(){var a=[],b=this.j;b&&a.push(cr(b,dr,!0),":");var c=this.ac;if(c||"file"==b)a.push("//"),(b=this.w)&&a.push(cr(b,dr,!0),"@"),a.push(encodeURIComponent(String(c)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),c=this.zb(),null!=c&&a.push(":",String(c));if(c=this.g)this.ac&&"/"!=c.charAt(0)&&a.push("/"),a.push(cr(c,"/"==c.charAt(0)?er:fr,!0));(c=this.h.toString())&&a.push("?",c);(c=this.l)&&a.push("#",cr(c,gr));return a.join("")};
Xq.prototype.resolve=function(a){var b=this.clone(),c=!!a.j;c?Yq(b,a.j):c=!!a.w;c?b.w=a.w:c=!!a.ac;c?b.ac=a.ac:c=null!=a.o;var d=a.g;if(c)Zq(b,a.zb());else if(c=!!a.g){if("/"!=d.charAt(0))if(this.ac&&!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=gd(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?$q(b,a.h.clone()):c=!!a.l;c&&(b.l=a.l);return b};Xq.prototype.clone=function(){return new Xq(this)};var Yq=function(a,b,c){a.j=c?ar(b,!0):b;a.j&&(a.j=a.j.replace(/:$/,""))};Xq.prototype.zb=function(){return this.o};
var Zq=function(a,b){if(b){b=Number(b);if(isNaN(b)||0>b)throw Error("Bad port number "+b);a.o=b}else a.o=null},$q=function(a,b,c){b instanceof br?(a.h=b,hr(a.h,a.m)):(c||(b=cr(b,ir)),a.h=new br(b,a.m))},ar=function(a,b){return a?b?decodeURI(a.replace(/%25/g,"%2525")):decodeURIComponent(a):""},cr=function(a,b,c){return"string"===typeof a?(a=encodeURI(a).replace(b,jr),c&&(a=a.replace(/%25([0-9a-fA-F]{2})/g,"%$1")),a):null},jr=function(a){a=a.charCodeAt(0);return"%"+(a>>4&15).toString(16)+(a&15).toString(16)},
dr=/[#\/\?@]/g,fr=/[#\?:]/g,er=/[#\?]/g,ir=/[#\?@]/g,gr=/#/g,br=function(a,b){this.h=this.g=null;this.j=a||null;this.l=!!b},kr=function(a){a.g||(a.g=new Hm,a.h=0,a.j&&Oq(a.j,function(b,c){a.add(decodeURIComponent(b.replace(/\+/g," ")),c)}))},nr=function(a){var b=yn(a);if("undefined"==typeof b)throw Error("Keys are undefined");var c=new br(null,void 0);a=xn(a);for(var d=0;d<b.length;d++){var e=b[d],f=a[d];Array.isArray(f)?lr(c,e,f):c.add(e,f)}return c};k=br.prototype;k.wa=function(){kr(this);return this.h};
k.add=function(a,b){kr(this);this.j=null;a=or(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){kr(this);a=or(this,a);return Km(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.uc=function(){kr(this);return 0==this.h};var pr=function(a,b){kr(a);b=or(a,b);return Km(a.g,b)};k=br.prototype;k.kf=function(a){var b=this.Ja();return Tb(b,a)};
k.forEach=function(a,b){kr(this);this.g.forEach(function(c,d){Hb(c,function(e){a.call(b,e,d,this)},this)},this)};k.Lb=function(){kr(this);for(var a=this.g.Ja(),b=this.g.Lb(),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){kr(this);var b=[];if("string"===typeof a)pr(this,a)&&(b=bc(b,this.g.get(or(this,a))));else{a=this.g.Ja();for(var c=0;c<a.length;c++)b=bc(b,a[c])}return b};
k.set=function(a,b){kr(this);this.j=null;a=or(this,a);pr(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 lr=function(a,b,c){a.remove(b);0<c.length&&(a.j=null,a.g.set(or(a,b),cc(c)),a.h+=c.length)};
br.prototype.toString=function(){if(this.j)return this.j;if(!this.g)return"";for(var a=[],b=this.g.Lb(),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("&")};br.prototype.clone=function(){var a=new br;a.j=this.j;this.g&&(a.g=this.g.clone(),a.h=this.h);return a};
var or=function(a,b){b=String(b);a.l&&(b=b.toLowerCase());return b},hr=function(a,b){b&&!a.l&&(kr(a),a.j=null,a.g.forEach(function(c,d){var e=d.toLowerCase();d!=e&&(this.remove(d),lr(this,e,c))},a));a.l=b};br.prototype.extend=function(a){for(var b=0;b<arguments.length;b++)An(arguments[b],function(c,d){this.add(d,c)},this)};var qr=function(a,b){this.input=a;this.domain=b};var rr=function(a){this.g=a;this.u=ab("mr.ExternalMessageHandler")};
rr.prototype.onMessage=function(a,b,c){var d=this;B(this.u,"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 qr(a.meetingName,a.domain)).then(function(f){var g="PresentationId"+b.id+sr++;d.g.createRoute("urn:x-org.chromium.media:source:desktop",f,g).then(function(h){c(new xf(e,"route",h.id))}).catch(function(h){c(new xf(e,"error",h))})},function(){c(new xf(e,"error",
Error("Failed to find sink.")))})):"stop"==a.type?this.g.terminateRoute(a.message.routeId).then(function(){c(new xf(e,"stopped"))}):"subscribe_log_data"==a.type?(cb.push(function(f){chrome.runtime.sendMessage(b.id,new xf(e,"log_message",f))}),c(new xf(e,"subscribed"))):(c(new xf(e,"error",Error("Unhandled message type"))),this.u.error("Unhandled message type "+a.type))};var sr=0;var tr=function(){this.g=[];this.h=[]};k=tr.prototype;k.enqueue=function(a){if(1E3<=this.wa()){if(this.uc())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.uc=function(){return 0==this.wa()};k.Ja=function(){var a=this.g.slice();a.reverse();a.push.apply(a,q(this.h));return a};k.clear=function(){this.g=[];this.h=[]};var ur=function(){this.g=new tr;this.h=Date.now()},wr=function(){null==vr&&(vr=new ur);return vr};
ur.prototype.init=function(){bb=1;var a=ab("browser"),b=window.onerror;window.onerror=function(d,e,f,g,h){try{var l=h.result.error.errors[0];if("usageLimits"==l.domain&&"accessNotConfigured"==l.reason)return!0}catch(p){}b&&b(d,e,f,g,h);a.error("Error: "+d+" ("+e+" @ Line: "+f+")",h)};cb.push(this.l.bind(this));var c=window.localStorage["debug.logs"];c&&(bb=jb(c.toUpperCase()));(c=window.localStorage["debug.console"])&&"false"!=c.toLowerCase()&&cb.push(this.j.bind(this))};
ur.prototype.l=function(a){this.g.enqueue(xr(this,a,!1));a=a.Ec;a instanceof Error&&a.stack&&this.g.enqueue(a.stack)};ur.prototype.j=function(a){var b=[xr(this,a,!0)];a.Ec&&b.push(a.Ec);switch(a.level){case 3:console.error.apply(console,q(b));break;case 2:console.warn.apply(console,q(b));break;case 1:console.log.apply(console,q(b));break;default:console.debug.apply(console,q(b))}};
var xr=function(a,b,c){var d=["["];if(c)a=(Date.now()-a.h)/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("][",ib[b.level],"][",b.T,"] ",b.message);if(!c&&null!=b.Ec)if(d.push("\n"),b.Ec instanceof Error)d.push(b.Ec.message);else try{d.push(JSON.stringify(b.Ec))}catch(f){d.push(b.Ec.toString())}d.push("\n");
return d.join("")},yr=function(){var a=wr();return 0==a.g.wa()?"NA":a.g.Ja().join("")},zr=function(){var a=wr();dm(a)};ur.prototype.Ta=function(){return"LogManager"};ur.prototype.Fb=function(){return[this.g.Ja()]};ur.prototype.Db=function(){var a=this.g.Ja();this.g.clear();for(var b=n(am(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 vr=null;var Ar=function(a){return Promise.all(a.map(function(b){return b.then(function(c){return{Vd:!0,value:c}},function(c){return{Vd:!1,reason:c}})}))};var Br=function(a){this.g=a;this.u=ab("mr.InternalMessageHandler")};
Br.prototype.onMessage=function(a,b,c){var d=this;if("retrieve_log_data"!=a.type)c(new xf(chrome.runtime.id,"error",Error("Unhandled message type")));else{var e={logs:yr(),device:xm()};b=[];var f=wf(e.device.ip).then(function(h){h.g&&(e.device.version=h.g)});b.push(f);var g=this.g.D;g&&(a=Cr(this,g,a.source).then(function(h){h&&(e.castStreamingLogs=h)},function(){d.u.error("Log upload failed for service: "+g)}),b.push(a));this.g.config&&(this.g.config.enable_cast_sink_query?b.push(Dr(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.u.error("Fail to get media sink service status")});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);Ar(b).then(function(){c(e)})}};
var Dr=function(a,b){return cj("mr.cast.SinkDiscoveryService").then(function(c){c=c.Eh;b.castDeviceCounts=c.gn+"."+c.dm},function(){a.u.error("Failed to get device counts for castDeviceCounts.")})},Cr=function(a,b,c){return Er(a.g,b).then(function(d){return d.hk(c)})};var Fr={ACCEPTED:0,Sz:1,TIMEOUT:2},Gr={SUCCESS:0,jA:1},Hr={Sq:0,uq:1,hK:2,vB:3,uB:4,GD:5,TIMEOUT:6,nF:7},Ir={qB:0,eI:1},Jr=function(a){vb("MediaRouter.Cloud.Knock.Result",a,Fr)},Kr=function(a){vb("MediaRouter.Cloud.Session.Start",a,Gr)},Lr=function(a){vb("MediaRouter.Cloud.Session.Type",a,Ir)};var Mr=function(a,b){this.g=a;this.h=b},Nr=new Mr("https://castedumessaging-pa.googleapis.com/v1","AIzaSyAOZM8ZYeov685QMjXT3sC7XNizfrTEKjA"),Or=new Mr("https://www.googleapis.com/calendar/v3",""),Pr=new Mr("https://www.googleapis.com/hangouts/v1",""),Qr=new Mr("https://networktraversal.googleapis.com/v1alpha","AIzaSyAOZM8ZYeov685QMjXT3sC7XNizfrTEKjA");var Rr=function(a,b,c,d,e,f){c=void 0===c?null:c;a||null==c&&(c="default");this.bn=a;this.Qa=b;this.ac=c;this.xf=void 0===d?null:d;this.ad=void 0===e?null:e;this.Ie=void 0===f?null:f},Sr=function(a){var b="";a.ad?b=a.ad:a.xf&&(b=a.xf);return b};Rr.prototype.Bd=function(){return this.bn};Rr.prototype.getId=function(){return this.Qa};Rr.prototype.merge=function(a){!this.Ie&&a.Ie&&(this.Ie=a.Ie);!this.ad&&a.ad&&(this.ad=a.ad);this.ad&&a.ad&&this.Ie&&(this.ad=a.ad)};var Tr=function(a,b){this.h=a;this.j=b;this.u=ab("mr.cloud.calendar.CalendarService")},Xr=function(a){return Ur(a,a.j.h).then(function(b){B(a.u,Vr(b.length)+" events discovered before filtering.");return Wr(a,b)},function(b){a.u.J("Error getting Hangouts from calendar.",b);return[]})},Vr=function(a){return 20<a?"20+":a.toString()},Ur=function(a,b){var c=Date.now();return Yr(a,b,new Date(c),new Date(c+9E5)).then(function(d){return d.filter(a.g)})};
Tr.prototype.g=function(a){return!(!a.start||!a.end||a.start.date||a.end.date||!a.start.dateTime||!a.end.dateTime)};
var Yr=function(a,b,c,d){b=Zr(Or.g,["calendars",b,"events"],{timeMin:c.toJSON(),timeMax:d.toJSON(),singleEvents:!0});hb(a.u,"Retrieving Hangouts from Calendar: "+b);vb("MediaRouter.Cloud.CalendarApiCaller",wb,xb);null!=yb&&(clearTimeout(yb),yb=null);return $r(a.h,b,"GET").then(function(e){return e.items?e.items:[]})},Wr=function(a,b){var c=[];b.filter(function(d){return d.hangoutLink}).forEach(function(d){var e=new Xq(d.hangoutLink);if("meet.google.com"==e.ac)c.push(new Rr(!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 Rr(!1,f+"@"+e,h,g,d.summary,void 0))}else a.u.J("Invalid hangout link from calendar event: "+d.hangoutLink)});B(a.u,Vr(c.length)+" events discovered with Hangout links.");return c};var as=function(a,b,c,d,e,f,g,h){var l=wm(vm(),a);this.Gb=new Xl(l,b,g,h,e);this.deviceId=a;this.g=c;this.model=d;this.isAvailable=f};da.Object.defineProperties(as.prototype,{id:{configurable:!0,enumerable:!0,get:function(){return this.Gb.id}},displayName:{configurable:!0,enumerable:!0,set:function(a){this.Gb.friendlyName=a}}});var bs=function(a){var b=a.ac,c;a.xf&&Sr(a)!=a.xf&&(c=a.xf);as.call(this,a.getId(),Sr(a),"mesi","Hangout",b,!1,a.Bd()?"meeting":"hangout",c);this.Bd=a.Bd();this.Xg=a.Ie||""};
u(bs,as);var cs=function(a,b,c){as.call(this,a,b,"slarti","Cast Receiver for Education","default",c,"education")};u(cs,as);var ds=function(a,b,c){this.s=a;this.w=b;this.g=new Map;this.m=new Map;this.l=null;this.o=c};ds.prototype.j=function(){var a=this.l+this.o;if(null==this.l||a<Date.now())this.l=Date.now(),es(this);return Array.from(this.g.values())};ds.prototype.h=function(a){return this.g.get(a)||null};
var es=function(a){a.s().then(function(b){fs(a,b)})},fs=function(a,b){var c=new Map(a.g),d=new Map,e=new Map,f=[],g=[];b.forEach(function(h){var l=h.id;d.set(l,h);e.set(l,h.deviceId);c.has(l)?c.has(l)&&JSON.stringify(c.get(l))!=JSON.stringify(h)&&g.push(h.Gb):f.push(h.Gb);c.delete(l)});b=[].concat(q(c.values())).map(function(h){return h.Gb});a.m.clear();a.m=e;a.g.clear();a.g=d;gs(a,f,g,b)},gs=function(a,b,c,d){0<b.length&&hs(a.w,b);0<c.length&&is(a.w,c);0<d.length&&js(a.w,d)},ls=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.m.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 ks(b,c,a.l)},ms=function(a,b){for(var c in b.sinks){var d=b.sinks[c],e=null;"Hangout"==d.model?e=new bs(new Rr(d.Bd,d.deviceId,d.Gb.domain,d.Gb.description,d.Gb.friendlyName,d.Xg)):"Cast Receiver for Education"==d.model&&(e=new cs(d.deviceId,d.Gb.friendlyName,d.isAvailable));
a.g.set(c,e)}for(c in b.g)a.m.set(c,b.g[c]);b.h&&(a.l=b.h)},ks=function(a,b,c){this.sinks=a;this.g=b;this.h=c};var ps=function(a,b,c){if(!ns){Vf();var d=Uf;d.h=Qf;var e=os;d.g||(d.g=[]);d.g.push(e);ns=!0}this.m=a;this.w=b;this.g=new ds(this.o.bind(this),c,2E4);this.l=new Map;dm(this)},os=function(a){db({T:a.j,level:kb(a.h.value),time:a.m,message:a.getMessage(),Ec:a.g})};ps.prototype.j=function(){return this.g.j()};ps.prototype.h=function(a){return this.g.h(a)};
ps.prototype.o=function(){var a=this;B(this.u,"Fetching hangouts");return Ar([qs(this.w),Xr(this.m)]).then(function(b){var c=Array.from(a.l.values());b.forEach(function(e){e.Vd?c=c.concat(e.value):a.u.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];ub("MediaRouter.Cloud.Hangout.Sink.Discovered");return new bs(e)})})};
var ss=function(a,b){return cj("mr.mirror.hangouts.MeetingsService").then(function(c){return c.Mb(b)}).then(function(c){return rs(a,c)},function(){return b.input.match(/^#/)?Promise.reject(Error("Failed to resolve meeting alias.")):rs(a,b.input,b.domain)})},rs=function(a,b,c){c=c||void 0;var d=!c;b=new Rr(d,d?b:b+"@"+c,c,b,void 0,void 0);a.l.set(b.getId(),b);b=new bs(b);a.g.g.set(b.id,b);return b.Gb};ps.prototype.Ta=function(){return"HangoutSinkDiscoveryService"};
ps.prototype.Fb=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:ls(this.g),manualHangouts:a}]};ps.prototype.Db=function(){var a=am(this);if(a){ms(this.g,a.cache);for(var b in a.manualHangouts){var c=a.manualHangouts[b];this.l.set(b,new Rr(c.bn,c.Qa,c.ac,c.xf,c.ad,c.Ie))}}};ps.prototype.u=ab("mr.cloud.discovery.HangoutSinkDiscoveryService");var ns=!1;var T=function(){this.Oc=this.Oc;this.mb=this.mb};T.prototype.Oc=!1;T.prototype.w=function(){return this.Oc};T.prototype.dispose=function(){this.Oc||(this.Oc=!0,this.aa())};T.prototype.N=function(a){ts(this,Wa(us,a))};var ts=function(a,b){a.Oc?b():(a.mb||(a.mb=[]),a.mb.push(b))};T.prototype.aa=function(){if(this.mb)for(;this.mb.length;)this.mb.shift()()};
var us=function(a){a&&"function"==typeof a.dispose&&a.dispose()},vs=function(a){for(var b=0,c=arguments.length;b<c;++b){var d=arguments[b];Na(d)?vs.apply(null,d):us(d)}};var ws=Ea.JSON.parse,xs=Ea.JSON.stringify;var ys=function(a,b){this.j=a;this.l=b;this.h=0;this.g=null};ys.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 zs=function(a,b){a.l(b);100>a.h&&(a.h++,b.next=a.g,a.g=b)};var As=function(a){Ea.setTimeout(function(){throw a;},0)},Bs,Cs=function(){var a=Ea.MessageChannel;"undefined"===typeof a&&"undefined"!==typeof window&&window.postMessage&&window.addEventListener&&!Zd("Presto")&&(a=function(){var e=ig(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=w(function(l){if(("*"==
h||l.origin==h)&&l.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&&!ae()){var b=new a,c={},d=c;b.port1.onmessage=function(){if(void 0!==c.next){c=c.next;var e=c.km;c.km=null;e()}};return function(e){d.next={km:e};d=d.next;b.port2.postMessage(0)}}return function(e){Ea.setTimeout(e,0)}};var Ds=function(){this.h=this.g=null},Fs=new ys(function(){return new Es},function(a){a.reset()});Ds.prototype.add=function(a,b){var c=Fs.get();c.set(a,b);this.h?this.h.next=c:this.g=c;this.h=c};Ds.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 Es=function(){this.next=this.scope=this.g=null};Es.prototype.set=function(a,b){this.g=a;this.scope=b;this.next=null};Es.prototype.reset=function(){this.next=this.scope=this.g=null};var Ks=function(a,b){Gs||Hs();Is||(Gs(),Is=!0);Js.add(a,b)},Gs,Hs=function(){if(Ea.Promise&&Ea.Promise.resolve){var a=Ea.Promise.resolve(void 0);Gs=function(){a.then(Ls)}}else Gs=function(){var b=Ls;!Oa(Ea.setImmediate)||Ea.Window&&Ea.Window.prototype&&!Zd("Edge")&&Ea.Window.prototype.setImmediate==Ea.setImmediate?(Bs||(Bs=Cs()),Bs(b)):Ea.setImmediate(b)}},Is=!1,Js=new Ds,Ls=function(){for(var a;a=Js.remove();){try{a.g.call(a.scope)}catch(b){As(b)}zs(Fs,a)}Is=!1};var Ms=function(a){a.prototype.$goog_Thenable=!0},Ns=function(a){if(!a)return!1;try{return!!a.$goog_Thenable}catch(b){return!1}};var Qs=function(a,b){this.g=0;this.o=void 0;this.l=this.h=this.j=null;this.m=this.w=!1;if(a!=Ka)try{var c=this;a.call(b,function(d){Os(c,2,d)},function(d){if(!(d instanceof Ps))try{if(d instanceof Error)throw d;throw Error("Promise rejected.");}catch(e){}Os(c,3,d)})}catch(d){Os(this,3,d)}},Rs=function(){this.next=this.context=this.h=this.l=this.g=null;this.j=!1};Rs.prototype.reset=function(){this.context=this.h=this.l=this.g=null;this.j=!1};
var Ss=new ys(function(){return new Rs},function(a){a.reset()}),Ts=function(a,b,c){var d=Ss.get();d.l=a;d.h=b;d.context=c;return d},Us=function(a){if(a instanceof Qs)return a;var b=new Qs(Ka);Os(b,2,a);return b},Vs=function(a){return new Qs(function(b,c){c(a)})},Xs=function(a,b,c){Ws(a,b,c,null)||Ks(Wa(b,a))},Ys=function(a){return new Qs(function(b,c){a.length||b(void 0);for(var d=0,e;d<a.length;d++)e=a[d],Xs(e,b,c)})},Zs=function(a){return new Qs(function(b,c){var d=a.length,e=[];if(d)for(var f=
function(p,r){d--;e[p]=r;0==d&&b(e)},g=function(p){c(p)},h=0,l;h<a.length;h++)l=a[h],Xs(l,Wa(f,h),g);else b(e)})},$s=function(a){return new Qs(function(b){var c=a.length,d=[];if(c)for(var e=function(h,l,p){c--;d[h]=l?{Vd:!0,value:p}:{Vd:!1,reason:p};0==c&&b(d)},f=0,g;f<a.length;f++)g=a[f],Xs(g,Wa(e,f,!0),Wa(e,f,!1));else b(d)})},bt=function(){var a,b,c=new Qs(function(d,e){a=d;b=e});return new at(c,a,b)};Qs.prototype.then=function(a,b,c){return ct(this,Oa(a)?a:null,Oa(b)?b:null,c)};Ms(Qs);
var et=function(a,b,c){b=Ts(b,b,c);b.j=!0;dt(a,b);return a},ft=function(a,b){return ct(a,null,b,void 0)};Qs.prototype.cancel=function(a){if(0==this.g){var b=new Ps(a);Ks(function(){gt(this,b)},this)}};
var gt=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?gt(c,b):(f?(d=f,d.next==c.l&&(c.l=d),d.next=d.next.next):ht(c),it(c,e,3,b)))}a.j=null}else Os(a,3,b)},dt=function(a,b){a.h||2!=a.g&&3!=a.g||jt(a);a.l?a.l.next=b:a.h=b;a.l=b},ct=function(a,b,c,d){var e=Ts(null,null,null);e.g=new Qs(function(f,g){e.l=b?function(h){try{var l=b.call(d,h);f(l)}catch(p){g(p)}}:f;e.h=c?function(h){try{var l=c.call(d,
h);void 0===l&&h instanceof Ps?g(h):f(l)}catch(p){g(p)}}:g});e.g.j=a;dt(a,e);return e.g};Qs.prototype.D=function(a){this.g=0;Os(this,2,a)};Qs.prototype.C=function(a){this.g=0;Os(this,3,a)};
var Os=function(a,b,c){0==a.g&&(a===c&&(b=3,c=new TypeError("Promise cannot resolve to itself")),a.g=1,Ws(c,a.D,a.C,a)||(a.o=c,a.g=b,a.j=null,jt(a),3!=b||c instanceof Ps||kt(a,c)))},Ws=function(a,b,c,d){if(a instanceof Qs)return dt(a,Ts(b||Ka,c||null,d)),!0;if(Ns(a))return a.then(b,c,d),!0;if(Pa(a))try{var e=a.then;if(Oa(e))return lt(a,e,b,c,d),!0}catch(f){return c.call(d,f),!0}return!1},lt=function(a,b,c,d,e){var f=!1,g=function(l){f||(f=!0,c.call(e,l))},h=function(l){f||(f=!0,d.call(e,l))};try{b.call(a,
g,h)}catch(l){h(l)}},jt=function(a){a.w||(a.w=!0,Ks(a.s,a))},ht=function(a){var b=null;a.h&&(b=a.h,a.h=b.next,b.next=null);a.h||(a.l=null);return b};Qs.prototype.s=function(){for(var a;a=ht(this);)it(this,a,this.g,this.o);this.w=!1};
var it=function(a,b,c,d){if(3==c&&b.h&&!b.j)for(;a&&a.m;a=a.j)a.m=!1;if(b.g)b.g.j=null,mt(b,c,d);else try{b.j?b.l.call(b.context):mt(b,c,d)}catch(e){nt.call(null,e)}zs(Ss,b)},mt=function(a,b,c){2==b?a.l.call(a.context,c):a.h&&a.h.call(a.context,c)},kt=function(a,b){a.m=!0;Ks(function(){a.m&&nt.call(null,b)})},nt=As,Ps=function(a){Bb.call(this,a)};y(Ps,Bb);Ps.prototype.name="cancel";var at=function(a,b,c){this.da=a;this.resolve=b;this.reject=c};var ot=function(a,b,c,d,e,f,g,h,l){T.call(this);this.g=null;this.C=!1;this.D=bt();this.h=[];this.s=a?encodeURIComponent(String(a)):null;this.F=null;!d&&b&&(this.F=b);this.H=c||null;this.j=!d;this.l=null!=e?e:null;this.o=f||null;this.L=!!g;this.G=h||null;this.m=null!=l?l:null};u(ot,T);ot.prototype.init=function(){var a=w(function(c){this.g=c;var d=Ja("auth",c);Ja("client.request",c)&&d?this.K():c.load("client",w(this.K,this))},this),b=pt("gapi");b?a(b.gapi):qt(this,a);return this.D.da};
var pt=function(a){for(var b=window,c=Ja(a,b);!c&&b!=window.top&&rt(b.parent,a);)b=b.parent,c=Ja(a,b);return c?b:null},rt=function(a,b){try{return!!a&&null!=a.location.href&&Ce(a,b)}catch(c){return!1}},qt=function(a,b){var c=pt("gapi_onload");if(c){var d=c.gapi_onload;c.gapi_onload=function(){d();b(c.gapi)}}else{window.gapi_onload=function(){b(window.gapi)};var e=ig(document,"SCRIPT");qe(e,st);a.G&&lg(e,xs(a.G));document.getElementsByTagName("head")[0].appendChild(e)}};
ot.prototype.K=function(){for(var a=0;a<this.h.length;a++)this.h[a].yb.resolve(tt(this,this.h[a].requestData));this.C=!0;this.D.resolve(this.g)};ot.prototype.sendRequest=function(a){if(this.C)return tt(this,a);var b=bt();this.h.push({requestData:a,yb:b});return b.da};
var tt=function(a,b){var c=Ja("config.get",a.g);if(!a.j){var d=c("googleapis.config/auth/useFirstPartyAuth");var e=c("googleapis.config/auth/useOriginToken")}var f;null!=a.l&&(f=c("client/cors"));var g;null!=a.m&&(g=c("client/xd4"));try{var h=Ja("config.update",a.g);a.j||(h("googleapis.config/auth/useFirstPartyAuth",!1),h("googleapis.config/auth/useOriginToken",!1));null!=a.l&&h("client/cors",a.l);null!=a.m&&h("client/xd4",a.m);var l=ut(a);b.headers&&Mc(l,b.headers);var p={headers:l,root:a.H,path:b.path,
method:b.method,body:b.body},r=b.params||{};a.s&&!a.o?Mc(r,{key:a.s}):a.o&&Mc(r,{key:null});Gc(r)||(p.params=r);var t=Us(Ja("client.request",a.g)(p));b.callback&&t.then(function(A){b.callback.apply(null,[A.result,A])},function(A){b.callback.apply(null,[A.result,A])});return t}finally{c=Ja("config.update",a.g),a.j||(c("googleapis.config/auth/useFirstPartyAuth",d),c("googleapis.config/auth/useOriginToken",e)),null!=a.l&&c("client/cors",f),null!=a.m&&c("client/xd4",g)}},ut=function(a){if(a.j){if(a.o)return{Authorization:"Bearer "+
a.o};var b=Ja("auth.getAuthHeaderValueForFirstParty",a.g);return{Authorization:a.L?b([]):b(),"X-Goog-AuthUser":a.F}}return{}},st=new bd($c,Rc(new Qc(Oc,"https://apis.google.com/js/client.js")));var vt=function(a){this.g=a},Zr=function(a,b,c){var d="";b.forEach(function(e){d+="/"+encodeURIComponent(e)});a=new Xq(a+d);c&&(c=nr(c),$q(a,c));return a},$r=function(a,b,c,d,e){e=void 0===e?1:e;return a.g.getAuthToken().then(function(f){return wt(a,b,c,f,d).catch(function(g){if("INVALID_ACCESS_ERROR"==g&&0<e)return xt(a,f,b,c,d,e-1);throw g;})})},xt=function(a,b,c,d,e,f){return yt(b).then(function(){return $r(a,c,d,e,f)})},wt=function(a,b,c,d,e){var f=zt;d=new ot(void 0,void 0,void 0,!1,!1,d);d.init();
return f(a,d,b,c,e)},zt=function(a,b,c,d,e){return new Promise(function(f,g){b.sendRequest(At(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))})},At=function(a,b,c,d){a={callback:c,method:b,path:a.toString()};d&&(a.body=d);return a};var Dt=function(){this.g=!1;this.h=null;this.j=!1;this.u=ab("mr.cloud.identity.IdentityService");dm(this);Bt(this);Ct(this)},Et=function(a){return a.h?a.h.substr(a.h.indexOf("@")+1):""};Dt.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 yt=function(a){return new Promise(function(b){chrome.identity.removeCachedAuthToken({token:a},function(){b()})})},Ct=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){hb(a.u,"Unable to set sign in and email.",b)})},Bt=function(a){chrome.identity.onSignInChanged.addListener(function(b,c){lj(6);a.g=c;B(a.u,"Signed in change: "+a.g);a.g?Ct(a):(a.h=null,a.j=!1)})},Ft=function(a){return a.getAuthToken().then(function(b){var c=
window.gapi;if(!c)return a.u.error("gapi not loaded."),!1;B(a.u,"Setting gapi auth token");c.auth.setToken({access_token:b});return!0})};Dt.prototype.Ta=function(){return"IdentityService"};Dt.prototype.Fb=function(){return[null,{signedIn:this.g,userEmail:this.h,kioskAuth:this.j}]};Dt.prototype.Db=function(){var a=bm(this);a&&(a.signedIn&&(this.g=a.signedIn),a.userEmail&&(this.h=a.userEmail),a.kioskAuth&&(this.j=a.kioskAuth))};var Gt="cloudview.test@gmail.com castouts.qa.nohangouts@gmail.com castouts.qa@gmail.com castouts-qa.com castouts-test.com google.com youtube.com nest.com waze.com netflix.com twitter.com yahoo.com salesforce.com whirlpool.com nytimes.com kohls.com squareup.com ivci.com".split(" ");var Ht={kz:{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"}},jz:{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"}}},It=Ht;It=Ht;var Jt={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$","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 Kt={rl:".",zi:",",Fl:"%",Fi:"0",gq:"+",Al:"-",ul:"E",Gl:"\u2030",Ai:"\u221e",Zp:"NaN",Dp:"#,##0.###",gH:"#E0",bF:"#,##0%",Pz:"\u00a4#,##0.00",sl:"USD"},Lt=Kt;Lt=Kt;var Nt=function(){this.C=40;this.h=1;this.j=3;this.G=this.w=0;this.L=!1;this.F=this.s="";this.l=Lt.Al;this.D="";this.g=1;this.o=!1;this.m=[];this.K=this.H=!1;var a=Lt.Dp;a.replace(/ /g,"\u00a0");var b=[0];this.s=Mt(this,a,b);for(var c=b[0],d=-1,e=0,f=0,g=0,h=-1,l=a.length,p=!0;b[0]<l&&p;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.m.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.G=0;b[0]+1<l&&"+"==a.charAt(b[0]+1)&&(b[0]++,this.L=!0);for(;b[0]+1<l&&"0"==a.charAt(b[0]+1);)b[0]++,this.G++;if(1>e+f||1>this.G)throw Error('Malformed exponential pattern "'+a+'"');p=!1;break;default:b[0]--,p=!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.w=e+f-d,0>this.w&&(this.w=0));this.h=(0<=d?d:g)-e;this.K&&(this.C=e+this.h,0==this.j&&0==this.h&&(this.h=1));this.m.push(Math.max(0,h));this.H=0==d||d==g;c=b[0]-c;this.F=Mt(this,a,b);b[0]<a.length&&";"==a.charAt(b[0])?(b[0]++,1!=this.g&&(this.o=!0),this.l=Mt(this,a,b),b[0]+=c,this.D=Mt(this,a,b)):(this.l+=this.s,this.D+=this.F)};
Nt.prototype.parse=function(a,b){b=b||[0];a=a.replace(/ |\u202f/g,"\u00a0");var c=a.indexOf(this.s,b[0])==b[0],d=a.indexOf(this.l,b[0])==b[0];c&&d&&(this.s.length>this.l.length?d=!1:this.s.length<this.l.length&&(c=!1));c?b[0]+=this.s.length:d&&(b[0]+=this.l.length);if(a.indexOf(Lt.Ai,b[0])==b[0]){b[0]+=Lt.Ai.length;var e=Infinity}else{e=a;var f=!1,g=!1,h=!1,l=-1,p=1,r=Lt.rl,t=Lt.zi,A=Lt.ul;t=t.replace(/\u202f/g,"\u00a0");for(var z="";b[0]<e.length;b[0]++){var G=e.charAt(b[0]),N=Ot(G);if(0<=N&&9>=
N)z+=N,h=!0;else if(G==r.charAt(0)){if(f||g)break;z+=".";f=!0}else if(G==t.charAt(0)&&("\u00a0"!=t.charAt(0)||b[0]+1<e.length&&0<=Ot(e.charAt(b[0]+1)))){if(f||g)break}else if(G==A.charAt(0)){if(g)break;z+="E";g=!0;l=b[0]}else if("+"==G||"-"==G){if(h&&l!=b[0]-1)break;z+=G}else if(1==this.g&&G==Lt.Fl.charAt(0)){if(1!=p)break;p=100;if(h){b[0]++;break}}else if(1==this.g&&G==Lt.Gl.charAt(0)){if(1!=p)break;p=1E3;if(h){b[0]++;break}}else break}1!=this.g&&(p=this.g);e=parseFloat(z)/p}if(c){if(a.indexOf(this.F,
b[0])!=b[0])return NaN;b[0]+=this.F.length}else if(d){if(a.indexOf(this.D,b[0])!=b[0])return NaN;b[0]+=this.D.length}return d?-e:e};
Nt.prototype.format=function(a){if(isNaN(a))return Lt.Zp;var b=[];var c=Pt;a=Qt(a,-c.Cr);var d=0>a||0==a&&0>1/a;d?c.Dn?b.push(c.Dn):(b.push(c.prefix),b.push(this.l)):(b.push(c.prefix),b.push(this.s));if(isFinite(a))if(a=a*(d?-1:1)*this.g,this.K)if(0==a)Rt(this,a,this.h,b),St(this,0,b);else{var e=Math.floor(Math.log(a)/Math.log(10)+2E-15);a=Qt(a,-e);var f=this.h;1<this.C&&this.C>this.h?(f=e%this.C,0>f&&(f=this.C+f),a=Qt(a,f),e-=f,f=1):1>this.h?(e++,a=Qt(a,-1)):(e-=this.h-1,a=Qt(a,this.h-1));Rt(this,
a,f,b);St(this,e,b)}else Rt(this,a,this.h,b);else b.push(Lt.Ai);d?c.En?b.push(c.En):(b.push(c.Zo),b.push(this.D)):(b.push(c.Zo),b.push(this.F));return b.join("")};
var Rt=function(a,b,c,d){if(a.w>a.j)throw Error("Min value must be less than max value");d||(d=[]);var e=Qt(b,a.j);e=Math.round(e);if(isFinite(e)){b=Math.floor(Qt(e,-a.j));var f=Math.floor(e-Qt(b,a.j))}else f=0;e=b;b=f;var g=e;f=b;var h=0<a.w||0<f||!1;e=a.w;h&&(e=a.w);var l="";for(b=g;1E20<b;)l="0"+l,b=Math.round(Qt(b,-1));l=b+l;var p=Lt.rl;b=Lt.Fi.charCodeAt(0);var r=l.length,t=0;if(0<g||0<c){for(g=r;g<c;g++)d.push(String.fromCharCode(b));if(2<=a.m.length)for(c=1;c<a.m.length;c++)t+=a.m[c];c=r-t;
if(0<c){g=a.m;t=r=0;for(var A,z=Lt.zi,G=l.length,N=0;N<G;N++)if(d.push(String.fromCharCode(b+1*Number(l.charAt(N)))),1<G-N)if(A=g[t],N<c){var Aa=c-N;(1===A||0<A&&1===Aa%A)&&d.push(z)}else t<g.length&&(N===c?t+=1:A===N-c-r+1&&(d.push(z),r+=A,t+=1))}else{c=l;l=a.m;g=Lt.zi;A=c.length;z=[];for(r=l.length-1;0<=r&&0<A;r--){t=l[r];for(G=0;G<t&&0<=A-G-1;G++)z.push(String.fromCharCode(b+1*Number(c.charAt(A-G-1))));A-=t;0<A&&z.push(g)}d.push.apply(d,z.reverse())}}else h||d.push(String.fromCharCode(b));(a.H||
h)&&d.push(p);h=String(f);f=h.split("e+");if(2==f.length){if(h=parseFloat(f[0])){p=h;if(isFinite(p)){for(c=0;1<=(p/=10);)c++;p=c}else p=0<p?p:0;p=0-p-1;h=-1>p?h&&isFinite(h)?Qt(Math.round(Qt(h,-1)),1):h:h&&isFinite(h)?Qt(Math.round(Qt(h,p)),-p):h}h=String(h);h=h.replace(".","");h+=se("0",parseInt(f[1],10)-h.length+1)}a.j+1>h.length&&(h="1"+se("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))))},St=function(a,b,c){c.push(Lt.ul);
0>b?(b=-b,c.push(Lt.Al)):a.L&&c.push(Lt.gq);b=""+b;for(var d=Lt.Fi,e=b.length;e<a.G;e++)c.push(d);c.push(b)},Ot=function(a){a=a.charCodeAt(0);if(48<=a&&58>a)return a-48;var b=Lt.Fi.charCodeAt(0);return b<=a&&a<b+10?a-b:-1},Mt=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+=Lt.sl):(g=Lt.sl,d+=g in Jt?Jt[g][1]:g);break;case "%":if(!a.o&&1!=a.g)throw Error("Too many percent/permill");if(a.o&&100!=a.g)throw Error("Inconsistent use of percent/permill characters");a.g=100;a.o=!1;d+=Lt.Fl;break;case "\u2030":if(!a.o&&1!=a.g)throw Error("Too many percent/permill");if(a.o&&1E3!=a.g)throw Error("Inconsistent use of percent/permill characters");a.g=1E3;a.o=!1;d+=Lt.Gl;break;default:d+=g}}return d},Pt={Cr:0,Dn:"",En:"",prefix:"",Zo:""},Qt=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 Tt=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"},Ut=Tt;Ut=Tt;var Vt=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"},Wt=Vt;Wt=Vt;var au=function(){this.l=Xt;this.h=this.g=this.m=null;var a=Lt,b=It;if(Yt!==a||Zt!==b)Yt=a,Zt=b,$t=new Nt;this.w=$t},Yt=null,Zt=null,$t=null,bu=/'([{}#].*?)'/g,cu=/''/g;au.prototype.format=function(a){if(this.l){this.m=[];var b=du(this,this.l);this.h=eu(this,b);this.l=null}if(this.h&&0!=this.h.length)for(this.g=cc(this.m),b=[],fu(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 fu=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,l=e,p=c[g];void 0===p?l.push("Undefined parameter - "+g):(h.g.push(p),l.push(h.j(h.g)));break;case 2:g=b[f].value;h=a;l=c;p=d;var r=e,t=g.uh;void 0===l[t]?r.push("Undefined parameter - "+t):(t=g[l[t]],void 0===t&&(t=g.other),fu(h,t,l,p,r));break;case 0:g=b[f].value;gu(a,g,c,Wt,d,e);break;case 1:g=b[f].value;gu(a,g,c,Ut,d,e);break;default:Eb("Unrecognized block type: "+
b[f].type)}},gu=function(a,b,c,d,e,f){var g=b.uh,h=b.am,l=+c[g];isNaN(l)?f.push("Undefined or invalid parameter - "+g):(h=l-h,g=b[c[g]],void 0===g&&(d=d(Math.abs(h)),g=b[d],void 0===g&&(g=b.other)),b=[],fu(a,g,c,e,b),c=b.join(""),e?f.push(c):(a=a.w.format(h),f.push(c.replace(/#/g,a))))},du=function(a,b){var c=a.m,d=w(a.j,a);b=b.replace(cu,function(){c.push("'");return d(c)});return b=b.replace(bu,function(e,f){c.push(f);return d(c)})},hu=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},iu=/^\s*(\w+)\s*,\s*plural\s*,(?:\s*offset:(\d+))?/,ju=/^\s*(\w+)\s*,\s*selectordinal\s*,/,ku=/^\s*(\w+)\s*,\s*select\s*,/,eu=function(a,b){var c=[];b=hu(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(iu.test(f)?0:ju.test(f)?1:ku.test(f)?2:/^\s*\w+\s*/.test(f)?3:5){case 2:e.type=2;e.value=lu(a,b[d].value);break;case 0:e.type=0;e.value=mu(a,b[d].value);break;case 1:e.type=1;e.value=nu(a,b[d].value);break;case 3:e.type=3;e.value=b[d].value;break;default:Eb("Unknown block type for pattern: "+b[d].value)}}else Eb("Unknown part of the pattern.");c.push(e)}return c},lu=function(a,b){var c="";b=b.replace(ku,function(h,l){c=l;return""});var d={};d.uh=c;b=hu(b);for(var e=
0;e<b.length;){var f=b[e].value;e++;var g;1==b[e].type?g=eu(a,b[e].value):Eb("Expected block type.");d[f.replace(/\s/g,"")]=g;e++}return d},mu=function(a,b){var c="",d=0;b=b.replace(iu,function(l,p,r){c=p;r&&(d=parseInt(r,10));return""});var e={};e.uh=c;e.am=d;b=hu(b);for(var f=0;f<b.length;){var g=b[f].value;f++;var h;1==b[f].type?h=eu(a,b[f].value):Eb("Expected block type.");e[g.replace(/\s*(?:=)?(\w+)\s*/,"$1")]=h;f++}return e},nu=function(a,b){var c="";b=b.replace(ju,function(h,l){c=l;return""});
var d={};d.uh=c;d.am=0;b=hu(b);for(var e=0;e<b.length;){var f=b[e].value;e++;if(1==b[e].type)var g=eu(a,b[e].value);else Eb("Expected block type.");d[f.replace(/\s*(?:=)?(\w+)\s*/,"$1")]=g;e++}return d};au.prototype.j=function(a){return"\ufddf_"+(a.length-1).toString(10)+"_"};var ou=chrome.i18n.getMessage("1522140683318860351"),pu=chrome.i18n.getMessage("4246483347873264186"),qu=chrome.i18n.getMessage("5991427458288444010"),xi=chrome.i18n.getMessage("6063910461797960050"),ru=chrome.i18n.getMessage("7735695102441495789"),su=chrome.i18n.getMessage("4575332923598659024"),Xt=chrome.i18n.getMessage("2297080986956220930"),tu=new au;var uu=function(a){this.g=a;this.u=ab("mr.cloud.mesi.MesiService")},qs=function(a){var b=Zr(Pr.g,["hangouts","search"]);B(a.u,"Retrieving Hangouts from MESI: "+b);return $r(a.g,b,"POST",vu).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 l=tu.format({ORGANIZER:"",PARTICIPANTS:0});if((e=e.participant)&&0<e.length){var p=e[0].display_name;
l=e.reduce(function(r,t){r.add(t.user_id);"ORGANIZER"==t.role&&(p=t.display_name);return r},new Set);l=tu.format({ORGANIZER:p,PARTICIPANTS:l.size})}return g&&h?new Rr(!1,g+"@"+h,h,g,l,f.hangout_id):new Rr(!1,f.hangout_id,h,g,l,f.hangout_id)}));return d})},vu={request_header:{client_version:{client_id:"39"}},search_sources:["0"]};var wu=function(a,b){this.h=a;this.g=b},zu=function(a,b,c,d){switch(b.type){case "REFRESH_AUTH":var e=d.Bd,f=d.deviceId,g=d.Xg;return Ft(a.h).then(function(){xu(a.g,new Jj("AUTH_READY",{Bd:e,gb:f,Xg:g}),c.id)});case "STATUS_REQUEST":return xu(a.g,b,c.id),Promise.resolve();case "STATUS_RESPONSE":return xu(a.g,b,c.id,!0),b.data.routeDescription||xu(a.g,b,c.id),Promise.resolve();case "HANGOUT_INACTIVE":return yu(a.g,c,4,Ai(new wi(ru,"warning"),c.sinkId));case "HANGOUT_INVALID":return yu(a.g,c,3,Ai(new wi(su,
"warning"),c.sinkId));default:return Promise.reject(Error("Unknown type: "+b.type))}};var Au=function(a){var b=a.method,c=a.uri,d=a.Dc,e=a.Ic,f=a.no,g=a.headers,h=a.body,l=a.start,p=a.apiKey,r=a.Xe;a=a.lb;this.method=b&&b.toUpperCase()||"GET";(b=c)||(d=[d].concat(q(e||[])).join("/"),d=new Xq(encodeURI(d)),f&&(f=nr(f),$q(d,f)),b=d);this.uri=b;p&&this.uri.h.add("key",p);this.g=a||null;this.headers=g||{};(this.body=h)&&(this.headers["Content-Type"]="application/json");this.Xe=void 0!==r?r:1E4;this.start=l||Xa()},Bu=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 Cu={Bz:100,rI:101,OK:200,Cz:201,ACCEPTED:202,fE:203,sE:204,fG:205,QE:206,QD:207,PD:300,MD:301,BA:302,qH:303,pE:304,RJ:305,BI:307,cF:308,vp:400,xJ:401,fq:402,AA:403,NOT_FOUND:404,BD:405,iE:406,rF:407,dG:408,oz:409,cB:410,CC:411,kF:412,aG:413,eG:414,FJ:415,cG:416,cA:417,DJ:422,KC:423,eA:424,lF:428,gJ:429,bG:431,Tp:500,mE:501,tx:502,CH:503,PA:504,HB:505,XB:507,XD:511,AF:1223};var Du=function(a,b){Bb.call(this,b&&b.message||a.statusText);this.code=a.status;this.response=a;this.status=(this.g=b)&&b.status};u(Du,Bb);var Hu=function(a){if(Eu.has(a.code))return!0;var b=a.g||{};return a.g?Fu.has(b.status)?!0:!!(b.errors||[]).find(function(c){return Gu.has(c)}):!1},Iu=function(a,b){a=new Response(void 0,{status:b||408,statusText:a});return new Du(a)},Eu=new Set([400,401,403,404,405,406,501]),Fu=new Set(["PERMISSION_DENIED"]),Gu=new Set("authError command_is_in_terminal_state forbidden notFound unmanaged_group_acl acl_entry_bad_scope network_error".split(" "));var Ju=function(a){this.id=a};Ju.prototype.toString=function(){return this.id};var U=function(a,b){this.type=a instanceof Ju?String(a):a;this.h=this.target=b;this.defaultPrevented=!1};U.prototype.l=function(){this.defaultPrevented=!0};var Ku=!He||9<=Number(df),Lu=He&&!af("9"),Mu=function(){if(!Ea.addEventListener||!Object.defineProperty)return!1;var a=!1,b=Object.defineProperty({},"passive",{get:function(){a=!0}});try{Ea.addEventListener("test",Ka,b),Ea.removeEventListener("test",Ka,b)}catch(c){}return a}();var Nu=function(a,b){U.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.keyCode=0;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)};y(Nu,U);var Ou=Ff({2:"touch",3:"pen",4:"mouse"});
Nu.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)?Je&&(Ce(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.keyCode=a.keyCode||0;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:Ou[a.pointerType]||"";this.state=a.state;this.g=a;a.defaultPrevented&&this.l()};
Nu.prototype.l=function(){Nu.Ab.l.call(this);var a=this.g;if(a.preventDefault)a.preventDefault();else if(a.returnValue=!1,Lu)try{if(a.ctrlKey||112<=a.keyCode&&123>=a.keyCode)a.keyCode=-1}catch(b){}};var Pu="closure_listenable_"+(1E6*Math.random()|0),Qu=function(a){return!(!a||!a[Pu])},Ru=0;var Su=function(a,b,c,d,e){this.listener=a;this.proxy=null;this.src=b;this.type=c;this.capture=!!d;this.Wc=e;this.key=++Ru;this.removed=this.wh=!1},Tu=function(a){a.removed=!0;a.listener=null;a.proxy=null;a.src=null;a.Wc=null};var Uu=function(a){this.src=a;this.g={};this.h=0};Uu.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=Vu(a,b,d,e);-1<g?(b=a[g],c||(b.wh=!1)):(b=new Su(b,this.src,f,!!d,e),b.wh=c,a.push(b));return b};Uu.prototype.remove=function(a,b,c,d){a=a.toString();if(!(a in this.g))return!1;var e=this.g[a];b=Vu(e,b,c,d);return-1<b?(Tu(e[b]),Yb(e,b),0==e.length&&(delete this.g[a],this.h--),!0):!1};
var Wu=function(a,b){var c=b.type;if(!(c in a.g))return!1;var d=Zb(a.g[c],b);d&&(Tu(b),0==a.g[c].length&&(delete a.g[c],a.h--));return d};Uu.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,Tu(d[e]);delete this.g[c];this.h--}return b};var Xu=function(a,b,c,d,e){a=a.g[b.toString()];b=-1;a&&(b=Vu(a,c,d,e));return-1<b?a[b]:null};
Uu.prototype.hasListener=function(a,b){var c=void 0!==a,d=c?a.toString():"",e=void 0!==b;return zc(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 Vu=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.Wc==d)return e}return-1};var Yu="closure_lm_"+(1E6*Math.random()|0),Zu={},$u=0,bv=function(a,b,c,d,e){if(d&&d.once)return av(a,b,c,d,e);if(Array.isArray(b)){for(var f=0;f<b.length;f++)bv(a,b[f],c,d,e);return null}c=cv(c);return Qu(a)?a.listen(b,c,Pa(d)?!!d.capture:!!d,e):dv(a,b,c,!1,d,e)},dv=function(a,b,c,d,e,f){if(!b)throw Error("Invalid event type");var g=Pa(e)?!!e.capture:!!e,h=ev(a);h||(a[Yu]=h=new Uu(a));c=h.add(b,c,d,g,f);if(c.proxy)return c;d=fv();c.proxy=d;d.src=a;d.listener=c;if(a.addEventListener)Mu||(e=g),void 0===
e&&(e=!1),a.addEventListener(b.toString(),d,e);else if(a.attachEvent)a.attachEvent(gv(b.toString()),d);else if(a.addListener&&a.removeListener)a.addListener(d);else throw Error("addEventListener and attachEvent are unavailable.");$u++;return c},fv=function(){var a=hv,b=Ku?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},av=function(a,b,c,d,e){if(Array.isArray(b)){for(var f=0;f<b.length;f++)av(a,b[f],c,d,e);return null}c=cv(c);return Qu(a)?
iv(a,b,c,Pa(d)?!!d.capture:!!d,e):dv(a,b,c,!0,d,e)},jv=function(a,b,c,d,e){if(Array.isArray(b))for(var f=0;f<b.length;f++)jv(a,b[f],c,d,e);else d=Pa(d)?!!d.capture:!!d,c=cv(c),Qu(a)?a.K.remove(String(b),c,d,e):a&&(a=ev(a))&&(b=Xu(a,b,c,d,e))&&kv(b)},kv=function(a){if("number"===typeof a||!a||a.removed)return!1;var b=a.src;if(Qu(b))return Wu(b.K,a);var c=a.type,d=a.proxy;b.removeEventListener?b.removeEventListener(c,d,a.capture):b.detachEvent?b.detachEvent(gv(c),d):b.addListener&&b.removeListener&&
b.removeListener(d);$u--;(c=ev(b))?(Wu(c,a),0==c.h&&(c.src=null,b[Yu]=null)):Tu(a);return!0},lv=function(a){if(a)if(Qu(a))a.Fk(void 0);else if(a=ev(a)){var b=0,c;for(c in a.g)for(var d=a.g[c].concat(),e=0;e<d.length;++e)kv(d[e])&&++b}},gv=function(a){return a in Zu?Zu[a]:Zu[a]="on"+a},nv=function(a,b,c,d){var e=!0;if(a=ev(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=mv(f,d),e=e&&!1!==f)}return e},mv=function(a,b){var c=a.listener,d=a.Wc||
a.src;a.wh&&kv(a);return c.call(d,b)},hv=function(a,b){if(a.removed)return!0;if(!Ku){var c=b||Ja("window.event");b=new Nu(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=nv(c[e],a,!0,b);d=d&&f}for(e=0;e<c.length;e++)b.h=c[e],f=nv(c[e],a,!1,b),d=d&&f}return d}return mv(a,new Nu(b,this))},
ev=function(a){a=a[Yu];return a instanceof Uu?a:null},ov="__closure_events_fn_"+(1E9*Math.random()>>>0),cv=function(a){if(Oa(a))return a;a[ov]||(a[ov]=function(b){return a.handleEvent(b)});return a[ov]};var pv=function(){T.call(this);this.K=new Uu(this);this.jh=this;this.D=null};y(pv,T);pv.prototype[Pu]=!0;k=pv.prototype;k.addEventListener=function(a,b,c,d){bv(this,a,b,c,d)};k.removeEventListener=function(a,b,c,d){jv(this,a,b,c,d)};
k.M=function(a){var b,c=this.D;if(c)for(b=[];c;c=c.D)b.push(c);c=this.jh;var d=a.type||a;if("string"===typeof a)a=new U(a,c);else if(a instanceof U)a.target=a.target||c;else{var e=a;a=new U(d,c);Mc(a,e)}e=!0;if(b)for(var f=b.length-1;0<=f;f--){var g=a.h=b[f];e=g.pf(d,!0,a)&&e}g=a.h=c;e=g.pf(d,!0,a)&&e;e=g.pf(d,!1,a)&&e;if(b)for(f=0;f<b.length;f++)g=a.h=b[f],e=g.pf(d,!1,a)&&e;return e};k.aa=function(){pv.Ab.aa.call(this);this.Fk();this.D=null};
k.listen=function(a,b,c,d){return this.K.add(String(a),b,!1,c,d)};var iv=function(a,b,c,d,e){return a.K.add(String(b),c,!0,d,e)};pv.prototype.Fk=function(a){this.K&&this.K.removeAll(a)};pv.prototype.pf=function(a,b,c){a=this.K.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.Wc||f.src;f.wh&&Wu(this.K,f);d=!1!==g.call(h,c)&&d}}return d&&!c.defaultPrevented};
pv.prototype.hasListener=function(a,b){return this.K.hasListener(void 0!==a?String(a):void 0,b)};var qv=function(a,b){pv.call(this);this.j=a||1;this.h=b||Ea;this.l=w(this.o,this);this.m=Xa()};y(qv,pv);qv.prototype.enabled=!1;qv.prototype.g=null;var rv=function(a,b){a.j=b;a.g&&a.enabled?(a.stop(),a.start()):a.g&&a.stop()};qv.prototype.o=function(){if(this.enabled){var a=Xa()-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.M("tick"),this.enabled&&(this.stop(),this.start()))}};
qv.prototype.start=function(){this.enabled=!0;this.g||(this.g=this.h.setTimeout(this.l,this.j),this.m=Xa())};qv.prototype.stop=function(){this.enabled=!1;this.g&&(this.h.clearTimeout(this.g),this.g=null)};qv.prototype.aa=function(){qv.Ab.aa.call(this);this.stop();delete this.h};
var sv=function(a,b,c){if(Oa(a))c&&(a=w(a,c));else if(a&&"function"==typeof a.handleEvent)a=w(a.handleEvent,a);else throw Error("Invalid listener argument");return 2147483647<Number(b)?-1:Ea.setTimeout(a,b||0)},tv=function(a){Ea.clearTimeout(a)},uv=function(a,b){var c=null;return ft(new Qs(function(d,e){c=sv(function(){d(b)},a);-1==c&&e(Error("Failed to schedule timer."))}),function(d){tv(c);throw d;})};var vv=function(){var a=void 0===a?!0:a;this.u=Wf("mr.cloud.slarti.Fetcher");this.g=0;this.h=a};vv.prototype.execute=function(a){var b=this,c="Fetch call "+ ++this.g,d=new mf(function(){return wv(b,c,a,function(e){return d.abort(e)})},1E3,this.h?5:1);return d.start()};
var wv=function(a,b,c,d){var e=c.uri.toString().replace(/\?.*/,"?<redacted>"),f=c.method+" "+e;D(a.u,b+": "+f);e=[Bu(c).then(function(g){return Promise.resolve(fetch(g))})];c.Xe&&e.push(uv(c.Xe).then(function(){throw Iu("API call timed out",504);}));return Promise.race(e).then(function(g){if(!g.ok)return g.json().then(function(l){return l},function(){return null}).then(function(l){var p;l&&l instanceof Object&&l.error&&(p=l.error);throw new Du(g,p);});var h=(Xa()-c.start)/1E3;D(a.u,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 Du)h=", ("+g.status+"): "+g.message,Hu(g)&&d(g);else{try{h=", "+JSON.stringify(g,null,2)}catch(l){}g instanceof Error&&"Failed to fetch"==g.message&&(g=Iu(g.message))}Yf(a.u,b+" failed: "+h);throw g;})};var xv=function(a,b){this.g=Nr.g;this.lb=a;this.h=b};var yv=new Map([["status","status"],["results","result"],["expirationTime","expiration_time"]]),zv=function(a,b){xv.call(this,a,b);this.u=Wf("mr.cloud.slarti.CommandsService")};u(zv,xv);zv.prototype.get=function(a){a=new Au({method:"GET",Dc:this.g,Ic:["commands",a],lb:this.lb});return this.h.execute(a).then(function(b){return b})};
zv.prototype.list=function(a){a=new Au({method:"GET",Dc:this.g,Ic:["commands"],no:{deviceId:a},lb:this.lb});return this.h.execute(a).then(function(b){return b.command||[]})};zv.prototype.send=function(a,b){var c=this;a=new Au({method:"POST",Dc:this.g,Ic:["commands:send"],lb:this.lb,body:{command:b,deviceId:a}});return this.h.execute(a).then(function(d){c.u.log(Mf,"Sent Slarti command with ID "+d.id,void 0);return d})};
zv.prototype.update=function(a,b){for(var c=[],d={},e=n(yv.keys()),f=e.next();!f.done;f=e.next())f=f.value,b[f]&&(d[f]=b[f],c.push(yv.get(f)));d.id=a;a=new Au({method:"PUT",Dc:this.g,Ic:["commands",a],lb:this.lb,body:{command:d,updateMask:c}});return this.h.execute(a).then(function(g){return g})};var Av=Ea.JSON.parse;var Bv=function(){};Bv.prototype.g=null;var Dv=function(a){var b;(b=a.g)||(b={},Cv(a)&&(b[0]=!0,b[1]=!0),b=a.g=b);return b};var Ev,Fv=function(){};y(Fv,Bv);var Gv=function(a){return(a=Cv(a))?new ActiveXObject(a):new XMLHttpRequest},Cv=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};Ev=new Fv;var Hv=function(a){pv.call(this);this.headers=new Hm;this.W=a||null;this.h=!1;this.R=this.g=null;this.oa=this.H="";this.m=0;this.j="";this.l=this.ka=this.G=this.Z=!1;this.o=0;this.C=null;this.s="";this.L=this.F=!1};y(Hv,pv);Hv.prototype.u=Wf("goog.net.XhrIo");var Iv=/^https?$/i,Jv=["POST","PUT"],Kv=[],Lv=function(a,b,c,d,e,f,g){var h=new Hv;Kv.push(h);b&&h.listen("complete",b);iv(h,"ready",h.ta);f&&(h.o=Math.max(0,f));g&&(h.F=g);h.send(a,c,d,e);return h};
Hv.prototype.ta=function(){this.dispose();Zb(Kv,this)};
Hv.prototype.send=function(a,b,c,d){if(this.g)throw Error("[goog.net.XhrIo] Object is active with another request="+this.H+"; newUri="+a);b=b?b.toUpperCase():"GET";this.H=a;this.j="";this.m=0;this.oa=b;this.Z=!1;this.h=!0;this.g=this.W?Gv(this.W):Gv(Ev);this.R=this.W?Dv(this.W):Dv(Ev);this.g.onreadystatechange=w(this.ra,this);try{Zf(this.u,Mv(this,"Opening Xhr")),this.ka=!0,this.g.open(b,String(a),!0),this.ka=!1}catch(f){Zf(this.u,Mv(this,"Error opening Xhr: "+f.message));Nv(this,f);return}a=c||"";
var e=this.headers.clone();d&&An(d,function(f,g){e.set(g,f)});d=Rb(e.Lb(),Ov);c=Ea.FormData&&a instanceof Ea.FormData;!Tb(Jv,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.s&&(this.g.responseType=this.s);"withCredentials"in this.g&&this.g.withCredentials!==this.F&&(this.g.withCredentials=this.F);try{Pv(this),0<this.o&&(this.L=Qv(this.g),Zf(this.u,Mv(this,"Will abort after "+this.o+"ms if incomplete, xhr2 "+
this.L)),this.L?(this.g.timeout=this.o,this.g.ontimeout=w(this.ah,this)):this.C=sv(this.ah,this.o,this)),Zf(this.u,Mv(this,"Sending request")),this.G=!0,this.g.send(a),this.G=!1}catch(f){Zf(this.u,Mv(this,"Send error: "+f.message)),Nv(this,f)}};var Qv=function(a){return He&&af(9)&&"number"===typeof a.timeout&&void 0!==a.ontimeout},Ov=function(a){return hd("Content-Type",a)};
Hv.prototype.ah=function(){"undefined"!=typeof Da&&this.g&&(this.j="Timed out after "+this.o+"ms, aborting",this.m=8,Zf(this.u,Mv(this,this.j)),this.M("timeout"),this.abort(8))};var Nv=function(a,b){a.h=!1;a.g&&(a.l=!0,a.g.abort(),a.l=!1);a.j=b;a.m=5;Rv(a);Sv(a)},Rv=function(a){a.Z||(a.Z=!0,a.M("complete"),a.M("error"))};Hv.prototype.abort=function(a){this.g&&this.h&&(Zf(this.u,Mv(this,"Aborting")),this.h=!1,this.l=!0,this.g.abort(),this.l=!1,this.m=a||7,this.M("complete"),this.M("abort"),Sv(this))};
Hv.prototype.aa=function(){this.g&&(this.h&&(this.h=!1,this.l=!0,this.g.abort(),this.l=!1),Sv(this,!0));Hv.Ab.aa.call(this)};Hv.prototype.ra=function(){this.w()||(this.ka||this.G||this.l?Tv(this):this.sa())};Hv.prototype.sa=function(){Tv(this)};
var Tv=function(a){if(a.h&&"undefined"!=typeof Da)if(a.R[1]&&4==Uv(a)&&2==a.Ia())Zf(a.u,Mv(a,"Local request error detected and ignored"));else if(a.G&&4==Uv(a))sv(a.ra,0,a);else if(a.M("readystatechange"),4==Uv(a)){Zf(a.u,Mv(a,"Request complete"));a.h=!1;try{Vv(a)?(a.M("complete"),a.M("success")):(a.m=6,a.j=Wv(a)+" ["+a.Ia()+"]",Rv(a))}finally{Sv(a)}}},Sv=function(a,b){if(a.g){Pv(a);var c=a.g,d=a.R[0]?Ka:null;a.g=null;a.R=null;b||a.M("ready");try{c.onreadystatechange=d}catch(e){Yf(a.u,"Problem encountered resetting onreadystatechange: "+
e.message)}}},Pv=function(a){a.g&&a.L&&(a.g.ontimeout=null);a.C&&(tv(a.C),a.C=null)},Vv=function(a){var b=a.Ia();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.H).match(Nq)[1]||null,!a&&Ea.self&&Ea.self.location&&(a=Ea.self.location.protocol,a=a.substr(0,a.length-1)),b=!Iv.test(a?a.toLowerCase():"");c=b}return c},Uv=function(a){return a.g?a.g.readyState:0};
Hv.prototype.Ia=function(){try{return 2<Uv(this)?this.g.status:-1}catch(a){return-1}};
var Wv=function(a){try{return 2<Uv(a)?a.g.statusText:""}catch(b){return Zf(a.u,"Can not get status: "+b.message),""}},Xv=function(a){try{return a.g?a.g.responseText:""}catch(b){return Zf(a.u,"Can not get responseText: "+b.message),""}},Yv=function(a){if(a.g)return Av(a.g.responseText)},Zv=function(a){try{if(!a.g)return null;if("response"in a.g)return a.g.response;switch(a.s){case "":case "text":return a.g.responseText;case "arraybuffer":if("mozResponseArrayBuffer"in a.g)return a.g.mozResponseArrayBuffer}Yf(a.u,
"Response type "+a.s+" is not supported on this browser");return null}catch(b){return Zf(a.u,"Can not get response: "+b.message),null}};Hv.prototype.getResponseHeader=function(a){if(this.g&&4==Uv(this))return a=this.g.getResponseHeader(a),null===a?void 0:a};
var $v=function(a){var b={};a=(a.g&&4==Uv(a)?a.g.getAllResponseHeaders()||"":"").split("\r\n");for(var c=0;c<a.length;c++)if(!id(a[c])){var d=xe(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 yc(b,function(g){return g.join(", ")})},Mv=function(a,b){return b+" ["+a.oa+" "+a.H+" "+a.Ia()+"]"};var aw=function(){this.u=ab("mr.cloud.CredentialService")},dw=function(a){var b=new Ab,c=Qr.g+"/iceconfig?key="+Qr.h;B(a.u,"Requesting TURN credentials from "+c);var d=Lv(c,function(){Vv(d)?(B(a.u,"Got TURN credentials: "+Xv(d)),b.resolve(bw(a,Yv(d)))):b.resolve(cw(a))},"POST",void 0,{"Content-Type":"application/json"});return b.g},bw=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.u.error("Error parsing TURN credentials.",d),[]}},cw=function(a){a.u.error("XHR failed fetching TURN credentials.",null);return[]};var ew=function(a,b,c){this.u=ab("mr.cloud.slarti.MessageHandler");this.j=a;this.l=b;this.g=c;this.h=new Map},fw=function(a){if(pj(a.mediaSource))return Promise.resolve({title:"screen"});var b=a.sb&&a.sb.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||""})})})},gw=function(a,b,c,d){var e=d.deviceId,f=b.data;return fw(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(l,p){a.h.set(h.id,{routeId:c.id,sinkId:d.id,resolve:l,reject:p,pt:"PENDING_APPROVAL"==h.status})})},function(){var h=a.g,l=c.id,p=new wi(ou,"warning");p.isBlocking=!0;yu(h,l,7,Ai(zi(p,c.id),d.id))})})},hw=function(a,b){return dw(a.l).then(function(c){xu(a.g,new Jj("TURN_CREDENTIALS",{credentials:c}),
b.id)})};var iw=function(a,b,c){this.h=a;this.j=b;this.g=c},jw=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(yu(a.g,d,1,null));return;case "SESSION_START_SUCCESS":Kr(0);break;case "SESSION_END":break;case "SESSION_FAILURE":Kr(1);f(yu(a.g,d,2,Ai(new wi(ou,"warning"),d?d.sinkId:"")));return;case "__webrtc_stats__":break;case "PRESENTATION_CONNECTION_MESSAGE":xu(a.g,
c.data,d.id,!0);break;case "OFFER":switch(b){case "slarti":f(gw(a.h,c,d,e));return;default:throw Error("Unexpected channel type: "+b);}case "GET_TURN_CREDENTIALS":switch(b){case "slarti":f(hw(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(zu(a.j,c,d,e));return;case "new_session":xu(a.g,c,d.id,!0);break;case "remove_session":xu(a.g,c,
d.id,!0);a.g.terminateRoute(d.id);break;default:throw Error("Unknown type: "+c.type);}f()})};var kw=function(){var a=this;this.u=ab("mr.cloud.settings.SettingsService");this.g=null;chrome.settingsPrivate.onPrefsChanged.addListener(function(b){lj(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){zb(5);a.g.call(null,c.value);break}}})},lw=function(a,b){a.g=b},mw=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)})})},
ow=function(a){return nw().catch(function(){return nw().catch(function(b){a.u.J("Error retrieving cloud enabled setting.",b);return!1})})},nw=function(){return pw().then(function(a){return!!a.value})},pw=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)})})},qw=function(a){var b=a.u;chrome.storage.sync.set({"mr.cloud.notifiedHangouts":!0},function(){chrome.runtime.lastError&&
b.J("Error setting notified Hangout privacy.",chrome.runtime.lastError)})},sw=function(a){return rw().catch(function(){return rw().catch(function(b){a.u.J("Error retrieving hangouts notified setting.",b);return!1})})},rw=function(){return mw().then(function(a){return!!a["mr.cloud.notifiedHangouts"]})};var tw=new Map([["displayName","display_name"],["description","description"],["type","type"],["status","status"],["state","state"],["commandDefs","command_defs"]]),uw=function(a,b){xv.call(this,a,b)};u(uw,xv);k=uw.prototype;k.act=function(a,b){a=new Au({method:"POST",Dc:this.g,Ic:["devices:act"],lb:this.lb,body:{gcmId:b,id:a}});return this.h.execute(a).then(function(c){return c})};k.create=function(a){a=new Au({method:"POST",Dc:this.g,Ic:["devices"],lb:this.lb,body:a});return this.h.execute(a).then(function(b){return b})};
k.delete=function(a){a=new Au({method:"DELETE",Dc:this.g,Ic:["devices",a],lb:this.lb});return this.h.execute(a)};k.get=function(a){a=new Au({method:"GET",Dc:this.g,Ic:["devices",a],lb:this.lb});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 Au({method:"GET",Dc:this.g,Ic:["devices"],no:d,lb:this.lb});return this.h.execute(b).then(function(e){return e.device||[]})};
k.update=function(a,b){for(var c=[],d={},e=n(tw.keys()),f=e.next();!f.done;f=e.next())f=f.value,b[f]&&(d[f]=b[f],c.push(tw.get(f)));d.id=a;a=new Au({method:"PUT",Dc:this.g,Ic:["devices",a],lb:this.lb,body:{device:d,updateMask:c}});return this.h.execute(a).then(function(g){return g})};var vw=function(a,b){xv.call(this,a,b)};u(vw,xv);vw.prototype.register=function(a){a=new Au({method:"POST",Dc:this.g,Ic:["user:register"],lb:this.lb,body:{gcmId:a}});return this.h.execute(a)};vw.prototype.unregister=function(a){a=new Au({method:"POST",Dc:this.g,Ic:["user:unregister"],lb:this.lb,body:{gcmId:a}});return this.h.execute(a)};var ww=function(a){var b=window.localStorage;this.u=ab("mr.cloud.slarti.GcmRegistration");this.j=a;this.h=b;this.g=null},yw=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)hb(a.u,"Slarti GCM ID unchanged: "+e),c();else{hb(a.u,"Got new Slarti GCM ID: "+e);var f=b?xw(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.u.J("Error registering for GCM notifications: "+f),b&&xw(a,b),d(Error(f))})})}return a.g},xw=function(a,b){return a.j.unregister(b).then(function(){delete a.h["mr.cloud.slarti.GcmRegistration.ID"]},function(c){a.u.J("Failed to unregister GCM ID with Slarti",c)})};var zw=null,Aw=function(){Cp.call(this,5,"mr.cloud.slarti.GcmEventListener","mr.cloud.slarti.SinkDiscoveryService",chrome.gcm.onMessage);this.u=ab("mr.cloud.slarti.GcmEventListener")};u(Aw,Cp);Aw.prototype.ui=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 B(this.u,"Received Slarti GCM notification: "+a+" ("+b+")"),!0}return!1};var Bw=function(){null==zw&&(zw=new Aw);return zw};var Cw=function(a,b,c,d,e,f){f=void 0===f?null:f;this.u=ab("mr.cloud.slarti.SinkDiscoveryService");this.s=a;this.m=b;this.l=c;this.o=d;this.w=e;this.g=f||new ds(this.D.bind(this),c,36E5);Bw().addListener();dm(this);ij("mr.cloud.slarti.SinkDiscoveryService",this)};u(Cw,Zi);Cw.prototype.j=function(){yw(this.w).catch(function(){});return this.g.j().filter(function(a){return a.isAvailable})};Cw.prototype.h=function(a){return this.g.h(a)};
Cw.prototype.handleEvent=function(a,b){if(a!=chrome.gcm.onMessage)throw Error("Unhandled event: expected chrome.gcm.onMessage");Dw(this,b)};
var Dw=function(a,b){var c=JSON.parse(b.data.data);B(a.u,"Received Slarti GCM notification: "+c.type);hb(a.u,function(){return"Got notification: "+JSON.stringify(c)});switch(c.type){case "DEVICE_ADDED":Ew(a,c).then(function(d){"cast-receiver"==d.type&&(d=new cs(d.id,d.displayName,"ONLINE"==d.status),a.g.g.set(d.id,d),hs(a.l,[d.Gb]))});break;case "DEVICE_CHANGED":Ew(a,c).then(function(d){if("cast-receiver"==d.type){var e=wm(vm(),d.id);if(e=a.g.h(e))e.displayName=d.displayName,e.isAvailable="ONLINE"==
d.status,is(a.l,[e.Gb])}});break;case "DEVICE_REMOVED":Fw(a,Gw(c));Promise.resolve();break;case "COMMAND_CHANGED":Hw(a,c).then(function(d){var e=a.o,f=d.id,g=e.h.get(f);if(g){var h=g.routeId,l=g.sinkId,p=g.resolve,r=g.reject,t=g.pt;g=!0;try{var A=JSON.parse(d.results||"{}"),z=A.sessionDescription,G=A.errorCode,N=A.errorText;switch(d.status){case "SUCCESS":p(xu(e.g,new Jj("ANSWER",z),h));t&&Jr(0);break;case "ERROR":case "TIMEOUT":var Aa="TIMEOUT"==d.status;p=ou;"KNOCK_DENIED"==G&&(Jr(Aa?2:1),p=Aa?
qu:pu);var Mb=e.g,Nb=new wi(p,"warning");Nb.isBlocking=!0;yu(Mb,h,7,Ai(zi(Nb,h),l));throw Error("Slarti command "+f+" failed with status: "+(d.status+", errorCode: "+G+", errorText: ")+N);default:g=!1}}catch(Mj){r(Mj)}finally{g&&e.h.delete(f)}}else e.u.J("Received update to unknown command with name = "+(d.name+" and id = "+f))});break;default:Promise.resolve()}};
Cw.prototype.D=function(){return this.m.list({type:"cast-receiver"}).then(function(a){return a.map(function(b){return new cs(b.id,b.displayName,"ONLINE"==b.status)})})};Cw.prototype.Ta=function(){return"SlartiSinkDiscoveryService"};Cw.prototype.Fb=function(){return[{cache:ls(this.g)}]};Cw.prototype.Db=function(){var a=am(this);a&&ms(this.g,a.cache)};
var Fw=function(a,b){b=wm(vm(),b);var c=a.g.h(b);c&&(a.g.g.delete(b),js(a.l,[c.Gb]))},Gw=function(a){a=a.deviceInfo;return a.device?a.device.id:a.deviceId},Ew=function(a,b){b=b.deviceInfo;return b.device?Promise.resolve(b.device):a.m.get(b.deviceId)},Hw=function(a,b){b=b.commandInfo;return b.command?Promise.resolve(b.command):a.s.get(b.commandId)};var Iw=function(){this.g=null},Jw=function(a,b){if(!a.g||L(a.g,2)<L(b,2))a.g=Cl(b)},Kw=function(a){return a.g?L(a.g,2)+";"+L(a.g,1):null};var Lw=function(){this.m=this.G=this.C=this.D=this.s=this.j=this.h=this.l=this.L=this.F=this.R=this.W=this.H=this.K=this.w=this.o=this.g=null},Mw=function(){var a=Lw.Kb();null==a.m&&(a.m=new Iw);return a.m},Nw=function(a){null==a.g&&(a.g=new Dt);return a.g},Ow=function(a){null==a.o&&(a.o=new vt(Nw(a)));return a.o},Pw=function(a){null==a.w&&(a.w=new vv);return a.w},Qw=function(a){null==a.K&&(a.K=new zv(Nw(a),Pw(a)));return a.K},Rw=function(a,b){if(null==a.F){var c=Qw(a);null==a.G&&(a.G=new aw(Ow(a)));
a.F=new ew(c,a.G,b)}return a.F};La(Lw);var Vw=function(a,b){this.j=a;this.w=b;this.m=new Ab;this.ga=this.m.g;this.g=Sw(a.id);this.h=new Ab;this.l=!1;Tw(this);Uw(this);this.g.sendMessage(new Jj("GET_TURN_CREDENTIALS"))};Vw.prototype.start=function(){var a=this;return this.ga.then(function(b){if(b.g)return Promise.reject(Error("Presentation already started"));b.start();return a.h.g})};Vw.prototype.stop=function(){var a=this;this.l=!1;return this.ga.then(function(b){b.stop();a.ga=Promise.reject(Error("Peer connection has already been stopped"))})};
var Tw=function(a){a.g.onMessage=function(b){if(b.type)switch(b.type){case "TURN_CREDENTIALS":a.m.resolve(new Pj(a.j.id,b.data.credentials));break;case "ANSWER":a.ga.then(function(c){Xj(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.ga.then(function(c){var d={type:"PRESENTATION_CONNECTION_MESSAGE",data:b};"string"==typeof d?c.l.send(d):c.l.send(JSON.stringify(d))})}},Uw=function(a){a.ga.then(function(b){Tj(b,
function(c){a.g.sendMessage(new Jj("OFFER",new Lj(c,null,null,a.w,a.j.id)))});Uj(b,function(c){c=Kj(c);"STOP"==c.type&&a.stop();a.g.sendMessage(c)});Qj(b,function(){a.l=!0;a.g.sendMessage(new Jj("SESSION_START_SUCCESS"));a.h.resolve(a.j)});Sj(b,function(){a.g.sendMessage(new Jj("SESSION_END"))});Rj(b,function(c){a.l||a.h.reject(c);a.g.sendMessage(new Jj("SESSION_FAILURE"))})})};var Ww=function(a){this.g=a;this.h=new Map;this.F=new Map;this.G=new Map;this.D=[];this.s=this.K=this.o=this.l=null;this.m=this.j=!1;this.C=new Map;this.w=new Map;dm(this)};Ww.prototype.getName=function(){return"cloud"};
Ww.prototype.Cn=function(){var a=this;B(this.u,"Initializing Cloud MRP");var b=Lw.Kb();if(Date.now()<Xw){if(null==b.R){var c=Qw(b);null==b.H&&(b.H=new uw(Nw(b),Pw(b)));var d=b.H,e=Rw(b,this);null==b.L&&(null==b.W&&(b.W=new vw(Nw(b),Pw(b))),b.L=new ww(b.W));b.R=new Cw(c,d,this,e,b.L)}this.D.push(b.R);Rw(b,this)}null==b.j&&(null==b.h&&(b.h=new Tr(Ow(b),Nw(b))),c=b.h,null==b.l&&(b.l=new uu(Ow(b))),b.j=new ps(c,b.l,this));this.l=b.j;this.D.push(this.l);this.o=Nw(b);null==b.D&&(c=Rw(b,this),null==b.s&&
(b.s=new wu(Nw(b),this)),b.D=new iw(c,b.s,this));this.K=b.D;null==b.C&&(b.C=new kw);this.s=b.C;ow(this.s).then(function(f){a.j=f;B(a.u,"Cloud enabled setting: "+a.j)});lw(this.s,function(f){a.j=f;B(a.u,"Cloud enabled setting: "+a.j);a.j&&Yw(a)});sw(this.s).then(function(f){a.m=f;B(a.u,"Privacy notified setting: "+a.m)})};Ww.prototype.Nh=function(){return Array.from(this.h.values())};
Ww.prototype.Em=function(a){if(!Zw(this,a)||-1!=a.indexOf("0F5096E8"))return tq;hb(this.u,"GetAvailableSinks for "+a);var b=Yw(this);this.w.clear();for(var c={},d=n(this.C.values()),e=d.next();!e.done;c={ef:c.ef,gh:c.gh},e=d.next())c.ef=e.value,c.gh=!1,b.forEach(function(f){return function(g){g.id==f.ef.Gb.id&&(f.gh=!0,g.friendlyName=f.ef.Gb.friendlyName)}}(c)),c.gh||this.w.set(c.ef.id,c.ef.Gb);b=b.concat.apply(b,q(this.w.values()));hb(this.u,function(){return"Available sinks are..."+JSON.stringify(b)});
this.l&&(b=b.concat($w));return new sq(b,-1!=a.indexOf("0F5096E8")?nj:null)};var Yw=function(a){var b=[];B(a.u,"Checking cloud discovery services");a.D.forEach(function(c){c=c.j().map(function(d){return d.Gb});b.push.apply(b,q(c))});return b};k=Ww.prototype;k.startObservingMediaSinks=function(){};k.stopObservingMediaSinks=function(){};k.startObservingMediaRoutes=function(){};k.stopObservingMediaRoutes=function(){};k.Bn=function(a){return(a=ax(this,a))?a.Gb:null};
k.createRoute=function(a,b,c,d,e,f,g){var h=this;B(this.u,"createRoute called");hb(this.u,"urn: "+a+" sinkId:"+b);if(e=this.F.get(b))return Ci(bx(this.g,this,e,a,c,g,function(l){l.mediaSource=a;l.sb.tabId=g;return Ei(l)}),function(l){Hq(h.g);return l});e=ax(this,b);return cx(this,a,e,b,c,d,g)};
var dx=function(a,b,c,d,e){b instanceof rq&&2==b.errorCode?yu(a,c,6,null):(a.u.error("Error on start session",b instanceof Error?b:Error("Expected an Error value, got "+b)),a.h.has(c.id)&&yu(a,c,e,Ai(new wi(ou,"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&&js(a,[d.Gb])},cx=function(a,b,c,d,e,f,g){if(f)return Fi(Error("not supported"));f=!1;switch(c.g){case "slarti":Lr(1);break;case "mesi":f=!0;if(!a.m){a.m=!0;qw(a.s);var h=Ai(yi(),d);a.g.g.onIssue(h)}Lr(0)}vm().h=
new sm(c.model,null);var l=Jp(e,a.getName(),d,b,!0);a.h.set(l.id,l);a.F.set(d,l);a.C.set(l.id,c);a.G.set(l.id,c.g);yq(a.g,a,l);Mq(a.g,a.Ta(),!0);if(mj(b)&&!f)return B(a.u,"starting presentation on route: "+l.id),Di(ex(l,b),function(p){dx(a,p,l,c,7);throw p;});B(a.u,"starting mirroring on route: "+l.id);l.sb={tabId:g,sessionId:"",Zg:"",ee:c.model};mj(b)&&(l.isOffscreenPresentation=!0);return Di(Aq(a.g,a,l,e),function(p){dx(a,p,l,c,5);throw p;})};
Ww.prototype.terminateRoute=function(a){return yu(this,a,0,null)};
var yu=function(a,b,c,d){var e="string"==typeof b?a.h.get(b):b;if(!e)return Promise.reject(new rq(3,"Route in cloud provider not found for routeId "+b));B(a.u,"terminating route: "+e.id);a.h.delete(e.id);a.F.delete(e.sinkId);a.C.get(e.id);a.C.delete(e.id);if(d)a.g.g.onIssue(d);vb("MediaRouter.Cloud.Session.End",c,Hr);Gq(a.g,e);0==a.h.size&&Mq(a.g,a.Ta(),!1);a.g.onPresentationConnectionStateChanged(e.id,"terminated");a.w.has(e.sinkId)&&(b=a.w.get(e.sinkId),js(a,[b]),a.w.delete(e.sinkId));return Promise.resolve()};
k=Ww.prototype;k.sendRouteMessage=function(a,b){var c=this.G.get(a);if(c){var d=(a=this.h.get(a)||void 0)?ax(this,a.sinkId):void 0;return jw(this.K,c,b,a,d)}return"string"===typeof b?(xu(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.nj=function(a){var b=new Hj;5>b.minFrameRate&&(b.minFrameRate=5);var c=this.mj(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;Ij(b);Object.freeze(b);B(this.u,"Settings for "+a+": "+Gj(b));if(!b.shouldCaptureAudio&&!b.shouldCaptureVideo)throw Error("Cannot start mirroring without video or audio capture.");return b};
k.mj=function(a){var b=null;a=ax(this,a);switch(a.g){case "slarti":b="webrtc";break;case "mesi":b=a.Bd?"meetings":"hangouts"}return b};k.Ln=function(){};k.jm=function(a,b){hb(this.u,"Checking canRoute: "+a+" for sinkId: "+b);return Zw(this,a)&&!!this.Bn(b)};k.Ri=function(a,b){return mj(a)&&this.h.has(b)};k.joinRoute=function(a,b){return(a=this.h.get(b))?(B(this.u,"joining route: "+a.id),Ei(a)):Fi(Error("not supported"))};k.connectRouteByRouteId=function(){return Fi(Error("not supported"))};
k.detachRoute=function(){};
var hs=function(a,b){B(a.u,b.length+" sinks added");b=ax(a,b[0].id);vm().g=new sm(b.model,null);Zm(a.g);a.g.onSinkAvailabilityUpdated(a,2);B(a.u,"sinkAvailability changed to AVAILABLE")},js=function(a,b){B(a.u,b.length+" sinks removed");zb(2);a.D.some(function(c){return 0<c.j().length})||(a.g.onSinkAvailabilityUpdated(a,0),B(a.u,"sinkAvailability changed to UNAVAILABLE"));Zm(a.g)},is=function(a,b){B(a.u,b.length+" sinks updated");Zm(a.g)},xu=function(a,b,c,d){(void 0===d?0:d)?ao(a.g,c,b):jp(a.g.K,
new kp(c,b))},ax=function(a,b){var c=fx(a,b);c||(c=null,(b=a.F.get(b))&&(c=a.C.get(b.id)));return c},fx=function(a,b){var c=null;a.D.some(function(d){c=d.h(b);return!!c});return c},Zw=function(a,b){var c=oj(b)||pj(b);b=mj(b);if(a.o.j&&!a.o.g&&c)return a.g.onSinkAvailabilityUpdated(a,2),!0;var d=!1;a.j&&a.o.g&&(d=!0);var e;if(e=!chrome.declarativeWebRequest)a=a.o,e=!(a.j||a.g&&a.h&&(-1!=Gt.indexOf(a.h)||-1!=Gt.indexOf(Et(a))))&&b;return e?!1:d&&(c||b)};k=Ww.prototype;
k.searchSinks=function(a,b){var c=this;if(!Zw(this,a))return Promise.reject(Error("err"));a=ss(this.l,b);a.then(function(d){hs(c,[d])});return a};k.createMediaRouteController=function(){return Ya()};k.provideSinks=function(){};k.Ta=function(){return"CloudProvider"};k.Fb=function(){return[void 0,{cloudEnabled:this.j,notifiedHangoutsPrivacy:this.m}]};k.Db=function(){var a=bm(this);a&&(a.cloudEnabled&&(this.j=a.cloudEnabled),a.notifiedHangoutsPrivacy&&(this.m=a.notifiedHangoutsPrivacy))};
var ex=function(a,b){a=new Vw(a,b);return Gi(a.start())};Ww.prototype.u=ab("mr.CloudProvider");var $w=new Xl("pseudo:cloud","","meeting","","default"),Xw=Date.parse("15 Aug 2020 00:00:00 GMT");var gx=function(){Cp.call(this,12,"ExternalMessageListener","mr.ProviderManager",chrome.runtime.onMessageExternal)};u(gx,Cp);gx.prototype.ui=function(a,b){return b.origin&&b.origin.startsWith("chrome-extension://")&&hx.includes(b.origin.substring(19))?"start"==a.type||"stop"==a.type||"subscribe_log_data"==a.type:!1};gx.prototype.Vi=function(){return!0};var jx=function(){ix||(ix=new gx);return ix},ix=null,hx=["idmofbkcelhplfjnmmdolenpigiiiecc","ggedfkijiiammpnbdadhllnehapomdge","njjegkblellcjnakomndbaloifhcoccg"];var kx=function(){Cp.call(this,11,"InternalMessageListener","mr.ProviderManager",chrome.runtime.onMessage)};u(kx,Cp);kx.prototype.ui=function(a,b){return"retrieve_log_data"==a.type&&b.origin=="chrome-extension://"+chrome.runtime.id&&b.url==b.origin+"/feedback.html"};kx.prototype.Vi=function(){return!0};var mx=function(){lx||(lx=new kx);return lx},lx=null;function nx(a){var b=ox,c=[];a&&c.push(new uq(b));c.push(new Ww(b));return c};var px=function(a,b){this.routeId=a;this.message=b},qx=function(a){return"string"!=typeof a.message};var rx=function(a){this.C=a;this.l=this.m=null},sx=function(a){if(null==a.l)if(null==a.m||Date.now()-a.m>=a.C)a.w();else{var b=Math.max(a.m+a.C-Date.now(),5);a.l=setTimeout(a.w.bind(a),b)}};rx.prototype.w=function(){null!=this.l&&(clearTimeout(this.l),this.l=null);this.D();this.m=Date.now()};rx.prototype.D=function(){};var tx=function(a,b){rx.call(this,20);this.g=new Map;this.h=new Set;this.s=null;this.o=this.j=0;this.F=!1;this.K=a;this.G=b;this.u=ab("mr.RouteMessageSender")};u(tx,rx);tx.prototype.init=function(a){this.s=a;dm(this)};tx.prototype.stopListeningForRouteMessages=function(a){this.h.delete(a)};
tx.prototype.send=function(a,b){var c=this.g.get(a);c||(c=[],this.g.set(a,c));b=new px(a,b);c.push(b);50<c.length&&1==c.length%50&&this.u.J(function(){return"Message queue length is excessively large ("+(c.length+") for route "+a)});this.j+=qx(b)?0:b.message.length;qx(b)&&this.o++;ux(this);this.h.has(a)&&sx(this)};
var vx=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-=qx(c)?0:c.message.length,qx(c)&&a.o--}},ux=function(a){var b=0<a.o||a.j>a.G;b!=a.F&&(a.F=b,Mq(a.K,a.Ta(),b))};tx.prototype.D=function(){if(this.s){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.s(b,c),vx(this,c),this.g.set(b,[]))}ux(this)}else this.u.error("sendMessagesCallback not set. Messages not delivered.")};tx.prototype.Ta=function(){return"mr.RouteMessageSender"};
tx.prototype.Fb=function(){var a=[].concat(q(this.g.entries())).map(function(b){return[b[0],b[1].map(function(c){return c.message})]});return[new wx(a,Array.from(this.h),this.j)]};tx.prototype.Db=function(){var a=am(this);if(a){this.g=new Map;for(var b={},c=n(a.h),d=c.next();!d.done;b={hh:b.hh},d=c.next())d=d.value,b.hh=d[0],d=d[1].map(function(e){return function(f){return new px(e.hh,f)}}(b)),this.g.set(b.hh,d);this.h=new Set(a.g);this.j=a.j}};var wx=function(a,b,c){this.h=a;this.g=b;this.j=c};var kp=function(a,b){this.type="internal_message";this.routeId=a;this.message=b};var xx=function(){this.g=[]};xx.prototype.listen=function(a,b,c){this.g.push({type:a,Wc:b,target:c})};var yx=function(a,b,c){var d=a.g.findIndex(function(e){return"internal_message"==e.type&&e.Wc==b&&e.target==c});-1!=d&&a.g.splice(d,1)},jp=function(a,b){a.g.forEach(function(c){c.type==b.type&&Promise.resolve().then(function(){return c.Wc.call(c.target,b)})})};var zx=function(a,b,c){this.g=a;this.l=b;this.j=c;this.onMessage=function(){};c.listen("internal_message",this.h,this)};zx.prototype.sendMessage=function(a,b){return this.l(this.g,a,b)};zx.prototype.h=function(a){if(a.routeId==this.g)this.onMessage(a.message)};zx.prototype.dispose=function(){this.onMessage=function(){};yx(this.j,this.h,this)};
var Ax=new zx("",function(){return Promise.resolve()},new xx),Bx=function(a){this.g=a},Sw=function(a){var b=ui,c=b.g.h.get(a);return c?new zx(a,c.sendRouteMessage.bind(c),b.g.K):Ax};var Cx=function(a,b){this.w=null!=b?a.bind(b):a;this.m=this.o.bind(this);this.l=[];this.g=!1;this.h=null};Cx.prototype.j=function(a){for(var b=[],c=0;c<arguments.length;++c)b[c-0]=arguments[c];this.l=[].concat(q(b));null==this.h?Dx(this):this.g=!0};var Dx=function(a){a.h=setTimeout(a.m,500);a.w.apply(a,q(a.l))};Cx.prototype.o=function(){this.h=null;this.g&&(this.g=!1,Dx(this))};var Ex=function(){this.config=null;this.u=ab("mr.ProviderManager");this.j=[];this.h=new Map;this.o=new Map;this.m=new Set;this.l=new Set;this.C=new Map;this.g=this.D=null;this.K=new xx;this.R=new Cx(this.Bo,this);this.Z=new Cx(this.H,this);this.w=new tx(this,524288);this.G=0;this.s=new Map;this.F=[];var a=new Br(this);this.mb=a.onMessage.bind(a);a=new rr(this);this.W=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};u(Ex,Zi);
Ex.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.mb.apply(this,q(c));else if(a==chrome.runtime.onMessageExternal)this.W.apply(this,q(c));else throw Error("Unhandled event");};
var Er=function(a,b){b=a.C.get(b);return cj(b).then(function(c){var d=!!a.config&&a.config.use_mirroring_service;c.C||(c.j=a,c.C=!0,c.pg(d));return c})},Gx=function(a,b,c){b.forEach(function(d){if(Fx(a,d.getName()))a.u.J("Provider "+d.getName()+" already registered.");else try{d.Cn(c),a.j.push(d),a.s.set(d.getName(),0)}catch(e){a.u.J("Provider "+d.getName()+" failed to initialize.",e)}})},Hx=function(a,b,c){var d=ox;d.C.set("webrtc","mr.mirror.webrtc.WebRtcService");d.C.set("cast_streaming","mr.mirror.cast.Service");
d.C.set("hangouts","mr.mirror.hangouts.HangoutsService");d.C.set("meetings","mr.mirror.hangouts.MeetingsService");var e=new Bx(d);ui||(ui=e);d.g=a;d.w.init(d.g.onRouteMessagesReceived.bind(d.g));Gx(d,b,c);d.config=c;dm(d);ij("mr.ProviderManager",d)},Jx=function(a,b,c){return new Promise(function(d,e){var f=null;a.G++;Ix(a);f=window.setTimeout(function(){f=null;b.cancel(new rq(2,"timeout after "+c+" ms."))},c);b.g.then(function(g){a.G--;Ix(a);null!=f&&window.clearTimeout(f);d(g)},function(g){a.G--;
Ix(a);null!=f&&window.clearTimeout(f);e(g instanceof rq?g:g instanceof Error?new rq(0,g.message,g.stack):new rq(0))})})};Ex.prototype.onBeforeInvokeHandler=function(){lj(0)};var Kx=function(a){return"string"==typeof a?a:a.unique?"":a.scheme+"://"+a.host+"\n       "+(a.port?":"+a.port:"")+"/"};k=Ex.prototype;
k.createRoute=function(a,b,c,d,e,f,g){var h=this;g=void 0===g?!1:g;var l=Lx(this,a,b);if(!l)return Promise.reject(new rq(7,"No provider supports createRoute with source: "+a+" and sink: "+b));var p=void 0;void 0!==d&&(p=Kx(d));f=f&&0<f?f:6E4;a=l.createRoute(a,b,c,g,f,p,e);return Jx(this,a,f).then(function(r){return r},function(r){h.u.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 rq(7,"No provider supports join "+b));a=g.connectRouteByRouteId(a,b,c,Kx(d),e);return Jx(this,a,f&&0<f?f:3E4)};k.joinRoute=function(a,b,c,d,e,f){f=void 0===f?!1:f;var g=Mx(this,a,b);if(!g)return Promise.reject(new rq(7,"No provider supports join "+b));e=e&&0<e?e:3E4;a=g.joinRoute(a,b,f,e,Kx(c),d);return Jx(this,a,e)};
k.terminateRoute=function(a){var b=this.h.get(a);return b?Nx(this,a).then(function(){return b.terminateRoute(a)}):Promise.reject(new rq(3,"Route not found for routeId "+a))};k.startObservingMediaSinks=function(a){zb(1);this.m.has(a)||(this.m.add(a),this.j.forEach(function(b){b.startObservingMediaSinks(a)}));Ox(this,a)};k.stopObservingMediaSinks=function(a){this.m.delete(a)?Px(this,a):B(this.u,"No existing query "+a)};
var Px=function(a,b){a.j.forEach(function(c){c.stopObservingMediaSinks(b)})},Ox=function(a,b){if("urn:x-org.chromium.media:source:tab:-1"==b)a.u.J("No sinks for sourceUrn: "+b);else{var c=new Map,d=[];a.j.forEach(function(e){var f=e.Em(b);0<f.sinks.length&&(d=f.origins);f.sinks.forEach(function(g){c.has(g.id)?a.u.J("Detected duplicate sink "+g.id+" from provider: "+e.getName()):c.set(g.id,g)})});Qx(a,b,Array.from(c.values()),d||[])}},Qx=function(a,b,c,d){B(a.u,"Sending "+c.length+" sinks to MR for "+
b);a.g.onSinksReceived(b,c,d.map(Bo))};k=Ex.prototype;k.sendRouteMessage=function(a,b,c){var d=this.h.get(a);d?(a=d.sendRouteMessage(a,b,c),a=Jx(this,Gi(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=Jx(this,Gi(a),3E4)):a=Promise.reject(Error("Invalid route ID "+a));return a};
k.startListeningForRouteMessages=function(a){var b=this.w;b.h.has(a)||(b.h.add(a),(a=b.g.get(a))&&0<a.length&&sx(b))};k.stopListeningForRouteMessages=function(a){this.w.stopListeningForRouteMessages(a)};k.detachRoute=function(a){var b=this.h.get(a);b?b.detachRoute(a):B(this.u,"Route "+a+" does not exist.")};k.enableMdnsDiscovery=function(){};var Lx=function(a,b,c){return a.j.find(function(d){return d.jm(b,c)})||null},Mx=function(a,b,c){return a.j.find(function(d){return d.Ri(b,c)})||null};
Ex.prototype.H=function(){var a=this;this.m.forEach(function(b){Ox(a,b)})};var Ix=function(a){a.g.setKeepAlive(0<a.G||0<a.F.length)};k=Ex.prototype;k.startObservingMediaRoutes=function(a){this.l.has(a)||(this.l.add(a),this.j.forEach(function(b){b.startObservingMediaRoutes(a)}));this.R.j()};k.stopObservingMediaRoutes=function(a){this.l.delete(a)?this.j.forEach(function(b){b.stopObservingMediaRoutes(a)}):B(this.u,"No existing route query "+a)};
k.Bo=function(){var a=this;if(0!=this.l.size){var b=[];this.j.forEach(function(c){b=b.concat(c.Nh())});this.l.forEach(function(c){var d=[];a.j.forEach(function(e){e.Nh().forEach(function(f){!f.lf&&e.Ri(c,void 0,f)&&d.push(f.id)})});a.g.onRoutesUpdated(b,c,d)})}};k.Ta=function(){return"ProviderManager"};
k.Fb=function(){return[new Rx(this.j.map(function(a){return a.getName()}),Array.from(this.m),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.s),this.D)]};k.Db=function(){var a=am(this);if(a){this.m=new Set(a.m);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=Fx(this,d);this.h.set(c,d)}this.s=new Map(a.l);this.D=a.g||null}};
var yq=function(a,b,c){a.h.set(c.id,b);Hq(a)},Gq=function(a,b){Nx(a,b.id);a.h.delete(b.id);var c=a.w;b=b.id;c.h.delete(b);var d=c.g.get(b);d&&(c.g.delete(b),vx(c,d),ux(c));Hq(a)},Hq=function(a){0<a.l.size&&a.R.j()};Ex.prototype.L=function(a){var b=this.h.get(a.id);b&&(b.Ln(a.id),0<this.l.size&&this.Bo())};var ao=function(a,b,c){a.h.has(b)?("string"===typeof c||c instanceof Uint8Array||(c=JSON.stringify(c)),a.w.send(b,c)):a.u.J("Got route message for closed route "+b)};
Ex.prototype.onPresentationConnectionStateChanged=function(a,b){"terminated"==b&&this.w.w();this.g.onPresentationConnectionStateChanged(a,b)};Ex.prototype.onPresentationConnectionClosed=function(a,b,c){this.w.w();this.g.onPresentationConnectionClosed(a,b,c)};var xj=function(a,b){a.o.delete(b);(a=a.h.get(b))&&a.terminateRoute(b)},Zm=function(a){zb(4);a.Z.j()};
Ex.prototype.onSinkAvailabilityUpdated=function(a,b){var c=this;if(this.s.get(a.getName())!=b){var d=Sx(this);this.s.set(a.getName(),b);a=Sx(this);d!=a&&(zb(3),0==a&&this.H(),this.g.onSinkAvailabilityUpdated(a),0==a&&(this.m.forEach(function(e){Px(c,e)}),this.m.clear()))}};
var Sx=function(a){return Array.from(a.s.values()).reduce(function(b,c){return Math.max(b,c)},0)},Nx=function(a,b){return a.o.has(b)?Er(a,a.o.get(b)).then(function(c){a.o.delete(b);return c.o()}):Promise.resolve(!1)},Aq=function(a,b,c,d,e){var f=b.mj(c.sinkId);B(a.u,"Starting mirroring using service: "+f);a.o.set(c.id,f);return Hi(Er(a,f),function(g){a.D=f;return Di(g.ik(c,c.mediaSource,b.nj(c.sinkId),d,e),function(h){if(h instanceof Ji&&3==h.reason)throw new rq(8);throw h;})})},bx=function(a,b,c,
d,e,f,g){var h=a.o.get(c.id);return h?Hi(Er(a,h),function(l){a.D=h;return l.oa(c,d,b.nj(c.sinkId),e,f,g)}):Fi(Error("Route "+c.id+" is not mirroring"))},Mq=function(a,b,c){var d=a.F.indexOf(b),e=0<=d;c&&!e?a.F.push(b):!c&&e&&a.F.splice(d,1);Ix(a)},Fx=function(a,b){return a.j.find(function(c){return c.getName()==b})||null};k=Ex.prototype;
k.searchSinks=function(a,b,c){var d=a.startsWith("pseudo:")?a.substring(7):null;return(d=d?Fx(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=Fx(this,a);c?c.provideSinks(b):B(this.u,"provideSinks: Provider not found for providerName "+a)};k.updateMediaSinks=function(a){this.m.has(a)||Ox(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.u.error("createMediaRouteController failed: "+f.message);b.close();c.ptr.reset();throw f;}):(a="createMediaRouteController: Provider not found for "+a,this.u.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"function"!=typeof this.g.getMediaSinkServiceStatus?Promise.resolve({status:""}):this.g.getMediaSinkServiceStatus()};k.getMirroringServiceHostForTab=function(a,b){this.g.getMirroringServiceHostForTab(a,b)};k.getMirroringServiceHostForDesktop=function(a,b,c){this.g.getMirroringServiceHostForDesktop(a,b,c)};k.getMirroringServiceHostForOffscreenTab=function(a,b,c){this.g.getMirroringServiceHostForOffscreenTab(a,b,c)};
var Rx=function(a,b,c,d,e,f){this.m=b;this.j=c;this.h=d;this.l=e;this.g=f};
