coze-bridge 0.1.7 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +43 -41
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5,25 +5,25 @@ import { dirname as __coze_dirname } from 'node:path';
|
|
|
5
5
|
const require = __coze_createRequire(import.meta.url);
|
|
6
6
|
const __filename = __coze_fileURLToPath(import.meta.url);
|
|
7
7
|
const __dirname = __coze_dirname(__filename);
|
|
8
|
-
var
|
|
9
|
-
`,"utf8"),
|
|
10
|
-
`):
|
|
11
|
-
`)}function O(r){return{debug:(e,i)=>Gt("debug",r,e,i),info:(e,i)=>Gt("info",r,e,i),warn:(e,i)=>Gt("warn",r,e,i),error:(e,i)=>Gt("error",r,e,i),child:e=>O(`${r}.${e}`)}}var Jt,vs,j0,G0,bs,K=Pe(()=>{"use strict";Jt={debug:10,info:20,warn:30,error:40},vs=(()=>{let r=process.env.COZE_BRIDGE_LOG_LEVEL;return r==="debug"||r==="info"||r==="warn"||r==="error"?r:"info"})(),j0=process.stdout,G0=process.stderr,bs={}});import{homedir as J0}from"node:os";import{join as se}from"node:path";function V(r){let e=r??J0(),i=se(e,".coze"),a=se(i,"bridge"),x=se(a,"lib");return{cozeRoot:i,bridgeRoot:a,libDir:x,libEntry:se(x,"index.js"),pidFile:se(a,"bridge.pid"),portFile:se(a,"bridge.port"),tokenFile:se(a,"bridge.token"),logFile:se(a,"bridge.log"),installLock:se(a,"install.lock"),configFile:se(a,"config.json"),agentsRoot:se(i,"agents")}}function Le(r,e=V()){let i=se(e.agentsRoot,r);return{root:i,config:se(i,"config.json"),workspace:se(i,"workspace"),logs:se(i,"logs")}}var fe=Pe(()=>{"use strict"});var Xt={};ys(Xt,{AGENT_CONFIG_FILE_MODE:()=>Vt,enforceAgentConfigMode:()=>X0,loadAgentConfig:()=>xe,persistAgentSessions:()=>ur,persistAgentSkills:()=>Yt,saveAgentConfig:()=>he});import{chmod as V0,stat as Y0}from"node:fs/promises";function xe(r,e){return Wt(Le(r,e).config)}function he(r,e){return jt(Le(r.agentId,e).config,r,{mode:Vt})}async function X0(r,e){if(process.platform==="win32")return;let i=Le(r,e).config;try{let a=await Y0(i);if(!a.isFile())return;let x=a.mode&511;x!==Vt&&(await V0(i,Vt),Cs.warn("agent config mode auto-corrected to 0600",{path:i,from:x.toString(8)}))}catch(a){if(a.code==="ENOENT")return;Cs.warn("enforceAgentConfigMode: chmod failed (ignored)",{path:i,err:String(a)})}}async function ur(r,e,i){let a=await xe(r,i);a&&(a.sessions=Object.fromEntries(e),await he(a,i))}async function Yt(r,e,i){let a=await xe(r,i);a&&(a.skills=e,await he(a,i))}var Cs,Vt,Ke=Pe(()=>{"use strict";cr();K();fe();Cs=O("agent-config"),Vt=384});var ai=ae(Q=>{"use strict";function D(r,e){r=r-331;let i=Cn(),a=i[r];if(D.NuNDVN===void 0){var x=function(m){let _="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=",v="",y="";for(let C=0,T,P,R=0;P=m.charAt(R++);~P&&(T=C%4?T*64+P:P,C++%4)?v+=String.fromCharCode(255&T>>(-2*C&6)):0)P=_.indexOf(P);for(let C=0,T=v.length;C<T;C++)y+="%"+("00"+v.charCodeAt(C).toString(16)).slice(-2);return decodeURIComponent(y)};D.jChnHz=x,D.BcrqPJ={},D.NuNDVN=!0}let f=i[0],u=r+f,g=D.BcrqPJ[u];return g?a=g:(a=D.jChnHz(a),D.BcrqPJ[u]=a),a}var S=D;(function(r,e){let i=D,a=r();for(;;)try{if(parseInt(i(1017))/1+parseInt(i(1532))/2+-parseInt(i(1479))/3*(parseInt(i(1039))/4)+-parseInt(i(721))/5+-parseInt(i(899))/6+parseInt(i(435))/7+parseInt(i(1190))/8*(-parseInt(i(735))/9)===e)break;a.push(a.shift())}catch{a.push(a.shift())}})(Cn,512940);var tx=Object[S(983)+S(1754)],nx=Object[S(1415)+S(1831)+"mes"],ni=(r,e)=>function(){return r&&(e=(0,r[{ZmMXB:function(f,u){return f(u)}}[S(1711)](nx,r)[0]])(r=0)),e},rx=(r,e)=>{let i={ZVNAO:function(x,f,u,g){return x(f,u,g)}};for(var a in e)i.ZVNAO(tx,r,a,{get:e[a],enumerable:!0})};function sx(){return Zs||(Zs=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function ix(){let r=S;return $s||($s=[IDBCursor[r(1522)+"e"].advance,IDBCursor.prototype[r(1752)],IDBCursor[r(1522)+"e"][r(1752)+"PrimaryKey"]])}function ox(r){let e=S,i={Gmfoa:e(404),aSzRZ:"error",YfOgm:function(x,f){return x(f)},ctLkU:function(x,f){return x instanceof f}},a=new Promise((x,f)=>{let u=e,g={vkUfy:function(y,C){return i.YfOgm(y,C)}},m=()=>{let y=D;r[y(1072)+"entListe"+y(1083)](i.Gmfoa,_),r[y(1072)+y(826)+y(1083)](i.aSzRZ,v)},_=()=>{x(g[D(849)](ke,r.result)),m()},v=()=>{f(r.error),m()};r[u(719)+u(1382)](u(404),_),r[u(719)+u(1382)](i[u(953)],v)});return a.then(x=>{let f=e;i[f(887)](x,IDBCursor)&&pr[f(563)](x,r)})[e(470)](()=>{}),bn[e(563)](a,r),a}function ax(r){let e=S,i={FGTwN:e(532),MJBkb:e(1600),abUbF:e(1604),fFwec:function(x,f,u){return x(f,u)},fmLAK:function(x,f){return x>>>f},OpxkJ:function(x,f){return x<<f},WMQRG:function(x,f){return x!==f},KkxYz:"Lrypu",GYrjp:e(493),lylgm:function(x){return x()},SYpmY:function(x){return x()},MObtK:e(593)+"or",iwEJU:function(x){return x()},Taysd:function(x,f){return x===f}};if(vn[e(1238)](r))return;let a=new Promise((x,f)=>{let u=e,g={uVrWv:function(y,C){return i[D(1255)](y,C)}},m=()=>{let y=D;if(y(743)!=="MGafe")r[y(1072)+y(826)+y(1083)](i[y(954)],_),r["removeEv"+y(826)+"ner"](i.MJBkb,v),r[y(1072)+y(826)+y(1083)](i[y(1661)],v);else return g[y(1596)](0,this[y(443)])&&g[y(1596)](0,this[y(757)])},_=()=>{let y=D,C={zDPrU:function(T,P,R){return i[D(1509)](T,P,R)},KPxel:function(T,P){return i[D(382)](T,P)},iWZOk:function(T,P){return i[D(1644)](T,P)}};if(i[y(828)](i[y(727)],i.GYrjp))i.lylgm(x),i[y(550)](m);else{let{value:T,offset:P}=C[y(500)](_0x30e9e6,_0xbffeb7,_0x33668a);_0x59755a=P,_0x55ff75=C[y(1186)](C.iWZOk(_0x23cbd9,8),0),_0x258028+=T}},v=()=>{let y=D;f(r[y(1600)]||new DOMException(i[y(1106)],"AbortError")),i[y(979)](m)};r[u(719)+u(1382)](u(532),_),r.addEventListener(i[u(723)],v),r["addEvent"+u(1382)](u(1604),v)});vn.set(r,a)}function xx(r){Sn=r(Sn)}function cx(r){let e=S,i={fXsnW:function(a,x){return a(x)},FKEYk:function(a,x){return a(x)},EsPIk:function(a,x){return a===x},rYwgn:function(a,x){return a in x},bLHjc:e(1228)+"oreNames",jQabR:function(a){return a()}};return i[e(427)](r,IDBDatabase.prototype["transact"+e(1568)])&&!i[e(1381)](i[e(580)],IDBTransaction[e(1522)+"e"])?function(a,...x){let f=e,u=r[f(656)](i[f(1371)](Lt,this),a,...x);return gr[f(563)](u,a[f(749)]?a[f(749)]():[a]),i.FKEYk(ke,u)}:i.jQabR(ix).includes(r)?function(...a){let x=e;return r[x(1295)](i[x(1297)](Lt,this),a),i[x(1297)](ke,pr[x(1508)](this))}:function(...a){return ke(r[e(1295)](i.FKEYk(Lt,this),a))}}function fx(r){let e=S,i={qWSSp:function(a,x){return a===x},gXoTp:function(a,x){return a(x)},iEbfU:function(a,x,f){return a(x,f)},mbCkz:function(a){return a()}};return i[e(1610)](typeof r,"function")?i[e(838)](cx,r):(r instanceof IDBTransaction&&ax(r),i.iEbfU(ri,r,i[e(703)](sx))?new Proxy(r,Sn):r)}function ke(r){let e=S,i={NQfCk:function(x,f){return x instanceof f},mnWFQ:function(x,f){return x(f)},kPLmx:function(x,f){return x!==f}};if(i[e(1302)](r,IDBRequest))return i.mnWFQ(ox,r);if(wn[e(1238)](r))return wn[e(1508)](r);let a=fx(r);return i[e(1402)](a,r)&&(wn[e(563)](r,a),bn.set(a,r)),a}var ri,Zs,$s,pr,vn,gr,wn,bn,Sn,Lt,Qs=ni({"node_modules/idb/build/wrap-idb-value.js"(){let r=S,e={zFRXE:function(i,a){return i instanceof a},MJvTP:function(i,a){return i===a},sTfQz:r(1515),FUWnD:"objectSt"+r(1620),bSHRM:function(i,a){return i!==a},HNNwN:"yupXb",vcqaT:function(i,a){return i===a},lwSAv:function(i,a){return i(a)},BvPNL:function(i,a){return i<a},pZilD:function(i,a){return i|a},CsJQJ:function(i,a){return i&a},GRkmz:function(i,a){return i&a},WBbYY:function(i,a){return i>=a},xwZLh:function(i,a){return i|a},KcNOq:function(i,a){return i<<a},BThoS:function(i,a){return i>=a},hbMKj:function(i,a){return i-a},ypAFg:function(i,a){return i|a},JrjQD:function(i,a){return i|a},FokyY:function(i,a){return i|a},qQmSW:function(i,a){return i<<a},TSJlh:function(i,a){return i>>a},UnNqG:function(i,a){return i+a},cZVKD:function(i,a){return i!==a},CNDCk:r(1805),OSgNl:function(i,a){return i===a},gvzcr:r(1679),rNPyF:function(i,a){return i in a}};ri=(i,a)=>a.some(x=>i instanceof x),pr=new WeakMap,vn=new WeakMap,gr=new WeakMap,wn=new WeakMap,bn=new WeakMap,Sn={get(i,a,x){let f=r;if(e[f(1621)](i,IDBTransaction)){if(e[f(956)](a,e[f(1283)]))return vn[f(1508)](i);if(a===e[f(816)])if(e[f(670)](e[f(931)],e[f(931)]))this._debug(f(1260),_0x573115.message),_0x1f9cbc();else return i[f(1228)+f(1620)]||gr.get(i);if(e[f(1005)](a,f(1679)))return x[f(1228)+f(1620)][1]?void 0:x[f(1228)+f(883)](x[f(1228)+f(1620)][0])}return e.lwSAv(ke,i[a])},set(i,a,x){return i[a]=x,!0},has(i,a){let x=r;if(e[x(444)](e.CNDCk,e[x(1296)])){let f=_0x41b119[_0x1e10f0++];if(f<=127)_0xa570c3+=_0x1e7621[x(1483)+x(1162)](f);else if(f>=192&&e[x(1099)](f,224))_0x5b2d4b+=_0x214365[x(1483)+x(1162)](e[x(934)](e.CsJQJ(31,f)<<6,e[x(1023)](63,_0x4a1032[_0x444e36++])));else if(e[x(801)](f,224)&&f<240)_0x3e6e39+=_0x3c39f6[x(1483)+x(1162)](e[x(934)](e[x(889)](e[x(1174)](e.CsJQJ(15,f),12),e[x(1023)](63,_0x55b447[_0x32f249++])<<6),63&_0x4d0e59[_0x2517d5++]));else if(e[x(1541)](f,240)){let u=e[x(465)](e[x(428)](e[x(972)](e[x(1113)](e.GRkmz(7,f)<<18,e[x(1734)](63&_0x15ab1c[_0x1f9681++],12)),e.qQmSW(e[x(1514)](63,_0x18ea74[_0x183fb5++]),6)),63&_0x1722b7[_0x38aa9e++]),65536);_0x339ffa+=_0x54e9b1[x(1483)+x(1162)](55296+e[x(378)](u,10)),_0x1c706f+=_0x117f49.fromCharCode(e[x(1488)](56320,e[x(1514)](1023,u)))}}else return e[x(1621)](i,IDBTransaction)&&(e[x(652)](a,e[x(1283)])||a===e[x(1399)])?!0:e.rNPyF(a,i)}},Lt=i=>bn.get(i)}}),si={};rx(si,{deleteDB:()=>dx,openDB:()=>ux,unwrap:()=>Lt,wrap:()=>ke});function Cn(){let r=["q1njAKO","B3n1DxG","v0DkAK0","qM5YzhO","CwzQBeK","sxbwq0e","zuPitMe","yxnJCMLWDa","DwLoEuO","qLjmt0W","BNrbBMrvCgq","C3nHz2vfDMu","u215BK8","DM9otK8","sg1Izfy","CM92AwrLihC","AxnbCNjHEq","z0Plwxi","Aw9U","wNPtCMe","AwXSihvZzsa","uNb0v2C","vfLVuey","CMvHzhLtDge","yxGGCMv0CMK","CeHlt1m","D2fZq2XLyw4","DLrPsw4","DhnoBMi","tfvpvve","vxbKyxrLq28","z09Ltfq","y0jjtfi","y3jLyxrLq2W","A0zxuvy","vg55AKy","zhzowNy","r2TOyKC","FdL8mhWY","rfLttwS","BMrWB2LUDca","A0DPCva","vLH0wxO","ywnRtxnNswq","CgfNzxnOB3C","AuHgtNi","DvzYv3y","x2HHBMrSzu8","r2PNBgq","B2nRzxq","zxjYB3i","BNruCMLLC0m","Aw5N","Bwf4tg9ZC0m","ywjVCNq","CgD3ELu","u0L2tNa","ALfQzfK","DeTUCe4","veDyC0q","CvDtu3a","yxDvA3C","y3vYC29Y","DKngyMq","t2r0rLa","mNW1","wKDWzuS","AK12tfm","sfnlChq","y3jLyxrLt3a","B3jLtMfTzxm","EKzsweu","wLnLu2S","CNnVCL9Uyw0","BhHyv3q","x2nVBM5Ly3q","AfL6D1e","wLPqB0K","CM9YrxzLBNq","Dxvfq2m","AKLqseG","z2v0sxrLBq","A3blzLG","Dg9cExrLC0i","x2LUAxrhBg8","zgv2AwnLx2K","zgnnwwK","x2LZv29YA2u","u21lBhe","AxmGDw5Kzwy","BgLZDgvUtMu","nNW0FdD8mhW","twPMD0O","DNHzquK","t3b4A0O","y291BNq","D3nZoI8V","zLPNse8","DxnLCKLW","CMfTugfYyw0","l3DZl3yY","zgDnv0K","zw50zwqGDhK","zMLSDgvY","zeXdBgq","B25ozxr3B3i","BLbwtLa","vgfWB0O","uKzzu2m","ugHvyKS","C1DMqwC","ywjvyKy","vLjQwNi","zwnmDw8","sMrcue0","x29WDgLVBNm","AxnrB1nby2S","suvRC1a","zereCeO","vejvr3y","BwLZzq","BMv2tfq","twfyEeC","rxzLBNq","y2HHCKnVzgu","s09AsuW","CgfNzwHPzgu","z2vY","EvjLy29UBMu","C3rVCMu","BwvKAwf0zwW","Dxrjza","AxnmB25N","C2nYAxb0","BM5Ly3q","v1jiCwK","yM1PsKO","C2vUza","wgv5z0q","CxbWDgy","C2jAvKi","DgvZDa","B3fkwNi","zMLN","q2n5r0i","AgfZt3DUuhi","uNfPq3y","z2LKALq","CM92AwrLige","DNnJuxu","C3bSAxq","DuXYDfi","A0HttwW","rgnMEw8","BezSDxnO","nhWXmhW2Fdm","CM9TEvi","ihrVihjLDhi","sLzIse0","tMjsqxq","Agfvr2S","wM1nwei","EgnSv3q","t0TiqMG","Bwf4uMv0CMK","sg9uCKS","ChLIsM0","Bw51wKC","zMzMzG","x2LZtM9Kzq","u3zPsfy","CNzHBa","uw9SzgK","B3vUDa","CMvHzg9UBhK","CNzHBfzHBhu","vu5Itei","B2zMC2v0","Dw5RBM93BIa","BwXMv2i","CKTZrNG","ELzcr0u","CMvHzhDYAxq","C3vIyxjYyxK","CvfTu1C","yNvMzMvY","lcbOB3n0BMe","x3DHAxq","Bgj1A0q","v3Przhi","wvDuuw4","tvbQrxy","vNHJENm","yM9L","vLrTAhK","su9zAu0","z1rPBwvVDxq","CgfYC2u","s0DLC1O","x2rPC2nVBM4","nhWXFdb8m3W","vxDmveC","y29UDgLUDwu","v2jcs0e","B3bLCNr5","x3vYBa","Ae1LC3nHz2u","B3jpBMXPBMu","AwXLtMfTzq","BgvUz3rO","CMvZzxrdB3u","x2LZtwLUAvC","DKvkqMS","CMfUzg9T","zw50","uNr2q1O","DLDrCfa","AxjLza","yvnIAeq","zMzmAw5L","Aw47y2HHCNm","AgnqBxK","CvH1z0e","zvvYBa","wxfxCu4","DKXcC3q","ywrKq291BNq","y29UBMvJDgK","BgLUzq","BMvJDa","wgPNELC","sNbbvgC","r2vOt3q","B2Twuee","C3rYAw5N","ANLyCeK","s3bzugC","quH0Egu","rfvpsNm","tKPrueO","EwjTshu","AgP2uNK","BwfW","rvH6ueW","zw5XDwv1zq","yLnlz3O","ig1LC3nHz2u","zwnhBxq","y2HnyxHdB3u","zeDZCg8","DKzUDfy","x194x21Zz18","BM93","Dur5y2y","ChjVDg9JB2W","tfvwsee","B3bLBG","D1v3BKe","EKLXv28","Cg9PBNrbBMq","u2j6zui","Cg9W","vhzyy1m","uMvJB25Uzwm","tvDJEfe","uhvyueS","CMTnEeu","A2rtD1a","t2DYDhe","wNrkEva","x2LUDgvYDMe","sgDArfm","D0njAfG","rgjlDxK","CLDWzxC","mhWXFdr8mNW","yw5Hz2vY","yM9ruw4","vvPrCLm","y3D4Bu4","sMz3Cfm","B3bLCNr5tMe","yuvZCwO","zw5HyMXLuw8","zMvY","ywDLsgLKzq","C0nVDw50zxi","uhb0zKK","zM9YrwfJAa","yNvMzMvYzwq","DLD6ufe","CMvZB2X2zq","CNnVCL92ywW","y29Kzq","BwvZC2fNztO","DgvmB2Djre4","x2jPBMfYEvq","x2nSzwfYvgK","rKLJCNy","B3fZt2G","s2zlAM4","yxnZAwDU","BMCGB3iGyw4","whrOweu","BKTQyMW","zxrxB3jRq2G","DgfIyxnL","tgjuquq","y3vZDg9Tshq","C2DvCKO","Cfrcvxu","zv9ZDwnJzxm","wfrdCfi","z0zRtvC","t2rtCwW","teDhCfu","wKLuC2K","DxPKqKm","AKD2BLK","EMvNz1y","z2v0q3vYCMu","Cg93","yLngy0q","B2LUDfjLywm","zMjmsLi","Cw9Zx18","x3bPBMDmB3m","wxfbEMq","rLr3Cwm","uKXpr3u","DMvUDa","zNjHBwvuExa","CNbrwgG","DxrVuMvJB24","vvn4DLK","y29UBMvJDca","x0vysvnu","D3jPDgvvAw4","vffxBwq","rvfxuLq","vfnkBgG","C2v0q3vYC28","Bgv2Dwu","zNDZxZeUmc4","zM1mquS","yxzSueq","EwHuDeC","EK5AENi","vePRsuK","teLKuMy","y1zrqLi","zfDVCMTLCKC","z3jxAe8","yKTAwfi","y3DvD1q","B3v0sw50zxi","DgLUzYbZzxi","ENjhDfm","Aw5jB1G","C3vIC3rYAw4","yxbWBgLJyxq","wxDjtfy","q3riD3m","wg92BxK","wujetee","C2v0sxrLBq","C3vJy2vZCW","EKjpwM4","v0zOy1C","DLzWs1K","EuLzyMy","zu5yDfq","BhvfzgC","t3DYAfG","tLj1wvm","twvZC2fNzuu","vw5PBxbSzw0","BhjuwKi","C3vSt1C","re1RBfK","q1n2z28","Chv0","uMvHzcbWyxm","zMnWAxa","C2vUzf9Hy2S","B25tDgfYDfi","Bwf4twvZC2e","ywnRx2nVzgu","Ec1TC2CTy3u","rxnqswS","ExbbrMC","DgzPu0S","q1vNyuW","B1LSy1O","AgjXs1G","Ec11C2uT","AujJALq","mZyWmdiXoujVDgTYqG","Bg9Nsurhzw4","sMPtz2y","terHDLq","t3zJvLu","zxjYtxnN","x2LUAxrqCM8","Bw9WwMK","AgLNAa","y1Pws0q","v2jwyu4","sxruCLu","Cgz4uMy","zNjVBNrPzxi","u0rXq0e","y0Dgrwy","z2jUqNu","DhjPzxm","ExfRu20","v2vPEgLUsLm","x2rLyNvN","rNjVBNrPzxi","Dg9oDw1Izxi","qK5grfm","AxnszwfKEq","nNWWFdj8mxW","zhnXu1a","x3nLBMrby2S","D3PuvM0","ihrPBwvZ","Agjns2O","sfPWvfC","yxrHlcbKyxq","thL6B20","x3bHDgHlzxK","y2f0y2G","y3ruAw1LB3u","BKXPBMu","tgrAA1e","qKr0EuS","vhfRreq","qLnYyvO","uvPQzM8","ExDNtNi","vgLTzw91Da","x2rItMfTzq","y254sNe","DxvlBfC","D3nkqMm","AKTlzKm","Dg9VigXHCMC","DxbKyxrLq3u","t0zcBMq","B25nzxnZywC","yxv0B21HDgK","ANb4DvC","C1L4qwi","tg9JAW","rezZAeK","Ahvcr1i","D3jPDgu","qLD3Agm","zMLUza","z2u6ia","vhbhrKe","EKrqCLu","AenSB3nLrxy","C0Xf","A3nRvNa","vu1KvNK","yLjmvgy","zgvSzxrLrge","su5wChy","y2HLy2TdDxi","B2nRzxrtDwm","vK50yuy","CMvHzfvjBNq","AxnrB1nnzxm","rezMuwi","zgvSzxrL","zvLYCxu","rfjoELi","DNbuAMW","B3bLBIa","vhzNuMy","CufPtvu","t1PMq3G","x2n1CNnVCK4","CYbWyxjHBxm","x2rPC3bHDgm","z2v0qwXSs2u","txz0A2i","ywDLu2HVDW","Evbevgu","yNDgqM8","BMfLz2m","yxj4qKS","y29TCgXLDgu","whD2wLa","twLZC2LUzYa","tu5evwG","Dg9tDhjPBMC","BKXds2y","DvLlELK","yMfJA3vWigu","BfDNz0W","AeDywNK","CxHxqxu","Cgf5Bg9Hza","z05Zrgy","rKDKueC","aaaaaaaaaaa","x29UvgLTzw8","uM9QrvO","x25HDMLNyxq","u1LWBvK","ihrPBwvVDxq","vxvvBeC","B3nLrxzLBNq","Agfxqxq","u1Lwt3y","t29Nu2S","z2vtEw5J","y29UC3rYDwm","CMztseC","B3bLBKrc","lcbxzwjtB2m","weTRr3K","C2v0","uuPbvM0","D24GCMvHC28","x2XPC3rLBMu","yMXVy2TLza","rNfnq3m","CMvZzxrfBMq","AwvyAvm","x29Uq2XVC2u","AwDHDg9Yt24","rhnWsLG","C2v0u3rVCMe","CMfNzvn5BMm","y3r4","B25tDg9Wsw0","ugHRtMG","DK1fwg8","yKXiAMm","C2vUDa","yxv0BW","vNvnvgW","vMvctxO","AgfUz2u","Cxn3ufq","v01gAwK","z2vfCNu","C3jJ","x0rctMfTzq","shziAva","AM5xtLq","qwjVCNrfCNi","ywWGy3vYC28","r2zYwvu","z1Ptu3O","CNjVCK1LC3m","zgvIDwC","sKrXEKO","s0f0wem","Dhr3Awq","AgvHzgvYCW","zgjss2O","uuThwNe","BgXdvhK","CgjWEKO","DuvWBM0","D3zywe4","mdaWma","we1nyNO","zMzLCG","wvPNEKW","ELb3BK0","ug5LAem","q0f0s2m","x3bPBMC","Efrurw52","CgLUz09Uy2u","wMfjB2K","C2XPy2u","ywnR","tMzwC0K","CMvHC29U","ANDXuKu","weTHwhi","qKvzqMO","zfnRww8","x29UrxjYB3i","uNHjCfi","uuLLAuC","DgLTzw91Da","u2vXsuq","x3nVy2TLDa","BML0AwfSAxO","ywrK","rK1tvLq","Cw9Z","C3rYAw5NAwy","x3jLBw92zvC","t2DKwfK","ChrVCG","uNDlAee","vhfYqLa","DxrMofDYAxq","zgH1r0O","mNWXFdn8nq","rxjeBNK","D2PYCxK","u0HXCMi","EM9tBMG","vLP4vxm","t1nNtMW","zwn0","zgfitKS","CM92AwrLihy","y2fSBa","x2TLEvbHDgG","x29UugfNzu4","uKPwEu4","zMXVB3i","wwzQyuu","EuLpquy","CMTLCKDSB2i","AMzSC3a","rgvZz2q","zu5Sruy","mdaWmdaWmda","y29UBMvJDfm","BgHjtMe","yLniuK0","sxjsvLq","y3vYC29Yx24","DcbSAw1PDa","Dwr2qMy","CxLZuwS","yNL0zxm","DfLmv0u","CMLLC0nVDw4","zKDvt1G","qwLdAeS","wLHotuq","icSG","v0zrAgC","rvLxwvq","wfPNu1u","sxzOAuy","CePXq0y","B2zMBgLUzq","sKfWDKu","zNf6EwS","D0PrtKy","y2uGBM90igK","vMzRsfC","vw5Oyw5KBgu","DuDpwgy","CgXLyxnLiha","CfzZz2W","tg9NsurozxC","CIb0DhDjra","tMfJteC","rhvQwhO","DMvYC2LVBG","BwjdA3O","vNvtCNe","DhjPBq","reiGzMfPBgu","zxj2AwnL","AwXLx25HBwu","q2T1ruO","Curfr0y","nhWZFdu","t3P1De8","DeLK","A21vEeC","D3D5C0W","Bezgugi","AgLHtNi","yMrFzgLK","ywrKrxzLBNq","DNrXrfq","mJa3mZCYmgXkrgvnEG","x2HHBMrSzvi","tuPcA2i","qwnoq1u","Eg9xAvy","AffbyMe","s2T4wxO","Ew5IDNu","m3WYFdr8mxW","tMHPDKW","y09Wzw4","rMTywu8","uvr1u24","BgLTAxq","mJDIr0LvEue","AMvdAfi","s09wzuS","q0HJCxG","Dgv4Dc9Qyxy","AwXPtK4","EeDtALy","uLjpuG","rLjey3y","qLDgvgy","zKnIEu4","zgvS","te9pCuy","sxzAu1q","C29YDa","tfbRuxi","ChvZAa","yNL0zu9MzNm","yMLUza","rwrPreS","rKLmrv9ot1q","CxvQEve","Bg93","rMrerwG","zu1zDhi","ywXSB2nvBNm","q0XkAgC","DgLLCKPtt04","D1Dxwva","Ahr0Chm6","EgTtweq","DMn6zxG","Eg9Qtw0","DeLUDgvYy2u","Dg9iyxnO","EvPfwfm","uevQEuO","yNL0zuXLBMC","tK9uyve","B25fCNjVCG","B1PMv2O","DMfSDwvZ","C2v0y3vYC28","Bwu6ia","EK5TyLy","DxjS","qwT4Eve","whjKt2e","C1PqqMm","BMj3tMy","q0Xmvgy","sMrVELO","zsbHihn0CMK","y3jLyxrLuMu","zw5JB2rLrNi","qwn0sg0","zufJAW","A2v5","yLbNqLG","AKD5uw0","CMv0CNLdB3u","v0XjrLG","BMnVzgLUzW","BgvY","rxfUA0m","t2jVEKK","v0jIwvK","DhDjqMi","wwTiB2K","z2jRy0W","zxjHDg9Y","AMT2uNO","D1zJwfi","se1rzfK","y3jLyxrLtwu","yxjYyxLIDwy","v2PmCeq","txnztKi","rhLUv3e","Ae9Wzw5fDMu","reTpvg8","rLvxBKq","sxbzDMm","x1fVu01HBMe","yNvyuuW","x2nYzwf0zvm","uMPxt3K","Dgv4DfbHEwW","uhbTAgW","y3vYDMfSDwu","r25ls2u","zw50tgLZDgu","igzHAwWSig0","v01ruKC","Bg9IywXty28","wvvXueu","wLfVAMC","ywnRpwzYB24","y2XVC2u","EgTQDKS","qwXYvLK","CMvWBgfJzui","zK1itum","z1HVvha","AwPlvwO","t1z2AuG","txDyz2q","r0DWBfG","tg9Nsuq","zNryCey","BNDMzvO","z3n4t1e","EhfPBK0","zu1Atxu","DMTvzNK","lcbTyxGGCMu","qKzqt1e","rhnvy2m","B25pCgvU","vKHbAg0","B3jRig9MzMW","EvDdAgK","yuvlEwK","vMvRv0y","A25fsfe","zgvJB2rLzey","wKvTEfu","sfv0vwG","AwrI","v25SBhO","t3bLBKv2zw4","Egrdr04","tKfusvzfx0u","CgLUz19VBMm","zxjFAxnFywm","z2v0u3rVCMe","uvPpyLK","t1bftL9fuLi","Bhm6ia","r3jKEve","x2LZsw5PDa","ihbYB3rVy28","wNrxAgW","C1j4svu","teP6q04","yw5ZzM9YBvq","s3zoDei","CgvYC2LZDgu","B3jL","ELfTvM8","tuPbC1m","uMfwAMO","y3rmA1u","z29yEfu","EhDAtgG","DLH2ANG","Dev2zw50","uxvLDwu","q2Dls2e","EujKqxC","t0zSA1a","s2n5uLa","AK5zCLe","Aff6EK8","ndqWodi2u0f4vw5H","ywnOzwqSihC","weTHqNu","y29UDgv4Da","zgf0yq","Bff4q3i","y0vQDg8","x2rLC3rYB3K","Bgzbwee","t0jPyxG","BufQzNu","ywXSzwqGBxu","A1rSvee","BMDuAw1LCG","t1bftG","DcbVzIbYyw4","Ahr0Ca","B25JBg9Zzq","uhnfDvi","rMjNq0C","BMv4DcGPigm","Cg9PBNrdB24","ANPYAue","y2HLy2Tszwe","q1f3Cwi","DeroDvO","x2HHBMrSzva","y29SBM8","CgjICdi","BejZv0C","Egr4suO","re9cv0W","se5oD04","u1LiwLi","qw9dqxy","CfPPBeq","qw1pq2y","AeDfBwS","zgLZywjSzue","uNHKwwW","zxHWB3j0CW","rufrCxy","zwrPyxrLBhK","tenPAvK","AfrQq2e","zMXZAMG","t2rbyMO","suvtx0vsuK8","vNzcDLq","AuPKBxi","BNrLCG","DMfS","y29UBMvJDeu","Aw9WvwS","yvn6uLO","rKDuD04","uxfIrgC","tuP2vfa","rg1tChm","BMCGDxjSoIa","Aw5KzxHpzG","qw56quO","D2LSBfjLy28","uvnvC3C","DxHhDwi","AxLAv0u","r29JtLy","BMz0AuC","yvvhrNm","uvnszeS","CxPwzfe","BfzQCxC","tuvtu0fhrv8","sNjQuuq","swPtzK0","zM9Yy2u","r25KBuq","Aw50zwDLCIa","DvLcu0i","DgfYz2v0","AxDfsLu","zxnezKm","BxnNsuq","q3vZDg9Tq2W","zgvMAw5Luhi","BKHKyLO","rgjWy3i","uhjXBw0","BMv3vMvYC2K","zNjVBuj5Dgu","uwvws0C","q3PJB0m","EhvewNm","werwz0y","ywDLrxzLBNq","rg1ksKG","z0Ttv1u","ywnOzwq","x3fVC0rc","BwfUDwfSihi","y3vYCMvUDeu","x29UtwvZC2e","CMnoBKu","yw5Nzq","C0n1BwC","yMvHqM8","DMnXyvq","s2XpCuG","CYbPBNn0yw4","A294EgW","y2vZC0HHBMq","DKHtA0W","zw5HyMXLqxu","vgnxrNy","s2zmt3G","y0jPqLO","Dw50","wuDLrvi","mtC0ntqWCMXKse5c","zcbLCNjVCI4","zfPhy2q","wgLTqve","shzNA0G","B2nRzxrgywK","r1jRBxO","uuv6teS","quDkr1C","vMvxzLK","Cgf5Bg9Hzeu","ywXPzcb1CMW","wKDyEgy","rNDhD0O","sMvpvui","C2jWuxq","tePpDLq","y2LryvK","ihn1y2nLC3m","q291BNq","wgP0z3q","shnmrwm","odyYndy4CMXkr2DR","z29PBMCGyxC","CxfHsu8","x19LC01Vzhu","uuT4Du0","A21LqK0","zwnVBM5Ly3q","BwLUzW","ihzHBgLKigq","DMLJzuLeig8","CgLUz0LUDgu","zxjFywnRx20","vNHLt0y","DhjHBNnHy3q","uhH5zgK","AejzqKS","yxKSihrYEsa","B2zM","BwvZC2fNzv8","y3fHtLa","y2XcAeu","zw1PDa","r0jWD0G","CMvXDwLYzwq","x21PBMLoyxy","rfr6Cgy","vgX5C2G","x3bYzwzPEa","q0Xpu0ve","vejjuwy","Cffsrwe","x3jLywr5q2W","zMXVrhq","CMvTB3zLrxy","AwXK","zNjVBujPDhm","yvj2D2S","z2nKsNq","C2L0su0","DhvkEMy","vezVzKO","Dg9Ys3a","C2HQtvm","x29Ut3bLBG","BMvY","igfYCMf5yNu","wxb1z0K","C3rLBMvYCW","CMvZDwX0","ru9lwxy","EvbPrva","ihjLy29UBMu","v0Lns2e","tufyx1jfvfi","B3nLza","ELL2qNe","BMrLEa","D1vxrhu","zw5JB2rPBMC","zNjVBu51Bwi","qNzqtKW","Ef9MCM9UDgK","u0vuCu8","zvLWs2u","vxfSEee","shj5A0i","AhDgu1e","tu9IDeS","x3DZsw5ZDge","z0HovMy","zvvNEem","rxDwzLu","D0HvsNq","wgPuBe4","rM9REvK","Au9wsK4","CLzHBhvLCW","u253seK","AM9PBG","zhHPrfK","rvDRB0q","sNL0qLC","C2HPzNq","BMnLq2XVC2u","uu1XAfC","vxjwDLK","zvjfvKu","qwzHwKy","vMDoBgK","D3m6lY8","BMnRr3C","CNnVCKzPBgu","rKjZwvC","x2vUzhbVAw4","mxW4FdD8nxW","yw1LoIa","CMvTB3zLq2G","wvj1y2K","vwzkuhi","ExvsvLq","y3vYCMvUDeK","AvLSyLa","q0nUzhu","A05ls1O","whHQzuW","q0Xpu0LorW","EezZCe0","A1vuzLG","Dw5KzwzPBMu","qLfhqxi","v2LUzg93","BgLUzw5V","yM9KEq","x2n1CNnVCK0","q09otKvdveK","AxnFywnR","y29YvvC","teHAtLq","zKL3s2C","vgfN","rePAqNK","y29Uy2f0","ywfkDfa","q29Kzq","BwvY","tvbqB0K","DMfSDwu","wxfXsNe","vgXeEgy","C3jRq3u","DgLTzw91DcW","jMPZy2fSBgi","B25szwnLAxy","DgHLBG","Eev2Dgq","s2not3e","t0LQsgS","zgHVz08","vwLlshi","mNWXFdn8nhW","C2vYDMLJzs0","zePMrum","t3HusKC","q1vXze4","sKzIrhi","wwPQsxi","v21Ht0S","s1b4zwW","y2zotM4","rgXNuMW","ywX3yxLZ","mtqWmJaWyw9yyuXy","AMHZzfa","vgHptMm","uLHxwey","AenzA2W","BKfmzxG","mxWWFdn8nhW","zxf1ywXZ","yMLUyxj5vhK","t3bLAuq","y0ngCvu","qNvZDKq","B2jZELO","ugrAqNq","vxHvBvK","y0nWruW","DxfhCKO","x2DLBMvYyxq","EwTRz2C","AMvJDfn0B3i","AhLqr3q","yw1L","y2XVC2uSihC","wfvdsuK","vuf6BwK","C2fNzq","yxnL","CMvQzwn0","DLDpzuC","BMvLzf9Hy2S","q1fTs1a","rxjYB3jdB2q","DhbizwfKzxi","AevYCM9Yrxy","zNvHsue","Dg9mB3DLCKm","x21LC3nHz2u","u0fuvfm","B2jQzwn0u3q","C3zbDvG","D3HQqKW","ANzVrvK","x2fKzfDZtgK","DfrWuuC","AeDhwNG","B2fK","BfrPBwvVDxq","BMfTzq","AgfZ","Bg9N","wfLWrgy","yNDPAwC","zuHgz3q","DePPv24","tu53ELa","wgfxrg0","igzPzwXKoIa","B2XKvMvYC2K","DxbNCMfKzw4","pxv0zI04","C29cruG","quvvre8","BMCGzMfPBgu","CMfTzq","EvLxvhi","vgf5C2q","zNjVBuHHC2G","sLnptLa","uxHmtxK","y213wha","CMvJzwL2zwq","EeDqq2C","zhH2u28","z2n2BeK","q3nJyva","C2vYDMLJzq","q2Xiy2m","tfrHuK0","CwPcEM0","v2X6seq","AefJA01LC3m","ExbL","u2TPCcbWyxm","ywnRx2LK","rxzjwuu","zw5NDgG","tLH1twO","B25TzxnZywC","BMDLza","q21jA1a","BIWGAg9ZDg4","Aw5KzxG","CMvWBgfJzq","C1rMuxO","wxbeDM0","C1P5u2S","tgrbv0S","rLnrtKK","x3bPBMDqB24","sfrSsKK","yvrYuxi","rMv3t1C","uMT4BgS","x3bYB3rVy28","rfjitKu","yxbWBhK","q05eq2S","rKTfwwS","ihzHBgLKihm","C3rXtuG","y3vYC29Yx2y","B09vD0S","tLfMq2S","ywneBwi","tvDgC2C","B2vbAu4","tMfZv2C","yMfSrxzLBNq","CMLSAhC","qw1VDw50","D0HbzLi","t1fftue","DhbOtMG","zw1LBNq","CeTxEe0","CMvUDevUzha","zcWGDw5RBM8","CKDND3a","q3vZDg9Trxi","C0zitKq","uMHwuha","DePAExe","y2HnyxHuCMK","EMjKAfy","r0HbsfG","zwvKzwq","DhDVCMTdAge","BvncEem","uunrCvC","nhWYFdf8mhW","De1HBMfNzxi","y09rrwW","z21tANK","vvHorvC","v3jwqKu","s3nzC1u","rLDt","o2nOyxjZzxq","ruPfvuq","CgLUz0XVC3m","vxLhvwW","swTptuC","z0frAM4","v1zwsNi","tw9KDwXL","C3rHCNq","EMnVwvO","zxq9DxrMltG","u3rYyxrLz3K","Duj2Agq","y3vYC29YlNm","zMX1C2HfEha","D3bTveO","mhWXFdn8nhW","rML3ugq","zw5HyMXLvhi","zvzfDuy","uvzsB3K","BMrWB2LUDfq","ChrTyK4","zgLsC1C","A1n0yxr1C0m","x3nLCuLK","rxHqDfG","x2nSzwfYugK","CeDTEKO","r0nhDwK","x2LUAxq","BNrfBMrWB2K","zNbzDNa","AMr0s2O","zLHZBLC","veHsEwS","y29UBMvJDa","x2n1CNnVCKy","BwvZC2fNzq","BwXcrum","wNjjtwK","Ce5zEw0","A3DOC1e","Aw9UvgLTzw8","CLL3z24","tgLZDgvUzxi","t2LLBei","teT5ywK","t2jQzwn0","sgjqqK4","C2ruuMC","rLbJvNO","BeHHBMrSzxi","u2HHCMvKv28","rLr1wxK","tNL2u2y","z2D3CvO","x2rYB3bhBg8","Dg9Y","B25LCNjVCG","yMfSu2nVCgu","x3DZ","z3z6y3i","DhjPzxmGCMu","u2TxyNC","A1bmBxG","AwrvAxe","rwjoCLi","u3rUwwu","z2vMu2G","z2vjBMzVu3K","AMDqtfi","C0PVsMm","tMrcrfu","DvHzuvq","r01wEge","vK11yLa","quXSzfi","z2v0t3DUuhi","t2HSthu","qxPZDMy","q09oveLovuu","BNDHv2m","q29UzMLN","AwrtC1O","uKvcEwG","z2v0qwXS","ywXty29Wzq","C0vlENy","y2v4s3y","C1jpveu","Au1Ntw4","y2XVC2veqG","zxjYtM8","z2v0s2v5","B25Uzwn0Aw4","tfDwzvy","C2DPza","D3bYBeG","x2LZtwLUAvq","z0z6qxm","EuXWvvG","zcWG","u2vYDMLJzvC","y2XLyxi","zg5TqKK","A21Hqve","C0XPC3rLBMu","vfvZBxe","v2vIu29JA2u","rLjptLrjrvi","t05xq3m","qwnXEwi","C2v0zgi","Bwv0Ag9K","CgnMEwq","B25VCgvU","tMfTzq","BxnzyK4","A2v5CW","r05uBxK","CMvJB25Uzwm","r0fhyLy","ywDL","BxjqAwu","rvPprwy","z1ftvuK","zxjFCw9Z","we55wM4","CMfRANO","C1z4rwi","CMvZzxruCMK","zw5fDMvUDa","u3DcBfu","q0j1yuW","AvvWrMS","Cgf5Bg9Hzfq","z2vrDwv1zuW","Aw9Ul2PZB24","EMv6CfC","rfjQB28","Dgv4Dc9WBge","oxruvwzxwa","uNLhzuq","ww5Kwvy","C2vYDMvYvgK","zNjVBunOyxi","AK5rweS","zw5KCg9PBNq","wur3tfm","BwLUAvbYB2C","vw5oCuC","igXHCMDLCIa","swLVEMm","qxjzwMW","sMjrqvu","s3zzywq","x3jLy29UBMu","EhnIAfq","wwv2yNe","DhLWzq","vvPTyvu","AwfYvwy","t1jdB0i","ywrKt25L","x2LZqNjVD3m","AvLXz08","BLDXA1u","quzezg4","CMvJzxzPzwq","tg9YrMW","z2v0","zKz3zwm","CuT2sNK","CNDdsuu","Aw5JBhvKzxm","CM92AwrLigi","q3nkuuO","zg9Uzq","x2DLDeLUDgu","shfzywC","rKnqv3u","zuXtD3a","zxjFBxnNAwq","tuLPAeG","ChjVDg90Exa","t3jiCvK","uMHRtuO","zxjFCw9Zx2e","x2zVCM1HDeu","sw1nwKy","uwvOChO","y3jLyxrLrxi","BeXTz2W","C0jf","mJaYmZq0ogfpy2PqBW","AvvjDuC","q1nSDwG","uxnvuhK","yvvIsfy","Bg9NsurozxC","r3zLBwK","zuTAqwi","ufzgwxq","qLrOB1m","zv90Aw1LB3u","sgnuA00","vezICw8","EhzpDgS","yw51Ce1LC3m","Dw5ZAwDUzwq","rgvKAwnHDgu","zxH0zw5ZAw8"];return Cn=function(){return r},Cn()}function ux(r,e,{blocked:i,upgrade:a,blocking:x,terminated:f}={}){let u=S,g={aZgTd:function(v,y,C,T,P){return v(y,C,T,P)},ArYZl:function(v,y){return v(y)},LUOUQ:"versionc"+u(585),naegc:function(v,y){return v(y)},FTwqc:u(567)},m=indexedDB[u(1806)](r,e),_=g[u(530)](ke,m);return a&&m.addEventListener("upgraden"+u(1325),v=>{let y=u;g.aZgTd(a,g[y(1491)](ke,m[y(1087)]),v[y(1247)+"on"],v[y(987)+"on"],g[y(1491)](ke,m["transact"+y(1568)]))}),i&&m[u(719)+u(1382)](g[u(366)],()=>i()),_[u(1172)](v=>{let y=u;f&&v[y(719)+y(1382)](y(833),()=>f()),x&&v["addEvent"+y(1382)](g[y(1579)],()=>x())})[u(470)](()=>{}),_}function dx(r,{blocked:e}={}){let i=S,a={corUW:i(567),mrPie:function(f,u){return f(u)}},x=indexedDB[i(506)+i(344)](r);return e&&x.addEventListener(a[i(1155)],()=>e()),a[i(1461)](ke,x)[i(1172)](()=>{})}function ei(r,e){let i=S,a={xlEAM:function(m,_){return m(_)},wWWYP:"AbortError",MJAsS:function(m){return m()},gcdJt:i(1724),ogzIM:function(m,_){return m instanceof _},cCpEL:function(m,_){return m in _},YndYV:function(m,_){return m===_},cnxJq:"string",JeOUB:i(544),gbnBu:function(m,_){return m!==_},nLCKf:function(m,_){return m in _}};if(!(a.ogzIM(r,IDBDatabase)&&!a[i(1205)](e,r)&&a[i(1481)](typeof e,a[i(481)]))){if(a[i(1031)]===a[i(1031)])return;KgyaRC.xlEAM(_0xa30aa0,_0x19fb78.error||new _0x1ea195(KgyaRC.wWWYP,KgyaRC[i(763)])),KgyaRC[i(885)](_0x4ecc70)}if(yn[i(1508)](e))return yn[i(1508)](e);let x=e.replace(/FromIndex$/,""),f=a[i(451)](e,x),u=oi[i(1512)](x);if(!a[i(537)](x,(f?IDBIndex:IDBObjectStore).prototype)||!(u||ii[i(1512)](x)))return;let g=async function(m,..._){let v=i,y=this[v(1052)+v(1568)](m,u?v(1732)+"e":a[v(1076)]),C=y[v(1679)];return f&&(C=C[v(1281)](_[v(1121)]())),(await Promise.all([C[x](..._),u&&y.done]))[0]};return yn[i(563)](e,g),g}var ii,oi,yn,lx=ni({"node_modules/idb/build/index.js"(){let r=S,e={xGSjV:r(1750)+r(1615),AcNCU:r(1508),DUOJs:r(1431),gUpPv:r(1423),LHZNT:"getAllKeys",uLrtR:r(1645),ijKUj:r(635),zNZzr:r(514),zCOGX:"clear",djHwI:function(x){return x()},yPDTe:function(x,f){return x(f)}},i=e[r(741)][r(1700)]("|"),a=0;for(;;){switch(i[a++]){case"0":ii=[e[r(724)],e[r(1788)],e.gUpPv,e[r(1156)],e[r(1701)]];continue;case"1":Qs();continue;case"2":yn=new Map;continue;case"3":oi=[r(419),e[r(839)],e[r(385)],e.zCOGX];continue;case"4":e.djHwI(Qs);continue;case"5":e[r(528)](xx,x=>({...x,get:(f,u,g)=>ei(f,u)||x[r(1508)](f,u,g),has:(f,u)=>!!ei(f,u)||x.has(f,u)}));continue}break}}}),hx={idb:function(r){let e=S;r.exports=Promise[e(1841)]()[e(1172)](()=>(lx(),si))[e(1172)](function(i){return i})}},ti={};function Ee(r){let e=S,i={WSSTj:function(f,u){return f!==u}};var a=ti[r];if(i.WSSTj(void 0,a))return a[e(939)];var x=ti[r]={exports:{}};return hx[r](x,x[e(939)],Ee),x[e(939)]}Ee.d=(r,e)=>{let i=D;for(var a in e)Ee.o(e,a)&&!Ee.o(r,a)&&Object[i(983)+i(1754)](r,a,{enumerable:!0,get:e[a]})},(()=>{let r=S;Ee.o=(e,i)=>Object[r(1522)+"e"][r(1695)+r(1754)][r(656)](e,i)})(),(()=>{let r=S,e={gOeLT:function(i,a){return i!=a},VvBvT:r(1344)};Ee.r=i=>{let a=r;e[a(1581)](a(1147)+"d",typeof Symbol)&&Symbol[a(536)+a(1158)]&&Object[a(983)+a(1754)](i,Symbol[a(536)+a(1158)],{value:e[a(947)]}),Object[a(983)+a(1754)](i,"__esModule",{value:!0})}})();var $={};(()=>{let r=S,e={XUCII:function(s,t,n){return s(t,n)},WLIFX:function(s,t){return s===t},UfJPr:r(1642),UqlxA:function(s,t){return s(t)},Acqyb:function(s,t){return s+t},yIYbf:function(s,t){return s+t},ZITsi:function(s,t,n){return s(t,n)},vHSkL:function(s,t){return s instanceof t},uDVBR:r(1228)+"oreNames",aUbHV:function(s,t){return s===t},knEHQ:r(1679),yIOAF:r(1476),zeggV:function(s,t){return s(t)},iyZWE:function(s,t){return s+t},qswPT:r(609),tphNh:r(1718),jJYYx:r(667)+"00000000"+r(667)+r(667),TYoPF:function(s,t){return s-t},MaXxG:function(s,t){return s|t},ynbvu:function(s,t){return s|t},MwXgd:function(s,t){return s&t},llCTy:function(s,t){return s<<t},YqWqN:function(s,t){return s<<t},VekWF:function(s,t){return s&t},xqinM:function(s,t){return s&t},fbLJR:function(s,t){return s+t},OIjHk:function(s,t){return s>>t},dVQcD:function(s,t,n,o,c){return s(t,n,o,c)},WrVBE:function(s,t){return s(t)},sgUrJ:function(s,t){return s>t},bKZXR:function(s,t){return s<t},vxYAI:function(s,t){return s>t},pcfyd:function(s,t){return s!==t},Prqmm:r(1267),lrTZB:r(510),aEKyi:function(s,t){return s-t},rWpew:function(s,t){return s<t},WFQhg:function(s,t){return s-t},YZgzL:function(s,t){return s!==t},srkCu:function(s,t,n){return s(t,n)},HgZDS:function(s,t){return s!==t},WbVaN:function(s,t){return s(t)},Bnrdz:function(s,t){return s(t)},esDfC:function(s,t,n){return s(t,n)},BRLOL:r(534)+r(1062)+r(1246)+r(792),RxIpR:function(s,t){return s===t},CQmKP:r(534)+"required field: "+r(1165),qjBzm:function(s){return s()},LCiiY:function(s,t){return s(t)},jhsdP:function(s,t){return s(t)},okVPA:r(404),Mvtkb:"ping_onc"+r(1542)+"t",nbwNf:function(s,t,n){return s(t,n)},qysQk:function(s,t){return s!==t},XjgzW:function(s,t){return s!==t},FwGwJ:"VbsME",obszZ:function(s,t,n){return s(t,n)},IOYiM:function(s,t){return s!==t},TpGFA:r(466),ZtJyP:function(s,t,n){return s(t,n)},QZjfo:function(s,t,n){return s(t,n)},CscaP:function(s,t){return s!==t},QTgZJ:function(s,t,n){return s(t,n)},EEKSq:function(s,t,n){return s(t,n)},kTlTA:function(s,t,n){return s(t,n)},iOVJN:function(s,t){return s!==t},FbgCG:function(s,t){return s===t},OFlkP:"QbYGK",QyLUS:r(1667),vVpKY:function(s,t,n){return s(t,n)},gHNVf:function(s,t){return s!==t},QZObY:function(s,t,n){return s(t,n)},GndmD:function(s,t,n){return s(t,n)},CBuaL:function(s,t,n){return s(t,n)},WMFii:function(s,t){return s(t)},PsEuR:function(s,t){return s(t)},msYbN:function(s,t){return s(t)},CtHws:function(s,t){return s(t)},uBvhd:function(s,t){return s>>>t},MWcxQ:function(s,t){return s(t)},Ppmhl:function(s,t){return s(t)},haWAt:function(s,t){return s(t)},WFhcW:function(s,t,n){return s(t,n)},jpxuW:function(s,t,n){return s(t,n)},ZtWhl:function(s,t){return s(t)},CUgaL:function(s,t,n){return s(t,n)},VfkHW:r(534)+"required field: "+r(632),SDqCA:r(534)+r(1062)+r(1246)+r(843),DmSps:function(s,t){return s===t},lLmgl:function(s,t){return s===t},Ogrtq:r(534)+r(1062)+r(1246)+r(1451),tHkoK:function(s,t){return s(t)},Jhwlh:function(s,t,n){return s(t,n)},WKueF:function(s,t){return s(t)},dJfEC:function(s,t,n){return s(t,n)},nwaWc:r(414)+r(1652)+"pe: ",gPkEt:function(s,t){return s>=t},CHcqx:"pKWxM",TapoJ:function(s,t){return s+t},FIcrv:r(1272)+"t limit",fCbyN:"pagehide",idUiq:r(1594),SmKlq:r(1545),dhuGJ:function(s,t,n){return s(t,n)},ZEJVU:r(661),Hkexk:r(1123),daHNK:function(s,t){return s>t},JfwpS:function(s,t){return s!==t},zsjmK:r(351),TFbqo:function(s,t){return s*t},CCndu:function(s,t){return s>t},wzTVm:r(420)+r(673),NacLG:r(437),SYVOv:function(s,t,n){return s(t,n)},NasWg:function(s,t){return s==t},pbpzJ:r(1784),hjvRy:r(998)+r(1045)+r(1602),JVbHM:function(s,t){return s<t},uYKzY:function(s,t){return s===t},CLLTf:function(s,t){return s&t},jKKfC:function(s,t){return s>=t},eREVE:function(s,t){return s+t},fGUOX:function(s,t){return s+t},YwILV:function(s,t){return s+t},XNyZn:function(s,t){return s!==t},ZSeSk:function(s,t){return s&t},INVpv:function(s,t){return s&t},sWfAg:function(s,t){return s<t},AfaZF:function(s,t){return s==t},qzVdQ:function(s,t){return s&t},jdtKj:function(s,t){return s+t},awUkw:function(s,t){return s+t},UiKHr:function(s,t){return s!==t},Gvemi:function(s,t){return s&t},UuUlG:function(s,t){return s<<t},RptWg:r(1807),wpmTJ:function(s,t){return s|t},KAtXC:function(s,t){return s|t},jNQXK:function(s,t){return s&t},yWChi:function(s,t){return s>=t},ybmHu:function(s,t){return s>=t},fuaIA:r(1664),QJAVm:function(s,t){return s!==t},NXuMj:function(s,t){return s|t},Desgd:function(s,t){return s&t},stqMH:function(s,t){return s<t},ecGmt:function(s,t){return s>t},GMVxa:function(s,t){return s&t},qxWAu:function(s,t){return s+t},nHdbZ:function(s,t){return s<t},Lyzom:function(s,t){return s>=t},SmynO:function(s,t){return s+t},soBEH:function(s,t){return s<<t},eNXtT:function(s,t){return s<t},gJKYr:function(s,t){return s<t},JFbDr:function(s,t){return s<t},OpeiD:function(s,t){return s|t},CrJbO:function(s,t){return s&t},OrHqY:function(s,t){return s>>t},yPiEP:function(s,t){return s|t},ExPtX:function(s,t){return s&t},eJHNa:function(s,t){return s&t},OVviH:function(s,t){return s|t},ZzSra:r(1598),oZfWj:function(s,t){return s<t},PhkNh:function(s,t){return s+t},ClHcc:function(s,t){return s!==t},EvIYE:r(1104),WVVJr:r(496),QCQqW:function(s,t,n){return s(t,n)},EWkoD:function(s,t){return s(t)},Iiozc:function(s,t){return s&t},mWSXs:function(s,t){return s&t},hBYBK:function(s,t){return s&t},TBUGv:function(s,t){return s(t)},EXzPL:function(s,t){return s&t},PuXPK:function(s,t){return s&t},rKsFx:function(s,t){return s&t},qAiMU:function(s,t){return s(t)},UlLvl:r(1511),fZgHO:function(s,t){return s<<t},yHYKm:function(s,t){return s&t},KpYPg:function(s,t){return s&t},OKHBh:function(s,t){return s(t)},PnehC:function(s,t){return s(t)},haUGk:function(s,t){return s<<t},fRjuR:function(s,t){return s(t)},WRHqi:function(s,t){return s<<t},hGEmk:function(s,t){return s&t},fBlHp:"HZQAh",WbBKA:function(s,t){return s(t)},TcWFv:function(s,t){return s(t)},nPVNP:function(s,t){return s<<t},xsbhT:function(s,t){return s|t},OFBnd:function(s,t){return s|t},TQWmd:function(s,t){return s>>>t},XeygD:function(s,t){return s<t},QqbDg:function(s,t){return s<t},gKSWU:function(s,t,n){return s(t,n)},VeWfY:function(s,t){return s+t},rpUcR:function(s,t){return s+t},SwBlU:function(s,t){return s!==t},dxiDY:function(s,t){return s>>>t},CSIjJ:function(s,t){return s>>>t},rcNnE:function(s,t){return s|t},XrdOa:function(s,t){return s>>>t},kYtMo:function(s,t){return s!==t},vTaOv:function(s,t){return s!==t},EZOEf:function(s,t){return s>>>t},KOVeK:function(s,t){return s|t},HvgkH:function(s,t){return s&t},bLtJF:function(s,t){return s>>>t},LQkUi:function(s,t){return s>>>t},XthXE:function(s,t){return s!==t},inIoX:function(s,t){return s(t)},gFzAs:r(1600),cqaNP:function(s,t,n){return s(t,n)},SHqrb:"close",HvHiP:function(s,t){return s===t},OhlLu:r(759),kHSMl:function(s,t){return s|t},lbukD:function(s,t){return s|t},CSvgo:function(s,t){return s|t},hTjCa:function(s,t){return s|t},jwqRE:function(s,t){return s<<t},FCPWu:function(s,t){return s===t},torKp:function(s,t){return s>>>t},RqiCv:function(s,t){return s|t},StnYe:function(s,t){return s|t},ACwWm:function(s,t){return s<<t},EqnkC:function(s,t){return s<<t},sbZVB:function(s,t){return s<<t},cBiBZ:function(s,t){return s<<t},QeVKG:function(s,t){return s&t},sfBme:function(s,t){return s>>>t},XaWDm:function(s,t){return s>>>t},tuJzf:function(s,t){return s>>>t},oeAiN:function(s,t){return s&t},REByh:function(s,t){return s>>>t},UwLTG:function(s,t){return s(t)},wxjBL:function(s,t){return s<=t},zIqWo:function(s,t){return s+t},mlfWb:function(s,t){return s%t},bRLTf:function(s,t){return s>>>t},acDmb:function(s,t){return s===t},MNDUh:r(1717),bwiig:function(s,t){return s&t},TFMDw:function(s,t){return s&t},EbNrR:function(s,t){return s+t},xclWt:function(s,t){return s>>>t},fdpVF:function(s,t){return s>>>t},gZSSz:function(s,t){return s>>>t},qgqQF:function(s,t){return s===t},JDqzJ:function(s,t){return s+t},tybCm:function(s,t){return s&t},sdTRg:function(s,t){return s>>>t},ecLuo:function(s,t){return s&t},hGGZx:function(s,t){return s>>>t},tYLWE:function(s,t){return s&t},LdAWK:function(s,t,n,o){return s(t,n,o)},LwkMS:r(1100)+"er_qos",CSluh:function(s,t,n,o){return s(t,n,o)},AlrVY:r(1100)+r(1525)+"ck",eYpKe:function(s,t,n,o){return s(t,n,o)},BQGAr:r(1100)+r(869)+"k",xuDZs:"x_fronti"+r(1050)+r(1434),DOBWL:function(s,t){return s===t},WIMKa:r(893),jMvLS:function(s,t){return s>>>t},LwGgX:function(s,t){return s&t},xkSXD:function(s,t){return s&t},huBGR:function(s,t){return s>>>t},koxxl:r(1321),hGXZy:"4|5|0|3|1|2",YWTQn:r(1092)+"IES_ERROR",rpQXh:r(872)+"OR",IvhiF:"MESSAGE_ERROR",LDavT:r(867)+r(742),GehOt:"CONNECTING_ERROR",xkjvK:r(460)+r(711),cfNNn:r(1825)+"3",kmUxG:function(s,t,n){return s(t,n)},eKZAb:function(s,t){return s!==t},gefSh:r(1630),BrmpL:r(1210),OBiax:"BImDu",FGdPG:r(1450),RJVyN:function(s,t){return s===t},YGeER:r(1694),sVxEb:r(687),TvXcS:r(613),uxxmr:function(s,t){return s===t},TCfbN:r(1340),NOTaQ:r(712),ZQojg:function(s,t){return s>=t},dGspo:function(s,t){return s===t},vWzPQ:function(s,t){return s>t},vczex:function(s,t){return s&t},GgwlN:function(s,t){return s!==t},QCvrk:"UNMFO",HsLEc:function(s,t){return s===t},TElNw:function(s,t){return s instanceof t},DRNzR:r(694)+r(1018),wHUJt:function(s,t){return s+t},nygpZ:function(s,t){return s===t},zbdhV:r(348),YUqPE:r(1519),AoCAv:r(1408),udvBf:function(s,t){return s===t},OdtFP:r(1375),vscQu:r(1231),OgTBO:r(1376),oqJZr:function(s,t){return s instanceof t},avlPD:function(s,t){return s+t},fKiBz:function(s,t){return s!==t},vWQpP:r(1837),GnKKe:function(s,t){return s|t},vEJBk:function(s,t){return s<<t},hwFSQ:function(s,t){return s&t},ALldR:function(s,t){return s<<t},dIgKM:function(s,t){return s&t},wsJBc:function(s,t){return s&t},RaVjj:function(s,t){return s<t},gcvlI:function(s,t){return s>=t},DRjoo:function(s,t){return s!==t},OwrhX:r(529),fcpip:function(s,t){return s||t},AmOCf:function(s,t){return s||t},kNKKZ:function(s,t){return s!=t},CQwqb:"undefined",xGPCg:r(1329)+"3",QSRdK:function(s,t){return s+t},EJEUD:function(s,t){return s<t},dLCld:function(s,t){return s&t},syUxB:function(s,t){return s&t},XTCpR:function(s,t){return s!==t},IkOMG:function(s,t){return s-t},vXvjx:r(681),xrgga:r(1720),qujyQ:function(s,t){return s|t},dAdtU:function(s,t){return s|t},jzriA:function(s,t){return s<<t},HSKpt:function(s,t){return s&t},DujXz:function(s,t){return s&t},uDycf:function(s,t){return s+t},aUGFs:function(s,t){return s>t},SIvNp:function(s,t){return s<t},knzZy:function(s,t){return s&t},sYxAb:function(s,t){return s&t},CvCpo:function(s,t){return s!==t},nzBGz:r(1037),zoSnh:function(s,t){return s&t},QKxuM:function(s,t){return s|t},FjSPt:function(s,t){return s&t},tfJZm:function(s,t){return s|t},FdDEh:function(s,t){return s>>t},pgwzU:function(s,t){return s>>t},HqYag:function(s,t){return s-t},eUgxC:r(1428),SYHZR:function(s,t,n,o){return s(t,n,o)},sRxIU:function(s,t){return s instanceof t},zBOZn:function(s,t){return s instanceof t},KfLOx:"applicat"+r(1475),LWVeV:r(1478)+r(1770)+r(1347),grWhO:"ppe",ORCoB:function(s,t){return s!==t},tsNnb:r(1391),wVcXR:function(s,t){return s(t)},VTvRI:r(1728)+r(623),cmwXp:r(1170)+r(832)+r(762)+"P",XKaBu:function(s,t){return s!==t},DYSMk:r(898),cEjto:"wWjLo",VZxUs:function(s,t,n,o){return s(t,n,o)},beaBo:r(1131),MIihH:function(s,t){return s===t},BDtyK:r(1463),oqsOh:r(1173),OogSk:function(s,t){return s-t},eYrqu:r(1176),KlOqH:"AiChK",fqzyk:function(s,t){return s!==t},DynWq:r(909),wCIhX:function(s,t){return s||t},AGJGW:r(1146),JApvE:"online",FMSVT:r(688),XZgSU:function(s,t){return s!==t},kmaAQ:"YjOfK",VEDlH:r(1709),TqrBP:function(s,t){return s||t},ActHm:function(s,t){return s||t},gmSjy:function(s,t){return s||t},DRHNE:r(1094),TlDxf:function(s,t){return s||t},wjrqy:r(384),LorFO:r(770),XMMbz:function(s,t){return s===t},AEUDO:r(1112),luEdg:function(s,t){return s||t},UMdVy:function(s,t){return s||t},tHRzX:"init QoS"+r(706)+"d",fIwKg:function(s,t,n){return s(t,n)},yBdAw:r(637),DSQdG:r(1057)+"id",XYpDf:function(s,t){return s===t},PbjYt:"GRPLF",FewOW:r(647),HUtUh:function(s,t){return s(t)},DlgRl:function(s,t){return s===t},JbQAU:r(821),IvZST:function(s,t){return s!==t},vTiIn:r(1019),neTuu:r(1829),VeBMz:function(s,t){return s!==t},jkvRz:r(1079),kFWQV:function(s,t,n,o){return s(t,n,o)},LPkQr:function(s,t,n,o){return s(t,n,o)},Xovmy:r(1154),RhkMJ:r(1273),MNwzP:"received",aTrQr:function(s){return s()},QEzLK:function(s,t){return s(t)},aaJtP:function(s,t){return s(t)},kjxqf:function(s,t){return s instanceof t},PEjyJ:function(s,t){return s instanceof t},yuRVT:r(398)+r(1475)+r(1337)+r(1249),Okasl:"none_none",jNYrQ:"binary",hnBDa:function(s,t,n,o){return s(t,n,o)},CzcoC:function(s){return s()},uovJg:function(s,t){return s(t)},Tlysh:function(s,t){return s||t},KcyRP:function(s,t){return s===t},uoetm:"MSJGk",XKaXr:function(s,t){return s+t},Wnllz:"index ou"+r(914)+r(498),NdBDU:r(682),VgNli:r(976)+r(485)+"e",RpvaF:function(s,t){return s>=t},czzSB:function(s,t){return s&t},lQxCr:function(s,t,n,o){return s(t,n,o)},DsUcc:function(s,t){return s+t},ykkgg:function(s,t){return s+t},Gamjk:r(729)+"0",LNESK:function(s,t){return s+t},hcPmy:function(s,t){return s+t},dSkYo:r(1178)+"0",Qehpz:function(s,t){return s===t},LGGpU:r(815),GGplX:function(s,t){return s|t},dsqSP:function(s,t){return s<<t},QsUPy:function(s,t){return s+t},VRlPk:function(s,t){return s|t},YpugI:function(s,t){return s|t},sbpQt:function(s,t){return s<<t},YDwLS:function(s,t){return s+t},ZEmxU:function(s,t){return s&t},wJFsh:function(s,t){return s+t},hqrWL:function(s,t){return s+t},mSBxC:function(s,t){return s+t},uYBSB:function(s,t){return s>>>t},Dcfyo:function(s,t){return s+t},IYHLE:function(s,t){return s&t},SFHKE:function(s,t){return s+t},FkXYO:function(s,t){return s&t},ggwqZ:function(s,t){return s|t},qDEGF:function(s,t){return s+t},jRwyZ:function(s,t){return s+t},GAGbV:function(s,t){return s|t},RodfH:function(s,t){return s|t},TnyjF:function(s,t){return s|t},levue:function(s,t){return s+t},diRsW:function(s,t){return s+t},YqqJq:function(s,t){return s<<t},dCUht:function(s,t){return s===t},nmNSG:function(s,t){return s===t},iHFNr:function(s,t){return s>>>t},lfAXA:function(s,t){return s|t},pHPcm:function(s,t){return s&t},XimAQ:function(s,t){return s===t},TvgRf:r(929),dvdxp:r(1350)+r(707),pHKOS:"service",xHtMd:r(1179)+r(1237),RFYSc:r(1237),buXQL:"WLWnl",eHFgt:r(1300)+r(708),lBsWG:function(s,t,n){return s(t,n)},FOwFP:function(s,t,n){return s(t,n)},IrRVT:function(s,t){return s===t},gAQjn:r(1189),TJkII:r(868)+"e_success",NfVsI:function(s,t,n){return s(t,n)},xCWUe:function(s,t){return s!==t},NRPrZ:"dbRKj",NyvSf:r(755)+r(374),jflsp:r(863),nwfeZ:"allCurso"+r(1115),GTEaO:"ALL",iuXji:"INSTANT",TqkDD:r(1418),XVeiG:r(446),vpTjl:"NAugF",MJoLW:r(777)+"r",uiNyJ:r(1563),lVjqw:function(s,t){return s!==t},DJZBy:r(1722),VTmhy:function(s,t){return s===t},goXxU:function(s,t){return s-t},AHtxe:function(s,t){return s===t},osuux:function(s,t){return s|t},uXYQT:function(s,t){return s&t},kmeBM:r(811),Ieqem:function(s,t,n,o){return s(t,n,o)},FqMCs:function(s,t,n){return s(t,n)},PVFYt:function(s,t,n){return s(t,n)},ZZPoI:function(s,t,n,o){return s(t,n,o)},GWDwt:"x-msg-qos",UZmaU:r(426)+r(1623)+"e",yqkSm:function(s,t,n){return s(t,n)},YkHoi:"x-msg-cu"+r(1842)+"ue",AkxyQ:function(s,t){return s===t},BSraZ:r(1041),LYdfU:function(s,t){return s+t},CUqdN:function(s,t){return s===t},Bedjt:"WgkLY",dcMYi:r(669),OQEMA:function(s){return s()},udTsK:function(s){return s()},dxvSo:function(s,t){return s-t},QTuSn:function(s,t,n){return s(t,n)},iBcjT:function(s,t){return s===t},vWOeG:function(s,t){return s===t},EwVfU:function(s,t){return s&&t},SbzeB:function(s){return s()},KvYad:function(s){return s()},jQjdY:r(837),YEhWx:r(1409),WmaOK:r(365),HbPBN:"nOdjj",RyGeD:function(s,t){return s(t)},VrbXy:r(666),iliNN:"iogly",iarUf:function(s){return s()},RXWXF:function(s,t,n){return s(t,n)},uqGrJ:"bye",ONWCs:function(s,t,n){return s(t,n)},vEEhC:function(s,t){return s===t},ciQaY:r(1064),Rkxlk:r(631),EOKYv:function(s,t){return s!==t},GfrYU:r(1366),pvSXH:r(1624),rfSHG:function(s,t,n){return s(t,n)},gbkcL:function(s,t,n){return s(t,n)},qKvJy:r(810)+r(1834),iWNEg:r(927),xFspM:r(582),MPPoI:r(696)+r(655)+r(1028),sgrYf:r(696)+r(1565)+r(523)+r(561)+"ket constructor "+r(1639)+"ined",GNTmy:r(1816),CXgFm:function(s,t,n){return s(t,n)},HHpkM:"stop imm"+r(941)+r(1090)+"ct",vLBst:r(764),CAVUD:r(1646),wHAfR:r(1128),WGJjM:function(s,t){return s!==t},XBKbT:r(1591),RxdYl:"KXpLy",HoTrK:function(s,t){return s!==t},LJOvT:r(601),xojMm:r(696)+r(1513)+"ddID, de"+r(1048)+r(699),BlHnh:function(s,t){return s==t},LorFl:"web",hCYkl:r(381)+"0",tTpQG:function(s,t){return s!==t},FPcVz:r(1651),fuWqF:function(s,t){return s===t},EYWYT:r(1059),XDVgF:r(642),KOZIL:function(s,t,n){return s(t,n)},RojEZ:r(1458)+"t",zNmbV:function(s,t){return s>t},cVQBR:function(s,t){return s-t},jGyQm:function(s,t){return s!==t},MWFsg:r(345),PhUbK:r(817),ieXiS:function(s,t){return s(t)},ptmbN:r(1447)+">",VuSrq:function(s,t){return s*t},jeChR:function(s,t){return s>t},iopUk:function(s,t){return s===t},wJQNF:function(s,t,n){return s(t,n)},SkWbw:function(s,t){return s!==t},aEsqj:function(s,t,n){return s(t,n)},AFDdn:function(s,t){return s!==t},QsOgI:r(744),cOQEl:r(1204),iJdmr:"oEFnO",vMEXo:function(s,t,n){return s(t,n)},USxvY:function(s,t){return s===t},hiaNr:r(1626),lFFPb:r(1169)+" try rec"+r(1432)+"g",wprlH:r(960),yaLpp:function(s,t){return s(t)},VuMTl:function(s,t){return s(t)},fpYvp:r(1800),rilhw:"hGCiH",XwvZP:r(1353)+"2",sitIM:r(1806),VXtYz:function(s,t,n){return s(t,n)},KfKjn:function(s,t){return s===t},SETqO:r(879),UNbLB:r(621),ylpcV:function(s,t){return s<t},BHseK:function(s,t){return s-t},xoWiV:r(1258),wUWDu:r(812),LKyai:function(s,t){return s+t},kpKfX:r(425),qpptf:function(s,t){return s!==t},Dbpcr:r(503),ZJpBb:function(s,t){return s+t},XKkGy:function(s,t){return s===t},FaomK:"VMubP",NJQPJ:r(1641)+r(646),GocNV:"close, w"+r(1007)+r(692)+r(634)+"ed",zVBGE:function(s,t){return s===t},twIBb:r(1212)+"s already closed",uGOXf:function(s,t){return s==t},NRuYS:r(696)+r(1698)+r(1047)+r(467)+"a must b"+r(787)+r(340)+r(1084)+r(611),flsjh:function(s,t){return s==t},rfFoD:"number",XvBFs:function(s,t){return s(t)},VRjZr:function(s,t){return s||t},cgUyE:r(696)+r(1698)+r(1298)+r(707),svAuX:function(s,t){return s instanceof t},UZQrS:r(581),BNqIA:function(s,t){return s<t},bmiJJ:function(s,t){return s||t},jGvnY:function(s,t,n){return s(t,n)},TfrYu:"VkMKa",ZaIoi:r(1196)+"2",FiwPd:r(1346),vgqOZ:function(s,t,n){return s(t,n)},YpDvm:function(s,t){return s*t},EqpDe:function(s,t){return s*t},KsYsU:function(s,t){return s/t},fGsKU:function(s,t){return s===t},ThONc:r(1149),NhivL:function(s,t){return s!=t},nevLT:function(s,t){return s!=t},yYWTr:"Object",OZfCx:r(1548)+r(389)+r(829)+"pe",CLJhg:function(s,t){return s!=t},BFPOQ:function(s,t){return s!=t},DmJJH:function(s,t){return s===t},tKnpN:function(s,t){return s!=t},tJiWn:function(s,t,n){return s(t,n)}};Ee.r($),Ee.d($,{FWS:()=>L0,CustomErrorEvent:()=>ss,createCloseEvent:()=>_e,ReconnectEvent:()=>rs,createErrorEvent:()=>de,decodedFrame:()=>$r,createOpenEvent:()=>fs,CustomCloseEvent:()=>is,createReconnectEvent:()=>Qn,FrontierMessageEvent:()=>as,encodeFrame:()=>$n,createMessageEvent:()=>cs,OpenEvent:()=>xs,ErrorCode:()=>Fe,Event:()=>ot,MessageEvent:()=>os});let i="";function a(s=""){let t=r,n={uEOXW:function(o,c,l){return e[D(1213)](o,c,l)},cexKv:function(o,c,l){return e.XUCII(o,c,l)}};if(e[t(796)](e[t(1137)],t(962)))n.uEOXW(_0x7660fc,_0x1f81a4,18),n[t(1426)](_0x332a76,_0x4932a8,_0xcca45d);else{let c=""+Date[t(1802)](),l=i||(i=e[t(1103)](m,s)),h=Math[t(1763)]()[t(536)](16)[t(620)](-6);return e[t(1449)](e[t(1449)]("02"+c,l),h)}}function x(){let s=r;return e[s(1449)](1e4*Date[s(1802)](),Math[s(660)](1e4*Math[s(1763)]()))}function f(s){let t=r;return(Array(8)[t(1117)]("0")+e[t(1213)](parseInt,s,10)[t(536)](2))[t(620)](-8)}function u(s){let t=r;return e.yIYbf(e[t(1103)](Array,4)[t(1117)]("0"),e[t(354)](parseInt,s,2).toString(16))[t(620)](-4)}function g(s){let t=r,n={vCTae:function(o,c){return e[D(1010)](o,c)},ZrIMi:t(1515),TUsmq:e.uDVBR,rGgwp:function(o,c){return e[t(1536)](o,c)},pKuuP:e[t(859)],uEpnm:function(o,c){return e[t(1103)](o,c)}};if(e[t(1536)](e.yIOAF,e[t(662)])){let o=s.split(/\./)[t(1792)](h=>f(h)),c=[];return c[0]=e[t(357)](u,e[t(964)](o[0],o[1])),c[1]=u(e[t(408)](o[2],o[3])),[e[t(586)],e.qswPT,e.qswPT,e.qswPT,e[t(586)],e[t(1312)],c[0],c[1]].join("")}else{if(ZRZhfN.vCTae(_0x36732c,_0x5d87d3)){if(_0x26fc67===ZRZhfN[t(1377)])return _0xc8a5fe[t(1508)](_0x10e113);if(_0x4dc518===ZRZhfN[t(1445)])return _0x5e89a0[t(1228)+t(1620)]||_0x26688e[t(1508)](_0x1d6d3a);if(ZRZhfN[t(1317)](_0x4b5ada,ZRZhfN.pKuuP))return _0x529481["objectSt"+t(1620)][1]?void 0:_0x226552[t(1228)+t(883)](_0x238526[t(1228)+t(1620)][0])}return ZRZhfN[t(607)](_0x3480c6,_0x4926a7[_0x2d458a])}}function m(s){let t=r,n=/(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}/[t(1691)](s),o=/(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))/[t(1691)](s);return n?e[t(357)](g,s):o?e[t(1103)](_,s):e.jJYYx}function _(s){let t=r,n={OxTJG:function(w,b,k,N,L){return e.dVQcD(w,b,k,N,L)},wwysL:function(w,b){return e[D(1334)](w,b)},yLpUX:t(1248)+"eeded"},o="",c=[],l=0,h=0,p=!0,d=e[t(586)];if(e[t(347)](s[t(959)]("::"),-1)){let w=s.split("::");for(let k=0;e.bKZXR(k,w[t(1759)]);k++){let N=w[k];if(e.vxYAI(N.indexOf(":"),0)){let L=N[t(1700)](":");p&&(l=L[t(1759)]),h+=L[t(1759)];for(let A=0;e.bKZXR(A,L[t(1759)]);A++)if(L[A][t(1759)]!==4)if(t(478)!=="ywgNr"){let M=e[t(1572)](e[t(1672)](e[t(728)](e[t(841)](7,_0x1a2a47)<<18|e[t(605)](e[t(841)](63,_0x260a0a[_0x50747e++]),12),e[t(1774)](e[t(858)](63,_0x3f1293[_0x3f2cd9++]),6)),e[t(847)](63,_0x368957[_0x33f444++])),65536);_0x398b5b+=_0x2ec8a0[t(1483)+t(1162)](e[t(362)](55296,e.OIjHk(M,10))),_0x26c91e+=_0x12c003["fromChar"+t(1162)](56320+e[t(841)](1023,M))}else{let M=d[t(397)+"g"](0,e[t(1572)](4,L[A][t(1759)])),B=M[t(1160)](L[A]);c[t(751)](B)}else c[t(751)](L[A]);p=!1}else{if(e[t(1452)](e[t(986)],e[t(986)]))return _0x9108a2.offset>=_0x31c640[t(734)];if(e.pcfyd(4,N[t(1759)]))if(t(510)===e[t(415)]){let L=d[t(397)+"g"](0,4-N.length),A=L.concat(N);c[t(751)](A)}else{let L={HmbdV:function(A,M,B,j,le){let Se=t;return oTloou[Se(1181)](A,M,B,j,le)},RFgtl:function(A,M){let B=t;return oTloou[B(715)](A,M)}};_0x4e4585[t(719)+"Listener"](oTloou[t(1438)],A=>{let M=t;L[M(1564)](_0x3bfee8,_0xc6363f(_0x56e158[M(1087)]),A[M(1247)+"on"],A[M(987)+"on"],L.RFgtl(_0x5ced19,_0x34152c[M(1052)+M(1568)]))})}else c[t(751)](N);p&&(l+=1),h+=1,p=!1}}let b="";for(let k=0;k<e[t(857)](8,h);k++)b=b[t(1160)](d);for(let k=0;e[t(1824)](k,c[t(1759)]);k++)k===l&&(o=o.concat(b)),o=o[t(1160)](c[k]);return o}{let w=s[t(1700)](":");for(let b=0;b<w[t(1759)];b++){let k=w[b];if(e[t(1452)](4,w[b][t(1759)])){let N=d[t(397)+"g"](0,e[t(683)](4,w[b][t(1759)])),L=N[t(1160)](k);o=o[t(1160)](L)}else o=o.concat(k)}return o}}function v(s,t){let n=r,o=s[n(792)];e[n(612)](void 0,o)&&(e.srkCu(re,t,10),e[n(1213)](Te,t,o));let c=s[n(1165)];e[n(1821)](void 0,c)&&(e[n(1213)](re,t,18),Te(t,c))}function y(s){let t=r,n={};e:for(;!e[t(445)](ve,s);){let o=e.WbVaN(W,s);switch(o>>>3){case 0:break e;case 1:n[t(792)]=be(s,e.Bnrdz(W,s));break;case 2:n[t(1165)]=e.esDfC(be,s,e[t(1103)](W,s));break;default:oe(s,e.xqinM(7,o))}}if(n[t(792)]===void 0)throw new Error(e[t(1559)]);if(e[t(629)](void 0,n.value))throw new Error(e[t(1220)]);return n}function C(s){let t=r,n=e[t(1268)](F);return T(s,n),e[t(942)](ze,n)}function T(s,t){let n=r,o={GHAHX:function(B,j){return e.bKZXR(B,j)},floDt:function(B,j,le){return e.XUCII(B,j,le)},pVsgl:function(B,j,le,Se){return B(j,le,Se)},iUIuG:function(B,j){return e[D(964)](B,j)},nALex:function(B,j){return e[D(1553)](B,j)}},c=s.SeqID;e.pcfyd(void 0,c)&&(re(t,8),e.nbwNf(bt,t,c));let l=s[n(843)];e[n(675)](void 0,l)&&(e[n(1213)](re,t,16),e.srkCu(bt,t,l));let h=s[n(1265)];e[n(1780)](void 0,h)&&(re(t,24),e.nbwNf(bt,t,ce(h)));let p=s[n(1451)];if(e.HgZDS(void 0,p))if(e[n(796)](e[n(1030)],e[n(1030)]))re(t,32),bt(t,e[n(357)](ce,p));else{let B=0,j=[];for(;o[n(1324)](B,_0xc48cd9[n(772)+"th"]);){let{offset:le}=o[n(1071)](_0x9c6619,_0x156c35,B);B=le;let Se={cursor_name:"",cursor:0,service:0},{value:ar,offset:Et}=_0x213091(_0x2c508f,B);Se[n(1265)]=ar,B=Et;let{value:Ht,offset:kt}=o[n(1071)](_0x11e713,_0x461534,B);B=kt,Se["cursor_n"+n(1211)]=o[n(697)](_0x370222,_0x1d29e7,B,o[n(1533)](B,Ht)),B+=Ht;let{value:At,offset:N0}=o[n(1071)](_0x54f009,_0xf14233,B);Se[n(1612)]=At[n(457)](),B=N0,j[n(751)](Se)}return j}let d=s.headers;if(e.qysQk(void 0,d))for(let B of d){e[n(980)](re,t,42);let j=F();e[n(784)](v,B,j),re(t,j[n(734)]),e[n(1213)](Zn,t,j),e[n(942)](Y,j)}let w=s[n(1027)+n(797)];e[n(612)](void 0,w)&&(re(t,50),e[n(1202)](Te,t,w));let b=s[n(1473)+"ype"];e[n(1452)](void 0,b)&&(e.IOYiM(e[n(499)],e[n(499)])?(e[n(1191)](_0x4f3737,e.okVPA),this[n(1056)](n(868)+n(349)+"s",_0x1e091c),this.off(e.Mvtkb,_0x3fc76f)):(e[n(1819)](re,t,58),e[n(477)](Te,t,b)));let k=s[n(543)];e.CscaP(void 0,k)&&(e[n(1168)](re,t,66),e.QTgZJ(re,t,k[n(1759)]),e.EEKSq(Kt,t,k));let N=s[n(698)];e[n(1745)](void 0,N)&&(re(t,74),e[n(911)](Te,t,N));let L=s[n(1482)+n(1046)];if(e[n(1114)](void 0,L)){if(e[n(918)](e[n(895)],e.QyLUS))return _0x1fac1a.apply(HCMZES[n(1195)](_0x21eb8b,this),_0x386fde),HCMZES[n(1195)](_0x7e588c,_0xb2667.get(this));e.XUCII(re,t,82),e[n(407)](Te,t,L)}let A=s[n(981)];e[n(1108)](void 0,A)&&(e[n(1168)](re,t,90),e[n(871)](Te,t,A));let M=s[n(369)+"e"];M!==void 0&&(e.GndmD(re,t,96),e[n(1471)](bt,t,e[n(587)](ce,M)))}function P(s){let t=r;return e[t(917)](R,e[t(1455)](De,s))}function R(s){let t=r,n={};e:for(;!e.CtHws(ve,s);){let o=e[t(1103)](W,s);switch(e[t(1349)](o,3)){case 0:break e;case 1:n[t(632)]=e[t(354)](Zr,s,!0);break;case 2:n[t(843)]=e[t(1213)](Zr,s,!0);break;case 3:n.service=e[t(1814)](W,s);break;case 4:n[t(1451)]=e.Ppmhl(W,s);break;case 5:{let c=e.WMFii(J,s);(n[t(602)]||(n[t(602)]=[]))[t(751)](e[t(554)](y,s)),s[t(734)]=c;break}case 6:n[t(1027)+t(797)]=e[t(1471)](be,s,e[t(823)](W,s));break;case 7:n[t(1473)+t(1271)]=e.WFhcW(be,s,e[t(400)](W,s));break;case 8:n[t(543)]=Ut(s,e[t(1334)](W,s));break;case 9:n[t(698)]=e[t(490)](be,s,W(s));break;case 10:n[t(1482)+t(1046)]=e.EEKSq(be,s,e[t(877)](W,s));break;case 11:n.msgID=e[t(430)](be,s,e.haWAt(W,s));break;case 12:n[t(369)+"e"]=W(s);break;default:e[t(975)](oe,s,e[t(847)](7,o))}}if(e[t(1536)](void 0,n[t(632)]))throw new Error(e[t(693)]);if(e[t(796)](void 0,n[t(843)]))throw new Error(e[t(449)]);if(e.DmSps(void 0,n[t(1265)]))throw new Error(t(534)+"required"+t(1246)+t(1265));if(e[t(1530)](void 0,n[t(1451)]))throw new Error(e[t(1818)]);return n}function J(s){let t=r,n=e.tHkoK(W,s),o=s.limit;return s[t(734)]=s[t(1727)]+n,o}function oe(s,t){let n=r;switch(t){case 0:for(;e[n(841)](128,e[n(1334)](X,s)););break;case 2:e.Jhwlh(ye,s,e.WKueF(W,s));break;case 5:e[n(1180)](ye,s,4);break;case 1:e[n(911)](ye,s,8);break;default:throw new Error(e[n(1419)]+t)}}function ce(s){return s|=0,{low:s,high:e.OIjHk(s,31),unsigned:e.gPkEt(s,0)}}let I=[];function F(){let s=r;if(s(1314)===e[s(738)]){let t=I[s(1811)]();return t?(t[s(1727)]=t[s(734)]=0,t):{bytes:new Uint8Array(64),offset:0,limit:0}}else try{this[s(997)]?.[s(833)](),this[s(997)]=void 0}catch(t){_0x320215[s(1239)](t)}}function Y(s){I[r(751)](s)}function De(s){return{bytes:s,offset:0,limit:s[r(1759)]}}function ze(s){let t=r,n=s[t(676)],o=s[t(734)];return n[t(1759)]===o?n:n[t(1733)](0,o)}function ye(s,t){let n=r;if(e.TapoJ(s[n(1727)],t)>s[n(734)])throw new Error(e[n(336)]);s[n(1727)]+=t}function ve(s){let t=r,n={eMZMu:e[t(745)],cBILR:e.idUiq};if(e[t(1638)]===e.SmKlq)return s[t(1727)]>=s.limit;this[t(1502)+"er"]&&_0x24b245[t(1072)+t(826)+t(1083)](n[t(848)],this[t(925)+t(1835)]),this[t(1502)+"er"]&&_0xa588b1[t(1072)+t(826)+t(1083)](n[t(1582)],this[t(925)+t(527)]),this[t(833)]()}function me(s,t){let n=r,o={KvNtB:function(c,l,h){return e[D(645)](c,l,h)}};if(e[n(1745)](e.ZEJVU,e.Hkexk)){let c=s[n(676)],l=s.offset,h=s.limit,p=e[n(964)](l,t);if(e[n(654)](p,c.length))if(e[n(1830)]("wzVKy",e.zsjmK)){let d=new Uint8Array(e[n(1544)](2,p));d[n(563)](c),s.bytes=d}else _0x2b033b&&this[n(1152)+n(1826)][n(486)+n(1130)+n(1454)](_0x1b942f);return s[n(1727)]=p,e[n(1643)](p,h)&&(s.limit=p),l}else return new _0x3a738e(c=>{let l=n;o[l(881)](_0x29c28b,c,this[l(1516)+"rvalValue"](_0x278067))})}function rt(s,t){let n=r,o=s[n(1727)];if(e.CCndu(e.TapoJ(o,t),s.limit))throw new Error(e[n(463)]);return s.offset+=t,o}function Ut(s,t){let n=r,o=e[n(784)](rt,s,t);return s[n(676)].subarray(o,o+t)}function Kt(s,t){let n=r;if(e[n(1821)](e[n(700)],"Bnzjz")){let o=e.SYVOv(me,s,t[n(1759)]);s[n(676)][n(563)](t,o)}else{if(this._options["disableA"+n(371)+n(1779)]||this[n(1070)+n(1093)])return;this["_handleR"+n(1045)]()}}function be(s,t){let n=r,o={bSFcD:function(w,b){return w&b},uuECc:function(w,b){return e[D(1306)](w,b)},OgdXY:e[n(606)],Vxczs:e[n(1791)]},c=rt(s,t),l=String[n(1483)+"Code"],h=s[n(676)],p="\uFFFD",d="";for(let w=0;e[n(1708)](w,t);w++){let b=h[e[n(1657)](w,c)],k,N,L,A;if((128&b)===0)d+=e[n(1103)](l,b);else if(e[n(538)](e[n(785)](224,b),192))e[n(484)](e[n(1125)](w,1),t)?d+=p:(k=h[e.fGUOX(e[n(399)](w,c),1)],e[n(1465)](e[n(1622)](192,k),128)?d+=p:(A=e.INVpv(31,b)<<6|e.INVpv(63,k),e[n(1660)](A,128)?d+=p:(d+=l(A),w++)));else if(e[n(1126)](e[n(969)](240,b),224))if(e[n(484)](e[n(1370)](w,2),t))d+=p;else if(k=h[e[n(362)](w+c,1)],N=h[e.awUkw(e[n(399)](w,c),2)],e[n(1177)](e[n(1538)](e[n(1672)](k,e[n(552)](N,8)),49344),32896))d+=p;else if(e.aUbHV(e[n(1571)],n(1781))){let M=o[n(360)](255,_0x17dfc3);_0x20a8c8(M,_0x35df04,_0x16955a+_0x4f6139),_0x343fb6>>>=8,_0x447285--}else A=e[n(1352)](e[n(600)](e[n(1484)](15,b)<<12,e[n(507)](63,k)<<6),63&N),e[n(1660)](A,2048)||e[n(856)](A,55296)&&A<=57343?d+=p:(d+=e[n(1191)](l,A),w+=2);else if(e[n(507)](248,b)==240)if(e[n(1790)](e[n(408)](w,3),t))d+=p;else if(e.uYKzY(n(573),e[n(1224)])){let{url:M}=_0x275f2e||{},B=_0x4c4b9d[n(1566)](M)?M:o[n(1629)](o[n(640)],typeof M)?[M]:[];_0x543966&&_0x53277a[n(339)](this[n(1665)],_0x312955),B&&B[n(1759)]?this[n(1132)+n(1330)]=new _0x3e0fc5(B,this._options.maxRetries):this["_endpoin"+n(1330)]?.[n(569)+n(920)+n(1693)](),this[n(364)+"sCounter"]?.["resetCou"+n(949)](this._options["pingLoss"+n(1036)]),this[n(1070)+n(1093)]=!1,this[n(1398)]&&this[n(1398)][n(1573)+"te"]!==this.CLOSED?this[n(1749)+n(653)](1e3,o[n(1742)],!0):(this[n(875)]=!0,this._connect())}else k=h[e[n(1611)](w,c)+1],N=h[e[n(1611)](w+c,2)],L=h[e[n(362)](e[n(408)](w,c),3)],e[n(564)](e.wpmTJ(e.MaXxG(k,N<<8),L<<16)&12632256,8421504)?d+=p:(A=e[n(1276)](e[n(728)](e.NXuMj((7&b)<<18,e[n(552)](e[n(1538)](63,k),12)),e[n(1774)](e[n(785)](63,N),6)),e[n(665)](63,L)),e[n(1299)](A,65536)||e[n(1797)](A,1114111)?d+=p:(A-=65536,d+=e[n(871)](l,(A>>10)+55296,e.fbLJR(e[n(1412)](1023,A),56320)),w+=3));else d+=p}return d}function Te(s,t){let n=r,o=t[n(1759)],c=0;for(let p=0;e[n(391)](p,o);p++){let d=t[n(1674)+"At"](p);d>=55296&&d<=56319&&e[n(1708)](e[n(1370)](p,1),o)&&(d=e[n(542)](e[n(552)](d,10),t[n(1674)+"At"](++p))-56613888),c+=e[n(984)](d,128)?1:e[n(1708)](d,2048)?2:d<65536?3:4}re(s,c);let l=e[n(645)](me,s,c),h=s[n(676)];for(let p=0;p<o;p++){let d=t[n(1674)+"At"](p);e[n(468)](d,55296)&&d<=56319&&e.SmynO(p,1)<o&&(d=e.soBEH(d,10)+t[n(1674)+"At"](++p)-56613888),e.eNXtT(d,128)?h[l++]=d:(e[n(1567)](d,2048)?h[l++]=e[n(1276)](e[n(507)](d>>6,31),192):(e[n(1183)](d,65536)?h[l++]=e[n(1199)](e.CrJbO(e.OrHqY(d,12),15),224):(h[l++]=e[n(1089)](e[n(1363)](e.OrHqY(d,18),7),240),h[l++]=e[n(1556)](e[n(1523)](d,12),63)|128),h[l++]=e.OVviH(e[n(1175)](d,6)&63,128)),h[l++]=e[n(1276)](63&d,128))}}function Zn(s,t){let n=r,o={Saezs:function(c,l,h){return e[D(1471)](c,l,h)},ImMZF:function(c,l){return c|l},EyHXT:function(c,l){return e[D(507)](c,l)}};if(e[n(612)](e[n(1569)],e.ZzSra))o.Saezs(_0x2a6dcf,_0x4d8897,o[n(1527)](o.EyHXT(127,_0x39a91d),128)),_0x111b0f>>>=7;else{let c=e[n(911)](me,s,t[n(734)]),l=s[n(676)],h=t[n(676)];for(let p=0,d=t.limit;e.oZfWj(p,d);p++)l[e[n(578)](p,c)]=h[p]}}function X(s){let t=r,n={OdSql:function(o,c){return e[D(1266)](o,c)},gsxOQ:function(o,c){return e[D(957)](o,c)},CkuEJ:function(o,c){return e[D(1349)](o,c)},zUOkJ:function(o,c){return e.WLIFX(o,c)}};return e[t(1274)]===e[t(1343)]?(_0x3c20c7[t(1682)](_0x3c1630)||(_0x585707=_0x65b08b[t(1098)+"er"](_0x51b4f6)),n[t(352)](this.unsigned,_0x5ee2f8.unsigned)&&n[t(846)](n.CkuEJ(this[t(443)],31),1)&&n[t(846)](n[t(709)](_0xec6d1d[t(443)],31),1)?!1:n.zUOkJ(this.high,_0x30a8fa[t(443)])&&n.gsxOQ(this[t(757)],_0x2354e8[t(757)])):s[t(676)][rt(s,1)]}function st(s,t){let n=r,o=e[n(1328)](me,s,1);s.bytes[o]=t}function W(s){let t=r,n=0,o=0,c;do c=e[t(1119)](X,s),n<32&&(o|=e[t(1490)](127,c)<<n),n+=7;while(e.mWSXs(128,c));return o}function re(s,t){let n=r;for(t>>>=0;e[n(484)](t,128);)e[n(784)](st,s,e[n(728)](e[n(1054)](127,t),128)),t>>>=7;e[n(1471)](st,s,t)}function Zr(s,t){let n=r,o=0,c=0,l=0,h;if(h=e[n(520)](X,s),o=127&h,128&h)if(e.UlLvl!==n(1269)){if(h=e[n(823)](X,s),o|=e.fZgHO(e.Desgd(127,h),7),e.yHYKm(128,h)&&(h=X(s),o|=(127&h)<<14,128&h&&(h=X(s),o|=e.YqWqN(e.rKsFx(127,h),21),e[n(847)](128,h)&&(h=e.jhsdP(X,s),c=127&h,e[n(1786)](128,h)&&(h=e[n(1713)](X,s),c|=e[n(552)](127&h,7),e.qzVdQ(128,h)&&(h=e[n(614)](X,s),c|=e.haUGk(127&h,14),128&h&&(h=e.fRjuR(X,s),c|=e[n(1685)](127&h,21),e[n(936)](128,h))))))))if(e[n(629)](e.fBlHp,"HZQAh"))h=e[n(1753)](X,s),l=e.ZSeSk(127,h),e[n(665)](128,h)&&(h=e[n(1012)](X,s),l|=e[n(1656)](e[n(785)](127,h),7));else return this[n(1398)]?this._ws[n(1549)+"ns"]:""}else _0x5ac942=e[n(1669)](_0x1edc75,_0x443c37),_0x1f90af|=e[n(552)](e[n(1793)](127,_0xb198cb),21),e.PuXPK(128,_0x5637f5)&&(_0x2a6d11=_0xae9780(_0x3d9f7e),_0x190abf=127&_0x4ccef5,e.MwXgd(128,_0x1bafd0)&&(_0x2600f7=e.UqlxA(_0x37a627,_0x2468cb),_0x3082fa|=e[n(1774)](e[n(1730)](127,_0x178f1d),7)));return{low:e[n(1495)](o,c<<28),high:e[n(487)](c>>>4,l<<24),unsigned:t}}function bt(s,t){let n=r,o=t.low>>>0,c=e[n(1349)](e[n(1089)](e.TQWmd(t[n(757)],28),t.high<<4),0),l=e[n(1349)](t.high,24),h=e[n(538)](0,l)?c===0?e[n(1688)](o,16384)?e[n(984)](o,128)?1:2:e.oZfWj(o,2097152)?3:4:e[n(955)](c,16384)?c<128?5:6:e[n(1183)](c,2097152)?7:8:e[n(409)](l,128)?9:10,p=e[n(995)](me,s,h),d=s[n(676)];switch(h){case 10:d[e[n(1026)](p,9)]=e[n(1815)](e[n(376)](l,7),1);case 9:d[e.rpUcR(p,8)]=h!==9?128|l:e[n(507)](127,l);case 8:d[p+7]=e[n(1470)](8,h)?e[n(1495)](e.dxiDY(c,21),128):e[n(1550)](c,21)&127;case 7:d[e.iyZWE(p,6)]=e[n(1114)](7,h)?e[n(728)](c>>>14,128):e[n(665)](e[n(1349)](c,14),127);case 6:d[e[n(1026)](p,5)]=e.iOVJN(6,h)?e[n(1001)](e[n(782)](c,7),128):c>>>7&127;case 5:d[p+4]=e.kYtMo(5,h)?e.yPiEP(128,c):127&c;case 4:d[p+3]=e.vTaOv(4,h)?o>>>21|128:e[n(785)](e[n(1462)](o,21),127);case 3:d[p+2]=h!==3?e[n(737)](e[n(1349)](o,14),128):e[n(1021)](e.bLtJF(o,14),127);case 2:d[p+1]=e[n(1108)](2,h)?e[n(487)](e.LQkUi(o,7),128):e.CLLTf(o>>>7,127);case 1:d[p]=e[n(341)](1,h)?128|o:127&o}}function $r(s){return e.MWcxQ(P,s)}function $n(s){return e[r(396)](C,s)}let Qr=65536,Ho=r(546),it=e[r(1284)](Qr,Qr),es=e.EqpDe(it,it),ts=e[r(1335)](es,2),qe=String[r(1522)+"e"][r(1674)+"At"];class z{constructor(t,n,o){let c=r;this[c(1682)]=!0,this[c(757)]=e[c(1495)](0,t),this[c(443)]=e.wpmTJ(0,n),this[c(1547)]=!!o}static[r(1682)](t){let n=r;return t&&e[n(1530)](!0,t[n(1682)])}static[r(1074)](t,n,o){return new z(t,n,o)}static[r(988)+"s"](t,n,o){let c=r;return o?z[c(988)+c(502)](t,n):z["fromByte"+c(1531)](t,n)}static[r(988)+r(502)](t,n){let o=r,c={gjwNl:e[o(1437)],gidjT:function(l,h,p){return e[o(1058)](l,h,p)},nftiG:e[o(649)]};if(e.HvHiP(e[o(1416)],e[o(1416)]))return new z(e[o(840)](e[o(1702)](t[0],e[o(1710)](t[1],8))|e[o(1656)](t[2],16),e[o(1685)](t[3],24)),e[o(1276)](e[o(487)](t[4]|e[o(1647)](t[5],8),t[6]<<16),e[o(552)](t[7],24)),n);{let l=_0x380e3d("error",{message:this[o(1526)+"rrorMess"+o(1460)](_0x2564d9)});this.emit(c.gjwNl,l);let h=c[o(1697)](_0x29942d,c.nftiG,{reason:this[o(1526)+"rrorMess"+o(1460)](_0x17d9e5)});this.emit(c[o(966)],h)}}static fromBytesBE(t,n){let o=r;return new z(e.lbukD(e[o(1352)](e[o(418)](e[o(1250)](t[4],24),t[5]<<16),t[6]<<8),t[7]),e[o(943)](e[o(1702)](t[0]<<24,e.jwqRE(t[1],16)),e.soBEH(t[2],8))|t[3],n)}static[r(1256)](t){let n=r;return e[n(1518)](t,Ho)?ns:new z(e[n(1080)](e[n(1696)](e[n(737)](e.StnYe(qe[n(656)](t,0),e[n(1685)](qe.call(t,1),8)),qe.call(t,2)<<16),e.ACwWm(qe.call(t,3),24)),0),(e[n(943)](qe[n(656)](t,4),e[n(799)](qe[n(656)](t,5),8))|e[n(1690)](qe[n(656)](t,6),16)|e[n(1014)](qe.call(t,7),24))>>>0,!0)}[r(769)](){let t=r;return String["fromChar"+t(1162)](e[t(989)](255,this[t(757)]),e[t(665)](e.sfBme(this.low,8),255),e.TQWmd(this[t(757)],16)&255,e[t(1245)](this[t(757)],24),e[t(1484)](255,this[t(443)]),e[t(1622)](e[t(1078)](this[t(443)],8),255),e[t(1305)](e[t(1422)](this[t(443)],16),255),e[t(1462)](this[t(443)],24))}static[r(1098)+"er"](t,n=!0){let o=r;if(e[o(1751)](isNaN,t))return n?Wo:ns;if(n){if(e[o(468)](t,es))return Go}else{if(e[o(1230)](t,-ts))return Jo;if(e[o(1808)](t,1)>=ts)return jo}return z[o(1074)](e[o(418)](e[o(1729)](t,it),0),e[o(728)](t/it,0),n)}[r(457)](){let t=r;return this[t(1547)]?e[t(1544)](e[t(1118)](this[t(443)],0),it)+(this[t(757)]>>>0):e[t(542)](e[t(1544)](this[t(443)],it),e[t(505)](this.low,0))}isZero(){let t=r;return e[t(1303)](0,this[t(443)])&&e[t(591)](0,this[t(757)])}[r(635)](t){let n=r;if(e[n(535)]!==n(1717)){let o=this[n(997)].getItem(this._prefix),c=_0x23a32a[n(1747)](o||"{}");return c[_0x276436]=void 0,this[n(997)][n(403)](this[n(1066)],_0x3fbfe6[n(638)+"y"](c))}else{z[n(1682)](t)||(t=z[n(1098)+"er"](t));let o=this[n(443)]>>>16,c=e[n(1556)](65535,this[n(443)]),l=this[n(757)]>>>16,h=65535&this[n(757)],p=t.high>>>16,d=e[n(1241)](65535,t[n(443)]),w=t[n(757)]>>>16,b=e.TFMDw(65535,t[n(757)]),k=0,N=0,L=0,A=0;return A+=e[n(1404)](h,b),L+=A>>>16,A&=65535,L+=l+w,N+=e.xclWt(L,16),L&=65535,N+=e[n(1657)](c,d),k+=e.fdpVF(N,16),N&=65535,k+=e[n(964)](o,p),k&=65535,z[n(1074)](e.xsbhT(e[n(624)](L,16),A),e[n(605)](k,16)|N,this[n(1547)])}}[r(1197)](t){let n=r;return z[n(1682)](t)||(t=z.fromNumber(t)),e.QJAVm(this[n(1547)],t.unsigned)&&e[n(957)](e[n(596)](this.high,31),1)&&e.qgqQF(t[n(443)]>>>31,1)?!1:e[n(629)](this.high,t[n(443)])&&e[n(1530)](this[n(757)],t[n(757)])}[r(1501)](){let t=r;return this[t(757)]===-1&&this[t(443)]===-1?z[t(1074)](0,0,this.unsigned):e.FbgCG(-1,this[t(757)])?z[t(1074)](0,e[t(1370)](this.high,1),this.unsigned):z[t(1074)](e.JDqzJ(this[t(757)],1),this[t(443)],this[t(1547)])}toBytes(t){return t?this.toBytesLE():this[r(1633)+"E"]()}toBytesLE(){let t=r,n=this.high,o=this.low;return[e.tybCm(255,o),e.INVpv(e[t(782)](o,8),255),e[t(1241)](e[t(1387)](o,16),255),e[t(1078)](o,24),255&n,e[t(1663)](e[t(1234)](n,8),255),e[t(677)](e[t(1078)](n,16),255),e[t(596)](n,24)]}toBytesBE(){let t=r;if(e.DOBWL(t(1795),e[t(1091)])){let n=!!this._options.enableQoS;if(!n)return{enabled:n,isQoSMessage:!1,isQoSAck:!1,isAckCleanupMessage:!1,ackMsgIds:[]};let o=e[t(1286)](_0x1ec6c7,_0x3c2a9d.message[t(602)],e.LwkMS,"2"),c=o&&e[t(1534)](_0x23b612,_0x31817e[t(1375)][t(602)],e[t(835)],"1"),l=o&&e[t(1102)](_0x236c72,_0xcd8163[t(1375)][t(602)],e[t(1148)],"1"),h=l?e[t(1168)](_0x53e2ed,_0x4ead29[t(1375)].headers,e[t(991)])?.split(",").filter(_0x1105ce)||[]:[];return{enabled:n,isQoSMessage:o,isQoSAck:c,isAckCleanupMessage:l,ackMsgIds:h}}else{let n=this[t(443)],o=this.low;return[n>>>24,e[t(1021)](e[t(1617)](n,16),255),e.LwGgX(e[t(1349)](n,8),255),e[t(765)](255,n),e[t(1349)](o,24),e[t(494)](o,16)&255,e[t(1663)](o>>>8,255),255&o]}}}let ns=new z(0,0,!1),Wo=new z(0,0,!0),jo=z[r(1074)](-1,2147483647,!1),Go=z.fromBits(-1,-1,!0),Jo=z.fromBits(0,-2147483648,!1);var Fe=(function(s){let t=r;if(e[t(1530)](t(1068),e[t(1008)]))return this[t(999)+"ndpointT"+t(678)+"t"]=1,this[t(1139)+"ndex"]++,this[t(1485)+"s"][this[t(1139)+t(1095)]];{let n=e[t(541)][t(1700)]("|"),o=0;for(;;){switch(n[o++]){case"0":s[s[e[t(1740)]]=5003]=e[t(1740)];continue;case"1":s[s[e.rpQXh]=5005]=e[t(370)];continue;case"2":return s;case"3":s[s[e[t(686)]]=5004]=e[t(686)];continue;case"4":s[s[e[t(438)]]=5001]=e.LDavT;continue;case"5":s[s[e[t(1782)]]=5002]=e[t(1782)];continue}break}}})({});class ot{constructor(t){let n=r;this[n(1497)]=t,this[n(978)]=null}}class rs extends ot{constructor(t,n){let o=r;super(t),this[o(1375)]=n&&n[o(1375)]||null}}class ss extends ot{constructor(t,n){let o=r,c=e[o(834)][o(1700)]("|"),l=0;for(;;){switch(c[l++]){case"0":this[o(1600)]=n&&n[o(1600)]||null;continue;case"1":this.filename=n&&n.filename||"";continue;case"2":this[o(926)]=n&&n[o(926)]||0;continue;case"3":this[o(1375)]=n&&n.message||"";continue;case"4":this[o(1150)]=n&&n[o(1150)]||0;continue;case"5":this[o(331)]=n&&n[o(331)]||5001;continue;case"6":super(t);continue}break}}}class is extends ot{constructor(t,n){let o=r,c=e[o(1187)][o(1700)]("|"),l=0;for(;;){switch(c[l++]){case"0":super(t);continue;case"1":this.code=n&&n[o(331)]||0;continue;case"2":this.wasClean=n&&n[o(1576)]||!1;continue;case"3":this[o(961)+"nnect"]=n&&n[o(961)+o(1684)]||!1;continue;case"4":this[o(623)]=n&&n[o(623)]||"";continue}break}}}class os extends ot{constructor(t,n){let o=r;e[o(1539)](e[o(1406)],e[o(1406)])?(_0x4974c4(_0x269ed0,32),e[o(714)](_0x3f20e4,_0x274de1,e.PnehC(_0x589f26,_0x3dd37b))):(super(t),this[o(903)]=n&&n.data||null)}}class as extends os{constructor(t,n){let o=r;e[o(1177)](e.BrmpL,e[o(908)])?(super(t),this[o(903)]=n&&n.data||null,this[o(1375)]=n&&n[o(1375)]||null):this[o(1056)](_0x237214,_0x31cb7c)}}class xs extends ot{constructor(t,n){let o=r,c={qfjlI:e[o(545)]};if(e[o(659)](e[o(1016)],e[o(1467)]))return _0x3bb81d[o(1239)](c[o(1554)],_0x5b4c8c,_0x2804ef,_0x2ba356),this[o(997)][o(563)]({cursor_name:_0x34c500,cursor:_0x1e8823,service:_0x5f5163});super(t),this[o(903)]=n&&n.data||null}}function de(s,{message:t,code:n,error:o}){return new ss(s,{message:t,code:n,error:o})}function _e(s,{code:t,reason:n,wasClean:o,willReconnect:c}){return new is(s,{code:t,reason:n,wasClean:o,willReconnect:c})}function cs(s,{data:t,message:n}){return new as(s,{data:t,message:n})}function fs(s,{data:t}){let n=r,o={shjMS:function(c){return c()},uzdBC:function(c){return e[D(1268)](c)}};if(e[n(1821)](e[n(1812)],e[n(1812)]))rikTvk[n(1081)](_0x5db2e0),rikTvk[n(355)](_0x9daf9a);else return new xs(s,{data:t})}function Qn(s,{message:t}){return new rs(s,{message:t})}class us{constructor(t,n){let o=r;this[o(1485)+"s"]=t,this[o(1714)+"es"]=n,this[o(1139)+o(1095)]=0,this["currentE"+o(1358)+o(678)+"t"]=0}[r(569)+"pointConfig"](){let t=r;this[t(1139)+t(1095)]=0,this.currentEndpointTriesCount=0}[r(1468)+"es"](){let t=r,n={QVRoy:function(o,c,l){return e[D(430)](o,c,l)}};e.uxxmr(e.TCfbN,e[t(773)])?(axavaS.QVRoy(_0x4817ca,_0x4adc8a,50),axavaS[t(1357)](_0x187d81,_0x22aa9c,_0x4eda83)):this[t(999)+t(1358)+t(678)+"t"]=0}getCurrentEndpoint(){let t=r;return this[t(1485)+"s"][this["currentI"+t(1095)]]}[r(358)+"ntEndpoi"+r(1601)+r(1723)](){let t=r;return this["currentE"+t(1358)+t(678)+"t"]}[r(922)+r(1322)+"es"](){let t=r;return!!(e[t(831)](this[t(1139)+t(1095)],this[t(1485)+"s"][t(1759)])||e.HvHiP(this[t(1139)+t(1095)],e[t(1572)](this[t(1485)+"s"][t(1759)],1))&&e[t(1799)](this["currentE"+t(1358)+t(678)+"t"],this.maxRetries))}[r(508)+r(1315)+r(361)+"hedMaxRe"+r(452)](){let t=r;return e.AfaZF(this.currentIndex,this.endpoints[t(1759)])?!0:e[t(1840)](this[t(999)+t(1358)+"riesCount"],this[t(1714)+"es"])}[r(836)+"ackupEnd"+r(1809)+r(1580)+r(1015)](){let t=r;return this[t(999)+t(1358)+t(678)+"t"]=1,this.currentIndex++,this[t(1485)+"s"][this[t(1139)+"ndex"]]}[r(358)+r(1368)+r(1560)+"ateCount"](){let t=r;return e.GgwlN(e.QCvrk,e.QCvrk)?(_0x18ee18[t(375)+"t8"]?_0x241519[t(375)+"t8"](_0x245df6,_0x4a20ec):_0x4ee4b3[_0x790ee6]=e[t(766)](255,_0x3d25a9),_0xc2da0c+1):(this[t(999)+"ndpointTriesCount"]++,this.getCurrentEndpoint())}}let at=(e.kNKKZ(e[r(923)],typeof globalThis)&&e.fGsKU(e[r(1192)],globalThis.constructor.name)||e[r(730)](e[r(923)],typeof window)&&e[r(562)](r(1149),window[r(558)+"tor"][r(1237)]))&&e[r(923)]!=typeof document,Je=e.nevLT(e[r(923)],typeof globalThis)&&(e.XYpDf(e[r(1254)],globalThis[r(558)+r(1395)][r(1237)])||e[r(1731)](e.OZfCx,globalThis[r(558)+r(1395)].name))&&e[r(730)](e[r(923)],typeof tt),St=(e.nevLT(e[r(923)],typeof globalThis)&&e[r(372)](e[r(1254)],globalThis[r(558)+r(1395)].name)||e[r(1126)](e[r(923)],typeof globalThis)||e[r(761)](e[r(923)],typeof globalThis)&&!!globalThis[r(454)+"Bridge"])&&e.nevLT(e[r(923)],typeof wx),Ct=e[r(851)](r(1147)+"d",typeof globalThis)&&(e[r(521)]===globalThis[r(558)+r(1395)].name||e[r(674)](r(1390)+r(663)+r(1424),globalThis["construc"+r(1395)].name)||e[r(994)](r(1440)+"orkerGlo"+r(1397),globalThis[r(558)+"tor"][r(1237)]))&&e[r(730)](e[r(923)],typeof self),Vo=e[r(1608)](e[r(923)],typeof globalThis)&&e[r(1038)](r(1385),globalThis[r(558)+r(1395)].name)&&e[r(1671)](r(1147)+"d",typeof global)&&e[r(1787)](e[r(1254)],global[r(558)+r(1395)].name)&&e[r(851)](e[r(923)],typeof process)&&!!process[r(702)];class er{constructor(){this._listeners={}}emit(t,...n){let o=r,c=this[o(566)+"rs"][t];if(c)c[o(620)]()[o(1838)](l=>l.fn.apply(l[o(576)],n));else if(e[o(1038)](e[o(1437)],t)&&!this[o(1396)]){let l=n[o(1759)]&&n[0];if(e.TElNw(l,Error))throw l;let h=new Error(e[o(516)]+(l?e[o(1111)](" (",l[o(1375)])+")":""));throw h[o(902)]=l,l}return this}[r(1056)](t,n){let o=r;if(t===void 0)this[o(566)+"rs"]={};else if(e.nygpZ(void 0,n))this[o(566)+"rs"][t]=null;else{let c=this._listeners[t];if(c)for(let l=0;e[o(409)](l,c.length);)e.uxxmr(c[l].fn,n)?c.splice(l,1):++l}return this}on(t,n,o){let c=r;return(this[c(566)+"rs"][t]||(this._listeners[t]=[]))[c(751)]({fn:n,ctx:o||this}),this}}class Yo extends er{[r(1526)+r(597)+r(1460)](t){let n=r;if(n(348)!==e[n(1323)])this[n(566)+"rs"]={};else return t[n(440)]||t[n(1430)]?(n(332)+" "+(t[n(440)]||"")+" code: "+(t[n(1430)]||""))[n(705)]():JSON[n(638)+"y"](t)}constructor(t,n,o){let c=r;super(),this._socket=null,St&&wx["connectS"+c(1599)]&&(this._socket=wx[c(668)+c(1599)]({url:t,protocols:n,header:o,fail:this["_createS"+c(1022)+c(1389)][c(753)](this),success:this["_createSocketSuc"+c(1009)+c(798)][c(753)](this)})),Je&&tt[c(668)+c(1599)]&&(this[c(633)]=tt[c(668)+"ocket"]({url:t,protocols:n,header:o,fail:this[c(820)+c(1022)+"lHandler"][c(753)](this),success:this["_createS"+c(509)+c(1009)+"ler"].bind(this)}))}[r(820)+"ocketSuc"+r(1009)+"ler"](){let t=r,n={QIeiG:function(o,c){return o(c)},DbKuy:function(o){return e.qjBzm(o)},sulOW:function(o,c){return e.HsLEc(o,c)},romyR:e[t(830)],nWqkU:e[t(933)]};e[t(674)]("KOkrp",t(866))?(this[t(875)]=!1,n[t(630)](_0x2e8eed,this[t(1625)+"ionTimeo"+t(1681)]),n[t(1823)](_0x3e9c74)):Promise[t(1841)]()[t(1172)](()=>{let o=t,c={MPjEv:function(l,h){return n[D(630)](l,h)}};if(n[o(416)](n[o(1706)],n[o(1504)]))return function(...l){let h=o;return _0x57f61d[h(1295)](lAWnbx[h(1741)](_0x164893,this),l),lAWnbx.MPjEv(_0x3101c0,_0x372023[h(1508)](this))};this._addWsListeners()})}[r(820)+r(1022)+r(1389)](t){let n=r,o={ftXpF:function(c,l,h){return e.kTlTA(c,l,h)},pNYym:e.gFzAs,YjjIr:n(833)};Promise[n(1841)]()[n(1172)](()=>{let c=n,l=o[c(844)](de,o[c(1378)],{message:this[c(1526)+"rrorMessage"](t)});this[c(1060)](c(1600),l);let h=_e(o[c(1184)],{reason:this["_formatE"+c(597)+"age"](t)});this.emit(c(833),h)})}["_addWsLi"+r(1086)](){let t=r,n={jnWNT:function(o,c,l){return o(c,l)},RLOGu:e[t(1614)],cwUwT:e.gFzAs};this[t(633)][t(853)](o=>{let c=t;this[c(1060)](c(1806),n.jnWNT(fs,"open",{...o,data:o[c(440)]||""}))}),this._socket.onClose(o=>{let c=t;this[c(1060)](e[c(649)],e.Jhwlh(_e,e[c(649)],{...o}))}),this[t(633)][t(488)+"e"](o=>{let c=t;this[c(1060)](n[c(367)],n[c(592)](cs,n[c(367)],{...o}))}),this[t(633)][t(774)](o=>{let c=t;this[c(1060)](n.cwUwT,de(n[c(392)],{...o,message:o[c(440)]||""}))})}[r(1687)](t){let n=r,o={TGXsD:e[n(1437)],tDNuZ:function(c,l,h){return e[n(995)](c,l,h)}};if(e[n(1699)]!==e.OgTBO)if(e.oqJZr(t,Uint8Array)){let c=t[n(1735)][n(620)](t[n(752)+"et"],t[n(772)+"th"]+t[n(752)+"et"]);this[n(633)]&&this._socket.send({data:c,fail:l=>{let h=n;this.emit(o[h(1609)],o[h(924)](de,h(1600),{message:this[h(1526)+h(597)+h(1460)](l)}))}})}else this[n(633)]&&this[n(633)][n(1687)]({data:t,fail:c=>{let l=n;this[l(1060)](o[l(1609)],de(o[l(1609)],{message:this[l(1526)+"rrorMess"+l(1460)](c)}))}});else this[n(1364)+n(912)](),this[n(1060)](n(868)+n(349)+"s",n(404)),this[n(1288)+"gTimeoutId"]=o[n(924)](_0x155b9c,this[n(616)].bind(this),_0x200fe1)}close(t,n){let o=r;this[o(633)]&&this[o(633)][o(833)]({code:t,reason:n})}[r(719)+r(1382)](t,n){let o=r;if(e.fKiBz("PptfI",e[o(1766)])){let c=_0x5e47cf[o(1759)]&&_0x8069c7[0];if(e[o(1010)](c,_0x411959))throw c;let l=new _0x127c00(e[o(383)](e.DRNzR,c?e[o(1370)](" ("+c.message,")"):""));throw l[o(902)]=c,c}else this.on(t,n)}removeEventListener(t,n){this[r(1056)](t,n)}get[r(1573)+"te"](){let t=r;return this[t(633)][t(1573)+"te"]}get binaryType(){let t=r;return this._socket[t(1198)+"pe"]}set binaryType(t){}get[r(780)](){return this._socket.url}get[r(1804)](){let t=r;return this[t(633)][t(1804)]}get extensions(){let t=r;return this[t(633)][t(1549)+"ns"]}get["buffered"+r(1309)](){let t=r;if(e[t(1477)](e[t(411)],e[t(411)]))_0x5d5d68=e[t(825)](e[t(1762)](e.hwFSQ(15,_0x29e715),12),e.ALldR(e.dIgKM(63,_0x568584),6))|e.wsJBc(63,_0x14edde),e.RaVjj(_0x55f614,2048)||e[t(1263)](_0x416bb3,55296)&&_0x1f7e9d<=57343?_0x267fbb+=_0x3ce8de:(_0x50d6d7+=e[t(917)](_0x17d22a,_0x3b0922),_0x191383+=2);else return 0}}function Xo(s,t){let n=r;if(t)return new t(s[n(780)],s[n(1804)]);if(e[n(421)](St,Je))return new Yo(s.url,s[n(1804)],s[n(602)]);if(e.AmOCf(at,Ct)&&e.kNKKZ(e[n(923)],typeof WebSocket)&&WebSocket)return new WebSocket(s[n(780)],s.protocols)}function Zo(s){let t=r,n=e[t(1261)][t(1700)]("|"),o=0;for(;;){switch(n[o++]){case"0":if(e[t(421)](at,Ct)&&e[t(1142)](e[t(923)],typeof WebSocket)&&WebSocket)return!0;continue;case"1":if(Je&&tt["connectS"+t(1599)])return!0;continue;case"2":if(St&&wx[t(668)+"ocket"])return!0;continue;case"3":return!1;case"4":if(s)return!0;continue}break}}function ds(s,t,n){let o=r,c=-1;async function l(h){let p=D;return e[p(1230)](h,c)?Promise[p(1217)](new Error(p(919)+p(910)+"ltiple times in process")):(c=h,e[p(796)](h,n.length)?Promise[p(1841)]():n[h].bind(s)(t,l.bind(null,e[p(968)](h,1))))}e[o(1669)](l,0)}function ls(s){let t=r,n=0,o=0;for(let c=0;e[t(984)](c,s[t(1759)]);++c)o=s.charCodeAt(c),e[t(1338)](o,128)?n+=1:o<2048?n+=2:e[t(930)](e[t(1654)](64512,o),55296)&&e[t(674)](e.syUxB(64512,s[t(1674)+"At"](c+1)),56320)?(++c,n+=4):n+=3;return n}function hs(s,t,n){let o=r;if(e[o(886)](e[o(1341)](n,t),1))return"";let c="";for(let l=t;l<n;)if(e[o(890)]===e.xrgga){if(e[o(350)](4,_0x561224[o(1759)])){let h=_0x706f4d[o(397)+"g"](0,4-_0x1daab1[o(1759)]),p=h[o(1160)](_0x41f963);_0x468939[o(751)](p)}else _0x32afd1[o(751)](_0x286271);_0x4d63d3&&(_0x373523+=1),_0x65245+=1,_0x466eac=!1}else{let h=s[l++];if(e.wxjBL(h,127))c+=String[o(1483)+o(1162)](h);else if(e[o(856)](h,192)&&e.sWfAg(h,224))c+=String[o(1483)+o(1162)](e[o(1774)](31&h,6)|63&s[l++]);else if(e[o(1790)](h,224)&&h<240)c+=String["fromChar"+o(1162)](e[o(756)](e.dAdtU(e[o(921)](e[o(1021)](15,h),12),e[o(1556)](63,s[l++])<<6),e[o(1490)](63,s[l++])));else if(e[o(1263)](h,240)){let p=e[o(487)](e[o(1001)](e[o(1618)](7,h)<<18,e[o(1414)](63&s[l++],12))|e[o(921)](e[o(1105)](63,s[l++]),6),e.DujXz(63,s[l++]))-65536;c+=String["fromChar"+o(1162)](55296+e[o(1523)](p,10)),c+=String[o(1483)+o(1162)](e[o(1803)](56320,e[o(936)](1023,p)))}}return c}function tr(s,t,n){let o=r,c={bPgBX:function(d,w){return e[D(967)](d,w)},dvNZv:function(d,w){return d+w},wvXXN:o(1272)+o(673)},l=n,h,p;for(let d=0;e[o(1688)](d,s[o(1759)]);++d)if(h=s[o(1674)+"At"](d),e[o(1606)](h,128))t[n++]=h;else if(e[o(1708)](h,2048))t[n++]=e[o(1738)](h>>6,192),t[n++]=e.lbukD(e.knzZy(63,h),128);else if(e.acDmb(e[o(491)](64512,h),55296)&&e.udvBf(e[o(701)](64512,p=s[o(1674)+"At"](d+1)),56320))if(e.CvCpo("ymQEC",e.nzBGz))h=e.YwILV(65536+(e[o(483)](1023,h)<<10),e.ZSeSk(1023,p)),++d,t[n++]=e[o(1696)](e[o(1175)](h,18),240),t[n++]=e[o(650)](h>>12,63)|128,t[n++]=e[o(1043)](e.FjSPt(h>>6,63),128),t[n++]=e.tfJZm(63&h,128);else{if(uWtszP[o(793)](uWtszP[o(1586)](_0x1eae80.offset,_0x2e5fcf),_0x38dfe2.limit))throw new _0x417c30(uWtszP[o(608)]);_0xeae87f[o(1727)]+=_0x1461cc}else t[n++]=e[o(1043)](e[o(758)](h,12),224),t[n++]=e[o(1001)](e[o(1538)](e.pgwzU(h,6),63),128),t[n++]=63&h|128;return e[o(1517)](n,l)}async function gs(s){let t=r;if(e.eUgxC!==e[t(1109)]){let n=this[t(997)][t(1631)](this[t(1066)]),o=_0x2b5f82[t(1747)](e[t(421)](n,"{}"));return _0x3b9c85[t(776)](o)}else{if(e.AfaZF(e[t(606)],typeof s)){let n=new Uint8Array(e.zeggV(ls,s));return e[t(932)](tr,s,n,0),n}return e[t(1692)](s,ArrayBuffer)?new Uint8Array(s):new Uint8Array(s[t(1735)],s[t(752)+"et"],s[t(772)+"th"])}}function $o(s){let t=r;try{return e.kNKKZ(e.pbpzJ,typeof s)&&(e[t(878)](s,ArrayBuffer)||s.buffer&&e[t(405)](s[t(1735)],ArrayBuffer))||e[t(606)]!=typeof s?"":(JSON.parse(s),e.KfLOx)}catch{return e.pbpzJ==typeof s?e[t(1433)]:""}}let Qo=(s,t)=>{let n=r;switch(s){case n(1743):case e[n(390)]:return{[n(433)+s]:1,"x-tt-env":t};default:return{}}};class e0{constructor(t){let n=r;this[n(1603)+n(1723)]=t,this.count=0}[r(1776)](){let t=r;this[t(1645)]++}[r(922)+"chMaxCount"](){let t=r;return this[t(1645)]>=this[t(1603)+t(1723)]}[r(1760)+"nter"](t=0){let n=r;this[n(1603)+"ount"]=t,this.count=0}}async function t0(s){let t=r,n={ICqQf:function(o,c){return e.ORCoB(o,c)},HwHGj:e[t(1578)],uxGub:function(o,c){return e.wVcXR(o,c)},sFHND:e.VTvRI,HMQdY:function(o,c){return e[t(1012)](o,c)},qXugA:t(1683),UXNEW:function(o,c){return e[t(408)](o,c)},VHAhm:t(915),iUpFk:e[t(1259)]};return new Promise(o=>{let c=t;if(!at)return n.HMQdY(o,n[c(1319)]);try{let l=document["createEl"+c(1313)](n[c(1772)]);window[c(448)+c(1257)]=h=>{let p=c;if(n.ICqQf(n.HwHGj,n.HwHGj))for(var d in _0x5f571b)_0x24a171.o(_0x87e225,d)&&!_0xf8cf48.o(_0x5879ed,d)&&_0x30a499.defineProperty(_0x5730c7,d,{enumerable:!0,get:_0x4b5499[d]});else document[p(1151)][p(1135)+p(1073)](l),window[p(448)+"JSONP"]=void 0,n[p(963)](o,h&&h.msg||n[p(1319)])},l[c(1497)]=c(739)+c(1557),l[c(589)]=n[c(1333)](s[c(1282)](/^ws/,n[c(854)]),n[c(1472)]);try{document[c(1151)].appendChild(l)}catch{document[c(1151)][c(1135)+c(1073)](l)}}catch{window[c(448)+c(1257)]=void 0,n[c(808)](o,n[c(1319)])}})}function Ue(s,t,n){let o=r;return!!s?.[o(497)](c=>c[o(792)]===t&&c[o(1165)]===n)}function xt(s,t){let n=r;return s?.[n(497)](o=>o[n(792)]===t)?.[n(1165)]}let nr=null;async function n0(){let s=r;return nr||(nr=Promise[s(1841)]()[s(1172)](Ee[s(753)](Ee,"idb"))),nr}class r0 extends er{constructor(t,n){let o=r;super(),this[o(480)]=t,this[o(657)]=n,this[o(997)]=void 0,this[o(441)+o(1670)]=null}async[r(560)](){await this._init()}async[r(1367)](){let t=r,n={uZlMC:function(o,c){return e[D(901)](o,c)},GrdyQ:e[t(1589)],Bxgyi:e[t(905)],oOUwK:function(o,c,l,h){return e[t(651)](o,c,l,h)}};if(e[t(1518)](e[t(1004)],e[t(1004)])){if(this[t(997)])return;if(this[t(441)+"mise"])return this[t(441)+t(1670)];try{if(e[t(1521)](e[t(474)],e[t(474)])){let o=this[t(480)],c=this[t(657)];this[t(441)+t(1670)]=(async()=>{let l=t,{openDB:h}=await n0();this._qosDB=await n[l(1301)](h,l(448)+"_"+o,1,{upgrade(p){let d=l;n.uZlMC(n[d(874)],n.Bxgyi)?p["createOb"+d(1209)+"e"](o,{keyPath:c}):_0x94940c[d(1239)](_0x40b6d0)}})})(),await this[t(441)+"mise"]}else{let o=this[t(997)][t(870)+t(1407)+"nc"](this._prefix),c=_0x71d92b[t(1747)](e[t(935)](o,"{}"));return _0x4960ae[t(776)](c)}}catch(o){console.log(o)}finally{this[t(441)+t(1670)]=null}}else throw this[t(1625)+t(492)]=!1,_0x46091a}async[r(1508)](t){let n=r;if(n(726)!==e[n(337)])try{return await this[n(1367)](),this[n(997)]?.[n(1508)](this[n(480)],t)}catch(o){console[n(1239)](o)}else return this["_endpoin"+n(1330)]?.[n(358)+n(1368)+n(1601)+n(1723)]()||0}async[r(563)](t,n){let o=r;return await this._init(),this[o(997)]?.[o(419)](this[o(480)],t)}async[r(746)](t){let n=r,o={ktxBZ:function(c,l){return e[D(556)](c,l)}};try{if(e.eYrqu===e[n(515)])return await this._init(),this._qosDB?.[n(514)](this[n(480)],t);{let c=_0x5e18a2[n(397)+"g"](0,yvmDYv.ktxBZ(4,_0x51f2d6[_0x43b7a1][n(1759)])),l=c[n(1160)](_0x43aa6b);_0x9fc45f=_0x5220cf[n(1160)](l)}}catch(c){e[n(1539)](e[n(1006)],n(680))?(++_0x3ca3fc,_0x32690f+=4):console.log(c)}}async[r(1441)](){let t=r;try{return await this._init(),this[t(997)]?.clear(this[t(480)])}catch(n){console[t(1239)](n)}}async[r(1456)](){let t=r;return await this[t(1367)](),this[t(997)]?.[t(525)+"ys"](this[t(480)])}async[r(1423)](){let t=r;return await this[t(1367)](),this[t(997)]?.[t(1423)](this[t(480)])}async closeDB(){let t=r;if(e[t(690)](e[t(813)],e[t(813)]))return t(448)+"_"+this[t(590)];try{this._qosDB?.[t(833)](),this[t(997)]=void 0}catch(n){console[t(1239)](n)}}get[r(459)](){let t=r;try{return!!this._qosDB}catch(n){if(e[t(1500)](e[t(1025)],t(1427)))return console[t(1239)](n),!1;{let o=this[t(997)][t(870)+"geInfoSync"](this[t(1066)]),c=_0x19a415[t(1747)](e.wCIhX(o,"{}"));return _0x1a5dc8[t(1456)](c)}}}}class s0{constructor(t,n){let o=r;e[o(685)](o(1668),e[o(1443)])?(this[o(590)]=t,this[o(469)]=n,this[o(997)]=localStorage):(this[o(1502)+"er"]&&_0x17efc3[o(1072)+"entListe"+o(1083)](e.JApvE,this["_handleO"+o(472)]),this._isBrowser&&_0x1f11d0[o(1072)+o(826)+o(1083)](e[o(636)],this[o(1597)+o(1769)]),this[o(1502)+"er"]&&_0x27ee80[o(1072)+o(826)+o(1083)]("pagehide",this[o(925)+"ageHide"]),this._isBrowser&&_0xc3b85e[o(1072)+o(826)+o(1083)](e[o(1403)],this[o(925)+o(527)]))}async[r(560)](){}get[r(1066)](){let t=r;if(e.VEDlH===t(1709))return"frontier_"+this[t(590)];this[t(1374)+t(1758)]=_0x132e16}async[r(1508)](t){let n=r,o=this[n(997)][n(1631)](this[n(1066)]);return JSON.parse(e.TqrBP(o,"{}"))[t]}async[r(563)](t,n){let o=r,c=this[o(997)][o(1631)](this[o(1066)]),l=JSON[o(1747)](e[o(790)](c,"{}"));return l[n||t[this[o(469)]]]=t,this[o(997)][o(403)](this[o(1066)],JSON[o(638)+"y"](l)),n||t[this[o(469)]]}async[r(746)](t){let n=r,o=this[n(997)][n(1631)](this[n(1066)]),c=JSON[n(1747)](e[n(421)](o,"{}"));return c[t]=void 0,this[n(997)].setItem(this[n(1066)],JSON[n(638)+"y"](c))}async[r(1441)](){let t=r;return this[t(997)][t(1441)]()}async[r(1456)](){let t=r,n=this[t(997)][t(1631)](this._prefix),o=JSON[t(1747)](e[t(1332)](n,"{}"));return Object.keys(o)}async[r(1423)](){let t=r,n=this[t(997)][t(1631)](this[t(1066)]),o=JSON[t(1747)](e[t(643)](n,"{}"));return Object.values(o)}[r(1429)](){return Promise[r(1841)]()}get[r(459)](){return!!this[r(997)]}}class i0{constructor(t,n){let o=r;this[o(590)]=t,this[o(469)]=n,this[o(997)]=Je?tt:St?wx:null}async[r(560)](){}get[r(1066)](){let t=r;return e.DOBWL(e.DRHNE,e[t(1294)])?"frontier_"+this[t(590)]:_0x38930a[t(676)][_0x228837(_0x5c2a03,1)]}async[r(1508)](t){let n=r,o=this._qosDB[n(870)+n(557)](this[n(1066)]);return JSON.parse(e[n(790)](o,"{}"))[t]}async[r(563)](t,n){let o=r,c=this[o(997)][o(870)+o(557)](this[o(1066)]),l=JSON.parse(e[o(1167)](c,"{}"));return l[n||t[this[o(469)]]]=t,this[o(997)][o(574)+o(557)](this[o(1066)],JSON[o(638)+"y"](l)),n||t[this[o(469)]]}async[r(746)](t){let n=r;if(e[n(648)]===e.LorFO)e[n(932)](_0x36e987,this,_0x1e0ce1,[_0x375f90,_0xbbbaa5,_0x2c20d5]);else{let o=this._qosDB[n(870)+n(557)](this[n(1066)]),c=JSON[n(1747)](o||"{}");return c[t]=void 0,this[n(997)][n(574)+n(557)](this[n(1066)],JSON[n(638)+"y"](c))}}async[r(1441)](){let t=r;return this[t(997)]["clearSto"+t(575)]()}async[r(1456)](){let t=r,n=this[t(997)][t(870)+"geInfoSync"](this[t(1066)]),o=JSON[t(1747)](e[t(1167)](n,"{}"));return Object.keys(o)}async[r(1423)](){let t=r,n=this._qosDB[t(870)+"geInfoSync"](this[t(1066)]),o=JSON[t(1747)](n||"{}");return Object[t(776)](o)}closeDB(){return Promise.resolve()}get isReady(){return!!this[r(997)]}}function ps(s,t){let n=r;if(e[n(610)](e.AEUDO,e[n(1251)])){if(Je||Je)return new i0(s,t);if(e[n(410)](at,Ct)&&e.kNKKZ(e[n(923)],typeof indexedDB))return new r0(s,t);if(e[n(504)](at,Ct)&&e[n(1142)](n(1147)+"d",typeof localStorage))return new s0(s,t);throw new Error(e.tHRzX)}else this[n(1665)][n(598)]&&_0x79261a[n(1239)][n(1295)](_0x380f0e,["FRONTIER>",..._0x2a1474])}class o0{constructor(){let t=r;this._intervalTimeoutId=null,this._interval=36e5,this[t(997)]=e[t(1157)](ps,e[t(894)],e.DSQdG)}async[r(1820)+r(1704)](){let t=r;if(e[t(1240)](e.PbjYt,e[t(1291)])){let n=e.qjBzm(_0x1f8a95);return e.esDfC(_0x25a84c,_0x1083d5,n),e.UwLTG(_0x2d7fbf,n)}else e[t(862)](clearInterval,this[t(1820)+"lTimeoutId"]),this[t(1820)+t(1236)+"Id"]=e[t(1058)](setInterval,()=>{this["flushExp"+t(1767)]()},this[t(1820)+"l"])}async[r(560)](){let t=r;await this._qosDB.openDB()[t(1172)](()=>{this[t(1820)+"lFlush"]()})}async[r(1351)+r(1767)](){let t=r;(await this[t(997)]?.[t(1423)]()||[]).filter(({timestamp:c})=>c<Date.now())[t(1838)](c=>{let l=t;this[l(997)]?.del(c[l(1057)+"id"])})}async[r(746)](t){let n=r,o={WzQdr:function(c,l){return c(l)}};if(e[n(1188)](e[n(1492)],"RjWOy"))return this._qosDB?.[n(746)](t);{let c=/(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}/[n(1691)](_0x211c6c),l=/(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))/[n(1691)](_0x39aad1);return c?_0x4a2f87(_0x1b8613):l?fgxXEj[n(1739)](_0x549c16,_0x4ccec4):n(667)+"0000000000000000"+n(667)}}async[r(563)](t,n){let o=r;if(e[o(748)](e[o(1577)],e.neTuu))return this._qosDB?.[o(563)]({message_id:t,timestamp:n});this[o(1060)](e[o(1437)],_0x151e69("error",{message:this["_formatE"+o(597)+o(1460)](_0x1825b9)}))}async[r(1508)](t){let n=r;return this[n(997)]?.[n(1508)](t)}async[r(1429)](){let t=r;e[t(396)](clearInterval,this[t(1820)+"lTimeoutId"]),await this[t(997)]?.[t(1429)]()}get[r(459)](){let t=r;if(e[t(584)](e[t(806)],"lXPoo"))return this._qosDB?.[t(459)];{let n=_0x17c33c[t(1375)][t(543)];n&&_0x13cc0e[t(379)+"rs"](n)}}}function rr(s){let t=r,n=!!this[t(1665)][t(1833)+"S"];if(!n)return{enabled:n,isQoSMessage:!1,isQoSAck:!1,isAckCleanupMessage:!1,ackMsgIds:[]};let o=Ue(s[t(1375)][t(602)],t(1100)+t(1464),"2"),c=o&&Ue(s[t(1375)].headers,e.AlrVY,"1"),l=o&&e[t(1584)](Ue,s[t(1375)][t(602)],t(1100)+t(869)+"k","1"),h=l?xt(s[t(1375)].headers,t(1100)+"er_ack_m"+t(1434))?.[t(1700)](",")[t(1653)](Boolean)||[]:[];return{enabled:n,isQoSMessage:o,isQoSAck:c,isAckCleanupMessage:l,ackMsgIds:h}}async function ms(){let s=r;return this[s(818)+s(1677)]||(this[s(818)+s(1677)]=new o0),this[s(818)+s(1677)][s(459)]||await this[s(818)+s(1677)][s(560)](),this[s(818)+"ger"]}async function a0(s,t){let n=r,{enableAutoAck:o}=this[n(1665)],c=Ue(s[n(1375)][n(602)],n(1219),"1"),l=e[n(750)](Ue,s[n(1375)].headers,"is_ack","1"),h=rr[n(656)](this,s);if(o&&c){let{SeqID:p,LogID:d,service:w,LogIDNew:b,method:k}=s.message;this._sendAck({SeqID:p,LogID:d,LogIDNew:b,service:w,method:k,headers:[{key:e[n(401)],value:"1"},{key:e.RhkMJ,value:e[n(1822)](b,"")},{key:n(425),value:"0"}]})}l&&!h.isQoSAck&&this[n(524)+n(1270)+n(993)](s),t()}async function x0(s,t){let n=r;this[n(455)](e[n(1244)],s[n(1375)]),e[n(1290)](t)}async function c0(s,t){let n=r,o=e[n(1024)]($r,await e[n(1161)](gs,s[n(903)]));try{if(e.kjxqf(o[n(543)],Uint8Array)){let c=this[n(1665)][n(1027)+n(797)]instanceof Object?{force:!!this._options[n(1027)+"ncoding"][n(974)],encoding:this[n(1665)][n(1027)+"ncoding"][n(1097)]?this[n(1665)][n(1027)+n(797)][n(1097)].replace(/\s/g,"")[n(1225)+n(1216)]():""}:{force:!1,encoding:this[n(1665)][n(1027)+n(797)]?this._options.payloadEncoding[n(1282)](/\s/g,"")["toLowerC"+n(1216)]():""},l=o[n(1027)+"ncoding"]?o[n(1027)+"ncoding"][n(1282)](/\s/g,"")[n(1225)+n(1216)]():"",h=e[n(771)](this._options[n(1473)+n(1271)],Object)?{force:!!this._options[n(1473)+n(1271)][n(974)],type:this[n(1665)]["payloadT"+n(1271)][n(1497)]?this[n(1665)][n(1473)+n(1271)][n(1497)].replace(/\s/g,"")[n(1225)+n(1216)]():""}:{force:!1,type:this._options.payloadType?this[n(1665)][n(1473)+n(1271)][n(1282)](/\s/g,"")["toLowerC"+n(1216)]():""},p=o["payloadT"+n(1271)]?o[n(1473)+"ype"].replace(/\s/g,"")[n(1225)+"ase"]():"",d=h[n(974)]?h[n(1497)]:p||h[n(1497)],w=c.force?c[n(1097)]:l||c[n(1097)],b=[n(1478)+n(1770)+n(1347),e[n(1013)],e[n(1138)],e[n(606)]],k=[e.Okasl,e[n(897)]];this._options[n(1355)+n(880)+"extPayload"]&&b[n(1512)](d)&&(!w||k[n(1512)](w))?o[n(822)+n(1235)]=e.hnBDa(hs,o[n(543)],0,o[n(543)][n(772)+"th"]):o[n(822)+"oad"]=""}else o[n(822)+n(1235)]=""}catch(c){o[n(822)+n(1235)]="",console[n(1239)](c)}s[n(1375)]=o,e[n(990)](t)}function f0(s,t,n){let o=r,c=e[o(1065)](n,8192),l=c>>>1,h=null,p=c;return function(d){let w=o;if(e[w(409)](d,1)||d>l)return e.PsEuR(s,d);p+d>c&&(h=e.uovJg(s,c),p=0);let b=t.call(h,p,p+=d);return 7&p&&(p=e[w(542)](e.ynbvu(7,p),1)),b}}let u0=4294967295;function d0(s,t,n){let o=r;return e[o(896)](e.uoetm,e.uoetm)?RangeError(e[o(1449)](e[o(625)](e[o(864)]+s,e[o(1410)]),e[o(643)](t,1))+" > "+n):((this[o(566)+"rs"][_0x1a4c90]||(this[o(566)+"rs"][_0x87ac0b]=[])).push({fn:_0x11682d,ctx:_0xa5c858||this}),this)}function l0(s,t,n){let o=r;if(e[o(1643)](n,u0))throw new Error(e[o(1127)]);let c=3;for(;e.RpvaF(c,0);){let l=e.czzSB(255,n);e[o(904)](ir,l,s,e[o(852)](t,c)),n>>>=8,c--}return e[o(968)](t,4)}function h0(s,t){let n=r,o=0,c=t,l=e[n(1208)](t,4);for(;e[n(1299)](c,l);){let{value:h,offset:p}=sr(s,c);c=p,o=o<<8>>>0,o+=h}return{value:o,offset:l}}function g0(s,t,n){let o=r,c=e.Gamjk[o(1700)]("|"),l=0;for(;;){switch(c[l++]){case"0":return e.LNESK(e[o(904)](tr,s,t,n),n);case"1":if(t[o(495)])return e[o(1370)](t.write(s,n),n);continue;case"2":if(s.length<40)return e[o(1657)](e[o(904)](tr,s,t,n),n);continue;case"3":if(!s)return n;continue;case"4":if(t[o(644)+"e"])return e.hcPmy(t[o(644)+"e"](s,n),n);continue}break}}function p0(s,t){let n=r,o={sCumg:e[n(627)]};if(e[n(1528)](e[n(353)],e[n(353)])){let c=new z(e[n(1405)](e[n(418)](e[n(842)](e[n(461)](s[t+4],24),e[n(461)](s[t+5],16)),e.YqWqN(s[e[n(1370)](t,6)],8)),s[e[n(1535)](t,7)]),e[n(1702)](e.VRlPk(e[n(1085)](e.EqnkC(s[t+0],24),e[n(1032)](s[e[n(599)](t,1)],16)),e.soBEH(s[e.DsUcc(t,2)],8)),s[e[n(599)](t,3)]),!0);return t+=8,{value:c,offset:t+8}}else{let c=o[n(1003)].split("|"),l=0;for(;;){switch(c[l++]){case"0":this[n(1625)]();continue;case"1":this[n(364)+n(1836)]?.[n(1760)+"nter"]();continue;case"2":this["_endpoin"+n(1330)]?.[n(569)+"pointCon"+n(1693)]();continue;case"3":this[n(1070)+n(1093)]=!1;continue;case"4":this[n(875)]=!0;continue}break}}}function m0(s,t,n){let o=r,c=s[o(757)],l=s[o(443)];return t[n]=e[o(1234)](l,24),t[e[o(1486)](n,1)]=e[o(861)](e.XrdOa(l,16),255),t[e.wJFsh(n,2)]=e[o(858)](l>>>8,255),t[e.hqrWL(n,3)]=255&l,t[e[o(1327)](n,4)]=e[o(1712)](c,24),t[e.LNESK(n,5)]=e[o(507)](e[o(977)](c,16),255),t[e[o(1703)](n,6)]=e.IYHLE(e[o(1712)](c,8),255),t[n+7]=e.IYHLE(255,c),n+=8,n}function sr(s,t){let n=r;return s[n(511)+"8"]?{value:s[n(511)+"8"](t),offset:e[n(964)](t,1)}:{value:e[n(650)](255,s[t]),offset:e.SFHKE(t,1)}}function ir(s,t,n){let o=r;return t.writeUint8?t[o(375)+"t8"](s,n):t[n]=e[o(732)](255,s),e[o(1562)](n,1)}let _0=function(s){return new Uint8Array(s)},w0=e[r(923)]!=typeof Buffer?Buffer[r(760)+"afe"]:e[r(1243)](f0,_0,Uint8Array[r(1522)+"e"][r(1733)]);(()=>{let s=r,t={rWTaK:function(n,o){return e.dCUht(n,o)},cCFqU:function(n,o){return e[D(1338)](n,o)},CAtKc:function(n,o){return e.nmNSG(n,o)},lWggL:function(n,o){return e[D(1595)](n,o)},UAzmi:function(n,o){return n|o},rRJwC:function(n,o){return e[D(842)](n,o)},vCFbd:function(n,o){return e[D(1032)](n,o)},ZGpeK:function(n,o){return e[D(1305)](n,o)},capFU:function(n,o){return e[D(1338)](n,o)},XxjeL:function(n,o){return e[D(907)](n,o)},EdiDK:function(n,o){return n&o},PdZBt:function(n,o){return e[D(1660)](n,o)},boQQn:function(n,o){return e.ExPtX(n,o)},QKGZq:function(n,o){return n|o},JdozZ:function(n,o){return e.pHPcm(n,o)},nKjbl:function(n,o){return e[D(1643)](n,o)},zrGtS:function(n,o){return n!==o},CmIkP:s(1425),mJgvB:function(n,o,c,l){return n(o,c,l)}};if(e[s(1020)](e[s(519)],e[s(519)])){let n=4294967295;return function(o,c,l=!0){let h=s;if(n=t.lWggL(127&o[c],0),t[h(1200)](o[c++],128))return{value:l?n:t[h(1214)](0,n),offset:c};if(n=t.rRJwC(n,t[h(1613)](t[h(1616)](127,o[c]),7))>>>0,t.capFU(o[c++],128))return{value:l?n:t[h(1143)](0,n),offset:c};if(n=t.rRJwC(n,t[h(754)](127,o[c])<<14)>>>0,t[h(1203)](o[c++],128))return{value:l?n:t[h(1143)](0,n),offset:c};if(n=t[h(540)](t.rRJwC(n,t[h(1827)](127,o[c])<<21),0),t[h(1203)](o[c++],128))return{value:l?n:t[h(604)](0,n),offset:c};if(n=t.lWggL(t.QKGZq(n,t[h(786)](15,o[c])<<28),0),o[c++]<128)return{value:l?n:t[h(604)](0,n),offset:c};if(t[h(342)](c+=5,o[h(1759)]))if(t[h(395)](t[h(1279)],t[h(1279)])){if(_0xf50b94===void 0)this[h(566)+"rs"]={};else if(itgpHJ.rWTaK(void 0,_0x2fc5cd))this[h(566)+"rs"][_0x538f95]=null;else{let p=this[h(566)+"rs"][_0x63af28];if(p)for(let d=0;itgpHJ.cCFqU(d,p[h(1759)]);)itgpHJ[h(615)](p[d].fn,_0x2099e8)?p.splice(d,1):++d}return this}else throw c=o[h(1759)],t.mJgvB(d0,c,10,o[h(1759)]);return{value:l?n:t[h(1143)](0,n),offset:c}}}else{let n=new _0x4e13cf(e[s(1393)](e[s(1696)](_0x1d48ea[e[s(710)](_0x1643e1,4)]<<24,e[s(1656)](_0x454e3f[e.fbLJR(_0x56fca4,5)],16))|e[s(799)](_0x320001[_0x1e6375+6],8),_0x162493[e.jRwyZ(_0x36dc86,7)]),e[s(1459)](e.RodfH(e[s(1585)](e[s(1762)](_0x5b36ad[e[s(380)](_0x41b7aa,0)],24),_0x5e7ab5[e[s(1360)](_0x3c1bb3,1)]<<16),e[s(1166)](_0x10a3d3[e[s(1771)](_0x2f5180,2)],8)),_0x2d7252[_0x3332fc+3]),!0);return _0x344746+=8,{value:n,offset:_0x816473+8}}})();let y0=16,or=32;function v0(s){let t=r,n=0,o={};for(let c=0;e[t(775)](c,s[t(1759)]);c++)o[s[c][t(672)+t(1211)]]=ls(s[c][t(672)+t(1211)]),n+=e[t(679)](14,o[s[c][t(672)+t(1211)]]);return[n,o]}function _s(s,t,n){let o=r,c={OielB:function(l,h,p,d){return l(h,p,d)},wDfsi:e.dvdxp,iYlbP:function(l,h,p,d){return e[D(1286)](l,h,p,d)},SnwHI:e[o(1575)],eVEuF:e.xHtMd,kdSwP:e[o(1658)],pzEld:function(l,h,p,d){return e[o(750)](l,h,p,d)}};if(e[o(819)]===o(431))return(e[o(807)](_0x49cb6f,4).join("0")+e[o(980)](_0x5c358c,_0x260b61,2)[o(536)](16)).slice(-4);{let[l,h]=e[o(1334)](v0,s),p=e[o(1119)](w0,l),d=0;return s[o(1838)](w=>{let b=o,k=(b(1133)+b(1705)+b(1588))[b(1700)]("|"),N=0;for(;;){switch(k[N++]){case"0":d=c[b(1383)](m0,z[b(1098)+"er"](w.cursor||t),p,d);continue;case"1":console[b(1239)](c.wDfsi,w,w.service);continue;case"2":console[b(1239)](b(824),d);continue;case"3":d=c[b(1140)](g0,w[b(672)+b(1211)],p,d);continue;case"4":console[b(1239)](c[b(1116)],d);continue;case"5":d=c.OielB(l0,p,d,w.service||0);continue;case"6":console.log(c[b(1356)],d);continue;case"7":console[b(1239)]("header",d);continue;case"8":d=c[b(1383)](ir,0,p,d);continue;case"9":console[b(1239)](c[b(1817)],d);continue;case"10":d=c.pzEld(ir,h[w[b(672)+b(1211)]],p,d);continue}break}}),{frameType:or,headers:[{key:e[o(1242)],value:n}],payload:p}}}function b0(s){let t=r,n=0,o=[];for(;e[t(409)](n,s[t(772)+"th"]);){let{offset:c}=e[t(928)](sr,s,n);n=c;let l={cursor_name:"",cursor:0,service:0},{value:h,offset:p}=e[t(406)](h0,s,n);l[t(1265)]=h,n=p;let{value:d,offset:w}=e[t(645)](sr,s,n);n=w,l[t(672)+t(1211)]=e.LPkQr(hs,s,n,n+d),n+=d;let{value:b,offset:k}=e.FOwFP(p0,s,n);l.cursor=b.toNumber(),n=k,o[t(751)](l)}return o}function S0(){let s=r;if(e.xCWUe(s(603),e.NRPrZ)){let{pingInterval:t,pingFrequency:n}=this[s(1665)];if((e[s(671)]("hi",_0x3d852d[s(903)])&&e[s(1342)]===n||s(582)===n)&&(this._clearPingTimer(),this[s(1060)](e[s(386)],e[s(1783)]),this[s(1288)+"gTimeoutId"]=e[s(622)](_0x16d6f3,this._ping[s(753)](this),t)),e[s(659)]("hi",_0x446d47[s(903)]))return;try{_0x5b6a88(this,_0x5c4bb2,[_0x4eb69,_0x3d743c,_0x105ccf,_0x2b858f,_0x2e0249,_0x1cbe5a])}catch(o){let c=e[s(911)](_0x28be6d,e.gFzAs,{message:o[s(1375)],code:_0x2d7397[s(971)+"ERROR"],error:o});this[s(524)+s(1223)+"ent"](c)}}else return{frameType:or,headers:[{key:e[s(1242)],value:e[s(1392)]}],payload:void 0}}class C0{constructor(t,n,o){let c=r;this[c(522)+"ameSpace"]=t,this[c(1374)+c(1758)]=n,this[c(1226)+c(1348)]=o,this[c(997)]=e[c(645)](ps,this[c(522)+"ameSpace"],c(672)+"ame")}async[r(560)](){await this._qosDB.openDB()}async getCursors(){let t=r,n={pfxRf:e[t(664)]};if(e[t(1264)](t(402),t(402)))return _0x1c3d23||(_0x183345=_0x1dc887[t(1841)]().then(_0x52b0d6[t(753)](_0x33868b,aCuyJm[t(447)]))),_0x3d0bfd;{if(!this[t(997)][t(459)])return;let o=this[t(1226)+"Strategy"],c=await this[t(997)][t(1423)]();switch(console[t(1239)](e[t(845)],c),o){case e.GTEaO:return c&&c.length?_s(c,0,this[t(1374)+t(1758)]):void 0;case e.iuXji:return;case e[t(475)]:return c&&c[t(1759)]?e[t(1584)](_s,c,0,this["_cursorF"+t(1758)]):S0()}}}async[r(563)](t,n,o){let c=r;return console[c(1239)](e[c(545)],t,n,o),this[c(997)].set({cursor_name:t,cursor:n,service:o})}async[r(379)+"rs"](t){let n=r,o={aSbhD:e[n(1437)]},c=e[n(862)](b0,t);for(let l of c)e[n(1188)](e.XVeiG,e[n(517)])?(this[n(1060)](o[n(1768)],_0x53980a),this[n(1396)]&&this[n(1396)](_0x47441a)):(console[n(1239)](e.MJoLW,c),await this[n(997)][n(563)](l))}async[r(1508)](t){let n=r;return(await this[n(997)][n(1508)](t))?.[n(1612)]}async[r(1429)](){let t=r;e.XKaBu(e[t(1558)],e[t(1558)])?(this[t(1603)+t(1723)]=_0x353d17,this[t(1645)]=0):await this[t(997)][t(1429)]()}[r(486)+r(1130)+r(1454)](t){let n=r;this[n(1374)+n(1758)]=t}get[r(459)](){let t=r;return this[t(997)][t(459)]}}let E0=r(1801)+r(363);async function ws(s){let t=r;if(!this[t(1665)].enableQoS)return null;let{aID:n,fpID:o,messageStrategy:c}=this[t(1665)],l=e[t(643)](s,E0);try{return e[t(970)](e[t(1159)],"jXNUU")?(this[t(1152)+t(1826)]?s&&this[t(1152)+t(1826)][t(486)+t(1130)+t(1454)](s):this[t(1152)+t(1826)]=new C0(o+"_"+n+"_"+l,l,c),this[t(1152)+"anager"][t(459)]||await this._cursorManager[t(560)](),this[t(1152)+t(1826)]):{bytes:_0x1c9728,offset:0,limit:_0x2dc26a[t(1759)]}}catch{return null}}async function k0(s,t){let n=r,o={EQWRT:function(c,l){return e[D(1744)](c,l)},DMklY:function(c,l){return e[D(888)](c,l)},KKYCp:function(c,l){return e.AHtxe(c,l)},OdAbj:function(c,l){return e[D(1605)](c,l)},UxjNc:function(c,l){return e[D(1551)](c,l)},EAQqv:function(c,l){return e[D(1411)](c,l)},RhVPp:function(c,l){return c>>l},CHeRI:function(c,l){return c|l}};if(e.kmeBM!==e[n(1044)])return!!(this.currentIndex>=this[n(1485)+"s"].length||uZTRku.EQWRT(this[n(1139)+n(1095)],uZTRku[n(417)](this[n(1485)+"s"][n(1759)],1))&&uZTRku[n(377)](this[n(999)+n(1358)+n(678)+"t"],this.maxRetries));{let c=Ue(s[n(1375)][n(602)],n(331),"-1"),l=e.Ieqem(Ue,s[n(1375)][n(602)],e.Xovmy,"1"),h=e[n(568)](xt,s.message[n(602)],n(1100)+n(1520)),p=e[n(807)](Number,e[n(1540)](xt,s[n(1375)].headers,"x_frontier_ttl"))||0,d=rr[n(656)](this,s),w=e[n(1627)](Ue,s.message[n(602)],e.GWDwt,"2"),b=xt(s[n(1375)][n(602)],e[n(1498)]),k=Number(e[n(453)](xt,s.message[n(602)],e[n(803)]));if(d[n(1666)])return t();let N=d[n(512)+n(1215)]?await ms.call(this):null;if(e[n(1141)](s[n(1375)][n(1265)],0)&&l&&!c||e[n(1840)](s[n(1375)].service,0)){if(h&&d[n(512)+n(1215)]&&N){if(!!!await N[n(1508)](h))if(e[n(781)](e[n(476)],e[n(476)]))this[n(524)+n(1756)+n(1673)](s),await N[n(563)](h,e.LYdfU(Date[n(1802)](),p));else return _0x550fe1&&uZTRku.KKYCp(!0,_0x2e5562[n(1682)]);return t()}if(w)if(e[n(1182)](e.Bedjt,e[n(1636)]))_0x4d32f4[_0x51c800++]=uZTRku[n(945)](_0x5b692b,12)|224,_0x44fc2c[_0x1461dd++]=uZTRku.UxjNc(uZTRku[n(940)](uZTRku[n(1320)](_0x3349d8,6),63),128),_0x3e7ae1[_0x471c35++]=uZTRku.CHeRI(uZTRku[n(940)](63,_0x6e467f),128);else{let L=await ws.call(this);if(!L)return this[n(524)+"hMessage"+n(1673)](s),e[n(1311)](t);let A=await L[n(1508)](b)??-1;if(A<k)this["_dispatc"+n(1756)+n(1673)](s),L[n(563)](b,k,s[n(1375)].service);else throw new Error(n(1506)+n(1796)+" cursor "+k+(n(1489)+"than loc"+n(594)+"r ")+A);return e[n(1311)](t)}return this[n(524)+n(1756)+n(1673)](s),t()}}}async function A0(s,t){let n=r,o=rr.call(this,s);if(!o[n(512)+n(1215)])return e[n(1311)](t);let c=await ms.call(this);if(o["isAckCle"+n(1546)+n(1460)]&&o[n(1593)+"s"].length)for(let l of o[n(1593)+"s"])await c[n(746)](l);e.udTsK(t)}async function D0(s,t){let n=r,o=e[n(434)](s[n(1375)][n(369)+"e"],y0),c=e[n(1218)](s[n(1375)].frameType,or);if(e[n(1110)](!o,!c))return e[n(1810)](t);let l=e.kTlTA(xt,s[n(1375)][n(602)],e.eHFgt);if(!l)return e[n(1493)](t);let h=await ws[n(656)](this,l);if(!h)return t();if(o)if(e[n(591)](e[n(1607)],e.YEhWx)){let p=_0x20dd0a.substring(0,e[n(1262)](4,_0x4e6c5c[_0x438cdf][n(1759)])),d=p[n(1160)](_0x4e833e[_0x388fa9]);_0x5b3b34.push(d)}else{let p=await h.getCursors(),d={frameType:p?.["frameType"],SeqID:z.fromNumber(this[n(1362)]++),LogID:z.fromNumber(this[n(1665)][n(436)+n(805)]()),service:9e3,method:5,headers:p?.headers,payload:p?.[n(543)]},w=e.zeggV(C,d);this[n(1398)]&&this[n(1398)].readyState&&this[n(1398)][n(1687)](w)}if(c)if(e[n(930)](e[n(1185)],e[n(1386)])){this[n(1364)+n(912)](),this["_pingPon"+n(1746)+"Id"]=e[n(733)](_0x267f9f,this[n(616)][n(753)](this),this[n(1665)][n(1049)+n(1721)]);return}else{let p=s[n(1375)][n(543)];p&&h[n(379)+"rs"](p)}}let T0=async function(s,t){let n=r;this._isInit=!1,e[n(1480)](clearTimeout,this[n(1625)+"ionTimeo"+n(1681)]),e[n(1268)](t)},P0=async function(s,t){let n=r;if(e[n(1452)](e.VrbXy,e[n(740)])){if(!this[n(1398)]||this._ws.readyState!==this[n(913)])return e[n(1499)](t);let{pingInterval:o}=this[n(1665)];this[n(1132)+n(1330)]?.["resetEnd"+n(920)+"fig"]();for(let l=0;e[n(1299)](l,this[n(1226)+n(892)][n(1759)]);l++){let h=this[n(1226)+n(892)][l];if(this[n(1398)][n(1573)+"te"]===this[n(913)]&&e[n(341)](null,h))this._ws&&this[n(1398)].send(h),this["_message"+n(892)][l]=null;else break}this[n(1226)+n(892)]=this[n(1226)+n(892)][n(1653)](l=>!!l),this[n(1288)+n(1746)+"Id"]=e[n(1193)](setTimeout,()=>this[n(616)](),o),this[n(524)+n(814)+"nt"](s),this[n(1502)+"er"]&&this[n(1398)]&&(this[n(1398)][n(1198)+"pe"]=this[n(334)+n(1271)]);let c=this[n(1132)+"tManager"]?.[n(358)+n(1368)+"nt"]();this[n(455)](n(518)+c+n(1035)),e[n(1499)](t)}else _0x1ee0cc.set(_0x5177c9,_0x4b52ea)},I0=async function(s,t){let n=r,o=this[n(1132)+n(1330)]?.getCurrentEndpoint();this[n(455)](n(518)+o),t()};class L0 extends er{constructor(t){let n=r,o={GBpwH:function(p,d,w,b){return p(d,w,b)},uuKlW:function(p,d,w){return p(d,w)},KGesZ:function(p,d){return e[D(445)](p,d)},YRuci:n(868)+n(349)+"s",UrVvY:e[n(526)],LOOqF:e[n(1292)],dEYRN:function(p,d){return e[n(434)](p,d)},geEru:e.gAQjn,kwhsQ:"auto",sZySk:e.okVPA,LdZkQ:function(p,d){return e[n(1088)](p,d)},dnmBI:e[n(595)],JytBW:e.pvSXH,xCFSI:function(p,d,w){return e[n(559)](p,d,w)},pQREa:e.gFzAs,NpEhX:function(p,d,w){return e[n(555)](p,d,w)},kIdNT:function(p,d,w){return e[n(804)](p,d,w)},IpVCA:function(p,d,w){return p(d,w)}};super(),this["_miniNav"+n(572)+n(1778)]=!0,this[n(1502)+"er"]=at,this[n(1719)]=Vo,this[n(1436)+"T"]=Je,this[n(1761)+"X"]=St,this[n(1637)+"r"]=Ct,this[n(1226)+n(892)]=[],this[n(1132)+"tManager"]=null,this[n(1070)+n(1093)]=!1,this[n(334)+n(1271)]=e[n(1510)],this[n(1625)+n(492)]=!1,this[n(1625)+n(1380)+n(1681)]=null,this[n(1494)+n(471)+n(713)]=null,this[n(1288)+n(1746)+"Id"]=null,this._seqId=0,this[n(875)]=!1,this._url="",this["_QoSMana"+n(1677)]=null,this[n(1152)+n(1826)]=null,this[n(364)+n(1836)]=null,this[n(1293)+"ls"]=e.iWNEg,this[n(1067)]=3,this[n(1153)+"NG"]=0,this[n(913)]=1,this[n(1144)]=2,this[n(1082)]=p=>{let d=n;try{o.GBpwH(ds,this,p,[T0,P0,I0])}catch(w){let b=o[d(482)](de,d(1600),{message:w[d(1375)],code:Fe[d(872)+"OR"],error:w});this[d(524)+d(1223)+d(1764)](b)}},this[n(1e3)+"ge"]=async p=>{let d=n,w={TTXhT:function(N,L){return o[D(1748)](N,L)},vtqDT:d(404),RtvCZ:o[d(1136)],pybJm:o[d(1124)],ZGXxf:o[d(747)],aRvwk:function(N,L,A){return o[d(482)](N,L,A)}},{pingInterval:b,pingFrequency:k}=this._options;if((p[d(903)]==="hi"&&o.dEYRN(o[d(588)],k)||o[d(1379)]===k)&&(this[d(1364)+d(912)](),this[d(1060)](d(868)+d(349)+"s",o[d(1285)]),this["_pingPon"+d(1746)+"Id"]=setTimeout(this[d(616)][d(753)](this),b)),p[d(903)]!=="hi")try{if(o[d(473)](o[d(1442)],o[d(1120)]))o[d(1061)](ds,this,p,[c0,a0,A0,D0,k0,x0]);else{this._clearPingTimer(),this[d(1288)+d(1746)+"Id"]=w[d(1075)](_0x20b10e,this[d(616)][d(753)](this),this[d(1665)]["pingInte"+d(1721)]);let N=()=>{let A=d;w.TTXhT(_0x566700,w[A(720)]),this[A(1056)](w.RtvCZ,N),this[A(1056)](w[A(1716)],L)},L=()=>{let A=d;w.TTXhT(_0x6ffff7,w[A(1029)]),this[A(1056)](w[A(1765)],N),this[A(1056)](w[A(1716)],L)};this.on(w[d(1765)],N),this.on("ping_onc"+d(1542)+"t",L),this[d(616)]()}}catch(N){let L=o.xCFSI(de,o[d(1069)],{message:N[d(1375)],code:Fe[d(971)+"ERROR"],error:N});this["_dispatc"+d(1223)+d(1764)](L)}},this[n(628)]=p=>{let d=n,w=this[d(1132)+d(1330)]?.[d(922)+"chMaxTries"](),b=this[d(1132)+d(1330)]?.[d(358)+d(1368)+"nt"]();if(w&&!p.message){let k=d(373)+b+(d(827)+d(1574)+"es reached");this[d(524)+d(1223)+d(1764)](o.NpEhX(de,d(1600),{message:k,code:Fe[d(1092)+"IES_ERROR"],error:p}));return}this[d(1398)]&&this[d(1398)][d(1573)+"te"]===this.OPEN&&this["_disconn"+d(653)](),this[d(524)+"hErrorEvent"](o.kIdNT(de,o[d(1069)],{message:p[d(1375)],code:Fe[d(867)+"RROR"],error:p}))},this[n(571)]=async p=>{let d=n;this[d(335)+"mer"](),this["_clearPi"+d(912)](),this[d(639)+d(1444)+"rs"](),this[d(1398)]=null,this[d(1625)+d(492)]=!1;let w=this[d(1132)+"tManager"]?.[d(922)+"chMaxTries"]();if(!w&&this["_navigat"+d(1757)]()&&!this["_readyCl"+d(1093)]){let b=this[d(1132)+d(1330)]?.["getCurre"+d(1368)+"nt"](),k=this[d(1665)][d(1458)+d(768)+d(641)](p.code,p[d(623)]);this[d(524)+"hCloseEv"+d(1764)](_e(d(833),{code:1006,reason:p[d(623)]||"connecti"+d(1252)+"d, unkno"+d(565)+d(1280)+d(1134)+b,willReconnect:k})),k&&this[d(1625)]();return}if(e.HgZDS(1e3,p[d(331)])&&this[d(1070)+"osed"]){this[d(524)+d(501)+d(1764)](_e(e[d(649)],{code:1e3,reason:e[d(1206)]})),this._endpointManager?.[d(569)+d(920)+d(1693)](),this._pingLossCounter?.[d(1760)+d(949)]();return}if(p[d(331)]!==1e3&&w){let b=this[d(1132)+"tManager"]?.[d(358)+"ntEndpoint"](),k=p[d(623)];k||(k=await e.WbBKA(t0,this._url)),k="connecti"+d(1252)+d(1439)+k+(d(1736)+d(778))+b+(d(850)+d(1400)+d(996)),this[d(524)+"hCloseEv"+d(1764)](_e(e[d(649)],{code:p[d(331)],reason:k}));let N=d(373)+b+(" fail, m"+d(1574)+"es reached");this[d(524)+d(1223)+d(1764)](e[d(1448)](de,d(1600),{message:N,code:Fe[d(1092)+d(946)+"R"]})),this[d(1132)+d(1330)]?.[d(569)+d(920)+d(1693)](),this[d(364)+d(1836)]?.[d(1760)+d(949)]();return}if(p[d(331)]!==1e3&&!p.reason)if(e.vEEhC(e[d(1034)],e[d(1034)])){let b=this["_endpoin"+d(1330)]?.[d(358)+d(1368)+"nt"]();this[d(524)+d(501)+d(1764)](_e(e[d(649)],{code:p[d(331)],reason:d(1777)+d(1252)+d(1316)+"wn reaso"+d(1280)+d(1134)+b})),this[d(1132)+d(1330)]?.[d(569)+d(920)+d(1693)](),this["_pingLos"+d(1836)]?.resetCounter();return}else{let b=o[d(1555)](_0x513b96,o[d(1069)],{message:_0x330a31[d(1375)],code:_0x34a3f9[d(872)+"OR"],error:_0x122020});this[d(524)+d(1223)+"ent"](b)}this["_dispatc"+d(501)+d(1764)](p),this[d(1132)+"tManager"]?.[d(569)+"pointConfig"](),this[d(364)+d(1836)]?.[d(1760)+"nter"]()},this.onclose=null,this[n(1396)]=null,this[n(1277)+"e"]=null,this[n(1453)]=null,this["onStartR"+n(1045)]=null,this[n(1171)+"eAck"]=null,this["onStopIm"+n(1680)+n(1678)+"ct"]=null,this[n(1597)+"nLine"]=this[n(1597)+n(472)][n(753)](this),this[n(1597)+"ffLine"]=this["_handleO"+n(1769)][n(753)](this),this[n(925)+n(1835)]=this[n(925)+n(1835)].bind(this),this["_handleP"+n(527)]=this[n(925)+n(527)][n(753)](this),this[n(1665)]={url:"",automaticOpen:!0,initReconnectInterval:1e3,maxReconnectInterval:1e4,reconnectIntervalGrowFactor:2,timeoutInterval:5e3,maxRetries:5,debug:!1,maxMessageQueueLength:1/0,service:0,logIDGenerator:x,headers:void 0,payloadEncoding:"",payloadType:"",fpID:"",deviceID:"",accessKey:"",ttwID:"",bddID:"",aID:"",disableAutoReconnect:!1,customParams:{},pingInterval:15e3,pingTimeoutInterval:4e3,pingFrequency:e[n(1145)],pingLossCount:2,enableTransformTextPayload:!1,logIDNewConfig:{enableAutoGenerateLogIDNew:!1,userIp:""},miniProgramParams:{customHttpHeader:{}},enableAutoAck:!1,reconnectInterceptor:()=>!0,enableQoS:!1,QoSLevel:2,messageStrategy:n(1418),env:{xTTEnv:"",xUseEnv:""},listenNetworkChanged:!0};let{url:c,ws:l}=t,h=Array[n(1566)](c)?c:e[n(606)]==typeof c?[c]:[];if(!h||h.length===0)throw new Error(e[n(1164)]);if(!e[n(396)](Zo,l))throw new Error(e.sgrYf);Object[n(339)](this[n(1665)],t),this[n(1132)+n(1330)]=new us(h,this[n(1665)][n(1714)+"es"]),this[n(364)+n(1836)]=new e0(this._options[n(1339)+n(1036)]),this[n(1665)][n(489)+"cOpen"]&&(this[n(875)]=!0,this._connect()),this[n(1665)][n(1640)+"tworkCha"+n(1278)]&&(this[n(1436)+"T"]||this[n(1761)+"X"]?this[n(658)+n(343)+"ange"]():this._isBrowser&&this[n(1634)+n(1307)+"Listener"]())}["_handleO"+r(472)](){let t=r,n={sZPBc:function(o,c,l){return e[D(1328)](o,c,l)}};if(e.GgwlN(e.GNTmy,e[t(1457)]))UqYTXm[t(783)](_0x1ee79c,_0x529e9b,58),_0x2937dd(_0x51fbd3,_0x77507c);else{if(this._options[t(937)+"utoReconnect"]||this[t(1070)+t(1093)])return;this[t(722)+"econnect"]()}}[r(1597)+r(1769)](){let t=r;this[t(906)+t(1446)+"t"]();let n=e.CXgFm(Qn,"reconnect",{message:e.HHpkM});this[t(577)+t(1680)+"yReconnect"]&&this[t(577)+"mediatel"+t(1678)+"ct"](n)}[r(1634)+r(1307)+"Listener"](){let t=r;this._isBrowser&&window[t(719)+t(1382)](e[t(689)],this[t(1597)+t(472)]),this[t(1502)+"er"]&&window[t(719)+t(1382)](e[t(636)],this[t(1597)+t(1769)]),this[t(1502)+"er"]&&window["addEvent"+t(1382)](e[t(745)],this["_handleP"+t(1835)]),this[t(1502)+"er"]&&window["addEvent"+t(1382)](e[t(1403)],this[t(925)+"ageShow"])}[r(1394)+r(1307)+"Listener"](){let t=r;this[t(1502)+"er"]&&window[t(1072)+t(826)+t(1083)](e[t(689)],this[t(1597)+"nLine"]),this[t(1502)+"er"]&&window[t(1072)+"entListe"+t(1083)](e[t(636)],this[t(1597)+t(1769)]),this[t(1502)+"er"]&&window[t(1072)+t(826)+t(1083)](t(1676),this[t(925)+t(1835)]),this[t(1502)+"er"]&&window["removeEventListe"+t(1083)](e[t(1403)],this[t(925)+"ageShow"])}[r(925)+"ageHide"](t){let n=r;!t[n(882)+"d"]&&(e[n(1552)](e.XBKbT,e[n(938)])?(this._isBrowser&&window[n(1072)+n(826)+n(1083)]("pagehide",this[n(925)+n(1835)]),this[n(1502)+"er"]&&window[n(1072)+n(826)+n(1083)](n(1594),this[n(925)+n(527)]),this[n(833)]()):(_0x57d556=_0x841352&&e[n(1775)]==_0x14dff1[n(1804)]?e.CAVUD:e.wHAfR,_0x21b578=_0xdab78e[n(1282)](/((^ws)|(^http))((?:[s]*:\/\/))/,""),_0x53ced0=/^wss(.*:\/\/)/[n(1691)](_0x127cce)?_0x407c6e:""+_0x4df08b+_0x579c47)),this[n(1502)+"er"]&&window[n(1072)+n(826)+n(1083)](e[n(689)],this[n(1597)+n(472)]),this[n(1502)+"er"]&&window[n(1072)+n(826)+"ner"](e[n(636)],this[n(1597)+n(1769)])}_handlePageShow(t){let n=r;t.persisted&&(this[n(549)+n(1757)]()&&(!this[n(1398)]||this[n(1398)][n(1573)+"te"]!==this[n(913)]||e[n(1715)](this._ws[n(1573)+"te"],this[n(1153)+"NG"]))&&this["_handleO"+n(472)](),this[n(1502)+"er"]&&window[n(719)+n(1382)](e[n(689)],this[n(1597)+n(472)]),this._isBrowser&&window[n(719)+"Listener"](e[n(636)],this[n(1597)+"ffLine"]))}async[r(1207)+r(1773)](t){let n=r,{fpID:o,deviceID:c,bddID:l,ttwID:h,accessKey:p,aID:d,customParams:w={},enableAutoAck:b,enableQoS:k,QoSLevel:N,env:L}=this[n(1665)],A,M,B;this[n(1502)+"er"]||this[n(1761)+"X"]||this._isMiniTT?(A=location&&e[n(1306)](e[n(1775)],location.protocol)?n(1646):e[n(1310)],M=t[n(1282)](/((^ws)|(^http))((?:[s]*:\/\/))/,""),B=/^wss(.*:\/\/)/[n(1691)](t)?t:""+A+M):(A=e.CAVUD,M=t[n(1282)](/(^http)((?:[s]*:\/\/))/,""),B=/(^ws)((?:[s]*:\/\/))/.test(M)?M:""+A+M);let j=l?n(718):h?e[n(1033)]:n(1635)+"d",le=l||h||c;if(!le||!j)throw new Error(e[n(767)]);let Se=e.BlHnh("function",typeof w)?await w():w,ar=L?e[n(1202)](Qo,L.xUseEnv,L[n(617)]):{},Et=Object[n(339)]({device_platform:e[n(1507)],version_code:e[n(1194)],access_key:p,fpid:o,aid:d,[j]:le,xsack:b?1:0,xaack:b?1:0,xsqos:k?1:0,qos_level:k?N:void 0,qos_sdk_version:2,...ar},Se),Ht=Object[n(1456)](Et).reduce((kt,At)=>Et[At]!==void 0?""+kt+(kt?"&":"?")+At+"="+Et[At]:kt,"");return B+n(1650)+Ht}async[r(1625)](){let t=r,n={hbqKX:function(o,c){return e[D(504)](o,c)}};if(e[t(1233)](e[t(1388)],t(1785))){if(this[t(1625)+t(492)]||this[t(1070)+t(1093)])return;this["_connect"+t(492)]=!0;try{if(e.fuWqF(e[t(684)],e[t(992)]))_0x5441dc[t(1239)](_0x416fb2);else{let o=this[t(1132)+t(1330)]?.[t(508)+t(1315)+t(361)+"hedMaxRetries"](),{timeoutInterval:c}=this[t(1665)];if(o){let h=this[t(1132)+t(1330)]?.[t(358)+t(1368)+"nt"](),p=this[t(1132)+t(1330)]?.[t(836)+"ackupEnd"+t(1809)+t(1580)+t(1015)](),d=this[t(1132)+t(1330)]?.[t(358)+t(1368)+t(1601)+t(1723)]();if(p){let w=t(373)+h+(t(551)+t(850)+t(1400)+t(900)+t(1570)+t(539)+t(1590))+p+(t(1707)+"y"),b=e[t(1675)](de,e[t(1437)],{message:w,code:Fe[t(1092)+t(946)+"R"]});this[t(455)](w),this[t(524)+t(1223)+t(1764)](b),this._url=await this[t(1207)+t(1773)](p),this._debug(t(373)+p+" "+d+" times"),this[t(639)+t(1444)+"rs"]()}else{let w=t(373)+h+(t(551)+t(850)+t(1400)+t(996));this._debug(w),this[t(524)+t(1223)+t(1764)](e[t(453)](de,t(1600),{message:w,code:Fe[t(1092)+t(946)+"R"]}));return}}else{let h=this[t(1132)+t(1330)]?.[t(358)+"ntEndpointAndUpdateCount"](),p=this._endpointManager?.[t(358)+t(1368)+t(1601)+"ount"]();this[t(1755)]=await this[t(1207)+t(1773)](e.AmOCf(h,"")),this[t(455)](t(373)+h+" "+p+t(464)),this[t(639)+"sListeners"]()}if(this[t(875)])this._isInit=!1;else{let h=Qn(e[t(548)],{message:t(1345)});this[t(423)+t(1045)]&&this[t(423)+t(1045)](h)}let l=this[t(1132)+t(1330)]?.["getCurre"+t(1368)+t(1601)+t(1723)]()||0;e[t(779)](l,1)&&await this._wait(e[t(388)](l,1)),this._debug(t(1777)+t(958)+this[t(1755)]+(t(876)+t(873))+this[t(1293)+"ls"]),this[t(1398)]=e[t(1213)](Xo,{url:this[t(1755)],protocols:[this[t(1293)+"ls"]],headers:this[t(1665)][t(1487)+t(1649)+"s"][t(346)+t(1222)]},this[t(1665)].ws),(this[t(1502)+"er"]||this._isWorker)&&this[t(1398)]&&(this[t(1398)][t(1198)+"pe"]=this[t(334)+t(1271)]),this["_addWsLi"+t(1086)](),this[t(1625)+t(1380)+t(1681)]=setTimeout(this[t(547)+"ut"][t(753)](this),c)}}catch(o){if(e[t(794)](e[t(1304)],t(345)))return _0xc9ffcc[_0x50f0aa]=_0x5b7068,!0;throw this[t(1625)+t(492)]=!1,o}}else{if(_0x50d2fd)return new _0x3be1d1(_0x1da702[t(780)],_0x23cbda.protocol);if(_0x1a9b78||_0x57f8b5)return new _0x1cbb2c(_0x40667b[t(780)],_0xb234ba[t(1804)],_0x96597a[t(602)]);if(mzumaJ[t(432)](_0x5a28e6,_0x2e0b30)&&t(1147)+"d"!=typeof _0x45cd41&&_0x15bcb6)return new _0x53ce3c(_0x27c72d[t(780)],_0x21280f[t(1804)+"s"])}}[r(335)+r(1163)](){let t=r;clearTimeout(this["_connect"+t(1380)+t(1681)]),this[t(1625)+t(1380)+t(1681)]=null}["_clearPi"+r(912)](){let t=r;if(t(439)!==e[t(1659)])e[t(570)](clearTimeout,this["_pingPon"+t(1746)+"Id"]),e[t(1455)](clearTimeout,this["_reconne"+t(471)+"tId"]),this["_pingPon"+t(1746)+"Id"]=null,this[t(1494)+"ctTimeoutId"]=null;else return t(448)+"_"+this._DBName}[r(455)](...t){let n=r;this[n(1665)][n(598)]&&console.log[n(1295)](console,[e[n(1359)],...t])}[r(1516)+"rvalValue"](t){let n=r,{initReconnectInterval:o,maxReconnectInterval:c,reconnectIntervalGrowFactor:l}=this[n(1665)],h=e[n(704)](o,Math[n(359)](l,t-1));return e[n(736)](h,c)?c:h}[r(616)](){let t=r;if(this[t(1398)]&&e[t(952)](this._ws.readyState,this.CONNECTING)){this[t(1364)+t(912)](),this[t(1288)+t(1746)+"Id"]=e[t(691)](setTimeout,this._ping[t(753)](this),this[t(1665)][t(1049)+"rval"]);return}if(!this[t(1398)]||e[t(1401)](this._ws[t(1573)+"te"],this.OPEN))return void this[t(722)+t(1045)]();this[t(1398)]&&this[t(1398)][t(1687)]("hi"),this[t(1494)+t(471)+t(713)]=e[t(1832)](setTimeout,this["_handleR"+t(1045)+t(479)][t(753)](this),this[t(1665)]["pingTime"+t(393)+t(950)])}[r(722)+"econnect"+r(479)](){let t=r;this[t(364)+t(1836)]?.[t(1776)](),this.emit(e[t(526)],e[t(1292)]),this[t(364)+t(1836)]?.[t(922)+t(1798)+"nt"]()?this[t(722)+t(1045)]():this[t(616)]()}[r(549)+r(1757)](){let t=r;return this[t(1436)+"T"]||this[t(1761)+"X"]?this[t(1063)+t(572)+t(1778)]:(this[t(1502)+"er"]||this[t(1637)+"r"])&&this._options[t(1640)+t(1326)+t(1278)]?navigator.onLine:!0}[r(722)+r(1045)](){let t=r;!this[t(549)+t(1757)]()||this["_readyCl"+t(1093)]||(this[t(1132)+t(1330)]?.["resetEnd"+t(920)+t(1693)](),this[t(364)+t(1836)]?.[t(1760)+"nter"](),this[t(1398)]?this[t(1749)+"ect"](1001,t(1040)+t(1055)+"reconnec"+t(394)+"ver",!0):this[t(1625)]())}[r(658)+r(343)+r(1002)](){let t=r;this[t(1436)+"T"]?tt[t(1655)+t(1361)+t(585)](({isConnected:n})=>{let o=t;if(e[o(1505)](e.QsOgI,e[o(1331)]))this[o(1063)+"igatorOnline"]=n,n?this[o(1597)+"nLine"]():this["_handleO"+o(1769)]();else return _0x3a4ef5.objectStoreNames||_0x3791ee.get(_0x5464b9)}):this[t(1761)+"X"]&&wx[t(1655)+t(1361)+"hange"](({isConnected:n})=>{let o=t;this[o(1063)+o(572)+o(1778)]=n,n?this[o(1597)+"nLine"]():this._handleOffLine()})}[r(1737)](t){let n=r;if(e[n(372)](e[n(717)],e[n(717)]))return new Promise(o=>{let c=n;e[c(901)](e[c(948)],"mGUol")?e[c(579)](setTimeout,o,this[c(1516)+c(1725)+"e"](t)):_0x2e2cfd.body["appendCh"+c(1073)](_0x10b108)});this[n(1232)+n(1086)]()}[r(1749)+r(653)](t=1e3,n="",o=!1){let c=r;this[c(1398)]&&this[c(906)+"WebSocket"](t,n,o)}[r(547)+"ut"](){let t=r,n=this[t(1132)+t(1330)]?.[t(358)+"ntEndpoint"]();this[t(455)](t(373)+n+t(551)),this[t(1749)+"ect"](1001,e[t(716)],!0)}_sendAck(t){let n=r;if(e[n(796)](e[n(1435)],"AnzAJ")){let o=e.yaLpp($n,t);this[n(1398)]&&this[n(1398)][n(1573)+"te"]===this[n(913)]&&(this._ws&&this._ws[n(1687)](o),this._debug(n(422),t))}else return _0x2612bf?this.toBytesLE():this.toBytesBE()}["_removeW"+r(1444)+"rs"](){let t=r,n={GkhbG:function(o,c){return e[D(583)](o,c)}};if(e[t(1369)]===e[t(1308)])return _0x48fe8d(NlKQLt[t(1587)](_0x31e2cd,_0x3c0f67));{let o=e[t(533)].split("|"),c=0;for(;;){switch(o[c++]){case"0":if(!this[t(1398)])return;continue;case"1":this[t(1398)][t(1072)+t(826)+t(1083)](e[t(1077)],this[t(1082)]);continue;case"2":this[t(1398)][t(1072)+t(826)+t(1083)](e[t(1437)],this[t(628)]);continue;case"3":this[t(1398)][t(1072)+t(826)+t(1083)](e[t(649)],this[t(571)]);continue;case"4":this._ws[t(1072)+"entListener"](e[t(1614)],this._onMessage);continue}break}}}["_addWsLi"+r(1086)](){let t=r;this[t(1398)]&&(this._ws.addEventListener("open",this[t(1082)]),this._ws[t(719)+t(1382)](e[t(649)],this[t(571)]),this._ws[t(719)+t(1382)](t(1375),this[t(1e3)+"ge"]),this[t(1398)][t(719)+"Listener"](t(1600),this[t(628)]))}[r(1107)+r(1122)](t=1e3,n=""){let o=r;try{this[o(1398)]&&this[o(1398)][o(833)](t,n)}catch{}}["_destroy"+r(1446)+"t"](t=1e3,n="",o=!1){let c=r,l={Yevbq:function(h,p){return h(p)},qVvfs:function(h,p){return e[D(1360)](h,p)}};if(this[c(1364)+c(912)](),this[c(335)+"mer"](),this[c(639)+c(1444)+"rs"](),this["_wsInsta"+c(1122)](1e3,n),this[c(1625)+"Lock"]=!1,o&&this[c(549)+c(1757)]()&&!this[c(1070)+c(1093)]){if(this[c(1132)+"tManager"]?.[c(922)+c(1322)+"es"]()){let p=this[c(1132)+"tManager"]?.[c(358)+"ntEndpoint"]();this[c(524)+c(501)+c(1764)](e[c(1592)](_e,e[c(649)],{code:1006,reason:"connect "+p+(c(551)+c(850)+c(1400)+c(996)),wasClean:!0}))}else if(e[c(338)](e[c(1101)],e[c(1101)])){let p=this[c(1665)][c(1458)+c(768)+"ptor"](t,n);this[c(524)+"hCloseEv"+c(1764)](e.dhuGJ(_e,e.SHqrb,{code:t,reason:n,wasClean:!0,willReconnect:p})),p&&this[c(1625)]()}else{let p=yndzmJ[c(1496)](_0x446344,_0xf95d4e),d=_0x383c41[c(734)];return _0x46b28f[c(734)]=yndzmJ.qVvfs(_0x5be52b[c(1727)],p),d}return}this[c(549)+"orOnline"]()||this[c(1070)+c(1093)]?this["_dispatchCloseEv"+c(1764)](_e(e[c(649)],{code:t,reason:e.uqGrJ})):this["_dispatc"+c(501)+c(1764)](e[c(568)](_e,e[c(649)],{code:1006,reason:c(1040)+"ay, netw"+c(855)+"ine"})),this[c(1398)]=null,this[c(1132)+c(1330)]?.["resetEnd"+c(920)+"fig"](),this[c(364)+c(1836)]?.resetCounter()}[r(524)+r(814)+"nt"](t){let n=r;this.emit(n(1806),t),this.onopen&&this[n(1453)](t)}[r(524)+r(1756)+"Event"](t){let n=r;this[n(1060)](e.OdtFP,t),this[n(1277)+"e"]&&this[n(1277)+"e"](t)}["_dispatc"+r(1270)+r(993)](t){let n=r;this[n(1060)](e[n(1726)],t),this[n(1171)+n(791)]&&this[n(1171)+n(791)](t)}["_dispatc"+r(1223)+"ent"](t){let n=r;this.emit(e[n(1437)],t),this.onerror&&this[n(1396)](t)}[r(524)+r(501)+"ent"](t){let n=r;this[n(1060)](e[n(649)],t),this[n(916)]&&this[n(916)](t)}get[r(1198)+"pe"](){let t=r;return this[t(1398)]?this._ws[t(1198)+"pe"]:this[t(334)+t(1271)]}set[r(1198)+"pe"](t){let n=r;this._binaryType=t,this[n(1398)]&&(this[n(1398)][n(1198)+"pe"]=t)}get[r(795)+"nt"](){let t=r;return this[t(1132)+t(1330)]?.[t(358)+"ntEndpoi"+t(1601)+t(1723)]()||0}get bufferedAmount(){let t=r;if(e.IrRVT(e[t(725)],e[t(1096)])){let n=_0x4b9e4c.split(":");for(let o=0;e.ylpcV(o,n.length);o++){let c=n[o];if(n[o][t(1759)]!==4){let l=_0x139558.substring(0,e.BHseK(4,n[o][t(1759)])),h=l[t(1160)](c);_0x450be7=_0x38eece[t(1160)](h)}else _0x437f7b=_0x2e8d2d.concat(c)}return _0x1872d2}else{let n=this[t(1226)+t(892)].reduce((o,c)=>(o+=c&&c[t(772)+"th"]||0,o),0);return e[t(1384)](n,this[t(1398)]?this[t(1398)][t(1839)+t(1309)]:0)}}get extensions(){let t=r;return this[t(1398)]?this._ws[t(1549)+"ns"]:""}get[r(1804)](){let t=r,n={rakjz:t(1154),tfiSK:e[t(1524)],arxBK:function(o,c){return e.TlDxf(o,c)},BusvD:e[t(1632)]};if(e[t(1689)](e[t(985)],"kskVp")){let{SeqID:o,LogID:c,service:l,LogIDNew:h,method:p}=_0x40ccd4[t(1375)];this[t(462)]({SeqID:o,LogID:c,LogIDNew:h,service:l,method:p,headers:[{key:GoaIRc[t(1466)],value:"1"},{key:GoaIRc[t(429)],value:GoaIRc[t(531)](h,"")},{key:GoaIRc[t(1201)],value:"0"}]})}else return this[t(1398)]?this[t(1398)][t(1804)]:""}get[r(1573)+"te"](){let t=r;return this[t(1398)]?this[t(1398)][t(1573)+"te"]:this[t(1665)][t(489)+t(731)]?this[t(1153)+"NG"]:this[t(1067)]}get[r(780)](){let t=r;return this._ws?this._ws[t(780)]:this[t(1755)]}[r(833)](t=1e3,n){let o=r;if(e[o(562)](e.FaomK,o(1413))){let c=e[o(1789)][o(1700)]("|"),l=0;for(;;){switch(c[l++]){case"0":this[o(1394)+o(1307)+o(1382)]();continue;case"1":if(!this._ws)return void this._debug(e[o(965)]);continue;case"2":this._QoSManager?.closeDB();continue;case"3":if(e[o(930)](this[o(1398)][o(1573)+"te"],this.CLOSED)||e[o(1731)](this._ws.readyState,this[o(1144)]))return void this[o(455)](e[o(802)]);continue;case"4":this[o(335)+o(1163)]();continue;case"5":this[o(906)+o(1446)+"t"](t,n);continue;case"6":this[o(1070)+o(1093)]=!0;continue;case"7":this["_clearPi"+o(912)]();continue}break}}else{let c={Pxydi:e[o(1437)],HcTkM:function(h,p,d){return e[o(804)](h,p,d)}},l=_0x3331f4[o(1735)][o(620)](_0x17ac89[o(752)+"et"],e.ZJpBb(_0x3bf8bd[o(772)+"th"],_0x11bf6b[o(752)+"et"]));this[o(633)]&&this[o(633)][o(1687)]({data:l,fail:h=>{let p=o;this[p(1060)](c[p(1053)],c[p(1543)](_0x16ca6b,c[p(1053)],{message:this[p(1526)+p(597)+p(1460)](h)}))}})}}async[r(1687)](t,n){let o=r;if(e[o(695)](null,t))throw new Error(e[o(412)]);e[o(944)](e.rfFoD,typeof t)&&(t=JSON.stringify(t)),e[o(1142)](e[o(606)],typeof t)&&!e[o(405)](t,ArrayBuffer)&&!(t.buffer&&e[o(405)](t[o(1735)],ArrayBuffer))&&(t=JSON.stringify(t));let c=await gs(t),l=e.XvBFs($o,t),{method:h=0,service:p=this._options[o(1265)],logID:d=this[o(1665)][o(436)+o(805)](),headers:w=this[o(1665)][o(602)],payloadEncoding:b=this._options[o(1027)+"ncoding"],payloadType:k=this[o(1665)][o(1473)+o(1271)],logIDNew:N=this[o(1665)][o(1537)+"Config"][o(1011)+"toGenera"+o(333)+"ew"]?a(this._options["logIDNew"+o(1420)][o(1648)]):""}=e[o(1662)](n,{});if(!p)throw new Error(e.cgUyE);let L={SeqID:z[o(1098)+"er"](this[o(1362)]++),LogID:z.fromNumber(d),service:p,method:h,headers:w,payloadEncoding:e.vHSkL(b,Object)?b.encoding?b[o(1097)]:"":b,payloadType:e[o(1229)](k,Object)?k[o(1497)]?k[o(1497)]:l:k||l,payload:c,LogIDNew:N},A=$n(L);return this[o(1398)]&&e.lLmgl(this._ws[o(1573)+"te"],this[o(913)])?(this[o(1398)]&&this[o(1398)][o(1687)](A),this[o(455)](e[o(1828)],L)):e.BNqIA(this[o(1226)+"Queue"][o(1759)],this[o(1665)][o(424)+o(1474)+o(1275)])?(this[o(1226)+o(892)][o(751)](A),this._debug(o(1794),L)):(this[o(1226)+o(892)].shift(),this[o(1226)+o(892)][o(751)](A)),{seqID:this[o(1362)],logID:d,logIDNew:N}}async reconnect(t){let n=r,{url:o}=e[n(1686)](t,{}),c=Array[n(1566)](o)?o:e[n(695)](e[n(606)],typeof o)?[o]:[];t&&Object[n(339)](this[n(1665)],t),c&&c[n(1759)]?this[n(1132)+"tManager"]=new us(c,this[n(1665)].maxRetries):this[n(1132)+n(1330)]?.["resetEndpointCon"+n(1693)](),this[n(364)+"sCounter"]?.["resetCou"+n(949)](this[n(1665)][n(1339)+"Count"]),this["_readyCl"+n(1093)]=!1,this._ws&&e[n(1233)](this[n(1398)][n(1573)+"te"],this[n(1067)])?this[n(1749)+n(653)](1e3,e[n(1791)],!0):(this[n(875)]=!0,this[n(1625)]())}async[r(1373)](){let t=r,n={VxeOF:function(o,c,l){return e[D(356)](o,c,l)},ObozI:"ping_onc"+t(349)+"s",idSsZ:e.Mvtkb};if(!this["_connect"+t(492)])if(t(884)===e.TfrYu){let o={HTlJI:function(c,l){return c(l)},iYqgO:n[t(800)],Azsvf:n[t(1421)]};return new _0xbd8bd((c,l)=>{let h=t;this[h(1364)+h(912)](),this[h(1288)+h(1746)+"Id"]=n[h(1051)](_0xca1ca8,this[h(616)].bind(this),this[h(1665)][h(1049)+"rval"]);let p=()=>{let w=h;o[w(1289)](c,w(404)),this[w(1056)](o[w(1503)],p),this[w(1056)](o[w(1417)],d)},d=()=>{let w=h;o[w(1289)](l,w(631)),this.off(o.iYqgO,p),this[w(1056)]("ping_onc"+w(1542)+"t",d)};this.on(n[h(800)],p),this.on(h(868)+h(1542)+"t",d),this[h(616)]()})}else{let o=e[t(619)][t(1700)]("|"),c=0;for(;;){switch(o[c++]){case"0":this[t(364)+"sCounter"]?.[t(1760)+t(949)]();continue;case"1":this["_endpoin"+t(1330)]?.resetEndpointConfig();continue;case"2":this._connect();continue;case"3":this[t(1070)+t(1093)]=!1;continue;case"4":this[t(875)]=!0;continue}break}}}[r(719)+"Listener"](t,n){this.on(t,n)}["dispatch"+r(1673)](t){let n=r,{type:o}=t;this[n(1060)](o,t)}[r(1072)+r(826)+r(1083)](t,n){this.off(t,n)}[r(618)](){let t=r,n={LIdRf:function(o,c){return e[D(1103)](o,c)},IjSfM:e.Rkxlk,FSQNI:t(868)+"e_timeout",SATTS:e[t(1354)],nckGw:e.okVPA,BNFDS:t(868)+"e_success",LVtSN:function(o,c,l){return e.vgqOZ(o,c,l)}};return new Promise((o,c)=>{let l=t,h={DFfQb:function(w,b){return w(b)},BEYBj:n[l(1227)],mopZi:function(w,b){return n[l(387)](w,b)},THRyk:n[l(1129)],pGmzJ:n[l(458)],cGFEf:n[l(1287)]};this["_clearPi"+l(912)](),this._pingPongTimeoutId=n.LVtSN(setTimeout,this[l(616)].bind(this),this[l(1665)][l(1049)+l(1721)]);let p=()=>{let w=l;h[w(626)]!==h[w(626)]?(_0x478874+=CvEcIn[w(513)](_0x587c8c,_0x12d025),_0xc382f4+=2):(h[w(442)](o,h[w(1372)]),this[w(1056)](h[w(1365)],p),this[w(1056)](h[w(450)],d))},d=()=>{let w=l;n[w(387)](c,n[w(973)]),this[w(1056)]("ping_once_success",p),this[w(1056)](n[w(1287)],d)};this.on(n.BNFDS,p),this.on(n[l(1287)],d),this._ping()})}}})(),Q.CustomCloseEvent=$[S(982)+S(553)],Q[S(1318)+"rorEvent"]=$["CustomEr"+S(1628)],Q[S(1221)+"e"]=$.ErrorCode,Q[S(1673)]=$[S(1673)],Q.FWS=$[S(1336)],Q[S(456)+S(413)+S(368)]=$[S(456)+S(413)+S(368)],Q[S(413)+S(368)]=$["MessageE"+S(368)],Q[S(865)+"t"]=$[S(865)+"t"],Q["Reconnec"+S(891)]=$[S(1813)+"tEvent"],Q[S(1583)+S(553)]=$[S(1583)+"oseEvent"],Q[S(1529)+S(1628)]=$["createEr"+S(1628)],Q[S(809)+S(1561)+"nt"]=$[S(809)+S(1561)+"nt"],Q[S(1619)+S(1469)]=$[S(1619)+S(1469)],Q[S(788)+S(951)+"vent"]=$["createRe"+S(951)+S(368)],Q[S(860)+S(1253)]=$[S(860)+S(1253)],Q["encodeFr"+S(1211)]=$[S(789)+S(1211)];for(_n in $)[S(982)+S(553),S(1318)+S(1628),"ErrorCode",S(1673),S(1336),S(456)+"MessageE"+S(368),S(413)+S(368),S(865)+"t",S(1813)+"tEvent",S(1583)+S(553),S(1529)+S(1628),S(809)+S(1561)+"nt",S(1619)+S(1469),S(788)+"connectE"+S(368),S(860)+S(1253),S(789)+S(1211)].indexOf(_n)===-1&&(Q[_n]=$[_n]);var _n;Object["definePr"+S(1754)](Q,S(1042)+"le",{value:!0})});var Re=ae((Xd,fi)=>{"use strict";var xi=["nodebuffer","arraybuffer","fragments"],ci=typeof Blob<"u";ci&&xi.push("blob");fi.exports={BINARY_TYPES:xi,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:ci,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var Nt=ae((Zd,En)=>{"use strict";var{EMPTY_BUFFER:gx}=Re(),mr=Buffer[Symbol.species];function px(r,e){if(r.length===0)return gx;if(r.length===1)return r[0];let i=Buffer.allocUnsafe(e),a=0;for(let x=0;x<r.length;x++){let f=r[x];i.set(f,a),a+=f.length}return a<e?new mr(i.buffer,i.byteOffset,a):i}function ui(r,e,i,a,x){for(let f=0;f<x;f++)i[a+f]=r[f]^e[f&3]}function di(r,e){for(let i=0;i<r.length;i++)r[i]^=e[i&3]}function mx(r){return r.length===r.buffer.byteLength?r.buffer:r.buffer.slice(r.byteOffset,r.byteOffset+r.length)}function _r(r){if(_r.readOnly=!0,Buffer.isBuffer(r))return r;let e;return r instanceof ArrayBuffer?e=new mr(r):ArrayBuffer.isView(r)?e=new mr(r.buffer,r.byteOffset,r.byteLength):(e=Buffer.from(r),_r.readOnly=!1),e}En.exports={concat:px,mask:ui,toArrayBuffer:mx,toBuffer:_r,unmask:di};if(!process.env.WS_NO_BUFFER_UTIL)try{let r=Z("bufferutil");En.exports.mask=function(e,i,a,x,f){f<48?ui(e,i,a,x,f):r.mask(e,i,a,x,f)},En.exports.unmask=function(e,i){e.length<32?di(e,i):r.unmask(e,i)}}catch{}});var gi=ae(($d,hi)=>{"use strict";var li=Symbol("kDone"),wr=Symbol("kRun"),yr=class{constructor(e){this[li]=()=>{this.pending--,this[wr]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[wr]()}[wr](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[li])}}};hi.exports=yr});var gt=ae((Qd,wi)=>{"use strict";var Rt=Z("zlib"),pi=Nt(),_x=gi(),{kStatusCode:mi}=Re(),yx=Buffer[Symbol.species],vx=Buffer.from([0,0,255,255]),An=Symbol("permessage-deflate"),Oe=Symbol("total-length"),lt=Symbol("callback"),We=Symbol("buffers"),ht=Symbol("error"),kn,vr=class{constructor(e){if(this._options=e||{},this._threshold=this._options.threshold!==void 0?this._options.threshold:1024,this._maxPayload=this._options.maxPayload|0,this._isServer=!!this._options.isServer,this._deflate=null,this._inflate=null,this.params=null,!kn){let i=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;kn=new _x(i)}}static get extensionName(){return"permessage-deflate"}offer(){let e={};return this._options.serverNoContextTakeover&&(e.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(e.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(e.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?e.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits==null&&(e.client_max_window_bits=!0),e}accept(e){return e=this.normalizeParams(e),this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){let e=this._deflate[lt];this._deflate.close(),this._deflate=null,e&&e(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(e){let i=this._options,a=e.find(x=>!(i.serverNoContextTakeover===!1&&x.server_no_context_takeover||x.server_max_window_bits&&(i.serverMaxWindowBits===!1||typeof i.serverMaxWindowBits=="number"&&i.serverMaxWindowBits>x.server_max_window_bits)||typeof i.clientMaxWindowBits=="number"&&!x.client_max_window_bits));if(!a)throw new Error("None of the extension offers can be accepted");return i.serverNoContextTakeover&&(a.server_no_context_takeover=!0),i.clientNoContextTakeover&&(a.client_no_context_takeover=!0),typeof i.serverMaxWindowBits=="number"&&(a.server_max_window_bits=i.serverMaxWindowBits),typeof i.clientMaxWindowBits=="number"?a.client_max_window_bits=i.clientMaxWindowBits:(a.client_max_window_bits===!0||i.clientMaxWindowBits===!1)&&delete a.client_max_window_bits,a}acceptAsClient(e){let i=e[0];if(this._options.clientNoContextTakeover===!1&&i.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(!i.client_max_window_bits)typeof this._options.clientMaxWindowBits=="number"&&(i.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits=="number"&&i.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"');return i}normalizeParams(e){return e.forEach(i=>{Object.keys(i).forEach(a=>{let x=i[a];if(x.length>1)throw new Error(`Parameter "${a}" must have only a single value`);if(x=x[0],a==="client_max_window_bits"){if(x!==!0){let f=+x;if(!Number.isInteger(f)||f<8||f>15)throw new TypeError(`Invalid value for parameter "${a}": ${x}`);x=f}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${a}": ${x}`)}else if(a==="server_max_window_bits"){let f=+x;if(!Number.isInteger(f)||f<8||f>15)throw new TypeError(`Invalid value for parameter "${a}": ${x}`);x=f}else if(a==="client_no_context_takeover"||a==="server_no_context_takeover"){if(x!==!0)throw new TypeError(`Invalid value for parameter "${a}": ${x}`)}else throw new Error(`Unknown parameter "${a}"`);i[a]=x})}),e}decompress(e,i,a){kn.add(x=>{this._decompress(e,i,(f,u)=>{x(),a(f,u)})})}compress(e,i,a){kn.add(x=>{this._compress(e,i,(f,u)=>{x(),a(f,u)})})}_decompress(e,i,a){let x=this._isServer?"client":"server";if(!this._inflate){let f=`${x}_max_window_bits`,u=typeof this.params[f]!="number"?Rt.Z_DEFAULT_WINDOWBITS:this.params[f];this._inflate=Rt.createInflateRaw({...this._options.zlibInflateOptions,windowBits:u}),this._inflate[An]=this,this._inflate[Oe]=0,this._inflate[We]=[],this._inflate.on("error",Sx),this._inflate.on("data",_i)}this._inflate[lt]=a,this._inflate.write(e),i&&this._inflate.write(vx),this._inflate.flush(()=>{let f=this._inflate[ht];if(f){this._inflate.close(),this._inflate=null,a(f);return}let u=pi.concat(this._inflate[We],this._inflate[Oe]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[Oe]=0,this._inflate[We]=[],i&&this.params[`${x}_no_context_takeover`]&&this._inflate.reset()),a(null,u)})}_compress(e,i,a){let x=this._isServer?"server":"client";if(!this._deflate){let f=`${x}_max_window_bits`,u=typeof this.params[f]!="number"?Rt.Z_DEFAULT_WINDOWBITS:this.params[f];this._deflate=Rt.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:u}),this._deflate[Oe]=0,this._deflate[We]=[],this._deflate.on("data",bx)}this._deflate[lt]=a,this._deflate.write(e),this._deflate.flush(Rt.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let f=pi.concat(this._deflate[We],this._deflate[Oe]);i&&(f=new yx(f.buffer,f.byteOffset,f.length-4)),this._deflate[lt]=null,this._deflate[Oe]=0,this._deflate[We]=[],i&&this.params[`${x}_no_context_takeover`]&&this._deflate.reset(),a(null,f)})}};wi.exports=vr;function bx(r){this[We].push(r),this[Oe]+=r.length}function _i(r){if(this[Oe]+=r.length,this[An]._maxPayload<1||this[Oe]<=this[An]._maxPayload){this[We].push(r);return}this[ht]=new RangeError("Max payload size exceeded"),this[ht].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[ht][mi]=1009,this.removeListener("data",_i),this.reset()}function Sx(r){if(this[An]._inflate=null,this[ht]){this[lt](this[ht]);return}r[mi]=1007,this[lt](r)}});var pt=ae((el,Dn)=>{"use strict";var{isUtf8:yi}=Z("buffer"),{hasBlob:Cx}=Re(),Ex=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function kx(r){return r>=1e3&&r<=1014&&r!==1004&&r!==1005&&r!==1006||r>=3e3&&r<=4999}function br(r){let e=r.length,i=0;for(;i<e;)if((r[i]&128)===0)i++;else if((r[i]&224)===192){if(i+1===e||(r[i+1]&192)!==128||(r[i]&254)===192)return!1;i+=2}else if((r[i]&240)===224){if(i+2>=e||(r[i+1]&192)!==128||(r[i+2]&192)!==128||r[i]===224&&(r[i+1]&224)===128||r[i]===237&&(r[i+1]&224)===160)return!1;i+=3}else if((r[i]&248)===240){if(i+3>=e||(r[i+1]&192)!==128||(r[i+2]&192)!==128||(r[i+3]&192)!==128||r[i]===240&&(r[i+1]&240)===128||r[i]===244&&r[i+1]>143||r[i]>244)return!1;i+=4}else return!1;return!0}function Ax(r){return Cx&&typeof r=="object"&&typeof r.arrayBuffer=="function"&&typeof r.type=="string"&&typeof r.stream=="function"&&(r[Symbol.toStringTag]==="Blob"||r[Symbol.toStringTag]==="File")}Dn.exports={isBlob:Ax,isValidStatusCode:kx,isValidUTF8:br,tokenChars:Ex};if(yi)Dn.exports.isValidUTF8=function(r){return r.length<24?br(r):yi(r)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let r=Z("utf-8-validate");Dn.exports.isValidUTF8=function(e){return e.length<32?br(e):r(e)}}catch{}});var Ar=ae((tl,Ai)=>{"use strict";var{Writable:Dx}=Z("stream"),vi=gt(),{BINARY_TYPES:Tx,EMPTY_BUFFER:bi,kStatusCode:Px,kWebSocket:Ix}=Re(),{concat:Sr,toArrayBuffer:Lx,unmask:Nx}=Nt(),{isValidStatusCode:Rx,isValidUTF8:Si}=pt(),Tn=Buffer[Symbol.species],ge=0,Ci=1,Ei=2,ki=3,Cr=4,Er=5,Pn=6,kr=class extends Dx{constructor(e={}){super(),this._allowSynchronousEvents=e.allowSynchronousEvents!==void 0?e.allowSynchronousEvents:!0,this._binaryType=e.binaryType||Tx[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxPayload=e.maxPayload|0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[Ix]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=ge}_write(e,i,a){if(this._opcode===8&&this._state==ge)return a();this._bufferedBytes+=e.length,this._buffers.push(e),this.startLoop(a)}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){let a=this._buffers[0];return this._buffers[0]=new Tn(a.buffer,a.byteOffset+e,a.length-e),new Tn(a.buffer,a.byteOffset,e)}let i=Buffer.allocUnsafe(e);do{let a=this._buffers[0],x=i.length-e;e>=a.length?i.set(this._buffers.shift(),x):(i.set(new Uint8Array(a.buffer,a.byteOffset,e),x),this._buffers[0]=new Tn(a.buffer,a.byteOffset+e,a.length-e)),e-=a.length}while(e>0);return i}startLoop(e){this._loop=!0;do switch(this._state){case ge:this.getInfo(e);break;case Ci:this.getPayloadLength16(e);break;case Ei:this.getPayloadLength64(e);break;case ki:this.getMask();break;case Cr:this.getData(e);break;case Er:case Pn:this._loop=!1;return}while(this._loop);this._errored||e()}getInfo(e){if(this._bufferedBytes<2){this._loop=!1;return}let i=this.consume(2);if((i[0]&48)!==0){let x=this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");e(x);return}let a=(i[0]&64)===64;if(a&&!this._extensions[vi.extensionName]){let x=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(x);return}if(this._fin=(i[0]&128)===128,this._opcode=i[0]&15,this._payloadLength=i[1]&127,this._opcode===0){if(a){let x=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(x);return}if(!this._fragmented){let x=this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");e(x);return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){let x=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");e(x);return}this._compressed=a}else if(this._opcode>7&&this._opcode<11){if(!this._fin){let x=this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");e(x);return}if(a){let x=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(x);return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){let x=this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");e(x);return}}else{let x=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");e(x);return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(i[1]&128)===128,this._isServer){if(!this._masked){let x=this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK");e(x);return}}else if(this._masked){let x=this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");e(x);return}this._payloadLength===126?this._state=Ci:this._payloadLength===127?this._state=Ei:this.haveLength(e)}getPayloadLength16(e){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(e)}getPayloadLength64(e){if(this._bufferedBytes<8){this._loop=!1;return}let i=this.consume(8),a=i.readUInt32BE(0);if(a>Math.pow(2,21)-1){let x=this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");e(x);return}this._payloadLength=a*Math.pow(2,32)+i.readUInt32BE(4),this.haveLength(e)}haveLength(e){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)){let i=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");e(i);return}this._masked?this._state=ki:this._state=Cr}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=Cr}getData(e){let i=bi;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}i=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0&&Nx(i,this._mask)}if(this._opcode>7){this.controlMessage(i,e);return}if(this._compressed){this._state=Er,this.decompress(i,e);return}i.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(i)),this.dataMessage(e)}decompress(e,i){this._extensions[vi.extensionName].decompress(e,this._fin,(x,f)=>{if(x)return i(x);if(f.length){if(this._messageLength+=f.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let u=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");i(u);return}this._fragments.push(f)}this.dataMessage(i),this._state===ge&&this.startLoop(i)})}dataMessage(e){if(!this._fin){this._state=ge;return}let i=this._messageLength,a=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let x;this._binaryType==="nodebuffer"?x=Sr(a,i):this._binaryType==="arraybuffer"?x=Lx(Sr(a,i)):this._binaryType==="blob"?x=new Blob(a):x=a,this._allowSynchronousEvents?(this.emit("message",x,!0),this._state=ge):(this._state=Pn,setImmediate(()=>{this.emit("message",x,!0),this._state=ge,this.startLoop(e)}))}else{let x=Sr(a,i);if(!this._skipUTF8Validation&&!Si(x)){let f=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");e(f);return}this._state===Er||this._allowSynchronousEvents?(this.emit("message",x,!1),this._state=ge):(this._state=Pn,setImmediate(()=>{this.emit("message",x,!1),this._state=ge,this.startLoop(e)}))}}controlMessage(e,i){if(this._opcode===8){if(e.length===0)this._loop=!1,this.emit("conclude",1005,bi),this.end();else{let a=e.readUInt16BE(0);if(!Rx(a)){let f=this.createError(RangeError,`invalid status code ${a}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");i(f);return}let x=new Tn(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!Si(x)){let f=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");i(f);return}this._loop=!1,this.emit("conclude",a,x),this.end()}this._state=ge;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?"ping":"pong",e),this._state=ge):(this._state=Pn,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",e),this._state=ge,this.startLoop(i)}))}createError(e,i,a,x,f){this._loop=!1,this._errored=!0;let u=new e(a?`Invalid WebSocket frame: ${i}`:i);return Error.captureStackTrace(u,this.createError),u.code=f,u[Px]=x,u}};Ai.exports=kr});var Pr=ae((rl,Pi)=>{"use strict";var{Duplex:nl}=Z("stream"),{randomFillSync:Ox}=Z("crypto"),Di=gt(),{EMPTY_BUFFER:Bx,kWebSocket:Mx,NOOP:zx}=Re(),{isBlob:mt,isValidStatusCode:qx}=pt(),{mask:Ti,toBuffer:Ze}=Nt(),pe=Symbol("kByteLength"),Fx=Buffer.alloc(4),In=8*1024,$e,_t=In,we=0,Ux=1,Kx=2,Dr=class r{constructor(e,i,a){this._extensions=i||{},a&&(this._generateMask=a,this._maskBuffer=Buffer.alloc(4)),this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=we,this.onerror=zx,this[Mx]=void 0}static frame(e,i){let a,x=!1,f=2,u=!1;i.mask&&(a=i.maskBuffer||Fx,i.generateMask?i.generateMask(a):(_t===In&&($e===void 0&&($e=Buffer.alloc(In)),Ox($e,0,In),_t=0),a[0]=$e[_t++],a[1]=$e[_t++],a[2]=$e[_t++],a[3]=$e[_t++]),u=(a[0]|a[1]|a[2]|a[3])===0,f=6);let g;typeof e=="string"?(!i.mask||u)&&i[pe]!==void 0?g=i[pe]:(e=Buffer.from(e),g=e.length):(g=e.length,x=i.mask&&i.readOnly&&!u);let m=g;g>=65536?(f+=8,m=127):g>125&&(f+=2,m=126);let _=Buffer.allocUnsafe(x?g+f:f);return _[0]=i.fin?i.opcode|128:i.opcode,i.rsv1&&(_[0]|=64),_[1]=m,m===126?_.writeUInt16BE(g,2):m===127&&(_[2]=_[3]=0,_.writeUIntBE(g,4,6)),i.mask?(_[1]|=128,_[f-4]=a[0],_[f-3]=a[1],_[f-2]=a[2],_[f-1]=a[3],u?[_,e]:x?(Ti(e,a,_,f,g),[_]):(Ti(e,a,e,0,g),[_,e])):[_,e]}close(e,i,a,x){let f;if(e===void 0)f=Bx;else{if(typeof e!="number"||!qx(e))throw new TypeError("First argument must be a valid error code number");if(i===void 0||!i.length)f=Buffer.allocUnsafe(2),f.writeUInt16BE(e,0);else{let g=Buffer.byteLength(i);if(g>123)throw new RangeError("The message must not be greater than 123 bytes");f=Buffer.allocUnsafe(2+g),f.writeUInt16BE(e,0),typeof i=="string"?f.write(i,2):f.set(i,2)}}let u={[pe]:f.length,fin:!0,generateMask:this._generateMask,mask:a,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state!==we?this.enqueue([this.dispatch,f,!1,u,x]):this.sendFrame(r.frame(f,u),x)}ping(e,i,a){let x,f;if(typeof e=="string"?(x=Buffer.byteLength(e),f=!1):mt(e)?(x=e.size,f=!1):(e=Ze(e),x=e.length,f=Ze.readOnly),x>125)throw new RangeError("The data size must not be greater than 125 bytes");let u={[pe]:x,fin:!0,generateMask:this._generateMask,mask:i,maskBuffer:this._maskBuffer,opcode:9,readOnly:f,rsv1:!1};mt(e)?this._state!==we?this.enqueue([this.getBlobData,e,!1,u,a]):this.getBlobData(e,!1,u,a):this._state!==we?this.enqueue([this.dispatch,e,!1,u,a]):this.sendFrame(r.frame(e,u),a)}pong(e,i,a){let x,f;if(typeof e=="string"?(x=Buffer.byteLength(e),f=!1):mt(e)?(x=e.size,f=!1):(e=Ze(e),x=e.length,f=Ze.readOnly),x>125)throw new RangeError("The data size must not be greater than 125 bytes");let u={[pe]:x,fin:!0,generateMask:this._generateMask,mask:i,maskBuffer:this._maskBuffer,opcode:10,readOnly:f,rsv1:!1};mt(e)?this._state!==we?this.enqueue([this.getBlobData,e,!1,u,a]):this.getBlobData(e,!1,u,a):this._state!==we?this.enqueue([this.dispatch,e,!1,u,a]):this.sendFrame(r.frame(e,u),a)}send(e,i,a){let x=this._extensions[Di.extensionName],f=i.binary?2:1,u=i.compress,g,m;typeof e=="string"?(g=Buffer.byteLength(e),m=!1):mt(e)?(g=e.size,m=!1):(e=Ze(e),g=e.length,m=Ze.readOnly),this._firstFragment?(this._firstFragment=!1,u&&x&&x.params[x._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(u=g>=x._threshold),this._compress=u):(u=!1,f=0),i.fin&&(this._firstFragment=!0);let _={[pe]:g,fin:i.fin,generateMask:this._generateMask,mask:i.mask,maskBuffer:this._maskBuffer,opcode:f,readOnly:m,rsv1:u};mt(e)?this._state!==we?this.enqueue([this.getBlobData,e,this._compress,_,a]):this.getBlobData(e,this._compress,_,a):this._state!==we?this.enqueue([this.dispatch,e,this._compress,_,a]):this.dispatch(e,this._compress,_,a)}getBlobData(e,i,a,x){this._bufferedBytes+=a[pe],this._state=Kx,e.arrayBuffer().then(f=>{if(this._socket.destroyed){let g=new Error("The socket was closed while the blob was being read");process.nextTick(Tr,this,g,x);return}this._bufferedBytes-=a[pe];let u=Ze(f);i?this.dispatch(u,i,a,x):(this._state=we,this.sendFrame(r.frame(u,a),x),this.dequeue())}).catch(f=>{process.nextTick(Hx,this,f,x)})}dispatch(e,i,a,x){if(!i){this.sendFrame(r.frame(e,a),x);return}let f=this._extensions[Di.extensionName];this._bufferedBytes+=a[pe],this._state=Ux,f.compress(e,a.fin,(u,g)=>{if(this._socket.destroyed){let m=new Error("The socket was closed while data was being compressed");Tr(this,m,x);return}this._bufferedBytes-=a[pe],this._state=we,a.readOnly=!1,this.sendFrame(r.frame(g,a),x),this.dequeue()})}dequeue(){for(;this._state===we&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[3][pe],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][pe],this._queue.push(e)}sendFrame(e,i){e.length===2?(this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],i),this._socket.uncork()):this._socket.write(e[0],i)}};Pi.exports=Dr;function Tr(r,e,i){typeof i=="function"&&i(e);for(let a=0;a<r._queue.length;a++){let x=r._queue[a],f=x[x.length-1];typeof f=="function"&&f(e)}}function Hx(r,e,i){Tr(r,e,i),r.onerror(e)}});var qi=ae((sl,zi)=>{"use strict";var{kForOnEventAttribute:Ot,kListener:Ir}=Re(),Ii=Symbol("kCode"),Li=Symbol("kData"),Ni=Symbol("kError"),Ri=Symbol("kMessage"),Oi=Symbol("kReason"),wt=Symbol("kTarget"),Bi=Symbol("kType"),Mi=Symbol("kWasClean"),Be=class{constructor(e){this[wt]=null,this[Bi]=e}get target(){return this[wt]}get type(){return this[Bi]}};Object.defineProperty(Be.prototype,"target",{enumerable:!0});Object.defineProperty(Be.prototype,"type",{enumerable:!0});var Qe=class extends Be{constructor(e,i={}){super(e),this[Ii]=i.code===void 0?0:i.code,this[Oi]=i.reason===void 0?"":i.reason,this[Mi]=i.wasClean===void 0?!1:i.wasClean}get code(){return this[Ii]}get reason(){return this[Oi]}get wasClean(){return this[Mi]}};Object.defineProperty(Qe.prototype,"code",{enumerable:!0});Object.defineProperty(Qe.prototype,"reason",{enumerable:!0});Object.defineProperty(Qe.prototype,"wasClean",{enumerable:!0});var yt=class extends Be{constructor(e,i={}){super(e),this[Ni]=i.error===void 0?null:i.error,this[Ri]=i.message===void 0?"":i.message}get error(){return this[Ni]}get message(){return this[Ri]}};Object.defineProperty(yt.prototype,"error",{enumerable:!0});Object.defineProperty(yt.prototype,"message",{enumerable:!0});var Bt=class extends Be{constructor(e,i={}){super(e),this[Li]=i.data===void 0?null:i.data}get data(){return this[Li]}};Object.defineProperty(Bt.prototype,"data",{enumerable:!0});var Wx={addEventListener(r,e,i={}){for(let x of this.listeners(r))if(!i[Ot]&&x[Ir]===e&&!x[Ot])return;let a;if(r==="message")a=function(f,u){let g=new Bt("message",{data:u?f:f.toString()});g[wt]=this,Ln(e,this,g)};else if(r==="close")a=function(f,u){let g=new Qe("close",{code:f,reason:u.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});g[wt]=this,Ln(e,this,g)};else if(r==="error")a=function(f){let u=new yt("error",{error:f,message:f.message});u[wt]=this,Ln(e,this,u)};else if(r==="open")a=function(){let f=new Be("open");f[wt]=this,Ln(e,this,f)};else return;a[Ot]=!!i[Ot],a[Ir]=e,i.once?this.once(r,a):this.on(r,a)},removeEventListener(r,e){for(let i of this.listeners(r))if(i[Ir]===e&&!i[Ot]){this.removeListener(r,i);break}}};zi.exports={CloseEvent:Qe,ErrorEvent:yt,Event:Be,EventTarget:Wx,MessageEvent:Bt};function Ln(r,e,i){typeof r=="object"&&r.handleEvent?r.handleEvent.call(r,i):r.call(e,i)}});var Nn=ae((il,Fi)=>{"use strict";var{tokenChars:Mt}=pt();function Ae(r,e,i){r[e]===void 0?r[e]=[i]:r[e].push(i)}function jx(r){let e=Object.create(null),i=Object.create(null),a=!1,x=!1,f=!1,u,g,m=-1,_=-1,v=-1,y=0;for(;y<r.length;y++)if(_=r.charCodeAt(y),u===void 0)if(v===-1&&Mt[_]===1)m===-1&&(m=y);else if(y!==0&&(_===32||_===9))v===-1&&m!==-1&&(v=y);else if(_===59||_===44){if(m===-1)throw new SyntaxError(`Unexpected character at index ${y}`);v===-1&&(v=y);let T=r.slice(m,v);_===44?(Ae(e,T,i),i=Object.create(null)):u=T,m=v=-1}else throw new SyntaxError(`Unexpected character at index ${y}`);else if(g===void 0)if(v===-1&&Mt[_]===1)m===-1&&(m=y);else if(_===32||_===9)v===-1&&m!==-1&&(v=y);else if(_===59||_===44){if(m===-1)throw new SyntaxError(`Unexpected character at index ${y}`);v===-1&&(v=y),Ae(i,r.slice(m,v),!0),_===44&&(Ae(e,u,i),i=Object.create(null),u=void 0),m=v=-1}else if(_===61&&m!==-1&&v===-1)g=r.slice(m,y),m=v=-1;else throw new SyntaxError(`Unexpected character at index ${y}`);else if(x){if(Mt[_]!==1)throw new SyntaxError(`Unexpected character at index ${y}`);m===-1?m=y:a||(a=!0),x=!1}else if(f)if(Mt[_]===1)m===-1&&(m=y);else if(_===34&&m!==-1)f=!1,v=y;else if(_===92)x=!0;else throw new SyntaxError(`Unexpected character at index ${y}`);else if(_===34&&r.charCodeAt(y-1)===61)f=!0;else if(v===-1&&Mt[_]===1)m===-1&&(m=y);else if(m!==-1&&(_===32||_===9))v===-1&&(v=y);else if(_===59||_===44){if(m===-1)throw new SyntaxError(`Unexpected character at index ${y}`);v===-1&&(v=y);let T=r.slice(m,v);a&&(T=T.replace(/\\/g,""),a=!1),Ae(i,g,T),_===44&&(Ae(e,u,i),i=Object.create(null),u=void 0),g=void 0,m=v=-1}else throw new SyntaxError(`Unexpected character at index ${y}`);if(m===-1||f||_===32||_===9)throw new SyntaxError("Unexpected end of input");v===-1&&(v=y);let C=r.slice(m,v);return u===void 0?Ae(e,C,i):(g===void 0?Ae(i,C,!0):a?Ae(i,g,C.replace(/\\/g,"")):Ae(i,g,C),Ae(e,u,i)),e}function Gx(r){return Object.keys(r).map(e=>{let i=r[e];return Array.isArray(i)||(i=[i]),i.map(a=>[e].concat(Object.keys(a).map(x=>{let f=a[x];return Array.isArray(f)||(f=[f]),f.map(u=>u===!0?x:`${x}=${u}`).join("; ")})).join("; ")).join(", ")}).join(", ")}Fi.exports={format:Gx,parse:jx}});var Mn=ae((xl,$i)=>{"use strict";var Jx=Z("events"),Vx=Z("https"),Yx=Z("http"),Hi=Z("net"),Xx=Z("tls"),{randomBytes:Zx,createHash:$x}=Z("crypto"),{Duplex:ol,Readable:al}=Z("stream"),{URL:Lr}=Z("url"),je=gt(),Qx=Ar(),ec=Pr(),{isBlob:tc}=pt(),{BINARY_TYPES:Ui,CLOSE_TIMEOUT:nc,EMPTY_BUFFER:Rn,GUID:rc,kForOnEventAttribute:Nr,kListener:sc,kStatusCode:ic,kWebSocket:ne,NOOP:Wi}=Re(),{EventTarget:{addEventListener:oc,removeEventListener:ac}}=qi(),{format:xc,parse:cc}=Nn(),{toBuffer:fc}=Nt(),ji=Symbol("kAborted"),Rr=[8,13],Me=["CONNECTING","OPEN","CLOSING","CLOSED"],uc=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,U=class r extends Jx{constructor(e,i,a){super(),this._binaryType=Ui[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=Rn,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol="",this._readyState=r.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,e!==null?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,i===void 0?i=[]:Array.isArray(i)||(typeof i=="object"&&i!==null?(a=i,i=[]):i=[i]),Gi(this,e,i,a)):(this._autoPong=a.autoPong,this._closeTimeout=a.closeTimeout,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(e){Ui.includes(e)&&(this._binaryType=e,this._receiver&&(this._receiver._binaryType=e))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(e,i,a){let x=new Qx({allowSynchronousEvents:a.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:a.maxPayload,skipUTF8Validation:a.skipUTF8Validation}),f=new ec(e,this._extensions,a.generateMask);this._receiver=x,this._sender=f,this._socket=e,x[ne]=this,f[ne]=this,e[ne]=this,x.on("conclude",hc),x.on("drain",gc),x.on("error",pc),x.on("message",mc),x.on("ping",_c),x.on("pong",wc),f.onerror=yc,e.setTimeout&&e.setTimeout(0),e.setNoDelay&&e.setNoDelay(),i.length>0&&e.unshift(i),e.on("close",Yi),e.on("data",Bn),e.on("end",Xi),e.on("error",Zi),this._readyState=r.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=r.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[je.extensionName]&&this._extensions[je.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=r.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(e,i){if(this.readyState!==r.CLOSED){if(this.readyState===r.CONNECTING){ue(this,this._req,"WebSocket was closed before the connection was established");return}if(this.readyState===r.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=r.CLOSING,this._sender.close(e,i,!this._isServer,a=>{a||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),Vi(this)}}pause(){this.readyState===r.CONNECTING||this.readyState===r.CLOSED||(this._paused=!0,this._socket.pause())}ping(e,i,a){if(this.readyState===r.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(a=e,e=i=void 0):typeof i=="function"&&(a=i,i=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==r.OPEN){Or(this,e,a);return}i===void 0&&(i=!this._isServer),this._sender.ping(e||Rn,i,a)}pong(e,i,a){if(this.readyState===r.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(a=e,e=i=void 0):typeof i=="function"&&(a=i,i=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==r.OPEN){Or(this,e,a);return}i===void 0&&(i=!this._isServer),this._sender.pong(e||Rn,i,a)}resume(){this.readyState===r.CONNECTING||this.readyState===r.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(e,i,a){if(this.readyState===r.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof i=="function"&&(a=i,i={}),typeof e=="number"&&(e=e.toString()),this.readyState!==r.OPEN){Or(this,e,a);return}let x={binary:typeof e!="string",mask:!this._isServer,compress:!0,fin:!0,...i};this._extensions[je.extensionName]||(x.compress=!1),this._sender.send(e||Rn,x,a)}terminate(){if(this.readyState!==r.CLOSED){if(this.readyState===r.CONNECTING){ue(this,this._req,"WebSocket was closed before the connection was established");return}this._socket&&(this._readyState=r.CLOSING,this._socket.destroy())}}};Object.defineProperty(U,"CONNECTING",{enumerable:!0,value:Me.indexOf("CONNECTING")});Object.defineProperty(U.prototype,"CONNECTING",{enumerable:!0,value:Me.indexOf("CONNECTING")});Object.defineProperty(U,"OPEN",{enumerable:!0,value:Me.indexOf("OPEN")});Object.defineProperty(U.prototype,"OPEN",{enumerable:!0,value:Me.indexOf("OPEN")});Object.defineProperty(U,"CLOSING",{enumerable:!0,value:Me.indexOf("CLOSING")});Object.defineProperty(U.prototype,"CLOSING",{enumerable:!0,value:Me.indexOf("CLOSING")});Object.defineProperty(U,"CLOSED",{enumerable:!0,value:Me.indexOf("CLOSED")});Object.defineProperty(U.prototype,"CLOSED",{enumerable:!0,value:Me.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(r=>{Object.defineProperty(U.prototype,r,{enumerable:!0})});["open","error","close","message"].forEach(r=>{Object.defineProperty(U.prototype,`on${r}`,{enumerable:!0,get(){for(let e of this.listeners(r))if(e[Nr])return e[sc];return null},set(e){for(let i of this.listeners(r))if(i[Nr]){this.removeListener(r,i);break}typeof e=="function"&&this.addEventListener(r,e,{[Nr]:!0})}})});U.prototype.addEventListener=oc;U.prototype.removeEventListener=ac;$i.exports=U;function Gi(r,e,i,a){let x={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:nc,protocolVersion:Rr[1],maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...a,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(r._autoPong=x.autoPong,r._closeTimeout=x.closeTimeout,!Rr.includes(x.protocolVersion))throw new RangeError(`Unsupported protocol version: ${x.protocolVersion} (supported versions: ${Rr.join(", ")})`);let f;if(e instanceof Lr)f=e;else try{f=new Lr(e)}catch{throw new SyntaxError(`Invalid URL: ${e}`)}f.protocol==="http:"?f.protocol="ws:":f.protocol==="https:"&&(f.protocol="wss:"),r._url=f.href;let u=f.protocol==="wss:",g=f.protocol==="ws+unix:",m;if(f.protocol!=="ws:"&&!u&&!g?m=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:g&&!f.pathname?m="The URL's pathname is empty":f.hash&&(m="The URL contains a fragment identifier"),m){let R=new SyntaxError(m);if(r._redirects===0)throw R;On(r,R);return}let _=u?443:80,v=Zx(16).toString("base64"),y=u?Vx.request:Yx.request,C=new Set,T;if(x.createConnection=x.createConnection||(u?lc:dc),x.defaultPort=x.defaultPort||_,x.port=f.port||_,x.host=f.hostname.startsWith("[")?f.hostname.slice(1,-1):f.hostname,x.headers={...x.headers,"Sec-WebSocket-Version":x.protocolVersion,"Sec-WebSocket-Key":v,Connection:"Upgrade",Upgrade:"websocket"},x.path=f.pathname+f.search,x.timeout=x.handshakeTimeout,x.perMessageDeflate&&(T=new je({...x.perMessageDeflate,isServer:!1,maxPayload:x.maxPayload}),x.headers["Sec-WebSocket-Extensions"]=xc({[je.extensionName]:T.offer()})),i.length){for(let R of i){if(typeof R!="string"||!uc.test(R)||C.has(R))throw new SyntaxError("An invalid or duplicated subprotocol was specified");C.add(R)}x.headers["Sec-WebSocket-Protocol"]=i.join(",")}if(x.origin&&(x.protocolVersion<13?x.headers["Sec-WebSocket-Origin"]=x.origin:x.headers.Origin=x.origin),(f.username||f.password)&&(x.auth=`${f.username}:${f.password}`),g){let R=x.path.split(":");x.socketPath=R[0],x.path=R[1]}let P;if(x.followRedirects){if(r._redirects===0){r._originalIpc=g,r._originalSecure=u,r._originalHostOrSocketPath=g?x.socketPath:f.host;let R=a&&a.headers;if(a={...a,headers:{}},R)for(let[J,oe]of Object.entries(R))a.headers[J.toLowerCase()]=oe}else if(r.listenerCount("redirect")===0){let R=g?r._originalIpc?x.socketPath===r._originalHostOrSocketPath:!1:r._originalIpc?!1:f.host===r._originalHostOrSocketPath;(!R||r._originalSecure&&!u)&&(delete x.headers.authorization,delete x.headers.cookie,R||delete x.headers.host,x.auth=void 0)}x.auth&&!a.headers.authorization&&(a.headers.authorization="Basic "+Buffer.from(x.auth).toString("base64")),P=r._req=y(x),r._redirects&&r.emit("redirect",r.url,P)}else P=r._req=y(x);x.timeout&&P.on("timeout",()=>{ue(r,P,"Opening handshake has timed out")}),P.on("error",R=>{P===null||P[ji]||(P=r._req=null,On(r,R))}),P.on("response",R=>{let J=R.headers.location,oe=R.statusCode;if(J&&x.followRedirects&&oe>=300&&oe<400){if(++r._redirects>x.maxRedirects){ue(r,P,"Maximum redirects exceeded");return}P.abort();let ce;try{ce=new Lr(J,e)}catch{let F=new SyntaxError(`Invalid URL: ${J}`);On(r,F);return}Gi(r,ce,i,a)}else r.emit("unexpected-response",P,R)||ue(r,P,`Unexpected server response: ${R.statusCode}`)}),P.on("upgrade",(R,J,oe)=>{if(r.emit("upgrade",R),r.readyState!==U.CONNECTING)return;P=r._req=null;let ce=R.headers.upgrade;if(ce===void 0||ce.toLowerCase()!=="websocket"){ue(r,J,"Invalid Upgrade header");return}let I=$x("sha1").update(v+rc).digest("base64");if(R.headers["sec-websocket-accept"]!==I){ue(r,J,"Invalid Sec-WebSocket-Accept header");return}let F=R.headers["sec-websocket-protocol"],Y;if(F!==void 0?C.size?C.has(F)||(Y="Server sent an invalid subprotocol"):Y="Server sent a subprotocol but none was requested":C.size&&(Y="Server sent no subprotocol"),Y){ue(r,J,Y);return}F&&(r._protocol=F);let De=R.headers["sec-websocket-extensions"];if(De!==void 0){if(!T){ue(r,J,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let ze;try{ze=cc(De)}catch{ue(r,J,"Invalid Sec-WebSocket-Extensions header");return}let ye=Object.keys(ze);if(ye.length!==1||ye[0]!==je.extensionName){ue(r,J,"Server indicated an extension that was not requested");return}try{T.accept(ze[je.extensionName])}catch{ue(r,J,"Invalid Sec-WebSocket-Extensions header");return}r._extensions[je.extensionName]=T}r.setSocket(J,oe,{allowSynchronousEvents:x.allowSynchronousEvents,generateMask:x.generateMask,maxPayload:x.maxPayload,skipUTF8Validation:x.skipUTF8Validation})}),x.finishRequest?x.finishRequest(P,r):P.end()}function On(r,e){r._readyState=U.CLOSING,r._errorEmitted=!0,r.emit("error",e),r.emitClose()}function dc(r){return r.path=r.socketPath,Hi.connect(r)}function lc(r){return r.path=void 0,!r.servername&&r.servername!==""&&(r.servername=Hi.isIP(r.host)?"":r.host),Xx.connect(r)}function ue(r,e,i){r._readyState=U.CLOSING;let a=new Error(i);Error.captureStackTrace(a,ue),e.setHeader?(e[ji]=!0,e.abort(),e.socket&&!e.socket.destroyed&&e.socket.destroy(),process.nextTick(On,r,a)):(e.destroy(a),e.once("error",r.emit.bind(r,"error")),e.once("close",r.emitClose.bind(r)))}function Or(r,e,i){if(e){let a=tc(e)?e.size:fc(e).length;r._socket?r._sender._bufferedBytes+=a:r._bufferedAmount+=a}if(i){let a=new Error(`WebSocket is not open: readyState ${r.readyState} (${Me[r.readyState]})`);process.nextTick(i,a)}}function hc(r,e){let i=this[ne];i._closeFrameReceived=!0,i._closeMessage=e,i._closeCode=r,i._socket[ne]!==void 0&&(i._socket.removeListener("data",Bn),process.nextTick(Ji,i._socket),r===1005?i.close():i.close(r,e))}function gc(){let r=this[ne];r.isPaused||r._socket.resume()}function pc(r){let e=this[ne];e._socket[ne]!==void 0&&(e._socket.removeListener("data",Bn),process.nextTick(Ji,e._socket),e.close(r[ic])),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",r))}function Ki(){this[ne].emitClose()}function mc(r,e){this[ne].emit("message",r,e)}function _c(r){let e=this[ne];e._autoPong&&e.pong(r,!this._isServer,Wi),e.emit("ping",r)}function wc(r){this[ne].emit("pong",r)}function Ji(r){r.resume()}function yc(r){let e=this[ne];e.readyState!==U.CLOSED&&(e.readyState===U.OPEN&&(e._readyState=U.CLOSING,Vi(e)),this._socket.end(),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",r)))}function Vi(r){r._closeTimer=setTimeout(r._socket.destroy.bind(r._socket),r._closeTimeout)}function Yi(){let r=this[ne];if(this.removeListener("close",Yi),this.removeListener("data",Bn),this.removeListener("end",Xi),r._readyState=U.CLOSING,!this._readableState.endEmitted&&!r._closeFrameReceived&&!r._receiver._writableState.errorEmitted&&this._readableState.length!==0){let e=this.read(this._readableState.length);r._receiver.write(e)}r._receiver.end(),this[ne]=void 0,clearTimeout(r._closeTimer),r._receiver._writableState.finished||r._receiver._writableState.errorEmitted?r.emitClose():(r._receiver.on("error",Ki),r._receiver.on("finish",Ki))}function Bn(r){this[ne]._receiver.write(r)||this.pause()}function Xi(){let r=this[ne];r._readyState=U.CLOSING,r._receiver.end(),this.end()}function Zi(){let r=this[ne];this.removeListener("error",Zi),this.on("error",Wi),r&&(r._readyState=U.CLOSING,this.destroy())}});var no=ae((fl,to)=>{"use strict";var cl=Mn(),{Duplex:vc}=Z("stream");function Qi(r){r.emit("close")}function bc(){!this.destroyed&&this._writableState.finished&&this.destroy()}function eo(r){this.removeListener("error",eo),this.destroy(),this.listenerCount("error")===0&&this.emit("error",r)}function Sc(r,e){let i=!0,a=new vc({...e,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return r.on("message",function(f,u){let g=!u&&a._readableState.objectMode?f.toString():f;a.push(g)||r.pause()}),r.once("error",function(f){a.destroyed||(i=!1,a.destroy(f))}),r.once("close",function(){a.destroyed||a.push(null)}),a._destroy=function(x,f){if(r.readyState===r.CLOSED){f(x),process.nextTick(Qi,a);return}let u=!1;r.once("error",function(m){u=!0,f(m)}),r.once("close",function(){u||f(x),process.nextTick(Qi,a)}),i&&r.terminate()},a._final=function(x){if(r.readyState===r.CONNECTING){r.once("open",function(){a._final(x)});return}r._socket!==null&&(r._socket._writableState.finished?(x(),a._readableState.endEmitted&&a.destroy()):(r._socket.once("finish",function(){x()}),r.close()))},a._read=function(){r.isPaused&&r.resume()},a._write=function(x,f,u){if(r.readyState===r.CONNECTING){r.once("open",function(){a._write(x,f,u)});return}r.send(x,u)},a.on("end",bc),a.on("error",eo),a}to.exports=Sc});var Br=ae((ul,ro)=>{"use strict";var{tokenChars:Cc}=pt();function Ec(r){let e=new Set,i=-1,a=-1,x=0;for(x;x<r.length;x++){let u=r.charCodeAt(x);if(a===-1&&Cc[u]===1)i===-1&&(i=x);else if(x!==0&&(u===32||u===9))a===-1&&i!==-1&&(a=x);else if(u===44){if(i===-1)throw new SyntaxError(`Unexpected character at index ${x}`);a===-1&&(a=x);let g=r.slice(i,a);if(e.has(g))throw new SyntaxError(`The "${g}" subprotocol is duplicated`);e.add(g),i=a=-1}else throw new SyntaxError(`Unexpected character at index ${x}`)}if(i===-1||a!==-1)throw new SyntaxError("Unexpected end of input");let f=r.slice(i,x);if(e.has(f))throw new SyntaxError(`The "${f}" subprotocol is duplicated`);return e.add(f),e}ro.exports={parse:Ec}});var fo=ae((ll,co)=>{"use strict";var kc=Z("events"),zn=Z("http"),{Duplex:dl}=Z("stream"),{createHash:Ac}=Z("crypto"),so=Nn(),et=gt(),Dc=Br(),Tc=Mn(),{CLOSE_TIMEOUT:Pc,GUID:Ic,kWebSocket:Lc}=Re(),Nc=/^[+/0-9A-Za-z]{22}==$/,io=0,oo=1,xo=2,Mr=class extends kc{constructor(e,i){if(super(),e={allowSynchronousEvents:!0,autoPong:!0,maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:Pc,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:Tc,...e},e.port==null&&!e.server&&!e.noServer||e.port!=null&&(e.server||e.noServer)||e.server&&e.noServer)throw new TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(e.port!=null?(this._server=zn.createServer((a,x)=>{let f=zn.STATUS_CODES[426];x.writeHead(426,{"Content-Length":f.length,"Content-Type":"text/plain"}),x.end(f)}),this._server.listen(e.port,e.host,e.backlog,i)):e.server&&(this._server=e.server),this._server){let a=this.emit.bind(this,"connection");this._removeListeners=Rc(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(x,f,u)=>{this.handleUpgrade(x,f,u,a)}})}e.perMessageDeflate===!0&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=io}address(){if(this.options.noServer)throw new Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(e){if(this._state===xo){e&&this.once("close",()=>{e(new Error("The server is not running"))}),process.nextTick(zt,this);return}if(e&&this.once("close",e),this._state!==oo)if(this._state=oo,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients?this.clients.size?this._shouldEmitClose=!0:process.nextTick(zt,this):process.nextTick(zt,this);else{let i=this._server;this._removeListeners(),this._removeListeners=this._server=null,i.close(()=>{zt(this)})}}shouldHandle(e){if(this.options.path){let i=e.url.indexOf("?");if((i!==-1?e.url.slice(0,i):e.url)!==this.options.path)return!1}return!0}handleUpgrade(e,i,a,x){i.on("error",ao);let f=e.headers["sec-websocket-key"],u=e.headers.upgrade,g=+e.headers["sec-websocket-version"];if(e.method!=="GET"){nt(this,e,i,405,"Invalid HTTP method");return}if(u===void 0||u.toLowerCase()!=="websocket"){nt(this,e,i,400,"Invalid Upgrade header");return}if(f===void 0||!Nc.test(f)){nt(this,e,i,400,"Missing or invalid Sec-WebSocket-Key header");return}if(g!==13&&g!==8){nt(this,e,i,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});return}if(!this.shouldHandle(e)){qt(i,400);return}let m=e.headers["sec-websocket-protocol"],_=new Set;if(m!==void 0)try{_=Dc.parse(m)}catch{nt(this,e,i,400,"Invalid Sec-WebSocket-Protocol header");return}let v=e.headers["sec-websocket-extensions"],y={};if(this.options.perMessageDeflate&&v!==void 0){let C=new et({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let T=so.parse(v);T[et.extensionName]&&(C.accept(T[et.extensionName]),y[et.extensionName]=C)}catch{nt(this,e,i,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let C={origin:e.headers[`${g===8?"sec-websocket-origin":"origin"}`],secure:!!(e.socket.authorized||e.socket.encrypted),req:e};if(this.options.verifyClient.length===2){this.options.verifyClient(C,(T,P,R,J)=>{if(!T)return qt(i,P||401,R,J);this.completeUpgrade(y,f,_,e,i,a,x)});return}if(!this.options.verifyClient(C))return qt(i,401)}this.completeUpgrade(y,f,_,e,i,a,x)}completeUpgrade(e,i,a,x,f,u,g){if(!f.readable||!f.writable)return f.destroy();if(f[Lc])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>io)return qt(f,503);let _=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${Ac("sha1").update(i+Ic).digest("base64")}`],v=new this.options.WebSocket(null,void 0,this.options);if(a.size){let y=this.options.handleProtocols?this.options.handleProtocols(a,x):a.values().next().value;y&&(_.push(`Sec-WebSocket-Protocol: ${y}`),v._protocol=y)}if(e[et.extensionName]){let y=e[et.extensionName].params,C=so.format({[et.extensionName]:[y]});_.push(`Sec-WebSocket-Extensions: ${C}`),v._extensions=e}this.emit("headers",_,x),f.write(_.concat(`\r
|
|
8
|
+
var F0=Object.create;var sr=Object.defineProperty;var U0=Object.getOwnPropertyDescriptor;var K0=Object.getOwnPropertyNames;var H0=Object.getPrototypeOf,G0=Object.prototype.hasOwnProperty;var W=(r=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(r,{get:(e,o)=>(typeof require<"u"?require:e)[o]}):r)(function(r){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+r+'" is not supported')});var De=(r,e)=>()=>(r&&(e=r(r=0)),e);var re=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),_s=(r,e)=>{for(var o in e)sr(r,o,{get:e[o],enumerable:!0})},j0=(r,e,o,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let x of K0(e))!G0.call(r,x)&&x!==o&&sr(r,x,{get:()=>e[x],enumerable:!(a=U0(e,x))||a.enumerable});return r};var Pe=(r,e,o)=>(o=r!=null?F0(H0(r)):{},j0(e||!r||!r.__esModule?sr(o,"default",{value:r,enumerable:!0}):o,r));import{chmod as W0,mkdir as J0,readFile as V0,rename as ws,writeFile as ys}from"node:fs/promises";import{dirname as X0}from"node:path";async function Ft(r){try{let e=await V0(r,"utf8");return JSON.parse(e)}catch(e){if(e.code==="ENOENT")return null;throw e}}async function Ut(r,e,o){await J0(X0(r),{recursive:!0});let a=`${JSON.stringify(e,null,2)}
|
|
9
|
+
`,x=`${r}.tmp-${process.pid}-${Math.random().toString(36).slice(2,10)}`;try{o?.mode!==void 0?await ys(x,a,{encoding:"utf8",mode:o.mode}):await ys(x,a,"utf8"),await ws(x,r),o?.mode!==void 0&&await W0(r,o.mode)}catch(f){await ws(x,x).catch(()=>{});let{rm:d}=await import("node:fs/promises");throw await d(x,{force:!0}).catch(()=>{}),f}}var ir=De(()=>{"use strict"});function Ss(r){return Ht[vs]<=Ht[r]}function or(r){bs={...r}}function Kt(r,e,o,a){if(Ht[r]<Ht[vs])return;let x=JSON.stringify({ts:new Date().toISOString(),level:r,module:e,msg:o,...bs,...a});r==="error"||r==="warn"?Z0.write(`${x}
|
|
10
|
+
`):Y0.write(`${x}
|
|
11
|
+
`)}function B(r){return{debug:(e,o)=>Kt("debug",r,e,o),info:(e,o)=>Kt("info",r,e,o),warn:(e,o)=>Kt("warn",r,e,o),error:(e,o)=>Kt("error",r,e,o),child:e=>B(`${r}.${e}`)}}var Ht,vs,Y0,Z0,bs,K=De(()=>{"use strict";Ht={debug:10,info:20,warn:30,error:40},vs=(()=>{let r=process.env.COZE_BRIDGE_LOG_LEVEL;return r==="debug"||r==="info"||r==="warn"||r==="error"?r:"info"})(),Y0=process.stdout,Z0=process.stderr,bs={}});import{homedir as $0}from"node:os";import{join as Q}from"node:path";function H(r){let e=r??$0(),o=Q(e,".coze"),a=Q(o,"bridge"),x=Q(a,"lib");return{cozeRoot:o,bridgeRoot:a,libDir:x,libEntry:Q(x,"index.js"),pidFile:Q(a,"bridge.pid"),portFile:Q(a,"bridge.port"),tokenFile:Q(a,"bridge.token"),logFile:Q(a,"bridge.log"),installLock:Q(a,"install.lock"),configFile:Q(a,"config.json"),agentsRoot:Q(o,"agents")}}function Le(r,e=H()){let o=Q(e.agentsRoot,r);return{root:o,config:Q(o,"config.json"),workspace:Q(o,"workspace"),logs:Q(o,"logs")}}var se=De(()=>{"use strict"});var Wt={};_s(Wt,{AGENT_CONFIG_FILE_MODE:()=>Gt,enforceAgentConfigMode:()=>ta,loadAgentConfig:()=>xe,persistAgentSessions:()=>ar,persistAgentSkills:()=>jt,saveAgentConfig:()=>he});import{chmod as Q0,stat as ea}from"node:fs/promises";function xe(r,e){return Ft(Le(r,e).config)}function he(r,e){return Ut(Le(r.agentId,e).config,r,{mode:Gt})}async function ta(r,e){if(process.platform==="win32")return;let o=Le(r,e).config;try{let a=await ea(o);if(!a.isFile())return;let x=a.mode&511;x!==Gt&&(await Q0(o,Gt),Es.warn("agent config mode auto-corrected to 0600",{path:o,from:x.toString(8)}))}catch(a){if(a.code==="ENOENT")return;Es.warn("enforceAgentConfigMode: chmod failed (ignored)",{path:o,err:String(a)})}}async function ar(r,e,o){let a=await xe(r,o);a&&(a.sessions=Object.fromEntries(e),await he(a,o))}async function jt(r,e,o){let a=await xe(r,o);a&&(a.skills=e,await he(a,o))}var Es,Gt,qe=De(()=>{"use strict";ir();K();se();Es=B("agent-config"),Gt=384});var ci=re(X=>{"use strict";var E=k;(function(r,e){let o=k,a=r();for(;;)try{if(parseInt(o(654))/1*(-parseInt(o(1166))/2)+-parseInt(o(1050))/3*(-parseInt(o(1729))/4)+parseInt(o(1687))/5*(-parseInt(o(1346))/6)+parseInt(o(1216))/7+-parseInt(o(521))/8+parseInt(o(1190))/9*(-parseInt(o(556))/10)+-parseInt(o(304))/11*(-parseInt(o(1598))/12)===e)break;a.push(a.shift())}catch{a.push(a.shift())}})(gn,689747);function gn(){let r=["wen4tg0","tgTzAgy","vLjTA1G","DxvuBM0","rfbewK4","zxjFCw9Z","Aw9UvgLTzw8","BMfMCNy","igzHAwWSig0","rwX3Bvu","Aw5Lza","Berkt2y","BwvKAwf0zwW","zwXTC3m","AKXLCvq","r0HYzLy","x29UtwvZC2e","ywzL","x2nVBM5Ly3q","zg9Uzq","yM9KEq","zuXbzeK","y29UDgv4Da","uK5ZwwS","CKLhAvu","BfHcBKm","BM93","EKXfvgq","CLDPs20","CeTnBxa","EvrvCeq","y1LQAKm","zgrkv08","uKzXDe8","zfDVCMTLCKC","z3Lwwfy","nti3mdq4u0jSzLLj","D2fszxe","swfSr2i","C2HPzNq","zNjVBuHHC2G","r2nhwgi","B25SAw5L","vMHnqMm","CMvJB25Uzwm","q0XZAwm","D3jPDgu","vLjxq0i","vgfN","CMfUzg9T","EgTkve0","DLjzBNq","uhnzA1G","swPQs1i","DM1AshO","t0zYwKy","A0fwtee","zMzmAw5L","qKH6zKG","wwTAwue","zgvJB2rLzey","yxbWBgLJyxq","sxLgCxu","q0TKrgC","EK5yu3O","x2LUDgvYDMe","BMDuAw1LCG","B2LUDfjLywm","ChjVDg9JB2W","ywnRtxnNswq","ywnOzwq","zxjFDhrS","qurwsM0","yxjYyxLIDwy","ANHRtwG","qKLvzfe","CMvJzwL2zwq","t1HbDhG","igfYCMf5yNu","y3DVrwK","rwHKsxu","DfDJuMe","zgTZrhi","wKjlvuC","tMrwvgi","CMfNzvn5BMm","rhbpqM4","z0v2uLe","BMzQwwu","y01pDMu","B0TQshe","Dg9cExrLCW","A3DnDgG","qxjqyNe","vuzhvey","rxzUDvK","AxnmB25N","uxHjtLi","v3vYqvO","wMTnsgu","C3Hnrxi","CMvHC29U","wMzvDu4","Bg9Nsurhzw4","A0Huwxm","qNjbvKy","yLnssgS","rK9nz2y","wfPbrhq","shfOEhK","renXzwq","AunAq0K","Ahr0Chm6","A0HTqve","s21Quxe","D2zjzva","Bw5Vwxa","yMfSrxzLBNq","shnHq2m","z2v0qwXS","v0XJB2e","y2f0y2G","zw5JB2rLrNi","DhLWzq","thfSy2G","t1Lnweu","t1bftL9fuLi","v0XTr2C","BNrfBMrWB2K","zxq9DxrMltG","tMfTzq","x2LUAxrqCM8","s0LztuW","ywrKt25L","x2n1CNnVCKy","r1nNwfK","B2zMC2v0","AezqAu4","icSG","D2vI","rfHZswK","yvH2tKy","v1frv3m","mZe0ntKZng9rrgLVuG","v3Dzzwm","rLHnANe","q1LMrhe","zw50zwqGDhK","y2uGBM90igK","CgLUz19VBMm","yM9L","v1PPveK","ChrryuW","x2HHBMrSzu8","shrAyNC","BMv4DcGPigm","x3bYzwzPEa","x2LZqNjVD3m","sff1q28","ywjVCNq","B3bLCNr5tMe","B25dBg9Zzq","wNLMtxK","uxbKDuq","rfPywha","Cg9PBNrbBMq","wgDYEey","y2T6tvG","sNPzBvO","igzPzwXKoIa","CMvKDwnL","BNruCMLLC0m","D3bTtNC","C3jJ","x3bHDgHlzxK","EfLds1m","Dev2zw50","y2T0wg8","zNbPBgS","A3HQu2G","D1HUq0C","zv90Aw1LB3u","zNjVBuj5Dgu","wM1QtfO","zM9Yy2u","r1PXwvC","s1jhBwG","B25szwnLAxy","zw5HyMXLuw8","yNvMzMvY","q0r0sxO","Aw5JBhvKzxm","CMvZzxruCMK","zhPWuum","A1jJA3m","zw5KCg9PBNq","yMLUyxj5vhK","ywnRx2nVzgu","AuDSCfi","B3DZENy","DKHRsxu","A1rYt2S","zgvMAw5Luhi","CMvZDwX0","A3zvs3q","q29Kzq","ugzUqNy","wvrNs3u","tufyx1jfvfi","ywnRx2LK","y2XLyxjtDg8","ChbL","CKnmyKW","B3bLBG","BezSDxnO","u1LLqxm","ExbVzhq","Bwf4uMv0CMK","rMvhDMu","vurgt2K","rvjst1i","tu9eCue","B3nLrxzLBNq","yxKSihrYEsa","CM9YrxzLBNq","AenSrMq","BwrVtLO","DgvmB2Djre4","zNjVBu51Bwi","zNnPDva","wLL1B0u","whztr0W","C2vUza","CMvWBgfJzq","yw5ZzM9YBvq","Dg9oDw1Izxi","ELHnv1i","Ae1LC3nHz2u","uNbWvuq","zgTPzLu","Ae5xv2e","s0T6vhm","DxrMofDYAxq","q2LuB0S","B2rwChC","z2v0u3rVCMe","sgzAuLy","AwXSihvZzsa","C1jYq0S","DMrNEvy","CgjICdi","uxPVBK4","EwDlzxG","rgz2Dwi","sunnt24","zND0t2C","zunLuNK","Cu5HDwi","t3vVq1e","BeDtsfO","rKD1BKm","tKvNt0S","rfPlA3C","B3nLza","BM5Ly3q","CNnVCL9Uyw0","EfvZzuvUDG","DfjjCKy","z2v0t3DUuhi","DMrhAxO","ENDLuLe","yM50sue","AgrjD0e","rxjYB3jdB2q","Bxz2v3G","yxv0BW","uwn6r0m","zLHMBuC","y29SBM8","r0roCu4","qu5cCuS","Eu5Lq1q","zNbYAMi","BfzquwC","zv9ZDwnJzxm","B2fK","qufmv2W","vKLSzKG","qxD2DLq","zwrLBLi","rfDpwuG","wMDkrfG","Cg9W","ywXSq3vYC28","zw50tgLZDgu","DgvZDa","DuXqzvi","vgLTzw91Da","CeDfAhy","BgvY","qKPPAMy","q3rIBNa","weforgS","BwvZC2fNztO","q0Xpu0ve","uLjpuG","vNL6CNK","yNL0zuXLBMC","zcbLCNjVCI4","ywWGy3vYC28","Dg9iyxnO","y29UDgLUDwu","qxPNreW","CMLwDLO","C2v0y3vYC28","yNvMzMvYzwq","BMvY","BLflzu0","ExD5zMW","wwXrA1e","DhftBMK","ue1rsw4","q3vXrLa","se9Qt1e","ALPxvfa","rvLZwMS","zNjHBwvuExa","tg9Nsuq","CKjyy2K","zxjFBxnNAwq","qvDpA2y","ANbAALy","AKPwt2q","y3jLyxrLt3a","sMn6yLG","zgf0yq","ywXty29Wzq","qKDVANu","DhjHBNnHy3q","C3rYAw5N","uu9XvM4","sLDSzwi","zu15rKO","CMvHzhLtDge","wNvxy1e","suDHEwq","CeT1sLC","sfHzwKi","EuH0s1C","u3rYyxrLz3K","Cfvhv0y","v3DdyKK","Au1VBhK","C2fNzq","wwDVChq","wLfivNm","y291BNq","vg5ZDwS","yw5Hz2vY","Dhj1y3rVCIa","oti3oteZnNnJvK5jyW","zw9guK0","Aw5KzxGGB3u","Cwvlsw8","DgfIyxnL","CMTHq2i","BevpsuO","vM1ktLa","s1Pquwi","A2fXtKm","CwHswuC","rufbAxO","wwHqu2u","BwTqDfG","sxjcANe","zw5JB2rPBMC","quLvwgG","rg5fyMq","BvbsuLi","wKPdD1m","C29YDa","rhbSzha","sLnkBLO","Aw55rwq","EK5mr08","zMLN","suvtx0vsuK8","wM11qNq","z2v0s2v5","zwnVBM5Ly3q","Dgv4Dc9WBge","AxnbCNjHEq","r3vPy2K","zMzMzG","ihrPBwvVDxq","mti3nJe4mfvwAKHXsG","uuvpwu4","zxj2AwnL","z1Pdtu8","EwLRCNu","Cgf5Bg9Hzeu","zLrrwMm","zvDUy2S","uMvJB25Uzwm","reTQvem","C3vJy2vZCW","zePnvKy","id4G","AK1NDwe","zNjVBunOyxi","ywDL","v0jpCvm","x2rYB3bhBg8","nNWZFdv8nhW","y29UBMvJDeu","sLnuBxu","mdaWmdaWmda","shvxDgW","y3vYC29Y","zw1LBNq","y3r4","AgfUz2u","tuD0t2W","rKTYvwO","x2n1CNnVCK4","zMX1C2HfEha","B2HJBxq","vLjwz0C","D2jWwKe","sNfzze0","r1bwyuC","Ew9KB1m","DwzNtfu","ueHPsu4","wfj0qKC","uK5bB3q","AgfZ","veTJv0C","Bwf4tg9ZC0m","q2j0CNm","wfbXDvK","twDREgK","CKPKA24","B3jL","CM92AwrLihy","sfrLvuO","t2jQzwn0","u0vrtum","CfLnCvq","v3nSvui","u2TPCcbWyxm","r0TTCgy","Bg1ZALq","CNjVCK1LC3m","yw5Nzq","BMrWB2LUDfq","CePmqKu","Axnby2TdBgu","CMvZzxrfBMq","y2HLy2TdDxi","zNjVBNrPzxi","BfrPBwvVDxq","x2XPC3rLBMu","C2vYDMvYvgK","r2ntEgO","Bhrjtwe","vLnOvKe","yxGGCMv0CMK","s2rKCfC","zfHUBhG","vMvSsxe","vhrmsKm","DMvY","vMrftei","y2jRz3a","C2v0u3rVCMe","DxfSDKG","zMLSzw5HBwu","Dgv4DfbHEwW","DwHmr0G","ALHjAMe","sLfIqMK","B1n3ueW","EhvuyLC","uxvLDwu","EKr5A2i","zgvIDwC","DNfvzgS","DK5fsgm","Eu1RB1y","yKTsywq","sfj4uxe","DMjrtw8","oufutxHjzq","yxbWBhK","ywnRDxbfBMq","q1v1Cwi","thvdzvy","yKzyDNO","zxjFCw9Zx2e","wNLWqLy","rwngrvi","DxDOCNa","y0D3vhG","AwXK","rND2yui","ChrVCG","Eur1EKm","yuvetgO","wNbVv08","Aw5KzxG","ihjLy29UBMu","y2XVC2u","D2fZq2XLyw4","whfeChu","C29Tzq","AwD2u0W","x3jLywr5q2W","zK5NAhe","CMvUDevUzha","B3bLBIa","Dg9hzw5LCMe","C3rYAw5NAwy","vNrlAe4","BxnWrgu","Aw9Ul2PZB24","DvjmzLi","shjgAfq","zufJAW","Bg1muMK","C1byDeO","z0fHzMm","uu10Dw8","CgLUz0LUDgu","verkzxG","CfjNExq","vfzvEvK","CeH6s0W","CgXIEhy","tLbMsNu","EurZsLe","y3jLyxrLuMu","z2vtEw5J","B0TfwvC","y2HnyxHdB3u","zfnlsNa","zLjHBvq","x2DLDeLUDgu","q0Xpu0LorW","wfnzt00","vM1xEKK","v2Dhu0e","CuDssNO","x2LZsw5PDa","x2DLBMvYyxq","DxjS","A2zMsMm","v29HENe","y29UBMvJDfm","DeXyqwW","DxP5rw0","DvPfu3y","BgDIA3K","zMvY","t216r1u","EvnVD2C","BKzfB0e","svHvsuW","zxrxB3jRq2G","D0rMyuS","DvLmtuq","A09NtwS","AevoB3q","vLzTAva","tKH0ALq","D0znBLe","Cw9HsK4","AMX1z1C","vMHuqLu","DMHYtfy","Bwv0Ag9K","BgncALq","uMLdyui","uu9bue0","yxv0B21HDgK","rfjOtNm","B0jUueW","A1fdvxa","Cg93","A1HNz0e","BwrfsMK","x0rctMfTzq","DM1HDLi","y2LKvwW","DLnltNm","wfnHC0O","y3vYCMvUDeK","Auzgv1K","tMvWv0q","y2HnyxHuCMK","ysbTDxn0igi","zgnRANq","qxjnz0i","v1LNwKi","y09Wzw4","CNDNv00","u2vXsuq","zejxuNi","ELH4qw0","zg9yrxu","Cw9Z","zw5HyMXLqxu","BgLTAxq","A2LUu3m","mdaWma","zMLUza","x2rLC3rYB3K","txzxqxq","o2nOyxjZzxq","vxj4v0e","C2vYDMLJzq","AevYCM9Yrxy","uhD3v0i","CxbSELe","t1zkv2i","v2vmv1K","C3bSAwnL","tKLtv1y","zKvtCKO","tfPXt1a","x2TLEvbHDgG","zNjVBujPDhm","C2vYDMLJzs0","BMCGzMfPBgu","qwLAzfu","yMLzyKW","AvjZENe","shvPruO","tg9NsurozxC","veLdugm","BgLZDgvUtMu","wvLVwvG","zgLZCgf0y2G","A2XyDey","BxnN","u0nAAui","q0Hzu2u","CMfuyMu","yLH0t2C","AKfjuvy","r1viCwu","qvvIrKW","y2XLyxi","zgjoqNu","tvvpB2q","Dg9mB3DLCKm","AwDHDg9Yt24","ExLABKO","u1HSvKC","BwvY","vg9bu3C","vNHjt0e","BMPltKG","ihrVihjLDhi","y2HHCKnVzgu","zxH0zw5ZAw8","yLH1uMm","C3vIyxjYyxK","CM92AwrLigi","r3vZAuq","B2jQzwn0u3q","DxLUDwG","zw50","qND1CLe","whjYsK8","x3vYBa","EeTRqM0","uvrfzLi","B3vUDa","pxv0zI04","Aw5L","t3bLBKv2zw4","DKX5sMi","AxLJugy","BufTDvi","Bw5oq20","AMPete4","DMvUDa","B2XKvMvYC2K","wgvbvLq","C2v0","CgvYC2LZDgu","CgXLyxnLiha","sNbfAvm","uMzTEKW","q09oveLovuu","v3r3uMe","C2v0sxrLBq","we1WBgu","DuroAha","CYbPBNn0yw4","C3bSAxq","sgL5wK0","C3rVCcbPBw0","C0XPC3rLBMu","Dg9cExrLC0W","t3L0D20","AM9PBG","C3rHCNq","B2zM","BMrLEa","tg9JAW","DMnJCgq","r1jVtvG","B3PUy2O","v0zfDgy","B3bLCNr5","vw5Oyw5KBgu","zwn0","wLrZuM4","DKrwyNq","rK91z0C","ign1CNnVCIa","ALnvuhG","yLP6u28","x2LUAxq","ENf0wgO","AwXLx25HBwu","v0TLvg4","ENPXz2y","zxHWB3j0CW","CfjPAMe","zhzgz2W","uu1hz1y","z1Dnr0G","x3bPBMDmB3m","DvnPwfi","rM1iC2i","CufPzNi","zeHRDwe","r2XYB3O","ihzHBgLKigq","C2v0q3vYC28","x2rItMfTzq","y1n6BMi","CMvTB3zLrxy","wg9eBMW","DhDVCMTdAge","vhrdsLa","x2rPC3bHDgm","DhroAMu","u1bny1e","tffeqLu","seHvBNK","ruvdBuS","q291BNq","rLjptLrjrvi","Cgf5Bg9Hza","BLLvDee","yMrFzgLK","CgLUz0XVC3m","ELjfqxm","AeT1Aw4","q01rDNq","tw9KDwXL","zw1PDa","CMvQzwn0","B1rSzhi","x21LC3nHz2u","q0XuwLm","zeXqswe","BeHHBMrSzxi","vxjwyK8","rvPfs1i","CMfTzq","DeDMsMK","v3biB3e","reDJD0S","C21XDue","uxLXvMm","v21Jveu","vMPzvvq","x2rLyNvN","yw51Ce1LC3m","ywXPzcb1CMW","B1zYyNi","CM92AwrLige","vwPMtwi","C2XPy2u","zMLSDgvY","y3vZDg9Tshq","jMPZy2fSBgi","vMvsrLy","x2zVCM1HDeu","C1DjD3q","C2vUzf9Hy2S","u2HHCMvKv28","survtMi","vhrNugK","uLnVzMu","v2fvDfO","mNW0Fdn8mhW","tgTtDxO","AfHxvge","CvbUzvm","AefJA01LC3m","zNvUy3rPB24","A2v0ignVBNm","zM9YrwfJAa","tKfusvzfx0u","r1bUwhK","u0veuLu","ywDLu2HVDW","z1P5t2e","tNLIrfC","y3ruAw1LB3u","y3vYC29Yx24","Dg9tDhjPBMC","s0j5AKO","wg5Os1G","uNfAq0e","ug5RCLm","svLTD3u","C0nVDw50zxi","zKH2yvG","q3DYAM4","Dg9Y","zhfUAvy","yMXABgy","AhL1C3i","y2XVC2uSihC","ywrKq291BNq","BwvZC2fNzv8","B25tDg9Wsw0","lcbTyxGGCMu","Cgf5Bg9Hzfq","DeLUDgvYy2u","AMvQEu0","zxjFywnRx20","shPHyxi","rNjVBNrPzxi","D3jPDgvvAw4","t3fQsfO","C3DvwhG","CNvhtMS","zxH0ugf5Bg8","AgvKtwf4uMu","Dw5ZAwDUzwq","rLHevxO","BM1ltgq","x2rPC2nVBM4","AK90svu","Dw50","u21Uzhq","CMLLC0nVDw4","rLDt","sLLXs2C","D1POCwu","BKHmrey","x2nSzwfYugK","DMfSDwvZ","B25VCgvU","uejtDuC","zvLjveO","BKXPBMu","Dxrjza","zgn2B3a","DhjPzxm","x3bPBMDqB24","CKfis1K","wefLs2m","rxLvqLe","BerOCeG","rxzLBNq","x29Ut3bLBG","Ae9Wzw5fDMu","yxnJCMLWDa","wgX3z0O","yw1LoIa","AxjLza","y29UBMvJDca","BxvuBxO","DgD4EhK","CvHbzNK","BMnLq2XVC2u","ihrPBwvZ","Bg93","vvzvuwW","BwLZzq","m3nyv3LPBq","tuvtu0fhrv8","zerLvuG","vgvgt0G","z2v0","A1HXru4","q2r3D0W","vMnJELi","vMf3qNG","sKXbzNy","rM9Yt08","BhrPCgXLihq","s3f2uw0","yM1AExq","BgLhA0y","x2n1CNnVCK0","B2zMBgLUzq","CvD5CK4","s2PPwuS","EsbJBg9Zzwq","C1jRB3y","t1PZB28","r1j4v2W","yKjXt1O","x2LZtwLUAvC","CvjACeC","uLvhtwK","AKPYAwK","qwfSqNC","ELnLDKC","BgvUz3rO","Aw5KzxHpzG","t2Hxug8","AurqEKC","yw1L","te1eq0W","r3jcu1q","tgLZDgvUzxi","tLroyKK","x2LZtwLUAvq","y3vYDMfSDwu","vwL3zKu","y2fSBa","vLnNrKS","DKPLAfm","EM92CMW","ywXSzwqGBxu","rNPAr2O","A1nTEMC","zfnJqNO","zvfAwNm","Aw50zwDLCIa","B2nRzxq","CvDOsfy","Aw1LCYbPBIa","ALjNrhq","DNb3yuy","x29WDgLVBNm","CNnVCL92ywW","AhrZuuW","D1rqs3C","wM1gzhG","CwPcAhG","uwXZsw8","r0Pnwem","u0PlwhC","CMvJzxzPzwq","x1fVu01HBMe","sxLXuem","A2v5","sg5wweW","z0HWC2G","CNnVCKzPBgu","s09vrva","ywDLsgLKzq","qwHptK0","r3DwDe8","CMvHzhDYAxq","zMzLCG","tvHSrLG","D2jkAee","EK5byM0","v0vmAfG","B0XqqNi","wKj3qvu","zxmGCMvHy2G","B3bLBKrc","A0PNve8","rgDjt0K","A0jpr2S","zLPeqNm","CM9XqMK","tKrhwhO","EM1Vt1G","DLD4CwK","zgvSzxrL","uKz0zvu","BgLUzq","A1nuEgi","CMvTB3zLq2G","CgTrv2K","DK1zDge","x2LZv29YA2u","A0Lcv1q","Bhm6ia","A1n0yxr1C0m","zhvruwu","DhfmueC","ywrK","DePOy2S","BvzTweC","C3bZDxO","zg1vrK4","zM5LsgK","ywzTENq","y3vYC29Yx2y","ndy4mdzwue1nqxe","t1LVBhi","zw5HyMXLvhi","q3vZDg9Trxi","y2v4AKG","x29UrxjYB3i","zxjYB3i","yMflt1a","zKfTu0W","BMnVzgLUzW","z3DQuwq","sxvfANO","C2vUDa","quPqrfu","CuHzA3G","ChjVDg90Exa","z2v0sxrLBq","CMvZB2X2zq","D3m6lY8","CuztzKq","C3nHz2vfDMu","v2vPEgLUsLm","BgLUzw5V","B25JBg9Zzq","ntrgu2HOzhe","AgLNAa","ihrYEsbYzwm","twLZC2LUzYa","AxnszwfKEq","wLrYqKi","s2vXt2W","x2LUAxrhBg8","v2Xis2y","B2fVreK","x2fKzfDZtgK","x194x21Zz18","D09iqxi","AwXLtMfTzq","AxnrB1nby2S","y0X6yKK","mxW2Fdn8ohW","vhjdy04","BeHMqwS","wvDzyvy","yLbeuKi","C25ou2i","swPQuLC","qKnStgS","AgvHzgvY","yKzUuNC","mJuYntmWnNDTzxfKra","y053vLy","DgfYz2v0","vNr0Ce0","EKfWCw4","BeHiDKK","rLDvy3C","DMXOBKC","yKD6A2y","ENzxwuS","DhPPq2K","yxrLq291BNq","yvHJAhm","q2D3zMW","rwzitem","DuL1B2y","zgvSzxrLrge","zMXVB3i","uKHmsMq","x21PBMLoyxy","Dw5KzwzPBMu","tgDAwfa","uNfpC1C","B3P3rgm","ENL6v3u","y2vZC0HHBMq","AgD0zuC","BgrQuwS","AxHJq0O","sgP0veq","DeDjyNq","DxHbDhe","t3jwExq","x3bYB3rVy28","yNnqAfm","DejkqxK","tevUA1G","v1nhtwW","qM9Pzxi","uMjgCw0","uKn4t1u","x2nSzwfYvgK","zNDZxZeUmc4","D24GCMvHC28","AgvHzgvYCW","ELfpzfe","q1zos24","uuDHzfu","rM1Jtxu","x3jLy29UBMu","DxbKyxrLq3u","x29UvgLTzw8","s2LMwKm","EfvTt1O","seXIufy","C0Xf","AxnFywnR","wgLht04","AhvqsK0","Dg9cExrLC0i","yKXVqKm","uxzfCxO","B25fCNjVCG","DwrsDxy","vu9pAfm","ignVzgu6ia","vefrtKi","ELb6wuq","tvzXzwK","ELrqrMC","twvZC2fNzuu","y3vYCMvUDeu","yNL0zxm","rMnfA1q","ChvZAa","rMHmtKW","Exruwuy","z2vjBMzVu3K","Ce5zueK","v01iDNq","wfn5Ewu","CYbHBhjLywq","B25TzxnZywC","aaaaaaaaaaa","rgXAuMS","B3jRig9MzMW","swXivKG","thrtteC","rMzswKO","s1Dnugm","ANHPC0e","DNLeAwK","ywXS","zxjYtM8","DxnLCKLW","q0Pcs3u","BMvLzf9Hy2S","vLjNy3C","rfvgz24","ELjkA2K","vxbKyxrLq28","zxjHDg9Y","DezVzwS","u0Pwq0W","rhPZEM4","sMXNEwm","y3jLyxrLtwu","tePlqxO","BM9etKO","B25LCNjVCG","DKvOAfy","END3Ahu","yMLUyxj5","B25tDgfYDfi","ELHjrgW","x2nYzwf0zvm","ywr2yw5Jzq","y29UBMvJDgK","x3nLCuLK","B25mAw5L","Dhr3Awq","BwfKsuG","txznEMu","vfrfruq","rKT6AKW","y29UC3rYDwm","l3DZl3yY","zwrPyxrLBhK","AxjfDfa","ugnqwM0","oda0CwvQvKvW","CMTLCKDSB2i","DfLZBu0","BwfW","r29pufi","BKroDwe","t1bftG","wgvADwS","x19LC01Vzhu","y3jLyxrLq2W","DNzJD1K","q3blChy","r0nvtMy","x2LZtM9Kzq","y0n1Cfu","CgfYC2u","CLLbt3G","reiGzMfPBgu","vgHKywe","y29Uy2f0","B2nRzxrtDwm","DNDwrMq","ueruCw8","q2Dxwu8","yxrHlcbKyxq","y01lBLa","x29Uq2XVC2u","z1zkEMm","sg5zyKK","Dhjnrei","v1bPALG","s1rAuee","EvjLy29UBMu","v2nWyK8","DMfwD0m","yNvprfy","BKLxzgK","yMLOzMK","rgjbwMi","D0XJu20","uuTYsNC","vfvWwxK","seveq1G","zg5qzxm","x2HHBMrSzva","AhnuBve","DLPMz0u","A05jy0q","y29Kzq","Exv1s3a","v1zfy0y","x3bPBMC","yxbeEe8","yMfSu2nVCgu","BNrLCG","EK1Zu2q","sxjkzgC","yw1Lu3bHy2u","u0rgt1y","quv3ufy","zgPsuwS","Cg9PBNrdB24","CxbjDLG","C3vIC3rYAw4","ALHeuNq","r0fiEee","DMLJzuLeig8","r0foB2y","Ef9MCM9UDgK","B0rWs0K","B2nRzxrgywK","AxnAzxjV","sff4uuu","ugznrNG","AxnrB1nnzxm","vLfTvhO","qMrmzu4","zgvS","y0DeuNC","A2jVwvK","BhL1tvC","rgPtEg0","zNjJC1C","z2vrDwv1zuW","nhWYFdb8mxW","Du9rq3m","v2vIu29JA2u","y29TCgXLDgu","su5tvefova","Cgu6ia","DgHHBIbSB2m","svPtsum","DgLTzw91Da","wufSAMq","s0PWrLa","qw1VDw50","Chv0","te9SDxC","AuThs1a","rNj1tw0","EMH5uhm","yxHjzfC","z2v0q3vYC28","BgP3Bvm","BwLUzW","Cxnzwgy","thHlvhC","DKzuAee","A1HABxq","q0TQCMK","x2HHBMrSzvi","q29UzMLN","z29PBMCGyxC","zMzMsum","DhbizwfKzxi","A3jZwxq","vNb4A1K","D3nZoI8V","C2v0zgi","txHxy0e","DcbSAw1PDa","wK5dr28","zvzbr2S","BMDLza","BMvJDa","DgHLBG","uvH0veK","zvvYBa","u2T2s3C","sfzJEwC","Efrurw52","DxrVuMvJB24","CLzHBhvLCW","wLLXtha","x3jLBw92zvC","ENrIrfm","zgLZywjSzue","zxjYtxnN","BMv3vMvYC2K","uvHgquC","CNzHBfzHBhu","yNjZwLK","BufQzeu","y2HLy2Tszwe","q3vZDg9Tq2W","rvzxC08","CMvXDwLYzwq","De1HBMfNzxi","BMfTzq","x3DZsw5ZDge","tNbwt1m","y2XVC2veqG","ywrKrxzLBNq","y3jLyxrLrwW","zgv2AwnLx2K","BMH5yM0","wKzSy1y","sez2qKq","EgPcwKm","x2vUzhbVAw4","uK9Js0e","AgDOBfe","x3DZ","wvjfr28","yxnZAwDU","ugLJrhi","s0z0ufy","Cuz0rxa","ELr1yKi","oxW3Fdb8mta","yMXVy2TLza","CMvZzxrdB3u","ExbL","vuPHrve","vKrQDNi","qwDADeS","A3j1DM0","zLvXDhq","ugjJzNm","DKHvzM4","rKjXwuO","zKnHC2e","ENrnqwu","zNDguuq","y3Lmte8","vw5zq3i","uhjPBwfYEuS","v2v5sKi","DMjkCge","Aw9U","ywrnAum","nhWZFdf8nxW","yMLUza","u2jcrLy","Aw5N","BMCGB3iGyw4","AMvJDfn0B3i","zLvWrge","z2v0q3vYCMu","vw5PBxbSzw0","CMvHzfvjBNq","rxnQr0G","yvLcyw4","C3rVCMu","u0rIywS","C0jf","Bg9IywXty28","tKDFrvjst1i","CM92AwrLihC","zw5fDMvUDa","yw9dwgm","t1nIDg8","x3DHAxq","wxjor0e","DM9yENy","x2jPBMfYEvq","mhWY","yLP1z1m","yuLwvKO","BKnIC3q","Ce1quK8","Dgv4Dc9Qyxy","zcWG","B3PnqLy","vevNufO","q0vqEwy","r25RthK","D2LSBfjLy28","yxnL","ufHfr0W","BwvZC2fNzq","svDJz2y","uufZz3G","tgPzAvK","qLPmCeu","qNfOAfm","D2DUwhu","EhL0ree","r0ntAey","txH3sg4","DgLUzYbZzxi","t015DMO","u2vYDMLJzvC","B3jLtMfTzxm","zKTcA3m","x25HDMLNyxq","AgD4yMO","CgfNzxnOB3C","CNzHBa","yNLL","txjhvgu","B3jpBMXPBMu","mtiWCerdqwj4","qu5pAve","mxWWFdi","uxLiEgC","qKD6thm","A2v5CW","zhLSq1m","BxnNsuq","B093s1C","B21QDhC","Dw5RBM93BIa","CwLbEMG","AeLLq3C","z1rPBwvVDxq","vKrHDwG","wvPjwe8","A3bAveu","sLnptLa","BMrWB2LUDca","CvHjAKO","CYbWyxjHBxm","zgrlz1a","mxWZFdb8nhW","zhzouxO","tMLoAKK","B25ozxr3B3i","vvbpC2i","DLv2sMS","BNL2CNu","Bg9N","EM1Wzgu","yK1kBKC","rwzhrg8","z2vY","wM5vEKu","D3bMCw0","qwjVCNrfCNi","rMnhzLy","D29Hu3q","BIWGAg9ZDg4","CgfNzwHPzgu","BeHluxi","zw5NDgG","AuL6u20","rgPnyNG","weHqq3i","AvDXEha","tNzJwuC","tgvoyvi","z2vJsxi","ugLABNm","AwLTsxe","y0jbAMm","rMrWEge","BfrAzM0","uuHzruW","BLrbtxu","v2LUzg93","BNrbBMrvCgq","D2LWBxG","EMzSBgi","rvL6yLC","C3rLBMvYCW","x3nVy2TLDa","B2rnuKu","DMfSDwu","yNL0zu9MzNm","y3jLyxrLrxi","CgLluuC","sunHsum","q09otKvdveK","DhjPzxmGCMu","DeLK","yw9lBeC","y3vszM8","z3vUEeG","wKXIAum","yxrKBxy","CgLUz09Uy2u","txLmtxG","z2v0qwXSs2u","Bg9NsurozxC","sefru0m","tMXYreq","x3fVC0rc","t2f4D2K","EMr0z2G","x29UugfNzu4","zcWGDw5RBM8","mtK2ndvXA0zyzNO","sNfqveq","C2DPza","AenSB3nLrxy","uxnrt3a","uwTfAKu"];return gn=function(){return r},gn()}var ux=Object[E(363)+E(877)],dx=Object[E(429)+E(321)+"mes"],si=(r,e)=>function(){return r&&(e=(0,r[{iimIq:function(f,d){return f(d)}}[E(1649)](dx,r)[0]])(r=0)),e},lx=(r,e)=>{let o=E,a={kBOGk:function(f,d,h,_){return f(d,h,_)}};for(var x in e)a[o(1139)](ux,r,x,{get:e[x],enumerable:!0})};function hx(){return Qs||(Qs=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function gx(){let r=E;return ei||(ei=[IDBCursor.prototype[r(1332)],IDBCursor[r(1181)+"e"][r(472)],IDBCursor[r(1181)+"e"][r(472)+"PrimaryKey"]])}function px(r){let e=E,o={RfmzL:function(x,f){return x(f)},WPijX:function(x){return x()},iMoly:function(x,f,d){return x(f,d)},ZnUzE:e(1595),Blskd:function(x,f){return x===f},kHTYs:e(1314),lcBjT:"rrJeA",DRhNs:"success",xkJTM:e(1172),jyKth:function(x,f){return x instanceof f}},a=new Promise((x,f)=>{let d=e,h={lEOIJ:function(y,A,L){return o[k(513)](y,A,L)},AiZdU:o[d(1632)],pkQWi:function(y,A){return o.Blskd(y,A)},UrVbO:o[d(265)],FsyHw:o[d(742)],QczGC:o[d(746)],kinSs:o[d(1743)]},_=()=>{let y=d;if(h[y(1150)](h[y(933)],h.FsyHw)){this[y(910)+y(1690)+y(833)](h[y(527)](_0x357676,y(673),{code:1e3,reason:h[y(795)]})),this[y(1505)+y(1493)]?.[y(619)+"pointConfig"](),this[y(896)+y(984)]?.[y(1517)+y(1400)]();return}else r[y(906)+y(455)+y(477)](h[y(437)],v),r[y(906)+y(455)+y(477)](h[y(774)],b)},v=()=>{let y=d;o.RfmzL(x,o[y(855)](Ee,r[y(364)])),o[y(1376)](_)},b=()=>{f(r[d(1172)]),_()};r[d(1498)+d(1087)](o[d(746)],v),r[d(1498)+d(1087)](o[d(1743)],b)});return a[e(1471)](x=>{let f=e;o.jyKth(x,IDBCursor)&&dr[f(851)](x,r)})[e(282)](()=>{}),mn[e(851)](a,r),a}function mx(r){let e=E,o={GnkLy:function(x,f){return x!==f},KeqOl:e(606),tGfJi:e(1634)+"or",KFtPV:function(x){return x()},BZLpE:e(1433),AalBw:e(320),owszv:e(1628)};if(pn[e(597)](r))return;let a=new Promise((x,f)=>{let d=e,h={LOluw:o[d(1580)],brsZY:o[d(1078)],tWcRa:function(y,A){return y!==A},YWYaV:o[d(360)],gecIr:function(y){return o[d(1512)](y)}},_=()=>{let y=d;r[y(906)+"entListe"+y(477)](h[y(1443)],v),r["removeEv"+y(455)+y(477)](y(1172),b),r["removeEv"+y(455)+"ner"](h[y(1487)],b)},v=()=>{let y=d;if(h[y(1774)](h[y(1209)],h.YWYaV))return this[y(910)+y(398)+y(1034)](_0xa97d72),_0x572d1e();h[y(1647)](x),h[y(1647)](_)},b=()=>{let y=d;o[y(1572)](y(989),o[y(1196)])?(f(r[y(1172)]||new DOMException(o[y(936)],o[y(936)])),o[y(1512)](_)):(_0x59d465(_0x37a550,82),_0x37508d(_0x34d7c4,_0x38178a))};r[d(1498)+d(1087)]("complete",v),r[d(1498)+"Listener"](d(1172),b),r[d(1498)+"Listener"](o.AalBw,b)});pn[e(851)](r,a)}function _x(r){_n={IvwPe:function(o,a){return o(a)}}.IvwPe(r,_n)}function yx(r){let e=E,o={KZPQb:function(a,x){return a(x)},eldII:function(a,x){return a(x)},gunxH:"00000000"+e(577)+"0000000000000000",pKuJW:function(a,x){return a(x)},tRIrF:function(a,x){return a(x)},MHifW:function(a,x){return a in x},qplzQ:e(831)+e(1589),nIWdi:function(a){return a()},dScBz:function(a,x){return a!==x},QyHxg:e(796)};if(r===IDBDatabase[e(1181)+"e"][e(499)+e(1535)]&&!o.MHifW(o[e(784)],IDBTransaction[e(1181)+"e"]))return function(a,...x){let f=e,d=r.call(Pt(this),a,...x);return ur[f(851)](d,a.sort?a[f(541)]():[a]),o[f(529)](Ee,d)};if(o[e(1382)](gx).includes(r))if(o[e(1099)](o.QyHxg,o[e(1601)])){let a=/(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}/[e(456)](_0x4f7987),x=/(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))/[e(456)](_0x344095);return a?o.eldII(_0x36cf73,_0x2266b7):x?_0x2a750d(_0x193598):o[e(1673)]}else return function(...a){let x=e;return r[x(655)](Pt(this),a),o[x(507)](Ee,dr[x(1054)](this))};return function(...a){let x=e;return Ee(r[x(655)](o[x(428)](Pt,this),a))}}function vx(r){let e=E,o={IDUNb:function(a,x){return a===x},MrGTe:e(967),ZmuBt:function(a,x){return a(x)},MOAKZ:function(a,x){return a(x)},EhdIu:function(a,x,f){return a(x,f)},wDfaK:function(a){return a()}};return o[e(958)](typeof r,o[e(1596)])?o[e(548)](yx,r):(r instanceof IDBTransaction&&o.MOAKZ(mx,r),o[e(1773)](ii,r,o[e(730)](hx))?new Proxy(r,_n):r)}function Ee(r){let e=E,o={KRGmh:function(x,f){return x instanceof f},qoaJN:function(x,f){return x(f)}};if(o[e(347)](r,IDBRequest))return o[e(737)](px,r);if(ln[e(597)](r))return ln[e(1054)](r);let a=o[e(737)](vx,r);return a!==r&&(ln.set(r,a),mn[e(851)](a,r)),a}function k(r,e){r=r-265;let o=gn(),a=o[r];if(k.ayQsIC===void 0){var x=function(_){let v="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=",b="",y="";for(let A=0,L,T,R=0;T=_.charAt(R++);~T&&(L=A%4?L*64+T:T,A++%4)?b+=String.fromCharCode(255&L>>(-2*A&6)):0)T=v.indexOf(T);for(let A=0,L=b.length;A<L;A++)y+="%"+("00"+b.charCodeAt(A).toString(16)).slice(-2);return decodeURIComponent(y)};k.iNiVbf=x,k.EmKXqU={},k.ayQsIC=!0}let f=o[0],d=r+f,h=k.EmKXqU[d];return h?a=h:(a=k.iNiVbf(a),k.EmKXqU[d]=a),a}var ii,Qs,ei,dr,pn,ur,ln,mn,_n,Pt,ti=si({"node_modules/idb/build/wrap-idb-value.js"(){let r=E,e={psmTI:function(o,a){return o instanceof a},HXYZB:function(o,a){return o===a},ZJCwS:r(1683),BgPoa:r(482),krsYt:function(o,a){return o===a},lHHvI:r(1549),bZzSo:function(o,a){return o(a)},bmZyt:function(o,a){return o instanceof a},GcSxj:r(1712),zTPFg:function(o,a){return o===a},VShVA:function(o,a){return o in a}};ii=(o,a)=>a[r(676)](x=>o instanceof x),dr=new WeakMap,pn=new WeakMap,ur=new WeakMap,ln=new WeakMap,mn=new WeakMap,_n={get(o,a,x){let f=r,d={plnSq:function(h,_,v){return h(_,v)}};if(e.psmTI(o,IDBTransaction)){if(e.HXYZB(a,f(1712)))return pn[f(1054)](o);if(e.HXYZB(a,f(831)+"oreNames"))if(e[f(508)](e[f(540)],e.BgPoa)){let h=d.plnSq(_0x33adff,_0x381274,_0x50e92f[f(1080)]);_0x1e2185[f(1288)][f(851)](_0x55d653,h)}else return o[f(831)+f(1589)]||ur.get(o);if(e[f(1461)](a,e.lHHvI))return x[f(831)+"oreNames"][1]?void 0:x[f(831)+f(604)](x[f(831)+f(1589)][0])}return e[f(885)](Ee,o[a])},set(o,a,x){return o[a]=x,!0},has(o,a){let x=r;return e[x(1063)](o,IDBTransaction)&&(e.krsYt(a,e[x(625)])||e[x(1285)](a,e[x(1221)]))?!0:e[x(627)](a,o)}},Pt=o=>mn[r(1054)](o)}}),oi={};lx(oi,{deleteDB:()=>Sx,openDB:()=>bx,unwrap:()=>Pt,wrap:()=>Ee});function bx(r,e,{blocked:o,upgrade:a,blocking:x,terminated:f}={}){let d=E,h={bAuXq:function(b,y,A,L,T){return b(y,A,L,T)},spsuz:function(b,y){return b(y)},EZEKR:function(b,y){return b||y},fwtOg:"close",yNeCT:"versionchange",ZYqLp:function(b,y){return b===y},vvcwY:d(1017),kvTSm:"upgradeneeded",ygKex:d(1516)},_=indexedDB[d(374)](r,e),v=h.spsuz(Ee,_);if(a)if(h[d(1479)](h[d(1356)],"JYqKg"))_[d(1498)+d(1087)](h.kvTSm,b=>{let y=d;h.bAuXq(a,h[y(1161)](Ee,_[y(364)]),b.oldVersion,b[y(1484)+"on"],h[y(1161)](Ee,_["transact"+y(1535)]))});else{let b=this[d(1682)][d(1182)](this[d(317)]);return _0x40e685[d(1361)](h[d(934)](b,"{}"))[_0x1e9ffc]}return o&&_[d(1498)+d(1087)](h[d(413)],()=>o()),v[d(1471)](b=>{let y=d;f&&b[y(1498)+y(1087)](h[y(416)],()=>f()),x&&b[y(1498)+y(1087)](h[y(442)],()=>x())})[d(282)](()=>{}),v}function Sx(r,{blocked:e}={}){let o=E,a={vqUdk:function(f,d){return f(d)}},x=indexedDB["deleteDa"+o(525)](r);return e&&x[o(1498)+"Listener"](o(1516),()=>e()),a[o(648)](Ee,x)[o(1471)](()=>{})}function ni(r,e){let o=E,a={BHzfH:o(1127)+"e",vjlLh:"readonly",TEgPZ:function(_,v){return _ instanceof v},JqPTD:function(_,v){return _ in v},ypodt:function(_,v){return _===v},xDwES:o(500),vJehS:function(_,v){return _!==v},AUbFL:function(_,v){return _ in v}};if(!(a[o(1570)](r,IDBDatabase)&&!a[o(1688)](e,r)&&a[o(377)](typeof e,a.xDwES)))return;if(hn[o(1054)](e))return hn[o(1054)](e);let x=e[o(394)](/FromIndex$/,""),f=a[o(1094)](e,x),d=xi.includes(x);if(!a[o(812)](x,(f?IDBIndex:IDBObjectStore).prototype)||!(d||ai[o(352)](x)))return;let h=async function(_,...v){let b=o,y=this[b(499)+b(1535)](_,d?a[b(1751)]:a.vjlLh),A=y[b(1549)];return f&&(A=A[b(671)](v[b(1732)]())),(await Promise[b(1308)]([A[x](...v),d&&y[b(1712)]]))[0]};return hn[o(851)](e,h),h}var ai,xi,hn,Ex=si({"node_modules/idb/build/index.js"(){let r=E,e={kXZmt:function(o){return o()},MCytJ:function(o){return o()},ZFlcV:r(549),HsaCc:r(280),PicDr:r(1678)+"ys",huPJM:r(1442),ZYuoE:"add",pkLed:r(1145),XMple:r(813),IjjKR:function(o,a){return o(a)}};e[r(1454)](ti),e.MCytJ(ti),ai=[r(1054),e[r(1502)],e[r(279)],e[r(1511)],"count"],xi=[e[r(1274)],e[r(391)],e.pkLed,e[r(859)]],hn=new Map,e[r(1746)](_x,o=>({...o,get:(a,x,f)=>ni(a,x)||o[r(1054)](a,x,f),has:(a,x)=>!!ni(a,x)||o.has(a,x)}))}}),Cx={idb:function(r){let e=E;r[e(891)]=Promise[e(1183)]().then(()=>(Ex(),oi))[e(1471)](function(o){return o})}},ri={};function Se(r){let e=E,o={Lbkst:function(f,d){return f!==d}};var a=ri[r];if(o.Lbkst(void 0,a))return a[e(891)];var x=ri[r]={exports:{}};return Cx[r](x,x[e(891)],Se),x.exports}Se.d=(r,e)=>{let o=k;for(var a in e)Se.o(e,a)&&!Se.o(r,a)&&Object["definePr"+o(877)](r,a,{enumerable:!0,get:e[a]})},(()=>{let r=E;Se.o=(e,o)=>Object.prototype["hasOwnPr"+r(877)].call(e,o)})(),(()=>{let r=E,e={oLeFK:function(o,a){return o!=a},fsRXV:r(925),cBAjc:r(1354)+"le"};Se.r=o=>{let a=r;e.oLeFK("undefined",typeof Symbol)&&Symbol[a(978)+"Tag"]&&Object["definePr"+a(877)](o,Symbol["toString"+a(1741)],{value:e.fsRXV}),Object.defineProperty(o,e[a(1650)],{value:!0})}})();var J={};(()=>{let r=E,e={HrFhT:function(s,t){return s!=t},JpEiS:r(1236)+"d",bFXvz:r(1354)+"le",kIBWT:function(s,t){return s===t},FhLNL:"JYTGF",vdGiz:function(s,t){return s(t)},CpKpv:function(s,t){return s+t},bntIA:function(s,t){return s+t},DPDZN:function(s,t){return s+t},RNsYk:function(s,t){return s+t},TtLJC:function(s,t){return s*t},Dfvub:function(s,t){return s+t},vhrLV:function(s,t){return s+t},KTZPA:r(775),ArPbq:r(554),MyLMx:function(s,t){return s(t)},fffIC:function(s,t){return s(t)},HQxQE:function(s,t){return s===t},omjtw:function(s,t){return s>>>t},tqSni:function(s,t){return s<<t},LxKTw:function(s,t){return s|t},Oytwm:function(s,t){return s|t},cwoEi:function(s,t){return s>t},zyzWu:function(s,t){return s<t},HfZRV:function(s,t){return s>t},PfpOI:r(697),GSgXY:function(s,t){return s-t},TAQNB:function(s,t){return s!==t},ckzMX:function(s,t){return s<t},zweRQ:function(s,t){return s-t},Glroz:r(1474),ICaIC:function(s,t,n){return s(t,n)},kTrOk:function(s,t){return s!==t},PDTqo:function(s,t){return s(t)},CHYSe:function(s,t,n){return s(t,n)},WVEcF:function(s,t){return s&t},Thdaa:function(s,t){return s===t},bPDRB:"Missing "+r(1492)+r(330)+r(1119),tBJAy:function(s){return s()},MxwHn:function(s,t,n){return s(t,n)},Jlgyc:function(s,t){return s!==t},IyqPC:function(s,t,n){return s(t,n)},Nurzd:function(s,t){return s!==t},ZypBV:function(s,t,n){return s(t,n)},EcFER:function(s,t){return s(t)},xYCKS:function(s,t){return s!==t},wfIeP:function(s,t,n){return s(t,n)},jpZjV:function(s){return s()},RSofe:function(s,t,n){return s(t,n)},aEDLj:function(s,t,n){return s(t,n)},EtZyH:function(s,t){return s!==t},FcEkT:function(s,t,n){return s(t,n)},EsjGH:function(s,t){return s!==t},voXzv:function(s,t,n){return s(t,n)},odMRE:function(s,t,n){return s(t,n)},qFSfD:function(s,t,n){return s(t,n)},wbJhA:function(s,t){return s!==t},rIGiU:function(s,t){return s(t)},TICPc:function(s,t){return s&t},qWhHV:function(s,t){return s!==t},EvnuY:r(948),XANDk:r(1613),sWIwt:function(s,t){return s(t)},BGzLs:function(s,t){return s>>>t},QKrJw:function(s,t,n){return s(t,n)},VQmTz:function(s,t){return s(t)},ohcmt:function(s,t){return s(t)},QvEqz:function(s,t,n){return s(t,n)},bMJnG:function(s,t){return s(t)},jSUPx:function(s,t,n){return s(t,n)},hgxbj:function(s,t){return s&t},VjYUT:function(s,t){return s===t},vpwaF:r(1193)+r(1492)+r(330)+r(767),VRmkX:r(1193)+r(1492)+" field: "+r(488),JLAfv:"Missing required"+r(330)+"method",KqvQm:function(s,t){return s+t},FfRZJ:function(s,t){return s(t)},Ledsy:function(s,t,n){return s(t,n)},BClLk:function(s,t,n){return s(t,n)},BrAVF:r(1545)+r(308)+r(1435),VAAAV:function(s,t){return s>>t},mspDe:function(s,t){return s>=t},qHYkx:function(s,t){return s>t},SCZiB:function(s,t){return s+t},nyvru:"ZPHBX",XSasJ:function(s,t){return s===t},eQZZs:r(611)+"t limit",cJPqR:function(s,t){return s>=t},DlZRk:function(s,t){return s<t},cYjjC:function(s,t){return s<<t},zmoOX:r(1058),yDsJQ:function(s,t){return s+t},ywyfl:function(s,t){return s>t},cGwTx:r(1048),nFEoA:function(s,t){return s+t},GoOPR:"Read pas"+r(1466),Cwrjn:function(s,t){return s instanceof t},pRija:function(s,t,n){return s(t,n)},sXkMc:function(s,t){return s+t},cMOve:function(s,t){return s&t},axIdW:function(s,t){return s>=t},jxisA:function(s,t){return s+t},KifZC:function(s,t){return s+t},uIuof:function(s,t){return s!==t},OSbto:function(s,t){return s&t},piKQG:function(s,t){return s<t},TDJex:function(s,t){return s(t)},hIeCw:function(s,t){return s+t},iWqxp:function(s,t){return s!==t},vDVbt:function(s,t){return s&t},zLETd:function(s,t){return s<<t},DgjQl:function(s,t){return s<<t},vyDii:function(s,t){return s&t},DbAZb:function(s,t){return s<<t},fHvaX:function(s,t){return s>=t},gWMGH:function(s,t){return s<=t},hGZpA:"ddKgP",HEDCX:function(s,t){return s+t},RUGMi:function(s,t){return s+t},WZiTI:function(s,t){return s&t},zNAbm:function(s,t){return s<<t},PXEGL:function(s,t){return s|t},oDpKI:function(s,t){return s|t},LJKAz:function(s,t){return s|t},hsTmQ:function(s,t){return s&t},qAifr:function(s,t){return s&t},VhMBc:function(s,t){return s<t},KByjJ:r(1531),QmiZK:r(617),fAmSL:function(s,t,n){return s(t,n)},VeRFV:function(s,t){return s>>t},gwjQd:function(s,t){return s+t},dvNQz:function(s,t){return s&t},xuTbW:function(s,t){return s||t},zQOdQ:function(s,t){return s+t},madIH:function(s,t){return s|t},ZgJDX:function(s,t){return s===t},yuuKp:r(677),XgrxF:function(s,t){return s>=t},eMyFJ:function(s,t){return s-t},cGDRw:function(s,t){return s+t},QpduD:function(s,t){return s<<t},GCUNf:function(s,t){return s>=t},ZRhUC:function(s,t){return s<=t},BGoju:function(s,t){return s<t},LkYhf:function(s,t){return s+t},teWDX:function(s,t){return s<t},XnhKX:function(s,t){return s|t},FXDUz:function(s,t){return s<t},KKzTs:function(s,t){return s|t},vxiJc:function(s,t){return s&t},doXEu:function(s,t){return s>>t},ANBqK:"Buiio",LMDCL:function(s,t){return s|t},dXnlx:function(s,t){return s>>t},gEvRQ:function(s,t){return s|t},cFmiJ:function(s,t){return s>>t},Dzszn:function(s,t){return s&t},OZsoo:function(s,t){return s|t},jJrii:function(s,t){return s<t},JSJnZ:function(s,t){return s+t},pMSlE:r(1269),hFPiN:function(s,t,n){return s(t,n)},kEbJS:function(s,t){return s(t)},QHYEL:function(s,t){return s<<t},EVWsO:function(s,t){return s&t},VVmiP:function(s,t){return s>=t},GwVtO:function(s,t){return s|t},Pbcfs:function(s,t,n){return s(t,n)},yodoS:function(s,t){return s&t},jAIQV:function(s,t){return s&t},PwwWB:function(s,t){return s&t},HuiEJ:function(s,t){return s<<t},QTEfR:function(s,t){return s(t)},RFqtO:function(s,t){return s&t},IOMGJ:function(s,t){return s&t},tGIbt:function(s,t){return s<<t},buODV:function(s,t){return s&t},PcPZm:function(s,t){return s&t},ZQHVs:r(1086),dnPes:function(s,t){return s|t},uSiXR:function(s,t){return s<<t},qWyrN:function(s,t){return s>>>t},vNEHc:function(s,t){return s|t},PnkrS:function(s,t){return s>>>t},JgBjX:function(s,t){return s<t},GPVaG:function(s,t){return s<t},WtwRa:function(s,t,n){return s(t,n)},AwvvT:function(s,t){return s+t},bSRHk:function(s,t){return s>>>t},mDXPN:function(s,t){return s+t},oKEYW:function(s,t){return s!==t},mAjdE:function(s,t){return s>>>t},sxtdU:function(s,t){return s!==t},hKuin:function(s,t){return s>>>t},noDNJ:function(s,t){return s&t},CDtIz:function(s,t){return s+t},waReq:function(s,t){return s>>>t},NdVTb:function(s,t){return s>>>t},FzZGj:function(s,t){return s+t},XeAVT:function(s,t){return s&t},vSKNs:function(s,t){return s!==t},bGzkf:function(s,t){return s>>>t},HtZbw:function(s,t){return s&t},Smndt:function(s,t){return s+t},nDNua:function(s,t){return s!==t},vdgyV:function(s,t){return s!==t},FcGfV:function(s,t){return s|t},cuRfo:function(s,t){return s&t},uZESv:function(s,t){return s!==t},OhWPo:function(s,t){return s|t},SeruD:function(s,t){return s|t},GlPUE:r(526),jxkMh:function(s,t){return s===t},GBCSQ:r(1712),ljwmS:function(s,t){return s===t},atdmv:"store",vZfgE:r(565),gZCMO:function(s,t){return s|t},NlrDD:function(s,t){return s|t},HOjOQ:function(s,t){return s|t},nafrv:function(s,t){return s<<t},SXlVG:function(s,t){return s|t},uuTnm:function(s,t){return s|t},vFThA:function(s,t){return s<<t},bBqOZ:function(s,t){return s>>>t},EEhAd:function(s,t){return s>>>t},KWMPc:function(s,t){return s>>>t},vHUfn:function(s,t){return s&t},ZLbiC:function(s,t){return s>>>t},qRZpG:r(975),hENot:function(s,t){return s<<t},WYgZB:function(s,t){return s|t},auagC:function(s,t){return s|t},ZkMHe:function(s,t){return s===t},BszwI:function(s,t){return s>>>t},YrNGA:function(s,t){return s|t},EECmK:function(s,t){return s|t},xjBZC:function(s,t){return s|t},cSznb:function(s,t){return s|t},LgZXP:function(s,t){return s<<t},XAWNT:"QxnPU",yMkoV:function(s,t){return s&t},CUuqb:function(s,t){return s&t},XZADt:function(s,t){return s&t},oaoDI:function(s,t){return s>>>t},wOHAr:function(s,t){return s<=t},plbxv:function(s,t){return s%t},DpOBn:function(s,t){return s+t},JQbBi:function(s,t){return s>>>t},zzqgf:function(s,t){return s*t},DZXXp:function(s,t){return s===t},FruMm:function(s,t){return s===t},WSGMl:function(s,t){return s&t},kxjSh:function(s,t){return s&t},TRgVy:function(s,t){return s>>>t},pYMqT:function(s,t){return s&t},sxMEr:function(s,t){return s+t},XrrJO:function(s,t){return s>>>t},wTPKw:function(s,t){return s|t},ZfUuN:function(s,t){return s|t},vbJpa:function(s,t){return s<<t},gVJzc:function(s,t){return s!==t},qXnug:function(s,t){return s>>>t},fUqtt:function(s,t){return s>>>t},RFteU:function(s,t){return s+t},oOwKW:function(s,t){return s===t},OQzuu:r(486),bKRad:function(s,t){return s&t},WeLWY:function(s,t){return s>>>t},MxWcA:function(s,t){return s>>>t},yHtKW:function(s,t){return s>>>t},qXAfy:function(s,t){return s&t},uLPeR:function(s,t){return s>>>t},HuWtl:function(s,t){return s&t},QXtTI:function(s,t){return s>>>t},zvWYK:function(s,t){return s>>>t},qGRJz:function(s,t){return s>>>t},wpfqm:function(s,t){return s&t},MXlFX:r(287)+"OR",TeFOH:r(369)+"IES_ERROR",ZhAUB:r(1668)+r(1553),DgIOI:r(970)+r(466),HHUny:r(1051)+"ERROR",ZmFdx:r(566),oKjHq:r(310)+"e_timeout",GRxWl:r(310)+"e_success",yyZnJ:"Zfnoc",sJtJw:r(1543),ZxaCq:r(574)+r(1600),zqtXj:function(s,t){return s&t},YREGo:function(s,t){return s&t},hghlQ:function(s,t){return s&t},ozwDc:function(s,t){return s===t},lXBnC:"iRrsA",eYITJ:r(962)+"1",xKkBm:"error",XHPCr:function(s,t){return s!==t},uRLfR:r(1462),CiToK:function(s,t){return s===t},Wdklm:r(1380),IuEjz:"zpJEQ",cSuzp:function(s,t){return s>=t},HECSW:function(s,t){return s-t},kAVLA:function(s,t){return s===t},aXchs:function(s,t){return s(t)},ZNCGo:r(382),TUpYy:"oiaJT",FwvaB:r(900),cMKnP:function(s,t){return s+t},yikru:"pZmMA",lmLRi:function(s,t){return s<t},dqniV:r(1433),KyDwT:r(1634)+"or",LeNaR:r(440),Cgwfl:function(s,t,n){return s(t,n)},ytTYF:"close",fwFQD:r(1179),XPquY:r(374),zdtgh:function(s,t,n){return s(t,n)},GAHxA:function(s,t){return s!==t},gAafc:function(s,t,n){return s(t,n)},YlQkQ:function(s,t,n){return s(t,n)},WwCbI:function(s,t){return s===t},JczbX:r(1692),kffJc:function(s,t){return s+t},ixcCJ:function(s,t){return s+t},vWxqi:function(s,t){return s+t},JzYmZ:function(s,t){return s<<t},MGtOl:function(s,t){return s|t},mnoYp:function(s,t){return s&t},jejyM:function(s,t){return s&t},VcczR:function(s,t){return s&t},KOUEP:function(s,t){return s<t},smquA:function(s,t,n){return s(t,n)},uynuh:function(s,t){return s+t},CLTZS:function(s,t){return s&t},QOAPM:function(s,t){return s===t},LlPHb:r(1752),MUOod:"cursor_name",MbDBF:function(s,t){return s===t},aoKlG:r(1318),gHpsh:function(s,t){return s||t},HLbPV:function(s,t){return s||t},dJMVF:r(1430)+"3",kwMth:function(s,t){return s||t},ZyfMy:function(s,t){return s&t},cktXo:function(s,t){return s>>>t},TTEED:function(s,t){return s&t},wZhqe:function(s,t){return s&t},QlsIo:function(s,t){return s>>>t},VZqVu:function(s,t){return s&t},PErbw:function(s,t){return s>>>t},istVX:"lRVJu",pNYPI:function(s,t){return s<t},WaUtZ:function(s,t){return s&t},KiGbf:function(s,t){return s&t},ZmjLZ:function(s,t){return s+t},rJdkn:function(s,t){return s<t},GlNTb:function(s,t){return s-t},iGlpR:function(s,t){return s<=t},ANOiQ:function(s,t){return s<t},LBwVm:function(s,t){return s|t},kboYY:function(s,t){return s<<t},lgbky:function(s,t){return s&t},KtlEF:function(s,t){return s>=t},FGunC:function(s,t){return s<<t},oTldr:function(s,t){return s&t},BqhhS:function(s,t){return s<<t},BXzZM:function(s,t){return s-t},WpHoq:function(s,t){return s<<t},uaDAp:function(s,t){return s&t},kruvm:function(s,t){return s&t},zNLGO:function(s,t){return s>>t},tYsmM:"string",Woazq:function(s,t){return s instanceof t},DXsIi:function(s,t){return s!=t},DnEbd:function(s,t){return s==t},TrCcN:r(551)+"in;chars"+r(290),DuSak:function(s,t){return s<t},kSmzg:r(1070),HQuCo:r(1426),qKMgy:function(s,t){return s===t},jJVOd:function(s,t){return s&t},BdcIW:function(s,t){return s+t},NvcYG:function(s,t){return s|t},mmSHf:function(s,t){return s>>t},dSKJp:function(s,t){return s|t},dvFgl:function(s,t){return s>>t},OYMXE:function(s,t){return s&t},IjjRW:function(s,t){return s>>t},JBaNy:function(s,t){return s|t},Cyqur:function(s,t){return s&t},dksDr:function(s,t){return s>>t},VRVgG:function(s,t){return s|t},IrJdg:function(s,t){return s-t},ySowg:function(s,t){return s(t)},FKzjL:function(s,t,n,i){return s(t,n,i)},jOtIU:function(s,t){return s instanceof t},XSYOM:function(s,t){return s instanceof t},QLRpn:r(1754)+r(686),oSFqx:function(s,t){return s==t},nCbst:r(311),hGJKr:r(372),QyqVc:function(s,t){return s>=t},cbkgp:"unknown reason",UOOhS:r(1567)+r(1037),zNXSz:"http",dylCS:r(952)+"ack=frontierJSONP",NHtjT:"NcHsu",SULLm:r(528),woaSt:"idb",HVcyg:r(1438),rYAOx:function(s,t){return s===t},WaebR:r(1088),hXWTa:function(s,t){return s+t},AWOkf:function(s,t){return s-t},KJpFP:function(s,t){return s|t},SJVCL:function(s,t){return s>>t},vEhhV:function(s,t){return s>>t},ztbDS:function(s,t){return s===t},bXuRc:r(502),hNWWa:r(515),oLPBr:function(s,t){return s||t},WFEtf:function(s,t){return s(t)},WKeTn:function(s,t){return s===t},nQKeM:function(s,t){return s||t},NEgOK:function(s,t){return s<t},qeKIo:function(s,t){return s===t},oVrbr:r(1728),BIUdQ:function(s,t){return s&t},rAHKY:function(s,t){return s&t},uwhrp:function(s,t){return s+t},nTAMu:function(s,t){return s>>t},WmcTE:r(1115),NDGXz:r(1514),vmZHz:function(s,t){return s||t},roqBi:function(s,t){return s||t},xXhXF:r(804),Hqhxy:r(821),VtKhN:function(s,t){return s||t},vSXYL:"init QoS"+r(1363)+"d",WcpbO:function(s,t){return s===t},jLeqT:r(1220),PsYkX:r(1691),PiZns:r(771),fneHi:function(s,t,n){return s(t,n)},jlugW:function(s,t){return s!==t},uqlvH:"OqjHZ",elmss:function(s,t){return s===t},dzpQC:r(1756),zSevG:function(s,t,n,i){return s(t,n,i)},VxIOA:function(s,t,n,i){return s(t,n,i)},aoOKh:r(1414)+r(660)+"ck",wbpZA:"x_frontier_is_ack",mvvWx:r(1414)+r(999)+r(1689),CEPyf:r(1791),WlHKf:r(281),tziCi:"is_ack",CdwwL:r(358),RCdoF:r(1769),yTUpD:function(s,t){return s(t)},pMPRO:function(s,t){return s instanceof t},vUvJk:"none_none",ulgte:r(1328),uxAtq:function(s,t){return s+t},fprjb:function(s,t){return s(t)},SDFOV:function(s,t){return s&t},eVAGk:function(s,t){return s+t},apDxO:function(s,t){return s|t},qhRYG:function(s,t){return s>>t},ArMgB:function(s,t){return s===t},lGSHZ:"DZKkw",lVPQg:function(s,t){return s+t},QMtuo:function(s,t){return s+t},mdoNZ:function(s,t){return s+t},VhTBU:r(523)+"t of range: ",VdELB:r(299),CZTxR:function(s,t){return s||t},OVJWb:r(568),CgWYO:r(1101)+"too large",zREAs:function(s,t){return s>=t},RqZCA:function(s,t){return s&t},IGayd:function(s,t,n,i){return s(t,n,i)},YYoYX:function(s,t){return s+t},itZfT:function(s,t){return s<t},aXRoo:function(s,t){return s<<t},XeZuk:function(s,t){return s<t},kRcks:function(s,t,n,i){return s(t,n,i)},HeYCU:function(s,t){return s+t},mdEJi:function(s,t){return s|t},lDJOf:function(s,t){return s<<t},ttNje:function(s,t){return s+t},HXwWR:function(s,t){return s+t},WLmGg:function(s,t){return s<<t},WQQWs:function(s,t){return s+t},zXMWR:function(s,t){return s+t},CLsic:r(1576),waflU:"rPvrN",ozMBV:r(1374),FeGve:function(s,t){return s+t},gHDjs:function(s,t){return s&t},dYdbg:function(s,t){return s+t},kXggA:function(s,t){return s&t},IPpDy:function(s,t){return s+t},EfHLC:function(s,t){return s&t},rwgWM:function(s,t){return s+t},VelIq:function(s,t){return s&t},FgOeV:function(s,t){return s+t},YhPSe:r(1515)+"|5|4|1|1"+r(1206)+"2",frcsW:function(s,t){return s>>>t},ptQaL:function(s,t){return s|t},DjMbx:function(s,t){return s<<t},OuoCQ:function(s,t){return s|t},dbNBu:function(s,t){return s<t},MVqei:function(s,t){return s|t},rBXci:function(s,t){return s&t},hClFd:function(s,t){return s|t},oBnPL:function(s,t){return s>>>t},VDjvr:function(s,t){return s|t},YTgKu:r(1214),EthUQ:"service",DCqed:function(s,t,n,i){return s(t,n,i)},RppUD:r(793)+"name",GcGXb:function(s,t,n,i){return s(t,n,i)},KddpW:function(s,t,n,i){return s(t,n,i)},feKro:r(1090),WwYec:function(s,t){return s(t)},BdLeN:r(1165)+r(888),XAeKc:r(1556),VLxIu:function(s,t){return s===t},XXRZI:r(1032),oSwPL:"DHlIn",Tzikt:function(s,t,n){return s(t,n)},DGcwK:function(s,t,n){return s(t,n)},jsWuF:function(s,t,n){return s(t,n)},IalGb:r(454)+r(1478),OrVyt:"ALL",nYUtA:r(856),vlhnG:function(s,t,n,i){return s(t,n,i)},uzyEm:function(s){return s()},RbFqm:function(s,t){return s(t)},WGwCI:r(475)+"r",Ctbnp:function(s,t,n){return s(t,n)},FWUcw:r(1414)+r(490),kXqEN:function(s,t,n,i){return s(t,n,i)},XHFDv:"x-msg-qos",SbBFV:function(s,t,n){return s(t,n)},LQDBU:"x-msg-cu"+r(426)+"e",CGSLV:function(s,t){return s(t)},VRgcw:"x-msg-cu"+r(1108)+"ue",UrxWA:function(s){return s()},CMQvt:function(s){return s()},iQHhB:function(s,t){return s<t},OYolr:function(s){return s()},ZBwAU:function(s){return s()},dmUFN:function(s,t){return s===t},SPMcQ:"uuKWF",FXMjq:function(s,t){return s&&t},QOqVn:function(s){return s()},FOMgf:function(s,t){return s!==t},ROpuG:function(s){return s()},qwikY:function(s,t){return s<t},vLyJb:function(s,t,n){return s(t,n)},IXUIL:function(s){return s()},zwwhu:function(s,t){return s===t},TtCJP:"always",rJfnZ:function(s,t,n,i){return s(t,n,i)},HnVXL:r(1114),pacyh:function(s,t){return s!==t},TwQEe:r(563),bZugS:r(753),ZTrBB:function(s,t){return s!==t},wgnXu:r(1766)+r(724),fsiuP:function(s,t){return s/t},LEnkX:r(436),RiCaB:function(s,t){return s==t},GRoMX:r(853)+r(605)+r(945),SIMBv:r(853)+r(1554)+r(1618)+", WebSoc"+r(968)+r(520)+"is undef"+r(1703),TKcWG:r(1737)+"t",EgLBA:r(864)+r(1343)+r(672)+"ct",kHmAQ:r(1735),udRuv:r(1066),nhybm:"pagehide",edenR:r(1593),ahYZy:function(s,t){return s!==t},ktmgy:r(273),vwVFd:r(1184),yiEhF:r(920),CYfDq:r(1336),HFvBD:r(1500)+"d",ZBKUG:function(s,t){return s||t},VttpM:r(853)+r(829)+"ddID, de"+r(1412)+"r ttwID",OMyvj:r(967),IQpBE:function(s,t,n){return s(t,n)},XTnDq:r(300),CJBKu:r(1258)+"0",IYmwu:"CfPRQ",dcvop:function(s,t,n){return s(t,n)},IrBjq:r(869),afmzt:function(s,t,n){return s(t,n)},xXDTn:function(s,t,n){return s(t,n)},qjBhx:function(s,t){return s===t},njKNH:r(590),kOgMk:function(s,t){return s(t)},OFrZF:"WtIJk",pRgyt:function(s,t){return s(t)},MEthH:function(s,t){return s(t)},iIzSm:"FRONTIER>",Lqlch:"TGTIt",PDNCf:r(698),ForOO:function(s,t){return s!==t},qFtEp:r(691),Mgkxi:r(788),XlwgJ:function(s,t,n){return s(t,n)},LjYiY:r(1458)+r(384)+r(1737)+r(1586)+r(633),ozncj:function(s,t,n){return s(t,n)},Dpldp:"timeout,"+r(1192)+"onnecting",FmcMu:r(956),adMiC:function(s,t){return s!==t},snNSb:r(965),fRamT:r(1620)+"2",iycPf:function(s,t,n){return s(t,n)},tqLPG:function(s,t){return s(t)},inyEd:function(s,t){return s===t},NFFtL:r(1273),AzgDL:"oidWh",KeoJN:function(s,t,n){return s(t,n)},IZSIC:function(s,t,n){return s(t,n)},VDauh:r(1595),XEWHY:r(1458)+"ay, netw"+r(1301)+r(841),iCZCI:r(769),EYzbW:"ack",lHKQr:function(s,t){return s&t},Vyzry:function(s,t){return s(t)},trMDB:function(s,t){return s&t},sRrCK:function(s,t){return s!==t},tgxxy:r(1091),dkifU:function(s,t){return s(t)},fKBks:function(s,t){return s+t},VRWCB:function(s,t){return s+t},cidUl:"GANof",dLPIa:function(s,t){return s+t},IyFqu:r(991)+r(861)+r(309)+"nitialized",zhyPs:function(s,t){return s===t},ufgLU:r(991)+r(1297)+r(1069),cLzbI:function(s,t){return s==t},vBGjq:function(s,t){return s instanceof t},fSMut:"please p"+r(947)+" valid s"+r(558),bpbBB:function(s,t){return s instanceof t},MvMze:function(s,t){return s instanceof t},tJhck:function(s,t){return s(t)},KjiYK:function(s,t){return s<t},XoDnl:"enqueue",TtgPi:r(1295),UJaEQ:function(s,t){return s||t},RNAot:function(s,t){return s!==t},zPzYD:"manual r"+r(550)+r(1540),fXfmG:"blocked",vRYnt:function(s,t){return s!==t},iKGKP:r(1496),YXYUg:r(1299),PfMFx:function(s,t){return s/t},LtSLG:r(1655),IPYMc:function(s,t){return s===t},NepWD:r(607),PHiIN:"Dedicate"+r(1727)+r(1552)+"pe",lHfAk:function(s,t){return s!=t},QMGgV:function(s,t){return s===t},nVKnN:r(957)+r(1347)+r(497),QAsgx:function(s,t){return s===t},ElwmU:r(1588)+"orkerGlo"+r(1399),MvWAt:function(s,t){return s!=t},kSTxb:function(s,t){return s!=t},liGkF:r(1201)+"qos__"};Se.r(J),Se.d(J,{FWS:()=>O0,CustomErrorEvent:()=>es,createCloseEvent:()=>le,ReconnectEvent:()=>Qr,createErrorEvent:()=>oe,decodedFrame:()=>Vr,createOpenEvent:()=>os,CustomCloseEvent:()=>ts,createReconnectEvent:()=>Jn,FrontierMessageEvent:()=>rs,encodeFrame:()=>Wn,createMessageEvent:()=>is,OpenEvent:()=>ss,ErrorCode:()=>Me,Event:()=>nt,MessageEvent:()=>ns});let o="";function a(s=""){let t=r,n={ltIMa:function(i,c){return e[k(688)](i,c)},CVNKn:e[t(854)],coraR:t(925),bLoBC:e[t(659)]};if(e.kIBWT(e[t(1291)],e.FhLNL)){let c=""+Date.now(),l=o||(o=e[t(430)](_,s)),g=Math.random()[t(978)](16)[t(949)](-6);return e[t(1357)](e[t(432)](e[t(1697)]("02",c),l),g)}else{let i={Tnsuk:function(c,l){let g=t;return czuNSD[g(626)](c,l)},qXIjJ:czuNSD[t(1262)],ruGNk:czuNSD.coraR,SYeAs:czuNSD[t(1276)]};_0x26a604.r=c=>{let l=t;i[l(518)](i[l(1617)],typeof _0x47fda4)&&_0x45adf3["toString"+l(1741)]&&_0x2d4121[l(363)+"operty"](c,_0x722495[l(978)+"Tag"],{value:i[l(1005)]}),_0x69a074["definePr"+l(877)](c,i[l(376)],{value:!0})}}}function x(){let s=r;return e.RNsYk(e[s(632)](1e4,Date[s(1719)]()),Math[s(1233)](e.TtLJC(1e4,Math[s(1742)]())))}function f(s){let t=r;return e[t(414)](e.vdGiz(Array,8)[t(868)]("0"),parseInt(s,10).toString(2)).slice(-8)}function d(s){let t=r;return e[t(1697)](Array(4)[t(868)]("0"),parseInt(s,2).toString(16)).slice(-4)}function h(s){let t=r,n=s.split(/\./)[t(1349)](l=>f(l)),i=[];return i[0]=e[t(430)](d,e[t(740)](n[0],n[1])),i[1]=e[t(430)](d,e.vhrLV(n[2],n[3])),[e[t(1377)],e[t(1377)],t(775),e[t(1377)],e[t(1377)],e[t(1786)],i[0],i[1]][t(868)]("")}function _(s){let t=r,n=/(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}/[t(456)](s),i=/(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))/.test(s);return n?e.MyLMx(h,s):i?e[t(1459)](v,s):t(577)+"00000000"+t(577)+t(577)}function v(s){let t=r,n={uDNhp:function(m,w){return e[k(1418)](m,w)},kJgTO:function(m,w){return e[k(1607)](m,w)},zRJki:function(m,w){return m|w},OmzGU:function(m,w){return e.tqSni(m,w)},lmsjT:function(m,w){return m>>>w},Cbtrs:function(m,w){return m|w},DjSxm:function(m,w){return e.LxKTw(m,w)},WBOqS:function(m,w){return e[k(867)](m,w)},jZWTP:function(m,w){return m<<w}},i="",c=[],l=0,g=0,p=!0,u="0000";if(e[t(1772)](s.indexOf("::"),-1)){let m=s[t(862)]("::");for(let S=0;e[t(1240)](S,m[t(1080)]);S++){let D=m[S];if(e[t(407)](D[t(1081)](":"),0)){let N=D[t(862)](":");p&&(l=N[t(1080)]),g+=N[t(1080)];for(let I=0;e[t(1240)](I,N[t(1080)]);I++)if(N[I][t(1080)]!==4)if(e[t(1418)](e.PfpOI,t(697))){let ae=u[t(1409)+"g"](0,e[t(296)](4,N[I][t(1080)])),ve=ae[t(1365)](N[I]);c[t(1290)](ve)}else return n[t(860)](_0x43ad5d,_0x1072b0)?_0x76fe71:new _0x480b4b(n[t(1137)](n[t(1315)](_0x3a8e9b[t(1092)](_0x2fa50d,0)|n[t(725)](_0x316faf[t(1092)](_0x53ed2b,1),8)|_0xfde58c.call(_0x370e22,2)<<16,_0x18a6b1[t(1092)](_0x5c2fe1,3)<<24),0),n[t(613)](n[t(600)](n[t(1427)](n[t(572)](_0x3800a0[t(1092)](_0x5c8ce1,4),n.OmzGU(_0x25652d.call(_0x1b22db,5),8)),n[t(725)](_0x4309c8[t(1092)](_0x5875d6,6),16)),n[t(485)](_0x50a397[t(1092)](_0xc753c2,7),24)),0),!0);else c[t(1290)](N[I]);p=!1}else{if(e.TAQNB(4,D[t(1080)])){let N=u[t(1409)+"g"](0,4-D[t(1080)]),I=N[t(1365)](D);c[t(1290)](I)}else c[t(1290)](D);p&&(l+=1),g+=1,p=!1}}let w="";for(let S=0;e[t(1240)](S,e[t(296)](8,g));S++)w=w[t(1365)](u);for(let S=0;e[t(1240)](S,c[t(1080)]);S++)e[t(1418)](S,l)&&(i=i.concat(w)),i=i[t(1365)](c[S]);return i}{let m=s[t(862)](":");for(let w=0;e[t(328)](w,m[t(1080)]);w++){let S=m[w];if(e[t(1282)](4,m[w].length)){let D=u[t(1409)+"g"](0,e[t(431)](4,m[w][t(1080)])),N=D[t(1365)](S);i=i[t(1365)](N)}else i=i.concat(S)}return i}}function b(s,t){let n=r;if(e[n(1418)](n(668),e[n(901)]))return this[n(1661)].protocol;{let i=s.key;e[n(1282)](void 0,i)&&(e[n(1667)](q,t,10),we(t,i));let c=s.value;e[n(362)](void 0,c)&&(e[n(1667)](q,t,18),e[n(1667)](we,t,c))}}function y(s){let t=r,n={};e:for(;!me(s);){let i=e[t(1368)](V,s);switch(e[t(1607)](i,3)){case 0:break e;case 1:n.key=e[t(1667)](_e,s,e[t(1368)](V,s));break;case 2:n.value=e.CHYSe(_e,s,e[t(1459)](V,s));break;default:e[t(807)]($,s,e.WVEcF(7,i))}}if(e[t(1364)](void 0,n[t(1119)]))throw new Error(e[t(1210)]);if(n.value===void 0)throw new Error("Missing "+t(1492)+t(330)+t(1663));return n}function A(s){let t=r,n=e[t(1251)](P);return e[t(1667)](L,s,n),pe(n)}function L(s,t){let n=r,i=s[n(767)];e.kTrOk(void 0,i)&&(e.MxwHn(q,t,8),wt(t,i));let c=s.LogID;e[n(1321)](void 0,c)&&(e[n(1667)](q,t,16),e.IyqPC(wt,t,c));let l=s.service;e.Nurzd(void 0,l)&&(e[n(661)](q,t,24),e[n(807)](wt,t,e.EcFER(te,l)));let g=s[n(741)];e[n(362)](void 0,g)&&(e[n(661)](q,t,32),e[n(661)](wt,t,te(g)));let p=s[n(1260)];if(e[n(336)](void 0,p))for(let ae of p){e.wfIeP(q,t,42);let ve=e[n(492)](P);e.RSofe(b,ae,ve),e[n(276)](q,t,ve[n(773)]),jn(t,ve),e[n(1459)](z,ve)}let u=s["payloadE"+n(1175)];e[n(1282)](void 0,u)&&(e[n(1118)](q,t,50),e[n(669)](we,t,u));let m=s[n(996)+n(1518)];e.EtZyH(void 0,m)&&(e[n(276)](q,t,58),e[n(1289)](we,t,m));let w=s.payload;e[n(1547)](void 0,w)&&(e[n(807)](q,t,66),e[n(1560)](q,t,w.length),e[n(1662)](qt,t,w));let S=s[n(799)];e[n(1547)](void 0,S)&&(q(t,74),e.qFSfD(we,t,S));let D=s[n(624)+"ming"];e[n(1130)](void 0,D)&&(e.ICaIC(q,t,82),e.ICaIC(we,t,D));let N=s[n(1605)];e.kTrOk(void 0,N)&&(e.IyqPC(q,t,90),e[n(661)](we,t,N));let I=s.frameType;I!==void 0&&(e[n(1662)](q,t,96),e[n(1289)](wt,t,e[n(1717)](te,I)))}function T(s){let t=r,n={mHvNr:function(i,c){return i<c},eLAdI:function(i,c){return e.TICPc(i,c)},AIUXh:function(i,c){return i>>c},NFHDw:function(i,c){return i|c},VmWzI:function(i,c){return i|c}};if(e[t(1103)](e[t(1788)],e[t(463)]))return e[t(662)](R,e[t(955)](Z,s));n.mHvNr(_0x4a0332,65536)?_0x14e51b[_0x4e9101++]=n[t(1714)](n[t(537)](_0x1c8ed7,12),15)|224:(_0x393839[_0x26f736++]=n.NFHDw(n.AIUXh(_0x4808a5,18)&7,240),_0x237686[_0x5e7010++]=n[t(1714)](n[t(537)](_0x1c0e2a,12),63)|128),_0x332e71[_0x28cc5b++]=n[t(711)](n[t(537)](_0x5e62a2,6)&63,128)}function R(s){let t=r,n={};e:for(;!e[t(955)](me,s);){let i=e[t(955)](V,s);switch(e[t(1602)](i,3)){case 0:break e;case 1:n.SeqID=e[t(960)](Jr,s,!0);break;case 2:n[t(488)]=e[t(1386)](Jr,s,!0);break;case 3:n[t(781)]=e.sWIwt(V,s);break;case 4:n[t(741)]=e[t(1421)](V,s);break;case 5:{let c=e[t(587)](U,s);(n[t(1260)]||(n.headers=[]))[t(1290)](e[t(955)](y,s)),s[t(773)]=c;break}case 6:n[t(561)+t(1175)]=e.odMRE(_e,s,V(s));break;case 7:n["payloadT"+t(1518)]=e[t(1277)](_e,s,e.bMJnG(V,s));break;case 8:n.payload=zt(s,V(s));break;case 9:n[t(799)]=_e(s,e[t(955)](V,s));break;case 10:n["serverTi"+t(1450)]=e[t(276)](_e,s,e.sWIwt(V,s));break;case 11:n.msgID=e.jSUPx(_e,s,e[t(1677)](V,s));break;case 12:n.frameType=e[t(1629)](V,s);break;default:e[t(1662)]($,s,e[t(1592)](7,i))}}if(e.VjYUT(void 0,n[t(767)]))throw new Error(e[t(1106)]);if(n[t(488)]===void 0)throw new Error(e[t(1695)]);if(e[t(1418)](void 0,n[t(781)]))throw new Error(t(1193)+t(1492)+t(330)+t(781));if(n[t(741)]===void 0)throw new Error(e[t(1059)]);return n}function U(s){let t=r,n=e.ohcmt(V,s),i=s[t(773)];return s[t(773)]=e[t(1062)](s[t(297)],n),i}function $(s,t){let n=r;switch(t){case 0:for(;128&e[n(1304)](ne,s););break;case 2:e[n(276)](ke,s,V(s));break;case 5:e.Ledsy(ke,s,4);break;case 1:e[n(1213)](ke,s,8);break;default:throw new Error(e[n(266)]+t)}}function te(s){let t=r;return s|=0,{low:s,high:e.VAAAV(s,31),unsigned:e[t(685)](s,0)}}let Ae=[];function P(){let s=r,t=Ae[s(453)]();return t?(t[s(297)]=t[s(773)]=0,t):{bytes:new Uint8Array(64),offset:0,limit:0}}function z(s){let t=r;if(e.VjYUT(e[t(1626)],e[t(1626)]))Ae[t(1290)](s);else{let n=_0x1783c4[t(297)];if(e[t(1180)](e[t(806)](n,_0x5e6d99),_0x590e88[t(773)]))throw new _0x393d05("Read pas"+t(1466));return _0x4c4ad6[t(297)]+=_0x40b32d,n}}function Z(s){return{bytes:s,offset:0,limit:s[r(1080)]}}function pe(s){let t=r,n=s[t(1288)],i=s[t(773)];return e.XSasJ(n[t(1080)],i)?n:n[t(828)](0,i)}function ke(s,t){let n=r;if(e[n(1772)](s.offset+t,s[n(773)]))throw new Error(e[n(1100)]);s[n(297)]+=t}function me(s){let t=r;return e.cJPqR(s[t(297)],s[t(773)])}function de(s,t){let n=r,i={IlHVH:function(c,l){return e[k(685)](c,l)},AXAoR:function(c,l){return c<=l},FBqYJ:function(c,l){return e[k(1300)](c,l)},wLcSm:function(c,l){return c-l},JSTmu:function(c,l){return e[k(1716)](c,l)},QzonN:function(c,l){return e[k(1724)](c,l)},iQFFb:function(c,l){return c<l},RHLJd:function(c,l){return c<l}};if(e[n(1153)](e[n(1143)],e[n(1143)])){let c=s[n(1288)],l=s[n(297)],g=s[n(773)],p=e[n(701)](l,t);if(e[n(479)](p,c.length)){let u=new Uint8Array(e[n(632)](2,p));u[n(851)](c),s[n(1288)]=u}return s[n(297)]=p,p>g&&(s[n(773)]=p),l}else{let c=_0x188821[n(825)+"At"](_0x3df989);i[n(1302)](c,55296)&&i.AXAoR(c,56319)&&i[n(1526)](_0x2d50d8+1,_0x404038)&&(c=i[n(1385)](i[n(576)](i[n(412)](c,10),_0x53c9c1[n(825)+"At"](++_0x1e43a6)),56613888)),_0x1ac3eb+=i.iQFFb(c,128)?1:i[n(1234)](c,2048)?2:i[n(1526)](c,65536)?3:4}}function je(s,t){let n=r;if(e[n(664)]!=="UVUQl")return _0x5700a4+=_0xb76822&&_0x26f87c[n(468)+"th"]||0,_0x100110;{let i=s[n(297)];if(e[n(1772)](e[n(727)](i,t),s[n(773)]))throw new Error(e[n(1350)]);return s[n(297)]+=t,i}}function zt(s,t){let n=r,i=e[n(1118)](je,s,t);return s[n(1288)][n(828)](i,i+t)}function qt(s,t){let n=r,i=e[n(276)](de,s,t[n(1080)]);s[n(1288)].set(t,i)}function _e(s,t){let n=r,i={kYEef:function(m,w){return e[k(756)](m,w)},EbZdh:n(967),uxmyh:function(m,w){return e[n(1421)](m,w)},iFFWY:function(m,w){return e.Cwrjn(m,w)},nfjYe:function(m,w,S){return m(w,S)}},c=e[n(892)](je,s,t),l=String[n(570)+n(366)],g=s[n(1288)],p="\uFFFD",u="";for(let m=0;e[n(1240)](m,t);m++){let w=g[e.sXkMc(m,c)],S,D,N,I;if(e.kIBWT(128&w,0))u+=l(w);else if(e[n(1782)](224,w)===192)e[n(1447)](m+1,t)?u+=p:(S=g[e[n(1306)](e[n(1268)](m,c),1)],e[n(1231)](e.OSbto(192,S),128)?u+=p:(I=e[n(1724)](e[n(1592)](31,w),6)|63&S,e[n(1666)](I,128)?u+=p:(u+=e.TDJex(l,I),m++)));else if((240&w)==224)if(e[n(685)](m+2,t))u+=p;else if(S=g[e.vhrLV(e[n(1610)](m,c),1)],D=g[e.CpKpv(m,c)+2],e[n(1644)](e[n(881)](S|e[n(1720)](D,8),49344),32896))u+=p;else if(I=e[n(1452)](e.DgjQl(e[n(1307)](15,w),12)|e.DbAZb(63&S,6),63&D),I<2048||e[n(985)](I,55296)&&e[n(895)](I,57343))u+=p;else if(e[n(1153)](e.hGZpA,n(1619)))u+=e[n(955)](l,I),m+=2;else return FHDLcJ.kYEef(typeof _0x5df94a,FHDLcJ.EbZdh)?FHDLcJ.uxmyh(_0x1a4133,_0x1c12df):(FHDLcJ[n(758)](_0x17a2db,_0x14f2ee)&&FHDLcJ.uxmyh(_0x57a189,_0x432643),FHDLcJ[n(1781)](_0x5012af,_0x5d3a16,_0x4994b3())?new _0x4be88e(_0x8f252b,_0x530576):_0x17eec8);else(248&w)==240?e[n(685)](e[n(1388)](m,3),t)?u+=p:(S=g[e[n(432)](m,c)+1],D=g[e[n(1076)](m+c,2)],N=g[e[n(727)](e.KifZC(m,c),3)],e[n(312)](S|e[n(1131)](D,8)|e[n(1384)](N,16),12632256)!==8421504?u+=p:(I=e[n(1575)](e[n(1415)](e.LJKAz(e[n(1391)](7,w)<<18,e.cYjjC(e[n(899)](63,S),12)),e.zLETd(e[n(1391)](63,D),6)),e.vyDii(63,N)),e.VhMBc(I,65536)||I>1114111?u+=p:e[n(336)](e[n(979)],e.QmiZK)?(I-=65536,u+=e[n(1174)](l,e.nFEoA(e[n(953)](I,10),55296),e[n(1176)](e[n(1621)](1023,I),56320)),m+=3):_0x2a755f[n(1713)][n(1149)+n(665)](_0x3ddd57))):u+=p}return u}function we(s,t){let n=r,i={OXAtx:function(u,m){return u<m},baKOP:function(u,m){return e[k(1629)](u,m)},kpZTE:function(u,m){return u>m},ZuWcQ:function(u,m){return e[k(1261)](u,m)},LZqOP:function(u,m){return e[k(1621)](u,m)},XRtBG:function(u,m){return e[k(1337)](u,m)}},c=t.length,l=0;for(let u=0;u<c;u++)if(e.ZgJDX(e[n(1395)],"igvSL")){let m=t[n(825)+"At"](u);e[n(327)](m,55296)&&e.gWMGH(m,56319)&&u+1<c&&(m=e[n(503)](e.cGDRw(e.QpduD(m,10),t[n(825)+"At"](++u)),56613888)),l+=e[n(1666)](m,128)?1:e.piKQG(m,2048)?2:e.zyzWu(m,65536)?3:4}else{let m=e[n(644)](_0x5ddf73,8192),w=e[n(1602)](m,1),S=null,D=m;return function(N){let I=n;if(i[I(1770)](N,1)||N>w)return i[I(1173)](_0x2ad3ee,N);i[I(1614)](i[I(505)](D,N),m)&&(S=i.baKOP(_0x2664fa,m),D=0);let ae=_0x5558f8.call(S,D,D+=N);return i[I(790)](7,D)&&(D=i[I(505)](i[I(595)](7,D),1)),ae}}q(s,l);let g=de(s,l),p=s[n(1288)];for(let u=0;e[n(1666)](u,c);u++){let m=t[n(825)+"At"](u);e[n(1358)](m,55296)&&e.ZRhUC(m,56319)&&e[n(498)](e[n(1694)](u,1),c)&&(m=e.bntIA(e[n(1724)](m,10),t[n(825)+"At"](++u))-56613888),e[n(328)](m,128)?p[g++]=m:(e.teWDX(m,2048)?p[g++]=e[n(980)](e[n(1782)](m>>6,31),192):(e[n(1009)](m,65536)?p[g++]=e[n(402)](e.vxiJc(e[n(770)](m,12),15),224):n(553)!==e[n(441)]?(p[g++]=e[n(1085)](e.vxiJc(e[n(630)](m,18),7),240),p[g++]=e[n(1780)](e[n(1396)](e.cFmiJ(m,12),63),128)):(this[n(752)]=_0x42aee7,this[n(335)]=_0x35b1df,this._qosDB=_0x2883b7),p[g++]=e[n(1320)](e[n(953)](m,6),63)|128),p[g++]=e[n(1071)](e[n(1592)](63,m),128))}}function jn(s,t){let n=r,i=e[n(892)](de,s,t[n(773)]),c=s[n(1288)],l=t[n(1288)];for(let g=0,p=t[n(773)];e[n(1077)](g,p);g++)c[e[n(543)](g,i)]=l[g]}function ne(s){let t=r;if(e.pMSlE!==t(461))return s[t(1288)][e[t(298)](je,s,1)];_0x4515a3[t(891)]=_0x55c205[t(1183)]().then(()=>(_0x2744fe(),_0x81b735))[t(1471)](function(n){return n})}function ye(s,t){let n=r,i=de(s,1);s[n(1288)][i]=t}function V(s){let t=r,n=0,i=0,c;do c=e.kEbJS(ne,s),e[t(1009)](n,32)&&(i|=e[t(1653)](127&c,n)),n+=7;while(e[t(1491)](128,c));return i}function q(s,t){let n=r;for(t>>>=0;e[n(734)](t,128);)e[n(960)](ye,s,e[n(1126)](e[n(1621)](127,t),128)),t>>>=7;e[n(1524)](ye,s,t)}function Jr(s,t){let n=r,i=0,c=0,l=0,g;if(g=e[n(1459)](ne,s),i=e[n(592)](127,g),e[n(1592)](128,g)&&(g=e[n(695)](ne,s),i|=e[n(810)](127,g)<<7,e.PwwWB(128,g)&&(g=ne(s),i|=e[n(798)](127&g,14),128&g&&(g=e.QTEfR(ne,s),i|=e[n(1724)](127&g,21),e[n(1726)](128,g)&&(g=e[n(1677)](ne,s),c=127&g,e.IOMGJ(128,g)&&(g=e.vdGiz(ne,s),c|=e[n(1246)](e[n(1320)](127,g),7),e[n(1782)](128,g)&&(g=e[n(662)](ne,s),c|=e[n(1726)](127,g)<<14,e[n(881)](128,g)&&(g=e[n(955)](ne,s),c|=e[n(1381)](127,g)<<21,e[n(783)](128,g)&&(g=e.PDTqo(ne,s),l=e[n(1345)](127,g),128&g))))))))){if(e[n(516)]==="srhdY")return"frontier_"+this[n(752)];g=e[n(1459)](ne,s),l|=(127&g)<<7}return{low:e.gEvRQ(i,e[n(324)](c,28)),high:e[n(1389)](e[n(1607)](c,4),e[n(897)](l,24)),unsigned:t}}function wt(s,t){let n=r,i=t[n(1047)]>>>0,c=e.qWyrN(e[n(649)](e[n(982)](t[n(1047)],28),e[n(481)](t.high,4)),0),l=t[n(1191)]>>>24,g=l===0?c===0?e[n(1736)](i,16384)?e.JgBjX(i,128)?1:2:e[n(328)](i,2097152)?3:4:c<16384?c<128?5:6:c<2097152?7:8:e.GPVaG(l,128)?9:10,p=e[n(857)](de,s,g),u=s[n(1288)];switch(g){case 10:u[e[n(449)](p,9)]=e[n(1307)](e[n(267)](l,7),1);case 9:u[e[n(1388)](p,8)]=g!==9?128|l:e[n(1307)](127,l);case 8:u[e.mDXPN(p,7)]=e[n(704)](8,g)?e[n(1607)](c,21)|128:e[n(1381)](e[n(1488)](c,21),127);case 7:u[e[n(1176)](p,6)]=e.sxtdU(7,g)?e[n(1452)](e[n(923)](c,14),128):e[n(1324)](e.bSRHk(c,14),127);case 6:u[e[n(351)](p,5)]=g!==6?e[n(980)](e[n(1730)](c,7),128):e[n(1777)](c,7)&127;case 5:u[e[n(1097)](p,4)]=e[n(1282)](5,g)?128|c:e.XeAVT(127,c);case 4:u[p+3]=e[n(755)](4,g)?e[n(1071)](e.bGzkf(i,21),128):e[n(315)](i>>>21,127);case 3:u[e[n(1014)](p,2)]=e[n(1351)](3,g)?e[n(1575)](e[n(1607)](i,14),128):e[n(1324)](e[n(1067)](i,14),127);case 2:u[e[n(1610)](p,1)]=e[n(410)](2,g)?e[n(1635)](e[n(267)](i,7),128):e[n(1672)](e[n(1224)](i,7),127);case 1:u[p]=e[n(722)](1,g)?e[n(1082)](128,i):e[n(800)](127,i)}}function Vr(s){let t=r;return e.Thdaa(t(1e3),t(1e3))?e.MyLMx(T,s):this[t(1089)+"T"]||this[t(1074)+"X"]?this["_miniNav"+t(817)+t(1147)]:(this._isBrowser||this[t(1152)+"r"])&&this[t(1107)][t(801)+"tworkCha"+t(1469)]?_0x47cc8e[t(1335)]:!0}function Wn(s){return e[r(838)](A,s)}let Xr=65536,Jo=e.YXYUg,et=e[r(890)](Xr,Xr),Yr=et*et,Zr=e[r(1419)](Yr,2),Oe=String.prototype[r(825)+"At"];class O{constructor(t,n,i){let c=r;this[c(1789)]=!0,this[c(1047)]=e[c(1452)](0,t),this.high=e.SeruD(0,n),this[c(1008)]=!!i}static isLong(t){let n=r;return t&&e.ZgJDX(!0,t[n(1789)])}static[r(792)](t,n,i){return new O(t,n,i)}static fromBytes(t,n,i){let c=r;if(e[c(1321)](e.GlPUE,c(526)))this[c(910)+c(398)+c(1034)](_0x4add67),_0x139400[c(851)](_0x1b69d5,_0x5428fb,_0xd8fb14.message[c(781)]);else return i?O[c(343)+c(1271)](t,n):O[c(343)+"sBE"](t,n)}static[r(343)+r(1271)](t,n){let i=r;if(i(565)===e[i(1392)])return new O(e[i(559)](e[i(1681)](e[i(484)](t[0],e[i(1384)](t[1],8)),e[i(1700)](t[2],16)),e[i(1720)](t[3],24)),e[i(819)](e[i(1323)](e[i(1696)](t[4],t[5]<<8),e[i(897)](t[6],16)),e[i(1453)](t[7],24)),n);if(YWxCjJ[i(986)](_0x329c40,_0x15fdce)){if(YWxCjJ[i(1767)](_0x1033b1,YWxCjJ.GBCSQ))return _0xa5b9ce.get(_0x139727);if(_0x43ca84===i(831)+i(1589))return _0x4551c1.objectStoreNames||_0x347d86[i(1054)](_0x2c14ee);if(YWxCjJ[i(1449)](_0x345aa6,YWxCjJ[i(1675)]))return _0x3597a0[i(831)+i(1589)][1]?void 0:_0x58fe92[i(831)+i(604)](_0x5c84af[i(831)+i(1589)][0])}return _0x59b07a(_0x5a874f[_0x3216a8])}static[r(343)+r(1551)](t,n){let i=r;if(e[i(1075)]!==i(975)){let c=this[i(1191)],l=this[i(1047)];return[e[i(1073)](c,24),e.EEhAd(c,16)&255,e[i(1305)](c,8)&255,e.noDNJ(255,c),e.mAjdE(l,24),e[i(1525)](e.ZLbiC(l,16),255),e[i(982)](l,8)&255,e[i(1345)](255,l)]}else return new O(e[i(1323)](e[i(1085)](e.uuTnm(e.cYjjC(t[4],24),e[i(733)](t[5],16)),t[6]<<8),t[7]),e[i(764)](e.auagC(t[0]<<24,e[i(481)](t[1],16)),e[i(1384)](t[2],8))|t[3],n)}static[r(1733)](t){let n=r;return e[n(1792)](t,Jo)?$r:new O(e.BszwI(e[n(1559)](e[n(559)](e[n(915)](Oe[n(1092)](t,0),Oe[n(1092)](t,1)<<8),Oe[n(1092)](t,2)<<16),e[n(1724)](Oe[n(1092)](t,3),24)),0),e[n(1504)](e[n(905)](Oe[n(1092)](t,4),Oe[n(1092)](t,5)<<8)|e[n(1453)](Oe[n(1092)](t,6),16),e[n(1237)](Oe.call(t,7),24))>>>0,!0)}[r(471)](){let t=r;return e.XSasJ("QxnPU",e.XAWNT)?String.fromCharCode(e[t(650)](255,this[t(1047)]),e[t(1621)](e[t(1607)](this[t(1047)],8),255),e[t(657)](e[t(1067)](this[t(1047)],16),255),e.EEhAd(this[t(1047)],24),e[t(269)](255,this[t(1191)]),e.bBqOZ(this[t(1191)],8)&255,e[t(1199)](this[t(1191)],16)&255,e[t(1674)](this[t(1191)],24)):this[t(1682)]?.[t(1423)](_0x29f898)}static[r(389)+"er"](t,n=!0){let i=r;if(isNaN(t))return n?Vo:$r;if(n){if(t>=Yr)return Yo}else{if(e[i(1202)](t,-Zr))return Zo;if(e[i(1716)](t,1)>=Zr)return Xo}return O.fromBits(e.vNEHc(e[i(699)](t,et),0),e.vNEHc(t/et,0),n)}[r(396)](){let t=r;return this[t(1008)]?e[t(1779)](e[t(632)](e[t(642)](this[t(1191)],0),et),e.ZLbiC(this[t(1047)],0)):e.RUGMi(e.zzqgf(this[t(1191)],et),e[t(1777)](this.low,0))}[r(1417)](){let t=r;return e[t(325)](0,this.high)&&e[t(1445)](0,this.low)}[r(1158)](t){let n=r;O[n(1789)](t)||(t=O[n(389)+"er"](t));let i=e[n(1224)](this[n(1191)],16),c=e[n(1253)](65535,this[n(1191)]),l=this[n(1047)]>>>16,g=e[n(340)](65535,this[n(1047)]),p=t[n(1191)]>>>16,u=e.TICPc(65535,t[n(1191)]),m=e.TRgVy(t[n(1047)],16),w=e[n(609)](65535,t[n(1047)]),S=0,D=0,N=0,I=0;return I+=g+w,N+=I>>>16,I&=65535,N+=e[n(1261)](l,m),D+=e[n(642)](N,16),N&=65535,D+=e[n(1793)](c,u),S+=e[n(835)](D,16),D&=65535,S+=e.CpKpv(i,p),S&=65535,O[n(792)](e[n(1110)](N<<16,I),e[n(1795)](e[n(1534)](S,16),D),this[n(1008)])}equals(t){let n=r;return O[n(1789)](t)||(t=O[n(389)+"er"](t)),e[n(1373)](this.unsigned,t[n(1008)])&&e[n(1792)](e.qXnug(this.high,31),1)&&e.fUqtt(t[n(1191)],31)===1?!1:this.high===t[n(1191)]&&this[n(1047)]===t[n(1047)]}[r(294)](){let t=r;return this[t(1047)]===-1&&this[t(1191)]===-1?O.fromBits(0,0,this[t(1008)]):this.low===-1?O.fromBits(0,e[t(1357)](this[t(1191)],1),this.unsigned):O[t(792)](e[t(1146)](this[t(1047)],1),this[t(1191)],this[t(1008)])}[r(1784)](t){let n=r,i={DWOYH:n(1608)+n(1794)};if(e[n(1606)](e.OQzuu,e.OQzuu))return t?this[n(866)+"E"]():this[n(1275)+"E"]();_0x28cf9b[n(1713)][n(1149)+n(665)](_0x39dc02),_0x194523[n(621)+n(1615)]=void 0,_0x38d9f9(_0x1c073b&&_0x11dc26[n(805)]||i[n(451)])}[r(866)+"E"](){let t=r,n=this.high,i=this[t(1047)];return[e[t(1557)](255,i),e[t(651)](e[t(786)](i,8),255),e[t(1253)](e[t(1465)](i,16),255),e[t(509)](i,24),e[t(850)](255,n),e.EVWsO(n>>>8,255),e[t(1044)](n>>>16,255),n>>>24]}toBytesBE(){let t=r,n=this[t(1191)],i=this[t(1047)];return[e[t(457)](n,24),e[t(578)](e[t(1472)](n,16),255),n>>>8&255,e[t(783)](255,n),e[t(1225)](i,24),e[t(1523)](i,16)&255,e[t(651)](e[t(713)](i,8),255),e[t(1633)](255,i)]}}let $r=new O(0,0,!1),Vo=new O(0,0,!0),Xo=O[r(792)](-1,2147483647,!1),Yo=O[r(792)](-1,-1,!0),Zo=O[r(792)](0,-2147483648,!1);var Me=(function(s){let t=r,n=(t(1537)+t(1562))[t(862)]("|"),i=0;for(;;){switch(n[i++]){case"0":s[s[e[t(1129)]]=5005]=e[t(1129)];continue;case"1":s[s[t(369)+t(547)+"R"]=5003]=e[t(1053)];continue;case"2":return s;case"3":s[s["CONNECTI"+t(1553)]=5002]=e.ZhAUB;continue;case"4":s[s[t(970)+t(466)]=5001]=e[t(1138)];continue;case"5":s[s[e[t(914)]]=5004]=e[t(914)];continue}break}})({});class nt{constructor(t){let n=r;this.type=t,this[n(1218)]=null}}class Qr extends nt{constructor(t,n){let i=r,c={RCxOU:function(l,g){return e.FfRZJ(l,g)},izZLN:e[i(1111)],Boier:e[i(1783)],mVmXG:e[i(1072)]};if(e[i(722)](e[i(818)],e[i(818)])){let l={mAmuR:function(u,m){return c[i(1256)](u,m)},dDeUH:i(1438),IVUaK:c[i(1160)],tMdib:c[i(1254)]};this[i(1020)+i(1759)](),this[i(1029)+"gTimeoutId"]=_0x3ee3e0(this._ping[i(1538)](this),this[i(1107)][i(694)+"rval"]);let g=()=>{let u=i;c[u(1256)](_0x6874fe,c.izZLN),this[u(870)](u(310)+u(445)+"s",g),this[u(870)](c[u(1254)],p)},p=()=>{let u=i;l[u(845)](_0x6e082a,l[u(1052)]),this[u(870)](l.IVUaK,g),this.off(l.tMdib,p)};this.on("ping_onc"+i(445)+"s",g),this.on(c[i(1254)],p),this[i(1397)]()}else super(t),this[i(1576)]=n&&n[i(1576)]||null}}class es extends nt{constructor(t,n){let i=r,c={gSHza:function(l,g){return l(g)}};if(e.sJtJw!=="fUpDa")_0x4ec3bc(FQmjpQ.gSHza(_0x2a2b72,_0x2cc2f6[i(364)]),_0x30c118[i(849)+"on"],_0x55ca11[i(1484)+"on"],_0x5d83ba(_0x321702[i(499)+i(1535)]));else{let l=e.ZxaCq[i(862)]("|"),g=0;for(;;){switch(l[g++]){case"0":this.message=n&&n[i(1576)]||"";continue;case"1":this[i(1188)]=n&&n[i(1188)]||0;continue;case"2":this.code=n&&n[i(1394)]||5001;continue;case"3":this[i(1172)]=n&&n[i(1172)]||null;continue;case"4":this.filename=n&&n[i(638)]||"";continue;case"5":this[i(439)]=n&&n[i(439)]||0;continue;case"6":super(t);continue}break}}}}class ts extends nt{constructor(t,n){let i=r;if(e[i(1239)](e[i(1718)],e[i(1718)])){let c=e[i(1024)][i(862)]("|"),l=0;for(;;){switch(c[l++]){case"0":this[i(674)]=n&&n[i(674)]||!1;continue;case"1":this["willReco"+i(425)]=n&&n[i(1573)+"nnect"]||!1;continue;case"2":super(t);continue;case"3":this.reason=n&&n[i(1794)]||"";continue;case"4":this.code=n&&n[i(1394)]||0;continue}break}}else return _0x325a43[i(570)+"Code"](e[i(887)](255,this[i(1047)]),this.low>>>8&255,e.hsTmQ(e[i(509)](this.low,16),255),e[i(1488)](this[i(1047)],24),e.YREGo(255,this.high),e.BGzLs(this[i(1191)],8)&255,e[i(1507)](e[i(1199)](this.high,16),255),this[i(1191)]>>>24)}}class ns extends nt{constructor(t,n){super(t),this.data=n&&n.data||null}}class rs extends ns{constructor(t,n){let i=r,c={bihfi:e[i(837)]};if(e[i(1643)](e[i(687)],e[i(687)])){let l=i(1041)+_0x583f19+(i(1701)+"ax retri"+i(1135)+"ed");this[i(910)+"hErrorEv"+i(833)](_0x5bdb79(c[i(1383)],{message:l,code:_0xffe88a[i(369)+i(547)+"R"],error:_0x5c433b}));return}else super(t),this[i(496)]=n&&n[i(496)]||null,this[i(1576)]=n&&n[i(1576)]||null}}class ss extends nt{constructor(t,n){let i=r;super(t),this[i(496)]=n&&n[i(496)]||null}}function oe(s,{message:t,code:n,error:i}){return new es(s,{message:t,code:n,error:i})}function le(s,{code:t,reason:n,wasClean:i,willReconnect:c}){return new ts(s,{code:t,reason:n,wasClean:i,willReconnect:c})}function is(s,{data:t,message:n}){return new rs(s,{data:t,message:n})}function os(s,{data:t}){return new ss(s,{data:t})}function Jn(s,{message:t}){let n=r;return e[n(404)](e.Wdklm,e[n(1177)])?this[n(1505)+"tManager"]?.[n(1544)+n(289)+n(332)+n(839)]()||0:new Qr(s,{message:t})}class as{constructor(t,n){let i=r;this.endpoints=t,this.maxRetries=n,this["currentI"+i(871)]=0,this[i(1287)+"ndpointT"+i(1015)+"t"]=0}["resetEnd"+r(1407)+"fig"](){let t=r;this[t(757)+"ndex"]=0,this["currentE"+t(616)+t(1015)+"t"]=0}[r(353)+"es"](){let t=r;this[t(1287)+"ndpointTriesCount"]=0}[r(1544)+r(289)+"nt"](){let t=r;return this.endpoints[this[t(757)+t(871)]]}[r(1544)+r(289)+"ntTriesC"+r(839)](){let t=r;return this[t(1287)+t(616)+t(1015)+"t"]}[r(1489)+"chMaxTries"](){let t=r;return!!(e.cSuzp(this[t(757)+"ndex"],this.endpoints.length)||e[t(1792)](this["currentI"+t(871)],e.HECSW(this.endpoints[t(1080)],1))&&e[t(1749)](this[t(1287)+t(616)+t(1015)+"t"],this[t(378)+"es"]))}["checkCur"+r(680)+r(1760)+r(1007)+r(1028)](){let t=r;if(e[t(1231)](e[t(1467)],e[t(1387)]))return this["currentI"+t(871)]==this[t(356)+"s"].length?!0:e.ywyfl(this[t(1287)+"ndpointT"+t(1015)+"t"],this.maxRetries);_0x556d28+=e[t(1228)](_0x35bd1a,_0x469669),_0x35ea4e+=2}["replaceB"+r(656)+r(326)+r(1316)+r(1013)](){let t=r;if(e[t(666)]!==t(275))return this[t(1287)+t(616)+t(1015)+"t"]=1,this[t(757)+"ndex"]++,this.endpoints[this[t(757)+t(871)]];{let n=_0x10aacf(_0x391c7d,_0x4075d2);return _0x170e90[t(1288)][t(828)](n,e.RNsYk(n,_0x53dc94))}}["getCurrentEndpoi"+r(1656)+r(1227)](){let t=r;return this[t(1287)+"ndpointTriesCount"]++,this["getCurre"+t(289)+"nt"]()}}let rt=(e.DXsIi(e[r(854)],typeof globalThis)&&e[r(1303)]===globalThis[r(1341)+r(987)][r(1494)]||e[r(301)](e[r(854)],typeof window)&&e.HQxQE(e.LtSLG,window[r(1341)+"tor"].name))&&e[r(854)]!=typeof document,We=e[r(854)]!=typeof globalThis&&(e.IPYMc(e[r(759)],globalThis[r(1341)+r(987)][r(1494)])||e.XSasJ(e[r(594)],globalThis["construc"+r(987)][r(1494)]))&&e.JpEiS!=typeof tt,yt=(e[r(1208)](e[r(854)],typeof globalThis)&&e.HQxQE(r(607),globalThis[r(1341)+r(987)][r(1494)])||e[r(538)](e.JpEiS,typeof globalThis)||e[r(688)](r(1236)+"d",typeof globalThis)&&!!globalThis[r(1187)+"Bridge"])&&e[r(854)]!=typeof wx,vt=e.JpEiS!=typeof globalThis&&(e[r(594)]===globalThis["construc"+r(987)][r(1494)]||e[r(894)](e.nVKnN,globalThis[r(1341)+r(987)][r(1494)])||e[r(1578)](e[r(1702)],globalThis.constructor[r(1494)]))&&e[r(854)]!=typeof self,$o=e.lHfAk(e.JpEiS,typeof globalThis)&&e[r(763)](r(607),globalThis[r(1341)+"tor"][r(1494)])&&e[r(778)](e[r(854)],typeof global)&&r(607)===global[r(1341)+r(987)].name&&e[r(688)](e[r(854)],typeof process)&&!!process.version;class Vn{constructor(){let t=r;this[t(623)+"rs"]={}}[r(926)](t,...n){let i=r,c=this._listeners[t];if(c)c[i(949)]()[i(969)](l=>l.fn[i(655)](l[i(581)],n));else if(e[i(1364)](e.xKkBm,t)&&!this[i(1325)]){let l=n.length&&n[0];if(e[i(986)](l,Error))throw l;let g=new Error(e[i(1371)](i(878)+i(469),l?e[i(1261)](" (",l[i(1576)])+")":""));throw g[i(1715)]=l,l}return this}off(t,n){let i=r;if(e[i(1153)](void 0,t))this[i(623)+"rs"]={};else if(n===void 0)this[i(623)+"rs"][t]=null;else if(e[i(1321)](e[i(560)],e[i(560)]))try{return!!this[i(1682)]}catch(c){return _0x48aa79.log(c),!1}else{let c=this[i(623)+"rs"][t];if(c)for(let l=0;e[i(690)](l,c[i(1080)]);)e[i(325)](c[l].fn,n)?c[i(787)](l,1):++l}return this}on(t,n,i){let c=r;return(this._listeners[t]||(this[c(623)+"rs"][t]=[]))[c(1290)]({fn:n,ctx:i||this}),this}}class Qo extends Vn{[r(954)+r(614)+"age"](t){let n=r;return t[n(1483)]||t[n(1309)]?(n(464)+" "+(t[n(1483)]||"")+n(1281)+(t[n(1309)]||"")).trim():JSON.stringify(t)}constructor(t,n,i){let c=r,l={UBOCX:e[c(988)],HRxQq:e.xKkBm,iRszq:function(g){return e.tBJAy(g)},AALWl:function(g,p){return e[c(1459)](g,p)},aIVVJ:e.KyDwT,jXDRt:function(g){return g()}};if(e[c(1646)]===c(1109)){let g={GZqYW:function(w){let S=c;return OrvYyL[S(797)](w)},glnZn:function(w,S){let D=c;return OrvYyL[D(447)](w,S)},kJXsI:OrvYyL[c(1564)],XSyye:function(w){let S=c;return OrvYyL[S(1410)](w)}},p=()=>{let w=c;_0x47a192[w(906)+w(455)+"ner"](OrvYyL.UBOCX,u),_0x4144c7[w(906)+"entListe"+w(477)](OrvYyL[w(652)],m),_0x681b31["removeEv"+w(455)+w(477)](w(320),m)},u=()=>{let w=c;_0x5556eb(),g[w(346)](p)},m=()=>{let w=c;g.glnZn(_0xda8e3f,_0x487ce6[w(1172)]||new _0x3b4e9a(g.kJXsI,w(1634)+"or")),g[w(1296)](p)};_0x5c22a2[c(1498)+c(1087)](c(1433),u),_0x188096[c(1498)+c(1087)](OrvYyL[c(652)],m),_0x44698a[c(1498)+c(1087)](c(320),m)}else super(),this._socket=null,yt&&wx[c(719)+"ocket"]&&(this[c(1661)]=wx.connectSocket({url:t,protocols:n,header:i,fail:this[c(1331)+c(1416)+c(932)][c(1538)](this),success:this[c(1331)+c(1366)+c(1241)+c(460)][c(1538)](this)})),We&&tt[c(719)+"ocket"]&&(this[c(1661)]=tt["connectS"+c(1102)]({url:t,protocols:n,header:i,fail:this[c(1331)+c(1416)+c(932)][c(1538)](this),success:this[c(1331)+"ocketSuc"+c(1241)+c(460)][c(1538)](this)}))}[r(1331)+r(1366)+r(1241)+"ler"](){let t=r;Promise.resolve()[t(1471)](()=>{let n=t;this[n(1200)+n(1660)]()})}["_createSocketFai"+r(932)](t){let n=r,i={zDykb:n(1172),GHrfV:function(c,l,g){return e[n(1229)](c,l,g)},UPOsb:e[n(1292)]};Promise.resolve()[n(1471)](()=>{let c=n,l=oe(i.zDykb,{message:this._formatErrorMessage(t)});this.emit(i[c(646)],l);let g=i[c(1708)](le,i.UPOsb,{reason:this[c(954)+c(614)+c(571)](t)});this[c(926)](i[c(1624)],g)})}[r(1200)+r(1660)](){let t=r,n={GKmpf:e[t(1529)],uYLMD:e[t(601)],xBBjH:function(i,c,l){return e[t(1684)](i,c,l)},kvUKt:t(917)+">",bFnRw:function(i,c){return e[t(1411)](i,c)},KIYML:t(720),wFMnQ:function(i,c,l){return i(c,l)},FKrUj:function(i,c,l){return e[t(857)](i,c,l)},gZyOa:t(1172),cCupU:function(i,c,l){return e[t(692)](i,c,l)}};this._socket.onOpen(i=>{let c=t;n[c(612)]===n.GKmpf?this[c(926)](n[c(731)],n.xBBjH(os,"open",{...i,data:i[c(1483)]||""})):this._socket&&this[c(1661)][c(673)]({code:_0x31bb39,reason:_0x1820f9})}),this[t(1661)][t(322)](i=>{let c=t,l={jXIja:n[c(365)]};n[c(1215)](c(809),n[c(293)])?this[c(926)](c(673),n[c(736)](le,"close",{...i})):this._options[c(647)]&&_0x514a8[c(1627)][c(655)](_0x47aca6,[l[c(641)],..._0x2c2816])}),this[t(1661)].onMessage(i=>{let c=t;this[c(926)](c(1576),n[c(584)](is,c(1576),{...i}))}),this[t(1661)][t(1278)](i=>{let c=t;this[c(926)](n[c(974)],n[c(1360)](oe,n[c(974)],{...i,message:i[c(1483)]||""}))})}[r(393)](t){let n=r,i={qsYXf:function(c,l,g){return e[k(480)](c,l,g)},cexjH:e.xKkBm,WslUB:n(1217)};if(e.Cwrjn(t,Uint8Array)){let c=t[n(350)].slice(t[n(1664)+"et"],t[n(468)+"th"]+t[n(1664)+"et"]);this._socket&&this[n(1661)][n(393)]({data:c,fail:l=>{let g=n;this[g(926)]("error",i[g(1451)](oe,i[g(1170)],{message:this[g(954)+g(614)+g(571)](l)}))}})}else this[n(1661)]&&this[n(1661)].send({data:t,fail:c=>{let l=n;i[l(610)]!==i[l(610)]?this.off(_0x438457,_0x32eed5):this[l(926)](l(1172),i[l(1451)](oe,l(1172),{message:this["_formatE"+l(614)+l(571)](c)}))}})}[r(673)](t,n){let i=r;this[i(1661)]&&this[i(1661)][i(673)]({code:t,reason:n})}[r(1498)+"Listener"](t,n){let i=r;if(e[i(512)](e[i(495)],e[i(495)]))this.on(t,n);else try{this[i(1508)]&&this[i(1508)][i(673)](_0x16a45b,_0x72ca6b)}catch{}}[r(906)+"entListe"+r(477)](t,n){this.off(t,n)}get[r(504)+"te"](){let t=r;return this[t(1661)][t(504)+"te"]}get[r(357)+"pe"](){let t=r;if(e[t(744)](t(1485),e.LlPHb))_0xb22e8f=_0x4f6bb5[e.kffJc(_0x5c36aa+_0x5bae39,1)],_0x5de288=_0x3b665a[e[t(1097)](e.ixcCJ(_0x209351,_0x571ea9),2)],_0x5d4b4b=_0x2f89d1[e[t(1144)](_0x362623+_0x36dbeb,3)],e[t(1782)](e[t(1071)](_0x300deb|e.HuiEJ(_0x3391c3,8),e[t(329)](_0x24b1df,16)),12632256)!==8421504?_0x178b3c+=_0x171c78:(_0x5a7a6e=e[t(1504)](e[t(583)](e[t(277)](7,_0x45d9c7)<<18,e[t(998)](63,_0x343f5a)<<12)|e.zNAbm(e[t(1057)](63,_0x58306d),6),e.PwwWB(63,_0x119328)),e[t(1123)](_0x800a4e,65536)||e.qHYkx(_0xa49c43,1114111)?_0x3c0daf+=_0x2a22dd:(_0x1cbfe2-=65536,_0x222787+=e.smquA(_0x2086aa,e[t(832)](e[t(953)](_0xbcc4d2,10),55296),e[t(432)](e.CLTZS(1023,_0x59f2d9),56320)),_0x493da2+=3));else return this[t(1661)].binaryType}set[r(357)+"pe"](t){}get url(){let t=r;if(e.MbDBF(e[t(1671)],"aSLld"))this._cursorNameSpace=_0x203a85,this._cursorFileName=_0x21d104,this[t(929)+t(510)]=_0x67d457,this[t(1682)]=e.CHYSe(_0x33a4c5,this[t(585)+t(1403)],e[t(815)]);else return this[t(1661)][t(716)]}get[r(1761)](){let t=r;return this[t(1661)][t(1761)]}get[r(826)+"ns"](){let t=r;return this[t(1661)][t(826)+"ns"]}get[r(476)+r(1441)](){return 0}}function e0(s,t){let n=r;if(t)return new t(s.url,s[n(1761)]);if(e[n(1121)](yt,We))return new Qo(s[n(716)],s[n(1761)],s.headers);if(e[n(1270)](rt,vt)&&e[n(688)](e[n(854)],typeof WebSocket)&&WebSocket)return new WebSocket(s[n(716)],s.protocols)}function t0(s){let t=r,n=e[t(567)][t(862)]("|"),i=0;for(;;){switch(n[i++]){case"0":if(We&&tt[t(719)+"ocket"])return!0;continue;case"1":if(e[t(1785)](rt,vt)&&e[t(688)](e[t(854)],typeof WebSocket)&&WebSocket)return!0;continue;case"2":if(yt&&wx["connectS"+t(1102)])return!0;continue;case"3":return!1;case"4":if(s)return!0;continue}break}}function xs(s,t,n){let i=r,c={LkSuz:function(p,u){return p<=u},KguYh:function(p,u){return p===u}},l=-1;async function g(p){let u=k;return c[u(963)](p,l)?Promise[u(927)](new Error(u(316)+u(1096)+u(1061)+u(1104)+"process")):(l=p,c.KguYh(p,n[u(1080)])?Promise[u(1183)]():n[p][u(1538)](s)(t,g[u(1538)](null,p+1)))}e[i(1717)](g,0)}function cs(s){let t=r;if(e[t(336)](t(1406),e.istVX)){let n=0,i=0;for(let c=0;c<s[t(1080)];++c)i=s[t(825)+"At"](c),i<128?n+=1:e[t(1294)](i,2048)?n+=2:e[t(961)](64512,i)===55296&&e[t(942)](e.KiGbf(64512,s[t(825)+"At"](e[t(344)](c,1))),56320)?(++c,n+=4):n+=3;return n}else{let n=this[t(1191)],i=this.low;return[255&i,e[t(323)](e[t(338)](i,8),255),e[t(1339)](e[t(267)](i,16),255),e[t(1777)](i,24),e.OSbto(255,n),e[t(1018)](e[t(1113)](n,8),255),e.VZqVu(e.PErbw(n,16),255),e[t(1224)](n,24)]}}function fs(s,t,n){let i=r;if(e[i(603)](e.GlNTb(n,t),1))return"";let c="";for(let l=t;e[i(603)](l,n);){let g=s[l++];if(e.iGlpR(g,127))c+=String[i(570)+"Code"](g);else if(e[i(1447)](g,192)&&e[i(1599)](g,224))c+=String[i(570)+i(366)](e.LBwVm(e[i(1425)](e[i(723)](31,g),6),e.yodoS(63,s[l++])));else if(e.KtlEF(g,224)&&e[i(603)](g,240))c+=String[i(570)+"Code"](e[i(819)](e[i(421)](e[i(928)](15,g),12)|e[i(1581)](e[i(800)](63,s[l++]),6),e[i(340)](63,s[l++])));else if(e[i(985)](g,240)){let p=e.BXzZM(e[i(1635)](e[i(937)](e.uaDAp(7,g),18)|e[i(1522)](63,s[l++])<<12|e[i(937)](e[i(578)](63,s[l++]),6),63&s[l++]),65536);c+=String["fromChar"+i(366)](e[i(717)](55296,e[i(545)](p,10))),c+=String[i(570)+i(366)](e.RFteU(56320,e.KiGbf(1023,p)))}}return c}function Xn(s,t,n){let i=r,c=n,l,g;for(let p=0;e[i(690)](p,s[i(1080)]);++p)if(l=s[i(825)+"At"](p),e.DuSak(l,128))t[n++]=l;else if(e[i(591)](l,2048))if(e[i(1098)]===e[i(319)])try{return e[i(688)](e[i(1348)],typeof _0x53974e)&&(e[i(986)](_0x5a8774,_0x499345)||_0x608734[i(350)]&&e[i(718)](_0x7ec60f.buffer,_0x4b93cb))||e[i(301)](i(500),typeof _0x31b627)?"":(_0x567b12.parse(_0x43ffc6),i(1754)+i(686))}catch{return e[i(538)](e[i(1348)],typeof _0x16adf1)?e[i(1207)]:""}else t[n++]=l>>6|192,t[n++]=e.SXlVG(63&l,128);else e[i(1445)](e[i(1672)](64512,l),55296)&&e.qKMgy(e[i(493)](64512,g=s[i(825)+"At"](p+1)),56320)?(l=e.BdcIW(65536+e[i(1653)](e[i(887)](1023,l),10),1023&g),++p,t[n++]=e[i(1645)](e.mmSHf(l,18),240),t[n++]=e[i(706)](e[i(1307)](e[i(893)](l,12),63),128),t[n++]=e.OYMXE(e[i(1212)](l,6),63)|128,t[n++]=e.JBaNy(e.Cyqur(63,l),128)):(t[n++]=e[i(1415)](e[i(1775)](l,12),224),t[n++]=e[i(1507)](e.dksDr(l,6),63)|128,t[n++]=e[i(588)](e[i(723)](63,l),128));return e[i(1402)](n,c)}async function us(s){let t=r;if(e[t(538)](e[t(1348)],typeof s)){let n=new Uint8Array(e[t(726)](cs,s));return e.FKzjL(Xn,s,n,0),n}return e[t(1012)](s,ArrayBuffer)?new Uint8Array(s):new Uint8Array(s[t(350)],s.byteOffset,s[t(468)+"th"])}function n0(s){let t=r;try{return e[t(1348)]!=typeof s&&(s instanceof ArrayBuffer||s[t(350)]&&e[t(710)](s[t(350)],ArrayBuffer))||e[t(1348)]!=typeof s?"":(JSON.parse(s),e.QLRpn)}catch{return e.oSFqx(e[t(1348)],typeof s)?e[t(1207)]:""}}let r0=(s,t)=>{let n=r;switch(s){case e[n(1565)]:case e.hGJKr:return{["x-use-"+s]:1,"x-tt-env":t};default:return{}}};class s0{constructor(t){let n=r;this[n(599)+n(839)]=t,this[n(517)]=0}[r(992)](){let t=r;this[t(517)]++}["checkRea"+r(705)+"nt"](){let t=r;return e[t(940)](this.count,this["maxLossC"+t(839)])}[r(1517)+r(1400)](t=0){let n=r;this["maxLossC"+n(839)]=t,this.count=0}}async function i0(s){let t=r,n={fCasa:t(1172),nmKLd:function(i,c){return i instanceof c},YAljd:function(i,c){return i+c},gNhfx:function(i,c){return e[t(336)](i,c)},EAAiz:t(653),BwurQ:e[t(635)],ZTsRn:function(i,c){return e[t(726)](i,c)}};return new Promise(i=>{let c=t;if(!rt)return e.bMJnG(i,e.cbkgp);try{let l=document[c(1499)+c(580)]("script");window[c(621)+c(1615)]=g=>{let p=c,u={mnNCm:n[p(1527)],GUHqe:function(m,w){return n[p(1010)](m,w)},QGadU:function(m,w){return n[p(1439)](m,w)}};if(n.gNhfx(n[p(532)],p(418)))document[p(1713)][p(1149)+p(665)](l),window[p(621)+p(1615)]=void 0,i(g&&g[p(805)]||n[p(834)]);else if(aCeSHg[p(811)](_0x304289,_0x20bcde)){let m=_0x23a3fb.buffer[p(949)](_0x374200[p(1664)+"et"],aCeSHg[p(1263)](_0x560a2a[p(468)+"th"],_0x1c99ae[p(1664)+"et"]));this[p(1661)]&&this[p(1661)][p(393)]({data:m,fail:w=>{let S=p;this.emit(aCeSHg[S(846)],_0x468743(S(1172),{message:this[S(954)+"rrorMess"+S(571)](w)}))}})}else this[p(1661)]&&this._socket[p(393)]({data:_0x5e380f,fail:m=>{let w=p;this.emit("error",_0xa74ad8(aCeSHg[w(846)],{message:this[w(954)+w(614)+w(571)](m)}))}})},l[c(284)]=e[c(1280)],l[c(334)]=e.RNsYk(s[c(394)](/^ws/,e[c(1757)]),e[c(1604)]);try{document[c(1713)]["appendCh"+c(665)](l)}catch{document[c(1713)][c(1149)+c(665)](l)}}catch{if(e[c(1606)](e[c(735)],"NcHsu"))window["frontier"+c(1615)]=void 0,e[c(955)](i,e[c(635)]);else{let l=_0x37add6[c(1092)](pAFdBV[c(880)](_0xe38fd,this),_0x2c8cf2,..._0x1dba5f);return _0x2e0d8e.set(l,_0x2aa0d6[c(541)]?_0x22860e.sort():[_0x40cd71]),_0x4f0c20(l)}}})}function ze(s,t,n){let i=r;if(e[i(512)](i(528),e.SULLm))return!!s?.[i(776)](l=>l.key===t&&l[i(1663)]===n);for(var c in _0x4c3046)_0x303ebc.o(_0x3c0dc7,c)&&!_0x522157.o(_0x591076,c)&&_0x56957b["definePr"+i(877)](_0x54f06c,c,{enumerable:!0,get:_0x504f57[c]})}function st(s,t){let n=r;return s?.[n(776)](i=>i[n(1119)]===t)?.[n(1663)]}let Yn=null;async function o0(){let s=r;return Yn||(Yn=Promise.resolve().then(Se.bind(Se,e[s(1636)]))),Yn}class a0 extends Vn{constructor(t,n){let i=r;super(),this[i(904)]=t,this[i(791)]=n,this._qosDB=void 0,this[i(292)+"mise"]=null}async[r(1136)](){await this[r(886)]()}async _init(){let t=r,n={AgZtK:function(i){return e[k(1251)](i)}};if(!this._qosDB){if(this[t(292)+t(1049)])return this[t(292)+"mise"];try{let i=this._dbName,c=this[t(791)];this[t(292)+"mise"]=(async()=>{let l=t,{openDB:g}=await n[l(1521)](o0);this._qosDB=await g(l(621)+"_"+i,1,{upgrade(p){p["createOb"+l(1542)+"e"](i,{keyPath:c})}})})(),await this["_initPro"+t(1049)]}catch(i){console[t(1627)](i)}finally{this[t(292)+t(1049)]=null}}}async get(t){let n=r;try{return await this[n(886)](),this[n(1682)]?.get(this[n(904)],t)}catch(i){console[n(1627)](i)}}async set(t,n){let i=r;return await this._init(),this[i(1682)]?.[i(1442)](this[i(904)],t)}async[r(1423)](t){let n=r,i={AEwPV:function(c,l){return c(l)},ApnqN:e[n(1475)],XqDpu:e.GRxWl};try{if(e[n(1362)](n(1088),e.WaebR))return await this[n(886)](),this[n(1682)]?.[n(1145)](this[n(904)],t);i[n(1405)](_0x4a25ba,i.ApnqN),this[n(870)](i[n(675)],_0x2bab6d),this[n(870)](n(310)+"e_timeout",_0xe72841)}catch(c){console[n(1627)](c)}}async clear(){let t=r;try{return await this[t(886)](),this[t(1682)]?.[t(813)](this[t(904)])}catch(n){console[t(1627)](n)}}async[r(1603)](){let t=r;return await this[t(886)](),this[t(1682)]?.getAllKeys(this._dbName)}async getAll(){let t=r;return await this._init(),this[t(1682)]?.[t(280)](this[t(904)])}async closeDB(){let t=r,n={VIlfH:function(i,c){return i<c},mouMs:function(i,c){return e[k(964)](i,c)},VSgFK:function(i,c){return e[k(491)](i,c)},saqxt:function(i,c){return i+c},EfGDo:function(i,c){return e[k(1440)](i,c)},fNghq:function(i,c){return e[k(1775)](i,c)},jjDLN:function(i,c){return i&c},ROcKA:function(i,c){return i|c},GusiD:function(i,c){return i&c},ICMOn:function(i,c){return e[k(1319)](i,c)},NfCgk:function(i,c){return e[k(1326)](i,c)},EBkxv:function(i,c){return e.dnPes(i,c)},PBSuG:function(i,c){return e[k(286)](i,c)},mkPtX:function(i,c){return e.NlrDD(i,c)}};try{if(e[t(1481)](t(502),e[t(827)]))this[t(1682)]?.[t(673)](),this._qosDB=void 0;else{let i=_0x311704[t(825)+"At"](_0x209758);i>=55296&&i<=56319&&pkkwPE[t(448)](pkkwPE.mouMs(_0x543cb8,1),_0x5e0a07)&&(i=pkkwPE[t(1093)](pkkwPE.saqxt(i<<10,_0x2fde3d[t(825)+"At"](++_0x45b5b1)),56613888)),pkkwPE[t(448)](i,128)?_0x289a8f[_0x44f1fd++]=i:(pkkwPE[t(448)](i,2048)?_0x2a7de6[_0xa5fca5++]=pkkwPE[t(1630)](pkkwPE[t(679)](i,6)&31,192):(pkkwPE[t(448)](i,65536)?_0x11fbb8[_0x1b6a26++]=pkkwPE[t(1630)](pkkwPE[t(847)](i>>12,15),224):(_0x4783a4[_0x249a4e++]=pkkwPE[t(1506)](pkkwPE[t(830)](pkkwPE[t(415)](i,18),7),240),_0x1625a6[_0x298abc++]=pkkwPE[t(847)](pkkwPE.NfCgk(i,12),63)|128),_0x40118a[_0x428367++]=pkkwPE.EBkxv(pkkwPE[t(1023)](i>>6,63),128)),_0x3f25f2[_0x4ba173++]=pkkwPE[t(534)](pkkwPE[t(830)](63,i),128))}}catch(i){console.log(i)}}get[r(1194)](){let t=r,n={pGEhv:function(i,c,l){return e[k(939)](i,c,l)}};if(e.EsjGH(e[t(401)],e[t(401)]))ZhJCPz[t(459)](_0x13fe5f,_0x310afa,16),ZhJCPz[t(459)](_0x13c32b,_0x3b79e9,_0x43fed1);else try{return!!this[t(1682)]}catch(i){return console[t(1627)](i),!1}}}class x0{constructor(t,n){let i=r;this[i(752)]=t,this[i(335)]=n,this._qosDB=localStorage}async[r(1136)](){}get[r(317)](){return"frontier_"+this._DBName}async[r(1054)](t){let n=r,i=this[n(1682)][n(1182)](this[n(317)]);return JSON[n(1361)](e[n(1121)](i,"{}"))[t]}async[r(851)](t,n){let i=r,c=this._qosDB.getItem(this[i(317)]),l=JSON[i(1361)](c||"{}");return l[n||t[this[i(335)]]]=t,this[i(1682)].setItem(this[i(317)],JSON.stringify(l)),n||t[this._pathKey]}async[r(1423)](t){let n=r,i=this._qosDB[n(1182)](this._prefix),c=JSON[n(1361)](e.oLPBr(i,"{}"));return c[t]=void 0,this[n(1682)][n(858)](this[n(317)],JSON[n(683)+"y"](c))}async clear(){let t=r;return this._qosDB[t(813)]()}async[r(1603)](){let t=r,n=this[t(1682)][t(1182)](this[t(317)]),i=JSON[t(1361)](n||"{}");return Object[t(1603)](i)}async[r(280)](){let t=r,n={qpIvX:function(i,c){return e[k(876)](i,c)},irEtP:function(i,c){return i&c},dBWRr:function(i,c){return e[k(928)](i,c)},fESrJ:function(i,c){return i(c)},HAQSC:function(i,c){return i<<c}};if(e[t(889)](t(1004),"zrzkH"))_0x20a75e=KUZgLg[t(1408)](_0x25524c,_0x290d39),_0x2b0958=KUZgLg[t(1344)](127,_0x29bfe4),KUZgLg[t(768)](128,_0x35d9ed)&&(_0x2318c4=KUZgLg[t(789)](_0x89b3fe,_0x1fe261),_0x362cea|=KUZgLg[t(1680)](KUZgLg[t(1344)](127,_0x471660),7));else{let i=this._qosDB[t(1182)](this[t(317)]),c=JSON[t(1361)](e.nQKeM(i,"{}"));return Object[t(1021)](c)}}[r(1497)](){return Promise[r(1183)]()}get isReady(){let t=r;if(e[t(524)](e[t(946)],t(1728)))return!!this[t(1682)];{let n=_0x3a982b.split(":");for(let i=0;e[t(422)](i,n.length);i++){let c=n[i];if(n[i][t(1080)]!==4){let l=_0x4e28cd[t(1409)+"g"](0,4-n[i][t(1080)]),g=l.concat(c);_0xaff981=_0x1c1c8f.concat(g)}else _0x18db43=_0x3d1188[t(1365)](c)}return _0x459f75}}}class c0{constructor(t,n){let i=r;this[i(752)]=t,this[i(335)]=n,this[i(1682)]=We?tt:yt?wx:null}async[r(1136)](){}get[r(317)](){let t=r,n={SDbak:function(i,c){return e[k(359)](i,c)},pUGWF:function(i,c){return e[k(327)](i,c)},IWcgf:function(i,c){return i|c},NiNjI:function(i,c){return e.nafrv(i,c)},WELhX:function(i,c){return e[k(1509)](i,c)},wpmNw:function(i,c){return i>=c},KDLzf:function(i,c){return e[k(1237)](i,c)},QxINR:function(i,c){return i<<c},dugXw:function(i,c){return i&c},LuCeV:function(i,c){return e[k(1768)](i,c)},mPRRR:function(i,c){return i>=c},QEOYN:function(i,c){return i|c},uhLGH:function(i,c){return i<<c},PFDpE:function(i,c){return e.Dzszn(i,c)},LTnzi:function(i,c){return e[k(1030)](i,c)},cyLLO:function(i,c){return e[k(663)](i,c)},ZpoWO:function(i,c){return e[k(1654)](i,c)}};if(e[t(1282)](e[t(941)],t(1115))){let i=_0xe77289[_0x31ede3++];if(Gavfde[t(1550)](i,127))_0x390760+=_0x133bea["fromChar"+t(366)](i);else if(Gavfde[t(511)](i,192)&&i<224)_0x55606b+=_0x6c8ca2[t(570)+t(366)](Gavfde[t(1577)](Gavfde[t(1622)](31&i,6),Gavfde[t(1132)](63,_0x8ea375[_0x22ec1d++])));else if(Gavfde[t(333)](i,224)&&i<240)_0x349a77+=_0x47f8c1[t(570)+t(366)](Gavfde[t(1577)](Gavfde[t(1577)](Gavfde.KDLzf(15&i,12),Gavfde[t(1790)](Gavfde.dugXw(63,_0x52973d[_0x5e761f++]),6)),Gavfde[t(658)](63,_0xc84951[_0x4b30d2++])));else if(Gavfde[t(539)](i,240)){let c=Gavfde[t(557)](Gavfde[t(1577)](Gavfde[t(1790)](7&i,18),Gavfde[t(640)](Gavfde.PFDpE(63,_0x2c3eb1[_0x415e02++]),12))|Gavfde[t(658)](63,_0x1660e7[_0x49285e++])<<6,Gavfde.LTnzi(63,_0x556a54[_0x1bc16e++]))-65536;_0x37e636+=_0x281d0a[t(570)+t(366)](Gavfde[t(1530)](55296,Gavfde[t(670)](c,10))),_0x344db1+=_0x4cf6c0["fromChar"+t(366)](Gavfde.cyLLO(56320,Gavfde.LuCeV(1023,c)))}}else return t(621)+"_"+this[t(752)]}async[r(1054)](t){let n=r,i=this[n(1682)]["getStora"+n(703)](this[n(317)]);return JSON[n(1361)](e[n(1133)](i,"{}"))[t]}async set(t,n){let i=r,c=this[i(1682)]["getStora"+i(703)](this[i(317)]),l=JSON.parse(e[i(1121)](c,"{}"));return l[n||t[this._pathKey]]=t,this[i(1682)][i(636)+i(703)](this[i(317)],JSON.stringify(l)),n||t[this._pathKey]}async[r(1423)](t){let n=r,i=this[n(1682)][n(406)+"geSync"](this[n(317)]),c=JSON[n(1361)](e[n(644)](i,"{}"));return c[t]=void 0,this[n(1682)][n(636)+"geSync"](this._prefix,JSON[n(683)+"y"](c))}async[r(813)](){let t=r;if(e.ozwDc(t(1514),e[t(1142)]))return this._qosDB[t(371)+t(1778)]();if(this._options[t(1482)+t(1477)+t(1470)]||this._readyClosed)return;this["_handleR"+t(550)]()}async keys(){let t=r,n=this[t(1682)][t(406)+t(1293)+"nc"](this._prefix),i=JSON.parse(e[t(1747)](n,"{}"));return Object[t(1603)](i)}async[r(280)](){let t=r,n=this._qosDB[t(406)+"geInfoSync"](this[t(317)]),i=JSON[t(1361)](e[t(1141)](n,"{}"));return Object[t(1021)](i)}[r(1497)](){let t=r;return e.kTrOk(e.xXhXF,e[t(270)])?Promise[t(1183)]():_0x1526f9(_0x4eb96f)}get isReady(){return!!this._qosDB}}function ds(s,t){let n=r;if(e[n(478)](We,We))return new c0(s,t);if(e[n(684)](rt,vt)&&e[n(301)](e[n(854)],typeof indexedDB))return new a0(s,t);if(e.vmZHz(rt,vt)&&e[n(854)]!=typeof localStorage)return new x0(s,t);throw new Error(e.vSXYL)}class f0{constructor(){let t=r;if(e[t(1379)](e[t(1707)],e[t(1745)]))return(this[t(623)+"rs"][_0x2f2d85]||(this[t(623)+"rs"][_0x1c7d32]=[]))[t(1290)]({fn:_0x1af282,ctx:_0x5d9f28||this}),this;this["_interva"+t(622)+"Id"]=null,this[t(1758)+"l"]=36e5,this[t(1682)]=e[t(1684)](ds,e[t(1648)],t(993)+"id")}async[r(1758)+r(375)](){let t=r;clearInterval(this[t(1758)+t(622)+"Id"]),this[t(1758)+t(622)+"Id"]=e[t(1163)](setInterval,()=>{this["flushExp"+t(1040)]()},this[t(1758)+"l"])}async openDB(){let t=r,n={FmHsb:function(i,c){return e[k(738)](i,c)},RhQlg:function(i,c){return e[k(362)](i,c)},Kqgdn:t(1735),zfllb:t(1066),AhONM:function(i,c){return i===c},LeEFS:e[t(637)]};await this[t(1682)][t(1136)]()[t(1471)](()=>{let i=t,c={dpsXp:function(l,g){return n[k(898)](l,g)},BYbwE:function(l,g){return n.RhQlg(l,g)},vMYta:n.Kqgdn,FOugG:n[i(1658)]};n[i(1125)](n.LeEFS,i(1003))?this[i(1758)+i(375)]():(this["_navigat"+i(1597)]()&&(!this[i(1508)]||c.dpsXp(this[i(1508)][i(504)+"te"],this[i(1352)])||c.BYbwE(this[i(1508)][i(504)+"te"],this.CONNECTING))&&this["_handleO"+i(1025)](),this[i(318)+"er"]&&_0x2fce56[i(1498)+i(1087)](c[i(1151)],this[i(314)+i(1025)]),this[i(318)+"er"]&&_0x38eafd[i(1498)+i(1087)](c[i(882)],this["_handleO"+i(1750)]))})}async[r(586)+r(1040)](){let t=r;(await this[t(1682)]?.getAll()||[]).filter(({timestamp:c})=>c<Date[t(1719)]())[t(969)](c=>{let l=t;this[l(1682)]?.[l(1423)](c.message_id)})}async[r(1423)](t){let n=r;return this[n(1682)]?.[n(1423)](t)}async set(t,n){let i=r;return this[i(1682)]?.[i(851)]({message_id:t,timestamp:n})}async get(t){return this[r(1682)]?.get(t)}async[r(1497)](){let t=r;e[t(876)](clearInterval,this[t(1758)+t(622)+"Id"]),await this._qosDB?.closeDB()}get[r(1194)](){let t=r,n={RqOsW:function(i,c){return e.HEDCX(i,c)}};return e[t(1706)](e[t(354)],e[t(354)])?this[t(1682)]?.[t(1194)]:EFQyKG[t(1238)](_0x12d422(4).join("0"),_0x560651(_0xbee03b,2).toString(16))[t(949)](-4)}}function Zn(s){let t=r,n=!!this[t(1107)][t(349)+"S"];if(!n)return{enabled:n,isQoSMessage:!1,isQoSAck:!1,isAckCleanupMessage:!1,ackMsgIds:[]};let i=e[t(1079)](ze,s[t(1576)].headers,t(1414)+t(1698),"2"),c=i&&e.VxIOA(ze,s[t(1576)][t(1260)],e.aoOKh,"1"),l=i&&e[t(1079)](ze,s.message[t(1260)],e[t(589)],"1"),g=l?st(s[t(1576)][t(1260)],e[t(435)])?.split(",").filter(Boolean)||[]:[];return{enabled:n,isQoSMessage:i,isQoSAck:c,isAckCleanupMessage:l,ackMsgIds:g}}async function ls(){let s=r;return this[s(1117)+"ger"]||(this[s(1117)+"ger"]=new f0),this[s(1117)+s(1631)][s(1194)]||await this[s(1117)+s(1631)][s(1136)](),this["_QoSMana"+s(1631)]}async function u0(s,t){let n=r,i={qiAzh:function(u,m){return e[k(1270)](u,m)}},{enableAutoAck:c}=this[n(1107)],l=e[n(822)](ze,s[n(1576)][n(1260)],n(1312),"1"),g=ze(s[n(1576)][n(1260)],n(1272),"1"),p=Zn[n(1092)](this,s);if(c&&l)if(e[n(1606)](e[n(1571)],e[n(1198)])){let u=this[n(1682)][n(406)+n(1293)+"nc"](this[n(317)]),m=_0x279afb[n(1361)](NoXDiI[n(1609)](u,"{}"));return _0x68e4fe[n(1021)](m)}else{let{SeqID:u,LogID:m,service:w,LogIDNew:S,method:D}=s[n(1576)];this._sendAck({SeqID:u,LogID:m,LogIDNew:S,service:w,method:D,headers:[{key:e[n(1226)],value:"1"},{key:n(370),value:e[n(1270)](S,"")},{key:e[n(1056)],value:"0"}]})}g&&!p[n(1204)]&&this[n(910)+n(966)+"ageEvent"](s),e[n(1251)](t)}async function d0(s,t){this._debug(e.RCdoF,s.message),t()}async function l0(s,t){let n=r,i=e[n(1723)](Vr,await e[n(1717)](us,s[n(496)]));try{if(e[n(710)](i[n(918)],Uint8Array)){let c=e[n(1566)](this[n(1107)][n(561)+n(1175)],Object)?{force:!!this[n(1107)]["payloadE"+n(1175)].force,encoding:this[n(1107)][n(561)+n(1175)].encoding?this[n(1107)][n(561)+n(1175)].encoding[n(394)](/\s/g,"").toLowerCase():""}:{force:!1,encoding:this._options[n(561)+n(1175)]?this._options[n(561)+n(1175)][n(394)](/\s/g,"")[n(816)+n(1574)]():""},l=i[n(561)+"ncoding"]?i[n(561)+n(1175)][n(394)](/\s/g,"")[n(816)+n(1574)]():"",g=this[n(1107)][n(996)+n(1518)]instanceof Object?{force:!!this[n(1107)]["payloadT"+n(1518)][n(345)],type:this[n(1107)]["payloadT"+n(1518)].type?this._options.payloadType[n(284)][n(394)](/\s/g,"")[n(816)+n(1574)]():""}:{force:!1,type:this[n(1107)][n(996)+n(1518)]?this[n(1107)]["payloadT"+n(1518)].replace(/\s/g,"")[n(816)+"ase"]():""},p=i["payloadT"+n(1518)]?i[n(996)+n(1518)][n(394)](/\s/g,"")[n(816)+n(1574)]():"",u=g[n(345)]?g[n(284)]:p||g[n(284)],m=c[n(345)]?c.encoding:l||c[n(536)],w=[n(551)+"in;charset=utf-8",e.QLRpn,n(1754)+n(686)+n(779)+n(840),e[n(1348)]],S=[e[n(1625)],e.ulgte];this[n(1107)][n(1168)+n(395)+n(1006)+"ad"]&&w.includes(u)&&(!m||S[n(352)](m))?i[n(639)+n(446)]=fs(i[n(918)],0,i[n(918)][n(468)+"th"]):i[n(639)+n(446)]=""}else i[n(639)+n(446)]=""}catch(c){i[n(639)+"oad"]="",console[n(1627)](c)}s[n(1576)]=i,t()}function h0(s,t,n){let i=r,c={fZDBs:function(m,w){return e[k(1180)](m,w)},bsPhS:function(m,w){return e[k(479)](m,w)},dckjt:function(m,w){return e[k(1247)](m,w)},UFGTF:function(m,w){return e[k(443)](m,w)},XvSGL:function(m,w){return e[k(1404)](m,w)},GQBYc:function(m,w){return e[k(1468)](m,w)},jRgDt:function(m,w){return e[k(1398)](m,w)}},l=n||8192,g=e[i(835)](l,1),p=null,u=l;return function(m){let w=i;if(m<1||c[w(1140)](m,g))return s(m);c[w(1250)](c[w(762)](u,m),l)&&(p=c[w(1787)](s,l),u=0);let S=t[w(1092)](p,u,u+=m);return c[w(392)](7,u)&&(u=c.GQBYc(c[w(1105)](7,u),1)),S}}let g0=4294967295;function p0(s,t,n){let i=r,c={GgNdB:function(l,g){return e[k(531)](l,g)},pfzBB:function(l,g){return e[k(819)](l,g)},XCxLm:function(l,g){return l&g}};if(e[i(763)](i(423),e[i(420)]))return e.MyLMx(RangeError,e[i(1371)](e[i(449)](e[i(444)](e.QMtuo(e[i(387)](e[i(739)],s),e[i(634)]),e.CZTxR(t,1)),e[i(785)]),n));_0x578d0e[_0x42dd34++]=xqOmap.GgNdB(_0x2226f2,6)|192,_0xf4d4ad[_0x2a2b8e++]=xqOmap.pfzBB(xqOmap[i(1693)](63,_0x1d0f1d),128)}function m0(s,t,n){let i=r;if(e[i(1772)](n,g0))throw new Error(e[i(1369)]);let c=3;for(;e[i(922)](c,0);){let l=e[i(981)](255,n);e[i(506)](Qn,l,s,t+c),n>>>=8,c--}return e[i(543)](t,4)}function _0(s,t){let n=r,i=0,c=t,l=e[n(802)](t,4);for(;e.itZfT(c,l);){let{value:g,offset:p}=e.qFSfD($n,s,c);c=p,i=e.qWyrN(e.aXRoo(i,8),0),i+=g}return{value:i,offset:l}}function w0(s,t,n){let i=r;return s?e[i(1353)](s.length,40)?e[i(1076)](e[i(355)](Xn,s,t,n),n):t[i(403)+"e"]?e[i(1014)](t.utf8Write(s,n),n):t[i(1739)]?e[i(693)](t[i(1739)](s,n),n):e.HeYCU(e[i(506)](Xn,s,t,n),n):n}function y0(s,t){let n=r,i=new O(e[n(583)](e[n(751)](e[n(1704)](s[e[n(1388)](t,4)],24),s[e[n(1247)](t,5)]<<16)|s[e[n(911)](t,6)]<<8,s[e[n(1268)](t,7)]),e[n(1082)](e[n(583)](s[e[n(414)](t,0)]<<24,e.JzYmZ(s[e.HXwWR(t,1)],16)),e[n(288)](s[e[n(303)](t,2)],8))|s[t+3],!0);return t+=8,{value:i,offset:e[n(397)](t,8)}}function v0(s,t,n){let i=r;if(e[i(1373)](e.waflU,e[i(1569)])){let c=s.low,l=s[i(1191)];return t[n]=e.zvWYK(l,24),t[e[i(1424)](n,1)]=e[i(651)](l>>>16,255),t[e[i(379)](n,2)]=e.gHDjs(e[i(1674)](l,8),255),t[e.dYdbg(n,3)]=e[i(750)](255,l),t[e.Smndt(n,4)]=e.QXtTI(c,24),t[e.IPpDy(n,5)]=e[i(1230)](e[i(1305)](c,16),255),t[e[i(1468)](n,6)]=e[i(315)](e[i(1488)](c,8),255),t[n+7]=255&c,n+=8,n}else this.emit(e.CLsic,_0xae5f45(i(1576),{..._0x3e9aa7}))}function $n(s,t){let n=r;return s[n(1546)+"8"]?{value:s[n(1546)+"8"](t),offset:e[n(303)](t,1)}:{value:e[n(493)](255,s[t]),offset:e[n(766)](t,1)}}function Qn(s,t,n){let i=r;return t.writeUint8?t[i(1002)+"t8"](s,n):t[n]=e[i(631)](255,s),e.FgOeV(n,1)}let b0=function(s){return new Uint8Array(s)},S0=e[r(1148)](e[r(854)],typeof Buffer)?Buffer["allocUns"+r(1710)]:e.RSofe(h0,b0,Uint8Array[r(1181)+"e"][r(828)]),E0=16,er=32;function C0(s){let t=r,n=0,i={};for(let c=0;c<s[t(1080)];c++)i[s[c][t(977)+t(1084)]]=e[t(955)](cs,s[c]["cursor_n"+t(1084)]),n+=14+i[s[c]["cursor_n"+t(1084)]];return[n,i]}function hs(s,t,n){let i=r,c={rWiKm:function(m,w,S,D){return m(w,S,D)},kaqNC:e[i(368)],kQCUp:e.EthUQ,GCShF:function(m,w,S,D){return e[i(271)](m,w,S,D)},WgGSA:e[i(399)],QZPDe:function(m,w,S,D){return e[i(1734)](m,w,S,D)},dSQYF:function(m,w,S,D){return e[i(629)](m,w,S,D)},Cdmgj:e.feKro},[l,g]=e[i(662)](C0,s),p=e[i(305)](S0,l),u=0;return s[i(969)](m=>{let w=i;console[w(1627)]("cursor.s"+w(558),m,m[w(781)]),u=c[w(1721)](Qn,0,p,u),console[w(1627)](c[w(530)],u),u=m0(p,u,m[w(781)]||0),console[w(1627)](c[w(748)],u),u=c[w(1584)](Qn,g[m[w(977)+w(1084)]],p,u),console[w(1627)](c[w(712)],u),u=c.QZPDe(w0,m[w(977)+"ame"],p,u),console[w(1627)](w(1494),u),u=c.dSQYF(v0,O[w(389)+"er"](m.cursor||t),p,u),console[w(1627)](c.Cdmgj,u)}),{frameType:er,headers:[{key:e[i(1422)],value:n}],payload:p}}function A0(s){let t=r;if(e.qeKIo(e[t(1031)],e[t(1031)])){let n=0,i=[];for(;e.DlZRk(n,s[t(468)+"th"]);){if(e.VLxIu(e.XXRZI,e[t(643)]))return _0x27bde6[t(831)+t(1589)][1]?void 0:_0x455a76[t(831)+t(604)](_0x39e4a5[t(831)+t(1589)][0]);{let{offset:c}=e[t(1585)]($n,s,n);n=c;let l={cursor_name:"",cursor:0,service:0},{value:g,offset:p}=e.Tzikt(_0,s,n);l[t(781)]=g,n=p;let{value:u,offset:m}=$n(s,n);n=m,l[t(977)+t(1084)]=fs(s,n,e[t(1244)](n,u)),n+=u;let{value:w,offset:S}=e[t(938)](y0,s,n);l.cursor=w[t(396)](),n=S,i[t(1290)](l)}}return i}else e[t(1667)](_0x3e1b29,_0x3d0390,90),_0x4bb705(_0x2a9a4f,_0x27f9ae)}function k0(){return{frameType:er,headers:[{key:e.BdLeN,value:"FILE_NOT_EXIST"}],payload:void 0}}class D0{constructor(t,n,i){let c=r;this[c(585)+c(1403)]=t,this[c(295)+c(1203)]=n,this[c(929)+c(510)]=i,this._qosDB=e.jsWuF(ds,this[c(585)+c(1403)],e.MUOod)}async[r(1136)](){let t=r;await this[t(1682)][t(1136)]()}async[r(1448)+"rs"](){let t=r;if(!this._qosDB[t(1194)])return;let n=this["_message"+t(510)],i=await this._qosDB.getAll();switch(console[t(1627)](e[t(1731)],i),n){case e[t(1248)]:return i&&i[t(1080)]?hs(i,0,this[t(295)+"ileName"]):void 0;case t(1434):return;case e[t(919)]:return i&&i[t(1080)]?e[t(1223)](hs,i,0,this[t(295)+t(1203)]):e[t(721)](k0)}}async[r(851)](t,n,i){let c=r;return console[c(1627)](c(1464),t,n,i),this[c(1682)][c(851)]({cursor_name:t,cursor:n,service:i})}async[r(903)+"rs"](t){let n=r,i=e[n(1255)](A0,t);for(let c of i)console[n(1627)](e.WGwCI,i),await this._qosDB[n(851)](c)}async get(t){let n=r;return(await this[n(1682)][n(1054)](t))?.[n(579)]}async closeDB(){let t=r;await this._qosDB[t(1497)]()}[r(1266)+r(1122)+r(291)](t){let n=r;this[n(295)+n(1203)]=t}get[r(1194)](){return this[r(1682)].isReady}}let P0=e[r(1064)];async function gs(s){let t=r;if(!this._options.enableQoS)return null;let{aID:n,fpID:i,messageStrategy:c}=this[t(1107)],l=s||P0;try{return this["_cursorM"+t(519)]?s&&this[t(1065)+"anager"][t(1266)+t(1122)+t(291)](s):this[t(1065)+"anager"]=new D0(i+"_"+n+"_"+l,l,c),this["_cursorM"+t(519)][t(1194)]||await this[t(1065)+t(519)][t(1136)](),this["_cursorM"+t(519)]}catch{return null}}async function L0(s,t){let n=r,i=e.KddpW(ze,s[n(1576)][n(1260)],"code","-1"),c=e[n(1340)](ze,s[n(1576)].headers,e[n(1226)],"1"),l=e[n(462)](st,s[n(1576)][n(1260)],e[n(1222)]),g=Number(st(s[n(1576)].headers,"x_fronti"+n(1764)))||0,p=Zn[n(1092)](this,s),u=e[n(1055)](ze,s[n(1576)][n(1260)],e.XHFDv,"2"),m=e.SbBFV(st,s.message[n(1260)],e[n(913)]),w=e.CGSLV(Number,st(s[n(1576)][n(1260)],e[n(1313)]));if(p[n(1204)])return e[n(780)](t);let S=p[n(1420)+n(514)]?await ls[n(1092)](this):null;if(s[n(1576)][n(781)]>0&&c&&!i||s[n(1576)][n(781)]>0){if(l&&p[n(1420)+n(514)]&&S)return!!!await S[n(1054)](l)&&(this[n(910)+"hMessageEvent"](s),await S[n(851)](l,e[n(303)](Date.now(),g))),t();if(u){let D=await gs[n(1092)](this);if(!D)return this[n(910)+"hMessage"+n(1034)](s),e[n(924)](t);let N=await D.get(m)??-1;if(e.iQHhB(N,w))this["_dispatc"+n(398)+"Event"](s),D[n(851)](m,w,s[n(1576)].service);else throw new Error(n(1116)+" message"+n(883)+w+(" larger "+n(1436)+n(470)+"r ")+N);return e[n(1167)](t)}return this[n(910)+n(398)+n(1034)](s),e[n(1167)](t)}}async function T0(s,t){let n=r,i=Zn[n(1092)](this,s);if(!i["isQoSMes"+n(514)])return e[n(1134)](t);let c=await ls.call(this);if(i[n(618)+n(944)+n(571)]&&i[n(1762)+"s"][n(1080)])for(let l of i.ackMsgIds)await c[n(1423)](l);e.CMQvt(t)}async function I0(s,t){let n=r;if(e[n(1162)](e[n(912)],e.SPMcQ)){let i=s[n(1576)][n(487)+"e"]===E0,c=e[n(1449)](s[n(1576)][n(487)+"e"],er);if(e[n(306)](!i,!c))return e[n(501)](t);let l=st(s[n(1576)][n(1260)],n(1165)+"ile_name");if(!l)return t();let g=await gs.call(this,l);if(!g)return e[n(1167)](t);if(i){let p=await g.getCursors(),u={frameType:p?.[n(487)+"e"],SeqID:O[n(389)+"er"](this[n(1334)]++),LogID:O.fromNumber(this[n(1107)][n(1796)+n(1317)]()),service:9e3,method:5,headers:p?.[n(1260)],payload:p?.[n(918)]},m=e.fprjb(A,u);this._ws&&this[n(1508)][n(504)+"te"]&&this[n(1508)][n(393)](m)}if(c){let p=s[n(1576)][n(918)];p&&g[n(903)+"rs"](p)}}else return this._ws?this._ws[n(826)+"ns"]:""}let N0=async function(s,t){let n=r;this[n(714)]=!1,e[n(443)](clearTimeout,this[n(1711)+n(1699)+n(1026)]),e[n(780)](t)},R0=async function(s,t){let n=r;if(!this[n(1508)]||e[n(268)](this[n(1508)][n(504)+"te"],this[n(1352)]))return e.ROpuG(t);let{pingInterval:i}=this._options;this["_endpoin"+n(1493)]?.[n(619)+n(1407)+n(546)]();for(let l=0;e.qwikY(l,this["_message"+n(645)][n(1080)]);l++){let g=this[n(929)+n(645)][l];if(e.XSasJ(this._ws[n(504)+"te"],this[n(1352)])&&e[n(1643)](null,g))this._ws&&this._ws[n(393)](g),this[n(929)+"Queue"][l]=null;else break}this._messageQueue=this._messageQueue[n(950)](l=>!!l),this[n(1029)+n(1611)+"Id"]=e[n(843)](setTimeout,()=>this._ping(),i),this["_dispatc"+n(1036)+"nt"](s),this._isBrowser&&this._ws&&(this[n(1508)].binaryType=this[n(1561)+n(1518)]);let c=this["_endpoin"+n(1493)]?.[n(1544)+n(289)+"nt"]();this[n(943)](n(681)+c+" success"),e[n(728)](t)},B0=async function(s,t){let n=r,i=this[n(1505)+n(1493)]?.[n(1544)+"ntEndpoint"]();this[n(943)](n(681)+i),e.jpZjV(t)};class O0 extends Vn{constructor(t){let n=r,i={UDFOi:function(p,u,m,w){return p(u,m,w)},hdIwA:function(p,u){return e[k(1327)](p,u)},WNJoh:"vFBhU",HjtTD:function(p,u,m){return e.Pbcfs(p,u,m)},vHkIu:e.xKkBm,raTbe:function(p,u){return p===u},lTZfm:e[n(909)],wXnCG:n(436),eCeRy:e[n(1072)],wipmx:e[n(1111)],vxdmr:function(p,u,m,w){return e.rJfnZ(p,u,m,w)},gIkfj:function(p,u){return p!==u},SZrjg:function(p,u,m){return p(u,m)},zXIDl:function(p,u){return e.QTEfR(p,u)},CbYpi:function(p,u){return p===u},muTmz:e[n(1120)],fTQZc:function(p,u){return e.pacyh(p,u)},uOQCs:e.TwQEe,eoFRM:e[n(1563)],hgteG:function(p,u,m){return e[n(1539)](p,u,m)},zMsSd:function(p,u){return p===u},ztMAe:n(673),fpilk:function(p,u){return e[n(1195)](p,u)},duQQe:function(p,u,m){return e[n(857)](p,u,m)},SEDRU:function(p,u,m){return e[n(1185)](p,u,m)}};super(),this[n(1235)+n(817)+n(1147)]=!0,this[n(318)+"er"]=rt,this[n(1359)]=$o,this[n(1089)+"T"]=We,this[n(1074)+"X"]=yt,this[n(1152)+"r"]=vt,this[n(929)+n(645)]=[],this[n(1505)+n(1493)]=null,this["_readyCl"+n(424)]=!1,this[n(1561)+n(1518)]=e[n(1582)],this._connectLock=!1,this[n(1711)+n(1699)+n(1026)]=null,this[n(1265)+"ctTimeou"+n(1670)]=null,this[n(1029)+n(1611)+"Id"]=null,this[n(1334)]=0,this._isInit=!1,this[n(836)]="",this[n(1117)+n(1631)]=null,this[n(1065)+"anager"]=null,this[n(896)+"sCounter"]=null,this[n(1249)+"ls"]=n(411),this[n(465)]=3,this[n(1668)+"NG"]=0,this[n(1352)]=1,this[n(709)]=2,this._onOpen=p=>{let u=n;try{i[u(380)](xs,this,p,[N0,R0,B0])}catch(m){if(i[u(433)](u(1243),i.WNJoh))return _0x20f8ae||(_0x860c1=[_0x3f43bb[u(1181)+"e"][u(1332)],_0x461dfa[u(1181)+"e"][u(472)],_0x5cfc12.prototype[u(472)+u(1532)+"ey"]]);{let w=i[u(1245)](oe,i.vHkIu,{message:m.message,code:Me[u(287)+"OR"],error:m});this[u(910)+"hErrorEvent"](w)}}},this[n(1709)+"ge"]=async p=>{let u=n,{pingInterval:m,pingFrequency:w}=this._options;if((i[u(808)]("hi",p[u(496)])&&i[u(808)](i[u(1652)],w)||i[u(341)]===w)&&(this[u(1020)+"ngTimer"](),this[u(926)](i[u(417)],i[u(1657)]),this[u(1029)+u(1611)+"Id"]=setTimeout(this._ping.bind(this),m)),!i[u(433)]("hi",p[u(496)]))try{i.vxdmr(xs,this,p,[l0,u0,T0,I0,L0,d0])}catch(S){if(i.gIkfj(u(700),"NPfJu"))return{bytes:_0x3ecd6a,offset:0,limit:_0x11d0b7[u(1080)]};{let D=i.SZrjg(oe,u(1172),{message:S[u(1576)],code:Me["MESSAGE_"+u(381)],error:S});this[u(910)+u(782)+u(833)](D)}}},this[n(1171)]=p=>{let u=n,m={WeyJB:function(w,S){return i[k(1330)](w,S)},koATi:function(w,S,D,N){return w(S,D,N)}};if(i.CbYpi(i.muTmz,i[u(1042)])){let w=this[u(1505)+"tManager"]?.[u(1489)+u(760)+"es"](),S=this[u(1505)+u(1493)]?.[u(1544)+u(289)+"nt"]();if(w&&!p[u(1576)])if(i[u(562)](i[u(1431)],i[u(522)])){let D="connect "+S+(u(1701)+u(628)+u(1135)+"ed");this[u(910)+u(782)+u(833)](i[u(1242)](oe,i[u(361)],{message:D,code:Me[u(369)+u(547)+"R"],error:p}));return}else return"frontier_"+this[u(752)];this[u(1508)]&&i[u(1401)](this[u(1508)][u(504)+"te"],this.OPEN)&&this[u(1011)+u(879)](),this[u(910)+u(782)+u(833)](i.hgteG(oe,i[u(361)],{message:p[u(1576)],code:Me[u(970)+u(466)],error:p}))}else{let w=new _0x24f94b(dJmrbh[u(1533)](_0x451896,_0x196bba));return dJmrbh.koATi(_0x18b60d,_0x99966a,w,0),w}},this._onClose=async p=>{let u=n;this[u(1257)+u(820)](),this[u(1020)+u(1759)](),this["_removeW"+u(865)+"rs"](),this[u(1508)]=null,this["_connect"+u(872)]=!1;let m=this[u(1505)+"tManager"]?.[u(1489)+"chMaxTries"]();if(!m&&this["_navigat"+u(1597)]()&&!this["_readyCl"+u(424)]){let w=this[u(1505)+u(1493)]?.[u(1544)+"ntEndpoint"](),S=this[u(1107)][u(1737)+u(997)+u(667)](p[u(1394)],p[u(1794)]);this[u(910)+u(1690)+u(833)](i[u(1242)](le,i.ztMAe,{code:1006,reason:p[u(1794)]||"connecti"+u(794)+u(1686)+u(1259)+u(1637)+u(1039)+w,willReconnect:S})),S&&this[u(1711)]();return}if(i[u(339)](1e3,p.code)&&this._readyClosed){if(u(1393)!==u(1393))return this[u(1682)]?.[u(851)]({message_id:_0x35b808,timestamp:_0x20f0fe});this[u(910)+u(1690)+u(833)](i[u(1242)](le,u(673),{code:1e3,reason:u(1595)})),this[u(1505)+u(1493)]?.[u(619)+"pointCon"+u(546)](),this[u(896)+u(984)]?.[u(1517)+u(1400)]();return}if(p[u(1394)]!==1e3&&m){let w=this[u(1505)+"tManager"]?.getCurrentEndpoint(),S=p[u(1794)];S||(S=await i0(this._url)),S=u(1333)+u(794)+u(1568)+S+", hostname: "+w+(u(995)+u(1669)+u(1763)),this[u(910)+"hCloseEvent"](i.duQQe(le,"close",{code:p[u(1394)],reason:S}));let D=u(1041)+w+(" fail, max retri"+u(1135)+"ed");this["_dispatc"+u(782)+"ent"](i[u(1156)](oe,i[u(361)],{message:D,code:Me[u(369)+u(547)+"R"]})),this[u(1505)+"tManager"]?.["resetEnd"+u(1407)+u(546)](),this[u(896)+"sCounter"]?.[u(1517)+u(1400)]();return}if(i[u(562)](1e3,p[u(1394)])&&!p[u(1794)]){let w=this[u(1505)+u(1493)]?.[u(1544)+u(289)+"nt"]();this["_dispatc"+u(1690)+"ent"](i[u(972)](le,i[u(1528)],{code:p[u(1394)],reason:u(1333)+u(794)+u(1686)+u(1259)+"n, hostn"+u(1039)+w})),this[u(1505)+u(1493)]?.[u(619)+"pointCon"+u(546)](),this[u(896)+"sCounter"]?.["resetCou"+u(1400)]();return}this[u(910)+"hCloseEv"+u(833)](p),this[u(1505)+"tManager"]?.["resetEnd"+u(1407)+u(546)](),this[u(896)+u(984)]?.[u(1517)+u(1400)]()},this.onclose=null,this[n(1325)]=null,this[n(1298)+"e"]=null,this[n(1022)]=null,this["onStartR"+n(550)]=null,this[n(348)+n(689)]=null,this[n(994)+n(1705)+n(1378)+"ct"]=null,this[n(314)+"nLine"]=this["_handleO"+n(1025)][n(1538)](this),this[n(314)+n(1750)]=this["_handleO"+n(1750)][n(1538)](this),this[n(1390)+n(1124)]=this[n(1390)+n(1124)].bind(this),this[n(1390)+n(973)]=this[n(1390)+n(973)].bind(this),this._options={url:"",automaticOpen:!0,initReconnectInterval:1e3,maxReconnectInterval:1e4,reconnectIntervalGrowFactor:2,timeoutInterval:5e3,maxRetries:5,debug:!1,maxMessageQueueLength:e[n(390)](1,0),service:0,logIDGenerator:x,headers:void 0,payloadEncoding:"",payloadType:"",fpID:"",deviceID:"",accessKey:"",ttwID:"",bddID:"",aID:"",disableAutoReconnect:!1,customParams:{},pingInterval:15e3,pingTimeoutInterval:4e3,pingFrequency:e[n(1252)],pingLossCount:2,enableTransformTextPayload:!1,logIDNewConfig:{enableAutoGenerateLogIDNew:!1,userIp:""},miniProgramParams:{customHttpHeader:{}},enableAutoAck:!1,reconnectInterceptor:()=>!0,enableQoS:!1,QoSLevel:2,messageStrategy:n(856),env:{xTTEnv:"",xUseEnv:""},listenNetworkChanged:!0};let{url:c,ws:l}=t,g=Array[n(552)](c)?c:e[n(743)](n(500),typeof c)?[c]:[];if(!g||g[n(1080)]===0)throw new Error(e[n(874)]);if(!e[n(430)](t0,l))throw new Error(e.SIMBv);Object[n(1510)](this._options,t),this["_endpoin"+n(1493)]=new as(g,this._options[n(378)+"es"]),this[n(896)+n(984)]=new s0(this[n(1107)]["pingLoss"+n(916)]),this[n(1107)][n(745)+n(765)]&&(this[n(714)]=!0,this[n(1711)]()),this[n(1107)][n(801)+n(908)+n(1469)]&&(this[n(1089)+"T"]||this[n(1074)+"X"]?this[n(1685)+n(729)+"ange"]():this[n(318)+"er"]&&this[n(1197)+n(278)+n(1087)]())}[r(314)+r(1025)](){let t=r;this[t(1107)]["disableA"+t(1477)+t(1470)]||this[t(678)+t(424)]||this[t(1456)+t(550)]()}[r(314)+r(1750)](){let t=r;this[t(777)+"WebSocket"]();let n=Jn(e[t(598)],{message:e.EgLBA});this[t(994)+t(1705)+t(1378)+"ct"]&&this["onStopIm"+t(1705)+t(1378)+"ct"](n)}[r(1197)+r(278)+r(1087)](){let t=r;this[t(318)+"er"]&&window[t(1498)+t(1087)](e[t(274)],this[t(314)+t(1025)]),this[t(318)+"er"]&&window[t(1498)+"Listener"](e[t(1279)],this["_handleO"+t(1750)]),this._isBrowser&&window[t(1498)+"Listener"](e[t(1501)],this[t(1390)+"ageHide"]),this[t(318)+"er"]&&window[t(1498)+t(1087)](e.edenR,this._handlePageShow)}[r(573)+r(278)+"Listener"](){let t=r;this._isBrowser&&window[t(906)+t(455)+t(477)](e.kHmAQ,this["_handleO"+t(1025)]),this._isBrowser&&window[t(906)+t(455)+t(477)](e[t(1279)],this[t(314)+t(1750)]),this[t(318)+"er"]&&window["removeEv"+t(455)+t(477)](e[t(1501)],this[t(1390)+"ageHide"]),this[t(318)+"er"]&&window[t(906)+t(455)+"ner"](e[t(450)],this[t(1390)+t(973)])}["_handleP"+r(1124)](t){let n=r;!t[n(852)+"d"]&&(this[n(318)+"er"]&&window["removeEv"+n(455)+n(477)](n(1638),this[n(1390)+n(1124)]),this[n(318)+"er"]&&window[n(906)+"entListe"+n(477)](e.edenR,this[n(1390)+n(973)]),this.close()),this[n(318)+"er"]&&window["removeEv"+n(455)+n(477)](e[n(274)],this[n(314)+n(1025)]),this[n(318)+"er"]&&window[n(906)+n(455)+n(477)](e[n(1279)],this._handleOffLine)}["_handleP"+r(973)](t){let n=r;t[n(852)+"d"]&&(this[n(1591)+"orOnline"]()&&(!this[n(1508)]||this._ws.readyState!==this[n(1352)]||e.ahYZy(this[n(1508)][n(504)+"te"],this[n(1668)+"NG"]))&&this["_handleO"+n(1025)](),this[n(318)+"er"]&&window[n(1498)+n(1087)](e.kHmAQ,this[n(314)+n(1025)]),this[n(318)+"er"]&&window[n(1498)+"Listener"](e[n(1279)],this[n(314)+n(1750)]))}async[r(715)+"eUrl"](t){let n=r,{fpID:i,deviceID:c,bddID:l,ttwID:g,accessKey:p,aID:u,customParams:m={},enableAutoAck:w,enableQoS:S,QoSLevel:D,env:N}=this[n(1107)],I,ae,ve;this[n(318)+"er"]||this[n(1074)+"X"]||this[n(1089)+"T"]?(I=location&&e[n(743)](e.ktmgy,location[n(1761)])?n(1463):e[n(1367)],ae=t[n(394)](/((^ws)|(^http))((?:[s]*:\/\/))/,""),ve=/^wss(.*:\/\/)/[n(456)](t)?t:""+I+ae):(I="wss://",ae=t[n(394)](/(^http)((?:[s]*:\/\/))/,""),ve=/(^ws)((?:[s]*:\/\/))/[n(456)](ae)?ae:""+I+ae);let ps=l?e.yiEhF:g?e[n(307)]:e[n(1503)],ms=l||g||c;if(e[n(1776)](!ms,!ps))throw new Error(e[n(1219)]);let M0=e[n(1587)]==typeof m?await m():m,z0=N?e.IQpBE(r0,N[n(427)],N[n(1476)]):{},tr=Object.assign({device_platform:e.XTnDq,version_code:e[n(1311)],access_key:p,fpid:i,aid:u,[ps]:ms,xsack:w?1:0,xaack:w?1:0,xsqos:S?1:0,qos_level:S?D:void 0,qos_sdk_version:2,...z0},M0),q0=Object[n(1603)](tr)[n(331)]((nr,rr)=>tr[rr]!==void 0?""+nr+(nr?"&":"?")+rr+"="+tr[rr]:nr,"");return ve+n(1342)+q0}async[r(1711)](){let t=r;if(e[t(404)](e[t(983)],e[t(983)])){if(this[t(1711)+t(872)]||this[t(678)+"osed"])return;this[t(1711)+t(872)]=!0;try{let n=this["_endpoin"+t(1493)]?.[t(620)+t(680)+t(1760)+t(1007)+"tries"](),{timeoutInterval:i}=this._options;if(n){let l=this["_endpoin"+t(1493)]?.[t(1544)+t(289)+"nt"](),g=this[t(1505)+t(1493)]?.["replaceB"+t(656)+"pointAndUpdateCo"+t(1013)](),p=this[t(1505)+t(1493)]?.[t(1544)+t(289)+t(332)+t(839)]();if(g){let u=t(1041)+l+(t(555)+t(995)+t(1669)+"ached, w"+t(408)+"backup e"+t(1616))+g+(t(824)+"y"),m=e[t(1027)](oe,e[t(837)],{message:u,code:Me[t(369)+t(547)+"R"]});this[t(943)](u),this["_dispatc"+t(782)+t(833)](m),this[t(836)]=await this["_generat"+t(1473)](g),this[t(943)](t(1041)+g+" "+p+t(1046)),this[t(1480)+t(865)+"rs"]()}else{let u=t(1041)+l+(" timeout, max re"+t(1669)+t(1763));this[t(943)](u),this[t(910)+"hErrorEv"+t(833)](e.FcEkT(oe,e[t(837)],{message:u,code:Me[t(369)+"IES_ERROR"]}));return}}else{let l=this._endpointManager?.[t(1544)+t(289)+t(1656)+t(1227)](),g=this._endpointManager?.[t(1544)+t(289)+"ntTriesC"+t(839)]();this._url=await this[t(715)+t(1473)](l||""),this[t(943)](t(1041)+l+" "+g+" times"),this[t(1480)+t(865)+"rs"]()}if(this[t(714)])this[t(714)]=!1;else{let l=Jn(e[t(598)],{message:e[t(535)]});this[t(1329)+"econnect"]&&this[t(1329)+t(550)](l)}let c=this["_endpoin"+t(1493)]?.[t(1544)+t(289)+t(332)+"ount"]()||0;c>1&&await this[t(1558)](c-1),this._debug(t(1333)+"ng url: "+this[t(836)]+(" protoco"+t(1154))+this[t(1249)+"ls"]),this[t(1508)]=e[t(1164)](e0,{url:this[t(836)],protocols:[this[t(1249)+"ls"]],headers:this._options.miniProgramParams[t(951)+t(1460)]},this._options.ws),(this._isBrowser||this[t(1152)+"r"])&&this[t(1508)]&&(this[t(1508)][t(357)+"pe"]=this._binaryType),this["_addWsLi"+t(1660)](),this[t(1711)+t(1699)+t(1026)]=e.xXDTn(setTimeout,this._onTimeout.bind(this),i)}catch(n){throw this[t(1711)+t(872)]=!1,n}}else return 0}[r(1257)+r(820)](){let t=r;e[t(1112)](t(1725),e[t(823)])?this[t(926)](e[t(1292)],e.IQpBE(_0x50c416,e[t(1292)],{..._0x413d04})):(e[t(732)](clearTimeout,this[t(1711)+"ionTimeo"+t(1026)]),this._connectionTimeoutId=null)}[r(1020)+r(1759)](){let t=r;if(e[t(1748)]!==e.OFrZF)return _0x412817[t(1627)](t(1464),_0x285b5a,_0x510797,_0x28747f),this._qosDB[t(851)]({cursor_name:_0x4ea9d7,cursor:_0x30845b,service:_0x4735ec});e[t(696)](clearTimeout,this[t(1029)+"gTimeoutId"]),e.MEthH(clearTimeout,this["_reconne"+t(976)+"tId"]),this[t(1029)+t(1611)+"Id"]=null,this[t(1265)+t(976)+t(1670)]=null}[r(943)](...t){let n=r;this[n(1107)].debug&&console[n(1627)][n(655)](console,[e[n(1641)],...t])}[r(708)+r(1486)+"e"](t){let n=r;if(e[n(285)]!==e.PDNCf){let{initReconnectInterval:i,maxReconnectInterval:c,reconnectIntervalGrowFactor:l}=this[n(1107)],g=i*Math[n(749)](l,e[n(491)](t,1));return e[n(479)](g,c)?c:g}else return _0x5c4f04}[r(1397)](){let t=r,n={GPnXy:t(1438)};if(e[t(1060)](e[t(1513)],e[t(602)])){if(this._ws&&e[t(452)](this[t(1508)].readyState,this[t(1668)+"NG"])){this[t(1020)+t(1759)](),this[t(1029)+t(1611)+"Id"]=e[t(1038)](setTimeout,this[t(1397)][t(1538)](this),this[t(1107)][t(694)+t(1594)]);return}if(!this[t(1508)]||e[t(1411)](this[t(1508)][t(504)+"te"],this[t(1352)]))return void this[t(1456)+"econnect"]();this[t(1508)]&&this[t(1508)].send("hi"),this[t(1265)+t(976)+t(1670)]=e[t(1560)](setTimeout,this["_handleR"+t(550)+t(458)][t(1538)](this),this._options.pingTimeoutInterval)}else this._pingLossCounter?.[t(992)](),this.emit(t(310)+t(342)+"t",n[t(971)]),this._pingLossCounter?.[t(1489)+t(705)+"nt"]()?this[t(1456)+t(550)]():this[t(1397)]()}[r(1456)+r(550)+r(458)](){let t=r;this[t(896)+t(984)]?.[t(992)](),this.emit("ping_once_timeout",t(1438)),this[t(896)+t(984)]?.checkReachMaxCount()?this[t(1456)+"econnect"]():this[t(1397)]()}[r(1591)+"orOnline"](){let t=r;return this[t(1089)+"T"]||this[t(1074)+"X"]?this[t(1235)+t(817)+t(1147)]:(this._isBrowser||this[t(1152)+"r"])&&this[t(1107)]["listenNetworkCha"+t(1469)]?navigator[t(1335)]:!0}[r(1456)+r(550)](){let t=r;!this[t(1591)+t(1597)]()||this[t(678)+"osed"]||(this["_endpoin"+t(1493)]?.[t(619)+t(1407)+t(546)](),this[t(896)+t(984)]?.[t(1517)+t(1400)](),this[t(1508)]?this["_disconn"+t(879)](1001,e[t(1579)],!0):this[t(1711)]())}[r(1685)+r(729)+r(615)](){let t=r;this[t(1089)+"T"]?tt["onNetworkStatusC"+t(582)](({isConnected:n})=>{let i=t;this[i(1235)+i(817)+"line"]=n,n?this[i(314)+i(1025)]():this["_handleO"+i(1750)]()}):this._isMiniWX&&wx[t(1623)+t(1155)+t(582)](({isConnected:n})=>{let i=t;this[i(1235)+i(817)+i(1147)]=n,n?this[i(314)+i(1025)]():this["_handleO"+i(1750)]()})}[r(1558)](t){return new Promise(n=>{let i=k;e[i(875)](setTimeout,n,this[i(708)+i(1486)+"e"](t))})}[r(1011)+r(879)](t=1e3,n="",i=!1){let c=r;this[c(1508)]&&this[c(777)+c(1432)+"t"](t,n,i)}[r(1267)+"ut"](){let t=r,n=this._endpointManager?.["getCurre"+t(289)+"nt"]();this[t(943)](t(1041)+n+t(555)),this[t(1011)+t(879)](1001,e[t(542)],!0)}_sendAck(t){let n=r,i=e[n(838)](Wn,t);this[n(1508)]&&e[n(325)](this[n(1508)][n(504)+"te"],this.OPEN)&&(this[n(1508)]&&this._ws.send(i),this[n(943)](e[n(1264)],t))}[r(1480)+r(865)+"rs"](){let t=r;this[t(1508)]&&(this[t(1508)][t(906)+t(455)+t(477)]("open",this._onOpen),this[t(1508)][t(906)+"entListe"+t(477)](t(673),this[t(1372)]),this[t(1508)][t(906)+t(455)+"ner"](e[t(1738)],this[t(1709)+"ge"]),this._ws[t(906)+t(455)+"ner"](e[t(837)],this[t(1171)]))}[r(1200)+r(1660)](){let t=r;if(e[t(1536)](e[t(1211)],t(965)))return this[t(1508)]?this[t(1508)][t(504)+"te"]:this[t(1107)][t(745)+t(765)]?this[t(1668)+"NG"]:this.CLOSED;{let n=e[t(707)][t(862)]("|"),i=0;for(;;){switch(n[i++]){case"0":this._ws[t(1498)+"Listener"]("close",this[t(1372)]);continue;case"1":if(!this[t(1508)])return;continue;case"2":this[t(1508)][t(1498)+"Listener"](e[t(837)],this[t(1171)]);continue;case"3":this[t(1508)]["addEvent"+t(1087)](e[t(601)],this[t(1035)]);continue;case"4":this[t(1508)].addEventListener(e[t(1738)],this._onMessage);continue}break}}}[r(1495)+r(1045)](t=1e3,n=""){let i=r;try{this._ws&&this[i(1508)][i(673)](t,n)}catch{}}[r(777)+r(1432)+"t"](t=1e3,n="",i=!1){let c=r,l={jMgua:function(g,p,u){return e[k(884)](g,p,u)},HLtfV:function(g,p,u){return g(p,u)},CuqFP:function(g,p,u){return e[k(844)](g,p,u)},pKMmp:function(g,p){return e[k(1157)](g,p)}};if(this["_clearPi"+c(1759)](),this._clearTimer(),this[c(1480)+"sListeners"](),this[c(1495)+c(1045)](1e3,n),this[c(1711)+c(872)]=!1,i&&this["_navigat"+c(1597)]()&&!this["_readyCl"+c(424)])if(e[c(544)](e.NFFtL,e[c(473)])){_0x33556c(_0x138d9a,42);let g=_0x1cf59c();XfhCvE[c(569)](_0x432705,_0x3face1,g),XfhCvE.HLtfV(_0x428a68,_0x28b3af,g.limit),XfhCvE[c(483)](_0x470a50,_0x4b5ee0,g),XfhCvE[c(1722)](_0x3a80f5,g)}else{if(this[c(1505)+c(1493)]?.[c(1489)+c(760)+"es"]()){let p=this["_endpoin"+c(1493)]?.[c(1544)+"ntEndpoint"]();this[c(910)+c(1690)+c(833)](le(c(673),{code:1006,reason:"connect "+p+(c(555)+c(995)+c(1669)+"ached"),wasClean:!0}))}else{let p=this._options[c(1737)+c(997)+c(667)](t,n);this[c(910)+c(1690)+"ent"](e.KeoJN(le,e[c(1292)],{code:t,reason:n,wasClean:!0,willReconnect:p})),p&&this[c(1711)]()}return}this[c(1591)+c(1597)]()||this[c(678)+c(424)]?this[c(910)+"hCloseEv"+c(833)](e[c(1437)](le,e[c(1292)],{code:t,reason:e[c(1612)]})):this[c(910)+c(1690)+c(833)](e.iycPf(le,e.ytTYF,{code:1006,reason:e.XEWHY})),this[c(1508)]=null,this._endpointManager?.[c(619)+"pointCon"+c(546)](),this[c(896)+"sCounter"]?.[c(1517)+c(1400)]()}[r(910)+"hOpenEvent"](t){let n=r;if(n(1455)!==e[n(272)])this[n(926)](e[n(601)],t),this.onopen&&this[n(1022)](t);else{let i=this[n(1682)][n(406)+n(703)](this._prefix),c=_0x48db07[n(1361)](e.ZBKUG(i,"{}"));return c[_0x5e023e||_0x46f8d8[this[n(335)]]]=_0x42961e,this[n(1682)][n(636)+n(703)](this._prefix,_0xa194d0[n(683)+"y"](c)),_0x2842c6||_0x556702[this[n(335)]]}}[r(910)+r(398)+"Event"](t){let n=r;this.emit(e[n(1738)],t),this[n(1298)+"e"]&&this[n(1298)+"e"](t)}[r(910)+"hAckMessageEvent"](t){let n=r;this[n(926)](e[n(1659)],t),this[n(348)+n(689)]&&this[n(348)+n(689)](t)}["_dispatc"+r(782)+r(833)](t){let n=r;e[n(409)](n(1083),e[n(1043)])?(this[n(926)](e[n(837)],t),this.onerror&&this[n(1325)](t)):(_0x2ae74d=e.pRgyt(_0x5b4ea8,_0x3ef648),_0x2bb026|=e[n(1639)](127,_0x2961b9)<<21,e[n(930)](128,_0x30f756)&&(_0xe6f615=e[n(467)](_0xbb6812,_0x5d5126),_0x4afde1=127&_0xbbf5f5,e[n(1375)](128,_0x12c915)&&(_0x5177cd=_0x2db20c(_0x4a8ce7),_0x18372f|=e.BqhhS(127&_0x83f344,7))))}["_dispatc"+r(1690)+r(833)](t){let n=r;this[n(926)](e.ytTYF,t),this[n(1189)]&&this[n(1189)](t)}get binaryType(){let t=r;return this[t(1508)]?this[t(1508)].binaryType:this[t(1561)+t(1518)]}set[r(357)+"pe"](t){let n=r;this[n(1561)+n(1518)]=t,this._ws&&(this[n(1508)][n(357)+"pe"]=t)}get retryCount(){let t=r,n={aXvNF:function(i,c){return e[k(400)](i,c)},zovrl:function(i,c){return e[k(1590)](i,c)},ADVJm:function(i,c){return e[k(1740)](i,c)},nHLDF:e.KTZPA,rCLbL:e.ArPbq};if(e[t(1749)](e[t(754)],t(1413)))return this[t(1505)+t(1493)]?.[t(1544)+"ntEndpoi"+t(332)+t(839)]()||0;{let i=_0x59fe5.split(/\./)[t(1349)](g=>_0x5498bd(g)),c=[];return c[0]=OnoABM[t(302)](_0x225577,OnoABM[t(1095)](i[0],i[1])),c[1]=OnoABM[t(302)](_0x3b1af1,OnoABM[t(1765)](i[2],i[3])),[OnoABM.nHLDF,t(775),OnoABM.nHLDF,OnoABM[t(1019)],OnoABM[t(1019)],OnoABM[t(373)],c[0],c[1]][t(868)]("")}}get[r(476)+r(1441)](){let t=r,n=this["_message"+t(645)][t(331)]((i,c)=>(i+=c&&c[t(468)+"th"]||0,i),0);return e[t(931)](n,this._ws?this[t(1508)]["buffered"+t(1441)]:0)}get extensions(){let t=r;return this[t(1508)]?this._ws[t(826)+"ns"]:""}get[r(1761)](){let t=r;return this[t(1508)]?this._ws[t(1761)]:""}get[r(504)+"te"](){let t=r;return this[t(1508)]?this[t(1508)].readyState:this[t(1107)][t(745)+t(765)]?this[t(1668)+"NG"]:this[t(465)]}get[r(716)](){let t=r;return this[t(1508)]?this[t(1508)].url:this[t(836)]}[r(673)](t=1e3,n){let i=r;if(this[i(678)+i(424)]=!0,this["_clearTi"+i(820)](),this[i(1020)+"ngTimer"](),this["_dropGlo"+i(278)+i(1087)](),this["_QoSMana"+i(1631)]?.[i(1497)](),!this[i(1508)])return void this[i(943)](e[i(1755)]);if(e[i(1446)](this[i(1508)][i(504)+"te"],this.CLOSED)||e[i(1481)](this[i(1508)][i(504)+"te"],this.CLOSING))return void this._debug(e[i(593)]);this._destroyWebSocket(t,n)}async[r(393)](t,n){let i=r;if(e.RiCaB(null,t))throw new Error(i(853)+i(947)+i(902)+i(1370)+i(761)+"e a stri"+i(1541)+i(1771)+i(1128));e[i(1205)]("number",typeof t)&&(t=JSON.stringify(t)),e.HrFhT(i(500),typeof t)&&!e.vBGjq(t,ArrayBuffer)&&!(t.buffer&&e.vBGjq(t[i(350)],ArrayBuffer))&&(t=JSON[i(683)+"y"](t));let c=await us(t),l=e[i(1304)](n0,t),{method:g=0,service:p=this[i(1107)][i(781)],logID:u=this[i(1107)][i(1796)+i(1317)](),headers:m=this[i(1107)][i(1260)],payloadEncoding:w=this._options[i(561)+i(1175)],payloadType:S=this[i(1107)][i(996)+i(1518)],logIDNew:D=this._options["logIDNew"+i(1457)][i(772)+i(682)+i(388)+"ew"]?a(this._options[i(1679)+i(1457)][i(1310)]):""}=e.HLbPV(n,{});if(!p)throw new Error(e.fSMut);let N={SeqID:O[i(389)+"er"](this[i(1334)]++),LogID:O[i(389)+"er"](u),service:p,method:g,headers:m,payloadEncoding:e.bpbBB(w,Object)?w[i(536)]?w[i(536)]:"":w,payloadType:e[i(1338)](S,Object)?S[i(284)]?S[i(284)]:l:S||l,payload:c,LogIDNew:D},I=e[i(1159)](Wn,N);return this[i(1508)]&&this._ws[i(504)+"te"]===this[i(1352)]?(this[i(1508)]&&this[i(1508)][i(393)](I),this[i(943)](i(1178),N)):e[i(1068)](this[i(929)+i(645)][i(1080)],this[i(1107)]["maxMessa"+i(1429)+i(1640)])?(this[i(929)+i(645)][i(1290)](I),this[i(943)](e[i(907)],N)):(this[i(929)+"Queue"][i(1732)](),this[i(929)+i(645)][i(1290)](I)),{seqID:this[i(1334)],logID:u,logIDNew:D}}async[r(1737)+"t"](t){let n=r;if(e[n(1103)](n(1548),e[n(959)])){let{url:i}=e[n(1519)](t,{}),c=Array[n(552)](i)?i:e[n(538)](e.tYsmM,typeof i)?[i]:[];t&&Object.assign(this[n(1107)],t),c&&c[n(1080)]?this[n(1505)+n(1493)]=new as(c,this[n(1107)][n(378)+"es"]):this[n(1505)+n(1493)]?.["resetEnd"+n(1407)+n(546)](),this[n(896)+"sCounter"]?.["resetCou"+n(1400)](this[n(1107)][n(921)+"Count"]),this[n(678)+n(424)]=!1,this[n(1508)]&&e[n(596)](this[n(1508)].readyState,this.CLOSED)?this["_disconn"+n(879)](1e3,e[n(1283)],!0):(this[n(714)]=!0,this._connect())}else return _0x5b0dca[n(1288)][_0x467bcb(_0x1af300,1)]}async connect(){let t=r,n={xytDA:e[t(438)],hyusr:function(i,c){return i(c)}};if(e[t(1744)](e[t(1444)],e[t(1444)])){let i=_0x43096b[t(1232)+t(525)](_0x2052a1);return _0x3bf63d&&i.addEventListener(PcGPRs[t(1583)],()=>_0x437fc4()),PcGPRs[t(990)](_0x2f5b2a,i)[t(1471)](()=>{})}else!this[t(1711)+t(872)]&&(this[t(1505)+"tManager"]?.[t(619)+t(1407)+"fig"](),this["_pingLos"+t(984)]?.resetCounter(),this[t(678)+t(424)]=!1,this[t(714)]=!0,this._connect())}[r(1498)+r(1087)](t,n){this.on(t,n)}[r(803)+r(1034)](t){let n=r,{type:i}=t;this[n(926)](i,t)}["removeEv"+r(455)+"ner"](t,n){this[r(870)](t,n)}[r(1676)](){let t=r,n={odVpw:e.ZmFdx,SEQMC:e[t(1072)],riVvZ:e[t(1783)],lDhpH:e[t(1475)]};return new Promise((i,c)=>{let l=t,g={PfnBv:n[l(405)],HiyZM:n[l(608)],vccpd:n[l(474)],Fdpxa:n[l(1033)]};this[l(1020)+l(1759)](),this[l(1029)+l(1611)+"Id"]=setTimeout(this[l(1397)][l(1538)](this),this[l(1107)][l(694)+l(1594)]);let p=()=>{let m=l;i(g[m(367)]),this.off(g[m(863)],p),this[m(870)](g[m(873)],u)},u=()=>{let m=l;c(g[m(1651)]),this.off(m(310)+m(445)+"s",p),this[m(870)](g.vccpd,u)};this.on(n[l(608)],p),this.on(n.riVvZ,u),this._ping()})}}})(),X[E(1490)+E(383)]=J[E(1490)+"oseEvent"],X[E(1169)+E(385)]=J.CustomErrorEvent,X[E(434)+"e"]=J[E(434)+"e"],X.Event=J[E(1034)],X[E(1016)]=J.FWS,X[E(1001)+E(1286)+E(848)]=J[E(1001)+E(1286)+"vent"],X[E(1286)+E(848)]=J["MessageE"+E(848)],X.OpenEvent=J[E(842)+"t"],X[E(564)+"tEvent"]=J[E(564)+E(337)],X[E(1355)+"oseEvent"]=J[E(1355)+E(383)],X[E(1665)+E(385)]=J[E(1665)+E(385)],X[E(1322)+E(1186)+"nt"]=J[E(1322)+E(1186)+"nt"],X[E(494)+E(1555)]=J[E(494)+E(1555)],X["createRe"+E(575)+E(848)]=J["createRe"+E(575)+E(848)],X[E(1753)+E(935)]=J["decodedF"+E(935)],X["encodeFr"+E(1084)]=J[E(283)+E(1084)];for(dn in J)["CustomCl"+E(383),E(1169)+"rorEvent",E(434)+"e",E(1034),E(1016),E(1001)+E(1286)+E(848),E(1286)+"vent",E(842)+"t","Reconnec"+E(337),E(1355)+"oseEvent",E(1665)+E(385),E(1322)+E(1186)+"nt","createOpenEvent",E(702)+E(575)+E(848),E(1753)+E(935),E(283)+E(1084)][E(1081)](dn)===-1&&(X[dn]=J[dn]);var dn;Object["definePr"+E(877)](X,"__esModule",{value:!0})});var Ie=re((xl,di)=>{"use strict";var fi=["nodebuffer","arraybuffer","fragments"],ui=typeof Blob<"u";ui&&fi.push("blob");di.exports={BINARY_TYPES:fi,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:ui,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var Lt=re((cl,wn)=>{"use strict";var{EMPTY_BUFFER:Ax}=Ie(),lr=Buffer[Symbol.species];function kx(r,e){if(r.length===0)return Ax;if(r.length===1)return r[0];let o=Buffer.allocUnsafe(e),a=0;for(let x=0;x<r.length;x++){let f=r[x];o.set(f,a),a+=f.length}return a<e?new lr(o.buffer,o.byteOffset,a):o}function li(r,e,o,a,x){for(let f=0;f<x;f++)o[a+f]=r[f]^e[f&3]}function hi(r,e){for(let o=0;o<r.length;o++)r[o]^=e[o&3]}function Dx(r){return r.length===r.buffer.byteLength?r.buffer:r.buffer.slice(r.byteOffset,r.byteOffset+r.length)}function hr(r){if(hr.readOnly=!0,Buffer.isBuffer(r))return r;let e;return r instanceof ArrayBuffer?e=new lr(r):ArrayBuffer.isView(r)?e=new lr(r.buffer,r.byteOffset,r.byteLength):(e=Buffer.from(r),hr.readOnly=!1),e}wn.exports={concat:kx,mask:li,toArrayBuffer:Dx,toBuffer:hr,unmask:hi};if(!process.env.WS_NO_BUFFER_UTIL)try{let r=W("bufferutil");wn.exports.mask=function(e,o,a,x,f){f<48?li(e,o,a,x,f):r.mask(e,o,a,x,f)},wn.exports.unmask=function(e,o){e.length<32?hi(e,o):r.unmask(e,o)}}catch{}});var mi=re((fl,pi)=>{"use strict";var gi=Symbol("kDone"),gr=Symbol("kRun"),pr=class{constructor(e){this[gi]=()=>{this.pending--,this[gr]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[gr]()}[gr](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[gi])}}};pi.exports=pr});var dt=re((ul,vi)=>{"use strict";var Tt=W("zlib"),_i=Lt(),Px=mi(),{kStatusCode:wi}=Ie(),Lx=Buffer[Symbol.species],Tx=Buffer.from([0,0,255,255]),vn=Symbol("permessage-deflate"),Ne=Symbol("total-length"),ft=Symbol("callback"),Ke=Symbol("buffers"),ut=Symbol("error"),yn,mr=class{constructor(e){if(this._options=e||{},this._threshold=this._options.threshold!==void 0?this._options.threshold:1024,this._maxPayload=this._options.maxPayload|0,this._isServer=!!this._options.isServer,this._deflate=null,this._inflate=null,this.params=null,!yn){let o=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;yn=new Px(o)}}static get extensionName(){return"permessage-deflate"}offer(){let e={};return this._options.serverNoContextTakeover&&(e.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(e.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(e.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?e.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits==null&&(e.client_max_window_bits=!0),e}accept(e){return e=this.normalizeParams(e),this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){let e=this._deflate[ft];this._deflate.close(),this._deflate=null,e&&e(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(e){let o=this._options,a=e.find(x=>!(o.serverNoContextTakeover===!1&&x.server_no_context_takeover||x.server_max_window_bits&&(o.serverMaxWindowBits===!1||typeof o.serverMaxWindowBits=="number"&&o.serverMaxWindowBits>x.server_max_window_bits)||typeof o.clientMaxWindowBits=="number"&&!x.client_max_window_bits));if(!a)throw new Error("None of the extension offers can be accepted");return o.serverNoContextTakeover&&(a.server_no_context_takeover=!0),o.clientNoContextTakeover&&(a.client_no_context_takeover=!0),typeof o.serverMaxWindowBits=="number"&&(a.server_max_window_bits=o.serverMaxWindowBits),typeof o.clientMaxWindowBits=="number"?a.client_max_window_bits=o.clientMaxWindowBits:(a.client_max_window_bits===!0||o.clientMaxWindowBits===!1)&&delete a.client_max_window_bits,a}acceptAsClient(e){let o=e[0];if(this._options.clientNoContextTakeover===!1&&o.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(!o.client_max_window_bits)typeof this._options.clientMaxWindowBits=="number"&&(o.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits=="number"&&o.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"');return o}normalizeParams(e){return e.forEach(o=>{Object.keys(o).forEach(a=>{let x=o[a];if(x.length>1)throw new Error(`Parameter "${a}" must have only a single value`);if(x=x[0],a==="client_max_window_bits"){if(x!==!0){let f=+x;if(!Number.isInteger(f)||f<8||f>15)throw new TypeError(`Invalid value for parameter "${a}": ${x}`);x=f}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${a}": ${x}`)}else if(a==="server_max_window_bits"){let f=+x;if(!Number.isInteger(f)||f<8||f>15)throw new TypeError(`Invalid value for parameter "${a}": ${x}`);x=f}else if(a==="client_no_context_takeover"||a==="server_no_context_takeover"){if(x!==!0)throw new TypeError(`Invalid value for parameter "${a}": ${x}`)}else throw new Error(`Unknown parameter "${a}"`);o[a]=x})}),e}decompress(e,o,a){yn.add(x=>{this._decompress(e,o,(f,d)=>{x(),a(f,d)})})}compress(e,o,a){yn.add(x=>{this._compress(e,o,(f,d)=>{x(),a(f,d)})})}_decompress(e,o,a){let x=this._isServer?"client":"server";if(!this._inflate){let f=`${x}_max_window_bits`,d=typeof this.params[f]!="number"?Tt.Z_DEFAULT_WINDOWBITS:this.params[f];this._inflate=Tt.createInflateRaw({...this._options.zlibInflateOptions,windowBits:d}),this._inflate[vn]=this,this._inflate[Ne]=0,this._inflate[Ke]=[],this._inflate.on("error",Nx),this._inflate.on("data",yi)}this._inflate[ft]=a,this._inflate.write(e),o&&this._inflate.write(Tx),this._inflate.flush(()=>{let f=this._inflate[ut];if(f){this._inflate.close(),this._inflate=null,a(f);return}let d=_i.concat(this._inflate[Ke],this._inflate[Ne]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[Ne]=0,this._inflate[Ke]=[],o&&this.params[`${x}_no_context_takeover`]&&this._inflate.reset()),a(null,d)})}_compress(e,o,a){let x=this._isServer?"server":"client";if(!this._deflate){let f=`${x}_max_window_bits`,d=typeof this.params[f]!="number"?Tt.Z_DEFAULT_WINDOWBITS:this.params[f];this._deflate=Tt.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:d}),this._deflate[Ne]=0,this._deflate[Ke]=[],this._deflate.on("data",Ix)}this._deflate[ft]=a,this._deflate.write(e),this._deflate.flush(Tt.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let f=_i.concat(this._deflate[Ke],this._deflate[Ne]);o&&(f=new Lx(f.buffer,f.byteOffset,f.length-4)),this._deflate[ft]=null,this._deflate[Ne]=0,this._deflate[Ke]=[],o&&this.params[`${x}_no_context_takeover`]&&this._deflate.reset(),a(null,f)})}};vi.exports=mr;function Ix(r){this[Ke].push(r),this[Ne]+=r.length}function yi(r){if(this[Ne]+=r.length,this[vn]._maxPayload<1||this[Ne]<=this[vn]._maxPayload){this[Ke].push(r);return}this[ut]=new RangeError("Max payload size exceeded"),this[ut].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[ut][wi]=1009,this.removeListener("data",yi),this.reset()}function Nx(r){if(this[vn]._inflate=null,this[ut]){this[ft](this[ut]);return}r[wi]=1007,this[ft](r)}});var lt=re((dl,bn)=>{"use strict";var{isUtf8:bi}=W("buffer"),{hasBlob:Rx}=Ie(),Bx=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function Ox(r){return r>=1e3&&r<=1014&&r!==1004&&r!==1005&&r!==1006||r>=3e3&&r<=4999}function _r(r){let e=r.length,o=0;for(;o<e;)if((r[o]&128)===0)o++;else if((r[o]&224)===192){if(o+1===e||(r[o+1]&192)!==128||(r[o]&254)===192)return!1;o+=2}else if((r[o]&240)===224){if(o+2>=e||(r[o+1]&192)!==128||(r[o+2]&192)!==128||r[o]===224&&(r[o+1]&224)===128||r[o]===237&&(r[o+1]&224)===160)return!1;o+=3}else if((r[o]&248)===240){if(o+3>=e||(r[o+1]&192)!==128||(r[o+2]&192)!==128||(r[o+3]&192)!==128||r[o]===240&&(r[o+1]&240)===128||r[o]===244&&r[o+1]>143||r[o]>244)return!1;o+=4}else return!1;return!0}function Mx(r){return Rx&&typeof r=="object"&&typeof r.arrayBuffer=="function"&&typeof r.type=="string"&&typeof r.stream=="function"&&(r[Symbol.toStringTag]==="Blob"||r[Symbol.toStringTag]==="File")}bn.exports={isBlob:Mx,isValidStatusCode:Ox,isValidUTF8:_r,tokenChars:Bx};if(bi)bn.exports.isValidUTF8=function(r){return r.length<24?_r(r):bi(r)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let r=W("utf-8-validate");bn.exports.isValidUTF8=function(e){return e.length<32?_r(e):r(e)}}catch{}});var Sr=re((ll,Pi)=>{"use strict";var{Writable:zx}=W("stream"),Si=dt(),{BINARY_TYPES:qx,EMPTY_BUFFER:Ei,kStatusCode:Fx,kWebSocket:Ux}=Ie(),{concat:wr,toArrayBuffer:Kx,unmask:Hx}=Lt(),{isValidStatusCode:Gx,isValidUTF8:Ci}=lt(),Sn=Buffer[Symbol.species],fe=0,Ai=1,ki=2,Di=3,yr=4,vr=5,En=6,br=class extends zx{constructor(e={}){super(),this._allowSynchronousEvents=e.allowSynchronousEvents!==void 0?e.allowSynchronousEvents:!0,this._binaryType=e.binaryType||qx[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxPayload=e.maxPayload|0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[Ux]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=fe}_write(e,o,a){if(this._opcode===8&&this._state==fe)return a();this._bufferedBytes+=e.length,this._buffers.push(e),this.startLoop(a)}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){let a=this._buffers[0];return this._buffers[0]=new Sn(a.buffer,a.byteOffset+e,a.length-e),new Sn(a.buffer,a.byteOffset,e)}let o=Buffer.allocUnsafe(e);do{let a=this._buffers[0],x=o.length-e;e>=a.length?o.set(this._buffers.shift(),x):(o.set(new Uint8Array(a.buffer,a.byteOffset,e),x),this._buffers[0]=new Sn(a.buffer,a.byteOffset+e,a.length-e)),e-=a.length}while(e>0);return o}startLoop(e){this._loop=!0;do switch(this._state){case fe:this.getInfo(e);break;case Ai:this.getPayloadLength16(e);break;case ki:this.getPayloadLength64(e);break;case Di:this.getMask();break;case yr:this.getData(e);break;case vr:case En:this._loop=!1;return}while(this._loop);this._errored||e()}getInfo(e){if(this._bufferedBytes<2){this._loop=!1;return}let o=this.consume(2);if((o[0]&48)!==0){let x=this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");e(x);return}let a=(o[0]&64)===64;if(a&&!this._extensions[Si.extensionName]){let x=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(x);return}if(this._fin=(o[0]&128)===128,this._opcode=o[0]&15,this._payloadLength=o[1]&127,this._opcode===0){if(a){let x=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(x);return}if(!this._fragmented){let x=this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");e(x);return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){let x=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");e(x);return}this._compressed=a}else if(this._opcode>7&&this._opcode<11){if(!this._fin){let x=this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");e(x);return}if(a){let x=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(x);return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){let x=this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");e(x);return}}else{let x=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");e(x);return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(o[1]&128)===128,this._isServer){if(!this._masked){let x=this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK");e(x);return}}else if(this._masked){let x=this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");e(x);return}this._payloadLength===126?this._state=Ai:this._payloadLength===127?this._state=ki:this.haveLength(e)}getPayloadLength16(e){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(e)}getPayloadLength64(e){if(this._bufferedBytes<8){this._loop=!1;return}let o=this.consume(8),a=o.readUInt32BE(0);if(a>Math.pow(2,21)-1){let x=this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");e(x);return}this._payloadLength=a*Math.pow(2,32)+o.readUInt32BE(4),this.haveLength(e)}haveLength(e){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)){let o=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");e(o);return}this._masked?this._state=Di:this._state=yr}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=yr}getData(e){let o=Ei;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}o=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0&&Hx(o,this._mask)}if(this._opcode>7){this.controlMessage(o,e);return}if(this._compressed){this._state=vr,this.decompress(o,e);return}o.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(o)),this.dataMessage(e)}decompress(e,o){this._extensions[Si.extensionName].decompress(e,this._fin,(x,f)=>{if(x)return o(x);if(f.length){if(this._messageLength+=f.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let d=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");o(d);return}this._fragments.push(f)}this.dataMessage(o),this._state===fe&&this.startLoop(o)})}dataMessage(e){if(!this._fin){this._state=fe;return}let o=this._messageLength,a=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let x;this._binaryType==="nodebuffer"?x=wr(a,o):this._binaryType==="arraybuffer"?x=Kx(wr(a,o)):this._binaryType==="blob"?x=new Blob(a):x=a,this._allowSynchronousEvents?(this.emit("message",x,!0),this._state=fe):(this._state=En,setImmediate(()=>{this.emit("message",x,!0),this._state=fe,this.startLoop(e)}))}else{let x=wr(a,o);if(!this._skipUTF8Validation&&!Ci(x)){let f=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");e(f);return}this._state===vr||this._allowSynchronousEvents?(this.emit("message",x,!1),this._state=fe):(this._state=En,setImmediate(()=>{this.emit("message",x,!1),this._state=fe,this.startLoop(e)}))}}controlMessage(e,o){if(this._opcode===8){if(e.length===0)this._loop=!1,this.emit("conclude",1005,Ei),this.end();else{let a=e.readUInt16BE(0);if(!Gx(a)){let f=this.createError(RangeError,`invalid status code ${a}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");o(f);return}let x=new Sn(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!Ci(x)){let f=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");o(f);return}this._loop=!1,this.emit("conclude",a,x),this.end()}this._state=fe;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?"ping":"pong",e),this._state=fe):(this._state=En,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",e),this._state=fe,this.startLoop(o)}))}createError(e,o,a,x,f){this._loop=!1,this._errored=!0;let d=new e(a?`Invalid WebSocket frame: ${o}`:o);return Error.captureStackTrace(d,this.createError),d.code=f,d[Fx]=x,d}};Pi.exports=br});var Ar=re((gl,Ii)=>{"use strict";var{Duplex:hl}=W("stream"),{randomFillSync:jx}=W("crypto"),Li=dt(),{EMPTY_BUFFER:Wx,kWebSocket:Jx,NOOP:Vx}=Ie(),{isBlob:ht,isValidStatusCode:Xx}=lt(),{mask:Ti,toBuffer:Xe}=Lt(),ue=Symbol("kByteLength"),Yx=Buffer.alloc(4),Cn=8*1024,Ye,gt=Cn,ge=0,Zx=1,$x=2,Er=class r{constructor(e,o,a){this._extensions=o||{},a&&(this._generateMask=a,this._maskBuffer=Buffer.alloc(4)),this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=ge,this.onerror=Vx,this[Jx]=void 0}static frame(e,o){let a,x=!1,f=2,d=!1;o.mask&&(a=o.maskBuffer||Yx,o.generateMask?o.generateMask(a):(gt===Cn&&(Ye===void 0&&(Ye=Buffer.alloc(Cn)),jx(Ye,0,Cn),gt=0),a[0]=Ye[gt++],a[1]=Ye[gt++],a[2]=Ye[gt++],a[3]=Ye[gt++]),d=(a[0]|a[1]|a[2]|a[3])===0,f=6);let h;typeof e=="string"?(!o.mask||d)&&o[ue]!==void 0?h=o[ue]:(e=Buffer.from(e),h=e.length):(h=e.length,x=o.mask&&o.readOnly&&!d);let _=h;h>=65536?(f+=8,_=127):h>125&&(f+=2,_=126);let v=Buffer.allocUnsafe(x?h+f:f);return v[0]=o.fin?o.opcode|128:o.opcode,o.rsv1&&(v[0]|=64),v[1]=_,_===126?v.writeUInt16BE(h,2):_===127&&(v[2]=v[3]=0,v.writeUIntBE(h,4,6)),o.mask?(v[1]|=128,v[f-4]=a[0],v[f-3]=a[1],v[f-2]=a[2],v[f-1]=a[3],d?[v,e]:x?(Ti(e,a,v,f,h),[v]):(Ti(e,a,e,0,h),[v,e])):[v,e]}close(e,o,a,x){let f;if(e===void 0)f=Wx;else{if(typeof e!="number"||!Xx(e))throw new TypeError("First argument must be a valid error code number");if(o===void 0||!o.length)f=Buffer.allocUnsafe(2),f.writeUInt16BE(e,0);else{let h=Buffer.byteLength(o);if(h>123)throw new RangeError("The message must not be greater than 123 bytes");f=Buffer.allocUnsafe(2+h),f.writeUInt16BE(e,0),typeof o=="string"?f.write(o,2):f.set(o,2)}}let d={[ue]:f.length,fin:!0,generateMask:this._generateMask,mask:a,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state!==ge?this.enqueue([this.dispatch,f,!1,d,x]):this.sendFrame(r.frame(f,d),x)}ping(e,o,a){let x,f;if(typeof e=="string"?(x=Buffer.byteLength(e),f=!1):ht(e)?(x=e.size,f=!1):(e=Xe(e),x=e.length,f=Xe.readOnly),x>125)throw new RangeError("The data size must not be greater than 125 bytes");let d={[ue]:x,fin:!0,generateMask:this._generateMask,mask:o,maskBuffer:this._maskBuffer,opcode:9,readOnly:f,rsv1:!1};ht(e)?this._state!==ge?this.enqueue([this.getBlobData,e,!1,d,a]):this.getBlobData(e,!1,d,a):this._state!==ge?this.enqueue([this.dispatch,e,!1,d,a]):this.sendFrame(r.frame(e,d),a)}pong(e,o,a){let x,f;if(typeof e=="string"?(x=Buffer.byteLength(e),f=!1):ht(e)?(x=e.size,f=!1):(e=Xe(e),x=e.length,f=Xe.readOnly),x>125)throw new RangeError("The data size must not be greater than 125 bytes");let d={[ue]:x,fin:!0,generateMask:this._generateMask,mask:o,maskBuffer:this._maskBuffer,opcode:10,readOnly:f,rsv1:!1};ht(e)?this._state!==ge?this.enqueue([this.getBlobData,e,!1,d,a]):this.getBlobData(e,!1,d,a):this._state!==ge?this.enqueue([this.dispatch,e,!1,d,a]):this.sendFrame(r.frame(e,d),a)}send(e,o,a){let x=this._extensions[Li.extensionName],f=o.binary?2:1,d=o.compress,h,_;typeof e=="string"?(h=Buffer.byteLength(e),_=!1):ht(e)?(h=e.size,_=!1):(e=Xe(e),h=e.length,_=Xe.readOnly),this._firstFragment?(this._firstFragment=!1,d&&x&&x.params[x._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(d=h>=x._threshold),this._compress=d):(d=!1,f=0),o.fin&&(this._firstFragment=!0);let v={[ue]:h,fin:o.fin,generateMask:this._generateMask,mask:o.mask,maskBuffer:this._maskBuffer,opcode:f,readOnly:_,rsv1:d};ht(e)?this._state!==ge?this.enqueue([this.getBlobData,e,this._compress,v,a]):this.getBlobData(e,this._compress,v,a):this._state!==ge?this.enqueue([this.dispatch,e,this._compress,v,a]):this.dispatch(e,this._compress,v,a)}getBlobData(e,o,a,x){this._bufferedBytes+=a[ue],this._state=$x,e.arrayBuffer().then(f=>{if(this._socket.destroyed){let h=new Error("The socket was closed while the blob was being read");process.nextTick(Cr,this,h,x);return}this._bufferedBytes-=a[ue];let d=Xe(f);o?this.dispatch(d,o,a,x):(this._state=ge,this.sendFrame(r.frame(d,a),x),this.dequeue())}).catch(f=>{process.nextTick(Qx,this,f,x)})}dispatch(e,o,a,x){if(!o){this.sendFrame(r.frame(e,a),x);return}let f=this._extensions[Li.extensionName];this._bufferedBytes+=a[ue],this._state=Zx,f.compress(e,a.fin,(d,h)=>{if(this._socket.destroyed){let _=new Error("The socket was closed while data was being compressed");Cr(this,_,x);return}this._bufferedBytes-=a[ue],this._state=ge,a.readOnly=!1,this.sendFrame(r.frame(h,a),x),this.dequeue()})}dequeue(){for(;this._state===ge&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[3][ue],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][ue],this._queue.push(e)}sendFrame(e,o){e.length===2?(this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],o),this._socket.uncork()):this._socket.write(e[0],o)}};Ii.exports=Er;function Cr(r,e,o){typeof o=="function"&&o(e);for(let a=0;a<r._queue.length;a++){let x=r._queue[a],f=x[x.length-1];typeof f=="function"&&f(e)}}function Qx(r,e,o){Cr(r,e,o),r.onerror(e)}});var Ui=re((pl,Fi)=>{"use strict";var{kForOnEventAttribute:It,kListener:kr}=Ie(),Ni=Symbol("kCode"),Ri=Symbol("kData"),Bi=Symbol("kError"),Oi=Symbol("kMessage"),Mi=Symbol("kReason"),pt=Symbol("kTarget"),zi=Symbol("kType"),qi=Symbol("kWasClean"),Re=class{constructor(e){this[pt]=null,this[zi]=e}get target(){return this[pt]}get type(){return this[zi]}};Object.defineProperty(Re.prototype,"target",{enumerable:!0});Object.defineProperty(Re.prototype,"type",{enumerable:!0});var Ze=class extends Re{constructor(e,o={}){super(e),this[Ni]=o.code===void 0?0:o.code,this[Mi]=o.reason===void 0?"":o.reason,this[qi]=o.wasClean===void 0?!1:o.wasClean}get code(){return this[Ni]}get reason(){return this[Mi]}get wasClean(){return this[qi]}};Object.defineProperty(Ze.prototype,"code",{enumerable:!0});Object.defineProperty(Ze.prototype,"reason",{enumerable:!0});Object.defineProperty(Ze.prototype,"wasClean",{enumerable:!0});var mt=class extends Re{constructor(e,o={}){super(e),this[Bi]=o.error===void 0?null:o.error,this[Oi]=o.message===void 0?"":o.message}get error(){return this[Bi]}get message(){return this[Oi]}};Object.defineProperty(mt.prototype,"error",{enumerable:!0});Object.defineProperty(mt.prototype,"message",{enumerable:!0});var Nt=class extends Re{constructor(e,o={}){super(e),this[Ri]=o.data===void 0?null:o.data}get data(){return this[Ri]}};Object.defineProperty(Nt.prototype,"data",{enumerable:!0});var ec={addEventListener(r,e,o={}){for(let x of this.listeners(r))if(!o[It]&&x[kr]===e&&!x[It])return;let a;if(r==="message")a=function(f,d){let h=new Nt("message",{data:d?f:f.toString()});h[pt]=this,An(e,this,h)};else if(r==="close")a=function(f,d){let h=new Ze("close",{code:f,reason:d.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});h[pt]=this,An(e,this,h)};else if(r==="error")a=function(f){let d=new mt("error",{error:f,message:f.message});d[pt]=this,An(e,this,d)};else if(r==="open")a=function(){let f=new Re("open");f[pt]=this,An(e,this,f)};else return;a[It]=!!o[It],a[kr]=e,o.once?this.once(r,a):this.on(r,a)},removeEventListener(r,e){for(let o of this.listeners(r))if(o[kr]===e&&!o[It]){this.removeListener(r,o);break}}};Fi.exports={CloseEvent:Ze,ErrorEvent:mt,Event:Re,EventTarget:ec,MessageEvent:Nt};function An(r,e,o){typeof r=="object"&&r.handleEvent?r.handleEvent.call(r,o):r.call(e,o)}});var kn=re((ml,Ki)=>{"use strict";var{tokenChars:Rt}=lt();function Ce(r,e,o){r[e]===void 0?r[e]=[o]:r[e].push(o)}function tc(r){let e=Object.create(null),o=Object.create(null),a=!1,x=!1,f=!1,d,h,_=-1,v=-1,b=-1,y=0;for(;y<r.length;y++)if(v=r.charCodeAt(y),d===void 0)if(b===-1&&Rt[v]===1)_===-1&&(_=y);else if(y!==0&&(v===32||v===9))b===-1&&_!==-1&&(b=y);else if(v===59||v===44){if(_===-1)throw new SyntaxError(`Unexpected character at index ${y}`);b===-1&&(b=y);let L=r.slice(_,b);v===44?(Ce(e,L,o),o=Object.create(null)):d=L,_=b=-1}else throw new SyntaxError(`Unexpected character at index ${y}`);else if(h===void 0)if(b===-1&&Rt[v]===1)_===-1&&(_=y);else if(v===32||v===9)b===-1&&_!==-1&&(b=y);else if(v===59||v===44){if(_===-1)throw new SyntaxError(`Unexpected character at index ${y}`);b===-1&&(b=y),Ce(o,r.slice(_,b),!0),v===44&&(Ce(e,d,o),o=Object.create(null),d=void 0),_=b=-1}else if(v===61&&_!==-1&&b===-1)h=r.slice(_,y),_=b=-1;else throw new SyntaxError(`Unexpected character at index ${y}`);else if(x){if(Rt[v]!==1)throw new SyntaxError(`Unexpected character at index ${y}`);_===-1?_=y:a||(a=!0),x=!1}else if(f)if(Rt[v]===1)_===-1&&(_=y);else if(v===34&&_!==-1)f=!1,b=y;else if(v===92)x=!0;else throw new SyntaxError(`Unexpected character at index ${y}`);else if(v===34&&r.charCodeAt(y-1)===61)f=!0;else if(b===-1&&Rt[v]===1)_===-1&&(_=y);else if(_!==-1&&(v===32||v===9))b===-1&&(b=y);else if(v===59||v===44){if(_===-1)throw new SyntaxError(`Unexpected character at index ${y}`);b===-1&&(b=y);let L=r.slice(_,b);a&&(L=L.replace(/\\/g,""),a=!1),Ce(o,h,L),v===44&&(Ce(e,d,o),o=Object.create(null),d=void 0),h=void 0,_=b=-1}else throw new SyntaxError(`Unexpected character at index ${y}`);if(_===-1||f||v===32||v===9)throw new SyntaxError("Unexpected end of input");b===-1&&(b=y);let A=r.slice(_,b);return d===void 0?Ce(e,A,o):(h===void 0?Ce(o,A,!0):a?Ce(o,h,A.replace(/\\/g,"")):Ce(o,h,A),Ce(e,d,o)),e}function nc(r){return Object.keys(r).map(e=>{let o=r[e];return Array.isArray(o)||(o=[o]),o.map(a=>[e].concat(Object.keys(a).map(x=>{let f=a[x];return Array.isArray(f)||(f=[f]),f.map(d=>d===!0?x:`${x}=${d}`).join("; ")})).join("; ")).join(", ")}).join(", ")}Ki.exports={format:nc,parse:tc}});var Tn=re((yl,eo)=>{"use strict";var rc=W("events"),sc=W("https"),ic=W("http"),ji=W("net"),oc=W("tls"),{randomBytes:ac,createHash:xc}=W("crypto"),{Duplex:_l,Readable:wl}=W("stream"),{URL:Dr}=W("url"),He=dt(),cc=Sr(),fc=Ar(),{isBlob:uc}=lt(),{BINARY_TYPES:Hi,CLOSE_TIMEOUT:dc,EMPTY_BUFFER:Dn,GUID:lc,kForOnEventAttribute:Pr,kListener:hc,kStatusCode:gc,kWebSocket:Y,NOOP:Wi}=Ie(),{EventTarget:{addEventListener:pc,removeEventListener:mc}}=Ui(),{format:_c,parse:wc}=kn(),{toBuffer:yc}=Lt(),Ji=Symbol("kAborted"),Lr=[8,13],Be=["CONNECTING","OPEN","CLOSING","CLOSED"],vc=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,F=class r extends rc{constructor(e,o,a){super(),this._binaryType=Hi[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=Dn,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol="",this._readyState=r.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,e!==null?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,o===void 0?o=[]:Array.isArray(o)||(typeof o=="object"&&o!==null?(a=o,o=[]):o=[o]),Vi(this,e,o,a)):(this._autoPong=a.autoPong,this._closeTimeout=a.closeTimeout,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(e){Hi.includes(e)&&(this._binaryType=e,this._receiver&&(this._receiver._binaryType=e))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(e,o,a){let x=new cc({allowSynchronousEvents:a.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:a.maxPayload,skipUTF8Validation:a.skipUTF8Validation}),f=new fc(e,this._extensions,a.generateMask);this._receiver=x,this._sender=f,this._socket=e,x[Y]=this,f[Y]=this,e[Y]=this,x.on("conclude",Ec),x.on("drain",Cc),x.on("error",Ac),x.on("message",kc),x.on("ping",Dc),x.on("pong",Pc),f.onerror=Lc,e.setTimeout&&e.setTimeout(0),e.setNoDelay&&e.setNoDelay(),o.length>0&&e.unshift(o),e.on("close",Zi),e.on("data",Ln),e.on("end",$i),e.on("error",Qi),this._readyState=r.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=r.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[He.extensionName]&&this._extensions[He.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=r.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(e,o){if(this.readyState!==r.CLOSED){if(this.readyState===r.CONNECTING){ie(this,this._req,"WebSocket was closed before the connection was established");return}if(this.readyState===r.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=r.CLOSING,this._sender.close(e,o,!this._isServer,a=>{a||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),Yi(this)}}pause(){this.readyState===r.CONNECTING||this.readyState===r.CLOSED||(this._paused=!0,this._socket.pause())}ping(e,o,a){if(this.readyState===r.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(a=e,e=o=void 0):typeof o=="function"&&(a=o,o=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==r.OPEN){Tr(this,e,a);return}o===void 0&&(o=!this._isServer),this._sender.ping(e||Dn,o,a)}pong(e,o,a){if(this.readyState===r.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(a=e,e=o=void 0):typeof o=="function"&&(a=o,o=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==r.OPEN){Tr(this,e,a);return}o===void 0&&(o=!this._isServer),this._sender.pong(e||Dn,o,a)}resume(){this.readyState===r.CONNECTING||this.readyState===r.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(e,o,a){if(this.readyState===r.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof o=="function"&&(a=o,o={}),typeof e=="number"&&(e=e.toString()),this.readyState!==r.OPEN){Tr(this,e,a);return}let x={binary:typeof e!="string",mask:!this._isServer,compress:!0,fin:!0,...o};this._extensions[He.extensionName]||(x.compress=!1),this._sender.send(e||Dn,x,a)}terminate(){if(this.readyState!==r.CLOSED){if(this.readyState===r.CONNECTING){ie(this,this._req,"WebSocket was closed before the connection was established");return}this._socket&&(this._readyState=r.CLOSING,this._socket.destroy())}}};Object.defineProperty(F,"CONNECTING",{enumerable:!0,value:Be.indexOf("CONNECTING")});Object.defineProperty(F.prototype,"CONNECTING",{enumerable:!0,value:Be.indexOf("CONNECTING")});Object.defineProperty(F,"OPEN",{enumerable:!0,value:Be.indexOf("OPEN")});Object.defineProperty(F.prototype,"OPEN",{enumerable:!0,value:Be.indexOf("OPEN")});Object.defineProperty(F,"CLOSING",{enumerable:!0,value:Be.indexOf("CLOSING")});Object.defineProperty(F.prototype,"CLOSING",{enumerable:!0,value:Be.indexOf("CLOSING")});Object.defineProperty(F,"CLOSED",{enumerable:!0,value:Be.indexOf("CLOSED")});Object.defineProperty(F.prototype,"CLOSED",{enumerable:!0,value:Be.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(r=>{Object.defineProperty(F.prototype,r,{enumerable:!0})});["open","error","close","message"].forEach(r=>{Object.defineProperty(F.prototype,`on${r}`,{enumerable:!0,get(){for(let e of this.listeners(r))if(e[Pr])return e[hc];return null},set(e){for(let o of this.listeners(r))if(o[Pr]){this.removeListener(r,o);break}typeof e=="function"&&this.addEventListener(r,e,{[Pr]:!0})}})});F.prototype.addEventListener=pc;F.prototype.removeEventListener=mc;eo.exports=F;function Vi(r,e,o,a){let x={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:dc,protocolVersion:Lr[1],maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...a,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(r._autoPong=x.autoPong,r._closeTimeout=x.closeTimeout,!Lr.includes(x.protocolVersion))throw new RangeError(`Unsupported protocol version: ${x.protocolVersion} (supported versions: ${Lr.join(", ")})`);let f;if(e instanceof Dr)f=e;else try{f=new Dr(e)}catch{throw new SyntaxError(`Invalid URL: ${e}`)}f.protocol==="http:"?f.protocol="ws:":f.protocol==="https:"&&(f.protocol="wss:"),r._url=f.href;let d=f.protocol==="wss:",h=f.protocol==="ws+unix:",_;if(f.protocol!=="ws:"&&!d&&!h?_=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:h&&!f.pathname?_="The URL's pathname is empty":f.hash&&(_="The URL contains a fragment identifier"),_){let R=new SyntaxError(_);if(r._redirects===0)throw R;Pn(r,R);return}let v=d?443:80,b=ac(16).toString("base64"),y=d?sc.request:ic.request,A=new Set,L;if(x.createConnection=x.createConnection||(d?Sc:bc),x.defaultPort=x.defaultPort||v,x.port=f.port||v,x.host=f.hostname.startsWith("[")?f.hostname.slice(1,-1):f.hostname,x.headers={...x.headers,"Sec-WebSocket-Version":x.protocolVersion,"Sec-WebSocket-Key":b,Connection:"Upgrade",Upgrade:"websocket"},x.path=f.pathname+f.search,x.timeout=x.handshakeTimeout,x.perMessageDeflate&&(L=new He({...x.perMessageDeflate,isServer:!1,maxPayload:x.maxPayload}),x.headers["Sec-WebSocket-Extensions"]=_c({[He.extensionName]:L.offer()})),o.length){for(let R of o){if(typeof R!="string"||!vc.test(R)||A.has(R))throw new SyntaxError("An invalid or duplicated subprotocol was specified");A.add(R)}x.headers["Sec-WebSocket-Protocol"]=o.join(",")}if(x.origin&&(x.protocolVersion<13?x.headers["Sec-WebSocket-Origin"]=x.origin:x.headers.Origin=x.origin),(f.username||f.password)&&(x.auth=`${f.username}:${f.password}`),h){let R=x.path.split(":");x.socketPath=R[0],x.path=R[1]}let T;if(x.followRedirects){if(r._redirects===0){r._originalIpc=h,r._originalSecure=d,r._originalHostOrSocketPath=h?x.socketPath:f.host;let R=a&&a.headers;if(a={...a,headers:{}},R)for(let[U,$]of Object.entries(R))a.headers[U.toLowerCase()]=$}else if(r.listenerCount("redirect")===0){let R=h?r._originalIpc?x.socketPath===r._originalHostOrSocketPath:!1:r._originalIpc?!1:f.host===r._originalHostOrSocketPath;(!R||r._originalSecure&&!d)&&(delete x.headers.authorization,delete x.headers.cookie,R||delete x.headers.host,x.auth=void 0)}x.auth&&!a.headers.authorization&&(a.headers.authorization="Basic "+Buffer.from(x.auth).toString("base64")),T=r._req=y(x),r._redirects&&r.emit("redirect",r.url,T)}else T=r._req=y(x);x.timeout&&T.on("timeout",()=>{ie(r,T,"Opening handshake has timed out")}),T.on("error",R=>{T===null||T[Ji]||(T=r._req=null,Pn(r,R))}),T.on("response",R=>{let U=R.headers.location,$=R.statusCode;if(U&&x.followRedirects&&$>=300&&$<400){if(++r._redirects>x.maxRedirects){ie(r,T,"Maximum redirects exceeded");return}T.abort();let te;try{te=new Dr(U,e)}catch{let P=new SyntaxError(`Invalid URL: ${U}`);Pn(r,P);return}Vi(r,te,o,a)}else r.emit("unexpected-response",T,R)||ie(r,T,`Unexpected server response: ${R.statusCode}`)}),T.on("upgrade",(R,U,$)=>{if(r.emit("upgrade",R),r.readyState!==F.CONNECTING)return;T=r._req=null;let te=R.headers.upgrade;if(te===void 0||te.toLowerCase()!=="websocket"){ie(r,U,"Invalid Upgrade header");return}let Ae=xc("sha1").update(b+lc).digest("base64");if(R.headers["sec-websocket-accept"]!==Ae){ie(r,U,"Invalid Sec-WebSocket-Accept header");return}let P=R.headers["sec-websocket-protocol"],z;if(P!==void 0?A.size?A.has(P)||(z="Server sent an invalid subprotocol"):z="Server sent a subprotocol but none was requested":A.size&&(z="Server sent no subprotocol"),z){ie(r,U,z);return}P&&(r._protocol=P);let Z=R.headers["sec-websocket-extensions"];if(Z!==void 0){if(!L){ie(r,U,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let pe;try{pe=wc(Z)}catch{ie(r,U,"Invalid Sec-WebSocket-Extensions header");return}let ke=Object.keys(pe);if(ke.length!==1||ke[0]!==He.extensionName){ie(r,U,"Server indicated an extension that was not requested");return}try{L.accept(pe[He.extensionName])}catch{ie(r,U,"Invalid Sec-WebSocket-Extensions header");return}r._extensions[He.extensionName]=L}r.setSocket(U,$,{allowSynchronousEvents:x.allowSynchronousEvents,generateMask:x.generateMask,maxPayload:x.maxPayload,skipUTF8Validation:x.skipUTF8Validation})}),x.finishRequest?x.finishRequest(T,r):T.end()}function Pn(r,e){r._readyState=F.CLOSING,r._errorEmitted=!0,r.emit("error",e),r.emitClose()}function bc(r){return r.path=r.socketPath,ji.connect(r)}function Sc(r){return r.path=void 0,!r.servername&&r.servername!==""&&(r.servername=ji.isIP(r.host)?"":r.host),oc.connect(r)}function ie(r,e,o){r._readyState=F.CLOSING;let a=new Error(o);Error.captureStackTrace(a,ie),e.setHeader?(e[Ji]=!0,e.abort(),e.socket&&!e.socket.destroyed&&e.socket.destroy(),process.nextTick(Pn,r,a)):(e.destroy(a),e.once("error",r.emit.bind(r,"error")),e.once("close",r.emitClose.bind(r)))}function Tr(r,e,o){if(e){let a=uc(e)?e.size:yc(e).length;r._socket?r._sender._bufferedBytes+=a:r._bufferedAmount+=a}if(o){let a=new Error(`WebSocket is not open: readyState ${r.readyState} (${Be[r.readyState]})`);process.nextTick(o,a)}}function Ec(r,e){let o=this[Y];o._closeFrameReceived=!0,o._closeMessage=e,o._closeCode=r,o._socket[Y]!==void 0&&(o._socket.removeListener("data",Ln),process.nextTick(Xi,o._socket),r===1005?o.close():o.close(r,e))}function Cc(){let r=this[Y];r.isPaused||r._socket.resume()}function Ac(r){let e=this[Y];e._socket[Y]!==void 0&&(e._socket.removeListener("data",Ln),process.nextTick(Xi,e._socket),e.close(r[gc])),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",r))}function Gi(){this[Y].emitClose()}function kc(r,e){this[Y].emit("message",r,e)}function Dc(r){let e=this[Y];e._autoPong&&e.pong(r,!this._isServer,Wi),e.emit("ping",r)}function Pc(r){this[Y].emit("pong",r)}function Xi(r){r.resume()}function Lc(r){let e=this[Y];e.readyState!==F.CLOSED&&(e.readyState===F.OPEN&&(e._readyState=F.CLOSING,Yi(e)),this._socket.end(),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",r)))}function Yi(r){r._closeTimer=setTimeout(r._socket.destroy.bind(r._socket),r._closeTimeout)}function Zi(){let r=this[Y];if(this.removeListener("close",Zi),this.removeListener("data",Ln),this.removeListener("end",$i),r._readyState=F.CLOSING,!this._readableState.endEmitted&&!r._closeFrameReceived&&!r._receiver._writableState.errorEmitted&&this._readableState.length!==0){let e=this.read(this._readableState.length);r._receiver.write(e)}r._receiver.end(),this[Y]=void 0,clearTimeout(r._closeTimer),r._receiver._writableState.finished||r._receiver._writableState.errorEmitted?r.emitClose():(r._receiver.on("error",Gi),r._receiver.on("finish",Gi))}function Ln(r){this[Y]._receiver.write(r)||this.pause()}function $i(){let r=this[Y];r._readyState=F.CLOSING,r._receiver.end(),this.end()}function Qi(){let r=this[Y];this.removeListener("error",Qi),this.on("error",Wi),r&&(r._readyState=F.CLOSING,this.destroy())}});var so=re((bl,ro)=>{"use strict";var vl=Tn(),{Duplex:Tc}=W("stream");function to(r){r.emit("close")}function Ic(){!this.destroyed&&this._writableState.finished&&this.destroy()}function no(r){this.removeListener("error",no),this.destroy(),this.listenerCount("error")===0&&this.emit("error",r)}function Nc(r,e){let o=!0,a=new Tc({...e,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return r.on("message",function(f,d){let h=!d&&a._readableState.objectMode?f.toString():f;a.push(h)||r.pause()}),r.once("error",function(f){a.destroyed||(o=!1,a.destroy(f))}),r.once("close",function(){a.destroyed||a.push(null)}),a._destroy=function(x,f){if(r.readyState===r.CLOSED){f(x),process.nextTick(to,a);return}let d=!1;r.once("error",function(_){d=!0,f(_)}),r.once("close",function(){d||f(x),process.nextTick(to,a)}),o&&r.terminate()},a._final=function(x){if(r.readyState===r.CONNECTING){r.once("open",function(){a._final(x)});return}r._socket!==null&&(r._socket._writableState.finished?(x(),a._readableState.endEmitted&&a.destroy()):(r._socket.once("finish",function(){x()}),r.close()))},a._read=function(){r.isPaused&&r.resume()},a._write=function(x,f,d){if(r.readyState===r.CONNECTING){r.once("open",function(){a._write(x,f,d)});return}r.send(x,d)},a.on("end",Ic),a.on("error",no),a}ro.exports=Nc});var Ir=re((Sl,io)=>{"use strict";var{tokenChars:Rc}=lt();function Bc(r){let e=new Set,o=-1,a=-1,x=0;for(x;x<r.length;x++){let d=r.charCodeAt(x);if(a===-1&&Rc[d]===1)o===-1&&(o=x);else if(x!==0&&(d===32||d===9))a===-1&&o!==-1&&(a=x);else if(d===44){if(o===-1)throw new SyntaxError(`Unexpected character at index ${x}`);a===-1&&(a=x);let h=r.slice(o,a);if(e.has(h))throw new SyntaxError(`The "${h}" subprotocol is duplicated`);e.add(h),o=a=-1}else throw new SyntaxError(`Unexpected character at index ${x}`)}if(o===-1||a!==-1)throw new SyntaxError("Unexpected end of input");let f=r.slice(o,x);if(e.has(f))throw new SyntaxError(`The "${f}" subprotocol is duplicated`);return e.add(f),e}io.exports={parse:Bc}});var lo=re((Cl,uo)=>{"use strict";var Oc=W("events"),In=W("http"),{Duplex:El}=W("stream"),{createHash:Mc}=W("crypto"),oo=kn(),$e=dt(),zc=Ir(),qc=Tn(),{CLOSE_TIMEOUT:Fc,GUID:Uc,kWebSocket:Kc}=Ie(),Hc=/^[+/0-9A-Za-z]{22}==$/,ao=0,xo=1,fo=2,Nr=class extends Oc{constructor(e,o){if(super(),e={allowSynchronousEvents:!0,autoPong:!0,maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:Fc,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:qc,...e},e.port==null&&!e.server&&!e.noServer||e.port!=null&&(e.server||e.noServer)||e.server&&e.noServer)throw new TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(e.port!=null?(this._server=In.createServer((a,x)=>{let f=In.STATUS_CODES[426];x.writeHead(426,{"Content-Length":f.length,"Content-Type":"text/plain"}),x.end(f)}),this._server.listen(e.port,e.host,e.backlog,o)):e.server&&(this._server=e.server),this._server){let a=this.emit.bind(this,"connection");this._removeListeners=Gc(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(x,f,d)=>{this.handleUpgrade(x,f,d,a)}})}e.perMessageDeflate===!0&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=ao}address(){if(this.options.noServer)throw new Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(e){if(this._state===fo){e&&this.once("close",()=>{e(new Error("The server is not running"))}),process.nextTick(Bt,this);return}if(e&&this.once("close",e),this._state!==xo)if(this._state=xo,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients?this.clients.size?this._shouldEmitClose=!0:process.nextTick(Bt,this):process.nextTick(Bt,this);else{let o=this._server;this._removeListeners(),this._removeListeners=this._server=null,o.close(()=>{Bt(this)})}}shouldHandle(e){if(this.options.path){let o=e.url.indexOf("?");if((o!==-1?e.url.slice(0,o):e.url)!==this.options.path)return!1}return!0}handleUpgrade(e,o,a,x){o.on("error",co);let f=e.headers["sec-websocket-key"],d=e.headers.upgrade,h=+e.headers["sec-websocket-version"];if(e.method!=="GET"){Qe(this,e,o,405,"Invalid HTTP method");return}if(d===void 0||d.toLowerCase()!=="websocket"){Qe(this,e,o,400,"Invalid Upgrade header");return}if(f===void 0||!Hc.test(f)){Qe(this,e,o,400,"Missing or invalid Sec-WebSocket-Key header");return}if(h!==13&&h!==8){Qe(this,e,o,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});return}if(!this.shouldHandle(e)){Ot(o,400);return}let _=e.headers["sec-websocket-protocol"],v=new Set;if(_!==void 0)try{v=zc.parse(_)}catch{Qe(this,e,o,400,"Invalid Sec-WebSocket-Protocol header");return}let b=e.headers["sec-websocket-extensions"],y={};if(this.options.perMessageDeflate&&b!==void 0){let A=new $e({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let L=oo.parse(b);L[$e.extensionName]&&(A.accept(L[$e.extensionName]),y[$e.extensionName]=A)}catch{Qe(this,e,o,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let A={origin:e.headers[`${h===8?"sec-websocket-origin":"origin"}`],secure:!!(e.socket.authorized||e.socket.encrypted),req:e};if(this.options.verifyClient.length===2){this.options.verifyClient(A,(L,T,R,U)=>{if(!L)return Ot(o,T||401,R,U);this.completeUpgrade(y,f,v,e,o,a,x)});return}if(!this.options.verifyClient(A))return Ot(o,401)}this.completeUpgrade(y,f,v,e,o,a,x)}completeUpgrade(e,o,a,x,f,d,h){if(!f.readable||!f.writable)return f.destroy();if(f[Kc])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>ao)return Ot(f,503);let v=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${Mc("sha1").update(o+Uc).digest("base64")}`],b=new this.options.WebSocket(null,void 0,this.options);if(a.size){let y=this.options.handleProtocols?this.options.handleProtocols(a,x):a.values().next().value;y&&(v.push(`Sec-WebSocket-Protocol: ${y}`),b._protocol=y)}if(e[$e.extensionName]){let y=e[$e.extensionName].params,A=oo.format({[$e.extensionName]:[y]});v.push(`Sec-WebSocket-Extensions: ${A}`),b._extensions=e}this.emit("headers",v,x),f.write(v.concat(`\r
|
|
12
12
|
`).join(`\r
|
|
13
|
-
`)),f.removeListener("error",
|
|
13
|
+
`)),f.removeListener("error",co),b.setSocket(f,d,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(b),b.on("close",()=>{this.clients.delete(b),this._shouldEmitClose&&!this.clients.size&&process.nextTick(Bt,this)})),h(b,x)}};uo.exports=Nr;function Gc(r,e){for(let o of Object.keys(e))r.on(o,e[o]);return function(){for(let a of Object.keys(e))r.removeListener(a,e[a])}}function Bt(r){r._state=fo,r.emit("close")}function co(){this.destroy()}function Ot(r,e,o,a){o=o||In.STATUS_CODES[e],a={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(o),...a},r.once("finish",r.destroy),r.end(`HTTP/1.1 ${e} ${In.STATUS_CODES[e]}\r
|
|
14
14
|
`+Object.keys(a).map(x=>`${x}: ${a[x]}`).join(`\r
|
|
15
15
|
`)+`\r
|
|
16
16
|
\r
|
|
17
|
-
`+
|
|
17
|
+
`+o)}function Qe(r,e,o,a,x,f){if(r.listenerCount("wsClientError")){let d=new Error(x);Error.captureStackTrace(d,Qe),r.emit("wsClientError",d,o,e)}else Ot(o,a,x,f)}});import{spawn as gf}from"node:child_process";import{existsSync as pf,openSync as mf}from"node:fs";import{mkdir as _f}from"node:fs/promises";import{dirname as wf}from"node:path";import{fileURLToPath as yf}from"node:url";function Or(r=H()){return pf(r.libEntry)?r.libEntry:yf(new URL("../index.ts",import.meta.url))}async function Bo(r={}){let e=r.paths??H(),o=r.entryOverride??Or(e);await _f(wf(e.logFile),{recursive:!0});let a=mf(e.logFile,"a"),f=o.endsWith(".ts")?["--import","tsx/esm",o,"--daemon"]:[o,"--daemon"],d=gf(process.execPath,f,{detached:!0,stdio:["ignore",a,a],env:{...process.env,COZE_BRIDGE_DAEMON:"1"}});if(d.unref(),typeof d.pid!="number")throw new Error("failed to spawn daemon (no pid)");return vf.info("daemon spawned",{pid:d.pid,entry:o}),{pid:d.pid,entry:o}}var vf,Mr=De(()=>{"use strict";K();se();vf=B("spawn-daemon")});import{spawn as Pf}from"node:child_process";import{mkdir as Lf,unlink as Tf,writeFile as If}from"node:fs/promises";import{dirname as Nf,join as Rf}from"node:path";function Fn(r){return r.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function Fo(r,e){return new Promise((o,a)=>{let x=Pf(r,e,{stdio:["ignore","pipe","pipe"]}),f="";x.stderr?.on("data",d=>{f+=d.toString("utf8")}),x.on("error",a),x.on("close",d=>{d===0?o():a(new Error(`${r} ${e.join(" ")} exited ${d}: ${f.trim()}`))})})}var qn,Fr,Ur,Uo=De(()=>{"use strict";K();qn=B("supervisor.launchd"),Fr="ai.coze.bridge",Ur={platform:"darwin",renderConfig(r){return`<?xml version="1.0" encoding="UTF-8"?>
|
|
18
18
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
19
19
|
<plist version="1.0">
|
|
20
20
|
<dict>
|
|
21
21
|
<key>Label</key>
|
|
22
|
-
<string>${
|
|
22
|
+
<string>${Fr}</string>
|
|
23
23
|
<key>ProgramArguments</key>
|
|
24
24
|
<array>
|
|
25
|
-
<string>${
|
|
26
|
-
<string>${
|
|
25
|
+
<string>${Fn(r.nodeBin)}</string>
|
|
26
|
+
<string>${Fn(r.entry)}</string>
|
|
27
27
|
<string>--daemon</string>
|
|
28
28
|
</array>
|
|
29
29
|
<key>RunAtLoad</key>
|
|
@@ -33,12 +33,12 @@ var R0=Object.create;var xr=Object.defineProperty;var O0=Object.getOwnPropertyDe
|
|
|
33
33
|
<key>ThrottleInterval</key>
|
|
34
34
|
<integer>10</integer>
|
|
35
35
|
<key>StandardOutPath</key>
|
|
36
|
-
<string>${
|
|
36
|
+
<string>${Fn(r.logFile)}</string>
|
|
37
37
|
<key>StandardErrorPath</key>
|
|
38
|
-
<string>${
|
|
38
|
+
<string>${Fn(r.logFile)}</string>
|
|
39
39
|
</dict>
|
|
40
40
|
</plist>
|
|
41
|
-
`},configPath(r){return
|
|
41
|
+
`},configPath(r){return Rf(r.homeDir,"Library","LaunchAgents",`${Fr}.plist`)},async install(r){let e=this.configPath(r);await Lf(Nf(e),{recursive:!0}),await If(e,this.renderConfig(r),"utf8"),qn.info("plist written",{plistPath:e}),await Fo("launchctl",["load","-w",e]),qn.info("launchd job loaded",{label:Fr})},async uninstall(r){let e=this.configPath(r);await Fo("launchctl",["unload","-w",e]).catch(o=>qn.warn("launchctl unload failed (ignored)",{err:String(o)})),await Tf(e).catch(o=>{if(o.code!=="ENOENT")throw o}),qn.info("launchd job removed",{plistPath:e})}}});import{spawn as Bf}from"node:child_process";import{mkdir as Of,unlink as Mf,writeFile as zf}from"node:fs/promises";import{dirname as qf,join as Ff}from"node:path";function Hn(r,e){return new Promise((o,a)=>{let x=Bf(r,e,{stdio:["ignore","pipe","pipe"]}),f="";x.stderr?.on("data",d=>{f+=d.toString("utf8")}),x.on("error",a),x.on("close",d=>{d===0?o():a(new Error(`${r} ${e.join(" ")} exited ${d}: ${f.trim()}`))})})}var Un,Kn,Kr,Ko=De(()=>{"use strict";K();Un=B("supervisor.systemd"),Kn="coze-bridge.service",Kr={platform:"linux",renderConfig(r){return`[Unit]
|
|
42
42
|
Description=Coze Bridge daemon
|
|
43
43
|
After=network.target
|
|
44
44
|
|
|
@@ -52,7 +52,7 @@ StandardError=append:${r.logFile}
|
|
|
52
52
|
|
|
53
53
|
[Install]
|
|
54
54
|
WantedBy=default.target
|
|
55
|
-
`},configPath(r){return
|
|
55
|
+
`},configPath(r){return Ff(r.homeDir,".config","systemd","user",Kn)},async install(r){let e=this.configPath(r);await Of(qf(e),{recursive:!0}),await zf(e,this.renderConfig(r),"utf8"),Un.info("systemd unit written",{unitPath:e}),await Hn("systemctl",["--user","daemon-reload"]),await Hn("systemctl",["--user","enable","--now",Kn]),Un.info("systemd unit enabled",{unitName:Kn})},async uninstall(r){let e=this.configPath(r);await Hn("systemctl",["--user","disable","--now",Kn]).catch(o=>Un.warn("systemctl disable failed (ignored)",{err:String(o)})),await Mf(e).catch(o=>{if(o.code!=="ENOENT")throw o}),await Hn("systemctl",["--user","daemon-reload"]).catch(()=>{}),Un.info("systemd unit removed",{unitPath:e})}}});import{spawn as Uf}from"node:child_process";import{join as Kf}from"node:path";function Ho(r,e){return new Promise((o,a)=>{let x=Uf(r,e,{stdio:["ignore","pipe","pipe"],shell:!1}),f="";x.stderr?.on("data",d=>{f+=d.toString("utf8")}),x.on("error",a),x.on("close",d=>{d===0?o():a(new Error(`${r} ${e.join(" ")} exited ${d}: ${f.trim()}`))})})}var Hr,Gn,Gr,Go=De(()=>{"use strict";K();Hr=B("supervisor.taskscheduler"),Gn="CozeBridge",Gr={platform:"win32",renderConfig(r){return`<?xml version="1.0" encoding="UTF-16"?>
|
|
56
56
|
<Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
|
|
57
57
|
<RegistrationInfo>
|
|
58
58
|
<Description>Coze Bridge daemon</Description>
|
|
@@ -76,19 +76,20 @@ WantedBy=default.target
|
|
|
76
76
|
</Exec>
|
|
77
77
|
</Actions>
|
|
78
78
|
</Task>
|
|
79
|
-
`},configPath(r){return
|
|
79
|
+
`},configPath(r){return Kf(r.homeDir,".coze","bridge","task.xml")},async install(r){let e=`"${r.nodeBin}" "${r.entry}" --daemon`;await Ho("schtasks",["/Create","/SC","ONLOGON","/TN",Gn,"/TR",e,"/RU",r.userName,"/F"]),Hr.info("task scheduler entry created",{task:Gn})},async uninstall(r){await Ho("schtasks",["/Delete","/TN",Gn,"/F"]).catch(e=>Hr.warn("schtasks /Delete failed (ignored)",{err:String(e)})),Hr.info("task scheduler entry removed",{task:Gn})}}});var jr={};_s(jr,{buildContext:()=>Wf,getSupervisor:()=>jf,launchdSupervisor:()=>Ur,systemdSupervisor:()=>Kr,taskSchedulerSupervisor:()=>Gr});import{homedir as Hf,userInfo as Gf}from"node:os";function jf(r=process.platform){switch(r){case"darwin":return Ur;case"linux":return Kr;case"win32":return Gr;default:throw new Error(`unsupported platform for OS supervisor: ${r}`)}}function Wf(){let r=H();return{nodeBin:process.execPath,entry:Or(r),logFile:r.logFile,homeDir:Hf(),userName:Gf().username}}var Wr=De(()=>{"use strict";se();Mr();Uo();Ko();Go()});qe();K();import{readdir as aa}from"node:fs/promises";import{mkdir as na,writeFile as ra}from"node:fs/promises";import{join as sa}from"node:path";var ia={"claude-code":"CLAUDE.md",codex:"AGENTS.md",openclaw:"SOUL.md"};async function it(r,e,o,a){await na(r,{recursive:!0});let x=ia[e],f=sa(r,x),d=oa(e,o,a);return await ra(f,d,"utf8"),f}function oa(r,e,o){let a=`# Coze Agent: ${e}
|
|
80
80
|
|
|
81
81
|
> framework: \`${r}\`
|
|
82
82
|
|
|
83
|
-
`,x=
|
|
84
|
-
`)?
|
|
83
|
+
`,x=o?.trim()?o.endsWith(`
|
|
84
|
+
`)?o:`${o}
|
|
85
85
|
`:`_No instructions provided._
|
|
86
86
|
`;return`${a}---
|
|
87
87
|
|
|
88
|
-
${x}`}var Ce=O("agent-detail-sync"),Zt=class{constructor(e){this.opts=e}opts;async syncAll(e){let i=this.opts.paths.agentsRoot,a;try{a=await na(i)}catch(x){Ce.info("agents dir not found, skip detail sync",{root:i,err:String(x)});return}Ce.info("starting detail sync",{reason:e,count:a.length});for(let x of a)try{await this.syncOne(x)}catch(f){Ce.warn("detail sync failed for agent, skipping",{agentId:x,err:String(f)})}Ce.info("detail sync done",{reason:e})}async syncOne(e){let i=await xe(e,this.opts.paths);if(!i){Ce.info("detail sync: agent config missing, skip",{agentId:e});return}let a;try{a=await this.opts.sendDetail({_meta:{cozeAgentId:e}})}catch(u){Ce.warn("detail RPC failed, using local data",{agentId:e,err:String(u)});return}if(a.agentId&&a.agentId!==e){Ce.warn("detail response agentId mismatch, ignoring",{agentId:e,responseAgentId:a.agentId});return}let x=!1,f=!1;if(a.agentName&&a.agentName!==i.agentName&&(i.agentName=a.agentName,x=!0),a.description!==void 0&&a.description!==i.description&&(i.description=a.description,x=!0),a.cozeIdentity&&a.cozeIdentity!==i.cozeIdentity&&(i.cozeIdentity=a.cozeIdentity,x=!0,f=!0),a.deployType&&Ce.info("detail.deployType",{agentId:e,deployType:a.deployType}),!x){Ce.debug("detail sync: no diff",{agentId:e});return}await he(i,this.opts.paths),Ce.info("detail sync: config updated",{agentId:e,identityChanged:f,agentName:i.agentName}),f&&(await Ve(i.workspace,i.framework,e,i.cozeIdentity),await this.opts.handlers.reloadAgentSessionsPublic(e,"detail-sync"))}};Ke();import{spawn as ra}from"node:child_process";import{mkdir as sa,readFile as Rs,readdir as ia,rm as oa,stat as en,writeFile as aa}from"node:fs/promises";import{join as Ne,normalize as xa,relative as Os,resolve as ca,sep as Bs}from"node:path";function $t(r){return r?.cozeDeployType==="cloud"?"cloud":"local"}function Es(r){let{_meta:e,...i}=r;return{stripped:i,meta:e}}function ct(r){if(!r?.cozeAgentId)throw new Error("missing _meta.cozeAgentId");return r.cozeAgentId}var E=class extends Error{code;retriable;cause;constructor(e,i,a){super(i),this.name="BridgeError",this.code=e,this.retriable=a?.retriable??!1,a?.cause!==void 0&&(this.cause=a.cause)}};K();fe();function Ye(r,e){if($t(r)!=="cloud")throw new E("OPERATION_NOT_ALLOWED_FOR_LOCAL",`${e} is not allowed for local agent`)}var ks="https://llm-gateway.coze.cn",Qt="auto";function dr(r){return{model:r.model??Qt,...r.modelToken?{modelToken:r.modelToken}:{}}}function As(r){return!r||r===Qt}function Ds(r){let e={};return r.modelToken&&(e.ANTHROPIC_BASE_URL=ks,e.ANTHROPIC_AUTH_TOKEN=r.modelToken),As(r.model)||(e.ANTHROPIC_MODEL=r.model),e}function Ts(r){let e=[];return As(r.model)||e.push("-c",`model="${r.model}"`),r.modelToken&&(e.push("-c",'model_provider="openai"'),e.push("-c",`model_provider_overrides.openai.base_url="${ks}/v1"`)),e}function Ps(r){return r.modelToken?{OPENAI_API_KEY:r.modelToken}:{}}var ee=O("agent-handlers"),Is=5*1024*1024,fa=1,ua=6,da=new Set(["node_modules",".git",".coze","dist","build",".next"]),la=3e4,tn=class{constructor(e){this.opts=e}opts;async listSkills(e){Ye(e._meta,"_agent/listSkills");let i=ct(e._meta),a=await this.loadAgentCfg(i),x=a?.workspace??Le(i).workspace,f=a?.skills??[],u=[];for(let g of f){let m=Ne(x,g.relPath,"SKILL.md");await en(m).then(v=>v.isFile()).catch(()=>!1)&&u.push({skillId:g.skillId,skillName:g.skillName,downloadUrl:g.downloadUrl??"",...g.description?{description:g.description}:{},...g.version?{version:g.version}:{}})}return{skills:u}}async addSkills(e){Ye(e._meta,"_agent/addSkills");let i=ct(e._meta),a=await this.requireAgentCfg(i),x=e.skills??[],f=[...a.skills??[]],u=new Map(f.map((m,_)=>[m.skillId,_])),g=[];for(let m of x){if(!m.skillName)throw new E("IPC_BAD_REQUEST","skill missing skillName");let _=ha(m.skillName),v=ga(a.framework),y=Ne(v,_),C=Ne(a.workspace,y);await sa(C,{recursive:!0});let T=await ma(m.downloadUrl);wa(T)?await ya(T,C):await aa(Ne(C,"SKILL.md"),T.toString("utf8"),"utf8");let P={skillId:m.skillId,skillName:m.skillName,relPath:y,installedAt:Date.now(),...m.description?{description:m.description}:{},...m.version?{version:m.version}:{},...m.downloadUrl?{downloadUrl:m.downloadUrl}:{}},R=u.get(m.skillId);R!==void 0?f[R]=P:(u.set(m.skillId,f.length),f.push(P)),g.push(m),ee.info("skill installed",{agentId:i,skillId:m.skillId,skillName:m.skillName,relPath:y})}return await Yt(i,f),await this.reloadAgentSessions(i,"skills-added"),{installedSkills:g}}async removeSkills(e){Ye(e._meta,"_agent/removeSkills");let i=ct(e._meta),a=await this.requireAgentCfg(i),x=new Set(e.skillIds??[]),f=a.skills??[],u=[];for(let g of f){if(!x.has(g.skillId)){u.push(g);continue}let m=Ne(a.workspace,g.relPath);await oa(m,{recursive:!0,force:!0}),ee.info("skill removed",{agentId:i,skillId:g.skillId,relPath:g.relPath})}return await Yt(i,u),await this.reloadAgentSessions(i,"skills-removed"),{ok:!0}}reloadAgentSessionsPublic(e,i){return this.reloadAgentSessions(e,i)}async reloadAgentSessions(e,i){let a=this.opts.agents.get(e);if(a&&a.framework!=="codex")for(let[x,f]of a.sessions)try{await a.downstream.sessionLoad({sessionId:f,cwd:a.workspace}),ee.info("session reloaded",{reason:i,agentId:e,framework:a.framework,cloudId:x,acpId:f})}catch(u){ee.warn("session reload failed",{reason:i,agentId:e,framework:a.framework,cloudId:x,acpId:f,err:String(u)})}}async updateAgent(e){if(!e.cozeIdentity?.trim())return ee.info("_agent/update: empty cozeIdentity, noop",{agentId:e.agentId}),{ok:!0};let i=e.agentId,a=await xe(i);if(!a)throw new E("AGENT_NOT_FOUND",`agent not found: ${i}`);return a.cozeIdentity===e.cozeIdentity?(ee.info("_agent/update: cozeIdentity unchanged, noop",{agentId:i}),{ok:!0}):(a.cozeIdentity=e.cozeIdentity,await he(a),await Ve(a.workspace,a.framework,i,e.cozeIdentity),ee.info("_agent/update: cozeIdentity rewritten",{agentId:i,framework:a.framework}),await this.reloadAgentSessions(i,"identity-changed"),{ok:!0})}async disconnectAgent(e){let i=e.agentId;if(!i)throw new E("IPC_BAD_REQUEST","_agent/disconnect: missing agentId");let a=await xe(i);return a?(a.disconnectedAt=Date.now(),a.disconnectReason=e.reason??"",await he(a),ee.info("agent disconnected",{agentId:i,reason:e.reason??"",force:e.force??!1}),this.opts.disposeAndMarkDisconnected&&await this.opts.disposeAndMarkDisconnected(i,e.reason??"disconnect"),{ok:!0}):(ee.warn("_agent/disconnect: agent not found, ignoring",{agentId:i}),{ok:!0})}async switchModel(e){if(Ye(e._meta,"_agent/switchModel"),!e.agentId)throw new E("IPC_BAD_REQUEST","_agent/switchModel: missing agentId");let i=e.model&&e.model.trim()?e.model:Qt,a=e.modelToken?.trim()||void 0,x=await xe(e.agentId);if(!x)throw new E("AGENT_NOT_FOUND",`agent not found: ${e.agentId}`);x.model=i,a!==void 0?x.modelToken=a:delete x.modelToken,await he(x),ee.info("_agent/switchModel: model/modelToken persisted",{agentId:e.agentId,model:i,hasToken:!!a,reason:e.reason??"",force:e.force??!1});let f=this.opts.agents.get(e.agentId);if(!f)return ee.info("_agent/switchModel: agent not running, config persisted only",{agentId:e.agentId}),{ok:!0};if(f.status==="switching")return ee.info("_agent/switchModel: already switching, params updated via config",{agentId:e.agentId}),{ok:!0};if(!this.opts.executeModelSwitch)throw new E("BRIDGE_INTERNAL","_agent/switchModel: executeModelSwitch callback not wired");f.status="switching";let u=f.msgQueue.enqueue(async()=>{}),g=setTimeout(()=>{ee.warn("_agent/switchModel: 30s idle timeout, forcing downstream stop",{agentId:e.agentId}),f.downstream.stop("switchModel idle timeout").catch(m=>ee.warn("force stop failed (ignored)",{agentId:e.agentId,err:String(m)}))},la);try{return await u.catch(m=>ee.warn("_agent/switchModel: msgQueue idle wait rejected (continuing)",{agentId:e.agentId,err:String(m)})),clearTimeout(g),await this.opts.executeModelSwitch(e.agentId),{ok:!0}}catch(m){clearTimeout(g),ee.error("_agent/switchModel: failed, marking disconnected",{agentId:e.agentId,err:String(m)});let _=await xe(e.agentId).catch(()=>null);throw _&&(_.disconnectedAt=Date.now(),_.disconnectReason=`model switch failed: ${m instanceof Error?m.message:String(m)}`,await he(_).catch(v=>ee.warn("write disconnect marker failed (ignored)",{err:String(v)}))),this.opts.disposeAndMarkDisconnected?await this.opts.disposeAndMarkDisconnected(e.agentId,`model switch failed: ${m instanceof Error?m.message:String(m)}`).catch(v=>ee.warn("disposeAndMarkDisconnected failed (ignored)",{err:String(v)})):f.status="disconnected",m instanceof E&&(m.code==="MODEL_SWITCH_FAILED"||m.code==="AGENT_NOT_FOUND")?m:new E("MODEL_SWITCH_FAILED",m instanceof Error?m.message:String(m),{cause:m})}}async getFileTree(e){Ye(e._meta,"_agent/getFileTree");let i=e._meta,a=ct(i),x=this.resolveWorkspace(a),f=e.filePath??"",u=this.safeJoin(x,f),g=await en(u).catch(()=>null);if(!g)throw new E("IPC_BAD_REQUEST",`path not found: ${f}`);let m=va(e.depth);return g.isDirectory()?{tree:await Ms(x,u,f,m)}:{tree:[{name:ba(f),path:zs(f||"."),isDir:!1,size:g.size,modifiedAt:Math.floor(g.mtimeMs)}]}}async getFileContent(e){Ye(e._meta,"_agent/getFileContent");let i=ct(e._meta),a=this.resolveWorkspace(i);if(!e.filePath)throw new E("IPC_BAD_REQUEST","filePath required");let x=this.safeJoin(a,e.filePath),f=await en(x).catch(()=>null);if(!f||!f.isFile())throw new E("IPC_BAD_REQUEST",`not a file: ${e.filePath}`);if(f.size>Is)throw new E("IPC_BAD_REQUEST",`file too large: ${f.size} bytes (max ${Is})`);let u=await Rs(x);return u.includes(0)?{content:u.toString("base64"),encoding:"base64",size:f.size}:{content:u.toString("utf8"),encoding:"utf-8",size:f.size}}resolveWorkspace(e){let i=this.opts.agents.get(e);return i?i.workspace:Le(e).workspace}safeJoin(e,i){let a=ca(e,i||"."),x=Os(e,a);if(x.startsWith("..")||x===".."||x.startsWith(`..${Bs}`))throw new E("IPC_BAD_REQUEST",`path escapes workspace: ${i}`);return a}loadAgentCfg(e){return xe(e)}async requireAgentCfg(e){let i=await this.loadAgentCfg(e);if(!i)throw new E("AGENT_NOT_FOUND",`no config for agent: ${e}`);return i}};function ha(r){let e=r.trim().replace(/[^a-zA-Z0-9._-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,64);if(!e||e==="."||e==="..")throw new E("IPC_BAD_REQUEST",`invalid skill name: ${r}`);return e}function ga(r){return r==="claude-code"?Ne(".claude","skills"):Ne(".agents","skills")}var pa=3e4,Ls=50*1024*1024,Ns=3e4;async function ma(r){if(!r)throw new E("IPC_BAD_REQUEST","skill missing downloadUrl");if(r.startsWith("data:"))return _a(r);if(r.startsWith("file:")){let e=new URL(r).pathname,i=await Rs(e);if(i.length>Ls)throw new E("IPC_BAD_REQUEST",`skill too large: ${i.length} bytes`);return i}if(r.startsWith("http://")||r.startsWith("https://")){let e=new AbortController,i=setTimeout(()=>e.abort(),pa);try{let a=await fetch(r,{signal:e.signal});if(!a.ok)throw new E("IPC_BAD_REQUEST",`fetch skill failed HTTP ${a.status} ${r}`);let x=await a.arrayBuffer();if(x.byteLength>Ls)throw new E("IPC_BAD_REQUEST",`skill too large: ${x.byteLength} bytes`);return Buffer.from(x)}finally{clearTimeout(i)}}throw new E("IPC_BAD_REQUEST",`unsupported downloadUrl scheme (\u8981 https/data/file): ${r.slice(0,80)}`)}function _a(r){let e=/^data:([^,;]*)(;base64)?,(.*)$/s.exec(r);if(!e)throw new E("IPC_BAD_REQUEST","bad data URL");let i=!!e[2],a=e[3]??"";return i?Buffer.from(a,"base64"):Buffer.from(decodeURIComponent(a),"utf8")}function wa(r){return r.length>=2&&r[0]===31&&r[1]===139}async function ya(r,e){await new Promise((i,a)=>{let x=ra("tar",["-xzf","-","-C",e,"--strip-components=1"],{stdio:["pipe","pipe","pipe"]}),f="";x.stderr?.on("data",g=>{f+=String(g)});let u=setTimeout(()=>{x.kill("SIGKILL"),a(new E("IPC_BAD_REQUEST",`tar extract timeout (${Ns}ms)`))},Ns);x.on("error",g=>{clearTimeout(u),a(new E("IPC_BAD_REQUEST",`tar spawn failed: ${g.message}`,{cause:g}))}),x.on("exit",g=>{clearTimeout(u),g===0?i():a(new E("IPC_BAD_REQUEST",`tar exit ${g}${f?`: ${f.trim().slice(0,200)}`:""}`))}),x.stdin?.end(r)})}async function Ms(r,e,i,a){if(a<=0)return[];let x;try{x=await ia(e,{withFileTypes:!0})}catch{return[]}let f=[];for(let u of x){if(da.has(u.name))continue;let g=Ne(e,u.name),m=xa(Ne(i,u.name)),_=null;try{_=await en(g)}catch{continue}let v={name:u.name,path:zs(Os(r,g)),isDir:_.isDirectory(),size:_.size,modifiedAt:Math.floor(_.mtimeMs)};_.isDirectory()&&a>1&&(v.children=await Ms(r,g,m,a-1)),f.push(v)}return f.sort((u,g)=>u.isDir!==g.isDir?u.isDir?-1:1:u.name.localeCompare(g.name)),f}function va(r){return!r||r<=0?fa:Math.min(r,ua)}function ba(r){if(!r||r==="."||r==="/")return".";let e=r.split(/[/\\]/);return e[e.length-1]||"."}function zs(r){return r.split(Bs).join("/")}K();var Dt=O("agent-health-reporter"),Sa=3e4,nn=class{constructor(e){this.opts=e;this.intervalMs=e.intervalMs??Sa}opts;timer=null;inFlight=!1;unsubscribeRegister=null;intervalMs;start(){this.timer||(this.timer=setInterval(()=>{this.tick()},this.intervalMs),this.timer.unref?.(),this.unsubscribeRegister=this.opts.core.onAgentRegister(()=>{this.tick()}),Dt.info("heartbeat started",{intervalMs:this.intervalMs}),this.tick())}stop(){this.timer&&(clearInterval(this.timer),this.timer=null,this.unsubscribeRegister&&(this.unsubscribeRegister(),this.unsubscribeRegister=null),Dt.info("heartbeat stopped"))}async tick(){if(this.inFlight){Dt.debug("previous tick still in-flight, skip");return}let e=this.opts.getDeviceId();if(!e){Dt.debug("deviceId not available, skip tick (\u5C1A\u672A pair)");return}this.inFlight=!0;try{let i=[...this.opts.core.agents.values()];for(let a of i){let x=Ca(a);if(!x)continue;let f={status:x,_meta:{cozeAgentId:a.agentId,cozeDeviceId:e}};try{await this.opts.core.sendRequest("_agent/health",f)}catch(u){Dt.warn("heartbeat send failed",{agentId:a.agentId,status:x,err:String(u)})}}}finally{this.inFlight=!1}}};function Ca(r){return r.status==="error"?"error":r.activeTriggers.size>0?"busy":r.status==="ok"||r.status==="degraded"?"online":null}Ke();import{mkdir as lr,rm as Ra}from"node:fs/promises";import{spawn as Ta}from"node:child_process";function ft(r,e,i){return i===void 0?{jsonrpc:"2.0",id:r,method:e}:{jsonrpc:"2.0",id:r,method:e,params:i}}function qs(r,e){return e===void 0?{jsonrpc:"2.0",method:r}:{jsonrpc:"2.0",method:r,params:e}}function ut(r,e){return{jsonrpc:"2.0",id:r,result:e}}function Xe(r,e){return{jsonrpc:"2.0",id:r,error:e}}var rn=class extends Error{code;data;constructor(e){super(`JSON-RPC error code=${e.code} ${e.message}`),this.name="RemoteRpcError",this.code=e.code,e.data!==void 0&&(this.data=e.data)}},H={PARSE_ERROR:-32700,INVALID_REQUEST:-32600,METHOD_NOT_FOUND:-32601,INVALID_PARAMS:-32602,INTERNAL_ERROR:-32603,AGENT_NOT_FOUND:-32001,AGENT_BUSY:-32002,AGENT_TIMEOUT:-32003,AGENT_SPAWN_FAILED:-32004,OPERATION_NOT_ALLOWED_FOR_LOCAL:-32005,AGENT_DISCONNECTED:-32006,MODEL_SWITCHING:-32007,MODEL_SWITCH_FAILED:-32008};function sn(r){return"method"in r&&"id"in r&&r.id!==void 0}function Fs(r){return"method"in r&&!("id"in r)}function on(r){return!("method"in r)&&"id"in r}var Ea={AGENT_NOT_FOUND:H.AGENT_NOT_FOUND,AGENT_BUSY:H.AGENT_BUSY,AGENT_DISCONNECTED:H.AGENT_DISCONNECTED,AGENT_TIMEOUT:H.AGENT_TIMEOUT,AGENT_SPAWN_FAILED:H.AGENT_SPAWN_FAILED,AGENT_PROTOCOL_ERROR:H.INTERNAL_ERROR,BRIDGE_CONFIG_INVALID:H.INTERNAL_ERROR,BRIDGE_INTERNAL:H.INTERNAL_ERROR,IPC_AUTH_FAILED:H.INTERNAL_ERROR,IPC_BAD_REQUEST:H.INVALID_REQUEST,MODEL_SWITCHING:H.MODEL_SWITCHING,MODEL_SWITCH_FAILED:H.MODEL_SWITCH_FAILED,OPERATION_NOT_ALLOWED_FOR_LOCAL:H.OPERATION_NOT_ALLOWED_FOR_LOCAL,UPSTREAM_DISCONNECTED:H.INTERNAL_ERROR,UPSTREAM_HANDSHAKE_FAILED:H.INTERNAL_ERROR};function an(r){return r instanceof E?{code:Ea[r.code]??H.INTERNAL_ERROR,message:r.message,data:{bridgeCode:r.code,retriable:r.retriable}}:{code:H.INTERNAL_ERROR,message:r instanceof Error?r.message:String(r)}}function Us(r){let e=r.data,i=e?.bridgeCode??"AGENT_PROTOCOL_ERROR";return new E(i,r.message,{retriable:e?.retriable??!1,cause:r.data})}function Ks(r){return`${JSON.stringify(r)}
|
|
89
|
-
`}
|
|
90
|
-
`);this.buffer=i.pop()??"";let a=[];for(let x of i){let f=x.replace(/\r$/,"").trim();if(f)try{a.push(JSON.parse(f))}catch(u){this.onError?.({line:f,error:u})}}return a}flush(){if(!this.buffer)return[];let e=this.buffer.replace(/\r$/,"").trim();if(this.buffer="",!e)return[];try{return[JSON.parse(e)]}catch(i){return this.onError?.({line:e,error:i}),[]}}};var Ws={"session/prompt":"session.prompt","session/cancel":"session.cancel","session/new":"session.new","session/load":"session.load","_agent/create":"agent.create","_agent/health":"agent.health","_agent/pair":"agent.pair","_agent/listSkills":"agent.listSkills","_agent/addSkills":"agent.addSkills","_agent/removeSkills":"agent.removeSkills","_agent/getFileTree":"agent.getFileTree","_agent/getFileContent":"agent.getFileContent","_agent/detail":"agent.detail","_agent/update":"agent.update","_agent/disconnect":"agent.disconnect","_agent/switchModel":"agent.switchModel",initialize:"initialize"},Fu=Object.fromEntries(Object.entries(Ws).map(([r,e])=>[e,r])),ka={"session.prompt":["agentId","triggerMsgId","sessionId"],"session.cancel":["agentId","triggerMsgId","sessionId"],"session.new":["agentId"],"session.load":["agentId"],"agent.create":["agentId"],"agent.health":["agentId"],"agent.listSkills":["agentId"],"agent.addSkills":["agentId"],"agent.removeSkills":["agentId"],"agent.getFileTree":["agentId"],"agent.getFileContent":["agentId"],"agent.detail":["agentId"],"agent.update":["agentId"],"agent.disconnect":["agentId"],"agent.switchModel":["agentId"],"agent.pair":[],initialize:[]},dt=class{seq=0;next(e,i){this.seq+=1;let a=Ws[e]??Aa(e),x=ka[a]??[],f=[a,String(this.seq)];if(x.length>0){let u=x.map(m=>Hs(i?.[m]??"")),g=Da(u).join(":");g&&f.push(g)}else i&&Object.values(i).some(u=>u)&&f.push(Object.values(i).filter(Boolean).map(u=>Hs(String(u))).join(":"));return f.join("_")}reset(){this.seq=0}};function Aa(r){return r.replace(/[\s/]+/g,".").replace(/_+/g,"-")}function Hs(r){return r.replace(/[:_\s]+/g,"-")}function Da(r){let e=r.length;for(;e>0&&!r[e-1];)e-=1;return r.slice(0,e)}K();var Pa=3e4;function js(r,e){if(!(typeof r!="number"||r<=0))try{process.platform==="win32"?process.kill(r,e):process.kill(-r,e)}catch{}}var He=class{constructor(e){this.opts=e;this.log=O(`downstream.${this.constructor.name}`),this.decoder=new xn({onError:i=>this.log.warn("decode line failed",{line:i.line})})}opts;child;decoder;pending=new Map;idAllocator=new dt;updateHandlers=[];agentRequestHandlers=[];exitHandlers=[];log;stopped=!1;sanitizeEnv(e){return e}async start(){if(this.child)throw new E("BRIDGE_INTERNAL","Downstream already started");let e=process.platform!=="win32",i=Ta(this.opts.command,this.opts.args,{cwd:this.opts.cwd,env:{...this.sanitizeEnv(process.env),...this.opts.env},stdio:["pipe","pipe","pipe"],detached:e});this.child=i,i.stdout?.setEncoding("utf8"),i.stdout?.on("data",a=>{for(let x of this.decoder.push(a))this.dispatch(x)}),i.stderr?.setEncoding("utf8"),i.stderr?.on("data",a=>{this.log.debug("stderr",{text:a.trimEnd()})}),i.on("exit",(a,x)=>{this.stopped=!0,this.failAllPending(new E("AGENT_PROTOCOL_ERROR",`agent exited (${a}/${x})`));for(let f of this.exitHandlers)f(a,x)}),i.on("error",a=>{this.log.error("child error",{err:String(a)}),this.failAllPending(new E("AGENT_SPAWN_FAILED",String(a),{cause:a}))}),this.log.info("downstream started",{command:this.opts.command,pid:i.pid,cwd:this.opts.cwd})}async stop(e){if(!this.child||this.stopped)return;this.stopped=!0,this.log.info("downstream stopping",{reason:e});let i=this.child,a=new Promise(f=>i.once("exit",()=>f()));js(i.pid,"SIGTERM");let x=setTimeout(()=>{i.killed||js(i.pid,"SIGKILL")},5e3);try{await a}finally{clearTimeout(x)}}pid(){return this.child?.pid}isAlive(){return!!this.child&&!this.stopped}initialize(e){return this.call("initialize",e)}sessionNew(e){return this.call("session/new",{mcpServers:[],...e})}sessionLoad(e){return this.call("session/load",{mcpServers:[],...e})}sessionPrompt(e){return this.call("session/prompt",e,0)}async sessionCancel(e){if(!this.child||this.stopped)return;let i=this.idAllocator.next("session/cancel");this.writeFrame(ft(i,"session/cancel",e))}onUpdate(e){this.updateHandlers.push(e)}onAgentRequest(e){this.agentRequestHandlers.push(e)}respondAgentRequest(e,i){if(!(!this.child||this.stopped))try{this.writeFrame(ut(e,i))}catch(a){this.log.warn("respondAgentRequest write failed",{id:e,err:String(a)})}}respondAgentRequestError(e,i){if(!(!this.child||this.stopped))try{this.writeFrame(Xe(e,i))}catch(a){this.log.warn("respondAgentRequestError write failed",{id:e,err:String(a)})}}onExit(e){this.exitHandlers.push(e)}call(e,i,a=Pa){if(!this.child||this.stopped)return Promise.reject(new E("AGENT_PROTOCOL_ERROR","downstream not started"));let x=this.idAllocator.next(e),f=ft(x,e,i),u=a>0&&Number.isFinite(a);return new Promise((g,m)=>{let _=u?setTimeout(()=>{this.pending.delete(x),m(new E("AGENT_TIMEOUT",`${e} timed out after ${a}ms`))},a):null;this.pending.set(x,{resolve:g,reject:m,timer:_,method:e});try{this.writeFrame(f)}catch(v){_&&clearTimeout(_),this.pending.delete(x),m(v)}})}writeFrame(e){if(!this.child?.stdin||this.child.stdin.destroyed)throw new E("AGENT_PROTOCOL_ERROR","downstream stdin not writable");this.child.stdin.write(Ks(e))}dispatch(e){if(on(e)){let i=e.id!==null?this.pending.get(e.id):void 0;if(!i){this.log.warn("orphan response",{id:e.id});return}this.pending.delete(e.id),i.timer&&clearTimeout(i.timer),e.error?i.reject(Us(e.error)):i.resolve(e.result);return}if(Fs(e)){if(e.method==="session/update")for(let i of this.updateHandlers)Promise.resolve(i(e.params)).catch(a=>this.log.warn("update handler failed",{err:String(a)}));else this.log.debug("unknown notification",{method:e.method});return}if(sn(e)){let i=e;this.handleAgentRequest(i).catch(a=>this.log.error("agent request handler failed",{method:i.method,err:String(a)}))}}async handleAgentRequest(e){if(this.agentRequestHandlers.length===0){this.writeFrame(Xe(e.id,{code:-32601,message:`method not handled by Bridge: ${e.method}`}));return}for(let i of this.agentRequestHandlers)try{await i(e)}catch(a){this.log.error("agentRequestHandler threw",{method:e.method,err:String(a)});try{this.writeFrame(Xe(e.id,an(a)))}catch{}}}failAllPending(e){for(let i of this.pending.values())i.timer&&clearTimeout(i.timer),i.reject(e);this.pending.clear()}};var Ia="@zed-industries/claude-code-acp@latest";function La(r){let e={};for(let[i,a]of Object.entries(r))a!==void 0&&(i.startsWith("CLAUDE")||i==="AI_AGENT"||i==="BAGGAGE"||(e[i]=a));return e}var cn=class extends He{framework="claude-code";constructor(e){let i=e.command??"npx",a=e.args??["-y",Ia],x={command:i,args:a,cwd:e.cwd,...e.env?{env:e.env}:{}};super(x)}sanitizeEnv(e){return La(e)}};var Na="@zed-industries/codex-acp@latest",fn=class extends He{framework="codex";constructor(e){let i=e.command??"npx",a=e.args??["-y",Na],x=e.extraArgs?[...a,...e.extraArgs]:a,f={command:i,args:x,cwd:e.cwd,...e.env?{env:e.env}:{}};super(f)}};import{spawn as Gs}from"node:child_process";K();var un=class extends He{framework="openclaw";registerLog;profile;agentId;sessionName;registered=!1;constructor(e){let i=e.profile??"coze",a=e.sessionName??"default",x=["--profile",i,"acp","--session",`agent:${e.agentId}:${a}`],f={command:e.command,args:x,cwd:e.cwd,...e.env?{env:e.env}:{}};super(f),this.profile=i,this.agentId=e.agentId,this.sessionName=a,this.registerLog=O("downstream.openclaw.register")}async start(){await this.registerAgent().catch(e=>{this.registerLog.warn("openclaw agents add failed (will continue to acp anyway)",{agentId:this.agentId,err:String(e)})}),await super.start()}registerAgent(){return new Promise((e,i)=>{let a=Gs(this.opts.command,["--profile",this.profile,"agents","add",this.agentId,"--workspace",this.opts.cwd,"--non-interactive"],{stdio:["ignore","pipe","pipe"],env:{...process.env,...this.opts.env}}),x="";a.stderr?.on("data",f=>{x+=f.toString("utf8")}),a.on("error",i),a.on("close",f=>{f===0?(this.registered=!0,this.registerLog.info("agent registered",{agentId:this.agentId,profile:this.profile}),e()):i(new E("AGENT_SPAWN_FAILED",`openclaw agents add ${this.agentId} exited ${f}: ${x.trim()}`))})})}async cleanup(e){this.registered&&await new Promise(i=>{let a=Gs(this.opts.command,["--profile",this.profile,"agents","delete",this.agentId,"--force"],{stdio:["ignore","pipe","pipe"],env:{...process.env,...this.opts.env}}),x="";a.stderr?.on("data",f=>{x+=f.toString("utf8")}),a.on("error",f=>{this.registerLog.warn("openclaw agents delete failed (best-effort)",{agentId:this.agentId,err:String(f)}),i()}),a.on("close",f=>{f===0?this.registerLog.info("agent unregistered",{agentId:this.agentId}):this.registerLog.warn("openclaw agents delete non-zero exit",{agentId:this.agentId,code:f,stderr:x.trim()}),this.registered=!1,i()})})}get acpSessionName(){return this.sessionName}};K();fe();var dn=class{slots=[];running=!1;closed=!1;disposed=!1;enqueue(e){return this.disposed?Promise.reject(new Error("AsyncQueue disposed")):this.closed?Promise.reject(new Error("AsyncQueue closed")):new Promise((i,a)=>{this.slots.push({task:e,resolve:i,reject:a}),this.drain()})}close(){this.closed=!0}dispose(e=new Error("AsyncQueue disposed")){for(this.disposed=!0,this.closed=!0;this.slots.length>0;)this.slots.shift()?.reject(e)}get size(){return this.slots.length}get isRunning(){return this.running}async drain(){if(!this.running){this.running=!0;try{for(;this.slots.length>0&&!this.disposed;){let e=this.slots.shift();if(!e)break;try{let i=await e.task();e.resolve(i)}catch(i){e.reject(i)}}}finally{this.running=!1}}}};var ln=class{agentId;framework;workspace;msgQueue;sessions=new Map;verifiedSessions=new Set;activeTriggers=new Map;status="starting";lastActiveAt=Date.now();_downstream;constructor(e){this.agentId=e.agentId,this.framework=e.framework,this.workspace=e.workspace,this._downstream=e.downstream,this.msgQueue=new dn}get downstream(){return this._downstream}swap(e){this._downstream=e,this.verifiedSessions.clear(),this.activeTriggers.clear()}async dispose(e){this.status="stopped",this.msgQueue.dispose(new Error(`AgentSession disposed${e?`: ${e}`:""}`)),await this._downstream.stop(e)}};var G=O("agent-manager"),Oa=(r,e,i,a,x)=>{switch(r){case"claude-code":{let f=x?Ds(x):void 0;return new cn({cwd:i,...f&&Object.keys(f).length>0?{env:f}:{}})}case"codex":{let f=x?Ts(x):[],u=x?Ps(x):void 0;return new fn({cwd:i,...f.length>0?{extraArgs:f}:{},...u&&Object.keys(u).length>0?{env:u}:{}})}case"openclaw":return new un({command:e,cwd:i,agentId:a})}},Ba=[0,5e3,5e3],Ma=2e4,Js={protocolVersion:1,clientCapabilities:{fs:{readTextFile:!0,writeTextFile:!0}}},hn=class{paths;config;registry;factory;restartDelaysMs;createTimeoutMs;healthReporter;constructor(e){this.paths=e.paths,this.config=e.config,this.registry=e.registry,this.factory=e.downstreamFactory??Oa,this.restartDelaysMs=e.restartDelaysMs??Ba,this.createTimeoutMs=e.createTimeoutMs??Ma,this.healthReporter=e.healthReporter}async createAgent(e){if(!e.agentId)throw new E("IPC_BAD_REQUEST","agentId required");if(!e.framework)throw new E("IPC_BAD_REQUEST","framework required");if($t(e._meta)==="cloud")return G.info("cloud-deployed agent, ack without local spawn",{agentId:e.agentId,framework:e.framework}),{ok:!0,agentId:e.agentId,framework:e.framework};this.registry.reviveIfDisconnected?.(e.agentId);let i=this.registry.get(e.agentId);if(i){if(i.framework!==e.framework)throw new E("AGENT_BUSY",`agent ${e.agentId} exists with different framework (${i.framework})`);if(i.status==="error")G.warn("existing agent in error state, rebuilding",{agentId:e.agentId}),await i.dispose("rebuild after error").catch(m=>G.warn("dispose stale agent failed (ignored)",{err:String(m)})),this.registry.unregister(e.agentId);else return G.info("agent already exists,return current",{agentId:e.agentId}),{ok:!0,agentId:i.agentId,workspace:i.workspace,pid:i.downstream.pid()??0,framework:i.framework}}let a=this.config.frameworksCache?.[e.framework];if(!a)throw new E("AGENT_SPAWN_FAILED",`framework ${e.framework} not detected on this machine; rerun daemon to refresh frameworks_cache`);let x=Le(e.agentId,this.paths),f=e.workspace??x.workspace,u=new AbortController,g=setTimeout(()=>u.abort(new E("AGENT_TIMEOUT",`_agent/create timed out after ${this.createTimeoutMs}ms`)),this.createTimeoutMs);try{return await this.createAgentInner(e,x,f,a,u.signal)}finally{clearTimeout(g)}}async createAgentInner(e,i,a,x,f){let u=()=>{if(f.aborted)throw f.reason instanceof Error?f.reason:new E("AGENT_TIMEOUT","_agent/create aborted")},g,m,_=!1;try{await lr(i.root,{recursive:!0}),await lr(a,{recursive:!0}),await lr(i.logs,{recursive:!0}),u(),e.framework!=="openclaw"&&await Ve(a,e.framework,e.agentId,e.cozeIdentity),u();let v=await xe(e.agentId,this.paths).catch(()=>null),y=dr({model:e.model??v?.model,modelToken:e.modelToken??v?.modelToken});if(g=this.factory(e.framework,x.path,a,e.agentId,y),await g.start(),u(),await g.initialize(Js),u(),e.framework==="openclaw"&&await Ve(a,"openclaw",e.agentId,e.cozeIdentity),m=new ln({agentId:e.agentId,framework:e.framework,workspace:a,downstream:g}),m.status="ok",v?.sessions){for(let[P,R]of Object.entries(v.sessions))m.sessions.set(P,R);Object.keys(v.sessions).length>0&&G.info("restored persisted sessions for agent",{agentId:e.agentId,count:Object.keys(v.sessions).length})}this.registry.register(m),_=!0;let C={agentId:e.agentId,framework:e.framework,workspace:a,cozeIdentity:e.cozeIdentity,createdAt:v?.createdAt??Date.now(),sessions:v?.sessions??{},model:y.model};y.modelToken&&(C.modelToken=y.modelToken),v?.skills&&(C.skills=v.skills),v?.agentName&&(C.agentName=v.agentName),v?.description&&(C.description=v.description),await he(C,this.paths);let T=g.pid()??0;return G.info("agent created",{agentId:e.agentId,framework:e.framework,pid:T}),this.installRestartHook(m),{ok:!0,agentId:e.agentId,workspace:a,pid:T,framework:e.framework}}catch(v){throw G.error("agent create failed,rolling back",{agentId:e.agentId,err:String(v)}),g?.cleanup&&await g.cleanup("rollback").catch(y=>G.warn("downstream cleanup failed (ignored)",{err:String(y)})),g&&await g.stop("rollback").catch(()=>{}),_&&m&&(await m.dispose("rollback").catch(()=>{}),this.registry.unregister(e.agentId)),await Ra(i.root,{recursive:!0,force:!0}).catch(y=>G.warn("rm agent dir failed (ignored)",{err:String(y)})),v instanceof E?v:new E("AGENT_SPAWN_FAILED",String(v),{cause:v})}}async reportHealth(e,i,a){if(!this.healthReporter){G.info("healthReporter not wired, skip _agent/health upstream",{agentId:e.agentId,status:i});return}try{await this.healthReporter({status:i,_meta:{cozeAgentId:e.agentId}}),G.info("_agent/health reported",{agentId:e.agentId,status:i,cause:a})}catch(x){G.warn("_agent/health upstream failed (ignored)",{agentId:e.agentId,status:i,err:String(x)})}}installRestartHook(e){let i=0,a=x=>{if(e.status==="stopped"||e.status==="disconnected"||e.status==="switching")return;if(i>=this.restartDelaysMs.length){G.error("agent restart exhausted",{agentId:e.agentId,attempts:i,...x}),e.status="error",this.reportHealth(e,"error",x);return}let f=this.restartDelaysMs[i]??5e3;i+=1,e.status="degraded",G.warn("agent restart scheduled",{agentId:e.agentId,attempt:i,delayMs:f,...x}),setTimeout(()=>{this.doRestart(e,i).then(u=>{u?(i=0,e.status="ok"):a(null)})},f)};e.downstream.onExit((x,f)=>a({code:x,signal:f}))}async spawnAndInitialize(e,i){let a=await xe(e.agentId,this.paths).catch(()=>null),x=a?dr(a):void 0,f=this.factory(e.framework,i,e.workspace,e.agentId,x);try{return await f.start(),await f.initialize(Js),f}catch(u){throw await f.stop("spawnAndInitialize failed").catch(()=>{}),u}}rewireSession(e,i){e.swap(i),this.registry.attachHooks?.(e),this.installRestartHook(e)}async doRestart(e,i){let a=this.config.frameworksCache?.[e.framework];if(!a)return G.error("framework cache missing during restart",{agentId:e.agentId,framework:e.framework}),e.status="error",!1;G.info("agent restart attempt",{agentId:e.agentId,attempt:i});try{let x=await this.spawnAndInitialize(e,a.path);return this.rewireSession(e,x),G.info("agent restart succeeded",{agentId:e.agentId,attempt:i}),!0}catch(x){return G.warn("agent restart attempt failed",{agentId:e.agentId,attempt:i,err:String(x)}),!1}}async executeModelSwitch(e){let i=this.registry.get(e);if(!i)throw new E("AGENT_NOT_FOUND",`agent not found: ${e}`);let a=this.config.frameworksCache?.[i.framework];if(!a)throw new E("AGENT_SPAWN_FAILED",`framework ${i.framework} not detected; cannot respawn for switchModel`);G.info("executeModelSwitch: stopping old downstream",{agentId:e,framework:i.framework}),await i.downstream.stop("switchModel").catch(u=>{G.warn("stop old downstream failed (ignored, continuing)",{agentId:e,err:String(u)})});let x;try{x=await this.spawnAndInitialize(i,a.path)}catch(u){throw new E("MODEL_SWITCH_FAILED",`failed to spawn new downstream after switchModel: ${u instanceof Error?u.message:String(u)}`,{cause:u})}this.rewireSession(i,x);let f=[...i.sessions.entries()];for(let[u,g]of f)try{await x.sessionLoad({sessionId:g,cwd:i.workspace}),i.verifiedSessions.add(g)}catch(m){throw new E("MODEL_SWITCH_FAILED",`sessionLoad failed after switchModel for cloud session ${u} (acp=${g}): ${m instanceof Error?m.message:String(m)}`,{cause:m})}f.length>0&&G.info("executeModelSwitch: session/load reloaded",{agentId:e,count:f.length}),i.status="ok",G.info("executeModelSwitch: success",{agentId:e,framework:i.framework})}};K();import{spawn as za}from"node:child_process";import{constants as Vs,access as qa}from"node:fs/promises";import{delimiter as Fa,join as Ua}from"node:path";var Ka=O("framework-detector"),Ys={"claude-code":"claude",codex:"codex",openclaw:"openclaw"},Ha=[".exe",".cmd",".bat",".ps1"],Tt=class{env;constructor(e={}){this.env={pathEnv:e.pathEnv??process.env.PATH??"",platform:e.platform??process.platform,spawn:e.spawn??za,access:e.access??qa}}async detect(e){let i=Ys[e],a=await this.which(i);if(!a)return Ka.debug("framework binary not found",{framework:e,bin:i}),null;let x=await this.probeVersion(a);return{path:a,version:x}}async detectAll(){let e=await Promise.all(Object.keys(Ys).map(async a=>[a,await this.detect(a)])),i={};for(let[a,x]of e)x&&(i[a]=x);return i}async which(e){let i=this.env.pathEnv.split(Fa).filter(Boolean),a=this.env.platform==="win32"?["",...Ha]:[""];for(let x of i)for(let f of a){let u=Ua(x,e+f);if(await this.isExecutable(u))return u}return null}async isExecutable(e){try{let i=this.env.platform==="win32"?Vs.F_OK:Vs.X_OK;return await this.env.access(e,i),!0}catch{return!1}}async probeVersion(e){return new Promise(i=>{let a="",x=!1,f,u=g=>{x||(x=!0,f&&clearTimeout(f),i(g.trim()||"unknown"))};try{let g=this.env.spawn(e,["--version"],{stdio:["ignore","pipe","pipe"]});f=setTimeout(()=>{g.kill("SIGKILL"),u("unknown")},5e3),g.stdout?.on("data",m=>{a+=m.toString("utf8")}),g.on("error",()=>u("unknown")),g.on("close",()=>{let m=ja(a).split(/\r?\n/)[0]??"";u(m)})}catch{u("unknown")}})}},Wa=new RegExp("\x1B\\[[0-9;]*[A-Za-z]","g");function ja(r){return r.replace(Wa,"")}cr();fe();function gn(r){return Wt(r??V().configFile)}function Pt(r,e){return jt(e??V().configFile,r)}Ke();K();var te=O("core"),Ga=5*6e4,Ja=3e4,pn=class{upstream;agents=new Map;disconnectedAgents=new Set;extensions;paths;upstreamIds=new dt;pendingUpstream=new Map;pendingBridge=new Map;constructor(e){this.upstream=e.upstream,this.extensions=e.extensions??{},this.paths=e.paths}registerExtension(e,i){this.extensions[e]=i}async start(){this.upstream.onFrame(e=>this.handleFrame(e)),await this.upstream.start(),te.info("Core started",{extensions:Object.keys(this.extensions)})}async stop(e){te.info("Core stopping",{reason:e}),await Promise.all([...this.agents.values()].map(i=>i.dispose(e))),this.agents.clear(),await this.upstream.stop(e)}get(e){return this.agents.get(e)}register(e){this.agents.set(e.agentId,e),this.attachDownstreamHooks(e),te.info("agent registered",{agentId:e.agentId,framework:e.framework});for(let i of this.registerHandlers)try{i(e.agentId)}catch(a){te.warn("onAgentRegister handler threw (ignored)",{agentId:e.agentId,err:String(a)})}}onAgentRegister(e){return this.registerHandlers.add(e),()=>this.registerHandlers.delete(e)}registerHandlers=new Set;unregister(e){this.agents.delete(e)}reviveIfDisconnected(e){this.disconnectedAgents.delete(e)&&te.info("agent revived from disconnect",{agentId:e})}attachDownstreamHooks(e){e.downstream.onUpdate(i=>{this.forwardUpdate(e,i)}),e.downstream.onAgentRequest(i=>{this.handleAgentRequest(e,i)}),e.downstream.onExit((i,a)=>{te.warn("agent downstream exited",{agentId:e.agentId,code:i,signal:a})})}attachHooks(e){this.attachDownstreamHooks(e)}async handleFrame(e){if(on(e)){this.handleUpstreamResponse(e);return}if(sn(e))try{if(e.method.startsWith("_agent/")){let i=this.extensions[e.method];if(!i){await this.sendError(e.id,H.METHOD_NOT_FOUND,`extension not registered: ${e.method}`);return}let a=await i(e,this);await this.upstream.send(ut(e.id,a));return}if(e.method.startsWith("session/")){let i=await this.routeSessionMethod(e);await this.upstream.send(ut(e.id,i));return}if(e.method==="initialize"){await this.upstream.send(ut(e.id,{protocolVersion:1,agentCapabilities:{loadSession:!0}}));return}await this.sendError(e.id,H.METHOD_NOT_FOUND,`method not implemented: ${e.method}`)}catch(i){te.error("handleFrame failed",{method:e.method,err:String(i)}),await this.upstream.send(Xe(e.id,an(i)))}}async routeSessionMethod(e){if(!e.params||typeof e.params!="object")throw new E("IPC_BAD_REQUEST",`${e.method} requires params`);let i=e.params,a=i._meta?.cozeAgentId;if(!a)throw new E("IPC_BAD_REQUEST",`${e.method}: missing _meta.cozeAgentId`);let x=this.agents.get(a);if(!x)throw this.disconnectedAgents.has(a)?new E("AGENT_DISCONNECTED",`agent ${a} has been disconnected; cloud must _agent/create to revive`):new E("AGENT_NOT_FOUND",`agent not found: ${a}`);if(x.status==="switching")throw new E("MODEL_SWITCHING",`agent ${a} is switching model; retry later`,{retriable:!0});let f=Date.now(),u=!1;try{let g=await x.msgQueue.enqueue(()=>this.dispatchSessionCall(x,e.method,i));return u=!0,g}finally{te.info("session call done",{agentId:x.agentId,method:e.method,durationMs:Date.now()-f,ok:u})}}async dispatchSessionCall(e,i,a){e.lastActiveAt=Date.now();let{stripped:x}=Es(a);switch(i){case"session/new":{let f=x;return await e.downstream.sessionNew({...f,cwd:f.cwd||e.workspace})}case"session/load":{let f=x,u=f.sessionId,g=e.sessions.get(u);try{let m=g??u,_=await e.downstream.sessionLoad({...f,sessionId:m,cwd:f.cwd||e.workspace});return g||e.sessions.set(u,m),_}catch(m){te.warn("session/load failed,fallback to session/new",{agentId:e.agentId,cloudId:u,err:String(m)});let _=await e.downstream.sessionNew({cwd:f.cwd||e.workspace});return e.sessions.set(u,_.sessionId),{}}}case"session/prompt":{let f=x,u=f.sessionId,g=e.sessions.get(u),m=!1;if(g&&!e.verifiedSessions.has(g))try{await e.downstream.sessionLoad({sessionId:g,cwd:e.workspace}),e.verifiedSessions.add(g),te.info("session restored via session/load",{agentId:e.agentId,cloudId:u,acpId:g})}catch(y){te.warn("session/load failed,fallback to session/new",{agentId:e.agentId,cloudId:u,acpId:g,err:String(y)}),e.sessions.delete(u),g=void 0}g||(g=(await e.downstream.sessionNew({cwd:e.workspace})).sessionId,e.sessions.set(u,g),e.verifiedSessions.add(g),m=!0);let _=a._meta?.cozeTriggerMsgId;_?e.activeTriggers.set(g,_):e.activeTriggers.delete(g);let v=await e.downstream.sessionPrompt({...f,sessionId:g});return m&&this.persistSessionMapping(e),v}case"session/cancel":{let u=x.sessionId;if(!u)throw new E("IPC_BAD_REQUEST","session/cancel: missing sessionId");let g=e.sessions.get(u);return g&&await e.downstream.sessionCancel({sessionId:g}),{ok:!0}}default:throw new E("IPC_BAD_REQUEST",`session method not supported: ${i}`)}}forwardUpdate(e,i){let a=i.sessionId,x=this.reverseSessionId(e,a);if(!x){te.debug("drop update for unknown session",{agentId:e.agentId,acpId:a});return}let f={cozeAgentId:e.agentId},u=e.activeTriggers.get(a);u&&(f.cozeTriggerMsgId=u),this.upstream.send(qs("session/update",{...i,sessionId:x,_meta:f})).catch(g=>te.warn("forward update failed",{agentId:e.agentId,err:String(g)}))}handleAgentRequest(e,i){if(i.method==="session/request_permission"){this.forwardPermissionRequest(e,i);return}te.warn("unhandled agent request,returning method_not_found",{agentId:e.agentId,method:i.method}),e.downstream.respondAgentRequestError(i.id,{code:H.METHOD_NOT_FOUND,message:`method not handled by Bridge: ${i.method}`})}forwardPermissionRequest(e,i){let a=this.upstreamIds.next("session/request_permission"),x=i.params??{},u=x.sessionId,g=u?e.activeTriggers.get(u):void 0,m={cozeAgentId:e.agentId};g&&(m.cozeTriggerMsgId=g);let _=u?this.reverseSessionId(e,u):void 0,v={...x,..._?{sessionId:_}:{},_meta:m},y=setTimeout(()=>{let C=this.pendingUpstream.get(a);C&&(this.pendingUpstream.delete(a),te.warn("upstream permission request timed out,replying cancelled to agent",{agentId:e.agentId,upstreamId:a}),e.downstream.respondAgentRequest(C.agentRequestId,{outcome:{kind:"cancelled"}}))},Ga);this.pendingUpstream.set(a,{agentRequestId:i.id,session:e,method:i.method,timer:y}),this.upstream.send(ft(a,"session/request_permission",v)).catch(C=>{let T=this.pendingUpstream.get(a);T&&(clearTimeout(T.timer),this.pendingUpstream.delete(a)),te.error("forward permission request failed",{agentId:e.agentId,err:String(C)}),e.downstream.respondAgentRequestError(i.id,{code:H.INTERNAL_ERROR,message:`upstream send failed: ${String(C)}`})})}handleUpstreamResponse(e){if(e.id===null)return;let i=this.pendingUpstream.get(e.id);if(i){this.pendingUpstream.delete(e.id),clearTimeout(i.timer),e.error?i.session.downstream.respondAgentRequestError(i.agentRequestId,e.error):i.session.downstream.respondAgentRequest(i.agentRequestId,e.result);return}let a=this.pendingBridge.get(e.id);if(a){this.pendingBridge.delete(e.id),clearTimeout(a.timer),e.error?a.reject(new rn(e.error)):a.resolve(e.result);return}te.debug("orphan upstream response (no pending)",{id:e.id})}sendRequest(e,i,a=Ja){let x=this.upstreamIds.next(e);return new Promise((f,u)=>{let g=setTimeout(()=>{this.pendingBridge.delete(x),u(new E("AGENT_TIMEOUT",`${e} timed out after ${a}ms`))},a);this.pendingBridge.set(x,{method:e,resolve:f,reject:u,timer:g}),this.upstream.send(ft(x,e,i)).catch(m=>{let _=this.pendingBridge.get(x);_&&(clearTimeout(_.timer),this.pendingBridge.delete(x)),u(m)})})}async persistSessionMapping(e){if(this.paths)try{await ur(e.agentId,e.sessions,this.paths)}catch(i){te.warn("persist session mapping failed",{agentId:e.agentId,err:String(i)})}}reverseSessionId(e,i){for(let[a,x]of e.sessions.entries())if(x===i)return a}sendError(e,i,a){return this.upstream.send(Xe(e,{code:i,message:a}))}};K();fe();import{randomBytes as Va}from"node:crypto";import{chmod as Ya,mkdir as Xa,writeFile as Xs}from"node:fs/promises";import{createServer as Za}from"node:http";import{dirname as $a}from"node:path";var Qa=1e6,hr=O("ipc"),mn=class{server=null;port=0;token="";routes;paths;constructor(e){this.routes=new Map(e.routes.map(i=>[`${i.method} ${i.path}`,i])),this.paths=e.paths??V()}async start(){this.token=Va(32).toString("hex");let e=Za((a,x)=>{this.dispatch(a,x)});this.server=e,await new Promise((a,x)=>{e.once("error",x),e.listen(0,"127.0.0.1",()=>a())});let i=e.address();if(!i||typeof i!="object")throw new Error("failed to obtain IPC port");return this.port=i.port,await this.persistAuthFiles(),hr.info("IPC listening",{port:this.port}),{port:this.port,token:this.token}}async stop(){let e=this.server;e&&(await new Promise((i,a)=>{e.close(x=>x?a(x):i())}),this.server=null)}async persistAuthFiles(){await Xa($a(this.paths.portFile),{recursive:!0}),await Xs(this.paths.portFile,String(this.port),"utf8"),await Xs(this.paths.tokenFile,this.token,"utf8");try{await Ya(this.paths.tokenFile,384)}catch(e){hr.warn("chmod token file failed (non-POSIX?)",{err:String(e)})}}async dispatch(e,i){if(e.headers.authorization!==`Bearer ${this.token}`){It(i,401,{error:"unauthorized"});return}let x=`${e.method} ${(e.url??"").split("?")[0]}`,f=this.routes.get(x);if(!f){It(i,404,{error:"not found"});return}let u=null;if(e.method==="POST")try{u=await ex(e)}catch(g){It(i,400,{error:"invalid json",detail:String(g)});return}try{let g=await f.handler(u,e);It(i,200,g??{ok:!0})}catch(g){hr.error("IPC handler failed",{key:x,err:String(g)}),It(i,500,{error:g instanceof Error?g.message:String(g)})}}};function It(r,e,i){r.statusCode=e,r.setHeader("content-type","application/json"),r.end(JSON.stringify(i))}async function ex(r){let e=[],i=0;for await(let x of r){let f=x;if(i+=f.length,i>Qa)throw new Error("body too large");e.push(f)}let a=Buffer.concat(e).toString("utf8");return a?JSON.parse(a):null}var So=Ie(ai(),1);var Oc=Ie(no(),1),Bc=Ie(Nn(),1),Mc=Ie(gt(),1),zc=Ie(Ar(),1),qc=Ie(Pr(),1),Fc=Ie(Br(),1),uo=Ie(Mn(),1),Uc=Ie(fo(),1);var lo=uo.default;K();var qn="1008033",ho="1289";var go="pbbp2",po="https://www.coze.cn",mo="/api/coze_claw/resource/get_frontier_key",Kc="https://www.coze.cn",Hc="wss://frontier.coze.cn";function _o(r){return r??process.env.COZE_BRIDGE_HANDSHAKE_URL??Kc}function wo(r){return r??process.env.COZE_BRIDGE_FRONTIER_URL??Hc}function Fn(r){let e={},i=r?.ttEnv??process.env.COZE_BRIDGE_TT_ENV,a=r?.usePpe??process.env.COZE_BRIDGE_USE_PPE;return i&&(e["x-tt-env"]=i),a&&(e["x-use-ppe"]=a),e}var ie=O("upstream.frontier"),vo="application/json",bo="none",Un=class{constructor(e){this.opts=e}opts;fws=null;handler=null;connectHandler=null;opened=!1;openCount=0;async start(){if(this.fws){ie.warn("start called on already-started FrontierUpstream; noop");return}let e={Authorization:`Bearer ${this.opts.privatecode}`,Origin:po,...Fn(this.opts.ppeOverride)};class i extends lo{constructor(g){super(g,go,{headers:e})}send(g,...m){if(Ss("debug"))try{let _;typeof g=="string"?_=Buffer.from(g,"utf8"):g instanceof Buffer?_=g:g instanceof ArrayBuffer?_=new Uint8Array(g):ArrayBuffer.isView(g)?_=new Uint8Array(g.buffer,g.byteOffset,g.byteLength):_=new Uint8Array(0);let v=Buffer.from(_.slice(0,128)).toString("hex");ie.debug("WS raw frame out",{bytes:_.byteLength,headHex:v})}catch(_){ie.warn("WS raw frame dump failed",{err:String(_)})}super.send(g,...m)}}let a=wo(this.opts.urlOverride),x={url:a,ws:i,fpID:ho,aID:qn,accessKey:this.opts.handshake.accessKey,deviceID:this.opts.handshake.deviceId,payloadType:{type:vo,force:!0},payloadEncoding:{encoding:bo,force:!0},enableTransformTextPayload:!0,enableQoS:!1,enableAutoAck:!1,automaticOpen:!1,debug:this.opts.debug??!1},f=new So.FWS(x);f.onopen=()=>{this.opened=!0,this.openCount+=1;let u=this.openCount===1;ie.info("frontier opened",{url:a,remoteDeviceId:this.opts.handshake.deviceId,initial:u,openCount:this.openCount}),this.connectHandler&&Promise.resolve(this.connectHandler({initial:u})).catch(g=>ie.warn("onConnect handler threw (ignored)",{err:String(g)}))},f.onclose=u=>{this.opened=!1,ie.info("frontier closed",{code:u.code,reason:u.reason,willReconnect:u.willReconnect})},f.onerror=u=>{ie.warn("frontier error",{code:u.code,msg:u.message})},f.onmessage=u=>this.handleMessage(u),this.fws=f,await f.connect()}async stop(e){let i=this.fws;if(i){this.fws=null,this.opened=!1;try{i.close(1e3,e??"bridge shutdown")}catch(a){ie.warn("frontier close threw (ignored)",{err:String(a)})}}}async send(e){let i=this.fws;if(!i)throw new E("UPSTREAM_DISCONNECTED","frontier upstream not started");let a=JSON.stringify(e),x=e;ie.info("frontier frame out",{method:x.method,jsonrpcId:x.id,size:a.length});try{await i.send(a,{service:33555712,method:1,payloadType:vo,payloadEncoding:bo})}catch(f){throw new E("UPSTREAM_DISCONNECTED",`frontier send failed: ${String(f)}`,{cause:f})}}onFrame(e){this.handler=e}onConnect(e){this.connectHandler=e}isConnected(){return this.opened&&this.fws?.readyState===1}handleMessage(e){let i=e.message?.service;if(i!==33555712){ie.debug("drop non-adapter frontier frame",{service:i});return}let a=Gc(e);if(!a){ie.debug("frontier message without text payload, drop",{payloadType:e.message?.payloadType});return}if(!this.handler){ie.debug("frame received but no onFrame handler",{size:a.length});return}let x;try{x=JSON.parse(a)}catch(f){ie.warn("frontier message JSON parse failed",{err:String(f),head:a.slice(0,80)});return}ie.info("frontier frame in",{logid:jc(e.message?.LogID),logidNew:e.message?.LogIDNew,msgId:e.message?.msgID,jsonrpcId:x.id}),Promise.resolve(this.handler(x)).catch(f=>ie.warn("frontier frame handler threw",{err:String(f)}))}};function jc(r){return r?r.high===0?String(r.low>>>0):`${r.high.toString(16)}${(r.low>>>0).toString(16).padStart(8,"0")}`:""}function Gc(r){let e=r.message;if(e?.textPayload)return e.textPayload;let i=e?.payload;if(!i)return null;try{return Buffer.from(i).toString("utf8")}catch{return null}}K();function Eo(r){return r?r.startsWith("boe_")?{ttEnv:r}:{ttEnv:r,usePpe:"1"}:{}}var Co=O("handshake");async function ko(r){let e=_o(r.endpoint),i=r.timeoutMs??1e4,a=`${Jc(e)}${mo}?aid=${encodeURIComponent(qn)}`,x={Authorization:`Bearer ${r.privatecode}`,Accept:"application/json",...Fn(r.ppeOverride)},f=new AbortController,u=setTimeout(()=>f.abort(),i);Co.info("frontier key handshake",{base:e});try{let g=await fetch(a,{method:"GET",headers:x,signal:f.signal}),m=g.headers.get("x-tt-logid")??"",_=g.headers.get("x-tt-trace-id")??"";if(!g.ok){let T=await g.text().catch(()=>"");throw new E("UPSTREAM_HANDSHAKE_FAILED",`handshake HTTP ${g.status} logid=${m}: ${T.slice(0,200)}`)}let v=await g.json();if(v.code!==void 0&&v.code!==0)throw new E("UPSTREAM_HANDSHAKE_FAILED",`handshake code=${v.code} msg=${v.msg??"-"} logid=${m}`);let y=v.data?.access_key,C=v.data?.device_id;if(!y||!C)throw new E("UPSTREAM_HANDSHAKE_FAILED",`handshake response missing access_key/device_id logid=${m}: ${JSON.stringify(v)}`);return Co.info("handshake ok",{remoteDeviceId:C,logid:m,traceId:_}),{accessKey:y,deviceId:C}}catch(g){throw g instanceof E?g:g.name==="AbortError"?new E("UPSTREAM_HANDSHAKE_FAILED",`handshake timeout (${i}ms)`):new E("UPSTREAM_HANDSHAKE_FAILED",String(g),{cause:g})}finally{clearTimeout(u)}}function Jc(r){return r.endsWith("/")?r.slice(0,-1):r}K();var zr=O("upstream.switchable"),Kn=class{inner;handler=null;connectHandler=null;constructor(e){this.inner=e}async swap(e,i){if(this.inner===e)return;zr.info("swap upstream",{reason:i});let a=this.inner;this.inner=e,this.handler&&e.onFrame(this.handler),this.connectHandler&&e.onConnect&&e.onConnect(this.connectHandler);try{await e.start()}catch(x){throw zr.error("swap target start failed, reverting",{err:String(x)}),this.inner=a,x}await a.stop(i??"swapped").catch(x=>zr.warn("previous upstream stop threw (ignored)",{err:String(x)}))}current(){return this.inner}start(){return this.inner.start()}stop(e){return this.inner.stop(e)}send(e){return this.inner.send(e)}onFrame(e){this.handler=e,this.inner.onFrame(e)}onConnect(e){this.connectHandler=e,this.inner.onConnect?.(e)}isConnected(){return this.inner.isConnected()}};K();var qr=O("upstream"),Ft=class{handler=null;async start(){qr.info("NoopUpstream started (M1 skeleton; real Frontier wired in M4)")}async stop(e){qr.info("NoopUpstream stopped",{reason:e})}async send(e){qr.debug("NoopUpstream.send (dropped)",{method:"method"in e?e.method:void 0})}onFrame(e){this.handler=e}isConnected(){return!1}async injectFrame(e){this.handler&&await this.handler(e)}};K();fe();K();fe();import{readFileSync as Vc,unlinkSync as Yc}from"node:fs";import{mkdir as Xc,readFile as Ao,unlink as Do,writeFile as Zc}from"node:fs/promises";import{dirname as $c}from"node:path";var Qc=O("single-instance"),Hn=class{pidFile;acquired=!1;constructor(e={}){this.pidFile=e.pidFile??V().pidFile,e.processTitle&&(process.title=e.processTitle)}async acquire(){let e=await this.readExistingPid();return e!==null&&this.isAlive(e)?{kind:"already-running",pid:e}:(e!==null&&(Qc.warn("removing stale pid file",{stalePid:e}),await Do(this.pidFile).catch(()=>{})),await Xc($c(this.pidFile),{recursive:!0}),await Zc(this.pidFile,String(process.pid),"utf8"),this.acquired=!0,this.installCleanupHooks(),{kind:"acquired"})}async release(){if(this.acquired){try{(await Ao(this.pidFile,"utf8")).trim()===String(process.pid)&&await Do(this.pidFile)}catch{}this.acquired=!1}}async readExistingPid(){try{let e=await Ao(this.pidFile,"utf8"),i=Number.parseInt(e.trim(),10);return Number.isFinite(i)&&i>0?i:null}catch(e){if(e.code==="ENOENT")return null;throw e}}isAlive(e){try{return process.kill(e,0),!0}catch(i){return i.code==="EPERM"}}installCleanupHooks(){process.once("exit",()=>{if(this.acquired)try{Vc(this.pidFile,"utf8").trim()===String(process.pid)&&Yc(this.pidFile)}catch{}})}};var q=O("daemon"),ef="coze-bridge-daemon";async function Io(){let r=new Hn({processTitle:ef}),e=await r.acquire();if(e.kind==="already-running")throw new Error(`coze-bridge daemon already running (pid=${e.pid})`);let i=await gn(),a=i??{};fr({pid:process.pid}),q.info(i?"loaded bridge config":"initialized bridge config");try{let I=new Tt;a.frameworksCache=await I.detectAll(),q.info("refreshed frameworks_cache",{detected:Object.keys(a.frameworksCache)})}catch(I){q.warn("framework detection failed",{err:String(I)})}await Pt(a);let x=new Kn(new Ft),f=V(),u=new pn({upstream:x,paths:f});await nf(f,u);let g=new hn({paths:f,config:a,registry:u,healthReporter:async I=>{await u.sendRequest("_agent/health",I)}}),m,_,v=null,y=null;u.registerExtension("_agent/create",async I=>g.createAgent(I.params)),u.registerExtension("_agent/health",async()=>({ok:!0}));let C=new tn({agents:u.agents,disposeAndMarkDisconnected:async(I,F)=>{let Y=u.agents.get(I);Y&&(await Y.dispose(`disconnect: ${F}`).catch(De=>q.warn("dispose during disconnect failed (ignored)",{agentId:I,err:String(De)})),Y.status="disconnected",u.unregister(I)),u.disconnectedAgents.add(I)},executeModelSwitch:I=>g.executeModelSwitch(I)});u.registerExtension("_agent/listSkills",I=>C.listSkills(I.params)),u.registerExtension("_agent/addSkills",I=>C.addSkills(I.params)),u.registerExtension("_agent/removeSkills",I=>C.removeSkills(I.params)),u.registerExtension("_agent/getFileTree",I=>C.getFileTree(I.params)),u.registerExtension("_agent/getFileContent",I=>C.getFileContent(I.params)),u.registerExtension("_agent/update",I=>C.updateAgent(I.params)),u.registerExtension("_agent/disconnect",I=>C.disconnectAgent(I.params)),u.registerExtension("_agent/switchModel",I=>C.switchModel(I.params));let T=new Zt({paths:f,handlers:C,sendDetail:I=>u.sendRequest("_agent/detail",I)});x.onConnect(({initial:I})=>{q.info("frontier upstream connected, triggering detail sync",{initial:I}),T.syncAll(I?"initial-connect":"reconnect").catch(F=>q.warn("detail sync top-level error (ignored)",{err:String(F)}))});let P=new mn({paths:f,routes:[{method:"GET",path:"/status",handler:async()=>({running:!0,pid:process.pid,agents:[...u.agents.keys()],deviceId:v??"",frameworksCache:a.frameworksCache??{}})},{method:"POST",path:"/pair",handler:async I=>{let F=I,Y=F?.privatecode,De=F?.pairing_code;if(!Y||!De)throw new E("IPC_BAD_REQUEST","/pair requires privatecode + pairing_code");let ze=Eo(F.env),ye=F.handshake_url,ve=F.frontier_url,me=tf(F.env,ye,ve),rt=!!m&&m!==Y,Ut=_!==void 0&&_!==me,Kt=rt||Ut;if(Kt){q.warn("pair config switched, resetting agents",{pcChanged:rt,envChanged:Ut,previousPc:m?To(m):"",nextPc:To(Y),previousEnvKey:_??"",nextEnvKey:me});for(let X of[...u.agents.values()])await X.dispose("pair config switch").catch(()=>{}),u.agents.delete(X.agentId);await x.swap(new Ft,"pair switch").catch(()=>{})}let be=await ko({privatecode:Y,...ye?{endpoint:ye}:{},ppeOverride:ze});v=be.deviceId,fr({deviceId:v,pid:process.pid});let Te=new Un({handshake:be,privatecode:Y,...ve?{urlOverride:ve}:{},ppeOverride:ze});await x.swap(Te,"pair"),m=Y,_=me;let Zn=Object.keys(a.frameworksCache??{});try{let X=await u.sendRequest("_agent/pair",{pairCode:De,patToken:Y,frameworks:Zn,_meta:{cozeDeviceId:v}});q.info("_agent/pair ok",{pairResult:X}),y||(y=new nn({core:u,getDeviceId:()=>v??""})),y.start(),Kt&&Po(f,g).catch(W=>q.warn("post-pair-switch auto-revive error (ignored)",{err:String(W)}));let st;return F.agent_id&&(st=await rf(F.agent_id,f,g,W=>u.sendRequest("_agent/detail",W)).catch(W=>(q.error("--agent-id ensureAgent failed",{agentId:F.agent_id,err:String(W)}),{ok:!1,agentId:F.agent_id??"",note:String(W)}))),{ok:!0,note:"paired with cloud",...st?{agent:st}:{}}}catch(X){return q.error("_agent/pair failed",{err:String(X)}),{ok:!1,note:`pair failed: ${String(X)}`}}}},{method:"POST",path:"/_agent/create",handler:async I=>{let F=I;return{ok:!0,result:await g.createAgent(F)}}},{method:"POST",path:"/refresh",handler:async()=>{q.info("IPC /refresh: re-detecting frameworks");let I=new Tt;return a.frameworksCache=await I.detectAll(),await Pt(a),{ok:!0,frameworks:a.frameworksCache}}},{method:"POST",path:"/shutdown",handler:async()=>(q.info("IPC /shutdown received"),setImmediate(()=>{ce.shutdown("ipc /shutdown")}),{ok:!0})}]}),{port:R,token:J}=await P.start();await u.start(),Po(f,g).catch(I=>q.warn("auto-revive top-level error (ignored)",{err:String(I)}));let oe=null,ce={port:R,token:J,core:u,ipc:P,shutdown(I){return oe||(q.info("daemon shutdown",{reason:I}),oe=(async()=>{y?.stop(),await u.stop(I),await P.stop(),await r.release()})(),oe)}};for(let I of["SIGTERM","SIGINT"])process.on(I,()=>{ce.shutdown(I).then(()=>process.exit(0))});return q.info("daemon ready",{port:R,pid:process.pid,nodeVersion:process.version,platform:process.platform,frameworks:Object.keys(a.frameworksCache??{}),libVersion:a.libVersion??"dev"}),ce}function To(r){return r.length<=8?"***":`${r.slice(0,4)}***${r.slice(-4)}`}function tf(r,e,i){return`${r??""}|${e??""}|${i??""}`}async function nf(r,e){let{readdir:i}=await import("node:fs/promises"),a;try{a=await i(r.agentsRoot)}catch{return}let{loadAgentConfig:x,enforceAgentConfigMode:f}=await Promise.resolve().then(()=>(Ke(),Xt));for(let u of a){await f(u,r).catch(g=>q.warn("enforceAgentConfigMode failed (ignored)",{agentId:u,err:String(g)}));try{let g=await x(u,r);g?.disconnectedAt&&(e.disconnectedAgents.add(u),q.info("agent marked disconnected on startup",{agentId:u,disconnectedAt:g.disconnectedAt,reason:g.disconnectReason??""}))}catch(g){q.warn("failed to load agent config on startup, skipping",{agentId:u,err:String(g)})}}}async function rf(r,e,i,a){let{loadAgentConfig:x}=await Promise.resolve().then(()=>(Ke(),Xt)),f=await x(r,e);if(f){q.info("--agent-id: local config found, reconnecting",{agentId:r,framework:f.framework,hadDisconnect:!!f.disconnectedAt});let m={agentId:f.agentId,framework:f.framework,...f.cozeIdentity?{cozeIdentity:f.cozeIdentity}:{},...f.model?{model:f.model}:{},...f.modelToken?{modelToken:f.modelToken}:{}};return await i.createAgent(m),{ok:!0,agentId:r,note:f.disconnectedAt?"revived from local config":"connected from local config"}}q.info("--agent-id: local config missing, pulling _agent/detail from cloud",{agentId:r});let u=await a({_meta:{cozeAgentId:r}});if(!u.framework)throw new E("AGENT_NOT_FOUND",`agent ${r} \u4E0D\u5728\u672C\u5730; \u4E91\u7AEF _agent/detail \u54CD\u5E94\u7F3A framework \u5B57\u6BB5 (D36 \u534F\u8BAE\u6269\u5C55\u672A\u751F\u6548), \u65E0\u6CD5\u5728\u672C\u673A\u65B0\u5EFA`);let g={agentId:u.agentId,framework:u.framework,...u.cozeIdentity?{cozeIdentity:u.cozeIdentity}:{},...u.model?{model:u.model}:{},...u.modelToken?{modelToken:u.modelToken}:{},...u.deployType?{_meta:{cozeDeployType:u.deployType}}:{}};return await i.createAgent(g),{ok:!0,agentId:r,note:u.deployType==="cloud"?"cloud agent acknowledged":"created from cloud detail"}}async function Po(r,e){let{readdir:i}=await import("node:fs/promises"),a;try{a=await i(r.agentsRoot)}catch{return{revived:0,skipped:0,total:0}}if(a.length===0)return{revived:0,skipped:0,total:0};let{loadAgentConfig:x}=await Promise.resolve().then(()=>(Ke(),Xt));q.info("auto-revive: scanning local agents on startup",{count:a.length});let f=0,u=0;for(let g of a){let m;try{m=await x(g,r)}catch(_){q.warn("auto-revive: load config failed (skipping)",{agentId:g,err:String(_)}),u+=1;continue}if(!m){u+=1;continue}if(m.disconnectedAt){q.info("auto-revive: skip disconnected agent",{agentId:g,disconnectedAt:m.disconnectedAt}),u+=1;continue}try{q.info("auto-revive: spawning",{agentId:g,framework:m.framework}),await e.createAgent({agentId:m.agentId,framework:m.framework,...m.cozeIdentity?{cozeIdentity:m.cozeIdentity}:{},...m.model?{model:m.model}:{},...m.modelToken?{modelToken:m.modelToken}:{}}),f+=1}catch(_){q.warn("auto-revive: createAgent failed (skipping)",{agentId:g,framework:m.framework,err:String(_)}),u+=1}}return q.info("auto-revive: done",{revived:f,skipped:u,total:a.length}),{revived:f,skipped:u,total:a.length}}Ur();fe();import{readFile as No}from"node:fs/promises";var Ge=class{paths;constructor(e){this.paths=e??V()}async probe(e=1e3){let i=await this.readAuth();if(!i)return{kind:"not-running"};try{let a=await this.fetch(i,{method:"GET",path:"/status",timeoutMs:e});return a.status===200?{kind:"connected",...i}:{kind:"stale",reason:`unexpected status ${a.status}`}}catch(a){return{kind:"stale",reason:lf(a)}}}async request(e){let i=await this.readAuth();if(!i)throw new Error("coze-bridge daemon not running (no port/token files)");return this.fetch(i,e)}async readAuth(){try{let[e,i]=await Promise.all([No(this.paths.portFile,"utf8"),No(this.paths.tokenFile,"utf8")]),a=Number.parseInt(e.trim(),10),x=i.trim();return!Number.isFinite(a)||a<=0||!x?null:{port:a,token:x}}catch(e){if(e.code==="ENOENT")return null;throw e}}async fetch(e,i){let a=i.body!==void 0,x={Authorization:`Bearer ${e.token}`};a&&(x["content-type"]="application/json");let f=new AbortController,u=setTimeout(()=>f.abort(),i.timeoutMs??5e3);try{let g=await fetch(`http://127.0.0.1:${e.port}${i.path}`,{method:i.method,headers:x,body:a?JSON.stringify(i.body):void 0,signal:f.signal}),m=await g.text();return{status:g.status,body:df(m)}}finally{clearTimeout(u)}}};function df(r){if(!r)return null;try{return JSON.parse(r)}catch{return r}}function lf(r){return r instanceof Error?r.message:String(r)}K();fe();import{copyFile as Ro,mkdir as hf,readFile as Kr,writeFile as gf}from"node:fs/promises";import{dirname as pf,resolve as Hr,sep as Wn}from"node:path";import{fileURLToPath as mf}from"node:url";K();fe();var Oo=O("dist-install");function _f(r){let e=mf(r),i=pf(e),a=`${Wn}src${Wn}`;if(i.includes(a)||i.endsWith(`${Wn}src${Wn}cli`))return null;let x=Hr(i,"index.js"),f=Hr(i,"..","package.json");return{dist:x,pkgJson:f}}async function Bo(r={}){let e=r.paths??V(),i=_f(import.meta.url),a=r.sourceDist??i?.dist,x=r.sourcePackageJson??i?.pkgJson;if(!a||!x)return{kind:"dev-mode-skip",reason:"running from src/(tsx loader);no dist/ to install"};let f;try{f=JSON.parse(await Kr(x,"utf8")).version??"unknown"}catch(y){return Oo.warn("cannot read source package.json,skip dist install",{err:String(y)}),{kind:"dev-mode-skip",reason:`package.json read failed: ${String(y)}`}}let u=await gn(e.configFile)??{},g=u.libVersion;if(g===f)try{return await Kr(e.libEntry),{kind:"already-current",libVersion:f}}catch{}await hf(e.libDir,{recursive:!0}),await Ro(a,e.libEntry),await Ro(`${a}.map`,`${e.libEntry}.map`).catch(()=>{});let m=Hr(e.libDir,"package.json"),_=`${JSON.stringify({type:"module"},null,2)}
|
|
91
|
-
`;return await Kr(m,"utf8").catch(()=>null)!==_&&await gf(m,_),u.libVersion=f,await Pt(u,e.configFile),Oo.info("dist installed",{libEntry:e.libEntry,fromVersion:g,toVersion:f}),g?{kind:"version-changed",fromVersion:g,toVersion:f,libEntry:e.libEntry}:{kind:"first-install",libVersion:f,libEntry:e.libEntry}}var Mf=O("cli");function vt(r,e){let i=[],a;for(let x=0;x<r.length;x++){let f=r[x];if(f===e){a=r[x+1],x+=1;continue}if(f.startsWith(`${e}=`)){a=f.slice(e.length+1);continue}i.push(f)}return{value:a,rest:i}}function zf(r){let e=r.slice(2);if(e.includes("--daemon"))return{mode:"daemon"};if(e.includes("--status"))return{mode:"status"};if(e.includes("--stop"))return{mode:"stop"};if(e.includes("--refresh"))return{mode:"refresh"};if(e.includes("--uninstall"))return{mode:"uninstall"};if(e.includes("--install-service"))return{mode:"install-service"};if(e.includes("--help")||e.includes("-h")||e.length===0)return{mode:"help"};let i=e,{value:a,rest:x}=vt(i,"--pat-token");i=x;let{value:f,rest:u}=vt(i,"--pair-code");i=u;let{value:g,rest:m}=vt(i,"--env");i=m;let{value:_,rest:v}=vt(i,"--handshake-url");i=v;let{value:y,rest:C}=vt(i,"--frontier-url");i=C;let{value:T}=vt(i,"--agent-id");if(!a||!f)return{mode:"help"};let P={mode:"pair",privatecode:a,pairingCode:f};return g&&(P.env=g),_&&(P.handshakeUrl=_),y&&(P.frontierUrl=y),T&&(P.agentId=T),P}var qf=`
|
|
88
|
+
${x}`}var be=B("agent-detail-sync"),Jt=class{constructor(e){this.opts=e}opts;async syncAll(e){let o=this.opts.paths.agentsRoot,a;try{a=await aa(o)}catch(x){be.info("agents dir not found, skip detail sync",{root:o,err:String(x)});return}be.info("starting detail sync",{reason:e,count:a.length});for(let x of a)try{await this.syncOne(x)}catch(f){be.warn("detail sync failed for agent, skipping",{agentId:x,err:String(f)})}be.info("detail sync done",{reason:e})}async syncOne(e){let o=await xe(e,this.opts.paths);if(!o){be.info("detail sync: agent config missing, skip",{agentId:e});return}let a;try{a=await this.opts.sendDetail({_meta:{cozeAgentId:e}})}catch(d){be.warn("detail RPC failed, using local data",{agentId:e,err:String(d)});return}if(a.agentId&&a.agentId!==e){be.warn("detail response agentId mismatch, ignoring",{agentId:e,responseAgentId:a.agentId});return}let x=!1,f=!1;if(a.agentName&&a.agentName!==o.agentName&&(o.agentName=a.agentName,x=!0),a.description!==void 0&&a.description!==o.description&&(o.description=a.description,x=!0),a.cozeIdentity&&a.cozeIdentity!==o.cozeIdentity&&(o.cozeIdentity=a.cozeIdentity,x=!0,f=!0),a.deployType&&be.info("detail.deployType",{agentId:e,deployType:a.deployType}),!x){be.debug("detail sync: no diff",{agentId:e});return}await he(o,this.opts.paths),be.info("detail sync: config updated",{agentId:e,identityChanged:f,agentName:o.agentName}),f&&(await it(o.workspace,o.framework,e,o.cozeIdentity),await this.opts.handlers.reloadAgentSessionsPublic(e,"detail-sync"))}};qe();import{spawn as Rs}from"node:child_process";import{lstat as xr,mkdir as xa,readFile as Bs,readdir as ca,rm as fa,stat as ua,writeFile as da}from"node:fs/promises";import{join as Te,normalize as la,relative as Os,resolve as ha,sep as Ms}from"node:path";function bt(r){return r?.cozeDeployType==="cloud"?"cloud":"local"}function Cs(r){let{_meta:e,...o}=r;return{stripped:o,meta:e}}function ot(r){if(!r?.cozeAgentId)throw new Error("missing _meta.cozeAgentId");return r.cozeAgentId}var C=class extends Error{code;retriable;cause;constructor(e,o,a){super(o),this.name="BridgeError",this.code=e,this.retriable=a?.retriable??!1,a?.cause!==void 0&&(this.cause=a.cause)}};K();se();function Je(r,e){if(bt(r)!=="cloud")throw new C("OPERATION_NOT_ALLOWED_FOR_LOCAL",`${e} is not allowed for local agent`)}var As="https://llm-gateway.coze.cn",at="auto";function ks(r){return{model:r.model??at,...r.modelToken?{modelToken:r.modelToken}:{}}}function Ds(r){return!r||r===at}function Ps(r){let e={};return r.modelToken&&(e.ANTHROPIC_BASE_URL=As,e.ANTHROPIC_AUTH_TOKEN=r.modelToken),Ds(r.model)||(e.ANTHROPIC_MODEL=r.model),e}function Ls(r){let e=[];return Ds(r.model)||e.push("-c",`model="${r.model}"`),r.modelToken&&(e.push("-c",'model_provider="openai"'),e.push("-c",`model_provider_overrides.openai.base_url="${As}/v1"`)),e}function Ts(r){return r.modelToken?{OPENAI_API_KEY:r.modelToken}:{}}var ce=B("agent-handlers"),Is=5*1024*1024,ga=1,pa=6,ma=new Set(["node_modules",".git",".coze","dist","build",".next"]),Vt=class{constructor(e){this.opts=e}opts;async listSkills(e){Je(e._meta,"_agent/listSkills");let o=ot(e._meta),a=await this.loadAgentCfg(o),x=a?.workspace??Le(o).workspace,f=a?.skills??[],d=[];for(let h of f){let _=Te(x,h.relPath,"SKILL.md");await ua(_).then(b=>b.isFile()).catch(()=>!1)&&d.push({skillId:h.skillId,skillName:h.skillName,downloadUrl:h.downloadUrl??"",...h.description?{description:h.description}:{},...h.version?{version:h.version}:{}})}return{skills:d}}async addSkills(e){Je(e._meta,"_agent/addSkills");let o=ot(e._meta),a=await this.requireAgentCfg(o),x=e.skills??[],f=[...a.skills??[]],d=new Map(f.map((_,v)=>[_.skillId,v])),h=[];for(let _ of x){if(!_.skillName)throw new C("IPC_BAD_REQUEST","skill missing skillName");let v=_a(_.skillName),b=wa(a.framework),y=Te(b,v),A=Te(a.workspace,y);await xa(A,{recursive:!0});let L=await va(_.downloadUrl);Sa(L)?await Ea(L,A):await da(Te(A,"SKILL.md"),L.toString("utf8"),"utf8");let T={skillId:_.skillId,skillName:_.skillName,relPath:y,installedAt:Date.now(),..._.description?{description:_.description}:{},..._.version?{version:_.version}:{},..._.downloadUrl?{downloadUrl:_.downloadUrl}:{}},R=d.get(_.skillId);R!==void 0?f[R]=T:(d.set(_.skillId,f.length),f.push(T)),h.push(_),ce.info("skill installed",{agentId:o,skillId:_.skillId,skillName:_.skillName,relPath:y})}return await jt(o,f),await this.reloadAgentSessions(o,"skills-added"),{installedSkills:h}}async removeSkills(e){Je(e._meta,"_agent/removeSkills");let o=ot(e._meta),a=await this.requireAgentCfg(o),x=new Set(e.skillIds??[]),f=a.skills??[],d=[];for(let h of f){if(!x.has(h.skillId)){d.push(h);continue}let _=Te(a.workspace,h.relPath);await fa(_,{recursive:!0,force:!0}),ce.info("skill removed",{agentId:o,skillId:h.skillId,relPath:h.relPath})}return await jt(o,d),await this.reloadAgentSessions(o,"skills-removed"),{ok:!0}}reloadAgentSessionsPublic(e,o){return this.reloadAgentSessions(e,o)}async reloadAgentSessions(e,o){let a=this.opts.agents.get(e);if(a&&a.framework!=="codex"){for(let[x,f]of a.sessions)if(!(!f.downstream||!f.acpSessionId)){f.loadingSession=!0;try{await f.downstream.sessionLoad({sessionId:f.acpSessionId,cwd:a.workspace}),ce.info("session reloaded",{reason:o,agentId:e,framework:a.framework,cloudId:x,acpId:f.acpSessionId})}catch(d){ce.warn("session reload failed",{reason:o,agentId:e,framework:a.framework,cloudId:x,acpId:f.acpSessionId,err:String(d)})}finally{f.loadingSession=!1}}}}async updateAgent(e){if(!e.cozeIdentity?.trim())return ce.info("_agent/update: empty cozeIdentity, noop",{agentId:e.agentId}),{ok:!0};let o=e.agentId,a=await xe(o);if(!a)throw new C("AGENT_NOT_FOUND",`agent not found: ${o}`);return a.cozeIdentity===e.cozeIdentity?(ce.info("_agent/update: cozeIdentity unchanged, noop",{agentId:o}),{ok:!0}):(a.cozeIdentity=e.cozeIdentity,await he(a),await it(a.workspace,a.framework,o,e.cozeIdentity),ce.info("_agent/update: cozeIdentity rewritten",{agentId:o,framework:a.framework}),await this.reloadAgentSessions(o,"identity-changed"),{ok:!0})}async disconnectAgent(e){let o=e.agentId;if(!o)throw new C("IPC_BAD_REQUEST","_agent/disconnect: missing agentId");let a=await xe(o);return a?(a.disconnectedAt=Date.now(),a.disconnectReason=e.reason??"",await he(a),ce.info("agent disconnected",{agentId:o,reason:e.reason??"",force:e.force??!1}),this.opts.disposeAndMarkDisconnected&&await this.opts.disposeAndMarkDisconnected(o,e.reason??"disconnect"),{ok:!0}):(ce.warn("_agent/disconnect: agent not found, ignoring",{agentId:o}),{ok:!0})}async switchModel(e){if(Je(e._meta,"_agent/switchModel"),!e.agentId)throw new C("IPC_BAD_REQUEST","_agent/switchModel: missing agentId");let o=e.model?.trim()?e.model:at,a=await xe(e.agentId);if(!a)throw new C("AGENT_NOT_FOUND",`agent not found: ${e.agentId}`);a.model=o,await he(a),ce.info("_agent/switchModel: model persisted",{agentId:e.agentId,model:o,reason:e.reason??""});let x=this.opts.agents.get(e.agentId);return x?(await x.msgQueue.enqueue(async()=>{x.model=o,await x.killAllRuntimes(`switchModel: ${o}`)}),ce.info("_agent/switchModel: all session runtimes killed, next prompt will respawn",{agentId:e.agentId,model:o}),{ok:!0}):(ce.info("_agent/switchModel: agent not running, config persisted only",{agentId:e.agentId}),{ok:!0})}async getFileTree(e){Je(e._meta,"_agent/getFileTree");let o=e._meta,a=ot(o),x=this.resolveWorkspace(a),f=e.filePath??"",d=this.safeJoin(x,f),h=await xr(d).catch(()=>null);if(!h)throw new C("IPC_BAD_REQUEST",`path not found: ${f}`);if(h.isSymbolicLink())throw new C("IPC_BAD_REQUEST",`symlink not allowed: ${f}`);let _=Aa(e.depth);return h.isDirectory()?{tree:await zs(x,d,f,_)}:{tree:[{name:ka(f),path:qs(f||"."),isDir:!1,size:h.size,modifiedAt:Math.floor(h.mtimeMs)}]}}async getFileContent(e){Je(e._meta,"_agent/getFileContent");let o=ot(e._meta),a=this.resolveWorkspace(o);if(!e.filePath)throw new C("IPC_BAD_REQUEST","filePath required");let x=this.safeJoin(a,e.filePath),f=await xr(x).catch(()=>null);if(!f||!f.isFile())throw new C("IPC_BAD_REQUEST",`not a file: ${e.filePath}`);if(f.isSymbolicLink())throw new C("IPC_BAD_REQUEST",`symlink not allowed: ${e.filePath}`);if(f.size>Is)throw new C("IPC_BAD_REQUEST",`file too large: ${f.size} bytes (max ${Is})`);let d=await Bs(x);return d.includes(0)?{content:d.toString("base64"),encoding:"base64",size:f.size}:{content:d.toString("utf8"),encoding:"utf-8",size:f.size}}resolveWorkspace(e){let o=this.opts.agents.get(e);return o?o.workspace:Le(e).workspace}safeJoin(e,o){let a=ha(e,o||"."),x=Os(e,a);if(x.startsWith("..")||x===".."||x.startsWith(`..${Ms}`))throw new C("IPC_BAD_REQUEST",`path escapes workspace: ${o}`);return a}loadAgentCfg(e){return xe(e)}async requireAgentCfg(e){let o=await this.loadAgentCfg(e);if(!o)throw new C("AGENT_NOT_FOUND",`no config for agent: ${e}`);return o}};function _a(r){let e=r.trim().replace(/[^a-zA-Z0-9._-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,64);if(!e||e==="."||e==="..")throw new C("IPC_BAD_REQUEST",`invalid skill name: ${r}`);return e}function wa(r){return r==="claude-code"?Te(".claude","skills"):Te(".agents","skills")}var ya=3e4,Ns=50*1024*1024,Xt=3e4;async function va(r){if(!r)throw new C("IPC_BAD_REQUEST","skill missing downloadUrl");if(r.startsWith("data:"))return ba(r);if(r.startsWith("file:")){let e=new URL(r).pathname,o=await Bs(e);if(o.length>Ns)throw new C("IPC_BAD_REQUEST",`skill too large: ${o.length} bytes`);return o}if(r.startsWith("http://")||r.startsWith("https://")){let e=new AbortController,o=setTimeout(()=>e.abort(),ya);try{let a=await fetch(r,{signal:e.signal});if(!a.ok)throw new C("IPC_BAD_REQUEST",`fetch skill failed HTTP ${a.status} ${r}`);let x=await a.arrayBuffer();if(x.byteLength>Ns)throw new C("IPC_BAD_REQUEST",`skill too large: ${x.byteLength} bytes`);return Buffer.from(x)}finally{clearTimeout(o)}}throw new C("IPC_BAD_REQUEST",`unsupported downloadUrl scheme (\u8981 https/data/file): ${r.slice(0,80)}`)}function ba(r){let e=/^data:([^,;]*)(;base64)?,(.*)$/s.exec(r);if(!e)throw new C("IPC_BAD_REQUEST","bad data URL");let o=!!e[2],a=e[3]??"";return o?Buffer.from(a,"base64"):Buffer.from(decodeURIComponent(a),"utf8")}function Sa(r){return r.length>=2&&r[0]===31&&r[1]===139}async function Ea(r,e){await Ca(r),await new Promise((o,a)=>{let x=Rs("tar",["-xzf","-","-C",e,"--strip-components=1","--no-same-owner"],{stdio:["pipe","pipe","pipe"]}),f="";x.stderr?.on("data",h=>{f+=String(h)});let d=setTimeout(()=>{x.kill("SIGKILL"),a(new C("IPC_BAD_REQUEST",`tar extract timeout (${Xt}ms)`))},Xt);x.on("error",h=>{clearTimeout(d),a(new C("IPC_BAD_REQUEST",`tar spawn failed: ${h.message}`,{cause:h}))}),x.on("exit",h=>{clearTimeout(d),h===0?o():a(new C("IPC_BAD_REQUEST",`tar exit ${h}${f?`: ${f.trim().slice(0,200)}`:""}`))}),x.stdin?.end(r)})}async function Ca(r){let e=await new Promise((o,a)=>{let x=Rs("tar",["-tzvf","-"],{stdio:["pipe","pipe","pipe"]}),f="",d="";x.stdout?.on("data",_=>{f+=String(_)}),x.stderr?.on("data",_=>{d+=String(_)});let h=setTimeout(()=>{x.kill("SIGKILL"),a(new C("IPC_BAD_REQUEST",`tar list timeout (${Xt}ms)`))},Xt);x.on("error",_=>{clearTimeout(h),a(new C("IPC_BAD_REQUEST",`tar list spawn failed: ${_.message}`))}),x.on("exit",_=>{clearTimeout(h),_===0?o(f):a(new C("IPC_BAD_REQUEST",`tar list exit ${_}${d?`: ${d.trim().slice(0,200)}`:""}`))}),x.stdin?.end(r)});for(let o of e.split(`
|
|
89
|
+
`)){let a=o.trim();if(!a)continue;let x=a.charCodeAt(0);if(x!==45&&x!==100)throw new C("IPC_BAD_REQUEST",`tar entry kind '${a[0]}' not allowed (symlink/hardlink/special): ${a.slice(0,100)}`);let d=(a.match(/\s(\S.*)$/)?.[1]??"").split(" -> ")[0]?.trim()??"";if(!d)continue;if(d.startsWith("/"))throw new C("IPC_BAD_REQUEST",`tar entry absolute path: ${d}`);if(d.split(/[/\\]/).some(_=>_===".."))throw new C("IPC_BAD_REQUEST",`tar entry contains '..': ${d}`)}}async function zs(r,e,o,a){if(a<=0)return[];let x;try{x=await ca(e,{withFileTypes:!0})}catch{return[]}let f=[];for(let d of x){if(ma.has(d.name)||d.isSymbolicLink())continue;let h=Te(e,d.name),_=la(Te(o,d.name)),v=null;try{v=await xr(h)}catch{continue}if(v.isSymbolicLink())continue;let b={name:d.name,path:qs(Os(r,h)),isDir:v.isDirectory(),size:v.size,modifiedAt:Math.floor(v.mtimeMs)};v.isDirectory()&&a>1&&(b.children=await zs(r,h,_,a-1)),f.push(b)}return f.sort((d,h)=>d.isDir!==h.isDir?d.isDir?-1:1:d.name.localeCompare(h.name)),f}function Aa(r){return!r||r<=0?ga:Math.min(r,pa)}function ka(r){if(!r||r==="."||r==="/")return".";let e=r.split(/[/\\]/);return e[e.length-1]||"."}function qs(r){return r.split(Ms).join("/")}K();var St=B("agent-health-reporter"),Da=3e4,Yt=class{constructor(e){this.opts=e;this.intervalMs=e.intervalMs??Da}opts;timer=null;inFlight=!1;unsubscribeRegister=null;intervalMs;start(){this.timer||(this.timer=setInterval(()=>{this.tick()},this.intervalMs),this.timer.unref?.(),this.unsubscribeRegister=this.opts.core.onAgentRegister(()=>{this.tick()}),St.info("heartbeat started",{intervalMs:this.intervalMs}),this.tick())}stop(){this.timer&&(clearInterval(this.timer),this.timer=null,this.unsubscribeRegister&&(this.unsubscribeRegister(),this.unsubscribeRegister=null),St.info("heartbeat stopped"))}async tick(){if(this.inFlight){St.debug("previous tick still in-flight, skip");return}let e=this.opts.getDeviceId();if(!e){St.debug("deviceId not available, skip tick (\u5C1A\u672A pair)");return}this.inFlight=!0;try{let o=[...this.opts.core.agents.values()];for(let a of o){let x=Pa(a);if(!x)continue;let f={status:x,_meta:{cozeAgentId:a.agentId,cozeDeviceId:e}};try{await this.opts.core.sendRequest("_agent/health",f)}catch(d){St.warn("heartbeat send failed",{agentId:a.agentId,status:x,err:String(d)})}}}finally{this.inFlight=!1}}};function Pa(r){return r.status==="error"?"error":r.activeTriggers.size>0?"busy":r.status==="ok"?"online":null}qe();import{mkdir as cr,rm as qa}from"node:fs/promises";import{spawn as Ra}from"node:child_process";function Et(r,e,o){return o===void 0?{jsonrpc:"2.0",id:r,method:e}:{jsonrpc:"2.0",id:r,method:e,params:o}}function Zt(r,e){return e===void 0?{jsonrpc:"2.0",method:r}:{jsonrpc:"2.0",method:r,params:e}}function xt(r,e){return{jsonrpc:"2.0",id:r,result:e}}function Ve(r,e){return{jsonrpc:"2.0",id:r,error:e}}var $t=class extends Error{code;data;constructor(e){super(`JSON-RPC error code=${e.code} ${e.message}`),this.name="RemoteRpcError",this.code=e.code,e.data!==void 0&&(this.data=e.data)}},G={PARSE_ERROR:-32700,INVALID_REQUEST:-32600,METHOD_NOT_FOUND:-32601,INVALID_PARAMS:-32602,INTERNAL_ERROR:-32603,AGENT_NOT_FOUND:-32001,AGENT_BUSY:-32002,AGENT_TIMEOUT:-32003,AGENT_SPAWN_FAILED:-32004,OPERATION_NOT_ALLOWED_FOR_LOCAL:-32005,AGENT_DISCONNECTED:-32006,MODEL_TOKEN_GEN_FAILED:-32009};function Fs(r){return"method"in r&&"id"in r&&r.id!==void 0}function Us(r){return"method"in r&&!("id"in r)}function Qt(r){return!("method"in r)&&"id"in r}var La={AGENT_NOT_FOUND:G.AGENT_NOT_FOUND,AGENT_BUSY:G.AGENT_BUSY,AGENT_DISCONNECTED:G.AGENT_DISCONNECTED,AGENT_TIMEOUT:G.AGENT_TIMEOUT,AGENT_SPAWN_FAILED:G.AGENT_SPAWN_FAILED,AGENT_PROTOCOL_ERROR:G.INTERNAL_ERROR,BRIDGE_CONFIG_INVALID:G.INTERNAL_ERROR,BRIDGE_INTERNAL:G.INTERNAL_ERROR,IPC_AUTH_FAILED:G.INTERNAL_ERROR,IPC_BAD_REQUEST:G.INVALID_REQUEST,MODEL_TOKEN_GEN_FAILED:G.MODEL_TOKEN_GEN_FAILED,OPERATION_NOT_ALLOWED_FOR_LOCAL:G.OPERATION_NOT_ALLOWED_FOR_LOCAL,UPSTREAM_DISCONNECTED:G.INTERNAL_ERROR,UPSTREAM_HANDSHAKE_FAILED:G.INTERNAL_ERROR};function en(r){return r instanceof C?{code:La[r.code]??G.INTERNAL_ERROR,message:r.message,data:{bridgeCode:r.code,retriable:r.retriable}}:{code:G.INTERNAL_ERROR,message:r instanceof Error?r.message:String(r)}}function Ks(r){let e=r.data,o=e?.bridgeCode??"AGENT_PROTOCOL_ERROR";return new C(o,r.message,{retriable:e?.retriable??!1,cause:r.data})}function Hs(r){return`${JSON.stringify(r)}
|
|
90
|
+
`}var tn=class{buffer="";onError;constructor(e={}){this.onError=e.onError}push(e){this.buffer+=typeof e=="string"?e:e.toString("utf8");let o=this.buffer.split(`
|
|
91
|
+
`);this.buffer=o.pop()??"";let a=[];for(let x of o){let f=x.replace(/\r$/,"").trim();if(f)try{a.push(JSON.parse(f))}catch(d){this.onError?.({line:f,error:d})}}return a}flush(){if(!this.buffer)return[];let e=this.buffer.replace(/\r$/,"").trim();if(this.buffer="",!e)return[];try{return[JSON.parse(e)]}catch(o){return this.onError?.({line:e,error:o}),[]}}};var js={"session/prompt":"session.prompt","session/cancel":"session.cancel","session/new":"session.new","session/load":"session.load","_agent/create":"agent.create","_agent/health":"agent.health","_agent/pair":"agent.pair","_agent/listSkills":"agent.listSkills","_agent/addSkills":"agent.addSkills","_agent/removeSkills":"agent.removeSkills","_agent/getFileTree":"agent.getFileTree","_agent/getFileContent":"agent.getFileContent","_agent/detail":"agent.detail","_agent/update":"agent.update","_agent/disconnect":"agent.disconnect","_agent/switchModel":"agent.switchModel","_agent/genModelToken":"agent.genModelToken","session/request_permission":"session.requestPermission",initialize:"initialize"},Yu=Object.fromEntries(Object.entries(js).map(([r,e])=>[e,r])),Ta={"session.prompt":["agentId","triggerMsgId","sessionId"],"session.cancel":["agentId","triggerMsgId","sessionId"],"session.new":["agentId"],"session.load":["agentId"],"agent.create":["agentId"],"agent.health":["agentId"],"agent.listSkills":["agentId"],"agent.addSkills":["agentId"],"agent.removeSkills":["agentId"],"agent.getFileTree":["agentId"],"agent.getFileContent":["agentId"],"agent.detail":["agentId"],"agent.update":["agentId"],"agent.disconnect":["agentId"],"agent.switchModel":["agentId"],"agent.genModelToken":["agentId","sessionId"],"session.requestPermission":["agentId","sessionId"],"agent.pair":[],initialize:[]},ct=class{seq=0;next(e,o){this.seq+=1;let a=js[e]??Ia(e),x=Ta[a]??[],f=[a,String(this.seq)];if(x.length>0){let d=x.map(_=>Gs(o?.[_]??"")),h=Na(d).join(":");h&&f.push(h)}else o&&Object.values(o).some(d=>d)&&f.push(Object.values(o).filter(Boolean).map(d=>Gs(String(d))).join(":"));return f.join("_")}reset(){this.seq=0}};function Ia(r){return r.replace(/[\s/]+/g,".").replace(/_+/g,"-")}function Gs(r){return r.replace(/[:_\s]+/g,"-")}function Na(r){let e=r.length;for(;e>0&&!r[e-1];)e-=1;return r.slice(0,e)}K();var Ba=3e4;function Ws(r,e){if(!(typeof r!="number"||r<=0))try{process.platform==="win32"?process.kill(r,e):process.kill(-r,e)}catch{}}var Fe=class{constructor(e){this.opts=e;this.log=B(`downstream.${this.constructor.name}`),this.decoder=new tn({onError:o=>this.log.warn("decode line failed",{line:o.line})})}opts;child;decoder;pending=new Map;idAllocator=new ct;updateHandlers=[];agentRequestHandlers=[];exitHandlers=[];log;stopped=!1;sanitizeEnv(e){return e}async start(){if(this.child)throw new C("BRIDGE_INTERNAL","Downstream already started");let e=process.platform!=="win32",o=Ra(this.opts.command,this.opts.args,{cwd:this.opts.cwd,env:{...this.sanitizeEnv(process.env),...this.opts.env},stdio:["pipe","pipe","pipe"],detached:e});this.child=o,o.stdout?.setEncoding("utf8"),o.stdout?.on("data",a=>{for(let x of this.decoder.push(a))this.dispatch(x)}),o.stderr?.setEncoding("utf8"),o.stderr?.on("data",a=>{this.log.debug("stderr",{text:a.trimEnd()})}),o.on("exit",(a,x)=>{this.stopped=!0,this.failAllPending(new C("AGENT_PROTOCOL_ERROR",`agent exited (${a}/${x})`));for(let f of this.exitHandlers)f(a,x)}),o.on("error",a=>{this.log.error("child error",{err:String(a)}),this.failAllPending(new C("AGENT_SPAWN_FAILED",String(a),{cause:a}))}),this.log.info("downstream started",{command:this.opts.command,pid:o.pid,cwd:this.opts.cwd})}async stop(e){if(!this.child||this.stopped)return;this.stopped=!0,this.log.info("downstream stopping",{reason:e});let o=this.child,a=new Promise(f=>o.once("exit",()=>f()));Ws(o.pid,"SIGTERM");let x=setTimeout(()=>{o.killed||Ws(o.pid,"SIGKILL")},5e3);try{await a}finally{clearTimeout(x)}}pid(){return this.child?.pid}isAlive(){return!!this.child&&!this.stopped}initialize(e){return this.call("initialize",e)}sessionNew(e){return this.call("session/new",{mcpServers:[],...e})}sessionLoad(e){return this.call("session/load",{mcpServers:[],...e})}sessionPrompt(e){return this.call("session/prompt",e,0)}async sessionCancel(e){!this.child||this.stopped||this.writeFrame(Zt("session/cancel",e))}onUpdate(e){this.updateHandlers.push(e)}onAgentRequest(e){this.agentRequestHandlers.push(e)}respondAgentRequest(e,o){if(!(!this.child||this.stopped))try{this.writeFrame(xt(e,o))}catch(a){this.log.warn("respondAgentRequest write failed",{id:e,err:String(a)})}}respondAgentRequestError(e,o){if(!(!this.child||this.stopped))try{this.writeFrame(Ve(e,o))}catch(a){this.log.warn("respondAgentRequestError write failed",{id:e,err:String(a)})}}onExit(e){this.exitHandlers.push(e)}call(e,o,a=Ba){if(!this.child||this.stopped)return Promise.reject(new C("AGENT_PROTOCOL_ERROR","downstream not started"));let x=this.idAllocator.next(e),f=Et(x,e,o),d=a>0&&Number.isFinite(a);return new Promise((h,_)=>{let v=d?setTimeout(()=>{this.pending.delete(x),_(new C("AGENT_TIMEOUT",`${e} timed out after ${a}ms`))},a):null;this.pending.set(x,{resolve:h,reject:_,timer:v,method:e});try{this.writeFrame(f)}catch(b){v&&clearTimeout(v),this.pending.delete(x),_(b)}})}writeFrame(e){if(!this.child?.stdin||this.child.stdin.destroyed)throw new C("AGENT_PROTOCOL_ERROR","downstream stdin not writable");this.child.stdin.write(Hs(e))}dispatch(e){if(Qt(e)){let o=e.id!==null?this.pending.get(e.id):void 0;if(!o){this.log.warn("orphan response",{id:e.id});return}this.pending.delete(e.id),o.timer&&clearTimeout(o.timer),e.error?o.reject(Ks(e.error)):o.resolve(e.result);return}if(Us(e)){if(e.method==="session/update")for(let o of this.updateHandlers)Promise.resolve(o(e.params)).catch(a=>this.log.warn("update handler failed",{err:String(a)}));else this.log.debug("unknown notification",{method:e.method});return}if(Fs(e)){let o=e;this.handleAgentRequest(o).catch(a=>this.log.error("agent request handler failed",{method:o.method,err:String(a)}))}}async handleAgentRequest(e){if(this.agentRequestHandlers.length===0){this.writeFrame(Ve(e.id,{code:-32601,message:`method not handled by Bridge: ${e.method}`}));return}for(let o of this.agentRequestHandlers)try{await o(e)}catch(a){this.log.error("agentRequestHandler threw",{method:e.method,err:String(a)});try{this.writeFrame(Ve(e.id,en(a)))}catch{}}}failAllPending(e){for(let o of this.pending.values())o.timer&&clearTimeout(o.timer),o.reject(e);this.pending.clear()}};var Oa="@zed-industries/claude-code-acp@latest";function Ma(r){let e={};for(let[o,a]of Object.entries(r))a!==void 0&&(o.startsWith("CLAUDE")||o==="AI_AGENT"||o==="BAGGAGE"||(e[o]=a));return e}var nn=class extends Fe{framework="claude-code";constructor(e){let o=e.command??"npx",a=e.args??["-y",Oa],x={command:o,args:a,cwd:e.cwd,...e.env?{env:e.env}:{}};super(x)}sanitizeEnv(e){return Ma(e)}};var za="@zed-industries/codex-acp@latest",rn=class extends Fe{framework="codex";constructor(e){let o=e.command??"npx",a=e.args??["-y",za],x=e.extraArgs?[...a,...e.extraArgs]:a,f={command:o,args:x,cwd:e.cwd,...e.env?{env:e.env}:{}};super(f)}};import{spawn as Js}from"node:child_process";K();var sn=class extends Fe{framework="openclaw";registerLog;profile;agentId;sessionName;registered=!1;constructor(e){let o=e.profile??"coze",a=e.sessionName??"default",x=["--profile",o,"acp","--session",`agent:${e.agentId}:${a}`],f={command:e.command,args:x,cwd:e.cwd,...e.env?{env:e.env}:{}};super(f),this.profile=o,this.agentId=e.agentId,this.sessionName=a,this.registerLog=B("downstream.openclaw.register")}async start(){await this.registerAgent().catch(e=>{this.registerLog.warn("openclaw agents add failed (will continue to acp anyway)",{agentId:this.agentId,err:String(e)})}),await super.start()}registerAgent(){return new Promise((e,o)=>{let a=Js(this.opts.command,["--profile",this.profile,"agents","add",this.agentId,"--workspace",this.opts.cwd,"--non-interactive"],{stdio:["ignore","pipe","pipe"],env:{...process.env,...this.opts.env}}),x="";a.stderr?.on("data",f=>{x+=f.toString("utf8")}),a.on("error",o),a.on("close",f=>{f===0?(this.registered=!0,this.registerLog.info("agent registered",{agentId:this.agentId,profile:this.profile}),e()):o(new C("AGENT_SPAWN_FAILED",`openclaw agents add ${this.agentId} exited ${f}: ${x.trim()}`))})})}async cleanup(e){this.registered&&await new Promise(o=>{let a=Js(this.opts.command,["--profile",this.profile,"agents","delete",this.agentId,"--force"],{stdio:["ignore","pipe","pipe"],env:{...process.env,...this.opts.env}}),x="";a.stderr?.on("data",f=>{x+=f.toString("utf8")}),a.on("error",f=>{this.registerLog.warn("openclaw agents delete failed (best-effort)",{agentId:this.agentId,err:String(f)}),o()}),a.on("close",f=>{f===0?this.registerLog.info("agent unregistered",{agentId:this.agentId}):this.registerLog.warn("openclaw agents delete non-zero exit",{agentId:this.agentId,code:f,stderr:x.trim()}),this.registered=!1,o()})})}get acpSessionName(){return this.sessionName}};K();se();var on=class{slots=[];running=!1;closed=!1;disposed=!1;enqueue(e){return this.disposed?Promise.reject(new Error("AsyncQueue disposed")):this.closed?Promise.reject(new Error("AsyncQueue closed")):new Promise((o,a)=>{this.slots.push({task:e,resolve:o,reject:a}),this.drain()})}close(){this.closed=!0}dispose(e=new Error("AsyncQueue disposed")){for(this.disposed=!0,this.closed=!0;this.slots.length>0;)this.slots.shift()?.reject(e)}get size(){return this.slots.length}get isRunning(){return this.running}async drain(){if(!this.running){this.running=!0;try{for(;this.slots.length>0&&!this.disposed;){let e=this.slots.shift();if(!e)break;try{let o=await e.task();e.resolve(o)}catch(o){e.reject(o)}}}finally{this.running=!1}}}};var an=class{agentId;framework;workspace;deployType;msgQueue;sessions=new Map;activeTriggers=new Map;status="ok";model;lastActiveAt=Date.now();constructor(e){this.agentId=e.agentId,this.framework=e.framework,this.workspace=e.workspace,this.model=e.model,this.deployType=e.deployType??"local",this.msgQueue=new on}async dispose(e){this.status="stopped",this.msgQueue.dispose(new Error(`AgentSession disposed${e?`: ${e}`:""}`)),await this.killAllRuntimes(e??"dispose")}async killAllRuntimes(e){let o=[];for(let[,a]of this.sessions)Ct(a),a.downstream&&(o.push(a.downstream.stop(e).catch(()=>{})),a.downstream=void 0);await Promise.all(o),this.activeTriggers.clear()}};function Ct(r){r.idleTimer&&(clearTimeout(r.idleTimer),r.idleTimer=void 0)}var Ue=B("agent-manager"),Fa=(r,e,o,a,x)=>{switch(r){case"claude-code":{let f=x?Ps(x):void 0;return new nn({cwd:o,...f&&Object.keys(f).length>0?{env:f}:{}})}case"codex":{let f=x?Ls(x):[],d=x?Ts(x):void 0;return new rn({cwd:o,...f.length>0?{extraArgs:f}:{},...d&&Object.keys(d).length>0?{env:d}:{}})}case"openclaw":return new sn({command:e,cwd:o,agentId:a})}};function Ua(r){return r==="claude-code"||r==="codex"}var Ka={path:"",version:"cloud-deployed"},Ha={protocolVersion:1,clientCapabilities:{fs:{readTextFile:!0,writeTextFile:!0}}},Ga=2e4,xn=class{paths;config;registry;factory;createTimeoutMs;constructor(e){this.paths=e.paths,this.config=e.config,this.registry=e.registry,this.factory=e.downstreamFactory??Fa,this.createTimeoutMs=e.createTimeoutMs??Ga}async createAgent(e){if(!e.agentId)throw new C("IPC_BAD_REQUEST","agentId required");if(!e.framework)throw new C("IPC_BAD_REQUEST","framework required");let o=bt(e._meta)==="cloud";if(o&&e.framework==="openclaw")return Ue.info("cloud-deployed openclaw, ack without local spawn",{agentId:e.agentId,framework:e.framework}),{ok:!0,agentId:e.agentId,framework:e.framework};this.registry.reviveIfDisconnected?.(e.agentId);let a=this.registry.get(e.agentId);if(a){if(a.framework!==e.framework)throw new C("AGENT_BUSY",`agent ${e.agentId} exists with different framework (${a.framework})`);if(a.status==="error")Ue.warn("existing agent in error state, rebuilding",{agentId:e.agentId}),await a.dispose("rebuild after error").catch(y=>Ue.warn("dispose stale agent failed (ignored)",{err:String(y)})),this.registry.unregister(e.agentId);else return Ue.info("agent already exists, return current",{agentId:e.agentId}),{ok:!0,agentId:a.agentId,workspace:a.workspace,framework:a.framework}}if(!o&&!this.config.frameworksCache?.[e.framework])throw new C("AGENT_SPAWN_FAILED",`framework ${e.framework} not detected on this machine; rerun daemon to refresh frameworks_cache`);let x=Le(e.agentId,this.paths),f=e.workspace??x.workspace,d=bt(e._meta),h=new AbortController,_=setTimeout(()=>h.abort(new C("AGENT_TIMEOUT",`_agent/create timed out after ${this.createTimeoutMs}ms`)),this.createTimeoutMs),v,b=!1;try{let y=()=>{if(h.signal.aborted)throw h.signal.reason instanceof Error?h.signal.reason:new C("AGENT_TIMEOUT","_agent/create aborted")};await cr(x.root,{recursive:!0}),await cr(f,{recursive:!0}),await cr(x.logs,{recursive:!0}),y(),await it(f,e.framework,e.agentId,e.cozeIdentity),y();let A=await xe(e.agentId,this.paths).catch(()=>null),L=ks({model:e.model??A?.model});if(v=new an({agentId:e.agentId,framework:e.framework,workspace:f,model:L.model??at,deployType:d}),v.status="ok",A?.sessions){for(let[U,$]of Object.entries(A.sessions))v.sessions.set(U,{acpSessionId:$.acpSessionId,modelToken:$.modelToken,tokenGeneratedAt:$.tokenGeneratedAt,lastActiveAt:Date.now(),loadingSession:!1});let R=Object.keys(A.sessions).length;R>0&&Ue.info("restored persisted session records (no spawn)",{agentId:e.agentId,count:R})}this.registry.register(v),b=!0;let T={agentId:e.agentId,framework:e.framework,workspace:f,cozeIdentity:e.cozeIdentity,createdAt:A?.createdAt??Date.now(),sessions:A?.sessions??{},model:L.model};return d==="cloud"&&(T.deployType="cloud"),A?.skills&&(T.skills=A.skills),A?.agentName&&(T.agentName=A.agentName),A?.description&&(T.description=A.description),await he(T,this.paths),Ue.info("agent created (no spawn, lazy on first prompt)",{agentId:e.agentId,framework:e.framework,deployType:d}),{ok:!0,agentId:e.agentId,workspace:f,framework:e.framework}}catch(y){throw Ue.error("agent create failed, rolling back",{agentId:e.agentId,err:String(y)}),b&&v&&(await v.dispose("rollback").catch(()=>{}),this.registry.unregister(e.agentId)),await qa(x.root,{recursive:!0,force:!0}).catch(A=>Ue.warn("rm agent dir failed (ignored)",{err:String(A)})),y instanceof C?y:new C("AGENT_SPAWN_FAILED",String(y),{cause:y})}finally{clearTimeout(_)}}async spawnSessionDownstream(e,o){let x=this.config.frameworksCache?.[e.framework];if(!x)if(e.deployType==="cloud"&&Ua(e.framework))x=Ka;else throw new C("AGENT_SPAWN_FAILED",`framework ${e.framework} not detected on this machine`);let f={model:e.model,modelToken:o},d=this.factory(e.framework,x.path,e.workspace,e.agentId,f);try{return await d.start(),await d.initialize(Ha),d}catch(h){throw await d.stop("spawnSessionDownstream failed").catch(()=>{}),h instanceof C?h:new C("AGENT_SPAWN_FAILED",h instanceof Error?h.message:String(h),{cause:h})}}};K();import{spawn as ja}from"node:child_process";import{constants as Vs,access as Wa}from"node:fs/promises";import{delimiter as Ja,join as Va}from"node:path";var Xa=B("framework-detector"),Xs={"claude-code":"claude",codex:"codex",openclaw:"openclaw"},Ya=[".exe",".cmd",".bat",".ps1"],At=class{env;constructor(e={}){this.env={pathEnv:e.pathEnv??process.env.PATH??"",platform:e.platform??process.platform,spawn:e.spawn??ja,access:e.access??Wa}}async detect(e){let o=Xs[e],a=await this.which(o);if(!a)return Xa.debug("framework binary not found",{framework:e,bin:o}),null;let x=await this.probeVersion(a);return{path:a,version:x}}async detectAll(){let e=await Promise.all(Object.keys(Xs).map(async a=>[a,await this.detect(a)])),o={};for(let[a,x]of e)x&&(o[a]=x);return o}async which(e){let o=this.env.pathEnv.split(Ja).filter(Boolean),a=this.env.platform==="win32"?["",...Ya]:[""];for(let x of o)for(let f of a){let d=Va(x,e+f);if(await this.isExecutable(d))return d}return null}async isExecutable(e){try{let o=this.env.platform==="win32"?Vs.F_OK:Vs.X_OK;return await this.env.access(e,o),!0}catch{return!1}}async probeVersion(e){return new Promise(o=>{let a="",x=!1,f,d=h=>{x||(x=!0,f&&clearTimeout(f),o(h.trim()||"unknown"))};try{let h=this.env.spawn(e,["--version"],{stdio:["ignore","pipe","pipe"]});f=setTimeout(()=>{h.kill("SIGKILL"),d("unknown")},5e3),h.stdout?.on("data",_=>{a+=_.toString("utf8")}),h.on("error",()=>d("unknown")),h.on("close",()=>{let _=$a(a).split(/\r?\n/)[0]??"";d(_)})}catch{d("unknown")}})}},Za=new RegExp("\x1B\\[[0-9;]*[A-Za-z]","g");function $a(r){return r.replace(Za,"")}ir();se();var Qa=10*6e4;function Ys(r){let e=r?.sessionIdleTimeoutMs;return typeof e!="number"||!Number.isFinite(e)||e<=0?Qa:e}function cn(r){return Ft(r??H().configFile)}function kt(r,e){return Ut(e??H().configFile,r)}import{randomBytes as ex}from"node:crypto";qe();var Zs={PAIR:"_agent/pair",CREATE:"_agent/create",HEALTH:"_agent/health",LIST_SKILLS:"_agent/listSkills",ADD_SKILLS:"_agent/addSkills",REMOVE_SKILLS:"_agent/removeSkills",GET_FILE_TREE:"_agent/getFileTree",GET_FILE_CONTENT:"_agent/getFileContent",DETAIL:"_agent/detail",UPDATE:"_agent/update",DISCONNECT:"_agent/disconnect",SWITCH_MODEL:"_agent/switchModel",GEN_MODEL_TOKEN:"_agent/genModelToken",DELETE:"_agent/delete"};K();var j=B("core"),tx=3e4,nx=3e4,fn=class{upstream;agents=new Map;disconnectedAgents=new Set;extensions;paths;sessionSpawner;sessionIdleTimeoutMs;upstreamIds=new ct;pendingUpstream=new Map;pendingBridge=new Map;constructor(e){this.upstream=e.upstream,this.extensions=e.extensions??{},this.paths=e.paths,this.sessionSpawner=e.sessionSpawner,this.sessionIdleTimeoutMs=Ys(e.bridgeConfig)}registerExtension(e,o){this.extensions[e]=o}async start(){this.upstream.onFrame(e=>this.handleFrame(e)),await this.upstream.start(),j.info("Core started",{extensions:Object.keys(this.extensions)})}async stop(e){j.info("Core stopping",{reason:e}),await Promise.all([...this.agents.values()].map(o=>o.dispose(e))),this.agents.clear(),await this.upstream.stop(e)}get(e){return this.agents.get(e)}register(e){this.agents.set(e.agentId,e),j.info("agent registered",{agentId:e.agentId,framework:e.framework});for(let o of this.registerHandlers)try{o(e.agentId)}catch(a){j.warn("onAgentRegister handler threw (ignored)",{agentId:e.agentId,err:String(a)})}}onAgentRegister(e){return this.registerHandlers.add(e),()=>this.registerHandlers.delete(e)}registerHandlers=new Set;unregister(e){this.agents.delete(e)}reviveIfDisconnected(e){this.disconnectedAgents.delete(e)&&j.info("agent revived from disconnect",{agentId:e})}attachRuntimeHooks(e,o,a){let x=a.downstream;x&&(x.onUpdate(f=>{a.loadingSession||this.forwardUpdate(e,f)}),x.onAgentRequest(f=>{this.handleAgentRequest(e,x,f)}),x.onExit((f,d)=>{j.info("session runtime exited",{agentId:e.agentId,cloudId:o,code:f,signal:d}),Ct(a),a.downstream=void 0,a.acpSessionId&&e.activeTriggers.delete(a.acpSessionId)}))}async handleFrame(e){if(Qt(e)){this.handleUpstreamResponse(e);return}if(!("method"in e)||typeof e.method!="string")return;let o="id"in e&&e.id!==void 0?e.id:null;try{if(e.method.startsWith("_agent/")){let a=this.extensions[e.method];if(!a){o!==null?await this.sendError(o,G.METHOD_NOT_FOUND,`extension not registered: ${e.method}`):j.warn("drop notification: extension not registered",{method:e.method});return}let x=await a(e,this);o!==null&&await this.upstream.send(xt(o,x));return}if(e.method.startsWith("session/")){let a=await this.routeSessionMethod(e);o!==null&&await this.upstream.send(xt(o,a));return}if(e.method==="initialize"){o!==null&&await this.upstream.send(xt(o,{protocolVersion:1,agentCapabilities:{loadSession:!0}}));return}o!==null?await this.sendError(o,G.METHOD_NOT_FOUND,`method not implemented: ${e.method}`):j.warn("drop unknown notification",{method:e.method})}catch(a){j.error("handleFrame failed",{method:e.method,err:String(a)}),o!==null&&await this.upstream.send(Ve(o,en(a)))}}async routeSessionMethod(e){if(!e.params||typeof e.params!="object")throw new C("IPC_BAD_REQUEST",`${e.method} requires params`);let o=e.params,a=o._meta?.cozeAgentId;if(!a)throw new C("IPC_BAD_REQUEST",`${e.method}: missing _meta.cozeAgentId`);let x=this.agents.get(a);if(!x)throw this.disconnectedAgents.has(a)?new C("AGENT_DISCONNECTED",`agent ${a} has been disconnected; cloud must _agent/create to revive`):new C("AGENT_NOT_FOUND",`agent not found: ${a}`);if(e.method==="session/cancel")return this.dispatchSessionCall(x,e.method,o);let f=Date.now(),d=!1;try{let h=await x.msgQueue.enqueue(()=>this.dispatchSessionCall(x,e.method,o));return d=!0,h}finally{j.info("session call done",{agentId:x.agentId,method:e.method,durationMs:Date.now()-f,ok:d})}}async dispatchSessionCall(e,o,a){e.lastActiveAt=Date.now();let{stripped:x}=Cs(a);switch(o){case"session/new":{let f=rx();return j.info("session/new ack (lazy spawn)",{agentId:e.agentId,cloudId:f}),{sessionId:f}}case"session/load":{let f=x;return j.info("session/load ack (lazy spawn)",{agentId:e.agentId,cloudId:f.sessionId}),{}}case"session/prompt":{let f=x,d=f.sessionId;if(!d)throw new C("IPC_BAD_REQUEST","session/prompt: missing sessionId");let h=await this.ensureRuntime(e,d);if(await this.ensureDownstream(e,d,h),!h.downstream||!h.acpSessionId)throw new C("BRIDGE_INTERNAL","session runtime not ready after ensureDownstream");let _=a._meta?.cozeTriggerMsgId;_?e.activeTriggers.set(h.acpSessionId,_):e.activeTriggers.delete(h.acpSessionId);try{let v=await h.downstream.sessionPrompt({...f,sessionId:h.acpSessionId});return h.lastActiveAt=Date.now(),v}finally{h.downstream?.isAlive()&&this.armIdleTimer(e,d,h)}}case"session/cancel":{let d=x.sessionId;if(!d)throw new C("IPC_BAD_REQUEST","session/cancel: missing sessionId");let h=e.sessions.get(d);return h?.downstream?.isAlive()&&h.acpSessionId&&await h.downstream.sessionCancel({sessionId:h.acpSessionId}),{ok:!0}}default:throw new C("IPC_BAD_REQUEST",`session method not supported: ${o}`)}}async ensureRuntime(e,o){let a=e.sessions.get(o);if(a)return a;let f={modelToken:await this.requestSessionToken(e.agentId,o),tokenGeneratedAt:Date.now(),lastActiveAt:Date.now(),loadingSession:!1};return e.sessions.set(o,f),await this.persistSessionMapping(e),f}async requestSessionToken(e,o){let a={sessionId:o,_meta:{cozeAgentId:e}};try{let x=await this.sendRequest(Zs.GEN_MODEL_TOKEN,a,nx);if(!x?.modelToken)throw new C("MODEL_TOKEN_GEN_FAILED",`cloud returned empty modelToken (agentId=${e}, cloudSessionId=${o})`);return x.modelToken}catch(x){throw x instanceof C&&x.code==="MODEL_TOKEN_GEN_FAILED"?x:new C("MODEL_TOKEN_GEN_FAILED",x instanceof Error?x.message:String(x),{cause:x})}}async ensureDownstream(e,o,a){if(Ct(a),a.downstream?.isAlive())return;if(!this.sessionSpawner)throw new C("AGENT_SPAWN_FAILED","sessionSpawner not wired (cannot spawn per-session downstream)");let x=await this.sessionSpawner(e,a.modelToken);if(a.downstream=x,this.attachRuntimeHooks(e,o,a),a.acpSessionId){a.loadingSession=!0;try{await x.sessionLoad({sessionId:a.acpSessionId,cwd:e.workspace}),j.info("session restored via session/load",{agentId:e.agentId,cloudId:o,acpId:a.acpSessionId})}catch(f){j.warn("session/load failed, fallback to session/new",{agentId:e.agentId,cloudId:o,acpId:a.acpSessionId,err:String(f)}),a.acpSessionId=void 0;let d=await x.sessionNew({cwd:e.workspace});a.acpSessionId=d.sessionId,await this.persistSessionMapping(e)}finally{a.loadingSession=!1}}else{let f=await x.sessionNew({cwd:e.workspace});a.acpSessionId=f.sessionId,await this.persistSessionMapping(e)}}armIdleTimer(e,o,a){Ct(a),a.idleTimer=setTimeout(()=>{j.info("session runtime idle timeout, killing downstream",{agentId:e.agentId,cloudId:o});let x=a.downstream;a.downstream=void 0,a.idleTimer=void 0,a.acpSessionId&&e.activeTriggers.delete(a.acpSessionId),x&&x.stop("idle timeout").catch(f=>j.warn("idle stop failed (ignored)",{agentId:e.agentId,cloudId:o,err:String(f)}))},this.sessionIdleTimeoutMs),a.idleTimer.unref?.()}forwardUpdate(e,o){let a=o.sessionId,x=this.reverseSessionId(e,a);if(!x){j.debug("drop update for unknown session",{agentId:e.agentId,acpId:a});return}let f={cozeAgentId:e.agentId},d=e.activeTriggers.get(a);d&&(f.cozeTriggerMsgId=d),this.upstream.send(Zt("session/update",{...o,sessionId:x,_meta:f})).catch(h=>j.warn("forward update failed",{agentId:e.agentId,err:String(h)}))}handleAgentRequest(e,o,a){if(a.method==="session/request_permission"){this.forwardPermissionRequest(e,o,a);return}j.warn("unhandled agent request,returning method_not_found",{agentId:e.agentId,method:a.method}),o.respondAgentRequestError(a.id,{code:G.METHOD_NOT_FOUND,message:`method not handled by Bridge: ${a.method}`})}forwardPermissionRequest(e,o,a){let x=this.upstreamIds.next("session/request_permission"),f=a.params??{},h=f.sessionId,_=h?e.activeTriggers.get(h):void 0,v={cozeAgentId:e.agentId};_&&(v.cozeTriggerMsgId=_);let b=h?this.reverseSessionId(e,h):void 0,y={...f,...b?{sessionId:b}:{},_meta:v};this.pendingUpstream.set(x,{agentRequestId:a.id,agentId:e.agentId,downstream:o,method:a.method}),this.upstream.send(Et(x,"session/request_permission",y)).catch(A=>{this.pendingUpstream.delete(x),j.error("forward permission request failed",{agentId:e.agentId,err:String(A)}),o.respondAgentRequestError(a.id,{code:G.INTERNAL_ERROR,message:`upstream send failed: ${String(A)}`})})}handleUpstreamResponse(e){if(e.id===null)return;let o=this.pendingUpstream.get(e.id);if(o){this.pendingUpstream.delete(e.id),e.error?o.downstream.respondAgentRequestError(o.agentRequestId,e.error):o.downstream.respondAgentRequest(o.agentRequestId,e.result);return}let a=this.pendingBridge.get(e.id);if(a){this.pendingBridge.delete(e.id),clearTimeout(a.timer),e.error?a.reject(new $t(e.error)):a.resolve(e.result);return}j.debug("orphan upstream response (no pending)",{id:e.id})}sendRequest(e,o,a=tx){let x=this.upstreamIds.next(e);return new Promise((f,d)=>{let h=setTimeout(()=>{this.pendingBridge.delete(x),d(new C("AGENT_TIMEOUT",`${e} timed out after ${a}ms`))},a);this.pendingBridge.set(x,{method:e,resolve:f,reject:d,timer:h}),this.upstream.send(Et(x,e,o)).catch(_=>{let v=this.pendingBridge.get(x);v&&(clearTimeout(v.timer),this.pendingBridge.delete(x)),d(_)})})}async persistSessionMapping(e){if(this.paths)try{let o=new Map;for(let[a,x]of e.sessions){let f={modelToken:x.modelToken,tokenGeneratedAt:x.tokenGeneratedAt};x.acpSessionId&&(f.acpSessionId=x.acpSessionId),o.set(a,f)}await ar(e.agentId,o,this.paths)}catch(o){j.warn("persist session mapping failed",{agentId:e.agentId,err:String(o)})}}reverseSessionId(e,o){for(let[a,x]of e.sessions.entries())if(x.acpSessionId===o)return a}sendError(e,o,a){return this.upstream.send(Ve(e,{code:o,message:a}))}};function rx(){return ex(16).toString("hex")}K();se();import{randomBytes as sx}from"node:crypto";import{chmod as ix,mkdir as ox,writeFile as $s}from"node:fs/promises";import{createServer as ax}from"node:http";import{dirname as xx}from"node:path";var cx=1e6,fr=B("ipc"),un=class{server=null;port=0;token="";routes;paths;constructor(e){this.routes=new Map(e.routes.map(o=>[`${o.method} ${o.path}`,o])),this.paths=e.paths??H()}async start(){this.token=sx(32).toString("hex");let e=ax((a,x)=>{this.dispatch(a,x)});this.server=e,await new Promise((a,x)=>{e.once("error",x),e.listen(0,"127.0.0.1",()=>a())});let o=e.address();if(!o||typeof o!="object")throw new Error("failed to obtain IPC port");return this.port=o.port,await this.persistAuthFiles(),fr.info("IPC listening",{port:this.port}),{port:this.port,token:this.token}}async stop(){let e=this.server;e&&(await new Promise((o,a)=>{e.close(x=>x?a(x):o())}),this.server=null)}async persistAuthFiles(){await ox(xx(this.paths.portFile),{recursive:!0}),await $s(this.paths.portFile,String(this.port),"utf8"),await $s(this.paths.tokenFile,this.token,{encoding:"utf8",mode:384});try{await ix(this.paths.tokenFile,384)}catch(e){fr.warn("chmod token file failed (non-POSIX?)",{err:String(e)})}}async dispatch(e,o){if(e.headers.authorization!==`Bearer ${this.token}`){Dt(o,401,{error:"unauthorized"});return}let x=`${e.method} ${(e.url??"").split("?")[0]}`,f=this.routes.get(x);if(!f){Dt(o,404,{error:"not found"});return}let d=null;if(e.method==="POST")try{d=await fx(e)}catch(h){Dt(o,400,{error:"invalid json",detail:String(h)});return}try{let h=await f.handler(d,e);Dt(o,200,h??{ok:!0})}catch(h){fr.error("IPC handler failed",{key:x,err:String(h)}),Dt(o,500,{error:h instanceof Error?h.message:String(h)})}}};function Dt(r,e,o){r.statusCode=e,r.setHeader("content-type","application/json"),r.end(JSON.stringify(o))}async function fx(r){let e=[],o=0;for await(let x of r){let f=x;if(o+=f.length,o>cx)throw new Error("body too large");e.push(f)}let a=Buffer.concat(e).toString("utf8");return a?JSON.parse(a):null}var Co=Pe(ci(),1);var jc=Pe(so(),1),Wc=Pe(kn(),1),Jc=Pe(dt(),1),Vc=Pe(Sr(),1),Xc=Pe(Ar(),1),Yc=Pe(Ir(),1),ho=Pe(Tn(),1),Zc=Pe(lo(),1);var go=ho.default;K();var Nn="1008033",po="1289";var mo="pbbp2",_o="https://www.coze.cn",wo="/api/coze_claw/resource/get_frontier_key",$c="https://www.coze.cn",Qc="wss://frontier.coze.cn";function yo(r){return r??process.env.COZE_BRIDGE_HANDSHAKE_URL??$c}function vo(r){return r??process.env.COZE_BRIDGE_FRONTIER_URL??Qc}function Rn(r){let e={},o=r?.ttEnv??process.env.COZE_BRIDGE_TT_ENV,a=r?.usePpe??process.env.COZE_BRIDGE_USE_PPE;return o&&(e["x-tt-env"]=o),a&&(e["x-use-ppe"]=a),e}var ee=B("upstream.frontier"),So="application/json",Eo="none",Bn=class{constructor(e){this.opts=e}opts;fws=null;handler=null;connectHandler=null;opened=!1;openCount=0;async start(){if(this.fws){ee.warn("start called on already-started FrontierUpstream; noop");return}let e={Authorization:`Bearer ${this.opts.privatecode}`,Origin:_o,...Rn(this.opts.ppeOverride)};class o extends go{constructor(h){super(h,mo,{headers:e})}send(h,..._){if(Ss("debug"))try{let v;typeof h=="string"?v=Buffer.from(h,"utf8"):h instanceof Buffer?v=h:h instanceof ArrayBuffer?v=new Uint8Array(h):ArrayBuffer.isView(h)?v=new Uint8Array(h.buffer,h.byteOffset,h.byteLength):v=new Uint8Array(0);let b=Buffer.from(v.slice(0,128)).toString("hex");ee.debug("WS raw frame out",{bytes:v.byteLength,headHex:b})}catch(v){ee.warn("WS raw frame dump failed",{err:String(v)})}super.send(h,..._)}}let a=vo(this.opts.urlOverride),x={url:a,ws:o,fpID:po,aID:Nn,accessKey:this.opts.handshake.accessKey,deviceID:this.opts.handshake.deviceId,payloadType:{type:So,force:!0},payloadEncoding:{encoding:Eo,force:!0},enableTransformTextPayload:!0,enableQoS:!1,enableAutoAck:!1,automaticOpen:!1,debug:this.opts.debug??!1},f=new Co.FWS(x);f.onopen=()=>{this.opened=!0,this.openCount+=1;let d=this.openCount===1;ee.info("frontier opened",{url:a,remoteDeviceId:this.opts.handshake.deviceId,initial:d,openCount:this.openCount}),this.connectHandler&&Promise.resolve(this.connectHandler({initial:d})).catch(h=>ee.warn("onConnect handler threw (ignored)",{err:String(h)}))},f.onclose=d=>{this.opened=!1,ee.info("frontier closed",{code:d.code,reason:d.reason,willReconnect:d.willReconnect})},f.onerror=d=>{ee.warn("frontier error",{code:d.code,msg:d.message})},f.onmessage=d=>this.handleMessage(d),this.fws=f,await f.connect()}async stop(e){let o=this.fws;if(o){this.fws=null,this.opened=!1;try{o.close(1e3,e??"bridge shutdown")}catch(a){ee.warn("frontier close threw (ignored)",{err:String(a)})}}}async send(e){let o=this.fws;if(!o)throw new C("UPSTREAM_DISCONNECTED","frontier upstream not started");let a=JSON.stringify(e),x=e;ee.info("frontier frame out",{method:x.method,jsonrpcId:x.id,size:a.length});try{await o.send(a,{service:33555712,method:1,payloadType:So,payloadEncoding:Eo})}catch(f){throw new C("UPSTREAM_DISCONNECTED",`frontier send failed: ${String(f)}`,{cause:f})}}onFrame(e){this.handler=e}onConnect(e){this.connectHandler=e}isConnected(){return this.opened&&this.fws?.readyState===1}handleMessage(e){let o=e.message?.service;if(o!==33555712){ee.debug("drop non-adapter frontier frame",{service:o});return}let a=nf(e);if(!a){ee.debug("frontier message without text payload, drop",{payloadType:e.message?.payloadType});return}if(!this.handler){ee.debug("frame received but no onFrame handler",{size:a.length});return}let x;try{x=JSON.parse(a)}catch(f){ee.warn("frontier message JSON parse failed",{err:String(f),head:a.slice(0,80)});return}ee.info("frontier frame in",{logid:tf(e.message?.LogID),logidNew:e.message?.LogIDNew,msgId:e.message?.msgID,jsonrpcId:x.id}),Promise.resolve(this.handler(x)).catch(f=>ee.warn("frontier frame handler threw",{err:String(f)}))}};function tf(r){return r?r.high===0?String(r.low>>>0):`${r.high.toString(16)}${(r.low>>>0).toString(16).padStart(8,"0")}`:""}function nf(r){let e=r.message;if(e?.textPayload)return e.textPayload;let o=e?.payload;if(!o)return null;try{return Buffer.from(o).toString("utf8")}catch{return null}}K();function ko(r){return r?r.startsWith("boe_")?{ttEnv:r}:{ttEnv:r,usePpe:"1"}:{}}var Ao=B("handshake");async function Do(r){let e=yo(r.endpoint),o=r.timeoutMs??1e4,a=`${rf(e)}${wo}?aid=${encodeURIComponent(Nn)}`,x={Authorization:`Bearer ${r.privatecode}`,Accept:"application/json",...Rn(r.ppeOverride)},f=new AbortController,d=setTimeout(()=>f.abort(),o);Ao.info("frontier key handshake",{base:e});try{let h=await fetch(a,{method:"GET",headers:x,signal:f.signal}),_=h.headers.get("x-tt-logid")??"",v=h.headers.get("x-tt-trace-id")??"";if(!h.ok){let L=await h.text().catch(()=>"");throw new C("UPSTREAM_HANDSHAKE_FAILED",`handshake HTTP ${h.status} logid=${_}: ${L.slice(0,200)}`)}let b=await h.json();if(b.code!==void 0&&b.code!==0)throw new C("UPSTREAM_HANDSHAKE_FAILED",`handshake code=${b.code} msg=${b.msg??"-"} logid=${_}`);let y=b.data?.access_key,A=b.data?.device_id;if(!y||!A)throw new C("UPSTREAM_HANDSHAKE_FAILED",`handshake response missing access_key/device_id logid=${_}: ${JSON.stringify(b)}`);return Ao.info("handshake ok",{remoteDeviceId:A,logid:_,traceId:v}),{accessKey:y,deviceId:A}}catch(h){throw h instanceof C?h:h.name==="AbortError"?new C("UPSTREAM_HANDSHAKE_FAILED",`handshake timeout (${o}ms)`):new C("UPSTREAM_HANDSHAKE_FAILED",String(h),{cause:h})}finally{clearTimeout(d)}}function rf(r){return r.endsWith("/")?r.slice(0,-1):r}K();var Rr=B("upstream.switchable"),On=class{inner;handler=null;connectHandler=null;constructor(e){this.inner=e}async swap(e,o){if(this.inner===e)return;Rr.info("swap upstream",{reason:o});let a=this.inner;this.inner=e,this.handler&&e.onFrame(this.handler),this.connectHandler&&e.onConnect&&e.onConnect(this.connectHandler);try{await e.start()}catch(x){throw Rr.error("swap target start failed, reverting",{err:String(x)}),this.inner=a,x}await a.stop(o??"swapped").catch(x=>Rr.warn("previous upstream stop threw (ignored)",{err:String(x)}))}current(){return this.inner}start(){return this.inner.start()}stop(e){return this.inner.stop(e)}send(e){return this.inner.send(e)}onFrame(e){this.handler=e,this.inner.onFrame(e)}onConnect(e){this.connectHandler=e,this.inner.onConnect?.(e)}isConnected(){return this.inner.isConnected()}};K();var Br=B("upstream"),Mt=class{handler=null;async start(){Br.info("NoopUpstream started (M1 skeleton; real Frontier wired in M4)")}async stop(e){Br.info("NoopUpstream stopped",{reason:e})}async send(e){Br.debug("NoopUpstream.send (dropped)",{method:"method"in e?e.method:void 0})}onFrame(e){this.handler=e}isConnected(){return!1}async injectFrame(e){this.handler&&await this.handler(e)}};K();se();K();se();import{execSync as sf}from"node:child_process";import{readFileSync as Po,unlinkSync as of}from"node:fs";import{mkdir as af,readFile as Lo,unlink as To,writeFile as xf}from"node:fs/promises";import{dirname as cf}from"node:path";var ff=B("single-instance"),Mn=class{pidFile;acquired=!1;constructor(e={}){this.pidFile=e.pidFile??H().pidFile,e.processTitle&&(process.title=e.processTitle)}async acquire(){let e=await this.readExistingPid();return e!==null&&this.isAlive(e)?{kind:"already-running",pid:e}:(e!==null&&(ff.warn("removing stale pid file",{stalePid:e}),await To(this.pidFile).catch(()=>{})),await af(cf(this.pidFile),{recursive:!0}),await xf(this.pidFile,String(process.pid),"utf8"),this.acquired=!0,this.installCleanupHooks(),{kind:"acquired"})}async release(){if(this.acquired){try{(await Lo(this.pidFile,"utf8")).trim()===String(process.pid)&&await To(this.pidFile)}catch{}this.acquired=!1}}async readExistingPid(){try{let e=await Lo(this.pidFile,"utf8"),o=Number.parseInt(e.trim(),10);return Number.isFinite(o)&&o>0?o:null}catch(e){if(e.code==="ENOENT")return null;throw e}}isAlive(e){try{process.kill(e,0)}catch(o){return o.code==="EPERM"}return this.matchesDaemonTitle(e)}matchesDaemonTitle(e){try{let o=Po(`/proc/${e}/cmdline`,"utf8").replace(/\0/g," ");return!!(o.includes("coze-bridge-daemon")||o.includes("lib/index.js"))}catch{}try{let o=sf(`ps -o command= -p ${e}`,{stdio:["ignore","pipe","ignore"],timeout:1e3}).toString();return o.trim()?o.includes("coze-bridge-daemon")||o.includes("lib/index.js"):!1}catch{return!0}}installCleanupHooks(){process.once("exit",()=>{if(this.acquired)try{Po(this.pidFile,"utf8").trim()===String(process.pid)&&of(this.pidFile)}catch{}})}};var M=B("daemon"),uf="coze-bridge-daemon";async function Ro(){let r=new Mn({processTitle:uf}),e=await r.acquire();if(e.kind==="already-running")throw new Error(`coze-bridge daemon already running (pid=${e.pid})`);let o=await cn(),a=o??{};or({pid:process.pid}),M.info(o?"loaded bridge config":"initialized bridge config");try{let P=new At;a.frameworksCache=await P.detectAll(),M.info("refreshed frameworks_cache",{detected:Object.keys(a.frameworksCache)})}catch(P){M.warn("framework detection failed",{err:String(P)})}await kt(a);let x=new On(new Mt),f=H(),d=null,h=new fn({upstream:x,paths:f,bridgeConfig:a,sessionSpawner:async(P,z)=>{if(!d)throw new Error("agentManager not ready");return d.spawnSessionDownstream(P,z)}});await lf(f,h);let _=new xn({paths:f,config:a,registry:h});d=_;let v,b,y=null,A=null;h.registerExtension("_agent/create",async P=>_.createAgent(P.params)),h.registerExtension("_agent/health",async()=>({ok:!0}));let L=new Vt({agents:h.agents,disposeAndMarkDisconnected:async(P,z)=>{let Z=h.agents.get(P);Z&&(await Z.dispose(`disconnect: ${z}`).catch(pe=>M.warn("dispose during disconnect failed (ignored)",{agentId:P,err:String(pe)})),Z.status="disconnected",h.unregister(P)),h.disconnectedAgents.add(P)}});h.registerExtension("_agent/listSkills",P=>L.listSkills(P.params)),h.registerExtension("_agent/addSkills",P=>L.addSkills(P.params)),h.registerExtension("_agent/removeSkills",P=>L.removeSkills(P.params)),h.registerExtension("_agent/getFileTree",P=>L.getFileTree(P.params)),h.registerExtension("_agent/getFileContent",P=>L.getFileContent(P.params)),h.registerExtension("_agent/update",P=>L.updateAgent(P.params)),h.registerExtension("_agent/disconnect",P=>L.disconnectAgent(P.params)),h.registerExtension("_agent/switchModel",P=>L.switchModel(P.params));let T=new Jt({paths:f,handlers:L,sendDetail:P=>h.sendRequest("_agent/detail",P)});x.onConnect(({initial:P})=>{M.info("frontier upstream connected, triggering detail sync",{initial:P}),T.syncAll(P?"initial-connect":"reconnect").catch(z=>M.warn("detail sync top-level error (ignored)",{err:String(z)}))});let R=new un({paths:f,routes:[{method:"GET",path:"/status",handler:async()=>({running:!0,pid:process.pid,agents:[...h.agents.keys()],deviceId:y??"",frameworksCache:a.frameworksCache??{}})},{method:"POST",path:"/pair",handler:async P=>{let z=P,Z=z?.privatecode,pe=z?.pairing_code;if(!Z||!pe)throw new C("IPC_BAD_REQUEST","/pair requires privatecode + pairing_code");let ke=ko(z.env),me=z.handshake_url,de=z.frontier_url,je=df(z.env,me,de),zt=!!v&&v!==Z,qt=b!==void 0&&b!==je,_e=zt||qt;if(_e){M.warn("pair config switched, resetting agents",{pcChanged:zt,envChanged:qt,previousPc:v?Io(v):"",nextPc:Io(Z),previousEnvKey:b??"",nextEnvKey:je});for(let ye of[...h.agents.values()])await ye.dispose("pair config switch").catch(()=>{}),h.agents.delete(ye.agentId);await x.swap(new Mt,"pair switch").catch(()=>{})}let we=await Do({privatecode:Z,...me?{endpoint:me}:{},ppeOverride:ke});y=we.deviceId,or({deviceId:y,pid:process.pid});let jn=new Bn({handshake:we,privatecode:Z,...de?{urlOverride:de}:{},ppeOverride:ke});await x.swap(jn,"pair");let ne=Object.keys(a.frameworksCache??{});try{let ye=await h.sendRequest("_agent/pair",{pairCode:pe,patToken:Z,frameworks:ne,_meta:{cozeDeviceId:y}});M.info("_agent/pair ok",{pairResult:ye}),v=Z,b=je,A||(A=new Yt({core:h,getDeviceId:()=>y??""})),A.start(),_e&&No(f,_).catch(q=>M.warn("post-pair-switch auto-revive error (ignored)",{err:String(q)}));let V;return z.agent_id&&(V=await hf(z.agent_id,f,_,q=>h.sendRequest("_agent/detail",q)).catch(q=>(M.error("--agent-id ensureAgent failed",{agentId:z.agent_id,err:String(q)}),{ok:!1,agentId:z.agent_id??"",note:String(q)}))),{ok:!0,note:"paired with cloud",...V?{agent:V}:{}}}catch(ye){return M.error("_agent/pair failed",{err:String(ye)}),{ok:!1,note:`pair failed: ${String(ye)}`}}}},{method:"POST",path:"/_agent/create",handler:async P=>{let z=P;return{ok:!0,result:await _.createAgent(z)}}},{method:"POST",path:"/refresh",handler:async()=>{M.info("IPC /refresh: re-detecting frameworks");let P=new At;return a.frameworksCache=await P.detectAll(),await kt(a),{ok:!0,frameworks:a.frameworksCache}}},{method:"POST",path:"/shutdown",handler:async()=>(M.info("IPC /shutdown received"),setImmediate(()=>{Ae.shutdown("ipc /shutdown")}),{ok:!0})}]}),{port:U,token:$}=await R.start();await h.start(),No(f,_).catch(P=>M.warn("auto-revive top-level error (ignored)",{err:String(P)}));let te=null,Ae={port:U,token:$,core:h,ipc:R,shutdown(P){return te||(M.info("daemon shutdown",{reason:P}),te=(async()=>{A?.stop(),await h.stop(P),await R.stop(),await r.release()})(),te)}};for(let P of["SIGTERM","SIGINT"])process.on(P,()=>{Ae.shutdown(P).then(()=>process.exit(0))});return M.info("daemon ready",{port:U,pid:process.pid,nodeVersion:process.version,platform:process.platform,frameworks:Object.keys(a.frameworksCache??{}),libVersion:a.libVersion??"dev"}),Ae}function Io(r){return r.length<=8?"***":`${r.slice(0,4)}***${r.slice(-4)}`}function df(r,e,o){return`${r??""}|${e??""}|${o??""}`}async function lf(r,e){let{readdir:o}=await import("node:fs/promises"),a;try{a=await o(r.agentsRoot)}catch{return}let{loadAgentConfig:x,enforceAgentConfigMode:f}=await Promise.resolve().then(()=>(qe(),Wt));for(let d of a){await f(d,r).catch(h=>M.warn("enforceAgentConfigMode failed (ignored)",{agentId:d,err:String(h)}));try{let h=await x(d,r);h?.disconnectedAt&&(e.disconnectedAgents.add(d),M.info("agent marked disconnected on startup",{agentId:d,disconnectedAt:h.disconnectedAt,reason:h.disconnectReason??""}))}catch(h){M.warn("failed to load agent config on startup, skipping",{agentId:d,err:String(h)})}}}async function hf(r,e,o,a){let{loadAgentConfig:x}=await Promise.resolve().then(()=>(qe(),Wt)),f=await x(r,e);if(f){M.info("--agent-id: local config found, reconnecting",{agentId:r,framework:f.framework,hadDisconnect:!!f.disconnectedAt});let v={agentId:f.agentId,framework:f.framework,...f.cozeIdentity?{cozeIdentity:f.cozeIdentity}:{},...f.model?{model:f.model}:{}};return await o.createAgent(v),{ok:!0,agentId:r,note:f.disconnectedAt?"revived from local config":"connected from local config"}}M.info("--agent-id: local config missing, pulling _agent/detail from cloud",{agentId:r});let d=await a({_meta:{cozeAgentId:r}});if(!d.framework)throw new C("AGENT_NOT_FOUND",`agent ${r} \u4E0D\u5728\u672C\u5730; \u4E91\u7AEF _agent/detail \u54CD\u5E94\u7F3A framework \u5B57\u6BB5 (D36 \u534F\u8BAE\u6269\u5C55\u672A\u751F\u6548), \u65E0\u6CD5\u5728\u672C\u673A\u65B0\u5EFA`);let h={agentId:d.agentId,framework:d.framework,...d.cozeIdentity?{cozeIdentity:d.cozeIdentity}:{},...d.model?{model:d.model}:{},...d.deployType?{_meta:{cozeDeployType:d.deployType}}:{}};await o.createAgent(h);let _=d.deployType==="cloud"&&d.framework==="openclaw";return{ok:!0,agentId:r,note:_?"cloud agent acknowledged":"created from cloud detail"}}async function No(r,e){let{readdir:o}=await import("node:fs/promises"),a;try{a=await o(r.agentsRoot)}catch{return{revived:0,skipped:0,total:0}}if(a.length===0)return{revived:0,skipped:0,total:0};let{loadAgentConfig:x}=await Promise.resolve().then(()=>(qe(),Wt));M.info("auto-revive: scanning local agents on startup",{count:a.length});let f=0,d=0;for(let h of a){let _;try{_=await x(h,r)}catch(v){M.warn("auto-revive: load config failed (skipping)",{agentId:h,err:String(v)}),d+=1;continue}if(!_){d+=1;continue}if(_.disconnectedAt){M.info("auto-revive: skip disconnected agent",{agentId:h,disconnectedAt:_.disconnectedAt}),d+=1;continue}try{M.info("auto-revive: re-registering agent (D44 no spawn)",{agentId:h,framework:_.framework}),await e.createAgent({agentId:_.agentId,framework:_.framework,..._.cozeIdentity?{cozeIdentity:_.cozeIdentity}:{},..._.model?{model:_.model}:{},..._.deployType?{_meta:{cozeDeployType:_.deployType}}:{}}),f+=1}catch(v){M.warn("auto-revive: createAgent failed (skipping)",{agentId:h,framework:_.framework,err:String(v)}),d+=1}}return M.info("auto-revive: done",{revived:f,skipped:d,total:a.length}),{revived:f,skipped:d,total:a.length}}Mr();se();import{readFile as Oo}from"node:fs/promises";var Ge=class{paths;constructor(e){this.paths=e??H()}async probe(e=1e3){let o=await this.readAuth();if(!o)return{kind:"not-running"};try{let a=await this.fetch(o,{method:"GET",path:"/status",timeoutMs:e});return a.status===200?{kind:"connected",...o}:{kind:"stale",reason:`unexpected status ${a.status}`}}catch(a){return{kind:"stale",reason:Sf(a)}}}async request(e){let o=await this.readAuth();if(!o)throw new Error("coze-bridge daemon not running (no port/token files)");return this.fetch(o,e)}async readAuth(){try{let[e,o]=await Promise.all([Oo(this.paths.portFile,"utf8"),Oo(this.paths.tokenFile,"utf8")]),a=Number.parseInt(e.trim(),10),x=o.trim();return!Number.isFinite(a)||a<=0||!x?null:{port:a,token:x}}catch(e){if(e.code==="ENOENT")return null;throw e}}async fetch(e,o){let a=o.body!==void 0,x={Authorization:`Bearer ${e.token}`};a&&(x["content-type"]="application/json");let f=new AbortController,d=setTimeout(()=>f.abort(),o.timeoutMs??5e3);try{let h=await fetch(`http://127.0.0.1:${e.port}${o.path}`,{method:o.method,headers:x,body:a?JSON.stringify(o.body):void 0,signal:f.signal}),_=await h.text();return{status:h.status,body:bf(_)}}finally{clearTimeout(d)}}};function bf(r){if(!r)return null;try{return JSON.parse(r)}catch{return r}}function Sf(r){return r instanceof Error?r.message:String(r)}K();se();import{copyFile as Mo,mkdir as Ef,readFile as zr,writeFile as Cf}from"node:fs/promises";import{dirname as Af,resolve as qr,sep as zn}from"node:path";import{fileURLToPath as kf}from"node:url";K();se();var zo=B("dist-install");function Df(r){let e=kf(r),o=Af(e),a=`${zn}src${zn}`;if(o.includes(a)||o.endsWith(`${zn}src${zn}cli`))return null;let x=qr(o,"index.js"),f=qr(o,"..","package.json");return{dist:x,pkgJson:f}}async function qo(r={}){let e=r.paths??H(),o=Df(import.meta.url),a=r.sourceDist??o?.dist,x=r.sourcePackageJson??o?.pkgJson;if(!a||!x)return{kind:"dev-mode-skip",reason:"running from src/(tsx loader);no dist/ to install"};let f;try{f=JSON.parse(await zr(x,"utf8")).version??"unknown"}catch(y){return zo.warn("cannot read source package.json,skip dist install",{err:String(y)}),{kind:"dev-mode-skip",reason:`package.json read failed: ${String(y)}`}}let d=await cn(e.configFile)??{},h=d.libVersion;if(h===f)try{return await zr(e.libEntry),{kind:"already-current",libVersion:f}}catch{}await Ef(e.libDir,{recursive:!0}),await Mo(a,e.libEntry),await Mo(`${a}.map`,`${e.libEntry}.map`).catch(()=>{});let _=qr(e.libDir,"package.json"),v=`${JSON.stringify({type:"module"},null,2)}
|
|
92
|
+
`;return await zr(_,"utf8").catch(()=>null)!==v&&await Cf(_,v),d.libVersion=f,await kt(d,e.configFile),zo.info("dist installed",{libEntry:e.libEntry,fromVersion:h,toVersion:f}),h?{kind:"version-changed",fromVersion:h,toVersion:f,libEntry:e.libEntry}:{kind:"first-install",libVersion:f,libEntry:e.libEntry}}var Jf=B("cli");function _t(r,e){let o=[],a;for(let x=0;x<r.length;x++){let f=r[x];if(f===e){a=r[x+1],x+=1;continue}if(f.startsWith(`${e}=`)){a=f.slice(e.length+1);continue}o.push(f)}return{value:a,rest:o}}function Vf(r){let e=r.slice(2);if(e.includes("--daemon"))return{mode:"daemon"};if(e.includes("--status"))return{mode:"status"};if(e.includes("--stop"))return{mode:"stop"};if(e.includes("--refresh"))return{mode:"refresh"};if(e.includes("--uninstall"))return{mode:"uninstall"};if(e.includes("--install-service"))return{mode:"install-service"};if(e.includes("--help")||e.includes("-h")||e.length===0)return{mode:"help"};let o=e,{value:a,rest:x}=_t(o,"--pat-token");o=x;let{value:f,rest:d}=_t(o,"--pair-code");o=d;let{value:h,rest:_}=_t(o,"--env");o=_;let{value:v,rest:b}=_t(o,"--handshake-url");o=b;let{value:y,rest:A}=_t(o,"--frontier-url");o=A;let{value:L}=_t(o,"--agent-id");if(!a||!f)return{mode:"help"};let T={mode:"pair",privatecode:a,pairingCode:f};return h&&(T.env=h),v&&(T.handshakeUrl=v),y&&(T.frontierUrl=y),L&&(T.agentId=L),T}var Xf=`
|
|
92
93
|
coze-bridge - local bridge daemon for cloud Agent Service
|
|
93
94
|
|
|
94
95
|
Usage:
|
|
@@ -115,34 +116,35 @@ Auto-connect agent (optional):
|
|
|
115
116
|
|
|
116
117
|
Internal:
|
|
117
118
|
<node> <entry> --daemon daemon mode (OS supervisor only)
|
|
118
|
-
`.trimStart();async function
|
|
119
|
-
`),1;if(
|
|
120
|
-
`),1;let
|
|
121
|
-
${JSON.stringify(
|
|
122
|
-
`),0}async function
|
|
123
|
-
`),0;
|
|
124
|
-
`),0
|
|
125
|
-
`),
|
|
119
|
+
`.trimStart();async function jo(r=process.argv,e={}){let o=Vf(r);switch(o.mode){case"help":return process.stdout.write(Xf),0;case"daemon":{try{await Ro()}catch(a){return Jf.error("daemon start failed",{err:String(a)}),1}return new Promise(()=>{})}case"status":return Yf(e);case"stop":return Zf(e);case"refresh":return $f(e);case"uninstall":return Qf(e);case"install-service":return eu();case"pair":{let a={};return o.env&&(a.env=o.env),o.handshakeUrl&&(a.handshakeUrl=o.handshakeUrl),o.frontierUrl&&(a.frontierUrl=o.frontierUrl),tu(o.privatecode,o.pairingCode,e,a,o.agentId)}}}async function Wo(r){let{unlink:e}=await import("node:fs/promises");await Promise.all([e(r.pidFile).catch(()=>{}),e(r.portFile).catch(()=>{}),e(r.tokenFile).catch(()=>{})])}async function Yf(r){let e=r.paths??H(),o=new Ge(e),a=await o.probe();if(a.kind==="not-running")return process.stdout.write(`coze-bridge: not running
|
|
120
|
+
`),1;if(a.kind==="stale")return await Wo(e),process.stdout.write(`coze-bridge: not running (cleaned stale state)
|
|
121
|
+
`),1;let x=await o.request({method:"GET",path:"/status"});return process.stdout.write(`coze-bridge: running
|
|
122
|
+
${JSON.stringify(x.body,null,2)}
|
|
123
|
+
`),0}async function Zf(r){let e=r.paths??H(),o=new Ge(e),a=await o.probe();if(a.kind==="not-running")return process.stdout.write(`coze-bridge: not running
|
|
124
|
+
`),0;if(a.kind==="stale")return await Wo(e),process.stdout.write(`coze-bridge: not running (cleaned stale state)
|
|
125
|
+
`),0;try{return await o.request({method:"POST",path:"/shutdown"}),process.stdout.write(`coze-bridge: stopped
|
|
126
|
+
`),0}catch(x){return process.stdout.write(`coze-bridge: stop failed: ${String(x)}
|
|
127
|
+
`),1}}async function $f(r){let e=new Ge(r.paths);if((await e.probe()).kind==="not-running")return process.stdout.write(`coze-bridge: not running (start daemon first)
|
|
126
128
|
`),1;try{let a=await e.request({method:"POST",path:"/refresh"});return a.status===200?(process.stdout.write(`coze-bridge: refreshed
|
|
127
129
|
${JSON.stringify(a.body,null,2)}
|
|
128
130
|
`),0):(process.stderr.write(`coze-bridge: refresh failed: ${JSON.stringify(a.body)}
|
|
129
131
|
`),1)}catch(a){return process.stderr.write(`coze-bridge: refresh failed: ${String(a)}
|
|
130
|
-
`),1}}async function
|
|
132
|
+
`),1}}async function Qf(r){let e=new Ge(r.paths);if((await e.probe()).kind==="connected"){process.stdout.write(`coze-bridge: stopping daemon...
|
|
131
133
|
`);try{await e.request({method:"POST",path:"/shutdown"})}catch(f){process.stderr.write(`coze-bridge: stop failed (continuing): ${String(f)}
|
|
132
|
-
`)}await new Promise(f=>setTimeout(f,500))}if(!r.skipSupervisor)try{let{getSupervisor:f,buildContext:
|
|
134
|
+
`)}await new Promise(f=>setTimeout(f,500))}if(!r.skipSupervisor)try{let{getSupervisor:f,buildContext:d}=await Promise.resolve().then(()=>(Wr(),jr)),h=f();await h.uninstall(d()),process.stdout.write(`coze-bridge: ${h.platform} supervisor unregistered
|
|
133
135
|
`)}catch(f){process.stderr.write(`coze-bridge: supervisor uninstall failed (continuing): ${String(f)}
|
|
134
|
-
`)}let a=r.paths??
|
|
136
|
+
`)}let a=r.paths??H(),{rm:x}=await import("node:fs/promises");try{await x(a.cozeRoot,{recursive:!0,force:!0}),process.stdout.write(`coze-bridge: removed ${a.cozeRoot}
|
|
135
137
|
`)}catch(f){return process.stderr.write(`coze-bridge: remove failed: ${String(f)}
|
|
136
138
|
`),1}return process.stdout.write(`coze-bridge: uninstalled
|
|
137
|
-
`),0}async function
|
|
138
|
-
`),await
|
|
139
|
+
`),0}async function eu(){try{let{getSupervisor:r,buildContext:e}=await Promise.resolve().then(()=>(Wr(),jr)),o=r(),a=e();return process.stdout.write(`coze-bridge: installing ${o.platform} supervisor...
|
|
140
|
+
`),await o.install(a),process.stdout.write(`coze-bridge: supervisor installed (daemon will auto-start on login)
|
|
139
141
|
`),0}catch(r){return process.stderr.write(`coze-bridge: --install-service failed: ${String(r)}
|
|
140
|
-
`),1}}async function
|
|
141
|
-
`),(await f.probe()).kind==="connected"&&(await f.request({method:"POST",path:"/shutdown"}).catch(()=>{}),await new Promise(y=>setTimeout(y,500)))):
|
|
142
|
-
`)}let
|
|
143
|
-
`),await
|
|
144
|
-
`),1;let
|
|
145
|
-
`),0):(process.stderr.write(`coze-bridge: pair failed: ${JSON.stringify(
|
|
146
|
-
`),1)}catch(
|
|
147
|
-
`),1}}async function
|
|
142
|
+
`),1}}async function tu(r,e,o,a={},x){let f=new Ge(o.paths),d=o.spawnDaemon??Bo;if(!o.skipDistInstall){let v=await qo({paths:o.paths});v.kind==="version-changed"?(process.stdout.write(`coze-bridge: upgraded ${v.fromVersion} \u2192 ${v.toVersion}
|
|
143
|
+
`),(await f.probe()).kind==="connected"&&(await f.request({method:"POST",path:"/shutdown"}).catch(()=>{}),await new Promise(y=>setTimeout(y,500)))):v.kind==="first-install"&&process.stdout.write(`coze-bridge: installed ${v.libVersion}
|
|
144
|
+
`)}let h=await f.probe();if(h.kind!=="connected"&&(process.stdout.write(`coze-bridge: starting daemon...
|
|
145
|
+
`),await d({paths:o.paths}),h=await nu(f,o.waitTimeoutMs??1e4,o.sleep??ru),h.kind!=="connected"))return process.stderr.write(`coze-bridge: daemon did not come up: ${h.kind}
|
|
146
|
+
`),1;let _={privatecode:r,pairing_code:e};a.env&&(_.env=a.env),a.handshakeUrl&&(_.handshake_url=a.handshakeUrl),a.frontierUrl&&(_.frontier_url=a.frontierUrl),x&&(_.agent_id=x);try{let v=await f.request({method:"POST",path:"/pair",body:_,timeoutMs:35e3});return v.status===200&&v.body?.ok?(process.stdout.write(`coze-bridge: paired (${v.body.note??"ok"})
|
|
147
|
+
`),0):(process.stderr.write(`coze-bridge: pair failed: ${JSON.stringify(v.body)}
|
|
148
|
+
`),1)}catch(v){return process.stderr.write(`coze-bridge: pair failed: ${String(v)}
|
|
149
|
+
`),1}}async function nu(r,e,o){let a=Date.now()+e;for(;Date.now()<a;){let x=await r.probe(500);if(x.kind==="connected")return x;await o(200)}return r.probe(500)}function ru(r){return new Promise(e=>setTimeout(e,r))}jo(process.argv).then(r=>process.exit(r),r=>{process.stderr.write(`fatal: ${r instanceof Error?r.stack??r.message:String(r)}
|
|
148
150
|
`),process.exit(1)});
|