@suns/react-monorepo-nx
Version:
To evaluate and compare the bundled and unbundled builds on large codebase.
44 lines (43 loc) • 21.7 kB
JavaScript
/** Notice * This file contains works from many authors under various (but compatible) licenses. Please see core.txt for more information. **/
(function(){(window.wpCoreControlsBundle=window.wpCoreControlsBundle||[]).push([[13],{528:function(wa,ta,n){function pa(){return!1}function oa(z,aa,ha){if(!(aa in w))return!0;aa=w[aa];for(var ba=0;ba<aa.length;ba++){var ca=z;var ea=aa[ba];var ma=ha;if(ea.name in ca){var la="",ia=!1;ca=ca[ea.name];switch(ea.type){case "s":la="String";ia=Object(ka.isString)(ca);break;case "a":la="Array";ia=Object(ka.isArray)(ca);break;case "n":la="Number";ia=Object(ka.isNumber)(ca)&&Object(ka.isFinite)(ca);break;case "o":la="Object",
ia=Object(ka.isObject)(ca)&&!Object(ka.isArray)(ca)}ia||ma.reject('Expected response field "'+ea.name+'" to have type '+la);ea=ia}else ma.reject('Response missing field "'+ea.name+'"'),ea=!1;if(!ea)return!1}return!0}function na(z){for(var aa=0,ha=["locale","excelMaxAllowedCellCount","applyPageBreaksToSheet","excelDefaultCellBorderWidth","displayChangeTracking"];aa<ha.length;aa++){var ba=ha[aa],ca=ba;ba=ba.charAt(0).toUpperCase()+ba.slice(1);z[ca]&&(Object.defineProperty(z,ba,Object.getOwnPropertyDescriptor(z,
ca)),delete z[ca])}return z}n.r(ta);var ja=n(0),ka=n(1);n.n(ka);var fa=n(3);wa=n(51);var y=n(29),x=n(546),f=n(112),e=n(438),a=n(49),b=n(193),h=function(){function z(){this.request=this.result=null;this.state=0;var aa=this;aa.promise=new Promise(function(ha,ba){aa.resolve=function(){if(0===aa.state||4===aa.state)aa.state=1,aa.result=arguments[0],ha.apply(null,arguments)};aa.reject=function(){if(0===aa.state||4===aa.state)aa.state=2,ba.apply(null,arguments)}})}z.prototype.Vv=function(){return 1===(this.state&
1)};z.prototype.mra=function(){return 2===(this.state&2)};z.prototype.ek=function(){return!this.mra()&&!this.Vv()};z.prototype.Lqa=function(){return 4===(this.state&4)};z.prototype.qS=function(){this.state|=4};return z}(),r=function(){function z(){this.Fv={};this.ec=[]}z.prototype.pop=function(){var aa=this.ec.pop();this.Fv[aa.key]=void 0;return aa};z.prototype.push=function(aa,ha){ha={key:aa,data:ha};this.ec.push(ha);this.Fv[aa]=ha.data};z.prototype.contains=function(aa){return!!this.Fv[aa]};z.prototype.get=
function(aa){return this.Fv[aa]};z.prototype.set=function(aa,ha){var ba=this;this.Fv[aa]=ha;this.ec.forEach(function(ca,ea){ca.key===aa&&(ba.ec[ea]=ca)})};z.prototype.remove=function(aa){var ha=this;this.Fv[aa]=void 0;this.ec.forEach(function(ba,ca){ba.key===aa&&ha.ec.splice(ca,1)})};z.prototype.length=function(){return this.ec.length};return z}(),w={pages:[{name:"pages",type:"a"}],pdf:[{name:"url",type:"s"}],docmod:[{name:"url",type:"s"},{name:"rID",type:"s"}],health:[],tiles:[{name:"z",type:"n"},
{name:"rID",type:"n"},{name:"tiles",type:"a"},{name:"size",type:"n"}],cAnnots:[{name:"annots",type:"a"}],annots:[{name:"url",type:"s"},{name:"name",type:"s"}],image:[{name:"url",type:"s"},{name:"name",type:"s"},{name:"p",type:"n"}],text:[{name:"url",type:"s"},{name:"name",type:"s"},{name:"p",type:"n"}],ApString2Xod:[{name:"url",type:"s"},{name:"rID",type:"s"}]};n=function(){function z(aa,ha,ba){var ca=this;this.ZS=this.SZ=!1;this.li=this.SJ=this.nx=this.sf=this.Iy=this.uq=this.Hy=this.Qo=null;this.qo=
new h;this.Kr=new h;this.qF=!1;this.xg=this.wf=this.xf=this.mg=null;this.Tg=[];this.dG=[];this.cache={};this.timeStamp=0;this.gi=[];this.nk=[];this.QN=null;this.FZ=!1;this.h7=this.id=null;this.pQ=this.X1=pa;this.hj=0;this.nP=!1;this.b4=1;this.kk={};this.wu=0;this.yw=new r;ha.endsWith("/")||(ha+="/");ba=ba||{};this.SZ=ba.disableWebsockets||!1;this.ZS=ba.singleServerMode||!1;null!=ba.customQueryParameters&&Object(a.b)("wvsQueryParameters",ba.customQueryParameters);ha.endsWith("blackbox/")||(ha+="blackbox/");
this.Qo=ba.uploadData||null;this.nx=ba.uriData||null;this.Hy=ba.cacheKey||null;if(this.uq=ba.officeOptions||null)this.uq=na(this.uq);this.sf=ba.rasterizerOptions||null;this.Iy=ba.cadOptions||null;this.Pf=ha;this.pN=aa;this.Fq(!0);this.Pu=(new x.a(ha,null,this.Ti())).dma(!this.SZ,function(ea){ca.cta(ea)},function(){return null},function(){ca.qF=!1},function(){ca.Cwa()})}z.prototype.ria=function(){var aa=this;return new Promise(function(ha,ba){var ca=new XMLHttpRequest;ca.open("GET",aa.Pf+"ck");ca.withCredentials=
aa.Ti();ca.onreadystatechange=function(){ca.readyState===XMLHttpRequest.DONE&&(200===ca.status?ha():ba())};ca.send()})};z.prototype.sya=function(aa){this.X1=aa||pa;this.pQ=pa};z.prototype.Qga=function(){this.E6();return this.Pu.Xr(!0)};z.prototype.E6=function(){Object(ja.b)(this,void 0,void 0,function(){return Object(ja.d)(this,function(aa){switch(aa.label){case 0:return this.Kr=new h,this.qo=new h,this.qF=!1,this.id=null,this.FZ=!1,[4,this.ria()];case 1:return aa.ba(),[2]}})})};z.prototype.Cwa=function(){this.X1();
this.E6();this.mg&&(this.mg.ek()?this.si(this.mg.request):this.mg.Vv()&&this.pQ(this.mg.result.url,"pdf")&&(this.mg=null,this.C6()));this.xg&&this.xg.ek()&&this.si(this.xg.request);this.xf&&this.xf.ek()?this.si(this.xf.request):this.wf&&this.wf.ek()&&this.G1();var aa;for(aa=0;aa<this.gi.length;aa++)this.gi[aa]&&(this.gi[aa].ek()?this.si(this.gi[aa].request):this.gi[aa].Vv()&&this.pQ(this.gi[aa].result.url,"image")&&(this.gi[aa]=null,this.JI(Object(ka.uniqueId)(),aa)));for(aa=0;aa<this.nk.length;aa++)this.nk[aa]&&
this.nk[aa].ek()&&!this.nk[aa].Lqa()&&this.si(this.nk[aa].request);for(aa=0;aa<this.Tg.length;aa++)this.Tg[aa]&&this.Tg[aa].ek()&&this.si(this.Tg[aa].request)};z.prototype.kqa=function(){return this.qF?Promise.resolve():(this.qF=!0,this.timeStamp=Date.now(),this.Pu.hH())};z.prototype.pBa=function(){var aa=this,ha,ba,ca,ea,ma;return new Promise(function(la,ia){if(aa.Qo)ha=new FormData,ha.append("file",aa.Qo.fileHandle,aa.Qo.fileHandle.name),aa.uq&&ha.append("officeOptions",JSON.stringify(aa.uq)),aa.sf&&
ha.append("rasterizerOptions",JSON.stringify(aa.sf)),aa.Iy&&ha.append("cadOptions",aa.Iy.getJsonString()),aa.Hy&&ha.append("cacheKey",aa.Hy),ba=aa.Qo.loadCallback,ea="upload",ca=aa.Qo.extension;else if(aa.nx)ha={uri:aa.nx.uri,KFa:aa.nx.shareId},ha=Object.keys(ha).map(function(sa){return sa+"="+(ha[sa]?encodeURIComponent(ha[sa]):"")}).join("&"),ma="application/x-www-form-urlencoded; charset=UTF-8",ba=aa.nx.loadCallback,ea="url",ca=aa.nx.extension;else{la();return}var ra=new XMLHttpRequest,qa=Object(y.k)(aa.Pf,
"AuxUpload");qa=Object(b.a)(qa,{type:ea,ext:ca});ra.open("POST",qa);ra.withCredentials=aa.Ti();ma&&ra.setRequestHeader("Content-Type",ma);ra.addEventListener("load",function(){if(ra.readyState===ra.DONE&&200===ra.status){var sa=JSON.parse(ra.response);aa.pN=sa.uri;ba(sa);la(sa)}});ra.addEventListener("error",function(){ia(ra.statusText+" "+JSON.stringify(ra))});aa.Qo&&null!=aa.Qo.onProgress&&(ra.upload.onprogress=function(sa){aa.Qo.onProgress(sa)});ra.send(ha)})};z.prototype.qwa=function(aa){this.password=
aa||null;this.qo.Vv()||(this.qo=new h,this.si({t:"pages"}));return this.qo.promise};z.prototype.MB=function(aa){this.QN=aa||null;this.qo.Vv()||this.si({t:"pages"});return this.qo.promise};z.prototype.Ty=function(aa){aa=Object.assign(aa,{uri:encodeURIComponent(this.pN)});this.QN&&(aa.ext=this.QN);this.li&&(aa.c=this.li);this.password&&(aa.pswd=this.password);this.Hy&&(aa.cacheKey=this.Hy);this.uq&&(aa.officeOptions=this.uq);this.sf&&(aa.rastOptions=this.sf);this.Iy&&(aa.cadOptions=this.Iy.mImpl);return aa};
z.prototype.exa=function(){0<this.yw.length()&&10>=this.wu&&this.fxa(this.yw.pop().data)};z.prototype.cga=function(aa){0<this.yw.length()&&this.yw.contains(aa)&&this.yw.remove(aa)};z.prototype.si=function(aa){aa=this.Ty(aa);this.Pu.send(aa)};z.prototype.c7=function(aa,ha){10<this.wu?this.yw.push(aa,ha):(this.wu++,aa=this.Ty(ha),this.Pu.send(aa))};z.prototype.fxa=function(aa){this.wu++;aa=this.Ty(aa);this.Pu.send(aa)};z.prototype.vn=function(aa){return aa};z.prototype.W1=function(aa){this.ZS&&aa?Object(fa.j)("Server failed health check. Single server mode ignoring check."):
!this.QDa&&aa&&3>=this.hj?(this.nP=!0,this.Pu.Xr()):3<this.hj&&(this.ZS=!0)};z.prototype.cta=function(aa){var ha=this,ba=aa.data,ca=aa.err,ea=aa.t;switch(ea){case "upload":ca?this.qBa.reject(ca):this.qBa.resolve("Success");break;case "pages":ca?this.qo.reject(ca):oa(ba,ea,this.qo)&&this.qo.resolve(ba);break;case "config":if(ca)this.Kr.reject(ca);else if(oa(ba,ea,this.Kr)){this.W1(ba.unhealthy);ba.id&&(this.id=ba.id);if(ba.auth){var ma=Object(a.a)("wvsQueryParameters");ma.auth=ba.auth;Object(a.b)("wvsQueryParameters",
ma)}ba.serverVersion&&(this.SJ=ba.serverVersion,Object(fa.h)("[WebViewer Server] server version: "+this.SJ));ba.serverID?(this.hj=ba.serverID===this.h7&&this.nP?this.hj+1:0,this.h7=ba.serverID):this.hj=0;this.nP=!1;this.Kr.resolve(ba)}break;case "health":ca?this.Kr.reject(ca):oa(ba,ea,this.Kr)&&this.W1(ba.unhealthy);break;case "pdf":ba.url=Object(b.a)(this.Pf+"../"+encodeURI(ba.url));ca?this.mg.reject(ca):oa(ba,ea,this.mg)&&this.mg.resolve(ba);break;case "ApString2Xod":ba.url=Object(b.a)(this.Pf+
"../data/"+encodeURI(ba.url));ca?this.kk[ba.rID].reject(ca):oa(ba,ea,this.kk[ba.rID])&&this.kk[ba.rID].resolve(ba);break;case "docmod":ba.url=Object(b.a)(this.Pf+"../"+encodeURI(ba.url));ca?this.kk[ba.rID].reject(ca):oa(ba,ea,this.mg)&&this.kk[ba.rID].resolve(ba);break;case "xod":if(ca)this.xf&&this.xf.ek()&&this.xf.reject(ca),this.wf&&this.wf.ek()&&this.wf.reject(ca);else if(ba.notFound)ba.noCreate||this.xf&&this.xf.ek()&&this.xf.resolve(ba),this.wf&&this.wf.ek()&&this.wf.resolve(ba);else{ba.url&&
(ba.url=Object(b.a)(this.Pf+"../"+encodeURI(ba.url)));if(!this.wf||this.wf.Vv())this.wf=new h,this.wf.request={t:"xod",noCreate:!0};this.xf||(this.xf=new h,this.xf.request={t:"xod"});this.wf.resolve(ba);this.xf.resolve(ba)}break;case "cAnnots":ma=this.xg;if(ca)ma.reject(ca);else if(oa(ba,ea,ma)){ma.qS();var la=[],ia=ba.annots;ba=function(Ja){var Fa=ia[Ja].s,Ea=ia[Ja].e,La=ra.Pf+"../"+encodeURI(ia[Ja].xfdf),Da="true"===ia[Ja].hasAppearance?Object(b.a)(La+".xodapp"):null,Ka=Object(ka.range)(Fa,Ea+1);
la[Ja]={range:Ka,promise:new Promise(function(Qa,Sa){var Oa=new XMLHttpRequest;Oa.open("GET",Object(b.a)(La));Oa.responseType="text";Oa.withCredentials=ha.Ti();Oa.addEventListener("load",function(){Oa.readyState===Oa.DONE&&200===Oa.status&&Qa({It:Oa.response,gn:Da,range:Ka})});Oa.addEventListener("error",function(){Sa(Oa.statusText+" "+JSON.stringify(Oa))});Oa.send()})}};var ra=this;for(ca=0;ca<ia.length;ca++)ba(ca);ma.resolve(la)}break;case "annots":if(ca)this.xg.reject(ca);else if(oa(ba,ea,this.xg)){this.xg.qS();
var qa=new XMLHttpRequest;ma=this.Pf+"../"+encodeURI(ba.url);var sa=ba.hasAppearance?Object(b.a)(ma+".xodapp"):null;qa.open("GET",Object(b.a)(ma));qa.responseType="text";qa.withCredentials=this.Ti();qa.addEventListener("load",function(){qa.readyState===qa.DONE&&200===qa.status&&ha.xg.resolve({It:qa.response,gn:sa})});qa.addEventListener("error",function(){ha.xg.reject(qa.statusText+" "+JSON.stringify(qa))});qa.send()}break;case "image":this.wu--;var va=this.gi[ba.p];ca?va.promise.reject(ca):oa(ba,
ea,va)&&(va.result=ba,va.result.url=Object(b.a)(this.Pf+"../"+encodeURI(va.result.url)),va.resolve(va.result));break;case "tiles":this.wu--;va=ba.rID;ma=this.Tg[va];this.Tg[va]=null;this.dG.push(va);if(ca)ma.reject(ca);else if(oa(ba,ea,ma)){for(ca=0;ca<ba.tiles.length;ca++)ba.tiles[ca]=Object(b.a)(this.Pf+"../"+encodeURI(ba.tiles[ca]));ma.resolve(ba)}break;case "text":va=this.nk[ba.p];if(ca)va.reject(ca);else if(oa(ba,ea,va)){va.qS();var ya=new XMLHttpRequest;ba=Object(b.a)(this.Pf+"../"+encodeURI(ba.url));
ya.open("GET",ba);ya.withCredentials=this.Ti();ya.addEventListener("load",function(){ya.readyState===ya.DONE&&200===ya.status&&(va.result=JSON.parse(ya.response),va.resolve(va.result))});ya.addEventListener("error",function(Ja){va.reject(ya.statusText+" "+JSON.stringify(Ja))});ya.send()}break;case "progress":"loading"===ba.t&&this.trigger(f.a.Events.DOCUMENT_LOADING_PROGRESS,[ba.bytes,ba.total])}this.exa();!ea&&aa.echo&&aa&&"apstring2xod"===aa.echo.t&&(aa=aa.echo.reqID)&&(2<=parseInt(this.SJ,10)?
this.kk[aa].reject("Message unhandled by server"):this.kk[aa].reject())};z.prototype.Tma=function(){return Object(ja.b)(this,void 0,void 0,function(){return Object(ja.d)(this,function(aa){switch(aa.label){case 0:return[4,this.kqa()];case 1:return aa.ba(),[2,this.Kr.promise]}})})};z.prototype.Ama=function(aa){for(var ha=this,ba=new XMLHttpRequest,ca=Object(b.a)(this.Pf+"aul",{id:this.id}),ea=new FormData,ma={},la=0;la<aa.body.length;la++){var ia=aa.body[la];ma[ia.id]=ia.cM.w+";"+ia.cM.h;ea.append(ia.id,
ia.cM.dataString)}aa={t:"apstring2xod",reqID:this.b4++,parts:ma};var ra=this.Ty(aa);ea.append("msg",JSON.stringify(ra));this.kk[ra.reqID]=new h;ba.open("POST",ca);ba.withCredentials=this.Ti;ca=new Promise(function(qa,sa){ba.onreadystatechange=function(){4===ba.readyState&&(200===ba.status?qa():sa("An error occurred while sending down appearance strings to the server"))}});ba.send(ea);return ca.then(function(){return ha.kk[ra.reqID].promise})};z.prototype.Tga=function(){var aa=this.SJ.split("-")[0].split("."),
ha=["1","5","9"];if(3!==aa.length)throw Error("Invalid WVS version length.");if(3!==ha.length)throw Error("Invalid version length.");for(var ba=0;ba<aa.length;++ba){if(ha.length===ba||aa[ba]>ha[ba])return-1;if(aa[ba]!==ha[ba])return 1}return 0};z.prototype.Fr=function(){return 0>=this.Tga()};z.prototype.cO=function(){this.xg||(this.xg=new h,this.Fr()?this.xg.request={t:"cAnnots"}:this.xg.request={t:"annots"},this.si(this.xg.request));return this.xg.promise};z.prototype.JI=function(aa,ha){this.gi[ha]||
(this.gi[ha]=new h,this.gi[ha].request={t:"image",p:ha},this.c7(aa,this.gi[ha].request));return this.gi[ha].promise};z.prototype.rwa=function(aa){this.nk[aa]||(this.nk[aa]=new h,this.nk[aa].request={t:"text",p:aa},this.si(this.nk[aa].request));return this.nk[aa].promise};z.prototype.swa=function(aa,ha,ba,ca,ea){var ma=this.Tg.length;this.dG.length&&(ma=this.dG.pop());this.Tg[ma]=new h;this.Tg[ma].request={t:"tiles",p:ha,z:ba,r:ca,size:ea,rID:ma};this.c7(aa,this.Tg[ma].request);return this.Tg[ma].promise};
z.prototype.C6=function(){this.mg||(this.mg=new h,this.mg.request={t:"pdf"},this.FZ?this.mg.resolve({url:this.pN}):this.si(this.mg.request));return this.mg.promise};z.prototype.M0=function(aa){var ha=this,ba=new XMLHttpRequest,ca=Object(b.a)(this.Pf+"aul",{id:this.id}),ea=new FormData,ma={};aa.annots&&(ma.annots="xfdf");aa.watermark&&(ma.watermark="png");aa.redactions&&(ma.redactions="redact");ma={t:"docmod",reqID:this.b4++,parts:ma};aa.print&&(ma.print=!0);var la=this.Ty(ma);ea.append("msg",JSON.stringify(la));
return Promise.all([aa.annots,aa.watermark,aa.redactions].map(function(ia){return Promise.resolve(ia)})).then(function(ia){var ra=ia[0],qa=ia[1];ia=ia[2];ra&&ea.append("annots",ra);qa&&ea.append("watermark",qa);ia&&ea.append("redactions",ia);ha.kk[la.reqID]=new h;ba.open("POST",ca);ba.withCredentials=ha.Ti;ra=new Promise(function(sa,va){ba.onreadystatechange=function(){4===ba.readyState&&(200===ba.status?sa():va("An error occurred while sending down annotation data to the server"))}});ba.send(ea);
return ra.then(function(){return ha.kk[la.reqID].promise})})};z.prototype.G1=function(){this.wf||(this.wf=new h,this.wf.request={t:"xod",noCreate:!0},this.si(this.wf.request));return this.wf.promise};z.prototype.twa=function(){this.xf||(this.xf=new h,this.xf.request={t:"xod"},this.si(this.xf.request));return this.xf.promise};z.prototype.Aq=function(){return!0};z.prototype.request=function(){};z.prototype.Q5=function(){};z.prototype.abort=function(){for(var aa=0;aa<this.Tg.length;aa++)this.Tg[aa]&&
(this.Tg[aa].resolve(null),this.Tg[aa]=null,this.dG.push(aa));this.close()};z.prototype.YI=function(aa){this.li=this.li||{};this.li.headers=aa};z.prototype.Fq=function(aa){this.li=this.li||{};this.li.internal=this.li.internal||{};this.li.internal.withCredentials=aa};z.prototype.Ti=function(){return this.li&&this.li.internal?this.li.internal.withCredentials:null};z.prototype.getFileData=function(){return Promise.reject()};return z}();Object(wa.a)(n);Object(e.a)(n);Object(e.b)(n);ta["default"]=n},546:function(wa,
ta,n){var pa=n(0),oa=n(3),na=n(29),ja=n(49),ka=n(193),fa=n(85),y=function(){function f(e,a,b,h,r,w){void 0===b&&(b=null);void 0===h&&(h=null);void 0===r&&(r=null);void 0===w&&(w=null);this.E3=!1;this.hj=0;this.xY=this.LBa(e);this.url=a?this.xY+"/"+a:this.xY+"/ws";this.dN=b;this.gB=h;this.Ry=r;this.OR=w}f.prototype.LBa=function(e){var a=e.indexOf("://"),b="ws://";0>a?a=0:(5===a&&(b="wss://"),a+=3);var h=e.lastIndexOf("/");0>h&&(h=e.length);return b+e.slice(a,h)};f.prototype.send=function(e){this.Qq.readyState===
WebSocket.CLOSED||this.E3||this.Qq.send(JSON.stringify(e))};f.prototype.hH=function(){return Object(pa.b)(this,void 0,void 0,function(){var e,a=this;return Object(pa.d)(this,function(){e=Object(ja.a)("wvsQueryParameters");e.bcid=Object(na.l)(8);Object(ja.b)("wvsQueryParameters",e);return[2,new Promise(function(b,h){var r=Object(ka.a)(a.url);a.Qq=new WebSocket(r);a.Qq.onopen=function(){a.gB&&a.gB();b()};a.Qq.onerror=function(w){a.E3=!0;h(w)};a.Qq.onclose=function(w){var z=w.code;return Object(pa.b)(a,
void 0,void 0,function(){var aa=this;return Object(pa.d)(this,function(ha){switch(ha.label){case 0:return this.Ry&&this.Ry(),3E3===z?[3,3]:8>this.hj++?[4,new Promise(function(ba){return setTimeout(function(){return Object(pa.b)(aa,void 0,void 0,function(){return Object(pa.d)(this,function(ca){switch(ca.label){case 0:return this.OR(),[4,this.hH()];case 1:return ca.ba(),ba(),[2]}})})},3E3)})]:[3,2];case 1:return ha.ba(),[3,3];case 2:h(fa.a),ha.label=3;case 3:return[2]}})})};a.Qq.onmessage=function(w){w&&
w.data&&(w=JSON.parse(w.data),w.hb?a.send({hb:!0}):w.end?close():a.dN(w))}})]})})};f.prototype.Xr=function(e){void 0===e&&(e=!1);this.hj=0;e?this.Qq.close(3E3):this.Qq.close();return Promise.resolve()};return f}(),x=function(){function f(e,a,b,h,r,w,z){void 0===h&&(h=null);void 0===r&&(r=null);void 0===w&&(w=null);void 0===z&&(z=null);this.hj=this.II=this.id=0;this.pA=!1;this.request=null;e=this.Fua(e);this.url=a?e+"/"+a+"pf":e+"/pf";this.LJ=b;this.dN=h;this.gB=r;this.Ry=w;this.OR=z}f.prototype.Fua=
function(e){var a=e.lastIndexOf("/");0>a&&(a=e.length);return e.slice(0,a)};f.prototype.Wha=function(e){e=e.split("\n");for(e[e.length-1]&&e.pop();0<e.length&&3>e[e.length-1].length;)"]"===e.pop()&&(this.id=0);0<e.length&&3>e[0].length&&e.shift();for(var a=0;a<e.length;++a)e[a].endsWith(",")&&(e[a]=e[a].substr(0,e[a].length-1));return e};f.prototype.O6=function(){return Object(pa.b)(this,void 0,void 0,function(){var e=this;return Object(pa.d)(this,function(a){switch(a.label){case 0:return 8>this.hj++?
[4,new Promise(function(b){return setTimeout(function(){e.OR();e.hH();b()},3E3)})]:[3,2];case 1:a.ba(),a.label=2;case 2:return[2]}})})};f.prototype.Hua=function(e){Object(pa.b)(this,void 0,void 0,function(){var a,b;return Object(pa.d)(this,function(h){switch(h.label){case 0:a=null,b=0,h.label=1;case 1:if(!(b<e.length))return[3,6];a=JSON.parse(e[b]);if(!a)return[3,5];if(!a.end)return[3,2];close();return[3,5];case 2:if(!a.id||Number(a.id)===this.id)return[3,4];Object(oa.j)("Reconnecting, new server detected");
this.Xr();return[4,this.O6()];case 3:return h.ba(),[3,5];case 4:a.hb&&Number(a.id)===this.id?this.send({hb:!0}):this.pA||this.dN(a),h.label=5;case 5:return++b,[3,1];case 6:return[2]}})})};f.prototype.$sa=function(e){Object(pa.b)(this,void 0,void 0,function(){var a,b,h;return Object(pa.d)(this,function(r){switch(r.label){case 0:if(!(3<=e.readyState))return[3,2];try{a=e.responseText.length}catch(w){return Object(oa.h)("caught exception"),[2]}if(0<a)try{b=this.Wha(e.responseText),0===this.id&&0<b.length&&
(h=JSON.parse(b.shift()),this.id=h.id,this.hj=0),this.Hua(b)}catch(w){}return this.pA?[3,2]:[4,this.z_()];case 1:r.ba(),r.label=2;case 2:return[2]}})})};f.prototype.z_=function(){return Object(pa.b)(this,void 0,void 0,function(){var e=this;return Object(pa.d)(this,function(){return[2,new Promise(function(a,b){function h(){return Object(pa.b)(e,void 0,void 0,function(){return Object(pa.d)(this,function(w){switch(w.label){case 0:b(),this.Xr(),w.label=1;case 1:return this.pA&&8>this.hj?[4,this.O6()]:
[3,3];case 2:return w.ba(),[3,1];case 3:return[2]}})})}e.request=new XMLHttpRequest;e.request.withCredentials=e.LJ;var r=Object(ka.a)(e.url,0!==e.id?{id:String(e.id),uc:String(e.II)}:{uc:String(e.II)});e.II++;e.request.open("GET",r,!0);e.request.setRequestHeader("Cache-Control","no-cache");e.request.setRequestHeader("X-Requested-With","XMLHttpRequest");e.request.onreadystatechange=function(){e.$sa(e.request)};e.request.addEventListener("error",h);e.request.addEventListener("timeout",h);e.request.addEventListener("load",
function(){e.gB&&e.gB();a()});e.request.send()})]})})};f.prototype.hH=function(){var e=Object(ja.a)("wvsQueryParameters");e.bcid=Object(na.l)(8);Object(ja.b)("wvsQueryParameters",e);this.II=this.id=0;this.pA=!1;return this.z_()};f.prototype.send=function(e){var a=this,b=new XMLHttpRequest;b.withCredentials=this.LJ;var h=Object(ka.a)(this.url,{id:String(this.id)}),r=new FormData;r.append("data",JSON.stringify(e));b.addEventListener("error",function(){a.Xr()});b.open("POST",h);b.setRequestHeader("X-Requested-With",
"XMLHttpRequest");b.send(r)};f.prototype.Xr=function(){this.id=0;this.pA=!0;this.Ry&&this.Ry();this.request.abort();return Promise.resolve()};return f}();wa=function(){function f(e,a,b){this.eZ=e;this.target=a;this.LJ=b}f.prototype.dma=function(e,a,b,h,r){void 0===e&&(e=!0);void 0===a&&(a=null);void 0===b&&(b=null);void 0===h&&(h=null);void 0===r&&(r=null);return e?new y(this.eZ,this.target,a,b,h,r):new x(this.eZ,this.target,this.LJ,a,b,h,r)};return f}();ta.a=wa}}]);}).call(this || window)