'use strict';var h,aa=aa||{},k=this,m=function(a){return void 0!==a},ba=function(){},n=function(){throw Error("unimplemented abstract method");},ca=function(a){a.da=function(){return a.Ha?a.Ha:a.Ha=new a}},da=function(a){var b=typeof a;if("object"==b)if(a){if(a instanceof Array)return"array";if(a instanceof Object)return b;var c=Object.prototype.toString.call(a);if("[object Window]"==c)return"object";if("[object Array]"==c||"number"==typeof a.length&&"undefined"!=typeof a.splice&&"undefined"!=typeof a.propertyIsEnumerable&&
!a.propertyIsEnumerable("splice"))return"array";if("[object Function]"==c||"undefined"!=typeof a.call&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("call"))return"function"}else return"null";else if("function"==b&&"undefined"==typeof a.call)return"object";return b},ea=function(a){return"array"==da(a)},fa=function(a){var b=da(a);return"array"==b||"object"==b&&"number"==typeof a.length},q=function(a){return"string"==typeof a},ga=function(a){return"number"==typeof a},ha=function(a){return"function"==
da(a)},ia=function(a){var b=typeof a;return"object"==b&&null!=a||"function"==b},ja="closure_uid_"+(1E9*Math.random()>>>0),ka=0,la=function(a,b,c){return a.call.apply(a.bind,arguments)},ma=function(a,b,c){if(!a)throw Error();if(2<arguments.length){var d=Array.prototype.slice.call(arguments,2);return function(){var c=Array.prototype.slice.call(arguments);Array.prototype.unshift.apply(c,d);return a.apply(b,c)}}return function(){return a.apply(b,arguments)}},na=function(a,b,c){na=Function.prototype.bind&&
-1!=Function.prototype.bind.toString().indexOf("native code")?la:ma;return na.apply(null,arguments)},oa=function(a,b){var c=Array.prototype.slice.call(arguments,1);return function(){var b=c.slice();b.push.apply(b,arguments);return a.apply(this,b)}},pa=Date.now||function(){return+new Date},r=function(a,b){a=a.split(".");var c=k;a[0]in c||!c.execScript||c.execScript("var "+a[0]);for(var d;a.length&&(d=a.shift());)!a.length&&m(b)?c[d]=b:c[d]?c=c[d]:c=c[d]={}},u=function(a,b){function c(){}c.prototype=
b.prototype;a.H=b.prototype;a.prototype=new c;a.prototype.constructor=a;a.Eb=function(a,c,f){for(var d=Array(arguments.length-2),e=2;e<arguments.length;e++)d[e-2]=arguments[e];return b.prototype[c].apply(a,d)}};var qa=String.prototype.trim?function(a){return a.trim()}:function(a){return a.replace(/^[\s\xa0]+|[\s\xa0]+$/g,"")},ra=function(a,b){a=String(a).toLowerCase();b=String(b).toLowerCase();return a<b?-1:a==b?0:1},sa=function(){return Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^pa()).toString(36)},ua=function(a,b){var c=0;a=qa(String(a)).split(".");b=qa(String(b)).split(".");for(var d=Math.max(a.length,b.length),e=0;0==c&&e<d;e++){var f=a[e]||"",g=b[e]||
"";do{f=/(\d*)(\D*)(.*)/.exec(f)||["","","",""];g=/(\d*)(\D*)(.*)/.exec(g)||["","","",""];if(0==f[0].length&&0==g[0].length)break;c=ta(0==f[1].length?0:parseInt(f[1],10),0==g[1].length?0:parseInt(g[1],10))||ta(0==f[2].length,0==g[2].length)||ta(f[2],g[2]);f=f[3];g=g[3]}while(0==c)}return c},ta=function(a,b){return a<b?-1:a>b?1:0};var v=function(a){this.type=a};r("castApp.protocol.Message",v);var va=function(a){this.type=a;this.requestId=sa()};u(va,v);r("castApp.protocol.Request",va);var w=function(a,b){this.type=a;this.responseTo=b.requestId};u(w,v);r("castApp.protocol.Response",w);var wa=function(a,b){w.call(this,"Error",a);this.errorName=b||"err-unknown"};u(wa,w);r("castApp.protocol.Error",wa);var xa=function(){};r("castApp.protocol.Handshake",xa);var ya=function(){va.call(this,"Handshake.Request");this.coreVersion=5};
u(ya,va);xa.Request=ya;var za=function(a){w.call(this,"Handshake.Response",a);this.version=5;this.latestVersion=void 0};u(za,w);xa.Response=za;var Aa=function(a,b){w.call(this,"Handshake.UiVersionNotSupported",a);this.latestVersion=b};u(Aa,w);xa.UiVersionNotSupported=Aa;var Ba=function(a){this.type="SetSimpleState";this.state=a};u(Ba,v);r("castApp.protocol.SetSimpleState",Ba);var Ca=function(){};r("castApp.protocol.ModalDialog",Ca);
var Da=function(a){va.call(this,"ModalDialog.Request");this.dialogId=a};u(Da,va);Ca.Request=Da;var Ea=function(a,b){w.call(this,"ModalDialog.Response",a);this.button=b};u(Ea,w);Ca.Response=Ea;var Fa=function(){};r("castApp.protocol.DeviceDiscovery",Fa);var Ga=function(a){this.type="DeviceDiscovery.ShowScanner";this.showTips=a};u(Ga,v);Fa.ShowScanner=Ga;var Ha=function(){};r("castApp.protocol.SetupStart",Ha);
var Ia=function(a,b,c){this.type="SetupStart.ShowDevice";this.state=a;this.deviceType=b;this.deviceName=c;this.analyticsOptIn=this.otherDevicesExist=!1};u(Ia,v);Ha.ShowDevice=Ia;var Ja=function(a){this.type="SetupStart.TosAccepted";this.analyticsOptIn=a};u(Ja,v);Ha.TosAccepted=Ja;var Ka=function(){};r("castApp.protocol.WiFiSwitching",Ka);var La=function(a,b,c){this.type="WiFiSwitching.ConnectHotSpot";this.state=a;this.deviceName=b;this.ssid=c};u(La,v);Ka.ConnectHotSpot=La;
var Ma=function(a,b){this.type="WiFiSwitching.ReconnectWiFi";this.state=a;this.ssid=b};u(Ma,v);Ka.ReconnectWiFi=Ma;var Na=function(){};r("castApp.protocol.CodeConfirmation",Na);var Oa=function(a){va.call(this,"CodeConfirmation.Request");this.code=a};u(Oa,va);Na.Request=Oa;var Pa=function(a,b){w.call(this,"CodeConfirmation.Response",a);this.confirmed=b};u(Pa,w);Na.Response=Pa;var Qa=function(){};r("castApp.protocol.AudioConfirmation",Qa);
var Ra=function(a){this.type="AudioConfirmation.PromptUser";this.state=a};u(Ra,v);Qa.PromptUser=Ra;var Sa=function(a){this.type="AudioConfirmation.UserAction";this.action=a};u(Sa,v);Qa.UserAction=Sa;var Ta=function(){};r("castApp.protocol.DeviceConfig",Ta);var Ua=function(a,b){va.call(this,"DeviceConfig.Request");this.name=a;this.country=b};u(Ua,va);Ta.Request=Ua;var Va=function(a,b,c){w.call(this,"DeviceConfig.Response",a);this.name=b;this.country=c};u(Va,w);Ta.Response=Va;var Wa=function(){};
r("castApp.protocol.WiFiConfig",Wa);var Xa=function(a,b,c){this.id=a;this.ssid=b;this.security=c};Wa.Network=Xa;var Ya=function(a,b,c){this.type="WiFiConfig.Show";this.state=a;this.networks=b;this.selectedNetwork=c};u(Ya,v);Wa.Show=Ya;var Za=function(a){this.type="WiFiConfig.UpdateNetworks";this.networks=a};u(Za,v);Wa.UpdateNetworks=Za;var $a=function(a,b){this.type="WiFiConfig.Connect";this.network=a;this.password=b};u($a,v);Wa.Connect=$a;
var ab=function(a){this.type="WiFiConfig.Retry";this.network=a};u(ab,v);Wa.Retry=ab;var bb=function(){};r("castApp.protocol.Features",bb);var cb=function(){this.supportsDisplay=this.supportsSetup=!1};bb.Device=cb;var db=function(){};r("castApp.protocol.Devices",db);var eb=function(a,b,c){this.id=a;this.type=b;this.displayName=c};db.DeviceProperties=eb;var fb=function(a,b){this.type="Devices.Show";this.devices=a;this.deviceName=b};u(fb,v);db.Show=fb;
var gb=function(a,b){this.type="Devices.UserAction";this.device=a;this.action=b};u(gb,v);db.UserAction=gb;var hb=function(){};r("castApp.protocol.DeviceSettings",hb);var ib=function(a,b){this.localeId=a;this.displayString=b};hb.Locale=ib;var jb=function(a,b,c){this.timeZoneId=a;this.displayString=b;this.offset=c};hb.TimeZone=jb;
var kb=function(a,b){this.type="DeviceSettings.Show";this.state=a;this.deviceType=b.deviceType;this.name=b.name;this.ssid=b.ssid;this.timeZoneId=b.timeZoneId;this.supportedTimeZones=b.supportedTimeZones;this.timeFormat=b.timeFormat;this.localeId=b.localeId;this.supportedLocales=b.supportedLocales;this.statsOptIn=b.statsOptIn;this.firmwareVersion=b.firmwareVersion;this.countryCode=b.countryCode;this.macAddress=b.macAddress;this.ipAddress=b.ipAddress};u(kb,v);hb.Show=kb;
var lb=function(a){this.type="DeviceSettings.Apply";this.name=a.name;this.timeZoneId=a.timeZoneId;this.timeFormat=a.timeFormat;this.localeId=a.localeId;this.statsOptIn=a.statsOptIn};u(lb,v);hb.Apply=lb;var mb=function(){};r("castApp.protocol.DetectCountry",mb);var nb=function(){va.call(this,"DetectCountry.Request")};u(nb,va);mb.Request=nb;var ob=function(a,b){w.call(this,"DetectCountry.Response",a);this.countryCode=b};u(ob,w);mb.Response=ob;var pb=function(){};r("castApp.protocol.Offers",pb);
var qb=function(){this.type="Offers.Scan";this.scanId=sa()};u(qb,v);pb.Scan=qb;var rb=function(a,b,c,d){this.token=a;this.displayName=b;this.deviceType=c;this.ssdpUdn=d};pb.Device=rb;var sb=function(a,b,c){this.type="Offers.ScanResults";this.scanId=a;this.devices=b;this.scanComplete=c};u(sb,v);pb.ScanResults=sb;var tb=function(a){this.type="Offers.Redeem";this.url=a};u(tb,v);pb.Redeem=tb;var ub=function(a,b){this.type="Offers.AnalyticsEvent";this.eventType=a;this.offerId=b};u(ub,v);
pb.AnalyticsEvent=ub;var x=function(a){if(Error.captureStackTrace)Error.captureStackTrace(this,x);else{var b=Error().stack;b&&(this.stack=b)}a&&(this.message=String(a))};u(x,Error);x.prototype.name="CustomError";var vb=Array.prototype.indexOf?function(a,b,c){return Array.prototype.indexOf.call(a,b,c)}:function(a,b,c){c=null==c?0:0>c?Math.max(0,a.length+c):c;if(q(a))return q(b)&&1==b.length?a.indexOf(b,c):-1;for(;c<a.length;c++)if(c in a&&a[c]===b)return c;return-1},wb=Array.prototype.lastIndexOf?function(a,b,c){return Array.prototype.lastIndexOf.call(a,b,null==c?a.length-1:c)}:function(a,b,c){c=null==c?a.length-1:c;0>c&&(c=Math.max(0,a.length+c));if(q(a))return q(b)&&1==b.length?a.lastIndexOf(b,c):-1;for(;0<=
c;c--)if(c in a&&a[c]===b)return c;return-1},xb=Array.prototype.forEach?function(a,b,c){Array.prototype.forEach.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=q(a)?a.split(""):a,f=0;f<d;f++)f in e&&b.call(c,e[f],f,a)},yb=Array.prototype.map?function(a,b,c){return Array.prototype.map.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=Array(d),f=q(a)?a.split(""):a,g=0;g<d;g++)g in f&&(e[g]=b.call(c,f[g],g,a));return e},zb=function(a,b){a:{for(var c=a.length,d=q(a)?a.split(""):a,e=0;e<c;e++)if(e in
d&&b.call(void 0,d[e],e,a)){b=e;break a}b=-1}return 0>b?null:q(a)?a.charAt(b):a[b]},Ab=function(a){if(!ea(a))for(var b=a.length-1;0<=b;b--)delete a[b];a.length=0},Cb=function(a,b){b=vb(a,b);var c;(c=0<=b)&&Bb(a,b);return c},Bb=function(a,b){Array.prototype.splice.call(a,b,1)},Db=function(a){return Array.prototype.concat.apply(Array.prototype,arguments)},Eb=function(a){return Array.prototype.concat.apply(Array.prototype,arguments)},Fb=function(a){var b=a.length;if(0<b){for(var c=Array(b),d=0;d<b;d++)c[d]=
a[d];return c}return[]},Gb=function(a,b){for(var c=1;c<arguments.length;c++){var d=arguments[c];if(fa(d)){var e=a.length||0,f=d.length||0;a.length=e+f;for(var g=0;g<f;g++)a[e+g]=d[g]}else a.push(d)}},Ib=function(a,b,c,d){Array.prototype.splice.apply(a,Hb(arguments,1))},Hb=function(a,b,c){return 2>=arguments.length?Array.prototype.slice.call(a,b):Array.prototype.slice.call(a,b,c)},Kb=function(a,b){a.sort(b||Jb)},Jb=function(a,b){return a>b?1:a<b?-1:0};var Lb;a:{var Mb=k.navigator;if(Mb){var Nb=Mb.userAgent;if(Nb){Lb=Nb;break a}}Lb=""}var y=function(a){return-1!=Lb.indexOf(a)};var Ob=function(){return y("iPhone")&&!y("iPod")&&!y("iPad")};var Pb=function(a,b,c){for(var d in a)b.call(c,a[d],d,a)},Qb=function(a){var b=[],c=0,d;for(d in a)b[c++]=a[d];return b},Rb=function(a){var b=[],c=0,d;for(d in a)b[c++]=d;return b},z=function(a,b,c){b in a||(a[b]=c)},Sb=function(a){var b={},c;for(c in a)b[c]=a[c];return b},Tb="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),Ub=function(a,b){for(var c,d,e=1;e<arguments.length;e++){d=arguments[e];for(c in d)a[c]=d[c];for(var f=0;f<Tb.length;f++)c=
Tb[f],Object.prototype.hasOwnProperty.call(d,c)&&(a[c]=d[c])}};var Vb=function(){return(y("Chrome")||y("CriOS"))&&!y("Edge")};var Wb="StopIteration"in k?k.StopIteration:{message:"StopIteration",stack:""},Xb=function(){};Xb.prototype.next=function(){throw Wb;};Xb.prototype.P=function(){return this};
var Yb=function(a){if(a instanceof Xb)return a;if("function"==typeof a.P)return a.P(!1);if(fa(a)){var b=0,c=new Xb;c.next=function(){for(;;){if(b>=a.length)throw Wb;if(b in a)return a[b++];b++}};return c}throw Error("Not implemented");},Zb=function(a,b){if(fa(a))try{xb(a,b,void 0)}catch(c){if(c!==Wb)throw c;}else{a=Yb(a);try{for(;;)b.call(void 0,a.next(),void 0,a)}catch(c){if(c!==Wb)throw c;}}},$b=function(a,b){var c=null;Zb(a,function(a){c=b.call(void 0,c,a)});return c},ac=function(a,b){a=Yb(a);
try{for(;;)if(!b.call(void 0,a.next(),void 0,a))return!1}catch(c){if(c!==Wb)throw c;}return!0};var A=function(a,b){this.b={};this.a=[];this.f=this.c=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 if(a){a instanceof A?(c=a.C(),d=a.v()):(c=Rb(a),d=Qb(a));for(var e=0;e<c.length;e++)this.set(c[e],d[e])}};A.prototype.u=function(){return this.c};A.prototype.v=function(){bc(this);for(var a=[],b=0;b<this.a.length;b++)a.push(this.b[this.a[b]]);return a};A.prototype.C=function(){bc(this);return this.a.concat()};
var dc=function(a,b){return cc(a.b,b)};A.prototype.clear=function(){this.b={};this.f=this.c=this.a.length=0};A.prototype.remove=function(a){return cc(this.b,a)?(delete this.b[a],this.c--,this.f++,this.a.length>2*this.c&&bc(this),!0):!1};var bc=function(a){if(a.c!=a.a.length){for(var b=0,c=0;b<a.a.length;){var d=a.a[b];cc(a.b,d)&&(a.a[c++]=d);b++}a.a.length=c}if(a.c!=a.a.length){for(var e={},c=b=0;b<a.a.length;)d=a.a[b],cc(e,d)||(a.a[c++]=d,e[d]=1),b++;a.a.length=c}};
A.prototype.get=function(a,b){return cc(this.b,a)?this.b[a]:b};A.prototype.set=function(a,b){cc(this.b,a)||(this.c++,this.a.push(a),this.f++);this.b[a]=b};A.prototype.forEach=function(a,b){for(var c=this.C(),d=0;d<c.length;d++){var e=c[d],f=this.get(e);a.call(b,f,e,this)}};A.prototype.P=function(a){bc(this);var b=0,c=this.f,d=this,e=new Xb;e.next=function(){if(c!=d.f)throw Error("The map has changed since the iterator was created");if(b>=d.a.length)throw Wb;var e=d.a[b++];return a?e:d.b[e]};return e};
var cc=function(a,b){return Object.prototype.hasOwnProperty.call(a,b)};var ec=function(a){if(a.v&&"function"==typeof a.v)return a.v();if(q(a))return a.split("");if(fa(a)){for(var b=[],c=a.length,d=0;d<c;d++)b.push(a[d]);return b}return Qb(a)},fc=function(a,b){if(a.forEach&&"function"==typeof a.forEach)a.forEach(b,void 0);else if(fa(a)||q(a))xb(a,b,void 0);else{var c;if(a.C&&"function"==typeof a.C)c=a.C();else if(a.v&&"function"==typeof a.v)c=void 0;else if(fa(a)||q(a)){c=[];for(var d=a.length,e=0;e<d;e++)c.push(e)}else c=Rb(a);for(var d=ec(a),e=d.length,f=0;f<e;f++)b.call(void 0,
d[f],c&&c[f],a)}};var B=function(a){this.a=new A;if(a){a=ec(a);for(var b=a.length,c=0;c<b;c++)gc(this,a[c])}},hc=function(a){var b=typeof a;return"object"==b&&a||"function"==b?"o"+(a[ja]||(a[ja]=++ka)):b.substr(0,1)+a};B.prototype.u=function(){return this.a.u()};var gc=function(a,b){a.a.set(hc(b),b)};B.prototype.removeAll=function(a){a=ec(a);for(var b=a.length,c=0;c<b;c++)this.remove(a[c])};B.prototype.remove=function(a){return this.a.remove(hc(a))};B.prototype.clear=function(){this.a.clear()};
B.prototype.contains=function(a){return dc(this.a,hc(a))};var ic=function(a,b){a=new B(a);a.removeAll(b);return a};B.prototype.v=function(){return this.a.v()};B.prototype.P=function(){return this.a.P(!1)};var jc=function(a){jc[" "](a);return a};jc[" "]=ba;var lc=function(a,b){var c=kc;return Object.prototype.hasOwnProperty.call(c,a)?c[a]:c[a]=b(a)};var mc=y("Opera"),C=y("Trident")||y("MSIE"),nc=y("Edge"),oc=y("Gecko")&&!(-1!=Lb.toLowerCase().indexOf("webkit")&&!y("Edge"))&&!(y("Trident")||y("MSIE"))&&!y("Edge"),pc=-1!=Lb.toLowerCase().indexOf("webkit")&&!y("Edge"),qc=function(){var a=k.document;return a?a.documentMode:void 0},rc;
a:{var sc="",tc=function(){var a=Lb;if(oc)return/rv\:([^\);]+)(\)|;)/.exec(a);if(nc)return/Edge\/([\d\.]+)/.exec(a);if(C)return/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(a);if(pc)return/WebKit\/(\S+)/.exec(a);if(mc)return/(?:Version)[ \/]?(\S+)/.exec(a)}();tc&&(sc=tc?tc[1]:"");if(C){var uc=qc();if(null!=uc&&uc>parseFloat(sc)){rc=String(uc);break a}}rc=sc}
var vc=rc,kc={},wc=function(a){return lc(a,function(){return 0<=ua(vc,a)})},xc=k.document,yc=xc&&C?qc()||("CSS1Compat"==xc.compatMode?parseInt(vc,10):5):void 0;var zc=function(a,b){this.b=[];this.a=b;for(var c=!0,d=a.length-1;0<=d;d--){var e=a[d]|0;c&&e==b||(this.b[d]=e,c=!1)}},Ac={},Bc=function(a){if(-128<=a&&128>a){var b=Ac[a];if(b)return b}b=new zc([a|0],0>a?-1:0);-128<=a&&128>a&&(Ac[a]=b);return b},Dc=function(a){if(isNaN(a)||!isFinite(a))return Cc;if(0>a)return D(Dc(-a));for(var b=[],c=1,d=0;a>=c;d++)b[d]=a/c|0,c*=4294967296;return new zc(b,0)},Ec=function(a,b){if(0==a.length)throw Error("number format error: empty string");b=b||10;if(2>b||36<b)throw Error("radix out of range: "+
b);if("-"==a.charAt(0))return D(Ec(a.substring(1),b));if(0<=a.indexOf("-"))throw Error('number format error: interior "-" character');for(var c=Dc(Math.pow(b,8)),d=Cc,e=0;e<a.length;e+=8){var f=Math.min(8,a.length-e),g=parseInt(a.substring(e,e+f),b);8>f?(f=Dc(Math.pow(b,f)),d=Fc(Gc(d,f),Dc(g))):(d=Gc(d,c),d=Fc(d,Dc(g)))}return d},Cc=Bc(0),Hc=Bc(1),Ic=Bc(16777216),Jc=function(a){if(-1==a.a)return-Jc(D(a));for(var b=0,c=1,d=0;d<a.b.length;d++)b+=Kc(a,d)*c,c*=4294967296;return b};
zc.prototype.toString=function(a){a=a||10;if(2>a||36<a)throw Error("radix out of range: "+a);if(Lc(this))return"0";if(-1==this.a)return"-"+D(this).toString(a);for(var b=Dc(Math.pow(a,6)),c=this,d="";;){var e=Mc(c,b),c=Nc(c,Gc(e,b)),f=((0<c.b.length?c.b[0]:c.a)>>>0).toString(a),c=e;if(Lc(c))return f+d;for(;6>f.length;)f="0"+f;d=""+f+d}};
var E=function(a,b){return 0>b?0:b<a.b.length?a.b[b]:a.a},Kc=function(a,b){a=E(a,b);return 0<=a?a:4294967296+a},Lc=function(a){if(0!=a.a)return!1;for(var b=0;b<a.b.length;b++)if(0!=a.b[b])return!1;return!0},Oc=function(a,b){a=Nc(a,b);return-1==a.a?-1:Lc(a)?0:1},D=function(a){for(var b=a.b.length,c=[],d=0;d<b;d++)c[d]=~a.b[d];a=new zc(c,~a.a);return Fc(a,Hc)},Fc=function(a,b){for(var c=Math.max(a.b.length,b.b.length),d=[],e=0,f=0;f<=c;f++){var g=e+(E(a,f)&65535)+(E(b,f)&65535),l=(g>>>16)+(E(a,f)>>>
16)+(E(b,f)>>>16),e=l>>>16,g=g&65535,l=l&65535;d[f]=l<<16|g}return new zc(d,d[d.length-1]&-2147483648?-1:0)},Nc=function(a,b){return Fc(a,D(b))},Gc=function(a,b){if(Lc(a)||Lc(b))return Cc;if(-1==a.a)return-1==b.a?Gc(D(a),D(b)):D(Gc(D(a),b));if(-1==b.a)return D(Gc(a,D(b)));if(0>Oc(a,Ic)&&0>Oc(b,Ic))return Dc(Jc(a)*Jc(b));for(var c=a.b.length+b.b.length,d=[],e=0;e<2*c;e++)d[e]=0;for(e=0;e<a.b.length;e++)for(var f=0;f<b.b.length;f++){var g=E(a,e)>>>16,l=E(a,e)&65535,p=E(b,f)>>>16,t=E(b,f)&65535;d[2*
e+2*f]+=l*t;Pc(d,2*e+2*f);d[2*e+2*f+1]+=g*t;Pc(d,2*e+2*f+1);d[2*e+2*f+1]+=l*p;Pc(d,2*e+2*f+1);d[2*e+2*f+2]+=g*p;Pc(d,2*e+2*f+2)}for(e=0;e<c;e++)d[e]=d[2*e+1]<<16|d[2*e];for(e=c;e<2*c;e++)d[e]=0;return new zc(d,0)},Pc=function(a,b){for(;(a[b]&65535)!=a[b];)a[b+1]+=a[b]>>>16,a[b]&=65535},Mc=function(a,b){if(Lc(b))throw Error("division by zero");if(Lc(a))return Cc;if(-1==a.a)return-1==b.a?Mc(D(a),D(b)):D(Mc(D(a),b));if(-1==b.a)return D(Mc(a,D(b)));if(30<a.b.length){if(-1==a.a||-1==b.a)throw Error("slowDivide_ only works with positive integers.");
for(var c=Hc;0>=Oc(b,a);)c=Qc(c,1),b=Qc(b,1);var d=Rc(c,1),e=Rc(b,1),f;b=Rc(b,2);for(c=Rc(c,2);!Lc(b);)f=Fc(e,b),0>=Oc(f,a)&&(d=Fc(d,c),e=f),b=Rc(b,1),c=Rc(c,1);return d}for(c=Cc;0<=Oc(a,b);){d=Math.max(1,Math.floor(Jc(a)/Jc(b)));e=Math.ceil(Math.log(d)/Math.LN2);e=48>=e?1:Math.pow(2,e-48);f=Dc(d);for(var g=Gc(f,b);-1==g.a||0<Oc(g,a);)d-=e,f=Dc(d),g=Gc(f,b);Lc(f)&&(f=Hc);c=Fc(c,f);a=Nc(a,g)}return c},Sc=function(a,b){for(var c=Math.max(a.b.length,b.b.length),d=[],e=0;e<c;e++)d[e]=E(a,e)|E(b,e);return new zc(d,
a.a|b.a)},Qc=function(a,b){var c=b>>5;b%=32;for(var d=a.b.length+c+(0<b?1:0),e=[],f=0;f<d;f++)e[f]=0<b?E(a,f-c)<<b|E(a,f-c-1)>>>32-b:E(a,f-c);return new zc(e,a.a)},Rc=function(a,b){var c=b>>5;b%=32;for(var d=a.b.length-c,e=[],f=0;f<d;f++)e[f]=0<b?E(a,f+c)>>>b|E(a,f+c+1)<<32-b:E(a,f+c);return new zc(e,a.a)};var Tc=function(a){this.b=a};Tc.prototype.toString=n;
var Wc=function(a){try{return-1!=a.indexOf(":")?new Uc(a):new Vc(a)}catch(b){return null}},Vc=function(a){var b=Cc;if(a instanceof zc){if(0!=a.a||0>Oc(a,Cc)||0<Oc(a,Xc))throw Error("The address does not look like an IPv4.");b=Sb(a)}else{if(!Yc.test(a))throw Error(a+" does not look like an IPv4 address.");var c=a.split(".");if(4!=c.length)throw Error(a+" does not look like an IPv4 address.");for(var d=0;d<c.length;d++){var e;e=c[d];var f=Number(e);e=0==f&&/^[\s\xa0]*$/.test(e)?NaN:f;if(isNaN(e)||0>
e||255<e||1!=c[d].length&&0==c[d].lastIndexOf("0",0))throw Error("In "+a+", octet "+d+" is not valid");e=Dc(e);b=Sc(Qc(b,8),e)}}this.b=b};u(Vc,Tc);var Yc=/^[0-9.]*$/,Xc=Nc(Qc(Hc,32),Hc);Vc.prototype.toString=function(){if(this.a)return this.a;for(var a=Kc(this.b,0),b=[],c=3;0<=c;c--)b[c]=String(a&255),a>>>=8;return this.a=b.join(".")};
var Uc=function(a){var b=Cc;if(a instanceof zc){if(0!=a.a||0>Oc(a,Cc)||0<Oc(a,Zc))throw Error("The address does not look like a valid IPv6.");b=Sb(a)}else{if(!$c.test(a))throw Error(a+" is not a valid IPv6 address.");var c=a.split(":");if(-1!=c[c.length-1].indexOf(".")){a=Kc(Sb((new Vc(c[c.length-1])).b),0);var d=[];d.push((a>>>16&65535).toString(16));d.push((a&65535).toString(16));Bb(c,c.length-1);Gb(c,d);a=c.join(":")}d=a.split("::");if(2<d.length||1==d.length&&8!=c.length)throw Error(a+" is not a valid IPv6 address.");
if(1<d.length){c=d[0].split(":");d=d[1].split(":");1==c.length&&""==c[0]&&(c=[]);1==d.length&&""==d[0]&&(d=[]);var e=8-(c.length+d.length);if(1>e)c=[];else{for(var f=[],g=0;g<e;g++)f[g]="0";c=Eb(c,f,d)}}if(8!=c.length)throw Error(a+" is not a valid IPv6 address");for(d=0;d<c.length;d++){e=Ec(c[d],16);if(0>Oc(e,Cc)||0<Oc(e,ad))throw Error(c[d]+" in "+a+" is not a valid hextet.");b=Sc(Qc(b,16),e)}}this.b=b};u(Uc,Tc);var $c=/^([a-fA-F0-9]*:){2}[a-fA-F0-9:.]*$/,ad=Bc(65535),Zc=Nc(Qc(Hc,128),Hc);
Uc.prototype.toString=function(){if(this.a)return this.a;for(var a=[],b=3;0<=b;b--){var c=Kc(this.b,b),d=c&65535;a.push((c>>>16).toString(16));a.push(d.toString(16))}for(var c=b=-1,e=d=0,f=0;f<a.length;f++)"0"==a[f]?(e++,-1==c&&(c=f),e>d&&(d=e,b=c)):(c=-1,e=0);0<d&&(b+d==a.length&&a.push(""),a.splice(b,d,""),0==b&&(a=[""].concat(a)));return this.a=a.join(":")};var bd=function(a,b,c){this.g=c;this.c=a;this.f=b;this.b=0;this.a=null};bd.prototype.get=function(){var a;0<this.b?(this.b--,a=this.a,this.a=a.next,a.next=null):a=this.c();return a};var cd=function(a,b){a.f(b);a.b<a.g&&(a.b++,b.next=a.a,a.a=b)};var dd=function(a){k.setTimeout(function(){throw a;},0)},ed,fd=function(){var a=k.MessageChannel;"undefined"===typeof a&&"undefined"!==typeof window&&window.postMessage&&window.addEventListener&&!y("Presto")&&(a=function(){var a=document.createElement("IFRAME");a.style.display="none";a.src="";document.documentElement.appendChild(a);var b=a.contentWindow,a=b.document;a.open();a.write("");a.close();var c="callImmediate"+Math.random(),d="file:"==b.location.protocol?"*":b.location.protocol+"//"+b.location.host,
a=na(function(a){if(("*"==d||a.origin==d)&&a.data==c)this.port1.onmessage()},this);b.addEventListener("message",a,!1);this.port1={};this.port2={postMessage:function(){b.postMessage(c,d)}}});if("undefined"!==typeof a&&!y("Trident")&&!y("MSIE")){var b=new a,c={},d=c;b.port1.onmessage=function(){if(m(c.next)){c=c.next;var a=c.Aa;c.Aa=null;a()}};return function(a){d.next={Aa:a};d=d.next;b.port2.postMessage(0)}}return"undefined"!==typeof document&&"onreadystatechange"in document.createElement("SCRIPT")?
function(a){var b=document.createElement("SCRIPT");b.onreadystatechange=function(){b.onreadystatechange=null;b.parentNode.removeChild(b);b=null;a();a=null};document.documentElement.appendChild(b)}:function(a){k.setTimeout(a,0)}};var gd=function(){this.b=this.a=null},id=new bd(function(){return new hd},function(a){a.reset()},100);gd.prototype.remove=function(){var a=null;this.a&&(a=this.a,this.a=this.a.next,this.a||(this.b=null),a.next=null);return a};var hd=function(){this.next=this.b=this.a=null};hd.prototype.set=function(a,b){this.a=a;this.b=b;this.next=null};hd.prototype.reset=function(){this.next=this.b=this.a=null};var nd=function(a,b){jd||kd();ld||(jd(),ld=!0);var c=md,d=id.get();d.set(a,b);c.b?c.b.next=d:c.a=d;c.b=d},jd,kd=function(){if(k.Promise&&k.Promise.resolve){var a=k.Promise.resolve(void 0);jd=function(){a.then(od)}}else jd=function(){var a=od;!ha(k.setImmediate)||k.Window&&k.Window.prototype&&!y("Edge")&&k.Window.prototype.setImmediate==k.setImmediate?(ed||(ed=fd()),ed(a)):k.setImmediate(a)}},ld=!1,md=new gd,od=function(){for(var a;a=md.remove();){try{a.a.call(a.b)}catch(b){dd(b)}cd(id,a)}ld=!1};var F=function(a,b){this.a=0;this.i=void 0;this.f=this.b=this.c=null;this.g=this.h=!1;if(a!=ba)try{var c=this;a.call(b,function(a){pd(c,2,a)},function(a){pd(c,3,a)})}catch(d){pd(this,3,d)}},qd=function(){this.next=this.context=this.b=this.f=this.a=null;this.c=!1};qd.prototype.reset=function(){this.context=this.b=this.f=this.a=null;this.c=!1};
var rd=new bd(function(){return new qd},function(a){a.reset()},100),sd=function(a,b,c){var d=rd.get();d.f=a;d.b=b;d.context=c;return d},G=function(a){if(a instanceof F)return a;var b=new F(ba);pd(b,2,a);return b},H=function(a){return new F(function(b,c){c(a)})},ud=function(a,b,c){td(a,b,c,null)||nd(oa(b,a))},vd=function(a){return new F(function(b,c){var d=a.length,e=[];if(d)for(var f=function(a,c){d--;e[a]=c;0==d&&b(e)},g=function(a){c(a)},l=0,p;l<a.length;l++)p=a[l],ud(p,oa(f,l),g);else b(e)})},
I=function(){var a,b,c=new F(function(c,e){a=c;b=e});return new wd(c,a,b)};F.prototype.then=function(a,b,c){return xd(this,ha(a)?a:null,ha(b)?b:null,c)};F.prototype.then=F.prototype.then;F.prototype.$goog_Thenable=!0;var J=function(a,b){b=sd(b,b,void 0);b.c=!0;yd(a,b);return a},K=function(a,b,c){return xd(a,null,b,c)};F.prototype.cancel=function(a){0==this.a&&nd(function(){var b=new L(a);zd(this,b)},this)};
var zd=function(a,b){if(0==a.a)if(a.c){var c=a.c;if(c.b){for(var d=0,e=null,f=null,g=c.b;g&&(g.c||(d++,g.a==a&&(e=g),!(e&&1<d)));g=g.next)e||(f=g);e&&(0==c.a&&1==d?zd(c,b):(f?(d=f,d.next==c.f&&(c.f=d),d.next=d.next.next):Ad(c),Bd(c,e,3,b)))}a.c=null}else pd(a,3,b)},yd=function(a,b){a.b||2!=a.a&&3!=a.a||Cd(a);a.f?a.f.next=b:a.b=b;a.f=b},xd=function(a,b,c,d){var e=sd(null,null,null);e.a=new F(function(a,g){e.f=b?function(c){try{var e=b.call(d,c);a(e)}catch(t){g(t)}}:a;e.b=c?function(b){try{var e=c.call(d,
b);!m(e)&&b instanceof L?g(b):a(e)}catch(t){g(t)}}:g});e.a.c=a;yd(a,e);return e.a};F.prototype.l=function(a){this.a=0;pd(this,2,a)};F.prototype.m=function(a){this.a=0;pd(this,3,a)};
var pd=function(a,b,c){0==a.a&&(a===c&&(b=3,c=new TypeError("Promise cannot resolve to itself")),a.a=1,td(c,a.l,a.m,a)||(a.i=c,a.a=b,a.c=null,Cd(a),3!=b||c instanceof L||Dd(a,c)))},td=function(a,b,c,d){if(a instanceof F)return yd(a,sd(b||ba,c||null,d)),!0;var e;if(a)try{e=!!a.$goog_Thenable}catch(g){e=!1}else e=!1;if(e)return a.then(b,c,d),!0;if(ia(a))try{var f=a.then;if(ha(f))return Ed(a,f,b,c,d),!0}catch(g){return c.call(d,g),!0}return!1},Ed=function(a,b,c,d,e){var f=!1,g=function(a){f||(f=!0,c.call(e,
a))},l=function(a){f||(f=!0,d.call(e,a))};try{b.call(a,g,l)}catch(p){l(p)}},Cd=function(a){a.h||(a.h=!0,nd(a.j,a))},Ad=function(a){var b=null;a.b&&(b=a.b,a.b=b.next,b.next=null);a.b||(a.f=null);return b};F.prototype.j=function(){for(var a;a=Ad(this);)Bd(this,a,this.a,this.i);this.h=!1};
var Bd=function(a,b,c,d){if(3==c&&b.b&&!b.c)for(;a&&a.g;a=a.c)a.g=!1;if(b.a)b.a.c=null,Fd(b,c,d);else try{b.c?b.f.call(b.context):Fd(b,c,d)}catch(e){Gd.call(null,e)}cd(rd,b)},Fd=function(a,b,c){2==b?a.f.call(a.context,c):a.b&&a.b.call(a.context,c)},Dd=function(a,b){a.g=!0;nd(function(){a.g&&Gd.call(null,b)})},Gd=dd,L=function(a){x.call(this,a)};u(L,x);L.prototype.name="cancel";var wd=function(a,b,c){this.a=a;this.b=b;this.c=c};var Hd=/^(?:([^:/?#.]+):)?(?:\/\/(?:([^/?#]*)@)?([^/#?]*?)(?::([0-9]+))?(?=[/#?]|$))?([^?#]+)?(?:\?([^#]*))?(?:#([\s\S]*))?$/,Id=function(a,b){if(a){a=a.split("&");for(var c=0;c<a.length;c++){var d=a[c].indexOf("="),e,f=null;0<=d?(e=a[c].substring(0,d),f=a[c].substring(d+1)):e=a[c];b(e,f?decodeURIComponent(f.replace(/\+/g," ")):"")}}};var Jd=function(a,b){this.a=this.j=this.f="";this.h=null;this.g=this.c="";this.b=!1;var c;a instanceof Jd?(this.b=m(b)?b:a.b,Kd(this,a.f),this.j=a.j,this.a=a.a,Ld(this,a.h),this.c=a.c,b=a.i,c=new Md,c.c=b.c,b.a&&(c.a=new A(b.a),c.b=b.b),Nd(this,c),this.g=a.g):a&&(c=String(a).match(Hd))?(this.b=!!b,Kd(this,c[1]||"",!0),this.j=Od(c[2]||""),this.a=Od(c[3]||"",!0),Ld(this,c[4]),this.c=Od(c[5]||"",!0),Nd(this,c[6]||"",!0),this.g=Od(c[7]||"")):(this.b=!!b,this.i=new Md(null,0,this.b))};
Jd.prototype.toString=function(){var a=[],b=this.f;b&&a.push(Pd(b,Qd,!0),":");var c=this.a;if(c||"file"==b)a.push("//"),(b=this.j)&&a.push(Pd(b,Qd,!0),"@"),a.push(encodeURIComponent(String(c)).replace(/%25([0-9a-fA-F]{2})/g,"%$1")),c=this.h,null!=c&&a.push(":",String(c));if(c=this.c)this.a&&"/"!=c.charAt(0)&&a.push("/"),a.push(Pd(c,"/"==c.charAt(0)?Rd:Sd,!0));(c=this.i.toString())&&a.push("?",c);(c=this.g)&&a.push("#",Pd(c,Td));return a.join("")};
var Kd=function(a,b,c){a.f=c?Od(b,!0):b;a.f&&(a.f=a.f.replace(/:$/,""))},Ld=function(a,b){if(b){b=Number(b);if(isNaN(b)||0>b)throw Error("Bad port number "+b);a.h=b}else a.h=null},Nd=function(a,b,c){b instanceof Md?(a.i=b,Ud(a.i,a.b)):(c||(b=Pd(b,Vd)),a.i=new Md(b,0,a.b))},Wd=function(a){return a instanceof Jd?new Jd(a):new Jd(a,void 0)},Od=function(a,b){return a?b?decodeURI(a.replace(/%25/g,"%2525")):decodeURIComponent(a):""},Pd=function(a,b,c){return q(a)?(a=encodeURI(a).replace(b,Xd),c&&(a=a.replace(/%25([0-9a-fA-F]{2})/g,
"%$1")),a):null},Xd=function(a){a=a.charCodeAt(0);return"%"+(a>>4&15).toString(16)+(a&15).toString(16)},Qd=/[#\/\?@]/g,Sd=/[\#\?:]/g,Rd=/[\#\?]/g,Vd=/[\#\?@]/g,Td=/#/g,Md=function(a,b,c){this.b=this.a=null;this.c=a||null;this.f=!!c},Yd=function(a){a.a||(a.a=new A,a.b=0,a.c&&Id(a.c,function(b,c){b=decodeURIComponent(b.replace(/\+/g," "));Yd(a);a.c=null;b=Zd(a,b);var d=a.a.get(b);d||a.a.set(b,d=[]);d.push(c);a.b+=1}))};Md.prototype.u=function(){Yd(this);return this.b};
Md.prototype.remove=function(a){Yd(this);a=Zd(this,a);return dc(this.a,a)?(this.c=null,this.b-=this.a.get(a).length,this.a.remove(a)):!1};Md.prototype.clear=function(){this.a=this.c=null;this.b=0};var $d=function(a,b){Yd(a);b=Zd(a,b);return dc(a.a,b)};h=Md.prototype;h.C=function(){Yd(this);for(var a=this.a.v(),b=this.a.C(),c=[],d=0;d<b.length;d++)for(var e=a[d],f=0;f<e.length;f++)c.push(b[d]);return c};
h.v=function(a){Yd(this);var b=[];if(q(a))$d(this,a)&&(b=Db(b,this.a.get(Zd(this,a))));else{a=this.a.v();for(var c=0;c<a.length;c++)b=Db(b,a[c])}return b};h.set=function(a,b){Yd(this);this.c=null;a=Zd(this,a);$d(this,a)&&(this.b-=this.a.get(a).length);this.a.set(a,[b]);this.b+=1;return this};h.get=function(a,b){a=a?this.v(a):[];return 0<a.length?String(a[0]):b};
h.toString=function(){if(this.c)return this.c;if(!this.a)return"";for(var a=[],b=this.a.C(),c=0;c<b.length;c++)for(var d=b[c],e=encodeURIComponent(String(d)),d=this.v(d),f=0;f<d.length;f++){var g=e;""!==d[f]&&(g+="="+encodeURIComponent(String(d[f])));a.push(g)}return this.c=a.join("&")};
var Zd=function(a,b){b=String(b);a.f&&(b=b.toLowerCase());return b},Ud=function(a,b){b&&!a.f&&(Yd(a),a.c=null,a.a.forEach(function(a,b){var c=b.toLowerCase();b!=c&&(this.remove(b),this.remove(c),0<a.length&&(this.c=null,this.a.set(Zd(this,c),Fb(a)),this.b+=a.length))},a));a.f=b};r("castApp.core.setupApi.ConfiguredNetworkMsg",function(a,b,c,d){this.ssid=a;this.wpa_auth=b;this.wpa_cipher=c;this.wpa_id=d});var ae=function(a,b){this.ssid=a;this.wpa_auth=b};r("castApp.core.setupApi.ConnectWiFiMsg",ae);var be=function(a,b,c,d,e,f,g,l,p,t,W){this.version=a;this.name=b;this.build_version=c;this.has_update=d;this.ssdp_udn=e;this.mac_address=f;this.connected=g;this.ssid=l;this.wpa_state=p;this.setup_state=t;this.wpa_configured=W};r("castApp.core.setupApi.EurekaInfoMsg34Base",be);
var ce=function(a,b,c,d,e,f,g,l,p,t){be.call(this,3,a,b,c,d,e,f,g,l,p,t)};u(ce,be);r("castApp.core.setupApi.EurekaInfoMsgV3",ce);ce.Location=function(a,b){this.latitude=a;this.longitude=b};var de=function(a,b,c){this.certificate=a;this.nonce=b;this.signed_data=c};ce.Sign=de;var ee=function(){};ce.Detail=ee;ee.Timezone=function(a,b){this.display_string=a;this.offset=b};ee.Locale=function(a){this.display_string=a};
var fe=function(a,b,c,d,e,f,g,l,p,t,W,zj){be.call(this,a,b,c,d,e,f,g,l,p,t,W);this.uptime=zj};u(fe,be);r("castApp.core.setupApi.EurekaInfoMsgV4",fe);
var ge=function(a){z(a,"locale","en-US");z(a,"debug_build",!1);z(a,"update_only_build",!1);z(a,"ethernet_connected",!1);z(a,"tos_accepted",!0);z(a,"time_format",0);z(a,"hdmi_control",!0);!q(a.hotspot_bssid)&&a.mac_address&&5<=a.mac_address.length&&(a.hotspot_bssid="00:1A:11:FF:"+a.mac_address.substr(a.mac_address.length-5));if(a.opt_in){var b=a.opt_in;z(b,"crash",!0);z(b,"stats",!0);z(b,"device_id",!1);z(b,"location",!1);z(b,"opencast",!1)}return a};fe.SetupStats=function(){};var he=function(){};
fe.Location=he;var ie=function(){};fe.OptIn=ie;var je=function(a,b,c){de.call(this,a,b,c)};u(je,de);fe.Sign=je;var ke=function(a){this.manufacturer="Google Inc.";this.model_name="Eureka Dongle";this.icon_list=a};u(ke,ee);fe.Detail=ke;ke.Icon=function(a,b,c,d){this.mimetype="image/png";this.width=a;this.height=b;this.depth=c;this.url=d};var le=function(){};r("castApp.core.setupApi.EurekaInfoMsgV7",le);le.BuildInfo=function(){};var me=function(){};le.DeviceInfo=me;me.Capabilities=function(){};
le.OtaStatus=function(){};le.Net=function(){};le.WiFi=function(){};var ne=function(){};le.Setup=ne;ne.Stats=function(){};var oe=function(){};le.Settings=oe;var pe=function(){};le.OptIn=pe;le.OpenCast=function(){};le.Multizone=function(){};var qe=function(a){this.wpa_id=a};r("castApp.core.setupApi.ForgetWiFiMsg",qe);r("castApp.core.setupApi.GetAppDeviceIdRequestMsg",function(a){this.app_id=a});
r("castApp.core.setupApi.GetAppDeviceIdResponseMsg",function(a,b,c){this.app_device_id=a;this.certificate=b;this.signed_data=c});r("castApp.core.setupApi.OfferMsg",function(a){this.token=a});var re=function(a){this.sound_id=a};r("castApp.core.setupApi.PlaySoundRequestMsg",re);r("castApp.core.setupApi.PlaySoundResponseMsg",function(a,b){this.volume=a;this.duration=b});var se=function(a){this.params=a};r("castApp.core.setupApi.RebootMsg",se);
var te=function(a,b,c,d,e){this.ssid=a;this.wpa_auth=b;this.wpa_cipher=c;this.bssid=d;this.signal_level=e};r("castApp.core.setupApi.ScanResultMsgBase",te);var ue=function(a,b,c,d,e,f){te.call(this,a,b,c,d,e);this.ap_list=f};u(ue,te);r("castApp.core.setupApi.ScanResultMsgV7",ue);ue.Ap=function(a,b,c){this.bssid=a;this.signal_level=b;this.frequency=c};var ve=function(){};r("castApp.core.setupApi.SaveWiFiRequestMsg",ve);r("castApp.core.setupApi.SaveWiFiResponseMsg",function(a){this.setup_state=a});
r("castApp.core.setupApi.SendLogReportRequestMsg",function(a){this.uuid=a});r("castApp.core.setupApi.SendLogReportResponseMsg",function(a){this.crash_report_id=a});var we=function(){};r("castApp.core.setupApi.SetEurekaInfoMsgBase",we);var xe=function(){};u(xe,we);r("castApp.core.setupApi.SetEurekaInfoMsgV3",xe);var ye=function(){};u(ye,we);r("castApp.core.setupApi.SetEurekaInfoMsgV4",ye);var ze=function(){};u(ze,we);r("castApp.core.setupApi.SetEurekaInfoMsgV7",ze);
r("castApp.core.setupApi.SupportedLocale",function(a,b){this.locale=a;this.display_string=b});r("castApp.core.setupApi.SupportedTimeZone",function(a,b,c){this.timezone=a;this.display_string=b;this.offset=c});var Ae=function(a){this.id=a};r("castApp.core.storage.SetupSession",Ae);var Be=function(){};r("castApp.core.storage.CommonSetupState",Be);var Ce=function(a){this.type=a.type;this.name=a.name;this.bssid=a.bssid;this.ssid=a.ssid;this.ipAddress=a.ipAddress};r("castApp.core.storage.DeviceToSetUp",Ce);var De=function(a){this.deviceIpAddress=a};r("castApp.core.storage.SetupApiClientState",De);var Ee=function(a){this.a=a};r("castApp.core.storage.ConnectWiFiState",Ee);
r("castApp.core.storage.EurekaInfoState",function(a,b,c,d,e,f,g,l){this.setupApiVersion=a;this.name=b;this.setupState=c;this.ssdpUdn=d;this.deviceType=e;this.features=f;this.ethernetConnected=g;this.tosAccepted=l});var Fe=function(a,b){this.timeStamp=a;this.verificationProperties=b};r("castApp.core.storage.VerificationState",Fe);var M=function(a){this.type=a};r("castApp.core.storage.SetupState",M);var Ge=function(a,b){this.all=b;this.current=a};r("castApp.core.storage.SetupStateCollection",Ge);
var He=function(a,b,c){this.type=a;this.time=b;this.deviceId=c},Ie=function(a){for(var b=[],c=0,d=a.length;c<d;++c){var e=a.key(c);if(e&&0==e.lastIndexOf("setupSession_",0)){var f;a:{var g=a,l=g.getItem(e);if(l)try{f=JSON.parse(l);break a}catch(p){g.removeItem(e)}f=null}f&&b.push(f)}}return b},Je=function(){var a=pa()-432E5;Ie(window.localStorage).forEach(function(b){(!b.timestamp||b.timestamp<a)&&window.localStorage.removeItem("setupSession_"+b.id)})},Ke=function(a,b){b.timestamp=pa();a.setItem("setupSession_"+
b.id,JSON.stringify(b))},Le=function(a,b){a.removeItem("setupSession_"+b.id)},Me=function(a){var b=a.getItem("setupDeviceState");if(b)try{return JSON.parse(b)}catch(c){a.removeItem("setupDeviceState")}return[]},Ne=function(a,b){0===b.length?a.removeItem("setupDeviceState"):a.setItem("setupDeviceState",JSON.stringify(b))},Oe=function(a){return"false"===a.getItem("setupAutoNetworkSwitching")?!1:!0},Pe=function(a,b){1===b?a.removeItem("castApp.analyticsOptIn"):a.setItem("castApp.analyticsOptIn",b.toString())};var Qe=function(){};Qe.prototype.a=n;Qe.prototype.g=n;Qe.prototype.b=n;Qe.prototype.f=n;var Re=function(){};u(Re,Qe);Re.prototype.b=function(){};Re.prototype.f=function(){};Re.prototype.a=function(){return G(3)};Re.prototype.g=function(){};var Se=function(a){this.h=chrome.metricsPrivate;this.c=a};u(Se,Qe);Se.prototype.b=function(a){this.h.recordUserAction("Cast.Chrome.App."+a.toString())};
Se.prototype.f=function(a){var b;switch(a.eventType){case 1:b="List";break;case 2:b="View";break;case 3:b="Redeem";break;default:return}b="Cast.Chrome.App.Offers."+b;if(m(a.offerId)){if(!ga(a.offerId)||0>a.offerId)return;b+="."+a.offerId}this.h.recordUserAction(b)};Se.prototype.a=function(){var a=parseInt(this.c.getItem("castApp.analyticsOptIn"),10);if(isNaN(a)||1>a||3<a)a=1;return G(a)};Se.prototype.g=function(a){a?(Pe(this.c,2),this.b(1)):(Pe(this.c,3),this.b(2))};var Te=function(){this.g=this.g;this.s=this.s};Te.prototype.g=!1;Te.prototype.ca=function(){this.g||(this.g=!0,this.F())};Te.prototype.F=function(){if(this.s)for(;this.s.length;)this.s.shift()()};var N=function(a,b){this.type=a;this.b=this.c=b;this.Ja=!0};N.prototype.f=function(){this.Ja=!1};var Ue=!C||9<=Number(yc),Ve=C&&!wc("9");!pc||wc("528");oc&&wc("1.9b")||C&&wc("8")||mc&&wc("9.5")||pc&&wc("528");oc&&!wc("8")||C&&wc("9");var We=function(a,b){N.call(this,a?a.type:"");this.b=this.c=null;this.button=0;this.a=this.state=null;if(a){this.type=a.type;this.c=a.target||a.srcElement;this.b=b;if((b=a.relatedTarget)&&oc)try{jc(b.nodeName)}catch(c){}this.button=a.button;this.state=a.state;this.a=a;a.defaultPrevented&&this.f()}};u(We,N);We.prototype.f=function(){We.H.f.call(this);var a=this.a;if(a.preventDefault)a.preventDefault();else if(a.returnValue=!1,Ve)try{if(a.ctrlKey||112<=a.keyCode&&123>=a.keyCode)a.keyCode=-1}catch(b){}};var Xe="closure_listenable_"+(1E6*Math.random()|0),Ye=function(a){return!(!a||!a[Xe])},Ze=0;var $e=function(a,b,c,d,e){this.listener=a;this.proxy=null;this.src=b;this.type=c;this.capture=!!d;this.ha=e;this.key=++Ze;this.removed=this.ba=!1},af=function(a){a.removed=!0;a.listener=null;a.proxy=null;a.src=null;a.ha=null};var bf=function(a){this.src=a;this.a={};this.b=0},df=function(a,b,c,d,e,f){var g=b.toString();b=a.a[g];b||(b=a.a[g]=[],a.b++);var l=cf(b,c,e,f);-1<l?(a=b[l],d||(a.ba=!1)):(a=new $e(c,a.src,g,!!e,f),a.ba=d,b.push(a));return a};bf.prototype.remove=function(a,b,c,d){a=a.toString();if(!(a in this.a))return!1;var e=this.a[a];b=cf(e,b,c,d);return-1<b?(af(e[b]),Bb(e,b),0==e.length&&(delete this.a[a],this.b--),!0):!1};
var ef=function(a,b){var c=b.type;c in a.a&&Cb(a.a[c],b)&&(af(b),0==a.a[c].length&&(delete a.a[c],a.b--))};bf.prototype.removeAll=function(a){a=a&&a.toString();var b=0,c;for(c in this.a)if(!a||c==a){for(var d=this.a[c],e=0;e<d.length;e++)++b,af(d[e]);delete this.a[c];this.b--}return b};var ff=function(a,b,c,d,e){a=a.a[b.toString()];b=-1;a&&(b=cf(a,c,d,e));return-1<b?a[b]:null},cf=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.ha==d)return e}return-1};var gf="closure_lm_"+(1E6*Math.random()|0),hf={},jf=0,kf=function(a,b,c,d,e){if(ea(b)){for(var f=0;f<b.length;f++)kf(a,b[f],c,d,e);return null}c=lf(c);return Ye(a)?a.listen(b,c,d,e):mf(a,b,c,!1,d,e)},mf=function(a,b,c,d,e,f){if(!b)throw Error("Invalid event type");var g=!!e,l=nf(a);l||(a[gf]=l=new bf(a));c=df(l,b,c,d,e,f);if(c.proxy)return c;d=of();c.proxy=d;d.src=a;d.listener=c;if(a.addEventListener)a.addEventListener(b.toString(),d,g);else if(a.attachEvent)a.attachEvent(pf(b.toString()),d);else throw Error("addEventListener and attachEvent are unavailable.");
jf++;return c},of=function(){var a=qf,b=Ue?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},rf=function(a,b,c,d,e){if(ea(b))for(var f=0;f<b.length;f++)rf(a,b[f],c,d,e);else c=lf(c),Ye(a)?df(a.c,String(b),c,!0,d,e):mf(a,b,c,!0,d,e)},sf=function(a,b,c,d,e){if(ea(b))for(var f=0;f<b.length;f++)sf(a,b[f],c,d,e);else c=lf(c),Ye(a)?a.B(b,c,d,e):a&&(a=nf(a))&&(b=ff(a,b,c,!!d,e))&&tf(b)},tf=function(a){if(ga(a)||!a||a.removed)return;var b=a.src;
if(Ye(b)){ef(b.c,a);return}var c=a.type,d=a.proxy;b.removeEventListener?b.removeEventListener(c,d,a.capture):b.detachEvent&&b.detachEvent(pf(c),d);jf--;(c=nf(b))?(ef(c,a),0==c.b&&(c.src=null,b[gf]=null)):af(a)},pf=function(a){return a in hf?hf[a]:hf[a]="on"+a},vf=function(a,b,c,d){var e=!0;if(a=nf(a))if(b=a.a[b.toString()])for(b=b.concat(),a=0;a<b.length;a++){var f=b[a];f&&f.capture==c&&!f.removed&&(f=uf(f,d),e=e&&!1!==f)}return e},uf=function(a,b){var c=a.listener,d=a.ha||a.src;a.ba&&tf(a);return c.call(d,
b)},qf=function(a,b){if(a.removed)return!0;if(!Ue){if(!b)a:{b=["window","event"];for(var c=k,d;d=b.shift();)if(null!=c[d])c=c[d];else{b=null;break a}b=c}d=b;b=new We(d,this);c=!0;if(!(0>d.keyCode||void 0!=d.returnValue)){a:{var e=!1;if(0==d.keyCode)try{d.keyCode=-1;break a}catch(g){e=!0}if(e||void 0==d.returnValue)d.returnValue=!0}d=[];for(e=b.b;e;e=e.parentNode)d.push(e);a=a.type;for(e=d.length-1;0<=e;e--){b.b=d[e];var f=vf(d[e],a,!0,b),c=c&&f}for(e=0;e<d.length;e++)b.b=d[e],f=vf(d[e],a,!1,b),c=
c&&f}return c}return uf(a,new We(b,this))},nf=function(a){a=a[gf];return a instanceof bf?a:null},wf="__closure_events_fn_"+(1E9*Math.random()>>>0),lf=function(a){if(ha(a))return a;a[wf]||(a[wf]=function(b){return a.handleEvent(b)});return a[wf]};var O=function(){Te.call(this);this.c=new bf(this);this.Pa=this;this.M=null};u(O,Te);O.prototype[Xe]=!0;var xf=function(a,b){kf(a,"originViolation",b,void 0,void 0)};O.prototype.removeEventListener=function(a,b,c,d){sf(this,a,b,c,d)};
var P=function(a,b){var c,d=a.M;if(d)for(c=[];d;d=d.M)c.push(d);a=a.Pa;d=b.type||b;if(q(b))b=new N(b,a);else if(b instanceof N)b.c=b.c||a;else{var e=b;b=new N(d,a);Ub(b,e)}var e=!0,f;if(c)for(var g=c.length-1;0<=g;g--)f=b.b=c[g],e=yf(f,d,!0,b)&&e;f=b.b=a;e=yf(f,d,!0,b)&&e;e=yf(f,d,!1,b)&&e;if(c)for(g=0;g<c.length;g++)f=b.b=c[g],e=yf(f,d,!1,b)&&e};O.prototype.F=function(){O.H.F.call(this);this.c&&this.c.removeAll(void 0);this.M=null};
O.prototype.listen=function(a,b,c,d){return df(this.c,String(a),b,!1,c,d)};O.prototype.B=function(a,b,c,d){return this.c.remove(String(a),b,c,d)};var yf=function(a,b,c,d){b=a.c.a[String(b)];if(!b)return!0;b=b.concat();for(var e=!0,f=0;f<b.length;++f){var g=b[f];if(g&&!g.removed&&g.capture==c){var l=g.listener,p=g.ha||g.src;g.ba&&ef(a.c,g);e=!1!==l.call(p,d)&&e}}return e&&0!=d.Ja};var zf=function(){x.call(this)};u(zf,x);zf.prototype.name="httpTimeout";var Af=function(a,b){var c=I(),d=function(a){c.b(a)};a.listen(b,d);return J(c.a,function(){a.B(b,d)})},Bf=function(a){if(a instanceof L)throw a;},Cf=function(a,b){var c=setTimeout(function(){a.cancel()},b);J(a,function(){clearTimeout(c);c=null});return a},Df=function(a){var b=I();Cf(b.a,a);return b};!oc&&!C||C&&9<=Number(yc)||oc&&wc("1.9.1");var Ef=C&&!wc("9");var Ff={SCRIPT:1,STYLE:1,HEAD:1,IFRAME:1,OBJECT:1},Gf={IMG:" ",BR:"\n"},If=function(a){if(Ef&&null!==a&&"innerText"in a)a=a.innerText.replace(/(\r\n|\r|\n)/g,"\n");else{var b=[];Hf(a,b,!0);a=b.join("")}a=a.replace(/ \xAD /g," ").replace(/\xAD/g,"");a=a.replace(/\u200B/g,"");Ef||(a=a.replace(/ +/g," "));" "!=a&&(a=a.replace(/^\s*/,""));return a},Hf=function(a,b,c){if(!(a.nodeName in Ff))if(3==a.nodeType)c?b.push(String(a.nodeValue).replace(/(\r\n|\r|\n)/g,"")):b.push(a.nodeValue);else if(a.nodeName in
Gf)b.push(Gf[a.nodeName]);else for(a=a.firstChild;a;)Hf(a,b,c),a=a.nextSibling};var Jf=function(){if(!C)return!1;try{return new ActiveXObject("MSXML2.DOMDocument"),!0}catch(a){return!1}},Kf=C&&Jf();var Lf=function(a){x.call(this,a)};u(Lf,x);Lf.prototype.name="chrome.runtime.lastError";var Mf=function(a,b){this.onNetworksChanged=a;this.onNetworkListChanged=b};r("castApp.core.NetworkingPrivateApi.WiFiProperties",function(){});r("castApp.core.NetworkingPrivateApi.NetworkProperties",function(){});h=Mf.prototype;h.getNetworks=n;h.getProperties=n;h.requestNetworkScan=n;h.startConnect=n;h.startDisconnect=n;h.verifyDestination=n;h.verifyAndEncryptData=n;var Nf=[[0xfa8fca000000,0xfa8fcaffffff],[111971074048,111971139583]],Of=["Chromecast","Chromecast Audio","Chromekey","Eureka Dongle"],Pf=new function(a){this.b=new A;this.a=new A;for(var b=a.length,c=0;c<b;++c)this.b.set(a[c],a[c+1]),this.a.set(a[c+1],a[c])}(["a",4,"b",2,"c",3,"d",5,"e",6,"f",1,"g",7,"h",8,"i",9,"j",10,"k",11,"l",12,"m",13]),Qf=new B(["b","c","a","m"]),Rf=new B("adghjkl".split("")),Sf=function(a){var b;if(/^([0-9a-fA-F]{2}:){5}[0-9a-fA-F]{2}$/.test(a)){b=parseInt;var c=RegExp,d;d=
":".replace(/([-()\[\]{}+?*.$\^|,:#<!\\])/g,"\\$1").replace(/\x08/g,"\\x08");c=new c(d,"g");a=a.replace(c,"");b=b(a,16)}else b=NaN;return b},Tf=function(a,b){return!(!a||!b||0!==ra(a,b))},Uf=function(a){var b=Sf(a);return!!zb(Nf,function(a){return b>=a[0]&&b<=a[1]})},Wf=function(a){return!a.WiFi||!a.WiFi.BSSID||a.WiFi.Security&&"None"!==a.WiFi.Security||!Uf(a.WiFi.BSSID)?!1:Qf.contains(Vf(a.WiFi.SSID||"").type)},Vf=function(a){var b=/^(.*)\.([^\.]*)$/.exec(a),c=null;return b&&3===b.length&&(c=Xf(b[2]))?
{name:b[1],type:c.type,subtype:c.subtype}:{name:a,type:"c",subtype:null}},Xf=function(a){a=/^([a-m])(\d{0,3})$/.exec(a);if(!a||3!==a.length)return null;var b=parseInt(a[2],10);return{type:a[1],subtype:isNaN(b)?null:b}},Yf=function(a,b){var c=new cb;c.supportsSetup=Qf.contains(a);c.supportsDisplay=!Rf.contains(a);b&&(void 0!==b.display_supported&&(c.supportsDisplay=!!b.display_supported),!1===b.setup_supported&&(c.supportsSetup=!1));return c},Zf=function(a){var b;if("undefined"!=typeof DOMParser)b=
(new DOMParser).parseFromString(a,"application/xml");else if(Kf){b=new ActiveXObject("MSXML2.DOMDocument");b.resolveExternals=!1;b.validateOnParse=!1;try{b.setProperty("ProhibitDTD",!0),b.setProperty("MaxXMLSize",2048),b.setProperty("MaxElementDepth",256)}catch(e){}b.loadXML(a)}else throw Error("Your browser does not support loading xml documents");if(!b)return null;var c=b.querySelector("root > device > manufacturer");a=b.querySelector("root > device > modelName");if(!c||!a)return null;c=If(c);a=
If(a);a="Google Inc."==c&&0<=vb(Of,a);var d=b.querySelector("root > URLBase"),c=b.querySelector("root > device > friendlyName");b=b.querySelector("root > device > UDN");if(!d||!c||!b)return null;d=If(d);d=Wd(d).a;c=If(c);b=If(b);return{name:c,ipAddress:d,udn:b,yb:a}},$f=function(a){return Pf.b.get(a)||3},ag=function(a){switch(a){case 2:case 3:case 4:return 3;case 5:case 6:return 4;case 7:case 8:return 5}return 2},bg=function(a){switch(a){case 2:return 1;case 3:return 2;case 4:return 5;case 5:return 7}return 0},
cg=function(a){switch(a){case chrome.cast.media.PlayerState.PLAYING:return 2;case chrome.cast.media.PlayerState.PAUSED:return 3;case chrome.cast.media.PlayerState.BUFFERING:return 4}return 1},dg=function(a){switch(a){case chrome.cast.SessionStatus.CONNECTED:return 1;case chrome.cast.SessionStatus.STOPPED:return 3}return 2},eg=function(a){var b=2;1===a.b?b=3:2===a.b&&(b=4);b=new Ya(b,[],null);b.selectedNetwork=new Xa(a.c||null,a.a.ssid,ag(a.a.wpa_auth));a.c&&b.networks.push(b.selectedNetwork);return b},
fg=function(a,b,c){switch(a){case 3:return c=new xe,c.name=b,c;case 4:case 5:case 6:return a=new ye,a.name=b,a.opt_in=new ie,a.opt_in.crash=a.opt_in.stats=c,a;default:return a=new ze,a.name=b,a.opt_in=new pe,a.opt_in.stats=c,a}},gg=function(a){return"E8C28D3C"==a||"00000000-0000-0000-0000-000000000000"==a};var hg=function(){};hg.prototype.c=n;var jg=function(){this.b={};this.a={};ig||(ig=new F(function(a,b){window.__onGCastApiAvailable=function(c){c?a():b()}.bind(this);var c=document.createElement("script");c.setAttribute("src",chrome.extension.getURL("cast_sender.js"));document.head.appendChild(c)}.bind(this)))};u(jg,hg);var ig=null;
jg.prototype.c=function(a,b,c){return ig.then(function(){var d=a+b,e=this.b[d];if(e)return e.a;e=Df(c||2E3);this.b[d]=e;var f=this.a[d];f||(f=new chrome.cast.SessionRequest(a),f=new chrome.cast.ApiConfig(f,this.f.bind(this),ba,chrome.cast.AutoJoinPolicy.CUSTOM_CONTROLLER_SCOPED),f.invisibleSender=!gg(a),f=chrome.cast.initializeWithContext(f,ba,function(){}.bind(this)),this.a[d]=f);chrome.cast.requestSessionByIdWithContext(f,b);return e.a}.bind(this))};
jg.prototype.f=function(a){var b=a.appId+a.sessionId,c=this.b[b];c&&c.b({session:a,context:this.a[b]})};var kg=function(){Mf.call(this,chrome.networkingPrivate.onNetworksChanged,chrome.networkingPrivate.onNetworkListChanged)};u(kg,Mf);ca(kg);var lg=function(a){return chrome.runtime.lastError?(a.c(new Lf(chrome.runtime.lastError.message)),!0):!1};h=kg.prototype;h.getNetworks=function(a){var b=I();chrome.networkingPrivate.getNetworks(a,function(a){lg(b)||b.b(a)});return b.a};h.getProperties=function(a){var b=I();chrome.networkingPrivate.getProperties(a,function(a){lg(b)||b.b(a)});return b.a};
h.requestNetworkScan=function(){chrome.networkingPrivate.requestNetworkScan()};h.startConnect=function(a){var b=I();chrome.networkingPrivate.startConnect(a,function(){lg(b)||b.b()});return b.a};h.startDisconnect=function(a){var b=I();chrome.networkingPrivate.startDisconnect(a,function(){lg(b)||b.b()});return b.a};h.verifyDestination=function(a){var b=I();chrome.networkingPrivate.verifyDestination(a,function(a){lg(b)||b.b(a)});return b.a};
h.verifyAndEncryptData=function(a,b){var c=I();chrome.networkingPrivate.verifyAndEncryptData(a,b,function(a){lg(c)||c.b(a)});return c.a};var mg=function(){this.a=new B},ng=function(a,b){gc(a.a,b);return J(b,function(){this.a.remove(b)}.bind(a))},og=function(a){if(0==a.a.a.c)return G();var b=a.a;a.a=new B;return new F(function(a){Zb(b,function(c){J(c,function(){b.remove(c)&&0==b.a.c&&a()});c.cancel()})})};var Q=function(a,b){this.h=a;this.g=b;this.f=new mg;this.c=new O;this.a="stopped"};Q.prototype.getState=function(){return this.a};Q.prototype.b=function(a){a!==this.a&&(this.a=a,P(this.c,a))};Q.prototype.start=function(){switch(this.a){case "stopped":case "stopping":return this.restart();case "starting":case "stoppingStartPending":return pg(this);case "started":return G();default:return G()}};
Q.prototype.restart=function(){switch(this.a){case "starting":case "started":this.b("stoppingStartPending");qg(this);break;case "stopping":this.b("stoppingStartPending");break;case "stopped":this.b("starting"),rg(this)}return pg(this)};var pg=function(a){var b=new mg;return J(K(new F(function(a,d){ng(b,Af(this.c,"started")).then(function(){a()});ng(b,Af(this.c,"stopped")).then(function(){d()})}.bind(a)),function(a){a instanceof L&&this.stop();throw a;},a),function(){og(b)})};
Q.prototype.stop=function(){if("stopped"===this.a)return G();var a=this.a;this.b("stopping");"starting"!==a&&"started"!==a||qg(this);return Af(this.c,"stopped")};
var R=function(a,b){if("starting"===a.a||"started"===a.a)return ng(a.f,b),b;b.cancel();return H(new L)},sg=function(a){return"started"===a.a?G():Af(a.c,"started")},qg=function(a){og(a.f).then(function(){try{if(this.g)return this.g()}catch(b){}}.bind(a)).then(function(){"stoppingStartPending"===this.a?(this.b("starting"),rg(this)):this.b("stopped")}.bind(a))},rg=function(a){var b=null;try{b=a.h()}catch(c){b=H(c)}"starting"!==a.a?b.cancel():K(ng(a.f,b).then(a.b.bind(a,"started")),function(){this.stop()}.bind(a))};var tg=function(){this.a={};this.b={};this.f=new B};tg.prototype.sendMessage=function(a){a.responseTo?this.f.contains(a.responseTo)&&(this.f.remove(a.responseTo),this.c(a)):this.c(a)};tg.prototype.sendRequest=function(a,b){var c=I();this.a[a.requestId]={O:c,La:b?setTimeout(na(this.i,this,a.requestId),b):null};this.c(a);return c.a};tg.prototype.i=function(a){a in this.a&&(this.a[a].O.a.cancel(),delete this.a[a])};tg.prototype.addListener=function(a,b){var c=this.b[a];c||(c=this.b[a]=new B);gc(c,b)};
var ug=function(a,b){var c=I(),d=na(function(a){c.b(a)},a);a.addListener(b,d);return J(c.a,function(){this.removeListener(b,d)}.bind(a))};tg.prototype.removeListener=function(a,b){(a=this.b[a])&&a.remove(b)};tg.prototype.c=n;var vg=function(a,b){if(b.requestId)gc(a.f,b.requestId);else if(b.responseTo){var c=a.a[b.responseTo];c&&(delete a.a[b.responseTo],null!==c.La&&clearTimeout(c.La),b instanceof wa?c.O.c(b):c.O.b(b))}var d=a.b[b.type];d&&d.v().forEach(function(a){d.contains(a)&&a(b)})};var wg=function(a,b,c,d){tg.call(this);this.g="object"===typeof b?b:null;this.j="function"===typeof b?b:null;this.h=c;this.m=d||ba;a.addEventListener("message",this.l.bind(this))};u(wg,tg);wg.prototype.l=function(a){a.origin===this.h?vg(this,a.data):this.m()};wg.prototype.c=function(a){this.g=this.g||this.j();this.g.postMessage(a,this.h)};var xg=!1;var yg=function(a,b,c,d){this.f=new O;this.i=new Q(c,d);this.c=a;this.D=b+"/v5";this.A=b;this.h=[]},zg=function(){N.call(this,"redirect")};u(zg,N);yg.prototype.start=function(){return this.i.start().then(this.b.bind(this))};yg.prototype.stop=function(){return this.i.stop()};yg.prototype.b=n;yg.prototype.l=function(a){0<=vb(this.h,a)||this.h.push(a)};
var Ag=function(a){var b=a.localStorage.getItem("castApp.uiOrigin")||"https://castappui.google.com";yg.call(this,a,b,this.s.bind(this),this.m.bind(this));this.g=this.a=null;this.j=[["newwindow",this.w.bind(this)],["loadredirect",this.o.bind(this)]]};u(Ag,yg);var Bg=["exit","loadabort","unresponsive"];Ag.prototype.b=function(){return this.g};
var Cg=function(a){var b=setInterval(function(){document.activeElement===this.a?clearInterval(b):this.a.focus()}.bind(a),20);window.addEventListener("focus",a.a.focus.bind(a.a),!0)};
Ag.prototype.s=function(){var a=this,b=I(),c=b.c.bind(b),d=a.c.document.querySelector("#cast-app-ui");d||(d=a.c.document.createElement("webview"),d.setAttribute("id","cast-app-ui"),d.setAttribute("src",a.D));Bg.forEach(function(a){d.addEventListener(a,c)});var e=function(){var c=d.contentWindow;a.a=d;a.g=new wg(a.c,c,a.A,function(){P(a.f,new N("originViolation"))});b.b();Cg(a)};d.addEventListener("contentload",e);J(b.a,function(){Bg.forEach(function(a){d.removeEventListener(a,c)});d.removeEventListener("contentload",
e)});a.j.forEach(function(a){d.addEventListener.apply(d,a)});d.parentElement||a.c.document.body.appendChild(d);a.a=d;return b.a};Ag.prototype.m=function(){this.g=null;if(this.a&&this.a.parentElement){var a=this.a;this.a=null;a.parentElement.removeChild(a);this.j.forEach(function(b){a.removeEventListener.apply(a,b)})}return G()};Ag.prototype.o=function(){P(this.f,new zg)};
Ag.prototype.w=function(a){var b=a.targetUrl,c=a.windowOpenDisposition,d=Wd(b),e=d.f,f=d.a,d="https"===e&&("www.google.com"===f||"support.google.com"===f||"chromecast.com"===f)||"http"===e&&Wc(f)&&8008===d.h&&"/setup/NOTICE.html.gz"===d.c;!d&&0<=vb(this.h,b)&&(d=!0);e="new_foreground_tab"===c;d&&(e||"new_background_tab"===c)&&chrome.tabs.create({url:b,active:e});a.window.discard()};var Dg=function(a,b,c,d,e,f,g,l,p,t,W){this.b=b;this.g=c;this.f=a.localStorage;this.l=d;this.c=e;this.m=p;this.j=f;this.reload=g;this.i=l;this.h=t;this.a=W};var Eg=function(a,b,c,d){this.c=a;this.f=b;this.a=this.b=a;this.g=c||0;this.h=d||2};Eg.prototype.reset=function(){this.a=this.b=this.c};var Fg=function(a){a.a=Math.min(a.f,a.a*a.h);a.b=Math.min(a.f,a.a+(a.g?Math.round(a.g*(Math.random()-.5)*2*a.a):0))};var Gg=function(a,b,c){if(ha(a))c&&(a=na(a,c));else if(a&&"function"==typeof a.handleEvent)a=na(a.handleEvent,a);else throw Error("Invalid listener argument");return 2147483647<Number(b)?-1:k.setTimeout(a,b||0)},S=function(a){var b=null;return K(new F(function(c,d){b=Gg(function(){c(void 0)},a);-1==b&&d(Error("Failed to schedule timer."))}),function(a){k.clearTimeout(b);throw a;})};var Hg=function(a,b){this.type="cast_app";this.originId=window["castApp.eventPage.Message.OriginID"]||void 0;this.subtype=a;this.devices=b;this.deviceJustSetUp=void 0};r("castApp.eventPage.Message",Hg);Hg.DeviceData=function(a,b,c){this.ipAddress=a;this.appId=b;this.sessionId=c};var Ig=function(a,b,c,d){this.ipAddress=a;this.name=b;this.udn=c;this.modelName=d};Hg.DeviceJustSetUp=Ig;var Jg=function(){O.call(this)};u(Jg,O);var Kg=function(a){N.call(this,a.subtype);this.a=a};u(Kg,N);Jg.prototype.sendMessage=n;Jg.prototype.a=n;var Lg=function(){this.b=new Eg(100,6E4);this.f=null;O.call(this)};u(Lg,Jg);var Mg=null;
Lg.prototype.start=function(){if(!Mg){var a=this;chrome.runtime.onMessage.addListener(a.h.bind(a));Mg=K(J(new F(function(b,c){chrome.runtime.getBackgroundPage(function(){chrome.runtime.lastError?c(new Lf(chrome.runtime.lastError.message)):(window["castApp.eventPage.Message.OriginID"]=sa(),Ng(a),Af(a,"serviceReady").then(b,c))})}),function(){clearTimeout(a.f)}),function(a){throw a;})}return Mg};var Ng=function(a){Og("serviceCheck");a.f=setTimeout(function(){Ng(this)}.bind(a),a.b.b);Fg(a.b)};
Lg.prototype.sendMessage=function(a){return this.start().then(function(){Og(a)}.bind(this))};var Og=function(a){chrome.runtime.sendMessage(ia(a)?a:new Hg(a))};Lg.prototype.a=function(){this.sendMessage("startDeviceMonitor")};Lg.prototype.h=function(a){"object"===typeof a&&"cast_app"===a.type&&P(this,new Kg(a));return!1};var Pg=function(a){return(a=a.match(/^\w{2,3}([-_]|$)/))?a[0].replace(/[_-]/g,""):""},Qg=function(a){return(a=a.match(/[-_]([a-zA-Z]{2}|\d{3})([-_]|$)/))?a[0].replace(/[_-]/g,""):""};var Rg=y("Firefox"),Sg=Ob()||y("iPod"),Tg=y("iPad"),Ug=y("Android")&&!(Vb()||y("Firefox")||y("Opera")||y("Silk")),Vg=Vb(),Wg=y("Safari")&&!(Vb()||y("Coast")||y("Opera")||y("Edge")||y("Silk")||y("Android"))&&!(Ob()||y("iPad")||y("iPod"));var Xg=function(a){return(a=a.exec(Lb))?a[1]:""},Yg=function(){if(Rg)return Xg(/Firefox\/([0-9.]+)/);if(C||nc||mc)return vc;if(Vg)return Xg(/Chrome\/([0-9.]+)/);if(Wg&&!(Ob()||y("iPad")||y("iPod")))return Xg(/Version\/([0-9.]+)/);if(Sg||Tg){var a=/Version\/(\S+).*Mobile\/(\S+)/.exec(Lb);if(a)return a[1]+"."+a[2]}else if(Ug)return(a=Xg(/Android\s+([0-9.]+)/))?a:Xg(/Version\/([0-9.]+)/);return""}();var Zg=null,$g=null,bh=function(a){var b=[];ah(a,function(a){b.push(a)});return b},ah=function(a,b){function c(b){for(;d<a.length;){var c=a.charAt(d++),e=$g[c];if(null!=e)return e;if(!/^[\s\xa0]*$/.test(c))throw Error("Unknown base64 encoding at char: "+c);}return b}ch();for(var d=0;;){var e=c(-1),f=c(0),g=c(64),l=c(64);if(64===l&&-1===e)break;b(e<<2|f>>4);64!=g&&(b(f<<4&240|g>>2),64!=l&&b(g<<6&192|l))}},ch=function(){if(!Zg){Zg={};$g={};for(var a=0;65>a;a++)Zg[a]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(a),
$g[Zg[a]]=a,62<=a&&($g["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.".charAt(a)]=a)}};var dh=function(){this.b=-1};dh.prototype.reset=n;dh.prototype.update=n;dh.prototype.i=n;var eh=function(){this.b=64;this.a=[];this.h=[];this.j=[];this.f=[];this.f[0]=128;for(var a=1;a<this.b;++a)this.f[a]=0;this.g=this.c=0;this.reset()};u(eh,dh);eh.prototype.reset=function(){this.a[0]=1732584193;this.a[1]=4023233417;this.a[2]=2562383102;this.a[3]=271733878;this.a[4]=3285377520;this.g=this.c=0};
var fh=function(a,b,c){c||(c=0);var d=a.j;if(q(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(e=16;80>e;e++){var f=d[e-3]^d[e-8]^d[e-14]^d[e-16];d[e]=(f<<1|f>>>31)&4294967295}b=a.a[0];c=a.a[1];for(var g=a.a[2],l=a.a[3],p=a.a[4],t,e=0;80>e;e++)40>e?20>e?(f=l^c&(g^l),t=1518500249):(f=c^g^l,t=1859775393):60>e?(f=c&g|l&(c|g),t=2400959708):(f=c^g^l,t=3395469782),
f=(b<<5|b>>>27)+f+p+t+d[e]&4294967295,p=l,l=g,g=(c<<30|c>>>2)&4294967295,c=b,b=f;a.a[0]=a.a[0]+b&4294967295;a.a[1]=a.a[1]+c&4294967295;a.a[2]=a.a[2]+g&4294967295;a.a[3]=a.a[3]+l&4294967295;a.a[4]=a.a[4]+p&4294967295};
eh.prototype.update=function(a,b){if(null!=a){m(b)||(b=a.length);for(var c=b-this.b,d=0,e=this.h,f=this.c;d<b;){if(0==f)for(;d<=c;)fh(this,a,d),d+=this.b;if(q(a))for(;d<b;){if(e[f]=a.charCodeAt(d),++f,++d,f==this.b){fh(this,e);f=0;break}}else for(;d<b;)if(e[f]=a[d],++f,++d,f==this.b){fh(this,e);f=0;break}}this.c=f;this.g+=b}};
eh.prototype.i=function(){var a=[],b=8*this.g;56>this.c?this.update(this.f,56-this.c):this.update(this.f,this.b-(this.c-56));for(var c=this.b-1;56<=c;c--)this.h[c]=b&255,b/=256;fh(this,this.h);for(c=b=0;5>c;c++)for(var d=24;0<=d;d-=8)a[b]=this.a[c]>>d&255,++b;return a};var gh=function(a,b){if(b+1>=a.length)return null;if(!(a[b+1]&128))return{length:a[b+1],ra:1};var c=a[b+1]&127;if(b+c+1>=a.length||2<c)return null;for(var d=0,e=2;e<=c+1;e++)d=d<<8|a[b+e];return{length:d,ra:c+1}},hh=function(a){var b=[{action:"step",code:48,optional:!1},{action:"step",code:48,optional:!1},{action:"skip",code:160,optional:!0},{action:"skip",code:2,optional:!1},{action:"skip",code:48,optional:!1},{action:"skip",code:48,optional:!1},{action:"skip",code:48,optional:!1},{action:"skip",
code:48,optional:!1},{action:"return",code:48,optional:!1}],c=0,d=-1;if(65535<a.length)return null;for(;b.length;){var e=b.shift();d++;if(a[c]!=e.code){if(e.optional)continue;break}var f=gh(a,c);if(!f)break;var g=c+f.length+f.ra;if(g>=a.length)break;switch(e.action){case "step":c+=f.ra+1;continue;case "skip":c=g+1;continue;case "return":return Hb(a,c,g+1);default:return null}}return null},ih=function(a){for(var b=a.length,c=0,d=0;d<b-1;d++)c+=a[d];c=(a[b-1]+16*c)%24;a=65+c;73<=a&&a++;79<=a&&a++;return String.fromCharCode(a)},
jh=function(a){return String.fromCharCode(50+a[a.length-1]%8)},kh=function(a,b){for(var c=[],d=0;4>d;d++)c[d]=a[b+d]^a[16+d];return c};var lh=function(a){this.a=a};lh.prototype.f=n;lh.prototype.c=n;lh.prototype.b=n;
var mh=function(a,b,c,d){if(!a.f(d))return H();var e=a.b(d.bssid);if(!e||!a.c(c))return H();a=b.verifyDestination(e);K(a,function(){});return a.then(function(a){if(!a)return H();a=new Fe((new Date).getTime(),e);var b;var c=e.certificate.replace(/[\r\n]/g,""),c=c.replace("-----BEGIN CERTIFICATE-----",""),c=c.replace("-----END CERTIFICATE-----","");try{b=bh(c)}catch(p){b=null}b?(b=hh(b))?(c=new eh,c.update(b),(b=c.i())?(c=[],c[0]=ih(kh(b,0)),c[1]=jh(kh(b,4)),c[2]=ih(kh(b,8)),c[3]=jh(kh(b,12)),b=c):
b=null):b=null:b=null;if(!b)return H();a.pin=b;return a})},nh=function(a){this.a=a};u(nh,lh);nh.prototype.f=function(a){return a.ssid===this.a.name};nh.prototype.c=function(){return!0};
nh.prototype.b=function(a){var b=this.a,c={};if(!(b.public_key&&b.ssdp_udn&&b.name&&b.sign&&b.sign.certificate&&b.sign.nonce&&b.sign.signed_data))return null;c.certificate=b.sign.certificate;c.publicKey=b.public_key;c.nonce=b.sign.nonce;c.signedData=b.sign.signed_data;c.deviceSerial=b.ssdp_udn;c.deviceSsid=b.name;c.deviceBssid=a;return c};var oh=function(a){this.a=a};u(oh,lh);oh.prototype.f=function(a){var b=this.a.hotspot_bssid.toLowerCase();return a.ssid===this.a.name&&a.bssid.toLowerCase()===b};
oh.prototype.c=function(a){return!(!this.a.sign||this.a.sign.nonce!==a)};
oh.prototype.b=function(){var a=this.a,b={};if(!(a.public_key&&a.ssdp_udn&&a.name&&a.sign&&a.sign.certificate&&a.sign.nonce&&a.sign.signed_data&&a.hotspot_bssid))return null;b.certificate=a.sign.certificate;b.publicKey=a.public_key;b.nonce=a.sign.nonce;b.signedData=a.sign.signed_data;b.deviceSerial=a.ssdp_udn;b.deviceSsid=a.name;b.deviceBssid=a.hotspot_bssid;a.sign.intermediate_certs&&0<=ua(Yg,42)&&(b.intermediateCertificates=a.sign.intermediate_certs);return b};var ph=function(a){this.a=a};
u(ph,lh);ph.prototype.f=function(a){var b=this.a;if(!b.name||!b.device_info||!b.device_info.hotspot_bssid)return!1;var c=b.name;b.setup&&b.setup.ssid_suffix&&"c"!==b.setup.ssid_suffix&&(c+="."+b.setup.ssid_suffix);return a.ssid===c&&Tf(b.device_info.hotspot_bssid,a.bssid)};ph.prototype.c=function(a){return!(!this.a.sign||this.a.sign.nonce!==a)};
ph.prototype.b=function(){var a=this.a,b={};if(!(a.name&&a.device_info&&a.device_info.public_key&&a.device_info.ssdp_udn&&a.device_info.hotspot_bssid&&a.sign&&a.sign.certificate&&a.sign.nonce&&a.sign.signed_data))return null;b.certificate=a.sign.certificate;b.publicKey=a.device_info.public_key;b.nonce=a.sign.nonce;b.signedData=a.sign.signed_data;b.deviceSerial=a.device_info.ssdp_udn;b.deviceSsid=a.name;b.deviceBssid=a.device_info.hotspot_bssid;a.sign.intermediate_certs&&0<=ua(Yg,42)&&(b.intermediateCertificates=
a.sign.intermediate_certs);return b};var rh=function(){this.a=qh},sh=function(a,b,c){if(null==b)c.push("null");else{if("object"==typeof b){if(ea(b)){var d=b;b=d.length;c.push("[");for(var e="",f=0;f<b;f++)c.push(e),e=d[f],sh(a,a.a?a.a.call(d,String(f),e):e,c),e=",";c.push("]");return}if(b instanceof String||b instanceof Number||b instanceof Boolean)b=b.valueOf();else{c.push("{");f="";for(d in b)Object.prototype.hasOwnProperty.call(b,d)&&(e=b[d],"function"!=typeof e&&(c.push(f),th(d,c),c.push(":"),sh(a,a.a?a.a.call(b,d,e):e,c),f=","));
c.push("}");return}}switch(typeof b){case "string":th(b,c);break;case "number":c.push(isFinite(b)&&!isNaN(b)?String(b):"null");break;case "boolean":c.push(String(b));break;case "function":c.push("null");break;default:throw Error("Unknown type: "+typeof b);}}},uh={'"':'\\"',"\\":"\\\\","/":"\\/","\b":"\\b","\f":"\\f","\n":"\\n","\r":"\\r","\t":"\\t","\x0B":"\\u000b"},vh=/\uffff/.test("\uffff")?/[\\\"\x00-\x1f\x7f-\uffff]/g:/[\\\"\x00-\x1f\x7f-\xff]/g,th=function(a,b){b.push('"',a.replace(vh,function(a){var b=
uh[a];b||(b="\\u"+(a.charCodeAt(0)|65536).toString(16).substr(1),uh[a]=b);return b}),'"')};var wh=function(){};wh.prototype.b=null;wh.prototype.a=n;var xh=function(a){return a.b||(a.b=a.f())};wh.prototype.f=n;var yh,zh=function(){};u(zh,wh);zh.prototype.a=function(){var a=Ah(this);return a?new ActiveXObject(a):new XMLHttpRequest};zh.prototype.f=function(){var a={};Ah(this)&&(a[0]=!0,a[1]=!0);return a};
var Ah=function(a){if(!a.c&&"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.c=d}catch(e){}}throw Error("Could not create ActiveXObject. ActiveX might be disabled, or MSXML might not be installed");}return a.c};yh=new zh;var T=function(a){O.call(this);this.headers=new A;this.A=a||null;this.b=!1;this.w=this.a=null;this.J="";this.h=0;this.f=this.I=this.m=this.D=!1;this.l=0;this.o=null;this.j="";this.T=this.i=!1};u(T,O);var Bh=/^https?$/i,Ch=["POST","PUT"];T.prototype.Ea=function(){return this.j};T.prototype.Fa=function(){return this.i};
T.prototype.send=function(a,b,c,d){if(this.a)throw Error("[goog.net.XhrIo] Object is active with another request="+this.J+"; newUri="+a);b=b?b.toUpperCase():"GET";this.J=a;this.h=0;this.D=!1;this.b=!0;this.a=this.A?this.A.a():yh.a();this.w=this.A?xh(this.A):xh(yh);this.a.onreadystatechange=na(this.xa,this);try{this.I=!0,this.a.open(b,String(a),!0),this.I=!1}catch(f){Dh(this);return}a=c||"";var e=new A(this.headers);d&&fc(d,function(a,b){e.set(b,a)});d=zb(e.C(),Eh);c=k.FormData&&a instanceof k.FormData;
!(0<=vb(Ch,b))||d||c||e.set("Content-Type","application/x-www-form-urlencoded;charset=utf-8");e.forEach(function(a,b){this.a.setRequestHeader(b,a)},this);this.j&&(this.a.responseType=this.j);"withCredentials"in this.a&&this.a.withCredentials!==this.i&&(this.a.withCredentials=this.i);try{Fh(this),0<this.l&&((this.T=Gh(this.a))?(this.a.timeout=this.l,this.a.ontimeout=na(this.Z,this)):this.o=Gg(this.Z,this.l,this)),this.m=!0,this.a.send(a),this.m=!1}catch(f){Dh(this)}};
var Gh=function(a){return C&&wc(9)&&ga(a.timeout)&&m(a.ontimeout)},Eh=function(a){return"content-type"==a.toLowerCase()};T.prototype.Z=function(){"undefined"!=typeof aa&&this.a&&(this.h=8,P(this,"timeout"),this.abort(8))};var Dh=function(a){a.b=!1;a.a&&(a.f=!0,a.a.abort(),a.f=!1);a.h=5;Hh(a);Ih(a)},Hh=function(a){a.D||(a.D=!0,P(a,"complete"),P(a,"error"))};T.prototype.abort=function(a){this.a&&this.b&&(this.b=!1,this.f=!0,this.a.abort(),this.f=!1,this.h=a||7,P(this,"complete"),P(this,"abort"),Ih(this))};
T.prototype.F=function(){this.a&&(this.b&&(this.b=!1,this.f=!0,this.a.abort(),this.f=!1),Ih(this,!0));T.H.F.call(this)};T.prototype.xa=function(){this.g||(this.I||this.m||this.f?Jh(this):this.Qa())};T.prototype.Qa=function(){Jh(this)};
var Jh=function(a){if(a.b&&"undefined"!=typeof aa&&(!a.w[1]||4!=Kh(a)||2!=a.getStatus()))if(a.m&&4==Kh(a))Gg(a.xa,0,a);else if(P(a,"readystatechange"),4==Kh(a)){a.b=!1;try{Lh(a)?(P(a,"complete"),P(a,"success")):(a.h=6,a.getStatus(),Hh(a))}finally{Ih(a)}}},Ih=function(a,b){if(a.a){Fh(a);var c=a.a,d=a.w[0]?ba:null;a.a=null;a.w=null;b||P(a,"ready");try{c.onreadystatechange=d}catch(e){}}},Fh=function(a){a.a&&a.T&&(a.a.ontimeout=null);ga(a.o)&&(k.clearTimeout(a.o),a.o=null)},Lh=function(a){var b=a.getStatus(),
c;a:switch(b){case 200:case 201:case 202:case 204:case 206:case 304:case 1223:c=!0;break a;default:c=!1}if(!c){if(b=0===b)a=String(a.J).match(Hd)[1]||null,!a&&k.self&&k.self.location&&(a=k.self.location.protocol,a=a.substr(0,a.length-1)),b=!Bh.test(a?a.toLowerCase():"");c=b}return c},Kh=function(a){return a.a?a.a.readyState:0};T.prototype.getStatus=function(){try{return 2<Kh(this)?this.a.status:-1}catch(a){return-1}};T.prototype.V=function(){try{return this.a?this.a.responseText:""}catch(a){return""}};
T.prototype.getResponseHeader=function(a){return this.a&&4==Kh(this)?this.a.getResponseHeader(a):void 0};var Mh=function(a){var b={};a=(a.a&&4==Kh(a)?a.a.getAllResponseHeaders():"").split("\r\n");for(var c=0;c<a.length;c++)if(!/^[\s\xa0]*$/.test(a[c])){var d;d=2;for(var e=a[c].split(": "),f=[];0<d&&e.length;)f.push(e.shift()),d--;e.length&&f.push(e.join(": "));d=f;b[d[0]]=b[d[0]]?b[d[0]]+(", "+d[1]):d[1]}return b};var Nh=function(a){Te.call(this);this.b=a;this.a={}};u(Nh,Te);var Oh=[];h=Nh.prototype;h.listen=function(a,b,c,d){ea(b)||(b&&(Oh[0]=b.toString()),b=Oh);for(var e=0;e<b.length;e++){var f=kf(a,b[e],c||this.handleEvent,d||!1,this.b||this);if(!f)break;this.a[f.key]=f}return this};
h.B=function(a,b,c,d,e){if(ea(b))for(var f=0;f<b.length;f++)this.B(a,b[f],c,d,e);else c=c||this.handleEvent,e=e||this.b||this,c=lf(c),d=!!d,b=Ye(a)?ff(a.c,String(b),c,d,e):a?(a=nf(a))?ff(a,b,c,d,e):null:null,b&&(tf(b),delete this.a[b.key]);return this};h.removeAll=function(){Pb(this.a,function(a,b){this.a.hasOwnProperty(b)&&tf(a)},this);this.a={}};h.F=function(){Nh.H.F.call(this);this.removeAll()};h.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented");};var Ph=function(){this.b=[];this.a=[]},Qh=function(a){0==a.b.length&&(a.b=a.a,a.b.reverse(),a.a=[]);return a.b.pop()};h=Ph.prototype;h.u=function(){return this.b.length+this.a.length};h.clear=function(){this.b=[];this.a=[]};h.contains=function(a){return 0<=vb(this.b,a)||0<=vb(this.a,a)};h.remove=function(a){var b;b=this.b;var c=wb(b,a);0<=c?(Bb(b,c),b=!0):b=!1;return b||Cb(this.a,a)};
h.v=function(){for(var a=[],b=this.b.length-1;0<=b;--b)a.push(this.b[b]);for(var c=this.a.length,b=0;b<c;++b)a.push(this.a[b]);return a};var Rh=function(a,b){Te.call(this);this.l=a||0;this.c=b||10;if(this.l>this.c)throw Error("[goog.structs.Pool] Min can not be greater than max");this.a=new Ph;this.b=new B;this.i=null;this.$()};u(Rh,Te);Rh.prototype.ea=function(){var a=pa();if(!(null!=this.i&&0>a-this.i)){for(var b;0<this.a.u()&&(b=Qh(this.a),!this.j(b));)this.$();!b&&this.u()<this.c&&(b=this.h());b&&(this.i=a,gc(this.b,b));return b}};Rh.prototype.U=function(a){this.b.remove(a);this.j(a)&&this.u()<this.c?this.a.a.push(a):Sh(a)};
Rh.prototype.$=function(){for(var a=this.a;this.u()<this.l;){var b=this.h();a.a.push(b)}for(;this.u()>this.c&&0<this.a.u();)Sh(Qh(a))};Rh.prototype.h=function(){return{}};var Sh=function(a){if("function"==typeof a.ca)a.ca();else for(var b in a)a[b]=null};Rh.prototype.j=function(a){return"function"==typeof a.Sa?a.Sa():!0};Rh.prototype.contains=function(a){return this.a.contains(a)||this.b.contains(a)};Rh.prototype.u=function(){return this.a.u()+this.b.u()};
Rh.prototype.F=function(){Rh.H.F.call(this);if(0<this.b.u())throw Error("[goog.structs.Pool] Objects not released");delete this.b;for(var a=this.a;0!=a.b.length||0!=a.a.length;)Sh(Qh(a));delete this.a};var Th=function(a,b){this.a=a;this.b=b};var Uh=function(a){this.a=[];if(a)a:{var b;if(a instanceof Uh){if(b=a.C(),a=a.v(),0>=this.u()){for(var c=this.a,d=0;d<b.length;d++)c.push(new Th(b[d],a[d]));break a}}else b=Rb(a),a=Qb(a);for(d=0;d<b.length;d++)Vh(this,b[d],a[d])}},Vh=function(a,b,c){var d=a.a;d.push(new Th(b,c));b=d.length-1;a=a.a;for(c=a[b];0<b;)if(d=b-1>>1,a[d].a>c.a)a[b]=a[d],b=d;else break;a[b]=c};h=Uh.prototype;
h.remove=function(){var a=this.a,b=a.length,c=a[0];if(!(0>=b)){if(1==b)Ab(a);else{a[0]=a.pop();for(var a=0,b=this.a,d=b.length,e=b[a];a<d>>1;){var f=2*a+1,g=2*a+2,f=g<d&&b[g].a<b[f].a?g:f;if(b[f].a>e.a)break;b[a]=b[f];a=f}b[a]=e}return c.b}};h.v=function(){for(var a=this.a,b=[],c=a.length,d=0;d<c;d++)b.push(a[d].b);return b};h.C=function(){for(var a=this.a,b=[],c=a.length,d=0;d<c;d++)b.push(a[d].a);return b};h.u=function(){return this.a.length};h.clear=function(){Ab(this.a)};var Wh=function(){Uh.call(this)};u(Wh,Uh);var Xh=function(a,b){this.f=new Wh;Rh.call(this,a,b)};u(Xh,Rh);h=Xh.prototype;h.ea=function(a,b){if(!a)return Xh.H.ea.call(this);Vh(this.f,m(b)?b:100,a);this.qa()};h.qa=function(){for(var a=this.f;0<a.u();){var b=this.ea();if(b)a.remove().apply(this,[b]);else break}};h.U=function(a){Xh.H.U.call(this,a);this.qa()};h.$=function(){Xh.H.$.call(this);this.qa()};h.F=function(){Xh.H.F.call(this);k.clearTimeout(void 0);this.f.clear();this.f=null};var Yh=function(a,b,c,d){this.m=a;this.o=!!d;Xh.call(this,b,c)};u(Yh,Xh);Yh.prototype.h=function(){var a=new T,b=this.m;b&&b.forEach(function(b,d){a.headers.set(d,b)});this.o&&(a.i=!0);return a};Yh.prototype.j=function(a){return!a.g&&!a.a};var Zh=function(a,b,c,d,e,f){O.call(this);this.i=m(a)?a:1;this.h=m(e)?Math.max(0,e):0;this.j=!!f;this.b=new Yh(b,c,d,f);this.a=new A;this.f=new Nh(this)};u(Zh,O);var $h="ready complete success error abort timeout".split(" ");Zh.prototype.send=function(a,b,c,d,e,f,g,l,p,t){if(this.a.get(a))throw Error("[goog.net.XhrManager] ID in use");b=new ai(b,na(this.m,this,a),c,d,e,g,m(l)?l:this.i,p,m(t)?t:this.j);this.a.set(a,b);a=na(this.l,this,a);this.b.ea(a,f);return b};
Zh.prototype.abort=function(a,b){var c=this.a.get(a);if(c){var d=c.ka;c.ya=!0;b&&(d&&(this.f.B(d,$h,c.wa),rf(d,"ready",function(){var a=this.b;a.b.remove(d)&&a.U(d)},!1,this)),this.a.remove(a));d&&d.abort()}};Zh.prototype.l=function(a,b){var c=this.a.get(a);c&&!c.ka?(this.f.listen(b,$h,c.wa),b.l=Math.max(0,this.h),b.j=c.Ea(),b.i=c.Fa(),c.ka=b,P(this,new bi("ready",this,a,b)),ci(this,a,b),c.ya&&b.abort()):(a=this.b,a.b.remove(b)&&a.U(b))};
Zh.prototype.m=function(a,b){var c=b.c;switch(b.type){case "ready":ci(this,a,c);break;case "complete":a:{var d=this.a.get(a);if(7==c.h||Lh(c)||d.aa>d.pa)if(P(this,new bi("complete",this,a,c)),d&&(d.Ca=!0,d.Ba)){a=d.Ba.call(c,b);break a}a=null}return a;case "success":P(this,new bi("success",this,a,c));break;case "timeout":case "error":b=this.a.get(a);b.aa>b.pa&&P(this,new bi("error",this,a,c));break;case "abort":P(this,new bi("abort",this,a,c))}return null};
var ci=function(a,b,c){var d=a.a.get(b);!d||d.Ca||d.aa>d.pa?(d&&(a.f.B(c,$h,d.wa),a.a.remove(b)),a=a.b,a.b.remove(c)&&a.U(c)):(d.aa++,c.send(d.lb,d.zb,d.jb,d.kb))};Zh.prototype.F=function(){Zh.H.F.call(this);this.b.ca();this.b=null;this.f.ca();this.f=null;this.a.clear();this.a=null};var bi=function(a,b,c,d){N.call(this,a,b);this.id=c;this.ka=d};u(bi,N);
var ai=function(a,b,c,d,e,f,g,l,p){this.lb=a;this.zb=c||"GET";this.jb=d;this.kb=e||null;this.pa=m(g)?g:1;this.aa=0;this.ya=this.Ca=!1;this.wa=b;this.Ba=f;this.a=l||"";this.b=!!p;this.ka=null};ai.prototype.Fa=function(){return this.b};ai.prototype.Ea=function(){return this.a};var di=function(){},ei=function(){x.call(this)};u(ei,x);ei.prototype.name="httpStatus";var fi=function(){x.call(this)};u(fi,x);fi.prototype.name="httpResponseParsing";di.prototype.request=n;var gi=function(a,b){return a.request(b).then(function(a){if(!ra(a.getResponseHeader("content-type")||"","application/json"))try{return JSON.parse(a.V())}catch(d){}throw new fi;})},hi=function(){this.a=new A;this.b=0};u(hi,di);
var ii=function(a){this.b=a.V();this.a={};Pb(Mh(a),function(a,c){this.a[c.toLowerCase()]=a},this)};ii.prototype.V=function(){return this.b};ii.prototype.getResponseHeader=function(a){return this.a[a.toLowerCase()]||void 0};hi.prototype.request=function(a){var b=I(),c=a.timeout||1E4,d=this.a.get(c);d||(d=new Zh,d.h=Math.max(0,c),this.a.set(c,d));c=a.method||"GET";d.send(this.b++,a.url,c,a.content,a.headers,0,function(a){a=a.c;Lh(a)?b.b(new ii(a)):b.c(new ei(a.getStatus()))},a.G);return b.a};var ji=function(a,b,c){var d=b.read();this.a=d.eurekaInfoState&&d.eurekaInfoState.setupApiVersion||null;this.g=new Jd("http://"+d.deviceIpAddress+":8008");this.b=a;this.c=b;c?(a=Pg(c),c=(c=Qg(c))?"en"==a?a+"-"+c+", en;q=0.8":a+"-"+c+", "+a+";q=0.8, en;q=0.5":a+", en;q=0.5"):c=null;this.f=c},ki=function(a){var b=new De(a);return{read:function(){return b},write:function(a){b=a}}},ni=function(a,b,c){var d=new ji(a,b,c);return d.a?G(d):li(d,{options:mi()}).then(function(){return d})},pi=function(a,b,
c,d,e){var f=new ji(a,b,e),g=b.read();if(g.eurekaInfoState&&g.eurekaInfoState.ethernetConnected)return G(f);if(g.verificationState){if(Tf(g.verificationState.verificationProperties.deviceBssid,d.bssid))return G(f);g=new De(g.deviceIpAddress);b.write(g)}a={};var l=a.nonce=sa();a.options=mi().concat(["name","sign","device_info.public_key","device_info.hotspot_bssid"]);return li(f,a).then(function(a){a:switch(a.version){case 3:a=mh(new nh(a),c,l,d);break a;case 4:case 5:case 6:a=mh(new oh(a),c,l,d);
break a;default:a=mh(new ph(a),c,l,d)}return a}).then(function(a){g=b.read();g.verificationState=a;b.write(g);return f},function(a){Bf(a);if(a instanceof ei)throw a;throw new oi;})},qi=function(){x.call(this)};u(qi,x);qi.prototype.name="setupApiVersionError";var oi=function(){x.call(this)};u(oi,x);oi.prototype.name="deviceVerificationError";var mi=function(){return"version name setup.setup_state net.ethernet_connected net.ip_address device_info.ssdp_udn device_info.model_name device_info.capabilities setup.ssid_suffix setup.tos_accepted".split(" ")};
ji.prototype.i=new B([3,4,5,6,7,8]);
ji.prototype.h=new A(3,function(a){z(a,"locale","en-US");return a},4,ge,5,ge,6,ge,7,function(a){if(a.device_info){var b=a.device_info;!b.hotspot_bssid&&b.mac_address&&(b.hotspot_bssid="00:1A:11:FF:"+b.mac_address.substr(b.mac_address.length-5));b.capabilities&&(b=b.capabilities,z(b,"display_supported",!0),z(b,"wifi_supported",!0),z(b,"wifi_regulatory_domain_locked",!1),z(b,"hotspot_supported",!0),z(b,"ble_supported",!1),z(b,"multizone_supported",!1))}a.net&&z(a.net,"ethernet_connected",!1);a.setup&&
z(a.setup,"tos_accepted",!0);a.settings&&(b=a.settings,z(b,"time_format",1),z(b,"locale","en-US"));return a});ji.prototype.getState=function(){return this.c.read()};
var ri=function(a){return a.c.read().eurekaInfoState},ti=function(a,b){return a.b.request({url:si(a,"/setup/connect_wifi"),method:"POST",headers:{"Content-Type":"application/json"},content:JSON.stringify(b),G:0})},li=function(a,b){var c=new Jd(a.g);c.c="/setup/eureka_info";if(b){var d=[];if(b.options){var e=new B(b.options),f=e.contains("sign");if(null===a.a||7>a.a){for(var g=new B(["sign","detail"]),l=new B,g=ec(g),p=0;p<g.length;p++){var t=g[p];e.contains(t)&&gc(l,t)}l.u()&&d.push("options="+l.v().join(","))}e.u()&&
(null===a.a||7<=a.a)&&d.push("params="+e.v().join(","))}b.nonce&&d.push("nonce="+b.nonce);d.length&&Nd(c,d.join("&"),void 0)}b=void 0;a.f&&(b={"Accept-Language":a.f});return gi(a.b,{url:c.toString(),method:"GET",headers:b,timeout:f?4E4:1E4,G:f?1:2}).then(a.j.bind(a)).then(a.l.bind(a))};ji.prototype.j=function(a){if(!a.version)return a;if(!this.i.contains(a.version))throw new qi;this.a=parseInt(a.version,10);return this.h.get(this.a,null)(a)};
ji.prototype.l=function(a){var b=this.c.read(),c=b.eurekaInfoState,d={};this.a&&(d.setupApiVersion=this.a);if(3<=this.a&&6>=this.a)d.name=a.name,d.setupState=a.setup_state,d.ssdpUdn=a.ssdp_udn,3===this.a?(d.ethernetConnected=!1,d.tosAccepted=!0,d.modelName="Chromecast"):(d.ethernetConnected=6===this.a?!!a.ethernet_connected:!1,d.tosAccepted=!!a.tos_accepted,a.detail&&(d.modelName=a.detail.model_name)),a.ip_address&&(d.connectedIpAddress=a.ip_address),d.deviceType="c",d.features=Yf(d.deviceType);else if(7<=
this.a){a.name&&(d.name=a.name);if(a.setup&&(void 0!==a.setup.setup_state&&(d.setupState=a.setup.setup_state),63===d.setupState?d.tosAccepted=!1:void 0!==a.setup.tos_accepted&&(d.tosAccepted=a.setup.tos_accepted),void 0!==a.setup.ssid_suffix)){var e=Xf(a.setup.ssid_suffix);d.deviceType=e?e.type:"c"}a.device_info&&a.device_info.model_name&&(d.modelName=a.device_info.model_name);a.net&&(void 0!==a.net.ethernet_connected&&(d.ethernetConnected=a.net.ethernet_connected),a.net.ip_address&&(d.connectedIpAddress=
a.net.ip_address),a.device_info&&a.device_info.ssdp_udn&&(d.ssdpUdn=a.device_info.ssdp_udn));d.features=Yf(d.deviceType||c&&c.deviceType||"b",a.device_info&&a.device_info.capabilities)}c?Ub(c,d):b.eurekaInfoState=d;this.c.write(b);return a};
var ui=function(a){return gi(a.b,{url:si(a,"/setup/offer"),method:"GET",timeout:1E4,G:2}).then(function(a){return a})},vi=function(a,b){a.b.request({url:si(a,"/setup/reboot"),method:"POST",headers:{"Content-Type":"application/json"},content:JSON.stringify(new se(b)),timeout:1E4,G:2})},wi=function(a){var b=new ve;b.immediate=!0;return gi(a.b,{url:si(a,"/setup/save_wifi"),method:"POST",headers:{"Content-Type":"application/json"},content:JSON.stringify(b),timeout:2E4,G:1}).then(function(a){var b=this.c.read();
b.eurekaInfoState&&b.eurekaInfoState.setupState!==a.setup_state&&(b.eurekaInfoState.setupState=a.setup_state,this.c.write(b));return a}.bind(a))},xi=function(a){return gi(a.b,{url:si(a,"/setup/scan_results"),method:"GET",timeout:1E4,G:5}).then(function(a){return a})},yi=function(a){return a.b.request({url:si(a,"/setup/scan_wifi"),method:"POST",G:0})},zi=function(a,b){return a.b.request({url:si(a,"/setup/set_eureka_info"),method:"POST",headers:{"Content-Type":"application/json"},content:JSON.stringify(b),
G:0})},Ai=function(a){return gi(a.b,{url:si(a,"/setup/supported_locales"),method:"GET",timeout:1E4,G:2}).then(function(a){return a})},Bi=function(a){return gi(a.b,{url:si(a,"/setup/supported_timezones"),method:"GET",timeout:1E4,G:2}).then(function(a){return a})},si=function(a,b){a=new Jd(a.g);a.c=b;return a.toString()};var Ci=function(a,b){this.networks=new A;this.f=new Q(this.gb.bind(this),this.fb.bind(this));this.b=a;this.g=[];for(var c=1,d=arguments.length;c<d;++c)this.g.push(arguments[c]);this.c=new B;this.h=this.pb.bind(this);this.i=this.qb.bind(this);this.a=new O},Di=function(a,b){N.call(this,a);this.a=b};u(Di,N);var Ei=function(){};Ei.prototype.c=function(){return!0};Ei.prototype.a=function(){return!0};var Fi=function(a){this.b=a||null};u(Fi,Ei);
Fi.prototype.c=function(a){return!(!a.WiFi||a.WiFi.Security&&"None"!==a.WiFi.Security)};Fi.prototype.a=function(a){return this.b?!(!a.WiFi||a.WiFi.BSSID!==this.b):Wf(a)};h=Ci.prototype;h.start=function(){return this.f.start()};h.stop=function(){return this.f.stop()};h.gb=function(){var a=this.b;a.onNetworkListChanged.addListener(this.h);a.onNetworksChanged.addListener(this.i);return R(this.f,this.b.getNetworks({networkType:"WiFi",visible:!0})).then(this.xb.bind(this))};
h.xb=function(a){return vd(a.filter(function(a){if(Gi(this,a))return!0;gc(this.c,a.GUID);return!1}.bind(this)).map(function(a){return this.va(a.GUID)}.bind(this)))};h.fb=function(){this.b.onNetworkListChanged.removeListener(this.h);this.b.onNetworksChanged.removeListener(this.i);this.networks.clear();this.c.clear();return G()};h.pb=function(a){var b=new B(this.networks.C());a=ic(new B(a),this.c);Zb(ic(a,b),this.va.bind(this));Zb(ic(b,a),this.Ia.bind(this))};
h.Ia=function(a){var b=this.networks.get(a);this.networks.remove(a);a="Connected"===b.ConnectionState;b.ConnectionState="NotConnected";a&&Hi(this,"disconnected",b);Hi(this,"removed",b)};h.qb=function(a){a=ic(new B(a),this.c);Zb(a,this.va.bind(this))};
h.va=function(a){var b=this,c=I();J(K(Ii(b,a).then(function(c){var d=b.networks.get(a),f=!(!d||"Connected"!==d.ConnectionState);b.networks.set(c.GUID,c);var g="Connected"===c.ConnectionState;d||Hi(b,"added",c);!f&&g?Hi(b,"connected",c):f&&!g&&Hi(b,"disconnected",c)}),function(){dc(b.networks,a)&&b.Ia(a)}),function(){c.b()});return c.a};
var Hi=function(a,b,c){P(a.a,new Di(b,c))},Ii=function(a,b){return K(R(a.f,a.b.getProperties(b)),function(a){throw a;}.bind(a)).then(function(a){if(!Ji(this,a))throw gc(this.c,b),new L;return a}.bind(a))},Gi=function(a,b){return!zb(a.g,function(a){return!a.c(b)})},Ji=function(a,b){return!zb(a.g,function(a){return!a.a(b)})};var Ki=function(a){this.b=a;this.a=null},Li=new A(1,2E4,3,6E4,2,6E4),Ni=function(a,b){var c=Me(a).filter(Mi);c.push(b);Ne(a,c)},Mi=function(a){var b=Li.get(a.type,Infinity);return pa()-a.time<b},Oi=function(a){this.b=a};u(Oi,Ei);Oi.prototype.a=function(a){return!Pi(this.b,a.WiFi&&a.WiFi.BSSID,2)};
var Qi=function(a){a.a=new A;for(var b=Me(a.b),c=[],d=0,e=b.length;d<e;++d){var f=b[d];if(Mi(f)){c.push(f);dc(a.a,f.type)||a.a.set(f.type,new A);var g=a.a.get(f.type);g&&g.get(f.deviceId,-Infinity)<f.time&&g.set(f.deviceId,f.time)}}c.length!==b.length&&Ne(a.b,c)},Pi=function(a,b,c){a.a||Qi(a);a=a.a.get(c,null);if(null===a||!dc(a,b))return!1;b=a.get(b)+Li.get(c,0);return pa()<b},Ri=function(a,b){return Pi(a,b,1)||Pi(a,b,3)};var Si=function(a,b,c,d){O.call(this);this.m=new Ki(d.localStorage);this.f=new Ci(a,new Fi,new Oi(this.m));this.h=b;this.I=a;this.D=c;this.l=d};u(Si,O);var Ti=function(a){N.call(this,"devices");this.devices=a};u(Ti,N);Si.prototype.start=n;Si.prototype.stop=n;Si.prototype.ta=n;Si.prototype.za=n;var Ui=function(a,b,c,d){Si.call(this,a,b,c,d);this.a=null;this.j=0;this.b=new A;this.i=new Eg(5E3,6E4);this.w=this.J.bind(this);this.A=this.tb.bind(this);this.o=new Q(this.eb.bind(this),this.cb.bind(this))};
u(Ui,Si);h=Ui.prototype;h.za=function(a){return K(ni(this.D,ki(a)).then(function(a){var b=a.getState(),d=b.eurekaInfoState;return b.deviceIpAddress&&d&&d.name&&d.ssdpUdn&&void 0!==d.ethernetConnected&&void 0!==d.tosAccepted&&d.deviceType&&void 0!==d.features?a:H()}.bind(this)),function(){}.bind(this))};h.eb=function(){this.l.document.addEventListener("visibilitychange",this.A);this.h.listen("devices",this.w);this.h.a();this.j=0;return this.f.start().then(this.ja.bind(this))};
h.cb=function(){this.l.document.removeEventListener("visibilitychange",this.A);this.h.B("devices",this.w);this.j=0;this.i=new Eg(5E3,6E4);this.a&&(this.a.cancel(),this.a=null);this.b.clear();return this.f.stop()};h.start=function(){return this.o.start()};h.stop=function(){return this.o.stop()};h.tb=function(){this.l.document.hidden?this.a&&(this.a.cancel(),this.a=null):(this.i=new Eg(5E3,6E4),this.ja())};
h.ja=function(){this.a&&this.a.cancel();Qi(this.m);this.I.requestNetworkScan();this.j++;1<=this.j&&this.l.document.hidden?this.a=null:(this.a=S(this.i.b),R(this.o,this.a).then(this.ja.bind(this)),Fg(this.i))};h.ta=function(){this.h.a();this.ja()};var Vi=function(a){var b=[];a.b.v().forEach(function(a){a.X&&!Ri(this.m,a.ipAddress)&&b.push(a)}.bind(a));P(a,new Ti(b))};
Ui.prototype.J=function(a){var b=new B;a.a.devices.forEach(function(a){gc(b,a.ipAddress);var c=this.b.get(a.ipAddress);c||(c={ipAddress:a.ipAddress},this.za(a.ipAddress).then(function(b){var c=this.b.get(a.ipAddress);c&&(c.X=b,this.b.set(a.ipAddress,c),Vi(this))}.bind(this)));a.sessionId&&a.appId&&(c.sessionId=a.sessionId,c.appId=a.appId);this.b.set(a.ipAddress,c)}.bind(this));Zb(ic(new B(this.b.C()),b),this.b.remove.bind(this.b));Vi(this)};var Wi=function(){},Xi="function"==typeof Uint8Array,Zi=function(a,b,c,d){a.b=null;b||(b=c?[c]:[]);a.j=c?String(c):void 0;a.f=0===c?-1:0;a.a=b;a:{if(a.a.length&&(b=a.a.length-1,(c=a.a[b])&&"object"==typeof c&&!ea(c)&&!(Xi&&c instanceof Uint8Array))){a.g=b-a.f;a.c=c;break a}a.g=Number.MAX_VALUE}a.i={};if(d)for(b=0;b<d.length;b++)c=d[b],c<a.g?(c+=a.f,a.a[c]=a.a[c]||Yi):a.c[c]=a.c[c]||Yi},Yi=[],$i=function(a,b){if(b<a.g){b+=a.f;var c=a.a[b];return c===Yi?a.a[b]=[]:c}c=a.c[b];return c===Yi?a.c[b]=[]:
c},aj=function(a,b,c){b<a.g?a.a[b+a.f]=c:a.c[b]=c},bj=function(a,b,c){a.b||(a.b={});if(!a.b[c]){for(var d=$i(a,c),e=[],f=0;f<d.length;f++)e[f]=new b(d[f]);a.b[c]=e}b=a.b[c];b==Yi&&(b=a.b[c]=[]);return b},dj=function(a){if(a.b)for(var b in a.b){var c=a.b[b];if(ea(c))for(var d=0;d<c.length;d++)c[d]&&cj(c[d]);else c&&cj(c)}},cj=function(a){dj(a);return a.a},ej=k.JSON&&k.JSON.stringify||"object"===typeof JSON&&JSON.stringify;
Wi.prototype.h=Xi?function(){var a=Uint8Array.prototype.toJSON;Uint8Array.prototype.toJSON=function(){ch();for(var a=Zg,b=[],e=0;e<this.length;e+=3){var f=this[e],g=e+1<this.length,l=g?this[e+1]:0,p=e+2<this.length,t=p?this[e+2]:0,W=f>>2,f=(f&3)<<4|l>>4,l=(l&15)<<2|t>>6,t=t&63;p||(t=64,g||(l=64));b.push(a[W],a[f],a[l],a[t])}return b.join("")};try{var b=ej.call(null,cj(this),qh)}finally{Uint8Array.prototype.toJSON=a}return b}:ej?function(){return ej.call(null,cj(this),qh)}:function(){var a=cj(this),
b=[];sh(new rh,a,b);return b.join("")};var qh=function(a,b){if(ga(b)){if(isNaN(b))return"NaN";if(Infinity===b)return"Infinity";if(-Infinity===b)return"-Infinity"}return b};Wi.prototype.toString=function(){dj(this);return this.a.toString()};var fj=function(a){Zi(this,a,0,null)};u(fj,Wi);var hj=function(a){Zi(this,a,"is.gsser",gj)};u(hj,Wi);var gj=[3,5,13];hj.messageId="is.gsser";hj.prototype.getTitle=function(){return $i(this,1)};hj.prototype.setTitle=function(a){aj(this,1,a)};var ij=function(a){Zi(this,a,0,null)};u(ij,Wi);var jj=function(a){Zi(this,a,0,null)};u(jj,Wi);var kj=function(a,b,c){this.b=a;this.a=c;this.c="https://clients3.google.com/cast/chromecast/home/gsse?rt=j&hl="+b};
kj.prototype.request=function(a){var b=new fj;aj(b,3,a);aj(b,1,"E8C28D3C");return this.b.request({url:this.c,method:"POST",content:b.h(),headers:{"Content-Type":"application/json"}}).then(function(a){a=a.V();a.startsWith(")]}'\n")&&(a=a.slice(5));a=JSON.parse(a);a=new hj(a[0][0]);var b=[],c=$i(a,4);c&&b.push(c);(c=bj(a,jj,5))&&c.forEach(function(a){b.push($i(a,2))});b.forEach(this.a.l.bind(this.a));return a}.bind(this))};var lj=function(a){this.b=a;this.a=new A;this.g=new Q(this.Ya.bind(this),this.Xa.bind(this));this.h=this.ub.bind(this);this.i=this.vb.bind(this);this.f=this.Wa.bind(this);this.c=this.Va.bind(this)},mj=function(a){this.a=a};mj.prototype.fa=function(){var a=Vf(this.a.WiFi.SSID),b=new eb("wifi:"+this.a.GUID,$f(a.type),a.name);b.needsSetup=!0;b.features=Yf(a.type);return b};
mj.prototype.Da=function(){var a=this.fa(),a={name:a.displayName,type:Pf.a.get(a.type)||"c"};a.ssid=this.a.WiFi.SSID;a.bssid=this.a.WiFi.BSSID;return new Ce(a)};mj.prototype.start=function(){return G()};mj.prototype.stop=function(){return G()};var nj=function(a,b,c,d){this.j=b;this.a=null;this.c=d;this.m=a;this.h=new Q(this.Ua.bind(this),this.Ta.bind(this));this.w=c;this.g=this.b=this.f=null;this.A=new kj(a.g,a.h(),this.m.m);this.i=this.l.bind(this);this.o=this.rb.bind(this);this.s=this.mb.bind(this)};
nj.prototype.Da=function(){var a=this.fa();return new Ce({name:a.displayName,type:Pf.a.get(a.type)||"c",ipAddress:this.j})};
var oj=function(a,b){if(!gg(a.a.appId)||gg(a.a.appId)&&!a.f)return b;a.a.status&&(b.sessionStatus=dg(a.a.status));var c=bj(a.f,ij,3);0<c.length&&(b.backdropImageAttributions=yb(c,function(a){return $i(a,1)}.bind(a)));c=bj(a.f,jj,5);0<c.length&&(b.backdropSecondaryActions=yb(c,function(a){var b={},c=$i(a,1);c&&(b.text=c);(a=$i(a,2))&&(b.url=a);return b}.bind(a)));if(c=a.f.getTitle())b.mediaTitle=c;var d=$i(a.f,2);d&&(b.imgUrl=d);if(a=$i(a.f,4))b.backdropPrimaryActionUrl=a;c||1!==b.backdropImageAttributions.length||
(b.mediaTitle=b.backdropImageAttributions[0],b.backdropImageAttributions=[]);return b};h=nj.prototype;
h.fa=function(){var a="ip:"+this.j,b=this.w.getState().eurekaInfoState,a=new eb(a,$f(b.deviceType),b.name);a.features=b.features;a.displayName=b.name;a.needsSetup=b.ethernetConnected&&!b.tosAccepted;if(a.needsSetup&&!a.features.supportsSetup)a=null;else if(this.a&&this.a.status!==chrome.cast.SessionStatus.STOPPED)if(gg(this.a.appId))a=oj(this,a);else if(a.isCasting=!0,this.a.receiver.volume&&(b=this.a.receiver.volume.level,null!==b&&(a.volumeLevel=b),b=this.a.receiver.volume.muted,null!==b&&(a.isMuted=
b)),this.a.status&&(a.sessionStatus=dg(this.a.status)),b=this.a.appId,"85CDB22F"===b||"0F5096E8"===b)this.a.displayName&&(a.mediaTitle=this.a.displayName),this.a.statusText&&(a.mediaSource=this.a.statusText);else if(this.a.displayName&&(a.mediaSource=this.a.displayName),b=pj(this))if(0<=vb(b.supportedMediaCommands,chrome.cast.media.MediaCommand.PAUSE)&&(a.canPause=!0),b.playerState&&(a.playerState=cg(b.playerState)),b.media&&(b.media.duration&&(a.mediaDuration=b.media.duration),b=b.media.metadata||
b.media.a))b.title&&(a.mediaTitle=b.title),b.images&&0<b.images.length&&b.images[0].url&&!b.images[0].url.endsWith(".ico")&&(a.imgUrl=b.images[0].url);return a};h.Ab=function(){if(this.g)if(!this.g.appId||!this.g.sessionId)qj(this),this.c();else if(!this.a||this.a.sessionId!=this.g.sessionId){var a=this.m.i.c(this.g.appId,this.g.sessionId);a.then(this.sb.bind(this));R(this.h,a);this.g=null}};
h.sb=function(a){a.session.status!==chrome.cast.SessionStatus.STOPPED&&(this.a&&qj(this),this.a=a.session,this.b=a.context,this.a.addMediaListenerWithContext(this.b,this.o),this.a.addUpdateListenerWithContext(this.b,this.i),gg(this.a.appId)&&(this.a.addMessageListenerWithContext(this.b,"urn:x-cast:com.google.cast.sse",this.s),this.a.sendMessageWithContext(this.b,"urn:x-cast:com.google.cast.sse",{type:"GET_STATUS",requestId:Math.floor(4294967295*Math.random())},ba,function(){})),this.a.media&&this.a.media.forEach(function(a){a.addUpdateListenerWithContext(this.b,
this.i)}.bind(this)),this.l())};h.mb=function(a,b){"urn:x-cast:com.google.cast.sse"===a&&(a=JSON.parse(b),a=this.A.request(a.backendData),a.then(function(a){this.f=a;this.c()}.bind(this)),R(this.h,a))};h.rb=function(a){this.l();a.addUpdateListenerWithContext(this.b,this.i)};h.start=function(){return this.h.start()};h.stop=function(){return this.h.stop()};h.Ua=function(){return G()};h.Ta=function(){qj(this);return G()};
var qj=function(a){a.f=null;a.a&&(a.a.media&&a.a.media.forEach(function(a){a.removeUpdateListenerWithContext(this.b,this.i)}.bind(a)),a.a.removeUpdateListenerWithContext(a.b,a.i),a.a.removeMediaListenerWithContext(a.b,a.o),gg(a.a.appId)&&a.a.removeMessageListenerWithContext(a.b,"urn:x-cast:com.google.cast.sse",a.s),a.a=null,a.b=null)},pj=function(a){if(!a.a||!a.a.media)return null;var b=null;a.a.media.forEach(function(a){a&&(b?!b.media&&a.media?b=a:b.playerState==chrome.cast.media.PlayerState.IDLE&&
a.playerState!=chrome.cast.media.PlayerState.IDLE&&(b=a):b=a)}.bind(a));return b};nj.prototype.l=function(){this.a.status===chrome.cast.SessionStatus.STOPPED&&qj(this);this.c()};
var rj=function(a,b){if(a.a&&a.b){var c=pj(a);c&&0<=vb(c.supportedMediaCommands,chrome.cast.media.MediaCommand.PAUSE)&&(3==b&&c.playerState==chrome.cast.media.PlayerState.PAUSED?c.playWithContext(a.b,null,a.c,function(){}):4==b&&c.playerState==chrome.cast.media.PlayerState.PLAYING&&c.pauseWithContext(a.b,null,a.c,function(){}))}},sj=function(a,b,c){if(a.a&&a.b)switch(c){case 4:case 3:rj(a,c);break;case 5:a.a.stopWithContext(a.b,a.c,function(){});break;case 6:a.a.setReceiverMutedWithContext(a.b,!0,
a.c,function(){});break;case 7:a.a.setReceiverMutedWithContext(a.b,!1,a.c,function(){});break;case 8:b.volumeLevel!==a.a.receiver.volume.level&&a.a.setReceiverVolumeLevelWithContext(a.b,b.volumeLevel,a.c,function(){})}},tj=function(a,b){if(a.id===b.id)return 0;if(a.needsSetup!==b.needsSetup)return a.needsSetup?-1:1;var c=ra(a.displayName,b.displayName);return 0!==c?c:a.id<b.id?-1:a.id>b.id?1:0};h=lj.prototype;h.start=function(){return this.g.start()};h.stop=function(){return this.g.stop()};
h.Ya=function(){this.W();var a=this.b.a.f.a;a.listen("added",this.h);a.listen("removed",this.i);U(this.b.b).addListener("Devices.UserAction",this.f);this.b.a.listen("devices",this.c);this.b.a.ta();return this.b.a.start()};h.Xa=function(){U(this.b.b).removeListener("Devices.UserAction",this.f);var a=this.b.a.f.a;a.B("added",this.h);a.B("removed",this.i);this.b.a.B("devices",this.c);var b=[this.b.a.stop()];this.a.forEach(function(a){b.push(a.stop())}.bind(this));this.a=new A;return vd(b)};
h.ub=function(a){var b="wifi:"+a.a.GUID;a=this.a.get(b)||new mj(a.a);this.a.set(b,a);a.start();this.W()};h.vb=function(a){a="wifi:"+a.a.GUID;var b=this.a.get(a);b&&(b.stop(),this.a.remove(a),this.W())};
h.Va=function(a){var b=new A,c=!1;a.devices.forEach(function(a){if(a.ipAddress){var d="ip:"+a.ipAddress,f=this.a.get(d);f||(f=new nj(this.b,a.ipAddress,a.X,this.W.bind(this)),f.start(),c=!0);var g=f;a.ipAddress==g.j&&(g.g=a,sg(g.h).then(g.Ab.bind(g)));b.set(d,f);this.a.remove(d)}}.bind(this));this.a.C().forEach(function(a){var c=this.a.get(a);c instanceof mj&&(b.set(a,c),this.a.remove(a))}.bind(this));0<this.a.u()&&(c=!0);this.a.forEach(function(a){a.stop()}.bind(this));this.a=b;c&&this.W()};
h.W=function(a){var b=[];this.a.forEach(function(a){if(a=a.fa()){for(var c,e=tj||Jb,f=0,g=b.length;f<g;){var l=f+g>>1,p;p=e(a,b[l]);0<p?f=l+1:(g=l,c=!p)}c=c?f:~f;0>c&&Ib(b,-(c+1),0,a)}}.bind(this));U(this.b.b).sendMessage(new fb(b,a))};
h.Wa=function(a){var b=this.a.get(a.device.id);if(b)switch(a.action){case 1:a=new Ae(sa());a.states=new Ge(0,[new M(1)]);a.commonState=new Be;a.commonState.device=b.Da();a.commonState.pinned=!0;Ke(this.b.f,a);this.b.l(a.id);break;case 2:this.b.j(b.j);break;case 3:case 4:case 5:case 6:case 7:case 8:sj(b,a.device,a.action)}};var uj=function(a,b){this.b=a;this.i=b;this.c=null;this.j=ki(b);this.g=this.a=null;this.f=new Q(this.$a.bind(this),this.Za.bind(this));this.h=new A("DeviceSettings.Apply",this.Ra.bind(this),"DeviceSettings.Reboot",this.o.bind(this),"DeviceSettings.FactoryReset",this.m.bind(this),"DeviceSettings.ForgetWiFi",this.s.bind(this),"DeviceSettings.Exit",this.l.bind(this))};h=uj.prototype;h.start=function(){return this.f.start()};h.stop=function(){return this.f.stop()};
h.$a=function(){return R(this.f,ni(this.b.g,this.j)).then(function(a){this.c=a;return vd([R(this.f,li(a,{options:"build_info.cast_build_revision device_info.mac_address detail net.ip_address settings.country_code settings.locale settings.timezone settings.time_format opt_in.stats wifi.ssid wifi.wpa_id".split(" ")})),R(this.f,Ai(a)),R(this.f,Bi(a))])}.bind(this)).then(function(a){this.wb.apply(this,a);var b=U(this.b.b);this.h.forEach(function(a,d){b.addListener(d,a)});vj(this,1)}.bind(this))};
h.Za=function(){var a=U(this.b.b);this.h.forEach(function(b,c){a.removeListener(c,b)});this.c=null;this.j=ki(this.i);this.a=null;return G()};
h.wb=function(a,b,c){var d=ri(this.c),e=d.setupApiVersion,f=$f(d.deviceType);c=c.map(function(a){return new jb(a.timezone,a.display_string,a.offset)});b=b.map(function(a){return new ib(a.locale,a.display_string)});var g=this.a={};if(7<=e){var e=a.wifi,l=a.settings,p=a.opt_in,t=a.build_info,W=a.device_info;a=a.net;g.deviceType=f;g.name=d.name;g.ssid=!d.ethernetConnected&&e.ssid||null;g.timeZoneId=l.timezone||null;g.supportedTimeZones=c;g.timeFormat=1===l.time_format?1:2;g.localeId=l.locale||"";g.supportedLocales=
b;g.statsOptIn=!!p.stats;g.firmwareVersion=t.cast_build_revision||"";g.countryCode=l.country_code||null;g.macAddress=W.mac_address||"";g.ipAddress=a.ip_address;this.g=void 0!==e.wpa_id?e.wpa_id:null}else l=1===(3<e?a.time_format:2)?1:2,g.deviceType=f,g.name=d.name,g.ssid=!d.ethernetConnected&&a.ssid||null,g.timeZoneId=a.timezone||null,g.supportedTimeZones=c,g.timeFormat=l,g.localeId=a.locale,g.supportedLocales=b,g.statsOptIn=!!(3<e&&a.opt_in&&a.opt_in.stats),g.firmwareVersion=a.build_version,g.countryCode=
3<e&&a.location&&a.location.country_code||null,g.macAddress=a.mac_address,g.ipAddress=a.ip_address,this.g=void 0!==a.wpa_id?a.wpa_id:null};
h.Ra=function(a){var b=this;if(a.name===b.a.name&&a.timeZoneId===b.a.timeZoneId&&a.timeFormat===b.a.timeFormat&&a.localeId===b.a.localeId&&a.statsOptIn===b.a.statsOptIn)vj(b,1);else{var c=Sb(b.a);b.a.name=a.name;b.a.timeZoneId=a.timeZoneId;b.a.timeFormat=a.timeFormat;b.a.localeId=a.localeId;b.a.statsOptIn=a.statsOptIn;vj(b,2);K(R(b.f,zi(b.c,wj(b,a))).then(function(){b.a.localeId!==c.localeId?b.b.reload():vj(b,1)}),function(){b.a=c;vj(b,3)})}};
var wj=function(a,b){var c=a.c.a;a=1===b.timeFormat?1:2;if(7<=c)return c=new ze,c.name=b.name,c.settings=new oe,b.timeZoneId&&(c.settings.timezone=b.timeZoneId),c.settings.time_format=a,c.settings.locale=b.localeId,c.opt_in=new pe,c.opt_in.stats=b.statsOptIn,c;if(4<=c&&6>=c)return c=new ye,c.name=b.name,b.timeZoneId&&(c.timezone=b.timeZoneId),c.time_format=a,c.locale=b.localeId,c.opt_in=new ie,c.opt_in.stats=b.statsOptIn,c;a=new xe;a.name=b.name;b.timeZoneId&&(a.timezone=b.timeZoneId);a.locale=b.localeId;
return a},vj=function(a,b){U(a.b.b).sendMessage(new kb(b,a.a))};uj.prototype.o=function(){vi(this.c,"now");var a=this.c.c.read().deviceIpAddress;Ni(this.b.f,new He(1,pa(),a));this.b.c()};uj.prototype.m=function(){vi(this.c,"fdr");var a=this.c.c.read().deviceIpAddress;Ni(this.b.f,new He(3,pa(),a));this.b.c()};
uj.prototype.s=function(){var a=this.c,b=this.g;a.b.request({url:si(a,"/setup/forget_wifi"),method:"POST",headers:{"Content-Type":"application/json"},content:JSON.stringify(new qe(b)),timeout:1E4,G:2});this.b.c()};uj.prototype.l=function(){this.b.c()};var xj=function(a,b){this.onDeviceList=a;this.onError=b};xj.prototype.discoverNow=n;var yj=function(){xj.call(this,chrome.dial.onDeviceList,chrome.dial.onError)};u(yj,xj);yj.prototype.discoverNow=function(){return new F(function(a,b){chrome.dial.discoverNow(function(){chrome.runtime.lastError?b(new Lf(chrome.runtime.lastError.message)):a()})})};ca(yj);var Aj=function(a,b,c){this.c=a;this.l=b;this.j=new O;this.b=0;this.g=[];this.i=0;this.a={};this.o=[];this.h=this.m.bind(this);this.s=this.A.bind(this);this.f=new Q(this.I.bind(this),this.D.bind(this));this.w=c},Bj=function(a,b,c,d,e,f){this.name=a;this.ipAddress=b;this.udn=c;this.ethernetConnected=d;this.tosAccepted=e;this.deviceType=f},Cj=function(a){N.call(this,"deviceListUpdated");this.devices=a};u(Cj,N);Aj.prototype.start=function(){return this.f.start()};Aj.prototype.stop=function(){return this.f.stop()};
var Dj=function(a){if(0<=ua(Yg,49))try{var b=chrome.extension.getBackgroundPage().backgroundSetup;b.stopDialService.call(b);a.c.onDeviceList.removeListener(a.h);a.c.onDeviceList.addListener(a.h);b.startDialService.call(b)}catch(c){}},Ej=function(a){Dj(a);K(a.c.discoverNow(),function(){})};Aj.prototype.I=function(){this.c.onDeviceList.addListener(this.h);this.c.onError.addListener(this.s);Ej(this);return G()};
Aj.prototype.D=function(){this.c.onDeviceList.removeListener(this.h);this.c.onError.removeListener(this.s);Pb(this.a,function(a){a.K&&clearTimeout(a.K)});this.a={};return G()};Aj.prototype.m=function(a){this.b++;a=a.filter(function(a){var b=null;try{b=Wd(a.deviceDescriptionUrl).a}catch(d){}return!(!b||null!==Wc(b)&&Ri(this.w,b))}.bind(this));this.i=a.length;this.g=[];0==a.length?Fj(this):xb(a,this.M,this);this.o=[]};Aj.prototype.A=function(){this.m([])};
var Fj=function(a){0<a.i||(Kb(a.g,function(a,c){return ra(a.name,c.name)}),P(a.j,new Cj(a.g)))},Hj=function(a,b,c,d){var e=a.a[c];if(e&&!(e.sa>b))if(0<=vb(a.o,d.udn))Gj(a,b,c);else{if(b=a.a[c])b.K&&clearTimeout(b.K),b.K=setTimeout(na(a.J,a,c),3E5);e.description=d;e.status=1;e.oa==a.b&&(--a.i,a.g.push(d),Fj(a))}},Gj=function(a,b,c){var d=a.a[c];if(d&&!(d.sa>b)){if(b=a.a[c])b.K&&clearTimeout(b.K),b=a.a,c in b&&delete b[c];d.oa==a.b&&(--a.i,Fj(a))}};
Aj.prototype.J=function(a){var b=this.a[a];b&&(b.K=null,1==b.status&&(b=this.a,a in b&&delete b[a]))};
Aj.prototype.M=function(a){var b=Ij(this,a);if(1==b.status)Hj(this,this.b,a.deviceLabel,b.description);else if(2!=b.status){b.status=2;var c=b.sa=this.b,d=a.deviceLabel,e=this;K(R(this.f,this.l.request({url:a.deviceDescriptionUrl})).then(function(a){return(a=Zf(a.V()))&&a.yb?R(e.f,ni(e.l,ki(a.ipAddress))):H()}).then(function(a){a=a.getState();if(!(a.deviceIpAddress&&a.eurekaInfoState&&a.eurekaInfoState.name&&a.eurekaInfoState.ssdpUdn&&void 0!==a.eurekaInfoState.ethernetConnected&&void 0!==a.eurekaInfoState.tosAccepted&&
a.eurekaInfoState.deviceType))return H();Hj(e,c,d,new Bj(a.eurekaInfoState.name,a.deviceIpAddress,a.eurekaInfoState.ssdpUdn,a.eurekaInfoState.ethernetConnected,a.eurekaInfoState.tosAccepted,a.eurekaInfoState.deviceType))}),function(){Gj(e,c,d)})}};var Ij=function(a,b){a.a[b.deviceLabel]||(a.a[b.deviceLabel]={status:3,configId:b.configId,sa:a.b,oa:a.b,K:null,description:null});var c=a.a[b.deviceLabel];c.oa=a.b;b.configId&&c.configId==b.configId||(c.configId=b.configId,c.status=3);return c};var Jj=chrome.i18n.getMessage("3254351313955764967"),Kj=chrome.i18n.getMessage("3485206350043289145");var Lj=function(a,b){this.f=a;this.c=b;this.a=new O;this.b=new Q(this.h.bind(this),this.g.bind(this))},Mj=function(){var a=document;a.body&&a.body.setAttribute("class","unknown-error")};Lj.prototype.start=function(){return this.b.start()};var Nj=function(a,b){(a=a.f.document&&a.f.document.body||null)&&a.setAttribute("class",b)},U=function(a){return a.c.b()};
Lj.prototype.h=function(){var a=I();Nj(this,"start");Oj(this);var b=R(this.b,S(18E4)).then(function(){Nj(this,"load-failed");P(this.a,"loadTimedOut");a.c(new zf)}.bind(this));R(this.b,this.c.start()).then(function(){var a=this.c.b();R(this.b,ug(a,"OfflineUiReady")).then(function(){P(this.a,"offlineUiReady")}.bind(this));P(this.a,"waitingForHandshake");return R(this.b,a.sendRequest(new ya))}.bind(this)).then(function(c){switch(c.type){case "Handshake.Response":Nj(this,"hosting-embedded-ui");P(this.a,
"embeddedUiReady");b.cancel();a.b();break;case "Handshake.UiVersionNotSupported":Nj(this,"update-required");P(this.a,"updateRequired");a.c(c);break;default:Nj(this,"load-failed"),P(this.a,"loadFailed")}}.bind(this));return a.a};var Oj=function(a){var b=a.f.document;[["#load-failed-message",Jj],["#update-required-message",Kj]].forEach(function(a){var c=b.querySelector(a[0]);c&&(c.textContent=a[1])})};Lj.prototype.g=function(){return this.c.stop()};var Pj=function(a,b,c,d,e){this.b=b;this.f=c;this.a=d;this.g=a.localStorage;this.c=e},Qj=function(a,b,c){this.i=a;this.l=b;this.s=m(c)?c:3E4;this.b=new A;this.h=!0;this.f=!1;this.a=new B;this.m=new Ki(a.g);this.g=new Aj(a.f,a.a,this.m);this.c=new Q(this.ib.bind(this),this.hb.bind(this));this.j=this.ob.bind(this)};h=Qj.prototype;h.start=function(){return this.c.start()};h.stop=function(){if(!this.f){var a=new sb(this.l,this.b.v(),!0);U(this.i.b).sendMessage(a);this.f=!0}return this.c.stop()};
h.ib=function(){this.g.j.listen("deviceListUpdated",this.j);R(this.c,S(this.s)).then(function(){this.h=!1;this.Ka()}.bind(this));return this.g.start()};h.hb=function(){this.g.j.B("deviceListUpdated",this.j);this.b=new A;this.h=!0;this.f=!1;this.a=new B;return this.g.stop()};h.ob=function(a){a.devices.forEach(this.nb.bind(this))};
h.nb=function(a){var b=this;dc(b.b,a.udn)||b.a.contains(a.udn)||(gc(b.a,a.udn),J(ni(b.i.a,ki(a.ipAddress)).then(function(a){if(7>a.a)throw new L;return R(b.c,ui(a))}).then(function(c){b.b.set(a.udn,new rb(c.token,a.name,$f(a.deviceType),a.udn));b.a.remove(a.udn);b.f||(c=new sb(b.l,b.b.v(),!b.h&&0===b.a.u()),b.f=c.scanComplete,U(b.i.b).sendMessage(c))},function(){b.a.remove(a.udn)}),b.Ka.bind(b)))};h.Ka=function(){this.h||0!==this.a.u()||this.stop()};var V=function(a,b,c){this.b=new Q(b||function(){return G()},c||void 0);this.a=a};V.prototype.start=function(){return this.b.start()};V.prototype.stop=function(){return this.b.stop()};var X=function(a){return U(a.a.j)};var Tj=function(a,b,c,d){var e=Rj,f=Sj,g=window.location.reload.bind(window.location),l=chrome.i18n.getUILanguage,p=new Lg;this.window=a;this.b=b;this.g=c;this.a=a.localStorage;this.l=a.sessionStorage;this.c=d;this.j=e;this.f=f;this.m=g;this.h=l;this.i=p};var Uj=function(a){V.call(this,a,this.l.bind(this),this.j.bind(this));this.c=this.f=null;this.g=this.i.bind(this);this.m=this.h.bind(this)};u(Uj,V);Uj.prototype.l=function(){return R(this.b,Vj(this.a)).then(function(a){this.f=a;X(this).addListener("AudioConfirmation.UserAction",this.g);X(this).sendMessage(new Ra(1));this.c=3;this.h()}.bind(this))};Uj.prototype.j=function(){this.c=this.f=null;X(this).removeListener("AudioConfirmation.UserAction",this.g);return G()};
Uj.prototype.h=function(){if(null!==this.c){var a=this.b,b;b=this.f;var c=this.c;b=b.b.request({url:si(b,"/setup/play_sound"),method:"POST",headers:{"Content-Type":"application/json"},content:JSON.stringify(new re(c)),timeout:1E4,G:2});R(a,b);this.c=3;R(this.b,S(1===this.c?3E3:1900)).then(this.m)}};Uj.prototype.i=function(a){var b=null;switch(a.action){case 1:this.c=1;b=2;break;case 2:Y(this.a,12);Wj(this.a,new M(5));break;case 3:b=3;break;case 4:Y(this.a,13),a=this.a,Le(a.a.a,a.b),a.a.f()}b&&X(this).sendMessage(new Ra(b))};var Xj=function(a){V.call(this,a,this.c.bind(this),null)};u(Xj,V);Xj.prototype.c=function(){var a=this.a.b.setupApiClientState||null,b=this;R(this.b,X(this).sendRequest(new Oa(a.verificationState.pin))).then(function(a){a.confirmed?(Y(b.a,10),Wj(b.a,new M(5))):(Y(b.a,11),R(b.b,X(b).sendRequest(new Da(1))).then(function(){var a=b.a;Le(a.a.a,a.b);a.a.f()}))});return G()};var Yj=function(a,b){this.i=a;this.a=new Ci(a,new Fi(b));this.b="connected";this.c=null;this.f=new Q(this.bb.bind(this),this.ab.bind(this));this.g=new O},Zj=["added","removed","connected","disconnected"];h=Yj.prototype;h.start=function(){return this.f.start()};h.stop=function(){return this.f.stop()};h.getState=function(){return this.b};h.bb=function(){var a=this;return a.a.start().then(function(){a.h();Zj.forEach(function(b){a.a.a.listen(b,a.h,!0,a)})})};
h.ab=function(){this.b="connected";this.c=null;if(!this.a)return G();var a=this.a;this.a=null;Zj.forEach(function(b){a.a.B(b,this.h,!0,this)}.bind(this));return a.stop()};var ak=function(a,b){a.b!==b&&(a.b=b,P(a.g,new N(b)))};
Yj.prototype.h=function(){if("failed"!==this.b){var a=null;1===this.a.networks.u()&&(a=this.a.networks.v()[0]);if(!a)"connected"===this.b&&(bk(this),ak(this,"disconnected"));else if("Connected"===a.ConnectionState)this.c&&(a=this.c,this.c=null,a.cancel()),ak(this,"connected");else if("connected"===this.b||"disconnected"===this.b)bk(this),ak(this,"reconnecting"),ck(this,a.GUID)}};
var ck=function(a,b){K(R(a.f,a.i.startConnect(b)),function(){ak(this,"failed");this.a.stop()}.bind(a))},bk=function(a){a.c||(a.c=R(a.f,S(9E4)).then(function(){ak(this,"failed");this.a.stop()}.bind(a)))};var dk=function(a){V.call(this,a,this.s.bind(this),this.m.bind(this));this.f=null;this.o=0;this.h=this.g=this.j=this.c=null};u(dk,V);var ek=["connected","disconnected","reconnecting","failed"];dk.prototype.s=function(){var a=this,b=Z(a.a),c=b.connectWiFi;X(a).sendMessage(eg(c));a.g=new Yj(a.a.a.b,b.connectedHotSpotBssid);ek.forEach(function(b){a.g.g.listen(b,a.i,!0,a)});return vd([R(a.b,a.g.start()),R(a.b,Vj(a.a)).then(function(b){a.f=b;fk(a)})]).then(a.w.bind(a))};
dk.prototype.m=function(){var a=this;gk(a);hk(a);if(!a.g)return G();var b=a.g;a.g=null;ek.forEach(function(c){b.g.B(c,a.i,!0,a)});return b.stop()};var fk=function(a,b){a.c||(a.c=K(S(b||0).then(function(){++a.o;a.c=li(a.f,{options:["version","setup.setup_state","net.ip_address"]});return a.c}).then(a.l.bind(a)),function(a){Bf(a)}).then(function(){a.c=null;fk(a,3E3)}))},hk=function(a){if(a.c){var b=a.c;a.c=null;b.cancel()}};
dk.prototype.l=function(){var a=ri(this.f).setupState;if(a!==this.j)switch(this.j=a,a){case 31:return ik(this,2),H(new L);case 21:case 41:case 10:case 11:return ik(this,1),H(new L);case 60:case 61:case 51:return jk(this),H(new L)}};
var jk=function(a){gk(a);Y(a.a,19);var b=ri(a.f);J(K(R(a.b,a.a.a.c.a()).then(function(c){c=fg(b.setupApiVersion,Z(a.a).deviceName,3!==c);return R(a.b,zi(a.f,c))}),function(a){Bf(a)}).then(function(){var c=Z(a.a),d=c.connectedHotSpotBssid;Ni(a.a.a.a,new He(2,pa(),d));delete c.connectedHotSpotBssid;kk(a.a,c);if(60!==b.setupState&&4<=b.setupApiVersion)return K(R(a.b,wi(a.f)),ba)}),function(){Wj(a.a,new M(8))})},ik=function(a,b){gk(a);Y(a.a,2===b?17:18);var c=Z(a.a);c.connectWiFi.b=b;kk(a.a,c);Wj(a.a,
new M(6))};dk.prototype.i=function(a){switch(a.type){case "connected":fk(this);break;case "disconnected":case "reconnecting":hk(this);break;case "failed":ik(this,1)}};dk.prototype.w=function(){clearTimeout(this.h);this.h=setTimeout(function(){ik(this,1)}.bind(this),9E4)};var gk=function(a){clearTimeout(a.h);a.h=null};var lk="AC AD AE AF AG AI AL AM AO AQ AR AS AT AU AW AX AZ BA BB BD BE BF BG BH BI BJ BL BM BN BO BQ BR BS BT BV BW BY BZ CA CC CD CF CG CH CI CK CL CM CN CO CP CR CU CV CW CX CY CZ DE DG DJ DK DM DO DZ EA EC EE EG EH ER ES ET FI FJ FK FM FO FR GA GB GD GE GF GG GH GI GL GM GN GP GQ GR GS GT GU GW GY HK HM HN HR HT HU IC ID IE IL IM IN IO IQ IR IS IT JE JM JO JP KE KG KH KI KM KN KP KR KW KY KZ LA LB LC LI LK LR LS LT LU LV LY MA MC MD ME MF MG MH MK ML MM MN MO MP MQ MR MS MT MU MV MW MX MY MZ NA NC NE NF NG NI NL NO NP NR NU NZ OM PA PE PF PG PH PK PL PM PN PR PS PT PW PY QA RE RO RS RU RW SA SB SC SD SE SG SH SI SJ SK SL SM SN SO SR SS ST SV SX SY SZ TA TC TD TF TG TH TJ TK TL TM TN TO TR TT TV TW TZ UA UG UM US UY UZ VA VC VE VG VI VN VU WF WS XK YE YT ZA ZM ZW".split(" ");var mk=function(a){V.call(this,a,this.g.bind(this),null);this.f=!1;this.c=null};u(mk,V);mk.prototype.g=function(){var a=Z(this.a);this.f=!!a.device.ipAddress;var b=(this.a.b.setupApiClientState||null).eurekaInfoState,c=a.deviceName||b.name,b=3===b.setupApiVersion;this.f||b||a.country?a=null:(a=this.a.a.h(),a=(b=Qg(a))&&-1!==lk.indexOf(b)?b:(a=Pg(a).toUpperCase())&&-1!==lk.indexOf(a)?a:"US");this.c=a;K(R(this.b,X(this).sendRequest(new Ua(c,this.c))).then(this.h.bind(this)),this.a.g.bind(this.a));return G()};
mk.prototype.h=function(a){var b=this;Y(b.a,14);var c=Z(b.a);c.deviceName=a.name;b.c&&a.country&&(c.country=a.country);kk(b.a,c);if(b.f){var d=null;return vd([R(b.b,Vj(b.a)),b.a.a.c.a()]).then(function(a){d=a[0];a=a[1];var e=[];7<=d.a&&e.push(R(b.b,d.b.request({url:si(d,"/setup/accept_tos"),method:"POST",timeout:1E4,G:2})));e.push(R(b.b,zi(d,fg(d.a,c.deviceName,3!==a))));return vd(e)}).then(function(){return R(b.b,li(d,{options:["setup.setup_state"]}))}).then(function(){switch(ri(d).setupState){case 60:nk(b.a);
break;case 62:Wj(b.a,new M(10));break;default:return H()}})}Wj(b.a,new M(6))};var ok=function(a){V.call(this,a,this.c.bind(this),null)};u(ok,V);ok.prototype.c=function(){var a=this,b=null;return vd([R(this.b,Vj(this.a)),this.a.a.c.a()]).then(function(c){b=c[0];c=fg(b.a,Z(a.a).deviceName,3!==c[1]);c=[R(a.b,zi(b,c))];4<=b.a&&c.push(R(a.b,wi(b)));return vd(c)}).then(function(){return R(a.b,li(b,{options:["setup.setup_state"]}))}).then(function(){switch(ri(b).setupState){case 60:case 52:nk(a.a);break;case 62:Wj(a.a,new M(10));break;default:return H()}})};var pk=function(a,b,c,d){V.call(this,a,this.Z.bind(this),this.m.bind(this));this.g=1;this.c=new mg;this.A=c;this.D=b;this.i=null;this.I=void 0!==d?d:Oe(a.a.a);this.h=null;this.s=this.T.bind(this);this.l=this.j.bind(this);this.J=this.M.bind(this)};u(pk,V);
pk.prototype.Z=function(){var a=this;qk(a,1);a.h=new Ci(this.a.a.b);var b=a.h.a;b.listen("connected",a.ga,!0,a);b.listen("added",a.o,!0,a);b=X(a);b.addListener("WiFiSwitching.Proceed",a.s);b.addListener("WiFiSwitching.RetryConnection",a.l);b.addListener("WiFiConfig.Retry",a.l);return R(a.b,a.h.start()).then(function(){var b=a.h.networks;(b=a.i&&b.get(a.i)||null)?"Connected"===b.ConnectionState?a.j():a.I?(a.N(1),qk(a,2),a.S(1),ng(a.c,S(25E3)).then(a.w.bind(a)),a.a.a.b.startConnect(a.i)):a.w():(qk(a,
11),a.a.g())})};pk.prototype.m=function(){this.g=1;this.i=null;var a=this.c;this.c=new mg;var a=[og(a)],b=this.h;this.h=null;if(b){var c=b.a;c.B("connected",this.ga,!0,this);c.listen("added",this.o,!0,this);a.push(b.stop())}b=X(this);b.removeListener("WiFiSwitching.Proceed",this.s);b.removeListener("WiFiSwitching.RetryConnection",this.l);b.removeListener("WiFiConfig.Retry",this.l);return vd(a)};
pk.prototype.ga=function(a){if(rk(this,a))switch(this.g){case 2:this.N(2);this.j();break;case 6:this.N(4),this.j()}};pk.prototype.o=function(a){rk(this,a)&&1===this.g&&(this.i=a.a.GUID)};var rk=function(a,b){b=b.a.WiFi;return a.A&&!Tf(b.BSSID,a.A)||a.D&&b.SSID!==a.D?!1:!0};pk.prototype.w=function(){this.N(3);qk(this,5);this.L(1)};pk.prototype.T=function(){var a=this;qk(a,6);a.L(2);var b=a.h.networks.get(this.i);b&&"Connected"===b.ConnectionState?a.j():ng(a.c,S(1E4)).then(function(){qk(a,7);a.L(3)})};
var sk=function(a){var b=I();ng(a.c,b.a);var c=null,d=function(e){c=S(e).then(a.ma.bind(a)).then(function(c){a.N(5);b.b(c)},function(c){c instanceof ei?d(2E3):c instanceof oi&&(Y(a.a,9),b.c(c))})};J(b.a,function(){if(c){var a=c;c=null;a.cancel()}});d(0);return b.a};pk.prototype.j=function(){var a=this;6===a.g||9===a.g?(qk(a,8),this.L(2)):(qk(a,3),this.S(1));var b=sk(a).then(function(b){qk(a,11);a.na(b)},this.J);ng(a.c,S(12E4)).then(function(){b.cancel()})};
pk.prototype.M=function(a){a=a instanceof qi||a instanceof oi;8===this.g?a?(qk(this,10),this.L(5)):(qk(this,9),this.L(4)):a?(qk(this,10),this.S(3)):(qk(this,4),this.S(2))};var qk=function(a,b){b!==a.g&&(a.g=b,b=a.c,a.c=new mg,og(b))};h=pk.prototype;h.S=n;h.L=n;h.ma=n;h.na=n;h.N=n;var tk=function(a){this.f=Z(a).device;pk.call(this,a,null,this.f.bssid)};u(tk,pk);var uk=new A(1,4,2,5,3,6,4,7,5,8);h=tk.prototype;h.ga=function(a){var b=a.a.WiFi,c=null;Tf(b.BSSID,this.f.bssid)?(c=Z(this.a),c.connectedHotSpotBssid=b.BSSID):Wf(a.a)||(c=Z(this.a),c.originalWiFiNetwork={ssid:b.SSID,bssid:b.BSSID});c&&kk(this.a,c);tk.H.ga.call(this,a)};h.ma=function(){var a=this.a.a;return R(this.b,pi(a.g,ki("192.168.255.249"),a.b,{ssid:this.f.ssid,bssid:this.f.bssid},a.h()))};
h.S=function(a){var b=this.a.a,c=X(this),d=$f(this.f.type);c.sendMessage(new Ia(1===a&&3||2===a&&4||3===a&&5||null,d,this.f.name));3===a&&ng(this.c,ug(c,"BadDeviceAck")).then(b.f.bind(b))};h.L=function(a){var b=this.a.a,c=X(this);c.sendMessage(new La(a,this.f.name,this.f.ssid));5===a&&ng(this.c,ug(c,"BadDeviceAck")).then(b.f.bind(b))};h.na=function(a){a=a.getState();this.a.h(a);a.eurekaInfoState.features.supportsDisplay?Wj(this.a,new M(3)):Wj(this.a,new M(4))};
h.N=function(a){(a=uk.get(a))&&Y(this.a,a)};var vk=function(a,b,c,d,e){var f=I(),g=new Ui(b,c,d,e),l=function(b){return b.X.getState().eurekaInfoState.ssdpUdn===a},p=function(a){(a=zb(a.devices,l))&&f.b(a.ipAddress)};g.listen("devices",p);var t=null;g.start().then(function(){t=setInterval(function(){g.ta()},5E3)});var W=setTimeout(f.c.bind(f),18E4);return J(f.a,function(){clearTimeout(W);clearInterval(t);g.B("devices",p);g.stop()})};var wk=function(a){V.call(this,a,this.i.bind(this),null);this.c=null;this.l=0;this.f=null;this.h=0};u(wk,V);wk.prototype.i=function(){var a=this;Y(a.a,30);return R(this.b,Vj(this.a)).then(function(b){a.c=b;X(a).sendMessage(new v("OtaUpdate.Pending"));xk(a,0)})};
var xk=function(a,b){K(R(a.b,S(b)).then(function(){++a.l;return R(a.b,li(a.c,{options:["ota_status","setup.setup_state"]}))}).then(function(b){var c=ri(a.c),e=0;7<=a.c.a&&(e=b.ota_status.download_progress);if(a.f!==c.setupState||e!==a.h)a.f=c.setupState,a.h=e,60===a.f&&a.g();xk(a,3E3)}),function(b){Bf(b);b=a.c.getState().eurekaInfoState.ssdpUdn;var c=a.a.a;R(a.b,vk(b,c.b,c.i,c.g,c.window)).then(a.g.bind(a),a.j.bind(a))})};
wk.prototype.g=function(){Y(this.a,31);var a=X(this);R(this.b,ug(a,"OtaUpdate.Proceed")).then(function(){nk(this.a)}.bind(this));a.sendMessage(new v("OtaUpdate.Done"))};wk.prototype.j=function(){};var yk=function(a,b,c){this.f=new Q(this.m.bind(this),this.l.bind(this));this.a=a;this.j=b;this.b=c;this.c=null;this.i=new O;U(b).addListener("RestartSetup",this.s.bind(this));U(b).addListener("GoToDeviceList",this.a.f.bind(this.a))},zk=function(a){N.call(this,"newState");this.state=a};u(zk,N);yk.prototype.start=function(){return this.f.start()};yk.prototype.stop=function(){return this.f.stop()};
var nk=function(a){var b=Z(a),c=a.b.setupApiClientState||null,d=c.deviceIpAddress,c=c.eurekaInfoState;Y(a,b.device&&b.device.bssid?25:28);b=new Hg("deviceJustSetUp");b.deviceJustSetUp=new Ig(d,c.name,c.ssdpUdn,c.modelName);a.a.l.setItem("showDeviceBanner",d);Le(a.a.a,a.b);J(R(a.f,Cf(a.a.i.sendMessage(b),1E4)),function(){J(a.stop(),function(){a.a.f()})})},Vj=function(a){var b={read:function(){return a.b.setupApiClientState||null},write:a.h.bind(a)};return ni(a.a.g,b,a.a.h())};
yk.prototype.h=function(a){a?this.b.setupApiClientState=a:delete this.b.setupApiClientState;Ke(this.a.a,this.b)};
var Z=function(a){return a.b.commonState||new Be},kk=function(a,b){b?a.b.commonState=b:delete a.b.commonState;Ke(a.a.a,a.b)},Wj=function(a,b){a.c.stop().then(function(){if(a.b.states){var c=a.b.states;c.all=c.all.slice(0,c.current+1);c.all.push(b);c.current=c.all.length-1}else a.b.states=new Ge(0,[b]);Ke(a.a.a,a.b);a.c=a.a.j(a,b.type);P(a.i,new zk(b.type));K(R(a.f,a.c.start()),function(b){if(b instanceof L)switch(a.f.getState()){case "starting":case "started":a.g()}else a.g()})})};
yk.prototype.g=function(){Le(this.a.a,this.b);U(this.j).sendMessage(new v("ShowGenericSetupError"));K(this.stop(),ba)};var Y=function(a,b){a.a.c.b(b)};
yk.prototype.m=function(){var a=this.b.states.all[this.b.states.current].type;this.c=this.a.j(this,a);P(this.i,new zk(a));null===this.a.a.getItem("setupNoCountryDetection")&&(a=Z(this),a.country||a.connectedHotSpotBssid||R(this.f,U(this.j).sendRequest(new nb)).then(function(a){var b=Z(this);b.country||(b.country=a.countryCode,kk(this,b))}.bind(this)));return this.c.start()};yk.prototype.l=function(){var a=this.c;this.c=null;P(this.i,new zk(null));return a.stop()};
yk.prototype.s=function(){Le(this.a.a,this.b);this.a.m()};var Ak=function(a){V.call(this,a,this.D.bind(this),this.A.bind(this));this.c=1;this.h=this.g=null;this.f=new A;this.i=new A;this.j=null;this.o=this.J.bind(this);this.l=this.w.bind(this)};u(Ak,V);
Ak.prototype.D=function(){var a=this;Bk(a,1);X(a).addListener("SetupStart.Proceed",a.o);var b=[];b.push(R(a.b,this.a.a.c.a()).then(function(b){a.j=b}));var c=Z(a.a);c.device&&!c.pinned&&(c.device=void 0,kk(a.a,c));var d=a.a.a;a.h=new Ui(d.b,d.i,d.g,d.window);d=a.h.f.a;d.listen("added",a.m,!0,a);d.listen("connected",a.s,!0,a);a.h.listen("devices",this.l);b.push(R(a.b,a.h.start()));sg(a.b).then(function(){c.pinned&&c.device?(a.g=c.device,Bk(a,4),Ck(a)):0!=a.i.c?Dk(a,a.i.P(!1).next()):ac(a.f,function(b){if("NotConnected"===
b.ConnectionState)return!0;Ek(a,b);return!1})&&(Bk(a,2),Ck(a),R(a.b,S(5E3)).then(a.I.bind(a)))});return vd(b)};Ak.prototype.A=function(){this.c=1;this.g=null;this.f=new A;this.i=new A;this.j=null;X(this).removeListener("SetupStart.Proceed",this.o);if(!this.h)return G();var a=this.h;this.h=null;var b=a.f.a;b.B("added",this.m,!0,this);b.B("connected",this.s,!0,this);a.B("devices",this.l);return a.stop()};
var Bk=function(a,b){b!==a.c&&(a.c=b)},Ck=function(a){var b=X(a);switch(a.c){case 1:case 2:b.sendMessage(new Ga(!1));break;case 3:b.sendMessage(new Ga(!0));break;case 4:Fk(a,1);break;case 5:Fk(a,2);break;case 6:Fk(a,3);break;case 7:Fk(a,4)}},Fk=function(a,b){var c=$f(a.g.type);b=new Ia(b,c,a.g.name);b.otherDevicesExist=1<a.f.u()+a.i.u();b.analyticsOptIn=3!==a.j;X(a).sendMessage(b)};
Ak.prototype.I=function(){if(2===this.c)if(0===this.f.u())Bk(this,3),Ck(this);else{var a=$b(this.f,function(a,c){return"NotConnected"!==c.ConnectionState?c:(c.WiFi&&c.WiFi.SignalStrength||-Infinity)<(a&&a.WiFi&&a.WiFi.SignalStrength||-Infinity)?a:c});Ek(this,a)}};
var Ek=function(a,b){b=b&&b.WiFi;var c=b.SSID,d=Vf(c);a.g=new Ce({name:d.name,type:d.type,ssid:c,bssid:b.BSSID});Bk(a,4);Ck(a)},Dk=function(a,b){var c=b.X.getState().eurekaInfoState;a.g=new Ce({name:c.name,type:c.deviceType,ipAddress:b.ipAddress});Bk(a,4);Ck(a)};Ak.prototype.m=function(a){a=a.a;var b=!dc(this.f,a.GUID);this.f.set(a.GUID,a);4===this.c?b&&Ck(this):3===this.c&&Ek(this,a)};Ak.prototype.s=function(a){2!==this.c&&3!==this.c||Ek(this,a.a)};
Ak.prototype.w=function(a){var b=this,c=null;a.devices.filter(function(a){a=a.X.getState().eurekaInfoState;return a.features.supportsSetup&&a.ethernetConnected&&!a.tosAccepted}).forEach(function(a){dc(b.i,a.ipAddress)||(b.i.set(a.ipAddress,a),c=c||a)});c&&(2===b.c||3===b.c?Dk(b,c):4===b.c&&Ck(b))};
Ak.prototype.J=function(){var a=this;4!==a.c&&7!==a.c||Gk(a).then(function(){var b=Z(a.a);b.device=a.g;kk(a.a,b);if(b.device.bssid)Y(a.a,3),Wj(a.a,new M(2));else{Y(a.a,27);Bk(a,6);Ck(a);var c=a.a.a;K(R(a.b,ni(c.g,ki(b.device.ipAddress),c.h())).then(function(b){a.a.h(b.getState());Y(a.a,27);Wj(a.a,new M(5))}),function(){Bk(a,7);Ck(a)})}})};
var Gk=function(a){var b=a.a.a.a;if(null!==b.getItem("setupTosAccepted"))return G();var c=a.a.a.c,d=R(a.b,ug(X(a),"SetupStart.TosAccepted")).then(function(a){c.g(a.analyticsOptIn);b.setItem("setupTosAccepted","")}.bind(a));Bk(a,5);Ck(a);return d};var Ik=function(a){this.f=a;this.b=new O;this.networks=new A;this.c=!1;this.a=new Q(function(){Hk(this);return G()}.bind(this),function(){this.networks.clear();this.c=!1;return G()}.bind(this))},Lk=function(a){this.id=Jk(a);this.ssid=a.ssid;this.Ma=a.wpa_auth;this.Na=a.wpa_cipher;this.Oa=a.wpa_id;this.la=new B;this.Y=a.signal_level;this.Ga=this.ia=!1;Kk(this,a)},Kk=function(a,b){gc(a.la,b.bssid);a.Y=Math.max(a.Y,b.signal_level);b.ap_list&&b.ap_list.forEach(function(a){gc(this.la,a.bssid);this.Y=Math.max(this.Y,
a.signal_level);this.ia=this.ia||5E3<=a.frequency}.bind(a))},Mk=function(){N.call(this,"error")};u(Mk,N);var Nk=function(){this.networks=new A;this.a=0;this.O=I()},Jk=function(a){return a.wpa_id?a.wpa_id.toString():a.ssid+":"+a.wpa_auth+":"+a.wpa_cipher};Ik.prototype.start=function(){return this.a.start()};Ik.prototype.stop=function(){return this.a.stop()};
var Hk=function(a){K(R(a.a,yi(a.f)).then(function(){R(a.a,S(3E3))}).then(function(){var b=new Nk;a.g(b);return b.O.a}).then(a.h.bind(a)).then(function(){return R(a.a,S(1E3))}).then(function(){Hk(a)}),function(b){Bf(b);P(a.b,new Mk);a.stop()})};Ik.prototype.g=function(a){K(R(this.a,xi(this.f)).then(this.i.bind(this,a)).then(function(){3===a.a?a.O.b(a.networks):R(this.a,S(2E3)).then(this.g.bind(this,a))}.bind(this)),function(b){a.O.c(b)})};
Ik.prototype.i=function(a,b){var c=!1,d=!1;b.filter(function(a){return 1!==a.wpa_auth?!0:!Uf(a.bssid)}).forEach(function(b){var e=Jk(b),g=a.networks.get(e);g?Kk(g,b):(g=new Lk(b),a.networks.set(e,g),c=!0,dc(this.networks,e)||(this.networks.set(e,g),d=!0))}.bind(this));a.a=c?0:a.a+1;if(d||!this.c)P(this.b,new N("networksAdded")),this.c=!0};
Ik.prototype.h=function(a){a.forEach(function(a){a.Ga=!0});Zb(ic(new B(this.networks.C()),a.C()),function(b){var c=this.networks.get(b);c.Y=-Infinity;a.set(b,c)}.bind(this));this.networks=a;P(this.b,new N("scanCompleted"))};var Ok=function(a){V.call(this,a,this.w.bind(this),this.o.bind(this));this.h=this.f=this.c=this.g=null;this.s=this.i.bind(this);this.j=this.A.bind(this);this.m=this.D.bind(this)};u(Ok,V);
Ok.prototype.w=function(){var a=this;return R(a.b,Vj(a.a)).then(function(b){a.g=b;var c=null;b=X(a);c=Z(a.a);a.f=c.connectWiFi||null;if(a.f){var d=eg(a.f);delete c.connectWiFi;kk(a.a,c);2===a.f.b?c=a.i():(b.addListener("WiFiConfig.ErrorAck",a.s),c=G());Pk(a,d)}else c=a.i(),R(a.b,S(7E3)).then(function(){a.h||Pk(a,new Ya(1,[],null))});b.addListener("WiFiConfig.Retry",a.m);return c})};
Ok.prototype.i=function(){if(this.c)return G();this.c=new Ik(this.g);this.c.b.listen("networksAdded",this.l,!0,this);X(this).addListener("WiFiConfig.Connect",this.j);Qk(this);return this.c.start()};Ok.prototype.o=function(){this.h=this.g=null;var a=X(this);a.removeListener("WiFiConfig.Connect",this.j);a.removeListener("WiFiConfig.Retry",this.m);a.removeListener("WiFiConfig.ErrorAck",this.s);return this.c?(this.c.b.B("networksAdded",this.l,!0,this),a=this.c,this.c=null,a.stop()):G()};
var Pk=function(a,b){a.h=b;X(a).sendMessage(b)};Ok.prototype.l=function(){if(this.h)X(this).sendMessage(new Za(this.c.networks.v().map(function(a){return new Xa(a.id,a.ssid,ag(a.Ma))})));else{var a=Z(this.a),b=a.originalWiFiNetwork&&a.originalWiFiNetwork.bssid,c=[],d=null;Zb(this.c.networks,function(a){var e=new Xa(a.id,a.ssid,ag(a.Ma));c.push(e);b&&a.la.contains(b)&&(d=e)});Pk(this,new Ya(1,c,d))}};
Ok.prototype.A=function(a){var b=this,c=Rk(b,a);R(b.b,new F(function(d){a.password?d(Sk(b,a.password).then(function(a){c.a.enc_passwd=a})):d()})).then(function(){return R(b.b,Tk(b,c))}).then(function(d){d?(b.f=c,Pk(b,new Ya(5,b.h.networks,a.network))):(d=Z(b.a),d.connectWiFi=c,kk(b.a,d),K(ti(b.g,c.a),ba),Y(b.a,15),Wj(b.a,new M(7)))})};
var Rk=function(a,b){var c=new Ee(new ae(b.network.ssid,bg(b.network.security)));b.network.id&&(c.c=b.network.id,a.c&&dc(a.c.networks,b.network.id)?(a=a.c.networks.get(b.network.id),a.Na&&(c.a.wpa_cipher=a.Na),a.Oa&&(c.a.wpa_id=a.Oa)):a.f&&a.f.c===b.network.id&&(a=a.f.a,a.wpa_cipher&&(c.a.wpa_cipher=a.wpa_cipher),a.wpa_id&&(c.a.wpa_id=a.wpa_id)));return c},Tk=function(a,b){var c=Z(a.a);if("m"!==(c.device&&c.device.type))return G(!1);var d=b.c;if(!d)return G(!1);if(b=a.c.networks.get(d)){if(b.ia)return G(!1);
if(b.Ga)return G(!0)}return Af(a.c.b,"scanCompleted").then(function(){var b=a.c.networks.get(d);return b&&!b.ia})};Ok.prototype.D=function(){var a=Z(this.a);a.connectWiFi=this.f;kk(this.a,a);K(ti(this.g,a.connectWiFi.a),ba);Y(this.a,15);Wj(this.a,new M(7))};
var Sk=function(a,b){var c=a.g.getState().verificationState.verificationProperties;return a.a.a.b.verifyAndEncryptData(c,b)},Qk=function(a){var b=a.g.a;if(!(4>b)){var c=Z(a.a).country,d=null;7>b?(b=new ye,b.location=new he,b.location.country_code=c,d=b):(b=new ze,b.settings=new oe,b.settings.country_code=c,d=b);K(R(a.b,zi(a.g,d)),function(){})}};var Uk=function(a){var b=Z(a).connectWiFi,c=Oe(a.a.a);y("Macintosh")&&1!==b.a.wpa_auth&&(c=!1);pk.call(this,a,b.a.ssid,null,c);this.f=null};u(Uk,pk);var Vk=new A(1,20,2,21,3,22,4,23,5,24);Uk.prototype.m=function(){this.f=null;return Uk.H.m.call(this)};var Wk=function(a){return a.f?G(a.f):R(a.b,Vj(a.a)).then(function(b){a.f=ri(b).connectedIpAddress;return a.f})};h=Uk.prototype;h.ma=function(){var a=this;return Wk(a).then(function(b){return R(a.b,ni(a.a.a.g,ki(b)))})};
h.S=function(a){var b=Z(this.a),c=b.connectWiFi;a=2===a||3===a?1:void 0;c.b!==a&&(c.b=a,kk(this.a,b));X(this).sendMessage(eg(c))};h.L=function(a){var b=Z(this.a).connectWiFi;X(this).sendMessage(new Ma(a,b.a.ssid))};h.na=function(a){this.a.h(a.getState());Wj(this.a,new M(9))};h.N=function(a){(a=Vk.get(a))&&Y(this.a,a)};var Rj=function(a,b){switch(b){case 1:return new Ak(a);case 2:return new tk(a);case 3:return new Xj(a);case 4:return new Uj(a);case 5:return new mk(a);case 6:return new Ok(a);case 7:return new dk(a);case 8:return new Uk(a);case 9:return new ok(a);case 10:return new wk(a);default:return new V(a,null,null)}};var Xk=null;r("castApp.app.setupManager",Xk);var Yk={Bb:"devices",Cb:"offers",Db:"setup",ERROR:"error"},Zk=function(a){if(!a||"#"==a)return{};a.startsWith("#")&&(a=a.slice(1));var b=a.split("/");if(!(0<=vb(Qb(Yk),b[0])))return{};a={R:b[0]};if(b[1])switch(a.R){case "devices":b=decodeURIComponent(b[1]);Wc(b)&&(a.ipAddress=b);break;case "setup":a.ua=b[1]}return a};window.addEventListener("hashchange",function(a){var b=Wd(a.oldURL).g;a=Wd(a.newURL).g;Zk(b).R!==Zk(a).R&&location.reload()});
var Sj=function(){window.location.hash="devices"},$k=function(a){window.location.hash="setup/"+a},al=function(a){window.location.hash="devices/"+encodeURIComponent(a)},bl=function(){window.location.hash="error"},cl=function(a){if(y("Linux"))bl();else{var b=chrome.metricsPrivate?new Se(window.localStorage):new Re,c=chrome.networkingPrivate?kg.da():null,d=new Tj(window,c,new hi,b),e=new Lj(window,a),f=function(){var a=Zk(window.location.hash);if("setup"===a.R){var b=null;if(a.ua){if(Xk&&Xk.b.id===a.ua)return;
b=zb(Ie(d.a),function(b){return b.id===a.ua})}b||(b=new Ae(sa()),b.states=new Ge(0,[new M(1)]),Ke(d.a,b),window.history.replaceState(null,"","#setup/"+b.id));Xk&&Xk.stop();Xk=new yk(d,e,b);Xk.start()}};e.start().then(function(){f();window.addEventListener("hashchange",f)})}},dl=function(a){if(y("Linux"))bl();else{var b=new Lj(window,a),c=chrome.networkingPrivate?kg.da():null;chrome.dial&&yj.da();var d=new Lg,e=new hi,f=new Dg(window,b,e,$k,Sj,al,window.location.reload.bind(window.location),new jg,
a,chrome.i18n.getUILanguage,new Ui(c,d,e,window)),g=null,l=null,p=function(a){if(!l||l.i!==a){var b=g&&g.stop()||l&&l.stop()||G();g=null;var c=l=new uj(f,a);b.then(function(){l===c&&K(l.start(),Sj)})}},t=function(){if(!g){var a=l&&l.stop()||G(),b=g=new lj(f);l=null;a.then(function(){b===g&&g.start()})}},W=function(){var a=Zk(location.hash);"devices"===a.R&&(a.ipAddress?p(a.ipAddress):t())};b.start().then(function(){W();window.addEventListener("hashchange",W)})}},el=function(a){var b=new Lj(window,
a);a=chrome.dial?yj.da():null;var c=chrome.metricsPrivate?new Se(window.localStorage):new Re,d=new Pj(window,b,a,new hi,c);b.start().then(function(){var a=U(b),c=new A;a.addListener("Offers.Scan",function(a){var b=a.scanId;dc(c,b)||(a=new Qj(d,b),c.set(b,a),Af(a.c.c,"stopped").then(function(){c.remove(b)}),a.start())});a.addListener("Offers.Redeem",function(a){window.location=a.url});a.addListener("Offers.AnalyticsEvent",function(a){d.c.f(a)});a.sendMessage(new v("Offers.Show"))})};
window.addEventListener("load",function(){var a=new Ag(window);xf(a.f,function(){bl()});xg||(xg=!0);Je();switch(Zk(location.hash).R){case "devices":dl(a);break;case "offers":el(a);break;case "setup":cl(a);break;case "error":Mj();break;default:Sj()}});
