'use strict';var pg;m("mr.IssueSeverity",{Ida:"fatal",Cga:"warning",Qea:"notification"},void 0);m("mr.IssueAction",{wda:"dismiss",yea:"learn_more"},void 0);var qg=function(a,b,c){this.routeId=null;this.severity=b;this.isBlocking="fatal"==this.severity?!0:!1;this.title=a;this.message=null;this.defaultAction=c;this.helpPageId=this.secondaryActions=null};qg.prototype.w8=function(a){this.helpPageId=a;return this};qg.prototype.k$=function(a){this.secondaryActions=a;return this};
qg.prototype.C8=function(a){if(!a&&"fatal"==this.severity)throw Error("All FATAL issues must be blocking.");this.isBlocking=a;return this};var rg=function(a,b){var c=this;this.mo=void 0===b?null:b;this.promise=new Promise(function(b,f){var e=function(a){c.mo=null;f(a)};c.h5=e;a(function(a){c.mo=null;b(a)},e)})};rg.prototype.cancel=function(a){this.h5(a);if(this.mo){var b=this.mo;this.mo=null;setTimeout(function(){return b(a)},0)}};
rg.prototype.zv=function(a,b){b=void 0===b?null:b;var c=this;return new rg(function(e,f){c.promise.then(function(b){if(a)try{e(a(b))}catch(k){f(k)}else e(b)},function(a){if(b)try{e(b(a))}catch(k){f(k)}else f(a)})},function(a){c.cancel(a)})};rg.prototype.then=function(a,b){return this.zv(a,void 0===b?null:b)};rg.prototype.catch=function(a){return this.zv(null,a)};
var sg=function(a){return new rg(function(b){b(a)})},tg=function(a){return new rg(function(b,c){c(a)})},ug=function(a){return new rg(function(b,c){a.then(b,c)})},vg=function(a,b){var c=!1,e=null;return new rg(function(f,g){a.then(function(a){c||(e=b(a),e.promise.then(f,g))},g)},function(a){e?e.cancel(a):c=!0})};var wg=function(a){this.Ib=a;this.am=w()},xg=E("mr.Timing");wg.prototype.Nw=function(a,b){null!=b&&(a+="_"+b);return a};wg.prototype.Ol=function(a){this.Ib=a};wg.prototype.end=function(a){var b=w()-this.am;yg(this.Nw(this.Ib,a),b)};var yg=function(a,b){0>b&&(G(xg,"Timing analytics event with negative time"),b=0);1E4<b&&(b=1E4);try{chrome.metricsPrivate.recordTime(a,b)}catch(c){G(xg,"Failed to record time "+b+" in "+a)}},zg=function(a){wg.call(this,a)};x(zg,wg);var Ag=E("mr.MediumTiming");
zg.prototype.end=function(a){var b=w()-this.am;a=this.Nw(this.Ib,a);if(0>b)G(Ag,"Timing analytics event with negative time");else{1E4>b&&(b=1E4);18E4<b&&(b=18E4);try{chrome.metricsPrivate.recordMediumTime(a,b)}catch(c){G(Ag,"Failed to record time "+b+" in "+a)}}};var Bg=function(a){wg.call(this,a)};x(Bg,wg);var Cg=E("mr.LongTiming");
Bg.prototype.end=function(a){var b=w()-this.am;a=this.Nw(this.Ib,a);if(0>b)G(Cg,"Timing analytics event with negative time");else{18E4>b&&(b=18E4);36E5<b&&(b=36E5);try{chrome.metricsPrivate.recordLongTime(a,b)}catch(c){G(Cg,"Failed to record time "+b+" in "+a)}}};
var Dg=E("mr.Analytics"),Eg=function(a){try{chrome.metricsPrivate.recordUserAction(a)}catch(b){G(Dg,"Failed to record event "+a)}},Fg=function(a,b,c){var e,f=0,g;for(g in c)f++,c[g]==b&&(e=g);if(l(e)){c={metricName:a,type:"histogram-linear",min:1,max:f,buckets:f+1};try{chrome.metricsPrivate.recordValue(c,b)}catch(k){G(Dg,"Failed to record enum value "+e+" ("+b+") in "+a,k)}}else F(Dg,"Unknown analytics value, "+b+" for histogram, "+a,Error())};var Gg={cda:0,ada:1,eda:2,bda:3,Jca:4,dda:5,cea:6,fga:7,sda:8,RB:9},Hg=function(a){Fg("MediaRouter.Mirror.Capturing.Failure",a,Gg)};var Ig=function(){return null!=Tb&&-1!=Tb.indexOf("CrOS")},Jg=function(){var a=Tb;if(!t(a))return!1;a=a.match(/Windows NT \d+.\d+/);if(null===a||!ta(a))return!1;a=a[0];a=a.match(/\d+.\d+/);if(null===a||!ta(a))return!1;a=a[0];return 6.2<=parseFloat(a)},Kg=function(){return Ig()?"ChromeOS":Yc?"Windows":Xc?"Mac":Zc?"Linux":"Other"};var Lg=function(a){this.xf=a;this.kc=this.sl=null;this.a=E("mr.mirror.MediaStream")},Mg={message:"empty-stream"};d=Lg.prototype;d.WL=function(a){this.sl=a};d.Bw=function(){return this.xf};d.start=function(){return this.xf.vH()?this.Laa():this.xf.sH()?this.Eaa():this.Aaa()};
d.Laa=function(){var a=this,b=this.xf.ZA();H(this.a,"Starting tab capture with constraints "+JSON.stringify(b));return(new Promise(function(c,e){chrome.tabCapture.capture(b,function(b){b?(a.xA(b),c(a)):e(Error(chrome.runtime.lastError&&chrome.runtime.lastError.message?chrome.runtime.lastError.message:Mg))});Ze(function(){e(Error("chrome.tabCapture.capture failed to call its callback"))},5E3,a)})).then(null,function(b){a.By(b)})};
d.KZ=function(a){a&&H(this.a,"Track "+JSON.stringify(a.target)+" ended");this.stop()};d.By=function(a){var b="";a.name&&(b=a.name);a.message&&(b&&(b+="-"),b+=a.message);a=this.xf.qq;"tab"==a&&"empty_stream"==b?Hg(0):"desktop"==a&&"Error-timeout"==b?Hg(1):"desktop"==a&&"Error-user_cancel"==b?Hg(3):"tab"==a&&"Error-timeout"==b?Hg(5):Hg(9);throw Error("Failed to capture "+this.xf.qq);};
d.Aaa=function(){var a=this;return(new Promise(function(a,c){var b=["screen","audio"];"Linux"==Kg()&&b.push("window");var f=chrome.desktopCapture.chooseDesktopMedia(b,a);Ze(function(){chrome.desktopCapture.cancelChooseDesktopMedia(f);c(Error("timeout"))},6E4,this)})).then(function(b){var c=a.xf.ZA(b);H(a.a,"Starting desktop capture with constraints "+JSON.stringify(c));return new Promise(function(a,b){navigator.webkitGetUserMedia(c,a,b)})}).then(function(b){if(b)a.xA(b);else throw Error(Mg);return a}).then(null,
function(b){a.By(b)})};d.Eaa=function(){var a=this,b=this.xf.ZA();H(this.a,"Starting offscreen tab capture with constraints "+JSON.stringify(b));return(new Promise(function(c,e){chrome.tabCapture.captureOffscreenTab(a.xf.T0.toString(),b,function(b){b?(a.xA(b),c(a)):e(Error(chrome.runtime.lastError&&chrome.runtime.lastError.message?chrome.runtime.lastError.message:Mg))})})).then(null,function(b){a.By(b)})};d.xA=function(a){this.kc=a;a.getTracks().forEach(function(a){a.onended=this.KZ.bind(this)},this)};
d.stop=function(){this.kc&&(this.kc.getTracks().forEach(function(a){a.onended=null;a.stop()}),this.kc=null,this.sl&&this.sl())};var Og=function(a){return Ng(a)||"urn:x-org.chromium.media:source:desktop"==a},Pg=function(a){if(!Da(a,"http:")&&!Da(a,"https:"))return!1;var b=document.createElement("a");b.href=a;return"http:"!=b.protocol&&"https:"!=b.protocol?!1:-1==b.hash.indexOf("__castAppId__")},Qg=["https://docs.google.com"],Ng=function(a){return Da(a,"urn:x-org.chromium.media:source:tab:")||-1!=a.indexOf("0F5096E8")};var Rg=function(a){return(new Promise(function(b){chrome.tabs.get(a,b)})).then(function(b){if(!b)throw Error("No such tab "+a);return b})};var Sg=chrome.i18n.getMessage("1639753794700094338");var Tg=function(a,b){Nd.call(this);this.T6=a;this.Ki=b;this.Oe=this.La=null;this.o=E("mr.mirror.Service."+a);this.Py=v(this.IZ,this);this.Jm=!1};x(Tg,Nd);d=Tg.prototype;d.getName=function(){return this.T6};d.np=function(a,b,c,e){H(this.o,"Start mirroring on route "+a.id);return ug(this.MD(b,a.pe.tabId).then(this.QS.bind(this,a,b,c,e)))};
d.QS=function(a,b,c,e){var f=this,g=this.Of(b,c);return this.RM().then(function(){return(new Lg(g.Bw())).start()}).then(function(b){f.Oe=b;b.WL(v(f.sl,f,b));return e?e(a).promise:a}).then(function(a){f.La=f.Eq(g,a);return f.La.start(f.Oe.kc)}).then(function(){g.Nx()&&!chrome.tabs.onUpdated.hasListener(f.Py)&&chrome.tabs.onUpdated.addListener(f.Py);return f.wJ(a,g,c)}).then(null,function(a){f.ZH(a);f.zf();throw a;})};
d.ju=function(a,b,c,e,f){H(this.o,"Update mirroring on route "+a.id);return ug(this.MD(b,e).then(this.RS.bind(this,a,b,c,f)))};d.MD=function(a,b){return Ng(a)?Rg(b).then(function(a){if(!a.active)throw Error("Tab to be mirrored is not active");}):Promise.resolve()};
d.RS=function(a,b,c,e){var f=this;b=this.Of(b,c);if(!this.La.YM())return Promise.reject(Error("Session does not support updating stream"));var g=!1;return(new Lg(b.Bw())).start().then(function(b){var c=f.Oe;f.Oe=b;b.WL(v(f.sl,f,b));g=!0;c.stop();return e?e(a).promise:a}).then(function(a){f.La.g$(a);return f.La.BN(f.Oe.kc)}).then(this.wJ.bind(this,a,b,c)).then(null,function(a){f.ZH(a);g&&f.zf();throw a;})};
d.wJ=function(a,b,c){var e=this;b.Nx()?this.La.Tba(a.pe.tabId).then(function(){e.La.nt();e.bt()},function(a){F(e.o,"Failed to obtain initial tab info.",a)}):b.tH()?(a="Capturing "+a.mediaSource,this.La.qA(a,a,null),this.La.nt(),this.wz()):(this.La.qA("Capturing Desktop","Capturing Desktop",null),this.La.nt(),this.Ys());this.qR(c,this.Oe);return this.La.ab};d.ZH=function(a){var b="";a.name&&(b=a.name);a.message&&(b&&(b+="-"),b+=a.message);b||(b="Error-unknown");this.$s(b)};
d.sl=function(a){this.Oe==a&&(this.at(),this.zf())};d.RM=function(){var a=this;return this.zf().then(function(b){b&&a.Zs();return b})};d.zf=function(){var a=this;if(this.Jm)return Promise.resolve(!1);this.Jm=!0;chrome.tabs.onUpdated.removeListener(this.Py);this.Oe&&(this.Oe.stop(),this.Oe=null);if(this.La)return this.xC().then(function(){a.La&&(a.La.stop(),a.La.mb(),a.Ki.Iy(a.La.ab.id),a.La=null);a.Jm=!1;return!0},function(b){F(a.o,"Error cleaning up",b);a.Jm=!1});this.Jm=!1;return Promise.resolve(!1)};
d.xC=function(){return Promise.resolve()};d.IZ=function(a,b,c){this.La&&this.La.tabId&&this.La.tabId==a&&("complete"==b.status||b.favIconUrl&&"complete"==c.status)&&(this.La.CN(c),this.Ki.TI(this.La.ab),this.La.nt())};d.qR=function(a,b){a.captureAudio&&b.kc&&!b.kc.getAudioTracks().length&&this.Ki.Nf().send(new qg(Sg,"notification","dismiss"))};d.Of=r;d.Eq=r;d.bt=r;d.Ys=r;d.wz=r;d.Zs=r;d.$s=r;d.at=r;var Ug=function(a){Nd.call(this);this.ab=a;this.Wr=!1;this.tabId=this.Cz=this.iconUrl=null};x(Ug,Nd);d=Ug.prototype;d.qA=function(a,b,c){this.ab.description=a;this.Wr||this.ab.offTheRecord?this.iconUrl=this.Cz=null:(this.Cz=b,this.iconUrl=c)};d.nt=function(){this.Wr||this.ab.offTheRecord||this.MK()};d.Tba=function(a){this.tabId=a;return Rg(a).then(this.CN.bind(this))};
d.CN=function(a){this.Wr=a.incognito;this.qA(a.title,Da(a.url,"file://")?"Local content (Tab)":cf(a.url.match(bf)[3]||null,!0)+" (Tab)",a.favIconUrl)};d.g$=function(a){this.ab=a};d.MK=n;d.Of=r;d.start=r;d.YM=function(){return!1};d.BN=r;d.stop=r;d.L=function(){this.stop()};var Vg=function(a,b){this.type=a;this.data=b},Wg=function(a){a=JSON.parse(a);if(!a.type)throw Error("Invalid message");return new Vg(a.type,a.data)},Xg=function(a,b,c,e){this.description=a;this.settings=b||null;this.mediaConstraints=c||null;this.presentationUrl=e||null};var Yg={PB:0,EB:1,JO:2},Zg=function(a){Fg("MediaRouter.WebRtc.Start.Success",a,Yg)};var ah=function(a,b){Nd.call(this);this.a=Kd("cv2.PeerConnection");this.x0=$g;this.m=this.aS(b);this.Sv=this.WR(a);this.aT=!0;this.SK=new ff;this.Yz=!1;this.Bs=0;this.Qr=null;this.FH=this.Ay=0;this.zb=!1;this.KI=this.LI=this.Ey=this.UI=this.m1=n};x(ah,Nd);var $g={mandatory:{OfferToReceiveAudio:!0,OfferToReceiveVideo:!0}},bh={mandatory:{IceRestart:!0,OfferToReceiveAudio:!0,OfferToReceiveVideo:!0}};d=ah.prototype;d.TL=function(a){this.Ey=a};d.SL=function(a){this.LI=a};d.RL=function(a){this.KI=a};
d.VL=function(a){this.UI=a};d.UL=function(a){this.Sv.onmessage=function(b){a(b.data)}};d.Zr=function(){return this.zb};d.kX=function(a){var b={};b.iceServers=[{url:"stun:stun.l.google.com:19302"}].concat(a);return b};d.aS=function(a){a=this.kX(a);var b=new webkitRTCPeerConnection(a);b.onicecandidate=v(this.Gy,this);b.moa=v(this.H1,this);b.oniceconnectionstatechange=v(this.G1,this);H(this.a,"Created webkitRTCPeerConnnection with config: "+JSON.stringify(a));return b};
d.WR=function(a){return this.m.createDataChannel(a,{reliable:!1})};d.C6=function(a){"string"==typeof a?this.Sv.send(a):this.Sv.send(JSON.stringify(a))};d.start=function(){this.zb||(this.zb=!0,this.Qm())};d.stop=function(){H(this.a,"Stopping peer connection...");this.zb&&(this.zb=!1,"closed"!=this.m.signalingState&&this.m.close())};d.addStream=function(a){this.m.addStream(a)};d.removeStream=function(a){this.zb&&this.m.removeStream(a)};d.L=function(){this.stop();this.m=null};
d.Qm=function(){H(this.a,"Sending offer to peer.");var a=this;this.Ay=w();this.m.createOffer(v(this.DL,this),function(b){G(a.a,"Error creating offer: "+JSON.stringify(b))},this.x0);this.SK.promise.then(function(b){a.UI(b)})};d.DL=function(a){H(this.a,"Setting local description: "+JSON.stringify(a));var b=this;this.m.setLocalDescription(a,function(){H(b.a,"Local description set successfully")},function(a){G(b.a,"Error setting local description: "+JSON.stringify(a))})};
d.QT=function(a){return{type:a.type,sdp:a.sdp}};d.setRemoteDescription=function(a){I(this.a,"<===: "+JSON.stringify(a));a=new RTCSessionDescription(a);H(this.a,"Setting remote description: "+JSON.stringify(a));var b=this;this.m.setRemoteDescription(a,function(){H(b.a,"Remote description set successfully.")},function(a){G(b.a,"Error setting remote description: "+JSON.stringify(a))})};
d.Gy=function(a){var b=this;a.candidate?(this.Bs++,this.FH=w(),1==this.Bs?this.Qr=Ze(function(){H(b.a,"ICE candidate gathering timed out.");b.Qr=null;b.Nz()},5E3):this.Yz&&G(this.a,"Received ICE candidate after resolving session description.")):(H(this.a,"End of ICE candidates."),yg("MediaRouter.WebRtc.IceCandidateGathering.Duration.Reported",w()-this.Ay),this.Nz(),0<this.Bs&&yg("MediaRouter.WebRtc.IceCandidateGathering.Duration.Real",this.FH-this.Ay))};
d.H1=function(){"completed"==this.m.iceGatheringState&&this.Nz()};d.Nz=function(){$e(this.Qr);this.Qr=null;this.Yz||(H(this.a,"Resolving sesion description after gathering "+this.Bs+" ICE candidates."),this.SK.resolve(this.QT(this.m.localDescription)),this.Yz=!0)};
d.G1=function(a){if(this.m){var b=this.m.iceConnectionState;H(this.a,"New ICE connection state: "+b+".");if("connected"==b)this.Ey("iceconnected");else if("completed"==b)this.Ey("icecompleted");else if("failed"==b)G(this.a,"Ice connection failed: "+JSON.stringify(a)),this.LI("icefailed");else if("closed"==b)this.KI("iceclosed");else if("disconnected"==b)if(G(this.a,"Ice connection state is bad."),this.aT&&this.Zr()){H(this.a,"Restarting ICE.");var c=this;this.m.createOffer(v(this.DL,this),function(a){G(c.a,
"Error creating new offer: "+JSON.stringify(a))},bh)}else this.m1()}};var ch=function(a){this.S6=a};ch.prototype.cl=function(){return Promise.resolve(this.S6)};var dh=function(a,b){this.width=a;this.height=b};d=dh.prototype;d.clone=function(){return new dh(this.width,this.height)};d.toString=function(){return"("+this.width+" x "+this.height+")"};d.gQ=function(){return this.width*this.height};d.Tb=function(){return!this.gQ()};d.ceil=function(){this.width=Math.ceil(this.width);this.height=Math.ceil(this.height);return this};d.floor=function(){this.width=Math.floor(this.width);this.height=Math.floor(this.height);return this};
d.round=function(){this.width=Math.round(this.width);this.height=Math.round(this.height);return this};d.scale=function(a,b){b=u(b)?b:a;this.width*=a;this.height*=b;return this};var eh=!Sc&&!Qc||Qc&&9<=Number(nd)||Sc&&kd("1.9.1");Qc&&kd("9");var gh=function(a,b){zb(b,function(b,e){"style"==e?a.style.cssText=b:"class"==e?a.className=b:"for"==e?a.htmlFor=b:fh.hasOwnProperty(e)?a.setAttribute(fh[e],b):Da(e,"aria-")||Da(e,"data-")?a.setAttribute(e,b):a[e]=b})},fh={cellpadding:"cellPadding",cellspacing:"cellSpacing",colspan:"colSpan",frameborder:"frameBorder",height:"height",maxlength:"maxLength",nonce:"nonce",role:"role",rowspan:"rowSpan",type:"type",usemap:"useMap",valign:"vAlign",width:"width"},hh=function(a){return a?a.parentWindow||a.defaultView:
window},jh=function(a,b,c,e){function f(c){c&&b.appendChild(t(c)?a.createTextNode(c):c)}for(;e<c.length;e++){var g=c[e];!ua(g)||wa(g)&&0<g.nodeType?f(g):z(ih(g)?pb(g):g,f)}},kh=function(a){return a&&a.parentNode?a.parentNode.removeChild(a):null},lh=function(a,b){if("textContent"in a)a.textContent=b;else if(3==a.nodeType)a.data=b;else if(a.firstChild&&3==a.firstChild.nodeType){for(;a.lastChild!=a.firstChild;)a.removeChild(a.lastChild);a.firstChild.data=b}else{for(var c;c=a.firstChild;)a.removeChild(c);
a.appendChild((9==a.nodeType?a:a.ownerDocument||a.document).createTextNode(String(b)))}},ih=function(a){if(a&&"number"==typeof a.length){if(wa(a))return"function"==typeof a.item||"string"==typeof a.item;if(va(a))return"function"==typeof a.item}return!1},mh=function(a){this.$m=a||h.document||document};d=mh.prototype;d.getElementsByTagName=function(a,b){return(b||this.$m).getElementsByTagName(String(a))};d.setProperties=gh;d.createElement=function(a){return this.$m.createElement(String(a))};
d.createTextNode=function(a){return this.$m.createTextNode(String(a))};d.getWindow=function(){var a=this.$m;return a.parentWindow||a.defaultView};d.appendChild=function(a,b){a.appendChild(b)};d.append=function(a,b){jh(9==a.nodeType?a:a.ownerDocument||a.document,a,arguments,1)};d.canHaveChildren=function(a){if(1!=a.nodeType)return!1;switch(a.tagName){case "APPLET":case "AREA":case "BASE":case "BR":case "COL":case "COMMAND":case "EMBED":case "FRAME":case "HR":case "IMG":case "INPUT":case "IFRAME":case "ISINDEX":case "KEYGEN":case "LINK":case "NOFRAMES":case "NOSCRIPT":case "META":case "OBJECT":case "PARAM":case "SCRIPT":case "SOURCE":case "STYLE":case "TRACK":case "WBR":return!1}return!0};
d.removeNode=kh;d.getChildren=function(a){return eh&&void 0!=a.children?a.children:ab(a.childNodes,function(a){return 1==a.nodeType})};d.isElement=function(a){return wa(a)&&1==a.nodeType};d.contains=function(a,b){if(!a||!b)return!1;if(a.contains&&1==b.nodeType)return a==b||a.contains(b);if("undefined"!=typeof a.compareDocumentPosition)return a==b||!!(a.compareDocumentPosition(b)&16);for(;b&&a!=b;)b=b.parentNode;return b==a};/*
 Portions of this code are from MochiKit, received by
 The Closure Authors under the MIT license. All other code is Copyright
 2005-2009 The Closure Authors. All Rights Reserved.
*/
var nh=function(a,b){this.qt=[];this.II=a;this.BD=b||null;this.Ln=this.qc=!1;this.dg=void 0;this.JA=this.lQ=this.iv=!1;this.iu=0;this.Jb=null;this.mq=0};d=nh.prototype;d.cancel=function(a){if(this.qc)this.dg instanceof nh&&this.dg.cancel();else{if(this.Jb){var b=this.Jb;delete this.Jb;a?b.cancel(a):b.nQ()}this.II?this.II.call(this.BD,this):this.JA=!0;this.qc||this.Ca(new oh(this))}};d.nQ=function(){this.mq--;0>=this.mq&&this.cancel()};d.qD=function(a,b){this.iv=!1;this.lB(a,b)};
d.lB=function(a,b){this.qc=!0;this.dg=b;this.Ln=!a;this.qE()};d.RC=function(){if(this.qc){if(!this.JA)throw new ph(this);this.JA=!1}};d.callback=function(a){this.RC();this.lB(!0,a)};d.Ca=function(a){this.RC();this.lB(!1,a)};d.na=function(a,b){return this.Lh(a,null,b)};d.nc=function(a,b){return this.Lh(null,a,b)};d.GP=function(a,b){return this.Lh(a,a,b)};d.Lh=function(a,b,c){this.qt.push([a,b,c]);this.qc&&this.qE();return this};
d.then=function(a,b,c){var e,f,g=new Je(function(a,b){e=a;f=b});this.Lh(e,function(a){a instanceof oh?g.cancel():f(a)});return g.then(a,b,c)};Ge(nh);d=nh.prototype;d.sq=function(a){this.Lh(a.callback,a.Ca,a);return this};d.tC=function(a){return a instanceof nh?this.na(v(a.lv,a)):this.na(function(){return a})};d.lv=function(a){var b=new nh;this.sq(b);a&&(b.Jb=this,this.mq++);return b};d.o_=function(a){return a instanceof Error};d.SG=function(){return bb(this.qt,function(a){return va(a[1])})};
d.qE=function(){if(this.iu&&this.qc&&this.SG()){var a=this.iu,b=qh[a];b&&(b.P5(),delete qh[a]);this.iu=0}this.Jb&&(this.Jb.mq--,delete this.Jb);for(var a=this.dg,c=b=!1;this.qt.length&&!this.iv;){var e=this.qt.shift(),f=e[0],g=e[1],e=e[2];if(f=this.Ln?g:f)try{var k=f.call(e||this.BD,a);l(k)&&(this.Ln=this.Ln&&(k==a||this.o_(k)),this.dg=a=k);if(He(a)||"function"===typeof h.Promise&&a instanceof h.Promise)this.iv=c=!0}catch(p){a=p,this.Ln=!0,this.SG()||(b=!0)}}this.dg=a;c&&(k=v(this.qD,this,!0),c=v(this.qD,
this,!1),a instanceof nh?(a.Lh(k,c),a.lQ=!0):a.then(k,c));b&&(a=new rh(a),qh[a.Rb]=a,this.iu=a.Rb)};var sh=function(a){var b=new nh;b.callback(a);return b},th=function(a){var b=new nh;b.Ca(a);return b},ph=function(){Ca.call(this)};x(ph,Ca);ph.prototype.message="Deferred has already fired";ph.prototype.name="AlreadyCalledError";var oh=function(){Ca.call(this)};x(oh,Ca);oh.prototype.message="Deferred was canceled";oh.prototype.name="CanceledError";
var rh=function(a){this.Rb=h.setTimeout(v(this.iba,this),0);this.hd=a};rh.prototype.iba=function(){delete qh[this.Rb];throw this.hd;};rh.prototype.P5=function(){h.clearTimeout(this.Rb)};var qh={};var yh=function(a,b){var c=b||{};b=c.document||document;var e=ic(a),f=document.createElement("SCRIPT");a={EK:f,sp:void 0};var g=new nh(uh,a),k=null,p=null!=c.timeout?c.timeout:5E3;0<p&&(k=window.setTimeout(function(){vh(f,!0);g.Ca(new wh(1,"Timeout reached for loading script "+e))},p),a.sp=k);f.onload=f.onreadystatechange=function(){f.readyState&&"loaded"!=f.readyState&&"complete"!=f.readyState||(vh(f,c.oia||!1,k),g.callback(null))};f.onerror=function(){vh(f,!0,k);g.Ca(new wh(0,"Error while loading script "+
e))};a=c.attributes||{};Lb(a,{type:"text/javascript",charset:"UTF-8",src:e});gh(f,a);xh(b).appendChild(f);return g},xh=function(a){var b=(a||document).getElementsByTagName("HEAD");return b&&0!=b.length?b[0]:a.documentElement},uh=function(){if(this&&this.EK){var a=this.EK;a&&"SCRIPT"==a.tagName&&vh(a,!0,this.sp)}},vh=function(a,b,c){null!=c&&h.clearTimeout(c);a.onload=n;a.onerror=n;a.onreadystatechange=n;b&&window.setTimeout(function(){kh(a)},0)},wh=function(a,b){var c="Jsloader error (code #"+a+")";
b&&(c+=": "+b);Ca.call(this,c);this.code=a};x(wh,Ca);var zh=function(){this.Sb=this.Ki=this.Nr=null;this.ky=new ff};qa(zh);d=zh.prototype;d.cl=function(){var a=this;if(this.Nr)return Promise.resolve(this.Nr);this.a0().then(null,function(){a.ky.reject(Error("Failed to load hangouts mirroring script."))});return this.ky.promise};d.y8=function(a){this.Sb=a};d.c9=function(a){this.Ki=a};d.VJ=function(a){this.Ki&&(this.Nr=a(this.Sb,this.Ki),this.ky.resolve(this.Nr))};
d.a0=function(){var a;a=chrome.extension.getURL("mirroring_hangouts.js");a=jc(a);return yh(a,void 0)};var Ah="undefined"!=typeof chrome&&!!chrome.networkingPrivate&&!!chrome.networkingPrivate.setWifiTDLSEnabledState&&Ig(),Bh=Ig()||Yc;var Dh=function(){this.maxWidth=1920;this.maxHeight=1080;this.minWidth=320;this.minHeight=180;this.maxFrameRate=30;this.minVideoBitrate=300;this.maxVideoBitrate=5E3;this.audioBitrate=128;this.maxLatencyMillis=800;this.animatedLatencyMillis=this.minLatencyMillis=400;this.dscpEnabled=Xc||Zc||Ig()||Jg();this.enableLogging=!0;this.useTdls=!1;this.captureAudio=this.captureVideo=!0;this.a=E("mr.mirror.Settings");var a=window.localStorage?window.localStorage.getItem(Ch):null;if(t(a))try{var b=JSON.parse(a);
b&&(this.FN(b),G(this.a,"Initial mr.mirror.Settings overridden to: "+this.YA()))}catch(c){throw F(this.a,Ch+' must be of the form \'{"maxWidth":640, "maxHeight":360}\'.',c),Error("Overrides not parseable.  See ERROR log for details.");}},Ch="mr.mirror.Settings.Overrides";d=Dh.prototype;d.clone=function(){var a=new Dh;a.FN(this);return a};d.YA=function(){return JSON.stringify(this,function(a,b){if(0==a.length||"boolean"==typeof b||"number"==typeof b||"string"==typeof b)return b})};
d.FN=function(a){for(var b in this){var c=a[b];if(null!=c){var e=this[b];"boolean"!=typeof e&&"number"!=typeof e&&"string"!=typeof e||typeof e!=typeof c||(this[b]=c)}}};
d.wR=function(){var a=screen.width,b=screen.height;this.maxHeight*a<this.maxWidth*b?(a=Math.min(this.maxWidth,a),a-=a%160,b=90*a/160):(b=Math.min(this.maxHeight,b),b-=b%90,a=160*b/90);if(a<Math.max(160,this.minWidth)||b<Math.max(90,this.minHeight))a=Math.max(160,this.minWidth),b=Math.max(90,this.minHeight);this.maxWidth=a;this.maxHeight=b};d.CS=function(){this.minHeight=this.minWidth=0};
var Eh=function(a,b){var c=new Dh;c.captureAudio=a;c.captureVideo=b;c.wR();H(c.a,"mr.mirror.Settings after screen size adjustments: "+c.YA());return c};Dh.prototype.NW=function(){return String(this.minWidth+"x"+this.minHeight)};Dh.prototype.wW=function(){return String(this.maxWidth+"x"+this.maxHeight)};Dh.prototype.KX=function(){return this.minWidth==this.maxWidth&&this.minHeight==this.maxHeight?"fixed":0<this.minWidth&&0<this.minHeight?"fixed-aspect-ratio":"variable"};var Fh=function(a,b,c){this.qq=a;this.Hb=b;this.T0=c||null};d=Fh.prototype;d.vH=function(){return"tab"==this.qq};d.sH=function(){return"offscreen_tab"==this.qq};d.ZA=function(a){return this.vH()||this.sH()?this.oba():this.mba(a)};
d.oba=function(){var a={audio:this.Hb.captureAudio,video:this.Hb.captureVideo};this.Hb.captureVideo&&(a.videoConstraints={mandatory:{minWidth:this.Hb.minWidth,minHeight:this.Hb.minHeight,maxWidth:this.Hb.maxWidth,maxHeight:this.Hb.maxHeight,maxFrameRate:this.Hb.maxFrameRate,enableAutoThrottling:!0}});return a};
d.mba=function(a){var b={audio:!1,video:!1};this.Hb.captureVideo&&(b.video={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:a,minWidth:this.Hb.minWidth,minHeight:this.Hb.minHeight,maxWidth:this.Hb.maxWidth,maxHeight:this.Hb.maxHeight,maxFrameRate:this.Hb.maxFrameRate}});Bh&&this.Hb.captureAudio&&(b.audio={mandatory:{chromeMediaSource:"desktop",chromeMediaSourceId:a}});return b};var Gh=function(a,b){Og(a)||Pg(a);this.qy=a;this.Hb=b};Gh.prototype.Pf=function(){return this.Hb};Gh.prototype.Bw=function(){return this.Nx()?new Fh("tab",this.Hb):this.tH()?new Fh("offscreen_tab",this.Hb,this.qy):new Fh("desktop",this.Hb)};Gh.prototype.Nx=function(){return Ng(this.qy)};Gh.prototype.tH=function(){return Pg(this.qy)};var Hh=C("Firefox"),Ih=Lc()||C("iPod"),Jh=C("iPad"),Kh=C("Android")&&!(Yb()||C("Firefox")||C("Opera")||C("Silk")),Lh=Yb(),Mh=C("Safari")&&!(Yb()||C("Coast")||C("Opera")||C("Edge")||C("Silk")||C("Android"))&&!(Lc()||C("iPad")||C("iPod"));var Nh=function(a){return B(a,function(a){a=a.toString(16);return 1<a.length?a:"0"+a}).join("")};var Oh=null,Ph=null,Qh=null,Rh=Sc||Tc&&!Mh||Pc||!Mh&&!Qc&&"function"==typeof h.atob,Th=function(a,b){Sh();b=b?Qh:Oh;for(var c=[],e=0;e<a.length;e+=3){var f=a[e],g=e+1<a.length,k=g?a[e+1]:0,p=e+2<a.length,q=p?a[e+2]:0,A=f>>2,f=(f&3)<<4|k>>4,k=(k&15)<<2|q>>6,q=q&63;p||(q=64,g||(k=64));c.push(b[A],b[f],b[k],b[q])}return c.join("")},Vh=function(a,b){if(Rh&&!b)return h.atob(a);var c="";Uh(a,function(a){c+=String.fromCharCode(a)});return c},Wh=function(a){var b=new Uint8Array(Math.ceil(3*a.length/4)),c=
0;Uh(a,function(a){b[c++]=a});return b.subarray(0,c)},Uh=function(a,b){function c(b){for(;e<a.length;){var c=a.charAt(e++),f=Ph[c];if(null!=f)return f;if(!Fa(c))throw Error("Unknown base64 encoding at char: "+c);}return b}Sh();for(var e=0;;){var f=c(-1),g=c(0),k=c(64),p=c(64);if(64===p&&-1===f)break;b(f<<2|g>>4);64!=k&&(b(g<<4&240|k>>2),64!=p&&b(k<<6&192|p))}},Sh=function(){if(!Oh){Oh={};Ph={};Qh={};for(var a=0;65>a;a++)Oh[a]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(a),
Ph[Oh[a]]=a,Qh[a]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.".charAt(a),62<=a&&(Ph["ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.".charAt(a)]=a)}};var Xh=function(a){Nd.call(this);this.B=a;this.Fa={}};x(Xh,Nd);var Yh=[];d=Xh.prototype;d.listen=function(a,b,c,e){return this.UH(a,b,c,e)};d.W_=function(a,b,c,e,f){return this.UH(a,b,c,e,f)};d.UH=function(a,b,c,e,f){ta(b)||(b&&(Yh[0]=b.toString()),b=Yh);for(var g=0;g<b.length;g++){var k=fe(a,b[g],c||this.handleEvent,e||!1,f||this.B||this);if(!k)break;this.Fa[k.key]=k}return this};d.ao=function(a,b,c,e){return this.SH(a,b,c,e)};
d.SH=function(a,b,c,e,f){if(ta(b))for(var g=0;g<b.length;g++)this.SH(a,b[g],c,e,f);else{a=me(a,b,c||this.handleEvent,e,f||this.B||this);if(!a)return this;this.Fa[a.key]=a}return this};d.vd=function(a,b,c,e,f){if(ta(b))for(var g=0;g<b.length;g++)this.vd(a,b[g],c,e,f);else c=c||this.handleEvent,f=f||this.B||this,c=ge(c),e=!!e,b=Yd(a)?a.vn(b,c,e,f):a?(a=ie(a))?a.vn(b,c,e,f):null:null,b&&(oe(b),delete this.Fa[b.key]);return this};
d.removeAll=function(){zb(this.Fa,function(a,b){this.Fa.hasOwnProperty(b)&&oe(a)},this);this.Fa={}};d.L=function(){Xh.S.L.call(this);this.removeAll()};d.handleEvent=function(){throw Error("EventHandler.handleEvent not implemented");};var Zh=function(a){this.ol=0;this.gl=a||100;this.tf=[]};d=Zh.prototype;d.add=function(a){var b=this.tf[this.ol];this.tf[this.ol]=a;this.ol=(this.ol+1)%this.gl;return b};d.get=function(a){a=this.BI(a);return this.tf[a]};d.set=function(a,b){a=this.BI(a);this.tf[a]=b};d.R=function(){return this.tf.length};d.Tb=function(){return 0==this.tf.length};d.clear=function(){this.ol=this.tf.length=0};d.C=function(){return this.ZW(this.R())};
d.ZW=function(a){var b=this.R(),c=[];for(a=this.R()-a;a<b;a++)c.push(this.get(a));return c};d.ib=function(){for(var a=[],b=this.R(),c=0;c<b;c++)a[c]=c;return a};d.xa=function(a){return a<this.R()};d.bk=function(a){for(var b=this.R(),c=0;c<b;c++)if(this.get(c)==a)return!0;return!1};d.BI=function(a){if(a>=this.tf.length)throw Error("Out of bounds exception");return this.tf.length<this.gl?a:(this.ol+Number(a))%this.gl};var $h=function(){this.YJ=w()},ai=new $h;$h.prototype.set=function(a){this.YJ=a};$h.prototype.reset=function(){this.set(w())};$h.prototype.get=function(){return this.YJ};var bi=function(a){this.c4=a||"";this.Maa=ai};d=bi.prototype;d.lC=!0;d.HA=!0;d.jaa=!0;d.iaa=!0;d.Lt=!1;d.IA=!1;d.tw=r;
var di=function(a){a=new Date(a.dN);return ci(a.getFullYear()-2E3)+ci(a.getMonth()+1)+ci(a.getDate())+" "+ci(a.getHours())+":"+ci(a.getMinutes())+":"+ci(a.getSeconds())+"."+ci(Math.floor(a.getMilliseconds()/10))},ci=function(a){return 10>a?"0"+a:String(a)},ei=function(a,b){a=(a.dN-b)/1E3;b=a.toFixed(3);var c=0;if(1>a)c=2;else for(;100>a;)c++,a*=10;for(;0<c--;)b=" "+b;return b},fi=function(a){bi.call(this,a)};x(fi,bi);
fi.prototype.tw=function(a){var b=[];b.push(this.c4," ");this.HA&&b.push("[",di(a),"] ");this.jaa&&b.push("[",ei(a,this.Maa.get()),"s] ");this.iaa&&b.push("[",a.$H,"] ");this.IA&&b.push("[",a.Di.name,"] ");b.push(a.getMessage());this.Lt&&(a=a.Tq)&&b.push("\n",a instanceof Error?a.message:a.toString());this.lC&&b.push("\n");return b.join("")};var gi=function(a){return(a=a.exec(Tb))?a[1]:""},hi=function(){if(Hh)return gi(/Firefox\/([0-9.]+)/);if(Qc||Rc||Pc)return id;if(Lh)return gi(/Chrome\/([0-9.]+)/);if(Mh&&!(Lc()||C("iPad")||C("iPod")))return gi(/Version\/([0-9.]+)/);if(Ih||Jh){var a=/Version\/(\S+).*Mobile\/(\S+)/.exec(Tb);if(a)return a[1]+"."+a[2]}else if(Kh)return(a=gi(/Android\s+([0-9.]+)/))?a:gi(/Version\/([0-9.]+)/);return""}();var ii=function(){this.oc=-1};ii.prototype.reset=r;ii.prototype.update=r;ii.prototype.digest=r;var ji=function(){this.oc=64;this.ea=[];this.nv=[];this.AP=[];this.Js=[];this.Js[0]=128;for(var a=1;a<this.oc;++a)this.Js[a]=0;this.fu=this.Uk=0;this.reset()};x(ji,ii);ji.prototype.reset=function(){this.ea[0]=1732584193;this.ea[1]=4023233417;this.ea[2]=2562383102;this.ea[3]=271733878;this.ea[4]=3285377520;this.fu=this.Uk=0};
ji.prototype.Eg=function(a,b){b||(b=0);var c=this.AP;if(t(a))for(var e=0;16>e;e++)c[e]=a.charCodeAt(b)<<24|a.charCodeAt(b+1)<<16|a.charCodeAt(b+2)<<8|a.charCodeAt(b+3),b+=4;else for(e=0;16>e;e++)c[e]=a[b]<<24|a[b+1]<<16|a[b+2]<<8|a[b+3],b+=4;for(e=16;80>e;e++){var f=c[e-3]^c[e-8]^c[e-14]^c[e-16];c[e]=(f<<1|f>>>31)&4294967295}a=this.ea[0];b=this.ea[1];for(var g=this.ea[2],k=this.ea[3],p=this.ea[4],q,e=0;80>e;e++)40>e?20>e?(f=k^b&(g^k),q=1518500249):(f=b^g^k,q=1859775393):60>e?(f=b&g|k&(b|g),q=2400959708):
(f=b^g^k,q=3395469782),f=(a<<5|a>>>27)+f+p+q+c[e]&4294967295,p=k,k=g,g=(b<<30|b>>>2)&4294967295,b=a,a=f;this.ea[0]=this.ea[0]+a&4294967295;this.ea[1]=this.ea[1]+b&4294967295;this.ea[2]=this.ea[2]+g&4294967295;this.ea[3]=this.ea[3]+k&4294967295;this.ea[4]=this.ea[4]+p&4294967295};
ji.prototype.update=function(a,b){if(null!=a){l(b)||(b=a.length);for(var c=b-this.oc,e=0,f=this.nv,g=this.Uk;e<b;){if(0==g)for(;e<=c;)this.Eg(a,e),e+=this.oc;if(t(a))for(;e<b;){if(f[g]=a.charCodeAt(e),++g,++e,g==this.oc){this.Eg(f);g=0;break}}else for(;e<b;)if(f[g]=a[e],++g,++e,g==this.oc){this.Eg(f);g=0;break}}this.Uk=g;this.fu+=b}};
ji.prototype.digest=function(){var a=[],b=8*this.fu;56>this.Uk?this.update(this.Js,56-this.Uk):this.update(this.Js,this.oc-(this.Uk-56));for(var c=this.oc-1;56<=c;c--)this.nv[c]=b&255,b/=256;this.Eg(this.nv);for(c=b=0;5>c;c++)for(var e=24;0<=e;e-=8)a[b]=this.ea[c]>>e&255,++b;return a};var ki=function(a,b,c,e,f,g,k,p){this.Gd=null;this.ZC=!1;this.YC=Te();this.Bc=[];this.qf=a?encodeURIComponent(String(a)):null;this.vE=null;!e&&b&&(this.vE=b);this.cQ=c||null;this.fq=!e;this.Oq=null!=f?f:null;this.Cs=g||null;this.aca=!!k;this.wE=p||null};x(ki,Nd);var li=new $b;li.TA="https://apis.google.com/js/client.js";var mi;li instanceof $b&&li.constructor===$b&&li.hP===Zb?mi=li.TA:(y("expected object of type Const, got '"+li+"'"),mi="type_error:Const");var ni=jc(mi);d=ki.prototype;
d.init=function(){var a=v(function(a){this.Gd=a;var b=pa("client.request",a),c=pa("auth",a);b&&c?this.KG():a.load("client",v(this.KG,this))},this),b=this.lE("gapi");b?a(b.gapi):this.$_(a);return this.YC.promise};d.lE=function(a){for(var b=window,c=pa(a,b);!c&&b!=window.top&&this.$Q(b.parent,a);)b=b.parent,c=pa(a,b);return c?b:null};d.$Q=function(a,b){try{return!!a&&null!=a.location.href&&Nc(a,b)}catch(c){return!1}};
d.$_=function(a){var b=this.lE("gapi_onload");if(b){var c=b.gapi_onload;b.gapi_onload=function(){c();a(b.gapi)}}else{window.gapi_onload=function(){a(window.gapi)};var e=document.createElement("script");e.src=ic(ni);this.wE&&lh(e,lf(this.wE));document.getElementsByTagName("head")[0].appendChild(e)}};d.KG=function(){for(var a=0;a<this.Bc.length;a++)this.Bc[a].vb.resolve(this.PK(this.Bc[a].G5));this.ZC=!0;this.YC.resolve(this.Gd)};
d.sendRequest=function(a){if(this.ZC)return this.PK(a);var b=Te();this.Bc.push({G5:a,vb:b});return b.promise};
d.PK=function(a){var b,c,e,f=pa("config.get",this.Gd);this.fq||(b=f("googleapis.config/auth/useFirstPartyAuth"),c=f("googleapis.config/auth/useOriginToken"));null!=this.Oq&&(e=f("client/cors"));try{var g=pa("config.update",this.Gd);this.fq||(g("googleapis.config/auth/useFirstPartyAuth",!1),g("googleapis.config/auth/useOriginToken",!1));null!=this.Oq&&g("client/cors",this.Oq);var k=pa("client.request",this.Gd),p=this.hU();a.headers&&Lb(p,a.headers);var q={headers:p,root:this.cQ,path:a.path,method:a.method,
body:a.body},A=a.params||{};this.qf&&!this.Cs?Lb(A,{key:this.qf}):this.Cs&&Lb(A,{key:null});Fb(A)||(q.params=A);var M=Ne(k(q));a.callback&&M.then(function(b){a.callback.apply(null,[b.result,b])},function(b){a.callback.apply(null,[b.result,b])});return M}finally{g=pa("config.update",this.Gd),this.fq||(g("googleapis.config/auth/useFirstPartyAuth",b),g("googleapis.config/auth/useOriginToken",c)),null!=this.Oq&&g("client/cors",e)}};
d.hU=function(){if(this.fq){if(this.Cs)return{Authorization:"Bearer "+this.Cs};var a=pa("auth.getAuthHeaderValueForFirstParty",this.Gd);return{Authorization:this.aca?a([]):a(),"X-Goog-AuthUser":this.vE}}return{}};
