'use strict';var h,aa="function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){a!=Array.prototype&&a!=Object.prototype&&(a[b]=c.value)},ba="undefined"!=typeof window&&window===this?this:"undefined"!=typeof global&&null!=global?global:this,ca=function(){ca=function(){};ba.Symbol||(ba.Symbol=da)},ea=0,da=function(a){return"jscomp_symbol_"+(a||"")+ea++},ga=function(){ca();var a=ba.Symbol.iterator;a||(a=ba.Symbol.iterator=ba.Symbol("iterator"));"function"!=typeof Array.prototype[a]&&
aa(Array.prototype,a,{configurable:!0,writable:!0,value:function(){return fa(this)}});ga=function(){}},fa=function(a){var b=0;return ha(function(){return b<a.length?{done:!1,value:a[b++]}:{done:!0}})},ha=function(a){ga();a={next:a};a[ba.Symbol.iterator]=function(){return this};return a},ia=function(a){ga();var b=a[Symbol.iterator];return b?b.call(a):fa(a)},ja=function(a,b,c){if(null==a)throw new TypeError("The 'this' value for String.prototype."+c+" must not be null or undefined");if(b instanceof
RegExp)throw new TypeError("First argument to String.prototype."+c+" must not be a regular expression");return a+""},ka=function(a,b){if(b){var c=ba;a=a.split(".");for(var d=0;d<a.length-1;d++){var e=a[d];e in c||(c[e]={});c=c[e]}a=a[a.length-1];d=c[a];b=b(d);b!=d&&null!=b&&aa(c,a,{configurable:!0,writable:!0,value:b})}};
ka("String.prototype.endsWith",function(a){return a?a:function(a,c){var b=ja(this,a,"endsWith");a+="";void 0===c&&(c=b.length);c=Math.max(0,Math.min(c|0,b.length));for(var e=a.length;0<e&&0<c;)if(b[--c]!=a[--e])return!1;return 0>=e}});ka("String.prototype.startsWith",function(a){return a?a:function(a,c){var b=ja(this,a,"startsWith");a+="";var e=b.length,f=a.length;c=Math.max(0,Math.min(c|0,b.length));for(var g=0;g<f&&c<e;)if(b[c++]!=a[g++])return!1;return g>=f}});
var la=la||{},k=this,m=function(a){return void 0!==a},ma=function(){},na=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},oa=function(a){return"array"==na(a)},pa=function(a){var b=na(a);return"array"==b||"object"==b&&"number"==typeof a.length},n=function(a){return"string"==typeof a},qa=function(a){return"number"==typeof a},ra=function(a){return"function"==na(a)},sa=function(a){var b=typeof a;return"object"==b&&null!=a||"function"==b},ta="closure_uid_"+
(1E9*Math.random()>>>0),ua=0,va=function(a,b,c){return a.call.apply(a.bind,arguments)},wa=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)}},xa=function(a,b,c){Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?xa=va:xa=wa;return xa.apply(null,arguments)},
ya=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)}},za=Date.now||function(){return+new Date},q=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[d]!==Object.prototype[d]?c=c[d]:c=c[d]={}},t=function(a,b){function c(){}c.prototype=b.prototype;a.H=b.prototype;a.prototype=new c;a.prototype.constructor=a;
a.xb=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 u=function(a){if(Error.captureStackTrace)Error.captureStackTrace(this,u);else{var b=Error().stack;b&&(this.stack=b)}a&&(this.message=String(a))};t(u,Error);u.prototype.name="CustomError";var Aa=String.prototype.trim?function(a){return a.trim()}:function(a){return a.replace(/^[\s\xa0]+|[\s\xa0]+$/g,"")},Ba=function(a,b){a=String(a).toLowerCase();b=String(b).toLowerCase();return a<b?-1:a==b?0:1},Ca=function(){return Math.floor(2147483648*Math.random()).toString(36)+Math.abs(Math.floor(2147483648*Math.random())^za()).toString(36)},Ea=function(a,b){var c=0;a=Aa(String(a)).split(".");b=Aa(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=Da(0==f[1].length?0:parseInt(f[1],10),0==g[1].length?0:parseInt(g[1],10))||Da(0==f[2].length,0==g[2].length)||Da(f[2],g[2]);f=f[3];g=g[3]}while(0==c)}return c},Da=function(a,b){return a<b?-1:a>b?1:0};var Fa=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(n(a))return n(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},Ga=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(n(a))return n(b)&&1==b.length?a.lastIndexOf(b,c):-1;for(;0<=
c;c--)if(c in a&&a[c]===b)return c;return-1},Ha=Array.prototype.forEach?function(a,b,c){Array.prototype.forEach.call(a,b,c)}:function(a,b,c){for(var d=a.length,e=n(a)?a.split(""):a,f=0;f<d;f++)f in e&&b.call(c,e[f],f,a)},Ia=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=n(a)?a.split(""):a,g=0;g<d;g++)g in f&&(e[g]=b.call(c,f[g],g,a));return e},Ja=function(a,b){a:{for(var c=a.length,d=n(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:n(a)?a.charAt(b):a[b]},Ka=function(a){if(!oa(a))for(var b=a.length-1;0<=b;b--)delete a[b];a.length=0},Ma=function(a,b){b=Fa(a,b);var c;(c=0<=b)&&La(a,b);return c},La=function(a,b){Array.prototype.splice.call(a,b,1)},Na=function(a){return Array.prototype.concat.apply([],arguments)},Oa=function(a){return Array.prototype.concat.apply([],arguments)},Pa=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[]},
Qa=function(a,b){for(var c=1;c<arguments.length;c++){var d=arguments[c];if(pa(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)}},Sa=function(a,b,c,d){Array.prototype.splice.apply(a,Ra(arguments,1))},Ra=function(a,b,c){return 2>=arguments.length?Array.prototype.slice.call(a,b):Array.prototype.slice.call(a,b,c)},Ta=function(a,b){return a>b?1:a<b?-1:0};var Ua="StopIteration"in k?k.StopIteration:{message:"StopIteration",stack:""},Va=function(){};Va.prototype.next=function(){throw Ua;};Va.prototype.M=function(){return this};
var Wa=function(a){if(a instanceof Va)return a;if("function"==typeof a.M)return a.M(!1);if(pa(a)){var b=0,c=new Va;c.next=function(){for(;;){if(b>=a.length)throw Ua;if(b in a)return a[b++];b++}};return c}throw Error("Not implemented");},Xa=function(a,b){if(pa(a))try{Ha(a,b,void 0)}catch(c){if(c!==Ua)throw c;}else{a=Wa(a);try{for(;;)b.call(void 0,a.next(),void 0,a)}catch(c){if(c!==Ua)throw c;}}},Ya=function(a,b){var c=null;Xa(a,function(a){c=b.call(void 0,c,a)});return c},Za=function(a,b){a=Wa(a);
try{for(;;)if(!b.call(void 0,a.next(),void 0,a))return!1}catch(c){if(c!==Ua)throw c;}return!0};var $a=function(a,b,c){for(var d in a)b.call(c,a[d],d,a)},ab=function(a,b){for(var c in a)if(b.call(void 0,a[c],c,a))return!0;return!1},bb=function(a){var b=[],c=0,d;for(d in a)b[c++]=a[d];return b},cb=function(a){var b=[],c=0,d;for(d in a)b[c++]=d;return b},v=function(a,b,c){b in a||(a[b]=c)},db=function(a){var b={},c;for(c in a)b[c]=a[c];return b},eb="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),fb=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<eb.length;f++)c=eb[f],Object.prototype.hasOwnProperty.call(d,c)&&(a[c]=d[c])}};var w=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 w?(c=a.C(),d=a.u()):(c=cb(a),d=bb(a));for(var e=0;e<c.length;e++)this.set(c[e],d[e])}};w.prototype.s=function(){return this.c};w.prototype.u=function(){gb(this);for(var a=[],b=0;b<this.a.length;b++)a.push(this.b[this.a[b]]);return a};w.prototype.C=function(){gb(this);return this.a.concat()};
var ib=function(a,b){return hb(a.b,b)};w.prototype.clear=function(){this.b={};this.f=this.c=this.a.length=0};w.prototype.remove=function(a){return hb(this.b,a)?(delete this.b[a],this.c--,this.f++,this.a.length>2*this.c&&gb(this),!0):!1};var gb=function(a){if(a.c!=a.a.length){for(var b=0,c=0;b<a.a.length;){var d=a.a[b];hb(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],hb(e,d)||(a.a[c++]=d,e[d]=1),b++;a.a.length=c}};
w.prototype.get=function(a,b){return hb(this.b,a)?this.b[a]:b};w.prototype.set=function(a,b){hb(this.b,a)||(this.c++,this.a.push(a),this.f++);this.b[a]=b};w.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)}};w.prototype.M=function(a){gb(this);var b=0,c=this.f,d=this,e=new Va;e.next=function(){if(c!=d.f)throw Error("The map has changed since the iterator was created");if(b>=d.a.length)throw Ua;var e=d.a[b++];return a?e:d.b[e]};return e};
var hb=function(a,b){return Object.prototype.hasOwnProperty.call(a,b)};var jb=function(a){if(a.u&&"function"==typeof a.u)return a.u();if(n(a))return a.split("");if(pa(a)){for(var b=[],c=a.length,d=0;d<c;d++)b.push(a[d]);return b}return bb(a)},kb=function(a,b){if(a.forEach&&"function"==typeof a.forEach)a.forEach(b,void 0);else if(pa(a)||n(a))Ha(a,b,void 0);else{var c;if(a.C&&"function"==typeof a.C)c=a.C();else if(a.u&&"function"==typeof a.u)c=void 0;else if(pa(a)||n(a)){c=[];for(var d=a.length,e=0;e<d;e++)c.push(e)}else c=cb(a);for(var d=jb(a),e=d.length,f=0;f<e;f++)b.call(void 0,
d[f],c&&c[f],a)}};var x=function(a){this.a=new w;if(a){a=jb(a);for(var b=a.length,c=0;c<b;c++)lb(this,a[c])}},mb=function(a){var b=typeof a;return"object"==b&&a||"function"==b?"o"+(a[ta]||(a[ta]=++ua)):b.substr(0,1)+a};x.prototype.s=function(){return this.a.s()};var lb=function(a,b){a.a.set(mb(b),b)};x.prototype.removeAll=function(a){a=jb(a);for(var b=a.length,c=0;c<b;c++)this.remove(a[c])};x.prototype.remove=function(a){return this.a.remove(mb(a))};x.prototype.clear=function(){this.a.clear()};
x.prototype.contains=function(a){return ib(this.a,mb(a))};var nb=function(a,b){a=new x(a);a.removeAll(b);return a};x.prototype.u=function(){return this.a.u()};x.prototype.M=function(){return this.a.M(!1)};var ob;a:{var pb=k.navigator;if(pb){var qb=pb.userAgent;if(qb){ob=qb;break a}}ob=""}var y=function(a){return-1!=ob.indexOf(a)};var rb=function(){return(y("Chrome")||y("CriOS"))&&!y("Edge")};var sb=function(){return y("iPhone")&&!y("iPod")&&!y("iPad")};var tb=function(a){tb[" "](a);return a};tb[" "]=ma;var vb=function(a,b){var c=ub;return Object.prototype.hasOwnProperty.call(c,a)?c[a]:c[a]=b(a)};var wb=y("Opera"),z=y("Trident")||y("MSIE"),xb=y("Edge"),yb=y("Gecko")&&!(-1!=ob.toLowerCase().indexOf("webkit")&&!y("Edge"))&&!(y("Trident")||y("MSIE"))&&!y("Edge"),zb=-1!=ob.toLowerCase().indexOf("webkit")&&!y("Edge"),Ab=function(){var a=k.document;return a?a.documentMode:void 0},Bb;
a:{var Cb="",Db=function(){var a=ob;if(yb)return/rv\:([^\);]+)(\)|;)/.exec(a);if(xb)return/Edge\/([\d\.]+)/.exec(a);if(z)return/\b(?:MSIE|rv)[: ]([^\);]+)(\)|;)/.exec(a);if(zb)return/WebKit\/(\S+)/.exec(a);if(wb)return/(?:Version)[ \/]?(\S+)/.exec(a)}();Db&&(Cb=Db?Db[1]:"");if(z){var Eb=Ab();if(null!=Eb&&Eb>parseFloat(Cb)){Bb=String(Eb);break a}}Bb=Cb}var Fb=Bb,ub={},Gb=function(a){return vb(a,function(){return 0<=Ea(Fb,a)})},Hb;var Ib=k.document;
Hb=Ib&&z?Ab()||("CSS1Compat"==Ib.compatMode?parseInt(Fb,10):5):void 0;var Jb=function(a,b,c){this.g=c;this.c=a;this.f=b;this.b=0;this.a=null};Jb.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 Kb=function(a,b){a.f(b);a.b<a.g&&(a.b++,b.next=a.a,a.a=b)};var Lb=function(a){k.setTimeout(function(){throw a;},0)},Mb,Nb=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=xa(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.ua;c.ua=null;a()}};return function(a){d.next={ua: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 Ob=function(){this.b=this.a=null},Qb=new Jb(function(){return new Pb},function(a){a.reset()},100);Ob.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 Pb=function(){this.next=this.b=this.a=null};Pb.prototype.set=function(a,b){this.a=a;this.b=b;this.next=null};Pb.prototype.reset=function(){this.next=this.b=this.a=null};var Vb=function(a,b){Rb||Sb();Tb||(Rb(),Tb=!0);var c=Ub,d=Qb.get();d.set(a,b);c.b?c.b.next=d:c.a=d;c.b=d},Rb,Sb=function(){if(-1!=String(k.Promise).indexOf("[native code]")){var a=k.Promise.resolve(void 0);Rb=function(){a.then(Wb)}}else Rb=function(){var a=Wb;!ra(k.setImmediate)||k.Window&&k.Window.prototype&&!y("Edge")&&k.Window.prototype.setImmediate==k.setImmediate?(Mb||(Mb=Nb()),Mb(a)):k.setImmediate(a)}},Tb=!1,Ub=new Ob,Wb=function(){for(var a;a=Ub.remove();){try{a.a.call(a.b)}catch(b){Lb(b)}Kb(Qb,
a)}Tb=!1};var A=function(a,b){this.a=0;this.i=void 0;this.f=this.b=this.c=null;this.g=this.h=!1;if(a!=ma)try{var c=this;a.call(b,function(a){Xb(c,2,a)},function(a){Xb(c,3,a)})}catch(d){Xb(this,3,d)}},Yb=function(){this.next=this.context=this.b=this.f=this.a=null;this.c=!1};Yb.prototype.reset=function(){this.context=this.b=this.f=this.a=null;this.c=!1};
var Zb=new Jb(function(){return new Yb},function(a){a.reset()},100),$b=function(a,b,c){var d=Zb.get();d.f=a;d.b=b;d.context=c;return d},B=function(a){if(a instanceof A)return a;var b=new A(ma);Xb(b,2,a);return b},ac=function(a){return new A(function(b,c){c(a)})},cc=function(a,b,c){bc(a,b,c,null)||Vb(ya(b,a))},C=function(a){return new A(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],cc(p,ya(f,l),g);else b(e)})},
D=function(){var a,b,c=new A(function(c,e){a=c;b=e});return new dc(c,a,b)};A.prototype.then=function(a,b,c){return ec(this,ra(a)?a:null,ra(b)?b:null,c)};A.prototype.then=A.prototype.then;A.prototype.$goog_Thenable=!0;var E=function(a,b){b=$b(b,b,void 0);b.c=!0;fc(a,b);return a},F=function(a,b,c){return ec(a,null,b,c)};A.prototype.cancel=function(a){0==this.a&&Vb(function(){var b=new G(a);gc(this,b)},this)};
var gc=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?gc(c,b):(f?(d=f,d.next==c.f&&(c.f=d),d.next=d.next.next):hc(c),ic(c,e,3,b)))}a.c=null}else Xb(a,3,b)},fc=function(a,b){a.b||2!=a.a&&3!=a.a||jc(a);a.f?a.f.next=b:a.b=b;a.f=b},ec=function(a,b,c,d){var e=$b(null,null,null);e.a=new A(function(a,g){e.f=b?function(c){try{var e=b.call(d,c);a(e)}catch(r){g(r)}}:a;e.b=c?function(b){try{var e=c.call(d,
b);!m(e)&&b instanceof G?g(b):a(e)}catch(r){g(r)}}:g});e.a.c=a;fc(a,e);return e.a};A.prototype.l=function(a){this.a=0;Xb(this,2,a)};A.prototype.m=function(a){this.a=0;Xb(this,3,a)};
var Xb=function(a,b,c){0==a.a&&(a===c&&(b=3,c=new TypeError("Promise cannot resolve to itself")),a.a=1,bc(c,a.l,a.m,a)||(a.i=c,a.a=b,a.c=null,jc(a),3!=b||c instanceof G||kc(a,c)))},bc=function(a,b,c,d){if(a instanceof A)return fc(a,$b(b||ma,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(sa(a))try{var f=a.then;if(ra(f))return lc(a,f,b,c,d),!0}catch(g){return c.call(d,g),!0}return!1},lc=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)}},jc=function(a){a.h||(a.h=!0,Vb(a.j,a))},hc=function(a){var b=null;a.b&&(b=a.b,a.b=b.next,b.next=null);a.b||(a.f=null);return b};A.prototype.j=function(){for(var a;a=hc(this);)ic(this,a,this.a,this.i);this.h=!1};
var ic=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,mc(b,c,d);else try{b.c?b.f.call(b.context):mc(b,c,d)}catch(e){nc.call(null,e)}Kb(Zb,b)},mc=function(a,b,c){2==b?a.f.call(a.context,c):a.b&&a.b.call(a.context,c)},kc=function(a,b){a.g=!0;Vb(function(){a.g&&nc.call(null,b)})},nc=Lb,G=function(a){u.call(this,a)};t(G,u);G.prototype.name="cancel";var dc=function(a,b,c){this.a=a;this.b=b;this.c=c};var H=function(){return B("")};var I=function(a){this.type=a};q("castApp.protocol.Message",I);var oc=function(a){this.type=a;this.requestId=Ca()};t(oc,I);q("castApp.protocol.Request",oc);var K=function(a,b){this.type=a;this.responseTo=b.requestId};t(K,I);q("castApp.protocol.Response",K);var pc=function(a,b){K.call(this,"Error",a);this.errorName=b||"err-unknown"};t(pc,K);q("castApp.protocol.Error",pc);var qc=function(){};q("castApp.protocol.Handshake",qc);var rc=function(){oc.call(this,"Handshake.Request");this.coreVersion=6};
t(rc,oc);qc.Request=rc;var sc=function(a){K.call(this,"Handshake.Response",a);this.version=6;this.latestVersion=void 0};t(sc,K);qc.Response=sc;var tc=function(a,b){K.call(this,"Handshake.UiVersionNotSupported",a);this.latestVersion=b};t(tc,K);qc.UiVersionNotSupported=tc;var uc=function(a){this.type="SetSimpleState";this.state=a};t(uc,I);q("castApp.protocol.SetSimpleState",uc);var vc=function(){};q("castApp.protocol.ModalDialog",vc);
var wc=function(a){oc.call(this,"ModalDialog.Request");this.dialogId=a};t(wc,oc);vc.Request=wc;var xc=function(a,b){K.call(this,"ModalDialog.Response",a);this.button=b};t(xc,K);vc.Response=xc;var yc=function(a,b){this.type=a;this.deviceType=b};t(yc,I);q("castApp.protocol.MessageWithDeviceType",yc);var zc=function(){};q("castApp.protocol.DeviceDiscovery",zc);var Ac=function(a){this.type="DeviceDiscovery.ShowScanner";this.showTips=a};t(Ac,I);zc.ShowScanner=Ac;var Bc=function(){};
q("castApp.protocol.SetupStart",Bc);var Cc=function(a,b,c){this.type="SetupStart.ShowDevice";this.state=a;this.deviceType=b;this.deviceName=c;this.analyticsOptIn=this.otherDevicesExist=!1};t(Cc,I);Bc.ShowDevice=Cc;var Dc=function(a){this.type="SetupStart.TosAccepted";this.analyticsOptIn=a};t(Dc,I);Bc.TosAccepted=Dc;var Ec=function(){};q("castApp.protocol.WiFiSwitching",Ec);var Fc=function(a,b,c){this.type="WiFiSwitching.ConnectHotSpot";this.state=a;this.deviceName=b;this.ssid=c};t(Fc,I);
Ec.ConnectHotSpot=Fc;var Gc=function(a,b){this.type="WiFiSwitching.ReconnectWiFi";this.state=a;this.ssid=b};t(Gc,I);Ec.ReconnectWiFi=Gc;var Hc=function(){};q("castApp.protocol.CodeConfirmation",Hc);var Ic=function(a){oc.call(this,"CodeConfirmation.Request");this.code=a};t(Ic,oc);Hc.Request=Ic;var Jc=function(a,b){K.call(this,"CodeConfirmation.Response",a);this.confirmed=b};t(Jc,K);Hc.Response=Jc;var Kc=function(){};q("castApp.protocol.AudioConfirmation",Kc);
var Lc=function(a){this.type="AudioConfirmation.PromptUser";this.state=a};t(Lc,I);Kc.PromptUser=Lc;var Mc=function(a){this.type="AudioConfirmation.UserAction";this.action=a};t(Mc,I);Kc.UserAction=Mc;var Nc=function(){};q("castApp.protocol.DeviceConfig",Nc);var Oc=function(a,b,c){oc.call(this,"DeviceConfig.Request");this.deviceType=a;this.name=b;this.country=c};t(Oc,oc);Nc.Request=Oc;var Pc=function(a,b,c){K.call(this,"DeviceConfig.Response",a);this.name=b;this.country=c};t(Pc,K);Nc.Response=Pc;
var Qc=function(){};q("castApp.protocol.WiFiConfig",Qc);var Rc=function(a,b,c){this.id=a;this.ssid=b;this.security=c};Qc.Network=Rc;var Sc=function(a,b,c,d){this.type="WiFiConfig.Show";this.state=a;this.deviceType=b;this.networks=c;this.selectedNetwork=d};t(Sc,I);Qc.Show=Sc;var Tc=function(a){this.type="WiFiConfig.UpdateNetworks";this.networks=a};t(Tc,I);Qc.UpdateNetworks=Tc;var Uc=function(a,b){this.type="WiFiConfig.Connect";this.network=a;this.password=b};t(Uc,I);Qc.Connect=Uc;
var Vc=function(a){this.type="WiFiConfig.Retry";this.network=a};t(Vc,I);Qc.Retry=Vc;var Wc=function(){};q("castApp.protocol.Features",Wc);var Xc=function(){};Wc.DeviceSettings=Xc;var Yc=function(){this.supportsDisplay=this.supportsSetup=!1};Wc.Device=Yc;var Zc=function(){};q("castApp.protocol.Devices",Zc);var $c=function(a,b,c){this.id=a;this.type=b;this.displayName=c};Zc.DeviceProperties=$c;var ad=function(a,b){this.type="Devices.Show";this.devices=a;this.deviceName=b};t(ad,I);Zc.Show=ad;
var bd=function(a,b){this.type="Devices.UserAction";this.device=a;this.action=b};t(bd,I);Zc.UserAction=bd;var cd=function(){};q("castApp.protocol.DeviceSettings",cd);var dd=function(a,b){this.localeId=a;this.displayString=b};cd.Locale=dd;var ed=function(a,b,c){this.timeZoneId=a;this.displayString=b;this.offset=c};cd.TimeZone=ed;
var fd=function(a,b,c){this.type="DeviceSettings.Show";this.state=a;this.features=b;this.deviceType=c.deviceType;this.name=c.name;this.ssid=c.ssid;this.timeZoneId=c.timeZoneId;this.supportedTimeZones=c.supportedTimeZones;this.timeFormat=c.timeFormat;this.localeId=c.localeId;this.supportedLocales=c.supportedLocales;this.statsOptIn=c.statsOptIn;this.firmwareVersion=c.firmwareVersion;this.countryCode=c.countryCode;this.macAddress=c.macAddress;this.ipAddress=c.ipAddress};t(fd,I);cd.Show=fd;
var gd=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};t(gd,I);cd.Apply=gd;var hd=function(){};q("castApp.protocol.DetectCountry",hd);var id=function(){oc.call(this,"DetectCountry.Request")};t(id,oc);hd.Request=id;var jd=function(a,b){K.call(this,"DetectCountry.Response",a);this.countryCode=b};t(jd,K);hd.Response=jd;var kd=function(){};q("castApp.protocol.Offers",kd);
var ld=function(){this.type="Offers.Scan";this.scanId=Ca()};t(ld,I);kd.Scan=ld;var md=function(a,b,c,d){this.token=a;this.displayName=b;this.deviceType=c;this.ssdpUdn=d};kd.Device=md;var nd=function(a,b,c){this.type="Offers.ScanResults";this.scanId=a;this.devices=b;this.scanComplete=c};t(nd,I);kd.ScanResults=nd;var od=function(a){this.type="Offers.Redeem";this.url=a};t(od,I);kd.Redeem=od;var pd=function(a,b){this.type="Offers.AnalyticsEvent";this.eventType=a;this.offerId=b};t(pd,I);
kd.AnalyticsEvent=pd;var qd=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)}},rd={},sd=function(a){if(-128<=a&&128>a){var b=rd[a];if(b)return b}b=new qd([a|0],0>a?-1:0);-128<=a&&128>a&&(rd[a]=b);return b},ud=function(a){if(isNaN(a)||!isFinite(a))return td;if(0>a)return L(ud(-a));for(var b=[],c=1,d=0;a>=c;d++)b[d]=a/c|0,c*=4294967296;return new qd(b,0)},vd=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 L(vd(a.substring(1),b));if(0<=a.indexOf("-"))throw Error('number format error: interior "-" character');for(var c=ud(Math.pow(b,8)),d=td,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=ud(Math.pow(b,f)),d=wd(xd(d,f),ud(g))):(d=xd(d,c),d=wd(d,ud(g)))}return d},td=sd(0),yd=sd(1),zd=sd(16777216),Ad=function(a){if(-1==a.a)return-Ad(L(a));for(var b=0,c=1,d=0;d<a.b.length;d++)b+=Bd(a,d)*c,c*=4294967296;return b};
qd.prototype.toString=function(a){a=a||10;if(2>a||36<a)throw Error("radix out of range: "+a);if(Cd(this))return"0";if(-1==this.a)return"-"+L(this).toString(a);for(var b=ud(Math.pow(a,6)),c=this,d="";;){var e=Dd(c,b),c=Ed(c,xd(e,b)),f=((0<c.b.length?c.b[0]:c.a)>>>0).toString(a),c=e;if(Cd(c))return f+d;for(;6>f.length;)f="0"+f;d=""+f+d}};
var M=function(a,b){return 0>b?0:b<a.b.length?a.b[b]:a.a},Bd=function(a,b){a=M(a,b);return 0<=a?a:4294967296+a},Cd=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},Fd=function(a,b){a=Ed(a,b);return-1==a.a?-1:Cd(a)?0:1},L=function(a){for(var b=a.b.length,c=[],d=0;d<b;d++)c[d]=~a.b[d];a=new qd(c,~a.a);return wd(a,yd)},wd=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+(M(a,f)&65535)+(M(b,f)&65535),l=(g>>>16)+(M(a,f)>>>
16)+(M(b,f)>>>16),e=l>>>16,g=g&65535,l=l&65535;d[f]=l<<16|g}return new qd(d,d[d.length-1]&-2147483648?-1:0)},Ed=function(a,b){return wd(a,L(b))},xd=function(a,b){if(Cd(a)||Cd(b))return td;if(-1==a.a)return-1==b.a?xd(L(a),L(b)):L(xd(L(a),b));if(-1==b.a)return L(xd(a,L(b)));if(0>Fd(a,zd)&&0>Fd(b,zd))return ud(Ad(a)*Ad(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=M(a,e)>>>16,l=M(a,e)&65535,p=M(b,f)>>>16,r=M(b,f)&65535;d[2*
e+2*f]+=l*r;Gd(d,2*e+2*f);d[2*e+2*f+1]+=g*r;Gd(d,2*e+2*f+1);d[2*e+2*f+1]+=l*p;Gd(d,2*e+2*f+1);d[2*e+2*f+2]+=g*p;Gd(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 qd(d,0)},Gd=function(a,b){for(;(a[b]&65535)!=a[b];)a[b+1]+=a[b]>>>16,a[b]&=65535,b++},Dd=function(a,b){if(Cd(b))throw Error("division by zero");if(Cd(a))return td;if(-1==a.a)return-1==b.a?Dd(L(a),L(b)):L(Dd(L(a),b));if(-1==b.a)return L(Dd(a,L(b)));if(30<a.b.length){if(-1==a.a||-1==b.a)throw Error("slowDivide_ only works with positive integers.");
for(var c=yd;0>=Fd(b,a);)c=Hd(c,1),b=Hd(b,1);var d=Id(c,1),e=Id(b,1),f;b=Id(b,2);for(c=Id(c,2);!Cd(b);)f=wd(e,b),0>=Fd(f,a)&&(d=wd(d,c),e=f),b=Id(b,1),c=Id(c,1);return d}for(c=td;0<=Fd(a,b);){d=Math.max(1,Math.floor(Ad(a)/Ad(b)));e=Math.ceil(Math.log(d)/Math.LN2);e=48>=e?1:Math.pow(2,e-48);f=ud(d);for(var g=xd(f,b);-1==g.a||0<Fd(g,a);)d-=e,f=ud(d),g=xd(f,b);Cd(f)&&(f=yd);c=wd(c,f);a=Ed(a,g)}return c},Jd=function(a,b){for(var c=Math.max(a.b.length,b.b.length),d=[],e=0;e<c;e++)d[e]=M(a,e)|M(b,e);return new qd(d,
a.a|b.a)},Hd=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?M(a,f-c)<<b|M(a,f-c-1)>>>32-b:M(a,f-c);return new qd(e,a.a)},Id=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?M(a,f+c)>>>b|M(a,f+c+1)<<32-b:M(a,f+c);return new qd(e,a.a)};var Kd=function(a){this.a=a},Nd=function(a){try{return-1!=a.indexOf(":")?new Ld(a):new Md(a)}catch(b){return null}},Md=function(a){this.b=null;var b=td;if(a instanceof qd){if(0!=a.a||0>Fd(a,td)||0<Fd(a,Od))throw Error("The address does not look like an IPv4.");b=db(a)}else{if(!Pd.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=ud(e);b=Jd(Hd(b,8),e)}}this.a=b};t(Md,Kd);var Pd=/^[0-9.]*$/,Od=Ed(Hd(yd,32),yd);Md.prototype.toString=function(){if(this.b)return this.b;for(var a=Bd(this.a,0),b=[],c=3;0<=c;c--)b[c]=String(a&255),a>>>=8;return this.b=b.join(".")};
var Ld=function(a){this.b=null;var b=td;if(a instanceof qd){if(0!=a.a||0>Fd(a,td)||0<Fd(a,Qd))throw Error("The address does not look like a valid IPv6.");b=db(a)}else{if(!Rd.test(a))throw Error(a+" is not a valid IPv6 address.");var c=a.split(":");if(-1!=c[c.length-1].indexOf(".")){a=Bd(db((new Md(c[c.length-1])).a),0);var d=[];d.push((a>>>16&65535).toString(16));d.push((a&65535).toString(16));La(c,c.length-1);Qa(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=Oa(c,f,d)}}if(8!=c.length)throw Error(a+" is not a valid IPv6 address");for(d=0;d<c.length;d++){e=vd(c[d],16);if(0>Fd(e,td)||0<Fd(e,Sd))throw Error(c[d]+" in "+a+" is not a valid hextet.");b=Jd(Hd(b,16),e)}}this.a=b};t(Ld,Kd);
var Rd=/^([a-fA-F0-9]*:){2}[a-fA-F0-9:.]*$/,Sd=sd(65535),Qd=Ed(Hd(yd,128),yd);Ld.prototype.toString=function(){if(this.b)return this.b;for(var a=[],b=3;0<=b;b--){var c=Bd(this.a,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.b=a.join(":")};var Td=/^(?:([^:/?#.]+):)?(?:\/\/(?:([^/?#]*)@)?([^/#?]*?)(?::([0-9]+))?(?=[/#?]|$))?([^?#]+)?(?:\?([^#]*))?(?:#([\s\S]*))?$/,Ud=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 Vd=function(a,b){this.f=this.j=this.c="";this.h=null;this.g=this.b="";this.a=!1;var c;a instanceof Vd?(this.a=m(b)?b:a.a,Wd(this,a.c),this.j=a.j,this.f=a.f,Xd(this,a.h),this.b=a.b,b=a.i,c=new Yd,c.c=b.c,b.a&&(c.a=new w(b.a),c.b=b.b),Zd(this,c),this.g=a.g):a&&(c=String(a).match(Td))?(this.a=!!b,Wd(this,c[1]||"",!0),this.j=$d(c[2]||""),this.f=$d(c[3]||"",!0),Xd(this,c[4]),this.b=$d(c[5]||"",!0),Zd(this,c[6]||"",!0),this.g=$d(c[7]||"")):(this.a=!!b,this.i=new Yd(null,0,this.a))};
Vd.prototype.toString=function(){var a=[],b=this.c;b&&a.push(ae(b,be,!0),":");var c=this.f;if(c||"file"==b)a.push("//"),(b=this.j)&&a.push(ae(b,be,!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.b)this.f&&"/"!=c.charAt(0)&&a.push("/"),a.push(ae(c,"/"==c.charAt(0)?ce:de,!0));(c=this.i.toString())&&a.push("?",c);(c=this.g)&&a.push("#",ae(c,ee));return a.join("")};
var Wd=function(a,b,c){a.c=c?$d(b,!0):b;a.c&&(a.c=a.c.replace(/:$/,""))},Xd=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},Zd=function(a,b,c){b instanceof Yd?(a.i=b,fe(a.i,a.a)):(c||(b=ae(b,ge)),a.i=new Yd(b,0,a.a))},he=function(a){return a instanceof Vd?new Vd(a):new Vd(a,void 0)},$d=function(a,b){return a?b?decodeURI(a.replace(/%25/g,"%2525")):decodeURIComponent(a):""},ae=function(a,b,c){return n(a)?(a=encodeURI(a).replace(b,ie),c&&(a=a.replace(/%25([0-9a-fA-F]{2})/g,
"%$1")),a):null},ie=function(a){a=a.charCodeAt(0);return"%"+(a>>4&15).toString(16)+(a&15).toString(16)},be=/[#\/\?@]/g,de=/[\#\?:]/g,ce=/[\#\?]/g,ge=/[\#\?@]/g,ee=/#/g,Yd=function(a,b,c){this.b=this.a=null;this.c=a||null;this.f=!!c},je=function(a){a.a||(a.a=new w,a.b=0,a.c&&Ud(a.c,function(b,c){b=decodeURIComponent(b.replace(/\+/g," "));je(a);a.c=null;b=ke(a,b);var d=a.a.get(b);d||a.a.set(b,d=[]);d.push(c);a.b+=1}))};Yd.prototype.s=function(){je(this);return this.b};
Yd.prototype.remove=function(a){je(this);a=ke(this,a);return ib(this.a,a)?(this.c=null,this.b-=this.a.get(a).length,this.a.remove(a)):!1};Yd.prototype.clear=function(){this.a=this.c=null;this.b=0};var le=function(a,b){je(a);b=ke(a,b);return ib(a.a,b)};h=Yd.prototype;h.C=function(){je(this);for(var a=this.a.u(),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.u=function(a){je(this);var b=[];if(n(a))le(this,a)&&(b=Na(b,this.a.get(ke(this,a))));else{a=this.a.u();for(var c=0;c<a.length;c++)b=Na(b,a[c])}return b};h.set=function(a,b){je(this);this.c=null;a=ke(this,a);le(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.u(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.u(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 ke=function(a,b){b=String(b);a.f&&(b=b.toLowerCase());return b},fe=function(a,b){b&&!a.f&&(je(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(ke(this,c),Pa(a)),this.b+=a.length))},a));a.f=b};q("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 me=function(a,b){this.ssid=a;this.wpa_auth=b};q("castApp.core.setupApi.ConnectWiFiMsg",me);var ne=function(a,b,c,d,e,f,g,l,p,r,J){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=r;this.wpa_configured=J};q("castApp.core.setupApi.EurekaInfoMsg34Base",ne);
var oe=function(a,b,c,d,e,f,g,l,p,r){ne.call(this,3,a,b,c,d,e,f,g,l,p,r)};t(oe,ne);q("castApp.core.setupApi.EurekaInfoMsgV3",oe);oe.Location=function(a,b){this.latitude=a;this.longitude=b};var pe=function(a,b,c){this.certificate=a;this.nonce=b;this.signed_data=c};oe.Sign=pe;var qe=function(){};oe.Detail=qe;qe.Timezone=function(a,b){this.display_string=a;this.offset=b};qe.Locale=function(a){this.display_string=a};
var re=function(a,b,c,d,e,f,g,l,p,r,J,Xg){ne.call(this,a,b,c,d,e,f,g,l,p,r,J);this.uptime=Xg};t(re,ne);q("castApp.core.setupApi.EurekaInfoMsgV4",re);
var se=function(a){v(a,"locale","en-US");v(a,"debug_build",!1);v(a,"update_only_build",!1);v(a,"ethernet_connected",!1);v(a,"tos_accepted",!0);v(a,"time_format",0);v(a,"hdmi_control",!0);!n(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;v(b,"crash",!0);v(b,"stats",!0);v(b,"device_id",!1);v(b,"location",!1);v(b,"opencast",!1)}return a};re.SetupStats=function(){};var te=function(){};
re.Location=te;var ue=function(){};re.OptIn=ue;var ve=function(a,b,c){pe.call(this,a,b,c)};t(ve,pe);re.Sign=ve;var we=function(a){this.manufacturer="Google Inc.";this.model_name="Eureka Dongle";this.icon_list=a};t(we,qe);re.Detail=we;we.Icon=function(a,b,c,d){this.mimetype="image/png";this.width=a;this.height=b;this.depth=c;this.url=d};var xe=function(){};q("castApp.core.setupApi.EurekaInfoMsgV7",xe);
var ye=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,v(b,"display_supported",!0),v(b,"wifi_supported",!0),v(b,"wifi_regulatory_domain_locked",!1),v(b,"hotspot_supported",!0),v(b,"ble_supported",!1),v(b,"multizone_supported",!1))}a.net&&v(a.net,"ethernet_connected",!1);a.setup&&v(a.setup,"tos_accepted",!0);a.settings&&(b=a.settings,v(b,"time_format",1),
v(b,"locale","en-US"));return a};xe.BuildInfo=function(){};var ze=function(){};xe.DeviceInfo=ze;ze.Capabilities=function(){};xe.OtaStatus=function(){};xe.Net=function(){};xe.WiFi=function(){};var Ae=function(){};xe.Setup=Ae;Ae.Stats=function(){};var Be=function(){};xe.Settings=Be;var Ce=function(){};xe.OptIn=Ce;xe.OpenCast=function(){};xe.Multizone=function(){};var De=function(a){this.wpa_id=a};q("castApp.core.setupApi.ForgetWiFiMsg",De);
q("castApp.core.setupApi.GetAppDeviceIdRequestMsg",function(a){this.app_id=a});q("castApp.core.setupApi.GetAppDeviceIdResponseMsg",function(a,b,c){this.app_device_id=a;this.certificate=b;this.signed_data=c});q("castApp.core.setupApi.OfferMsg",function(a){this.token=a});var Ee=function(a){this.sound_id=a};q("castApp.core.setupApi.PlaySoundRequestMsg",Ee);q("castApp.core.setupApi.PlaySoundResponseMsg",function(a,b){this.volume=a;this.duration=b});var Fe=function(a){this.params=a};
q("castApp.core.setupApi.RebootMsg",Fe);var Ge=function(a,b,c,d,e){this.ssid=a;this.wpa_auth=b;this.wpa_cipher=c;this.bssid=d;this.signal_level=e};q("castApp.core.setupApi.ScanResultMsgBase",Ge);var He=function(a,b,c,d,e,f){Ge.call(this,a,b,c,d,e);this.ap_list=f};t(He,Ge);q("castApp.core.setupApi.ScanResultMsgV7",He);He.Ap=function(a,b,c){this.bssid=a;this.signal_level=b;this.frequency=c};var Ie=function(){};q("castApp.core.setupApi.SaveWiFiRequestMsg",Ie);
q("castApp.core.setupApi.SaveWiFiResponseMsg",function(a){this.setup_state=a});q("castApp.core.setupApi.SendLogReportRequestMsg",function(a){this.uuid=a});q("castApp.core.setupApi.SendLogReportResponseMsg",function(a){this.crash_report_id=a});var Je=function(){};q("castApp.core.setupApi.SetEurekaInfoMsgBase",Je);var Ke=function(){};t(Ke,Je);q("castApp.core.setupApi.SetEurekaInfoMsgV3",Ke);var Le=function(){};t(Le,Je);q("castApp.core.setupApi.SetEurekaInfoMsgV4",Le);var Me=function(){};t(Me,Je);
q("castApp.core.setupApi.SetEurekaInfoMsgV7",Me);q("castApp.core.setupApi.SupportedLocale",function(a,b){this.locale=a;this.display_string=b});q("castApp.core.setupApi.SupportedTimeZone",function(a,b,c){this.timezone=a;this.display_string=b;this.offset=c});var Ne=function(a){this.id=a};q("castApp.core.storage.SetupSession",Ne);var Oe=function(){};q("castApp.core.storage.CommonSetupState",Oe);var Pe=function(a){this.type=a.type;this.name=a.name;this.bssid=a.bssid;this.ssid=a.ssid;this.ipAddress=a.ipAddress};q("castApp.core.storage.DeviceToSetUp",Pe);var Qe=function(a){this.deviceIpAddress=a};q("castApp.core.storage.SetupApiClientState",Qe);var Re=function(a){this.msg=a};q("castApp.core.storage.ConnectWiFiState",Re);
q("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 Se=function(a,b){this.timeStamp=a;this.verificationProperties=b};q("castApp.core.storage.VerificationState",Se);var N=function(a){this.type=a};q("castApp.core.storage.SetupState",N);var Te=function(a,b){this.all=b;this.current=a};q("castApp.core.storage.SetupStateCollection",Te);
var Ue=function(a,b,c){this.type=a;this.time=b;this.deviceId=c},Ve=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},We=function(){var a=za()-432E5;Ve(window.localStorage).forEach(function(b){(!b.timestamp||b.timestamp<a)&&window.localStorage.removeItem("setupSession_"+b.id)})},Xe=function(a,b){b.timestamp=za();a.setItem("setupSession_"+
b.id,JSON.stringify(b))},Ye=function(a,b){a.removeItem("setupSession_"+b.id)},Ze=function(a){var b=a.getItem("setupDeviceState");if(b)try{return JSON.parse(b)}catch(c){a.removeItem("setupDeviceState")}return[]},$e=function(a,b){0===b.length?a.removeItem("setupDeviceState"):a.setItem("setupDeviceState",JSON.stringify(b))},af=function(a){return"false"===a.getItem("setupAutoNetworkSwitching")?!1:!0},bf=function(a,b){1===b?a.removeItem("castApp.analyticsOptIn"):a.setItem("castApp.analyticsOptIn",b.toString())};var cf=function(){},df=function(){};t(df,cf);df.prototype.b=function(){};df.prototype.f=function(){};df.prototype.a=function(){return B(3)};df.prototype.h=function(){};var ef=function(a){this.g=chrome.metricsPrivate;this.c=a};t(ef,cf);ef.prototype.b=function(a){this.g.recordUserAction("Cast.Chrome.App."+a.toString())};
ef.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(!qa(a.offerId)||0>a.offerId)return;b+="."+a.offerId}this.g.recordUserAction(b)};ef.prototype.a=function(){var a=parseInt(this.c.getItem("castApp.analyticsOptIn"),10);if(isNaN(a)||1>a||3<a)a=1;return B(a)};ef.prototype.h=function(a){a?(bf(this.c,2),this.b(1)):(bf(this.c,3),this.b(2))};var ff=function(){this.g=this.g;this.v=this.v};ff.prototype.g=!1;ff.prototype.ca=function(){this.g||(this.g=!0,this.F())};ff.prototype.F=function(){if(this.v)for(;this.v.length;)this.v.shift()()};var gf=!z||9<=Number(Hb),hf=z&&!Gb("9");!zb||Gb("528");yb&&Gb("1.9b")||z&&Gb("8")||wb&&Gb("9.5")||zb&&Gb("528");yb&&!Gb("8")||z&&Gb("9");var O=function(a,b){this.type=a;this.b=this.c=b;this.Da=!0};O.prototype.f=function(){this.Da=!1};var jf=function(a,b){O.call(this,a?a.type:"");this.relatedTarget=this.b=this.c=null;this.button=this.screenY=this.screenX=this.clientY=this.clientX=0;this.key="";this.metaKey=this.shiftKey=this.altKey=this.ctrlKey=!1;this.a=this.state=null;if(a){var c=this.type=a.type,d=a.changedTouches?a.changedTouches[0]:null;this.c=a.target||a.srcElement;this.b=b;if(b=a.relatedTarget){if(yb){var e;a:{try{tb(b.nodeName);e=!0;break a}catch(f){}e=!1}e||(b=null)}}else"mouseover"==c?b=a.fromElement:"mouseout"==c&&(b=
a.toElement);this.relatedTarget=b;null===d?(this.clientX=void 0!==a.clientX?a.clientX:a.pageX,this.clientY=void 0!==a.clientY?a.clientY:a.pageY,this.screenX=a.screenX||0,this.screenY=a.screenY||0):(this.clientX=void 0!==d.clientX?d.clientX:d.pageX,this.clientY=void 0!==d.clientY?d.clientY:d.pageY,this.screenX=d.screenX||0,this.screenY=d.screenY||0);this.button=a.button;this.key=a.key||"";this.ctrlKey=a.ctrlKey;this.altKey=a.altKey;this.shiftKey=a.shiftKey;this.metaKey=a.metaKey;this.state=a.state;
this.a=a;a.defaultPrevented&&this.f()}};t(jf,O);jf.prototype.f=function(){jf.H.f.call(this);var a=this.a;if(a.preventDefault)a.preventDefault();else if(a.returnValue=!1,hf)try{if(a.ctrlKey||112<=a.keyCode&&123>=a.keyCode)a.keyCode=-1}catch(b){}};var kf="closure_listenable_"+(1E6*Math.random()|0),lf=function(a){return!(!a||!a[kf])},mf=0;var nf=function(a,b,c,d,e){this.listener=a;this.proxy=null;this.src=b;this.type=c;this.capture=!!d;this.ga=e;this.key=++mf;this.removed=this.ba=!1},of=function(a){a.removed=!0;a.listener=null;a.proxy=null;a.src=null;a.ga=null};var pf=function(a){this.src=a;this.a={};this.b=0},rf=function(a,b,c,d,e,f){var g=b.toString();b=a.a[g];b||(b=a.a[g]=[],a.b++);var l=qf(b,c,e,f);-1<l?(a=b[l],d||(a.ba=!1)):(a=new nf(c,a.src,g,!!e,f),a.ba=d,b.push(a));return a};pf.prototype.remove=function(a,b,c,d){a=a.toString();if(!(a in this.a))return!1;var e=this.a[a];b=qf(e,b,c,d);return-1<b?(of(e[b]),La(e,b),0==e.length&&(delete this.a[a],this.b--),!0):!1};
var sf=function(a,b){var c=b.type;c in a.a&&Ma(a.a[c],b)&&(of(b),0==a.a[c].length&&(delete a.a[c],a.b--))};pf.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,of(d[e]);delete this.a[c];this.b--}return b};var tf=function(a,b,c,d,e){a=a.a[b.toString()];b=-1;a&&(b=qf(a,c,d,e));return-1<b?a[b]:null};
pf.prototype.hasListener=function(a,b){var c=m(a),d=c?a.toString():"",e=m(b);return ab(this.a,function(a){for(var f=0;f<a.length;++f)if(!(c&&a[f].type!=d||e&&a[f].capture!=b))return!0;return!1})};var qf=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.ga==d)return e}return-1};var uf="closure_lm_"+(1E6*Math.random()|0),vf={},wf=0,xf=function(a,b,c,d,e){if(oa(b)){for(var f=0;f<b.length;f++)xf(a,b[f],c,d,e);return null}c=yf(c);return lf(a)?a.listen(b,c,d,e):zf(a,b,c,!1,d,e)},zf=function(a,b,c,d,e,f){if(!b)throw Error("Invalid event type");var g=!!e,l=Af(a);l||(a[uf]=l=new pf(a));c=rf(l,b,c,d,e,f);if(c.proxy)return c;d=Bf();c.proxy=d;d.src=a;d.listener=c;if(a.addEventListener)a.addEventListener(b.toString(),d,g);else if(a.attachEvent)a.attachEvent(Cf(b.toString()),d);else throw Error("addEventListener and attachEvent are unavailable.");
wf++;return c},Bf=function(){var a=Df,b=gf?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},Ef=function(a,b,c,d,e){if(oa(b))for(var f=0;f<b.length;f++)Ef(a,b[f],c,d,e);else c=yf(c),lf(a)?rf(a.b,String(b),c,!0,d,e):zf(a,b,c,!0,d,e)},Ff=function(a,b,c,d,e){if(oa(b))for(var f=0;f<b.length;f++)Ff(a,b[f],c,d,e);else c=yf(c),lf(a)?a.A(b,c,d,e):a&&(a=Af(a))&&(b=tf(a,b,c,!!d,e))&&Gf(b)},Gf=function(a){if(!qa(a)&&a&&!a.removed){var b=a.src;if(lf(b))sf(b.b,
a);else{var c=a.type,d=a.proxy;b.removeEventListener?b.removeEventListener(c,d,a.capture):b.detachEvent&&b.detachEvent(Cf(c),d);wf--;(c=Af(b))?(sf(c,a),0==c.b&&(c.src=null,b[uf]=null)):of(a)}}},Cf=function(a){return a in vf?vf[a]:vf[a]="on"+a},If=function(a,b,c,d){var e=!0;if(a=Af(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=Hf(f,d),e=e&&!1!==f)}return e},Hf=function(a,b){var c=a.listener,d=a.ga||a.src;a.ba&&Gf(a);return c.call(d,b)},Df=
function(a,b){if(a.removed)return!0;if(!gf){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 jf(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=If(d[e],a,!0,b),c=c&&f}for(e=0;e<d.length;e++)b.b=d[e],f=If(d[e],a,!1,b),c=c&&f}return c}return Hf(a,
new jf(b,this))},Af=function(a){a=a[uf];return a instanceof pf?a:null},Jf="__closure_events_fn_"+(1E9*Math.random()>>>0),yf=function(a){if(ra(a))return a;a[Jf]||(a[Jf]=function(b){return a.handleEvent(b)});return a[Jf]};var P=function(){ff.call(this);this.b=new pf(this);this.Ja=this;this.S=null};t(P,ff);P.prototype[kf]=!0;P.prototype.removeEventListener=function(a,b,c,d){Ff(this,a,b,c,d)};
var Q=function(a,b){var c,d=a.S;if(d)for(c=[];d;d=d.S)c.push(d);a=a.Ja;d=b.type||b;if(n(b))b=new O(b,a);else if(b instanceof O)b.c=b.c||a;else{var e=b;b=new O(d,a);fb(b,e)}var e=!0,f;if(c)for(var g=c.length-1;0<=g;g--)f=b.b=c[g],e=Kf(f,d,!0,b)&&e;f=b.b=a;e=Kf(f,d,!0,b)&&e;e=Kf(f,d,!1,b)&&e;if(c)for(g=0;g<c.length;g++)f=b.b=c[g],e=Kf(f,d,!1,b)&&e};P.prototype.F=function(){P.H.F.call(this);this.b&&this.b.removeAll(void 0);this.S=null};
P.prototype.listen=function(a,b,c,d){return rf(this.b,String(a),b,!1,c,d)};P.prototype.A=function(a,b,c,d){return this.b.remove(String(a),b,c,d)};var Kf=function(a,b,c,d){b=a.b.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.ga||g.src;g.ba&&sf(a.b,g);e=!1!==l.call(p,d)&&e}}return e&&0!=d.Da};P.prototype.hasListener=function(a,b){return this.b.hasListener(m(a)?String(a):void 0,b)};var Lf=function(){u.call(this)};t(Lf,u);Lf.prototype.name="httpTimeout";var Mf=function(a,b){var c=D(),d=function(a){c.b(a)};a.listen(b,d);return E(c.a,function(){a.A(b,d)})},Nf=function(a){if(a instanceof G)throw a;},Of=function(a,b){var c=setTimeout(function(){a.cancel()},b);E(a,function(){clearTimeout(c);c=null});return a},Pf=function(){var a=D();Of(a.a,2E3);return a};!yb&&!z||z&&9<=Number(Hb)||yb&&Gb("1.9.1");z&&Gb("9");if(z&&z)try{new ActiveXObject("MSXML2.DOMDocument")}catch(a){};var Qf=function(a){u.call(this,a)};t(Qf,u);Qf.prototype.name="chrome.runtime.lastError";var Rf=function(a,b){this.onNetworksChanged=a;this.onNetworkListChanged=b};q("castApp.core.NetworkingPrivateApi.WiFiProperties",function(){});q("castApp.core.NetworkingPrivateApi.NetworkProperties",function(){});var Sf=[[0xfa8fca000000,0xfa8fcaffffff],[111971074048,111971139583]],Tf=new function(a){this.b=new w;this.a=new w;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]),Uf=new x("bcamde".split("")),Vf=new x("adghjkl".split("")),Wf=new x("bcamde".split("")),Xf=new x(["b","c","a","m"]),Yf=new x(["b","c","a","m"]),Zf=new x(["d"]),$f=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},ag=function(a,b){return!(!a||!b||0!==Ba(a,b))},bg=function(a){var b=$f(a);return!!Ja(Sf,function(a){return b>=a[0]&&b<=a[1]})},dg=function(a){return!a.WiFi||!a.WiFi.BSSID||a.WiFi.Security&&"None"!==a.WiFi.Security||!bg(a.WiFi.BSSID)?!1:Uf.contains(cg(a.WiFi.SSID||"").type)},cg=function(a){var b=/^(.*)\.([^\.]*)$/.exec(a),c=null;return b&&
3===b.length&&(c=eg(b[2]))?{name:b[1],type:c.type,subtype:c.subtype}:{name:a,type:"c",subtype:null}},eg=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}},fg=function(a,b){var c=new Yc;c.supportsSetup=Uf.contains(a);b&&!1===b.setup_supported&&(c.supportsSetup=!1);c.supportsDisplay=!Vf.contains(a);b&&void 0!==b.display_supported&&(c.supportsDisplay=!!b.display_supported);if(Wf.contains(a)){var d=c.deviceSettings=
new Xc;d.supportsForgetWiFi=!0;b&&!1===b.wifi_supported&&(d.supportsForgetWiFi=!1);c.supportsSetup||(d.supportsForgetWiFi=!1);d.supportsReboot=Xf.contains(a);b&&void 0!==b.reboot_supported&&(d.supportsReboot=!!b.reboot_supported);d.supportsFdr=Yf.contains(a);b&&void 0!==b.fdr_supported&&(d.supportsFdr=!!b.fdr_supported);c.supportsSetup||(d.supportsFdr=!1);d.supportsDataCollectionToggle=!0;b&&void 0!==b.stats_supported&&(d.supportsDataCollectionToggle=!!b.stats_supported);d.supportsTimeFormatChange=
!0;c.supportsDisplay||(d.supportsTimeFormatChange=!1);d.supportsOtherLicenses=!Zf.contains(a)}return c},gg=function(a){return Tf.b.get(a)||3},hg=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},ig=function(a){switch(a){case 2:return 1;case 3:return 2;case 4:return 5;case 5:return 7}return 0},jg=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},
kg=function(a){switch(a){case chrome.cast.SessionStatus.CONNECTED:return 1;case chrome.cast.SessionStatus.STOPPED:return 3}return 2},lg=function(a,b){var c=2;1===a.a?c=3:2===a.a&&(c=4);b=new Sc(c,b,[],null);b.selectedNetwork=new Rc(a.b||null,a.msg.ssid,hg(a.msg.wpa_auth));a.b&&b.networks.push(b.selectedNetwork);return b},mg=function(a,b,c){switch(a){case 3:return c=new Ke,c.name=b,c;case 4:case 5:case 6:return a=new Le,a.name=b,a.opt_in=new ue,a.opt_in.crash=a.opt_in.stats=c,a;default:return a=new Me,
a.name=b,a.opt_in=new Ce,a.opt_in.stats=c,a}},ng=function(a){return"E8C28D3C"==a||"00000000-0000-0000-0000-000000000000"==a};var og=function(){},qg=function(){this.b={};this.a={};pg||(pg=new A(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)))};t(qg,og);
var pg=null,rg=function(a,b,c){return pg.then(function(){var a=b+c,e=this.b[a];if(e)return e.a;e=Pf();this.b[a]=e;var f=this.a[a];f||(f=new chrome.cast.SessionRequest(b),f=new chrome.cast.ApiConfig(f,this.c.bind(this),ma,chrome.cast.AutoJoinPolicy.CUSTOM_CONTROLLER_SCOPED),f.invisibleSender=!ng(b),f=chrome.cast.initializeWithContext(f,ma,function(){}.bind(this)),this.a[a]=f);chrome.cast.requestSessionByIdWithContext(f,c);return e.a}.bind(a))};
qg.prototype.c=function(a){var b=a.appId+a.sessionId,c=this.b[b];c&&c.b({session:a,context:this.a[b]})};var sg=function(){Rf.call(this,chrome.networkingPrivate.onNetworksChanged,chrome.networkingPrivate.onNetworkListChanged)};t(sg,Rf);sg.a=void 0;sg.b=function(){return sg.a?sg.a:sg.a=new sg};var tg=function(a){return chrome.runtime.lastError?(a.c(new Qf(chrome.runtime.lastError.message)),!0):!1};h=sg.prototype;h.getNetworks=function(a){var b=D();chrome.networkingPrivate.getNetworks(a,function(a){tg(b)||b.b(a)});return b.a};
h.getProperties=function(a){var b=D();chrome.networkingPrivate.getProperties(a,function(a){tg(b)||b.b(a)});return b.a};h.requestNetworkScan=function(){chrome.networkingPrivate.requestNetworkScan()};h.startConnect=function(a){var b=D();chrome.networkingPrivate.startConnect(a,function(){tg(b)||b.b()});return b.a};h.startDisconnect=function(a){var b=D();chrome.networkingPrivate.startDisconnect(a,function(){tg(b)||b.b()});return b.a};
h.verifyDestination=function(a){var b=D();chrome.networkingPrivate.verifyDestination(a,function(a){tg(b)||b.b(a)});return b.a};h.verifyAndEncryptData=function(a,b){var c=D();chrome.networkingPrivate.verifyAndEncryptData(a,b,function(a){tg(c)||c.b(a)});return c.a};var ug=function(){this.a=new x},vg=function(a,b){lb(a.a,b);return E(b,function(){this.a.remove(b)}.bind(a))},wg=function(a){if(0==a.a.a.c)return B();var b=a.a;a.a=new x;return new A(function(a){Xa(b,function(c){E(c,function(){b.remove(c)&&0==b.a.c&&a()});c.cancel()})})};var R=function(a,b){this.h=a;this.g=b;this.f=new ug;this.c=new P;this.a="stopped"};R.prototype.getState=function(){return this.a};R.prototype.b=function(a){a!==this.a&&(this.a=a,Q(this.c,a))};R.prototype.start=function(){switch(this.a){case "stopped":case "stopping":return this.restart();case "starting":case "stoppingStartPending":return xg(this);case "started":return B();default:return B()}};
R.prototype.restart=function(){switch(this.a){case "starting":case "started":this.b("stoppingStartPending");yg(this);break;case "stopping":this.b("stoppingStartPending");break;case "stopped":this.b("starting"),zg(this)}return xg(this)};var xg=function(a){var b=new ug;return E(F(new A(function(a,d){vg(b,Mf(this.c,"started")).then(function(){a()});vg(b,Mf(this.c,"stopped")).then(function(){d()})}.bind(a)),function(a){a instanceof G&&this.stop();throw a;},a),function(){wg(b)})};
R.prototype.stop=function(){if("stopped"===this.a)return B();var a=this.a;this.b("stopping");"starting"!==a&&"started"!==a||yg(this);return Mf(this.c,"stopped")};
var S=function(a,b){if("starting"===a.a||"started"===a.a)return vg(a.f,b),b;b.cancel();return ac(new G)},Ag=function(a){return"started"===a.a?B():Mf(a.c,"started")},yg=function(a){wg(a.f).then(function(){try{if(this.g)return this.g()}catch(b){}}.bind(a)).then(function(){"stoppingStartPending"===this.a?(this.b("starting"),zg(this)):this.b("stopped")}.bind(a))},zg=function(a){var b=null;try{b=a.h()}catch(c){b=ac(c)}"starting"!==a.a?b.cancel():F(vg(a.f,b).then(a.b.bind(a,"started")),function(){this.stop()}.bind(a))};var Bg=function(a,b,c){if(ra(a))c&&(a=xa(a,c));else if(a&&"function"==typeof a.handleEvent)a=xa(a.handleEvent,a);else throw Error("Invalid listener argument");return 2147483647<Number(b)?-1:k.setTimeout(a,b||0)},T=function(a){var b=null;return F(new A(function(c,d){b=Bg(function(){c(void 0)},a);-1==b&&d(Error("Failed to schedule timer."))}),function(a){k.clearTimeout(b);throw a;})};var Rg=function(a){Cg||(Cg=new w("SetupStart.ShowDevice",Dg,"WiFiSwitching.ConnectHotSpot",Eg,"WiFiSwitching.ReconnectWiFi",Fg,"CodeConfirmation.Request",Gg,"DeviceConfig.Request",Hg,"DeviceConfig.Response",Ig,"WiFiConfig.Show",Jg,"WiFiConfig.UpdateNetworks",Kg,"WiFiConfig.Connect",Lg,"WiFiConfig.Retry",Mg,"Devices.Show",Ng,"Devices.UserAction",Og,"DeviceSettings.Show",Pg,"DeviceSettings.Apply",Qg),"Error Handshake.Request Handshake.Response Handshake.UiVersionNotSupported OfflineUiReady SetupSessionTakeoverConfirmed SetSimpleState ModalDialog.Request ModalDialog.Response ShowGenericSetupError DeviceDiscovery.ShowScanner DeviceDiscovery.NotFound SetupStart.Proceed SetupStart.TosAccepted WiFiSwitching.Proceed WiFiSwitching.RetryConnection BadDeviceAck CodeConfirmation.Response AudioConfirmation.PromptUser AudioConfirmation.UserAction WiFiConfig.ErrorAck OtaUpdate.Pending OtaUpdate.Done OtaUpdate.Proceed DeviceSettings.Reboot DeviceSettings.FactoryReset DeviceSettings.ForgetWiFi DeviceSettings.Exit RestartSetup GoToDeviceList DetectCountry.Request DetectCountry.Response Offers.Show Offers.Scan Offers.ScanResults Offers.Redeem Offers.AnalyticsEvent".split(" ").forEach(function(a){Cg.set(a,
function(a){return B(a)})}));return Cg.get(a.type)(a).then(function(a){return JSON.stringify(a)})},Cg=null,Dg=function(a){return H().then(function(b){b=new Cc(a.state,a.deviceType,b);b.otherDevicesExist=a.otherDevicesExist;b.analyticsOptIn=a.analyticsOptIn;return b})},Eg=function(a){return C([H(),H()]).then(function(b){return new Fc(a.state,b[0],b[1])})},Fg=function(a){return H().then(function(b){return new Gc(a.state,b)})},Gg=function(a){return C(a.code.map(H)).then(function(a){return new Ic(a)})},
Hg=function(a){return H().then(function(b){return new Oc(a.deviceType,b,a.country)})},Ig=function(a){return H().then(function(b){return{requestId:a.responseTo,name:b,a:a.country}})},Sg=function(a){return C([a.id?H():null,H()]).then(function(b){var c=ia(b);b=c.next().value;c=c.next().value;return new Rc(b,c,a.security)})},Jg=function(a){return C([C(a.networks.map(Sg)),a.selectedNetwork?Sg(a.selectedNetwork):null]).then(function(b){var c=ia(b);b=c.next().value;c=c.next().value;return new Sc(a.state,
a.deviceType,b,c)})},Kg=function(a){return C(a.networks.map(Sg)).then(function(a){return new Tc(a)})},Lg=function(a){return Sg(a.network).then(function(a){return new Uc(a,"********")})},Mg=function(a){return Sg(a.network).then(function(a){return new Vc(a)})},Tg=function(a){return C([H(),H()]).then(function(b){var c=ia(b);b=c.next().value;var c=c.next().value,d=db(a);d.id=b;d.displayName=c;return d})},Ng=function(a){return C([C(a.devices.map(Tg)),a.deviceName?H():void 0]).then(function(a){var b=ia(a);
a=b.next().value;b=b.next().value;return new ad(a,b)})},Og=function(a){return Tg(a.device).then(function(b){return new bd(b,a.action)})},Pg=function(a){return C([H(),H(),H(),H()]).then(function(b){var c=ia(b);b=c.next().value;var d=c.next().value,e=c.next().value,c=c.next().value;return new fd(a.state,a.features,{deviceType:a.deviceType,name:b,ssid:a.ssid?d:null,timeZoneId:a.timeZoneId,supportedTimeZones:a.supportedTimeZones,timeFormat:a.timeFormat,localeId:a.localeId,supportedLocales:a.supportedLocales,
statsOptIn:a.statsOptIn,firmwareVersion:a.firmwareVersion,countryCode:a.countryCode,macAddress:e,ipAddress:c})})},Qg=function(a){return H().then(function(b){var c=new gd(a);c.name=b;return c})};var Ug=function(){this.a={};this.b={};this.c=new x};Ug.prototype.sendMessage=function(a){a.responseTo?this.c.contains(a.responseTo)&&(this.c.remove(a.responseTo),Vg(this,a)):Vg(this,a)};Ug.prototype.sendRequest=function(a,b){var c=D();this.a[a.requestId]={K:c,Fa:b?setTimeout(xa(this.i,this,a.requestId),b):null};Vg(this,a);return c.a};Ug.prototype.i=function(a){a in this.a&&(this.a[a].K.a.cancel(),delete this.a[a])};
Ug.prototype.addListener=function(a,b){var c=this.b[a];c||(c=this.b[a]=new x);lb(c,b)};var Wg=function(a,b){var c=D(),d=xa(function(a){c.b(a)},a);a.addListener(b,d);return E(c.a,function(){this.removeListener(b,d)}.bind(a))};Ug.prototype.removeListener=function(a,b){(a=this.b[a])&&a.remove(b)};
var Yg=function(a,b){if(b.requestId)lb(a.c,b.requestId);else if(b.responseTo){var c=a.a[b.responseTo];c&&(delete a.a[b.responseTo],null!==c.Fa&&clearTimeout(c.Fa),b instanceof pc?c.K.c(b):c.K.b(b))}var d=a.b[b.type];d&&d.u().forEach(function(a){d.contains(a)&&a(b)})};var Zg=function(a,b,c,d,e){Ug.call(this);this.f="object"===typeof b?b:null;this.j="function"===typeof b?b:null;this.h=c;this.m=d||ma;this.g=e||function(a){return B(JSON.stringify(a))};a.addEventListener("message",this.l.bind(this))};t(Zg,Ug);Zg.prototype.l=function(a){a.origin===this.h?(this.g(a.data),Yg(this,a.data)):this.m()};var Vg=function(a,b){a.g(b);a.f=a.f||a.j();a.f.postMessage(b,a.h)};var $g=function(a,b,c,d){this.f=new P;this.h=new R(c,d);this.c=a;this.D=b+"/v6";this.B=b;this.g=[]},ah=function(){O.call(this,"redirect")};t(ah,O);$g.prototype.start=function(){return this.h.start().then(this.v.bind(this))};$g.prototype.stop=function(){return this.h.stop()};$g.prototype.j=function(a){0<=Fa(this.g,a)||this.g.push(a)};
var bh=function(a){var b=a.localStorage.getItem("castApp.uiOrigin")||"https://castappui.google.com";$g.call(this,a,b,this.m.bind(this),this.l.bind(this));this.a=this.b=null;this.i=[["newwindow",this.w.bind(this)],["loadredirect",this.o.bind(this)]]};t(bh,$g);var ch=["exit","loadabort","unresponsive"];bh.prototype.v=function(){return this.a};
var dh=function(a){var b=setInterval(function(){document.activeElement===this.b?clearInterval(b):this.b.focus()}.bind(a),20);window.addEventListener("focus",a.b.focus.bind(a.b),!0)};
bh.prototype.m=function(){var a=this,b=D(),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));ch.forEach(function(a){d.addEventListener(a,c)});var e=function(){var c=d.contentWindow;a.b=d;a.a=new Zg(a.c,c,a.B,function(){Q(a.f,new O("originViolation"))},Rg);b.b();dh(a)};d.addEventListener("contentload",e);E(b.a,function(){ch.forEach(function(a){d.removeEventListener(a,c)});d.removeEventListener("contentload",
e)});a.i.forEach(function(a){d.addEventListener.apply(d,a)});d.parentElement||a.c.document.body.appendChild(d);a.b=d;return b.a};bh.prototype.l=function(){this.a=null;if(this.b&&this.b.parentElement){var a=this.b;this.b=null;a.parentElement.removeChild(a);this.i.forEach(function(b){a.removeEventListener.apply(a,b)})}return B()};bh.prototype.o=function(){Q(this.f,new ah)};
bh.prototype.w=function(a){var b=a.targetUrl,c=a.windowOpenDisposition,d=he(b),e=d.c,f=d.f,d="https"===e&&("www.google.com"===f||"support.google.com"===f||"chromecast.com"===f)||"http"===e&&Nd(f)&&8008===d.h&&"/setup/NOTICE.html.gz"===d.b;!d&&0<=Fa(this.g,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 eh=function(a,b,c,d,e,f,g,l,p,r,J){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=r;this.a=J};var fh=function(a,b,c,d){this.c=a;this.f=b;this.a=this.b=a;this.g=c||0;this.h=d||2};fh.prototype.reset=function(){this.a=this.b=this.c};var gh=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 hh=function(a,b){this.type="cast_app";this.originId=window["castApp.eventPage.Message.OriginID"]||void 0;this.subtype=a;this.devices=b;this.logRecord=this.deviceJustSetUp=void 0};q("castApp.eventPage.Message",hh);hh.DeviceData=function(a,b,c){this.ipAddress=a;this.appId=b;this.sessionId=c};var ih=function(a,b,c,d){this.ipAddress=a;this.name=b;this.udn=c;this.modelName=d};hh.DeviceJustSetUp=ih;var jh=function(){};hh.DeviceCapabilities=jh;
hh.LogRecord=function(a,b,c,d){this.levelValue=a;this.msg=b;this.loggerName=c;this.time=d};var mh=function(a){a.devices||a.deviceJustSetUp?C([a.devices?kh(a.devices):void 0,a.deviceJustSetUp?lh(a.deviceJustSetUp):void 0]).then(function(b){var c=ia(b);b=c.next().value;var c=c.next().value,d=db(a);d.devices=b;d.deviceJustSetUp=c;return JSON.stringify(d)}):B(JSON.stringify(a))},kh=function(a){return C(a.map(function(a){return H().then(function(b){var c=db(a);c.ipAddress=b;return c})}))},lh=function(a){return C([H(),H(),H()]).then(function(b){var c=ia(b);b=c.next().value;var d=c.next().value,
c=c.next().value;b=new ih(b,d,c,a.modelName);a.capabilities&&(b.capabilities=a.capabilities);return b})};var nh=function(){P.call(this)};t(nh,P);var oh=function(a){O.call(this,a.subtype);this.msg=a};t(oh,O);var ph=function(){this.c=new fh(100,6E4);this.f=null;P.call(this)};t(ph,nh);var qh=null;
ph.prototype.start=function(){var a=this;qh||(chrome.runtime.onMessage.addListener(this.h.bind(this)),qh=F(E(new A(function(b,c){chrome.runtime.getBackgroundPage(function(){chrome.runtime.lastError?c(new Qf(chrome.runtime.lastError.message)):(window["castApp.eventPage.Message.OriginID"]=Ca(),a.a(),Mf(a,"serviceReady").then(function(){b()},c))})}),function(){clearTimeout(a.f)}),function(a){throw a;}));return qh};
ph.prototype.a=function(){rh("serviceCheck");this.f=setTimeout(this.a.bind(this),this.c.b);gh(this.c)};ph.prototype.sendMessage=function(a){return this.start().then(function(){rh(a)})};var rh=function(a){a=sa(a)?a:new hh(a);"logRecord"!==a.subtype&&mh(a);chrome.runtime.sendMessage(a)},sh=function(a){a.sendMessage("startDeviceMonitor")};ph.prototype.h=function(a){"object"===typeof a&&"cast_app"===a.type&&"logRecord"!==a.subtype&&(mh(a),Q(this,new oh(a)));return!1};var th=function(a){return(a=a.match(/^\w{2,3}([-_]|$)/))?a[0].replace(/[_-]/g,""):""},uh=function(a){return(a=a.match(/[-_]([a-zA-Z]{2}|\d{3})([-_]|$)/))?a[0].replace(/[_-]/g,""):""};var vh=y("Firefox"),wh=sb()||y("iPod"),xh=y("iPad"),yh=y("Android")&&!(rb()||y("Firefox")||y("Opera")||y("Silk")),zh=rb(),Ah=y("Safari")&&!(rb()||y("Coast")||y("Opera")||y("Edge")||y("Silk")||y("Android"))&&!(sb()||y("iPad")||y("iPod"));var Bh=function(a){return(a=a.exec(ob))?a[1]:""},Ch=function(){if(vh)return Bh(/Firefox\/([0-9.]+)/);if(z||xb||wb)return Fb;if(zh)return sb()||y("iPad")||y("iPod")?Bh(/CriOS\/([0-9.]+)/):Bh(/Chrome\/([0-9.]+)/);if(Ah&&!(sb()||y("iPad")||y("iPod")))return Bh(/Version\/([0-9.]+)/);if(wh||xh){var a=/Version\/(\S+).*Mobile\/(\S+)/.exec(ob);if(a)return a[1]+"."+a[2]}else if(yh)return(a=Bh(/Android\s+([0-9.]+)/))?a:Bh(/Version\/([0-9.]+)/);return""}();var Dh=null,Eh=null,Gh=function(a){var b=[];Fh(a,function(a){b.push(a)});return b},Fh=function(a,b){function c(b){for(;d<a.length;){var c=a.charAt(d++),e=Eh[c];if(null!=e)return e;if(!/^[\s\xa0]*$/.test(c))throw Error("Unknown base64 encoding at char: "+c);}return b}Hh();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))}},Hh=function(){if(!Dh){Dh={};Eh={};for(var a=0;65>a;a++)Dh[a]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(a),
Eh[Dh[a]]=a,62<=a&&(Eh["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.".charAt(a)]=a)}};var Ih=function(){this.b=-1};var Jh=function(){this.b=64;this.a=[];this.h=[];this.i=[];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()};t(Jh,Ih);Jh.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 Kh=function(a,b,c){c||(c=0);var d=a.i;if(n(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],r,e=0;80>e;e++)40>e?20>e?(f=l^c&(g^l),r=1518500249):(f=c^g^l,r=1859775393):60>e?(f=c&g|l&(c|g),r=2400959708):(f=c^g^l,r=3395469782),
f=(b<<5|b>>>27)+f+p+r+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};
Jh.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;)Kh(this,a,d),d+=this.b;if(n(a))for(;d<b;){if(e[f]=a.charCodeAt(d),++f,++d,f==this.b){Kh(this,e);f=0;break}}else for(;d<b;)if(e[f]=a[d],++f,++d,f==this.b){Kh(this,e);f=0;break}}this.c=f;this.g+=b}};var Lh=function(a,b){if(b+1>=a.length)return null;if(!(a[b+1]&128))return{length:a[b+1],ma: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,ma:c+1}},Mh=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=Lh(a,c);if(!f)break;var g=c+f.length+f.ma;if(g>=a.length)break;switch(e.action){case "step":c+=f.ma+1;continue;case "skip":c=g+1;continue;case "return":return Ra(a,c,g+1);default:return null}}return null},Nh=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)},
Oh=function(a){return String.fromCharCode(50+a[a.length-1]%8)},Ph=function(a,b){for(var c=[],d=0;4>d;d++)c[d]=a[b+d]^a[16+d];return c};var Qh=function(a){this.a=a},Rh=function(a,b,c,d){if(!a.f(d))return ac();var e=a.b(d.bssid);if(!e||!a.c(c))return ac();a=b.verifyDestination(e);F(a,function(){});return a.then(function(a){if(!a)return ac();a=new Se((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=Gh(c)}catch(Xg){b=null}if(b)if(c=Mh(b)){b=new Jh;b.update(c);var c=[],d=8*b.g;56>b.c?b.update(b.f,56-b.c):b.update(b.f,
b.b-(b.c-56));for(var f=b.b-1;56<=f;f--)b.h[f]=d&255,d/=256;Kh(b,b.h);for(f=d=0;5>f;f++)for(var J=24;0<=J;J-=8)c[d]=b.a[f]>>J&255,++d;c?(b=[],b[0]=Nh(Ph(c,0)),b[1]=Oh(Ph(c,4)),b[2]=Nh(Ph(c,8)),b[3]=Oh(Ph(c,12))):b=null}else b=null;else b=null;if(!b)return ac();a.pin=b;return a})},Sh=function(a){this.a=a};t(Sh,Qh);Sh.prototype.f=function(a){return a.ssid===this.a.name};Sh.prototype.c=function(){return!0};
Sh.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 Th=function(a){this.a=a};t(Th,Qh);Th.prototype.f=function(a){var b=this.a.hotspot_bssid.toLowerCase();return a.ssid===this.a.name&&a.bssid.toLowerCase()===b};
Th.prototype.c=function(a){return!(!this.a.sign||this.a.sign.nonce!==a)};
Th.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<=Ea(Ch,42)&&(b.intermediateCertificates=a.sign.intermediate_certs);return b};var Uh=function(a){this.a=a};
t(Uh,Qh);Uh.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&&ag(b.device_info.hotspot_bssid,a.bssid)};Uh.prototype.c=function(a){return!(!this.a.sign||this.a.sign.nonce!==a)};
Uh.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<=Ea(Ch,42)&&(b.intermediateCertificates=
a.sign.intermediate_certs);return b};var Vh=function(){};Vh.prototype.a=null;var Xh=function(a){var b;(b=a.a)||(b={},Wh(a)&&(b[0]=!0,b[1]=!0),b=a.a=b);return b};var Yh,Zh=function(){};t(Zh,Vh);var $h=function(a){return(a=Wh(a))?new ActiveXObject(a):new XMLHttpRequest},Wh=function(a){if(!a.b&&"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.b=d}catch(e){}}throw Error("Could not create ActiveXObject. ActiveX might be disabled, or MSXML might not be installed");}return a.b};Yh=new Zh;var U=function(a){P.call(this);this.headers=new w;this.B=a||null;this.c=!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};t(U,P);var ai=/^https?$/i,bi=["POST","PUT"];U.prototype.ya=function(){return this.j};U.prototype.za=function(){return this.i};
U.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.c=!0;this.a=this.B?$h(this.B):$h(Yh);this.w=this.B?Xh(this.B):Xh(Yh);this.a.onreadystatechange=xa(this.qa,this);try{this.I=!0,this.a.open(b,String(a),!0),this.I=!1}catch(f){ci(this);return}a=c||"";var e=new w(this.headers);d&&kb(d,function(a,b){e.set(b,a)});d=Ja(e.C(),di);c=k.FormData&&a instanceof k.FormData;
!(0<=Fa(bi,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{ei(this),0<this.l&&((this.T=fi(this.a))?(this.a.timeout=this.l,this.a.ontimeout=xa(this.Z,this)):this.o=Bg(this.Z,this.l,this)),this.m=!0,this.a.send(a),this.m=!1}catch(f){ci(this)}};
var fi=function(a){return z&&Gb(9)&&qa(a.timeout)&&m(a.ontimeout)},di=function(a){return"content-type"==a.toLowerCase()};U.prototype.Z=function(){"undefined"!=typeof la&&this.a&&(this.h=8,Q(this,"timeout"),this.abort(8))};var ci=function(a){a.c=!1;a.a&&(a.f=!0,a.a.abort(),a.f=!1);a.h=5;gi(a);hi(a)},gi=function(a){a.D||(a.D=!0,Q(a,"complete"),Q(a,"error"))};U.prototype.abort=function(a){this.a&&this.c&&(this.c=!1,this.f=!0,this.a.abort(),this.f=!1,this.h=a||7,Q(this,"complete"),Q(this,"abort"),hi(this))};
U.prototype.F=function(){this.a&&(this.c&&(this.c=!1,this.f=!0,this.a.abort(),this.f=!1),hi(this,!0));U.H.F.call(this)};U.prototype.qa=function(){this.g||(this.I||this.m||this.f?ii(this):this.Ka())};U.prototype.Ka=function(){ii(this)};
var ii=function(a){if(a.c&&"undefined"!=typeof la&&(!a.w[1]||4!=ji(a)||2!=a.getStatus()))if(a.m&&4==ji(a))Bg(a.qa,0,a);else if(Q(a,"readystatechange"),4==ji(a)){a.c=!1;try{ki(a)?(Q(a,"complete"),Q(a,"success")):(a.h=6,a.getStatus(),gi(a))}finally{hi(a)}}},hi=function(a,b){if(a.a){ei(a);var c=a.a,d=a.w[0]?ma:null;a.a=null;a.w=null;b||Q(a,"ready");try{c.onreadystatechange=d}catch(e){}}},ei=function(a){a.a&&a.T&&(a.a.ontimeout=null);qa(a.o)&&(k.clearTimeout(a.o),a.o=null)},ki=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(Td)[1]||null,!a&&k.self&&k.self.location&&(a=k.self.location.protocol,a=a.substr(0,a.length-1)),b=!ai.test(a?a.toLowerCase():"");c=b}return c},ji=function(a){return a.a?a.a.readyState:0};U.prototype.getStatus=function(){try{return 2<ji(this)?this.a.status:-1}catch(a){return-1}};U.prototype.ea=function(){try{return this.a?this.a.responseText:""}catch(a){return""}};
U.prototype.getResponseHeader=function(a){if(this.a&&4==ji(this))return a=this.a.getResponseHeader(a),null===a?void 0:a};var li=function(a){var b={};a=(a.a&&4==ji(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 mi=function(a){ff.call(this);this.b=a;this.a={}};t(mi,ff);var ni=[];h=mi.prototype;h.listen=function(a,b,c,d){oa(b)||(b&&(ni[0]=b.toString()),b=ni);for(var e=0;e<b.length;e++){var f=xf(a,b[e],c||this.handleEvent,d||!1,this.b||this);if(!f)break;this.a[f.key]=f}return this};
h.A=function(a,b,c,d,e){if(oa(b))for(var f=0;f<b.length;f++)this.A(a,b[f],c,d,e);else c=c||this.handleEvent,e=e||this.b||this,c=yf(c),d=!!d,b=lf(a)?tf(a.b,String(b),c,d,e):a?(a=Af(a))?tf(a,b,c,d,e):null:null,b&&(Gf(b),delete this.a[b.key]);return this};h.removeAll=function(){$a(this.a,function(a,b){this.a.hasOwnProperty(b)&&Gf(a)},this);this.a={}};h.F=function(){mi.H.F.call(this);this.removeAll()};h.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented");};var oi=function(){this.b=[];this.a=[]},pi=function(a){0==a.b.length&&(a.b=a.a,a.b.reverse(),a.a=[]);return a.b.pop()};h=oi.prototype;h.s=function(){return this.b.length+this.a.length};h.clear=function(){this.b=[];this.a=[]};h.contains=function(a){return 0<=Fa(this.b,a)||0<=Fa(this.a,a)};h.remove=function(a){var b;b=this.b;var c=Ga(b,a);0<=c?(La(b,c),b=!0):b=!1;return b||Ma(this.a,a)};
h.u=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 qi=function(a,b){ff.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 oi;this.b=new x;this.i=null;this.$()};t(qi,ff);qi.prototype.da=function(){var a=za();if(!(null!=this.i&&0>a-this.i)){for(var b;0<this.a.s()&&(b=pi(this.a),!this.j(b));)this.$();!b&&this.s()<this.c&&(b=this.h());b&&(this.i=a,lb(this.b,b));return b}};qi.prototype.U=function(a){this.b.remove(a);this.j(a)&&this.s()<this.c?this.a.a.push(a):ri(a)};
qi.prototype.$=function(){for(var a=this.a;this.s()<this.l;){var b=this.h();a.a.push(b)}for(;this.s()>this.c&&0<this.a.s();)ri(pi(a))};qi.prototype.h=function(){return{}};var ri=function(a){if("function"==typeof a.ca)a.ca();else for(var b in a)a[b]=null};qi.prototype.j=function(a){return"function"==typeof a.Ma?a.Ma():!0};qi.prototype.contains=function(a){return this.a.contains(a)||this.b.contains(a)};qi.prototype.s=function(){return this.a.s()+this.b.s()};
qi.prototype.F=function(){qi.H.F.call(this);if(0<this.b.s())throw Error("[goog.structs.Pool] Objects not released");delete this.b;for(var a=this.a;0!=a.b.length||0!=a.a.length;)ri(pi(a));delete this.a};var si=function(a,b){this.a=a;this.b=b};var ti=function(a){this.a=[];if(a)a:{var b;if(a instanceof ti){if(b=a.C(),a=a.u(),0>=this.s()){for(var c=this.a,d=0;d<b.length;d++)c.push(new si(b[d],a[d]));break a}}else b=cb(a),a=bb(a);for(d=0;d<b.length;d++)ui(this,b[d],a[d])}},ui=function(a,b,c){var d=a.a;d.push(new si(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=ti.prototype;
h.remove=function(){var a=this.a,b=a.length,c=a[0];if(!(0>=b)){if(1==b)Ka(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.u=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.s=function(){return this.a.length};h.clear=function(){Ka(this.a)};var vi=function(){ti.call(this)};t(vi,ti);var wi=function(a,b){this.f=new vi;qi.call(this,a,b)};t(wi,qi);h=wi.prototype;h.da=function(a,b){if(!a)return wi.H.da.call(this);ui(this.f,m(b)?b:100,a);this.la()};h.la=function(){for(var a=this.f;0<a.s();){var b=this.da();if(b)a.remove().apply(this,[b]);else break}};h.U=function(a){wi.H.U.call(this,a);this.la()};h.$=function(){wi.H.$.call(this);this.la()};h.F=function(){wi.H.F.call(this);k.clearTimeout(void 0);this.f.clear();this.f=null};var xi=function(a,b,c,d){this.m=a;this.o=!!d;wi.call(this,b,c)};t(xi,wi);xi.prototype.h=function(){var a=new U,b=this.m;b&&b.forEach(function(b,d){a.headers.set(d,b)});this.o&&(a.i=!0);return a};xi.prototype.j=function(a){return!a.g&&!a.a};var yi=function(a,b,c,d,e,f){P.call(this);this.i=m(a)?a:1;this.h=m(e)?Math.max(0,e):0;this.j=!!f;this.c=new xi(b,c,d,f);this.a=new w;this.f=new mi(this)};t(yi,P);var zi="ready complete success error abort timeout".split(" ");yi.prototype.send=function(a,b,c,d,e,f,g,l,p,r){if(this.a.get(a))throw Error("[goog.net.XhrManager] ID in use");b=new Ai(b,xa(this.m,this,a),c,d,e,g,m(l)?l:this.i,p,m(r)?r:this.j);this.a.set(a,b);a=xa(this.l,this,a);this.c.da(a,f);return b};
yi.prototype.abort=function(a,b){var c=this.a.get(a);if(c){var d=c.ia;c.ra=!0;b&&(d&&(this.f.A(d,zi,c.pa),Ef(d,"ready",function(){var a=this.c;a.b.remove(d)&&a.U(d)},!1,this)),this.a.remove(a));d&&d.abort()}};yi.prototype.l=function(a,b){var c=this.a.get(a);c&&!c.ia?(this.f.listen(b,zi,c.pa),b.l=Math.max(0,this.h),b.j=c.ya(),b.i=c.za(),c.ia=b,Q(this,new Bi("ready",this,a,b)),Ci(this,a,b),c.ra&&b.abort()):(a=this.c,a.b.remove(b)&&a.U(b))};
yi.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||ki(c)||d.aa>d.ka)if(Q(this,new Bi("complete",this,a,c)),d&&(d.wa=!0,d.va)){a=d.va.call(c,b);break a}a=null}return a;case "success":Q(this,new Bi("success",this,a,c));break;case "timeout":case "error":b=this.a.get(a);b.aa>b.ka&&Q(this,new Bi("error",this,a,c));break;case "abort":Q(this,new Bi("abort",this,a,c))}return null};
var Ci=function(a,b,c){var d=a.a.get(b);!d||d.wa||d.aa>d.ka?(d&&(a.f.A(c,zi,d.pa),a.a.remove(b)),a=a.c,a.b.remove(c)&&a.U(c)):(d.aa++,c.send(d.gb,d.sb,d.eb,d.fb))};yi.prototype.F=function(){yi.H.F.call(this);this.c.ca();this.c=null;this.f.ca();this.f=null;this.a.clear();this.a=null};var Bi=function(a,b,c,d){O.call(this,a,b);this.id=c;this.ia=d};t(Bi,O);
var Ai=function(a,b,c,d,e,f,g,l,p){this.gb=a;this.sb=c||"GET";this.eb=d;this.fb=e||null;this.ka=m(g)?g:1;this.aa=0;this.ra=this.wa=!1;this.pa=b;this.va=f;this.a=l||"";this.b=!!p;this.ia=null};Ai.prototype.za=function(){return this.b};Ai.prototype.ya=function(){return this.a};var Di=function(){},Ei=function(){u.call(this)};t(Ei,u);Ei.prototype.name="httpStatus";var Fi=function(){u.call(this)};t(Fi,u);Fi.prototype.name="httpResponseParsing";var Gi=function(a,b){return a.request(b).then(function(a){if((a.getResponseHeader("content-type")||"").toLowerCase().startsWith("application/json")){a=a.ea();a.startsWith(")]}'")&&(a=a.substr(4));try{return JSON.parse(a)}catch(d){}}throw new Fi;})},Hi=function(){this.a=new w;this.b=0};t(Hi,Di);
var Ii=function(a){this.b=a.ea();this.a={};$a(li(a),function(a,c){this.a[c.toLowerCase()]=a},this)};Ii.prototype.ea=function(){return this.b};Ii.prototype.getResponseHeader=function(a){return this.a[a.toLowerCase()]||void 0};Hi.prototype.request=function(a){var b=D(),c=a.timeout||1E4,d=this.a.get(c);d||(d=new yi,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;ki(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 Vd("http://"+d.deviceIpAddress+":8008");this.b=a;this.c=b;c?(a=th(c),c=(c=uh(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 Qe(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?B(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 B(f);if(g.verificationState){if(ag(g.verificationState.verificationProperties.deviceBssid,d.bssid))return B(f);g=new Qe(g.deviceIpAddress);b.write(g)}a={};var l=a.nonce=Ca();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=Rh(new Sh(a),c,l,d);break a;case 4:case 5:case 6:a=Rh(new Th(a),c,l,d);
break a;default:a=Rh(new Uh(a),c,l,d)}return a}).then(function(a){g=b.read();g.verificationState=a;b.write(g);return f},function(a){Nf(a);if(a instanceof Ei)throw a;throw new Oi;})},Qi=function(){u.call(this)};t(Qi,u);Qi.prototype.name="setupApiVersionError";var Oi=function(){u.call(this)};t(Oi,u);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 x([3,4,5,6,7,8]);Ji.prototype.h=new w(3,function(a){v(a,"locale","en-US");return a},4,se,5,se,6,se,7,ye);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 Vd(a.g);c.b="/setup/eureka_info";if(b){var d=[];if(b.options){var e=new x(b.options),f=e.contains("sign");if(null===a.a||7>a.a){for(var g=new x(["sign","detail"]),l=new x,g=jb(g),p=0;p<g.length;p++){var r=g[p];e.contains(r)&&lb(l,r)}l.s()&&d.push("options="+l.u().join(","))}e.s()&&
(null===a.a||7<=a.a)&&d.push("params="+e.u().join(","))}b.nonce&&d.push("nonce="+b.nonce);d.length&&Zd(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);var b=this.h.get(this.a,null);!b&&7<=this.a&&(b=ye);return b(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";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=eg(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.device_info.ssdp_udn&&(d.ssdpUdn=a.device_info.ssdp_udn),a.device_info.capabilities&&(d.features=fg(d.deviceType||c&&c.deviceType||"b",a.device_info.capabilities)));
a.net&&(void 0!==a.net.ethernet_connected&&(d.ethernetConnected=a.net.ethernet_connected),a.net.ip_address&&(d.connectedIpAddress=a.net.ip_address))}c?fb(c,d):b.eurekaInfoState=d;b.eurekaInfoState.features||(b.eurekaInfoState.features=fg(d.deviceType||c&&c.deviceType||"b"));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 Fe(b)),timeout:1E4,G:2})},Wi=function(a){var b=new Ie;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})},$i=function(a){return Gi(a.b,{url:Si(a,"/setup/supported_locales"),method:"GET",timeout:1E4,G:2}).then(function(a){return a})},aj=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 Vd(a.g);a.b=b;return a.toString()};var bj=function(a,b){this.networks=new w;this.f=new R(this.$a.bind(this),this.Za.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 x;this.h=this.ib.bind(this);this.i=this.jb.bind(this);this.a=new P},cj=function(a,b){O.call(this,a);this.a=b};t(cj,O);var dj=function(){};dj.prototype.c=function(){return!0};dj.prototype.a=function(){return!0};var ej=function(a){this.b=a||null};t(ej,dj);
ej.prototype.c=function(a){return!(!a.WiFi||a.WiFi.Security&&"None"!==a.WiFi.Security)};ej.prototype.a=function(a){return this.b?!(!a.WiFi||a.WiFi.BSSID!==this.b):dg(a)};
var fj=function(a){var b=[];["GUID","Name"].forEach(function(c){c in a&&(b.push(" "+c+": "),b.push(H()))});["ConnectionState","Type"].forEach(function(c){c in a&&b.push(" "+c+": "+a[c])});a.WiFi&&(["SSID","BSSID"].forEach(function(c){c in a.WiFi&&(b.push(" WiFi."+c+": "),b.push(H()))}),["Security","SignalStrength"].forEach(function(c){b.push(" WiFi."+c+": "+a.WiFi[c])}));return B("")};h=bj.prototype;h.start=function(){return this.f.start()};h.stop=function(){return this.f.stop()};
h.$a=function(){var a=this.b;a.onNetworkListChanged.addListener(this.h);a.onNetworksChanged.addListener(this.i);return S(this.f,this.b.getNetworks({networkType:"WiFi",visible:!0})).then(this.rb.bind(this))};h.rb=function(a){return C(a.filter(function(a){if(gj(this,a))return!0;lb(this.c,a.GUID);return!1}.bind(this)).map(function(a){return this.oa(a.GUID)}.bind(this)))};
h.Za=function(){this.b.onNetworkListChanged.removeListener(this.h);this.b.onNetworksChanged.removeListener(this.i);this.networks.clear();this.c.clear();return B()};h.ib=function(a){var b=new x(this.networks.C());a=nb(new x(a),this.c);Xa(nb(a,b),this.oa.bind(this));Xa(nb(b,a),this.Ca.bind(this))};h.Ca=function(a){var b=this.networks.get(a);this.networks.remove(a);a="Connected"===b.ConnectionState;b.ConnectionState="NotConnected";a&&hj(this,"disconnected",b);hj(this,"removed",b)};
h.jb=function(a){a=nb(new x(a),this.c);Xa(a,this.oa.bind(this))};h.oa=function(a){var b=this,c=D();E(F(ij(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||hj(b,"added",c);!f&&g?hj(b,"connected",c):f&&!g&&hj(b,"disconnected",c)}),function(){ib(b.networks,a)&&b.Ca(a)}),function(){c.b()});return c.a};
var hj=function(a,b,c){fj.bind(a,c);Q(a.a,new cj(b,c))},ij=function(a,b){return F(S(a.f,a.b.getProperties(b)),function(a){a instanceof G||H();throw a;}.bind(a)).then(function(a){if(!jj(this,a))throw lb(this.c,b),new G;return a}.bind(a))},gj=function(a,b){return!Ja(a.g,function(a){return!a.c(b)})},jj=function(a,b){return!Ja(a.g,function(a){return!a.a(b)})};var kj=function(a){this.b=a;this.a=null},lj=new w(1,2E4,3,6E4,2,6E4),nj=function(a,b){var c=Ze(a).filter(mj);c.push(b);$e(a,c)},mj=function(a){var b=lj.get(a.type,Infinity);return za()-a.time<b},oj=function(a){this.b=a};t(oj,dj);oj.prototype.a=function(a){(a=pj(this.b,a.WiFi&&a.WiFi.BSSID,2))&&H();return!a};
var qj=function(a){a.a=new w;for(var b=Ze(a.b),c=[],d=0,e=b.length;d<e;++d){var f=b[d];if(mj(f)){c.push(f);ib(a.a,f.type)||a.a.set(f.type,new w);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&&$e(a.b,c)},pj=function(a,b,c){a.a||qj(a);a=a.a.get(c,null);if(null===a||!ib(a,b))return!1;b=a.get(b)+lj.get(c,0);return za()<b},rj=function(a,b){(a=pj(a,b,1)||pj(a,b,3))&&H();return a};var sj=function(a,b,c,d){P.call(this);this.m=new kj(d.localStorage);this.f=new bj(a,new ej,new oj(this.m));this.h=b;this.I=a;this.D=c;this.l=d};t(sj,P);var tj=function(a){O.call(this,"devices");this.devices=a};t(tj,O);var uj=function(a,b,c,d){sj.call(this,a,b,c,d);this.a=null;this.j=0;this.c=new w;this.i=new fh(5E3,6E4);this.w=this.J.bind(this);this.B=this.nb.bind(this);this.o=new R(this.Ya.bind(this),this.Xa.bind(this))};t(uj,sj);
var vj=function(a,b){return F(Ni(a.D,Ki(b)).then(function(a){var b=a.getState(),c=b.eurekaInfoState;if(b.deviceIpAddress&&c&&c.name&&c.ssdpUdn&&void 0!==c.ethernetConnected&&void 0!==c.tosAccepted&&c.deviceType&&void 0!==c.features)return a;H();return ac()}.bind(a)),function(){H()}.bind(a))};h=uj.prototype;h.Ya=function(){this.l.document.addEventListener("visibilitychange",this.B);this.h.listen("devices",this.w);sh(this.h);this.j=0;return this.f.start().then(this.P.bind(this))};
h.Xa=function(){this.l.document.removeEventListener("visibilitychange",this.B);this.h.A("devices",this.w);this.j=0;this.i=new fh(5E3,6E4);this.a&&(this.a.cancel(),this.a=null);this.c.clear();return this.f.stop()};h.start=function(){return this.o.start()};h.stop=function(){return this.o.stop()};h.nb=function(){this.l.document.hidden?this.a&&(this.a.cancel(),this.a=null):(this.i=new fh(5E3,6E4),this.P())};
h.P=function(){this.a&&this.a.cancel();qj(this.m);this.I.requestNetworkScan();this.j++;1<=this.j&&this.l.document.hidden?this.a=null:(this.a=T(this.i.b),S(this.o,this.a).then(this.P.bind(this)),gh(this.i))};var wj=function(a){var b=[];a.c.u().forEach(function(a){a.W&&!rj(this.m,a.ipAddress)&&b.push(a)}.bind(a));Q(a,new tj(b))};
uj.prototype.J=function(a){var b=new x;a.msg.devices.forEach(function(a){lb(b,a.ipAddress);var c=this.c.get(a.ipAddress);c||(c={ipAddress:a.ipAddress},vj(this,a.ipAddress).then(function(b){var c=this.c.get(a.ipAddress);c?(c.W=b,this.c.set(a.ipAddress,c),wj(this)):H()}.bind(this)));a.sessionId&&a.appId&&(c.sessionId=a.sessionId,c.appId=a.appId);this.c.set(a.ipAddress,c)}.bind(this));Xa(nb(new x(this.c.C()),b),this.c.remove.bind(this.c));wj(this)};var xj=function(){},yj="function"==typeof Uint8Array,Aj=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&&!oa(c)&&!(yj&&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]||zj):a.c[c]=a.c[c]||zj},zj=[],Bj=function(a,b){if(b<a.g){b+=a.f;var c=a.a[b];return c===zj?a.a[b]=[]:c}c=a.c[b];return c===zj?a.c[b]=[]:
c},Cj=function(a,b,c){b<a.g?a.a[b+a.f]=c:a.c[b]=c},Dj=function(a,b,c){a.b||(a.b={});if(!a.b[c]){for(var d=Bj(a,c),e=[],f=0;f<d.length;f++)e[f]=new b(d[f]);a.b[c]=e}b=a.b[c];b==zj&&(b=a.b[c]=[]);return b},Fj=function(a){if(a.b)for(var b in a.b){var c=a.b[b];if(oa(c))for(var d=0;d<c.length;d++)c[d]&&Ej(c[d]);else c&&Ej(c)}},Ej=function(a){Fj(a);return a.a};
xj.prototype.h=yj?function(){var a=Uint8Array.prototype.toJSON;Uint8Array.prototype.toJSON=function(){Hh();for(var a=Dh,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,r=p?this[e+2]:0,J=f>>2,f=(f&3)<<4|l>>4,l=(l&15)<<2|r>>6,r=r&63;p||(r=64,g||(l=64));b.push(a[J],a[f],a[l],a[r])}return b.join("")};try{var b=JSON.stringify(Ej(this),Gj)}finally{Uint8Array.prototype.toJSON=a}return b}:function(){return JSON.stringify(Ej(this),Gj)};
var Gj=function(a,b){if(qa(b)){if(isNaN(b))return"NaN";if(Infinity===b)return"Infinity";if(-Infinity===b)return"-Infinity"}return b};xj.prototype.toString=function(){Fj(this);return this.a.toString()};var Hj=function(a){Aj(this,a,0,null)};t(Hj,xj);var Jj=function(a){Aj(this,a,"is.gsser",Ij)};t(Jj,xj);var Ij=[3,5,13];Jj.messageId="is.gsser";Jj.prototype.getTitle=function(){return Bj(this,1)};Jj.prototype.setTitle=function(a){Cj(this,1,a)};var Kj=function(a){Aj(this,a,0,null)};t(Kj,xj);var Lj=function(a){Aj(this,a,0,null)};t(Lj,xj);var Mj=function(a,b,c){this.b=a;this.a=c;this.c="https://clients3.google.com/cast/chromecast/home/gsse?rt=j&hl="+b};
Mj.prototype.request=function(a){var b=new Hj;Cj(b,3,a);Cj(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.ea();a.startsWith(")]}'\n")&&(a=a.slice(5));a=JSON.parse(a);a=new Jj(a[0][0]);var b=[],c=Bj(a,4);c&&b.push(c);(c=Dj(a,Lj,5))&&c.forEach(function(a){b.push(Bj(a,2))});b.forEach(this.a.j.bind(this.a));return a}.bind(this))};var Nj=function(a){this.b=a;this.a=new w;this.f=new R(this.Sa.bind(this),this.Ra.bind(this));this.i=this.ob.bind(this);this.j=this.pb.bind(this);this.h=this.Qa.bind(this);this.l=this.mb.bind(this);this.g=this.Pa.bind(this);this.c=null},Oj=function(a){this.a=a};Oj.prototype.V=function(){var a=cg(this.a.WiFi.SSID),b=new $c("wifi:"+this.a.GUID,gg(a.type),a.name);b.needsSetup=!0;b.features=fg(a.type);return b};
Oj.prototype.xa=function(){var a=this.V(),a={name:a.displayName,type:Tf.a.get(a.type)||"c"};a.ssid=this.a.WiFi.SSID;a.bssid=this.a.WiFi.BSSID;return new Pe(a)};Oj.prototype.start=function(){return B()};Oj.prototype.stop=function(){return B()};var Pj=function(a,b,c,d){this.j=b;this.a=null;this.c=d;this.m=a;this.h=new R(this.Oa.bind(this),this.Na.bind(this));this.w=c;this.g=this.b=this.f=null;this.B=new Mj(a.g,a.h(),this.m.m);this.i=this.l.bind(this);this.o=this.kb.bind(this);this.v=this.hb.bind(this)};
Pj.prototype.xa=function(){var a=this.V();return new Pe({name:a.displayName,type:Tf.a.get(a.type)||"c",ipAddress:this.j})};
var Qj=function(a,b){if(!ng(a.a.appId)||ng(a.a.appId)&&!a.f)return b;a.a.status&&(b.sessionStatus=kg(a.a.status));var c=Dj(a.f,Kj,3);0<c.length&&(b.backdropImageAttributions=Ia(c,function(a){return Bj(a,1)}.bind(a)));c=Dj(a.f,Lj,5);0<c.length&&(b.backdropSecondaryActions=Ia(c,function(a){var b={},c=Bj(a,1);c&&(b.text=c);(a=Bj(a,2))&&(b.url=a);return b}.bind(a)));if(c=a.f.getTitle())b.mediaTitle=c;var d=Bj(a.f,2);d&&(b.imgUrl=d);if(a=Bj(a.f,4))b.backdropPrimaryActionUrl=a;c||1!==b.backdropImageAttributions.length||
(b.mediaTitle=b.backdropImageAttributions[0],b.backdropImageAttributions=[]);return b};h=Pj.prototype;
h.V=function(){var a="ip:"+this.j,b=this.w.getState().eurekaInfoState,a=new $c(a,gg(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(ng(this.a.appId))a=Qj(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=kg(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=Rj(this))if(0<=Fa(b.supportedMediaCommands,chrome.cast.media.MediaCommand.PAUSE)&&(a.canPause=!0),b.playerState&&(a.playerState=jg(b.playerState)),b.media&&(b.media.duration&&(a.mediaDuration=b.media.duration),b=b.media.metadata||
b.media.yb))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.tb=function(){if(this.g)if(!this.g.appId||!this.g.sessionId)Sj(this),this.c();else if(!this.a||this.a.sessionId!=this.g.sessionId){var a=rg(this.m.i,this.g.appId,this.g.sessionId);a.then(this.lb.bind(this));S(this.h,a);this.g=null}};
h.lb=function(a){a.session.status!==chrome.cast.SessionStatus.STOPPED&&(this.a&&Sj(this),this.a=a.session,this.b=a.context,this.a.addMediaListenerWithContext(this.b,this.o),this.a.addUpdateListenerWithContext(this.b,this.i),ng(this.a.appId)&&(this.a.addMessageListenerWithContext(this.b,"urn:x-cast:com.google.cast.sse",this.v),this.a.sendMessageWithContext(this.b,"urn:x-cast:com.google.cast.sse",{type:"GET_STATUS",requestId:Math.floor(4294967295*Math.random())},ma,function(){})),this.a.media&&this.a.media.forEach(function(a){a.addUpdateListenerWithContext(this.b,
this.i)}.bind(this)),this.l())};h.hb=function(a,b){"urn:x-cast:com.google.cast.sse"===a&&(a=JSON.parse(b),a=this.B.request(a.backendData),a.then(function(a){this.f=a;this.c()}.bind(this)),S(this.h,a))};h.kb=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.Oa=function(){return B()};h.Na=function(){Sj(this);return B()};
var Sj=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),ng(a.a.appId)&&a.a.removeMessageListenerWithContext(a.b,"urn:x-cast:com.google.cast.sse",a.v),a.a=null,a.b=null)},Rj=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};Pj.prototype.l=function(){this.a.status===chrome.cast.SessionStatus.STOPPED&&Sj(this);this.c()};
var Tj=function(a,b){if(a.a&&a.b){var c=Rj(a);c&&0<=Fa(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(){}))}},Uj=function(a,b,c){if(a.a&&a.b)switch(c){case 4:case 3:Tj(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(){})}},Vj=function(a,b){if(a.id===b.id)return 0;if(a.needsSetup!==b.needsSetup)return a.needsSetup?-1:1;var c=Ba(a.displayName,b.displayName);return 0!==c?c:a.id<b.id?-1:a.id>b.id?1:0};h=Nj.prototype;h.start=function(){return this.f.start()};h.stop=function(){return this.f.stop()};
h.Sa=function(){this.R();var a=this.b.a.f.a;a.listen("added",this.i);a.listen("removed",this.j);a=this.b.b.a.a;a.addListener("Devices.UserAction",this.h);a.addListener("DeviceDiscovery.ScanAgain",this.l);this.b.a.listen("devices",this.g);a=this.b.a;sh(a.h);a.P();return this.b.a.start()};
h.Ra=function(){this.b.b.a.a.removeListener("Devices.UserAction",this.h);var a=this.b.a.f.a;a.A("added",this.i);a.A("removed",this.j);this.b.a.A("devices",this.g);var b=[this.b.a.stop()];this.a.forEach(function(a){b.push(a.stop())}.bind(this));this.a=new w;return C(b)};h.ob=function(a){var b="wifi:"+a.a.GUID;a=this.a.get(b)||new Oj(a.a);this.a.set(b,a);a.start();this.R()};h.pb=function(a){a="wifi:"+a.a.GUID;var b=this.a.get(a);b&&(b.stop(),this.a.remove(a),this.R())};
h.Pa=function(a){var b=new w,c=!1;a.devices.forEach(function(a){if(a.ipAddress){var d="ip:"+a.ipAddress,f=this.a.get(d);f||(f=new Pj(this.b,a.ipAddress,a.W,this.R.bind(this)),f.start(),c=!0);var g=f;a.ipAddress!=g.j?(H(),H()):(g.g=a,Ag(g.h).then(g.tb.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 Oj&&(b.set(a,c),this.a.remove(a))}.bind(this));0<this.a.s()&&(c=!0);this.a.forEach(function(a){a.stop()}.bind(this));this.a=b;c&&this.R()};
h.R=function(a){var b=[];this.a.forEach(function(a){if(a=a.V()){for(var c,d=Vj||Ta,g=0,l=b.length;g<l;){var p=g+l>>1,r;r=d(a,b[p]);0<r?g=p+1:(l=p,c=!r)}c=c?g:~g;0>c&&Sa(b,-(c+1),0,a)}});var c=this.b.b.a.a;c.sendMessage(new ad(b,a));0===b.length?null===this.c&&(this.c=S(this.f,T(3E4)).then(function(){this.c=null;var a=0;this.a.forEach(function(b){a+=b.V()?1:0});0===a&&c.sendMessage(new I("DeviceDiscovery.NotFound"))}.bind(this))):null!==this.c&&(a=this.c,this.c=null,a.cancel())};
h.Qa=function(a){var b=this.a.get(a.device.id);if(b)switch(a.action){case 1:a=new Ne(Ca());a.states=new Te(0,[new N(1)]);a.commonState=new Oe;a.commonState.device=b.xa();a.commonState.pinned=!0;Xe(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:Uj(b,a.device,a.action)}else H()};h.mb=function(){this.R();var a=this.b.a;sh(a.h);a.P()};var Wj=function(a,b){this.c=a;this.i=b;this.b=null;this.j=Ki(b);this.g=this.a=null;this.f=new R(this.Ua.bind(this),this.Ta.bind(this));this.h=new w("DeviceSettings.Apply",this.La.bind(this),"DeviceSettings.Reboot",this.o.bind(this),"DeviceSettings.FactoryReset",this.m.bind(this),"DeviceSettings.ForgetWiFi",this.v.bind(this),"DeviceSettings.Exit",this.l.bind(this))};h=Wj.prototype;h.start=function(){return this.f.start()};h.stop=function(){return this.f.stop()};
h.Ua=function(){return S(this.f,Ni(this.c.g,this.j)).then(function(a){this.b=a;return C([S(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(" ")})),S(this.f,$i(a)),S(this.f,aj(a))])}.bind(this)).then(function(a){this.qb.apply(this,a);var b=this.c.b.a.a;this.h.forEach(function(a,d){b.addListener(d,a)});Xj(this,1)}.bind(this))};
h.Ta=function(){var a=this.c.b.a.a;this.h.forEach(function(b,c){a.removeListener(c,b)});this.b=null;this.j=Ki(this.i);this.a=null;return B()};
h.qb=function(a,b,c){var d=Ri(this.b),e=d.setupApiVersion,f=gg(d.deviceType);c=c.map(function(a){return new ed(a.timezone,a.display_string,a.offset)});b=b.map(function(a){return new dd(a.locale,a.display_string)});var g=this.a={};if(7<=e){var e=a.wifi,l=a.settings,p=a.opt_in,r=a.build_info,J=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=r.cast_build_revision||"";g.countryCode=l.country_code||null;g.macAddress=J.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.La=function(a){var b=this,c=Ri(this.b).features.deviceSettings;a.timeFormat===b.a.timeFormat||c.supportsTimeFormatChange||(a.timeFormat=b.a.timeFormat);a.statsOptIn===b.a.statsOptIn||c.supportsDataCollectionToggle||(a.statsOptIn=b.a.statsOptIn);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)Xj(b,1);else{var d=db(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;Xj(b,2);F(S(b.f,Zi(b.b,Yj(b,a))).then(function(){b.a.localeId!==d.localeId?b.c.reload():Xj(b,1)}),function(){b.a=d;Xj(b,3)})}};
var Yj=function(a,b){var c=a.b.a;a=1===b.timeFormat?1:2;if(7<=c)return c=new Me,c.name=b.name,c.settings=new Be,b.timeZoneId&&(c.settings.timezone=b.timeZoneId),c.settings.time_format=a,c.settings.locale=b.localeId,c.opt_in=new Ce,c.opt_in.stats=b.statsOptIn,c;if(4<=c&&6>=c)return c=new Le,c.name=b.name,b.timeZoneId&&(c.timezone=b.timeZoneId),c.time_format=a,c.locale=b.localeId,c.opt_in=new ue,c.opt_in.stats=b.statsOptIn,c;a=new Ke;a.name=b.name;b.timeZoneId&&(a.timezone=b.timeZoneId);a.locale=b.localeId;
return a},Xj=function(a,b){a.c.b.a.a.sendMessage(new fd(b,Ri(a.b).features,a.a))};Wj.prototype.o=function(){if(Ri(this.b).features.deviceSettings.supportsReboot){Vi(this.b,"now");var a=this.b.c.read().deviceIpAddress;nj(this.c.f,new Ue(1,za(),a));this.c.c()}};Wj.prototype.m=function(){if(Ri(this.b).features.deviceSettings.supportsFdr){Vi(this.b,"fdr");var a=this.b.c.read().deviceIpAddress;nj(this.c.f,new Ue(3,za(),a));this.c.c()}};
Wj.prototype.v=function(){if(Ri(this.b).features.deviceSettings.supportsForgetWiFi){var a=this.b,b=this.g;a.b.request({url:Si(a,"/setup/forget_wifi"),method:"POST",headers:{"Content-Type":"application/json"},content:JSON.stringify(new De(b)),timeout:1E4,G:2});this.c.c()}};Wj.prototype.l=function(){this.c.c()};var Zj=chrome.i18n.getMessage("3254351313955764967"),ak=chrome.i18n.getMessage("3485206350043289145");var bk=function(a,b){this.c=a;this.a=b;this.b=new P;this.f=new R(this.h.bind(this),this.g.bind(this))};bk.prototype.start=function(){return this.f.start()};
bk.prototype.h=function(){var a=D();ck(this.c,"start");dk(this);var b=S(this.f,T(18E4)).then(function(){ck(this.c,"load-failed");Q(this.b,"loadTimedOut");a.c(new Lf)}.bind(this));S(this.f,this.a.start()).then(function(){var a=this.a.a;S(this.f,Wg(a,"OfflineUiReady")).then(function(){Q(this.b,"offlineUiReady")}.bind(this));Q(this.b,"waitingForHandshake");return S(this.f,a.sendRequest(new rc))}.bind(this)).then(function(c){switch(c.type){case "Handshake.Response":ck(this.c,"hosting-embedded-ui");Q(this.b,
"embeddedUiReady");b.cancel();a.b();break;case "Handshake.UiVersionNotSupported":ck(this.c,"update-required");Q(this.b,"updateRequired");a.c(c);break;default:ck(this.c,"load-failed"),Q(this.b,"loadFailed")}}.bind(this));return a.a};var dk=function(a){var b=a.c.document;[["#load-failed-message",Zj],["#update-required-message",ak]].forEach(function(a){var c=b.querySelector(a[0]);c&&(c.textContent=a[1])})};bk.prototype.g=function(){return this.a.stop()};
var ck=function(a,b){(a=a.document&&a.document.body||null)&&a.setAttribute("class",b)};var ek=function(a,b,c,d,e){this.b=b;this.a=c;this.f=d;this.g=a.localStorage;this.c=e},fk=function(a,b,c){this.b=a;this.l=b;this.m=m(c)?c:3E4;this.c=new w;this.h=!0;this.g=!1;this.a=new x;this.j=new kj(a.g);this.f=new R(this.cb.bind(this),this.bb.bind(this));this.i=this.ab.bind(this)};h=fk.prototype;h.start=function(){return this.f.start()};h.stop=function(){if(!this.g){var a=new nd(this.l,this.c.u(),!0);this.b.b.a.a.sendMessage(a);this.g=!0}return this.f.stop()};
h.cb=function(){this.b.a.listen("devices",this.i);sh(this.b.a);S(this.f,T(this.m)).then(function(){this.h=!1;this.Ea()}.bind(this));return B()};h.bb=function(){this.b.a.A("devices",this.i);this.c=new w;this.h=!0;this.g=!1;this.a=new x;return B()};
h.ab=function(a){var b=this;qj(this.j);(a.msg.devices||[]).forEach(function(a){var c=a.ipAddress;ib(b.c,c)||b.a.contains(c)||rj(b.j,c)||(lb(b.a,c),E(F(Ni(b.b.f,Ki(c)).then(function(a){if(7>a.a)throw new G;return S(b.f,Ui(a)).then(function(d){var e=Ri(a);d=new md(d.token,e.name,gg(e.deviceType),e.ssdpUdn);b.c.set(c,d);b.a.remove(c);b.g||(d=new nd(b.l,b.c.u(),!b.h&&0===b.a.s()),b.g=d.scanComplete,b.b.b.a.a.sendMessage(d))})}),function(){b.a.remove(c)}),b.Ea.bind(b)))})};
h.Ea=function(){this.h||0!==this.a.s()||this.stop()};var V=function(a,b,c){this.b=new R(b||function(){return B()},c||void 0);this.a=a};V.prototype.start=function(){return this.b.start()};V.prototype.stop=function(){return this.b.stop()};var W=function(a){return a.a.j.a.a};var ik=function(a,b,c,d){var e=gk,f=hk,g=window.location.reload.bind(window.location),l=chrome.i18n.getUILanguage,p=new ph;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 jk=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)};t(jk,V);jk.prototype.l=function(){return S(this.b,kk(this.a)).then(function(a){this.f=a;W(this).addListener("AudioConfirmation.UserAction",this.g);W(this).sendMessage(new Lc(1));this.c=3;this.h()}.bind(this))};jk.prototype.j=function(){this.c=this.f=null;W(this).removeListener("AudioConfirmation.UserAction",this.g);return B()};
jk.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 Ee(c)),timeout:1E4,G:2});S(a,b);this.c=3;S(this.b,T(1===this.c?3E3:1900)).then(this.m)}};jk.prototype.i=function(a){var b=null;switch(a.action){case 1:this.c=1;b=2;break;case 2:X(this.a,12);Y(this.a,new N(5));break;case 3:b=3;break;case 4:X(this.a,13),a=this.a,Ye(a.a.a,a.b),a.a.f()}b&&W(this).sendMessage(new Lc(b))};var lk=function(a){V.call(this,a,this.c.bind(this),null)};t(lk,V);lk.prototype.c=function(){var a=this;S(this.b,W(this).sendRequest(new Ic((this.a.b.setupApiClientState||null).verificationState.pin))).then(function(b){b.confirmed?(X(a.a,10),Y(a.a,new N(5))):(X(a.a,11),S(a.b,W(a).sendRequest(new wc(1))).then(function(){var b=a.a;Ye(b.a.a,b.b);b.a.f()}))});return B()};var mk=function(a,b){this.i=a;this.a=new bj(a,new ej(b));this.b="connected";this.c=null;this.f=new R(this.Wa.bind(this),this.Va.bind(this));this.g=new P},nk=["added","removed","connected","disconnected"];h=mk.prototype;h.start=function(){return this.f.start()};h.stop=function(){return this.f.stop()};h.getState=function(){return this.b};h.Wa=function(){var a=this;return a.a.start().then(function(){a.h();nk.forEach(function(b){a.a.a.listen(b,a.h,!0,a)})})};
h.Va=function(){this.b="connected";this.c=null;if(!this.a)return B();var a=this.a;this.a=null;nk.forEach(function(b){a.a.A(b,this.h,!0,this)}.bind(this));return a.stop()};var ok=function(a,b){a.b!==b&&(a.b=b,Q(a.g,new O(b)))};
mk.prototype.h=function(){if("failed"!==this.b){var a=null;1===this.a.networks.s()&&(a=this.a.networks.u()[0]);if(!a)"connected"===this.b&&(pk(this),ok(this,"disconnected"));else if("Connected"===a.ConnectionState)this.c&&(a=this.c,this.c=null,a.cancel()),ok(this,"connected");else if("connected"===this.b||"disconnected"===this.b)pk(this),ok(this,"reconnecting"),qk(this,a.GUID)}};
var qk=function(a,b){F(S(a.f,a.i.startConnect(b)),function(){ok(this,"failed");this.a.stop()}.bind(a))},pk=function(a){a.c||(a.c=S(a.f,T(9E4)).then(function(){ok(this,"failed");this.a.stop()}.bind(a)))};var rk=function(a){V.call(this,a,this.v.bind(this),this.m.bind(this));this.f=null;this.o=0;this.h=this.g=this.j=this.c=null};t(rk,V);var sk=["connected","disconnected","reconnecting","failed"];rk.prototype.v=function(){var a=this,b=Z(a.a);W(a).sendMessage(lg(b.connectWiFi,tk(a.a)));a.g=new mk(a.a.a.b,b.connectedHotSpotBssid);sk.forEach(function(b){a.g.g.listen(b,a.i,!0,a)});return C([S(a.b,a.g.start()),S(a.b,kk(a.a)).then(function(b){a.f=b;uk(a)})]).then(a.w.bind(a))};
rk.prototype.m=function(){var a=this;vk(a);wk(a);if(!a.g)return B();var b=a.g;a.g=null;sk.forEach(function(c){b.g.A(c,a.i,!0,a)});return b.stop()};var uk=function(a,b){a.c||(a.c=F(T(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){Nf(a)}).then(function(){a.c=null;uk(a,3E3)}))},wk=function(a){if(a.c){var b=a.c;a.c=null;b.cancel()}};
rk.prototype.l=function(){var a=Ri(this.f).setupState;if(a!==this.j)switch(this.j=a,a){case 31:return xk(this,2),ac(new G);case 21:case 41:case 10:case 11:return xk(this,1),ac(new G);case 60:case 61:case 51:return yk(this),ac(new G)}};
var yk=function(a){vk(a);X(a.a,19);var b=Ri(a.f);E(F(S(a.b,a.a.a.c.a()).then(function(c){c=mg(b.setupApiVersion,Z(a.a).deviceName,3!==c);return S(a.b,Zi(a.f,c))}),function(a){Nf(a)}).then(function(){var c=Z(a.a),d=c.connectedHotSpotBssid;nj(a.a.a.a,new Ue(2,za(),d));delete c.connectedHotSpotBssid;zk(a.a,c);if(60!==b.setupState&&4<=b.setupApiVersion)return F(S(a.b,Wi(a.f)),ma)}),function(){Y(a.a,new N(8))})},xk=function(a,b){vk(a);X(a.a,2===b?17:18);var c=Z(a.a);c.connectWiFi.a=b;zk(a.a,c);Y(a.a,new N(6))};
rk.prototype.i=function(a){switch(a.type){case "connected":uk(this);break;case "disconnected":case "reconnecting":wk(this);break;case "failed":xk(this,1)}};rk.prototype.w=function(){clearTimeout(this.h);this.h=setTimeout(function(){xk(this,1)}.bind(this),9E4)};var vk=function(a){clearTimeout(a.h);a.h=null};var Ak="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 Bk=function(a){V.call(this,a,this.g.bind(this),null);this.f=!1;this.c=null};t(Bk,V);
Bk.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=uh(a))&&-1!==Ak.indexOf(b)?b:(a=th(a).toUpperCase())&&-1!==Ak.indexOf(a)?a:"US");this.c=a;F(S(this.b,W(this).sendRequest(new Oc(tk(this.a),c,this.c))).then(this.h.bind(this)),this.a.g.bind(this.a));return B()};
Bk.prototype.h=function(a){var b=this;X(b.a,14);var c=Z(b.a);c.deviceName=a.name;b.c&&a.country&&(c.country=a.country);zk(b.a,c);if(b.f){var d=null;return C([S(b.b,kk(b.a)),b.a.a.c.a()]).then(function(a){d=a[0];a=a[1];var e=[];7<=d.a&&e.push(S(b.b,d.b.request({url:Si(d,"/setup/accept_tos"),method:"POST",timeout:1E4,G:2})));e.push(S(b.b,Zi(d,mg(d.a,c.deviceName,3!==a))));return C(e)}).then(function(){return S(b.b,Li(d,{options:["setup.setup_state"]}))}).then(function(){switch(Ri(d).setupState){case 60:Ck(b.a);
break;case 62:Y(b.a,new N(10));break;default:return ac()}})}Y(b.a,new N(6))};var Dk=function(a){V.call(this,a,this.c.bind(this),null)};t(Dk,V);Dk.prototype.c=function(){var a=this,b=null;return C([S(this.b,kk(this.a)),this.a.a.c.a()]).then(function(c){b=c[0];c=mg(b.a,Z(a.a).deviceName,3!==c[1]);c=[S(a.b,Zi(b,c))];4<=b.a&&c.push(S(a.b,Wi(b)));return C(c)}).then(function(){return S(a.b,Li(b,{options:["setup.setup_state"]}))}).then(function(){switch(Ri(b).setupState){case 60:case 52:Ck(a.a);break;case 62:Y(a.a,new N(10));break;default:return ac()}})};var Ek=function(a,b,c,d){V.call(this,a,this.Z.bind(this),this.m.bind(this));this.g=1;this.c=new ug;this.B=c;this.D=b;this.i=null;this.I=void 0!==d?d:af(a.a.a);this.h=null;this.v=this.T.bind(this);this.l=this.j.bind(this);this.J=this.S.bind(this)};t(Ek,V);
Ek.prototype.Z=function(){var a=this;Fk(a,1);a.h=new bj(this.a.a.b);var b=a.h.a;b.listen("connected",a.fa,!0,a);b.listen("added",a.o,!0,a);b=W(a);b.addListener("WiFiSwitching.Proceed",a.v);b.addListener("WiFiSwitching.RetryConnection",a.l);b.addListener("WiFiConfig.Retry",a.l);return S(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.O(1),Fk(a,2),a.X(1),vg(a.c,T(25E3)).then(a.w.bind(a)),a.a.a.b.startConnect(a.i)):a.w():(Fk(a,
11),a.a.g())})};Ek.prototype.m=function(){this.g=1;this.i=null;var a=this.c;this.c=new ug;var a=[wg(a)],b=this.h;this.h=null;if(b){var c=b.a;c.A("connected",this.fa,!0,this);c.listen("added",this.o,!0,this);a.push(b.stop())}b=W(this);b.removeListener("WiFiSwitching.Proceed",this.v);b.removeListener("WiFiSwitching.RetryConnection",this.l);b.removeListener("WiFiConfig.Retry",this.l);return C(a)};
Ek.prototype.fa=function(a){if(Gk(this,a))switch(this.g){case 2:this.O(2);this.j();break;case 6:this.O(4),this.j()}};Ek.prototype.o=function(a){Gk(this,a)&&1===this.g&&(this.i=a.a.GUID)};var Gk=function(a,b){b=b.a.WiFi;return a.B&&!ag(b.BSSID,a.B)||a.D&&b.SSID!==a.D?!1:!0};Ek.prototype.w=function(){this.O(3);Fk(this,5);this.L(1)};Ek.prototype.T=function(){var a=this;Fk(a,6);a.L(2);var b=a.h.networks.get(this.i);b&&"Connected"===b.ConnectionState?a.j():vg(a.c,T(1E4)).then(function(){Fk(a,7);a.L(3)})};
var Hk=function(a){var b=D();vg(a.c,b.a);var c=null,d=function(e){c=T(e).then(a.sa.bind(a)).then(function(c){a.O(5);b.b(c)},function(c){c instanceof Ei?d(2E3):c instanceof Oi&&(X(a.a,9),b.c(c))})};E(b.a,function(){if(c){var a=c;c=null;a.cancel()}});d(0);return b.a};Ek.prototype.j=function(){var a=this;6===a.g||9===a.g?(Fk(a,8),this.L(2)):(Fk(a,3),this.X(1));var b=Hk(a).then(function(b){Fk(a,11);a.ta(b)},this.J);vg(a.c,T(12E4)).then(function(){b.cancel()})};
Ek.prototype.S=function(a){a=a instanceof Qi||a instanceof Oi;8===this.g?a?(Fk(this,10),this.L(5)):(Fk(this,9),this.L(4)):a?(Fk(this,10),this.X(3)):(Fk(this,4),this.X(2))};var Fk=function(a,b){b!==a.g&&(a.g=b,b=a.c,a.c=new ug,wg(b))};var Ik=function(a){this.f=Z(a).device;Ek.call(this,a,null,this.f.bssid)};t(Ik,Ek);var Jk=new w(1,4,2,5,3,6,4,7,5,8);h=Ik.prototype;h.fa=function(a){var b=a.a.WiFi,c=null;ag(b.BSSID,this.f.bssid)?(c=Z(this.a),c.connectedHotSpotBssid=b.BSSID):dg(a.a)||(c=Z(this.a),c.originalWiFiNetwork={ssid:b.SSID,bssid:b.BSSID});c&&zk(this.a,c);Ik.H.fa.call(this,a)};h.sa=function(){var a=this.a.a;return S(this.b,Pi(a.g,Ki("192.168.255.249"),a.b,{ssid:this.f.ssid,bssid:this.f.bssid},a.h()))};
h.X=function(a){var b=this.a.a,c=W(this),d=gg(this.f.type);c.sendMessage(new Cc(1===a&&3||2===a&&4||3===a&&5||null,d,this.f.name));3===a&&vg(this.c,Wg(c,"BadDeviceAck")).then(b.f.bind(b))};h.L=function(a){var b=this.a.a,c=W(this);c.sendMessage(new Fc(a,this.f.name,this.f.ssid));5===a&&vg(this.c,Wg(c,"BadDeviceAck")).then(b.f.bind(b))};h.ta=function(a){a=a.getState();this.a.h(a);a.eurekaInfoState.features.supportsDisplay?Y(this.a,new N(3)):Y(this.a,new N(4))};
h.O=function(a){(a=Jk.get(a))&&X(this.a,a)};var Kk=function(a,b,c,d,e){var f=D(),g=new uj(b,c,d,e),l=function(b){return b.W.getState().eurekaInfoState.ssdpUdn===a},p=function(a){(a=Ja(a.devices,l))&&f.b(a.ipAddress)};g.listen("devices",p);var r=null;g.start().then(function(){r=setInterval(function(){sh(g.h);g.P()},5E3)});var J=setTimeout(f.c.bind(f),18E4);return E(f.a,function(){clearTimeout(J);clearInterval(r);g.A("devices",p);g.stop()})};var Lk=function(a){V.call(this,a,this.i.bind(this),null);this.c=null;this.l=0;this.f=null;this.h=0};t(Lk,V);Lk.prototype.i=function(){var a=this;X(a.a,30);return S(this.b,kk(this.a)).then(function(b){a.c=b;W(a).sendMessage(new yc("OtaUpdate.Pending",tk(a.a)));Mk(a,0)})};
var Mk=function(a,b){F(S(a.b,T(b)).then(function(){++a.l;return S(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();Mk(a,3E3)}),function(b){Nf(b);b=a.c.getState().eurekaInfoState.ssdpUdn;var c=a.a.a;S(a.b,Kk(b,c.b,c.i,c.g,c.window)).then(a.g.bind(a),a.j.bind(a))})};
Lk.prototype.g=function(){X(this.a,31);var a=W(this);S(this.b,Wg(a,"OtaUpdate.Proceed")).then(function(){Ck(this.a)}.bind(this));a.sendMessage(new yc("OtaUpdate.Done",tk(this.a)))};Lk.prototype.j=function(){};var Nk=function(a,b,c){this.f=new R(this.m.bind(this),this.l.bind(this));this.a=a;this.j=b;this.b=c;this.c=null;this.i=new P;b.a.a.addListener("RestartSetup",this.v.bind(this));b.a.a.addListener("GoToDeviceList",this.a.f.bind(this.a))},Ok=function(a){O.call(this,"newState");this.state=a};t(Ok,O);Nk.prototype.start=function(){return this.f.start()};Nk.prototype.stop=function(){return this.f.stop()};
var Ck=function(a){var b=Z(a),c=a.b.setupApiClientState||null,d=c.deviceIpAddress,c=c.eurekaInfoState;X(a,b.device&&b.device.bssid?25:28);b=new hh("deviceJustSetUp");b.deviceJustSetUp=new ih(d,c.name,c.ssdpUdn,c.modelName);var e=new jh;e.audioOutSupported=!0;e.videoOutSupported=!!c.features.supportsDisplay;b.deviceJustSetUp.capabilities=e;a.a.l.setItem("showDeviceBanner",d);Ye(a.a.a,a.b);E(S(a.f,Of(a.a.i.sendMessage(b),1E4)),function(){E(a.stop(),function(){a.a.f()})})},tk=function(a){return(a=a.b.commonState&&
a.b.commonState.device&&a.b.commonState.device.type)?gg(a):2},kk=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())};Nk.prototype.h=function(a){a?this.b.setupApiClientState=a:delete this.b.setupApiClientState;Xe(this.a.a,this.b)};
var Z=function(a){return a.b.commonState||new Oe},zk=function(a,b){b?a.b.commonState=b:delete a.b.commonState;Xe(a.a.a,a.b)},Y=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 Te(0,[b]);Xe(a.a.a,a.b);a.c=a.a.j(a,b.type);Q(a.i,new Ok(b.type));F(S(a.f,a.c.start()),function(b){if(b instanceof G)switch(a.f.getState()){case "starting":case "started":a.g()}else a.g()})})};
Nk.prototype.g=function(){Ye(this.a.a,this.b);this.j.a.a.sendMessage(new yc("ShowGenericSetupError",tk(this)));F(this.stop(),ma)};var X=function(a,b){a.a.c.b(b)};
Nk.prototype.m=function(){var a=this.b.states.all[this.b.states.current].type;this.c=this.a.j(this,a);Q(this.i,new Ok(a));null===this.a.a.getItem("setupNoCountryDetection")&&(a=Z(this),a.country||a.connectedHotSpotBssid||S(this.f,this.j.a.a.sendRequest(new id)).then(function(a){var b=Z(this);b.country||(b.country=a.countryCode,zk(this,b))}.bind(this)));return this.c.start()};Nk.prototype.l=function(){var a=this.c;this.c=null;Q(this.i,new Ok(null));return a.stop()};
Nk.prototype.v=function(){Ye(this.a.a,this.b);this.a.m()};var Pk=function(a){V.call(this,a,this.D.bind(this),this.B.bind(this));this.c=1;this.f=this.h=null;this.g=new w;this.i=new w;this.j=null;this.o=this.J.bind(this);this.l=this.w.bind(this)};t(Pk,V);
Pk.prototype.D=function(){var a=this;Qk(a,1);W(a).addListener("SetupStart.Proceed",a.o);var b=[];b.push(S(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,zk(a.a,c));var d=a.a.a;a.f=new uj(d.b,d.i,d.g,d.window);d=a.f.f.a;d.listen("added",a.m,!0,a);d.listen("connected",a.v,!0,a);a.f.listen("devices",this.l);b.push(S(a.b,a.f.start()));Ag(a.b).then(function(){c.pinned&&c.device?(a.h=c.device,Qk(a,5),Rk(a)):0!=a.i.c?Sk(a,a.i.M(!1).next()):Za(a.g,function(b){if("NotConnected"===
b.ConnectionState)return!0;Tk(a,b);return!1})&&(Qk(a,2),Rk(a),S(a.b,T(5E3)).then(a.I.bind(a)))});return C(b)};Pk.prototype.B=function(){this.c=1;this.h=null;this.g=new w;this.i=new w;this.j=null;W(this).removeListener("SetupStart.Proceed",this.o);if(!this.f)return B();var a=this.f;this.f=null;var b=a.f.a;b.A("added",this.m,!0,this);b.A("connected",this.v,!0,this);a.A("devices",this.l);return a.stop()};
var Qk=function(a,b){b!==a.c&&(a.c=b)},Rk=function(a){var b=W(a);switch(a.c){case 1:case 2:b.sendMessage(new Ac(!1));break;case 3:b.sendMessage(new Ac(!0));break;case 4:b.sendMessage(new I("DeviceDiscovery.NotFound"));break;case 5:Uk(a,1);break;case 6:Uk(a,2);break;case 7:Uk(a,3);break;case 8:Uk(a,4)}},Uk=function(a,b){var c=gg(a.h.type);b=new Cc(b,c,a.h.name);b.otherDevicesExist=1<a.g.s()+a.i.s();b.analyticsOptIn=3!==a.j;W(a).sendMessage(b)};
Pk.prototype.I=function(){if(2===this.c)if(0===this.g.s())Qk(this,3),Rk(this),S(this.b,T(45E3)).then(function(){3===this.c&&(this.f.stop(),Qk(this,4),Rk(this))}.bind(this));else{var a=Ya(this.g,function(a,c){return"NotConnected"!==c.ConnectionState?c:(c.WiFi&&c.WiFi.SignalStrength||-Infinity)<(a&&a.WiFi&&a.WiFi.SignalStrength||-Infinity)?a:c});Tk(this,a)}};
var Tk=function(a,b){b=b&&b.WiFi;var c=b.SSID,d=cg(c);a.h=new Pe({name:d.name,type:d.type,ssid:c,bssid:b.BSSID});Qk(a,5);Rk(a)},Sk=function(a,b){var c=b.W.getState().eurekaInfoState;a.h=new Pe({name:c.name,type:c.deviceType,ipAddress:b.ipAddress});Qk(a,5);Rk(a)};Pk.prototype.m=function(a){a=a.a;var b=!ib(this.g,a.GUID);this.g.set(a.GUID,a);5===this.c?b&&Rk(this):3===this.c&&Tk(this,a)};Pk.prototype.v=function(a){2!==this.c&&3!==this.c||Tk(this,a.a)};
Pk.prototype.w=function(a){var b=this,c=null;a.devices.filter(function(a){a=a.W.getState().eurekaInfoState;return a.features.supportsSetup&&a.ethernetConnected&&!a.tosAccepted}).forEach(function(a){ib(b.i,a.ipAddress)||(b.i.set(a.ipAddress,a),c=c||a)});c&&(2===b.c||3===b.c?Sk(b,c):5===b.c&&Rk(b))};
Pk.prototype.J=function(){var a=this;5!==a.c&&8!==a.c||Vk(a).then(function(){var b=Z(a.a);b.device=a.h;zk(a.a,b);if(b.device.bssid)X(a.a,3),Y(a.a,new N(2));else{X(a.a,27);Qk(a,7);Rk(a);var c=a.a.a;F(S(a.b,Ni(c.g,Ki(b.device.ipAddress),c.h())).then(function(b){a.a.h(b.getState());X(a.a,27);Y(a.a,new N(5))}),function(){Qk(a,8);Rk(a)})}})};
var Vk=function(a){var b=a.a.a.a;if(null!==b.getItem("setupTosAccepted"))return B();var c=a.a.a.c,d=S(a.b,Wg(W(a),"SetupStart.TosAccepted")).then(function(a){c.h(a.analyticsOptIn);b.setItem("setupTosAccepted","")}.bind(a));Qk(a,6);Rk(a);return d};var Xk=function(a){this.f=a;this.b=new P;this.networks=new w;this.c=!1;this.a=new R(function(){Wk(this);return B()}.bind(this),function(){this.networks.clear();this.c=!1;return B()}.bind(this))},$k=function(a){this.id=Yk(a);this.ssid=a.ssid;this.Ga=a.wpa_auth;this.Ha=a.wpa_cipher;this.Ia=a.wpa_id;this.ja=new x;this.Y=a.signal_level;this.Aa=this.ha=!1;Zk(this,a)},Zk=function(a,b){lb(a.ja,b.bssid);a.Y=Math.max(a.Y,b.signal_level);b.ap_list&&b.ap_list.forEach(function(a){lb(this.ja,a.bssid);this.Y=Math.max(this.Y,
a.signal_level);this.ha=this.ha||5E3<=a.frequency}.bind(a))},al=function(){O.call(this,"error")};t(al,O);var bl=function(){this.networks=new w;this.a=0;this.K=D()},Yk=function(a){return a.wpa_id?a.wpa_id.toString():a.ssid+":"+a.wpa_auth+":"+a.wpa_cipher};Xk.prototype.start=function(){return this.a.start()};Xk.prototype.stop=function(){return this.a.stop()};
var Wk=function(a){F(S(a.a,Yi(a.f)).then(function(){S(a.a,T(3E3))}).then(function(){var b=new bl;a.g(b);return b.K.a}).then(a.h.bind(a)).then(function(){return S(a.a,T(1E3))}).then(function(){Wk(a)}),function(b){Nf(b);Q(a.b,new al);a.stop()})};Xk.prototype.g=function(a){F(S(this.a,Xi(this.f)).then(this.i.bind(this,a)).then(function(){3===a.a?a.K.b(a.networks):S(this.a,T(2E3)).then(this.g.bind(this,a))}.bind(this)),function(b){a.K.c(b)})};
Xk.prototype.i=function(a,b){var c=!1,d=!1;b.filter(function(a){return 1!==a.wpa_auth?!0:!bg(a.bssid)}).forEach(function(b){var e=Yk(b),g=a.networks.get(e);g?Zk(g,b):(g=new $k(b),a.networks.set(e,g),c=!0,ib(this.networks,e)||(this.networks.set(e,g),d=!0))}.bind(this));a.a=c?0:a.a+1;if(d||!this.c)Q(this.b,new O("networksAdded")),this.c=!0};
Xk.prototype.h=function(a){a.forEach(function(a){a.Aa=!0});Xa(nb(new x(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;Q(this.b,new O("scanCompleted"))};var cl=function(a){V.call(this,a,this.w.bind(this),this.o.bind(this));this.h=this.f=this.c=this.g=null;this.v=this.i.bind(this);this.j=this.B.bind(this);this.m=this.D.bind(this)};t(cl,V);
cl.prototype.w=function(){var a=this;return S(a.b,kk(a.a)).then(function(b){a.g=b;var c=null;b=W(a);c=Z(a.a);a.f=c.connectWiFi||null;if(a.f){var d=lg(a.f,tk(a.a));delete c.connectWiFi;zk(a.a,c);2===a.f.a?c=a.i():(b.addListener("WiFiConfig.ErrorAck",a.v),c=B());dl(a,d)}else c=a.i(),S(a.b,T(7E3)).then(function(){a.h||dl(a,new Sc(1,tk(a.a),[],null))});b.addListener("WiFiConfig.Retry",a.m);return c})};
cl.prototype.i=function(){if(this.c)return B();this.c=new Xk(this.g);this.c.b.listen("networksAdded",this.l,!0,this);W(this).addListener("WiFiConfig.Connect",this.j);el(this);return this.c.start()};cl.prototype.o=function(){this.h=this.g=null;var a=W(this);a.removeListener("WiFiConfig.Connect",this.j);a.removeListener("WiFiConfig.Retry",this.m);a.removeListener("WiFiConfig.ErrorAck",this.v);return this.c?(this.c.b.A("networksAdded",this.l,!0,this),a=this.c,this.c=null,a.stop()):B()};
var dl=function(a,b){a.h=b;W(a).sendMessage(b)};cl.prototype.l=function(){if(this.h)W(this).sendMessage(new Tc(this.c.networks.u().map(function(a){return new Rc(a.id,a.ssid,hg(a.Ga))})));else{var a=Z(this.a),b=a.originalWiFiNetwork&&a.originalWiFiNetwork.bssid,c=[],d=null;Xa(this.c.networks,function(a){var e=new Rc(a.id,a.ssid,hg(a.Ga));c.push(e);b&&a.ja.contains(b)&&(d=e)});dl(this,new Sc(1,tk(this.a),c,d))}};
cl.prototype.B=function(a){var b=this,c=fl(b,a);S(b.b,new A(function(d){a.password?d(gl(b,a.password).then(function(a){c.msg.enc_passwd=a})):d()})).then(function(){return S(b.b,hl(b,c))}).then(function(d){d?(b.f=c,dl(b,new Sc(5,tk(b.a),b.h.networks,a.network))):(d=Z(b.a),d.connectWiFi=c,zk(b.a,d),F(Ti(b.g,c.msg),ma),X(b.a,15),Y(b.a,new N(7)))})};
var fl=function(a,b){var c=new Re(new me(b.network.ssid,ig(b.network.security)));b.network.id&&(c.b=b.network.id,a.c&&ib(a.c.networks,b.network.id)?(a=a.c.networks.get(b.network.id),a.Ha&&(c.msg.wpa_cipher=a.Ha),a.Ia&&(c.msg.wpa_id=a.Ia)):a.f&&a.f.b===b.network.id&&(a=a.f.msg,a.wpa_cipher&&(c.msg.wpa_cipher=a.wpa_cipher),a.wpa_id&&(c.msg.wpa_id=a.wpa_id)));return c},hl=function(a,b){var c=Z(a.a);if("m"!==(c.device&&c.device.type))return B(!1);var d=b.b;if(!d)return B(!1);if(b=a.c.networks.get(d)){if(b.ha)return B(!1);
if(b.Aa)return B(!0)}return Mf(a.c.b,"scanCompleted").then(function(){var b=a.c.networks.get(d);return b&&!b.ha})};cl.prototype.D=function(){var a=Z(this.a);a.connectWiFi=this.f;zk(this.a,a);F(Ti(this.g,a.connectWiFi.msg),ma);X(this.a,15);Y(this.a,new N(7))};
var gl=function(a,b){var c=a.g.getState().verificationState.verificationProperties;return a.a.a.b.verifyAndEncryptData(c,b)},el=function(a){var b=a.g.a;if(!(4>b)){var c=Z(a.a).country,d=null;7>b?(b=new Le,b.location=new te,b.location.country_code=c,d=b):(b=new Me,b.settings=new Be,b.settings.country_code=c,d=b);F(S(a.b,Zi(a.g,d)),function(){})}};var il=function(a){var b=Z(a).connectWiFi,c=af(a.a.a);y("Macintosh")&&1!==b.msg.wpa_auth&&(c=!1);Ek.call(this,a,b.msg.ssid,null,c);this.f=null};t(il,Ek);var jl=new w(1,20,2,21,3,22,4,23,5,24);il.prototype.m=function(){this.f=null;return il.H.m.call(this)};var kl=function(a){return a.f?B(a.f):S(a.b,kk(a.a)).then(function(b){a.f=Ri(b).connectedIpAddress;return a.f})};h=il.prototype;h.sa=function(){var a=this;return kl(a).then(function(b){return S(a.b,Ni(a.a.a.g,Ki(b)))})};
h.X=function(a){var b=Z(this.a),c=b.connectWiFi;a=2===a||3===a?1:void 0;c.a!==a&&(c.a=a,zk(this.a,b));W(this).sendMessage(lg(c,tk(this.a)))};h.L=function(a){W(this).sendMessage(new Gc(a,Z(this.a).connectWiFi.msg.ssid))};h.ta=function(a){this.a.h(a.getState());Y(this.a,new N(9))};h.O=function(a){(a=jl.get(a))&&X(this.a,a)};var gk=function(a,b){switch(b){case 1:return new Pk(a);case 2:return new Ik(a);case 3:return new lk(a);case 4:return new jk(a);case 5:return new Bk(a);case 6:return new cl(a);case 7:return new rk(a);case 8:return new il(a);case 9:return new Dk(a);case 10:return new Lk(a);default:return new V(a,null,null)}};var ll=null;q("castApp.app.setupManager",ll);var ml={ub:"devices",vb:"offers",wb:"setup",ERROR:"error"},nl=function(a){if(!a||"#"==a)return{};a.startsWith("#")&&(a=a.slice(1));var b=a.split("/");if(!(0<=Fa(bb(ml),b[0])))return{};a={N:b[0]};if(b[1])switch(a.N){case "devices":b=decodeURIComponent(b[1]);Nd(b)&&(a.ipAddress=b);break;case "setup":a.na=b[1];break;case "offers":a.Ba=decodeURIComponent(b[1])}return a};
window.addEventListener("hashchange",function(a){var b=he(a.oldURL).g;a=he(a.newURL).g;nl(b).N!==nl(a).N&&location.reload()});
var hk=function(){window.location.hash="devices"},ol=function(a){window.location.hash="setup/"+a},pl=function(a){window.location.hash="devices/"+encodeURIComponent(a)},ql=function(){window.location.hash="error"},rl=function(a){if(y("Linux"))ql();else{var b=chrome.metricsPrivate?new ef(window.localStorage):new df,c=chrome.networkingPrivate?sg.b():null,d=new ik(window,c,new Hi,b),e=new bk(window,a),f=function(){var a=nl(window.location.hash);if("setup"===a.N){var b=null;if(a.na){if(ll&&ll.b.id===a.na)return;
b=Ja(Ve(d.a),function(b){return b.id===a.na})}b||(b=new Ne(Ca()),b.states=new Te(0,[new N(1)]),Xe(d.a,b),window.history.replaceState(null,"","#setup/"+b.id));ll&&ll.stop();ll=new Nk(d,e,b);ll.start()}};e.start().then(function(){f();window.addEventListener("hashchange",f)})}},sl=function(a,b){if(y("Linux"))ql();else{var c=new bk(window,a),d=chrome.networkingPrivate?sg.b():null,e=new Hi,f=new eh(window,c,e,ol,hk,pl,window.location.reload.bind(window.location),new qg,a,chrome.i18n.getUILanguage,new uj(d,
b,e,window)),g=null,l=null,p=function(a){if(!l||l.i!==a){var b=g&&g.stop()||l&&l.stop()||B();g=null;var c=l=new Wj(f,a);b.then(function(){l===c&&F(l.start(),hk)})}},r=function(){if(!g){var a=l&&l.stop()||B(),b=g=new Nj(f);l=null;a.then(function(){b===g&&g.start()})}},J=function(){var a=nl(location.hash);"devices"===a.N&&(a.ipAddress?p(a.ipAddress):r())};c.start().then(function(){J();window.addEventListener("hashchange",J)})}},ul=function(a,b){var c=new bk(window,a);a=chrome.metricsPrivate?new ef(window.localStorage):
new df;var d=new ek(window,c,b,new Hi,a);c.start().then(function(){var a=c.a.a,b=new w;a.addListener("Offers.Scan",function(a){var c=a.scanId;ib(b,c)||(a=new fk(d,c),b.set(c,a),Mf(a.f.c,"stopped").then(function(){b.remove(c)}),a.start())});a.addListener("Offers.Redeem",function(a){var b=encodeURIComponent(a.url);tl(b).then(function(a){0===a.length?chrome.tabs.create({url:"chrome://cast/#offers/"+b,active:!0}):(chrome.tabs.update(a[0].tabId,{active:!0}),chrome.windows.update(a[0].windowId,{active:!0}))})});
a.addListener("Offers.AnalyticsEvent",function(a){d.c.f(a)});a.sendMessage(new I("Offers.Show"))})},vl=function(a){ck(window,"start");F(Gi(new Hi,{url:a}).then(function(b){var c=b.url;return c?tl(encodeURIComponent(a)).then(function(a){a.forEach(function(a){chrome.tabs.update(a.id,{url:c})})}):ac()}),function(){ck(window,"unknown-error")})},tl=function(a){return new A(function(b){chrome.tabs.query({url:["chrome://cast/*","chrome-extension://"+chrome.runtime.id+"/cast_setup*"]},function(c){var d=[];
c.forEach(function(b){-1!==b.url.indexOf(a)&&d.push(b)});b(d)})})};window.addEventListener("load",function(){var a=new ph,b=new bh(window);b.f.listen("originViolation",ql);We();var c=nl(location.hash);switch(c.N){case "devices":sl(b,a);break;case "offers":c.Ba?vl(c.Ba):ul(b,a);break;case "setup":rl(b);break;case "error":ck(window,"unknown-error");break;default:JSON.stringify(c),hk()}});
