coze-bridge 0.1.7 → 0.1.8

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.
Files changed (2) hide show
  1. package/dist/index.js +38 -37
  2. 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 R0=Object.create;var xr=Object.defineProperty;var O0=Object.getOwnPropertyDescriptor;var B0=Object.getOwnPropertyNames;var M0=Object.getPrototypeOf,z0=Object.prototype.hasOwnProperty;var Z=(r=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(r,{get:(e,i)=>(typeof require<"u"?require:e)[i]}):r)(function(r){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+r+'" is not supported')});var Pe=(r,e)=>()=>(r&&(e=r(r=0)),e);var ae=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),ys=(r,e)=>{for(var i in e)xr(r,i,{get:e[i],enumerable:!0})},q0=(r,e,i,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let x of B0(e))!z0.call(r,x)&&x!==i&&xr(r,x,{get:()=>e[x],enumerable:!(a=O0(e,x))||a.enumerable});return r};var Ie=(r,e,i)=>(i=r!=null?R0(M0(r)):{},q0(e||!r||!r.__esModule?xr(i,"default",{value:r,enumerable:!0}):i,r));import{chmod as F0,mkdir as U0,readFile as K0,writeFile as H0}from"node:fs/promises";import{dirname as W0}from"node:path";async function Wt(r){try{let e=await K0(r,"utf8");return JSON.parse(e)}catch(e){if(e.code==="ENOENT")return null;throw e}}async function jt(r,e,i){await U0(W0(r),{recursive:!0}),await H0(r,`${JSON.stringify(e,null,2)}
9
- `,"utf8"),i?.mode!==void 0&&await F0(r,i.mode)}var cr=Pe(()=>{"use strict"});function Ss(r){return Jt[vs]<=Jt[r]}function fr(r){bs={...r}}function Gt(r,e,i,a){if(Jt[r]<Jt[vs])return;let x=JSON.stringify({ts:new Date().toISOString(),level:r,module:e,msg:i,...bs,...a});r==="error"||r==="warn"?G0.write(`${x}
10
- `):j0.write(`${x}
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 B0=Object.create;var sr=Object.defineProperty;var z0=Object.getOwnPropertyDescriptor;var q0=Object.getOwnPropertyNames;var F0=Object.getPrototypeOf,U0=Object.prototype.hasOwnProperty;var X=(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 oe=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),ms=(r,e)=>{for(var o in e)sr(r,o,{get:e[o],enumerable:!0})},H0=(r,e,o,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let x of q0(e))!U0.call(r,x)&&x!==o&&sr(r,x,{get:()=>e[x],enumerable:!(a=z0(e,x))||a.enumerable});return r};var Pe=(r,e,o)=>(o=r!=null?B0(F0(r)):{},H0(e||!r||!r.__esModule?sr(o,"default",{value:r,enumerable:!0}):o,r));import{chmod as K0,mkdir as j0,readFile as W0,writeFile as G0}from"node:fs/promises";import{dirname as J0}from"node:path";async function qt(r){try{let e=await W0(r,"utf8");return JSON.parse(e)}catch(e){if(e.code==="ENOENT")return null;throw e}}async function Ft(r,e,o){await j0(J0(r),{recursive:!0}),await G0(r,`${JSON.stringify(e,null,2)}
9
+ `,"utf8"),o?.mode!==void 0&&await K0(r,o.mode)}var ir=De(()=>{"use strict"});function ys(r){return Ht[_s]<=Ht[r]}function or(r){ws={...r}}function Ut(r,e,o,a){if(Ht[r]<Ht[_s])return;let x=JSON.stringify({ts:new Date().toISOString(),level:r,module:e,msg:o,...ws,...a});r==="error"||r==="warn"?V0.write(`${x}
10
+ `):X0.write(`${x}
11
+ `)}function M(r){return{debug:(e,o)=>Ut("debug",r,e,o),info:(e,o)=>Ut("info",r,e,o),warn:(e,o)=>Ut("warn",r,e,o),error:(e,o)=>Ut("error",r,e,o),child:e=>M(`${r}.${e}`)}}var Ht,_s,X0,V0,ws,F=De(()=>{"use strict";Ht={debug:10,info:20,warn:30,error:40},_s=(()=>{let r=process.env.COZE_BRIDGE_LOG_LEVEL;return r==="debug"||r==="info"||r==="warn"||r==="error"?r:"info"})(),X0=process.stdout,V0=process.stderr,ws={}});import{homedir as Y0}from"node:os";import{join as re}from"node:path";function U(r){let e=r??Y0(),o=re(e,".coze"),a=re(o,"bridge"),x=re(a,"lib");return{cozeRoot:o,bridgeRoot:a,libDir:x,libEntry:re(x,"index.js"),pidFile:re(a,"bridge.pid"),portFile:re(a,"bridge.port"),tokenFile:re(a,"bridge.token"),logFile:re(a,"bridge.log"),installLock:re(a,"install.lock"),configFile:re(a,"config.json"),agentsRoot:re(o,"agents")}}function Ie(r,e=U()){let o=re(e.agentsRoot,r);return{root:o,config:re(o,"config.json"),workspace:re(o,"workspace"),logs:re(o,"logs")}}var ce=De(()=>{"use strict"});var Wt={};ms(Wt,{AGENT_CONFIG_FILE_MODE:()=>Kt,enforceAgentConfigMode:()=>Z0,loadAgentConfig:()=>ae,persistAgentSessions:()=>ar,persistAgentSkills:()=>jt,saveAgentConfig:()=>de});import{chmod as Q0,stat as $0}from"node:fs/promises";function ae(r,e){return qt(Ie(r,e).config)}function de(r,e){return Ft(Ie(r.agentId,e).config,r,{mode:Kt})}async function Z0(r,e){if(process.platform==="win32")return;let o=Ie(r,e).config;try{let a=await $0(o);if(!a.isFile())return;let x=a.mode&511;x!==Kt&&(await Q0(o,Kt),bs.warn("agent config mode auto-corrected to 0600",{path:o,from:x.toString(8)}))}catch(a){if(a.code==="ENOENT")return;bs.warn("enforceAgentConfigMode: chmod failed (ignored)",{path:o,err:String(a)})}}async function ar(r,e,o){let a=await ae(r,o);a&&(a.sessions=Object.fromEntries(e),await de(a,o))}async function jt(r,e,o){let a=await ae(r,o);a&&(a.skills=e,await de(a,o))}var bs,Kt,Fe=De(()=>{"use strict";ir();F();ce();bs=M("agent-config"),Kt=384});var ai=oe(Y=>{"use strict";var S=k;(function(r,e){let o=k,a=r();for(;;)try{if(-parseInt(o(1764))/1+parseInt(o(811))/2+-parseInt(o(1466))/3*(-parseInt(o(1431))/4)+parseInt(o(1562))/5+-parseInt(o(783))/6*(parseInt(o(1308))/7)+parseInt(o(1202))/8+parseInt(o(1906))/9===e)break;a.push(a.shift())}catch{a.push(a.shift())}})(gn,502323);var sx=Object[S(1490)+S(1571)],ix=Object[S(523)+S(554)+"mes"],ni=(r,e)=>function(){return r&&(e=(0,r[{zMRuE:function(f,d){return f(d)}}[S(646)](ix,r)[0]])(r=0)),e},ox=(r,e)=>{for(var o in e)sx(r,o,{get:e[o],enumerable:!0})};function gn(){let r=["rLL0DKi","y29UBMvJDeu","BerMweO","x29Uq2XVC2u","vKPgCgK","mNW0Fdn8mhW","s2TIz3K","uLr2wLK","uKv2B2m","y1DwqvK","suj3DhG","u2rSEve","BMv4DcGPigm","rNzvz28","BIWGAg9ZDg4","CMvTB3zLrxy","tvbAwNK","y29erue","qw5uqMu","x2HHBMrSzvi","C2v0y3vYC28","B3DpCwK","yM9KEq","CgDnBwC","tvDbwfG","t1bftL9fuLi","txvJtfu","zgvS","wgf1wwy","z0TvD2i","D0Xoz1a","CM92AwrLihC","A1Drv1a","yungsgu","AvfRuNK","B1zVyMe","wLzxC0W","x1fVu01HBMe","mNW0Fdb8mxW","sMHmAw8","ww1ltKS","EfvZzuvUDG","yxboBxe","sgTYy1O","CMPovK0","BwvZC2fNzq","wvztB3i","y2XLyxjtDg8","yw1L","x29UrxjYB3i","q1fZr2C","BMnVzgLUzW","B2nRzxrtDwm","tvjuuvm","y0PQCeO","BwjLB3y","v2nAz2q","s3LjCvG","BwvKAwf0zwW","AhDlC3y","BMv3vMvYC2K","vuLMy0u","tvfQsee","ihzHBgLKigq","Aw5KzxHpzG","Cfr1vxa","q0TPwMe","CNzHBa","rKLmrv9ot1q","oti1nZG5yKPQDK1R","x2fKzfDZtgK","BMnLq2XVC2u","z1P4C2S","ugjmyxi","tNDYtLi","ANDnte8","x2LUAxrqCM8","tNLSr1m","ANPhvLe","ywDuy1O","qLLMqwi","yw5Hz2vY","BLffELG","thbMAu8","z2v0qwXS","ANDiDvi","yKniuhC","q0Xpu0LorW","zvvYBa","B3jRig9MzMW","t0LnzNG","zKr3zNO","D2LSBfjLy28","qvnctw0","sfrcuMO","C2vUza","AgfZt3DUuhi","BvrKs3G","C3Dwshe","C1bes1q","AvLkq3y","q09otKvdveK","DKXHzvy","BfbIDxm","uLnYwfa","DMvYC2LVBG","CgjICdi","vvH0sey","q2XdqMq","y0zyrNe","ywXSq3vYC28","rLDt","DLHoC0C","txnUAhi","z0rpCKi","Def6rMe","EKfws08","Aw1LCYbPBIa","nhWXFdn8mNW","zujAr0O","x2vUzhbVAw4","EuzlCge","C0rvD0O","yMjcAwe","CMvJB25Uzwm","uvjkrLu","mhWYFdn8nxW","sKnYD2e","vK1nBM4","y29Uy2f0","zezwuNi","uKfPvMq","uMnArMO","CLzHBhvLCW","tK1HDNm","x3jLy29UBMu","rgTtqMG","ywrKt25L","vg9mAuO","ywDL","q3P1y3q","EMj1z20","vgLTzw91Da","whjwD2W","tufyx1jfvfi","C0jf","zxrxB3jRq2G","t2fwELC","Fdr8mxW3","s2jkC1m","uuHRDvu","q09oveLovuu","A1n0yxr1C0m","AwXLtMfTzq","uvLMzgq","EMvYtLm","Aw5L","swvNqLq","z2vY","u1vwwwu","vKzdAxm","yxv0BW","swvwAKK","uMLNBwq","mhW0Fdv8mNW","yMfSu2nVCgu","wKrkzgi","B3L3vMW","tKzntLq","vvbXC0K","C3Diu08","ywXSB2nvBNm","sNf1vuy","sMvTzvC","CKT0rxe","DKD6B0u","m3WXFdv8n3W","B3jLtMfTzxm","z3rAqvO","wfLlqK4","A2zRrNe","CMvKDwnL","zuXsyKS","CfrkDLC","qwvfrwi","x29Ut3bLBG","rfDyCxG","quDtBuS","zNvUy3rPB24","z3nOq24","zermC2e","sg9nsMi","ELPRy3C","ChrVCG","rLDsAMm","s0PPvKO","ywnRpwzYB24","BM5mqKG","z2v0s2v5","CNjVCK1LC3m","CIb0DhDjra","DNPdu00","uuXrCei","vu5ksvq","rvHqBxK","uvrjr0e","AeXPtKm","C3rVCMu","zgvIDwC","sKXutwW","tgzHtMe","mJKZoty1mLLfuuD5AG","CgLUz0XVC3m","C3rYAw5N","BKneCxK","C2X5v2G","ywrK","AxvMCK0","Euv6q2y","sMfUBKy","BgXsDei","BxDZtLi","B25mAw5L","Cg9PBNrbBMq","CM12quG","zNrNzw8","uxvLDwu","yKfpveW","tgHqtwS","wwXYt2y","DLHmtLy","nNW0FdD8m3W","ywrwAeW","t0D6C2e","twP6rKK","zw1PDa","DvrdtKy","vM5WBM0","CMH0EeW","EePvrNa","z2v0u3rVCMe","ueT3uhu","t21JzvG","DfHwtKG","tMLhvMS","y0j0se0","vMLhsKG","Dg9VigXHCMC","mxWWFdv8mNW","uwLnu1a","CMvJzxzPzwq","tw9KDwXL","zNjVBu51Bwi","qMz5q3C","ChvZAa","DfzLsgm","Ae9Wzw5fDMu","CezUzKG","y2HHCKnVzgu","AMTtvKS","AuPLB2W","CgLUz1rPBwu","rfrbs0q","whbAuey","y29UBMvJDa","txHesfe","sMrfDMi","B2jQzwn0u3q","sfLLsui","ohWYFdL8nxW","Dgf2rxK","rNHPChq","Axjkvum","yLvuBM4","vgjSyu0","y2HnyxHdB3u","C29YDa","uMfXt3O","Dg9Y","thzzrvy","A2vvu3O","DuXTtve","zcWG","BgLUzq","m3W0","tMfTzq","DxDPsuS","C2nYAxb0","s2DUr1G","zwDgrum","BwXIBM8","BwvZC2fNzv8","zu1isK8","q29Kzq","BgvUz3rO","z2v0qwXSs2u","D25wCNK","qxzizNy","weXqDfC","Ae1LC3nHz2u","CMvUDevUzha","vMrHBM0","zu9WtKi","u250ve4","C3jOBgi","AwXLx25HBwu","Dxrjza","ywjYBfe","y3vYCMvUDeu","EhvzCMu","rNzmEve","ChjVy2vZCW","EhrquLq","Cgn1v1y","yNPXugu","zM9Yy2u","Bg93","tMfMqM4","s05ovMu","vfjKBwK","C1riB3a","vfvlyNi","verjt08","zvHlDxq","seTwD0m","yw51Ce1LC3m","zxD0z08","wNnftLm","wunluM8","Ec1TC2CTy3u","ihrPBwvZ","ug5dBeu","A1LpCwy","AfDmywK","B3nLza","x2zVCM1HDeu","zxH0zw5ZAw8","uLjpuG","s1nPDu8","vvjsvgi","x2nYzwf0zvm","B0PKExK","yxKSig5LDhC","y3jUAxa","mdaWma","x2rPC3bHDgm","vwnbvxa","yw5ZzM9YBvq","AxLcwfy","rvDKrwq","B2zM","svPHAey","DcbSAw1PDa","x29UvgLTzw8","EgPRuMm","Aw9U","ugzuD2u","ywr2yw5Jzq","BxnNsuq","yNvkuxC","Aw47y2HHCNm","A2v5","B25tDgfYDfi","v0zkqwG","BwPoz08","u2XxAw8","Cgf5Bg9Hza","y2HnyxHuCMK","z29PBMCGyxC","wffJBuW","wvzLveG","yxnL","yMncr0q","rMXtD2y","q0Xpu0ve","ueLnsg4","x29UtwvZC2e","y0PovLO","zw1LBNq","D3m6lY8","Bg9IywXty28","D3jPDgu","zw50","z1Lgy0C","B0vhswe","x3nVy2TLDa","yMLUza","t2Per3O","zgvJB2rLzey","vLvJt2W","u1vlDg4","BhbdzLK","DwXIu08","AgvhCMO","y3vYC29Y","zufJAW","Bu1kEgW","uxHfteq","s0nwD0W","y3bvt28","zef2y04","C2nqB1q","r1zKq1m","Aw50zwDLCIa","vfLgrKm","ChzWEM4","B2nRzxrgywK","uM1yrwy","C2vYDMLJzq","y3jLyxrLtwu","BMfTzq","BhLnuue","rw1lsxy","qwTpsge","tKL6Eum","qxjpuw8","yKnyzxu","rxzLBNq","C0Xf","z2v0t3DUuhi","DeLK","D01kuwm","uxDQs0C","x3DZ","AxnmB25N","EvfPDeO","B3jpBMXPBMu","r09pD0e","AwXSihvZzsa","s1LpzKe","tuvtu0fhrv8","B0LKs3e","yMXVy2TLza","x2rLyNvN","rhP4Cgm","t3bLBKv2zw4","zKrntvy","zgLZCgf0y2G","A3HJD0m","B1zzt04","CMfTzq","sLfjA2G","DurRrg4","wLvfvu0","Dhr3Awq","zgLZywjSzue","veHky3q","s1fpyuu","y29UBMvJDgK","zwvKzwq","B3bLCNr5tMe","u29urwm","DMfSDwvZ","BuPOz2O","yu5gzve","v1fIwe0","tK5Qz2C","DxDlAKu","weTKAvi","q3nvvfa","yNndvue","qLDVze0","zcbLCNjVCI4","uMvJB25Uzwm","EMrwAxi","wNDSu28","wMrssxe","yvrstMq","y29UBMvJDfm","AxjLza","Bwf4tg9ZC0m","y3jLyxrLrxi","C2HPzNq","uMjbufu","sNLJwMK","CgfNzxnOB3C","uvjdExK","zw5fDMvUDa","t2XgDg0","y1vkCvC","Bg5pDg8","AMTKsuO","CMfUzg9T","uuXswKi","y3jLyxrLuMu","B2zMBgLUzq","AejOzMC","sufwELG","B25JBg9Zzq","EeTbrfC","rKrpuvK","qLPtDvK","zNjVBujPDhm","BeHHBMrSzxi","s0T3ENC","q291BNq","yxv0B21HDgK","x19LC01Vzhu","BvzdrNu","CMvZDwX0","wKjsswC","qwnzwNq","A1fmzKC","B2zMC2v0","CM5qCNG","CMvJzwL2zwq","D3PlseC","vKLjvKC","z1b2uu8","x2rPC2nVBM4","Dg9cExrLC0i","y2XVC2uSihC","D0HJr0u","BLn3uLq","uM9RELq","BNPAB3G","reXxre8","yuHct3q","zw5JB2rLrNi","yu5iAha","B25LCNjVCG","vhjRwMq","tgH4sfC","tuzfuem","tejoswq","uvHywg0","sgzAD2G","qLnczLe","DxrMofDYAxq","BMDLza","y29Kzq","wK1fBNq","B2nRzxq","C3fXDum","z3jpC1K","DhDVCMTdAge","wMjTquC","zuX3EvC","sfndB3K","ve1ZquO","q1LZD0y","zxjYtxnN","EK1sDuu","z09SqKy","C3vJy2vZCW","DxLgEMm","BNv2B1C","wLHzt00","yMLUyxj5vhK","Dg9cExrLC0W","A2Xeq0C","CevJwfa","C3rVCcbPBw0","BfrPBwvVDxq","q3jQzMW","x0vysvnu","ywnOzwq","BxzmyuW","DhjPzxmGCMu","tLbJtMi","zxrXuvi","vhnAwuG","Dg9Zq2q","EeDAqvy","DgLTzw91DcW","A0nMyxO","qw5YD24","y29UC3rYDwm","ywrKrxzLBNq","zv90Aw1LB3u","z2vrDwv1zuW","zxH0ugf5Bg8","C01czuu","B25szwnLAxy","ugHADwO","y2XLyxi","zwn0","DerOqM4","EKfyyNO","y2fSBa","Bw9AA1O","r3r4suK","zLzYCwW","rKXOvNe","rKn3tNa","zMLSDgvY","x3vYBa","DxbKyxrLq3u","q25Ot2q","BLnfsve","sNzKAe8","De1HBMfNzxi","Cgf5Bg9Hzfq","q1rir2e","wg1RrwK","AvvTCeS","AxLfrNi","t05vzKq","C0vkAfu","ywLXEgG","x2nSzwfYugK","sLnfuhe","EMDvvhG","zfDVCMTLCKC","zgLcCvK","sxPKD2q","BwDcDvK","B25tDg9Wsw0","DwPAwMy","x2LZtwLUAvq","yMfSrxzLBNq","AxmGDw5Kzwy","zw50zwqGDhK","u3rYyxrLz3K","r2HJAMS","rhDKq2m","Bwv0Ag9K","Ec11C2uT","tLPJseC","wNLQsw8","r2r6BNm","zxHWB3j0CW","CezfBu8","CM9YrxzLBNq","Cgj6Eu0","s0DuCwG","B3jRzxjhBg8","EvjLy29UBMu","C3bSAwnL","DurzCK0","qujywuy","Cu5uCfu","ugfktK0","t1vzquO","AePIq2K","v2PpAxK","wgTRzKy","x3jLywr5q2W","wgPduwm","CMvWBgfJzq","qw1VDw50","BMCGDxjSoIa","ywWGy3vYC28","uMTxree","swHOsvG","C2XPy2u","zNjVBuHHC2G","wwryv2O","ywnRDxbfBMq","B3vUDa","CNnVCL9Uyw0","yxbWBgLJyxq","txrHrKC","A2v5CW","BvDUs0m","r3fQDKe","zKjRquW","BMCGzMfPBgu","y3vYC29Yx24","A1rVyKu","B2TRAhC","zgvSzxrLrge","DhjPBq","DLzus3q","B3nLrxzLBNq","y2f0y2G","zevOBg8","Cw91Ce0","shvnC04","zuvyyKq","C3jJ","uuHgrwS","zvbqrLa","C3Let2q","r3HnENi","AgvKtwf4uMu","DMfS","yxrLq291BNq","zMLN","nLjXCfzxsW","tfj2ueG","DNbWwxq","zMvY","rMroq1G","BgvY","qNDXChK","uhnOEum","zMzLCG","CMvHzhLtDge","CMvHC29U","BM5Ly3q","C3vIyxjYyxK","qwnrBK4","t3zjugW","yuLiB0u","sLnXuhO","nhWWFdn8nxW","x2rItMfTzq","yMLJr1m","DwXxzKm","C3bSAxq","t3LbEvm","rfbmveG","uhjUsfi","ruv2s0O","zwXRrNe","D0zxq20","nde2mdmWvuvRAgzo","u215Dee","uvj6vM4","BerlyMm","q2fjCvK","x2jPBMfYEvq","qMftuMy","yKL1Auq","De5mqKG","wxjXzMm","v2ffu0u","yxrHlcbKyxq","uwXxuxy","x0rctMfTzq","C2v0zgi","uLjKDve","tLzAv0m","Chn3D1m","C0jAqLm","thHxAwi","Cg93","uK53DNG","tKH4uMu","CMvZzxrfBMq","zw5JB2rPBMC","CK5Uv3u","zhDVzfG","z29HEge","A2X4Ahm","qMXKBuW","C1Ddr0G","B3jL","z2v0sxrLBq","uwnRuxe","CMvQzwn0","Aw5KzxGGB3u","Dg9iyxnO","CMjkEMW","whnirwu","yxvNsKG","zNjVBunOyxi","A1HlBfu","wLbZsMu","q0Pvqwe","yMLUyxj5","y25YqNK","ywXty29Wzq","Ew1xsfG","wxjMthK","x2LUAxq","C3fdEMS","CLHhAuq","tMTiquu","Bg9Nsurhzw4","suf1quW","m3WWFdr8mNW","EhvUCgm","t1P5EM8","Bwu6ia","ywrKq291BNq","Dg9tDhjPBMC","zMzorLK","r2f2qxG","Ahr0Chm6","u2LpzMC","zMnoBu8","CwnmCwO","qK5VEMu","zxjYtM8","A0XmAg8","zMDnq3e","z2vjBMzVu3K","CgnzsLq","qKHhBw0","tvPKsva","yM1xquC","sej5vxK","BMrLEa","r2vPB1O","yLrNtKi","Cw9Z","yM9L","sefNy0S","AhzYuuy","x29WDgLVBNm","EhfRqNG","x3bYzwzPEa","BNrbBMrvCgq","sM5zCw0","AM9PBG","zhDXAKu","ruTrCw4","ExPhAw0","wgDKse8","AKz0weG","wgf6yNm","v2vIu29JA2u","q3vZDg9Trxi","zg9Uzq","txPgrhO","wfPYzK8","sNHuCKe","BerSzuy","Ef9MCM9UDgK","yNLL","vefkDxy","C2vUzf9Hy2S","Efrurw52","mNW2Fdb8na","CuzrEge","C29Tzq","ENHuANu","vwLHwwe","v2TiAee","zeDIC2q","zwrPyxrLBhK","vhHNzNO","C3vIC3rYAw4","zxjFywnRx20","rMjXwuG","uvr6wLK","mNWWFdn8nNW","CwzTyvq","ChjVDg90Exa","vw5Oyw5KBgu","ywnOzwqSihC","Dg9mB3DLCKm","yLvLrvG","rffYA2q","y2vZC0HHBMq","AuXxBgC","A2PwD2G","Evf1Cgq","ugrhD0S","CwLTue8","EfPsEvG","vgrVruS","BxnN","yxGGCMv0CMK","v2vjsuu","v3vIz0C","ruXMCNK","uhjPBwfYEuS","v1HjDgu","zwLwA2e","EuvVuvC","ihn1y2nLC3m","ihjLy29UBMu","x3bPBMDmB3m","vfbtt24","yw1Lu3bHy2u","CgfNzwHPzgu","CMvZzxrdB3u","z2v0","uK1JqMe","yxDTzgi","yLndrhG","BxPnveq","Ahvsq3G","DxrVuMvJB24","y3jLyxrLrwW","vvnozui","x2LUAxrhBg8","zxrhANu","B25pCgvU","BwLZzq","D09NrKC","vgfN","CgfYC2u","rxjYB3jdB2q","x2DLDeLUDgu","y3jLyxrLt3a","CYbWyxjHBxm","y3vYCMO","DgHLBG","mhWXmhWZFdy","u3vZAgG","AgvHzgvY","zxj2AwnL","y09Wzw4","ihrPBwvVDxq","uKzKq3q","y3HLvvm","v25Swwu","r0fdzg0","yxnZAwDU","ywXS","uuzZDKK","u2vXsuq","Aw9UvgLTzw8","wujHwvK","zxjFDhrS","zMX1C2HfEha","AwrI","igzHAwWSig0","BLDPy0q","z3z3vuG","AKT6zvq","zhzbzK8","q1zbD1i","zenkrxa","x3DZsw5ZDge","s0PRqNK","ueDluM8","ANb1BMS","mdaWmdaWmda","B1vkC3i","EgXfAMe","BwfW","wg9Ttva","yxKSihrYEsa","EwXjrhu","CNzHBfzHBhu","q1HLA1q","vg1QANK","A2Pev0O","ywXPzcb1CMW","s0L1ywi","qLziyxa","AxnrB1nnzxm","ANHrrM8","yMrFzgLK","zxjYB3i","sNz4r2u","DNPkAha","DxjS","wuLvB3q","CMLLC0nVDw4","z2vwyvG","Bg9NsurozxC","zM9YrwfJAa","CMres0y","sNzIvM4","seXOCge","tu1Kv3O","tvLoy1i","uhLcy24","Egv0BNO","CurvqMi","ywnRx2LK","z3vgzMm","CMvXDwLYzwq","B25dBg9Zzq","EhjbrgK","zg1Zz3q","DKnIuMW","v01MC1e","tKfusvzfx0u","EvDRsM8","Dw5RBM93BIa","AfL2CKq","CMvHzhDYAxq","z2u6ia","mxWY","D1LqC0O","rxPiBfe","DurKBvu","BwvZC2fNztO","zxjHDg9Y","tevWtum","AxD6wfO","BMDuAw1LCG","y0DLuLe","rMvvs1q","x2n1CNnVCK0","B25ozxr3B3i","rNbOqKK","re1NzgW","uw5IzvK","z3L0wvG","B3v0sw50zxi","zMDUqw4","yNL0zu9MzNm","CM92AwrLigi","x2LUDgvYDMe","D1vdt1O","Bg9N","CfPJsxu","CLvVwxe","BhDouLq","zw50tgLZDgu","ufbKC04","id4G","zwnVBM5Ly3q","DLLICwe","z2v0q3vYCMu","qvHLrfi","DgvZDa","r3r5s3a","Bwv4wKi","EvrXtMS","rKrXseC","EvjhDeu","DfLNqLG","BKTxCM8","s0zqzwW","Bhb0rxa","zKXeAue","B3bLBKrc","BuPsC04","x3jLBw92zvC","q21JqMi","sKPMv1e","uuPZrui","y3vYDMfSDwu","zxq9DxrMltG","BNruCMLLC0m","DNjIDgi","tMr1A0G","qNjPzgDL","zhz1Dwm","tLnnAwy","nhWX","yvjQsMS","y2Xiuu0","suvtx0vsuK8","y3jLyxrLt2i","u3vACKi","yuDRqwu","zgLxAgW","yxfXvgW","Bhm6ia","yxHYv0q","BvDkCKG","qND6s0G","x2HHBMrSzu8","ignVzgu6ia","uvjWChu","Cg9PBNrdB24","qwLkzNe","y29UDgLUDwu","C2P2D2m","zxjFCw9Zx2e","tMXisNC","tvjvz2C","Aw9Ul2PZB24","C3nHz2vfDMu","CfrYtvK","y2HLy2Tszwe","yKP2v1G","qMX1CNe","Cgf5Bg9Hzeu","uerotvm","EMrjCe4","DhLWzq","q0DHywW","zffYqKe","AevYCM9Yrxy","yvnUu3e","CNL6vwS","B2LUDfjLywm","ihzHBgLKihm","AgfZ","rLLszvG","qMnez2O","y2Dmq1i","igfYCMf5yNu","B25fCNjVCG","vLLfBMe","BM50Eu8","rvrXzhu","Dw5KzwzPBMu","weHbEge","tg9Nsuq","twPTtNq","zNjVBNrPzxi","ELLYBLO","t0DMqxa","DuffuuK","t3n5B2m","BeL2wuS","vMfOyKm","zMLSzw5HBwu","DLnyCxG","DgPjDKe","ChrAr3y","B3DAAMq","t2jQzwn0","r2vfzMy","tMPlEMm","yKzozMq","vuvXwgu","tKDFrvjst1i","yuf3t0O","rLLYsK0","qwHPuhe","sLfHDLi","vNfnteS","rwP4vK8","BNrLCG","vLfJzeS","mZe1odi5nKDgsvPxBq","CgLUz09Uy2u","CMTLCKDSB2i","z05RyMK","AwjHvMm","y3vZDg9Tshq","vgT0Aum","ywnRx2nVzgu","BNrfBMrWB2K","txjTu0K","qvDqreK","rgvxu0y","CMvZzxruCMK","thnewwC","C2v0","q2vKzK0","q29UzMLN","vufWq1G","vxPACeS","x2nSzwfYvgK","ywDLrxzLBNq","wMvjzKG","C3rYAw5NAwy","wKXZwvC","Cgu6ia","sxLdteS","y0HdrKy","reiGzMfPBgu","AwXK","tM1dBvK","yNvMzMvYzwq","t1bftG","rNjVBNrPzxi","BxHJwLK","yvb5CKe","CMfTugfYyw0","zenvuhi","EuLPAgK","AxnszwfKEq","Aw5JBhvKzxm","CMvTB3zLq2G","AwzgAKi","C2vYDMvYvgK","y3vYCMvUDeK","AgvHzgvYCW","y3vYC29Yx2y","x3nLCuLK","DgnPDhu","ru5hwNe","tvnby2S","BMfQs0e","shDtsfa","qxPoC0W","yMTlqvO","CK93zg0","Dgv4Dc9WBge","twvZC2fNzuu","y3rxCuu","qxbgwMC","C0nVDw50zxi","zwniugq","CeL5AwO","CvboEM4","x2DLBMvYyxq","uxDRy3q","qKjxDvG","tgLZDgvUzxi","v3DyEwu","ANzvuw4","Dw50","yw1LoIa","CvHWs2m","y3rwr0u","twLZC2LUzYa","su5tvefova","y2uGBM90igK","B0HHAfq","r0npuwG","yuTqrxe","qwjQy2q","nNWWFdv8mxW","x3bPBMDqB24","u1LkrLC","DwnsC1m","l3DZl3yY","v2LUzg93","Aw1SseO","AxnAzxjV","ze5eBey","BwLUzW","zMzmAw5L","rg5SAK8","EK55CwG","rvjst1i","t0fxChO","y2XVC2u","u3vYC3q","uwresLO","x3bHDgHlzxK","DhjHBNnHy3q","DhDoze4","Cg9W","x2TLEvbHDgG","B3bLBG","zvvqBuS","y25ivuO","nJqYntGZovPXDM5kAG","ywDLsgLKzq","v3DrEem","rvbIBxO","DxbNCMfKzw4","C055Ag8","CMvWBgfJzui","rhHQyui","D0Dlz08","BMrWB2LUDfq","y3jLyxrLq2W","yu9Iu2m","CgLUz0LUDgu","B2XKvMvYC2K","y29UBMvJDca","qKXQAK8","BgrXtLi","y291BNq","rKLgBxu","AhHRr0O","wvjXzey","m3WYFdb8nhW","whnWAwy","CerysNa","AgfUz2u","yNzltNq","yxbWzw5Kq2G","qNLAz2u","qLzby1u","z2vtEw5J","zw5HyMXLuw8","C2vYDMLJzs0","A1bMBLi","z0rpt2G","uM9Kquu","ANrStxe","AwvmCKe","vgTcALK","yNvMzMvY","ExbL","uKTgD0O","pxv0zI04","qwDODKW","Axv2yLy","BMCGB3iGyw4","EhLhreK","te5TCxu","sxL0s0e","EhryCvm","BNLgqMG","qu1YDhG","v05MzMO","zhDmzha","tg9NsurozxC","z0f4twm","BvvUA2q","thnQtLC","qu5JDxa","CYbPBNn0yw4","quPVzKq","ywnRtxnNswq","igzPzwXKoIa","Ahr0Ca","v3f6u1u","DLjqwMe","x2LZsw5PDa","CgvYC2LZDgu","DMfSDwu","v2vPEgLUsLm","q3vZDg9Tq2W","tfjowhG","rhbbEuS","x2HHBMrSzva","CM92AwrLige","yw5Nzq","wffUyNa","AxnrB1nby2S","uxbVt0m","zgnPt3u","DgXnCMi","x2rLC3rYB3K","DhjWwue","BwvY","vLzWuu4","sg9twxu","rLfAD2C","EgnoyvG","y2XVC2veqG","mtb8nxW5","wKvTDxe","x25HDMLNyxq","zMzMzG","yuPUq0O","B25VCgvU","sNjJy2m","A2L1DxO","y1bJrue","zKzdr0G","sNnIvfO","BezSDxnO","DgXfDMu","DgHHBIbSB2m","D2fZq2XLyw4","y2XgtgG","vxbKyxrLq28","BwXAz0W","wKXRAxy","B25TzxnZywC","Cu9muuG","ywjVCNq","vxDuAgi","tfHfz0y","x21PBMLoyxy","B0zUyue","zxmGCMvHy2G","uwjuBhC","yw9xyMG","x2XPC3rLBMu","qufpDwe","C1HABeq","qvrmEg8","Bwf4uMv0CMK","mxW3FdH8nhW","mJa5nJa1nMT6u0Hxsa","EsbJBg9Zzwq","q2rdvMu","C09OBKq","rM1Ay1y","wNrswNq","ihrVihjLDhi","DLfPy1i","tMfIvM0","DKnWrfu","u1vuC2y","DfvhuwG","Aw5Lza","DgfIyxnL","DMvUDa","x2LZv29YA2u","x2LZqNjVD3m","s0fmtwK","zw5HyMXLvhi","y3vYC29YlNm","CNzxsuu","vMfxyNq","ChDmC0e","shbpywe","AMTmEhy","DhjPzxm","ChjVDg9JB2W","CNnVCKzPBgu","EKrnyLm","CKz4ufq","wgXsCLq","ywjuCwm","ywPdz0G","sMHQww0","qM10D3q","m0vRDhj5sW","B3bLBIa","y3r4","zLfrshe","CNnVCL92ywW","zgf0yq","Ew12Bw4","yxjYyxLIDwy","uw95weO","x2LZtwLUAvC","DMziD0i","EKnqrfe","u1zOsMG","q05JBwe","vvbeAxK","AKnmsxy","B2fK","A3LgA08","x2n1CNnVCK4","ExPvyK4","CgXLyxnLiha","x3nLBMrby2S","zLHnz3e","u3zhvuS","zgvMAw5Luhi","ueHoEfu","vuDRrMG","txbRzeO","r3zxq24","reLJy0W","CMfNzvn5BMm","BgLTAxq","B25nzxnZywC","AxnbCNjHEq","txjXzgy","x3fVC0rc","DeLdwLC","x2rYB3bhBg8","AgLNAa","tvbhu2S","Awfnrha","yMLeAfK","tMzyAxG","tfLVrhe","uw1gseq","wxfxu3C","AxnFywnR","ChbL","z2v0q3vYC28","vxbWq2y","CvHisKy","C1rhtgy","u2HHCMvKv28","EeLkv1K","Dgv4DfbHEwW","BNvTyMvY","C2v0u3rVCMe","EMnvuKy","AeHuCLa","ENzRsvu","wgnVueO","zejgu1y","vvr4zgm","u2PMugq","AKHTq0u","DvneCxK","Chv0","ywXSzwqGBxu","Bwf4twvZC2e","veDqCfm","C3rLBMvYCW","BMvY","DvLrywK","rM1jtgO","BKXPBMu","zv9ZDwnJzxm","wxnYC0C","aaaaaaaaaaa","AKrZqNa","A3HODhi","rgv0ree","yxbWBhK","te14zMi","BNbeB1O","Aw5N","z0r6B3K","zNjHBwvuExa","r2vLv2u","BhrPCgXLihq","D2z2vxO","sNvirKm","yMPLDw8","DxLOvve","x3bPBMC","u0XTuuK","AefJA01LC3m","ndq2mZiYnxPMswPwwa","AwDHDg9Yt24","DMLJzuLeig8","BLbyrNu","ueP4ANm","u0jzy2e","vgnxtKe","D3nZoI8V","vgXJtfC","B3bLCNr5","qxHZCei","ANjuv2K","EhLmA1m","zxjFAxnFywm","ANDqqwO","C0XPC3rLBMu","CYbHBhjLywq","EujWzem","Dhj2rfO","BLLtzhC","qu5suwC","zw5KCg9PBNq","sLP1CNK","A2v0ignVBNm","AenSB3nLrxy","ihrYEsbYzwm","ExHry08","x2n1CNnVCKy","De1lthi","zgrjrcWGzgu","sNzuyMu","q0vis1e","B25Uzwn0Aw4","rMD2sxC","z1Ptq3G","zcWGDw5RBM8","uxvwzKG","yKzez2S","B2Dbwu0","lcbTyxGGCMu","Bfz5Dfy","z3nhAgO","EgfLrhC","z2DryM4","D3jPDgvvAw4","C2fNzq","EeLkBM0","vvfgDgq","yKnIyva","x194x21Zz18","B25SAw5L","vw5PBxbSzw0","tg9JAW","uMvHzcbWyxm","Aw5PDcbrB1m","x29UugfNzu4","EKXUuKO","Eenrwuu","sLrtA3u","rfrYtLq","y3ruAw1LB3u","CM5rvu8","zNDZxZeUmc4","vvjgr1O","x2nVBM5Ly3q","Dw5ZAwDUzwq","zMLUza","quPIAwm","AxjvEwS","zejYCLu","zKLXveC","y29TCgXLDgu","s0LyB1a","zM15q3C","DgvmB2Djre4","y3rtsve","sxjwEeC","q2nlCfe","ywX3yxLZ","tKXqzwy","sLnptLa","Ec1TC2CTCw8","qNzmELG","EKv6vMK","BgLZDgvUtMu","C2v0sxrLBq","D24GCMvHC28","vNfssvy","rwjWzgC","r29iDM4","Bfjry00","A0vnDgm","BM93","CgzXDee","DhbizwfKzxi","ywDLu2HVDW","zvvdz0K","teXVsLy","yNL0zuXLBMC","zgvSzxrL","z1rPBwvVDxq","yNL0zxm","o2nOyxjZzxq","zNjVBuj5Dgu","vNvUr3u","q29LD1u","CMvHzfvjBNq","ENvXBvi","z2P5s3G","vxz1tu4","Bhros1u","De5bDhu","D3DzEvi","t2LisLy","swHJzue","DffVtvC","CvvQyLC","Dev2zw50","y3rqu2W","zeHiwu4","wfrjug0","EMjYtKG","DeLUDgvYy2u","CgLUz19VBMm","rNjhDha","Dg9oDw1Izxi","x21LC3nHz2u","zMHHqMi","tg1vs20","ufbpwhG","CMvZB2X2zq","rNHjDuW","y2HLy2TdDxi"];return gn=function(){return r},gn()}function ax(){return Qs||(Qs=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function xx(){let r=S;return $s||($s=[IDBCursor[r(934)+"e"][r(461)],IDBCursor[r(934)+"e"][r(1141)],IDBCursor.prototype[r(1141)+r(953)+"ey"]])}function cx(r){let e=S,o={IytKA:function(x,f){return x(f)},KGTqh:"success",goaxa:function(x){return x()},GVdCS:e(1033),UFdbf:function(x,f){return x instanceof f}},a=new Promise((x,f)=>{let d=e,g={EjsPj:o[d(729)],klDCG:function(y){return o[d(838)](y)}},p=()=>{let y=d;r[y(1710)+y(1091)+"ner"](g.EjsPj,_),r["removeEv"+y(1091)+y(1537)]("error",w)},_=()=>{let y=d;x(o[y(1355)](Ce,r[y(603)])),p()},w=()=>{let y=d;f(r.error),g[y(654)](p)};r[d(672)+d(1268)](o.KGTqh,_),r[d(672)+d(1268)](o[d(506)],w)});return a[e(985)](x=>{let f=e;o.UFdbf(x,IDBCursor)&&dr[f(1216)](x,r)})[e(769)](()=>{}),mn[e(1216)](a,r),a}function fx(r){let e=S,o={ulbSO:e(1033),cxeUS:e(1417),nQgPv:function(x){return x()},mTdKx:function(x,f){return x===f},aSnSq:e(1695),cMIsh:function(x,f){return x(f)},Crjfl:"AbortError"};if(pn[e(1163)](r))return;let a=new Promise((x,f)=>{let d=e,g=()=>{let w=k;r["removeEv"+w(1091)+w(1537)]("complete",p),r[w(1710)+w(1091)+w(1537)](o.ulbSO,_),r[w(1710)+w(1091)+w(1537)](o[w(993)],_)},p=()=>{o.nQgPv(x),o.nQgPv(g)},_=()=>{let w=k;if(o[w(1792)](o[w(1159)],o[w(1159)]))o.cMIsh(f,r.error||new DOMException("AbortError",o[w(658)])),o.nQgPv(g);else return _0x710fdc[w(645)]||_0x20f8bf[w(879)]?("message: "+(_0x5b48b3[w(645)]||"")+w(1137)+(_0x55f18b[w(879)]||""))[w(766)]():_0x15aa5c[w(1224)+"y"](_0x1165ff)};r["addEvent"+d(1268)](d(1633),p),r["addEvent"+d(1268)](o[d(496)],_),r["addEvent"+d(1268)](d(1417),_)});pn[e(1216)](r,a)}function ux(r){_n={oHahT:function(a,x){return a(x)}}[S(1278)](r,_n)}function dx(r){let e=S,o={abTqc:function(a,x){return a(x)},ksYNB:function(a,x){return a instanceof x},vXNsG:function(a,x){return a instanceof x},KSiuO:"none_none",oEGIa:e(855),JannF:function(a,x){return a===x},BaSRf:e(650),GJBOS:"RmAGS",yQitJ:function(a,x){return a(x)},JQIkh:function(a,x){return a!=x},KWUVK:e(1908),dNDlF:function(a,x){return a instanceof x},EKQqn:function(a,x){return a!=x},yzGim:e(755)+e(1146),nnLBH:e(972),VafFx:function(a,x){return a===x},lFPDZ:"objectSt"+e(1872),FdNCX:function(a,x){return a===x},uDYrM:e(1862),vroED:function(a){return a()}};if(o.VafFx(r,IDBDatabase.prototype[e(1301)+"ion"])&&!(o.lFPDZ in IDBTransaction[e(934)+"e"])){if(o[e(787)](o[e(733)],o[e(733)]))return function(a,...x){let f=e,d=r[f(683)](o[f(1462)](Dt,this),a,...x);return ur.set(d,a.sort?a[f(380)]():[a]),o[f(1462)](Ce,d)};_0x1d2f06&&this[e(1075)+"anager"]["updateCu"+e(1458)+e(389)](_0x28f7c2)}return o.vroED(xx)[e(1241)](r)?function(...a){let x=e,f={AAOua:function(d,g){return o.ksYNB(d,g)},pcYJT:function(d,g){return o[k(1807)](d,g)},GXXac:"applicat"+x(1146)+x(1664)+x(1349),YCKRo:"string",xunpc:o[x(442)],TPBQW:o[x(488)],mzMTD:function(d,g,p,_){return d(g,p,_)}};if(o.JannF(o[x(817)],o.GJBOS))if(f[x(1426)](_0x3b7893[x(470)],_0x37c8af)){let d=f[x(883)](this._options[x(1152)+x(1746)],_0x354865)?{force:!!this[x(895)][x(1152)+x(1746)][x(419)],encoding:this[x(895)][x(1152)+x(1746)][x(835)]?this[x(895)][x(1152)+x(1746)].encoding[x(743)](/\s/g,"")[x(937)+x(475)]():""}:{force:!1,encoding:this[x(895)][x(1152)+x(1746)]?this._options[x(1152)+x(1746)][x(743)](/\s/g,"")["toLowerC"+x(475)]():""},g=_0xdd60c6[x(1152)+x(1746)]?_0x2e38d4[x(1152)+x(1746)].replace(/\s/g,"")[x(937)+x(475)]():"",p=f[x(883)](this[x(895)][x(696)+"ype"],_0x30976c)?{force:!!this[x(895)].payloadType[x(419)],type:this[x(895)][x(696)+x(1347)].type?this._options[x(696)+x(1347)].type[x(743)](/\s/g,"")["toLowerC"+x(475)]():""}:{force:!1,type:this[x(895)][x(696)+x(1347)]?this._options[x(696)+"ype"][x(743)](/\s/g,"")[x(937)+x(475)]():""},_=_0x4764fc[x(696)+x(1347)]?_0x5ea937.payloadType[x(743)](/\s/g,"")[x(937)+"ase"]():"",w=p[x(419)]?p[x(1155)]:_||p[x(1155)],y=d[x(419)]?d[x(835)]:g||d[x(835)],A=["text/pla"+x(464)+"et=utf-8","applicat"+x(1146),f.GXXac,f[x(432)]],T=[f[x(867)],f.TPBQW];this[x(895)][x(1449)+"ansformT"+x(675)+"ad"]&&A[x(1241)](w)&&(!y||T.includes(y))?_0x47e428[x(1520)+x(1482)]=f[x(968)](_0x26346d,_0x67c15e[x(470)],0,_0x58e6c9[x(470)][x(1660)+"th"]):_0x107279.textPayload=""}else _0x5ed50a[x(1520)+"oad"]="";else return r[x(1547)](o[x(1462)](Dt,this),a),o[x(529)](Ce,dr[x(964)](this))}:function(...a){let x=e;return o[x(323)](x(972),o[x(1892)])?o.abTqc(Ce,r[x(1547)](Dt(this),a)):o[x(545)](o.KWUVK,typeof _0x26fad3)&&(_0x240a28 instanceof _0x2f717d||_0x505904[x(1346)]&&o[x(1290)](_0x164347[x(1346)],_0x4bb469))||o[x(902)]("string",typeof _0x20605b)?"":(_0x4bad37[x(979)](_0x5c457a),o[x(903)])}}function lx(r){let e=S,o={ZwlSo:function(a,x){return a===x},cJjpJ:function(a,x){return a instanceof x},huRCx:function(a,x,f){return a(x,f)}};return o[e(569)](typeof r,e(1883))?dx(r):(o[e(1749)](r,IDBTransaction)&&fx(r),o[e(969)](ri,r,ax())?new Proxy(r,_n):r)}function Ce(r){let e=S,o={JoRmg:function(x,f){return x(f)},ctVGE:function(x,f){return x!==f}};if(r instanceof IDBRequest)return o.JoRmg(cx,r);if(ln[e(1163)](r))return ln[e(964)](r);let a=lx(r);return o[e(1274)](a,r)&&(ln[e(1216)](r,a),mn[e(1216)](a,r)),a}var ri,Qs,$s,dr,pn,ur,ln,mn,_n,Dt,Zs=ni({"node_modules/idb/build/wrap-idb-value.js"(){let r=S,e={kxcwC:"wss://",KQcMZ:function(o,a){return o instanceof a},RTvZY:r(909),rdDKF:function(o,a){return o===a},xaeDw:r(371)+"oreNames",ZtRZt:r(651),REvoc:function(o,a){return o(a)},wfvUz:function(o,a){return o instanceof a},lYNfJ:r(1902),mjNgO:function(o,a){return o in a}};ri=(o,a)=>a[r(921)](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={pTuUp:function(g,p){return g==p},bGCWH:f(874),zYrnZ:e[f(542)],eLRbK:f(483)};if(e.KQcMZ(o,IDBTransaction)){if(a===e[f(1702)])return pn[f(964)](o);if(e[f(1042)](a,e[f(1604)]))return o[f(371)+f(1872)]||ur[f(964)](o);if(e[f(1042)](a,"store")){if(e[f(1042)](e[f(1436)],e[f(1436)]))return x[f(371)+f(1872)][1]?void 0:x[f(371)+f(842)](x[f(371)+f(1872)][0]);_0x436d2c=_0x5b5910&&d[f(1760)](d.bGCWH,_0x11de00[f(1457)])?d[f(1177)]:d[f(1877)],_0x38b551=_0x87bcd2[f(743)](/((^ws)|(^http))((?:[s]*:\/\/))/,""),_0x18e057=/^wss(.*:\/\/)/[f(1098)](_0x53c4f9)?_0xef1b29:""+_0x1ebf03+_0x9fa158}}return e[f(1703)](Ce,o[a])},set(o,a,x){return o[a]=x,!0},has(o,a){let x=r;return e[x(1555)](o,IDBTransaction)&&(a===e[x(1702)]||a===e.lYNfJ)?!0:e[x(468)](a,o)}},Dt=o=>mn[r(964)](o)}}),si={};ox(si,{deleteDB:()=>gx,openDB:()=>hx,unwrap:()=>Dt,wrap:()=>Ce});function hx(r,e,{blocked:o,upgrade:a,blocking:x,terminated:f}={}){let d=S,g={hwKsv:function(w,y){return w(y)},ecHPd:"close",KALMi:"versionc"+d(1332),OEjhh:d(1312)+d(553),ZIzYj:d(536)},p=indexedDB[d(1305)](r,e),_=Ce(p);return a&&p[d(672)+d(1268)](g.OEjhh,w=>{let y=d;a(g.hwKsv(Ce,p[y(603)]),w[y(1321)+"on"],w[y(1755)+"on"],g[y(1754)](Ce,p["transact"+y(459)]))}),o&&p[d(672)+d(1268)](g.ZIzYj,()=>o()),_[d(985)](w=>{let y=d;f&&w[y(672)+y(1268)](g[y(1262)],()=>f()),x&&w[y(672)+y(1268)](g[y(1448)],()=>x())})[d(769)](()=>{}),_}function gx(r,{blocked:e}={}){let o=S,a=indexedDB[o(765)+o(1444)](r);return e&&a[o(672)+o(1268)](o(536),()=>e()),Ce(a)[o(985)](()=>{})}function ei(r,e){let o=S,a={MucLU:o(405),LsjNW:o(1062)+"e",CcKpQ:"readonly",iJeol:o(1908),eiVka:function(p,_){return p!==_},LRvPH:function(p,_){return p in _}};if(!(r instanceof IDBDatabase&&!(e in r)&&typeof e===a[o(364)]))return;if(hn[o(964)](e))return hn[o(964)](e);let x=e[o(743)](/FromIndex$/,""),f=a[o(955)](e,x),d=oi[o(1241)](x);if(!a[o(784)](x,(f?IDBIndex:IDBObjectStore)[o(934)+"e"])||!(d||ii[o(1241)](x)))return;let g=async function(p,..._){let w=o;if(a[w(1721)]===a[w(1721)]){let y=this[w(1301)+w(459)](p,d?a[w(1364)]:a[w(1639)]),A=y[w(1902)];return f&&(A=A.index(_.shift())),(await Promise[w(997)]([A[x](..._),d&&y.done]))[0]}else{let y=_0x3250c2[w(928)+"g"](0,4-_0x616653[_0x15f7e7][w(398)]),A=y[w(1824)](_0x4164ca[_0x329d4c]);_0xc12014[w(358)](A)}};return hn[o(1216)](e,g),g}var ii,oi,hn,px=ni({"node_modules/idb/build/index.js"(){let r=S,e={ANcup:function(o){return o()},CnhOd:function(o){return o()},bIuiD:r(964),VyQli:r(1893),clHQM:r(1779),Sushh:r(1325)};e[r(1365)](Zs),e[r(692)](Zs),ii=[e[r(818)],e.VyQli,e[r(1125)],"getAllKeys",e[r(987)]],oi=[r(1532),"add",r(1661),r(679)],hn=new Map,ux(o=>({...o,get:(a,x,f)=>ei(a,x)||o[r(964)](a,x,f),has:(a,x)=>!!ei(a,x)||o[r(1163)](a,x)}))}}),mx={idb:function(r){let e=S,o={TlcLW:function(a,x){return a&x},llRtB:function(a,x){return a+x},ylIDu:function(a,x){return a===x},MRTQS:e(1598)};r.exports=Promise[e(1692)]().then(()=>(px(),si))[e(985)](function(a){let x=e;return o[x(1022)](o[x(1748)],"QuVfH")?a:(_0x154676[x(1606)+"t8"]?_0x417f29[x(1606)+"t8"](_0xea231a,_0x298da6):_0x24e3ea[_0x1f4f95]=o[x(1570)](255,_0x1aebe6),o[x(324)](_0x217176,1))})}},ti={};function Se(r){let e=S,o={nCDqy:function(f,d){return f!==d}};var a=ti[r];if(o[e(1909)](void 0,a))return a.exports;var x=ti[r]={exports:{}};return mx[r](x,x[e(725)],Se),x[e(725)]}Se.d=(r,e)=>{let o=k;for(var a in e)Se.o(e,a)&&!Se.o(r,a)&&Object[o(1490)+o(1571)](r,a,{enumerable:!0,get:e[a]})},(()=>{let r=S;Se.o=(e,o)=>Object[r(934)+"e"][r(1791)+r(1571)].call(e,o)})(),(()=>{let r=S,e={hYvrD:r(933),nDmGe:function(o,a){return o!=a},vrbtb:r(1172)+"d",zDMbS:r(355),gZSCx:r(601)+"le"};Se.r=o=>{let a=r;a(1079)===e[a(1061)]?Y._cursorFileName=_0x41937c:(e.nDmGe(e[a(1118)],typeof Symbol)&&Symbol[a(871)+a(978)]&&Object[a(1490)+"operty"](o,Symbol[a(871)+a(978)],{value:e[a(1459)]}),Object[a(1490)+a(1571)](o,e[a(1596)],{value:!0}))}})();function k(r,e){r=r-323;let o=gn(),a=o[r];if(k.ojjJXg===void 0){var x=function(p){let _="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=",w="",y="";for(let A=0,T,N,R=0;N=p.charAt(R++);~N&&(T=A%4?T*64+N:N,A++%4)?w+=String.fromCharCode(255&T>>(-2*A&6)):0)N=_.indexOf(N);for(let A=0,T=w.length;A<T;A++)y+="%"+("00"+w.charCodeAt(A).toString(16)).slice(-2);return decodeURIComponent(y)};k.kFLLOb=x,k.aIsoIS={},k.ojjJXg=!0}let f=o[0],d=r+f,g=k.aIsoIS[d];return g?a=g:(a=k.kFLLOb(a),k.aIsoIS[d]=a),a}var V={};(()=>{let r=S,e={vCbRl:function(s,t){return s(t)},IZahF:function(s,t){return s+t},RKFwJ:function(s,t){return s+t},tDhBn:function(s,t){return s+t},fDwfz:function(s,t){return s+t},NFMNT:function(s,t){return s*t},PPOXx:function(s,t){return s*t},XsHEe:function(s,t){return s+t},GtyKp:function(s,t,n){return s(t,n)},PhZuj:function(s,t){return s===t},uLmMQ:r(808),TAJuv:function(s,t){return s(t)},MYNcR:function(s,t){return s(t)},UiaYa:function(s,t){return s+t},HYeIB:function(s,t){return s(t)},NMavs:"0000",lRQcM:r(1399),XQcmL:function(s,t){return s!==t},HnmHb:r(1035),HoMJb:function(s,t){return s(t)},KCVwL:function(s,t,n){return s(t,n)},etGju:r(1685)+"e_success",FgvIw:r(1685)+r(673)+"t",gZxsk:"NATIVE_E"+r(441),QFsvI:r(1796)+r(1193),okkhw:r(1839)+"IES_ERROR",GeeWe:"OPEN_ERROR",IhceA:r(534)+r(1295),MRUgg:"timeout",lpCfY:function(s,t){return s>t},KyIqX:function(s,t){return s<t},PshyC:function(s,t){return s!==t},zNyqh:r(1560),Surst:function(s,t){return s<t},uhNHo:function(s,t){return s-t},pEcXP:function(s,t){return s!==t},kYOqf:r(610),XmkEi:r(1896),rmvAH:function(s,t){return s-t},hxkGJ:function(s,t){return s-t},cFXFq:function(s,t){return s<t},LYoDq:function(s,t){return s===t},MtaFG:r(414),yxQcO:function(s,t){return s<t},iaMDp:function(s,t){return s!==t},XlRrT:function(s,t,n){return s(t,n)},clFLh:function(s,t){return s!==t},CoewU:function(s,t){return s>>>t},JTSku:function(s,t,n){return s(t,n)},MPZZy:function(s,t){return s(t)},PdGwK:function(s,t,n){return s(t,n)},fcNmO:function(s,t){return s(t)},YRqdF:function(s,t,n){return s(t,n)},egFEC:function(s,t){return s&t},NIzyC:function(s,t){return s===t},mFUDh:"Missing "+r(1052)+r(1369)+r(1375),pcuWV:function(s){return s()},bUTnn:function(s,t,n){return s(t,n)},FbqYH:r(1297),cUJqW:r(915),OjDGz:function(s,t){return s<<t},FYrJM:function(s,t){return s&t},KJkBy:function(s,t){return s<<t},JQavR:function(s,t,n){return s(t,n)},etqQR:r(547),QJsEB:r(1219),Ebpdg:function(s,t,n){return s(t,n)},WkHhA:function(s,t,n){return s(t,n)},hBhfg:function(s,t){return s!==t},xKADW:r(1184),FCwNp:function(s,t,n){return s(t,n)},jEFFg:function(s,t,n){return s(t,n)},JLTMl:function(s,t,n){return s(t,n)},VqMLK:function(s,t,n){return s(t,n)},FmILj:"fsHga",LxWib:function(s,t,n){return s(t,n)},LmUKm:function(s,t){return s!==t},eBZGJ:function(s,t,n){return s(t,n)},sWUxP:function(s,t){return s!==t},kfkFq:function(s,t){return s(t)},QIaVU:function(s,t){return s(t)},JdEvb:function(s,t){return s(t)},LvYEV:function(s,t){return s(t)},xcNaX:function(s,t){return s(t)},uTCNF:function(s,t){return s(t)},RbAPU:function(s,t,n){return s(t,n)},qoupM:function(s,t){return s(t)},eXKut:function(s,t,n){return s(t,n)},WNffj:"Missing "+r(1052)+r(1369)+r(999),iLWlg:function(s,t){return s===t},BcDgj:"Missing "+r(1052)+r(1369)+"LogID",yBpdC:"Missing required field: service",GvWCn:function(s,t){return s===t},PGKRo:r(1275)+"required"+r(1369)+r(720),OAWpz:function(s,t){return s>=t},FWRjc:"usCeq",nzZox:function(s,t){return s(t)},wMJQc:function(s,t){return s&t},nvPqX:function(s,t,n){return s(t,n)},bCXeu:function(s,t){return s(t)},IAVzX:function(s,t){return s+t},gshCn:r(1613)+r(716)+r(1226),SVhJh:function(s,t){return s>=t},jDsBp:r(718),ujZZf:"Skip pas"+r(456),sDUwJ:function(s,t){return s>=t},SUKtn:r(910),RAtjl:r(1825),bFNfd:function(s,t){return s+t},gDOrB:function(s,t){return s*t},aKPEq:function(s,t){return s>t},OlFtm:function(s,t){return s>t},PbLar:function(s,t){return s+t},bmWAG:r(1615)+r(456),DkSBh:function(s,t){return s+t},FYReX:function(s,t,n,i){return s(t,n,i)},xqkBx:function(s,t){return s<t},mJhgj:function(s,t){return s&t},Bwqpy:function(s,t){return s(t)},RmXEf:function(s,t){return s+t},mwsNR:function(s,t){return s!==t},ZPsJe:r(1315),ZeIfH:r(1548),XKdiR:function(s,t){return s+t},hHTrP:function(s,t){return s!==t},SuZrB:function(s,t){return s&t},OGzsa:function(s,t){return s|t},AzNsL:function(s,t){return s!==t},NmCmY:function(s,t){return s==t},NfXix:function(s,t){return s+t},HkrcZ:function(s,t){return s+t},lyMQA:function(s,t){return s+t},aqqTl:function(s,t){return s&t},Txgfz:function(s,t){return s|t},pIyij:function(s,t){return s!==t},SDWso:r(1170),mxcZY:function(s,t){return s|t},buSyb:function(s,t){return s<<t},TYFFC:function(s,t){return s<=t},ASBMm:function(s,t){return s(t)},LEpMC:function(s,t){return s+t},LRNXx:"lUtcg",hLiNC:function(s,t){return s+t},uAEQI:function(s,t){return s!==t},wFWCm:function(s,t){return s|t},tNAtu:function(s,t){return s|t},OZyzo:function(s,t){return s===t},eLwyW:r(693),Srnoz:function(s,t){return s|t},UNJIT:function(s,t){return s<<t},KIuab:function(s,t){return s&t},XcoPJ:function(s,t){return s&t},kEMtc:function(s,t){return s>t},jwMLO:function(s,t,n){return s(t,n)},ZBRIg:function(s,t){return s>>t},Dcibz:function(s,t){return s+t},RRduQ:function(s,t){return s&t},JSEPq:function(s,t){return s<t},iQkRy:function(s,t){return s+t},URFGZ:function(s,t){return s+t},jvUQn:function(s,t){return s<<t},tuijP:function(s,t){return s<t},ePPFP:function(s,t){return s<t},uDdmU:function(s,t){return s>=t},mTnfT:function(s,t){return s<=t},YplBc:function(s,t){return s+t},wUCOZ:function(s,t){return s<<t},pwLsA:function(s,t){return s<t},WQbXM:function(s,t){return s<t},JycZi:function(s,t){return s>>t},TktiC:function(s,t){return s&t},kQLfG:function(s,t){return s>>t},uYQai:function(s,t){return s|t},TkBjY:function(s,t){return s>>t},FAEdw:function(s,t){return s&t},pvpzn:function(s,t){return s>>t},zbugm:function(s,t){return s|t},znKWJ:function(s,t){return s&t},CGaal:function(s,t,n){return s(t,n)},UGkFh:function(s,t,n){return s(t,n)},XomMP:function(s,t){return s<<t},PoUJS:function(s,t){return s&t},fFCGH:r(1725),RaqOz:function(s,t){return s>=t},YrfLy:function(s,t,n){return s(t,n)},currj:r(1033),ywDbN:function(s,t){return s(t)},YqWSw:function(s,t){return s&t},aCFHe:r(1704),lnOto:r(1421),ffNFY:function(s,t){return s&t},ejMxc:function(s,t){return s&t},xjkRc:function(s,t){return s(t)},QTzZY:function(s,t){return s(t)},wvtKI:function(s,t){return s<<t},XpZPF:function(s,t){return s&t},Msnhr:function(s,t){return s&t},WqzSU:function(s,t){return s&t},HByUy:function(s,t){return s(t)},Izdwd:function(s,t){return s<<t},dQrBA:function(s,t){return s&t},tVeHc:function(s,t){return s|t},RSrXP:function(s,t){return s|t},Anrwn:function(s,t){return s>>>t},bzqPe:function(s,t){return s<<t},BldmL:function(s,t){return s>>>t},apNmq:function(s,t){return s>>>t},TMsAJ:function(s,t){return s>>>t},lDKbc:function(s,t){return s<t},JsbTZ:function(s,t){return s<t},tUGQh:function(s,t){return s<t},FvUgo:function(s,t){return s<t},GOOwA:function(s,t){return s+t},GavAx:function(s,t){return s&t},PDNMS:function(s,t){return s!==t},ViGJH:function(s,t){return s&t},SjfPd:function(s,t){return s!==t},BLjjO:function(s,t){return s|t},uDkDn:function(s,t){return s|t},FLhVq:function(s,t){return s>>>t},gDzoy:function(s,t){return s>>>t},HuMsN:function(s,t){return s|t},qNTpU:function(s,t){return s>>>t},Yrqfc:function(s,t){return s>>>t},WXIte:function(s,t){return s>>>t},EToJI:function(s,t){return s!==t},wYPsJ:function(s,t){return s|t},fjVwr:function(s,t){return s(t)},trpYA:function(s,t){return s===t},RAiVd:"ZLkiv",BwzKH:r(355),QXXXm:r(601)+"le",CmcBb:function(s,t){return s===t},XHAxa:r(649),AcYZt:r(1082),pZcIu:function(s,t){return s|t},QRzVn:function(s,t){return s<<t},xCQYE:function(s,t){return s|t},QoyXJ:function(s,t){return s<<t},ZwTVG:function(s,t){return s|t},QLRZB:function(s,t){return s<<t},zAVKO:function(s,t){return s<<t},zerNS:function(s,t){return s<<t},lDleF:function(s,t){return s<<t},FmZcV:function(s,t){return s|t},UPDiy:function(s,t){return s|t},JvdhO:function(s,t){return s|t},ZWIqv:function(s,t){return s<<t},kfevH:function(s,t){return s&t},ajCgH:function(s,t){return s&t},BYfAb:function(s,t){return s>>>t},lptEp:function(s,t){return s(t)},MjzFI:function(s,t){return s>=t},AghvL:function(s,t){return s>=t},bkKAZ:function(s,t){return s%t},Qupyz:function(s,t){return s|t},QwjKG:function(s,t){return s/t},xcblt:function(s,t){return s*t},NNjgg:function(s,t){return s&t},KJiVJ:function(s,t){return s&t},GxMzr:function(s,t){return s>>>t},FlSwf:function(s,t){return s&t},lIvYK:function(s,t){return s>>>t},TUKbr:function(s,t){return s>>>t},YVeTH:r(1302),AnTBe:r(742),FxIuL:function(s,t){return s>>>t},fDMMV:function(s,t){return s&t},LLoJV:function(s,t){return s&t},IJiqo:function(s,t){return s>>>t},NZcHG:function(s,t){return s|t},Abjcd:function(s,t){return s===t},gvwUH:function(s,t){return s===t},coDEA:function(s,t){return s+t},FEvbh:function(s,t){return s>>>t},XZrfO:function(s,t){return s&t},WaESE:function(s,t){return s>>>t},nYSdw:function(s,t){return s&t},jHmCE:function(s,t){return s&t},swVHq:function(s,t){return s>>t},DetDA:function(s,t){return s&t},gOlBF:function(s,t){return s!==t},sjvwc:"mzHwq",JxTrA:r(1528),iyEFr:r(1329)+"1",FQZwg:function(s,t,n){return s(t,n)},bTgNB:r(1166),rUoYq:r(802),MjmNt:r(1827),NjKzc:r(1718),aIHoE:r(1358),pbzyM:r(1418),DMgdl:r(625),GDqPD:r(1199),YlrOf:function(s,t,n){return s(t,n)},DIccL:r(1452),KbJsS:function(s,t){return s|t},YIUot:function(s,t){return s<<t},dYbuH:function(s,t){return s+t},UcAUp:function(s,t){return s<<t},tNLBH:function(s,t){return s+t},moZkZ:function(s,t){return s<<t},dwqjE:function(s,t){return s+t},nyFBh:function(s,t){return s+t},vQicR:function(s,t){return s<<t},aGkAe:function(s,t){return s+t},sXZlD:r(487),ONUfD:r(1228),aRjJk:r(1215),bsCUA:r(775),WubgG:function(s,t){return s===t},JemeW:function(s,t){return s!==t},qpSon:r(369),KYOfA:function(s,t){return s instanceof t},DnljO:r(935)+r(566),nreul:function(s,t){return s|t},excJi:function(s,t){return s===t},QLQpB:function(s,t){return s&t},ifFjB:function(s,t){return s&t},QTIGA:function(s,t){return s|t},AvHfv:function(s,t){return s&t},Blurq:"ejbOc",DQrkd:function(s,t){return s===t},gPzNM:r(1354),xJUFp:function(s,t){return s===t},lTezq:r(469),jtlMq:function(s,t){return s!==t},FDOQY:r(925),FDqHG:function(s,t,n){return s(t,n)},JvbVn:function(s,t,n){return s(t,n)},ApFZg:r(1397),dDLsa:r(1797),xlEja:r(1305),ZDJdb:function(s,t,n){return s(t,n)},cGeRQ:r(942),QiMSP:r(1632),XTIPm:r(1356),wwYyR:r(1372),dciOu:function(s,t){return s||t},ctSIQ:function(s,t){return s!=t},NwrNR:r(932)+r(1430)+r(1396),heGrj:function(s,t,n,i){return s(t,n,i)},CdCVe:r(512),BvLzX:r(1450)+r(989),URRTb:r(988),QKWvq:function(s,t,n,i){return s(t,n,i)},yRGtE:function(s,t,n,i){return s(t,n,i)},crnip:r(1339)+r(514),qnrWS:r(1115),LBNId:"name",anVEF:function(s,t){return s===t},yEzCf:r(1160),KFPel:r(1733)+"3",nKWro:function(s,t){return s!=t},mgBuY:r(1172)+"d",kTPdd:function(s,t){return s<=t},KIXoP:r(1707)+r(1533)+r(1554)+r(1812)+r(415),RmWwU:function(s,t){return s+t},cgyYz:function(s,t){return s(t)},mWJrH:function(s,t){return s(t)},vYbqa:function(s,t,n){return s(t,n)},xyGDI:function(s,t){return s<t},aAwOJ:function(s,t){return s<t},gDOOh:function(s,t){return s&t},SvGUK:r(767),kyFkO:function(s,t){return s<t},jzGVQ:function(s,t){return s<t},CsUTP:function(s,t){return s<=t},fqfLd:function(s,t){return s<<t},aJnCJ:function(s,t){return s&t},dEhlo:function(s,t){return s&t},XgeXX:function(s,t){return s-t},yIihi:function(s,t){return s&t},QHkuU:function(s,t){return s&t},AxRZk:function(s,t){return s+t},srhlb:r(839),zbrNH:function(s,t){return s<t},imlHJ:function(s,t){return s===t},ogAYM:"qTLba",QYfdd:function(s,t){return s>>t},jpunk:function(s,t){return s|t},qXpKc:function(s,t){return s&t},MrmSI:function(s,t){return s&t},xIJWY:function(s,t){return s+t},keUSz:r(1859)+"1|3",jCLIv:function(s,t){return s&t},GeioZ:function(s,t){return s>>t},Jrccc:function(s,t){return s|t},tAzFa:function(s,t){return s>>t},TkEyb:function(s,t){return s&t},syDOd:function(s,t){return s|t},ucRsS:function(s,t){return s>>t},YmKNK:function(s,t){return s&t},GeEff:function(s,t){return s|t},dBFSV:function(s,t){return s==t},pswwS:function(s,t){return s(t)},CYswF:function(s,t){return s||t},YPGpQ:r(392),ieLrA:r(1264),PIMHn:r(1908),rjNVM:function(s,t){return s instanceof t},lZPHC:function(s,t){return s!=t},KNNVe:r(755)+r(1146),tjIvA:function(s,t){return s>=t},YVSor:function(s,t){return s<t},aObSc:function(s,t){return s&t},Vnpnm:function(s,t){return s<t},kXKlU:function(s,t){return s<<t},KKwzw:function(s,t){return s&t},xyLkS:function(s,t){return s|t},zgUTx:function(s,t){return s<<t},DFWYJ:function(s,t){return s&t},fqpzv:function(s,t){return s<<t},HfZwh:function(s,t){return s+t},qOLQH:function(s,t){return s+t},PaJNM:r(1148),MQjHA:r(538),XqaVX:r(892),LfaNa:r(348),DLWDO:function(s,t){return s>=t},CJUAa:function(s,t){return s|t},TRdmi:"unknown "+r(793),cnHUJ:r(686),VFCis:r(391),ymWHX:function(s,t){return s+t},GvyoB:"&jscallb"+r(1891)+"tierJSONP",BfyCw:function(s,t){return s===t},JSqPz:r(1731),EPbmz:function(s,t){return s===t},mJRsN:r(618),WwXye:r(1004),MzFVk:function(s,t,n){return s(t,n)},iufrM:function(s,t){return s===t},kLLho:"ftgeo",TsZYH:function(s,t){return s||t},PNWld:function(s,t){return s!==t},CEHKQ:r(977),TblaM:function(s,t){return s!==t},XQYGZ:function(s,t){return s||t},mVCFu:function(s,t){return s(t)},pFnfH:function(s,t){return s+t},NlHJw:function(s,t){return s!==t},kCfaz:r(1697),gtZAZ:r(1858),sqCzk:function(s,t){return s||t},HwSHP:function(s,t){return s!==t},oIdKq:"tavEy",AkOHa:r(334),dmXkU:function(s,t){return s||t},OyAyS:r(1616)+"DB failed",jKzeT:r(891),sPDKT:"message_id",NdukH:function(s,t){return s&t},ZTJXc:r(347),AJbic:function(s,t){return s(t)},cJNVZ:function(s,t,n){return s(t,n)},fXMgq:function(s,t){return s===t},MiLkB:"vdAfR",uyhUQ:r(914)+"er_qos",dAvcN:function(s,t,n,i){return s(t,n,i)},fmyCw:r(914)+r(1143)+"ck",FIFmu:function(s,t,n,i){return s(t,n,i)},QdDJZ:function(s,t,n){return s(t,n)},nQEzX:"x_fronti"+r(929)+"sgid",eUPmK:"need_ack",JhLio:r(1512),dwodX:function(s,t){return s&&t},rnQUO:r(1050),IhhIX:r(609),xrADi:function(s){return s()},BBWuX:r(507)+r(351)+"e",UppCf:function(s,t,n,i){return s(t,n,i)},vCpDU:r(1335),ibaVc:function(s,t){return s(t)},BHGmm:function(s,t){return s===t},Tmjjy:r(621),QRppu:"BOXFh",QmFHD:function(s,t){return s instanceof t},sWCGH:r(1257)+r(464)+r(1116),QckQq:r(755)+r(1146)+";charset"+r(1349),dSJex:"none_none",OiHJV:r(855),mbeov:function(s){return s()},qsMLR:function(s,t){return s>t},cDNPU:function(s,t){return s(t)},nSwRT:function(s,t){return s&t},owOqi:function(s,t){return s>>>t},geVaX:function(s,t){return s===t},ahKzC:r(1774),OmceX:"ngBlS",SmytA:function(s,t){return s+t},lwNRT:function(s,t){return s+t},mUnkd:function(s,t){return s+t},GtxII:r(846)+"t of ran"+r(1063),gNkbi:" + ",EXPmy:r(1093),fgMCq:function(s,t){return s!==t},UQFtd:r(1186),qoplO:function(s,t){return s>t},AWPDI:function(s,t){return s>=t},aiqxh:function(s,t){return s&t},awmdb:function(s,t){return s+t},EIUhl:function(s,t,n,i){return s(t,n,i)},SdlyQ:function(s,t){return s<<t},YsrsG:function(s,t){return s<<t},sNyho:function(s,t){return s+t},CaIqY:function(s,t){return s|t},AhiPq:function(s,t){return s+t},zAXbz:function(s,t){return s<<t},OaVzW:function(s,t){return s+t},ctWqE:function(s,t){return s+t},tcitu:function(s,t){return s>>>t},GWMMa:function(s,t){return s>>>t},xetnz:function(s,t){return s&t},EqOrJ:function(s,t){return s>>>t},IpZIb:function(s,t){return s&t},TdoEK:function(s,t){return s+t},AxtID:function(s,t){return s>>>t},OvIPl:function(s,t){return s>>>t},LhxHW:function(s,t){return s>t},IBwtx:function(s,t){return s+t},iYJCv:function(s,t){return s||t},UEqXe:function(s,t){return s!=t},mvLaL:function(s,t){return s!==t},ZdRIq:r(726),MJXei:function(s,t){return s&t},eOUZd:function(s,t){return s===t},QxELD:function(s,t){return s>>>t},buJQw:function(s,t){return s|t},qXHJF:function(s,t){return s<<t},wnVry:function(s,t){return s|t},DnOhc:function(s,t){return s<<t},LpfiO:function(s,t){return s|t},mWnKC:function(s,t){return s<<t},JCrwa:function(s,t){return s&t},oJdyy:r(656)+r(926)+r(958)+"ct",OUYAJ:"QzNgn",RFdCt:r(1469),bbBia:function(s,t){return s<t},LXEgF:function(s,t){return s|t},axrWD:function(s,t){return s|t},bJvWX:function(s,t){return s&t},tlEve:function(s,t){return s>>>t},jwHuR:function(s,t){return s&t},eUCgI:"KHAcl",TDIOO:function(s,t,n,i){return s(t,n,i)},uSDqy:r(1187),ArOQo:function(s,t){return s<t},RvRxn:function(s,t){return s+t},VMMnn:function(s,t,n,i){return s(t,n,i)},PfTwe:function(s,t,n,i){return s(t,n,i)},fLDiA:function(s,t,n,i){return s(t,n,i)},eMHJO:"cursor_f"+r(409),CedfM:function(s,t){return s<t},najKA:function(s,t,n){return s(t,n)},lVytV:function(s,t,n){return s(t,n)},oVoba:r(1763)+r(659),oVYON:"cursor_n"+r(1743),FdWsU:r(1805)+r(1828),kiuuz:function(s,t,n,i){return s(t,n,i)},swHSO:r(1276),dmsgt:r(1846),kjDWJ:function(s){return s()},dCJEp:r(505),stgdR:r(825),grOsY:function(s,t){return s(t)},rPDzN:r(1715)+"r",olbfa:function(s,t){return s|t},zdVir:function(s,t){return s>>>t},VYEna:function(s,t){return s|t},JuHFC:function(s,t){return s>t},fhaBb:function(s,t){return s===t},sEJhU:r(627),pDXJp:function(s,t,n,i){return s(t,n,i)},AxKgC:r(914)+"er_msgid",wHcGE:r(914)+r(1002),DPrfT:r(1643)+"s",PKwPu:function(s){return s()},BNoze:function(s,t){return s>t},QRJFU:function(s,t){return s>t},AcQnN:function(s,t){return s!==t},hWLai:"CDCus",iuvbV:r(1227),xIJnm:function(s){return s()},XauYf:function(s){return s()},MZdIP:function(s,t){return s(t)},KQOaE:function(s){return s()},KADQX:function(s,t){return s!==t},HpOaa:r(1491),XLPtW:r(827),VUcOl:r(1549),qaZto:function(s){return s()},iwzXZ:function(s,t,n,i){return s(t,n,i)},nPXFu:"vUeYE",vHYDC:function(s,t,n){return s(t,n)},QRCyy:function(s,t){return s===t},dvuuc:function(s,t,n){return s(t,n)},xuYre:function(s,t,n){return s(t,n)},sMBeE:function(s,t){return s===t},QpoOC:"success",zvkIU:r(1582),xGZAV:"gNNoE",jrTWi:function(s,t){return s!==t},AXeDR:"YVzLk",mlbno:r(363),gAxMc:r(1473)+r(786),diBqY:"auto",tEpOi:function(s,t){return s==t},pYrdi:r(1486)+"rovide v"+r(1027),JZury:r(1638),SBYca:function(s,t,n){return s(t,n)},rbJzl:r(1819)+"t",zZkcw:r(589),cpUOo:r(962),ATLxo:r(1612),OIMfx:"pageshow",sOhnD:function(s,t){return s(t)},JquUF:function(s){return s()},eEXbD:"PekEK",dCUPr:r(1724),dxwXR:r(874),tQoMW:r(1569),VahbC:r(483),Gdzns:r(548),GCOQh:"please p"+r(1084)+r(1591)+r(1564)+r(1895),YdXWj:r(1883),EWdEd:"web",AGSmK:function(s,t,n){return s(t,n)},ZLsYW:function(s,t){return s>t},dBrrU:function(s,t){return s-t},Qwkct:function(s,t,n){return s(t,n)},HScjT:function(s,t,n){return s(t,n)},SiOfg:"0|2|4|1|3",NylGS:r(1740),lPbus:function(s,t){return s!==t},BWodM:r(945),sBgED:function(s,t){return s(t)},StuDh:"FRONTIER>",zuqmR:function(s,t){return s*t},mexZB:function(s,t){return s-t},JJfWQ:function(s,t){return s>t},DpAyK:function(s,t){return s===t},HTBRj:r(946),HHWcJ:r(332),guFfc:r(472)+r(1021)+r(1819)+"ting server",MpkdJ:function(s,t){return s!==t},YLPkc:function(s,t,n){return s(t,n)},rKtEq:r(668)+r(1587)+r(1594)+"g",yzUbN:function(s,t){return s===t},FphBI:r(917),HSCoy:r(866)+"1",YstUd:"0|3|1|2|4",WauWk:function(s,t){return s===t},NafBn:r(615)+"s already closed",ltNKU:"AWfhE",vGzoE:r(611),eOpNB:function(s,t,n){return s(t,n)},FeUKT:function(s,t,n){return s(t,n)},NVjFT:r(472)+r(446)+r(1784)+r(1851),RMcBa:r(1566),lCCPg:"ack",RodAE:r(1871)+r(919),HLhpa:function(s,t){return s==t},ubTvR:function(s,t){return s==t},elkFq:r(1521),aNFeQ:function(s,t){return s instanceof t},aNHhp:function(s,t){return s(t)},CTHGa:function(s,t){return s(t)},bjeuo:function(s,t){return s(t)},rOwdm:function(s,t){return s||t},diWhl:function(s,t){return s instanceof t},aPyrA:function(s,t){return s(t)},SoTEc:"sent",IegBT:function(s,t){return s<t},cnrBy:"enqueue",JvTbe:function(s,t){return s||t},GqjvA:function(s,t){return s!==t},gjyKx:"manual r"+r(1094)+r(1550),tlMrb:r(1813)+"0",vzZTC:r(1001),ymvmn:function(s,t){return s!==t},NXrsF:r(1213),xtPRT:r(1543),jFtXH:function(s,t){return s*t},VQcdK:function(s,t){return s/t},isWEh:function(s,t){return s!=t},AJofD:r(1287),dENIA:function(s,t){return s!=t},XYKBN:function(s,t){return s===t},cPcEA:r(1188),ENGZq:"Dedicate"+r(707)+r(484)+"pe",nWicD:function(s,t){return s!=t},WeIIE:function(s,t){return s==t},ickjK:function(s,t){return s!=t},TcWNA:function(s,t){return s!=t},Xspif:function(s,t){return s!=t},RkWDA:function(s,t){return s===t},UPqsI:function(s,t){return s===t},CQsGg:r(1518)+r(1204)+r(857),rXGiD:function(s,t){return s===t},adVhL:"ServiceW"+r(730)+r(1860),biDhY:function(s,t){return s!=t},WcZgd:function(s,t){return s===t}};Se.r(V),Se.d(V,{FWS:()=>N0,CustomErrorEvent:()=>es,createCloseEvent:()=>pe,ReconnectEvent:()=>Zr,createErrorEvent:()=>ue,decodedFrame:()=>Xr,createOpenEvent:()=>os,CustomCloseEvent:()=>ts,createReconnectEvent:()=>Jn,FrontierMessageEvent:()=>rs,encodeFrame:()=>Gn,createMessageEvent:()=>is,OpenEvent:()=>ss,ErrorCode:()=>ze,Event:()=>st,MessageEvent:()=>ns});let o="";function a(s=""){let t=r,n="02",i=""+Date[t(1654)](),c=o||(o=e.vCbRl(p,s)),u=Math[t(586)]()[t(871)](16)[t(749)](-6);return e[t(455)](e[t(1348)](e[t(681)](n,i),c),u)}function x(){let s=r;return e[s(1786)](e[s(1863)](1e4,Date[s(1654)]()),Math.floor(e[s(1691)](1e4,Math[s(586)]())))}function f(s){let t=r;return e[t(849)](Array(8)[t(900)]("0"),e[t(1099)](parseInt,s,10).toString(2))[t(749)](-8)}function d(s){let t=r;if(e[t(678)](t(808),e[t(385)]))return e[t(681)](e[t(916)](Array,4)[t(900)]("0"),parseInt(s,2).toString(16))[t(749)](-4);_0x43dce0.log(_0x1388b2)}function g(s){let t=r,n=s.split(/\./)[t(1019)](u=>f(u)),i=[];return i[0]=e[t(1046)](d,e[t(923)](n[0],n[1])),i[1]=e[t(372)](d,e[t(923)](n[2],n[3])),[e[t(1829)],e[t(1829)],t(448),e.NMavs,e[t(1829)],e[t(1652)],i[0],i[1]].join("")}function p(s){let t=r;if(e[t(473)]("QMBWo",e.HnmHb)){let 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}/.test(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]))/[t(1098)](s);return n?e[t(916)](g,s):i?e.HoMJb(_,s):t(1016)+"00000000"+t(1016)+"00000000"}else return this[t(1501)]?.get(_0x22a9b8)}function _(s){let t=r,n={SUTsf:function(b,v){return e[k(1886)](b,v)},tYgBX:t(648),dHHYN:t(1685)+t(1541)+"s",PPdsN:e[t(1595)],qgNJy:e[t(1145)]},i="",c=[],u=0,h=0,m=!0,l=e[t(1829)];if(e[t(495)](s.indexOf("::"),-1)){let b=s[t(804)]("::");for(let C=0;e.KyIqX(C,b[t(398)]);C++)if(e[t(790)](e[t(1294)],t(967))){let P=b[C];if(P[t(1759)](":")>0){let L=P.split(":");m&&(u=L.length),h+=L[t(398)];for(let I=0;e[t(1298)](I,L[t(398)]);I++)if(e[t(790)](4,L[I][t(398)])){let te=l[t(928)+"g"](0,e.uhNHo(4,L[I][t(398)])),ne=te.concat(L[I]);c[t(358)](ne)}else c[t(358)](L[I]);m=!1}else{if(e[t(473)](4,P[t(398)]))if(e[t(655)](e[t(436)],e[t(698)])){let L=l[t(928)+"g"](0,e[t(328)](4,P.length)),I=L[t(1824)](P);c[t(358)](I)}else return _0xa4d70a?.find(L=>L.key===_0x14563e)?.[t(1375)];else c[t(358)](P);m&&(u+=1),h+=1,m=!1}}else{this["_clearPi"+t(1072)](),this[t(1283)+"gTimeoutId"]=e[t(502)](_0x370b8a,this[t(1559)][t(490)](this),this[t(895)][t(1320)+t(1762)]);let P=()=>{let I=t;n[I(1441)](_0x14378c,n[I(1104)]),this[I(454)](n[I(1681)],P),this.off(n[I(1092)],L)},L=()=>{let I=t;_0x316b82(n.qgNJy),this.off(I(1685)+"e_success",P),this.off(I(1685)+I(673)+"t",L)};this.on(e[t(974)],P),this.on(e[t(1595)],L),this._ping()}let v="";for(let C=0;e[t(1752)](C,e.hxkGJ(8,h));C++)v=v[t(1824)](l);for(let C=0;e[t(1804)](C,c[t(398)]);C++)if(e[t(1509)](C,u))if(e[t(790)](t(1080),e[t(756)]))i=i[t(1824)](v),i=i[t(1824)](c[C]);else{let P=(t(1821)+t(1123)).split("|"),L=0;for(;;){switch(P[L++]){case"0":_0x39969c[_0x4d0bbb[e[t(1767)]]=5001]=e[t(1767)];continue;case"1":return _0x55b37e;case"2":_0x5203d3[_0x25c1bb[e.QFsvI]=5002]=e[t(998)];continue;case"3":_0x4f8da7[_0x486bca[e.okkhw]=5003]=e[t(764)];continue;case"4":_0x16b7e4[_0x243ec0[t(1720)+"OR"]=5005]=e.GeeWe;continue;case"5":_0xf6901e[_0x3ec9b8[e[t(1676)]]=5004]=e[t(1676)];continue}break}}else i=i[t(1824)](c[C]);return i}{let b=s[t(804)](":");for(let v=0;e[t(1588)](v,b[t(398)]);v++){let C=b[v];if(e[t(1506)](4,b[v].length)){let P=l.substring(0,e[t(1327)](4,b[v].length)),L=P[t(1824)](C);i=i.concat(L)}else i=i[t(1824)](C)}return i}}function w(s,t){let n=r,i=s[n(465)];i!==void 0&&(e.XlRrT(ee,t,10),ke(t,i));let c=s[n(1375)];e.clFLh(void 0,c)&&(ee(t,18),e.GtyKp(ke,t,c))}function y(s){let t=r,n={};e:for(;!ye(s);){let i=j(s);switch(e[t(1667)](i,3)){case 0:break e;case 1:n.key=e.JTSku(be,s,e[t(1711)](j,s));break;case 2:n[t(1375)]=e[t(944)](be,s,e[t(876)](j,s));break;default:e[t(1328)](ie,s,e[t(393)](7,i))}}if(e[t(678)](void 0,n[t(465)]))throw new Error("Missing "+t(1052)+t(1369)+t(465));if(e[t(518)](void 0,n.value))throw new Error(e.mFUDh);return n}function A(s){let t=r,n=e[t(417)](z);return e[t(1328)](T,s,n),e[t(916)](Oe,n)}function T(s,t){let n=r,i={oUJsr:function(ne,me){return e.KJkBy(ne,me)}},c=s[n(999)];e[n(1411)](void 0,c)&&(e[n(1197)](ee,t,8),yt(t,c));let u=s[n(1174)];e[n(655)](void 0,u)&&(ee(t,16),e[n(944)](yt,t,u));let h=s[n(512)];if(h!==void 0)if(e.NIzyC(e[n(664)],e[n(1114)])){this[n(449)+n(1586)+n(486)](e.bUTnn(_0x2f5b36,e[n(930)],{code:1e3,reason:e[n(583)]})),this[n(1815)+n(695)]?.[n(834)+n(1139)+n(782)](),this[n(959)+n(1261)]?.["resetCou"+n(1200)]();return}else e[n(1620)](ee,t,24),e[n(1650)](yt,t,xe(h));let m=s.method;e[n(790)](void 0,m)&&(e.YRqdF(ee,t,32),e.WkHhA(yt,t,e[n(1886)](xe,m)));let l=s.headers;if(e[n(590)](void 0,l))for(let ne of l)if(e[n(518)](e[n(593)],e[n(593)])){e[n(688)](ee,t,42);let me=e[n(417)](z);e.jEFFg(w,ne,me),e[n(1904)](ee,t,me[n(1497)]),e[n(1904)](Wn,t,me),e[n(1046)](G,me)}else _0x3f2d5d=e[n(1711)](_0x17cafd,_0x504dba),_0x402634|=e.OjDGz(e[n(1195)](127,_0x61f2d5),7);let b=s["payloadE"+n(1746)];e[n(590)](void 0,b)&&(e[n(1099)](ee,t,50),ke(t,b));let v=s[n(696)+n(1347)];e[n(655)](void 0,v)&&(e.PdGwK(ee,t,58),e[n(1198)](ke,t,v));let C=s[n(470)];C!==void 0&&(e[n(1197)](ee,t,66),e[n(1198)](ee,t,C[n(398)]),zt(t,C));let P=s[n(1361)];if(e[n(1506)](void 0,P))if(e[n(1506)](e[n(1539)],e.FmILj)){let{value:ne,offset:me}=_0x326879(_0x51519d,_0x1c6887);_0x46d54f=me,_0x3cf0f1=i[n(1017)](_0x48738b,8)>>>0,_0x12795a+=ne}else ee(t,74),e[n(830)](ke,t,P);let L=s[n(1244)+"ming"];L!==void 0&&(e.VqMLK(ee,t,82),e[n(1461)](ke,t,L));let I=s.msgID;e[n(1690)](void 0,I)&&(e[n(1814)](ee,t,90),e[n(924)](ke,t,I));let te=s.frameType;e.sWUxP(void 0,te)&&(ee(t,96),e[n(1197)](yt,t,e[n(372)](xe,te)))}function N(s){return e[r(1875)](R,e.QIaVU(Ae,s))}function R(s){let t=r,n={};e:for(;!ye(s);){let i=e[t(370)](j,s);switch(e[t(1667)](i,3)){case 0:break e;case 1:n[t(999)]=Jr(s,!0);break;case 2:n[t(1174)]=e[t(924)](Jr,s,!0);break;case 3:n[t(512)]=e[t(383)](j,s);break;case 4:n[t(720)]=j(s);break;case 5:{let c=e[t(1394)](K,s);(n[t(1246)]||(n[t(1246)]=[]))[t(358)](e[t(340)](y,s)),s[t(1497)]=c;break}case 6:n["payloadE"+t(1746)]=e[t(1198)](be,s,j(s));break;case 7:n[t(696)+t(1347)]=e[t(577)](be,s,e[t(1886)](j,s));break;case 8:n[t(470)]=e.JTSku(Bt,s,e[t(1394)](j,s));break;case 9:n.LogIDNew=e[t(830)](be,s,e[t(1886)](j,s));break;case 10:n[t(1244)+t(1291)]=e.jEFFg(be,s,e.LvYEV(j,s));break;case 11:n[t(462)]=be(s,e.MPZZy(j,s));break;case 12:n[t(1552)+"e"]=e[t(771)](j,s);break;default:e[t(427)](ie,s,e.FYrJM(7,i))}}if(e[t(518)](void 0,n[t(999)]))throw new Error(e[t(1359)]);if(e[t(941)](void 0,n[t(1174)]))throw new Error(e[t(1165)]);if(n[t(512)]===void 0)throw new Error(e[t(1579)]);if(e[t(1494)](void 0,n[t(720)]))throw new Error(e[t(1014)]);return n}function K(s){let t=r,n={iVueu:function(i,c){return e[k(1296)](i,c)}};if(e.sWUxP(e[t(1889)],"usCeq")){if(n.iVueu(_0x1c27ab,_0x30506c))return _0x5af506}else{let i=e[t(619)](j,s),c=s.limit;return s[t(1497)]=e[t(455)](s[t(607)],i),c}}function ie(s,t){let n=r;switch(t){case 0:for(;e[n(525)](128,e[n(372)](J,s)););break;case 2:e.nvPqX(we,s,e[n(520)](j,s));break;case 5:we(s,4);break;case 1:we(s,8);break;default:throw new Error(e.IAVzX(e[n(1884)],t))}}function xe(s){let t=r;return s|=0,{low:s,high:s>>31,unsigned:e[t(1478)](s,0)}}let D=[];function z(){let s=r,t=D[s(1303)]();return t?(t[s(607)]=t.limit=0,t):{bytes:new Uint8Array(64),offset:0,limit:0}}function G(s){let t=r;if(e[t(1544)]===t(1910))return this[t(449)+t(403)+t(521)](_0x2ea7fa),_0x191152();D[t(358)](s)}function Ae(s){return{bytes:s,offset:0,limit:s.length}}function Oe(s){let t=r,n=s[t(1663)],i=s[t(1497)];return n[t(398)]===i?n:n[t(795)](0,i)}function we(s,t){let n=r;if(e[n(495)](e[n(455)](s[n(607)],t),s[n(1497)]))throw new Error(e[n(712)]);s[n(607)]+=t}function ye(s){return e[r(1817)](s.offset,s.limit)}function ge(s,t){let n=r;if(e[n(1494)](e[n(494)],e.RAtjl))return this[n(1501)]?.[n(1722)](_0x54c057);{let i=s.bytes,c=s.offset,u=s[n(1497)],h=e[n(1191)](c,t);if(e[n(495)](h,i[n(398)])){let m=new Uint8Array(e[n(1809)](2,h));m[n(1216)](i),s.bytes=m}return s[n(607)]=h,e[n(1280)](h,u)&&(s[n(1497)]=h),c}}function et(s,t){let n=r,i=s[n(607)];if(e[n(582)](e.PbLar(i,t),s.limit))throw new Error(e[n(886)]);return s[n(607)]+=t,i}function Bt(s,t){let n=r,i=e[n(427)](et,s,t);return s[n(1663)][n(795)](i,e[n(1831)](i,t))}function zt(s,t){let n=r,i=ge(s,t[n(398)]);s.bytes[n(1216)](t,i)}function be(s,t){let n=r,i={XkkfF:function(b){return e.pcuWV(b)},ABXYF:function(b,v,C){return b(v,C)},tosCd:function(b,v,C,P){return e[k(1164)](b,v,C,P)}},c=e[n(377)](et,s,t),u=String["fromChar"+n(397)],h=s[n(1663)],m="\uFFFD",l="";for(let b=0;e[n(896)](b,t);b++){let v=h[e[n(1831)](b,c)],C,P,L,I;if(e[n(557)](128,v)===0)l+=e[n(789)](u,v);else if(e[n(941)](224&v,192))if(e[n(511)](b,1)>=t)l+=m;else if(e[n(325)](e[n(853)],e[n(1223)]))C=h[e[n(1348)](e[n(562)](b,c),1)],e[n(1524)](e.SuZrB(192,C),128)?l+=m:(I=e[n(337)](e[n(557)](31,v)<<6,63&C),e[n(1752)](I,128)?l+=m:e[n(1254)](n(1857),n(1857))?(_0x3ecac6(),bjSpdA[n(740)](_0x822e72)):(l+=e[n(771)](u,I),b++));else return new _0x260ca6(te=>{let ne=n;i[ne(734)](_0x1a0ace,te,this[ne(981)+ne(1023)+"e"](_0x5ee8b2))});else if(e[n(1231)](e[n(1195)](240,v),224))if(e.sDUwJ(e.NfXix(b,2),t))l+=m;else if(C=h[e[n(1738)](e[n(1831)](b,c),1)],P=h[e[n(515)](e[n(1831)](b,c),2)],e[n(1131)](e[n(927)](C,e[n(491)](P,8)),49344)!==32896)l+=m;else if(e.pIyij(n(1170),e.SDWso)){let te=new _0x120f3d(_0x221121(_0xb63a50));return i[n(666)](_0x3d3cc4,_0x232d97,te,0),te}else I=e.Txgfz(e[n(1235)](e.buSyb(e[n(557)](15,v),12),e[n(491)](63&C,6)),e[n(393)](63,P)),I<2048||e[n(1817)](I,55296)&&e[n(508)](I,57343)?l+=m:(l+=e[n(1788)](u,I),b+=2);else if(e.NmCmY(e[n(1128)](248,v),240))if(e.LEpMC(b,3)>=t)l+=m;else if(n(1655)!==e[n(1378)])if(C=h[e[n(455)](e[n(1070)](b,c),1)],P=h[e[n(849)](e[n(1070)](b,c),2)],L=h[e.hLiNC(b,c)+3],e[n(1179)](e[n(393)](e[n(810)](e[n(1673)](C,e[n(1013)](P,8)),e[n(1013)](L,16)),12632256),8421504))l+=m;else{if(e[n(868)](n(1641),e[n(641)]))return _0x1843b4||(_0x3b82d4=[_0x36ab96,_0x1b18eb,_0x233ba,_0x1c03fb,_0x26d0e5]);I=e[n(1235)](e.Srnoz(e[n(1195)](7,v)<<18,e[n(1898)](e[n(525)](63,C),12))|e[n(491)](e[n(1028)](63,P),6),e[n(1526)](63,L)),I<65536||e[n(1653)](I,1114111)?l+=m:(I-=65536,l+=e[n(1770)](u,e[n(604)](I,10)+55296,e.Dcibz(e[n(826)](1023,I),56320)),b+=3)}else return this[n(713)+"T"]||this[n(1475)+"X"]?this["_miniNav"+n(1563)+n(387)]:(this[n(1447)+"er"]||this[n(1446)+"r"])&&this._options[n(1646)+n(639)+n(633)]?_0x32ec01[n(326)]:!0;else l+=m}return l}function ke(s,t){let n=r,i=t[n(398)],c=0;for(let m=0;e.JSEPq(m,i);m++){let l=t[n(362)+"At"](m);e[n(1817)](l,55296)&&e[n(508)](l,56319)&&e[n(1729)](m,1)<i&&(l=e[n(328)](e[n(1625)](e[n(1270)](l,10),t[n(362)+"At"](++m)),56613888)),c+=e.tuijP(l,128)?1:e[n(1298)](l,2048)?2:e[n(776)](l,65536)?3:4}ee(s,c);let u=e.nvPqX(ge,s,c),h=s[n(1663)];for(let m=0;m<i;m++){let l=t[n(362)+"At"](m);e[n(1067)](l,55296)&&e.mTnfT(l,56319)&&e.YplBc(m,1)<i&&(l=e[n(1786)](e[n(1086)](l,10),t[n(362)+"At"](++m))-56613888),e[n(1453)](l,128)?h[u++]=l:(e.WQbXM(l,2048)?h[u++]=e.egFEC(e[n(578)](l,6),31)|192:(e.cFXFq(l,65536)?h[u++]=e.Txgfz(e.JycZi(l,12)&15,224):(h[u++]=e[n(1235)](e[n(1208)](e[n(606)](l,18),7),240),h[u++]=e[n(1538)](e[n(1128)](e[n(1345)](l,12),63),128)),h[u++]=e[n(1538)](e.FAEdw(e[n(509)](l,6),63),128)),h[u++]=e[n(1836)](e.znKWJ(63,l),128))}}function Wn(s,t){let n=r;if(e[n(868)](n(1251),n(1251))){let i=e[n(1156)](ge,s,t.limit),c=s.bytes,u=t[n(1663)];for(let h=0,m=t[n(1497)];e[n(896)](h,m);h++)c[e[n(455)](h,i)]=u[h]}else return n(1176)+"_"+this[n(824)]}function J(s){return s.bytes[et(s,1)]}function nt(s,t){let n=r,i=e[n(1492)](ge,s,1);s.bytes[i]=t}function j(s){let t=r,n=0,i=0,c;do c=e.nzZox(J,s),n<32&&(i|=e[t(1020)](127&c,n)),n+=7;while(e.PoUJS(128,c));return i}function ee(s,t){let n=r;if(e[n(655)](e.fFCGH,e[n(1405)]))e[n(1904)](_0x3b8200,_0x27b38c,18),e[n(502)](_0x34d17d,_0x20fe24,_0x555cf4);else{for(t>>>=0;e[n(381)](t,128);)e.bUTnn(nt,s,e[n(1538)](e.egFEC(127,t),128)),t>>>=7;e[n(1198)](nt,s,t)}}function Jr(s,t){let n=r,i={jkdIJ:e[n(930)],VVpQN:function(c,u,h){return e[n(1197)](c,u,h)}};if(e[n(1254)](n(719),n(561))){let c=0,u=0,h=0,m;if(m=J(s),c=127&m,e.KIuab(128,m)&&(m=e.ywDbN(J,s),c|=e[n(1086)](e[n(1511)](127,m),7),e.TktiC(128,m)&&(m=J(s),c|=e[n(1020)](e.egFEC(127,m),14),128&m&&(m=e[n(372)](J,s),c|=(127&m)<<21,e[n(1208)](128,m)))))if(e[n(1728)]===e[n(584)]){let l=e[n(859)](_0x1c8a40,e[n(984)],{message:_0x459d38[n(1740)],code:_0x114e28["MESSAGE_"+n(1295)],error:_0x389213});this["_dispatc"+n(1158)+n(486)](l)}else m=e[n(1886)](J,s),u=e[n(872)](127,m),e.ejMxc(128,m)&&(m=e[n(1394)](J,s),u|=e[n(491)](127&m,7),128&m&&(m=e[n(458)](J,s),u|=e[n(1013)](e[n(872)](127,m),14),e.TktiC(128,m)&&(m=e[n(931)](J,s),u|=e.wvtKI(e[n(367)](127,m),21),e[n(1808)](128,m)&&(m=e[n(372)](J,s),h=127&m,e[n(1371)](128,m)&&(m=e[n(887)](J,s),h|=e[n(709)](e[n(1157)](127,m),7))))));return{low:e[n(359)](c,e[n(709)](u,28)),high:e[n(1799)](e.Anrwn(u,4),e.bzqPe(h,24)),unsigned:t}}else this.emit(i.jkdIJ,i[n(1391)](_0x12e523,i[n(585)],{..._0xf07feb}))}function yt(s,t){let n=r,i=t[n(420)]>>>0,c=e.BldmL(e[n(1737)](t[n(420)],28)|e[n(1020)](t.high,4),0),u=e[n(643)](t.high,24),h=u===0?c===0?e[n(814)](i,16384)?e[n(705)](i,128)?1:2:e[n(1406)](i,2097152)?3:4:c<16384?e[n(1442)](c,128)?5:6:c<2097152?7:8:e[n(1708)](u,128)?9:10,m=ge(s,h),l=s.bytes;switch(h){case 10:l[e[n(531)](m,9)]=e.GavAx(e[n(840)](u,7),1);case 9:l[m+8]=e[n(1153)](9,h)?e.zbugm(128,u):e.ViGJH(127,u);case 8:l[e[n(923)](m,7)]=e[n(1529)](8,h)?c>>>21|128:e[n(670)](c,21)&127;case 7:l[m+6]=h!==7?e.BLjjO(e[n(670)](c,14),128):c>>>14&127;case 6:l[m+5]=h!==6?e[n(546)](e.FLhVq(c,7),128):e.gDzoy(c,7)&127;case 5:l[m+4]=h!==5?e.OGzsa(128,c):127&c;case 4:l[e[n(1901)](m,3)]=e.iaMDp(4,h)?e[n(772)](e[n(735)](i,21),128):e[n(826)](i>>>21,127);case 3:l[e[n(1768)](m,2)]=e[n(655)](3,h)?e[n(820)](i,14)|128:e[n(525)](e.CoewU(i,14),127);case 2:l[m+1]=e[n(1254)](2,h)?e[n(810)](e[n(1667)](i,7),128):e[n(954)](i,7)&127;case 1:l[m]=e.EToJI(1,h)?e[n(1065)](128,i):e.FAEdw(127,i)}}function Xr(s){return N(s)}function Gn(s){return e.fjVwr(A,s)}let Vr=65536,jo=e[r(416)],rt=e[r(905)](Vr,Vr),Yr=rt*rt,Qr=e[r(1201)](Yr,2),Be=String[r(934)+"e"][r(362)+"At"];class O{constructor(t,n,i){let c=r;this[c(528)]=!0,this[c(420)]=e[c(1323)](0,t),this.high=0|n,this.unsigned=!!i}static[r(528)](t){return t&&e[r(1389)](!0,t.isLong)}static fromBits(t,n,i){let c=r;return e[c(325)](c(1414),e[c(1826)])?this[c(1501)]?.[c(1216)]({message_id:_0x506fee,timestamp:_0x30876e}):new O(t,n,i)}static[r(1665)+"s"](t,n,i){let c=r;return i?O["fromByte"+c(522)](t,n):O[c(1665)+"sBE"](t,n)}static[r(1665)+"sLE"](t,n){let i=r,c={bCbaP:i(1172)+"d",zxTju:e[i(1135)],knxDd:e[i(629)]};if(e[i(1112)](e[i(1173)],e[i(605)]))CbOiDf[i(1610)]!=typeof _0x3c95a0&&_0x2b8719[i(871)+i(978)]&&_0x3986a7[i(1490)+i(1571)](_0xf05223,_0x39a727[i(871)+"Tag"],{value:CbOiDf[i(922)]}),_0x2f3ca2["definePr"+i(1571)](_0x38755b,CbOiDf.knxDd,{value:!0});else return new O(e[i(927)](e[i(1088)](t[0]|e.QRzVn(t[1],8),e[i(1898)](t[2],16)),t[3]<<24),e[i(1619)](e.HuMsN(t[4],e.QoyXJ(t[5],8)),t[6]<<16)|e[i(1086)](t[7],24),n)}static[r(1665)+r(1840)](t,n){let i=r;return new O(e[i(772)](e[i(1619)](e.ZwTVG(e[i(813)](t[4],24),e.UNJIT(t[5],16)),e.jvUQn(t[6],8)),t[7]),e[i(546)](e[i(927)](e[i(359)](t[0]<<24,e.QLRZB(t[1],16)),e[i(1811)](t[2],8)),t[3]),n)}static[r(750)](t){let n=r;return t===jo?$r:new O(e[n(1737)](e[n(1619)](Be.call(t,0)|e[n(1850)](Be[n(683)](t,1),8)|e[n(418)](Be[n(683)](t,2),16),e[n(913)](Be[n(683)](t,3),24)),0),e.FmZcV(e[n(1480)](e[n(694)](Be[n(683)](t,4),Be[n(683)](t,5)<<8),e.ZWIqv(Be.call(t,6),16)),e[n(418)](Be[n(683)](t,7),24))>>>0,!0)}[r(847)](){let t=r;return String[t(851)+"Code"](e.kfevH(255,this[t(420)]),this[t(420)]>>>8&255,e.Msnhr(e[t(840)](this[t(420)],16),255),e[t(1551)](this[t(420)],24),e[t(1463)](255,this[t(1504)]),e.wMJQc(e[t(1775)](this[t(1504)],8),255),e.wMJQc(e[t(840)](this.high,16),255),e[t(1775)](this.high,24))}static[r(356)+"er"](t,n=!0){let i=r;if(e[i(1107)](isNaN,t))return n?Wo:$r;if(n){if(e[i(338)](t,Yr))return Jo}else{if(t<=-Qr)return Xo;if(e[i(1350)](e[i(1070)](t,1),Qr))return Go}return O.fromBits(e[i(1255)](t,rt)|0,e.Qupyz(e[i(526)](t,rt),0),n)}[r(1687)](){let t=r;return this[t(1627)]?e[t(511)](e[t(670)](this[t(1504)],0)*rt,e[t(1775)](this[t(420)],0)):e.xcblt(this.high,rt)+e[t(670)](this[t(420)],0)}[r(1289)](){let t=r;return e.GvWCn(0,this.high)&&e[t(678)](0,this[t(420)])}[r(1911)](t){let n=r;if(e[n(1389)](e[n(474)],e[n(1713)])){let i=this[n(1504)],c=this[n(420)];return[e[n(560)](255,c),e[n(1890)](e[n(778)](c,8),255),e.TMsAJ(c,16)&255,c>>>24,255&i,e[n(477)](e[n(643)](i,8),255),e.FlSwf(e[n(1181)](i,16),255),e[n(425)](i,24)]}else{O[n(528)](t)||(t=O[n(356)+"er"](t));let i=e[n(1667)](this[n(1504)],16),c=e[n(873)](65535,this[n(1504)]),u=e[n(1693)](this.low,16),h=e[n(477)](65535,this[n(420)]),m=t[n(1504)]>>>16,l=e[n(540)](65535,t[n(1504)]),b=e[n(1737)](t[n(420)],16),v=e.LLoJV(65535,t[n(420)]),C=0,P=0,L=0,I=0;return I+=e.YplBc(h,v),L+=e[n(1181)](I,16),I&=65535,L+=u+b,P+=L>>>16,L&=65535,P+=e[n(1729)](c,l),C+=e.IJiqo(P,16),P&=65535,C+=e[n(1070)](i,m),C&=65535,O[n(596)](e.zbugm(e[n(1086)](L,16),I),e[n(722)](e.Izdwd(C,16),P),this[n(1627)])}}equals(t){let n=r;return O[n(528)](t)||(t=O.fromNumber(t)),this.unsigned!==t[n(1627)]&&e[n(1389)](e.TUKbr(this[n(1504)],31),1)&&e[n(1737)](t[n(1504)],31)===1?!1:e[n(1509)](this[n(1504)],t[n(1504)])&&e.LYoDq(this[n(420)],t.low)}[r(1832)](){let t=r;return this.low===-1&&e[t(1281)](-1,this[t(1504)])?O[t(596)](0,0,this[t(1627)]):e[t(1007)](-1,this[t(420)])?O[t(596)](0,this[t(1504)]+1,this[t(1627)]):O[t(596)](e.coDEA(this.low,1),this.high,this[t(1627)])}toBytes(t){let n=r;return t?this[n(653)+"E"]():this[n(614)+"E"]()}toBytesLE(){let t=r,n=this[t(1504)],i=this[t(420)];return[e[t(1028)](255,i),e[t(393)](e[t(820)](i,8),255),e[t(1131)](e.FEvbh(i,16),255),i>>>24,e[t(1208)](255,n),e[t(393)](e[t(1737)](n,8),255),e[t(1890)](e[t(1551)](n,16),255),e.Yrqfc(n,24)]}[r(614)+"E"](){let t=r,n=this[t(1504)],i=this[t(420)];return[e[t(820)](n,24),n>>>16&255,e[t(911)](e[t(821)](n,8),255),e[t(1581)](255,n),e[t(687)](i,24),i>>>16&255,e[t(840)](i,8)&255,e[t(1530)](255,i)]}}let $r=new O(0,0,!1),Wo=new O(0,0,!0),Go=O[r(596)](-1,2147483647,!1),Jo=O[r(596)](-1,-1,!0),Xo=O[r(596)](0,-2147483648,!1);var ze=(function(s){let t=r,n=(t(352)+t(388)).split("|"),i=0;for(;;){switch(n[i++]){case"0":s[s[e.QFsvI]=5002]=e[t(998)];continue;case"1":s[s[t(1058)+t(441)]=5001]=t(1058)+t(441);continue;case"2":s[s[e.IhceA]=5004]=e[t(1676)];continue;case"3":s[s[e[t(1553)]]=5005]=e.GeeWe;continue;case"4":return s;case"5":s[s["MAX_RETR"+t(1126)+"R"]=5003]=t(1839)+t(1126)+"R";continue}break}})({});class st{constructor(t){let n=r;this[n(1155)]=t,this.target=null}}class Zr extends st{constructor(t,n){super(t),this.message=n&&n.message||null}}class es extends st{constructor(t,n){let i=r,c="0|3|2|5|4|1|6"[i(804)]("|"),u=0;for(;;){switch(c[u++]){case"0":super(t);continue;case"1":this.message=n&&n.message||"";continue;case"2":this.colno=n&&n.colno||0;continue;case"3":this[i(1033)]=n&&n.error||null;continue;case"4":this.lineno=n&&n.lineno||0;continue;case"5":this[i(1183)]=n&&n.filename||"";continue;case"6":this.code=n&&n.code||5001;continue}break}}}class ts extends st{constructor(t,n){let i=r,c={UvuMN:function(u,h){return e[k(1793)](u,h)},AxspB:function(u,h){return e[k(1546)](u,h)}};if(e.gOlBF(e[i(1142)],e[i(912)])){let u=e[i(700)][i(804)]("|"),h=0;for(;;){switch(u[h++]){case"0":this[i(793)]=n&&n[i(793)]||"";continue;case"1":this[i(1787)+i(794)]=n&&n[i(1787)+i(794)]||!1;continue;case"2":this[i(634)]=n&&n[i(634)]||0;continue;case"3":super(t);continue;case"4":this[i(1410)]=n&&n.wasClean||!1;continue}break}}else _0xe4a9f7[_0x18dba0++]=c[i(1671)](_0xa93103,6)|192,_0x3c76ad[_0x15d682++]=c[i(1572)](63,_0x10dc76)|128}}class ns extends st{constructor(t,n){let i=r;super(t),this[i(1471)]=n&&n[i(1471)]||null}}class rs extends ns{constructor(t,n){let i=r,c={SxQPi:function(u,h,m){return e.FQZwg(u,h,m)},joOxa:function(u,h,m){return e[k(1814)](u,h,m)},WiWIT:function(u,h){return e[k(789)](u,h)}};e[i(890)]!==i(1166)?(mERsSL.SxQPi(_0x3b0cbe,_0x57faf0,24),mERsSL.joOxa(_0x156035,_0x131402,mERsSL.WiWIT(_0x2c3ee1,_0x4ab503))):(super(t),this[i(1471)]=n&&n.data||null,this[i(1740)]=n&&n.message||null)}}class ss extends st{constructor(t,n){let i=r;e[i(868)](e[i(1089)],e[i(1175)])?this["currentE"+i(1317)+i(1038)+"t"]=0:(super(t),this[i(1471)]=n&&n[i(1471)]||null)}}function ue(s,{message:t,code:n,error:i}){let c=r;return e[c(1153)](c(1718),e[c(1190)])?this[c(1501)].isReady:new es(s,{message:t,code:n,error:i})}function pe(s,{code:t,reason:n,wasClean:i,willReconnect:c}){let u=r,h={wGKgO:function(m,l){return m(l)},mlZgL:function(m,l){return e[k(776)](m,l)},kxhtr:function(m,l){return e[k(587)](m,l)},QbTlw:function(m,l){return e[k(1659)](m,l)}};if(e.gvwUH(e[u(798)],e[u(728)]))_0x2859c7=DmtErz[u(1316)](_0x41069f,_0x104be0),DmtErz[u(1413)](_0x375571,32)&&(_0x181004|=DmtErz[u(1545)](DmtErz[u(1423)](127,_0x2b1d3e),_0x4a3e51)),_0x4c14e3+=7;else return new ts(s,{code:t,reason:n,wasClean:i,willReconnect:c})}function is(s,{data:t,message:n}){return e[r(1078)]===e.GDqPD?null:new rs(s,{data:t,message:n})}function os(s,{data:t}){return new ss(s,{data:t})}function Jn(s,{message:t}){return new Zr(s,{message:t})}class as{constructor(t,n){let i=r;this.endpoints=t,this[i(1429)+"es"]=n,this[i(1245)+i(888)]=0,this[i(412)+i(1317)+"riesCount"]=0}[r(834)+r(1139)+r(782)](){let t=r;this["currentI"+t(888)]=0,this[t(412)+t(1317)+t(1038)+"t"]=0}[r(1214)+"es"](){let t=r;this[t(412)+t(1317)+t(1038)+"t"]=0}[r(1096)+r(1210)+"nt"](){let t=r;return this[t(1583)+"s"][this[t(1245)+t(888)]]}getCurrentEndpointTriesCount(){let t=r;return this[t(412)+t(1317)+t(1038)+"t"]}["checkRea"+r(471)+"es"](){let t=r;return!!(this["currentI"+t(888)]>=this[t(1583)+"s"].length||e[t(678)](this.currentIndex,this[t(1583)+"s"][t(398)]-1)&&e[t(1112)](this.currentEndpointTriesCount,this[t(1429)+"es"]))}[r(1694)+r(404)+r(1161)+"hedMaxRe"+r(1456)](){let t=r,n={BSBfQ:function(i,c,u){return e[k(333)](i,c,u)},TmAmF:"error",hJbCi:e[t(930)]};if(e.DIccL===e[t(1495)])return e.NmCmY(this[t(1245)+t(888)],this.endpoints[t(398)])?!0:e[t(1280)](this[t(412)+t(1317)+"riesCount"],this[t(1429)+"es"]);{let i=n[t(631)](_0x57d6fa,n.TmAmF,{message:this[t(439)+t(1894)+t(1834)](_0x171d73)});this[t(339)](t(1033),i);let c=_0x243e69(n[t(738)],{reason:this["_formatE"+t(1894)+t(1834)](_0x556ba7)});this.emit(n[t(738)],c)}}[r(1314)+r(752)+r(327)+r(1412)+r(1271)](){let t=r;if(e[t(1427)]!==e[t(701)])return this["currentE"+t(1317)+t(1038)+"t"]=1,this[t(1245)+t(888)]++,this[t(1583)+"s"][this[t(1245)+"ndex"]];{let n=new _0x3ce8be(e[t(1844)](e.BLjjO(e.BLjjO(e[t(1037)](_0x8a1f6c[e.dYbuH(_0x56c247,4)],24),e[t(450)](_0x4392ae[e[t(819)](_0x221396,5)],16)),e[t(684)](_0x146247[e.dwqjE(_0x5906d6,6)],8)),_0xecf430[e[t(1712)](_0x330352,7)]),e[t(772)](_0x5a0b96[e[t(1357)](_0x59d45c,0)]<<24|e[t(1438)](_0x2da5dc[e[t(901)](_0x24880e,1)],16),_0x17da48[_0x49123c+2]<<8)|_0xc8f56d[e[t(1129)](_0x593112,3)],!0);return _0x8225a7+=8,{value:n,offset:e[t(591)](_0xae4529,8)}}}[r(1096)+r(1210)+r(898)+r(781)](){let t=r,n={EmKIv:function(i,c){return i(c)}};return e[t(647)](e[t(1124)],e[t(564)])?(this[t(412)+t(1317)+t(1038)+"t"]++,this[t(1096)+t(1210)+"nt"]()):function(i,...c){let u=t,h=_0x28de2d[u(683)](qwVmSU[u(516)](_0x1995b6,this),i,...c);return _0xcb2575.set(h,i[u(380)]?i[u(380)]():[i]),qwVmSU[u(516)](_0x34f393,h)}}}let it=(e.isWEh(e.mgBuY,typeof globalThis)&&e.trpYA(e[r(1367)],globalThis[r(671)+r(382)].name)||e.dENIA(e[r(710)],typeof window)&&e[r(580)](e[r(1367)],window[r(671)+"tor"][r(514)]))&&e.mgBuY!=typeof document,We=e[r(1637)](r(1172)+"d",typeof globalThis)&&(e[r(1874)](e.cPcEA,globalThis.constructor[r(514)])||e[r(941)](e[r(1250)],globalThis[r(671)+r(382)][r(514)]))&&e[r(1105)](e[r(710)],typeof tt),bt=(e[r(1006)](r(1172)+"d",typeof globalThis)&&e[r(1404)]===globalThis[r(671)+r(382)].name||e[r(950)](e[r(710)],typeof globalThis)||e.ickjK(e[r(710)],typeof globalThis)&&!!globalThis[r(1376)+r(1120)])&&e[r(1568)](e[r(710)],typeof wx),vt=e[r(1330)](r(1172)+"d",typeof globalThis)&&(e[r(747)](e[r(1250)],globalThis[r(671)+r(382)][r(514)])||e[r(1864)](e[r(1745)],globalThis["construc"+r(382)][r(514)])||e[r(862)](e[r(336)],globalThis[r(671)+"tor"][r(514)]))&&e[r(1507)](e[r(710)],typeof self),Vo=e[r(1006)](r(1172)+"d",typeof globalThis)&&e[r(1311)](r(1188),globalThis[r(671)+r(382)][r(514)])&&r(1172)+"d"!=typeof global&&e[r(1751)](r(1188),global[r(671)+r(382)].name)&&e.mgBuY!=typeof process&&!!process[r(1800)];class Xn{constructor(){this._listeners={}}emit(t,...n){let i=r,c=this[i(1425)+"rs"][t];if(c)c[i(749)]().forEach(u=>u.fn[i(1547)](u[i(1468)],n));else if(e[i(951)](e[i(984)],t)&&!this[i(624)])if(e[i(1868)](i(760),e.qpSon)){let u=n.length&&n[0];if(e[i(533)](u,Error))throw u;let h=new Error(e[i(1293)]+(u?e[i(819)](e[i(1508)](" (",u[i(1740)]),")"):""));throw h.context=u,u}else return!!_0x450ade?.[i(1628)](u=>u[i(465)]===_0x4756eb&&u[i(1375)]===_0x497bf0);return this}[r(454)](t,n){let i=r,c={NvjET:function(u,h){return e[k(1708)](u,h)},MBStS:function(u,h){return u<h},sTHop:function(u,h){return u>>h},DWXqx:function(u,h){return e.nreul(u,h)},ZbmAG:function(u,h){return e[k(1028)](u,h)},WuulF:function(u,h){return e.excJi(u,h)},VJFpi:function(u,h){return e[k(1897)](u,h)},ctPSl:function(u,h){return e[k(1243)](u,h)},zEzVi:i(800)+i(1064),MWAXX:function(u,h){return e[i(1900)](u,h)},WMfsQ:function(u,h){return u>>h},Mrqdf:function(u,h){return e[i(694)](u,h)},NkHAE:function(u,h){return e[i(401)](u,h)},SntTN:function(u,h){return u+h},iUmpK:function(u,h){return e[i(560)](u,h)},cOtSL:function(u,h){return u&h}};if(e[i(1389)](void 0,t))this[i(1425)+"rs"]={};else if(n===void 0)this[i(1425)+"rs"][t]=null;else if(e[i(1151)]!==e[i(1151)])if(_0x2733af=_0x246963.charCodeAt(_0x597203),c.NvjET(_0x1658f2,128))_0x39bc39[_0x304d4a++]=_0x31f815;else if(c.MBStS(_0x6ab3a8,2048))_0x5e1c35[_0x24c37f++]=c[i(424)](_0x545beb,6)|192,_0x565391[_0x3cf110++]=c.DWXqx(c[i(640)](63,_0x861075),128);else if(c.WuulF(c[i(1699)](64512,_0xa2ad6b),55296)&&c.WuulF(c[i(1680)](64512,_0x18113f=_0x234616[i(362)+"At"](_0x542a85+1)),56320)){let u=c[i(1645)].split("|"),h=0;for(;;){switch(u[h++]){case"0":++_0x128652;continue;case"1":_0xbecdf3[_0x574d12++]=c.MWAXX(c[i(1680)](c[i(1057)](_0x51458b,6),63),128);continue;case"2":_0x16b7c4[_0x422467++]=c[i(1500)](c[i(863)](63,_0x3cbc59),128);continue;case"3":_0x89a4f4[_0x57ae86++]=_0x560c87>>18|240;continue;case"4":_0x3c3245=c[i(407)](65536+(c[i(699)](1023,_0xff6f9b)<<10),c[i(640)](1023,_0x522276));continue;case"5":_0x1e6102[_0x51346e++]=c[i(1719)](c[i(640)](_0x3b1591>>12,63),128);continue}break}}else _0x2b83d4[_0x353e8a++]=c[i(1881)](_0x1a7de3>>12,224),_0x324cda[_0x342aa4++]=c.cOtSL(_0x5e4ad5>>6,63)|128,_0x143581[_0x15f8f1++]=c[i(1881)](63&_0x28d383,128);else{let u=this[i(1425)+"rs"][t];if(u)for(let h=0;h<u.length;)e[i(939)](u[h].fn,n)?u[i(732)](h,1):++h}return this}on(t,n,i){let c=r;return(this[c(1425)+"rs"][t]||(this[c(1425)+"rs"][t]=[])).push({fn:n,ctx:i||this}),this}}class Yo extends Xn{["_formatE"+r(1894)+"age"](t){let n=r,i={sqquC:function(c,u,h){return e[k(1620)](c,u,h)},OGfAp:function(c,u,h){return e[k(1198)](c,u,h)}};if(e.gPzNM!==e.gPzNM)rnrXtE[n(637)](_0x389515,_0x3bc3bd,50),rnrXtE[n(1178)](_0x42a119,_0x393052,_0x45d9af);else return t[n(645)]||t[n(879)]?(n(1068)+" "+(t[n(645)]||"")+n(1137)+(t[n(879)]||""))[n(766)]():JSON[n(1224)+"y"](t)}constructor(t,n,i){let c=r;super(),this[c(489)]=null,bt&&wx["connectS"+c(636)]&&(this[c(489)]=wx[c(572)+c(636)]({url:t,protocols:n,header:i,fail:this[c(444)+c(510)+"lHandler"][c(490)](this),success:this["_createS"+c(1747)+"cessHand"+c(788)].bind(this)})),We&&tt[c(572)+c(636)]&&(this[c(489)]=tt["connectS"+c(636)]({url:t,protocols:n,header:i,fail:this[c(444)+c(510)+c(597)][c(490)](this),success:this[c(444)+c(1747)+c(940)+c(788)][c(490)](this)}))}[r(444)+r(1747)+r(940)+"ler"](){let t=r,n={VxvzL:function(i,c,u){return e[k(924)](i,c,u)},pULTK:function(i,c){return e[k(455)](i,c)}};if(e[t(343)](e.lTezq,e.lTezq))Promise.resolve().then(()=>{let i=t;this[i(1765)+i(1536)]()});else{let i=EXhLSS.VxvzL(_0xeaeec4,_0x297896,_0xff4c91);return _0x5e36fb[t(1663)].subarray(i,EXhLSS.pULTK(i,_0x5c1ac5))}}[r(444)+"ocketFai"+r(597)](t){let n=r;Promise.resolve()[n(985)](()=>{let i=n;if(e[i(1343)](e[i(594)],e[i(594)])){let c=_0x397cc1[i(1740)][i(470)];c&&_0x2675f8.setCursors(c)}else{let c=e[i(1650)](ue,e[i(984)],{message:this[i(439)+i(1894)+"age"](t)});this[i(339)](e.currj,c);let u=e.FDqHG(pe,e[i(930)],{reason:this[i(439)+"rrorMess"+i(1834)](t)});this[i(339)](e[i(930)],u)}})}["_addWsLi"+r(1536)](){let t=r,n={augJH:function(i,c){return i===c},FrGtp:e[t(1260)],aTRNd:e[t(1885)],cBtHM:e.xlEja,PrnHR:function(i,c,u){return e[t(1861)](i,c,u)},BVHap:t(1740)};this[t(489)][t(975)](i=>{let c=t,u={dYBKA:c(1297)};if(n[c(850)](n[c(1686)],n[c(571)])){let h=this[c(1815)+"tManager"]?.[c(1096)+c(1210)+"nt"]();this[c(449)+c(1586)+c(486)](_0x29bde8(u.dYBKA,{code:1006,reason:c(1322)+h+(c(991)+c(1601)+"tries re"+c(660)),wasClean:!0}))}else this[c(339)](n[c(349)],n[c(807)](os,c(1305),{...i,data:i.errMsg||""}))}),this[t(489)][t(1053)](i=>{let c=t;this.emit(c(1297),pe(c(1297),{...i}))}),this._socket[t(1498)+"e"](i=>{let c=t;this[c(339)](n[c(1029)],is("message",{...i}))}),this[t(489)][t(1168)](i=>{let c=t;this[c(339)](e[c(984)],e.JvbVn(ue,e[c(984)],{...i,message:i[c(645)]||""}))})}send(t){let n=r;if(e.KYOfA(t,Uint8Array)){let i=t[n(1346)][n(749)](t[n(1083)+"et"],e[n(1901)](t.byteLength,t[n(1083)+"et"]));this[n(489)]&&this._socket.send({data:i,fail:c=>{let u=n;this[u(339)](u(1033),e[u(1393)](ue,e[u(984)],{message:this[u(439)+u(1894)+u(1834)](c)}))}})}else this._socket&&this[n(489)][n(1790)]({data:t,fail:i=>{let c=n;this[c(339)](e[c(984)],e[c(944)](ue,"error",{message:this[c(439)+c(1894)+c(1834)](i)}))}})}close(t,n){this[r(489)]&&this._socket.close({code:t,reason:n})}[r(672)+r(1268)](t,n){let i=r;i(550)!==i(899)?this.on(t,n):(_0x1f421c(this[i(1626)+i(1e3)+i(410)]),this[i(1626)+i(1e3)+i(410)]=null)}["removeEv"+r(1091)+r(1537)](t,n){let i=r;e[i(1494)](e[i(1073)],e[i(353)])?(_0x19f412(_0x452f0a,16),_0x1e3d64(_0xd9ba4f,_0x3d57f5)):this[i(454)](t,n)}get readyState(){let t=r;return this[t(489)][t(792)+"te"]}get[r(652)+"pe"](){return this[r(489)].binaryType}set[r(652)+"pe"](t){}get[r(1036)](){let t=r,n={jRJYR:function(i,c,u){return e[k(1197)](i,c,u)}};if(e[t(1682)]===e[t(1674)]){let i=jkMSuG.jRJYR(_0x1556d6,_0x334b7f,_0x257a6c[t(398)]);_0x4dd803[t(1663)][t(1216)](_0x13f08b,i)}else return this[t(489)].url}get protocol(){let t=r;return this._socket[t(1457)]}get[r(440)+"ns"](){return this[r(489)].extensions}get[r(1232)+r(744)](){return 0}}function Qo(s,t){let n=r;if(t)return new t(s[n(1036)],s[n(1457)]);if(e[n(1386)](bt,We))return new Yo(s[n(1036)],s.protocol,s[n(1246)]);if((it||vt)&&e[n(1637)](n(1172)+"d",typeof WebSocket)&&WebSocket)return new WebSocket(s[n(1036)],s[n(1457)+"s"])}function $o(s){let t=r;if(e.anVEF(e[t(1913)],t(1838))){let n=e[t(1769)][t(804)]("|"),i=0;for(;;){switch(n[i++]){case"0":_0x501b9e=e[t(497)](_0x37056f,0,_0x1b04db,_0x3a08f7);continue;case"1":_0x328ff4.log(e[t(1433)],_0xc26876);continue;case"2":_0x30536e[t(1087)](e[t(1644)],_0x264840,_0x400ac4[t(512)]);continue;case"3":_0x74417b.log(e[t(443)],_0x1d2494);continue;case"4":_0x30175d=_0x15b241(_0x47878c["cursor_n"+t(1743)],_0xfe2464,_0x2f206a);continue;case"5":_0x3d304e=e.QKWvq(_0xfbe8d9,_0x50426.fromNumber(_0x4c3874[t(498)]||_0x7bfd7a),_0x4606fc,_0x90374d);continue;case"6":_0x79abec=e[t(1103)](_0x117b9c,_0x4835be,_0x23ab84,_0x54dc21.service||0);continue;case"7":_0x3583=e.QKWvq(_0x39f3dd,_0x3ce0cd[_0x37162d["cursor_n"+t(1743)]],_0x240b9f,_0x7a6ad8);continue;case"8":_0x357248.log(e[t(447)],_0x3f2839);continue;case"9":_0x359926[t(1087)](e.qnrWS,_0x31bb11);continue;case"10":_0x1a6cb8[t(1087)](e[t(628)],_0x1b9707);continue}break}}else{let n=e[t(1106)][t(804)]("|"),i=0;for(;;){switch(n[i++]){case"0":if(We&&tt[t(572)+t(636)])return!0;continue;case"1":if((it||vt)&&e.nKWro(e[t(710)],typeof WebSocket)&&WebSocket)return!0;continue;case"2":if(s)return!0;continue;case"3":return!1;case"4":if(bt&&wx[t(572)+t(636)])return!0;continue}break}}}function xs(s,t,n){let i=-1;async function c(u){let h=k;return e.kTPdd(u,i)?Promise[h(845)](new Error(e[h(1634)])):(i=u,e[h(1509)](u,n[h(398)])?Promise[h(1692)]():n[u].bind(s)(t,c[h(490)](null,e.RmWwU(u,1))))}e.cgyYz(c,0)}function cs(s){let t=r,n=0,i=0;for(let c=0;e[t(1353)](c,s[t(398)]);++c)if(i=s[t(362)+"At"](c),e[t(1194)](i,128))n+=1;else if(i<2048)n+=2;else if((64512&i)===55296&&e[t(868)](e[t(1341)](64512,s.charCodeAt(e[t(1070)](c,1))),56320))if(e[t(1489)]==="vVTKt")++c,n+=4;else return(e[t(1134)](_0x332d4a,4)[t(900)]("0")+e[t(1095)](_0x56bff7,_0x7c1ba,2)[t(871)](16))[t(749)](-4);else n+=3;return n}function fs(s,t,n){let i=r;if(e[i(1483)](n-t,1))return"";let c="";for(let u=t;e[i(1773)](u,n);){let h=s[u++];if(e[i(563)](h,127))c+=String.fromCharCode(h);else if(e[i(1296)](h,192)&&e.cFXFq(h,224))c+=String.fromCharCode(e[i(546)](e.fqfLd(e[i(1400)](31,h),6),e[i(770)](63,s[u++])));else if(h>=224&&h<240)c+=String[i(851)+i(397)](e[i(1480)](e[i(1157)](15,h)<<12,(63&s[u++])<<6)|e.mJhgj(63,s[u++]));else if(e[i(1350)](h,240)){let m=e.XgeXX(e[i(359)](e[i(1435)](e[i(1371)](7,h)<<18|e[i(1239)](63,s[u++])<<12,e[i(813)](e[i(367)](63,s[u++]),6)),e[i(1845)](63,s[u++])),65536);c+=String[i(851)+i(397)](e.AxRZk(55296,e[i(578)](m,10))),c+=String[i(851)+"Code"](e[i(531)](56320,1023&m))}}return c}function Vn(s,t,n){let i=r;if(e[i(408)]!==e[i(408)])return _0x419b16[i(607)]>=_0x54d7f2[i(1497)];{let c=n,u,h;for(let m=0;e[i(1683)](m,s[i(398)]);++m){if(e[i(1288)](i(1140),e[i(1600)]))return i(1176)+"_"+this[i(824)];if(u=s[i(362)+"At"](m),e[i(559)](u,128))t[n++]=u;else if(u<2048)t[n++]=e.nreul(e[i(1849)](u,6),192),t[n++]=e[i(1015)](e[i(560)](63,u),128);else if(e[i(941)](e[i(1273)](64512,u),55296)&&e[i(1211)](64512,h=s.charCodeAt(e.xIJWY(m,1)))===56320){let l=e[i(384)][i(804)]("|"),b=0;for(;;){switch(l[b++]){case"0":u=e[i(1786)](65536,e[i(1474)](e[i(1481)](1023,u),10))+(1023&h);continue;case"1":t[n++]=e[i(393)](e[i(889)](u,6),63)|128;continue;case"2":t[n++]=e[i(1402)](e[i(1808)](e[i(1810)](u,12),63),128);continue;case"3":t[n++]=e.TkEyb(63,u)|128;continue;case"4":++m;continue;case"5":t[n++]=e[i(777)](e[i(1285)](u,18),240);continue}break}}else t[n++]=u>>12|224,t[n++]=e[i(777)](e[i(1735)](e[i(509)](u,6),63),128),t[n++]=e[i(1189)](e[i(1526)](63,u),128)}return n-c}}async function us(s){let t=r;if(e[t(1527)](t(1908),typeof s)){let n=new Uint8Array(e[t(828)](cs,s));return Vn(s,n,0),n}return s instanceof ArrayBuffer?new Uint8Array(s):new Uint8Array(s[t(1346)],s.byteOffset,s[t(1660)+"th"])}function Zo(s){let t=r;if(e.DQrkd(e.YPGpQ,e[t(1344)])){let n=this._qosDB[t(344)+t(1337)](this[t(897)]),i=_0x78094e[t(979)](e[t(644)](n,"{}"));return i[_0x249fa7||_0x319fdb[this[t(1300)]]]=_0x37ca54,this[t(1501)]["setStora"+t(1337)](this[t(897)],_0x127280[t(1224)+"y"](i)),_0x231779||_0x488b4f[this._pathKey]}else try{return e.PIMHn!=typeof s&&(e[t(1739)](s,ArrayBuffer)||s.buffer&&e.rjNVM(s[t(1346)],ArrayBuffer))||e.lZPHC(e[t(479)],typeof s)?"":(JSON[t(979)](s),e[t(422)])}catch{return e[t(1527)](e.PIMHn,typeof s)?t(1257)+t(464)+t(1116):""}}let e0=(s,t)=>{let n=r;if(e[n(736)]===e[n(1757)]){let i=_0xc35d5a[_0x160e1c++];if(e[n(563)](i,127))_0x293b30+=_0x560e3f[n(851)+n(397)](i);else if(e[n(1185)](i,192)&&e[n(1741)](i,224))_0x29ff41+=_0x551126["fromChar"+n(397)](e[n(1065)](e[n(1850)](e.aqqTl(31,i),6),e[n(1319)](63,_0x4044ae[_0x28725d++])));else if(e[n(1067)](i,224)&&e[n(341)](i,240))_0x1994b4+=_0x285c87[n(851)+"Code"](e[n(359)](e[n(1086)](e[n(1511)](15,i),12),e[n(852)](e[n(598)](63,_0x50e2f9[_0x276656++]),6))|e[n(1211)](63,_0x317d21[_0x1b204++]));else if(e[n(1350)](i,240)){let c=e[n(1015)](e[n(722)](e[n(1574)](e[n(706)](7&i,18),e[n(491)](e.DFWYJ(63,_0x129b23[_0xc0be63++]),12)),e.fqpzv(e[n(477)](63,_0x4a164e[_0x52be30++]),6)),63&_0x559d0a[_0x5a81b5++])-65536;_0x27a201+=_0x147803[n(851)+n(397)](e[n(630)](55296,e.tAzFa(c,10))),_0x30f2f5+=_0x29c9af["fromChar"+n(397)](e.qOLQH(56320,1023&c))}}else switch(s){case e.XqaVX:case n(1513):return{[n(721)+s]:1,"x-tt-env":t};default:return{}}};class t0{constructor(t){let n=r;this[n(574)+n(753)]=t,this.count=0}[r(870)](){let t=r;if(e[t(1524)](e[t(1905)],e[t(1905)]))return _0x52029d||(_0x296d25=_0x36f989[t(1692)]()[t(985)](_0x2f01f3[t(490)](_0x2aa29b,t(1004)))),_0x33216a;this[t(1325)]++}[r(1149)+r(379)+"nt"](){let t=r;return e[t(620)](this[t(1325)],this[t(574)+t(753)])}[r(963)+r(1200)](t=0){let n=r;this[n(574)+n(753)]=t,this.count=0}}async function n0(s){let t=r,n={qFQxa:function(i,c){return i||c},BiwCq:function(i,c){return e[k(854)](i,c)},tMKLr:function(i,c){return e[k(1511)](i,c)},Bmtwt:function(i,c){return i|c},MMdWz:e[t(423)],CKiZa:function(i,c){return i!==c},WFJAh:e[t(1307)],IAuAL:"WdXMT",yQupd:e[t(1855)],QlWQv:"text/javascript",vppYt:function(i,c){return e[t(858)](i,c)},VqRIV:e.GvyoB,irUyk:function(i,c){return e[t(357)](i,c)},bAOTL:e[t(799)],abrlQ:function(i,c){return e[t(1788)](i,c)}};return new Promise(i=>{let c=t,u={GACdm:n[c(1045)]};if(!it)return i(n[c(1045)]);try{if(n[c(1761)](n[c(467)],n[c(865)])){let h=document[c(971)+c(482)](n[c(943)]);window["frontier"+c(1642)]=m=>{let l=c;document[l(1717)]["removeCh"+l(1230)](h),window[l(1176)+l(1642)]=void 0,i(m&&m[l(948)]||u[l(995)])},h[c(1155)]=n[c(823)],h[c(774)]=n[c(785)](s.replace(/^ws/,c(1370)),n[c(1649)]);try{document.body[c(1334)+c(1230)](h)}catch{if(n[c(1630)](n[c(331)],"ZVWsL"))document.body[c(1242)+c(1230)](h);else{let m=this[c(1501)][c(344)+c(1337)](this[c(897)]),l=_0x15f515[c(979)](n[c(920)](m,"{}"));return l[_0x5d9b7d]=void 0,this[c(1501)].setStorageSync(this[c(897)],_0x20c6d2[c(1224)+"y"](l))}}}else _0x205173[_0x3f0f8e++]=_0x585906>>12|224,_0x3f7284[_0x512320++]=IKWvTB.BiwCq(IKWvTB[c(1590)](_0x5485e3>>6,63),128),_0x14f1db[_0x1d1d9d++]=IKWvTB[c(1465)](IKWvTB[c(1590)](63,_0x5c89df),128)}catch{window[c(1176)+c(1642)]=void 0,n[c(411)](i,c(1060)+c(793))}})}function qe(s,t,n){let i=r;return!!s?.find(c=>c[i(465)]===t&&c[i(1375)]===n)}function ot(s,t){let n=r;if(e[n(1281)](e[n(1110)],e[n(1110)]))return s?.[n(1628)](i=>i[n(465)]===t)?.[n(1375)];if(this[n(527)]&&e[n(1311)](this._ws[n(792)+"te"],this[n(1796)+"NG"])){this["_clearPi"+n(1072)](),this[n(1283)+n(1662)+"Id"]=_0x54e43d(this[n(1559)].bind(this),this[n(895)][n(1320)+"rval"]);return}if(!this[n(527)]||this[n(527)][n(792)+"te"]!==this[n(1233)])return void this[n(1714)+n(1094)]();this[n(527)]&&this[n(527)].send("hi"),this[n(1830)+n(1622)+n(524)]=e[n(1492)](_0x18a267,this[n(1714)+n(1094)+"Timeout"][n(490)](this),this._options[n(365)+n(1081)+n(780)])}let Yn=null;async function r0(){let s=r;return Yn||(Yn=Promise[s(1692)]()[s(985)](Se.bind(Se,e[s(1269)]))),Yn}class s0 extends Xn{constructor(t,n){let i=r;super(),this[i(801)]=t,this._keyPath=n,this[i(1501)]=void 0,this["_initPro"+i(976)]=null}async[r(1109)](){await this[r(860)]()}async[r(860)](){let t=r,n={TPSOn:function(i,c,u,h){return e.yRGtE(i,c,u,h)}};if(!this[t(1501)]){if(this._initPromise)return this[t(1771)+"mise"];try{let i=this[t(801)],c=this[t(1304)];this[t(1771)+"mise"]=(async()=>{let u=t,{openDB:h}=await r0();this[u(1501)]=await n[u(960)](h,u(1176)+"_"+i,1,{upgrade(m){m[u(1127)+"jectStore"](i,{keyPath:c})}})})(),await this["_initPro"+t(976)]}catch(i){console[t(1087)](i)}finally{this[t(1771)+t(976)]=null}}}async[r(964)](t){let n=r;try{return await this[n(860)](),this[n(1501)]?.[n(964)](this[n(801)],t)}catch(i){console[n(1087)](i)}}async[r(1216)](t,n){let i=r;return await this._init(),this[i(1501)]?.[i(1532)](this._dbName,t)}async del(t){let n=r;try{if(e[n(1912)](e[n(880)],n(329)))return await this[n(860)](),this[n(1501)]?.delete(this[n(801)],t);e.MzFVk(_0x34a296,_0x2ff6ac,8),_0x1b492c(_0xe22110,_0x4ad8aa)}catch(i){console[n(1087)](i)}}async clear(){let t=r,n={iyBXV:function(i,c){return e.TsZYH(i,c)}};try{return await this._init(),this[t(1501)]?.clear(this[t(801)])}catch(i){if(e.PNWld(e[t(1593)],t(977))){let c=this[t(1501)]["getStora"+t(882)+"nc"](this[t(897)]),u=_0x5998be[t(979)](n[t(452)](c,"{}"));return _0xe80ade[t(757)](u)}else console[t(1087)](i)}}async keys(){let t=r;return await this[t(860)](),this[t(1501)]?.[t(399)+"ys"](this[t(801)])}async[r(1779)](){let t=r;return await this[t(860)](),this._qosDB?.[t(1779)](this[t(801)])}async[r(1395)](){let t=r;if(e[t(378)]("ulWfC",t(803)))this.emit(e.currj,_0x341170),this.onerror&&this[t(624)](_0x2cb432);else try{this[t(1501)]?.[t(1297)](),this._qosDB=void 0}catch(n){console[t(1087)](n)}}get isReady(){let t=r;try{return!!this._qosDB}catch(n){return console[t(1087)](n),!1}}}class i0{constructor(t,n){let i=r;this[i(824)]=t,this[i(1300)]=n,this[i(1501)]=localStorage}async[r(1109)](){}get _prefix(){let t=r;return t(1176)+"_"+this[t(824)]}async get(t){let n=r,i=this[n(1501)][n(843)](this._prefix);return JSON[n(979)](e.XQYGZ(i,"{}"))[t]}async[r(1216)](t,n){let i=r,c=this._qosDB[i(843)](this[i(897)]),u=JSON[i(979)](e[i(665)](c,"{}"));return u[n||t[this._pathKey]]=t,this[i(1501)][i(1647)](this[i(897)],JSON[i(1224)+"y"](u)),n||t[this[i(1300)]]}async del(t){let n=r,i=this._qosDB[n(843)](this._prefix),c=JSON[n(979)](e[n(665)](i,"{}"));return c[t]=void 0,this[n(1501)].setItem(this[n(897)],JSON.stringify(c))}async[r(679)](){let t=r,n={bCHPw:function(i,c){return e[k(602)](i,c)},Xazbs:function(i,c){return e[k(361)](i,c)},RNwvx:e.NMavs,wMKdj:e[t(1652)]};if(e[t(1144)](e[t(669)],e[t(1873)]))return this[t(1501)].clear();{let i=_0x3de718[t(804)](/\./)[t(1019)](h=>_0x1ceca2(h)),c=[];return c[0]=rjTMnO[t(1781)](_0x3d1e7e,rjTMnO.Xazbs(i[0],i[1])),c[1]=_0x19941f(rjTMnO[t(906)](i[2],i[3])),[rjTMnO[t(832)],rjTMnO[t(832)],rjTMnO[t(832)],t(448),rjTMnO[t(832)],rjTMnO.wMKdj,c[0],c[1]].join("")}}async[r(757)](){let t=r,n=this._qosDB[t(843)](this[t(897)]),i=JSON[t(979)](n||"{}");return Object[t(757)](i)}async[r(1779)](){let t=r,n=this[t(1501)][t(843)](this[t(897)]),i=JSON.parse(n||"{}");return Object[t(556)](i)}[r(1395)](){return Promise[r(1692)]()}get[r(1240)](){return!!this._qosDB}}class o0{constructor(t,n){let i=r;this._DBName=t,this[i(1300)]=n,this[i(1501)]=We?tt:bt?wx:null}async openDB(){}get[r(897)](){let t=r;return t(1176)+"_"+this[t(824)]}async[r(964)](t){let n=r,i=this._qosDB[n(344)+n(1337)](this._prefix);return JSON.parse(e[n(861)](i,"{}"))[t]}async set(t,n){let i=r,c=this[i(1501)]["getStora"+i(1337)](this._prefix),u=JSON[i(979)](e.sqCzk(c,"{}"));return u[n||t[this[i(1300)]]]=t,this[i(1501)][i(1522)+i(1337)](this[i(897)],JSON[i(1224)+"y"](u)),n||t[this[i(1300)]]}async del(t){let n=r,i=this[n(1501)][n(344)+n(1337)](this[n(897)]),c=JSON[n(979)](e[n(665)](i,"{}"));return c[t]=void 0,this[n(1501)]["setStora"+n(1337)](this[n(897)],JSON[n(1224)+"y"](c))}async[r(679)](){let t=r;return this[t(1501)][t(1742)+t(1496)]()}async keys(){let t=r,n=this[t(1501)][t(344)+t(882)+"nc"](this[t(897)]),i=JSON[t(979)](e[t(1386)](n,"{}"));return Object.keys(i)}async[r(1779)](){let t=r;if(e[t(1253)](t(374),e[t(535)]))return this[t(489)][t(652)+"pe"];{let n=this._qosDB["getStora"+t(882)+"nc"](this[t(897)]),i=JSON[t(979)](n||"{}");return Object[t(556)](i)}}[r(1395)](){let t=r,n={hGHrJ:function(i,c){return i instanceof c}};if(e[t(517)]!==e[t(517)])RXlmAF.hGHrJ(_0x1f6040,_0x187505)&&_0x5df500[t(1216)](_0x321e22,_0x231239);else return Promise[t(1692)]()}get isReady(){return!!this[r(1501)]}}function ds(s,t){let n=r;if(e[n(665)](We,We))return new o0(s,t);if(e.dciOu(it,vt)&&e[n(710)]!=typeof indexedDB)return new s0(s,t);if(e.dmXkU(it,vt)&&e[n(1637)](e[n(710)],typeof localStorage))return new i0(s,t);throw new Error(e[n(805)])}class a0{constructor(){let t=r;this["_interva"+t(657)+"Id"]=null,this._interval=36e5,this[t(1501)]=e[t(377)](ds,e[t(1008)],e[t(1794)])}async[r(1085)+r(1407)](){let t=r,n={ldqNR:function(i,c,u){return e[k(1620)](i,c,u)},aoWbh:function(i,c){return e[k(1119)](i,c)}};e.Abjcd(e.ZTJXc,e.ZTJXc)?(e[t(1629)](clearInterval,this[t(1085)+"lTimeoutId"]),this[t(1085)+t(657)+"Id"]=e[t(481)](setInterval,()=>{this["flushExp"+t(573)]()},this[t(1085)+"l"])):(_0x39ca7d-=65536,_0x144b1c+=jSnKGd[t(1324)](_0x53c8e9,(_0x2fe5ed>>10)+55296,jSnKGd[t(1424)](1023,_0x3a09c4)+56320),_0x7c5da8+=3)}async[r(1109)](){let t=r,n={zCPDQ:function(i,c){return e[k(1488)](i,c)},dvAfO:e.MiLkB};await this[t(1501)][t(1109)]()[t(985)](()=>{let i=t;if(n[i(1477)](n.dvAfO,n[i(1009)]))this[i(1085)+i(1407)]();else return new _0x14c1d5(_0x148e82,{message:_0x12e671,code:_0xfb0b79,error:_0x2ef426})})}async[r(1003)+r(573)](){let t=r;(await this[t(1501)]?.[t(1779)]()||[])[t(689)](({timestamp:c})=>c<Date[t(1654)]())[t(1041)](c=>{let u=t;this[u(1501)]?.[u(1722)](c[u(395)+"id"])})}async[r(1722)](t){let n=r;return this[n(1501)]?.[n(1722)](t)}async[r(1216)](t,n){let i=r;return this[i(1501)]?.[i(1216)]({message_id:t,timestamp:n})}async[r(964)](t){let n=r;return this._qosDB?.[n(964)](t)}async[r(1395)](){let t=r;e[t(1056)](clearInterval,this[t(1085)+t(657)+"Id"]),await this._qosDB?.[t(1395)]()}get[r(1240)](){let t=r;return this[t(1501)]?.[t(1240)]}}function Qn(s){let t=r,n=!!this[t(895)].enableQoS;if(!n)return{enabled:n,isQoSMessage:!1,isQoSAck:!1,isAckCleanupMessage:!1,ackMsgIds:[]};let i=qe(s[t(1740)][t(1246)],e[t(1558)],"2"),c=i&&e[t(504)](qe,s[t(1740)][t(1246)],e[t(1635)],"1"),u=i&&e.FIFmu(qe,s[t(1740)].headers,t(914)+t(1575)+"k","1"),h=u?e[t(1299)](ot,s[t(1740)][t(1246)],e[t(1777)])?.split(",")[t(689)](Boolean)||[]:[];return{enabled:n,isQoSMessage:i,isQoSAck:c,isAckCleanupMessage:u,ackMsgIds:h}}async function ls(){let s=r;return this[s(1732)+"ger"]||(this[s(1732)+s(1853)]=new a0),this["_QoSMana"+s(1853)][s(1240)]||await this._QoSManager[s(1109)](),this["_QoSMana"+s(1853)]}async function x0(s,t){let n=r,{enableAutoAck:i}=this[n(895)],c=qe(s.message[n(1246)],e[n(1306)],"1"),u=qe(s[n(1740)][n(1246)],e[n(1734)],"1"),h=Qn[n(683)](this,s);if(e[n(837)](i,c)){let{SeqID:m,LogID:l,service:b,LogIDNew:v,method:C}=s.message;this._sendAck({SeqID:m,LogID:l,LogIDNew:v,service:b,method:C,headers:[{key:e[n(1734)],value:"1"},{key:e[n(1623)],value:e[n(644)](v,"")},{key:n(1209),value:"0"}]})}u&&!h[n(1384)]&&this[n(449)+n(1561)+n(1222)](s),e.pcuWV(t)}async function c0(s,t){let n=r;this[n(537)](e[n(748)],s[n(1740)]),e[n(1054)](t)}async function f0(s,t){let n=r;if(e.vCpDU!==e[n(1440)]){if(e[n(582)](_0x52470a,_0x1d4b17))throw new _0x4af684(e[n(1267)]);let i=3;for(;e[n(1817)](i,0);){let c=e[n(1581)](255,_0x47c636);e[n(1515)](_0x345615,c,_0x4ca297,e.RKFwJ(_0x13eea7,i)),_0x9c4aa8>>>=8,i--}return _0x5846ce+4}else{let i=e[n(619)](Xr,await e[n(1206)](us,s[n(1471)]));try{if(e[n(1739)](i[n(470)],Uint8Array))if(e[n(884)](e[n(1025)],e[n(1138)])){let c=this[n(1815)+n(695)]?.[n(1096)+n(1210)+"nt"]();this[n(537)](n(1467)+c),_0x1a1d17()}else{let c=e[n(1510)](this[n(895)]["payloadE"+n(1746)],Object)?{force:!!this[n(895)][n(1152)+n(1746)].force,encoding:this[n(895)][n(1152)+n(1746)][n(835)]?this[n(895)][n(1152)+n(1746)][n(835)][n(743)](/\s/g,"")[n(937)+n(475)]():""}:{force:!1,encoding:this._options[n(1152)+n(1746)]?this._options[n(1152)+n(1746)][n(743)](/\s/g,"")[n(937)+n(475)]():""},u=i[n(1152)+n(1746)]?i[n(1152)+n(1746)][n(743)](/\s/g,"")[n(937)+n(475)]():"",h=this[n(895)][n(696)+"ype"]instanceof Object?{force:!!this._options["payloadT"+n(1347)][n(419)],type:this[n(895)][n(696)+n(1347)][n(1155)]?this[n(895)][n(696)+n(1347)].type[n(743)](/\s/g,"")[n(937)+n(475)]():""}:{force:!1,type:this._options[n(696)+"ype"]?this[n(895)][n(696)+n(1347)].replace(/\s/g,"")[n(937)+"ase"]():""},m=i.payloadType?i[n(696)+n(1347)][n(743)](/\s/g,"")[n(937)+n(475)]():"",l=h[n(419)]?h[n(1155)]:m||h[n(1155)],b=c[n(419)]?c[n(835)]:u||c[n(835)],v=[e[n(841)],e[n(422)],e[n(844)],n(1908)],C=[e.dSJex,e[n(1675)]];this[n(895)][n(1449)+n(451)+"extPayload"]&&v.includes(l)&&(!b||C[n(1241)](b))?i[n(1520)+n(1482)]=fs(i[n(470)],0,i[n(470)][n(1660)+"th"]):i[n(1520)+n(1482)]=""}else i["textPayl"+n(1482)]=""}catch(c){i["textPayl"+n(1482)]="",console[n(1087)](c)}s.message=i,e[n(1750)](t)}}function u0(s,t,n){let i=r,c=e.CYswF(n,8192),u=e[i(1716)](c,1),h=null,m=c;return function(l){let b=i;if(l<1||e.qsMLR(l,u))return s(l);m+l>c&&(h=e.cDNPU(s,c),m=0);let v=t[b(683)](h,m,m+=l);return e[b(617)](7,m)&&(m=e.RSrXP(7,m)+1),v}}let d0=4294967295;function l0(s,t,n){let i=r;return e[i(1039)](e.ahKzC,e[i(346)])?this[i(527)]?this._ws[i(652)+"pe"]:this[i(816)+i(1347)]:RangeError(e[i(812)](e[i(1090)](e[i(1729)](e.mUnkd(e[i(455)](e[i(685)],s),e[i(1205)]),e[i(1386)](t,1)),e[i(1899)]),n))}function h0(s,t,n){let i=r;if(e[i(881)](e.UQFtd,e[i(1609)]))this[i(449)+"hMessage"+i(521)](_0x46a56e),_0x59b847[i(1216)](_0xf5a3b5,_0x26c823,_0x1b90ab[i(1740)][i(512)]);else{if(e.qoplO(n,d0))throw new Error(e[i(1267)]);let c=3;for(;e[i(1212)](c,0);){let u=e.aiqxh(255,n);e[i(1326)](Zn,u,s,e.NfXix(t,c)),n>>>=8,c--}return t+4}}function g0(s,t){let n=r,i=0,c=t,u=e.nyFBh(t,4);for(;c<u;){let{value:h,offset:m}=$n(s,c);c=m,i=e[n(1551)](e[n(813)](i,8),0),i+=h}return{value:i,offset:u}}function p0(s,t,n){let i=r,c=(i(1700)+"1")[i(804)]("|"),u=0;for(;;){switch(c[u++]){case"0":if(t[i(485)])return e[i(1363)](t[i(485)](s,n),n);continue;case"1":return Vn(s,t,n)+n;case"2":if(!s)return n;continue;case"3":if(t[i(632)+"e"])return e[i(966)](t.utf8Write(s,n),n);continue;case"4":if(e[i(896)](s[i(398)],40))return e.NfXix(e.EIUhl(Vn,s,t,n),n);continue}break}}function m0(s,t){let n=r,i=new O(e[n(927)](e[n(1706)](s[t+4],24)|e[n(1542)](s[e[n(1313)](t,5)],16)|e[n(1474)](s[t+6],8),s[t+7]),e[n(1435)](e[n(815)](e[n(1538)](e[n(813)](s[e[n(1196)](t,0)],24),e[n(682)](s[t+1],16)),s[t+2]<<8),s[e[n(1842)](t,3)]),!0);return t+=8,{value:i,offset:e[n(1259)](t,8)}}function _0(s,t,n){let i=r,c=s[i(420)],u=s[i(1504)];return t[n]=e[i(1249)](u,24),t[e[i(1416)](n,1)]=e.GWMMa(u,16)&255,t[e[i(681)](n,2)]=e[i(1048)](e.EqOrJ(u,8),255),t[n+3]=e.IpZIb(255,u),t[e[i(947)](n,4)]=c>>>24,t[n+5]=e[i(703)](e.AxtID(c,16),255),t[n+6]=e.nYSdw(e[i(797)](c,8),255),t[e[i(455)](n,7)]=255&c,n+=8,n}function $n(s,t){let n=r;if(e.fgMCq("JtizL",n(1580)))return s[n(1668)+"8"]?{value:s.readUInt8(t),offset:t+1}:{value:e[n(770)](255,s[t]),offset:e[n(1519)](t,1)};if(e[n(626)](e[n(1705)](_0x696a93[n(607)],_0x2db2bb),_0xd4b97c[n(1497)]))throw new _0x49b9bf(e[n(712)]);_0x336289[n(607)]+=_0xbc52bf}function Zn(s,t,n){let i=r,c={VunGu:function(u,h){return e.iYJCv(u,h)},EzHlQ:function(u,h){return e[k(1192)](u,h)},Kkbgy:e.mgBuY,MScIb:i(1616)+i(1229)+"d"};if(e[i(661)](e[i(570)],i(726))){if(DadpQy[i(1666)](_0x46b9bb,_0x5aaa30))return new _0x2efc1b(_0x647f96,_0x5e9078);if(DadpQy[i(1666)](_0x10c789,_0x46c630)&&DadpQy.EzHlQ(DadpQy.Kkbgy,typeof _0x4d9124))return new _0x22bd1a(_0x12fffb,_0x259c28);if(DadpQy[i(1666)](_0x598f4e,_0x54dbb5)&&DadpQy[i(1066)](DadpQy[i(1701)],typeof _0x28b566))return new _0x535f56(_0x3bda34,_0x43d04e);throw new _0x1ac747(DadpQy.MScIb)}else return t[i(1606)+"t8"]?t[i(1606)+"t8"](s,n):t[n]=e.MJXei(255,s),n+1}let w0=function(s){return new Uint8Array(s)},y0=e[r(1568)](e[r(710)],typeof Buffer)?Buffer[r(1866)+"afe"]:e[r(577)](u0,w0,Uint8Array[r(934)+"e"][r(795)]);(()=>{let s=r,t={UXtHF:function(n,i){return n|i},gsGhj:function(n,i){return e[k(1778)](n,i)},WnlYe:function(n,i){return e[k(758)](n,i)},dwLdp:function(n,i){return e[k(1822)](n,i)},UzZpK:function(n,i){return e[k(350)](n,i)},HoSYu:function(n,i){return e.WQbXM(n,i)},CNcma:function(n,i){return e[k(495)](n,i)},mMJxl:function(n,i,c){return n(i,c)},sQVsA:function(n,i){return n+i},bvKNt:function(n,i){return e.RmXEf(n,i)},bcBGD:function(n,i){return e.ajCgH(n,i)},bFDgk:e[s(445)],XgdHO:e[s(737)],qAkPV:e[s(992)],JhjYm:function(n,i){return e[s(840)](n,i)},SUVYe:function(n,i){return e[s(1581)](n,i)},BVAcU:function(n,i){return e[s(1818)](n,i)},yEoQW:function(n,i){return e[s(1419)](n,i)},rhtxL:function(n,i){return e[s(1133)](n,i)},TKIBa:function(n,i){return n<<i},NabVm:function(n,i){return e[s(1150)](n,i)},PyBcn:function(n,i){return e[s(1408)](n,i)},MPGSk:function(n,i){return e.zbugm(n,i)},rvWIE:function(n,i){return e[s(1474)](n,i)},hvrQF:function(n,i){return e[s(1780)](n,i)},ElYbm:function(n,i){return e.zbrNH(n,i)},rnPrx:function(n,i){return n&i},jjfyL:function(n,i){return n<<i},zLnRJ:function(n,i){return n!==i},rNnWu:e[s(1658)],Osyoc:function(n,i,c,u){return e[s(426)](n,i,c,u)}};if(e[s(1912)](e[s(1531)],e[s(1531)])){let n=4294967295;return function(i,c,u=!0){let h=s,m={DTAKD:function(l,b,v){return l(b,v)},zcURF:t[h(1599)]};if(t[h(904)]!==t.qAkPV){if(n=t.JhjYm(t[h(1854)](127,i[c]),0),t[h(1336)](i[c++],128))return{value:u?n:t.yEoQW(0,n),offset:c};if(n=t[h(1464)](t[h(342)](n,t.TKIBa(t[h(1439)](127,i[c]),7)),0),t.BVAcU(i[c++],128))return{value:u?n:t[h(956)](0,n),offset:c};if(n=t[h(1047)](t.MPGSk(n,t[h(1451)](t[h(894)](127,i[c]),14)),0),t.ElYbm(i[c++],128))return{value:u?n:0|n,offset:c};if(n=t.PyBcn(t[h(342)](n,t[h(608)](127,i[c])<<21),0),t[h(1392)](i[c++],128))return{value:u?n:t[h(1505)](0,n),offset:c};if(n=t[h(1047)](n|t.jjfyL(15&i[c],28),0),t[h(1336)](i[c++],128))return{value:u?n:t[h(1603)](0,n),offset:c};if(t[h(1479)](c+=5,i[h(398)])){if(t[h(1618)](t[h(836)],h(1678)))throw c=i[h(398)],t[h(1180)](l0,c,10,i[h(398)]);{this[h(1388)+h(907)+"t"]();let l=m[h(366)](_0x1f1d85,h(1819)+"t",{message:m[h(1523)]});this[h(711)+h(1753)+h(731)+"ct"]&&this[h(711)+"mediatel"+h(731)+"ct"](l)}}return{value:u?n:t.UXtHF(0,n),offset:c}}else _0x584fda=kiJCaM[h(1802)](kiJCaM[h(1603)](kiJCaM[h(994)](7&_0x581d4f,18)|kiJCaM.WnlYe(63&_0x488300,12),kiJCaM.WnlYe(kiJCaM[h(1360)](63,_0x3567b0),6)),kiJCaM[h(1220)](63,_0xb2690d)),kiJCaM[h(1392)](_0x183831,65536)||kiJCaM.CNcma(_0x4be5b5,1114111)?_0x21f436+=_0x54015:(_0x5c1df6-=65536,_0x938ae6+=kiJCaM[h(500)](_0x292730,kiJCaM.sQVsA(_0x276256>>10,55296),kiJCaM[h(1333)](kiJCaM[h(476)](1023,_0x58f5a2),56320)),_0x5e949d+=3)}}else return e.eOUZd(_0x1ab3bc,_0x18b350)?_0x565016:new _0x222eaf(e[s(501)](e[s(463)](e.xyLkS(_0xf9a693[s(683)](_0x2ee8f4,0),_0x3ba135[s(683)](_0x60962b,1)<<8),_0x3d225c[s(683)](_0x20e8e4,2)<<16)|e[s(1516)](_0x4f416e[s(683)](_0x18b845,3),24),0),e.OvIPl(e[s(1574)](e[s(400)](_0x40de26[s(683)](_0x534c31,4)|e[s(1037)](_0x41732a[s(683)](_0x6d5925,5),8),_0x23db42[s(683)](_0x4e3b57,6)<<16),e.DnOhc(_0x5daa20[s(683)](_0x1d7c3a,7),24)),0),!0)})();let b0=16,er=32;function v0(s){let t=r,n=0,i={};for(let c=0;e[t(519)](c,s.length);c++)i[s[c]["cursor_n"+t(1743)]]=cs(s[c][t(762)+"ame"]),n+=e.RvRxn(14,i[s[c][t(762)+t(1743)]]);return[n,i]}function hs(s,t,n){let i=r,c={etuCI:function(b,v){return e[k(325)](b,v)},bUeEX:i(373)+i(986)+i(1843),gPvQO:e[i(1433)],BZSuY:function(b,v,C,P){return e[i(1823)](b,v,C,P)},ZMEnt:function(b,v,C,P){return e.PfTwe(b,v,C,P)},racir:e.crnip,NPcNb:"name",ToLiJ:"header",ZyjIo:function(b,v,C,P){return e[i(1108)](b,v,C,P)}},[u,h]=e.QTzZY(v0,s),m=y0(u),l=0;return s[i(1041)](b=>{let v=i;if(c.etuCI(v(1835),v(1835))){let C=_0x1eea5d.pop();return C?(C.offset=C[v(1497)]=0,C):{bytes:new _0x1bdfda(64),offset:0,limit:0}}else{let C=c[v(938)][v(804)]("|"),P=0;for(;;){switch(C[P++]){case"0":console[v(1087)](c[v(612)],l);continue;case"1":l=c[v(595)](_0,O[v(356)+"er"](b[v(498)]||t),m,l);continue;case"2":l=c[v(635)](Zn,0,m,l);continue;case"3":console[v(1087)](c.racir,l);continue;case"4":console[v(1087)](c[v(663)],l);continue;case"5":l=h0(m,l,b.service||0);continue;case"6":l=c.ZMEnt(p0,b[v(762)+v(1743)],m,l);continue;case"7":console[v(1087)](v(1115),l);continue;case"8":console.log(v(1450)+"ervice",b,b[v(512)]);continue;case"9":console[v(1087)](c[v(1833)],l);continue;case"10":l=c[v(723)](Zn,h[b[v(762)+v(1743)]],m,l);continue}break}}}),{frameType:er,headers:[{key:e.eMHJO,value:n}],payload:m}}function S0(s){let t=r,n=0,i=[];for(;e[t(1217)](n,s[t(1660)+"th"]);){let{offset:c}=e[t(1252)]($n,s,n);n=c;let u={cursor_name:"",cursor:0,service:0},{value:h,offset:m}=e[t(1770)](g0,s,n);u[t(512)]=h,n=m;let{value:l,offset:b}=e[t(1602)]($n,s,n);n=b,u[t(762)+t(1743)]=e[t(460)](fs,s,n,n+l),n+=l;let{value:v,offset:C}=e[t(577)](m0,s,n);u[t(498)]=v[t(1687)](),n=C,i[t(358)](u)}return i}function C0(){let s=r;return{frameType:er,headers:[{key:s(1247)+s(409),value:e[s(1730)]}],payload:void 0}}class E0{constructor(t,n,i){let c=r;this[c(1484)+c(961)]=t,this["_cursorF"+c(1848)]=n,this[c(1688)+"Strategy"]=i,this[c(1501)]=e.UGkFh(ds,this[c(1484)+"ameSpace"],e[c(543)])}async[r(1109)](){let t=r;await this[t(1501)][t(1109)]()}async[r(1514)+"rs"](){let t=r;if(!this[t(1501)].isReady)return;let n=this[t(1688)+t(717)],i=await this._qosDB[t(1779)]();switch(console.log(e.FdWsU,i),n){case"ALL":return i&&i.length?e[t(1403)](hs,i,0,this._cursorFileName):void 0;case e[t(1865)]:return;case e[t(1055)]:return i&&i[t(398)]?hs(i,0,this[t(1589)+t(1848)]):e[t(1026)](C0)}}async[r(1216)](t,n,i){let c=r;if(e[c(1011)]!==c(1878))return console[c(1087)](e.stgdR,t,n,i),this[c(1501)].set({cursor_name:t,cursor:n,service:i});_0x1ba726.log(_0x4e2dbb)}async setCursors(t){let n=r,i=e[n(638)](S0,t);for(let c of i)console.log(e.rPDzN,i),await this[n(1501)][n(1216)](c)}async[r(964)](t){let n=r;return(await this[n(1501)][n(964)](t))?.[n(498)]}async[r(1395)](){let t=r;await this[t(1501)][t(1395)]()}[r(691)+r(1458)+"Name"](t){let n=r;this[n(1589)+"ileName"]=t}get isReady(){let t=r;return this[t(1501)][t(1240)]}}let A0=r(1611)+"qos__";async function gs(s){let t=r;if(!this[t(895)][t(1338)+"S"])return null;let{aID:n,fpID:i,messageStrategy:c}=this[t(895)],u=e[t(644)](s,A0);try{return this[t(1075)+t(1776)]?s&&this[t(1075)+"anager"][t(691)+t(1458)+t(389)](s):this[t(1075)+t(1776)]=new E0(i+"_"+n+"_"+u,u,c),this["_cursorM"+t(1776)].isReady||await this[t(1075)+"anager"][t(1109)](),this[t(1075)+"anager"]}catch{return null}}async function k0(s,t){let n=r,i={yTqNk:n(335)+"0|1|5|10|8|11|9|2",kWQWP:function(c,u){return c|u},kPfnR:function(c,u){return c<<u},yWkJo:function(c,u){return c&u},irJUC:function(c,u){return e.OGzsa(c,u)},adwCw:function(c,u){return e.olbfa(c,u)},sTGLf:function(c,u){return c<u},rFxPT:function(c,u){return e[n(1119)](c,u)},ggQbn:function(c,u){return e[n(568)](c,u)},ZsENS:function(c,u){return c&u},jxQFo:function(c,u){return e[n(1169)](c,u)},VaWIt:function(c,u){return e[n(1556)](c,u)},ELfry:function(c,u){return e[n(1480)](c,u)},HAgcK:function(c,u){return e.axrWD(c,u)}};if(e[n(1689)](e[n(702)],e.sEJhU)){let c=e[n(1331)](qe,s[n(1740)][n(1246)],n(634),"-1"),u=qe(s[n(1740)][n(1246)],e[n(1734)],"1"),h=ot(s[n(1740)][n(1246)],e.AxKgC),m=Number(ot(s[n(1740)].headers,e[n(616)]))||0,l=Qn[n(683)](this,s),b=e[n(1331)](qe,s[n(1740)][n(1246)],e.DPrfT,"2"),v=ot(s[n(1740)][n(1246)],n(433)+n(754)+"e"),C=e[n(520)](Number,e.JvbVn(ot,s[n(1740)][n(1246)],n(433)+n(1470)+"ue"));if(l.isQoSAck)return e[n(345)](t);let P=l[n(1030)+"sage"]?await ls[n(683)](this):null;if(e[n(878)](s[n(1740)][n(512)],0)&&u&&!c||e[n(1820)](s[n(1740)][n(512)],0)){if(h&&l[n(1030)+"sage"]&&P)return!!!await P[n(964)](h)&&(this["_dispatchMessage"+n(521)](s),await P[n(1216)](h,e[n(1729)](Date[n(1654)](),m))),e[n(417)](t);if(b){let L=await gs[n(683)](this);if(!L)return this[n(449)+n(403)+"Event"](s),e[n(1026)](t);let I=await L.get(v)??-1;if(e.Surst(I,C))if(e[n(796)](e[n(437)],e[n(1351)]))this[n(449)+n(403)+n(521)](s),L[n(1216)](v,C,s[n(1740)][n(512)]);else return n(1908)==typeof _0x22d4cc?e[n(841)]:"";else throw new Error(n(354)+" message cursor "+C+(" larger "+n(1409)+n(746)+"r ")+I);return e[n(1608)](t)}return this["_dispatc"+n(403)+"Event"](s),e[n(417)](t)}}else{let c=i[n(1101)][n(804)]("|"),u=0;for(;;){switch(c[u++]){case"0":_0x3c6d26=kjFrSn.kWQWP(_0x3da201,kjFrSn.kPfnR(kjFrSn.yWkJo(127,_0x3599b4[_0x9f8342]),14))>>>0;continue;case"1":if(_0x5cc679[_0xc08a8++]<128)return{value:_0x5c5053?_0x22db94:kjFrSn.irJUC(0,_0x1dd228),offset:_0x3b01c5};continue;case"2":return{value:_0x1efc68?_0x34ed06:kjFrSn.adwCw(0,_0x1645c6),offset:_0x56ea0d};case"3":if(kjFrSn[n(1517)](_0x157559[_0x1846e2++],128))return{value:_0x112659?_0x232536:kjFrSn[n(1727)](0,_0x4271c8),offset:_0x1677d3};continue;case"4":if(_0x320107[_0x5f5872++]<128)return{value:_0x16c09d?_0x4ab232:kjFrSn[n(376)](0,_0x544731),offset:_0x267672};continue;case"5":_0x1b67f5=kjFrSn.irJUC(_0x2ddf7c,kjFrSn[n(1460)](127,_0x3bf366[_0xb43fbb])<<21)>>>0;continue;case"6":_0x3b6e34=kjFrSn[n(1605)](kjFrSn[n(431)](127,_0xf898c5[_0x3dd2e0]),0);continue;case"7":_0x4fa17b=kjFrSn.ggQbn(kjFrSn[n(1727)](_0x177c74,kjFrSn[n(1340)](kjFrSn[n(1059)](127,_0x7ae1a2[_0x15edf1]),7)),0);continue;case"8":_0x35db24=kjFrSn[n(1031)](_0x4b8d0e,(15&_0x404244[_0x249bd8])<<28)>>>0;continue;case"9":if(kjFrSn.VaWIt(_0x1f9a68+=5,_0x56e72f[n(398)]))throw _0x4652b3=_0x3c30a4[n(398)],_0xe28c51(_0x30561c,10,_0x354c65[n(398)]);continue;case"10":if(_0xbbc297[_0x113539++]<128)return{value:_0x45c669?_0x1e4086:kjFrSn[n(952)](0,_0x3dc5e2),offset:_0x5b6071};continue;case"11":if(_0x4b51f4[_0x4448ae++]<128)return{value:_0x5e2263?_0x59f536:kjFrSn[n(893)](0,_0x50a2dd),offset:_0x24b73f};continue}break}}}async function D0(s,t){let n=r,i=Qn[n(683)](this,s);if(!i["isQoSMes"+n(1607)])return t();let c=await ls[n(683)](this);if(i["isAckCle"+n(429)+n(1834)]&&i[n(1368)+"s"][n(398)])for(let u of i[n(1368)+"s"])await c.del(u);e[n(1723)](t)}async function P0(s,t){let n=r,i=e.anVEF(s[n(1740)].frameType,b0),c=e.imlHJ(s[n(1740)][n(1552)+"e"],er);if(e[n(837)](!i,!c))return e[n(1723)](t);let u=ot(s.message[n(1246)],e[n(396)]);if(!u)return t();let h=await gs.call(this,u);if(!h)return e[n(1054)](t);if(i){let m=await h[n(1514)+"rs"](),l={frameType:m?.[n(1552)+"e"],SeqID:O[n(356)+"er"](this._seqId++),LogID:O[n(356)+"er"](this[n(895)][n(864)+n(1069)]()),service:9e3,method:5,headers:m?.[n(1246)],payload:m?.[n(470)]},b=e[n(885)](A,l);this._ws&&this[n(527)][n(792)+"te"]&&this._ws.send(b)}if(c){let m=s[n(1740)][n(470)];m&&h.setCursors(m)}}let I0=async function(s,t){let n=r;this[n(1373)]=!1,clearTimeout(this[n(1626)+n(1e3)+n(410)]),t()},T0=async function(s,t){let n=r;if(!this[n(527)]||e.iaMDp(this._ws.readyState,this[n(1233)]))return e[n(551)](t);let{pingInterval:i}=this[n(895)];this[n(1815)+n(695)]?.[n(834)+"pointCon"+n(782)]();for(let u=0;u<this._messageQueue[n(398)];u++){let h=this[n(1688)+"Queue"][u];if(this[n(527)][n(792)+"te"]===this[n(1233)]&&e.PDNMS(null,h))e.KADQX("PHNxU",e[n(1454)])?this.count++:(this._ws&&this[n(527)][n(1790)](h),this[n(1688)+n(330)][u]=null);else break}this["_message"+n(330)]=this[n(1688)+"Queue"][n(689)](u=>!!u),this[n(1283)+"gTimeoutId"]=e[n(1904)](setTimeout,()=>this._ping(),i),this[n(449)+n(360)+"nt"](s),this[n(1447)+"er"]&&this[n(527)]&&(this._ws.binaryType=this[n(816)+n(1347)]);let c=this["_endpoin"+n(695)]?.[n(1096)+n(1210)+"nt"]();this[n(537)](n(1467)+c+n(957)),e.kjDWJ(t)},L0=async function(s,t){let n=r;if(e[n(1153)](e[n(402)],e[n(493)])){let i=this["_endpoin"+n(695)]?.[n(1096)+n(1210)+"nt"]();this[n(537)](n(1467)+i),e.qaZto(t)}else _0x23b03b=_0x354ac7[n(1824)](_0x3152d0),_0x1c8ef6=_0x51a53e.concat(_0x12efce[_0x430de2])};class N0 extends Xn{constructor(t){let n=r,i={DPLTH:function(c,u,h){return c(u,h)},ClCBd:function(c,u){return c===u},nOvYe:function(c,u){return e[k(1311)](c,u)},WwQxC:function(c,u){return e[k(676)](c,u)},AeEEb:e.etGju,qcLqj:e[n(1385)],TGPpS:function(c,u){return e[n(1007)](c,u)},ETqdu:e[n(1525)],bwEPA:function(c,u,h,m){return e.QKWvq(c,u,h,m)},NSMif:e[n(667)],jGLTQ:function(c,u){return c!==u},AmxQi:function(c,u,h){return e[n(1102)](c,u,h)},vfHwB:e[n(930)],XQnbp:function(c,u){return c(u)},SYJFW:e.currj,CVAwR:function(c,u,h){return e[n(1602)](c,u,h)}};if(e[n(1573)](e[n(1097)],e[n(394)])){super(),this[n(1420)+n(1563)+n(387)]=!0,this[n(1447)+"er"]=it,this._isNode=Vo,this._isMiniTT=We,this[n(1475)+"X"]=bt,this[n(1446)+"r"]=vt,this["_message"+n(330)]=[],this["_endpoin"+n(695)]=null,this[n(741)+n(438)]=!1,this[n(816)+n(1347)]=e[n(1362)],this[n(1626)+n(1614)]=!1,this[n(1626)+"ionTimeo"+n(410)]=null,this[n(1830)+n(1622)+n(524)]=null,this["_pingPon"+n(1662)+"Id"]=null,this._seqId=0,this._isInit=!1,this[n(690)]="",this[n(1732)+n(1853)]=null,this["_cursorM"+n(1776)]=null,this[n(959)+n(1261)]=null,this._protocols=n(1801),this[n(478)]=3,this[n(1796)+"NG"]=0,this[n(1233)]=1,this[n(1782)]=2,this._onOpen=m=>{let l=n;try{e[l(1071)](xs,this,m,[I0,T0,L0])}catch(b){if(e[l(1343)](l(1455),e[l(1565)])){let v=ue(e[l(984)],{message:b[l(1740)],code:ze[l(1720)+"OR"],error:b});this[l(449)+"hErrorEv"+l(486)](v)}else this[l(1688)+l(330)].shift(),this[l(1688)+"Queue"].push(_0x5de35c)}},this[n(480)+"ge"]=async m=>{let l=n,{pingInterval:b,pingFrequency:v}=this[l(895)];if((i[l(1803)]("hi",m.data)&&i.nOvYe(l(1640),v)||i[l(1310)](l(1856),v))&&(this["_clearPi"+l(1072)](),this.emit(i[l(1879)],i[l(877)]),this[l(1283)+"gTimeoutId"]=i.DPLTH(setTimeout,this[l(1559)][l(490)](this),b)),!i[l(1310)]("hi",m[l(1471)]))try{i[l(1535)](i[l(1171)],"XAQXw")?this.emit(l(1740),LFrXZN[l(806)](_0x1e5b85,"message",{..._0x3933fc})):i.bwEPA(xs,this,m,[f0,x0,D0,P0,k0,c0])}catch(C){if(i[l(1803)](i[l(1122)],i[l(1122)])){let P=ue(l(1033),{message:C.message,code:ze[l(534)+l(1295)],error:C});this[l(449)+l(1158)+l(486)](P)}else this.on(_0x57fb12,_0x3bd496)}},this[n(1744)]=m=>{let l=n,b=this[l(1815)+l(695)]?.[l(1149)+l(471)+"es"](),v=this[l(1815)+"tManager"]?.[l(1096)+"ntEndpoint"]();if(b&&!m[l(1740)]){let C=l(1322)+v+(l(1005)+"ax retri"+l(1422)+"ed");this[l(449)+l(1158)+l(486)](e.vHYDC(ue,e.currj,{message:C,code:ze.MAX_RETRIES_ERROR,error:m}));return}this._ws&&e[l(580)](this[l(527)].readyState,this.OPEN)&&this._disconnect(),this[l(449)+l(1158)+"ent"](e.dvuuc(ue,e[l(984)],{message:m.message,code:ze[l(1058)+l(441)],error:m}))},this[n(1698)]=async m=>{let l=n;this[l(1221)+l(1390)](),this[l(704)+l(1072)](),this[l(1111)+l(1577)+"rs"](),this[l(527)]=null,this["_connect"+l(1614)]=!1;let b=this[l(1815)+"tManager"]?.[l(1149)+"chMaxTries"]();if(!b&&this[l(1398)+l(530)]()&&!this[l(741)+l(438)]){let v=this[l(1815)+l(695)]?.["getCurre"+l(1210)+"nt"](),C=this._options["reconnec"+l(1684)+l(1888)](m[l(634)],m[l(793)]);this[l(449)+l(1586)+"ent"](i.DPLTH(pe,"close",{code:1006,reason:m[l(793)]||l(552)+l(761)+"d, unkno"+l(1648)+l(1709)+l(1272)+v,willReconnect:C})),C&&this[l(1626)]();return}if(i.jGLTQ(1e3,m[l(634)])&&this[l(741)+l(438)]){this["_dispatc"+l(1586)+l(486)](i.AmxQi(pe,i[l(1476)],{code:1e3,reason:l(915)})),this[l(1815)+"tManager"]?.[l(834)+l(1139)+l(782)](),this["_pingLos"+l(1261)]?.[l(963)+"nter"]();return}if(i.jGLTQ(1e3,m[l(634)])&&b){let v=this[l(1815)+l(695)]?.[l(1096)+l(1210)+"nt"](),C=m[l(793)];C||(C=await i[l(1383)](n0,this[l(690)])),C=l(552)+l(761)+l(386)+C+(", hostna"+l(869))+v+(l(1601)+"tries re"+l(660)),this["_dispatc"+l(1586)+l(486)](i.AmxQi(pe,i.vfHwB,{code:m[l(634)],reason:C}));let P="connect "+v+(l(1005)+l(949)+"es reached");this[l(449)+l(1158)+"ent"](ue(i[l(1284)],{message:P,code:ze[l(1839)+l(1126)+"R"]})),this[l(1815)+l(695)]?.[l(834)+l(1139)+l(782)](),this[l(959)+l(1261)]?.[l(963)+l(1200)]();return}if(m[l(634)]!==1e3&&!m[l(793)]){let v=this[l(1815)+l(695)]?.[l(1096)+l(1210)+"nt"]();this[l(449)+l(1586)+l(486)](i[l(1010)](pe,i[l(1476)],{code:m[l(634)],reason:l(552)+"ng faile"+l(1597)+"wn reaso"+l(1709)+l(1272)+v})),this["_endpoin"+l(695)]?.[l(834)+l(1139)+"fig"](),this[l(959)+l(1261)]?.[l(963)+l(1200)]();return}this[l(449)+"hCloseEv"+l(486)](m),this[l(1815)+l(695)]?.[l(834)+l(1139)+l(782)](),this[l(959)+"sCounter"]?.[l(963)+l(1200)]()},this[n(592)]=null,this[n(624)]=null,this[n(1415)+"e"]=null,this[n(1401)]=null,this[n(466)+n(1094)]=null,this[n(677)+"eAck"]=null,this[n(711)+n(1753)+"yReconnect"]=null,this[n(1136)+n(1540)]=this[n(1136)+n(1540)].bind(this),this["_handleO"+n(1292)]=this[n(1136)+n(1292)][n(490)](this),this[n(1380)+"ageHide"]=this[n(1380)+"ageHide"][n(490)](this),this[n(1380)+"ageShow"]=this[n(1380)+"ageShow"].bind(this),this._options={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(708)],pingLossCount:2,enableTransformTextPayload:!1,logIDNewConfig:{enableAutoGenerateLogIDNew:!1,userIp:""},miniProgramParams:{customHttpHeader:{}},enableAutoAck:!1,reconnectInterceptor:()=>!0,enableQoS:!1,QoSLevel:2,messageStrategy:n(1846),env:{xTTEnv:"",xUseEnv:""},listenNetworkChanged:!0};let{url:c,ws:u}=t,h=Array[n(1499)](c)?c:e.tEpOi(e[n(479)],typeof c)?[c]:[];if(!h||e[n(1389)](0,h.length))throw new Error(e.pYrdi);if(!$o(u))throw new Error(n(1486)+n(1726)+n(983)+", WebSoc"+n(1585)+"tructor "+n(715)+n(1443));if(Object[n(996)](this[n(895)],t),this["_endpoin"+n(695)]=new as(h,this._options[n(1429)+"es"]),this["_pingLos"+n(1261)]=new t0(this[n(895)][n(1907)+n(599)]),this[n(895)]["automati"+n(990)]&&(this._isInit=!0,this[n(1626)]()),this[n(895)][n(1646)+"tworkCha"+n(633)])if(e.pEcXP(e.JZury,e[n(1584)])){let m=this[n(1501)][n(843)](this._prefix),l=_0x1a9a15[n(979)](e[n(1795)](m,"{}"));return l[_0x52760e]=void 0,this[n(1501)].setItem(this._prefix,_0x59ad99.stringify(l))}else this[n(713)+"T"]||this[n(1475)+"X"]?this[n(1617)+n(1841)+n(1382)]():this[n(1447)+"er"]&&this[n(973)+n(714)+n(1268)]()}else try{_0x3e5c50(this,_0x1dfc66,[_0x374e4b,_0xfd5288,_0x19a006])}catch(c){let u=e[n(413)](_0xa2fe70,e[n(984)],{message:c[n(1740)],code:_0x196c44.OPEN_ERROR,error:c});this[n(449)+n(1158)+"ent"](u)}}[r(1136)+"nLine"](){let t=r;this[t(895)][t(549)+t(970)+"nect"]||this[t(741)+t(438)]||this[t(1714)+"econnect"]()}[r(1136)+r(1292)](){let t=r;this["_destroy"+t(907)+"t"]();let n=e[t(1567)](Jn,e[t(848)],{message:e.oJdyy});this[t(711)+"mediatelyReconnect"]&&this[t(711)+"mediatelyReconnect"](n)}[r(973)+r(714)+r(1268)](){let t=r;this[t(1447)+"er"]&&window[t(672)+t(1268)](t(1612),this._handleOnLine),this[t(1447)+"er"]&&window[t(672)+t(1268)](e[t(1887)],this[t(1136)+t(1292)]),this[t(1447)+"er"]&&window[t(672)+t(1268)](e[t(503)],this[t(1380)+t(1309)]),this._isBrowser&&window[t(672)+t(1268)](t(579),this[t(1380)+"ageShow"])}[r(1503)+r(714)+r(1268)](){let t=r;this._isBrowser&&window[t(1710)+t(1091)+t(1537)](e[t(1428)],this[t(1136)+t(1540)]),this[t(1447)+"er"]&&window[t(1710)+t(1091)+"ner"](t(589),this[t(1136)+"ffLine"]),this[t(1447)+"er"]&&window[t(1710)+t(1091)+t(1537)](e.cpUOo,this[t(1380)+"ageHide"]),this[t(1447)+"er"]&&window[t(1710)+t(1091)+t(1537)](e[t(1785)],this[t(1380)+t(1657)])}[r(1380)+r(1309)](t){let n=r;!t[n(1374)+"d"]&&(this[n(1447)+"er"]&&window["removeEv"+n(1091)+"ner"](n(962),this[n(1380)+"ageHide"]),this[n(1447)+"er"]&&window[n(1710)+"entListener"](e[n(1785)],this[n(1380)+n(1657)]),this.close()),this[n(1447)+"er"]&&window[n(1710)+"entListe"+n(1537)](e[n(1428)],this["_handleO"+n(1540)]),this[n(1447)+"er"]&&window["removeEv"+n(1091)+n(1537)](e[n(1887)],this[n(1136)+"ffLine"])}[r(1380)+r(1657)](t){let n=r,i={ewtgO:function(c,u){return e[k(1394)](c,u)},xhIzE:function(c){return e[k(1750)](c)},WjOiy:function(c,u){return e[k(1434)](c,u)},XunxQ:function(c){return e[k(1867)](c)},LTwri:e[n(1385)],UIfcE:e[n(984)]};if(e[n(773)]!==e[n(1238)])t[n(1374)+"d"]&&(this._navigatorOnline()&&(!this._ws||e[n(647)](this[n(527)][n(792)+"te"],this[n(1233)])||e[n(1263)](this[n(527)][n(792)+"te"],this[n(1796)+"NG"]))&&this["_handleO"+n(1540)](),this[n(1447)+"er"]&&window[n(672)+"Listener"](e[n(1428)],this[n(1136)+n(1540)]),this[n(1447)+"er"]&&window["addEvent"+n(1268)](e[n(1887)],this[n(1136)+n(1292)]));else{let c={zdIpN:gftDCn.LTwri,yFKpa:gftDCn.UIfcE},u=()=>{let l=n;_0x669336["removeEv"+l(1091)+"ner"](c[l(1154)],h),_0xb3f230[l(1710)+l(1091)+l(1537)](c[l(1816)],m)},h=()=>{let l=n;gftDCn[l(430)](_0x4439fc,_0x22d5b9(_0x23d4b7.result)),gftDCn.xhIzE(u)},m=()=>{let l=n;gftDCn[l(739)](_0xb2fe8c,_0x170c27[l(1033)]),gftDCn.XunxQ(u)};_0x521b61["addEvent"+n(1268)](gftDCn.LTwri,h),_0x3c3512[n(672)+n(1268)](gftDCn[n(1756)],m)}}async["_generat"+r(1783)](t){let n=r,{fpID:i,deviceID:c,bddID:u,ttwID:h,accessKey:m,aID:l,customParams:b={},enableAutoAck:v,enableQoS:C,QoSLevel:P,env:L}=this[n(895)],I,te,ne;this[n(1447)+"er"]||this[n(1475)+"X"]||this[n(713)+"T"]?(I=location&&e.dBFSV(e.dxwXR,location.protocol)?e[n(1677)]:e[n(1182)],te=t[n(743)](/((^ws)|(^http))((?:[s]*:\/\/))/,""),ne=/^wss(.*:\/\/)/[n(1098)](t)?t:""+I+te):(I=e[n(1677)],te=t[n(743)](/(^http)((?:[s]*:\/\/))/,""),ne=/(^ws)((?:[s]*:\/\/))/.test(te)?te:""+I+te);let me=u?n(1032):h?e[n(724)]:"device_id",ps=u||h||c;if(!ps||!me)throw new Error(e[n(1279)]);let M0=e[n(1231)](e[n(751)],typeof b)?await e[n(345)](b):b,R0=L?e0(L[n(1736)],L[n(918)]):{},tr=Object.assign({device_platform:e[n(453)],version_code:n(1624)+"0",access_key:m,fpid:i,aid:l,[me]:ps,xsack:v?1:0,xaack:v?1:0,xsqos:C?1:0,qos_level:C?P:void 0,qos_sdk_version:2,...R0},M0),O0=Object[n(757)](tr)[n(1876)]((nr,rr)=>tr[rr]!==void 0?""+nr+(nr?"&":"?")+rr+"="+tr[rr]:nr,"");return ne+n(1286)+O0}async[r(1626)](){let t=r;if(!(this[t(1626)+t(1614)]||this[t(741)+"osed"])){this[t(1626)+t(1614)]=!0;try{let n=this[t(1815)+t(695)]?.["checkCur"+t(404)+"ointReac"+t(779)+t(1456)](),{timeoutInterval:i}=this[t(895)];if(n){let u=this[t(1815)+t(695)]?.["getCurre"+t(1210)+"nt"](),h=this[t(1815)+t(695)]?.["replaceB"+t(752)+t(327)+"UpdateCo"+t(1271)](),m=this[t(1815)+t(695)]?.[t(1096)+t(1210)+t(1117)+t(753)]();if(h){let l=t(1322)+u+(t(991)+t(1601)+t(662)+t(936)+t(532)+"backup endpoint ")+h+(t(1437)+"y"),b=e[t(1882)](ue,t(1033),{message:l,code:ze[t(1839)+t(1126)+"R"]});this[t(537)](l),this[t(449)+t(1158)+t(486)](b),this._url=await this[t(1265)+t(1783)](h),this._debug(t(1322)+h+" "+m+t(434)),this["_removeW"+t(1577)+"rs"]()}else{let l=t(1322)+u+(t(991)+t(1601)+t(662)+"ached");this[t(537)](l),this["_dispatc"+t(1158)+"ent"](e[t(413)](ue,e[t(984)],{message:l,code:ze[t(1839)+t(1126)+"R"]}));return}}else{let u=this._endpointManager?.[t(1096)+t(1210)+t(898)+t(781)](),h=this[t(1815)+t(695)]?.["getCurre"+t(1210)+t(1117)+t(753)]();this[t(690)]=await this["_generat"+t(1783)](u||""),this[t(537)]("connect "+u+" "+h+t(434)),this[t(1111)+t(1577)+"rs"]()}if(this[t(1373)])this._isInit=!1;else{let u=e[t(1882)](Jn,e[t(848)],{message:"start"});this[t(466)+t(1094)]&&this["onStartR"+t(1094)](u)}let c=this[t(1815)+t(695)]?.[t(1096)+"ntEndpoi"+t(1117)+"ount"]()||0;e[t(1225)](c,1)&&await this._wait(e[t(1631)](c,1)),this._debug(t(552)+t(745)+this[t(690)]+(" protoco"+t(1132))+this._protocols),this[t(527)]=e[t(1266)](Qo,{url:this[t(690)],protocols:[this._protocols],headers:this._options["miniProg"+t(1237)+"s"][t(1207)+t(1656)]},this[t(895)].ws),(this[t(1447)+"er"]||this[t(1446)+"r"])&&this[t(527)]&&(this[t(527)][t(652)+"pe"]=this[t(816)+t(1347)]),this["_addWsLi"+t(1536)](),this["_connect"+t(1e3)+"utId"]=e.HScjT(setTimeout,this._onTimeout[t(490)](this),i)}catch(n){throw this[t(1626)+t(1614)]=!1,n}}}[r(1221)+"mer"](){let t=r;if(e[t(1798)](e[t(565)],e[t(565)])){let n=e[t(875)].split("|"),i=0;for(;;){switch(n[i++]){case"0":if(!this._ws)return;continue;case"1":this[t(527)][t(1710)+t(1091)+"ner"](e[t(1772)],this[t(480)+"ge"]);continue;case"2":this[t(527)][t(1710)+"entListener"](e[t(1018)],this[t(1880)]);continue;case"3":this[t(527)]["removeEv"+t(1091)+t(1537)](e[t(984)],this._onError);continue;case"4":this._ws[t(1710)+t(1091)+"ner"](e[t(930)],this._onClose);continue}break}}else clearTimeout(this[t(1626)+t(1e3)+t(410)]),this[t(1626)+t(1e3)+t(410)]=null}[r(704)+r(1072)](){let t=r;e.sBgED(clearTimeout,this[t(1283)+t(1662)+"Id"]),clearTimeout(this[t(1830)+"ctTimeoutId"]),this[t(1283)+t(1662)+"Id"]=null,this[t(1830)+t(1622)+t(524)]=null}[r(537)](...t){let n=r;this._options[n(1903)]&&console.log[n(1547)](console,[e.StuDh,...t])}[r(981)+r(1023)+"e"](t){let n=r,{initReconnectInterval:i,maxReconnectInterval:c,reconnectIntervalGrowFactor:u}=this[n(895)],h=e[n(1669)](i,Math[n(831)](u,e[n(1100)](t,1)));return e[n(1113)](h,c)?c:h}[r(1559)](){let t=r;if(this._ws&&e[t(1379)](this[t(527)][t(792)+"te"],this[t(1796)+"NG"])){this["_clearPi"+t(1072)](),this[t(1283)+"gTimeoutId"]=e[t(1121)](setTimeout,this[t(1559)][t(490)](this),this[t(895)]["pingInte"+t(1762)]);return}if(!this[t(527)]||e[t(378)](this[t(527)][t(792)+"te"],this.OPEN))return void this._handleReconnect();this[t(527)]&&this._ws[t(1790)]("hi"),this[t(1830)+"ctTimeou"+t(524)]=setTimeout(this[t(1714)+t(1094)+t(1837)][t(490)](this),this[t(895)]["pingTime"+t(1081)+t(780)])}[r(1714)+r(1094)+r(1837)](){let t=r,n={kTobE:e[t(984)],PnClE:function(i,c,u){return e[t(859)](i,c,u)}};e[t(1509)](e[t(1789)],e.HHWcJ)?this[t(339)](TLbTnj[t(763)],TLbTnj[t(435)](_0x49dee3,TLbTnj[t(763)],{message:this["_formatErrorMess"+t(1834)](_0x4cdffe)})):(this[t(959)+t(1261)]?.[t(870)](),this[t(339)](e[t(1595)],e[t(1145)]),this[t(959)+t(1261)]?.[t(1149)+t(379)+"nt"]()?this[t(1714)+t(1094)]():this._ping())}[r(1398)+r(530)](){let t=r;return this[t(713)+"T"]||this._isMiniWX?this[t(1420)+t(1563)+t(387)]:(this._isBrowser||this._isWorker)&&this[t(895)][t(1646)+t(639)+t(633)]?navigator[t(326)]:!0}[r(1714)+r(1094)](){let t=r;!this[t(1398)+t(530)]()||this["_readyCl"+t(438)]||(this[t(1815)+t(695)]?.resetEndpointConfig(),this[t(959)+t(1261)]?.["resetCou"+t(1200)](),this._ws?this[t(613)+t(680)](1001,e[t(1051)],!0):this[t(1626)]())}[r(1617)+"etWorkCh"+r(1382)](){let t=r,n={IuExF:function(i,c){return e.aKPEq(i,c)},HbGLH:e[t(886)]};this._isMiniTT?tt[t(1076)+t(1847)+"hange"](({isConnected:i})=>{let c=t;if(e[c(1493)](c(1576),c(1576))){let u=_0x5ec8e6[c(607)];if(LdtMzh.IuExF(u+_0x47435d,_0x17b9e0.limit))throw new _0x475fbd(LdtMzh.HbGLH);return _0x4cf530[c(607)]+=_0x30b6ce,u}else this[c(1420)+c(1563)+"line"]=i,i?this[c(1136)+c(1540)]():this[c(1136)+"ffLine"]()}):this._isMiniWX&&wx["onNetwor"+t(1847)+t(1332)](({isConnected:i})=>{let c=t;this[c(1420)+c(1563)+"line"]=i,i?this[c(1136)+c(1540)]():this["_handleO"+c(1292)]()})}_wait(t){return new Promise(n=>{let i=k;e.YLPkc(setTimeout,n,this["_getInte"+i(1023)+"e"](t))})}[r(613)+r(680)](t=1e3,n="",i=!1){let c=r;this[c(527)]&&this[c(1388)+c(907)+"t"](t,n,i)}[r(457)+"ut"](){let t=r,n=this[t(1815)+t(695)]?.[t(1096)+t(1210)+"nt"]();this[t(537)]("connect "+n+t(991)),this["_disconn"+t(680)](1001,e[t(1869)],!0)}[r(1487)](t){let n=r,i=e[n(887)](Gn,t);this._ws&&e[n(1485)](this[n(527)][n(792)+"te"],this[n(1233)])&&(this._ws&&this[n(527)].send(i),this[n(537)](e[n(1077)],t))}[r(1111)+"sListeners"](){let t=r,n=e[t(642)].split("|"),i=0;for(;;){switch(n[i++]){case"0":this[t(527)][t(1710)+"entListener"](e.xlEja,this[t(1880)]);continue;case"1":this._ws.removeEventListener("error",this[t(1744)]);continue;case"2":this[t(527)]["removeEventListe"+t(1537)](t(1740),this[t(480)+"ge"]);continue;case"3":if(!this[t(527)])return;continue;case"4":this[t(527)][t(1710)+"entListe"+t(1537)](e[t(930)],this[t(1698)]);continue}break}}_addWsListeners(){let t=r,n=e.YstUd[t(804)]("|"),i=0;for(;;){switch(n[i++]){case"0":if(!this[t(527)])return;continue;case"1":this._ws[t(672)+"Listener"]("close",this[t(1698)]);continue;case"2":this[t(527)]["addEvent"+t(1268)](e[t(1772)],this[t(480)+"ge"]);continue;case"3":this._ws["addEvent"+t(1268)](e.xlEja,this[t(1880)]);continue;case"4":this[t(527)]["addEvent"+t(1268)](e[t(984)],this._onError);continue}break}}[r(1012)+r(1766)](t=1e3,n=""){let i=r;if(e[i(1253)](e[i(1672)],e[i(1870)]))try{this[i(527)]&&this[i(527)][i(1297)](t,n)}catch{}else{let c=(i(1282)+"4|7|2|3").split("|"),u=0;for(;;){switch(c[u++]){case"0":this["_clearTi"+i(1390)]();continue;case"1":this[i(1503)+i(714)+"Listener"]();continue;case"2":if(this[i(527)].readyState===this[i(478)]||e.WauWk(this._ws[i(792)+"te"],this[i(1782)]))return void this[i(537)](e[i(421)]);continue;case"3":this[i(1388)+"WebSocket"](_0x40550,_0x1cbbd2);continue;case"4":this[i(1732)+i(1853)]?.closeDB();continue;case"5":this[i(704)+"ngTimer"]();continue;case"6":this[i(741)+i(438)]=!0;continue;case"7":if(!this._ws)return void this[i(537)]("close, w"+i(1366)+i(1277)+"nitialized");continue}break}}}[r(1388)+r(907)+"t"](t=1e3,n="",i=!1){let c=r;if(this[c(704)+c(1072)](),this["_clearTi"+c(1390)](),this[c(1111)+"sListeners"](),this["_wsInsta"+c(1766)](1e3,n),this["_connect"+c(1614)]=!1,i&&this[c(1398)+c(530)]()&&!this["_readyCl"+c(438)]){if(this["_endpoin"+c(695)]?.[c(1149)+"chMaxTries"]()){let h=this["_endpoin"+c(695)]?.[c(1096)+"ntEndpoint"]();this["_dispatc"+c(1586)+c(486)](e[c(406)](pe,c(1297),{code:1006,reason:c(1322)+h+(c(991)+c(1601)+c(662)+c(660)),wasClean:!0}))}else{let h=this[c(895)][c(1819)+c(1684)+c(1888)](t,n);this[c(449)+c(1586)+c(486)](e[c(1074)](pe,e[c(930)],{code:t,reason:n,wasClean:!0,willReconnect:h})),h&&this._connect()}return}this[c(1398)+c(530)]()||this[c(741)+c(438)]?this["_dispatc"+c(1586)+c(486)](e[c(830)](pe,c(1297),{code:t,reason:e[c(583)]})):this[c(449)+c(1586)+c(486)](e[c(1043)](pe,e[c(930)],{code:1006,reason:e.NVjFT})),this[c(527)]=null,this[c(1815)+"tManager"]?.[c(834)+c(1139)+c(782)](),this[c(959)+"sCounter"]?.["resetCou"+c(1200)]()}[r(449)+r(360)+"nt"](t){let n=r;this[n(339)](e[n(1018)],t),this.onopen&&this[n(1401)](t)}[r(449)+r(403)+"Event"](t){let n=r;this[n(339)]("message",t),this.onmessage&&this[n(1415)+"e"](t)}[r(449)+r(1561)+r(1222)](t){let n=r;if(e.iufrM(e[n(965)],e[n(965)]))this[n(339)](e.lCCPg,t),this[n(677)+n(499)]&&this[n(677)+n(499)](t);else return(this[n(1425)+"rs"][_0x3affe8]||(this[n(1425)+"rs"][_0x644339]=[]))[n(358)]({fn:_0x3e1787,ctx:_0x12b6a8||this}),this}["_dispatc"+r(1158)+r(486)](t){let n=r;this[n(339)](e.currj,t),this[n(624)]&&this[n(624)](t)}["_dispatchCloseEv"+r(486)](t){let n=r;this.emit(n(1297),t),this[n(592)]&&this[n(592)](t)}get[r(652)+"pe"](){let t=r;return this[t(527)]?this._ws.binaryType:this[t(816)+t(1347)]}set[r(652)+"pe"](t){let n=r;this["_binaryT"+n(1347)]=t,this[n(527)]&&(this[n(527)][n(652)+"pe"]=t)}get retryCount(){let t=r;return this["_endpoin"+t(695)]?.[t(1096)+"ntEndpoi"+t(1117)+"ount"]()||0}get[r(1232)+r(744)](){let t=r;return this._messageQueue.reduce((i,c)=>(i+=c&&c[k(1660)+"th"]||0,i),0)+(this[t(527)]?this[t(527)][t(1232)+t(744)]:0)}get extensions(){let t=r;return this[t(527)]?this._ws[t(440)+"ns"]:""}get[r(1457)](){let t=r;return this[t(527)]?this[t(527)].protocol:""}get[r(792)+"te"](){let t=r;return this[t(527)]?this._ws.readyState:this[t(895)][t(600)+t(990)]?this[t(1796)+"NG"]:this[t(478)]}get[r(1036)](){let t=r;return this._ws?this[t(527)][t(1036)]:this._url}[r(1297)](t=1e3,n){let i=r,c=e[i(1342)][i(804)]("|"),u=0;for(;;){switch(c[u++]){case"0":if(this._ws[i(792)+"te"]===this[i(478)]||this._ws.readyState===this[i(1782)])return void this[i(537)]("close, w"+i(1578)+i(1432));continue;case"1":this[i(1221)+i(1390)]();continue;case"2":this[i(1732)+"ger"]?.[i(1395)]();continue;case"3":this[i(741)+i(438)]=!0;continue;case"4":this._destroyWebSocket(t,n);continue;case"5":this[i(704)+"ngTimer"]();continue;case"6":if(!this[i(527)])return void this[i(537)](i(615)+"s instan"+i(1277)+"nitialized");continue;case"7":this[i(1503)+i(714)+"Listener"]();continue}break}}async[r(1790)](t,n){let i=r;if(e[i(1044)](null,t))throw new Error(i(1486)+"rovide a"+i(1758)+i(822)+"a must be a stri"+i(1352)+i(1167)+i(791));e.ubTvR(e[i(809)],typeof t)&&(t=JSON.stringify(t)),e[i(479)]!=typeof t&&!(t instanceof ArrayBuffer)&&!(t[i(1346)]&&e[i(558)](t[i(1346)],ArrayBuffer))&&(t=JSON[i(1224)+"y"](t));let c=await e[i(623)](us,t),u=e[i(697)](Zo,t),{method:h=0,service:m=this[i(895)][i(512)],logID:l=this[i(895)][i(864)+"erator"](),headers:b=this[i(895)].headers,payloadEncoding:v=this[i(895)][i(1152)+i(1746)],payloadType:C=this._options[i(696)+i(1347)],logIDNew:P=this[i(895)][i(1040)+"Config"]["enableAutoGenera"+i(1636)+"ew"]?e[i(1557)](a,this[i(895)][i(1040)+i(1218)].userIp):""}=e[i(1256)](n,{});if(!m)throw new Error(i(1486)+i(1381)+i(1162)+i(989));let L={SeqID:O[i(356)+"er"](this[i(1248)]++),LogID:O[i(356)+"er"](l),service:m,method:h,headers:b,payloadEncoding:e[i(558)](v,Object)?v.encoding?v[i(835)]:"":v,payloadType:e[i(1130)](C,Object)?C[i(1155)]?C[i(1155)]:u:C||u,payload:c,LogIDNew:P},I=e[i(1236)](Gn,L);return this[i(527)]&&e.BfyCw(this[i(527)][i(792)+"te"],this[i(1233)])?(this[i(527)]&&this[i(527)][i(1790)](I),this[i(537)](e[i(555)],L)):e[i(1852)](this["_message"+i(330)][i(398)],this[i(895)][i(1534)+i(674)+"ength"])?(this[i(1688)+i(330)][i(358)](I),this._debug(e[i(856)],L)):(this[i(1688)+i(330)][i(576)](),this[i(1688)+i(330)][i(358)](I)),{seqID:this[i(1248)],logID:l,logIDNew:P}}async reconnect(t){let n=r,{url:i}=e[n(1592)](t,{}),c=Array[n(1499)](i)?i:e[n(1527)](e.PIMHn,typeof i)?[i]:[];t&&Object[n(996)](this[n(895)],t),c&&c.length?this[n(1815)+"tManager"]=new as(c,this[n(895)][n(1429)+"es"]):this[n(1815)+"tManager"]?.[n(834)+n(1139)+n(782)](),this._pingLossCounter?.["resetCou"+n(1200)](this[n(895)]["pingLoss"+n(599)]),this[n(741)+n(438)]=!1,this[n(527)]&&e[n(759)](this[n(527)][n(792)+"te"],this[n(478)])?this[n(613)+"ect"](1e3,e[n(1670)],!0):(this[n(1373)]=!0,this[n(1626)]())}async[r(368)](){let t=r;if(!this[t(1626)+"Lock"]){let n=e[t(1387)][t(804)]("|"),i=0;for(;;){switch(n[i++]){case"0":this[t(1626)]();continue;case"1":this[t(959)+t(1261)]?.[t(963)+t(1200)]();continue;case"2":this[t(1373)]=!0;continue;case"3":this[t(741)+t(438)]=!1;continue;case"4":this[t(1815)+t(695)]?.[t(834)+t(1139)+t(782)]();continue}break}}}["addEvent"+r(1268)](t,n){this.on(t,n)}[r(541)+"Event"](t){let n=r;if(e[n(1281)](e.vzZTC,n(1024)))_0x10622c.d=(i,c)=>{let u=n;for(var h in c)_0x356137.o(c,h)&&!_0x56f52e.o(i,h)&&_0xf1911f[u(1490)+u(1571)](i,h,{enumerable:!0,get:c[h]})};else{let{type:i}=t;this.emit(i,t)}}[r(1710)+r(1091)+r(1537)](t,n){this[r(454)](t,n)}[r(1203)](){let t=r,n={UNnbV:e[t(1385)],uwiIK:e[t(1595)],NHxRe:e.MRUgg,qDUBb:e[t(974)],GoHvn:function(i,c){return e[t(1472)](i,c)},DTrNT:e.NXrsF,tICZW:function(i,c,u){return i(c,u)}};return new Promise((i,c)=>{let u=t,h={sBZBS:n.UNnbV,Fxipt:n[u(390)],HKVwC:n[u(833)],JvxGe:n[u(1049)]};if(n[u(1651)]("qMCcb",n[u(1621)])){this[u(704)+u(1072)](),this._pingPongTimeoutId=n[u(1502)](setTimeout,this[u(1559)][u(490)](this),this[u(895)][u(1320)+u(1762)]);let m=()=>{let b=u;i(h[b(829)]),this.off("ping_onc"+b(1541)+"s",m),this[b(454)](h[b(375)],l)},l=()=>{let b=u;c(h[b(428)]),this[b(454)](h[b(1034)],m),this.off(b(1685)+b(673)+"t",l)};this.on("ping_once_success",m),this.on(n[u(390)],l),this[u(1559)]()}else this.emit(u(1297),_0x287fc4),this[u(592)]&&this[u(592)](_0x4ae1fa)})}}})(),Y.CustomCloseEvent=V[S(1377)+S(768)],Y[S(908)+S(727)]=V[S(908)+"rorEvent"],Y[S(980)+"e"]=V.ErrorCode,Y[S(521)]=V[S(521)],Y.FWS=V[S(1806)],Y[S(1234)+"MessageE"+S(1445)]=V["Frontier"+S(1258)+S(1445)],Y[S(1258)+S(1445)]=V[S(1258)+S(1445)],Y[S(539)+"t"]=V.OpenEvent,Y["Reconnec"+S(1679)]=V[S(567)+S(1679)],Y["createCl"+S(768)]=V["createCl"+S(768)],Y[S(575)+S(727)]=V["createEr"+S(727)],Y[S(513)+S(1147)+"nt"]=V[S(513)+S(1147)+"nt"],Y[S(982)+S(581)]=V[S(982)+S(581)],Y[S(588)+S(1696)+S(1445)]=V["createRe"+S(1696)+S(1445)],Y[S(492)+"rame"]=V[S(492)+S(544)],Y[S(622)+S(1743)]=V[S(622)+S(1743)];for(dn in V)[S(1377)+"oseEvent",S(908)+"rorEvent","ErrorCode",S(521),S(1806),S(1234)+S(1258)+S(1445),S(1258)+S(1445),"OpenEvent","ReconnectEvent",S(1318)+"oseEvent",S(575)+S(727),"createMe"+S(1147)+"nt",S(982)+S(581),S(588)+S(1696)+S(1445),S(492)+S(544),S(622)+"ame"].indexOf(dn)===-1&&(Y[dn]=V[dn]);var dn;Object[S(1490)+"operty"](Y,S(601)+"le",{value:!0})});var Le=oe((Zd,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 Pt=oe((el,wn)=>{"use strict";var{EMPTY_BUFFER:_x}=Le(),lr=Buffer[Symbol.species];function yx(r,e){if(r.length===0)return _x;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 ui(r,e,o,a,x){for(let f=0;f<x;f++)o[a+f]=r[f]^e[f&3]}function di(r,e){for(let o=0;o<r.length;o++)r[o]^=e[o&3]}function bx(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:yx,mask:ui,toArrayBuffer:bx,toBuffer:hr,unmask:di};if(!process.env.WS_NO_BUFFER_UTIL)try{let r=X("bufferutil");wn.exports.mask=function(e,o,a,x,f){f<48?ui(e,o,a,x,f):r.mask(e,o,a,x,f)},wn.exports.unmask=function(e,o){e.length<32?di(e,o):r.unmask(e,o)}}catch{}});var gi=oe((tl,hi)=>{"use strict";var li=Symbol("kDone"),gr=Symbol("kRun"),pr=class{constructor(e){this[li]=()=>{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[li])}}};hi.exports=pr});var lt=oe((nl,wi)=>{"use strict";var It=X("zlib"),pi=Pt(),vx=gi(),{kStatusCode:mi}=Le(),Sx=Buffer[Symbol.species],Cx=Buffer.from([0,0,255,255]),bn=Symbol("permessage-deflate"),Ne=Symbol("total-length"),ut=Symbol("callback"),He=Symbol("buffers"),dt=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 vx(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[ut];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"?It.Z_DEFAULT_WINDOWBITS:this.params[f];this._inflate=It.createInflateRaw({...this._options.zlibInflateOptions,windowBits:d}),this._inflate[bn]=this,this._inflate[Ne]=0,this._inflate[He]=[],this._inflate.on("error",Ax),this._inflate.on("data",_i)}this._inflate[ut]=a,this._inflate.write(e),o&&this._inflate.write(Cx),this._inflate.flush(()=>{let f=this._inflate[dt];if(f){this._inflate.close(),this._inflate=null,a(f);return}let d=pi.concat(this._inflate[He],this._inflate[Ne]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[Ne]=0,this._inflate[He]=[],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"?It.Z_DEFAULT_WINDOWBITS:this.params[f];this._deflate=It.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:d}),this._deflate[Ne]=0,this._deflate[He]=[],this._deflate.on("data",Ex)}this._deflate[ut]=a,this._deflate.write(e),this._deflate.flush(It.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let f=pi.concat(this._deflate[He],this._deflate[Ne]);o&&(f=new Sx(f.buffer,f.byteOffset,f.length-4)),this._deflate[ut]=null,this._deflate[Ne]=0,this._deflate[He]=[],o&&this.params[`${x}_no_context_takeover`]&&this._deflate.reset(),a(null,f)})}};wi.exports=mr;function Ex(r){this[He].push(r),this[Ne]+=r.length}function _i(r){if(this[Ne]+=r.length,this[bn]._maxPayload<1||this[Ne]<=this[bn]._maxPayload){this[He].push(r);return}this[dt]=new RangeError("Max payload size exceeded"),this[dt].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[dt][mi]=1009,this.removeListener("data",_i),this.reset()}function Ax(r){if(this[bn]._inflate=null,this[dt]){this[ut](this[dt]);return}r[mi]=1007,this[ut](r)}});var ht=oe((rl,vn)=>{"use strict";var{isUtf8:yi}=X("buffer"),{hasBlob:kx}=Le(),Dx=[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 Px(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 Ix(r){return kx&&typeof r=="object"&&typeof r.arrayBuffer=="function"&&typeof r.type=="string"&&typeof r.stream=="function"&&(r[Symbol.toStringTag]==="Blob"||r[Symbol.toStringTag]==="File")}vn.exports={isBlob:Ix,isValidStatusCode:Px,isValidUTF8:_r,tokenChars:Dx};if(yi)vn.exports.isValidUTF8=function(r){return r.length<24?_r(r):yi(r)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let r=X("utf-8-validate");vn.exports.isValidUTF8=function(e){return e.length<32?_r(e):r(e)}}catch{}});var Sr=oe((sl,ki)=>{"use strict";var{Writable:Tx}=X("stream"),bi=lt(),{BINARY_TYPES:Lx,EMPTY_BUFFER:vi,kStatusCode:Nx,kWebSocket:Mx}=Le(),{concat:wr,toArrayBuffer:Rx,unmask:Ox}=Pt(),{isValidStatusCode:Bx,isValidUTF8:Si}=ht(),Sn=Buffer[Symbol.species],le=0,Ci=1,Ei=2,Ai=3,yr=4,br=5,Cn=6,vr=class extends Tx{constructor(e={}){super(),this._allowSynchronousEvents=e.allowSynchronousEvents!==void 0?e.allowSynchronousEvents:!0,this._binaryType=e.binaryType||Lx[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxPayload=e.maxPayload|0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[Mx]=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=le}_write(e,o,a){if(this._opcode===8&&this._state==le)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 le:this.getInfo(e);break;case Ci:this.getPayloadLength16(e);break;case Ei:this.getPayloadLength64(e);break;case Ai:this.getMask();break;case yr:this.getData(e);break;case br:case Cn: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[bi.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=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 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=Ai:this._state=yr}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=yr}getData(e){let o=vi;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&&Ox(o,this._mask)}if(this._opcode>7){this.controlMessage(o,e);return}if(this._compressed){this._state=br,this.decompress(o,e);return}o.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(o)),this.dataMessage(e)}decompress(e,o){this._extensions[bi.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===le&&this.startLoop(o)})}dataMessage(e){if(!this._fin){this._state=le;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=Rx(wr(a,o)):this._binaryType==="blob"?x=new Blob(a):x=a,this._allowSynchronousEvents?(this.emit("message",x,!0),this._state=le):(this._state=Cn,setImmediate(()=>{this.emit("message",x,!0),this._state=le,this.startLoop(e)}))}else{let x=wr(a,o);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===br||this._allowSynchronousEvents?(this.emit("message",x,!1),this._state=le):(this._state=Cn,setImmediate(()=>{this.emit("message",x,!1),this._state=le,this.startLoop(e)}))}}controlMessage(e,o){if(this._opcode===8){if(e.length===0)this._loop=!1,this.emit("conclude",1005,vi),this.end();else{let a=e.readUInt16BE(0);if(!Bx(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&&!Si(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=le;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?"ping":"pong",e),this._state=le):(this._state=Cn,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",e),this._state=le,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[Nx]=x,d}};ki.exports=vr});var Ar=oe((ol,Ii)=>{"use strict";var{Duplex:il}=X("stream"),{randomFillSync:zx}=X("crypto"),Di=lt(),{EMPTY_BUFFER:qx,kWebSocket:Fx,NOOP:Ux}=Le(),{isBlob:gt,isValidStatusCode:Hx}=ht(),{mask:Pi,toBuffer:Ve}=Pt(),he=Symbol("kByteLength"),Kx=Buffer.alloc(4),En=8*1024,Ye,pt=En,_e=0,jx=1,Wx=2,Cr=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=_e,this.onerror=Ux,this[Fx]=void 0}static frame(e,o){let a,x=!1,f=2,d=!1;o.mask&&(a=o.maskBuffer||Kx,o.generateMask?o.generateMask(a):(pt===En&&(Ye===void 0&&(Ye=Buffer.alloc(En)),zx(Ye,0,En),pt=0),a[0]=Ye[pt++],a[1]=Ye[pt++],a[2]=Ye[pt++],a[3]=Ye[pt++]),d=(a[0]|a[1]|a[2]|a[3])===0,f=6);let g;typeof e=="string"?(!o.mask||d)&&o[he]!==void 0?g=o[he]:(e=Buffer.from(e),g=e.length):(g=e.length,x=o.mask&&o.readOnly&&!d);let p=g;g>=65536?(f+=8,p=127):g>125&&(f+=2,p=126);let _=Buffer.allocUnsafe(x?g+f:f);return _[0]=o.fin?o.opcode|128:o.opcode,o.rsv1&&(_[0]|=64),_[1]=p,p===126?_.writeUInt16BE(g,2):p===127&&(_[2]=_[3]=0,_.writeUIntBE(g,4,6)),o.mask?(_[1]|=128,_[f-4]=a[0],_[f-3]=a[1],_[f-2]=a[2],_[f-1]=a[3],d?[_,e]:x?(Pi(e,a,_,f,g),[_]):(Pi(e,a,e,0,g),[_,e])):[_,e]}close(e,o,a,x){let f;if(e===void 0)f=qx;else{if(typeof e!="number"||!Hx(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 g=Buffer.byteLength(o);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 o=="string"?f.write(o,2):f.set(o,2)}}let d={[he]:f.length,fin:!0,generateMask:this._generateMask,mask:a,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state!==_e?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):gt(e)?(x=e.size,f=!1):(e=Ve(e),x=e.length,f=Ve.readOnly),x>125)throw new RangeError("The data size must not be greater than 125 bytes");let d={[he]:x,fin:!0,generateMask:this._generateMask,mask:o,maskBuffer:this._maskBuffer,opcode:9,readOnly:f,rsv1:!1};gt(e)?this._state!==_e?this.enqueue([this.getBlobData,e,!1,d,a]):this.getBlobData(e,!1,d,a):this._state!==_e?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):gt(e)?(x=e.size,f=!1):(e=Ve(e),x=e.length,f=Ve.readOnly),x>125)throw new RangeError("The data size must not be greater than 125 bytes");let d={[he]:x,fin:!0,generateMask:this._generateMask,mask:o,maskBuffer:this._maskBuffer,opcode:10,readOnly:f,rsv1:!1};gt(e)?this._state!==_e?this.enqueue([this.getBlobData,e,!1,d,a]):this.getBlobData(e,!1,d,a):this._state!==_e?this.enqueue([this.dispatch,e,!1,d,a]):this.sendFrame(r.frame(e,d),a)}send(e,o,a){let x=this._extensions[Di.extensionName],f=o.binary?2:1,d=o.compress,g,p;typeof e=="string"?(g=Buffer.byteLength(e),p=!1):gt(e)?(g=e.size,p=!1):(e=Ve(e),g=e.length,p=Ve.readOnly),this._firstFragment?(this._firstFragment=!1,d&&x&&x.params[x._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(d=g>=x._threshold),this._compress=d):(d=!1,f=0),o.fin&&(this._firstFragment=!0);let _={[he]:g,fin:o.fin,generateMask:this._generateMask,mask:o.mask,maskBuffer:this._maskBuffer,opcode:f,readOnly:p,rsv1:d};gt(e)?this._state!==_e?this.enqueue([this.getBlobData,e,this._compress,_,a]):this.getBlobData(e,this._compress,_,a):this._state!==_e?this.enqueue([this.dispatch,e,this._compress,_,a]):this.dispatch(e,this._compress,_,a)}getBlobData(e,o,a,x){this._bufferedBytes+=a[he],this._state=Wx,e.arrayBuffer().then(f=>{if(this._socket.destroyed){let g=new Error("The socket was closed while the blob was being read");process.nextTick(Er,this,g,x);return}this._bufferedBytes-=a[he];let d=Ve(f);o?this.dispatch(d,o,a,x):(this._state=_e,this.sendFrame(r.frame(d,a),x),this.dequeue())}).catch(f=>{process.nextTick(Gx,this,f,x)})}dispatch(e,o,a,x){if(!o){this.sendFrame(r.frame(e,a),x);return}let f=this._extensions[Di.extensionName];this._bufferedBytes+=a[he],this._state=jx,f.compress(e,a.fin,(d,g)=>{if(this._socket.destroyed){let p=new Error("The socket was closed while data was being compressed");Er(this,p,x);return}this._bufferedBytes-=a[he],this._state=_e,a.readOnly=!1,this.sendFrame(r.frame(g,a),x),this.dequeue()})}dequeue(){for(;this._state===_e&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[3][he],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][he],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=Cr;function Er(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 Gx(r,e,o){Er(r,e,o),r.onerror(e)}});var qi=oe((al,zi)=>{"use strict";var{kForOnEventAttribute:Tt,kListener:kr}=Le(),Ti=Symbol("kCode"),Li=Symbol("kData"),Ni=Symbol("kError"),Mi=Symbol("kMessage"),Ri=Symbol("kReason"),mt=Symbol("kTarget"),Oi=Symbol("kType"),Bi=Symbol("kWasClean"),Me=class{constructor(e){this[mt]=null,this[Oi]=e}get target(){return this[mt]}get type(){return this[Oi]}};Object.defineProperty(Me.prototype,"target",{enumerable:!0});Object.defineProperty(Me.prototype,"type",{enumerable:!0});var Qe=class extends Me{constructor(e,o={}){super(e),this[Ti]=o.code===void 0?0:o.code,this[Ri]=o.reason===void 0?"":o.reason,this[Bi]=o.wasClean===void 0?!1:o.wasClean}get code(){return this[Ti]}get reason(){return this[Ri]}get wasClean(){return this[Bi]}};Object.defineProperty(Qe.prototype,"code",{enumerable:!0});Object.defineProperty(Qe.prototype,"reason",{enumerable:!0});Object.defineProperty(Qe.prototype,"wasClean",{enumerable:!0});var _t=class extends Me{constructor(e,o={}){super(e),this[Ni]=o.error===void 0?null:o.error,this[Mi]=o.message===void 0?"":o.message}get error(){return this[Ni]}get message(){return this[Mi]}};Object.defineProperty(_t.prototype,"error",{enumerable:!0});Object.defineProperty(_t.prototype,"message",{enumerable:!0});var Lt=class extends Me{constructor(e,o={}){super(e),this[Li]=o.data===void 0?null:o.data}get data(){return this[Li]}};Object.defineProperty(Lt.prototype,"data",{enumerable:!0});var Jx={addEventListener(r,e,o={}){for(let x of this.listeners(r))if(!o[Tt]&&x[kr]===e&&!x[Tt])return;let a;if(r==="message")a=function(f,d){let g=new Lt("message",{data:d?f:f.toString()});g[mt]=this,An(e,this,g)};else if(r==="close")a=function(f,d){let g=new Qe("close",{code:f,reason:d.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});g[mt]=this,An(e,this,g)};else if(r==="error")a=function(f){let d=new _t("error",{error:f,message:f.message});d[mt]=this,An(e,this,d)};else if(r==="open")a=function(){let f=new Me("open");f[mt]=this,An(e,this,f)};else return;a[Tt]=!!o[Tt],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[Tt]){this.removeListener(r,o);break}}};zi.exports={CloseEvent:Qe,ErrorEvent:_t,Event:Me,EventTarget:Jx,MessageEvent:Lt};function An(r,e,o){typeof r=="object"&&r.handleEvent?r.handleEvent.call(r,o):r.call(e,o)}});var kn=oe((xl,Fi)=>{"use strict";var{tokenChars:Nt}=ht();function Ee(r,e,o){r[e]===void 0?r[e]=[o]:r[e].push(o)}function Xx(r){let e=Object.create(null),o=Object.create(null),a=!1,x=!1,f=!1,d,g,p=-1,_=-1,w=-1,y=0;for(;y<r.length;y++)if(_=r.charCodeAt(y),d===void 0)if(w===-1&&Nt[_]===1)p===-1&&(p=y);else if(y!==0&&(_===32||_===9))w===-1&&p!==-1&&(w=y);else if(_===59||_===44){if(p===-1)throw new SyntaxError(`Unexpected character at index ${y}`);w===-1&&(w=y);let T=r.slice(p,w);_===44?(Ee(e,T,o),o=Object.create(null)):d=T,p=w=-1}else throw new SyntaxError(`Unexpected character at index ${y}`);else if(g===void 0)if(w===-1&&Nt[_]===1)p===-1&&(p=y);else if(_===32||_===9)w===-1&&p!==-1&&(w=y);else if(_===59||_===44){if(p===-1)throw new SyntaxError(`Unexpected character at index ${y}`);w===-1&&(w=y),Ee(o,r.slice(p,w),!0),_===44&&(Ee(e,d,o),o=Object.create(null),d=void 0),p=w=-1}else if(_===61&&p!==-1&&w===-1)g=r.slice(p,y),p=w=-1;else throw new SyntaxError(`Unexpected character at index ${y}`);else if(x){if(Nt[_]!==1)throw new SyntaxError(`Unexpected character at index ${y}`);p===-1?p=y:a||(a=!0),x=!1}else if(f)if(Nt[_]===1)p===-1&&(p=y);else if(_===34&&p!==-1)f=!1,w=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(w===-1&&Nt[_]===1)p===-1&&(p=y);else if(p!==-1&&(_===32||_===9))w===-1&&(w=y);else if(_===59||_===44){if(p===-1)throw new SyntaxError(`Unexpected character at index ${y}`);w===-1&&(w=y);let T=r.slice(p,w);a&&(T=T.replace(/\\/g,""),a=!1),Ee(o,g,T),_===44&&(Ee(e,d,o),o=Object.create(null),d=void 0),g=void 0,p=w=-1}else throw new SyntaxError(`Unexpected character at index ${y}`);if(p===-1||f||_===32||_===9)throw new SyntaxError("Unexpected end of input");w===-1&&(w=y);let A=r.slice(p,w);return d===void 0?Ee(e,A,o):(g===void 0?Ee(o,A,!0):a?Ee(o,g,A.replace(/\\/g,"")):Ee(o,g,A),Ee(e,d,o)),e}function Vx(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(", ")}Fi.exports={format:Vx,parse:Xx}});var Tn=oe((ul,$i)=>{"use strict";var Yx=X("events"),Qx=X("https"),$x=X("http"),Ki=X("net"),Zx=X("tls"),{randomBytes:ec,createHash:tc}=X("crypto"),{Duplex:cl,Readable:fl}=X("stream"),{URL:Dr}=X("url"),Ke=lt(),nc=Sr(),rc=Ar(),{isBlob:sc}=ht(),{BINARY_TYPES:Ui,CLOSE_TIMEOUT:ic,EMPTY_BUFFER:Dn,GUID:oc,kForOnEventAttribute:Pr,kListener:ac,kStatusCode:xc,kWebSocket:Z,NOOP:ji}=Le(),{EventTarget:{addEventListener:cc,removeEventListener:fc}}=qi(),{format:uc,parse:dc}=kn(),{toBuffer:lc}=Pt(),Wi=Symbol("kAborted"),Ir=[8,13],Re=["CONNECTING","OPEN","CLOSING","CLOSED"],hc=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,q=class r extends Yx{constructor(e,o,a){super(),this._binaryType=Ui[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]),Gi(this,e,o,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,o,a){let x=new nc({allowSynchronousEvents:a.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:a.maxPayload,skipUTF8Validation:a.skipUTF8Validation}),f=new rc(e,this._extensions,a.generateMask);this._receiver=x,this._sender=f,this._socket=e,x[Z]=this,f[Z]=this,e[Z]=this,x.on("conclude",mc),x.on("drain",_c),x.on("error",wc),x.on("message",yc),x.on("ping",bc),x.on("pong",vc),f.onerror=Sc,e.setTimeout&&e.setTimeout(0),e.setNoDelay&&e.setNoDelay(),o.length>0&&e.unshift(o),e.on("close",Vi),e.on("data",In),e.on("end",Yi),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[Ke.extensionName]&&this._extensions[Ke.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){fe(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())}),Xi(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[Ke.extensionName]||(x.compress=!1),this._sender.send(e||Dn,x,a)}terminate(){if(this.readyState!==r.CLOSED){if(this.readyState===r.CONNECTING){fe(this,this._req,"WebSocket was closed before the connection was established");return}this._socket&&(this._readyState=r.CLOSING,this._socket.destroy())}}};Object.defineProperty(q,"CONNECTING",{enumerable:!0,value:Re.indexOf("CONNECTING")});Object.defineProperty(q.prototype,"CONNECTING",{enumerable:!0,value:Re.indexOf("CONNECTING")});Object.defineProperty(q,"OPEN",{enumerable:!0,value:Re.indexOf("OPEN")});Object.defineProperty(q.prototype,"OPEN",{enumerable:!0,value:Re.indexOf("OPEN")});Object.defineProperty(q,"CLOSING",{enumerable:!0,value:Re.indexOf("CLOSING")});Object.defineProperty(q.prototype,"CLOSING",{enumerable:!0,value:Re.indexOf("CLOSING")});Object.defineProperty(q,"CLOSED",{enumerable:!0,value:Re.indexOf("CLOSED")});Object.defineProperty(q.prototype,"CLOSED",{enumerable:!0,value:Re.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(r=>{Object.defineProperty(q.prototype,r,{enumerable:!0})});["open","error","close","message"].forEach(r=>{Object.defineProperty(q.prototype,`on${r}`,{enumerable:!0,get(){for(let e of this.listeners(r))if(e[Pr])return e[ac];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})}})});q.prototype.addEventListener=cc;q.prototype.removeEventListener=fc;$i.exports=q;function Gi(r,e,o,a){let x={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:ic,protocolVersion:Ir[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,!Ir.includes(x.protocolVersion))throw new RangeError(`Unsupported protocol version: ${x.protocolVersion} (supported versions: ${Ir.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:",g=f.protocol==="ws+unix:",p;if(f.protocol!=="ws:"&&!d&&!g?p=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:g&&!f.pathname?p="The URL's pathname is empty":f.hash&&(p="The URL contains a fragment identifier"),p){let R=new SyntaxError(p);if(r._redirects===0)throw R;Pn(r,R);return}let _=d?443:80,w=ec(16).toString("base64"),y=d?Qx.request:$x.request,A=new Set,T;if(x.createConnection=x.createConnection||(d?pc:gc),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":w,Connection:"Upgrade",Upgrade:"websocket"},x.path=f.pathname+f.search,x.timeout=x.handshakeTimeout,x.perMessageDeflate&&(T=new Ke({...x.perMessageDeflate,isServer:!1,maxPayload:x.maxPayload}),x.headers["Sec-WebSocket-Extensions"]=uc({[Ke.extensionName]:T.offer()})),o.length){for(let R of o){if(typeof R!="string"||!hc.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}`),g){let R=x.path.split(":");x.socketPath=R[0],x.path=R[1]}let N;if(x.followRedirects){if(r._redirects===0){r._originalIpc=g,r._originalSecure=d,r._originalHostOrSocketPath=g?x.socketPath:f.host;let R=a&&a.headers;if(a={...a,headers:{}},R)for(let[K,ie]of Object.entries(R))a.headers[K.toLowerCase()]=ie}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&&!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")),N=r._req=y(x),r._redirects&&r.emit("redirect",r.url,N)}else N=r._req=y(x);x.timeout&&N.on("timeout",()=>{fe(r,N,"Opening handshake has timed out")}),N.on("error",R=>{N===null||N[Wi]||(N=r._req=null,Pn(r,R))}),N.on("response",R=>{let K=R.headers.location,ie=R.statusCode;if(K&&x.followRedirects&&ie>=300&&ie<400){if(++r._redirects>x.maxRedirects){fe(r,N,"Maximum redirects exceeded");return}N.abort();let xe;try{xe=new Dr(K,e)}catch{let z=new SyntaxError(`Invalid URL: ${K}`);Pn(r,z);return}Gi(r,xe,o,a)}else r.emit("unexpected-response",N,R)||fe(r,N,`Unexpected server response: ${R.statusCode}`)}),N.on("upgrade",(R,K,ie)=>{if(r.emit("upgrade",R),r.readyState!==q.CONNECTING)return;N=r._req=null;let xe=R.headers.upgrade;if(xe===void 0||xe.toLowerCase()!=="websocket"){fe(r,K,"Invalid Upgrade header");return}let D=tc("sha1").update(w+oc).digest("base64");if(R.headers["sec-websocket-accept"]!==D){fe(r,K,"Invalid Sec-WebSocket-Accept header");return}let z=R.headers["sec-websocket-protocol"],G;if(z!==void 0?A.size?A.has(z)||(G="Server sent an invalid subprotocol"):G="Server sent a subprotocol but none was requested":A.size&&(G="Server sent no subprotocol"),G){fe(r,K,G);return}z&&(r._protocol=z);let Ae=R.headers["sec-websocket-extensions"];if(Ae!==void 0){if(!T){fe(r,K,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let Oe;try{Oe=dc(Ae)}catch{fe(r,K,"Invalid Sec-WebSocket-Extensions header");return}let we=Object.keys(Oe);if(we.length!==1||we[0]!==Ke.extensionName){fe(r,K,"Server indicated an extension that was not requested");return}try{T.accept(Oe[Ke.extensionName])}catch{fe(r,K,"Invalid Sec-WebSocket-Extensions header");return}r._extensions[Ke.extensionName]=T}r.setSocket(K,ie,{allowSynchronousEvents:x.allowSynchronousEvents,generateMask:x.generateMask,maxPayload:x.maxPayload,skipUTF8Validation:x.skipUTF8Validation})}),x.finishRequest?x.finishRequest(N,r):N.end()}function Pn(r,e){r._readyState=q.CLOSING,r._errorEmitted=!0,r.emit("error",e),r.emitClose()}function gc(r){return r.path=r.socketPath,Ki.connect(r)}function pc(r){return r.path=void 0,!r.servername&&r.servername!==""&&(r.servername=Ki.isIP(r.host)?"":r.host),Zx.connect(r)}function fe(r,e,o){r._readyState=q.CLOSING;let a=new Error(o);Error.captureStackTrace(a,fe),e.setHeader?(e[Wi]=!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=sc(e)?e.size:lc(e).length;r._socket?r._sender._bufferedBytes+=a:r._bufferedAmount+=a}if(o){let a=new Error(`WebSocket is not open: readyState ${r.readyState} (${Re[r.readyState]})`);process.nextTick(o,a)}}function mc(r,e){let o=this[Z];o._closeFrameReceived=!0,o._closeMessage=e,o._closeCode=r,o._socket[Z]!==void 0&&(o._socket.removeListener("data",In),process.nextTick(Ji,o._socket),r===1005?o.close():o.close(r,e))}function _c(){let r=this[Z];r.isPaused||r._socket.resume()}function wc(r){let e=this[Z];e._socket[Z]!==void 0&&(e._socket.removeListener("data",In),process.nextTick(Ji,e._socket),e.close(r[xc])),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",r))}function Hi(){this[Z].emitClose()}function yc(r,e){this[Z].emit("message",r,e)}function bc(r){let e=this[Z];e._autoPong&&e.pong(r,!this._isServer,ji),e.emit("ping",r)}function vc(r){this[Z].emit("pong",r)}function Ji(r){r.resume()}function Sc(r){let e=this[Z];e.readyState!==q.CLOSED&&(e.readyState===q.OPEN&&(e._readyState=q.CLOSING,Xi(e)),this._socket.end(),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",r)))}function Xi(r){r._closeTimer=setTimeout(r._socket.destroy.bind(r._socket),r._closeTimeout)}function Vi(){let r=this[Z];if(this.removeListener("close",Vi),this.removeListener("data",In),this.removeListener("end",Yi),r._readyState=q.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[Z]=void 0,clearTimeout(r._closeTimer),r._receiver._writableState.finished||r._receiver._writableState.errorEmitted?r.emitClose():(r._receiver.on("error",Hi),r._receiver.on("finish",Hi))}function In(r){this[Z]._receiver.write(r)||this.pause()}function Yi(){let r=this[Z];r._readyState=q.CLOSING,r._receiver.end(),this.end()}function Qi(){let r=this[Z];this.removeListener("error",Qi),this.on("error",ji),r&&(r._readyState=q.CLOSING,this.destroy())}});var no=oe((ll,to)=>{"use strict";var dl=Tn(),{Duplex:Cc}=X("stream");function Zi(r){r.emit("close")}function Ec(){!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 Ac(r,e){let o=!0,a=new Cc({...e,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return r.on("message",function(f,d){let g=!d&&a._readableState.objectMode?f.toString():f;a.push(g)||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(Zi,a);return}let d=!1;r.once("error",function(p){d=!0,f(p)}),r.once("close",function(){d||f(x),process.nextTick(Zi,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",Ec),a.on("error",eo),a}to.exports=Ac});var Lr=oe((hl,ro)=>{"use strict";var{tokenChars:kc}=ht();function Dc(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&&kc[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 g=r.slice(o,a);if(e.has(g))throw new SyntaxError(`The "${g}" subprotocol is duplicated`);e.add(g),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}ro.exports={parse:Dc}});var fo=oe((pl,co)=>{"use strict";var Pc=X("events"),Ln=X("http"),{Duplex:gl}=X("stream"),{createHash:Ic}=X("crypto"),so=kn(),$e=lt(),Tc=Lr(),Lc=Tn(),{CLOSE_TIMEOUT:Nc,GUID:Mc,kWebSocket:Rc}=Le(),Oc=/^[+/0-9A-Za-z]{22}==$/,io=0,oo=1,xo=2,Nr=class extends Pc{constructor(e,o){if(super(),e={allowSynchronousEvents:!0,autoPong:!0,maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:Nc,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:Lc,...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=Ln.createServer((a,x)=>{let f=Ln.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=Bc(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=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(Mt,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(Mt,this):process.nextTick(Mt,this);else{let o=this._server;this._removeListeners(),this._removeListeners=this._server=null,o.close(()=>{Mt(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",ao);let f=e.headers["sec-websocket-key"],d=e.headers.upgrade,g=+e.headers["sec-websocket-version"];if(e.method!=="GET"){Ze(this,e,o,405,"Invalid HTTP method");return}if(d===void 0||d.toLowerCase()!=="websocket"){Ze(this,e,o,400,"Invalid Upgrade header");return}if(f===void 0||!Oc.test(f)){Ze(this,e,o,400,"Missing or invalid Sec-WebSocket-Key header");return}if(g!==13&&g!==8){Ze(this,e,o,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});return}if(!this.shouldHandle(e)){Rt(o,400);return}let p=e.headers["sec-websocket-protocol"],_=new Set;if(p!==void 0)try{_=Tc.parse(p)}catch{Ze(this,e,o,400,"Invalid Sec-WebSocket-Protocol header");return}let w=e.headers["sec-websocket-extensions"],y={};if(this.options.perMessageDeflate&&w!==void 0){let A=new $e({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let T=so.parse(w);T[$e.extensionName]&&(A.accept(T[$e.extensionName]),y[$e.extensionName]=A)}catch{Ze(this,e,o,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let A={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(A,(T,N,R,K)=>{if(!T)return Rt(o,N||401,R,K);this.completeUpgrade(y,f,_,e,o,a,x)});return}if(!this.options.verifyClient(A))return Rt(o,401)}this.completeUpgrade(y,f,_,e,o,a,x)}completeUpgrade(e,o,a,x,f,d,g){if(!f.readable||!f.writable)return f.destroy();if(f[Rc])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>io)return Rt(f,503);let _=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${Ic("sha1").update(o+Mc).digest("base64")}`],w=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}`),w._protocol=y)}if(e[$e.extensionName]){let y=e[$e.extensionName].params,A=so.format({[$e.extensionName]:[y]});_.push(`Sec-WebSocket-Extensions: ${A}`),w._extensions=e}this.emit("headers",_,x),f.write(_.concat(`\r
12
12
  `).join(`\r
13
- `)),f.removeListener("error",ao),v.setSocket(f,u,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(v),v.on("close",()=>{this.clients.delete(v),this._shouldEmitClose&&!this.clients.size&&process.nextTick(zt,this)})),g(v,x)}};co.exports=Mr;function Rc(r,e){for(let i of Object.keys(e))r.on(i,e[i]);return function(){for(let a of Object.keys(e))r.removeListener(a,e[a])}}function zt(r){r._state=xo,r.emit("close")}function ao(){this.destroy()}function qt(r,e,i,a){i=i||zn.STATUS_CODES[e],a={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(i),...a},r.once("finish",r.destroy),r.end(`HTTP/1.1 ${e} ${zn.STATUS_CODES[e]}\r
13
+ `)),f.removeListener("error",ao),w.setSocket(f,d,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(w),w.on("close",()=>{this.clients.delete(w),this._shouldEmitClose&&!this.clients.size&&process.nextTick(Mt,this)})),g(w,x)}};co.exports=Nr;function Bc(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 Mt(r){r._state=xo,r.emit("close")}function ao(){this.destroy()}function Rt(r,e,o,a){o=o||Ln.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} ${Ln.STATUS_CODES[e]}\r
14
14
  `+Object.keys(a).map(x=>`${x}: ${a[x]}`).join(`\r
15
15
  `)+`\r
16
16
  \r
17
- `+i)}function nt(r,e,i,a,x,f){if(r.listenerCount("wsClientError")){let u=new Error(x);Error.captureStackTrace(u,nt),r.emit("wsClientError",u,i,e)}else qt(i,a,x,f)}});import{spawn as sf}from"node:child_process";import{existsSync as of,openSync as af}from"node:fs";import{mkdir as xf}from"node:fs/promises";import{dirname as cf}from"node:path";import{fileURLToPath as ff}from"node:url";function Fr(r=V()){return of(r.libEntry)?r.libEntry:ff(new URL("../index.ts",import.meta.url))}async function Lo(r={}){let e=r.paths??V(),i=r.entryOverride??Fr(e);await xf(cf(e.logFile),{recursive:!0});let a=af(e.logFile,"a"),f=i.endsWith(".ts")?["--import","tsx/esm",i,"--daemon"]:[i,"--daemon"],u=sf(process.execPath,f,{detached:!0,stdio:["ignore",a,a],env:{...process.env,COZE_BRIDGE_DAEMON:"1"}});if(u.unref(),typeof u.pid!="number")throw new Error("failed to spawn daemon (no pid)");return uf.info("daemon spawned",{pid:u.pid,entry:i}),{pid:u.pid,entry:i}}var uf,Ur=Pe(()=>{"use strict";K();fe();uf=O("spawn-daemon")});import{spawn as wf}from"node:child_process";import{mkdir as yf,unlink as vf,writeFile as bf}from"node:fs/promises";import{dirname as Sf,join as Cf}from"node:path";function Gn(r){return r.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function Mo(r,e){return new Promise((i,a)=>{let x=wf(r,e,{stdio:["ignore","pipe","pipe"]}),f="";x.stderr?.on("data",u=>{f+=u.toString("utf8")}),x.on("error",a),x.on("close",u=>{u===0?i():a(new Error(`${r} ${e.join(" ")} exited ${u}: ${f.trim()}`))})})}var jn,Wr,jr,zo=Pe(()=>{"use strict";K();jn=O("supervisor.launchd"),Wr="ai.coze.bridge",jr={platform:"darwin",renderConfig(r){return`<?xml version="1.0" encoding="UTF-8"?>
17
+ `+o)}function Ze(r,e,o,a,x,f){if(r.listenerCount("wsClientError")){let d=new Error(x);Error.captureStackTrace(d,Ze),r.emit("wsClientError",d,o,e)}else Rt(o,a,x,f)}});import{spawn as xf}from"node:child_process";import{existsSync as cf,openSync as ff}from"node:fs";import{mkdir as uf}from"node:fs/promises";import{dirname as df}from"node:path";import{fileURLToPath as lf}from"node:url";function Or(r=U()){return cf(r.libEntry)?r.libEntry:lf(new URL("../index.ts",import.meta.url))}async function Lo(r={}){let e=r.paths??U(),o=r.entryOverride??Or(e);await uf(df(e.logFile),{recursive:!0});let a=ff(e.logFile,"a"),f=o.endsWith(".ts")?["--import","tsx/esm",o,"--daemon"]:[o,"--daemon"],d=xf(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 hf.info("daemon spawned",{pid:d.pid,entry:o}),{pid:d.pid,entry:o}}var hf,Br=De(()=>{"use strict";F();ce();hf=M("spawn-daemon")});import{spawn as vf}from"node:child_process";import{mkdir as Sf,unlink as Cf,writeFile as Ef}from"node:fs/promises";import{dirname as Af,join as kf}from"node:path";function Fn(r){return r.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function Bo(r,e){return new Promise((o,a)=>{let x=vf(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,zo=De(()=>{"use strict";F();qn=M("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>${Wr}</string>
22
+ <string>${Fr}</string>
23
23
  <key>ProgramArguments</key>
24
24
  <array>
25
- <string>${Gn(r.nodeBin)}</string>
26
- <string>${Gn(r.entry)}</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>${Gn(r.logFile)}</string>
36
+ <string>${Fn(r.logFile)}</string>
37
37
  <key>StandardErrorPath</key>
38
- <string>${Gn(r.logFile)}</string>
38
+ <string>${Fn(r.logFile)}</string>
39
39
  </dict>
40
40
  </plist>
41
- `},configPath(r){return Cf(r.homeDir,"Library","LaunchAgents",`${Wr}.plist`)},async install(r){let e=this.configPath(r);await yf(Sf(e),{recursive:!0}),await bf(e,this.renderConfig(r),"utf8"),jn.info("plist written",{plistPath:e}),await Mo("launchctl",["load","-w",e]),jn.info("launchd job loaded",{label:Wr})},async uninstall(r){let e=this.configPath(r);await Mo("launchctl",["unload","-w",e]).catch(i=>jn.warn("launchctl unload failed (ignored)",{err:String(i)})),await vf(e).catch(i=>{if(i.code!=="ENOENT")throw i}),jn.info("launchd job removed",{plistPath:e})}}});import{spawn as Ef}from"node:child_process";import{mkdir as kf,unlink as Af,writeFile as Df}from"node:fs/promises";import{dirname as Tf,join as Pf}from"node:path";function Yn(r,e){return new Promise((i,a)=>{let x=Ef(r,e,{stdio:["ignore","pipe","pipe"]}),f="";x.stderr?.on("data",u=>{f+=u.toString("utf8")}),x.on("error",a),x.on("close",u=>{u===0?i():a(new Error(`${r} ${e.join(" ")} exited ${u}: ${f.trim()}`))})})}var Jn,Vn,Gr,qo=Pe(()=>{"use strict";K();Jn=O("supervisor.systemd"),Vn="coze-bridge.service",Gr={platform:"linux",renderConfig(r){return`[Unit]
41
+ `},configPath(r){return kf(r.homeDir,"Library","LaunchAgents",`${Fr}.plist`)},async install(r){let e=this.configPath(r);await Sf(Af(e),{recursive:!0}),await Ef(e,this.renderConfig(r),"utf8"),qn.info("plist written",{plistPath:e}),await Bo("launchctl",["load","-w",e]),qn.info("launchd job loaded",{label:Fr})},async uninstall(r){let e=this.configPath(r);await Bo("launchctl",["unload","-w",e]).catch(o=>qn.warn("launchctl unload failed (ignored)",{err:String(o)})),await Cf(e).catch(o=>{if(o.code!=="ENOENT")throw o}),qn.info("launchd job removed",{plistPath:e})}}});import{spawn as Df}from"node:child_process";import{mkdir as Pf,unlink as If,writeFile as Tf}from"node:fs/promises";import{dirname as Lf,join as Nf}from"node:path";function Kn(r,e){return new Promise((o,a)=>{let x=Df(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,Hn,Hr,qo=De(()=>{"use strict";F();Un=M("supervisor.systemd"),Hn="coze-bridge.service",Hr={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 Pf(r.homeDir,".config","systemd","user",Vn)},async install(r){let e=this.configPath(r);await kf(Tf(e),{recursive:!0}),await Df(e,this.renderConfig(r),"utf8"),Jn.info("systemd unit written",{unitPath:e}),await Yn("systemctl",["--user","daemon-reload"]),await Yn("systemctl",["--user","enable","--now",Vn]),Jn.info("systemd unit enabled",{unitName:Vn})},async uninstall(r){let e=this.configPath(r);await Yn("systemctl",["--user","disable","--now",Vn]).catch(i=>Jn.warn("systemctl disable failed (ignored)",{err:String(i)})),await Af(e).catch(i=>{if(i.code!=="ENOENT")throw i}),await Yn("systemctl",["--user","daemon-reload"]).catch(()=>{}),Jn.info("systemd unit removed",{unitPath:e})}}});import{spawn as If}from"node:child_process";import{join as Lf}from"node:path";function Fo(r,e){return new Promise((i,a)=>{let x=If(r,e,{stdio:["ignore","pipe","pipe"],shell:!1}),f="";x.stderr?.on("data",u=>{f+=u.toString("utf8")}),x.on("error",a),x.on("close",u=>{u===0?i():a(new Error(`${r} ${e.join(" ")} exited ${u}: ${f.trim()}`))})})}var Jr,Xn,Vr,Uo=Pe(()=>{"use strict";K();Jr=O("supervisor.taskscheduler"),Xn="CozeBridge",Vr={platform:"win32",renderConfig(r){return`<?xml version="1.0" encoding="UTF-16"?>
55
+ `},configPath(r){return Nf(r.homeDir,".config","systemd","user",Hn)},async install(r){let e=this.configPath(r);await Pf(Lf(e),{recursive:!0}),await Tf(e,this.renderConfig(r),"utf8"),Un.info("systemd unit written",{unitPath:e}),await Kn("systemctl",["--user","daemon-reload"]),await Kn("systemctl",["--user","enable","--now",Hn]),Un.info("systemd unit enabled",{unitName:Hn})},async uninstall(r){let e=this.configPath(r);await Kn("systemctl",["--user","disable","--now",Hn]).catch(o=>Un.warn("systemctl disable failed (ignored)",{err:String(o)})),await If(e).catch(o=>{if(o.code!=="ENOENT")throw o}),await Kn("systemctl",["--user","daemon-reload"]).catch(()=>{}),Un.info("systemd unit removed",{unitPath:e})}}});import{spawn as Mf}from"node:child_process";import{join as Rf}from"node:path";function Fo(r,e){return new Promise((o,a)=>{let x=Mf(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 Kr,jn,jr,Uo=De(()=>{"use strict";F();Kr=M("supervisor.taskscheduler"),jn="CozeBridge",jr={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,19 @@ WantedBy=default.target
76
76
  </Exec>
77
77
  </Actions>
78
78
  </Task>
79
- `},configPath(r){return Lf(r.homeDir,".coze","bridge","task.xml")},async install(r){let e=`"${r.nodeBin}" "${r.entry}" --daemon`;await Fo("schtasks",["/Create","/SC","ONLOGON","/TN",Xn,"/TR",e,"/RU",r.userName,"/F"]),Jr.info("task scheduler entry created",{task:Xn})},async uninstall(r){await Fo("schtasks",["/Delete","/TN",Xn,"/F"]).catch(e=>Jr.warn("schtasks /Delete failed (ignored)",{err:String(e)})),Jr.info("task scheduler entry removed",{task:Xn})}}});var Yr={};ys(Yr,{buildContext:()=>Bf,getSupervisor:()=>Of,launchdSupervisor:()=>jr,systemdSupervisor:()=>Gr,taskSchedulerSupervisor:()=>Vr});import{homedir as Nf,userInfo as Rf}from"node:os";function Of(r=process.platform){switch(r){case"darwin":return jr;case"linux":return Gr;case"win32":return Vr;default:throw new Error(`unsupported platform for OS supervisor: ${r}`)}}function Bf(){let r=V();return{nodeBin:process.execPath,entry:Fr(r),logFile:r.logFile,homeDir:Nf(),userName:Rf().username}}var Xr=Pe(()=>{"use strict";fe();Ur();zo();qo();Uo()});Ke();K();import{readdir as na}from"node:fs/promises";import{mkdir as Z0,writeFile as $0}from"node:fs/promises";import{join as Q0}from"node:path";var ea={"claude-code":"CLAUDE.md",codex:"AGENTS.md",openclaw:"SOUL.md"};async function Ve(r,e,i,a){await Z0(r,{recursive:!0});let x=ea[e],f=Q0(r,x),u=ta(e,i,a);return await $0(f,u,"utf8"),f}function ta(r,e,i){let a=`# Coze Agent: ${e}
79
+ `},configPath(r){return Rf(r.homeDir,".coze","bridge","task.xml")},async install(r){let e=`"${r.nodeBin}" "${r.entry}" --daemon`;await Fo("schtasks",["/Create","/SC","ONLOGON","/TN",jn,"/TR",e,"/RU",r.userName,"/F"]),Kr.info("task scheduler entry created",{task:jn})},async uninstall(r){await Fo("schtasks",["/Delete","/TN",jn,"/F"]).catch(e=>Kr.warn("schtasks /Delete failed (ignored)",{err:String(e)})),Kr.info("task scheduler entry removed",{task:jn})}}});var Wr={};ms(Wr,{buildContext:()=>qf,getSupervisor:()=>zf,launchdSupervisor:()=>Ur,systemdSupervisor:()=>Hr,taskSchedulerSupervisor:()=>jr});import{homedir as Of,userInfo as Bf}from"node:os";function zf(r=process.platform){switch(r){case"darwin":return Ur;case"linux":return Hr;case"win32":return jr;default:throw new Error(`unsupported platform for OS supervisor: ${r}`)}}function qf(){let r=U();return{nodeBin:process.execPath,entry:Or(r),logFile:r.logFile,homeDir:Of(),userName:Bf().username}}var Gr=De(()=>{"use strict";ce();Br();zo();qo();Uo()});Fe();F();import{readdir as ia}from"node:fs/promises";import{mkdir as ea,writeFile as ta}from"node:fs/promises";import{join as na}from"node:path";var ra={"claude-code":"CLAUDE.md",codex:"AGENTS.md",openclaw:"SOUL.md"};async function Ge(r,e,o,a){await ea(r,{recursive:!0});let x=ra[e],f=na(r,x),d=sa(e,o,a);return await ta(f,d,"utf8"),f}function sa(r,e,o){let a=`# Coze Agent: ${e}
80
80
 
81
81
  > framework: \`${r}\`
82
82
 
83
- `,x=i?.trim()?i.endsWith(`
84
- `)?i:`${i}
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
- `}var xn=class{buffer="";onError;constructor(e={}){this.onError=e.onError}push(e){this.buffer+=typeof e=="string"?e:e.toString("utf8");let i=this.buffer.split(`
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 ve=M("agent-detail-sync"),Gt=class{constructor(e){this.opts=e}opts;async syncAll(e){let o=this.opts.paths.agentsRoot,a;try{a=await ia(o)}catch(x){ve.info("agents dir not found, skip detail sync",{root:o,err:String(x)});return}ve.info("starting detail sync",{reason:e,count:a.length});for(let x of a)try{await this.syncOne(x)}catch(f){ve.warn("detail sync failed for agent, skipping",{agentId:x,err:String(f)})}ve.info("detail sync done",{reason:e})}async syncOne(e){let o=await ae(e,this.opts.paths);if(!o){ve.info("detail sync: agent config missing, skip",{agentId:e});return}let a;try{a=await this.opts.sendDetail({_meta:{cozeAgentId:e}})}catch(d){ve.warn("detail RPC failed, using local data",{agentId:e,err:String(d)});return}if(a.agentId&&a.agentId!==e){ve.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&&ve.info("detail.deployType",{agentId:e,deployType:a.deployType}),!x){ve.debug("detail sync: no diff",{agentId:e});return}await de(o,this.opts.paths),ve.info("detail sync: config updated",{agentId:e,identityChanged:f,agentName:o.agentName}),f&&(await Ge(o.workspace,o.framework,e,o.cozeIdentity),await this.opts.handlers.reloadAgentSessionsPublic(e,"detail-sync"))}};Fe();import{spawn as oa}from"node:child_process";import{mkdir as aa,readFile as Ts,readdir as xa,rm as ca,stat as Xt,writeFile as fa}from"node:fs/promises";import{join as Te,normalize as ua,relative as Ls,resolve as da,sep as Ns}from"node:path";function St(r){return r?.cozeDeployType==="cloud"?"cloud":"local"}function vs(r){let{_meta:e,...o}=r;return{stripped:o,meta:e}}function at(r){if(!r?.cozeAgentId)throw new Error("missing _meta.cozeAgentId");return r.cozeAgentId}var E=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)}};F();ce();function Je(r,e){if(St(r)!=="cloud")throw new E("OPERATION_NOT_ALLOWED_FOR_LOCAL",`${e} is not allowed for local agent`)}var Ss="https://llm-gateway.coze.cn",Jt="auto";function xr(r){return{model:r.model??Jt,...r.modelToken?{modelToken:r.modelToken}:{}}}function Cs(r){return!r||r===Jt}function Es(r){let e={};return r.modelToken&&(e.ANTHROPIC_BASE_URL=Ss,e.ANTHROPIC_AUTH_TOKEN=r.modelToken),Cs(r.model)||(e.ANTHROPIC_MODEL=r.model),e}function As(r){let e=[];return Cs(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="${Ss}/v1"`)),e}function ks(r){return r.modelToken?{OPENAI_API_KEY:r.modelToken}:{}}var Q=M("agent-handlers"),Ds=5*1024*1024,la=1,ha=6,ga=new Set(["node_modules",".git",".coze","dist","build",".next"]),pa=3e4,Vt=class{constructor(e){this.opts=e}opts;async listSkills(e){Je(e._meta,"_agent/listSkills");let o=at(e._meta),a=await this.loadAgentCfg(o),x=a?.workspace??Ie(o).workspace,f=a?.skills??[],d=[];for(let g of f){let p=Te(x,g.relPath,"SKILL.md");await Xt(p).then(w=>w.isFile()).catch(()=>!1)&&d.push({skillId:g.skillId,skillName:g.skillName,downloadUrl:g.downloadUrl??"",...g.description?{description:g.description}:{},...g.version?{version:g.version}:{}})}return{skills:d}}async addSkills(e){Je(e._meta,"_agent/addSkills");let o=at(e._meta),a=await this.requireAgentCfg(o),x=e.skills??[],f=[...a.skills??[]],d=new Map(f.map((p,_)=>[p.skillId,_])),g=[];for(let p of x){if(!p.skillName)throw new E("IPC_BAD_REQUEST","skill missing skillName");let _=ma(p.skillName),w=_a(a.framework),y=Te(w,_),A=Te(a.workspace,y);await aa(A,{recursive:!0});let T=await ya(p.downloadUrl);va(T)?await Sa(T,A):await fa(Te(A,"SKILL.md"),T.toString("utf8"),"utf8");let N={skillId:p.skillId,skillName:p.skillName,relPath:y,installedAt:Date.now(),...p.description?{description:p.description}:{},...p.version?{version:p.version}:{},...p.downloadUrl?{downloadUrl:p.downloadUrl}:{}},R=d.get(p.skillId);R!==void 0?f[R]=N:(d.set(p.skillId,f.length),f.push(N)),g.push(p),Q.info("skill installed",{agentId:o,skillId:p.skillId,skillName:p.skillName,relPath:y})}return await jt(o,f),await this.reloadAgentSessions(o,"skills-added"),{installedSkills:g}}async removeSkills(e){Je(e._meta,"_agent/removeSkills");let o=at(e._meta),a=await this.requireAgentCfg(o),x=new Set(e.skillIds??[]),f=a.skills??[],d=[];for(let g of f){if(!x.has(g.skillId)){d.push(g);continue}let p=Te(a.workspace,g.relPath);await ca(p,{recursive:!0,force:!0}),Q.info("skill removed",{agentId:o,skillId:g.skillId,relPath:g.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)try{await a.downstream.sessionLoad({sessionId:f,cwd:a.workspace}),Q.info("session reloaded",{reason:o,agentId:e,framework:a.framework,cloudId:x,acpId:f})}catch(d){Q.warn("session reload failed",{reason:o,agentId:e,framework:a.framework,cloudId:x,acpId:f,err:String(d)})}}async updateAgent(e){if(!e.cozeIdentity?.trim())return Q.info("_agent/update: empty cozeIdentity, noop",{agentId:e.agentId}),{ok:!0};let o=e.agentId,a=await ae(o);if(!a)throw new E("AGENT_NOT_FOUND",`agent not found: ${o}`);return a.cozeIdentity===e.cozeIdentity?(Q.info("_agent/update: cozeIdentity unchanged, noop",{agentId:o}),{ok:!0}):(a.cozeIdentity=e.cozeIdentity,await de(a),await Ge(a.workspace,a.framework,o,e.cozeIdentity),Q.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 E("IPC_BAD_REQUEST","_agent/disconnect: missing agentId");let a=await ae(o);return a?(a.disconnectedAt=Date.now(),a.disconnectReason=e.reason??"",await de(a),Q.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}):(Q.warn("_agent/disconnect: agent not found, ignoring",{agentId:o}),{ok:!0})}async switchModel(e){if(Je(e._meta,"_agent/switchModel"),!e.agentId)throw new E("IPC_BAD_REQUEST","_agent/switchModel: missing agentId");let o=e.model&&e.model.trim()?e.model:Jt,a=e.modelToken?.trim()||void 0,x=await ae(e.agentId);if(!x)throw new E("AGENT_NOT_FOUND",`agent not found: ${e.agentId}`);x.model=o,a!==void 0?x.modelToken=a:delete x.modelToken,await de(x),Q.info("_agent/switchModel: model/modelToken persisted",{agentId:e.agentId,model:o,hasToken:!!a,reason:e.reason??"",force:e.force??!1});let f=this.opts.agents.get(e.agentId);if(!f)return Q.info("_agent/switchModel: agent not running, config persisted only",{agentId:e.agentId}),{ok:!0};if(f.status==="switching")return Q.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 d=f.msgQueue.enqueue(async()=>{}),g=setTimeout(()=>{Q.warn("_agent/switchModel: 30s idle timeout, forcing downstream stop",{agentId:e.agentId}),f.downstream.stop("switchModel idle timeout").catch(p=>Q.warn("force stop failed (ignored)",{agentId:e.agentId,err:String(p)}))},pa);try{return await d.catch(p=>Q.warn("_agent/switchModel: msgQueue idle wait rejected (continuing)",{agentId:e.agentId,err:String(p)})),clearTimeout(g),await this.opts.executeModelSwitch(e.agentId),{ok:!0}}catch(p){clearTimeout(g),Q.error("_agent/switchModel: failed, marking disconnected",{agentId:e.agentId,err:String(p)});let _=await ae(e.agentId).catch(()=>null);throw _&&(_.disconnectedAt=Date.now(),_.disconnectReason=`model switch failed: ${p instanceof Error?p.message:String(p)}`,await de(_).catch(w=>Q.warn("write disconnect marker failed (ignored)",{err:String(w)}))),this.opts.disposeAndMarkDisconnected?await this.opts.disposeAndMarkDisconnected(e.agentId,`model switch failed: ${p instanceof Error?p.message:String(p)}`).catch(w=>Q.warn("disposeAndMarkDisconnected failed (ignored)",{err:String(w)})):f.status="disconnected",p instanceof E&&(p.code==="MODEL_SWITCH_FAILED"||p.code==="AGENT_NOT_FOUND")?p:new E("MODEL_SWITCH_FAILED",p instanceof Error?p.message:String(p),{cause:p})}}async getFileTree(e){Je(e._meta,"_agent/getFileTree");let o=e._meta,a=at(o),x=this.resolveWorkspace(a),f=e.filePath??"",d=this.safeJoin(x,f),g=await Xt(d).catch(()=>null);if(!g)throw new E("IPC_BAD_REQUEST",`path not found: ${f}`);let p=Ca(e.depth);return g.isDirectory()?{tree:await Ms(x,d,f,p)}:{tree:[{name:Ea(f),path:Rs(f||"."),isDir:!1,size:g.size,modifiedAt:Math.floor(g.mtimeMs)}]}}async getFileContent(e){Je(e._meta,"_agent/getFileContent");let o=at(e._meta),a=this.resolveWorkspace(o);if(!e.filePath)throw new E("IPC_BAD_REQUEST","filePath required");let x=this.safeJoin(a,e.filePath),f=await Xt(x).catch(()=>null);if(!f||!f.isFile())throw new E("IPC_BAD_REQUEST",`not a file: ${e.filePath}`);if(f.size>Ds)throw new E("IPC_BAD_REQUEST",`file too large: ${f.size} bytes (max ${Ds})`);let d=await Ts(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:Ie(e).workspace}safeJoin(e,o){let a=da(e,o||"."),x=Ls(e,a);if(x.startsWith("..")||x===".."||x.startsWith(`..${Ns}`))throw new E("IPC_BAD_REQUEST",`path escapes workspace: ${o}`);return a}loadAgentCfg(e){return ae(e)}async requireAgentCfg(e){let o=await this.loadAgentCfg(e);if(!o)throw new E("AGENT_NOT_FOUND",`no config for agent: ${e}`);return o}};function ma(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 _a(r){return r==="claude-code"?Te(".claude","skills"):Te(".agents","skills")}var wa=3e4,Ps=50*1024*1024,Is=3e4;async function ya(r){if(!r)throw new E("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 Ts(e);if(o.length>Ps)throw new E("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(),wa);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>Ps)throw new E("IPC_BAD_REQUEST",`skill too large: ${x.byteLength} bytes`);return Buffer.from(x)}finally{clearTimeout(o)}}throw new E("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 E("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 va(r){return r.length>=2&&r[0]===31&&r[1]===139}async function Sa(r,e){await new Promise((o,a)=>{let x=oa("tar",["-xzf","-","-C",e,"--strip-components=1"],{stdio:["pipe","pipe","pipe"]}),f="";x.stderr?.on("data",g=>{f+=String(g)});let d=setTimeout(()=>{x.kill("SIGKILL"),a(new E("IPC_BAD_REQUEST",`tar extract timeout (${Is}ms)`))},Is);x.on("error",g=>{clearTimeout(d),a(new E("IPC_BAD_REQUEST",`tar spawn failed: ${g.message}`,{cause:g}))}),x.on("exit",g=>{clearTimeout(d),g===0?o():a(new E("IPC_BAD_REQUEST",`tar exit ${g}${f?`: ${f.trim().slice(0,200)}`:""}`))}),x.stdin?.end(r)})}async function Ms(r,e,o,a){if(a<=0)return[];let x;try{x=await xa(e,{withFileTypes:!0})}catch{return[]}let f=[];for(let d of x){if(ga.has(d.name))continue;let g=Te(e,d.name),p=ua(Te(o,d.name)),_=null;try{_=await Xt(g)}catch{continue}let w={name:d.name,path:Rs(Ls(r,g)),isDir:_.isDirectory(),size:_.size,modifiedAt:Math.floor(_.mtimeMs)};_.isDirectory()&&a>1&&(w.children=await Ms(r,g,p,a-1)),f.push(w)}return f.sort((d,g)=>d.isDir!==g.isDir?d.isDir?-1:1:d.name.localeCompare(g.name)),f}function Ca(r){return!r||r<=0?la:Math.min(r,ha)}function Ea(r){if(!r||r==="."||r==="/")return".";let e=r.split(/[/\\]/);return e[e.length-1]||"."}function Rs(r){return r.split(Ns).join("/")}F();var Ct=M("agent-health-reporter"),Aa=3e4,Yt=class{constructor(e){this.opts=e;this.intervalMs=e.intervalMs??Aa}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()}),Ct.info("heartbeat started",{intervalMs:this.intervalMs}),this.tick())}stop(){this.timer&&(clearInterval(this.timer),this.timer=null,this.unsubscribeRegister&&(this.unsubscribeRegister(),this.unsubscribeRegister=null),Ct.info("heartbeat stopped"))}async tick(){if(this.inFlight){Ct.debug("previous tick still in-flight, skip");return}let e=this.opts.getDeviceId();if(!e){Ct.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=ka(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){Ct.warn("heartbeat send failed",{agentId:a.agentId,status:x,err:String(d)})}}}finally{this.inFlight=!1}}};function ka(r){return r.status==="error"?"error":r.activeTriggers.size>0?"busy":r.status==="ok"||r.status==="degraded"?"online":null}Fe();import{mkdir as cr,rm as Ba}from"node:fs/promises";import{spawn as La}from"node:child_process";function xt(r,e,o){return o===void 0?{jsonrpc:"2.0",id:r,method:e}:{jsonrpc:"2.0",id:r,method:e,params:o}}function Os(r,e){return e===void 0?{jsonrpc:"2.0",method:r}:{jsonrpc:"2.0",method:r,params:e}}function ct(r,e){return{jsonrpc:"2.0",id:r,result:e}}function Xe(r,e){return{jsonrpc:"2.0",id:r,error:e}}var Qt=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 $t(r){return"method"in r&&"id"in r&&r.id!==void 0}function Bs(r){return"method"in r&&!("id"in r)}function Zt(r){return!("method"in r)&&"id"in r}var Da={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 en(r){return r instanceof E?{code:Da[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 zs(r){let e=r.data,o=e?.bridgeCode??"AGENT_PROTOCOL_ERROR";return new E(o,r.message,{retriable:e?.retriable??!1,cause:r.data})}function qs(r){return`${JSON.stringify(r)}
89
+ `}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(`
90
+ `);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 Us={"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"},Ku=Object.fromEntries(Object.entries(Us).map(([r,e])=>[e,r])),Pa={"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:[]},ft=class{seq=0;next(e,o){this.seq+=1;let a=Us[e]??Ia(e),x=Pa[a]??[],f=[a,String(this.seq)];if(x.length>0){let d=x.map(p=>Fs(o?.[p]??"")),g=Ta(d).join(":");g&&f.push(g)}else o&&Object.values(o).some(d=>d)&&f.push(Object.values(o).filter(Boolean).map(d=>Fs(String(d))).join(":"));return f.join("_")}reset(){this.seq=0}};function Ia(r){return r.replace(/[\s/]+/g,".").replace(/_+/g,"-")}function Fs(r){return r.replace(/[:_\s]+/g,"-")}function Ta(r){let e=r.length;for(;e>0&&!r[e-1];)e-=1;return r.slice(0,e)}F();var Na=3e4;function Hs(r,e){if(!(typeof r!="number"||r<=0))try{process.platform==="win32"?process.kill(r,e):process.kill(-r,e)}catch{}}var Ue=class{constructor(e){this.opts=e;this.log=M(`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 ft;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",o=La(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 E("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 E("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()));Hs(o.pid,"SIGTERM");let x=setTimeout(()=>{o.killed||Hs(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){if(!this.child||this.stopped)return;let o=this.idAllocator.next("session/cancel");this.writeFrame(xt(o,"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(ct(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(Xe(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=Na){if(!this.child||this.stopped)return Promise.reject(new E("AGENT_PROTOCOL_ERROR","downstream not started"));let x=this.idAllocator.next(e),f=xt(x,e,o),d=a>0&&Number.isFinite(a);return new Promise((g,p)=>{let _=d?setTimeout(()=>{this.pending.delete(x),p(new E("AGENT_TIMEOUT",`${e} timed out after ${a}ms`))},a):null;this.pending.set(x,{resolve:g,reject:p,timer:_,method:e});try{this.writeFrame(f)}catch(w){_&&clearTimeout(_),this.pending.delete(x),p(w)}})}writeFrame(e){if(!this.child?.stdin||this.child.stdin.destroyed)throw new E("AGENT_PROTOCOL_ERROR","downstream stdin not writable");this.child.stdin.write(qs(e))}dispatch(e){if(Zt(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(zs(e.error)):o.resolve(e.result);return}if(Bs(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($t(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(Xe(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(Xe(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 Ma="@zed-industries/claude-code-acp@latest";function Ra(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 Ue{framework="claude-code";constructor(e){let o=e.command??"npx",a=e.args??["-y",Ma],x={command:o,args:a,cwd:e.cwd,...e.env?{env:e.env}:{}};super(x)}sanitizeEnv(e){return Ra(e)}};var Oa="@zed-industries/codex-acp@latest",rn=class extends Ue{framework="codex";constructor(e){let o=e.command??"npx",a=e.args??["-y",Oa],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 Ks}from"node:child_process";F();var sn=class extends Ue{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=M("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=Ks(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 E("AGENT_SPAWN_FAILED",`openclaw agents add ${this.agentId} exited ${f}: ${x.trim()}`))})})}async cleanup(e){this.registered&&await new Promise(o=>{let a=Ks(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}};F();ce();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;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.deployType=e.deployType??"local",this._downstream=e.downstream,this.msgQueue=new on}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 W=M("agent-manager"),za=(r,e,o,a,x)=>{switch(r){case"claude-code":{let f=x?Es(x):void 0;return new nn({cwd:o,...f&&Object.keys(f).length>0?{env:f}:{}})}case"codex":{let f=x?As(x):[],d=x?ks(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 Gs(r){return r==="claude-code"||r==="codex"}var Js={path:"",version:"cloud-deployed"};function js(r,e){let o=r.frameworksCache?.[e.framework];if(o)return o;if(e.deployType==="cloud"&&Gs(e.framework))return Js}var qa=[0,5e3,5e3],Fa=2e4,Ws={protocolVersion:1,clientCapabilities:{fs:{readTextFile:!0,writeTextFile:!0}}},xn=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??za,this.restartDelaysMs=e.restartDelaysMs??qa,this.createTimeoutMs=e.createTimeoutMs??Fa,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");let o=St(e._meta)==="cloud";if(o&&e.framework==="openclaw")return W.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 E("AGENT_BUSY",`agent ${e.agentId} exists with different framework (${a.framework})`);if(a.status==="error")W.warn("existing agent in error state, rebuilding",{agentId:e.agentId}),await a.dispose("rebuild after error").catch(_=>W.warn("dispose stale agent failed (ignored)",{err:String(_)})),this.registry.unregister(e.agentId);else return W.info("agent already exists,return current",{agentId:e.agentId}),{ok:!0,agentId:a.agentId,workspace:a.workspace,pid:a.downstream.pid()??0,framework:a.framework}}let x=this.config.frameworksCache?.[e.framework];if(!x)if(o&&Gs(e.framework))x=Js;else throw new E("AGENT_SPAWN_FAILED",`framework ${e.framework} not detected on this machine; rerun daemon to refresh frameworks_cache`);let f=Ie(e.agentId,this.paths),d=e.workspace??f.workspace,g=new AbortController,p=setTimeout(()=>g.abort(new E("AGENT_TIMEOUT",`_agent/create timed out after ${this.createTimeoutMs}ms`)),this.createTimeoutMs);try{return await this.createAgentInner(e,f,d,x,g.signal)}finally{clearTimeout(p)}}async createAgentInner(e,o,a,x,f){let d=()=>{if(f.aborted)throw f.reason instanceof Error?f.reason:new E("AGENT_TIMEOUT","_agent/create aborted")},g,p,_=!1;try{await cr(o.root,{recursive:!0}),await cr(a,{recursive:!0}),await cr(o.logs,{recursive:!0}),d(),e.framework!=="openclaw"&&await Ge(a,e.framework,e.agentId,e.cozeIdentity),d();let w=await ae(e.agentId,this.paths).catch(()=>null),y=xr({model:e.model??w?.model,modelToken:e.modelToken??w?.modelToken});g=this.factory(e.framework,x.path,a,e.agentId,y),await g.start(),d(),await g.initialize(Ws),d(),e.framework==="openclaw"&&await Ge(a,"openclaw",e.agentId,e.cozeIdentity);let A=St(e._meta);if(p=new an({agentId:e.agentId,framework:e.framework,workspace:a,downstream:g,deployType:A}),p.status="ok",w?.sessions){for(let[R,K]of Object.entries(w.sessions))p.sessions.set(R,K);Object.keys(w.sessions).length>0&&W.info("restored persisted sessions for agent",{agentId:e.agentId,count:Object.keys(w.sessions).length})}this.registry.register(p),_=!0;let T={agentId:e.agentId,framework:e.framework,workspace:a,cozeIdentity:e.cozeIdentity,createdAt:w?.createdAt??Date.now(),sessions:w?.sessions??{},model:y.model};y.modelToken&&(T.modelToken=y.modelToken),A==="cloud"&&(T.deployType="cloud"),w?.skills&&(T.skills=w.skills),w?.agentName&&(T.agentName=w.agentName),w?.description&&(T.description=w.description),await de(T,this.paths);let N=g.pid()??0;return W.info("agent created",{agentId:e.agentId,framework:e.framework,pid:N}),this.installRestartHook(p),{ok:!0,agentId:e.agentId,workspace:a,pid:N,framework:e.framework}}catch(w){throw W.error("agent create failed,rolling back",{agentId:e.agentId,err:String(w)}),g?.cleanup&&await g.cleanup("rollback").catch(y=>W.warn("downstream cleanup failed (ignored)",{err:String(y)})),g&&await g.stop("rollback").catch(()=>{}),_&&p&&(await p.dispose("rollback").catch(()=>{}),this.registry.unregister(e.agentId)),await Ba(o.root,{recursive:!0,force:!0}).catch(y=>W.warn("rm agent dir failed (ignored)",{err:String(y)})),w instanceof E?w:new E("AGENT_SPAWN_FAILED",String(w),{cause:w})}}async reportHealth(e,o,a){if(!this.healthReporter){W.info("healthReporter not wired, skip _agent/health upstream",{agentId:e.agentId,status:o});return}try{await this.healthReporter({status:o,_meta:{cozeAgentId:e.agentId}}),W.info("_agent/health reported",{agentId:e.agentId,status:o,cause:a})}catch(x){W.warn("_agent/health upstream failed (ignored)",{agentId:e.agentId,status:o,err:String(x)})}}installRestartHook(e){let o=0,a=x=>{if(e.status==="stopped"||e.status==="disconnected"||e.status==="switching")return;if(o>=this.restartDelaysMs.length){W.error("agent restart exhausted",{agentId:e.agentId,attempts:o,...x}),e.status="error",this.reportHealth(e,"error",x);return}let f=this.restartDelaysMs[o]??5e3;o+=1,e.status="degraded",W.warn("agent restart scheduled",{agentId:e.agentId,attempt:o,delayMs:f,...x}),setTimeout(()=>{this.doRestart(e,o).then(d=>{d?(o=0,e.status="ok"):a(null)})},f)};e.downstream.onExit((x,f)=>a({code:x,signal:f}))}async spawnAndInitialize(e,o){let a=await ae(e.agentId,this.paths).catch(()=>null),x=a?xr(a):void 0,f=this.factory(e.framework,o,e.workspace,e.agentId,x);try{return await f.start(),await f.initialize(Ws),f}catch(d){throw await f.stop("spawnAndInitialize failed").catch(()=>{}),d}}rewireSession(e,o){e.swap(o),this.registry.attachHooks?.(e),this.installRestartHook(e)}async doRestart(e,o){let a=js(this.config,e);if(!a)return W.error("framework cache missing during restart",{agentId:e.agentId,framework:e.framework}),e.status="error",!1;W.info("agent restart attempt",{agentId:e.agentId,attempt:o});try{let x=await this.spawnAndInitialize(e,a.path);return this.rewireSession(e,x),W.info("agent restart succeeded",{agentId:e.agentId,attempt:o}),!0}catch(x){return W.warn("agent restart attempt failed",{agentId:e.agentId,attempt:o,err:String(x)}),!1}}async executeModelSwitch(e){let o=this.registry.get(e);if(!o)throw new E("AGENT_NOT_FOUND",`agent not found: ${e}`);let a=js(this.config,o);if(!a)throw new E("AGENT_SPAWN_FAILED",`framework ${o.framework} not detected; cannot respawn for switchModel`);W.info("executeModelSwitch: stopping old downstream",{agentId:e,framework:o.framework}),await o.downstream.stop("switchModel").catch(d=>{W.warn("stop old downstream failed (ignored, continuing)",{agentId:e,err:String(d)})});let x;try{x=await this.spawnAndInitialize(o,a.path)}catch(d){throw new E("MODEL_SWITCH_FAILED",`failed to spawn new downstream after switchModel: ${d instanceof Error?d.message:String(d)}`,{cause:d})}this.rewireSession(o,x);let f=[...o.sessions.entries()];for(let[d,g]of f)try{await x.sessionLoad({sessionId:g,cwd:o.workspace}),o.verifiedSessions.add(g)}catch(p){throw new E("MODEL_SWITCH_FAILED",`sessionLoad failed after switchModel for cloud session ${d} (acp=${g}): ${p instanceof Error?p.message:String(p)}`,{cause:p})}f.length>0&&W.info("executeModelSwitch: session/load reloaded",{agentId:e,count:f.length}),o.status="ok",W.info("executeModelSwitch: success",{agentId:e,framework:o.framework})}};F();import{spawn as Ua}from"node:child_process";import{constants as Xs,access as Ha}from"node:fs/promises";import{delimiter as Ka,join as ja}from"node:path";var Wa=M("framework-detector"),Vs={"claude-code":"claude",codex:"codex",openclaw:"openclaw"},Ga=[".exe",".cmd",".bat",".ps1"],Et=class{env;constructor(e={}){this.env={pathEnv:e.pathEnv??process.env.PATH??"",platform:e.platform??process.platform,spawn:e.spawn??Ua,access:e.access??Ha}}async detect(e){let o=Vs[e],a=await this.which(o);if(!a)return Wa.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(Vs).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(Ka).filter(Boolean),a=this.env.platform==="win32"?["",...Ga]:[""];for(let x of o)for(let f of a){let d=ja(x,e+f);if(await this.isExecutable(d))return d}return null}async isExecutable(e){try{let o=this.env.platform==="win32"?Xs.F_OK:Xs.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=g=>{x||(x=!0,f&&clearTimeout(f),o(g.trim()||"unknown"))};try{let g=this.env.spawn(e,["--version"],{stdio:["ignore","pipe","pipe"]});f=setTimeout(()=>{g.kill("SIGKILL"),d("unknown")},5e3),g.stdout?.on("data",p=>{a+=p.toString("utf8")}),g.on("error",()=>d("unknown")),g.on("close",()=>{let p=Xa(a).split(/\r?\n/)[0]??"";d(p)})}catch{d("unknown")}})}},Ja=new RegExp("\x1B\\[[0-9;]*[A-Za-z]","g");function Xa(r){return r.replace(Ja,"")}ir();ce();function cn(r){return qt(r??U().configFile)}function At(r,e){return Ft(e??U().configFile,r)}Fe();F();var $=M("core"),Va=5*6e4,Ya=3e4,fn=class{upstream;agents=new Map;disconnectedAgents=new Set;extensions;paths;upstreamIds=new ft;pendingUpstream=new Map;pendingBridge=new Map;constructor(e){this.upstream=e.upstream,this.extensions=e.extensions??{},this.paths=e.paths}registerExtension(e,o){this.extensions[e]=o}async start(){this.upstream.onFrame(e=>this.handleFrame(e)),await this.upstream.start(),$.info("Core started",{extensions:Object.keys(this.extensions)})}async stop(e){$.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),this.attachDownstreamHooks(e),$.info("agent registered",{agentId:e.agentId,framework:e.framework});for(let o of this.registerHandlers)try{o(e.agentId)}catch(a){$.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)&&$.info("agent revived from disconnect",{agentId:e})}attachDownstreamHooks(e){e.downstream.onUpdate(o=>{this.forwardUpdate(e,o)}),e.downstream.onAgentRequest(o=>{this.handleAgentRequest(e,o)}),e.downstream.onExit((o,a)=>{$.warn("agent downstream exited",{agentId:e.agentId,code:o,signal:a})})}attachHooks(e){this.attachDownstreamHooks(e)}async handleFrame(e){if(Zt(e)){this.handleUpstreamResponse(e);return}if($t(e))try{if(e.method.startsWith("_agent/")){let o=this.extensions[e.method];if(!o){await this.sendError(e.id,H.METHOD_NOT_FOUND,`extension not registered: ${e.method}`);return}let a=await o(e,this);await this.upstream.send(ct(e.id,a));return}if(e.method.startsWith("session/")){let o=await this.routeSessionMethod(e);await this.upstream.send(ct(e.id,o));return}if(e.method==="initialize"){await this.upstream.send(ct(e.id,{protocolVersion:1,agentCapabilities:{loadSession:!0}}));return}await this.sendError(e.id,H.METHOD_NOT_FOUND,`method not implemented: ${e.method}`)}catch(o){$.error("handleFrame failed",{method:e.method,err:String(o)}),await this.upstream.send(Xe(e.id,en(o)))}}async routeSessionMethod(e){if(!e.params||typeof e.params!="object")throw new E("IPC_BAD_REQUEST",`${e.method} requires params`);let o=e.params,a=o._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(),d=!1;try{let g=await x.msgQueue.enqueue(()=>this.dispatchSessionCall(x,e.method,o));return d=!0,g}finally{$.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}=vs(a);switch(o){case"session/new":{let f=x;return await e.downstream.sessionNew({...f,cwd:f.cwd||e.workspace})}case"session/load":{let f=x,d=f.sessionId,g=e.sessions.get(d);try{let p=g??d,_=await e.downstream.sessionLoad({...f,sessionId:p,cwd:f.cwd||e.workspace});return g||e.sessions.set(d,p),_}catch(p){$.warn("session/load failed,fallback to session/new",{agentId:e.agentId,cloudId:d,err:String(p)});let _=await e.downstream.sessionNew({cwd:f.cwd||e.workspace});return e.sessions.set(d,_.sessionId),{}}}case"session/prompt":{let f=x,d=f.sessionId,g=e.sessions.get(d),p=!1;if(g&&!e.verifiedSessions.has(g))try{await e.downstream.sessionLoad({sessionId:g,cwd:e.workspace}),e.verifiedSessions.add(g),$.info("session restored via session/load",{agentId:e.agentId,cloudId:d,acpId:g})}catch(y){$.warn("session/load failed,fallback to session/new",{agentId:e.agentId,cloudId:d,acpId:g,err:String(y)}),e.sessions.delete(d),g=void 0}g||(g=(await e.downstream.sessionNew({cwd:e.workspace})).sessionId,e.sessions.set(d,g),e.verifiedSessions.add(g),p=!0);let _=a._meta?.cozeTriggerMsgId;_?e.activeTriggers.set(g,_):e.activeTriggers.delete(g);let w=await e.downstream.sessionPrompt({...f,sessionId:g});return p&&this.persistSessionMapping(e),w}case"session/cancel":{let d=x.sessionId;if(!d)throw new E("IPC_BAD_REQUEST","session/cancel: missing sessionId");let g=e.sessions.get(d);return g&&await e.downstream.sessionCancel({sessionId:g}),{ok:!0}}default:throw new E("IPC_BAD_REQUEST",`session method not supported: ${o}`)}}forwardUpdate(e,o){let a=o.sessionId,x=this.reverseSessionId(e,a);if(!x){$.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(Os("session/update",{...o,sessionId:x,_meta:f})).catch(g=>$.warn("forward update failed",{agentId:e.agentId,err:String(g)}))}handleAgentRequest(e,o){if(o.method==="session/request_permission"){this.forwardPermissionRequest(e,o);return}$.warn("unhandled agent request,returning method_not_found",{agentId:e.agentId,method:o.method}),e.downstream.respondAgentRequestError(o.id,{code:H.METHOD_NOT_FOUND,message:`method not handled by Bridge: ${o.method}`})}forwardPermissionRequest(e,o){let a=this.upstreamIds.next("session/request_permission"),x=o.params??{},d=x.sessionId,g=d?e.activeTriggers.get(d):void 0,p={cozeAgentId:e.agentId};g&&(p.cozeTriggerMsgId=g);let _=d?this.reverseSessionId(e,d):void 0,w={...x,..._?{sessionId:_}:{},_meta:p},y=setTimeout(()=>{let A=this.pendingUpstream.get(a);A&&(this.pendingUpstream.delete(a),$.warn("upstream permission request timed out,replying cancelled to agent",{agentId:e.agentId,upstreamId:a}),e.downstream.respondAgentRequest(A.agentRequestId,{outcome:{kind:"cancelled"}}))},Va);this.pendingUpstream.set(a,{agentRequestId:o.id,session:e,method:o.method,timer:y}),this.upstream.send(xt(a,"session/request_permission",w)).catch(A=>{let T=this.pendingUpstream.get(a);T&&(clearTimeout(T.timer),this.pendingUpstream.delete(a)),$.error("forward permission request failed",{agentId:e.agentId,err:String(A)}),e.downstream.respondAgentRequestError(o.id,{code:H.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),clearTimeout(o.timer),e.error?o.session.downstream.respondAgentRequestError(o.agentRequestId,e.error):o.session.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 Qt(e.error)):a.resolve(e.result);return}$.debug("orphan upstream response (no pending)",{id:e.id})}sendRequest(e,o,a=Ya){let x=this.upstreamIds.next(e);return new Promise((f,d)=>{let g=setTimeout(()=>{this.pendingBridge.delete(x),d(new E("AGENT_TIMEOUT",`${e} timed out after ${a}ms`))},a);this.pendingBridge.set(x,{method:e,resolve:f,reject:d,timer:g}),this.upstream.send(xt(x,e,o)).catch(p=>{let _=this.pendingBridge.get(x);_&&(clearTimeout(_.timer),this.pendingBridge.delete(x)),d(p)})})}async persistSessionMapping(e){if(this.paths)try{await ar(e.agentId,e.sessions,this.paths)}catch(o){$.warn("persist session mapping failed",{agentId:e.agentId,err:String(o)})}}reverseSessionId(e,o){for(let[a,x]of e.sessions.entries())if(x===o)return a}sendError(e,o,a){return this.upstream.send(Xe(e,{code:o,message:a}))}};F();ce();import{randomBytes as Qa}from"node:crypto";import{chmod as $a,mkdir as Za,writeFile as Ys}from"node:fs/promises";import{createServer as ex}from"node:http";import{dirname as tx}from"node:path";var nx=1e6,fr=M("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??U()}async start(){this.token=Qa(32).toString("hex");let e=ex((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 Za(tx(this.paths.portFile),{recursive:!0}),await Ys(this.paths.portFile,String(this.port),"utf8"),await Ys(this.paths.tokenFile,this.token,"utf8");try{await $a(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}`){kt(o,401,{error:"unauthorized"});return}let x=`${e.method} ${(e.url??"").split("?")[0]}`,f=this.routes.get(x);if(!f){kt(o,404,{error:"not found"});return}let d=null;if(e.method==="POST")try{d=await rx(e)}catch(g){kt(o,400,{error:"invalid json",detail:String(g)});return}try{let g=await f.handler(d,e);kt(o,200,g??{ok:!0})}catch(g){fr.error("IPC handler failed",{key:x,err:String(g)}),kt(o,500,{error:g instanceof Error?g.message:String(g)})}}};function kt(r,e,o){r.statusCode=e,r.setHeader("content-type","application/json"),r.end(JSON.stringify(o))}async function rx(r){let e=[],o=0;for await(let x of r){let f=x;if(o+=f.length,o>nx)throw new Error("body too large");e.push(f)}let a=Buffer.concat(e).toString("utf8");return a?JSON.parse(a):null}var So=Pe(ai(),1);var zc=Pe(no(),1),qc=Pe(kn(),1),Fc=Pe(lt(),1),Uc=Pe(Sr(),1),Hc=Pe(Ar(),1),Kc=Pe(Lr(),1),uo=Pe(Tn(),1),jc=Pe(fo(),1);var lo=uo.default;F();var Nn="1008033",ho="1289";var go="pbbp2",po="https://www.coze.cn",mo="/api/coze_claw/resource/get_frontier_key",Wc="https://www.coze.cn",Gc="wss://frontier.coze.cn";function _o(r){return r??process.env.COZE_BRIDGE_HANDSHAKE_URL??Wc}function wo(r){return r??process.env.COZE_BRIDGE_FRONTIER_URL??Gc}function Mn(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 se=M("upstream.frontier"),bo="application/json",vo="none",Rn=class{constructor(e){this.opts=e}opts;fws=null;handler=null;connectHandler=null;opened=!1;openCount=0;async start(){if(this.fws){se.warn("start called on already-started FrontierUpstream; noop");return}let e={Authorization:`Bearer ${this.opts.privatecode}`,Origin:po,...Mn(this.opts.ppeOverride)};class o extends lo{constructor(g){super(g,go,{headers:e})}send(g,...p){if(ys("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 w=Buffer.from(_.slice(0,128)).toString("hex");se.debug("WS raw frame out",{bytes:_.byteLength,headHex:w})}catch(_){se.warn("WS raw frame dump failed",{err:String(_)})}super.send(g,...p)}}let a=wo(this.opts.urlOverride),x={url:a,ws:o,fpID:ho,aID:Nn,accessKey:this.opts.handshake.accessKey,deviceID:this.opts.handshake.deviceId,payloadType:{type:bo,force:!0},payloadEncoding:{encoding:vo,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 d=this.openCount===1;se.info("frontier opened",{url:a,remoteDeviceId:this.opts.handshake.deviceId,initial:d,openCount:this.openCount}),this.connectHandler&&Promise.resolve(this.connectHandler({initial:d})).catch(g=>se.warn("onConnect handler threw (ignored)",{err:String(g)}))},f.onclose=d=>{this.opened=!1,se.info("frontier closed",{code:d.code,reason:d.reason,willReconnect:d.willReconnect})},f.onerror=d=>{se.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){se.warn("frontier close threw (ignored)",{err:String(a)})}}}async send(e){let o=this.fws;if(!o)throw new E("UPSTREAM_DISCONNECTED","frontier upstream not started");let a=JSON.stringify(e),x=e;se.info("frontier frame out",{method:x.method,jsonrpcId:x.id,size:a.length});try{await o.send(a,{service:33555712,method:1,payloadType:bo,payloadEncoding:vo})}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 o=e.message?.service;if(o!==33555712){se.debug("drop non-adapter frontier frame",{service:o});return}let a=Vc(e);if(!a){se.debug("frontier message without text payload, drop",{payloadType:e.message?.payloadType});return}if(!this.handler){se.debug("frame received but no onFrame handler",{size:a.length});return}let x;try{x=JSON.parse(a)}catch(f){se.warn("frontier message JSON parse failed",{err:String(f),head:a.slice(0,80)});return}se.info("frontier frame in",{logid:Xc(e.message?.LogID),logidNew:e.message?.LogIDNew,msgId:e.message?.msgID,jsonrpcId:x.id}),Promise.resolve(this.handler(x)).catch(f=>se.warn("frontier frame handler threw",{err:String(f)}))}};function Xc(r){return r?r.high===0?String(r.low>>>0):`${r.high.toString(16)}${(r.low>>>0).toString(16).padStart(8,"0")}`:""}function Vc(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}}F();function Eo(r){return r?r.startsWith("boe_")?{ttEnv:r}:{ttEnv:r,usePpe:"1"}:{}}var Co=M("handshake");async function Ao(r){let e=_o(r.endpoint),o=r.timeoutMs??1e4,a=`${Yc(e)}${mo}?aid=${encodeURIComponent(Nn)}`,x={Authorization:`Bearer ${r.privatecode}`,Accept:"application/json",...Mn(r.ppeOverride)},f=new AbortController,d=setTimeout(()=>f.abort(),o);Co.info("frontier key handshake",{base:e});try{let g=await fetch(a,{method:"GET",headers:x,signal:f.signal}),p=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=${p}: ${T.slice(0,200)}`)}let w=await g.json();if(w.code!==void 0&&w.code!==0)throw new E("UPSTREAM_HANDSHAKE_FAILED",`handshake code=${w.code} msg=${w.msg??"-"} logid=${p}`);let y=w.data?.access_key,A=w.data?.device_id;if(!y||!A)throw new E("UPSTREAM_HANDSHAKE_FAILED",`handshake response missing access_key/device_id logid=${p}: ${JSON.stringify(w)}`);return Co.info("handshake ok",{remoteDeviceId:A,logid:p,traceId:_}),{accessKey:y,deviceId:A}}catch(g){throw g instanceof E?g:g.name==="AbortError"?new E("UPSTREAM_HANDSHAKE_FAILED",`handshake timeout (${o}ms)`):new E("UPSTREAM_HANDSHAKE_FAILED",String(g),{cause:g})}finally{clearTimeout(d)}}function Yc(r){return r.endsWith("/")?r.slice(0,-1):r}F();var Mr=M("upstream.switchable"),On=class{inner;handler=null;connectHandler=null;constructor(e){this.inner=e}async swap(e,o){if(this.inner===e)return;Mr.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 Mr.error("swap target start failed, reverting",{err:String(x)}),this.inner=a,x}await a.stop(o??"swapped").catch(x=>Mr.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()}};F();var Rr=M("upstream"),Ot=class{handler=null;async start(){Rr.info("NoopUpstream started (M1 skeleton; real Frontier wired in M4)")}async stop(e){Rr.info("NoopUpstream stopped",{reason:e})}async send(e){Rr.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)}};F();ce();F();ce();import{readFileSync as Qc,unlinkSync as $c}from"node:fs";import{mkdir as Zc,readFile as ko,unlink as Do,writeFile as ef}from"node:fs/promises";import{dirname as tf}from"node:path";var nf=M("single-instance"),Bn=class{pidFile;acquired=!1;constructor(e={}){this.pidFile=e.pidFile??U().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&&(nf.warn("removing stale pid file",{stalePid:e}),await Do(this.pidFile).catch(()=>{})),await Zc(tf(this.pidFile),{recursive:!0}),await ef(this.pidFile,String(process.pid),"utf8"),this.acquired=!0,this.installCleanupHooks(),{kind:"acquired"})}async release(){if(this.acquired){try{(await ko(this.pidFile,"utf8")).trim()===String(process.pid)&&await Do(this.pidFile)}catch{}this.acquired=!1}}async readExistingPid(){try{let e=await ko(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{return process.kill(e,0),!0}catch(o){return o.code==="EPERM"}}installCleanupHooks(){process.once("exit",()=>{if(this.acquired)try{Qc(this.pidFile,"utf8").trim()===String(process.pid)&&$c(this.pidFile)}catch{}})}};var B=M("daemon"),rf="coze-bridge-daemon";async function To(){let r=new Bn({processTitle:rf}),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}),B.info(o?"loaded bridge config":"initialized bridge config");try{let D=new Et;a.frameworksCache=await D.detectAll(),B.info("refreshed frameworks_cache",{detected:Object.keys(a.frameworksCache)})}catch(D){B.warn("framework detection failed",{err:String(D)})}await At(a);let x=new On(new Ot),f=U(),d=new fn({upstream:x,paths:f});await of(f,d);let g=new xn({paths:f,config:a,registry:d,healthReporter:async D=>{await d.sendRequest("_agent/health",D)}}),p,_,w=null,y=null;d.registerExtension("_agent/create",async D=>g.createAgent(D.params)),d.registerExtension("_agent/health",async()=>({ok:!0}));let A=new Vt({agents:d.agents,disposeAndMarkDisconnected:async(D,z)=>{let G=d.agents.get(D);G&&(await G.dispose(`disconnect: ${z}`).catch(Ae=>B.warn("dispose during disconnect failed (ignored)",{agentId:D,err:String(Ae)})),G.status="disconnected",d.unregister(D)),d.disconnectedAgents.add(D)},executeModelSwitch:D=>g.executeModelSwitch(D)});d.registerExtension("_agent/listSkills",D=>A.listSkills(D.params)),d.registerExtension("_agent/addSkills",D=>A.addSkills(D.params)),d.registerExtension("_agent/removeSkills",D=>A.removeSkills(D.params)),d.registerExtension("_agent/getFileTree",D=>A.getFileTree(D.params)),d.registerExtension("_agent/getFileContent",D=>A.getFileContent(D.params)),d.registerExtension("_agent/update",D=>A.updateAgent(D.params)),d.registerExtension("_agent/disconnect",D=>A.disconnectAgent(D.params)),d.registerExtension("_agent/switchModel",D=>A.switchModel(D.params));let T=new Gt({paths:f,handlers:A,sendDetail:D=>d.sendRequest("_agent/detail",D)});x.onConnect(({initial:D})=>{B.info("frontier upstream connected, triggering detail sync",{initial:D}),T.syncAll(D?"initial-connect":"reconnect").catch(z=>B.warn("detail sync top-level error (ignored)",{err:String(z)}))});let N=new un({paths:f,routes:[{method:"GET",path:"/status",handler:async()=>({running:!0,pid:process.pid,agents:[...d.agents.keys()],deviceId:w??"",frameworksCache:a.frameworksCache??{}})},{method:"POST",path:"/pair",handler:async D=>{let z=D,G=z?.privatecode,Ae=z?.pairing_code;if(!G||!Ae)throw new E("IPC_BAD_REQUEST","/pair requires privatecode + pairing_code");let Oe=Eo(z.env),we=z.handshake_url,ye=z.frontier_url,ge=sf(z.env,we,ye),et=!!p&&p!==G,Bt=_!==void 0&&_!==ge,zt=et||Bt;if(zt){B.warn("pair config switched, resetting agents",{pcChanged:et,envChanged:Bt,previousPc:p?Po(p):"",nextPc:Po(G),previousEnvKey:_??"",nextEnvKey:ge});for(let J of[...d.agents.values()])await J.dispose("pair config switch").catch(()=>{}),d.agents.delete(J.agentId);await x.swap(new Ot,"pair switch").catch(()=>{})}let be=await Ao({privatecode:G,...we?{endpoint:we}:{},ppeOverride:Oe});w=be.deviceId,or({deviceId:w,pid:process.pid});let ke=new Rn({handshake:be,privatecode:G,...ye?{urlOverride:ye}:{},ppeOverride:Oe});await x.swap(ke,"pair"),p=G,_=ge;let Wn=Object.keys(a.frameworksCache??{});try{let J=await d.sendRequest("_agent/pair",{pairCode:Ae,patToken:G,frameworks:Wn,_meta:{cozeDeviceId:w}});B.info("_agent/pair ok",{pairResult:J}),y||(y=new Yt({core:d,getDeviceId:()=>w??""})),y.start(),zt&&Io(f,g).catch(j=>B.warn("post-pair-switch auto-revive error (ignored)",{err:String(j)}));let nt;return z.agent_id&&(nt=await af(z.agent_id,f,g,j=>d.sendRequest("_agent/detail",j)).catch(j=>(B.error("--agent-id ensureAgent failed",{agentId:z.agent_id,err:String(j)}),{ok:!1,agentId:z.agent_id??"",note:String(j)}))),{ok:!0,note:"paired with cloud",...nt?{agent:nt}:{}}}catch(J){return B.error("_agent/pair failed",{err:String(J)}),{ok:!1,note:`pair failed: ${String(J)}`}}}},{method:"POST",path:"/_agent/create",handler:async D=>{let z=D;return{ok:!0,result:await g.createAgent(z)}}},{method:"POST",path:"/refresh",handler:async()=>{B.info("IPC /refresh: re-detecting frameworks");let D=new Et;return a.frameworksCache=await D.detectAll(),await At(a),{ok:!0,frameworks:a.frameworksCache}}},{method:"POST",path:"/shutdown",handler:async()=>(B.info("IPC /shutdown received"),setImmediate(()=>{xe.shutdown("ipc /shutdown")}),{ok:!0})}]}),{port:R,token:K}=await N.start();await d.start(),Io(f,g).catch(D=>B.warn("auto-revive top-level error (ignored)",{err:String(D)}));let ie=null,xe={port:R,token:K,core:d,ipc:N,shutdown(D){return ie||(B.info("daemon shutdown",{reason:D}),ie=(async()=>{y?.stop(),await d.stop(D),await N.stop(),await r.release()})(),ie)}};for(let D of["SIGTERM","SIGINT"])process.on(D,()=>{xe.shutdown(D).then(()=>process.exit(0))});return B.info("daemon ready",{port:R,pid:process.pid,nodeVersion:process.version,platform:process.platform,frameworks:Object.keys(a.frameworksCache??{}),libVersion:a.libVersion??"dev"}),xe}function Po(r){return r.length<=8?"***":`${r.slice(0,4)}***${r.slice(-4)}`}function sf(r,e,o){return`${r??""}|${e??""}|${o??""}`}async function of(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(()=>(Fe(),Wt));for(let d of a){await f(d,r).catch(g=>B.warn("enforceAgentConfigMode failed (ignored)",{agentId:d,err:String(g)}));try{let g=await x(d,r);g?.disconnectedAt&&(e.disconnectedAgents.add(d),B.info("agent marked disconnected on startup",{agentId:d,disconnectedAt:g.disconnectedAt,reason:g.disconnectReason??""}))}catch(g){B.warn("failed to load agent config on startup, skipping",{agentId:d,err:String(g)})}}}async function af(r,e,o,a){let{loadAgentConfig:x}=await Promise.resolve().then(()=>(Fe(),Wt)),f=await x(r,e);if(f){B.info("--agent-id: local config found, reconnecting",{agentId:r,framework:f.framework,hadDisconnect:!!f.disconnectedAt});let _={agentId:f.agentId,framework:f.framework,...f.cozeIdentity?{cozeIdentity:f.cozeIdentity}:{},...f.model?{model:f.model}:{},...f.modelToken?{modelToken:f.modelToken}:{}};return await o.createAgent(_),{ok:!0,agentId:r,note:f.disconnectedAt?"revived from local config":"connected from local config"}}B.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 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:d.agentId,framework:d.framework,...d.cozeIdentity?{cozeIdentity:d.cozeIdentity}:{},...d.model?{model:d.model}:{},...d.modelToken?{modelToken:d.modelToken}:{},...d.deployType?{_meta:{cozeDeployType:d.deployType}}:{}};await o.createAgent(g);let p=d.deployType==="cloud"&&d.framework==="openclaw";return{ok:!0,agentId:r,note:p?"cloud agent acknowledged":"created from cloud detail"}}async function Io(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(()=>(Fe(),Wt));B.info("auto-revive: scanning local agents on startup",{count:a.length});let f=0,d=0;for(let g of a){let p;try{p=await x(g,r)}catch(_){B.warn("auto-revive: load config failed (skipping)",{agentId:g,err:String(_)}),d+=1;continue}if(!p){d+=1;continue}if(p.disconnectedAt){B.info("auto-revive: skip disconnected agent",{agentId:g,disconnectedAt:p.disconnectedAt}),d+=1;continue}try{B.info("auto-revive: spawning",{agentId:g,framework:p.framework}),await e.createAgent({agentId:p.agentId,framework:p.framework,...p.cozeIdentity?{cozeIdentity:p.cozeIdentity}:{},...p.model?{model:p.model}:{},...p.modelToken?{modelToken:p.modelToken}:{},...p.deployType?{_meta:{cozeDeployType:p.deployType}}:{}}),f+=1}catch(_){B.warn("auto-revive: createAgent failed (skipping)",{agentId:g,framework:p.framework,err:String(_)}),d+=1}}return B.info("auto-revive: done",{revived:f,skipped:d,total:a.length}),{revived:f,skipped:d,total:a.length}}Br();ce();import{readFile as No}from"node:fs/promises";var je=class{paths;constructor(e){this.paths=e??U()}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:pf(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([No(this.paths.portFile,"utf8"),No(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 g=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}),p=await g.text();return{status:g.status,body:gf(p)}}finally{clearTimeout(d)}}};function gf(r){if(!r)return null;try{return JSON.parse(r)}catch{return r}}function pf(r){return r instanceof Error?r.message:String(r)}F();ce();import{copyFile as Mo,mkdir as mf,readFile as zr,writeFile as _f}from"node:fs/promises";import{dirname as wf,resolve as qr,sep as zn}from"node:path";import{fileURLToPath as yf}from"node:url";F();ce();var Ro=M("dist-install");function bf(r){let e=yf(r),o=wf(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 Oo(r={}){let e=r.paths??U(),o=bf(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 Ro.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)??{},g=d.libVersion;if(g===f)try{return await zr(e.libEntry),{kind:"already-current",libVersion:f}}catch{}await mf(e.libDir,{recursive:!0}),await Mo(a,e.libEntry),await Mo(`${a}.map`,`${e.libEntry}.map`).catch(()=>{});let p=qr(e.libDir,"package.json"),_=`${JSON.stringify({type:"module"},null,2)}
91
+ `;return await zr(p,"utf8").catch(()=>null)!==_&&await _f(p,_),d.libVersion=f,await At(d,e.configFile),Ro.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 Ff=M("cli");function wt(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 Uf(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}=wt(o,"--pat-token");o=x;let{value:f,rest:d}=wt(o,"--pair-code");o=d;let{value:g,rest:p}=wt(o,"--env");o=p;let{value:_,rest:w}=wt(o,"--handshake-url");o=w;let{value:y,rest:A}=wt(o,"--frontier-url");o=A;let{value:T}=wt(o,"--agent-id");if(!a||!f)return{mode:"help"};let N={mode:"pair",privatecode:a,pairingCode:f};return g&&(N.env=g),_&&(N.handshakeUrl=_),y&&(N.frontierUrl=y),T&&(N.agentId=T),N}var Hf=`
92
92
  coze-bridge - local bridge daemon for cloud Agent Service
93
93
 
94
94
  Usage:
@@ -115,34 +115,35 @@ Auto-connect agent (optional):
115
115
 
116
116
  Internal:
117
117
  <node> <entry> --daemon daemon mode (OS supervisor only)
118
- `.trimStart();async function Ko(r=process.argv,e={}){let i=zf(r);switch(i.mode){case"help":return process.stdout.write(qf),0;case"daemon":{try{await Io()}catch(a){return Mf.error("daemon start failed",{err:String(a)}),1}return new Promise(()=>{})}case"status":return Ff(e);case"stop":return Uf(e);case"refresh":return Kf(e);case"uninstall":return Hf(e);case"install-service":return Wf();case"pair":{let a={};return i.env&&(a.env=i.env),i.handshakeUrl&&(a.handshakeUrl=i.handshakeUrl),i.frontierUrl&&(a.frontierUrl=i.frontierUrl),jf(i.privatecode,i.pairingCode,e,a,i.agentId)}}}async function Ff(r){let e=new Ge(r.paths),i=await e.probe();if(i.kind==="not-running")return process.stdout.write(`coze-bridge: not running
119
- `),1;if(i.kind==="stale")return process.stdout.write(`coze-bridge: stale (${i.reason})
120
- `),1;let a=await e.request({method:"GET",path:"/status"});return process.stdout.write(`coze-bridge: running
121
- ${JSON.stringify(a.body,null,2)}
122
- `),0}async function Uf(r){let e=new Ge(r.paths);if((await e.probe()).kind==="not-running")return process.stdout.write(`coze-bridge: not running
123
- `),0;try{return await e.request({method:"POST",path:"/shutdown"}),process.stdout.write(`coze-bridge: stopped
124
- `),0}catch(a){return process.stdout.write(`coze-bridge: stop failed: ${String(a)}
125
- `),1}}async function Kf(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)
118
+ `.trimStart();async function Ho(r=process.argv,e={}){let o=Uf(r);switch(o.mode){case"help":return process.stdout.write(Hf),0;case"daemon":{try{await To()}catch(a){return Ff.error("daemon start failed",{err:String(a)}),1}return new Promise(()=>{})}case"status":return Kf(e);case"stop":return jf(e);case"refresh":return Wf(e);case"uninstall":return Gf(e);case"install-service":return Jf();case"pair":{let a={};return o.env&&(a.env=o.env),o.handshakeUrl&&(a.handshakeUrl=o.handshakeUrl),o.frontierUrl&&(a.frontierUrl=o.frontierUrl),Xf(o.privatecode,o.pairingCode,e,a,o.agentId)}}}async function Ko(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 Kf(r){let e=r.paths??U(),o=new je(e),a=await o.probe();if(a.kind==="not-running")return process.stdout.write(`coze-bridge: not running
119
+ `),1;if(a.kind==="stale")return await Ko(e),process.stdout.write(`coze-bridge: not running (cleaned stale state)
120
+ `),1;let x=await o.request({method:"GET",path:"/status"});return process.stdout.write(`coze-bridge: running
121
+ ${JSON.stringify(x.body,null,2)}
122
+ `),0}async function jf(r){let e=r.paths??U(),o=new je(e),a=await o.probe();if(a.kind==="not-running")return process.stdout.write(`coze-bridge: not running
123
+ `),0;if(a.kind==="stale")return await Ko(e),process.stdout.write(`coze-bridge: not running (cleaned stale state)
124
+ `),0;try{return await o.request({method:"POST",path:"/shutdown"}),process.stdout.write(`coze-bridge: stopped
125
+ `),0}catch(x){return process.stdout.write(`coze-bridge: stop failed: ${String(x)}
126
+ `),1}}async function Wf(r){let e=new je(r.paths);if((await e.probe()).kind==="not-running")return process.stdout.write(`coze-bridge: not running (start daemon first)
126
127
  `),1;try{let a=await e.request({method:"POST",path:"/refresh"});return a.status===200?(process.stdout.write(`coze-bridge: refreshed
127
128
  ${JSON.stringify(a.body,null,2)}
128
129
  `),0):(process.stderr.write(`coze-bridge: refresh failed: ${JSON.stringify(a.body)}
129
130
  `),1)}catch(a){return process.stderr.write(`coze-bridge: refresh failed: ${String(a)}
130
- `),1}}async function Hf(r){let e=new Ge(r.paths);if((await e.probe()).kind==="connected"){process.stdout.write(`coze-bridge: stopping daemon...
131
+ `),1}}async function Gf(r){let e=new je(r.paths);if((await e.probe()).kind==="connected"){process.stdout.write(`coze-bridge: stopping daemon...
131
132
  `);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:u}=await Promise.resolve().then(()=>(Xr(),Yr)),g=f();await g.uninstall(u()),process.stdout.write(`coze-bridge: ${g.platform} supervisor unregistered
133
+ `)}await new Promise(f=>setTimeout(f,500))}if(!r.skipSupervisor)try{let{getSupervisor:f,buildContext:d}=await Promise.resolve().then(()=>(Gr(),Wr)),g=f();await g.uninstall(d()),process.stdout.write(`coze-bridge: ${g.platform} supervisor unregistered
133
134
  `)}catch(f){process.stderr.write(`coze-bridge: supervisor uninstall failed (continuing): ${String(f)}
134
- `)}let a=r.paths??V(),{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
+ `)}let a=r.paths??U(),{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
136
  `)}catch(f){return process.stderr.write(`coze-bridge: remove failed: ${String(f)}
136
137
  `),1}return process.stdout.write(`coze-bridge: uninstalled
137
- `),0}async function Wf(){try{let{getSupervisor:r,buildContext:e}=await Promise.resolve().then(()=>(Xr(),Yr)),i=r(),a=e();return process.stdout.write(`coze-bridge: installing ${i.platform} supervisor...
138
- `),await i.install(a),process.stdout.write(`coze-bridge: supervisor installed (daemon will auto-start on login)
138
+ `),0}async function Jf(){try{let{getSupervisor:r,buildContext:e}=await Promise.resolve().then(()=>(Gr(),Wr)),o=r(),a=e();return process.stdout.write(`coze-bridge: installing ${o.platform} supervisor...
139
+ `),await o.install(a),process.stdout.write(`coze-bridge: supervisor installed (daemon will auto-start on login)
139
140
  `),0}catch(r){return process.stderr.write(`coze-bridge: --install-service failed: ${String(r)}
140
- `),1}}async function jf(r,e,i,a={},x){let f=new Ge(i.paths),u=i.spawnDaemon??Lo;if(!i.skipDistInstall){let _=await Bo({paths:i.paths});_.kind==="version-changed"?(process.stdout.write(`coze-bridge: upgraded ${_.fromVersion} \u2192 ${_.toVersion}
141
+ `),1}}async function Xf(r,e,o,a={},x){let f=new je(o.paths),d=o.spawnDaemon??Lo;if(!o.skipDistInstall){let _=await Oo({paths:o.paths});_.kind==="version-changed"?(process.stdout.write(`coze-bridge: upgraded ${_.fromVersion} \u2192 ${_.toVersion}
141
142
  `),(await f.probe()).kind==="connected"&&(await f.request({method:"POST",path:"/shutdown"}).catch(()=>{}),await new Promise(y=>setTimeout(y,500)))):_.kind==="first-install"&&process.stdout.write(`coze-bridge: installed ${_.libVersion}
142
143
  `)}let g=await f.probe();if(g.kind!=="connected"&&(process.stdout.write(`coze-bridge: starting daemon...
143
- `),await u({paths:i.paths}),g=await Gf(f,i.waitTimeoutMs??1e4,i.sleep??Jf),g.kind!=="connected"))return process.stderr.write(`coze-bridge: daemon did not come up: ${g.kind}
144
- `),1;let m={privatecode:r,pairing_code:e};a.env&&(m.env=a.env),a.handshakeUrl&&(m.handshake_url=a.handshakeUrl),a.frontierUrl&&(m.frontier_url=a.frontierUrl),x&&(m.agent_id=x);try{let _=await f.request({method:"POST",path:"/pair",body:m});return _.status===200&&_.body?.ok?(process.stdout.write(`coze-bridge: paired (${_.body.note??"ok"})
144
+ `),await d({paths:o.paths}),g=await Vf(f,o.waitTimeoutMs??1e4,o.sleep??Yf),g.kind!=="connected"))return process.stderr.write(`coze-bridge: daemon did not come up: ${g.kind}
145
+ `),1;let p={privatecode:r,pairing_code:e};a.env&&(p.env=a.env),a.handshakeUrl&&(p.handshake_url=a.handshakeUrl),a.frontierUrl&&(p.frontier_url=a.frontierUrl),x&&(p.agent_id=x);try{let _=await f.request({method:"POST",path:"/pair",body:p});return _.status===200&&_.body?.ok?(process.stdout.write(`coze-bridge: paired (${_.body.note??"ok"})
145
146
  `),0):(process.stderr.write(`coze-bridge: pair failed: ${JSON.stringify(_.body)}
146
147
  `),1)}catch(_){return process.stderr.write(`coze-bridge: pair failed: ${String(_)}
147
- `),1}}async function Gf(r,e,i){let a=Date.now()+e;for(;Date.now()<a;){let x=await r.probe(500);if(x.kind==="connected")return x;await i(200)}return r.probe(500)}function Jf(r){return new Promise(e=>setTimeout(e,r))}Ko(process.argv).then(r=>process.exit(r),r=>{process.stderr.write(`fatal: ${r instanceof Error?r.stack??r.message:String(r)}
148
+ `),1}}async function Vf(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 Yf(r){return new Promise(e=>setTimeout(e,r))}Ho(process.argv).then(r=>process.exit(r),r=>{process.stderr.write(`fatal: ${r instanceof Error?r.stack??r.message:String(r)}
148
149
  `),process.exit(1)});