coze-bridge 0.1.21 → 0.1.23

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 +46 -46
  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 o0=Object.create;var wr=Object.defineProperty;var a0=Object.getOwnPropertyDescriptor;var c0=Object.getOwnPropertyNames;var x0=Object.getPrototypeOf,u0=Object.prototype.hasOwnProperty;var V=(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 De=(r,e)=>()=>(r&&(e=r(r=0)),e);var oe=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),Ns=(r,e)=>{for(var i in e)wr(r,i,{get:e[i],enumerable:!0})},f0=(r,e,i,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let c of c0(e))!u0.call(r,c)&&c!==i&&wr(r,c,{get:()=>e[c],enumerable:!(o=a0(e,c))||o.enumerable});return r};var Ie=(r,e,i)=>(i=r!=null?o0(x0(r)):{},f0(e||!r||!r.__esModule?wr(i,"default",{value:r,enumerable:!0}):i,r));import{chmod as d0,mkdir as l0,readFile as h0,rename as Os,writeFile as Bs}from"node:fs/promises";import{dirname as g0}from"node:path";async function at(r){try{let e=await h0(r,"utf8");return JSON.parse(e)}catch(e){if(e.code==="ENOENT")return null;throw e}}async function Yt(r,e,i){await l0(g0(r),{recursive:!0});let o=`${JSON.stringify(e,null,2)}
9
- `,c=`${r}.tmp-${process.pid}-${Math.random().toString(36).slice(2,10)}`;try{i?.mode!==void 0?await Bs(c,o,{encoding:"utf8",mode:i.mode}):await Bs(c,o,"utf8"),await Os(c,r),i?.mode!==void 0&&await d0(r,i.mode)}catch(x){await Os(c,c).catch(()=>{});let{rm:f}=await import("node:fs/promises");throw await f(c,{force:!0}).catch(()=>{}),x}}var Xt=De(()=>{"use strict"});function qs(r){return Qt[Ms]<=Qt[r]}function _r(r){zs={...r}}function $t(r,e,i,o){if(Qt[r]<Qt[Ms])return;let c=JSON.stringify({ts:new Date().toISOString(),level:r,module:e,msg:i,...zs,...o});r==="error"||r==="warn"?m0.write(`${c}
10
- `):p0.write(`${c}
11
- `)}function L(r){return{debug:(e,i)=>$t("debug",r,e,i),info:(e,i)=>$t("info",r,e,i),warn:(e,i)=>$t("warn",r,e,i),error:(e,i)=>$t("error",r,e,i),child:e=>L(`${r}.${e}`)}}var Qt,Ms,p0,m0,zs,U=De(()=>{"use strict";Qt={debug:10,info:20,warn:30,error:40},Ms=(()=>{let r=process.env.COZE_BRIDGE_LOG_LEVEL;return r==="debug"||r==="info"||r==="warn"||r==="error"?r:"info"})(),p0=process.stdout,m0=process.stderr,zs={}});import{homedir as w0}from"node:os";import{join as ee}from"node:path";function G(r){let e=r??w0(),i=ee(e,".coze"),o=ee(i,"bridge"),c=ee(o,"lib");return{cozeRoot:i,bridgeRoot:o,libDir:c,libEntry:ee(c,"index.js"),pidFile:ee(o,"bridge.pid"),portFile:ee(o,"bridge.port"),tokenFile:ee(o,"bridge.token"),logFile:ee(o,"bridge.log"),installLock:ee(o,"install.lock"),configFile:ee(o,"config.json"),agentsRoot:ee(i,"agents")}}function Te(r,e=G()){let i=ee(e.agentsRoot,r);return{root:i,config:ee(i,"config.json"),workspace:ee(i,"workspace"),logs:ee(i,"logs")}}var xe=De(()=>{"use strict"});var tn={};Ns(tn,{AGENT_CONFIG_FILE_MODE:()=>Zt,enforceAgentConfigMode:()=>b0,loadAgentConfig:()=>ue,persistAgentSessions:()=>yr,persistAgentSkills:()=>en,saveAgentConfig:()=>me});import{chmod as _0,stat as y0}from"node:fs/promises";function ue(r,e){return at(Te(r,e).config)}function me(r,e){return Yt(Te(r.agentId,e).config,r,{mode:Zt})}async function b0(r,e){if(process.platform==="win32")return;let i=Te(r,e).config;try{let o=await y0(i);if(!o.isFile())return;let c=o.mode&511;c!==Zt&&(await _0(i,Zt),Fs.warn("agent config mode auto-corrected to 0600",{path:i,from:c.toString(8)}))}catch(o){if(o.code==="ENOENT")return;Fs.warn("enforceAgentConfigMode: chmod failed (ignored)",{path:i,err:String(o)})}}async function yr(r,e,i){let o=await ue(r,i);o&&(o.sessions=Object.fromEntries(e),await me(o,i))}async function en(r,e,i){let o=await ue(r,i);o&&(o.skills=e,await me(o,i))}var Fs,Zt,Ue=De(()=>{"use strict";Xt();U();xe();Fs=L("agent-config"),Zt=384});var zi=oe(X=>{"use strict";var S=k;(function(r,e){let i=k,o=r();for(;;)try{if(-parseInt(i(1445))/1+-parseInt(i(1267))/2+parseInt(i(1127))/3*(-parseInt(i(759))/4)+-parseInt(i(591))/5+-parseInt(i(328))/6+parseInt(i(980))/7*(parseInt(i(563))/8)+-parseInt(i(187))/9*(-parseInt(i(1567))/10)===e)break;o.push(o.shift())}catch{o.push(o.shift())}})(Nn,813735);var Yc=Object.defineProperty,Xc=Object["getOwnPr"+S(532)+S(1052)],Ri=(r,e)=>function(){return r&&(e=(0,r[{mmnMx:function(x,f){return x(f)}}[S(648)](Xc,r)[0]])(r=0)),e},$c=(r,e)=>{let i=S,o={AtFXw:function(x,f,d,g){return x(f,d,g)}};for(var c in e)o[i(1575)](Yc,r,c,{get:e[c],enumerable:!0})};function Qc(){return Pi||(Pi=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function Zc(){let r=S;return Di||(Di=[IDBCursor[r(1148)+"e"][r(883)],IDBCursor[r(1148)+"e"][r(790)],IDBCursor[r(1148)+"e"].continuePrimaryKey])}function ex(r){let e=S,i={RZiWT:function(c,x){return c(x)},QXiUY:e(227),VHcuy:e(939),UzqyE:function(c,x){return c>>>x},ievEc:function(c,x){return c===x},lyzlo:function(c,x){return c<x},LAGaL:function(c,x,f){return c(x,f)},WhHKw:function(c,x){return c&x},fzHKW:function(c,x){return c>>>x},LCpfi:function(c,x){return c+x},hQGgE:function(c,x){return c|x},ImqYC:function(c,x){return c+x},LJvTd:function(c,x){return c!==x},bFtvl:function(c,x){return c&x},klnsU:function(c,x){return c>>>x},JSmso:function(c,x){return c+x},iATlG:function(c,x){return c!==x},xxZoC:function(c,x){return c|x},LLPEJ:function(c,x){return c>>>x},NaQal:function(c,x){return c|x},iVxWV:function(c,x){return c>>>x},DjVXE:function(c,x){return c>>>x},ZbuXt:function(c,x){return c&x},UFhkM:"JDRem",ENLoy:function(c,x){return c instanceof x}},o=new Promise((c,x)=>{let f=e,d={BEyez:i[f(1053)],VXjqL:i[f(735)],Mcudv:function(y){return y()}},g=()=>{let y=f;r[y(923)+"entListe"+y(231)](d[y(1035)],w),r[y(923)+y(1204)+"ner"](d[y(166)],b)},w=()=>{let y=f;i[y(1326)](c,i[y(1326)](Ee,r[y(585)])),g()},b=()=>{x(r[f(939)]),d.Mcudv(g)};r[f(1380)+f(934)](i.QXiUY,w),r[f(1380)+f(934)](i[f(735)],b)});return o[e(1e3)](c=>{let x=e,f={JzbFx:function(d,g){return d>>>g},YHhrO:function(d,g){return d|g},CPbam:function(d,g){return d<<g},wsQoJ:function(d,g){return i[k(600)](d,g)},zLEEE:function(d,g){return d===g},FUPst:function(d,g){return i[k(316)](d,g)},BfsVw:function(d,g){return i[k(1102)](d,g)},hgpCQ:function(d,g){return d<g},sHFGd:function(d,g){return i[k(1102)](d,g)},WcCmO:function(d,g,w){return i[k(990)](d,g,w)},HxoNE:function(d,g){return i[k(599)](d,g)},NSsIG:function(d,g){return i[k(874)](d,g)},vuCFR:function(d,g){return i.LCpfi(d,g)},DMNkq:function(d,g){return d!==g},Girpg:function(d,g){return i[k(1256)](d,g)},nnnBm:function(d,g){return i.ImqYC(d,g)},eHmFg:function(d,g){return d&g},AVLBs:function(d,g){return i[k(1260)](d,g)},BHUQi:function(d,g){return i[k(833)](d,g)},SpiUQ:function(d,g){return i[k(1260)](d,g)},ZPvUl:function(d,g){return d|g},XYsvN:function(d,g){return d>>>g},CtVuN:function(d,g){return i[k(439)](d,g)},hBfPO:function(d,g){return i.hQGgE(d,g)},uQKhw:function(d,g){return i.JSmso(d,g)},CgXam:function(d,g){return i[k(1128)](d,g)},iLGbi:function(d,g){return i[k(236)](d,g)},wNXcO:function(d,g){return i[k(907)](d,g)},FFVLL:function(d,g){return i[k(874)](d,g)},hekGm:function(d,g){return i[k(313)](d,g)},AERsB:function(d,g){return i[k(879)](d,g)},FwZUJ:function(d,g){return d&g},vylaR:function(d,g){return i[k(874)](d,g)},IvXXN:function(d,g){return i[k(1622)](d,g)},YORAI:function(d,g){return i[k(903)](d,g)},MxxHh:function(d,g){return i[k(1622)](d,g)}};if(i[x(1589)]!==i.UFhkM){let d=f[x(480)](_0x1f0f7a[x(371)],0),g=f[x(480)](f[x(850)](f.JzbFx(_0x499d54[x(371)],28),f[x(1602)](_0x324bd2[x(1075)],4)),0),w=f[x(873)](_0x9512c2.high,24),b=f[x(184)](0,w)?f[x(1086)](0,g)?f.BfsVw(d,16384)?f[x(1089)](d,128)?1:2:f.hgpCQ(d,2097152)?3:4:f[x(1585)](g,16384)?f[x(1089)](g,128)?5:6:f[x(1089)](g,2097152)?7:8:f[x(1089)](w,128)?9:10,y=f.WcCmO(_0x434caa,_0x34670b,b),C=_0x407e63[x(385)];switch(b){case 10:C[y+9]=f[x(1533)](f[x(1615)](w,7),1);case 9:C[f[x(1510)](y,8)]=f[x(455)](9,b)?f[x(411)](128,w):f[x(1533)](127,w);case 8:C[f[x(546)](y,7)]=b!==8?f[x(411)](f[x(1615)](g,21),128):f[x(1141)](f[x(873)](g,21),127);case 7:C[y+6]=f[x(1130)](7,b)?f[x(411)](g>>>14,128):f[x(1528)](f.wsQoJ(g,14),127);case 6:C[f.nnnBm(y,5)]=f.SpiUQ(6,b)?f[x(488)](f[x(935)](g,7),128):f[x(1528)](f[x(226)](g,7),127);case 5:C[y+4]=f[x(1130)](5,b)?f.hBfPO(128,g):127&g;case 4:C[f[x(302)](y,3)]=f[x(802)](4,b)?f[x(1034)](f[x(807)](d,21),128):f[x(1209)](d,21)&127;case 3:C[y+2]=f.DMNkq(3,b)?f[x(1404)](f[x(978)](d,14),128):f[x(1064)](f.vylaR(d,14),127);case 2:C[f[x(546)](y,1)]=f[x(1130)](2,b)?f[x(1119)](d,7)|128:f[x(961)](f[x(1289)](d,7),127);case 1:C[y]=b!==1?f[x(543)](128,d):127&d}}else i.ENLoy(c,IDBCursor)&&Dr[x(885)](c,r)})[e(1360)](()=>{}),Ln.set(o,r),o}function tx(r){let e=S,i={iblRm:function(c){return c()},RIUbs:e(1484),zMUxb:function(c,x){return c(x)},lmYtw:"AbortError",bcHfO:e(939),puPiv:e(889),RPERE:e(263)};if(Tn.has(r))return;let o=new Promise((c,x)=>{let f=e,d={BQNYN:f(889),GzaIG:i[f(747)]},g=()=>{let y=f;r[y(923)+y(1204)+"ner"](d[y(571)],w),r[y(923)+y(1204)+y(231)](d.GzaIG,b),r[y(923)+"entListe"+y(231)](y(263),b)},w=()=>{let y=f;i.iblRm(c),i[y(179)](g)},b=()=>{let y=f;if(i[y(474)]!==i[y(474)])return this[y(1438)][y(1110)+"te"];i[y(771)](x,r[y(939)]||new DOMException(i.lmYtw,i.lmYtw)),g()};r[f(1380)+f(934)](i[f(479)],w),r.addEventListener(i.bcHfO,b),r[f(1380)+"Listener"](i[f(1459)],b)});Tn.set(r,o)}function nx(r){Rn=r(Rn)}function rx(r){let e=S,i={HJhjH:function(o,c){return o(c)},YQlOy:function(o,c){return o(c)},uAWmQ:e(800)+e(667)};return r===IDBDatabase[e(1148)+"e"].transaction&&!(i[e(665)]in IDBTransaction[e(1148)+"e"])?function(o,...c){let x=e,f=r[x(1407)](i[x(1003)](Mt,this),o,...c);return Pr.set(f,o[x(651)]?o[x(651)]():[o]),Ee(f)}:Zc()[e(1131)](r)?function(...o){let c=e;return r.apply(Mt(this),o),i[c(1003)](Ee,Dr.get(this))}:function(...o){let c=e;return i.YQlOy(Ee,r.apply(i[c(293)](Mt,this),o))}}function sx(r){let e=S,i={PVYGI:e(1605),NFKns:function(o,c){return o(c)},bnNUb:function(o,c,x){return o(c,x)},MEavP:function(o){return o()}};return typeof r===i.PVYGI?i[e(413)](rx,r):(r instanceof IDBTransaction&&i[e(413)](tx,r),i.bnNUb(Ni,r,i[e(225)](Qc))?new Proxy(r,Rn):r)}function Ee(r){let e=S,i={mELsk:function(c,x){return c instanceof x},iTZkl:function(c,x){return c(x)},UBHuS:function(c,x){return c(x)},UiiBM:function(c,x){return c!==x}};if(i[e(1146)](r,IDBRequest))return i[e(475)](ex,r);if(Dn.has(r))return Dn[e(1621)](r);let o=i[e(1247)](sx,r);return i[e(1197)](o,r)&&(Dn[e(885)](r,o),Ln[e(885)](o,r)),o}var Ni,Pi,Di,Dr,Tn,Pr,Dn,Ln,Rn,Mt,Ii=Ri({"node_modules/idb/build/wrap-idb-value.js"(){let r=S,e={pHJGD:r(1623),NdowV:function(i){return i()},LDjLl:function(i,o){return i instanceof o},VCTHN:function(i,o){return i===o},BdQmb:r(1125),Ascro:function(i,o){return i===o},hVZdB:"done",UyQJS:function(i,o){return i===o},UdCbN:"objectStoreNames",zlEcj:function(i,o){return i===o},rHNRM:r(396),hoPeB:function(i,o){return i(o)},rnYrl:function(i,o){return i instanceof o},fHOHe:function(i,o){return i in o}};Ni=(i,o)=>o[r(1409)](c=>i instanceof c),Dr=new WeakMap,Tn=new WeakMap,Pr=new WeakMap,Dn=new WeakMap,Ln=new WeakMap,Rn={get(i,o,c){let x=r,f={tVNBb:e[x(945)],nykOS:function(d){return e[x(1633)](d)}};if(e[x(462)](i,IDBTransaction))if(e[x(616)](e[x(1214)],e[x(1214)])){if(e[x(1040)](o,e[x(416)]))return Tn[x(1621)](i);if(e[x(866)](o,e[x(221)]))return i[x(800)+x(667)]||Pr[x(1621)](i);if(e[x(1016)](o,e.rHNRM))return c.objectStoreNames[1]?void 0:c[x(800)+x(1145)](c["objectSt"+x(667)][0])}else this[x(1343)](f[x(1101)],_0x507d31[x(1200)]),f.nykOS(_0x15ea62);return e.hoPeB(Ee,i[o])},set(i,o,c){return i[o]=c,!0},has(i,o){let c=r;return e[c(1636)](i,IDBTransaction)&&(e[c(1040)](o,e[c(416)])||e[c(616)](o,e[c(617)]))?!0:e[c(467)](o,i)}},Mt=i=>Ln[r(1621)](i)}}),Oi={};$c(Oi,{deleteDB:()=>ox,openDB:()=>ix,unwrap:()=>Mt,wrap:()=>Ee});function ix(r,e,{blocked:i,upgrade:o,blocking:c,terminated:x}={}){let f=S,d={uGmUO:function(b,y,C,P,I){return b(y,C,P,I)},pvHZk:function(b,y){return b(y)},yFKnc:f(1279)+f(346),heFWv:f(1548)+f(987),SkYqr:f(1461)},g=indexedDB.open(r,e),w=Ee(g);return o&&(f(1319)!==f(1319)?_0x53fe4a[f(251)](_0x1af02e):g[f(1380)+f(934)](d[f(859)],b=>{let y=f;d[y(1252)](o,d.pvHZk(Ee,g[y(585)]),b[y(465)+"on"],b[y(920)+"on"],Ee(g[y(770)+y(327)]))})),i&&g[f(1380)+f(934)](d.SkYqr,()=>i()),w[f(1e3)](b=>{let y=f;x&&b[y(1380)+y(934)](y(1403),()=>x()),c&&b[y(1380)+"Listener"](d.yFKnc,()=>c())})[f(1360)](()=>{}),w}function ox(r,{blocked:e}={}){let i=S,o={zdUtI:function(x,f){return x(f)}},c=indexedDB[i(738)+i(624)](r);return e&&c[i(1380)+i(934)](i(1461),()=>e()),o[i(902)](Ee,c)[i(1e3)](()=>{})}function Ti(r,e){let i=S,o={hHBOA:function(g,w){return g<w},IVQgq:function(g,w){return g<w},DRUrn:function(g,w){return g===w},KchkC:function(g,w){return g&w},AdrdJ:function(g,w){return g===w},Yfsjh:function(g,w){return g+w},OmxTr:function(g,w){return g!==w},fqrlj:i(1618),SRMkA:function(g,w){return g instanceof w},mGPru:function(g,w){return g in w},aECPe:"string"};if(!(o[i(1228)](r,IDBDatabase)&&!o[i(560)](e,r)&&o[i(968)](typeof e,o[i(1241)])))return;if(In[i(1621)](e))return In[i(1621)](e);let c=e[i(1317)](/FromIndex$/,""),x=e!==c,f=Mi[i(1131)](c);if(!o[i(560)](c,(x?IDBIndex:IDBObjectStore).prototype)||!(f||Bi[i(1131)](c)))return;let d=async function(g,...w){let b=i;if(o[b(996)](o[b(1639)],o[b(1639)])){let y=0,C=0;for(let P=0;P<_0x359af8[b(1620)];++P)C=_0x1a017a.charCodeAt(P),o[b(191)](C,128)?y+=1:o[b(214)](C,2048)?y+=2:o.DRUrn(o.KchkC(64512,C),55296)&&o[b(287)](64512&_0x12ab28.charCodeAt(o[b(642)](P,1)),56320)?(++P,y+=4):y+=3;return y}else{let y=this[b(770)+b(327)](g,f?"readwrite":"readonly"),C=y.store;return x&&(C=C[b(573)](w[b(1513)]())),(await Promise[b(797)]([C[c](...w),f&&y[b(1198)]]))[0]}};return In[i(885)](e,d),d}var Bi,Mi,In,ax=Ri({"node_modules/idb/build/index.js"(){let r=S,e={kOoNU:"2|0|4|5|"+r(1018),VbTfH:function(c){return c()},KwyZy:function(c,x){return c(x)},VKScH:function(c){return c()},RNAbm:r(1621),sfsKU:r(668),swatv:"getAll",vYfbA:r(701)+"ys",dHOmA:r(813),ihkpi:r(1581),knwsf:"add",fiWLO:r(1276)},i=e[r(1671)][r(460)]("|"),o=0;for(;;){switch(i[o++]){case"0":e[r(1600)](Ii);continue;case"1":e[r(549)](nx,c=>({...c,get:(x,f,d)=>Ti(x,f)||c[r(1621)](x,f,d),has:(x,f)=>!!Ti(x,f)||c[r(554)](x,f)}));continue;case"2":e[r(409)](Ii);continue;case"3":In=new Map;continue;case"4":Bi=[e[r(1046)],e[r(1002)],e[r(1275)],e[r(481)],e[r(1314)]];continue;case"5":Mi=[e[r(575)],e.knwsf,e.fiWLO,"clear"];continue}break}}}),cx={idb:function(r){let e=S;r[e(724)]=Promise.resolve()[e(1e3)](()=>(ax(),Oi)).then(function(i){return i})}},Li={};function Ce(r){let e=S,i={tlXBm:function(d,g){return d!==g}},o="4|1|0|3|2".split("|"),c=0;for(;;){switch(o[c++]){case"0":var x=Li[r]={exports:{}};continue;case"1":if(i[e(1668)](void 0,f))return f[e(724)];continue;case"2":return x[e(724)];case"3":cx[r](x,x[e(724)],Ce);continue;case"4":var f=Li[r];continue}break}}function k(r,e){r=r-156;let i=Nn(),o=i[r];if(k.TthaKT===void 0){var c=function(g){let w="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=",b="",y="";for(let C=0,P,I,T=0;I=g.charAt(T++);~I&&(P=C%4?P*64+I:I,C++%4)?b+=String.fromCharCode(255&P>>(-2*C&6)):0)I=w.indexOf(I);for(let C=0,P=b.length;C<P;C++)y+="%"+("00"+b.charCodeAt(C).toString(16)).slice(-2);return decodeURIComponent(y)};k.cfhaCy=c,k.wLlFbn={},k.TthaKT=!0}let x=i[0],f=r+x,d=k.wLlFbn[f];return d?o=d:(o=k.cfhaCy(o),k.wLlFbn[f]=o),o}function Nn(){let r=["ENDrqvu","zLDVswq","mJi4nZyWnLPeyMLpDa","Avnwy2K","y2HnyxHuCMK","DNrbCem","CNzHBa","Dvz6vNG","u2zUrMG","z2vrDwv1zuW","C3DHDhy","zgvSzxrL","werdr3u","yuLSBMS","DMvYC2LVBMm","s2rUr1m","rejhuwm","zNjVBuHHC2G","yLvJq0e","yw1LoIa","qw96txe","shvtz0S","x2vUzhbVAw4","uxvLDwu","txH4sgG","v3beD0O","z3bSBfK","CxLhs2i","wKD0s3C","yLfzy2q","B3fjt20","BgLZDgvUtMu","De12teG","A1n0yxr1C0m","x3jLBw92zvC","C2v0q3vYC28","Cgjwuhu","weP4zfa","wNz6s0O","D3nZoI8V","x2fKzfDZtgK","wNH2twm","DhLWzq","A2XMrLC","BNvTyMvY","A0foAhC","CNjVCK1LC3m","ywnRDxbfBMq","ugHctKW","zeHpBue","yNvMzMvYzwq","ueLkEMm","CMvWBgfJzq","vMjRt1G","r0HrBfe","t3Pgrvy","ihrPBwvZ","x3bPBMC","sw1xy3C","C0jf","zgv2AwnLx2K","uLPPv1q","DgLTzw91Da","AhLosNy","t1rvww4","AevYCM9Yrxy","CMvWBgfJzui","A0DqA3O","C2vUDa","BhrPCgXLihq","yw51Ce1LC3m","vufRze0","DezpzNi","ALfbzvO","DwTLzKm","AgvHzgvYCW","AxmGDw5Kzwy","B2zM","x2rLyNvN","BfH0v2e","zM9YrwfJAa","zxrxB3jRq2G","zw50zwqGDhK","v2f4vKq","yxv0BW","twLZC2LUzYa","tuzTyuW","zNjVBunOyxi","q0Xxrhq","y3r4","BNrLCG","wuLrAwG","CezOuwO","AwPVCMC","yxGGCMv0CMK","y2f0y2G","sKnmCfq","CMfTugfYyw0","AgzvB20","mtb8nxW4FdC","v2ncr0O","AK5jv1G","zNjVBujPDhm","swXdt0e","tg9JAW","uMPLshO","BerQyKW","r2TQqKO","DMvICu8","ChjVy2vZCW","zwvsCwC","EKDzwhi","zMXVB3i","C0n5Ahy","z2vtEw5J","ywrKrxzLBNq","swfpEMK","DMryqMO","wMfYywe","CNnVCL9Uyw0","wwfADui","tgzeDKW","BK1QwhG","C3vIC3rYAw4","t0XeD3G","tuPMvwu","zMX1C2HfEha","ruPyvey","uKzJqwi","CvbPEwm","rujKD2u","z1rPBwvVDxq","x2n1CNnVCK0","yvn0Afu","B25ozxr3B3i","C2fNzq","yMrFzgLK","A3DZEvC","y2XVC2u","AgvRr20","tKjfyvy","y2vZC0HHBMq","y2fSBa","tLrcuNu","C29Tzq","ywDLrxzLBNq","C3rHCNq","zw1PDa","x2HHBMrSzvi","x3jLywr5q2W","zw5KCg9PBNq","x19LC01Vzhu","Axbbtw8","x0vysvnu","y29Uy2f0","CM92AwrLihy","y3vYC29Yx24","DMfkAKe","qujMqui","BK5PCfe","y3vYCMvUDeu","ENLQu3a","qujswKq","D3jPDgvvAw4","CIb0DhDjra","ywnRtxnNswq","wxHzDfC","uK5xyKm","quHxAMe","y29UBMvJDa","C3rYAw5N","zgf0yq","zfDVCMTLCKC","x3nVy2TLDa","AwzxvNq","y3vYC29YlNm","vwjxq0y","qxnZAwK","AwXSihvZzsa","DxnLCKLW","mtu4mJqYmhv1sxLhvW","uLrlENK","qxbWBhO","D0L2s3y","q0Xpu0ve","ywrLyxe","sMP4wwW","Bg9IywXty28","CMfNzvn5BMm","wMPpywe","zKDpy0y","tfLPsee","s1rczwW","swfJv2m","uLbfuKu","y2ner0K","yMXVy2TLza","q3HrtgK","D3jPDgu","vhPLzei","DLbzvw0","BgLTAxq","whbPvxy","wwrZENG","B2vMB08","y29UBMvJDca","zw5NDgG","CujZrLy","qLPdqxG","AgHUB2K","tuvtu0fhrv8","s2rxr1a","qLbvqxK","CgLUz0LUDgu","v2LUzg93","te9MveC","EKHHsK8","yMDoBve","x2LZv29YA2u","zNf5Ceq","sfbmz1q","yLPJB1C","Ahr0Chm6","BwvKAwf0zwW","BfrPBwvVDxq","r1rqAfq","AuDsEwi","y29UBMvJDeu","wLDTsgG","x3nLBMrby2S","wvL1r1q","CLPuvhy","zMLSzw5HBwu","x3bHDgHlzxK","y2HHCKnVzgu","B2fK","mhW0Fdf8mNW","CgLUz19VBMm","zxDIuuO","yxzkyMW","x2DLBMvYyxq","CgLUz09Uy2u","D24GCMvHC28","AenJCwS","B09JrhC","DNvdrLi","q0XZyKG","AfLuwgu","C2HPzNq","AMTkDuy","yKnnt1y","x2LZtwLUAvC","y3jLyxrLq2W","y3vYDMfSDwu","Bg1oEhq","y3bOELi","AxnVqum","x3bYzwzPEa","zxmGCMvHy2G","CvrzufC","EuPvq0i","thLYv3m","AgfZt3DUuhi","qKHvuwK","x29Uq2XVC2u","BwfUDwfSihi","y3jLyxrLrxi","vw1QB0e","shHVtKu","CMvTB3zLq2G","yMfJA3vWigu","B0PAthe","wxn6uM4","wu9xCKu","z2v0q3vYCMu","zvD1wg8","z2rNswG","CxbyseO","BM5UDKq","AwHSvvu","twvZC2fNzuu","wwvsuuW","AMHsB08","DxbNCMfKzw4","BMrWB2LUDca","DNHIB0i","Ag9SD20","EvrxvLu","r05UtuW","wvvMzKu","AgXOEeG","zMzMzG","qw1VDw50","AxnmB25N","wMDKwKe","B0nPsu8","BgXsCuG","C0Xf","rNDnCe8","tejeB0u","r3ncDLq","yMfSrxzLBNq","mtbhtMfbtgC","Cw9Z","z21TA2C","AfPpAwW","vwTftgC","rKLRsfC","DKzUuvi","yvLVwwi","qxrgwhC","B0vgBue","yMLUza","BgLns24","q3vZDg9Trxi","DxrVuMvJB24","Chv0","BMvJDa","wgXdv3e","z1b3vge","C0Hgr2q","yLbwq0S","q1jzC1K","y29UBMvJDgK","vuzOA00","CNnVCL92ywW","uKHOB2u","AwDHDg9Yt24","B2nRzxrtDwm","BNnLsxy","zgrjrcWGzgu","Aw9Ul2PZB24","uKPswxC","Buv4zg4","AwXK","vMjuzKG","tgnqAeG","q1bIyw0","CMflvfC","z2vY","zNvUy3rPB24","CM9YrxzLBNq","wNjXzLi","qKPeB0S","ExvIv1K","ignVzgu6ia","rvntsNi","BNPywg8","mhWXFdn8mNW","DhjPzxm","tLnZsuC","tLzYvhq","Dg9oDw1Izxi","z014she","r0X5BKS","BgvUz3rO","z2v0","rgPwweu","CMvJzwL2zwq","zuH4weG","B3bLBIa","D3jzDKy","EMX0t2G","Ahfpt0y","qvDoyKq","v3nJDvK","su5tvefova","whnRy2K","tMrVD1y","zxjFDhrS","B3nLrxzLBNq","CM5zCMW","DxbKyxrLq3u","quTbrNu","zNfYBgO","x2HHBMrSzu8","Bg9Nsurhzw4","ywDL","zxvYr0u","CxfPuxi","BfroCNu","wLLKvKK","reiGzMfPBgu","Aw5KzxHpzG","D2TvCgK","zhf4r3i","yvv2BhO","x3bYB3rVy28","DuP3ze4","A29IuwK","tuTVv08","uw9cvMe","CMvZzxrfBMq","yuLjA0K","te9Nru4","yw1Lu3bHy2u","DhbizwfKzxi","s3LZBgK","B0jlANu","yKv4rw4","ywXntem","Dw5KzwzPBMu","DxrMofDYAxq","DgXyqM0","r2jnAKu","DMLJzuLeig8","A09VtLu","q3DkzMG","AgvHzgvY","sNnzzhi","wMfSEuq","CMrJvMy","zgLZCgf0y2G","D3HHrNi","A1zjEfC","BerLuey","lcbTyxGGCMu","u3rYyxrLz3K","thLyvMO","x29WDgLVBNm","yuLkB0m","DgvZDa","vLHQCuW","x3DZsw5ZDge","uxjdugW","x2LUAxrhBg8","DerNrxu","AxnbCNjHEq","Bg9NsurozxC","C2jlBLe","BgPdCvO","rNPnAgm","BNHVrw4","AhzlC0q","AenSB3nLrxy","AwjSuM0","ihjLy29UBMu","yNL0zu9MzNm","wNjpBMK","DMfSDwu","EKXfruu","zw5HyMXLqxu","x2rPC3bHDgm","ndy1nda4odftvgHivKi","rfbTuMi","Au9lrg8","AgPmDgS","AeHct0e","Dg9VigXHCMC","BhLSt1m","vMjNzuC","D2fZq2XLyw4","B1H2t00","Dg9tDhjPBMC","uhLjwha","Cw5ssg8","wu1Mrhy","q0TNwu0","Eujmt2u","C2v0u3rVCMe","CvfYrMu","u294BLm","Au9XDfG","ALrmAxC","s3HMueO","rNLVrvC","vw5Oyw5KBgu","DgLUzYbZzxi","CenXwuy","C2j6ANK","svzrz3e","Dxrjza","y2XVC2veqG","q0HXCNC","zgvJB2rLzey","z3vYEeG","x29UtwvZC2e","vwrdyK4","zcbLCNjVCI4","AgzgywS","C3v3sge","tuvHDLa","q3rwDu4","C3vJy2vZCW","Dwz3AwW","icSG","Cgf5Bg9Hzeu","BMvY","BM5Ly3q","uMjkt0m","t1bftL9fuLi","CYbWyxjHBxm","EhHAB0m","De5YvLO","lcbOB3n0BMe","x2rLC3rYB3K","BMDLza","ANPnBLi","DgnjthK","BerTBgG","BML0AwfSAxO","BND4BNG","seD1q2q","r0DuBLC","y29UC3rYDwm","C2vYDMLJzq","CgLUz1rPBwu","ChvZAa","D2L4qMK","q3vZDg9Tq2W","ze1NEwi","yuzksfm","yvzXveC","A2v5CW","z1rRtvu","tMzdy2C","uM1RDLG","B2zMBgLUzq","zvvYBa","ywjVCNq","ywWGy3vYC28","svLuBwW","z05Ar3m","DgLuv3a","zxjFywnRx20","BgnKEeC","x2TLEvbHDgG","y09OvNK","rfHYwue","CMvZzxrdB3u","BunzrfG","sg5OAhC","BKXPBMu","yNL0zuXLBMC","Dw5ZAwDUzwq","Aw5PDcbrB1m","B3bLBG","CgLUz0XVC3m","qKvetey","C2LUuw0","BxnNsuq","t25vCwy","BMrLEa","qwrYzeO","yxv0B21HDgK","u0zjqNq","mtb8mxWY","r1LIt1K","pxv0zI04","wvfSt3K","ign1CNnVCIa","B25tDg9Wsw0","Axbgsvy","t2jQzwn0","vuTrvM8","BM93","zw1LBNq","yvjrt2W","DvflAhC","DLrbqKm","uLHcBKm","tKfusvzfx0u","EwToA1y","CMvZB2X2zq","BgToEem","y0D5uw8","C2vUzf9Hy2S","CgXLyxnLiha","B2DzBxi","tMfrywW","x2LZsw5PDa","AMfyq3q","Awv2rwm","r2rSu1O","BwX3BMW","BNrfBMrWB2K","BMnVzgLUzW","CuPIwMu","x29UvgLTzw8","D3m6lY8","q2nlAgS","zwrPyxrLBhK","Bwf4uMv0CMK","Aw9U","ndu5mtmWogrxufLvqW","Ae9Wzw5fDMu","Efrurw52","rgncu0u","yMvkChK","q09otKvdveK","A1rdyuq","ihrVihjLDhi","AgvKtwf4uMu","yxnL","ywnR","zxjYtxnN","vxPLB0C","Dxnky3m","Bhm6ia","FdH8oxWWFdm","AwXLx25HBwu","m3W3Fdv8mhW","AgfUz2u","r3fUy2e","thblq2W","wLneufK","r3nzAK8","EKvjyvm","tg9NsurozxC","y3ruAw1LB3u","Dw5RBM93BIa","svzgAuO","z0r1r1q","CMfUzg9T","DxziBxG","BezfzKy","Cwrsrxa","u1vjsNi","A2v0ignVBNm","Dgv4Dc9Qyxy","v3vTsfC","zcWG","CMvJB25Uzwm","yvv0rwe","AMf5Duq","zxH0zw5ZAw8","Dgv4DfbHEwW","Bg93","yNfmv0u","BNrbBMrvCgq","Dg9cExrLC0i","zMzmAw5L","B25mAw5L","thrTDM8","igfYCMf5yNu","yxrLq291BNq","Dwjlv1e","DeLK","C0TfvxG","zuPRCKC","sKLLAK0","yNL0zxm","CfHjCgm","x2rPC2nVBM4","x29Ut3bLBG","yxPhC0e","yLfzzLe","tufyx1jfvfi","C0nbvum","v2XKuLi","zxjHDg9Y","zv90Aw1LB3u","C3rVCMu","EgHssMi","z0nuq2C","o2nOyxjZzxq","qNDptMq","B3jRzxjhBg8","ChjVDg9JB2W","vejLy1m","vMrsu0e","te5vD3u","sxnKteu","suvtx0vsuK8","A2zlsLm","vKTty0G","A2zeywq","r2LYCgC","BIWGAg9ZDg4","tKzlBNm","rKLAAw0","rvjst1i","AfzAzei","tg9Nsuq","ruHKEg4","BwLUzW","zu53rNi","zNjVBNrPzxi","q2nwuNG","tNnXwKO","BwLUAvbYB2C","CYbHBhjLywq","z3HLCKS","q2TjEMG","vuX2wvO","EKXOz3a","D09nsMW","x21LC3nHz2u","CYbPBNn0yw4","DcbSAw1PDa","whH6rMG","DuXnBgC","BMv4DcGPigm","q1bYvNe","zw5HyMXLuw8","A2XUC1u","ywLpBee","q25Pvwe","zufJAW","y29SBM8","yLfXCNO","AwrI","CgjICdi","zNjHBwvuExa","uerhCK0","q1v0zxi","q291BNq","t2rTqNi","DgLTzw91DcW","s2jnChe","q2fWv0K","re1oA3e","zfPRwKm","BgLUzq","yu5LBxC","u0DkzeS","C3bSAxq","svvHEgu","terQtgW","mhW1Fdj8m3W","BwXhugG","B2XKvMvYC2K","z2nMy1e","zKHpsgu","Ae1LC3nHz2u","z1vSwuS","zLHXr2e","yKnprhy","ihzHBgLKigq","ywrKq291BNq","uKLvyNm","AvrAA2W","DLLIzw4","zLrOAKW","DeLUDgvYy2u","ChvqAxy","sNPIrNG","DLLMyKe","A05kAum","l3DZl3yY","Aw50zwDLCIa","y2XVC2uSihC","zwrSrxy","q29Kzq","wLb2vwW","CKXtzK0","z2Txwgi","BK5mshu","C2vYDMvYvgK","x25HDMLNyxq","zgriu2G","vxbKyxrLq28","x2LZtwLUAvq","Dg9Y","BxnN","yNzfDvO","B3bLBKrc","sejKs0q","CwHgEem","wMXfEgC","y3jLyxrLt3a","tw9KDwXL","yNvMzMvY","EhnbAhC","qMzKqMS","wePhqw4","zMzLCG","s25rBxi","DMfS","A2vpAKe","x3bPBMDqB24","AgXysK0","mxWYFdr8nG","yMLUyxj5vhK","D1DTrvK","wLbRvNq","x2n1CNnVCK4","BwPIBvK","EffmvgC","BMvlrfq","CgfYC2u","BeHHBMrSzxi","ruzODK8","CNLSzem","EMjbqvG","EvHODha","rxfHyMu","y2HLy2TdDxi","B3bLCNr5tMe","zMLUza","u2LOzfm","ve5vvKq","y3jLyxrLtwu","y3vZDg9Tshq","mNW0Fdb8mxW","sKrLwxi","swD0z0G","ig1LC3nHz2u","Cwv0uNO","AejMue8","EhPnA0W","BgLUzw5V","BM5UqM0","ALLdExy","A2v5","s3D5wNK","AxnrB1nnzxm","Dg9cExrLC0W","B25TzxnZywC","B25LCNjVCG","AgfZ","DLzXzvK","x194x21Zz18","q09oveLovuu","rLDt","D29oExy","BuDqCNu","tMDTEM4","zLLwu1O","mJrPwK9pEuq","uMDVAw4","B25JBg9Zzq","rNjVBNrPzxi","y2XLyxi","BMfTzq","m3W0Fdz8mNW","vhrgtLq","qLfowu4","BgL6BgC","Aw5KzxG","CMfTzq","AwHRCgK","ChrVCG","tMjnAfa","uu5bDe0","Dhj1y3rVCIa","t3bLBKv2zw4","s3riq3a","lcbxzwjtB2m","yuzyqwW","yNfPrg8","CMvZDwX0","yuLowwu","igzPzwXKoIa","Ec11C2uT","D2X3u3i","C3rVCcbPBw0","ntqZmtq3mhHiAvnpvG","D0fSwvu","CNnVCKzPBgu","FdeXFdj8nNW","vu5Zv2O","C2XPy2u","zxjFAxnFywm","EvLvtMq","v2His3C","vxPXEuu","x2nSzwfYugK","ywzL","vgLTzw91Da","wgTeD0m","CMTLCKDSB2i","yK9hD0y","nhWYFdn8mhW","qw9yuwG","BgPPywu","AxnszwfKEq","C2j4v0G","ywnOzwqSihC","AhPdwNK","serhqwq","wu1bwhy","vKnuse4","CKHouK0","rxjYB3jdB2q","x21PBMLoyxy","u0PgCgG","zxrxv2G","B3vUDa","tuzWyKi","DgfIyxnL","t2zXuwW","B3nLza","twnHrxq","vw5PBxbSzw0","zwLgt1a","AKjLre8","ywfHEKm","zxj2AwnL","v3bJvue","CMLLC0nVDw4","ywnRx2LK","ANzXu0e","mNWZFdb8mxW","B25dBg9Zzq","ywffB0W","ywrKt25L","zgLZywjSzue","wwzZAMG","EvnSzg8","ALH3q3q","AxjuzfK","DvPYsMi","x2HHBMrSzva","Bw1UtxG","Chndww4","yNLL","C29YDa","DgHHBIbSB2m","CNzHBfzHBhu","igzHAwWSig0","ANnXweC","BMCGzMfPBgu","t1vzA0m","tMzoy0i","B25VCgvU","Auvru08","y3jLyxrLuMu","yxbWBhK","Dg9hzw5LCMe","q0Xpu0LorW","DufxBve","ENfOCgq","B3jLtMfTzxm","z2v0s2v5","yxKSig5LDhC","BwLZzq","q0nUseu","zw5JB2rLrNi","DwvQtM4","q1zYCK4","BwvZC2fNzv8","ze1kDgq","zNjVBuj5Dgu","B25SAw5L","DhjPzxmGCMu","EvjLy29UBMu","CMz2Buu","ug5nENa","Ag9iuMK","u1vksxK","B0jREuG","zgvIDwC","D2X3uNa","x3jLy29UBMu","CKfMquq","zM1LAwS","BKrUwuS","se9Nwgm","DgHisgm","yw5Hz2vY","rKLmrv9ot1q","rvbVsNK","z0TfC3e","BNruCMLLC0m","Dev2zw50","rwPeDxC","z2v0qwXSs2u","r2TtwLC","u2TPCcbWyxm","CMvJzxzPzwq","q29UzMLN","BNLnyuy","EeTIqxK","vgLntfC","ywDLsgLKzq","zeTcq3O","thvJBeK","zwPnyum","vwTgEKK","z2vjBMzVu3K","A25urNi","v0rJCMG","B05MDg0","B2LUDfjLywm","z2v0qwXS","DMHXy2S","DwrbEfi","AxbRDeW","rNjvEfi","zxHWB3j0CW","DfLmCvq","ueXWreO","C3rLBMvYCW","C3zSwKO","x3DHAxq","u1jLEee","ww9xvge","y2HnyxHdB3u","B2DrruK","B1PyAfe","vKHJDxK","yKLIqNe","vezZqMC","zgvSzxrLrge","AgHZEfq","yw5Nzq","qwLzB3u","DMvhthK","Dgv4Dc9WBge","BhnwA08","uKDIC0y","uerLCwi","yMnizK8","DMvUDa","rNf1Axe","rLjptLrjrvi","x2LZqNjVD3m","yK56B3C","AMvJDfn0B3i","CgLiEMe","jMPZy2fSBgi","x3bPBMDmB3m","DhDVCMTdAge","DMfSDwvZ","nfDrzKXuAa","uvvdrKm","B25nzxnZywC","nxWXmhW3Fdq","BefJueu","rwrguMm","zMLSDgvY","zM9Yy2u","q0HUB1O","FdeXFdL8mhW","ihn1y2nLC3m","DhjHBNnHy3q","EK1vEgi","y1b2sgu","zgvS","uefOuM0","Bg9N","y3jeExC","CvPmsLm","mdaWmdaWmda","ywDLu2HVDW","rxzhtum","vgTLz1m","ihzHBgLKihm","BNjqt3u","zxf1ywXZ","tMrsyvK","DNflDKq","svzev1i","DhjPBq","rfvwDgG","y29UDgLUDwu","z1vQD0q","x2LUAxrqCM8","y29Kzq","DMvYC2LVBG","q3fyyuG","rffMsuK","ywXS","ue92tuq","EK9otKu","B2jQzwn0u3q","CfLzugi","q2Dyyw0","AhrQvgC","BwvY","vxr0Cgu","rLDfsxa","D05yy08","y09Wzw4","s2rgzLi","v2TLwwS","yxbvufm","uMvHzcbWyxm","y291BNq","rvz2Cg0","t0vjq2m","v1b1tuS","x2LUDgvYDMe","rxzzyLu","EvnkvLG","ywHtvMK","D3jxwxO","C3nHz2vfDMu","sxzgv2u","ihrPBwvVDxq","rKnsBwK","ywXIz2G","ywXty29Wzq","BuD5q2O","x3vYBa","EM9UzMu","vuvbD2e","AeLir3O","yKz0DMW","Cg93","EKHKs0W","yK9vtxG","v1v6Exq","wxzvuui","ywfzt3i","sw9Rs0G","Dw50","s0XZu1C","zfjWrvq","tu9vuLC","whPyBwm","CgnKz2K","De9Kquq","ywrK","u0PbAuy","wuHOCK8","yLDftgm","tNvsseK","DNvdwwS","A0TbqLi","yM9KEq","B0PHyvG","x2rYB3bhBg8","BgXRwfG","Agvgv3y","uhHjzwS","rxvAzfe","EKrrDwi","yxKSihrYEsa","CK1Muva","EK9bque","vxLrsLm","C0XPC3rLBMu","Bwu6ia","ze9YuuC","zhznv2q","z0fdwKm","sMrUB1q","D3nrB0O","zNPis1C","yLvNrfq","vwPZqLm","BfzZrLG","uvjzCwi","Avz4v1y","ChbL","DNntzeK","B25szwnLAxy","ywr2yw5Jzq","y3jLyxrLt2i","C2v0","CfbRzLe","AvjSr3m","s2HRB0C","y29TCgXLDgu","zw5fDMvUDa","A29ZBMq","zNLpzxy","r2nPr1u","z0LxuLa","EwDIB0O","tNvst1u","uwnPvM0","x2n1CNnVCKy","DgvmB2Djre4","uLjpuG","suTQvhm","EMrvDeK","wMj1whq","B25Uzwn0Aw4","qM5ty0S","rfbowxG","teXqruO","BfLJuuu","u2vXsuq","A0jwCLa","DgfYz2v0","AxjLza","rxzLBNq","D2LSBfjLy28","yxP4weO","nNWZFdL8nhW","AxnAzxjV","CgfNzwHPzgu","t1bftG","BMv3vMvYC2K","ywnOzwq","DhHosuq","CMvTB3zLrxy","zw1YvNe","aaaaaaaaaaa","s2vzy0i","DhDRA2W","BwvZC2fNztO","BxHpzK0","vfHRDgG","EgPbvhO","Cg9PBNrbBMq","CgfNzxnOB3C","tgLZDgvUzxi","wfLZDK4","zeroAee","DMDUqNm","tfvJA24","zxjYB3i","z3zqExO","EgX1AK0","CMvHC29U","CgvYC2LZDgu","Ec1TC2CTy3u","CeHkr0q","y3vYCMvUDeK","zw5HyMXLvhi","r01IB0y","sxPtEem","sMXuAum","t0fVBe8","AK1Xsvq","q1rvwwy","z2v0u3rVCMe","Bwf4tg9ZC0m","yMLUyxj5","x1fVu01HBMe","m3W1Fdb8nhW","Exjtz2q","B25tDgfYDfi","wu9squK","DKrzEue","v0LsCLm","tKDFrvjst1i","s2XSsKu","B25pCgvU","vLDeteO","rfjvCM4","AM9PBG","DvvzB1q","CwrlzM0","y3vYC29Yx2y","C3L6wLO","tvjwue8","rfHRuMi","ywXPzcb1CMW","A2zqvKu","quvsC0i","x2zVCM1HDeu","mtK1ntK1ngPisvHkrG","zcWGDw5RBM8","uLDpr1m","B2zMC2v0","rK5Itva","rfzICNy","zwn0","zwvKzwq","uwDKuNO","x2nVBM5Ly3q","tefhyuW","BxzyA1e","C0nVDw50zxi","zw5JB2rPBMC","vLrpDNO","B3v0sw50zxi","t214vhi","Dfz1yMe","txfgAhO","DfztAe4","DgHLBG","ywnRpwzYB24","C2zZs1u","sePOAKG","DufJrKO","vLvkruW","Cgv0zLe","EfH5shq","Ahr0Ca","EgrgELG","igXHCMDLCIa","uMvJB25Uzwm","BKv5y3a","x2DLDeLUDgu","ueDWCuK","AwHgAhm","EMXfy2O","AwXLtMfTzq","m3WX","vhvQCMq","EunLreW","tNjrAwu","x2XPC3rLBMu","v2rKrwm","C2vYDMLJzs0","y3D1D3G","y3vYC29Y","DgvSrfO","yw1L","id4G","CMvUDevUzha","uNLkv08","BNf4qwK","D0DUCxO","AuXhyMK","qKv5zxO","ENvju3G","CMvHzfvjBNq","yxnZAwDU","x29UrxjYB3i","qxnJCM8","A3jzthq","sLnptLa","r0zhBuO","vgfN","DxjS","uK5byM0","C3rYAw5NAwy","CMvXDwLYzwq","EKzTu3u","wgvJq0S","EvfAB3e","BwvZ","uvHPvvK","sejfwNK","BfPpu0i","x2nSzwfYvgK","y0zsqxa","AuLprvm","uuvWs1O","zMjWBM4","BMCGDxjSoIa","EvPgAhK","sxvyDe8","rNDAvuO","EuLutMK","BezSDxnO","zgvMAw5Luhi","swvNzNm","y1DnD1a","Eufrru4","r1zewfa","zMLN","u2HHCMvKv28","BKHrCuG","AgLNAa","ru5euxy","Dg9mB3DLCKm","BgvY","ueLWqwK","B2nRzxq","C3bSAwnL","DgLLCKPtt04","Bwv0Ag9K","sM9KyMS","q3bUrhG","rLvqC3q","CuzbD2m","x2nYzwf0zvm","AgDWq1e","B2nRzxrgywK","CMvKDwnL","z29PBMCGyxC","rKL2DvG","x2jPBMfYEvq","sfLLvKO","BMnLq2XVC2u","BMDuAw1LCG","DMvY","tKPqBum","Ae14B1y","DfzoqMi","BhL6Bg8","te1gBMO","A1HfD0G","CM92AwrLihC","DhfYCwW","uxP2Egy","r09MA1i","v2fWu2G","CMvHzhLtDge","x2LUAxq","y1LPqvq","rLvwywy","ihrYEsbYzwm","EhfPsKm","CwvcrNq","De1HBMfNzxi","AvL1rMi","sxzywe4","qNLUvNO","qu9utxu","ihbYB3rVy28","u2TPDLe","Cg9PBNrdB24","C2Hluuq","z2v0sxrLBq","mtG1ndaXnvbSwfrjza","AufuBeC","z2v0q3vYC28","qvzmqNm","Aw5JBhvKzxm","C2vUza","EwvQCNy","Buzkr3G","q1rSrwS","wwHTv2G","CKThAMC","rgHyuNC","tejMwMu","EgXpEw8","zuHTrMC","zhLvr1a","Aw9UvgLTzw8","D0rwzhG","B3jL","BuvmC2S","rKHfrMK","ChjVDg90Exa","BM9Uzv9UB24","EvH1wvC","zMTXA0W","quXm","zxjYtM8","x2rItMfTzq","B3bLCNr5","v01YB2K","DunvDfG","x29UugfNzu4","rLzqvLO","s3Louuq","rK5WsK0","A2f5wu0","rgvKAwnHDgu","zNjVBu51Bwi","x3DZ","yM5yC1G","zwnVBM5Ly3q","BMrWB2LUDfq","wevXruS","r0zuvNe","B25fCNjVCG","AxnrB1nby2S","u1DotwO","tLHlu3G","wNHfB3O","y29UDgv4Da","Deflv1u","Dw5pDfe","Dwrqzei","y29UBMvJDfm","t21Lt00","tMXfA0m","swzqBKq","x3fVC0rc","veL0we4","x0rctMfTzq","zv9ZDwnJzxm","yMfSu2nVCgu","wu5ywve","nhWXFdy","quHquey","C3jJ","CMD1EuW","BuLiCKO","Cgf5Bg9Hzfq","C2v0sxrLBq","vwLPqK0","zg9Uzq","wNbyse4","BwvZC2fNzq","tuTTu3K","y2XLyxjtDg8","ywXSzwqGBxu","zw50tgLZDgu","yxbWBgLJyxq","y29SuKC","Cgf5Bg9Hza","qxj1A0S","rKzwteW","ue9PweK","whnJwwW","Cgu6ia","Aw1LCYbPBIa","qMrrBwi","y2HLy2Tszwe","ALrqDvG","tMfTzq","EKLZzNi","B3jRig9MzMW","C3vIyxjYyxK","Ew5WvuO","DNLdve8","zMvvz1q","EwzkD2e","s0jPDe4","x3nLCuLK","Ef9MCM9UDgK","u1jnA0e","zw50","uKfNB0C","tgT6tKG","ugjrsg4","q2zSwvi","qu1tDNC","mhWXFdj8m3W","BhnXsLm","ExbL","twXvu3y","BxfdtvO","wLHoBeW","yuvdugu","zLLbs2q","qNjPzgDL","C2HmEwC","B3jpBMXPBMu","wwrOCK8","vujiDvm","CgXqwue","rejoBfO","Afvgt2i","Ec1TC2CTCw8","DuDTvu8","D0fbAva","EwTgsNG","zxq9DxrMltG","Affhz0u","AK1wDxa","A1bdDwG","BwfW","teP2vgq","rhL3C2W","ENbVCwu","v2vIu29JA2u","t0XrwuC"];return Nn=function(){return r},Nn()}Ce.d=(r,e)=>{let i=k;for(var o in e)Ce.o(e,o)&&!Ce.o(r,o)&&Object[i(1067)+i(1155)](r,o,{enumerable:!0,get:e[o]})},(()=>{let r=S;Ce.o=(e,i)=>Object.prototype[r(1527)+r(1155)].call(e,i)})(),(()=>{let r=S,e={Uttpe:function(i,o){return i!=o},dOrQG:r(1666)+"d",zbAAX:r(505),gUjwD:r(1416)+"le"};Ce.r=i=>{let o=r;e[o(805)](e[o(869)],typeof Symbol)&&Symbol[o(197)+o(1044)]&&Object[o(1067)+o(1155)](i,Symbol[o(197)+o(1044)],{value:e[o(528)]}),Object[o(1067)+o(1155)](i,e[o(791)],{value:!0})}})();var Y={};(()=>{let r=S,e={wlwRp:function(s,t){return s===t},zONNE:r(948),OLDwx:r(1175),AiYou:function(s,t){return s+t},cWMwP:function(s,t){return s+t},KeYcB:function(s,t){return s+t},RGbsF:function(s,t){return s*t},LYiHA:r(627),gCTCg:function(s,t){return s(t)},HOgXc:function(s,t){return s+t},aUvlz:function(s,t){return s+t},IvFWe:function(s,t){return s(t)},SGJdK:function(s,t){return s+t},UbWCF:"0000",tOdAD:function(s,t){return s(t)},bUgDT:r(778)+"00000000"+r(778)+r(778),dMgyb:function(s,t){return s||t},lFEfF:function(s,t){return s!=t},NbMhP:r(1666)+"d",jBeDO:r(1205)+"ion/json",hyNJv:function(s,t){return s==t},oNftm:r(743)+"in;charset=utf-8",vFnQR:function(s,t){return s>t},RbJOC:function(s,t){return s!==t},LfDvL:r(1112),aSthU:function(s,t){return s<t},kosnd:r(539),krYLt:function(s,t){return s>t},lkNxC:function(s,t){return s<t},mlFmS:function(s,t){return s!==t},OdmBr:r(1019),qqiQr:function(s,t){return s!==t},SFIBt:function(s,t){return s-t},PDGrM:function(s,t){return s<t},ZgdZA:function(s,t){return s-t},IfPnD:function(s,t){return s<t},RJRYw:function(s,t){return s!==t},NfNcB:r(1561),nMjXx:function(s,t){return s===t},DBNlZ:r(162),HDGAd:function(s,t){return s!==t},QUCFC:function(s,t,n){return s(t,n)},MFmaL:function(s,t){return s(t)},RXBnC:function(s,t){return s>>>t},WddEc:function(s,t,n){return s(t,n)},ZSDPY:function(s,t){return s&t},GONtZ:r(1350)+"required"+r(587)+r(548),gkWXb:"Missing "+r(1048)+r(587)+"value",oCiIO:function(s){return s()},dMJtd:function(s,t){return s(t)},WMroi:function(s,t,n){return s(t,n)},xzMkL:r(1200),PIJzc:r(237),QiwQG:r(931),RjeHz:function(s,t){return s!==t},EZmvK:r(1074),sbKnQ:function(s,t){return s!==t},aVqTG:function(s,t,n){return s(t,n)},xdFzX:function(s,t){return s!==t},vuCYk:function(s,t,n){return s(t,n)},lDePF:function(s,t){return s(t)},BfdBk:function(s,t){return s!==t},NJPmC:function(s,t){return s!==t},mIHrJ:function(s){return s()},AKAFu:function(s,t,n){return s(t,n)},kfPVE:function(s,t,n){return s(t,n)},GciGU:function(s,t,n){return s(t,n)},fXqGa:function(s,t){return s!==t},RNWbC:function(s,t,n){return s(t,n)},bQqrz:function(s,t,n){return s(t,n)},feUgT:function(s,t,n){return s(t,n)},PIpAi:r(722),cdwXw:function(s,t,n){return s(t,n)},suwHa:function(s,t,n){return s(t,n)},GCMwy:function(s,t){return s(t)},fGOcF:function(s,t){return s===t},kANhw:r(1446),uVzVx:r(681),JsYdr:function(s,t,n){return s(t,n)},ukefC:function(s,t,n){return s(t,n)},yYUNd:function(s,t){return s(t)},veGLy:function(s,t){return s(t)},eiFOP:function(s,t,n){return s(t,n)},kGPkz:function(s,t){return s(t)},vtApC:function(s,t,n){return s(t,n)},TzedB:function(s,t){return s(t)},dRpET:function(s,t,n){return s(t,n)},thHHc:function(s,t){return s(t)},gvPyz:function(s,t){return s&t},AHWja:function(s,t){return s===t},KdWGP:r(1350)+r(1048)+" field: "+r(417),wixBi:function(s,t){return s===t},VJehl:"Missing "+r(1048)+" field: "+r(1083),pkJgn:function(s,t){return s(t)},htlrg:r(628)+r(1347)+r(1212),POvMD:function(s,t){return s>>t},bOGwF:function(s,t){return s>=t},tAKWU:function(s,t){return s===t},YoWTa:function(s,t){return s instanceof t},GTPhT:r(1205)+r(1596)+r(399)+r(292),iYuFb:r(1435),GNnML:r(1149)+"e",JIejM:function(s,t,n,a){return s(t,n,a)},ubKWQ:"oefoO",kBVrP:function(s,t){return s>t},qyGKb:r(703)+"t limit",WjQiS:function(s,t){return s*t},bCODv:r(678),gpllY:r(261),uejNn:r(918),unOtQ:r(739),yQZoq:r(812)+r(433),qZLJS:function(s,t,n){return s(t,n)},aIJoC:function(s,t){return s+t},WPuMK:function(s,t){return s||t},NTBRu:r(1530)+r(1167)+"ing",oBKju:function(s,t){return s===t},IaOzi:function(s,t){return s===t},aaazC:function(s,t){return s+t},NuROU:function(s,t){return s+t},yXuYW:function(s,t){return s&t},nyMaF:function(s,t){return s|t},hfUom:function(s,t){return s<<t},qPiyc:function(s,t){return s&t},WUzyt:function(s,t){return s<t},BJDoK:function(s,t){return s===t},TBecS:"IEtPO",nzXXo:function(s,t){return s(t)},rZTTv:function(s,t){return s+t},TItXN:"SrslY",dyUGP:function(s,t){return s+t},tyQyO:function(s,t){return s+t},FIkHW:function(s,t){return s+t},mqCMZ:function(s,t){return s|t},JjxYl:function(s,t){return s|t},POiXI:function(s,t){return s&t},IokKH:function(s,t){return s<<t},LyrWs:function(s,t){return s&t},tVShN:function(s,t){return s(t)},KyNQD:function(s,t){return s+t},kPCuh:function(s,t){return s|t},SkivQ:function(s,t){return s<<t},svlZJ:function(s,t){return s<<t},FCRmi:function(s,t){return s<<t},Ydszx:function(s,t){return s<<t},WscuY:function(s,t){return s&t},txNID:r(358),VpFbo:r(209),PLpDJ:function(s,t){return s>>t},ZrqfR:function(s,t){return s&t},RXAbU:function(s,t){return s<t},GLynK:function(s,t){return s+t},VbgeG:function(s,t){return s<t},bqiDo:function(s,t,n){return s(t,n)},aiOlA:function(s,t){return s<=t},nNLHu:function(s,t){return s<t},QEpKZ:function(s,t){return s-t},NXKSx:function(s,t){return s+t},uZrJb:function(s,t){return s<<t},FNbMP:r(454),petfQ:function(s,t){return s&t},tYLqT:function(s,t){return s|t},YrniR:r(355),qpXHJ:function(s,t){return s<t},JotkY:function(s,t,n){return s(t,n)},nrPOu:function(s,t){return s<t},WldRR:function(s,t){return s&t},hYTXe:function(s,t){return s&t},HBdKD:function(s){return s()},shLyg:r(702),liMKn:function(s,t,n){return s(t,n)},klfFW:function(s,t){return s|t},EnKdD:function(s,t,n){return s(t,n)},kFCEh:function(s,t){return s&t},CflYR:function(s,t){return s(t)},sinQm:function(s,t){return s&t},QrCPl:function(s,t){return s<<t},CTlEk:function(s,t){return s&t},sCAUC:function(s,t){return s&t},fkqkL:function(s,t){return s(t)},alMLC:function(s,t){return s<<t},tiTWp:function(s,t){return s&t},rLSfM:function(s,t){return s&t},fbpnn:function(s,t){return s(t)},Luxnm:function(s,t){return s&t},qBsFV:function(s,t){return s(t)},tFOfr:function(s,t){return s<<t},KnQmr:function(s,t){return s&t},hMxoV:function(s,t){return s&t},aINYe:function(s,t){return s<<t},QciVm:function(s,t){return s|t},kobQi:function(s,t){return s>>>t},rMfQP:function(s,t){return s<<t},dUNcv:function(s,t){return s>>>t},tMvLH:function(s,t){return s<<t},hfFak:function(s,t){return s===t},BnScK:function(s,t){return s<t},YNXYQ:function(s,t){return s<t},lmNxt:function(s,t){return s<t},kKABR:function(s,t,n){return s(t,n)},MKoWO:function(s,t){return s&t},Eqabe:function(s,t){return s+t},UvXhX:function(s,t){return s!==t},PbQHn:function(s,t){return s+t},zFmSu:function(s,t){return s!==t},RFcAb:function(s,t){return s|t},LOHLY:function(s,t){return s+t},oJaaX:function(s,t){return s!==t},BZCAx:function(s,t){return s|t},VbkOX:function(s,t){return s>>>t},ygboJ:function(s,t){return s!==t},EdFRc:function(s,t){return s+t},lpMBV:function(s,t){return s&t},jkJuF:function(s,t){return s!==t},GGTnW:function(s,t){return s>>>t},CHnoZ:function(s,t){return s>>>t},fYAKd:function(s,t){return s>>>t},hIHGz:function(s,t){return s&t},wAAiP:function(s,t){return s>>>t},gNZGs:function(s,t){return s&t},hqOOF:function(s,t){return s>>>t},yJUCB:function(s,t){return s!==t},mlwnl:function(s,t){return s|t},qdREp:function(s,t){return s&t},UjsBS:function(s,t){return s(t)},Gqnca:function(s,t){return s<<t},xlujM:function(s,t){return s|t},wlwSr:function(s,t){return s<<t},syzZZ:r(372),LBfZe:r(1611),CVrrN:function(s,t){return s|t},QgdRz:function(s,t){return s<<t},HYeVJ:function(s,t){return s|t},kVIxW:function(s,t){return s===t},wSSHu:function(s,t){return s<<t},pXIpc:function(s,t){return s|t},eNwFr:function(s,t){return s+t},cphzR:r(1036),ynpUJ:function(s,t){return s&t},TFsBg:function(s,t){return s&t},Uigis:function(s,t){return s&t},fYVSZ:function(s,t){return s>>>t},IacWc:function(s,t){return s&t},WumHW:function(s,t){return s>>>t},zDQub:function(s,t){return s(t)},OZUhm:function(s,t){return s%t},ZXNlL:function(s,t){return s*t},ewbQJ:function(s,t){return s+t},xWuVv:function(s,t){return s===t},YeRQL:function(s,t){return s===t},ABRZD:function(s,t){return s&t},YxYtW:function(s,t){return s>>>t},GbMjE:function(s,t){return s<<t},vdXBj:function(s,t){return s!==t},kTCaD:function(s,t){return s===t},JlTiC:function(s,t){return s>>>t},LOfTG:function(s,t){return s>>>t},YYuGT:function(s,t){return s===t},mlGPh:function(s,t){return s===t},aNdZY:function(s,t){return s===t},oBkyH:function(s,t){return s===t},iuJRn:function(s,t){return s+t},TNUVD:function(s,t){return s+t},SUIJr:function(s,t){return s&t},iOKDo:function(s,t){return s&t},HuSgK:function(s,t){return s&t},LSeNz:function(s,t){return s>>>t},jYCyv:function(s,t){return s>>>t},bfgSg:function(s,t){return s>>>t},psCYn:function(s,t){return s&t},XzXmc:function(s,t){return s>>>t},zGYXr:function(s,t){return s&t},gmmkg:function(s,t){return s&t},AMSvw:r(305)+r(900),VUJEL:r(333)+r(964),LcPhH:r(391)+"IES_ERROR",lAxtk:r(1475)+r(415),iRlGs:r(234)+"OR",edlEv:function(s,t){return s===t},lZOSB:r(821),kXEwH:"hAJfT",fThjL:r(463)+r(1190),avJbl:r(1235)+"4",AHPPF:function(s,t){return s===t},NVrTt:r(414),aNemw:function(s,t){return s<t},qQrFe:function(s,t){return s-t},ZPkVt:function(s,t){return s!==t},GsYjO:r(835),NjoNf:r(1392),Jldxb:r(1313),BPUAy:function(s,t){return s<t},tDgEu:function(s,t,n){return s(t,n)},Ngmzn:function(s,t,n,a){return s(t,n,a)},jTPuX:function(s,t){return s+t},ifWVt:r(1290),YvUQB:r(1231),ZYdVI:function(s,t,n){return s(t,n)},gPwTa:function(s,t){return s+t},lTNru:function(s,t){return s+t},qFAwc:function(s,t){return s&t},QqPDR:r(1364)+r(768)+r(569)+"1",nNipQ:function(s,t){return s>>>t},YUffE:function(s,t){return s|t},jMqIT:function(s,t){return s<t},nDnYK:function(s,t){return s<<t},holwm:function(s,t){return s&t},FIvuX:function(s,t){return s<t},hoHRi:function(s,t){return s|t},jTLiw:function(s,t){return s|t},XecCK:r(939),sbzjy:"eVmya",pMNKk:function(s,t){return s instanceof t},wJGue:r(210)+r(222),bJtpf:function(s,t){return s===t},UkELg:function(s,t){return s===t},dvMWd:function(s,t){return s===t},YIQih:r(331),TtFNT:function(s,t){return s===t},QvAIu:r(1246),VWDLJ:r(1403),zqhpd:r(280),zsllR:function(s,t,n){return s(t,n)},JCLpT:"utmNo",ejMaC:function(s,t){return s===t},vPYUm:r(830),ENDQv:function(s,t,n){return s(t,n)},jvqSA:function(s,t){return s instanceof t},MlUSv:function(s,t){return s===t},bZcoW:"lQMEc",SJFph:function(s,t){return s>=t},ArukK:function(s,t,n){return s(t,n)},OVCyy:r(826),jMVup:function(s,t){return s||t},lDjbL:function(s,t){return s||t},vebqO:r(1501)+"3",vhqck:function(s,t){return s||t},IzSxC:function(s,t){return s!=t},pCqYF:function(s,t){return s<t},SWNMj:function(s,t){return s===t},xqiJC:function(s,t){return s===t},yITNi:function(s,t){return s&t},QOSUq:function(s,t){return s+t},VdRSA:function(s,t){return s<t},zltOh:function(s,t){return s-t},KdFfR:function(s,t){return s>=t},rdcVf:function(s,t){return s<t},eHxXH:function(s,t){return s<<t},nnnvD:function(s,t){return s>=t},CLWDt:function(s,t){return s|t},CpnDx:function(s,t){return s|t},EjDuw:function(s,t){return s<<t},yAQEN:function(s,t){return s&t},RHhoe:function(s,t){return s<t},SUvhe:function(s,t){return s<t},IKjTs:function(s,t){return s>>t},knTFr:function(s,t){return s===t},xQLTg:function(s,t){return s===t},OLQYG:function(s,t){return s&t},Ovuhb:function(s,t){return s+t},xoNvP:function(s,t){return s|t},XxzFh:function(s,t){return s&t},oqIOm:function(s,t){return s==t},qdKfm:function(s,t){return s(t)},rRYsY:function(s,t,n,a){return s(t,n,a)},rhafF:function(s,t){return s instanceof t},CcKhk:"VUuEx",Dywsl:r(1179),irTdY:function(s,t){return s==t},xUZYu:"boe",wxaFr:r(880),iGRyb:function(s,t){return s===t},OfqQl:r(1649),ogQEI:r(354)+"reason",dDNhA:function(s,t){return s(t)},vgnBs:"script",oJZLq:r(363)+"ascript",ljCqZ:r(755)+r(1001)+r(1082)+"P",CRYsY:function(s,t){return s(t)},sZyJA:"pstVI",oZXhQ:"dFNBj",sbxWH:"rBaAX",zEIaS:function(s,t){return s!==t},cGyQo:"OEorf",sdSqZ:r(1524),vTABC:r(1021),bPVCK:function(s,t){return s|t},lylOS:function(s,t){return s<<t},NuRHI:function(s,t){return s|t},gdgIh:function(s,t){return s<<t},lQiDV:function(s,t){return s<<t},NfCcg:r(1043),hZoyn:r(1629),UNsWj:function(s,t){return s||t},ykNkV:function(s,t){return s||t},adeaq:"PcwPD",Applz:"GWLKK",crDyw:r(716),vqKvD:function(s,t){return s||t},HBEZy:function(s,t){return s(t)},neKDT:function(s,t){return s+t},hzCZy:r(499),woNyv:r(1285),EmsMa:function(s,t){return s||t},MqFhz:function(s,t){return s||t},jpmjV:r(1280),CRbRc:function(s,t){return s||t},IsdLE:r(279)+r(1647)+"d",PAhRm:function(s,t,n){return s(t,n)},yubWY:r(1568),EFhvO:r(675)+"id",yrSgd:function(s,t){return s&t},yTWVU:r(1537),XlCWq:function(s,t){return s(t)},DXkRb:function(s,t){return s(t)},UEAwa:r(227),BwONd:"ping_onc"+r(1187)+"s",uCUtX:"ping_onc"+r(395)+"t",LfxQH:r(271),LUckn:r(461),EBdwe:"x_frontier_qos",jaXCt:function(s,t,n,a){return s(t,n,a)},EVvpm:function(s,t,n,a){return s(t,n,a)},iEQSO:"x_fronti"+r(597)+"k",llkXX:r(1227)+r(268)+"sgid",DVbrv:function(s,t){return s<t},WOSWx:function(s,t){return s<t},XJxdP:function(s,t){return s&t},KLFrv:r(340),gIWRP:"need_ack",uLMlg:function(s,t,n,a){return s(t,n,a)},mvXkQ:"is_ack",eeRqg:function(s,t){return s&&t},GFTVq:r(635),cPvHe:"ack_code",ddHSh:"received",KtHCp:function(s){return s()},duisN:function(s,t){return s(t)},KllJE:function(s,t){return s(t)},aFXAl:function(s,t){return s instanceof t},yCeDL:function(s,t){return s instanceof t},rguyL:"binary",QoBVa:function(s,t){return s<t},bQYcd:function(s,t){return s>>>t},lFMoX:function(s,t){return s(t)},wrYvF:function(s,t){return s+t},ykFJx:function(s,t){return s+t},Rgoin:function(s,t){return s+t},bCMOV:"index out of range: ",GjcmJ:r(1029),UKQVo:r(202),TiMLW:function(s,t){return s>t},HPLgT:r(484)+r(192)+"e",CoMNV:function(s,t,n,a){return s(t,n,a)},YaZuB:function(s,t){return s+t},jXwCt:function(s,t){return s!==t},XxiwE:r(405),VXQCE:r(507),Assii:function(s,t,n){return s(t,n)},rQZoK:function(s,t){return s<<t},ZjOaa:r(607)+"1",eRpfV:function(s,t){return s+t},uUYoT:function(s,t,n,a){return s(t,n,a)},WapSh:function(s,t){return s+t},xJnpP:function(s,t){return s|t},TkegS:function(s,t){return s|t},oAUiR:function(s,t){return s+t},LfblZ:function(s,t){return s<<t},pFhQj:function(s,t){return s|t},FNpJM:function(s,t){return s+t},ImWcw:function(s,t){return s<<t},OEICc:function(s,t){return s===t},qhFxC:r(621),Ltmvo:function(s,t){return s&t},ihFhs:function(s,t){return s+t},vVqeY:function(s,t){return s&t},nqxAi:function(s,t){return s>>>t},bBccw:function(s,t){return s+t},jQAeZ:function(s,t){return s+t},ZZlga:function(s,t,n){return s(t,n)},ijorg:function(s,t,n,a){return s(t,n,a)},DPNYx:r(1598),esZLa:r(1662),DXrYA:function(s,t){return s&t},CwJfh:function(s,t){return s+t},wIvKv:function(s,t){return s<<t},Kemzs:function(s,t){return s<<t},lpOeB:function(s,t){return s>>>t},ogYmr:function(s,t){return s|t},kayYM:function(s,t){return s&t},Hnhhw:r(578),cwuwx:function(s,t){return s+t},ZWmHh:"8|5|7|0|"+r(916)+r(290),UibZk:function(s,t,n,a){return s(t,n,a)},LOgEN:r(1518),WIRrS:function(s,t,n,a){return s(t,n,a)},vyCTO:function(s,t,n,a){return s(t,n,a)},FUVaf:"service",xhRJb:r(1024)+r(568),EvYbU:"name",SoxnS:function(s,t){return s(t)},NsqZJ:r(972)+"ile_name",aFJHS:function(s,t){return s<t},RWOGS:function(s,t,n){return s(t,n)},lizlg:r(695)+r(1418),ljiae:function(s,t,n){return s(t,n)},kkaAO:r(1421)+"ame",RyJWO:"allCursorValues",PnMzp:r(1152),mFJGx:r(557),Iegfs:function(s){return s()},qnRHo:"setdb",xXyHt:function(s,t){return s*t},hCcqk:function(s,t){return s-t},pPkfQ:"lWeXi",KLsSW:function(s,t){return s(t)},SUJIy:"setcursor",MKmSy:function(s,t){return s!=t},wOMJl:r(1084),mUIpq:function(s,t){return s===t},MJfUe:r(242),UkFzI:function(s,t,n,a){return s(t,n,a)},YOWrE:"code",gKEsq:function(s,t,n){return s(t,n)},uAcFJ:"x_frontier_msgid",LuclI:"x_fronti"+r(1634),KzhjI:r(1251)+"s",wGnqz:function(s,t,n){return s(t,n)},IXNiD:r(944)+r(1384)+"e",IVDWR:function(s,t,n){return s(t,n)},HCwGt:r(944)+r(1590)+"ue",aIlnk:function(s,t){return s+t},vsSdI:function(s){return s()},lYcQE:function(s){return s()},fWoId:function(s){return s()},hWGZs:function(s){return s()},pbVPu:function(s,t){return s===t},lcdxG:function(s){return s()},DLDMw:function(s){return s()},srVNe:"RuRqo",bQYfQ:"kFjMe",FVPVZ:"KeKGq",GOfkR:function(s,t){return s(t)},CKgYM:function(s){return s()},ocNwd:function(s){return s()},bExEn:function(s,t){return s===t},mjbmY:function(s,t,n){return s(t,n)},PDeqb:function(s){return s()},kNJiC:function(s,t,n){return s(t,n)},lAcPE:function(s,t){return s!==t},ZxvMc:r(650),ipAMo:function(s,t,n){return s(t,n)},ZalyD:function(s,t){return s===t},NlEkC:"always",yzOuH:r(1349),JjPGb:r(446),aRQOl:function(s,t){return s/t},fnBxu:r(311)+r(1420)+r(976),AoXQh:function(s,t){return s(t)},gTkMU:r(311)+r(1105)+r(235)+r(582)+r(362)+r(579)+r(1341)+"ined",lsqJS:function(s,t){return s!==t},BEDLF:r(752),XDCGu:r(819),GYbOY:r(366)+"t",DOfma:r(590)+r(325)+r(180)+"ct",rhlZm:r(633),ZpXHN:"pageshow",BwHOv:function(s,t){return s!==t},oEFmA:r(671),zOAAA:r(1487),yfJwa:r(1304),nJPCr:r(323),ZBWzQ:r(1401),qeBFt:r(311)+"rovide b"+r(1595)+r(1670)+r(1429),gcfcQ:function(s,t){return s==t},ilsXA:"fws_1.0.0",ZlExg:r(1461),aaEoL:function(s,t){return s(t)},xKbAy:function(s,t){return s!==t},KxfPJ:"afzvP",beJpy:function(s,t,n){return s(t,n)},AOTMu:function(s,t){return s===t},YMAXv:r(1603),emrVq:function(s,t,n){return s(t,n)},CPrVq:r(1411),Zaraa:function(s,t){return s>t},PyIXp:function(s,t){return s-t},dZkZC:r(422),QRYqb:function(s,t){return s(t)},mTBNJ:function(s,t){return s*t},mOzqx:function(s,t){return s>t},iSVci:function(s,t){return s===t},RmkvX:r(1327),LBDoE:r(1092)+r(863)+r(366)+r(211)+r(1098),hlXJM:function(s,t){return s<<t},ahSVi:r(1329),GvQYd:function(s,t,n){return s(t,n)},OAolO:r(452)+r(1114)+r(904)+"g",Qzvxf:function(s,t){return s(t)},KhkoG:r(469),bnXsX:r(689),yXhtp:function(s,t){return s(t)},TQBkq:r(310),CxQLi:r(538)+"3",PGpqI:function(s,t){return s===t},XJGAn:function(s,t){return s===t},CHqrw:function(s,t,n,a){return s(t,n,a)},TXDxl:function(s,t,n){return s(t,n)},hUFOb:r(321),WcBGJ:r(200),NdRaY:function(s,t,n){return s(t,n)},rLpfX:r(1092)+r(669)+r(1219)+"ine",cFRAp:function(s,t,n){return s(t,n)},mCYDX:function(s,t){return s!==t},EeSRR:r(604),aYoYb:r(382),yMnab:function(s,t){return s>t},ivvqB:function(s,t){return s&t},Vtpdq:function(s,t){return s+t},bWELc:function(s,t){return s!==t},zyjSp:"FXVcb",vYben:r(345)+r(516),QxKxB:r(485)+r(425)+"y closed",LKQal:function(s,t){return s==t},Xskci:r(311)+"rovide a"+r(472)+"ata, data must be a string or an"+r(378)+r(510),ZGtKw:function(s,t){return s!=t},lDmlh:function(s,t){return s(t)},Krcsa:function(s,t){return s instanceof t},aIIkI:function(s,t){return s instanceof t},TJQvj:r(1333),xLbNC:function(s,t){return s<t},TXkth:"enqueue",hvKsD:r(1613)+"4",oOcDw:r(1372),YhmWh:"ToTlc",telDZ:function(s,t){return s===t},htjTg:"sGdmv",dCuRs:r(1482),BynVz:function(s,t){return s*t},sCyhv:function(s,t){return s*t},azxXJ:function(s,t){return s/t},SRexA:r(1479),ZrOni:function(s,t){return s!=t},IuXtO:function(s,t){return s===t},DBGQc:r(1163)+r(1437)+r(1452)+"pe",XscYl:function(s,t){return s!=t},apUPS:r(297),jhRoO:function(s,t){return s!=t},eJkrG:function(s,t){return s!=t},vaJjA:function(s,t){return s===t},oELFd:function(s,t){return s===t},zpoqe:"ServiceW"+r(401)+r(1188),MFpbB:function(s,t){return s!=t},OUYkC:function(s,t){return s===t},zHaJO:function(s,t){return s!=t},ZanQe:function(s,t){return s!=t}};Ce.r(Y),Ce.d(Y,{FWS:()=>n0,CustomErrorEvent:()=>ps,createCloseEvent:()=>pe,ReconnectEvent:()=>gs,createErrorEvent:()=>de,decodedFrame:()=>us,createOpenEvent:()=>vs,CustomCloseEvent:()=>ms,createReconnectEvent:()=>or,FrontierMessageEvent:()=>_s,encodeFrame:()=>ir,createMessageEvent:()=>bs,OpenEvent:()=>ys,ErrorCode:()=>qe,Event:()=>st,MessageEvent:()=>ws});let i="";function o(s=""){let t=r;if(e.wlwRp(e[t(799)],e[t(1389)]))return null;{let a=""+Date[t(299)](),u=i||(i=g(s)),p=Math[t(357)]()[t(197)](16)[t(596)](-6);return e[t(741)](e[t(1069)](e[t(926)]("02",a),u),p)}}function c(){let s=r;return e[s(745)](1e4,Date[s(299)]())+Math[s(1377)](1e4*Math[s(357)]())}function x(s){let t=r;return e[t(1456)]==="yrWHK"?_0x27cd32||(_0x39534f=[_0x4c89ff,_0x2028c4,_0xfb2cc7,_0x5333dd,_0x3d662c]):(e[t(398)](Array,8)[t(969)]("0")+parseInt(s,10).toString(2))[t(596)](-8)}function f(s){let t=r;return e[t(692)](e[t(398)](Array,4)[t(969)]("0"),parseInt(s,2)[t(197)](16)).slice(-4)}function d(s){let t=r,n=s.split(/\./)[t(1259)](p=>x(p)),a=[];return a[0]=e[t(398)](f,e[t(1651)](n[0],n[1])),a[1]=e[t(823)](f,e[t(459)](n[2],n[3])),[e.UbWCF,e[t(1441)],e[t(1441)],e[t(1441)],e[t(1441)],t(1556),a[0],a[1]][t(969)]("")}function g(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(165)](s),a=/(([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(165)](s);return n?e.tOdAD(d,s):a?w(s):e[t(875)]}function w(s){let t=r,n={keOjA:function(_,v){return _ instanceof v},yZFhy:function(_,v){return _ instanceof v},ipFIV:e[t(630)],lVsFX:function(_,v){return e[t(1328)](_,v)},DPmRb:e[t(717)]},a="",u=[],p=0,h=0,m=!0,l=e.UbWCF;if(e.vFnQR(s.indexOf("::"),-1))if(e.RbJOC(e[t(1386)],t(849))){let _=s[t(460)]("::");for(let A=0;e[t(1398)](A,_[t(1620)]);A++)if(e[t(687)](e[t(891)],t(539))){let N=_[A];if(e.krYLt(N[t(1648)](":"),0)){let R=N[t(460)](":");m&&(p=R[t(1620)]),h+=R[t(1620)];for(let O=0;e[t(308)](O,R.length);O++)if(e.mlFmS(4,R[O].length)){let ie=l[t(1388)+"g"](0,4-R[O][t(1620)]),ce=ie[t(1419)](R[O]);u[t(251)](ce)}else u[t(251)](R[O]);m=!1}else if(e[t(687)]("Tujrd",e[t(451)])){if(e[t(1644)](4,N.length)){let R=l.substring(0,e[t(289)](4,N[t(1620)])),O=R.concat(N);u[t(251)](O)}else u[t(251)](N);m&&(p+=1),h+=1,m=!1}else this[t(1165)]&&this[t(1165)].close(_0x33bd92,_0x219745)}else{if(_0x45198d)return new _0x26c2f8(_0x169ff3[t(1045)],_0x37b2ee[t(402)]);if(_0xebb754||_0x2d4ded)return new _0x300e97(_0x436ae9.url,_0x57c396[t(402)],_0x28cb46.headers);if(e[t(254)](_0x1c3036,_0x32bae7)&&e[t(359)](e[t(577)],typeof _0x52148a)&&_0x184f2f)return new _0xfe1c7e(_0x2f22a3[t(1045)],_0x5d5496[t(402)+"s"])}let v="";for(let A=0;e.PDGrM(A,e.ZgdZA(8,h));A++)v=v.concat(l);for(let A=0;e[t(308)](A,u[t(1620)]);A++)e[t(687)](A,p)&&(a=a[t(1419)](v)),a=a[t(1419)](u[A]);return a}else return this[t(1165)]?this[t(1165)][t(402)]:"";{let _=s[t(460)](":");for(let v=0;e[t(1183)](v,_.length);v++)if(e.RJRYw(e[t(658)],t(1138))){let A=_[v];if(e[t(233)](4,_[v][t(1620)])){let N=l[t(1388)+"g"](0,e[t(289)](4,_[v][t(1620)])),R=N[t(1419)](A);a=a[t(1419)](R)}else a=a[t(1419)](A)}else try{return t(1435)!=typeof _0x4dc93b&&(n[t(513)](_0x554fd4,_0x42fa3b)||_0x5d81f7[t(506)]&&n[t(1062)](_0x1aefa7[t(506)],_0x58ac6d))||typeof _0x24779b!="string"?"":(_0x485c8e[t(524)](_0x53d091),n[t(296)])}catch{return n[t(877)](t(1435),typeof _0x832a88)?n[t(188)]:""}return a}}function b(s,t){let n=r;if(e[n(1249)]!==e[n(1249)])return _0x88c35f&&e[n(1387)](!0,_0x52d4d2.isLong);{let a=s[n(548)];e[n(614)](void 0,a)&&(J(t,10),be(t,a));let u=s[n(183)];e[n(1644)](void 0,u)&&(J(t,18),e[n(760)](be,t,u))}}function y(s){let t=r,n={};e:for(;!ke(s);){let a=e.MFmaL(K,s);switch(e[t(304)](a,3)){case 0:break e;case 1:n[t(548)]=e.WddEc(ye,s,e[t(823)](K,s));break;case 2:n[t(183)]=e[t(1023)](ye,s,K(s));break;default:e[t(760)](re,s,e[t(349)](7,a))}}if(n[t(548)]===void 0)throw new Error(e.GONtZ);if(e[t(687)](void 0,n.value))throw new Error(e[t(490)]);return n}function C(s){let t=r,n=e[t(1560)](ae);return e[t(760)](P,s,n),e.dMJtd(j,n)}function P(s,t){let n=r;if(e[n(1644)](e[n(1316)],e.QiwQG)){let a=s.SeqID;e[n(1644)](void 0,a)&&(e[n(1370)]("nHQqH",e.EZmvK)?(this[n(520)+n(1660)]=_0x49a4ae,this._cursorFileName=_0x153778,this[n(431)+n(161)]=_0x41935b,this[n(1184)]=e[n(1156)](_0xb4bee3,this[n(520)+n(1660)],n(1421)+"ame")):(J(t,8),St(t,a)));let u=s[n(417)];e[n(173)](void 0,u)&&(e[n(256)](J,t,16),e[n(256)](St,t,u));let p=s[n(249)];e.xdFzX(void 0,p)&&(e[n(1156)](J,t,24),e.vuCYk(St,t,e[n(159)](Q,p)));let h=s.method;e.BfdBk(void 0,h)&&(e[n(760)](J,t,32),e.vuCYk(St,t,e[n(847)](Q,h)));let m=s.headers;if(e[n(1099)](void 0,m))for(let ie of m){J(t,42);let ce=e[n(1194)](ae);b(ie,ce),e.AKAFu(J,t,ce[n(1466)]),e[n(977)](Jt,t,ce),e.lDePF(D,ce)}let l=s["payloadE"+n(320)];e.NJPmC(void 0,l)&&(e[n(1023)](J,t,50),e[n(977)](be,t,l));let _=s["payloadT"+n(1237)];_!==void 0&&(e[n(893)](J,t,58),e[n(256)](be,t,_));let v=s[n(1207)];e[n(470)](void 0,v)&&(e.WMroi(J,t,66),e.RNWbC(J,t,v.length),e[n(1638)](jt,t,v));let A=s[n(352)];e[n(233)](void 0,A)&&(e[n(853)](J,t,74),e[n(444)](be,t,A));let N=s[n(492)+n(419)];e[n(508)](void 0,N)&&(e[n(1223)](J,t,82),e.kfPVE(be,t,N));let R=s[n(284)];R!==void 0&&(e[n(1079)]==="ipktL"?(J(t,90),e.cdwXw(be,t,R)):(this[n(1412)](e[n(544)],_0x173996),this[n(552)+"e"]&&this[n(552)+"e"](_0x3cb98e)));let O=s[n(447)+"e"];O!==void 0&&(J(t,96),e.suwHa(St,t,Q(O)))}else return new _0xfee87(_0x240748,{code:_0xd0e5c2,reason:_0x5dcfba,wasClean:_0x346c8d,willReconnect:_0x1608b5})}function I(s){return T(e.GCMwy(q,s))}function T(s){let t=r;if(e[t(1455)](e[t(1310)],e[t(1272)]))_0x27ca1b(_0xdc3803,10),e[t(256)](_0x2bb230,_0x37b59b,_0x3606d5);else{let n={};e:for(;!e[t(1351)](ke,s);){let a=K(s);switch(a>>>3){case 0:break e;case 1:n.SeqID=e[t(1674)](Pe,s,!0);break;case 2:n[t(417)]=e[t(1339)](Pe,s,!0);break;case 3:n[t(249)]=e.gCTCg(K,s);break;case 4:n[t(1083)]=e.IvFWe(K,s);break;case 5:{let u=e[t(598)](z,s);(n[t(1340)]||(n[t(1340)]=[]))[t(251)](y(s)),s[t(1466)]=u;break}case 6:n[t(230)+t(320)]=e[t(1023)](ye,s,e[t(742)](K,s));break;case 7:n[t(1195)+t(1237)]=e[t(760)](ye,s,e.yYUNd(K,s));break;case 8:n.payload=e[t(629)](vt,s,e[t(1332)](K,s));break;case 9:n.LogIDNew=e[t(1270)](ye,s,e.TzedB(K,s));break;case 10:n[t(492)+"ming"]=ye(s,K(s));break;case 11:n[t(284)]=e[t(843)](ye,s,e[t(693)](K,s));break;case 12:n.frameType=e[t(1351)](K,s);break;default:e[t(256)](re,s,e[t(940)](7,a))}}if(e[t(687)](void 0,n[t(909)]))throw new Error(t(1350)+"required field: "+t(909));if(e[t(1433)](void 0,n.LogID))throw new Error(e[t(1476)]);if(n.service===void 0)throw new Error(t(1350)+t(1048)+t(587)+t(249));if(e[t(252)](void 0,n.method))throw new Error(e.VJehl);return n}}function z(s){let t=r,n=K(s),a=s[t(1466)];return s.limit=e[t(1069)](s[t(983)],n),a}function re(s,t){let n=r;switch(t){case 0:for(;e[n(940)](128,se(s)););break;case 2:e[n(224)](Z,s,e.pkJgn(K,s));break;case 5:e[n(760)](Z,s,4);break;case 1:e.AKAFu(Z,s,8);break;default:throw new Error(e[n(1651)](e.htlrg,t))}}function Q(s){let t=r;return s|=0,{low:s,high:e[t(798)](s,31),unsigned:e[t(606)](s,0)}}let _e=[];function ae(){let s=r,t=_e.pop();return t?(t[s(983)]=t[s(1466)]=0,t):{bytes:new Uint8Array(64),offset:0,limit:0}}function D(s){_e.push(s)}function q(s){return{bytes:s,offset:0,limit:s[r(1620)]}}function j(s){let t=r,n=s[t(385)],a=s[t(1466)];return e.tAKWU(n.length,a)?n:n[t(1220)](0,a)}function Z(s,t){let n=r,a={KTBel:function(u,p){return e[k(731)](u,p)},HzXIQ:n(743)+"in;chars"+n(1255),piHza:e[n(1490)],HGuCd:e[n(1118)],XEqEK:e[n(1553)],oSkHn:n(956),Fquiq:function(u,p,h,m){return e[n(384)](u,p,h,m)}};if(e.nMjXx(e[n(380)],n(1469))){if(e.kBVrP(e.SGJdK(s[n(983)],t),s[n(1466)]))throw new Error(e[n(1292)]);s[n(983)]+=t}else{let u=a[n(1457)](this[n(163)][n(230)+n(320)],_0x5485a0)?{force:!!this[n(163)][n(230)+"ncoding"].force,encoding:this[n(163)]["payloadE"+n(320)][n(993)]?this[n(163)][n(230)+n(320)][n(993)].replace(/\s/g,"")["toLowerC"+n(337)]():""}:{force:!1,encoding:this._options[n(230)+"ncoding"]?this[n(163)][n(230)+n(320)][n(1317)](/\s/g,"")["toLowerC"+n(337)]():""},p=_0x91a7e6[n(230)+n(320)]?_0x4591b8[n(230)+"ncoding"][n(1317)](/\s/g,"")[n(1077)+"ase"]():"",h=a[n(1457)](this._options.payloadType,_0x4d7f44)?{force:!!this._options[n(1195)+"ype"][n(766)],type:this[n(163)][n(1195)+n(1237)][n(1307)]?this[n(163)][n(1195)+n(1237)][n(1307)].replace(/\s/g,"")[n(1077)+n(337)]():""}:{force:!1,type:this[n(163)]["payloadT"+n(1237)]?this[n(163)][n(1195)+n(1237)].replace(/\s/g,"")[n(1077)+n(337)]():""},m=_0x5ef06f[n(1195)+n(1237)]?_0x132bf2[n(1195)+n(1237)][n(1317)](/\s/g,"")[n(1077)+"ase"]():"",l=h[n(766)]?h.type:m||h[n(1307)],_=u[n(766)]?u[n(993)]:p||u[n(993)],v=[a.HzXIQ,"applicat"+n(1596),a[n(754)],a[n(246)]],A=[a[n(1169)],a.oSkHn];this._options[n(947)+"ansformTextPayload"]&&v[n(1131)](l)&&(!_||A[n(1131)](_))?_0x206145["textPayl"+n(1500)]=a[n(749)](_0x216d8f,_0x9edf5a[n(1207)],0,_0x1b805b[n(1207)].byteLength):_0x2a62b3[n(370)+n(1500)]=""}}function ke(s){let t=r;return s[t(983)]>=s[t(1466)]}function ge(s,t){let n=r,a=s[n(385)],u=s.offset,p=s[n(1466)],h=e[n(459)](u,t);if(e[n(1041)](h,a[n(1620)])){let m=new Uint8Array(e.WjQiS(2,h));m[n(885)](a),s[n(385)]=m}return s[n(983)]=h,e[n(910)](h,p)&&(s[n(1466)]=h),u}function Ve(s,t){let n=r;if(e[n(173)](e[n(1178)],e[n(1178)]))this[n(751)+"er"]&&_0x1ae108[n(923)+"entListe"+n(231)](e.bCODv,this._handleOnLine),this._isBrowser&&_0x22de46[n(923)+n(1204)+n(231)](e[n(1291)],this[n(1640)+"ffLine"]),this[n(751)+"er"]&&_0x54e73a[n(923)+n(1204)+"ner"](e[n(673)],this["_handleP"+n(709)]),this[n(751)+"er"]&&_0x37d1b2[n(923)+n(1204)+n(231)](n(933),this._handlePageShow);else{let a=s[n(983)];if(e[n(741)](a,t)>s[n(1466)])throw new Error(e[n(1051)]);return s.offset+=t,a}}function vt(s,t){let n=r,a=e[n(777)](Ve,s,t);return s.bytes[n(1220)](a,e.aIJoC(a,t))}function jt(s,t){let n=r,a=ge(s,t[n(1620)]);s[n(385)][n(885)](t,a)}function ye(s,t){let n=r,a=e[n(1270)](Ve,s,t),u=String[n(1352)+n(487)],p=s[n(385)],h="\uFFFD",m="";for(let l=0;l<t;l++){let _=p[l+a],v,A,N,R;if(e.oBKju(e[n(349)](128,_),0))m+=e[n(676)](u,_);else if(e[n(1381)](224&_,192))if(e.aaazC(l,1)>=t)m+=h;else if(v=p[e[n(896)](e[n(1069)](l,a),1)],e.yXuYW(192,v)!==128)m+=h;else if(R=e[n(706)](e.hfUom(e[n(940)](31,_),6),e[n(1394)](63,v)),e[n(837)](R,128))m+=h;else if(e[n(1608)]("IEtPO",e[n(403)]))m+=e[n(1612)](u,R),l++;else{let O=this._qosDB[n(954)+n(714)+"nc"](this[n(1522)]),ie=_0x193ff1[n(524)](e.WPuMK(O,"{}"));return _0x28cc2a[n(257)](ie)}else if((240&_)==224)if(e[n(606)](e.rZTTv(l,2),t))m+=h;else if(e[n(1433)](e[n(1185)],e[n(1185)]))v=p[e[n(741)](e[n(1142)](l,a),1)],A=p[e.tyQyO(e[n(1572)](l,a),2)],e[n(233)](e.gvPyz(e.nyMaF(v,e[n(1363)](A,8)),49344),32896)?m+=h:(R=e.mqCMZ(e[n(1451)](e.hfUom(e.POiXI(15,_),12),e[n(840)](e[n(1526)](63,v),6)),e[n(1394)](63,A)),R<2048||e.bOGwF(R,55296)&&R<=57343?m+=h:(m+=e[n(999)](u,R),l+=2));else{let{url:O}=e[n(816)](_0x44c18f,{}),ie=_0x3ba679[n(171)](O)?O:e.hyNJv(e[n(1118)],typeof O)?[O]:[];_0x5d5c96&&_0x4c8a9c[n(1038)](this[n(163)],_0x4214d0),ie&&ie[n(1620)]?this["_endpoin"+n(1117)]=new _0x33be74(ie,this._options[n(326)+"es"]):this[n(1287)+"tManager"]?.[n(1657)+n(1124)+n(1072)](),this._pingLossCounter?.[n(273)+n(1355)](this[n(163)][n(281)+"Count"]),this[n(1414)+n(626)]=!1,this[n(1165)]&&e[n(173)](this[n(1165)][n(1110)+"te"],this[n(1449)])?this[n(387)+"ect"](1e3,e[n(1408)],!0):(this[n(314)]=!0,this[n(989)]())}else e[n(940)](248,_)==240?e.bOGwF(l+3,t)?m+=h:(v=p[e[n(1160)](e[n(1069)](l,a),1)],A=p[e[n(1160)](l+a,2)],N=p[e[n(896)](e[n(1160)](l,a),3)],e[n(349)](e.kPCuh(v|e[n(1123)](A,8),e.svlZJ(N,16)),12632256)!==8421504?m+=h:(R=e.nyMaF(e.JjxYl(e.FCRmi(7&_,18),e[n(825)](e[n(1394)](63,v),12))|e[n(1468)](e[n(1630)](63,A),6),e[n(1526)](63,N)),R<65536||R>1114111?m+=h:e[n(922)]===e.VpFbo?_0x434f28[n(775)](_0x57708f):(R-=65536,m+=e[n(1674)](u,e[n(1572)](e.PLpDJ(R,10),55296),e[n(1651)](e[n(1607)](1023,R),56320)),l+=3))):m+=h}return m}function be(s,t){let n=r,a={gxerK:function(l,_){return l(_)}},u=t[n(1620)],p=0;for(let l=0;e[n(837)](l,u);l++){let _=t.charCodeAt(l);e.bOGwF(_,55296)&&_<=56319&&e.RXAbU(e[n(1619)](l,1),u)&&(_=e[n(1559)](e[n(1123)](_,10)+t[n(1499)+"At"](++l),56613888)),p+=e[n(1183)](_,128)?1:e.VbgeG(_,2048)?2:_<65536?3:4}e[n(584)](J,s,p);let h=e[n(1674)](ge,s,p),m=s.bytes;for(let l=0;e[n(194)](l,u);l++){let _=t.charCodeAt(l);e.bOGwF(_,55296)&&e[n(440)](_,56319)&&e[n(491)](e[n(1572)](l,1),u)&&(_=e[n(1059)](e[n(1174)](e[n(646)](_,10),t.charCodeAt(++l)),56613888)),e.lkNxC(_,128)?m[h++]=_:e[n(1387)](e.FNbMP,e[n(984)])?(e[n(194)](_,2048)?m[h++]=e[n(1210)](e[n(726)](_,6),31)|192:(e.nNLHu(_,65536)?m[h++]=e[n(1006)](e[n(798)](_,12),15)|224:(m[h++]=e[n(706)](_>>18&7,240),m[h++]=e[n(725)](e[n(1607)](e[n(726)](_,12),63),128)),m[h++]=e.ZSDPY(e[n(798)](_,6),63)|128),m[h++]=e[n(706)](e[n(1006)](63,_),128)):_0x3de399(ViLMfD[n(426)](_0x18bc81,_0x3f6018[n(585)]),_0x23c599[n(465)+"on"],_0x9c94ef[n(920)+"on"],_0xfd4be(_0x270c3e[n(770)+n(327)]))}}function Jt(s,t){let n=r;if(e.xdFzX(e.YrniR,n(196))){let a=ge(s,t.limit),u=s[n(385)],p=t[n(385)];for(let h=0,m=t[n(1466)];e[n(1542)](h,m);h++)u[h+a]=p[h]}else _0x34336a[n(307)]()[n(1e3)](()=>{let a=n;this[a(1305)+a(727)]()})}function se(s){return s[r(385)][e.kfPVE(Ve,s,1)]}function Vt(s,t){let n=r,a=e.JotkY(ge,s,1);s[n(385)][a]=t}function K(s){let t=r,n=0,a=0,u;do u=e[t(598)](se,s),e[t(783)](n,32)&&(a|=e[t(1468)](e[t(393)](127,u),n)),n+=7;while(e.hYTXe(128,u));return a}function J(s,t){let n=r;for(t>>>=0;t>=128;)e[n(252)]("GkSZW",e[n(1244)])?(e[n(1578)](Vt,s,e.klfFW(127&t,128)),t>>>=7):(CSsDJD[n(693)](_0x9d436,_0x431a27[n(939)]),CSsDJD[n(501)](_0x59b347));e.EnKdD(Vt,s,t)}function Pe(s,t){let n=r,a=0,u=0,p=0,h;return h=e.yYUNd(se,s),a=e.kFCEh(127,h),e[n(1512)](128,h)&&(h=e[n(1233)](se,s),a|=e[n(728)](e[n(1150)](127,h),7),e[n(283)](128,h)&&(h=e[n(598)](se,s),a|=e[n(168)](e[n(1135)](127,h),14),e.sCAUC(128,h)&&(h=e[n(1151)](se,s),a|=e[n(1665)](e[n(267)](127,h),21),e.rLSfM(128,h)&&(h=e[n(1464)](se,s),u=127&h,e.WldRR(128,h)&&(h=e[n(1060)](se,s),u|=e[n(168)](e.Luxnm(127,h),7),e[n(1630)](128,h)&&(h=e[n(742)](se,s),u|=e[n(392)](127,h)<<14,128&h&&(h=e[n(1472)](se,s),u|=e[n(1337)](e[n(511)](127,h),21),e[n(1100)](128,h)&&(h=e[n(742)](se,s),p=e[n(283)](127,h),e.rLSfM(128,h)&&(h=e[n(693)](se,s),p|=e.rLSfM(127,h)<<7))))))))),{low:a|e[n(586)](u,28),high:e[n(897)](e[n(1654)](u,4),e.rMfQP(p,24)),unsigned:t}}function St(s,t){let n=r,a=e[n(304)](t[n(371)],0),u=e.dUNcv(t[n(371)]>>>28|e[n(1297)](t[n(1075)],4),0),p=t.high>>>24,h=e.IaOzi(0,p)?e[n(223)](0,u)?e.BnScK(a,16384)?e[n(1189)](a,128)?1:2:e.IfPnD(a,2097152)?3:4:u<16384?e.nrPOu(u,128)?5:6:e[n(905)](u,2097152)?7:8:e[n(1519)](p,128)?9:10,m=e[n(854)](ge,s,h),l=s[n(385)];switch(h){case 10:l[m+9]=e[n(1655)](p>>>7,1);case 9:l[e.Eqabe(m,8)]=e.UvXhX(9,h)?e[n(725)](128,p):127&p;case 8:l[e[n(1232)](m,7)]=e[n(1049)](8,h)?e[n(1393)](e[n(304)](u,21),128):e[n(1394)](u>>>21,127);case 7:l[e.LOHLY(m,6)]=e[n(856)](7,h)?e[n(1473)](u>>>14,128):e[n(489)](e[n(1318)](u,14),127);case 6:l[e[n(1174)](m,5)]=e[n(895)](6,h)?e.dUNcv(u,7)|128:e[n(392)](u>>>7,127);case 5:l[e[n(764)](m,4)]=h!==5?128|u:e.lpMBV(127,u);case 4:l[e[n(1496)](m,3)]=e[n(1514)](4,h)?e[n(1258)](e[n(247)](a,21),128):e[n(940)](e[n(767)](a,21),127);case 3:l[e.rZTTv(m,2)]=e.RjeHz(3,h)?e.RFcAb(e[n(1242)](a,14),128):e[n(832)](e.GGTnW(a,14),127);case 2:l[e[n(164)](m,1)]=e.ygboJ(2,h)?e[n(706)](e[n(1253)](a,7),128):e[n(266)](e[n(1628)](a,7),127);case 1:l[m]=e[n(1525)](1,h)?e[n(318)](128,a):e.qdREp(127,a)}}function us(s){return e[r(876)](I,s)}function ir(s){return C(s)}let fs=65536,la=r(925),rt=e[r(1120)](fs,fs),ds=e[r(1378)](rt,rt),ls=e[r(915)](ds,2),ze=String.prototype[r(1499)+"At"];class M{constructor(t,n,a){let u=r;this[u(1558)]=!0,this[u(371)]=e[u(318)](0,t),this.high=0|n,this[u(278)]=!!a}static[r(1558)](t){return t&&t[r(1558)]===!0}static[r(1367)](t,n,a){return new M(t,n,a)}static[r(677)+"s"](t,n,a){let u=r;return a?M[u(677)+u(1562)](t,n):M[u(677)+u(1324)](t,n)}static[r(677)+r(1562)](t,n){let a=r;return new M(e[a(725)](e[a(706)](e[a(725)](t[0],e.hfUom(t[1],8)),e[a(347)](t[2],16)),e[a(347)](t[3],24)),e[a(941)](e[a(1451)](e[a(1258)](t[4],e[a(589)](t[5],8)),e[a(840)](t[6],16)),e[a(1123)](t[7],24)),n)}static["fromByte"+r(1324)](t,n){let a=r;if(e.qqiQr(e[a(973)],e[a(1139)]))return new M(e.mqCMZ(e[a(674)](t[4]<<24|e[a(988)](t[5],16),t[6]<<8),t[7]),e[a(1258)](e[a(1095)](t[0]<<24,e[a(864)](t[1],16)),e[a(1468)](t[2],8))|t[3],n);_0x219812[a(775)](_0x183c98)}static[r(1282)](t){let n=r;return e[n(158)](t,la)?hs:new M((ze.call(t,0)|e.wSSHu(ze[n(1407)](t,1),8)|ze[n(1407)](t,2)<<16|e.tFOfr(ze[n(1407)](t,3),24))>>>0,e[n(1628)](e[n(1239)](e[n(386)](ze[n(1407)](t,4),e[n(825)](ze[n(1407)](t,5),8)),e[n(1665)](ze[n(1407)](t,6),16))|e.rMfQP(ze[n(1407)](t,7),24),0),!0)}toHash(){let t=r;return e.RbJOC(e[t(1520)],t(1036))?_0x396361[t(1037)+"8"]?{value:_0x160db2.readUInt8(_0xeb44c3),offset:e[t(1174)](_0x2a0c0f,1)}:{value:e[t(393)](255,_0x296fff[_0x18e83c]),offset:e[t(420)](_0x5a48d5,1)}:String[t(1352)+t(487)](e.ynpUJ(255,this[t(371)]),e.TFsBg(e[t(1654)](this[t(371)],8),255),e.Uigis(e[t(1253)](this[t(371)],16),255),e[t(562)](this[t(371)],24),e.sCAUC(255,this[t(1075)]),e[t(1394)](e.wAAiP(this[t(1075)],8),255),e[t(1458)](this[t(1075)]>>>16,255),e[t(364)](this.high,24))}static fromNumber(t,n=!0){let a=r;if(e[a(862)](isNaN,t))return n?ha:hs;if(n){if(t>=ds)return pa}else{if(e[a(440)](t,-ls))return ma;if(e[a(606)](e[a(1651)](t,1),ls))return ga}return M.fromBits(e.OZUhm(t,rt)|0,e[a(706)](t/rt,0),n)}[r(1617)](){let t=r;return this[t(278)]?e[t(420)](e[t(1240)](this[t(1075)]>>>0,rt),this.low>>>0):e[t(1503)](e[t(745)](this[t(1075)],rt),this[t(371)]>>>0)}[r(917)](){let t=r;return e.xWuVv(0,this[t(1075)])&&e[t(1546)](0,this[t(371)])}[r(848)](t){let n=r;M.isLong(t)||(t=M[n(1164)+"er"](t));let a=e[n(562)](this[n(1075)],16),u=e[n(1427)](65535,this.high),p=e[n(1431)](this.low,16),h=e[n(1458)](65535,this[n(371)]),m=e[n(1654)](t.high,16),l=e.kFCEh(65535,t[n(1075)]),_=t.low>>>16,v=e[n(737)](65535,t[n(371)]),A=0,N=0,R=0,O=0;return O+=e[n(459)](h,v),R+=e[n(247)](O,16),O&=65535,R+=e[n(896)](p,_),N+=e[n(1654)](R,16),R&=65535,N+=e[n(1174)](u,l),A+=e[n(1242)](N,16),N&=65535,A+=a+m,A&=65535,M[n(1367)](e[n(706)](e.rMfQP(R,16),O),e.GbMjE(A,16)|N,this.unsigned)}[r(784)](t){let n=r;return M[n(1558)](t)||(t=M.fromNumber(t)),e[n(1382)](this[n(278)],t[n(278)])&&e[n(334)](e[n(950)](this[n(1075)],31),1)&&e[n(1663)](e[n(1480)](t[n(1075)],31),1)?!1:e[n(1495)](this[n(1075)],t[n(1075)])&&e[n(1495)](this[n(371)],t[n(371)])}[r(640)](){let t=r;return e.mlGPh(-1,this.low)&&e.aNdZY(-1,this[t(1075)])?M[t(1367)](0,0,this[t(278)]):e[t(685)](-1,this[t(371)])?M[t(1367)](0,e.iuJRn(this.high,1),this.unsigned):M[t(1367)](e[t(535)](this[t(371)],1),this[t(1075)],this[t(278)])}toBytes(t){let n=r;return t?this[n(551)+"E"]():this[n(374)+"E"]()}[r(551)+"E"](){let t=r,n=this[t(1075)],a=this[t(371)];return[e[t(361)](255,a),e[t(189)](a>>>8,255),a>>>16&255,a>>>24,e[t(1286)](255,n),e[t(1150)](e.fYAKd(n,8),255),e[t(767)](n,16)&255,e[t(950)](n,24)]}[r(374)+"E"](){let t=r,n=this[t(1075)],a=this[t(371)];return[e.LSeNz(n,24),e[t(1630)](n>>>16,255),e[t(511)](e[t(547)](n,8),255),e[t(1286)](255,n),e.bfgSg(a,24),e.psCYn(e[t(845)](a,16),255),e[t(1376)](a>>>8,255),e[t(1569)](255,a)]}}let hs=new M(0,0,!1),ha=new M(0,0,!0),ga=M.fromBits(-1,2147483647,!1),pa=M[r(1367)](-1,-1,!0),ma=M[r(1367)](0,-2147483648,!1);var qe=(function(s){let t=r;return s[s[e[t(1234)]]=5001]=e[t(1234)],s[s[e.VUJEL]=5002]=e[t(1005)],s[s[e.LcPhH]=5003]=e[t(1601)],s[s[e.lAxtk]=5004]=e.lAxtk,s[s[e.iRlGs]=5005]=e[t(887)],s})({});class st{constructor(t){let n=r;this[n(1307)]=t,this[n(911)]=null}}class gs extends st{constructor(t,n){let a=r;super(t),this.message=n&&n[a(1200)]||null}}class ps extends st{constructor(t,n){let a=r;if(e[a(486)](e[a(1055)],e[a(1104)]))this._listeners={};else{let u=e[a(477)].split("|"),p=0;for(;;){switch(u[p++]){case"0":super(t);continue;case"1":this[a(1200)]=n&&n[a(1200)]||"";continue;case"2":this[a(443)]=n&&n.colno||0;continue;case"3":this[a(1497)]=n&&n[a(1497)]||"";continue;case"4":this[a(545)]=n&&n[a(545)]||0;continue;case"5":this.error=n&&n[a(939)]||null;continue;case"6":this[a(793)]=n&&n[a(793)]||5001;continue}break}}}}class ms extends st{constructor(t,n){let a=r,u=e[a(1504)][a(460)]("|"),p=0;for(;;){switch(u[p++]){case"0":super(t);continue;case"1":this[a(793)]=n&&n.code||0;continue;case"2":this[a(942)]=n&&n[a(942)]||"";continue;case"3":this[a(195)]=n&&n.wasClean||!1;continue;case"4":this["willReco"+a(232)]=n&&n[a(914)+a(232)]||!1;continue}break}}}class ws extends st{constructor(t,n){let a=r;e[a(1191)](e[a(1616)],e[a(1616)])?(super(t),this[a(1436)]=n&&n[a(1436)]||null):_0x30a5d9&&this[a(1397)+a(694)][a(1637)+"rsorFile"+a(1217)](_0x11af2b)}}class _s extends ws{constructor(t,n){let a=r;super(t),this.data=n&&n[a(1436)]||null,this[a(1200)]=n&&n.message||null}}class ys extends st{constructor(t,n){let a=r;super(t),this[a(1436)]=n&&n[a(1436)]||null}}function de(s,{message:t,code:n,error:a}){let u=r;if(e[u(519)](e[u(350)],e.NjoNf))return new ps(s,{message:t,code:n,error:a});{let p=_0x4b8411[u(460)](":");_0x30616a&&(_0x1df70c=p.length),_0x50f9e9+=p[u(1620)];for(let h=0;e[u(458)](h,p[u(1620)]);h++)if(e[u(1514)](4,p[h][u(1620)])){let m=_0x57aead[u(1388)+"g"](0,e[u(204)](4,p[h][u(1620)])),l=m[u(1419)](p[h]);_0x305b3e[u(251)](l)}else _0x373c78.push(p[h]);_0x1aa6b5=!1}}function pe(s,{code:t,reason:n,wasClean:a,willReconnect:u}){return new ms(s,{code:t,reason:n,wasClean:a,willReconnect:u})}function bs(s,{data:t,message:n}){let a=r;return e.kTCaD(e.Jldxb,a(1313))?new _s(s,{data:t,message:n}):e.hyNJv(e[a(1118)],typeof _0x5a3f8a)?e.oNftm:""}function vs(s,{data:t}){return new ys(s,{data:t})}function or(s,{message:t}){return new gs(s,{message:t})}class Ss{constructor(t,n){let a=r;this[a(1415)+"s"]=t,this[a(326)+"es"]=n,this[a(946)+a(286)]=0,this[a(1425)+a(1168)+"riesCount"]=0}[r(1657)+r(1124)+r(1072)](){let t=r;this["currentI"+t(286)]=0,this[t(1425)+t(1168)+t(634)+"t"]=0}resetTries(){let t=r;this[t(1425)+t(1168)+t(634)+"t"]=0}[r(1539)+r(319)+"nt"](){let t=r;return this[t(1415)+"s"][this[t(946)+"ndex"]]}[r(1539)+r(319)+r(698)+"ount"](){let t=r;return this[t(1425)+t(1168)+t(634)+"t"]}checkReachMaxTries(){let t=r;if(e[t(519)](e[t(1439)],e[t(838)]))return!!(e.bOGwF(this[t(946)+"ndex"],this[t(1415)+"s"][t(1620)])||e.kTCaD(this["currentI"+t(286)],this[t(1415)+"s"].length-1)&&this["currentE"+t(1168)+t(634)+"t"]===this[t(326)+"es"]);{let n=0,a=[];for(;e[t(1477)](n,_0x39f8c4.byteLength);){let{offset:u}=_0xa8a7ce(_0x151849,n);n=u;let p={cursor_name:"",cursor:0,service:0},{value:h,offset:m}=e[t(170)](_0x26d27f,_0x1e74b8,n);p.service=h,n=m;let{value:l,offset:_}=e[t(629)](_0x5b7439,_0x2d96ad,n);n=_,p[t(1421)+"ame"]=e[t(561)](_0x2520b3,_0x19819b,n,e.jTPuX(n,l)),n+=l;let{value:v,offset:A}=e[t(1023)](_0x117a7e,_0x20f01e,n);p[t(1026)]=v[t(1617)](),n=A,a.push(p)}return a}}[r(531)+r(1030)+r(718)+r(336)+"tries"](){let t=r;return e[t(1328)](this[t(946)+t(286)],this.endpoints.length)?!0:this[t(1425)+"ndpointT"+t(634)+"t"]>this[t(326)+"es"]}["replaceB"+r(1312)+r(932)+r(495)+r(841)](){let t=r;if(t(449)==="CUter")return this[t(1425)+"ndpointT"+t(634)+"t"]=1,this[t(946)+"ndex"]++,this[t(1415)+"s"][this.currentIndex];_0x4c66d6-=65536,_0x23ceba+=e[t(1646)](_0x511d3e,e[t(1584)](e[t(726)](_0x1a1805,10),55296),e[t(1645)](e[t(1087)](1023,_0x49d69a),56320)),_0x3da071+=3}[r(1539)+r(319)+r(373)+"ateCount"](){let t=r;return this[t(1425)+t(1168)+t(634)+"t"]++,this[t(1539)+"ntEndpoint"]()}}let it=(e[r(577)]!=typeof globalThis&&e[r(1121)](e[r(730)],globalThis[r(248)+r(497)][r(568)])||e[r(1293)](e.NbMhP,typeof window)&&e[r(1177)](r(1479),window[r(248)+r(497)][r(568)]))&&e[r(182)](e[r(577)],typeof document),Ye=e[r(1293)](e.NbMhP,typeof globalThis)&&(e[r(1063)](r(297),globalThis[r(248)+r(497)].name)||e[r(1281)]===globalThis[r(248)+r(497)][r(568)])&&e[r(1211)](e[r(577)],typeof tt),Ct=(e[r(577)]!=typeof globalThis&&e[r(464)](e[r(811)],globalThis["construc"+r(497)][r(568)])||e[r(645)](e[r(577)],typeof globalThis)||e[r(1547)](e[r(577)],typeof globalThis)&&!!globalThis["WeixinJS"+r(1243)])&&e.IzSxC(e[r(577)],typeof wx),Et=e[r(383)](r(1666)+"d",typeof globalThis)&&(e[r(252)]("Dedicate"+r(1437)+r(1452)+"pe",globalThis[r(248)+r(497)].name)||e[r(1422)](r(1073)+r(605)+r(827),globalThis[r(248)+r(497)].name)||e.oELFd(e[r(1262)],globalThis[r(248)+"tor"].name))&&e[r(623)](e[r(577)],typeof self),wa=r(1666)+"d"!=typeof globalThis&&e[r(657)](e[r(811)],globalThis["construc"+r(497)].name)&&e[r(577)]!=typeof global&&e[r(1608)](r(297),global[r(248)+r(497)].name)&&e[r(1481)](e[r(577)],typeof process)&&!!process[r(794)];class ar{constructor(){let t=r;this[t(1022)+"rs"]={}}[r(1412)](t,...n){let a=r,u={yejrv:e.QqPDR,nseIv:function(h,m){return e[k(1424)](h,m)},GsBvT:function(h,m){return e[k(1554)](h,m)},vATKq:function(h,m){return e[k(840)](h,m)},OnUqf:function(h,m){return e[k(1041)](h,m)},lsVkO:function(h,m){return e[k(952)](h,m)},mOngq:function(h,m){return e[k(691)](h,m)},udAxR:function(h,m){return e[k(1551)](h,m)},fmeik:function(h,m){return e[k(1093)](h,m)},kkPpP:function(h,m){return h<m},JdnoT:function(h,m){return e.hoHRi(h,m)},CniUa:function(h,m){return e.alMLC(h,m)},GlBFf:function(h,m){return h&m},VyLTA:function(h,m){return e[k(491)](h,m)},TzttX:function(h,m){return h&m},plPYA:function(h,m){return e.jTLiw(h,m)},uJwdN:function(h,m){return h<<m},GdlSZ:function(h,m){return h&m}},p=this[a(1022)+"rs"][t];if(p)p[a(596)]()[a(1345)](h=>h.fn[a(662)](h[a(1354)],n));else if(e[a(486)](e[a(1050)],t)&&!this[a(553)])if(e[a(334)](e.sbzjy,e[a(213)])){let h=n.length&&n[0];if(e.pMNKk(h,Error))throw h;let m=new Error(e[a(896)](e.wJGue,h?e[a(1160)](" ("+h[a(1200)],")"):""));throw m[a(1176)]=h,h}else{let h=4294967295;return function(m,l,_=!0){let v=a,A=u[v(1133)][v(460)]("|"),N=0;for(;;){switch(A[N++]){case"0":h=u[v(1594)](u[v(1565)](h,u.vATKq(127&m[l],21)),0);continue;case"1":return{value:_?h:u[v(1565)](0,h),offset:l};case"2":if(u[v(285)](l+=5,m[v(1620)]))throw l=m[v(1620)],_0x408739(l,10,m.length);continue;case"3":if(u[v(744)](m[l++],128))return{value:_?h:u[v(1565)](0,h),offset:l};continue;case"4":h=u.nseIv(u[v(1565)](h,u.mOngq(u[v(721)](15,m[l]),28)),0);continue;case"5":if(u[v(690)](m[l++],128))return{value:_?h:0|h,offset:l};continue;case"6":if(u.kkPpP(m[l++],128))return{value:_?h:u[v(872)](0,h),offset:l};continue;case"7":if(m[l++]<128)return{value:_?h:u[v(872)](0,h),offset:l};continue;case"8":h=u[v(1594)](u[v(872)](h,u[v(441)](u.GlBFf(127,m[l]),7)),0);continue;case"9":if(u.VyLTA(m[l++],128))return{value:_?h:u[v(872)](0,h),offset:l};continue;case"10":h=u[v(1594)](u.TzttX(127,m[l]),0);continue;case"11":h=u[v(1594)](u[v(1248)](h,u[v(1653)](u[v(317)](127,m[l]),14)),0);continue}break}}}return this}[r(1342)](t,n){let a=r;if(e.bJtpf(void 0,t))this[a(1022)+"rs"]={};else if(e[a(1571)](void 0,n))this[a(1022)+"rs"][t]=null;else{let u=this[a(1022)+"rs"][t];if(u)for(let p=0;e[a(1093)](p,u[a(1620)]);)u[p].fn===n?u[a(1081)](p,1):++p}return this}on(t,n,a){return(this[r(1022)+"rs"][t]||(this._listeners[t]=[])).push({fn:n,ctx:a||this}),this}}class _a extends ar{[r(979)+"rrorMess"+r(1642)](t){let n=r,a={gurxH:function(u){return e.HBdKD(u)},wdQSp:function(u){return u()}};if(e[n(870)](e[n(1356)],e.YIQih))return t[n(339)]||t[n(1153)]?(n(928)+" "+(t[n(339)]||"")+n(1610)+(t.errNo||""))[n(788)]():JSON[n(1047)+"y"](t);xmEUpn[n(219)](_0x181ea5),xmEUpn.wdQSp(_0x228f9d)}constructor(t,n,a){let u=r;super(),this[u(1438)]=null,Ct&&wx[u(1180)+u(1080)]&&(this._socket=wx["connectS"+u(1080)]({url:t,protocols:n,header:a,fail:this[u(1088)+u(1090)+u(525)][u(1577)](this),success:this[u(1088)+u(1593)+u(1406)+u(1078)][u(1577)](this)})),Ye&&tt[u(1180)+"ocket"]&&(this[u(1438)]=tt[u(1180)+u(1080)]({url:t,protocols:n,header:a,fail:this[u(1088)+u(1090)+u(525)].bind(this),success:this[u(1088)+u(1593)+u(1406)+u(1078)].bind(this)}))}[r(1088)+r(1593)+r(1406)+r(1078)](){let t=r;Promise[t(307)]()[t(1e3)](()=>{let n=t;this[n(1305)+n(727)]()})}["_createS"+r(1090)+r(525)](t){let n=r,a={lXtWa:function(u,p){return u&p},SWwXW:function(u,p){return e[k(570)](u,p)},pznyZ:e.QvAIu,kfDad:function(u,p,h){return e[k(893)](u,p,h)},hjLtk:e[n(1050)],wWmEY:e[n(967)]};Promise[n(307)]()[n(1e3)](()=>{let u=n,p={twkkl:function(h,m,l){return h(m,l)},wzqSJ:function(h,m){return a[k(1344)](h,m)}};if(a.SWwXW(a.pznyZ,a.pznyZ)){let h=a[u(410)](de,a[u(190)],{message:this[u(979)+u(1311)+u(1642)](t)});this[u(1412)]("error",h);let m=a[u(410)](pe,a[u(518)],{reason:this[u(979)+u(1311)+u(1642)](t)});this.emit(a.wWmEY,m)}else YzZCGX[u(927)](_0xd18607,_0x47bef8,YzZCGX.wzqSJ(127,_0x179701)|128),_0x2073a0>>>=7})}[r(1305)+r(727)](){let t=r,n={dKBCz:e[t(967)],CTUYf:function(a,u,p){return e.zsllR(a,u,p)},MOURW:function(a,u){return e[t(1644)](a,u)},zIsfr:e[t(1361)],ccDGI:e[t(1050)]};this[t(1438)][t(966)](a=>{let u=t;this[u(1412)](e.zqhpd,e[u(854)](vs,e[u(666)],{...a,data:a.errMsg||""}))}),this[t(1438)][t(638)](a=>{let u=t;this[u(1412)](n[u(710)],n[u(953)](pe,u(1403),{...a}))}),this[t(1438)][t(761)+"e"](a=>{let u=t;this[u(1412)](e[u(544)],e[u(256)](bs,e[u(544)],{...a}))}),this._socket[t(1171)](a=>{let u=t;n[u(844)](u(1265),n[u(1218)])?this[u(1412)](n[u(1460)],de(u(939),{...a,message:a[u(339)]||""})):this._isMiniTT||this[u(1516)+"X"]?this[u(1158)+"etWorkCh"+u(740)]():this[u(751)+"er"]&&this[u(169)+"balEvent"+u(934)]()})}[r(1132)](t){let n=r,a={tFfXu:function(u,p,h){return e[k(256)](u,p,h)}};if(e[n(636)](t,Uint8Array))if(e[n(1238)](e[n(1486)],e.bZcoW)){let u=t[n(506)].slice(t.byteOffset,e.TNUVD(t.byteLength,t[n(181)+"et"]));this[n(1438)]&&this[n(1438)][n(1132)]({data:u,fail:p=>{let h=n;this[h(1412)](h(939),a.tFfXu(de,h(939),{message:this["_formatE"+h(1311)+h(1642)](p)}))}})}else return this[n(1425)+n(1168)+"riesCount"]++,this[n(1539)+"ntEndpoint"]();else this[n(1438)]&&this[n(1438)].send({data:t,fail:u=>{let p=n;if(e[p(712)](e[p(1465)],e[p(1465)]))this[p(1412)](e[p(1050)],e[p(1076)](de,e[p(1050)],{message:this[p(979)+p(1311)+p(1642)](u)}));else return!!this[p(1184)]}})}[r(1403)](t,n){let a=r;this._socket&&this._socket[a(1403)]({code:t,reason:n})}[r(1380)+r(934)](t,n){this.on(t,n)}[r(923)+r(1204)+r(231)](t,n){this[r(1342)](t,n)}get readyState(){let t=r;return this[t(1438)][t(1110)+"te"]}get[r(517)+"pe"](){return this[r(1438)].binaryType}set[r(517)+"pe"](t){}get[r(1045)](){let t=r;return this._socket[t(1045)]}get[r(402)](){return this[r(1438)].protocol}get extensions(){let t=r;return this[t(1438)][t(369)+"ns"]}get[r(1315)+r(1557)](){return 0}}function ya(s,t){let n=r,a={VTOvz:function(u,p){return e[k(620)](u,p)},UmjoA:function(u,p,h){return e[k(1208)](u,p,h)},IlCOA:function(u,p){return e.tYLqT(u,p)},aUtEa:function(u,p,h){return e.aVqTG(u,p,h)}};if(e[n(1597)](e.OVCyy,e.OVCyy)){for(_0x2242d8>>>=0;WnqYtD[n(994)](_0x4564e5,128);)WnqYtD[n(1532)](_0xf7cc89,_0x51658a,WnqYtD[n(1368)](127&_0x5904e7,128)),_0x2ea7d2>>>=7;WnqYtD[n(367)](_0x1d08ba,_0x5d8a7b,_0x421526)}else{if(t)return new t(s[n(1045)],s[n(402)]);if(e[n(1257)](Ct,Ye))return new _a(s.url,s[n(402)],s[n(1340)]);if(e[n(1371)](it,Et)&&e[n(359)](e[n(577)],typeof WebSocket)&&WebSocket)return new WebSocket(s.url,s[n(402)+"s"])}}function ba(s){let t=r,n=e[t(1373)][t(460)]("|"),a=0;for(;;){switch(n[a++]){case"0":if(s)return!0;continue;case"1":if(Ye&&tt["connectS"+t(1080)])return!0;continue;case"2":if(e[t(720)](it,Et)&&e[t(949)](e[t(577)],typeof WebSocket)&&WebSocket)return!0;continue;case"3":return!1;case"4":if(Ct&&wx[t(1180)+t(1080)])return!0;continue}break}}function Cs(s,t,n){let a=r,u={eWuXo:function(m,l){return m<=l},OzFEV:function(m,l){return e.aaazC(m,l)}},p=-1;async function h(m){let l=k;return u[l(1540)](m,p)?Promise.reject(new Error(l(436)+l(1203)+l(1334)+l(1213)+l(1374))):(p=m,m===n.length?Promise[l(307)]():n[m][l(1577)](s)(t,h[l(1577)](null,u[l(1320)](m,1))))}e[a(598)](h,0)}function Es(s){let t=r,n=0,a=0;for(let u=0;u<s.length;++u)a=s[t(1499)+"At"](u),e[t(212)](a,128)?n+=1:e[t(1519)](a,2048)?n+=2:e[t(1173)](e[t(940)](64512,a),55296)&&e[t(1115)](e[t(1065)](64512,s[t(1499)+"At"](e.QOSUq(u,1))),56320)?(++u,n+=4):n+=3;return n}function As(s,t,n){let a=r;if(e[a(404)](e.zltOh(n,t),1))return"";let u="";for(let p=t;e[a(404)](p,n);)if(e[a(1099)](a(427),"MuLpP")){let h=s[p++];if(h<=127)u+=String[a(1352)+a(487)](h);else if(e[a(809)](h,192)&&e[a(1676)](h,224))u+=String[a(1352)+"Code"](e[a(1308)](e[a(1624)](31&h,6),e.ZrqfR(63,s[p++])));else if(h>=224&&h<240)u+=String.fromCharCode((15&h)<<12|(63&s[p++])<<6|e[a(1100)](63,s[p++]));else if(e[a(1543)](h,240)){let m=e[a(1627)](e[a(1353)](e[a(1085)](e[a(700)](e[a(360)](7,h),18),e[a(1087)](63,s[p++])<<12),e[a(168)](e[a(1427)](63,s[p++]),6))|e[a(1512)](63,s[p++]),65536);u+=String[a(1352)+a(487)](e.jTPuX(55296,m>>10)),u+=String[a(1352)+a(487)](56320+e[a(1070)](1023,m))}}else _0x43062=e[a(676)](_0x284d93,_0x1bc8ca),_0x345945=0;return u}function cr(s,t,n){let a=r,u=n,p,h;for(let m=0;m<s[a(1620)];++m)if(p=s[a(1499)+"At"](m),e[a(1591)](p,128))t[n++]=p;else if(e.SUvhe(p,2048))t[n++]=e[a(207)](e[a(901)](p,6),192),t[n++]=e[a(1258)](63&p,128);else if(e[a(715)](e[a(1100)](64512,p),55296)&&e[a(522)](e.ynpUJ(64512,h=s[a(1499)+"At"](m+1)),56320)){let l=(a(958)+"1|2")[a(460)]("|"),_=0;for(;;){switch(l[_++]){case"0":t[n++]=e.mlwnl(e.IKjTs(p,18),240);continue;case"1":t[n++]=e[a(1308)](e.gmmkg(p>>6,63),128);continue;case"2":t[n++]=e[a(1264)](63,p)|128;continue;case"3":p=e.Ovuhb(e.jTPuX(65536,e.gvPyz(1023,p)<<10),1023&h);continue;case"4":t[n++]=p>>12&63|128;continue;case"5":++m;continue}break}}else t[n++]=e[a(386)](p>>12,224),t[n++]=e.xoNvP(e[a(434)](e.IKjTs(p,6),63),128),t[n++]=63&p|128;return n-u}async function ks(s){let t=r;if(e[t(1295)]("string",typeof s)){let n=new Uint8Array(e[t(971)](Es,s));return e.rRYsY(cr,s,n,0),n}return e.rhafF(s,ArrayBuffer)?new Uint8Array(s):new Uint8Array(s.buffer,s[t(181)+"et"],s[t(277)+"th"])}function va(s){let t=r;try{return e[t(949)](e[t(1118)],typeof s)&&(e.jvqSA(s,ArrayBuffer)||s[t(506)]&&s.buffer instanceof ArrayBuffer)||e[t(949)](e[t(1118)],typeof s)?"":(JSON[t(524)](s),t(1205)+t(1596))}catch{if(e.RjeHz(e[t(324)],e[t(1261)]))return e[t(645)](e[t(1118)],typeof s)?e[t(717)]:"";this[t(813)]++}}let Sa=(s,t)=>{let n=r;switch(s){case e.xUZYu:case e[n(157)]:return{[n(588)+s]:1,"x-tt-env":t};default:return{}}};class Ca{constructor(t){let n=r;this["maxLossC"+n(622)]=t,this[n(813)]=0}[r(473)](){let t=r;if(e[t(1491)](e[t(625)],e[t(625)]))this[t(813)]++;else return this[t(1184)]?.get(_0x148060)}[r(1215)+r(732)+"nt"](){let t=r;return this.count>=this[t(955)+t(622)]}[r(273)+"nter"](t=0){let n=r;this["maxLossC"+n(622)]=t,this[n(813)]=0}}async function Ea(s){let t=r,n={KbMpq:e[t(733)],usJcs:function(a,u){return e[t(936)](a,u)},aaYOr:e[t(937)],xXeqc:e[t(1536)],IiLbU:function(a,u){return e[t(692)](a,u)},kwsyW:e[t(174)],tVuba:function(a,u){return e[t(1587)](a,u)}};return new Promise(a=>{let u=t,p={hlhxH:n[u(453)]};if(!it)return n[u(341)](a,n[u(453)]);try{let h=document["createEl"+u(300)](n[u(839)]);window[u(421)+"JSONP"]=m=>{let l=u;document.body[l(1534)+l(1599)](h),window[l(421)+"JSONP"]=void 0,a(m&&m[l(498)]||p[l(1555)])},h[u(1307)]=n.xXeqc,h[u(1192)]=n.IiLbU(s[u(1317)](/^ws/,u(1008)),n[u(1402)]);try{document[u(855)]["appendCh"+u(1599)](h)}catch{document[u(855)]["removeCh"+u(1599)](h)}}catch{window[u(421)+u(1042)]=void 0,n[u(997)](a,n[u(453)])}})}function Fe(s,t,n){let a=r;return!!s?.[a(533)](u=>u[a(548)]===t&&u[a(183)]===n)}function ot(s,t){let n=r;return s?.[n(533)](a=>a[n(548)]===t)?.[n(183)]}let xr=null;async function Aa(){let s=r;return xr||(xr=Promise[s(307)]()[s(1e3)](Ce.bind(Ce,s(445)))),xr}class ka extends ar{constructor(t,n){let a=r;super(),this[a(1154)]=t,this[a(270)]=n,this[a(1184)]=void 0,this[a(792)+a(670)]=null}async[r(500)](){await this[r(1111)]()}async[r(1111)](){let t=r,n={Aitdh:e.sZyJA,DQfII:e[t(734)],tqrql:e[t(611)],xCCZD:function(a){return a()}};if(!this[t(1184)]){if(this[t(792)+"mise"])return this[t(792)+t(670)];try{let a=this._dbName,u=this[t(270)];this[t(792)+"mise"]=(async()=>{let p=t,h={IgtgH:n.Aitdh};if(n[p(796)]!==n[p(1106)]){let{openDB:m}=await n.xCCZD(Aa);this[p(1184)]=await m(p(421)+"_"+a,1,{upgrade(l){let _=p;_(1643)===h[_(540)]?this.on(_0x5596d6,_0x3a8ef9):l[_(884)+_(753)+"e"](a,{keyPath:u})}})}else return _0x4d9458?.[p(533)](m=>m.key===_0x6e91d4)?.[p(183)]})(),await this[t(792)+t(670)]}catch(a){console.log(a)}finally{this[t(792)+t(670)]=null}}}async get(t){let n=r;try{return await this[n(1111)](),this[n(1184)]?.[n(1621)](this[n(1154)],t)}catch(a){console[n(775)](a)}}async[r(885)](t,n){let a=r;return e[a(351)](a(265),e[a(309)])?(await this._init(),this[a(1184)]?.[a(1581)](this[a(1154)],t)):_0x2c4ae8?_0x34ffdc[a(677)+a(1562)](_0x1f4d3e,_0x538745):_0x2564e3["fromByte"+a(1324)](_0xd09f71,_0x4e98bd)}async[r(773)](t){let n=r;try{return await this[n(1111)](),this[n(1184)]?.[n(1276)](this._dbName,t)}catch(a){if(e[n(1009)]("qTYPW",e.sdSqZ))return n(421)+"_"+this[n(1186)];console[n(775)](a)}}async clear(){let t=r;try{return await this[t(1111)](),this._qosDB?.[t(567)](this[t(1154)])}catch(n){console[t(775)](n)}}async[r(257)](){let t=r;if(e[t(303)]!==e[t(303)])this[t(619)+"igatorOn"+t(457)]=_0x1b1dda,_0x42850c?this[t(1640)+"nLine"]():this[t(1640)+"ffLine"]();else return await this[t(1111)](),this[t(1184)]?.[t(701)+"ys"](this[t(1154)])}async[r(719)](){let t=r;return await this._init(),this._qosDB?.[t(719)](this._dbName)}async[r(216)](){let t=r;try{this[t(1184)]?.[t(1403)](),this[t(1184)]=void 0}catch(n){console[t(775)](n)}}get[r(610)](){let t=r;if(e[t(1571)](e[t(259)],e.hZoyn))return new _0x3e50e7(e[t(683)](e[t(1586)](_0x4de2f9[0]|e[t(988)](_0x555d82[1],8),e[t(193)](_0x387cea[2],16)),e[t(691)](_0x1d87b3[3],24)),e[t(1085)](e[t(852)](e[t(1473)](_0x1c376f[4],e[t(1541)](_0x52f5ae[5],8)),e[t(840)](_0x25f006[6],16)),e.lQiDV(_0x2991b3[7],24)),_0x51e3f3);try{return!!this._qosDB}catch(n){return console[t(775)](n),!1}}}class Pa{constructor(t,n){let a=r;this[a(1186)]=t,this[a(1498)]=n,this[a(1184)]=localStorage}async[r(500)](){}get[r(1522)](){return r(421)+"_"+this._DBName}async[r(1621)](t){let n=r,a=this[n(1184)][n(1126)](this._prefix);return JSON.parse(e.lDjbL(a,"{}"))[t]}async[r(885)](t,n){let a=r,u=this[a(1184)][a(1126)](this[a(1522)]),p=JSON.parse(e[a(595)](u,"{}"));return p[n||t[this[a(1498)]]]=t,this[a(1184)][a(1196)](this[a(1522)],JSON[a(1047)+"y"](p)),n||t[this[a(1498)]]}async del(t){let n=r,a=this._qosDB[n(1126)](this._prefix),u=JSON[n(524)](e.ykNkV(a,"{}"));return u[t]=void 0,this[n(1184)][n(1196)](this[n(1522)],JSON[n(1047)+"y"](u))}async clear(){let t=r;return this[t(1184)][t(567)]()}async[r(257)](){let t=r,n=this[t(1184)][t(1126)](this[t(1522)]),a=JSON[t(524)](n||"{}");return Object[t(257)](a)}async[r(719)](){let t=r,n=this[t(1184)][t(1126)](this[t(1522)]),a=JSON.parse(e[t(595)](n,"{}"));return Object[t(758)](a)}[r(216)](){return Promise[r(307)]()}get isReady(){return!!this[r(1184)]}}class Da{constructor(t,n){let a=r;e[a(1387)](a(861),e[a(1450)])?(_0x6db3e9(_0x4459b9,18),_0x30837f(_0x52b46a,_0x22a713)):(this._DBName=t,this._pathKey=n,this[a(1184)]=Ye?tt:Ct?wx:null)}async[r(500)](){}get _prefix(){let t=r;return t(421)+"_"+this[t(1186)]}async[r(1621)](t){let n=r;if(e[n(1049)](e[n(1447)],e[n(776)])){let a=this[n(1184)]["getStora"+n(1379)](this[n(1522)]);return JSON[n(524)](e[n(786)](a,"{}"))[t]}else this.emit(e[n(1050)],e[n(760)](_0x5a7dd3,e[n(1050)],{message:this["_formatE"+n(1311)+n(1642)](_0x27cb28)}))}async[r(885)](t,n){let a=r,u={UAkdM:function(p,h){return e[k(1054)](p,h)},ySldo:function(p,h){return e[k(523)](p,h)}};if(e[a(613)]!==e[a(559)]){let p=this[a(1184)][a(954)+a(1379)](this._prefix),h=JSON[a(524)](p||"{}");return h[n||t[this._pathKey]]=t,this[a(1184)][a(203)+a(1379)](this[a(1522)],JSON[a(1047)+"y"](h)),n||t[this[a(1498)]]}else{let p=IoeXhm[a(1336)](_0xcb240c,_0x571815),h=_0x2316be[a(1466)];return _0x21ca91[a(1466)]=IoeXhm[a(643)](_0x1e8060[a(983)],p),h}}async[r(773)](t){let n=r,a=this[n(1184)].getStorageSync(this._prefix),u=JSON[n(524)](e.EmsMa(a,"{}"));return u[t]=void 0,this._qosDB[n(203)+n(1379)](this[n(1522)],JSON[n(1047)+"y"](u))}async[r(567)](){let t=r;return this[t(1184)][t(1202)+t(1453)]()}async[r(257)](){let t=r,n=this._qosDB[t(954)+t(714)+"nc"](this._prefix),a=JSON[t(524)](n||"{}");return Object[t(257)](a)}async getAll(){let t=r,n={WaxVD:function(a,u){return e[k(998)](a,u)}};if(e[t(1009)](e.jpmjV,e.jpmjV)){let a=this[t(1184)]["getStora"+t(1379)](this._prefix);return _0x31a3b0.parse(PrQDzo[t(1348)](a,"{}"))[_0x4ed58f]}else{let a=this[t(1184)][t(954)+t(714)+"nc"](this._prefix),u=JSON.parse(e.dMgyb(a,"{}"));return Object[t(758)](u)}}[r(216)](){return Promise[r(307)]()}get isReady(){return!!this[r(1184)]}}function Ps(s,t){let n=r;if(e.ykNkV(Ye,Ye))return new Da(s,t);if(e.CRbRc(it,Et)&&e.NbMhP!=typeof indexedDB)return new ka(s,t);if((it||Et)&&e.IzSxC(e.NbMhP,typeof localStorage))return new Pa(s,t);throw new Error(e[n(406)])}class Ia{constructor(){let t=r;this[t(817)+t(1489)+"Id"]=null,this[t(817)+"l"]=36e5,this[t(1184)]=e[t(774)](Ps,e[t(1609)],e[t(526)])}async[r(817)+r(1066)](){let t=r;e[t(693)](clearInterval,this[t(817)+"lTimeoutId"]),this[t(817)+t(1489)+"Id"]=e[t(1023)](setInterval,()=>{let n=t;this[n(1391)+n(912)]()},this[t(817)+"l"])}async[r(500)](){let t=r;await this._qosDB[t(500)]()[t(1e3)](()=>{let n=t;this[n(817)+n(1066)]()})}async[r(1391)+"ired"](){let t=r;if(e[t(1663)](t(368),e[t(1552)])){let n=this[t(1075)],a=this.low;return[255&a,e.yrSgd(e[t(304)](a,8),255),e[t(361)](e[t(304)](a,16),255),a>>>24,255&n,e[t(649)](e[t(1318)](n,8),255),e.CHnoZ(n,16)&255,e.jYCyv(n,24)]}else(await this[t(1184)]?.[t(719)]()||[])[t(765)](({timestamp:u})=>u<Date[t(299)]())[t(1345)](u=>{let p=t;this._qosDB?.del(u[p(675)+"id"])})}async[r(773)](t){let n=r;return this[n(1184)]?.[n(773)](t)}async[r(885)](t,n){return this[r(1184)]?.set({message_id:t,timestamp:n})}async[r(1621)](t){let n=r;return this[n(1184)]?.[n(1621)](t)}async[r(216)](){let t=r;e[t(1583)](clearInterval,this[t(817)+"lTimeoutId"]),await this[t(1184)]?.closeDB()}get[r(610)](){let t=r;if(e.xdFzX(e.LfxQH,e[t(938)]))return this[t(1184)]?.[t(610)];e[t(975)](_0x382695,e[t(831)]),this[t(1342)](e[t(400)],_0x125e2c),this.off(e[t(1157)],_0x4e156f)}}function ur(s){let t=r,n=!!this._options[t(438)+"S"];if(!n)return{enabled:n,isQoSMessage:!1,isQoSAck:!1,isAckCleanupMessage:!1,ackMsgIds:[]};let a=Fe(s[t(1200)][t(1340)],e[t(1395)],"2"),u=a&&e[t(315)](Fe,s[t(1200)].headers,t(1227)+"er_qos_ack","1"),p=a&&e[t(814)](Fe,s[t(1200)][t(1340)],e[t(660)],"1"),h=p?e[t(1638)](ot,s.message.headers,e[t(858)])?.split(",")[t(765)](Boolean)||[]:[];return{enabled:n,isQoSMessage:a,isQoSAck:u,isAckCleanupMessage:p,ackMsgIds:h}}async function Ds(){let s=r;return this[s(957)+s(1604)]||(this[s(957)+"ger"]=new Ia),this["_QoSMana"+s(1604)][s(610)]||await this[s(957)+"ger"][s(500)](),this[s(957)+"ger"]}async function Ta(s,t){let n=r;if(e[n(715)](e.KLFrv,e.KLFrv)){let{enableAutoAck:a}=this[n(163)],u=e[n(384)](Fe,s[n(1200)][n(1340)],e[n(894)],"1"),p=e[n(435)](Fe,s.message[n(1340)],e[n(991)],"1"),h=ur[n(1407)](this,s);if(e[n(1375)](a,u)){let{SeqID:m,LogID:l,service:_,LogIDNew:v,method:A}=s[n(1200)];this[n(1494)]({SeqID:m,LogID:l,LogIDNew:v,service:_,method:A,headers:[{key:e[n(991)],value:"1"},{key:e[n(1170)],value:v||""},{key:e[n(772)],value:"0"}]})}p&&!h[n(1172)]&&this[n(186)+"hAckMessageEvent"](s),e[n(1560)](t)}else _0x5d39de=_0x59256c[n(1499)+"At"](_0x2de0bb),e[n(985)](_0x45f925,128)?_0x407107+=1:e.WOSWx(_0x56f625,2048)?_0x1c5ef8+=2:e[n(486)](e[n(1302)](64512,_0x27d908),55296)&&e[n(1433)](64512&_0x14a9a6[n(1499)+"At"](e[n(530)](_0x53963c,1)),56320)?(++_0x2b6b4d,_0x1ec64d+=4):_0x461f88+=3}async function La(s,t){let n=r;this[n(1343)](e[n(494)],s[n(1200)]),e[n(581)](t)}async function Ra(s,t){let n=r,a=e.duisN(us,await e[n(965)](ks,s[n(1436)]));try{if(e[n(583)](a.payload,Uint8Array)){let u=e[n(1020)](this[n(163)].payloadEncoding,Object)?{force:!!this[n(163)][n(230)+n(320)][n(766)],encoding:this[n(163)]["payloadE"+n(320)].encoding?this[n(163)][n(230)+n(320)][n(993)][n(1317)](/\s/g,"")[n(1077)+n(337)]():""}:{force:!1,encoding:this[n(163)][n(230)+n(320)]?this[n(163)][n(230)+"ncoding"][n(1317)](/\s/g,"")[n(1077)+"ase"]():""},p=a.payloadEncoding?a["payloadE"+n(320)].replace(/\s/g,"")[n(1077)+n(337)]():"",h=e[n(731)](this._options[n(1195)+n(1237)],Object)?{force:!!this[n(163)][n(1195)+n(1237)][n(766)],type:this[n(163)]["payloadT"+n(1237)][n(1307)]?this[n(163)]["payloadT"+n(1237)][n(1307)][n(1317)](/\s/g,"")[n(1077)+n(337)]():""}:{force:!1,type:this._options[n(1195)+n(1237)]?this[n(163)]["payloadT"+n(1237)][n(1317)](/\s/g,"")[n(1077)+n(337)]():""},m=a[n(1195)+"ype"]?a[n(1195)+"ype"].replace(/\s/g,"")[n(1077)+n(337)]():"",l=h.force?h[n(1307)]:m||h.type,_=u[n(766)]?u[n(993)]:p||u.encoding,v=[e.oNftm,n(1205)+n(1596),n(1205)+n(1596)+n(399)+n(292),e.iYuFb],A=[e.GNnML,e[n(1193)]];this[n(163)][n(947)+"ansformTextPayload"]&&v[n(1131)](l)&&(!_||A.includes(_))?a[n(370)+n(1500)]=e.EVvpm(As,a[n(1207)],0,a[n(1207)][n(277)+"th"]):a[n(370)+n(1500)]=""}else a["textPayl"+n(1500)]=""}catch(u){a[n(370)+"oad"]="",console[n(775)](u)}s[n(1200)]=a,e[n(501)](t)}function Na(s,t,n){let a=r,u=e.vhqck(n,8192),p=e[a(1294)](u,1),h=null,m=u;return function(l){let _=a;if(e[_(1656)](l,1)||e[_(910)](l,p))return e[_(598)](s,l);m+l>u&&(h=s(u),m=0);let v=t[_(1407)](h,m,m+=l);return e[_(266)](7,m)&&(m=e.eNwFr(7|m,1)),v}}let Oa=4294967295;function Ba(s,t,n){let a=r;return e.lFMoX(RangeError,e[a(1626)](e[a(1254)](e[a(564)](e[a(1515)]+s,a(229)),e[a(306)](t,1)),e.GjcmJ)+n)}function Ma(s,t,n){let a=r;if(e.SWNMj(e[a(298)],e[a(298)])){if(e[a(708)](n,Oa))throw new Error(e[a(1485)]);let u=3;for(;u>=0;){let p=e[a(1630)](255,n);e.CoMNV(dr,p,s,e[a(420)](t,u)),n>>>=8,u--}return e[a(1385)](t,4)}else _0x51c8c2[a(884)+"jectStore"](_0x4d65ce,{keyPath:_0x2e4bf3})}function za(s,t){let n=r,a=0,u=t,p=e.Rgoin(t,4);for(;e[n(1591)](u,p);)if(e[n(644)](e.XxiwE,e.VXQCE)){let{value:h,offset:m}=e[n(1442)](fr,s,u);u=m,a=e[n(1424)](e.rQZoK(a,8),0),a+=h}else throw this[n(989)+n(1369)]=!1,_0x42c9a3;return{value:a,offset:p}}function qa(s,t,n){let a=r,u=e[a(1454)][a(460)]("|"),p=0;for(;;){switch(u[p++]){case"0":if(t.write)return e.eRpfV(t[a(1463)](s,n),n);continue;case"1":return e[a(459)](e[a(970)](cr,s,t,n),n);case"2":if(e[a(1656)](s[a(1620)],40))return e[a(814)](cr,s,t,n)+n;continue;case"3":if(t[a(1667)+"e"])return e[a(1109)](t[a(1667)+"e"](s,n),n);continue;case"4":if(!s)return n;continue}break}}function Fa(s,t){let n=r,a=new M(e.xJnpP(e[n(386)](e[n(781)](e[n(1669)](s[e.oAUiR(t,4)],24),s[e[n(1160)](t,5)]<<16),e.LfblZ(s[e.GLynK(t,6)],8)),s[e[n(1584)](t,7)]),e[n(897)](e[n(1357)](s[e[n(1161)](t,0)]<<24,e[n(1323)](s[e[n(764)](t,1)],16))|e[n(1665)](s[e[n(1142)](t,2)],8),s[e[n(164)](t,3)]),!0);return t+=8,{value:a,offset:e[n(631)](t,8)}}function Ua(s,t,n){let a=r,u={mGyCj:function(p,h){return e[k(1233)](p,h)},MvNfz:"unknown reason"};if(e[a(815)](a(621),e[a(502)])){let p=s[a(371)],h=s[a(1075)];return t[n]=e[a(1424)](h,24),t[n+1]=e[a(959)](e.wAAiP(h,16),255),t[e.FIkHW(n,2)]=e[a(377)](h>>>8,255),t[n+3]=e.Uigis(255,h),t[e[a(1254)](n,4)]=e[a(950)](p,24),t[e[a(1015)](n,5)]=e[a(555)](e[a(1032)](p,16),255),t[e.bBccw(n,6)]=e[a(1526)](e[a(1480)](p,8),255),t[e.jQAeZ(n,7)]=255&p,n+=8,n}else _0x76efa5[a(421)+"JSONP"]=void 0,bwWHkN[a(828)](_0x3fb68f,bwWHkN.MvNfz)}function fr(s,t){let n=r,a={hhnoi:function(u,p,h){return e.ZZlga(u,p,h)},ryldC:function(u,p,h,m){return e[k(1358)](u,p,h,m)},vDYyA:function(u,p){return e[k(1254)](u,p)}};if(e[n(906)]===e.esZLa){let{offset:u}=a[n(1474)](_0x34651c,_0x288817,_0x2b00c2);_0x4cb3b1=u;let p={cursor_name:"",cursor:0,service:0},{value:h,offset:m}=a.hhnoi(_0x375ae7,_0x328279,_0x485a25);p[n(249)]=h,_0x426753=m;let{value:l,offset:_}=a[n(1474)](_0x5c29b2,_0x4806b1,_0x49a4c2);_0x5d3fbf=_,p[n(1421)+"ame"]=a[n(527)](_0x5799dd,_0x490c62,_0x5031cd,a[n(962)](_0x359269,l)),_0x29fd22+=l;let{value:v,offset:A}=_0x35c7db(_0x3a4bfd,_0x3c690d);p.cursor=v[n(1617)](),_0x186325=A,_0x5a8d46[n(251)](p)}else return s[n(1037)+"8"]?{value:s[n(1037)+"8"](t),offset:t+1}:{value:255&s[t],offset:t+1}}function dr(s,t,n){let a=r;return t.writeUint8?t[a(1428)+"t8"](s,n):t[n]=e[a(272)](255,s),e[a(1672)](n,1)}let Ha=function(s){return new Uint8Array(s)},Ka=e.ZanQe("undefined",typeof Buffer)?Buffer["allocUns"+r(602)]:Na(Ha,Uint8Array[r(1148)+"e"][r(1220)]);(()=>{let s=r,t={ULvYZ:function(n,a){return e[k(562)](n,a)},zLhgp:function(n,a){return e.kPCuh(n,a)},gACZC:function(n,a){return e.Kemzs(n,a)},XpiUv:function(n,a){return n&a},pcdgi:function(n,a){return e[k(448)](n,a)},WQXfQ:function(n,a){return e.TiMLW(n,a)},cFsRL:function(n,a){return e.lpOeB(n,a)},LpKCl:function(n,a){return e[k(312)](n,a)},NBEaV:function(n,a){return e[k(1162)](n,a)}};if(e[s(856)](e[s(275)],e.Hnhhw))_0x296b34=_0x215476(_0x569b1d),_0x51bbc1=e[s(959)](127,_0x540517),e[s(1221)](128,_0x57a480)&&(_0x4ebd46=e[s(1583)](_0x293ef3,_0x48bde2),_0x220c2e|=e[s(1448)](e[s(1065)](127,_0x2b0f5e),7));else{let n=4294967295;return function(a,u,p=!0){let h=s,m=(h(762)+h(343)+h(594)+"1")[h(460)]("|"),l=0;for(;;){switch(m[l++]){case"0":n=t[h(428)](t[h(429)](n,t[h(871)](t[h(1467)](127,a[u]),21)),0);continue;case"1":return{value:p?n:0|n,offset:u};case"2":if(t.pcdgi(a[u++],128))return{value:p?n:t[h(429)](0,n),offset:u};continue;case"3":if(t.pcdgi(a[u++],128))return{value:p?n:0|n,offset:u};continue;case"4":if(t[h(846)](a[u++],128))return{value:p?n:t[h(429)](0,n),offset:u};continue;case"5":n=t.ULvYZ(t[h(1467)](127,a[u]),0);continue;case"6":if(t.WQXfQ(u+=5,a[h(1620)]))throw u=a[h(1620)],Ba(u,10,a[h(1620)]);continue;case"7":n=t[h(428)](n|t.gACZC(t[h(1467)](127,a[u]),7),0);continue;case"8":n=t.ULvYZ(n|t.gACZC(127&a[u],14),0);continue;case"9":if(a[u++]<128)return{value:p?n:t[h(429)](0,n),offset:u};continue;case"10":if(a[u++]<128)return{value:p?n:t[h(429)](0,n),offset:u};continue;case"11":n=t.cFsRL(t[h(348)](n,t[h(871)](t[h(1405)](15,a[u]),28)),0);continue}break}}}})();let Ga=16,lr=32;function Wa(s){let t=r,n=0,a={};for(let u=0;e[t(491)](u,s.length);u++)a[s[u][t(1421)+t(1028)]]=e[t(862)](Es,s[u][t(1421)+"ame"]),n+=e[t(1025)](14,a[s[u][t(1421)+"ame"]]);return[n,a]}function Is(s,t,n){let a=r,[u,p]=e[a(1472)](Wa,s),h=e[a(205)](Ka,u),m=0;return s.forEach(l=>{let _=a,v=e[_(1493)][_(460)]("|"),A=0;for(;;){switch(v[A++]){case"0":m=Ma(h,m,l[_(249)]||0);continue;case"1":m=e.UibZk(Ua,M[_(1164)+"er"](l[_(1026)]||t),h,m);continue;case"2":console[_(775)](e[_(1659)],m);continue;case"3":m=e[_(963)](dr,p[l[_(1421)+"ame"]],h,m);continue;case"4":m=e[_(1222)](qa,l[_(1421)+"ame"],h,m);continue;case"5":m=e.Ngmzn(dr,0,h,m);continue;case"6":console[_(775)](e[_(1113)],m);continue;case"7":console[_(775)](_(1673),m);continue;case"8":console.log(_(1440)+_(632),l,l[_(249)]);continue;case"9":console[_(775)](e[_(397)],m);continue;case"10":console.log(e[_(818)],m);continue}break}}),{frameType:lr,headers:[{key:e[a(423)],value:n}],payload:h}}function ja(s){let t=r,n=0,a=[];for(;e[t(255)](n,s[t(277)+"th"]);){let{offset:u}=e.bQqrz(fr,s,n);n=u;let p={cursor_name:"",cursor:0,service:0},{value:h,offset:m}=e[t(1339)](za,s,n);p[t(249)]=h,n=m;let{value:l,offset:_}=e[t(774)](fr,s,n);n=_,p[t(1421)+t(1028)]=e[t(435)](As,s,n,e[t(1254)](n,l)),n+=l;let{value:v,offset:A}=e[t(982)](Fa,s,n);p[t(1026)]=v[t(1617)](),n=A,a[t(251)](p)}return a}function Ja(){let s=r;return{frameType:lr,headers:[{key:s(972)+s(344),value:e[s(572)]}],payload:void 0}}class Va{constructor(t,n,a){let u=r;this[u(520)+u(1660)]=t,this[u(898)+"ileName"]=n,this["_message"+u(161)]=a,this[u(1184)]=e[u(609)](Ps,this[u(520)+u(1660)],e.kkaAO)}async openDB(){let t=r;await this[t(1184)][t(500)]()}async[r(1129)+"rs"](){let t=r;if(!this._qosDB[t(610)])return;let n=this["_message"+t(161)],a=await this._qosDB.getAll();switch(console[t(775)](e[t(1031)],a),n){case e[t(682)]:return a&&a[t(1620)]?Is(a,0,this[t(898)+t(1017)]):void 0;case t(1631):return;case e[t(1134)]:return a&&a[t(1620)]?e[t(963)](Is,a,0,this[t(898)+t(1017)]):e[t(1068)](Ja)}}async set(t,n,a){let u=r;return console[u(775)](e[u(199)],t,n,a),this[u(1184)][u(885)]({cursor_name:t,cursor:n,service:a})}async[r(1300)+"rs"](t){let n=r,a={sLLUS:function(u,p){return e[k(1007)](u,p)},ABfAB:function(u,p){return e[k(1508)](u,p)},wAlYU:function(u,p){return u>p}};if(e[n(334)]("Awleg",e[n(886)])){let{initReconnectInterval:u,maxReconnectInterval:p,reconnectIntervalGrowFactor:h}=this._options,m=a.sLLUS(u,_0x257ed4[n(834)](h,a[n(1423)](_0x42b2f1,1)));return a[n(592)](m,p)?p:m}else{let u=e[n(842)](ja,t);for(let p of u)console[n(775)](e[n(684)],u),await this[n(1184)][n(885)](p)}}async[r(1621)](t){let n=r;return(await this[n(1184)].get(t))?.[n(1026)]}async[r(216)](){await this[r(1184)].closeDB()}[r(1637)+r(593)+r(1217)](t){let n=r,a={nxoEn:function(u,p){return e[k(816)](u,p)},bOUMx:function(u,p){return e[k(1201)](u,p)},GVDXP:e[n(577)],DcFoj:e[n(406)]};if(e[n(430)]!==n(929))this["_cursorF"+n(1017)]=t;else{if(XJjRqp[n(176)](_0x70746,_0x7ec75d))return new _0x33947c(_0x2b5dfb,_0x58dd67);if((_0x1e7997||_0x5ee4ab)&&XJjRqp[n(836)](XJjRqp[n(1071)],typeof _0x513e06))return new _0x22f5ea(_0x510c76,_0xf499b6);if(XJjRqp[n(176)](_0x531de9,_0x3c5d07)&&XJjRqp.bOUMx(XJjRqp[n(1071)],typeof _0x522274))return new _0x413799(_0x66f1,_0x4387e9);throw new _0x4211c2(XJjRqp.DcFoj)}}get[r(610)](){let t=r;return this[t(1184)][t(610)]}}let Ya=r(556)+"qos__";async function Ts(s){let t=r;if(!this._options[t(438)+"S"])return null;let{aID:n,fpID:a,messageStrategy:u}=this._options,p=s||Ya;try{if(this[t(1397)+t(694)])if(e.mUIpq(t(242),e[t(1390)]))s&&this[t(1397)+t(694)]["updateCu"+t(593)+"Name"](s);else return e[t(1216)](e[t(823)](_0x482764,4).join("0"),_0xc680a1(_0x1b0641,2)[t(197)](16))[t(596)](-4);else this["_cursorM"+t(694)]=new Va(a+"_"+n+"_"+p,p,u);return this["_cursorM"+t(694)][t(610)]||await this[t(1397)+t(694)].openDB(),this[t(1397)+t(694)]}catch{return null}}async function Xa(s,t){let n=r,a=e[n(713)](Fe,s[n(1200)][n(1340)],e[n(1538)],"-1"),u=Fe(s[n(1200)][n(1340)],e[n(991)],"1"),p=e[n(697)](ot,s[n(1200)].headers,e[n(1004)]),h=Number(ot(s.message[n(1340)],e[n(711)]))||0,m=ur[n(1407)](this,s),l=Fe(s[n(1200)][n(1340)],e.KzhjI,"2"),_=e.wGnqz(ot,s[n(1200)][n(1340)],e.IXNiD),v=e[n(693)](Number,e[n(787)](ot,s[n(1200)].headers,e.HCwGt));if(m[n(1172)])return e[n(1194)](t);let A=m["isQoSMes"+n(1400)]?await Ds.call(this):null;if(e[n(1573)](s[n(1200)][n(249)],0)&&u&&!a||s[n(1200)][n(249)]>0){if(p&&m[n(550)+n(1400)]&&A)return!!!await A[n(1621)](p)&&(this[n(186)+n(468)+n(913)](s),await A[n(885)](p,e[n(1278)](Date[n(299)](),h))),e[n(881)](t);if(l){let N=await Ts[n(1407)](this);if(!N)return this[n(186)+n(468)+n(913)](s),e[n(1068)](t);let R=await N.get(_)??-1;if(e[n(1093)](R,v))this[n(186)+n(468)+n(913)](s),N[n(885)](_,v,s[n(1200)][n(249)]);else throw new Error(n(704)+n(541)+n(294)+v+(n(1010)+n(652)+n(264)+"r ")+R);return e[n(908)](t)}return this[n(186)+n(468)+n(913)](s),t()}}async function $a(s,t){let n=r,a=ur.call(this,s);if(!a["isQoSMes"+n(1400)])return e[n(1266)](t);let u=await Ds.call(this);if(a["isAckCle"+n(1335)+n(1642)]&&a[n(1430)+"s"].length)for(let p of a[n(1430)+"s"])await u.del(p);e.hWGZs(t)}async function Qa(s,t){let n=r,a={PxIek:function(l,_,v){return e[k(1033)](l,_,v)}},u=e.tAKWU(s[n(1200)][n(447)+"e"],Ga),p=e.pbVPu(s.message[n(447)+"e"],lr);if(!u&&!p)return e[n(269)](t);let h=e[n(1208)](ot,s[n(1200)][n(1340)],e.NsqZJ);if(!h)return e[n(501)](t);let m=await Ts.call(this,h);if(!m)return e.DLDMw(t);if(u)if(e.kTCaD(e.srVNe,e[n(390)]))_0x4d825d[n(885)](_0x2af58d,_0x3af8a0);else{let l=await m.getCursors(),_={frameType:l?.["frameType"],SeqID:M[n(1164)+"er"](this[n(1226)]++),LogID:M.fromNumber(this[n(163)][n(1641)+n(394)]()),service:9e3,method:5,headers:l?.[n(1340)],payload:l?.[n(1207)]},v=C(_);this[n(1165)]&&this[n(1165)][n(1110)+"te"]&&this[n(1165)][n(1132)](v)}if(p)if(e[n(1301)](e[n(1159)],e[n(1159)])){let l=s[n(1200)][n(1207)];l&&m[n(1300)+"rs"](l)}else _0x37a11f(_0x12a3db,66),upJnce.PxIek(_0x28e586,_0x434347,_0x137805[n(1620)]),upJnce[n(860)](_0x1ac535,_0x5482bb,_0x3e0e06)}let Za=async function(s,t){let n=r;this[n(314)]=!1,e[n(1108)](clearTimeout,this[n(989)+n(1143)+"utId"]),e[n(201)](t)},e0=async function(s,t){let n=r;if(!this[n(1165)]||e.xdFzX(this[n(1165)][n(1110)+"te"],this[n(919)]))return e.ocNwd(t);let{pingInterval:a}=this[n(163)];this["_endpoin"+n(1117)]?.[n(1657)+n(1124)+n(1072)]();for(let p=0;e.aFJHS(p,this[n(431)+n(1288)].length);p++){let h=this["_message"+n(1288)][p];if(e[n(1664)](this[n(1165)][n(1110)+"te"],this[n(919)])&&e[n(1370)](null,h))this[n(1165)]&&this[n(1165)].send(h),this[n(431)+n(1288)][p]=null;else break}this[n(431)+n(1288)]=this[n(431)+"Queue"].filter(p=>!!p),this._pingPongTimeoutId=e[n(521)](setTimeout,()=>this[n(1322)](),a),this[n(186)+n(329)+"nt"](s),this[n(751)+"er"]&&this._ws&&(this[n(1165)][n(517)+"pe"]=this._binaryType);let u=this[n(1287)+"tManager"]?.[n(1539)+"ntEndpoint"]();this._debug(n(1625)+u+n(769)),e[n(746)](t)},t0=async function(s,t){let n=r,a=this["_endpoin"+n(1117)]?.[n(1539)+n(319)+"nt"]();this[n(1343)](n(1625)+a),e.ocNwd(t)};class n0 extends ar{constructor(t){let n=r,a={nwxnx:function(m,l){return e[k(1675)](m,l)},kfKJS:e[n(1182)],jNIWX:e.yzOuH,honWh:e[n(831)],EvGMC:e[n(1050)],WYuof:function(m,l,_){return m(l,_)},nEycp:function(m,l,_){return m(l,_)}};super(),this["_miniNav"+n(1592)+n(457)]=!0,this[n(751)+"er"]=it,this._isNode=wa,this[n(496)+"T"]=Ye,this[n(1516)+"X"]=Ct,this._isWorker=Et,this._messageQueue=[],this[n(1287)+n(1117)]=null,this[n(1414)+n(626)]=!1,this["_binaryT"+n(1237)]="arraybuffer",this._connectLock=!1,this["_connect"+n(1143)+n(215)]=null,this[n(688)+"ctTimeoutId"]=null,this[n(514)+n(1396)+"Id"]=null,this[n(1226)]=0,this._isInit=!1,this[n(829)]="",this[n(957)+n(1604)]=null,this[n(1397)+n(694)]=null,this._pingLossCounter=null,this._protocols=e.JjPGb,this[n(1449)]=3,this[n(333)+"NG"]=0,this.OPEN=1,this.CLOSING=2,this[n(388)]=m=>{let l=n;try{e[l(384)](Cs,this,m,[Za,e0,t0])}catch(_){let v=e[l(482)](de,e.XecCK,{message:_[l(1200)],code:qe[l(234)+"OR"],error:_});this[l(186)+"hErrorEv"+l(1229)](v)}},this[n(220)+"ge"]=async m=>{let l=n,{pingInterval:_,pingFrequency:v}=this._options;if((a[l(245)]("hi",m.data)&&a[l(245)](a[l(408)],v)||a[l(1366)]===v)&&(this[l(601)+l(1097)](),this[l(1412)](l(1502)+l(1187)+"s",a.honWh),this[l(514)+l(1396)+"Id"]=setTimeout(this._ping[l(1577)](this),_)),!a[l(245)]("hi",m.data))try{Cs(this,m,[Ra,Ta,$a,Qa,Xa,La])}catch(A){let N=de(a[l(780)],{message:A[l(1200)],code:qe[l(1475)+l(415)],error:A});this[l(186)+"hErrorEvent"](N)}},this[n(1039)]=m=>{let l=n,_=this["_endpoin"+l(1117)]?.[l(1215)+"chMaxTries"](),v=this[l(1287)+"tManager"]?.["getCurre"+l(319)+"nt"]();if(_&&!m[l(1200)]){let A="connect "+v+(" fail, max retri"+l(1523)+"ed");this[l(186)+l(1330)+l(1229)](a.WYuof(de,a[l(780)],{message:A,code:qe[l(391)+"IES_ERROR"],error:m}));return}this[l(1165)]&&a.nwxnx(this[l(1165)].readyState,this[l(919)])&&this[l(387)+l(986)](),this["_dispatc"+l(1330)+l(1229)](a[l(1012)](de,a[l(780)],{message:m[l(1200)],code:qe[l(305)+l(900)],error:m}))},this[n(1529)]=async m=>{let l=n;this[l(1056)+"mer"](),this["_clearPi"+l(1097)](),this[l(1299)+l(867)+"rs"](),this[l(1165)]=null,this[l(989)+l(1369)]=!1;let _=this[l(1287)+l(1117)]?.[l(1215)+"chMaxTries"]();if(!_&&this[l(493)+"orOnline"]()&&!this[l(1414)+"osed"]){let v=this[l(1287)+l(1117)]?.getCurrentEndpoint(),A=this[l(163)][l(366)+l(478)+l(576)](m[l(793)],m.reason);this[l(186)+"hCloseEv"+l(1229)](e[l(1646)](pe,"close",{code:1006,reason:m[l(942)]||l(1588)+l(656)+l(981)+l(1507)+"n, hostname: "+v,willReconnect:A})),A&&this._connect();return}if(e[l(763)](1e3,m[l(793)])&&this[l(1414)+"osed"]){this[l(186)+"hCloseEv"+l(1229)](e[l(1432)](pe,l(1403),{code:1e3,reason:e[l(1306)]})),this[l(1287)+l(1117)]?.[l(1657)+"pointCon"+l(1072)](),this[l(756)+l(992)]?.[l(273)+l(1355)]();return}if(m[l(793)]!==1e3&&_){let v=this[l(1287)+"tManager"]?.[l(1539)+"ntEndpoint"](),A=m.reason;A||(A=await e[l(1060)](Ea,this[l(829)])),A=l(1588)+l(656)+l(365)+A+(l(238)+l(868))+v+(l(160)+l(679)+l(921)),this[l(186)+"hCloseEvent"](e[l(1417)](pe,e.VWDLJ,{code:m[l(793)],reason:A}));let N="connect "+v+(l(654)+l(1359)+l(1523)+"ed");this[l(186)+l(1330)+l(1229)](de(e[l(1050)],{message:N,code:qe["MAX_RETR"+l(407)+"R"]})),this[l(1287)+l(1117)]?.["resetEnd"+l(1124)+l(1072)](),this[l(756)+l(992)]?.[l(273)+l(1355)]();return}if(m[l(793)]!==1e3&&!m[l(942)]){let v=this[l(1287)+"tManager"]?.[l(1539)+l(319)+"nt"]();this[l(186)+l(178)+l(1229)](pe(e[l(967)],{code:m[l(793)],reason:l(1588)+l(656)+l(981)+"wn reaso"+l(412)+l(1284)+v})),this[l(1287)+"tManager"]?.[l(1657)+l(1124)+l(1072)](),this["_pingLos"+l(992)]?.["resetCou"+l(1355)]();return}this["_dispatc"+l(178)+l(1229)](m),this[l(1287)+"tManager"]?.["resetEnd"+l(1124)+l(1072)](),this[l(756)+l(992)]?.[l(273)+l(1355)]()},this[n(565)]=null,this[n(553)]=null,this[n(552)+"e"]=null,this[n(659)]=null,this[n(960)+"econnect"]=null,this.onReceiveAck=null,this[n(295)+"mediatel"+n(680)+"ct"]=null,this[n(1640)+n(276)]=this[n(1640)+n(276)][n(1577)](this),this[n(1640)+"ffLine"]=this[n(1640)+n(375)][n(1577)](this),this[n(647)+n(709)]=this[n(647)+"ageHide"][n(1577)](this),this._handlePageShow=this[n(647)+n(779)].bind(this),this[n(163)]={url:"",automaticOpen:!0,initReconnectInterval:1e3,maxReconnectInterval:1e4,reconnectIntervalGrowFactor:2,timeoutInterval:5e3,maxRetries:5,debug:!1,maxMessageQueueLength:e[n(301)](1,0),service:0,logIDGenerator:c,headers:void 0,payloadEncoding:"",payloadType:"",fpID:"",deviceID:"",accessKey:"",ttwID:"",bddID:"",aID:"",disableAutoReconnect:!1,customParams:{},pingInterval:15e3,pingTimeoutInterval:4e3,pingFrequency:n(1349),pingLossCount:2,enableTransformTextPayload:!1,logIDNewConfig:{enableAutoGenerateLogIDNew:!1,userIp:""},miniProgramParams:{customHttpHeader:{}},enableAutoAck:!1,reconnectInterceptor:()=>!0,enableQoS:!1,QoSLevel:2,messageStrategy:n(557),env:{xTTEnv:"",xUseEnv:""},listenNetworkChanged:!0};let{url:u,ws:p}=t,h=Array[n(171)](u)?u:e[n(1118)]==typeof u?[u]:[];if(!h||h.length===0)throw new Error(e.fnBxu);if(!e[n(608)](ba,p))throw new Error(e[n(258)]);Object[n(1038)](this[n(163)],t),this[n(1287)+"tManager"]=new Ss(h,this[n(163)].maxRetries),this[n(756)+n(992)]=new Ca(this[n(163)][n(281)+n(450)]),this[n(163)][n(288)+n(808)]&&(this[n(314)]=!0,this[n(989)]()),this._options[n(1296)+n(757)+"nged"]&&(this._isMiniTT||this[n(1516)+"X"]?this[n(1158)+n(1346)+n(740)]():this._isBrowser&&this[n(169)+n(1566)+n(934)]())}[r(1640)+"nLine"](){let t=r;if(!e[t(1236)](e[t(282)],"bNzow")){if(this[t(163)][t(641)+t(1580)+t(1582)]||this["_readyCl"+t(626)])return;this._handleReconnect()}}[r(1640)+r(375)](){let t=r;if(e[t(1644)](e[t(1277)],e[t(1277)])){if(!this[t(1165)])return;this["_destroy"+t(1263)+"t"](_0x59adb2,_0x39d2d0,_0x10c650)}else{this["_destroy"+t(1263)+"t"]();let n=or(e[t(291)],{message:e.DOfma});this[t(295)+t(1488)+t(680)+"ct"]&&this["onStopIm"+t(1488)+t(680)+"ct"](n)}}[r(169)+"balEvent"+r(934)](){let t=r;e.rhlZm!==t(1140)?(this[t(751)+"er"]&&window[t(1380)+t(934)](t(678),this[t(1640)+t(276)]),this[t(751)+"er"]&&window["addEvent"+t(934)](e[t(1291)],this[t(1640)+t(375)]),this[t(751)+"er"]&&window[t(1380)+t(934)]("pagehide",this[t(647)+t(709)]),this._isBrowser&&window[t(1380)+t(934)](e[t(1199)],this[t(647)+t(779)])):(this[t(955)+t(622)]=_0x2a16f3,this[t(813)]=0)}[r(857)+r(1566)+r(934)](){let t=r;this[t(751)+"er"]&&window[t(923)+t(1204)+"ner"](e[t(471)],this[t(1640)+t(276)]),this[t(751)+"er"]&&window[t(923)+"entListe"+t(231)](e.gpllY,this[t(1640)+t(375)]),this[t(751)+"er"]&&window[t(923)+t(1204)+t(231)](e[t(673)],this[t(647)+t(709)]),this[t(751)+"er"]&&window[t(923)+t(1204)+t(231)](e.ZpXHN,this[t(647)+t(779)])}["_handleP"+r(709)](t){let n=r;!t[n(943)+"d"]&&(this[n(751)+"er"]&&window[n(923)+"entListe"+n(231)](e[n(673)],this[n(647)+n(709)]),this[n(751)+"er"]&&window[n(923)+n(1204)+"ner"](n(933),this[n(647)+"ageShow"]),this[n(1403)]()),this[n(751)+"er"]&&window[n(923)+n(1204)+n(231)](e[n(471)],this[n(1640)+"nLine"]),this[n(751)+"er"]&&window[n(923)+n(1204)+n(231)](e[n(1291)],this[n(1640)+n(375)])}[r(647)+r(779)](t){let n=r;t[n(943)+"d"]&&(this._navigatorOnline()&&(!this[n(1165)]||e[n(644)](this[n(1165)][n(1110)+"te"],this[n(919)])||e.BwHOv(this._ws[n(1110)+"te"],this.CONNECTING))&&this[n(1640)+n(276)](),this[n(751)+"er"]&&window[n(1380)+"Listener"](e[n(471)],this[n(1640)+n(276)]),this[n(751)+"er"]&&window.addEventListener("offline",this[n(1640)+"ffLine"]))}async["_generat"+r(262)](t){let n=r,a={aiqft:function(u,p){return u>=p}};if(e.xQLTg(e[n(1576)],e.oEFmA)){let{fpID:u,deviceID:p,bddID:h,ttwID:m,accessKey:l,aID:_,customParams:v={},enableAutoAck:A,enableQoS:N,QoSLevel:R,env:O}=this[n(163)],ie,ce,hr;this[n(751)+"er"]||this._isMiniWX||this[n(496)+"T"]?(ie=location&&e[n(1295)](e[n(865)],location.protocol)?e[n(1224)]:e.nJPCr,ce=t[n(1317)](/((^ws)|(^http))((?:[s]*:\/\/))/,""),hr=/^wss(.*:\/\/)/[n(165)](t)?t:""+ie+ce):(ie=n(1304),ce=t.replace(/(^http)((?:[s]*:\/\/))/,""),hr=/(^ws)((?:[s]*:\/\/))/[n(165)](ce)?ce:""+ie+ce);let Ls=h?e.ZBWzQ:m?"ttwid":n(1325)+"d",Rs=h||m||p;if(e[n(816)](!Rs,!Ls))throw new Error(e[n(1116)]);let r0=e[n(466)]("function",typeof v)?await v():v,s0=O?e[n(1156)](Sa,O.xUseEnv,O[n(330)]):{},gr=Object[n(1038)]({device_platform:"web",version_code:e.ilsXA,access_key:l,fpid:u,aid:_,[Ls]:Rs,xsack:A?1:0,xaack:A?1:0,xsqos:N?1:0,qos_level:N?R:void 0,qos_sdk_version:2,...s0},r0),i0=Object[n(257)](gr)[n(1091)]((pr,mr)=>gr[mr]!==void 0?""+pr+(pr?"&":"?")+mr+"="+gr[mr]:pr,"");return hr+n(483)+i0}else if(BDEWFG.aiqft(_0x157ec,_0x1ea6e9))return _0x487b8d}async[r(989)](){let t=r;if(!(this._connectLock||this["_readyCl"+t(626)])){this[t(989)+t(1369)]=!0;try{if(e[t(707)]("sJRsb",e[t(208)])){let n=this[t(1287)+t(1117)]?.["checkCur"+t(1030)+t(718)+t(336)+t(1614)](),{timeoutInterval:a}=this._options;if(n){let p=this[t(1287)+"tManager"]?.[t(1539)+"ntEndpoint"](),h=this[t(1287)+t(1117)]?.[t(1331)+"ackupEnd"+t(932)+t(495)+t(841)](),m=this[t(1287)+"tManager"]?.[t(1539)+t(319)+t(698)+t(622)]();if(h){let l="connect "+p+(t(824)+t(160)+t(679)+t(612)+t(1443)+t(1535)+t(1549))+h+(t(335)+"y"),_=e[t(332)](de,e[t(1050)],{message:l,code:qe["MAX_RETR"+t(407)+"R"]});this._debug(l),this[t(186)+t(1330)+t(1229)](_),this[t(829)]=await this[t(1505)+"eUrl"](h),this[t(1343)](t(1470)+h+" "+m+t(1321)),this[t(1299)+t(867)+"rs"]()}else if(e[t(1121)](e[t(615)],t(1563)))this[t(314)]=!0,this._connect();else{let l=t(1470)+p+(t(824)+t(160)+t(679)+t(921));this[t(1343)](l),this[t(186)+"hErrorEv"+t(1229)](e[t(224)](de,e.XecCK,{message:l,code:qe[t(391)+t(407)+"R"]}));return}}else{let p=this[t(1287)+t(1117)]?.[t(1539)+t(319)+t(373)+t(379)](),h=this["_endpoin"+t(1117)]?.[t(1539)+"ntEndpointTriesCount"]();this[t(829)]=await this[t(1505)+"eUrl"](p||""),this[t(1343)](t(1470)+p+" "+h+" times"),this[t(1299)+t(867)+"rs"]()}if(this[t(314)])this[t(314)]=!1;else{let p=e[t(924)](or,e[t(291)],{message:e[t(437)]});this[t(960)+t(1167)]&&this["onStartR"+t(1167)](p)}let u=this[t(1287)+t(1117)]?.[t(1539)+"ntEndpoi"+t(698)+t(622)]()||0;e[t(1383)](u,1)&&await this[t(729)](e[t(198)](u,1)),this._debug(t(1588)+t(1061)+this[t(829)]+(t(1122)+t(342))+this._protocols),this[t(1165)]=e.kNJiC(ya,{url:this[t(829)],protocols:[this[t(1652)+"ls"]],headers:this[t(163)][t(424)+t(1362)+"s"][t(537)+t(1661)]},this[t(163)].ws),(this[t(751)+"er"]||this._isWorker)&&this[t(1165)]&&(this[t(1165)][t(517)+"pe"]=this[t(1094)+t(1237)]),this[t(1305)+t(727)](),this[t(989)+t(1143)+t(215)]=e[t(924)](setTimeout,this._onTimeout[t(1577)](this),a)}else{let n=_0x16e3e5[t(738)+t(624)](_0x20235e);return _0x77943f&&n[t(1380)+t(934)](CSsDJD[t(503)],()=>_0x2dfcb1()),CSsDJD[t(639)](_0xc918d2,n).then(()=>{})}}catch(n){throw this[t(989)+t(1369)]=!1,n}}}_clearTimer(){let t=r;e.dZkZC===e[t(456)]?(e[t(878)](clearTimeout,this["_connect"+t(1143)+"utId"]),this[t(989)+t(1143)+t(215)]=null):(_0x3d3e1e[t(923)+"entListe"+t(231)](CSsDJD[t(831)],_0x2c60d4),_0x47bb2a[t(923)+"entListe"+t(231)](CSsDJD[t(1050)],_0x3d734c))}[r(601)+r(1097)](){let t=r;e[t(847)](clearTimeout,this[t(514)+t(1396)+"Id"]),clearTimeout(this["_reconne"+t(353)+"tId"]),this[t(514)+t(1396)+"Id"]=null,this[t(688)+t(353)+"tId"]=null}[r(1343)](...t){let n=r;this._options[n(686)]&&console[n(775)].apply(console,[n(750)+">",...t])}["_getInte"+r(653)+"e"](t){let n=r,{initReconnectInterval:a,maxReconnectInterval:u,reconnectIntervalGrowFactor:p}=this[n(163)],h=e.mTBNJ(a,Math.pow(p,t-1));return e.mOzqx(h,u)?u:h}[r(1322)](){let t=r;if(this[t(1165)]&&e[t(1268)](this[t(1165)][t(1110)+"te"],this[t(333)+"NG"])){this[t(601)+"ngTimer"](),this[t(514)+t(1396)+"Id"]=setTimeout(this[t(1322)][t(1577)](this),this._options[t(1478)+t(1271)]);return}if(!this._ws||e[t(508)](this[t(1165)][t(1110)+"te"],this[t(919)]))return void this[t(1413)+t(1167)]();this._ws&&this._ws[t(1132)]("hi"),this[t(688)+t(353)+t(381)]=e[t(1646)](setTimeout,this["_handleR"+t(1167)+t(603)][t(1577)](this),this[t(163)][t(250)+t(995)+t(512)])}[r(1413)+r(1167)+"Timeout"](){let t=r;this[t(756)+t(992)]?.[t(473)](),this[t(1412)](e[t(1157)],e[t(260)]),this[t(756)+"sCounter"]?.[t(1215)+"chMaxCount"]()?this[t(1413)+t(1167)]():this[t(1322)]()}[r(493)+r(1245)](){let t=r;return this._isMiniTT||this[t(1516)+"X"]?this[t(619)+t(1592)+t(457)]:(this[t(751)+"er"]||this[t(1483)+"r"])&&this[t(163)][t(1296)+"tworkCha"+t(240)]?navigator[t(376)]:!0}[r(1413)+r(1167)](){let t=r;!this[t(493)+t(1245)]()||this[t(1414)+t(626)]||(this[t(1287)+t(1117)]?.[t(1657)+t(1124)+t(1072)](),this._pingLossCounter?.[t(273)+t(1355)](),this[t(1165)]?this[t(387)+t(986)](1001,e[t(1564)],!0):this[t(989)]())}[r(1158)+r(1346)+r(740)](){let t=r,n={FrUxR:function(a,u){return e[k(212)](a,u)},jsqXG:function(a,u,p){return e[k(609)](a,u,p)},rKGjg:function(a,u){return e[k(515)](a,u)},jzMnR:e[t(820)]};this[t(496)+"T"]?tt[t(1399)+t(1298)+t(346)](({isConnected:a})=>{let u=t;this[u(619)+u(1592)+u(457)]=a,a?this[u(1640)+u(276)]():this[u(1640)+u(375)]()}):this[t(1516)+"X"]&&wx.onNetworkStatusChange(({isConnected:a})=>{let u=t;if(u(806)!==n[u(241)])this["_miniNavigatorOn"+u(457)]=a,a?this[u(1640)+"nLine"]():this["_handleO"+u(375)]();else{let p=0,h=_0x176842,m=_0x3c2432+4;for(;zkpyPM[u(723)](h,m);){let{value:l,offset:_}=zkpyPM[u(655)](_0x940466,_0x4b634f,h);h=_,p=zkpyPM[u(1137)](p,8)>>>0,p+=l}return{value:p,offset:m}}})}[r(729)](t){let n={dqxGr:function(a,u,p){return e.GvQYd(a,u,p)}};return new Promise(a=>{let u=k;n[u(1650)](setTimeout,a,this[u(1013)+u(653)+"e"](t))})}[r(387)+r(986)](t=1e3,n="",a=!1){let u=r;this[u(1165)]&&this[u(239)+u(1263)+"t"](t,n,a)}[r(322)+"ut"](){let t=r,n=this[t(1287)+t(1117)]?.[t(1539)+t(319)+"nt"]();this[t(1343)](t(1470)+n+t(824)),this[t(387)+"ect"](1001,e[t(951)],!0)}[r(1494)](t){let n=r,a={MRVPO:e.RmkvX,nsGuo:e[n(1157)],MnZQi:function(u,p,h){return u(p,h)},isoAC:function(u,p){return e[n(1107)](u,p)},wDVdx:"ping_onc"+n(1187)+"s"};if(e[n(888)]!==e[n(1166)]){let u=e[n(529)](ir,t);this[n(1165)]&&this._ws[n(1110)+"te"]===this[n(919)]&&(this[n(1165)]&&this._ws[n(1132)](u),this[n(1343)](e.TQBkq,t))}else{let u={EPoJy:function(p,h){return a[n(1521)](p,h)},colRG:"success",DxIKj:a[n(1144)],pYYPb:a.nsGuo};return new _0x841e95((p,h)=>{let m=n,l={ufwil:a[m(974)],DjCQx:m(1502)+m(1187)+"s",KBitN:a.nsGuo};this[m(601)+"ngTimer"](),this[m(514)+"gTimeoutId"]=a.MnZQi(_0x135ce8,this[m(1322)][m(1577)](this),this[m(163)][m(1478)+"rval"]);let _=()=>{let A=m;u[A(696)](p,u[A(1206)]),this.off(u.DxIKj,_),this[A(1342)](u[A(801)],v)},v=()=>{let A=m;h(l[A(228)]),this.off(l.DjCQx,_),this[A(1342)](l[A(1225)],v)};this.on(m(1502)+m(1187)+"s",_),this.on(a.nsGuo,v),this._ping()})}}[r(1299)+r(867)+"rs"](){let t=r,n=e[t(1462)].split("|"),a=0;for(;;){switch(n[a++]){case"0":this[t(1165)][t(923)+t(1204)+t(231)](t(1403),this[t(1529)]);continue;case"1":this[t(1165)]["removeEv"+t(1204)+"ner"](e[t(544)],this._onMessage);continue;case"2":if(!this._ws)return;continue;case"3":this._ws[t(923)+t(1204)+t(231)](e[t(1050)],this[t(1039)]);continue;case"4":this[t(1165)][t(923)+t(1204)+t(231)](e[t(666)],this[t(388)]);continue}break}}["_addWsLi"+r(727)](){let t=r,n=(t(637)+"4")[t(460)]("|"),a=0;for(;;){switch(n[a++]){case"0":this[t(1165)]["addEvent"+t(934)](e[t(967)],this._onClose);continue;case"1":this[t(1165)][t(1380)+t(934)](e[t(544)],this[t(220)+"ge"]);continue;case"2":if(!this[t(1165)])return;continue;case"3":this[t(1165)].addEventListener(e[t(666)],this[t(388)]);continue;case"4":this._ws[t(1380)+t(934)]("error",this._onError);continue}break}}[r(167)+"nceClose"](t=1e3,n=""){let a=r;try{this._ws&&this[a(1165)][a(1403)](t,n)}catch{}}[r(239)+r(1263)+"t"](t=1e3,n="",a=!1){let u=r;if(this["_clearPi"+u(1097)](),this[u(1056)+"mer"](),this[u(1299)+"sListeners"](),this[u(167)+u(1096)](1e3,n),this[u(989)+u(1369)]=!1,a&&this[u(493)+u(1245)]()&&!this["_readyCl"+u(626)]){if(this[u(1287)+"tManager"]?.[u(1215)+u(1269)+"es"]())if(e[u(1250)]!==e[u(1365)]){let h=this[u(1287)+"tManager"]?.[u(1539)+u(319)+"nt"]();this[u(186)+u(178)+u(1229)](pe(e[u(967)],{code:1006,reason:"connect "+h+(u(824)+u(160)+u(679)+u(921)),wasClean:!0}))}else{let{pingInterval:h,pingFrequency:m}=this._options;if((e[u(1014)]("hi",_0x437baf[u(1436)])&&m==="always"||e[u(509)](e.yzOuH,m))&&(this[u(601)+u(1097)](),this[u(1412)](e[u(400)],e[u(831)]),this[u(514)+"gTimeoutId"]=e.EnKdD(_0x35c01b,this[u(1322)][u(1577)](this),h)),_0x56f17c.data==="hi")return;try{e[u(217)](_0x401310,this,_0x49673b,[_0x2d4e1c,_0x359677,_0x48f1d6,_0x4007e5,_0x315cd7,_0x55862e])}catch(l){let _=e.TXDxl(_0x398ec7,u(939),{message:l[u(1200)],code:_0x33f08f.MESSAGE_ERROR,error:l});this[u(186)+"hErrorEv"+u(1229)](_)}}else{let h=this[u(163)][u(366)+"tInterce"+u(576)](t,n);this[u(186)+u(178)+u(1229)](e.kfPVE(pe,u(1403),{code:t,reason:n,wasClean:!0,willReconnect:h})),h&&this[u(989)]()}return}this[u(493)+"orOnline"]()||this["_readyCl"+u(626)]?this[u(186)+u(178)+u(1229)](pe(e[u(967)],{code:t,reason:e[u(1306)]})):this["_dispatchCloseEv"+u(1229)](e[u(785)](pe,e[u(967)],{code:1006,reason:e.rLpfX})),this[u(1165)]=null,this[u(1287)+"tManager"]?.["resetEnd"+u(1124)+u(1072)](),this._pingLossCounter?.[u(273)+u(1355)]()}_dispatchOpenEvent(t){let n=r;this.emit(n(280),t),this[n(659)]&&this[n(659)](t)}["_dispatc"+r(468)+r(913)](t){let n=r;this.emit(e[n(544)],t),this[n(552)+"e"]&&this.onmessage(t)}["_dispatchAckMess"+r(1410)](t){let n=r;this[n(1412)](n(338),t),this[n(882)+n(442)]&&this["onReceiv"+n(442)](t)}[r(186)+"hErrorEv"+r(1229)](t){let n=r;this[n(1412)](e[n(1050)],t),this[n(553)]&&this[n(553)](t)}[r(186)+r(178)+r(1229)](t){let n=r;this[n(1412)](e[n(967)],t),this[n(565)]&&this[n(565)](t)}get[r(517)+"pe"](){let t=r;return this[t(1165)]?this[t(1165)][t(517)+"pe"]:this[t(1094)+t(1237)]}set[r(517)+"pe"](t){let n=r,a={CqXaH:function(u,p,h){return e[k(1057)](u,p,h)}};e[n(274)](e.EeSRR,e[n(1574)])?(this[n(1094)+"ype"]=t,this._ws&&(this[n(1165)][n(517)+"pe"]=t)):(hqmkrC[n(795)](_0x5bed50,_0x270440,50),hqmkrC[n(795)](_0x1d1c06,_0x3e1755,_0x41d59a))}get retryCount(){let t=r;return this[t(1287)+t(1117)]?.[t(1539)+"ntEndpoi"+t(698)+t(622)]()||0}get bufferedAmount(){let t=r,n=this[t(431)+t(1288)].reduce((a,u)=>(a+=u&&u.byteLength||0,a),0);return e[t(1338)](n,this._ws?this[t(1165)]["buffered"+t(1557)]:0)}get extensions(){let t=r;return this[t(1165)]?this[t(1165)][t(369)+"ns"]:""}get[r(402)](){let t=r;return this[t(1165)]?this[t(1165)][t(402)]:""}get readyState(){let t=r,n={CLsbH:function(a,u){return e.yMnab(a,u)},FzMhc:e.HPLgT,HJBvD:function(a,u){return e[k(620)](a,u)},bUcCA:function(a,u){return e.ivvqB(a,u)},ihlUU:function(a,u){return e.Vtpdq(a,u)}};if(e[t(851)](e[t(1426)],t(1181)))return this[t(1165)]?this[t(1165)][t(1110)+"te"]:this._options[t(288)+"cOpen"]?this[t(333)+"NG"]:this[t(1449)];{if(EceIWY[t(1511)](_0x341f7c,_0x48d3ef))throw new _0x97fb18(EceIWY[t(175)]);let a=3;for(;EceIWY.HJBvD(a,0);){let u=EceIWY[t(1283)](255,_0x37f3fc);_0x1cf881(u,_0x10f7e2,_0x473921+a),_0x562bbd>>>=8,a--}return EceIWY[t(1544)](_0x23c66e,4)}}get url(){let t=r;return this._ws?this[t(1165)][t(1045)]:this._url}[r(1403)](t=1e3,n){let a=r,u=e[a(476)][a(460)]("|"),p=0;for(;;){switch(u[p++]){case"0":this[a(857)+"balEvent"+a(934)]();continue;case"1":this[a(957)+"ger"]?.[a(216)]();continue;case"2":if(!this[a(1165)])return void this._debug("close, w"+a(432)+"ce not i"+a(244)+"ed");continue;case"3":this[a(1414)+a(626)]=!0;continue;case"4":if(e[a(715)](this[a(1165)][a(1110)+"te"],this.CLOSED)||e.mlGPh(this._ws[a(1110)+"te"],this[a(664)]))return void this[a(1343)](e.QxKxB);continue;case"5":this._clearPingTimer();continue;case"6":this[a(239)+a(1263)+"t"](t,n);continue;case"7":this[a(1056)+a(804)]();continue}break}}async[r(1132)](t,n){let a=r;if(e.LKQal(null,t))throw new Error(e[a(1632)]);a(1309)==typeof t&&(t=JSON[a(1047)+"y"](t)),e[a(1293)](e[a(1118)],typeof t)&&!(t instanceof ArrayBuffer)&&!(t[a(506)]&&t[a(506)]instanceof ArrayBuffer)&&(t=JSON[a(1047)+"y"](t));let u=await e[a(608)](ks,t),p=e[a(243)](va,t),{method:h=0,service:m=this[a(163)][a(249)],logID:l=this[a(163)][a(1641)+a(394)](),headers:_=this._options.headers,payloadEncoding:v=this[a(163)][a(230)+a(320)],payloadType:A=this[a(163)][a(1195)+a(1237)],logIDNew:N=this._options["logIDNew"+a(705)][a(185)+a(663)+a(899)+"ew"]?e.lDmlh(o,this[a(163)][a(172)+a(705)][a(1444)]):""}=n||{};if(!m)throw new Error("please provide a"+a(782)+a(632));let R={SeqID:M[a(1164)+"er"](this._seqId++),LogID:M[a(1164)+"er"](l),service:m,method:h,headers:_,payloadEncoding:e.Krcsa(v,Object)?v[a(993)]?v[a(993)]:"":v,payloadType:e[a(1658)](A,Object)?A.type?A.type:p:A||p,payload:u,LogIDNew:N},O=ir(R);return this[a(1165)]&&e[a(1121)](this[a(1165)].readyState,this[a(919)])?(this._ws&&this[a(1165)][a(1132)](O),this[a(1343)](e.TJQvj,R)):e.xLbNC(this[a(431)+a(1288)][a(1620)],this[a(163)]["maxMessa"+a(1274)+a(1471)])?(this[a(431)+a(1288)].push(O),this[a(1343)](e[a(930)],R)):(this[a(431)+a(1288)][a(1513)](),this[a(431)+a(1288)].push(O)),{seqID:this[a(1226)],logID:l,logIDNew:N}}async reconnect(t){let n=r,{url:a}=e[n(1371)](t,{}),u=Array[n(171)](a)?a:e.iYuFb==typeof a?[a]:[];t&&Object[n(1038)](this[n(163)],t),u&&u[n(1620)]?this[n(1287)+n(1117)]=new Ss(u,this[n(163)][n(326)+"es"]):this["_endpoin"+n(1117)]?.[n(1657)+"pointCon"+n(1072)](),this[n(756)+n(992)]?.[n(273)+n(1355)](this._options["pingLoss"+n(450)]),this["_readyCl"+n(626)]=!1,this[n(1165)]&&this._ws[n(1110)+"te"]!==this.CLOSED?this[n(387)+n(986)](1e3,e[n(1408)],!0):(this[n(314)]=!0,this._connect())}async[r(1434)](){let t=r;if(!this["_connect"+t(1369)]){let n=e[t(177)][t(460)]("|"),a=0;for(;;){switch(n[a++]){case"0":this[t(1287)+t(1117)]?.[t(1657)+t(1124)+"fig"]();continue;case"1":this[t(756)+t(992)]?.resetCounter();continue;case"2":this[t(314)]=!0;continue;case"3":this[t(1414)+t(626)]=!1;continue;case"4":this._connect();continue}break}}}[r(1380)+r(934)](t,n){this.on(t,n)}[r(156)+r(913)](t){let{type:n}=t;this.emit(n,t)}removeEventListener(t,n){let a=r;e[a(1509)]===e[a(1136)]?this[a(1184)]?.del(_0x454692.message_id):this[a(1342)](t,n)}[r(1506)](){let t=r,n={gDuGT:function(a,u){return a(u)},WkeYk:e[t(400)],qetRz:e[t(1157)],EHdxn:function(a,u){return a>>u},rtgSg:function(a,u){return e[t(1543)](a,u)},fyOev:function(a,u,p){return a(u,p)},jThnq:e[t(1050)],ZvzKJ:t(1403),iIOES:function(a,u){return e[t(1027)](a,u)},FHEFi:e[t(803)],azGsA:function(a,u){return e[t(936)](a,u)},hZOil:e.RmkvX,FBUAI:e.dCuRs};return new Promise((a,u)=>{let p=t,h={iOqtX:function(m,l,_){return n[k(892)](m,l,_)},vxboB:n.jThnq,LMFnj:n[p(1303)],SihdS:function(m,l){return n[p(1058)](m,l)},bIbBq:n[p(1147)],DUVth:function(m,l){return n[p(389)](m,l)},RAgoG:n[p(1570)],SfnFh:n[p(542)]};if(n[p(1058)](n.FBUAI,"bgNmQ")){this._clearPingTimer(),this[p(514)+p(1396)+"Id"]=setTimeout(this[p(1322)][p(1577)](this),this[p(163)][p(1478)+p(1271)]);let m=()=>{let _=p;n[_(356)](a,_(227)),this.off(n[_(810)],m),this.off(n[_(542)],l)},l=()=>{let _=p;if(h[_(534)](h[_(736)],"ghlDe")){let v=IWoQLO[_(206)](_0x5793d1,IWoQLO[_(1550)],{message:this["_formatE"+_(1311)+_(1642)](_0x253b16)});this.emit(IWoQLO[_(1550)],v);let A=IWoQLO[_(206)](_0x2a35e0,IWoQLO[_(1103)],{reason:this["_formatE"+_(1311)+_(1642)](_0x29f7c3)});this[_(1412)](_(1403),A)}else h[_(789)](u,h[_(1230)]),this[_(1342)](_(1502)+_(1187)+"s",m),this[_(1342)](h[_(1273)],l)};this.on(n.WkeYk,m),this.on(n[p(542)],l),this[p(1322)]()}else return _0x59d3a6|=0,{low:_0x778678,high:BQVyvH[p(418)](_0x4788e4,31),unsigned:BQVyvH.rtgSg(_0x281f96,0)}})}}})(),X[S(253)+S(1635)]=Y[S(253)+S(1635)],X[S(1579)+S(1606)]=Y[S(1579)+"rorEvent"],X[S(618)+"e"]=Y[S(618)+"e"],X[S(913)]=Y.Event,X[S(558)]=Y[S(558)],X[S(566)+S(1545)+S(748)]=Y[S(566)+S(1545)+S(748)],X[S(1545)+S(748)]=Y[S(1545)+S(748)],X[S(580)+"t"]=Y[S(580)+"t"],X[S(1011)+S(699)]=Y[S(1011)+S(699)],X.createCloseEvent=Y[S(1517)+S(1635)],X[S(1531)+S(1606)]=Y[S(1531)+S(1606)],X[S(536)+"ssageEvent"]=Y["createMe"+S(822)+"nt"],X["createOp"+S(890)]=Y[S(504)+S(890)],X[S(661)+S(1492)+S(748)]=Y["createRe"+S(1492)+S(748)],X[S(218)+S(574)]=Y[S(218)+"rame"],X[S(672)+S(1028)]=Y[S(672)+"ame"];for(Pn in Y)[S(253)+"oseEvent",S(1579)+S(1606),S(618)+"e",S(913),S(558),"Frontier"+S(1545)+S(748),S(1545)+S(748),"OpenEvent","Reconnec"+S(699),S(1517)+"oseEvent",S(1531)+S(1606),S(536)+"ssageEvent",S(504)+S(890),"createRe"+S(1492)+S(748),S(218)+S(574),S(672)+S(1028)][S(1648)](Pn)===-1&&(X[Pn]=Y[Pn]);var Pn;Object[S(1067)+"operty"](X,"__esModule",{value:!0})});var Ne=oe((gh,Ui)=>{"use strict";var qi=["nodebuffer","arraybuffer","fragments"],Fi=typeof Blob<"u";Fi&&qi.push("blob");Ui.exports={BINARY_TYPES:qi,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:Fi,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var zt=oe((ph,On)=>{"use strict";var{EMPTY_BUFFER:xx}=Ne(),Ir=Buffer[Symbol.species];function ux(r,e){if(r.length===0)return xx;if(r.length===1)return r[0];let i=Buffer.allocUnsafe(e),o=0;for(let c=0;c<r.length;c++){let x=r[c];i.set(x,o),o+=x.length}return o<e?new Ir(i.buffer,i.byteOffset,o):i}function Hi(r,e,i,o,c){for(let x=0;x<c;x++)i[o+x]=r[x]^e[x&3]}function Ki(r,e){for(let i=0;i<r.length;i++)r[i]^=e[i&3]}function fx(r){return r.length===r.buffer.byteLength?r.buffer:r.buffer.slice(r.byteOffset,r.byteOffset+r.length)}function Tr(r){if(Tr.readOnly=!0,Buffer.isBuffer(r))return r;let e;return r instanceof ArrayBuffer?e=new Ir(r):ArrayBuffer.isView(r)?e=new Ir(r.buffer,r.byteOffset,r.byteLength):(e=Buffer.from(r),Tr.readOnly=!1),e}On.exports={concat:ux,mask:Hi,toArrayBuffer:fx,toBuffer:Tr,unmask:Ki};if(!process.env.WS_NO_BUFFER_UTIL)try{let r=V("bufferutil");On.exports.mask=function(e,i,o,c,x){x<48?Hi(e,i,o,c,x):r.mask(e,i,o,c,x)},On.exports.unmask=function(e,i){e.length<32?Ki(e,i):r.unmask(e,i)}}catch{}});var ji=oe((mh,Wi)=>{"use strict";var Gi=Symbol("kDone"),Lr=Symbol("kRun"),Rr=class{constructor(e){this[Gi]=()=>{this.pending--,this[Lr]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[Lr]()}[Lr](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[Gi])}}};Wi.exports=Rr});var gt=oe((wh,Xi)=>{"use strict";var qt=V("zlib"),Ji=zt(),dx=ji(),{kStatusCode:Vi}=Ne(),lx=Buffer[Symbol.species],hx=Buffer.from([0,0,255,255]),Mn=Symbol("permessage-deflate"),Oe=Symbol("total-length"),lt=Symbol("callback"),We=Symbol("buffers"),ht=Symbol("error"),Bn,Nr=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,!Bn){let i=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;Bn=new dx(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,o=e.find(c=>!(i.serverNoContextTakeover===!1&&c.server_no_context_takeover||c.server_max_window_bits&&(i.serverMaxWindowBits===!1||typeof i.serverMaxWindowBits=="number"&&i.serverMaxWindowBits>c.server_max_window_bits)||typeof i.clientMaxWindowBits=="number"&&!c.client_max_window_bits));if(!o)throw new Error("None of the extension offers can be accepted");return i.serverNoContextTakeover&&(o.server_no_context_takeover=!0),i.clientNoContextTakeover&&(o.client_no_context_takeover=!0),typeof i.serverMaxWindowBits=="number"&&(o.server_max_window_bits=i.serverMaxWindowBits),typeof i.clientMaxWindowBits=="number"?o.client_max_window_bits=i.clientMaxWindowBits:(o.client_max_window_bits===!0||i.clientMaxWindowBits===!1)&&delete o.client_max_window_bits,o}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(o=>{let c=i[o];if(c.length>1)throw new Error(`Parameter "${o}" must have only a single value`);if(c=c[0],o==="client_max_window_bits"){if(c!==!0){let x=+c;if(!Number.isInteger(x)||x<8||x>15)throw new TypeError(`Invalid value for parameter "${o}": ${c}`);c=x}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${o}": ${c}`)}else if(o==="server_max_window_bits"){let x=+c;if(!Number.isInteger(x)||x<8||x>15)throw new TypeError(`Invalid value for parameter "${o}": ${c}`);c=x}else if(o==="client_no_context_takeover"||o==="server_no_context_takeover"){if(c!==!0)throw new TypeError(`Invalid value for parameter "${o}": ${c}`)}else throw new Error(`Unknown parameter "${o}"`);i[o]=c})}),e}decompress(e,i,o){Bn.add(c=>{this._decompress(e,i,(x,f)=>{c(),o(x,f)})})}compress(e,i,o){Bn.add(c=>{this._compress(e,i,(x,f)=>{c(),o(x,f)})})}_decompress(e,i,o){let c=this._isServer?"client":"server";if(!this._inflate){let x=`${c}_max_window_bits`,f=typeof this.params[x]!="number"?qt.Z_DEFAULT_WINDOWBITS:this.params[x];this._inflate=qt.createInflateRaw({...this._options.zlibInflateOptions,windowBits:f}),this._inflate[Mn]=this,this._inflate[Oe]=0,this._inflate[We]=[],this._inflate.on("error",px),this._inflate.on("data",Yi)}this._inflate[lt]=o,this._inflate.write(e),i&&this._inflate.write(hx),this._inflate.flush(()=>{let x=this._inflate[ht];if(x){this._inflate.close(),this._inflate=null,o(x);return}let f=Ji.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[`${c}_no_context_takeover`]&&this._inflate.reset()),o(null,f)})}_compress(e,i,o){let c=this._isServer?"server":"client";if(!this._deflate){let x=`${c}_max_window_bits`,f=typeof this.params[x]!="number"?qt.Z_DEFAULT_WINDOWBITS:this.params[x];this._deflate=qt.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:f}),this._deflate[Oe]=0,this._deflate[We]=[],this._deflate.on("data",gx)}this._deflate[lt]=o,this._deflate.write(e),this._deflate.flush(qt.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let x=Ji.concat(this._deflate[We],this._deflate[Oe]);i&&(x=new lx(x.buffer,x.byteOffset,x.length-4)),this._deflate[lt]=null,this._deflate[Oe]=0,this._deflate[We]=[],i&&this.params[`${c}_no_context_takeover`]&&this._deflate.reset(),o(null,x)})}};Xi.exports=Nr;function gx(r){this[We].push(r),this[Oe]+=r.length}function Yi(r){if(this[Oe]+=r.length,this[Mn]._maxPayload<1||this[Oe]<=this[Mn]._maxPayload){this[We].push(r);return}this[ht]=new RangeError("Max payload size exceeded"),this[ht].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[ht][Vi]=1009,this.removeListener("data",Yi),this.reset()}function px(r){if(this[Mn]._inflate=null,this[ht]){this[lt](this[ht]);return}r[Vi]=1007,this[lt](r)}});var pt=oe((_h,zn)=>{"use strict";var{isUtf8:$i}=V("buffer"),{hasBlob:mx}=Ne(),_x=[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 yx(r){return r>=1e3&&r<=1014&&r!==1004&&r!==1005&&r!==1006||r>=3e3&&r<=4999}function Or(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 bx(r){return mx&&typeof r=="object"&&typeof r.arrayBuffer=="function"&&typeof r.type=="string"&&typeof r.stream=="function"&&(r[Symbol.toStringTag]==="Blob"||r[Symbol.toStringTag]==="File")}zn.exports={isBlob:bx,isValidStatusCode:yx,isValidUTF8:Or,tokenChars:_x};if($i)zn.exports.isValidUTF8=function(r){return r.length<24?Or(r):$i(r)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let r=V("utf-8-validate");zn.exports.isValidUTF8=function(e){return e.length<32?Or(e):r(e)}}catch{}});var Fr=oe((yh,so)=>{"use strict";var{Writable:vx}=V("stream"),Qi=gt(),{BINARY_TYPES:Sx,EMPTY_BUFFER:Zi,kStatusCode:Cx,kWebSocket:Ex}=Ne(),{concat:Br,toArrayBuffer:Ax,unmask:kx}=zt(),{isValidStatusCode:Px,isValidUTF8:eo}=pt(),qn=Buffer[Symbol.species],le=0,to=1,no=2,ro=3,Mr=4,zr=5,Fn=6,qr=class extends vx{constructor(e={}){super(),this._allowSynchronousEvents=e.allowSynchronousEvents!==void 0?e.allowSynchronousEvents:!0,this._binaryType=e.binaryType||Sx[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxPayload=e.maxPayload|0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[Ex]=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,i,o){if(this._opcode===8&&this._state==le)return o();this._bufferedBytes+=e.length,this._buffers.push(e),this.startLoop(o)}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){let o=this._buffers[0];return this._buffers[0]=new qn(o.buffer,o.byteOffset+e,o.length-e),new qn(o.buffer,o.byteOffset,e)}let i=Buffer.allocUnsafe(e);do{let o=this._buffers[0],c=i.length-e;e>=o.length?i.set(this._buffers.shift(),c):(i.set(new Uint8Array(o.buffer,o.byteOffset,e),c),this._buffers[0]=new qn(o.buffer,o.byteOffset+e,o.length-e)),e-=o.length}while(e>0);return i}startLoop(e){this._loop=!0;do switch(this._state){case le:this.getInfo(e);break;case to:this.getPayloadLength16(e);break;case no:this.getPayloadLength64(e);break;case ro:this.getMask();break;case Mr:this.getData(e);break;case zr:case Fn: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 c=this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");e(c);return}let o=(i[0]&64)===64;if(o&&!this._extensions[Qi.extensionName]){let c=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(c);return}if(this._fin=(i[0]&128)===128,this._opcode=i[0]&15,this._payloadLength=i[1]&127,this._opcode===0){if(o){let c=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(c);return}if(!this._fragmented){let c=this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");e(c);return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){let c=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");e(c);return}this._compressed=o}else if(this._opcode>7&&this._opcode<11){if(!this._fin){let c=this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");e(c);return}if(o){let c=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(c);return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){let c=this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");e(c);return}}else{let c=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");e(c);return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(i[1]&128)===128,this._isServer){if(!this._masked){let c=this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK");e(c);return}}else if(this._masked){let c=this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");e(c);return}this._payloadLength===126?this._state=to:this._payloadLength===127?this._state=no: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),o=i.readUInt32BE(0);if(o>Math.pow(2,21)-1){let c=this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");e(c);return}this._payloadLength=o*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=ro:this._state=Mr}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=Mr}getData(e){let i=Zi;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&&kx(i,this._mask)}if(this._opcode>7){this.controlMessage(i,e);return}if(this._compressed){this._state=zr,this.decompress(i,e);return}i.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(i)),this.dataMessage(e)}decompress(e,i){this._extensions[Qi.extensionName].decompress(e,this._fin,(c,x)=>{if(c)return i(c);if(x.length){if(this._messageLength+=x.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let f=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");i(f);return}this._fragments.push(x)}this.dataMessage(i),this._state===le&&this.startLoop(i)})}dataMessage(e){if(!this._fin){this._state=le;return}let i=this._messageLength,o=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let c;this._binaryType==="nodebuffer"?c=Br(o,i):this._binaryType==="arraybuffer"?c=Ax(Br(o,i)):this._binaryType==="blob"?c=new Blob(o):c=o,this._allowSynchronousEvents?(this.emit("message",c,!0),this._state=le):(this._state=Fn,setImmediate(()=>{this.emit("message",c,!0),this._state=le,this.startLoop(e)}))}else{let c=Br(o,i);if(!this._skipUTF8Validation&&!eo(c)){let x=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");e(x);return}this._state===zr||this._allowSynchronousEvents?(this.emit("message",c,!1),this._state=le):(this._state=Fn,setImmediate(()=>{this.emit("message",c,!1),this._state=le,this.startLoop(e)}))}}controlMessage(e,i){if(this._opcode===8){if(e.length===0)this._loop=!1,this.emit("conclude",1005,Zi),this.end();else{let o=e.readUInt16BE(0);if(!Px(o)){let x=this.createError(RangeError,`invalid status code ${o}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");i(x);return}let c=new qn(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!eo(c)){let x=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");i(x);return}this._loop=!1,this.emit("conclude",o,c),this.end()}this._state=le;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?"ping":"pong",e),this._state=le):(this._state=Fn,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",e),this._state=le,this.startLoop(i)}))}createError(e,i,o,c,x){this._loop=!1,this._errored=!0;let f=new e(o?`Invalid WebSocket frame: ${i}`:i);return Error.captureStackTrace(f,this.createError),f.code=x,f[Cx]=c,f}};so.exports=qr});var Kr=oe((vh,ao)=>{"use strict";var{Duplex:bh}=V("stream"),{randomFillSync:Dx}=V("crypto"),io=gt(),{EMPTY_BUFFER:Ix,kWebSocket:Tx,NOOP:Lx}=Ne(),{isBlob:mt,isValidStatusCode:Rx}=pt(),{mask:oo,toBuffer:$e}=zt(),he=Symbol("kByteLength"),Nx=Buffer.alloc(4),Un=8*1024,Qe,wt=Un,we=0,Ox=1,Bx=2,Ur=class r{constructor(e,i,o){this._extensions=i||{},o&&(this._generateMask=o,this._maskBuffer=Buffer.alloc(4)),this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=we,this.onerror=Lx,this[Tx]=void 0}static frame(e,i){let o,c=!1,x=2,f=!1;i.mask&&(o=i.maskBuffer||Nx,i.generateMask?i.generateMask(o):(wt===Un&&(Qe===void 0&&(Qe=Buffer.alloc(Un)),Dx(Qe,0,Un),wt=0),o[0]=Qe[wt++],o[1]=Qe[wt++],o[2]=Qe[wt++],o[3]=Qe[wt++]),f=(o[0]|o[1]|o[2]|o[3])===0,x=6);let d;typeof e=="string"?(!i.mask||f)&&i[he]!==void 0?d=i[he]:(e=Buffer.from(e),d=e.length):(d=e.length,c=i.mask&&i.readOnly&&!f);let g=d;d>=65536?(x+=8,g=127):d>125&&(x+=2,g=126);let w=Buffer.allocUnsafe(c?d+x:x);return w[0]=i.fin?i.opcode|128:i.opcode,i.rsv1&&(w[0]|=64),w[1]=g,g===126?w.writeUInt16BE(d,2):g===127&&(w[2]=w[3]=0,w.writeUIntBE(d,4,6)),i.mask?(w[1]|=128,w[x-4]=o[0],w[x-3]=o[1],w[x-2]=o[2],w[x-1]=o[3],f?[w,e]:c?(oo(e,o,w,x,d),[w]):(oo(e,o,e,0,d),[w,e])):[w,e]}close(e,i,o,c){let x;if(e===void 0)x=Ix;else{if(typeof e!="number"||!Rx(e))throw new TypeError("First argument must be a valid error code number");if(i===void 0||!i.length)x=Buffer.allocUnsafe(2),x.writeUInt16BE(e,0);else{let d=Buffer.byteLength(i);if(d>123)throw new RangeError("The message must not be greater than 123 bytes");x=Buffer.allocUnsafe(2+d),x.writeUInt16BE(e,0),typeof i=="string"?x.write(i,2):x.set(i,2)}}let f={[he]:x.length,fin:!0,generateMask:this._generateMask,mask:o,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state!==we?this.enqueue([this.dispatch,x,!1,f,c]):this.sendFrame(r.frame(x,f),c)}ping(e,i,o){let c,x;if(typeof e=="string"?(c=Buffer.byteLength(e),x=!1):mt(e)?(c=e.size,x=!1):(e=$e(e),c=e.length,x=$e.readOnly),c>125)throw new RangeError("The data size must not be greater than 125 bytes");let f={[he]:c,fin:!0,generateMask:this._generateMask,mask:i,maskBuffer:this._maskBuffer,opcode:9,readOnly:x,rsv1:!1};mt(e)?this._state!==we?this.enqueue([this.getBlobData,e,!1,f,o]):this.getBlobData(e,!1,f,o):this._state!==we?this.enqueue([this.dispatch,e,!1,f,o]):this.sendFrame(r.frame(e,f),o)}pong(e,i,o){let c,x;if(typeof e=="string"?(c=Buffer.byteLength(e),x=!1):mt(e)?(c=e.size,x=!1):(e=$e(e),c=e.length,x=$e.readOnly),c>125)throw new RangeError("The data size must not be greater than 125 bytes");let f={[he]:c,fin:!0,generateMask:this._generateMask,mask:i,maskBuffer:this._maskBuffer,opcode:10,readOnly:x,rsv1:!1};mt(e)?this._state!==we?this.enqueue([this.getBlobData,e,!1,f,o]):this.getBlobData(e,!1,f,o):this._state!==we?this.enqueue([this.dispatch,e,!1,f,o]):this.sendFrame(r.frame(e,f),o)}send(e,i,o){let c=this._extensions[io.extensionName],x=i.binary?2:1,f=i.compress,d,g;typeof e=="string"?(d=Buffer.byteLength(e),g=!1):mt(e)?(d=e.size,g=!1):(e=$e(e),d=e.length,g=$e.readOnly),this._firstFragment?(this._firstFragment=!1,f&&c&&c.params[c._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(f=d>=c._threshold),this._compress=f):(f=!1,x=0),i.fin&&(this._firstFragment=!0);let w={[he]:d,fin:i.fin,generateMask:this._generateMask,mask:i.mask,maskBuffer:this._maskBuffer,opcode:x,readOnly:g,rsv1:f};mt(e)?this._state!==we?this.enqueue([this.getBlobData,e,this._compress,w,o]):this.getBlobData(e,this._compress,w,o):this._state!==we?this.enqueue([this.dispatch,e,this._compress,w,o]):this.dispatch(e,this._compress,w,o)}getBlobData(e,i,o,c){this._bufferedBytes+=o[he],this._state=Bx,e.arrayBuffer().then(x=>{if(this._socket.destroyed){let d=new Error("The socket was closed while the blob was being read");process.nextTick(Hr,this,d,c);return}this._bufferedBytes-=o[he];let f=$e(x);i?this.dispatch(f,i,o,c):(this._state=we,this.sendFrame(r.frame(f,o),c),this.dequeue())}).catch(x=>{process.nextTick(Mx,this,x,c)})}dispatch(e,i,o,c){if(!i){this.sendFrame(r.frame(e,o),c);return}let x=this._extensions[io.extensionName];this._bufferedBytes+=o[he],this._state=Ox,x.compress(e,o.fin,(f,d)=>{if(this._socket.destroyed){let g=new Error("The socket was closed while data was being compressed");Hr(this,g,c);return}this._bufferedBytes-=o[he],this._state=we,o.readOnly=!1,this.sendFrame(r.frame(d,o),c),this.dequeue()})}dequeue(){for(;this._state===we&&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,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)}};ao.exports=Ur;function Hr(r,e,i){typeof i=="function"&&i(e);for(let o=0;o<r._queue.length;o++){let c=r._queue[o],x=c[c.length-1];typeof x=="function"&&x(e)}}function Mx(r,e,i){Hr(r,e,i),r.onerror(e)}});var mo=oe((Sh,po)=>{"use strict";var{kForOnEventAttribute:Ft,kListener:Gr}=Ne(),co=Symbol("kCode"),xo=Symbol("kData"),uo=Symbol("kError"),fo=Symbol("kMessage"),lo=Symbol("kReason"),_t=Symbol("kTarget"),ho=Symbol("kType"),go=Symbol("kWasClean"),Be=class{constructor(e){this[_t]=null,this[ho]=e}get target(){return this[_t]}get type(){return this[ho]}};Object.defineProperty(Be.prototype,"target",{enumerable:!0});Object.defineProperty(Be.prototype,"type",{enumerable:!0});var Ze=class extends Be{constructor(e,i={}){super(e),this[co]=i.code===void 0?0:i.code,this[lo]=i.reason===void 0?"":i.reason,this[go]=i.wasClean===void 0?!1:i.wasClean}get code(){return this[co]}get reason(){return this[lo]}get wasClean(){return this[go]}};Object.defineProperty(Ze.prototype,"code",{enumerable:!0});Object.defineProperty(Ze.prototype,"reason",{enumerable:!0});Object.defineProperty(Ze.prototype,"wasClean",{enumerable:!0});var yt=class extends Be{constructor(e,i={}){super(e),this[uo]=i.error===void 0?null:i.error,this[fo]=i.message===void 0?"":i.message}get error(){return this[uo]}get message(){return this[fo]}};Object.defineProperty(yt.prototype,"error",{enumerable:!0});Object.defineProperty(yt.prototype,"message",{enumerable:!0});var Ut=class extends Be{constructor(e,i={}){super(e),this[xo]=i.data===void 0?null:i.data}get data(){return this[xo]}};Object.defineProperty(Ut.prototype,"data",{enumerable:!0});var zx={addEventListener(r,e,i={}){for(let c of this.listeners(r))if(!i[Ft]&&c[Gr]===e&&!c[Ft])return;let o;if(r==="message")o=function(x,f){let d=new Ut("message",{data:f?x:x.toString()});d[_t]=this,Hn(e,this,d)};else if(r==="close")o=function(x,f){let d=new Ze("close",{code:x,reason:f.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});d[_t]=this,Hn(e,this,d)};else if(r==="error")o=function(x){let f=new yt("error",{error:x,message:x.message});f[_t]=this,Hn(e,this,f)};else if(r==="open")o=function(){let x=new Be("open");x[_t]=this,Hn(e,this,x)};else return;o[Ft]=!!i[Ft],o[Gr]=e,i.once?this.once(r,o):this.on(r,o)},removeEventListener(r,e){for(let i of this.listeners(r))if(i[Gr]===e&&!i[Ft]){this.removeListener(r,i);break}}};po.exports={CloseEvent:Ze,ErrorEvent:yt,Event:Be,EventTarget:zx,MessageEvent:Ut};function Hn(r,e,i){typeof r=="object"&&r.handleEvent?r.handleEvent.call(r,i):r.call(e,i)}});var Kn=oe((Ch,wo)=>{"use strict";var{tokenChars:Ht}=pt();function Ae(r,e,i){r[e]===void 0?r[e]=[i]:r[e].push(i)}function qx(r){let e=Object.create(null),i=Object.create(null),o=!1,c=!1,x=!1,f,d,g=-1,w=-1,b=-1,y=0;for(;y<r.length;y++)if(w=r.charCodeAt(y),f===void 0)if(b===-1&&Ht[w]===1)g===-1&&(g=y);else if(y!==0&&(w===32||w===9))b===-1&&g!==-1&&(b=y);else if(w===59||w===44){if(g===-1)throw new SyntaxError(`Unexpected character at index ${y}`);b===-1&&(b=y);let P=r.slice(g,b);w===44?(Ae(e,P,i),i=Object.create(null)):f=P,g=b=-1}else throw new SyntaxError(`Unexpected character at index ${y}`);else if(d===void 0)if(b===-1&&Ht[w]===1)g===-1&&(g=y);else if(w===32||w===9)b===-1&&g!==-1&&(b=y);else if(w===59||w===44){if(g===-1)throw new SyntaxError(`Unexpected character at index ${y}`);b===-1&&(b=y),Ae(i,r.slice(g,b),!0),w===44&&(Ae(e,f,i),i=Object.create(null),f=void 0),g=b=-1}else if(w===61&&g!==-1&&b===-1)d=r.slice(g,y),g=b=-1;else throw new SyntaxError(`Unexpected character at index ${y}`);else if(c){if(Ht[w]!==1)throw new SyntaxError(`Unexpected character at index ${y}`);g===-1?g=y:o||(o=!0),c=!1}else if(x)if(Ht[w]===1)g===-1&&(g=y);else if(w===34&&g!==-1)x=!1,b=y;else if(w===92)c=!0;else throw new SyntaxError(`Unexpected character at index ${y}`);else if(w===34&&r.charCodeAt(y-1)===61)x=!0;else if(b===-1&&Ht[w]===1)g===-1&&(g=y);else if(g!==-1&&(w===32||w===9))b===-1&&(b=y);else if(w===59||w===44){if(g===-1)throw new SyntaxError(`Unexpected character at index ${y}`);b===-1&&(b=y);let P=r.slice(g,b);o&&(P=P.replace(/\\/g,""),o=!1),Ae(i,d,P),w===44&&(Ae(e,f,i),i=Object.create(null),f=void 0),d=void 0,g=b=-1}else throw new SyntaxError(`Unexpected character at index ${y}`);if(g===-1||x||w===32||w===9)throw new SyntaxError("Unexpected end of input");b===-1&&(b=y);let C=r.slice(g,b);return f===void 0?Ae(e,C,i):(d===void 0?Ae(i,C,!0):o?Ae(i,d,C.replace(/\\/g,"")):Ae(i,d,C),Ae(e,f,i)),e}function Fx(r){return Object.keys(r).map(e=>{let i=r[e];return Array.isArray(i)||(i=[i]),i.map(o=>[e].concat(Object.keys(o).map(c=>{let x=o[c];return Array.isArray(x)||(x=[x]),x.map(f=>f===!0?c:`${c}=${f}`).join("; ")})).join("; ")).join(", ")}).join(", ")}wo.exports={format:Fx,parse:qx}});var Jn=oe((kh,Io)=>{"use strict";var Ux=V("events"),Hx=V("https"),Kx=V("http"),bo=V("net"),Gx=V("tls"),{randomBytes:Wx,createHash:jx}=V("crypto"),{Duplex:Eh,Readable:Ah}=V("stream"),{URL:Wr}=V("url"),je=gt(),Jx=Fr(),Vx=Kr(),{isBlob:Yx}=pt(),{BINARY_TYPES:_o,CLOSE_TIMEOUT:Xx,EMPTY_BUFFER:Gn,GUID:$x,kForOnEventAttribute:jr,kListener:Qx,kStatusCode:Zx,kWebSocket:$,NOOP:vo}=Ne(),{EventTarget:{addEventListener:eu,removeEventListener:tu}}=mo(),{format:nu,parse:ru}=Kn(),{toBuffer:su}=zt(),So=Symbol("kAborted"),Jr=[8,13],Me=["CONNECTING","OPEN","CLOSING","CLOSED"],iu=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,H=class r extends Ux{constructor(e,i,o){super(),this._binaryType=_o[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=Gn,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?(o=i,i=[]):i=[i]),Co(this,e,i,o)):(this._autoPong=o.autoPong,this._closeTimeout=o.closeTimeout,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(e){_o.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,o){let c=new Jx({allowSynchronousEvents:o.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:o.maxPayload,skipUTF8Validation:o.skipUTF8Validation}),x=new Vx(e,this._extensions,o.generateMask);this._receiver=c,this._sender=x,this._socket=e,c[$]=this,x[$]=this,e[$]=this,c.on("conclude",cu),c.on("drain",xu),c.on("error",uu),c.on("message",fu),c.on("ping",du),c.on("pong",lu),x.onerror=hu,e.setTimeout&&e.setTimeout(0),e.setNoDelay&&e.setNoDelay(),i.length>0&&e.unshift(i),e.on("close",ko),e.on("data",jn),e.on("end",Po),e.on("error",Do),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){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,i,!this._isServer,o=>{o||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),Ao(this)}}pause(){this.readyState===r.CONNECTING||this.readyState===r.CLOSED||(this._paused=!0,this._socket.pause())}ping(e,i,o){if(this.readyState===r.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(o=e,e=i=void 0):typeof i=="function"&&(o=i,i=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==r.OPEN){Vr(this,e,o);return}i===void 0&&(i=!this._isServer),this._sender.ping(e||Gn,i,o)}pong(e,i,o){if(this.readyState===r.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(o=e,e=i=void 0):typeof i=="function"&&(o=i,i=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==r.OPEN){Vr(this,e,o);return}i===void 0&&(i=!this._isServer),this._sender.pong(e||Gn,i,o)}resume(){this.readyState===r.CONNECTING||this.readyState===r.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(e,i,o){if(this.readyState===r.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof i=="function"&&(o=i,i={}),typeof e=="number"&&(e=e.toString()),this.readyState!==r.OPEN){Vr(this,e,o);return}let c={binary:typeof e!="string",mask:!this._isServer,compress:!0,fin:!0,...i};this._extensions[je.extensionName]||(c.compress=!1),this._sender.send(e||Gn,c,o)}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(H,"CONNECTING",{enumerable:!0,value:Me.indexOf("CONNECTING")});Object.defineProperty(H.prototype,"CONNECTING",{enumerable:!0,value:Me.indexOf("CONNECTING")});Object.defineProperty(H,"OPEN",{enumerable:!0,value:Me.indexOf("OPEN")});Object.defineProperty(H.prototype,"OPEN",{enumerable:!0,value:Me.indexOf("OPEN")});Object.defineProperty(H,"CLOSING",{enumerable:!0,value:Me.indexOf("CLOSING")});Object.defineProperty(H.prototype,"CLOSING",{enumerable:!0,value:Me.indexOf("CLOSING")});Object.defineProperty(H,"CLOSED",{enumerable:!0,value:Me.indexOf("CLOSED")});Object.defineProperty(H.prototype,"CLOSED",{enumerable:!0,value:Me.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(r=>{Object.defineProperty(H.prototype,r,{enumerable:!0})});["open","error","close","message"].forEach(r=>{Object.defineProperty(H.prototype,`on${r}`,{enumerable:!0,get(){for(let e of this.listeners(r))if(e[jr])return e[Qx];return null},set(e){for(let i of this.listeners(r))if(i[jr]){this.removeListener(r,i);break}typeof e=="function"&&this.addEventListener(r,e,{[jr]:!0})}})});H.prototype.addEventListener=eu;H.prototype.removeEventListener=tu;Io.exports=H;function Co(r,e,i,o){let c={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:Xx,protocolVersion:Jr[1],maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...o,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=c.autoPong,r._closeTimeout=c.closeTimeout,!Jr.includes(c.protocolVersion))throw new RangeError(`Unsupported protocol version: ${c.protocolVersion} (supported versions: ${Jr.join(", ")})`);let x;if(e instanceof Wr)x=e;else try{x=new Wr(e)}catch{throw new SyntaxError(`Invalid URL: ${e}`)}x.protocol==="http:"?x.protocol="ws:":x.protocol==="https:"&&(x.protocol="wss:"),r._url=x.href;let f=x.protocol==="wss:",d=x.protocol==="ws+unix:",g;if(x.protocol!=="ws:"&&!f&&!d?g=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:d&&!x.pathname?g="The URL's pathname is empty":x.hash&&(g="The URL contains a fragment identifier"),g){let T=new SyntaxError(g);if(r._redirects===0)throw T;Wn(r,T);return}let w=f?443:80,b=Wx(16).toString("base64"),y=f?Hx.request:Kx.request,C=new Set,P;if(c.createConnection=c.createConnection||(f?au:ou),c.defaultPort=c.defaultPort||w,c.port=x.port||w,c.host=x.hostname.startsWith("[")?x.hostname.slice(1,-1):x.hostname,c.headers={...c.headers,"Sec-WebSocket-Version":c.protocolVersion,"Sec-WebSocket-Key":b,Connection:"Upgrade",Upgrade:"websocket"},c.path=x.pathname+x.search,c.timeout=c.handshakeTimeout,c.perMessageDeflate&&(P=new je({...c.perMessageDeflate,isServer:!1,maxPayload:c.maxPayload}),c.headers["Sec-WebSocket-Extensions"]=nu({[je.extensionName]:P.offer()})),i.length){for(let T of i){if(typeof T!="string"||!iu.test(T)||C.has(T))throw new SyntaxError("An invalid or duplicated subprotocol was specified");C.add(T)}c.headers["Sec-WebSocket-Protocol"]=i.join(",")}if(c.origin&&(c.protocolVersion<13?c.headers["Sec-WebSocket-Origin"]=c.origin:c.headers.Origin=c.origin),(x.username||x.password)&&(c.auth=`${x.username}:${x.password}`),d){let T=c.path.split(":");c.socketPath=T[0],c.path=T[1]}let I;if(c.followRedirects){if(r._redirects===0){r._originalIpc=d,r._originalSecure=f,r._originalHostOrSocketPath=d?c.socketPath:x.host;let T=o&&o.headers;if(o={...o,headers:{}},T)for(let[z,re]of Object.entries(T))o.headers[z.toLowerCase()]=re}else if(r.listenerCount("redirect")===0){let T=d?r._originalIpc?c.socketPath===r._originalHostOrSocketPath:!1:r._originalIpc?!1:x.host===r._originalHostOrSocketPath;(!T||r._originalSecure&&!f)&&(delete c.headers.authorization,delete c.headers.cookie,T||delete c.headers.host,c.auth=void 0)}c.auth&&!o.headers.authorization&&(o.headers.authorization="Basic "+Buffer.from(c.auth).toString("base64")),I=r._req=y(c),r._redirects&&r.emit("redirect",r.url,I)}else I=r._req=y(c);c.timeout&&I.on("timeout",()=>{fe(r,I,"Opening handshake has timed out")}),I.on("error",T=>{I===null||I[So]||(I=r._req=null,Wn(r,T))}),I.on("response",T=>{let z=T.headers.location,re=T.statusCode;if(z&&c.followRedirects&&re>=300&&re<400){if(++r._redirects>c.maxRedirects){fe(r,I,"Maximum redirects exceeded");return}I.abort();let Q;try{Q=new Wr(z,e)}catch{let ae=new SyntaxError(`Invalid URL: ${z}`);Wn(r,ae);return}Co(r,Q,i,o)}else r.emit("unexpected-response",I,T)||fe(r,I,`Unexpected server response: ${T.statusCode}`)}),I.on("upgrade",(T,z,re)=>{if(r.emit("upgrade",T),r.readyState!==H.CONNECTING)return;I=r._req=null;let Q=T.headers.upgrade;if(Q===void 0||Q.toLowerCase()!=="websocket"){fe(r,z,"Invalid Upgrade header");return}let _e=jx("sha1").update(b+$x).digest("base64");if(T.headers["sec-websocket-accept"]!==_e){fe(r,z,"Invalid Sec-WebSocket-Accept header");return}let ae=T.headers["sec-websocket-protocol"],D;if(ae!==void 0?C.size?C.has(ae)||(D="Server sent an invalid subprotocol"):D="Server sent a subprotocol but none was requested":C.size&&(D="Server sent no subprotocol"),D){fe(r,z,D);return}ae&&(r._protocol=ae);let q=T.headers["sec-websocket-extensions"];if(q!==void 0){if(!P){fe(r,z,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let j;try{j=ru(q)}catch{fe(r,z,"Invalid Sec-WebSocket-Extensions header");return}let Z=Object.keys(j);if(Z.length!==1||Z[0]!==je.extensionName){fe(r,z,"Server indicated an extension that was not requested");return}try{P.accept(j[je.extensionName])}catch{fe(r,z,"Invalid Sec-WebSocket-Extensions header");return}r._extensions[je.extensionName]=P}r.setSocket(z,re,{allowSynchronousEvents:c.allowSynchronousEvents,generateMask:c.generateMask,maxPayload:c.maxPayload,skipUTF8Validation:c.skipUTF8Validation})}),c.finishRequest?c.finishRequest(I,r):I.end()}function Wn(r,e){r._readyState=H.CLOSING,r._errorEmitted=!0,r.emit("error",e),r.emitClose()}function ou(r){return r.path=r.socketPath,bo.connect(r)}function au(r){return r.path=void 0,!r.servername&&r.servername!==""&&(r.servername=bo.isIP(r.host)?"":r.host),Gx.connect(r)}function fe(r,e,i){r._readyState=H.CLOSING;let o=new Error(i);Error.captureStackTrace(o,fe),e.setHeader?(e[So]=!0,e.abort(),e.socket&&!e.socket.destroyed&&e.socket.destroy(),process.nextTick(Wn,r,o)):(e.destroy(o),e.once("error",r.emit.bind(r,"error")),e.once("close",r.emitClose.bind(r)))}function Vr(r,e,i){if(e){let o=Yx(e)?e.size:su(e).length;r._socket?r._sender._bufferedBytes+=o:r._bufferedAmount+=o}if(i){let o=new Error(`WebSocket is not open: readyState ${r.readyState} (${Me[r.readyState]})`);process.nextTick(i,o)}}function cu(r,e){let i=this[$];i._closeFrameReceived=!0,i._closeMessage=e,i._closeCode=r,i._socket[$]!==void 0&&(i._socket.removeListener("data",jn),process.nextTick(Eo,i._socket),r===1005?i.close():i.close(r,e))}function xu(){let r=this[$];r.isPaused||r._socket.resume()}function uu(r){let e=this[$];e._socket[$]!==void 0&&(e._socket.removeListener("data",jn),process.nextTick(Eo,e._socket),e.close(r[Zx])),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",r))}function yo(){this[$].emitClose()}function fu(r,e){this[$].emit("message",r,e)}function du(r){let e=this[$];e._autoPong&&e.pong(r,!this._isServer,vo),e.emit("ping",r)}function lu(r){this[$].emit("pong",r)}function Eo(r){r.resume()}function hu(r){let e=this[$];e.readyState!==H.CLOSED&&(e.readyState===H.OPEN&&(e._readyState=H.CLOSING,Ao(e)),this._socket.end(),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",r)))}function Ao(r){r._closeTimer=setTimeout(r._socket.destroy.bind(r._socket),r._closeTimeout)}function ko(){let r=this[$];if(this.removeListener("close",ko),this.removeListener("data",jn),this.removeListener("end",Po),r._readyState=H.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[$]=void 0,clearTimeout(r._closeTimer),r._receiver._writableState.finished||r._receiver._writableState.errorEmitted?r.emitClose():(r._receiver.on("error",yo),r._receiver.on("finish",yo))}function jn(r){this[$]._receiver.write(r)||this.pause()}function Po(){let r=this[$];r._readyState=H.CLOSING,r._receiver.end(),this.end()}function Do(){let r=this[$];this.removeListener("error",Do),this.on("error",vo),r&&(r._readyState=H.CLOSING,this.destroy())}});var No=oe((Dh,Ro)=>{"use strict";var Ph=Jn(),{Duplex:gu}=V("stream");function To(r){r.emit("close")}function pu(){!this.destroyed&&this._writableState.finished&&this.destroy()}function Lo(r){this.removeListener("error",Lo),this.destroy(),this.listenerCount("error")===0&&this.emit("error",r)}function mu(r,e){let i=!0,o=new gu({...e,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return r.on("message",function(x,f){let d=!f&&o._readableState.objectMode?x.toString():x;o.push(d)||r.pause()}),r.once("error",function(x){o.destroyed||(i=!1,o.destroy(x))}),r.once("close",function(){o.destroyed||o.push(null)}),o._destroy=function(c,x){if(r.readyState===r.CLOSED){x(c),process.nextTick(To,o);return}let f=!1;r.once("error",function(g){f=!0,x(g)}),r.once("close",function(){f||x(c),process.nextTick(To,o)}),i&&r.terminate()},o._final=function(c){if(r.readyState===r.CONNECTING){r.once("open",function(){o._final(c)});return}r._socket!==null&&(r._socket._writableState.finished?(c(),o._readableState.endEmitted&&o.destroy()):(r._socket.once("finish",function(){c()}),r.close()))},o._read=function(){r.isPaused&&r.resume()},o._write=function(c,x,f){if(r.readyState===r.CONNECTING){r.once("open",function(){o._write(c,x,f)});return}r.send(c,f)},o.on("end",pu),o.on("error",Lo),o}Ro.exports=mu});var Yr=oe((Ih,Oo)=>{"use strict";var{tokenChars:wu}=pt();function _u(r){let e=new Set,i=-1,o=-1,c=0;for(c;c<r.length;c++){let f=r.charCodeAt(c);if(o===-1&&wu[f]===1)i===-1&&(i=c);else if(c!==0&&(f===32||f===9))o===-1&&i!==-1&&(o=c);else if(f===44){if(i===-1)throw new SyntaxError(`Unexpected character at index ${c}`);o===-1&&(o=c);let d=r.slice(i,o);if(e.has(d))throw new SyntaxError(`The "${d}" subprotocol is duplicated`);e.add(d),i=o=-1}else throw new SyntaxError(`Unexpected character at index ${c}`)}if(i===-1||o!==-1)throw new SyntaxError("Unexpected end of input");let x=r.slice(i,c);if(e.has(x))throw new SyntaxError(`The "${x}" subprotocol is duplicated`);return e.add(x),e}Oo.exports={parse:_u}});var Ho=oe((Lh,Uo)=>{"use strict";var yu=V("events"),Vn=V("http"),{Duplex:Th}=V("stream"),{createHash:bu}=V("crypto"),Bo=Kn(),et=gt(),vu=Yr(),Su=Jn(),{CLOSE_TIMEOUT:Cu,GUID:Eu,kWebSocket:Au}=Ne(),ku=/^[+/0-9A-Za-z]{22}==$/,Mo=0,zo=1,Fo=2,Xr=class extends yu{constructor(e,i){if(super(),e={allowSynchronousEvents:!0,autoPong:!0,maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:Cu,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:Su,...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=Vn.createServer((o,c)=>{let x=Vn.STATUS_CODES[426];c.writeHead(426,{"Content-Length":x.length,"Content-Type":"text/plain"}),c.end(x)}),this._server.listen(e.port,e.host,e.backlog,i)):e.server&&(this._server=e.server),this._server){let o=this.emit.bind(this,"connection");this._removeListeners=Pu(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(c,x,f)=>{this.handleUpgrade(c,x,f,o)}})}e.perMessageDeflate===!0&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=Mo}address(){if(this.options.noServer)throw new Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(e){if(this._state===Fo){e&&this.once("close",()=>{e(new Error("The server is not running"))}),process.nextTick(Kt,this);return}if(e&&this.once("close",e),this._state!==zo)if(this._state=zo,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(Kt,this):process.nextTick(Kt,this);else{let i=this._server;this._removeListeners(),this._removeListeners=this._server=null,i.close(()=>{Kt(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,o,c){i.on("error",qo);let x=e.headers["sec-websocket-key"],f=e.headers.upgrade,d=+e.headers["sec-websocket-version"];if(e.method!=="GET"){nt(this,e,i,405,"Invalid HTTP method");return}if(f===void 0||f.toLowerCase()!=="websocket"){nt(this,e,i,400,"Invalid Upgrade header");return}if(x===void 0||!ku.test(x)){nt(this,e,i,400,"Missing or invalid Sec-WebSocket-Key header");return}if(d!==13&&d!==8){nt(this,e,i,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});return}if(!this.shouldHandle(e)){Gt(i,400);return}let g=e.headers["sec-websocket-protocol"],w=new Set;if(g!==void 0)try{w=vu.parse(g)}catch{nt(this,e,i,400,"Invalid Sec-WebSocket-Protocol header");return}let b=e.headers["sec-websocket-extensions"],y={};if(this.options.perMessageDeflate&&b!==void 0){let C=new et({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let P=Bo.parse(b);P[et.extensionName]&&(C.accept(P[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[`${d===8?"sec-websocket-origin":"origin"}`],secure:!!(e.socket.authorized||e.socket.encrypted),req:e};if(this.options.verifyClient.length===2){this.options.verifyClient(C,(P,I,T,z)=>{if(!P)return Gt(i,I||401,T,z);this.completeUpgrade(y,x,w,e,i,o,c)});return}if(!this.options.verifyClient(C))return Gt(i,401)}this.completeUpgrade(y,x,w,e,i,o,c)}completeUpgrade(e,i,o,c,x,f,d){if(!x.readable||!x.writable)return x.destroy();if(x[Au])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>Mo)return Gt(x,503);let w=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${bu("sha1").update(i+Eu).digest("base64")}`],b=new this.options.WebSocket(null,void 0,this.options);if(o.size){let y=this.options.handleProtocols?this.options.handleProtocols(o,c):o.values().next().value;y&&(w.push(`Sec-WebSocket-Protocol: ${y}`),b._protocol=y)}if(e[et.extensionName]){let y=e[et.extensionName].params,C=Bo.format({[et.extensionName]:[y]});w.push(`Sec-WebSocket-Extensions: ${C}`),b._extensions=e}this.emit("headers",w,c),x.write(w.concat(`\r
8
+ var i0=Object.create;var _r=Object.defineProperty;var o0=Object.getOwnPropertyDescriptor;var a0=Object.getOwnPropertyNames;var c0=Object.getPrototypeOf,x0=Object.prototype.hasOwnProperty;var X=(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 Te=(r,e)=>()=>(r&&(e=r(r=0)),e);var ce=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),Ns=(r,e)=>{for(var i in e)_r(r,i,{get:e[i],enumerable:!0})},u0=(r,e,i,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let c of a0(e))!x0.call(r,c)&&c!==i&&_r(r,c,{get:()=>e[c],enumerable:!(a=o0(e,c))||a.enumerable});return r};var Re=(r,e,i)=>(i=r!=null?i0(c0(r)):{},u0(e||!r||!r.__esModule?_r(i,"default",{value:r,enumerable:!0}):i,r));import{chmod as d0,mkdir as f0,readFile as l0,rename as Ls,writeFile as Os}from"node:fs/promises";import{dirname as h0}from"node:path";async function xt(r){try{let e=await l0(r,"utf8");return JSON.parse(e)}catch(e){if(e.code==="ENOENT")return null;throw e}}async function Xt(r,e,i){await f0(h0(r),{recursive:!0});let a=`${JSON.stringify(e,null,2)}
9
+ `,c=`${r}.tmp-${process.pid}-${Math.random().toString(36).slice(2,10)}`;try{i?.mode!==void 0?await Os(c,a,{encoding:"utf8",mode:i.mode}):await Os(c,a,"utf8"),await Ls(c,r),i?.mode!==void 0&&await d0(r,i.mode)}catch(u){await Ls(c,c).catch(()=>{});let{rm:d}=await import("node:fs/promises");throw await d(c,{force:!0}).catch(()=>{}),u}}var Zt=Te(()=>{"use strict"});function zs(r){return en[Bs]<=en[r]}function yr(r){Ms={...r}}function Qt(r,e,i,a){if(en[r]<en[Bs])return;let c=JSON.stringify({ts:new Date().toISOString(),level:r,module:e,msg:i,...Ms,...a});r==="error"||r==="warn"?p0.write(`${c}
10
+ `):g0.write(`${c}
11
+ `)}function N(r){return{debug:(e,i)=>Qt("debug",r,e,i),info:(e,i)=>Qt("info",r,e,i),warn:(e,i)=>Qt("warn",r,e,i),error:(e,i)=>Qt("error",r,e,i),child:e=>N(`${r}.${e}`)}}var en,Bs,g0,p0,Ms,G=Te(()=>{"use strict";en={debug:10,info:20,warn:30,error:40},Bs=(()=>{let r=process.env.COZE_BRIDGE_LOG_LEVEL;return r==="debug"||r==="info"||r==="warn"||r==="error"?r:"info"})(),g0=process.stdout,p0=process.stderr,Ms={}});import{homedir as m0}from"node:os";import{join as re}from"node:path";function j(r){let e=r??m0(),i=re(e,".coze"),a=re(i,"bridge"),c=re(a,"lib");return{cozeRoot:i,bridgeRoot:a,libDir:c,libEntry:re(c,"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(i,"agents")}}function Ne(r,e=j()){let i=re(e.agentsRoot,r);return{root:i,config:re(i,"config.json"),workspace:re(i,"workspace"),logs:re(i,"logs")}}var ue=Te(()=>{"use strict"});var rn={};Ns(rn,{AGENT_CONFIG_FILE_MODE:()=>tn,enforceAgentConfigMode:()=>y0,loadAgentConfig:()=>de,persistAgentSessions:()=>br,persistAgentSkills:()=>nn,saveAgentConfig:()=>we});import{chmod as w0,stat as _0}from"node:fs/promises";function de(r,e){return xt(Ne(r,e).config)}function we(r,e){return Xt(Ne(r.agentId,e).config,r,{mode:tn})}async function y0(r,e){if(process.platform==="win32")return;let i=Ne(r,e).config;try{let a=await _0(i);if(!a.isFile())return;let c=a.mode&511;c!==tn&&(await w0(i,tn),qs.warn("agent config mode auto-corrected to 0600",{path:i,from:c.toString(8)}))}catch(a){if(a.code==="ENOENT")return;qs.warn("enforceAgentConfigMode: chmod failed (ignored)",{path:i,err:String(a)})}}async function br(r,e,i){let a=await de(r,i);a&&(a.sessions=Object.fromEntries(e),await we(a,i))}async function nn(r,e,i){let a=await de(r,i);a&&(a.skills=e,await we(a,i))}var qs,tn,Ke=Te(()=>{"use strict";Zt();G();ue();qs=N("agent-config"),tn=384});var Mi=ce(Y=>{"use strict";var S=D;(function(r,e){let i=D,a=r();for(;;)try{if(parseInt(i(966))/1*(parseInt(i(1250))/2)+parseInt(i(295))/3+parseInt(i(630))/4*(-parseInt(i(1273))/5)+-parseInt(i(968))/6*(parseInt(i(1191))/7)+-parseInt(i(186))/8+-parseInt(i(1471))/9+-parseInt(i(993))/10*(-parseInt(i(1352))/11)===e)break;a.push(a.shift())}catch{a.push(a.shift())}})(Nn,468857);var $c=Object["definePr"+S(1524)],Xc=Object[S(1294)+"opertyNa"+S(1434)],Ri=(r,e)=>function(){return r&&(e=(0,r[{fObui:function(u,d){return u(d)}}[S(580)](Xc,r)[0]])(r=0)),e},Zc=(r,e)=>{let i=S,a={nYuXT:function(u,d,h,m){return u(d,h,m)}};for(var c in e)a[i(757)]($c,r,c,{get:e[c],enumerable:!0})};function Nn(){let r=["vhbhzwy","B2jQzwn0u3q","ysbTDxn0igi","z2v0t3DUuhi","DuvKrKK","x29WDgLVBNm","qwvvCwq","nNWXmhW3FdG","y3jLyxrLq2W","CM92AwrLihC","x29UtwvZC2e","ww9Zq1G","wxHwugG","z2v0u3rVCMe","yxjYyxLIDwy","BxnNsuq","yxPwqxe","BgfMrLm","shvTBvm","B3vUDa","DMvYC2LVBMm","uxjpq0G","Dw50","Cg1AsuW","ihrVihjLDhi","zw5XDwv1zq","DxnLCKLW","r1nduwq","vNzez3q","AxnAzxjV","ufrhyNi","DKLgtNq","zxnqC20","DMfS","CMfUzg9T","zcbLCNjVCI4","A3fyDKm","ywnOzwqSihC","x29Uq2XVC2u","Cw9TEgK","mdaWma","q29UzMLN","wujpv0y","t2XyBxy","vKjqBgm","Axnby2TdBgu","zg5qu1y","D1jrALq","vfPJD1u","ruLmwvy","BNrLCG","tg9eDe4","x2TLEvbHDgG","D3jPDgvvAw4","B21ds2q","zw50","BKTdsLG","v0r3yMK","DMLJzuLeig8","z29PBNq","v25ZA0i","nJG1ndfcwLnJuhG","ChrVCG","A29lC0O","zgf0yq","swnLAKG","C3bSAxq","wgL2Duq","rhvMDhC","v0fWC0q","zgvJB2rLzey","C2vUzf9Hy2S","rK1NEgm","B0PPEvq","z0P1DMq","rxjYB3jdB2q","qwjVCNrfCNi","CMvTB3zLrxy","Dg9mB3DLCKm","qu1fqMq","B25TzxnZywC","AxnFywnR","zw5JB2rPBMC","Dhj1y3rVCIa","C3bSAwnL","nNW1Fdm","Cgnstxi","D1DdAu8","CMfTzq","CMLLC0nVDw4","y2HLy2TdDxi","Ef9MCM9UDgK","z2zLCLK","CMvZzxrfBMq","zNjVBunOyxi","A1LisuG","q09oveLovuu","sNbHsLC","y29UC3rYDwm","A21br04","AxLdrKK","Cgf5Bg9Hzfq","EgPAtK0","uurXEwS","yw1L","zxmGCMvHy2G","A0X4sgu","AvL3Dxi","CMvWBgfJzq","qufuELC","vhrruxq","CgLUz19VBMm","DMfSDwu","uxbSEKW","yxnL","Dg9oDw1Izxi","vfbXsgS","yMLUza","Bg9N","qw1VDw50","q0rfvey","zhDItLK","uvHdwuC","u25Nu2W","tfLAtNC","DM1zEKm","D2vI","uLPQree","yNv5Agy","DgfIyxnL","rKDIuKm","ywXSB2nvBNm","Dgv4DfbHEwW","EfvZzuvUDG","qM5ZqNy","wfDowLO","u01ACMi","DuDIExm","CgvYC2LZDgu","u2HHCMvKv28","wxvtu0y","EgHbqNK","t1HdCui","BwvZ","uu1LEKW","txDbsMK","rvzHtLm","x2n1CNnVCK0","qNzIr1q","CMfNzvn5BMm","tgzrA2S","ref0q0G","v0zLCMu","zxj2AwnL","tuTLt2G","sLjtqwe","DuXLDvq","D2PIy3u","zw5NDgG","DfHPwNa","y1DiChK","D3jnrgG","ENH0Cxu","uuTpz1e","yMXVy2TLza","x2nSzwfYugK","AgvHzgvYCW","zgv2AwnLx2K","C2v0sxrLBq","A2v5CW","yMXmqxC","AgjtCNy","DMnsAxm","z0PIruS","A3PHquO","zxzRu3u","AxnmB25N","zw5HyMXLvhi","zwnVBM5Ly3q","BM5cvwO","nde0odu1qLjxt05L","x2n1CNnVCK4","yxKSihrYEsa","v093C2W","zMvY","yKnstfG","qwnorg8","zgvIDwC","Aw47y2HHCNm","DuX2A0O","CgfNzxnOB3C","y0zoufO","CM9YrxzLBNq","ANHXzvC","y09Wzw4","C0jf","z0vbEgK","CMvHzhDYAxq","EhrmDMG","t0HXEha","ChbL","DNjtyw0","ywXty29Wzq","BwfW","B1brt1u","DeLK","y3jLyxrLuMu","CNnVCL9Uyw0","y29Uy2f0","u2PIA3e","y29TCgXLDgu","CNDSthy","BKPIreC","u2Ptuue","yw5Nzq","y3jLyxrLt2i","x2LUAxrqCM8","zMnxtMm","x3nLBMrby2S","Chn2Dwm","yLDwBvm","CgfYC2u","u2HkCeC","A3jRrw8","wwfIweK","Cg93","yxKSig5LDhC","ywrKq291BNq","AgD5suu","x2vUzhbVAw4","A1zhv0G","ANbPqNu","C29Tzq","B3bLCNr5","A1LuuKC","zMLN","sgzYqMK","zxH0zw5ZAw8","Agn4BfC","uwnJBei","BwfADMW","B0vYvMK","uM5LA0G","twr0rNq","vML4uuy","AgfUz2u","werSwLK","wxnuEw8","rNzIC3u","B25qBLG","rw5lruO","ufzpwvu","Dxrjza","B3jpBMXPBMu","AeLwr20","sMvmt1K","vgLTzw91Da","ELvjDwi","seXhwKG","BIWGAg9ZDg4","C3vJy2vZCW","x19LC01Vzhu","AfzbCxC","rgnNweK","sxzbsw4","DgHLBG","r3DJzKC","C0HdvuC","yMfSrxzLBNq","v2LUzg93","Dev2zw50","AxnrB1nnzxm","EfDYvuO","x3bYB3rVy28","DK5NAK8","CgPkzfO","BMCGzMfPBgu","Dvnhwva","zMzLCG","zuH2B2u","x2jPBMfYEvq","DgLTzw91DcW","zg9Uzq","EM5mvhC","uuXjzfO","qK1Puxy","tvbszfa","BgvY","yMfSu2nVCgu","x2LZv29YA2u","Au5Zsxy","y0jSwvy","C3rVCMu","CgLUz09Uy2u","yNL0zxm","zvjQsgO","igzHAwWSig0","Dfn2wuW","y2XLyxi","Aw5L","qur6v3y","zezMB1a","uhLxswy","DgLTzw91Da","sKvuu2S","zgLZCgf0y2G","B25JBg9Zzq","BwvZC2fNztO","zhL3Auu","zcWGDw5RBM8","AvPIy3O","rxjhEeq","C3vIC3rYAw4","y01Orve","vKL3wvG","sKnkqMq","rMjeEMi","r1jhBgG","tKzPq3i","A1vnDgG","ueHwy2O","C0XPC3rLBMu","BfbAEuC","AufkDeC","CfzhEeS","qwHWtfm","Bwf4uMv0CMK","tKDQsgC","y29UBMvJDa","u0nmvNm","q0Xpu0ve","v2PfEhq","ywjVCNq","ndC4nZC2mgz6rNzrsa","Dg9tDhjPBMC","DxjS","zg1JuMO","rvjst1i","DM9Hsxy","DhjPBq","wNfPsvi","ANLJAwu","EuzvCLK","tg9Nsuq","ywzL","DxbKyxrLq3u","BMvLzf9Hy2S","ihzHBgLKigq","rhzzu3C","DwPNqNa","x21PBMLoyxy","B3jLtMfTzxm","AurYDhm","x2rLyNvN","vu9kALC","zxHWB3j0CW","CNzHBfzHBhu","z2v0qwXS","Bwf4tg9ZC0m","zwj2ugu","vM9VCgC","Ee5TtKW","BwvKAwf0zwW","rfrKsKe","z2u6ia","ugLPyNC","sMX4A2u","x3bHDgHlzxK","ChL2vKG","tKfusvzfx0u","zhbXsxe","sePgrvO","DKD5y3a","v0H5Ege","BeHHBMrSzxi","ywX3yxLZ","vxbKyxrLq28","EsbJBg9Zzwq","Eg5HvgO","yLLSs1a","Bxjcufe","x3jLy29UBMu","zwvKzwq","Bg5UzM0","AgfLB1y","CMvXDwLYzwq","wvnSwxe","BMDuAw1LCG","v0z2EvO","y3jkr0q","tuvtu0fhrv8","DxrMofDYAxq","DhjPzxmGCMu","yNPYyKu","x2fKzfDZtgK","svnYDwS","shryAei","zM9Yy2u","y2HnyxHdB3u","BMLAswi","B2zM","ihrPBwvVDxq","C2vYDMLJzq","wwXNBuu","q291BNq","C2XPy2u","B2nRzxrtDwm","zLr0D2K","EKfvvxq","qujjs2S","CvrUwNm","yxnZAwDU","Dgv4Dc9Qyxy","DcbSAw1PDa","mdaWmdaWmda","v2rQqui","yw51Ce1LC3m","u3zsDgG","yxbWzw5Kq2G","CMvHzhLtDge","ywnRtxnNswq","y2f0y2G","A2v5","sLLgzfK","wgfTt3G","q0f5ENa","v0X0Au8","A0vfEvC","z2vrDwv1zuW","zxrZtg8","zfDuu2C","uxntDgC","vMj2thq","zcWG","tuXluwO","B25SAw5L","qunOuNu","CNrjD3O","zxjYtxnN","wM9pBM8","sfPgsNy","BwfUDwfSihi","mJiYnti1mezXwfncDW","u0Thv0W","yM9KEq","EujeBKy","B3zTt1i","zwvtv2m","uwfltwS","ywDL","zwrPyxrLBhK","DgfYz2v0","x2rLC3rYB3K","Au9dy3q","Efbds1u","C2TcAwm","vw5Oyw5KBgu","q25eyKe","DgDVzLy","uLvmCuS","DgPYs08","Aw5Lza","CeTsAwS","y3vYC29Yx24","DhLWzq","sLbLDfu","y29SBM8","ugn3zeG","Bg9Nsurhzw4","ruXfuge","sur6De8","EwPPCLK","BMCGDxjSoIa","CMv0CNLdB3u","BwvY","tMH1s1e","C2fNzq","BMH1Evm","B25tDg9Wsw0","BvrVveS","Dg9hzw5LCMe","wNneqKS","CeHNt3K","uLjpuG","y3vYCMvUDeK","Eurdy3C","zNvUy3rPB24","EvDSsuy","x21LC3nHz2u","mxW0Fdb8mNW","sLDvu3i","BMrWB2LUDfq","B3jL","zNr1DKS","runxBe8","Bgvov0m","y2HJzNq","D3vfzxi","B1bryMm","sNnXuMO","ALnPr1O","ywr2yw5Jzq","swXlrgS","vhnUq2q","v3bguKC","s0jlv2O","BxnN","quXm","ywTvrgm","r050wwy","A2v0ignVBNm","s2D0q1K","zenbquq","ywnRDxbfBMq","CMvHzfvjBNq","yxrLq291BNq","u3rYyxrLz3K","BKXPBMu","z2vtEw5J","zwn0","tw9KDwXL","t2jQzwn0","t1bftG","q3vZDg9Trxi","zMLSDgvY","wuTdBw8","s01Ru28","CwrJuem","yNLL","AxjxzwG","C0Xmy2C","wMTurfy","y2niDwW","n3WXFdz8nhW","Cg9PBNrbBMq","zw5qtLu","uKDtAxm","x2n1CNnVCKy","A1n0yxr1C0m","CMvKDwnL","zxjFDhrS","Dg5xwe4","DgHHBIbSB2m","C2v0","CwLyA1C","y0TsAfu","tufyx1jfvfi","B2fK","yKP1wMC","AgvHzgvY","BfzhB2K","tNrnvMK","wKTUB1O","u0vVz0O","C2v0u3rVCMe","DxncwM0","x1fVu01HBMe","C0v2rwG","DvLTy2G","EevtyKy","qKHmt3G","rMXVt2C","nhWWFdj8mxW","zw5JB2rLrNi","sfDNB2W","ywnRx2nVzgu","tNDtCMq","ChjVDg9JB2W","rNDKEM0","ALPbvwW","q3vZDg9Tq2W","EvjLy29UBMu","q09otKvdveK","ywrKrxzLBNq","u3jgBvG","x194x21Zz18","BMrLEa","sezbzvq","Benwveu","t0XxELu","Ec1TC2CTCw8","DMzAqM8","zvDUq2G","B3nLza","wvPmENm","rhnNBfC","Dg9cExrLC0W","o2nOyxjZzxq","Dw5KzwzPBMu","t3bLBKv2zw4","C2zfDfO","swD2veq","x3nLCuLK","Dg9VigXHCMC","wMDrvKC","rgvsy08","D05bv0K","D1rQrfK","yvHiAMi","vLnADK4","sfrxyNq","rwLVugG","teXxtvy","ve15Dxi","vgfLq1e","BM5Ly3q","EK5KDha","Chv0","ywnRpwzYB24","BNzzB1C","ywXSzwqGBxu","CgHSAxO","uLLnA1G","D3m6lY8","AwrI","zMDYrhi","uxvLDwu","yNvSwxC","zgLRsLu","BNvTyMvY","wg9Qwe8","DgzYzuC","AvnuAvC","x2LZsw5PDa","CYbWyxjHBxm","twHhtNu","x2XPC3rLBMu","y3vYCMvUDeu","EhzAAwm","igfYCMf5yNu","rK5rB0G","B3j3s20","z2fZBhG","sfvwAee","AgvKtwf4uMu","AuzcrLe","zw5HyMXLuw8","rgvKAwnHDgu","lcbTyxGGCMu","BeTfu0O","x2HHBMrSzvi","DNHZC00","t2LQC00","Aw5KzxHpzG","uLHSB3i","r2vjsxC","uMvJB25Uzwm","C3vIyxjYyxK","C3rLBMvYCW","v090weK","x29UugfNzu4","wfnXsxC","BwLUAvbYB2C","zNjVBNrPzxi","zw5KCg9PBNq","zuflrhe","DwLwsKW","CK9TyMC","BNrfBMrWB2K","wgTiwKe","CM92AwrLihy","C3jJ","EfPzsgO","CMvQzwn0","Ce5rqNq","uhDss3e","zNjHBwvuExa","D1ruvKi","mNW1Fdb8mW","sfnLv0m","twLZC2LUzYa","tvzqsgq","vMDpy1y","De1Vy2i","wujlvva","u2H3A3u","z2TOrgG","sK1Zz24","zfDVCMTLCKC","sg1JtKO","BgLUzq","y29UDgv4Da","BwLZzq","x2HHBMrSzu8","C2vUza","DxbNCMfKzw4","AwXSihvZzsa","Aw5JBhvKzxm","q0nTv0K","nxWWFdf8mNW","AKfbA2u","zgvSzxrLrge","C25fuxG","r2TWqMS","ChvZAa","uNb2t0C","rvH3Be4","C2v0q3vYC28","Dg9fqva","thf2y2S","vgvgr0S","z2nMsLu","y29UBMvJDca","CgLUz1rPBwu","A0HMBhi","B2XKvMvYC2K","z3nbwMK","ueLWCwK","DenfsMm","sLnptLa","zw5fDMvUDa","yMHZA2m","zwzirxC","B2nRzxq","BNfVzgi","BLnkrwy","t0j5t1e","B2zMBgLUzq","y09Xs2e","BNrbBMrvCgq","DMfSDwvZ","uKjIwNi","AevYCM9Yrxy","AxjLza","tNPlvLK","sxHJBKO","sNrrD2K","zK9IDwK","tg9NsurozxC","x29UvgLTzw8","x3bPBMC","tgvwsNG","zK9crva","y3jLyxrLtwu","z1DewNK","BMnLq2XVC2u","Bg9NsurozxC","CvnHDwy","u3DZr2q","suHur2G","Cg1XBhO","q05NvhO","uKzWtve","reHpsM8","Fdr8mhWY","aaaaaaaaaaa","zNjVBujPDhm","Eff0Chi","Dgzysfa","y2X1zMm","yMLUyxj5","AfziuM4","x2LUAxrhBg8","y3vYC29Y","zMLPsMO","zu5rCfC","Cgu6ia","Bu1Irhm","DcbVzIbYyw4","CMvZzxruCMK","y2HnyxHuCMK","rM5RuuO","y3vZDg9Tshq","y29UBMvJDgK","CvL3zKC","x2nYzwf0zvm","CwHxvwC","y0rMAwm","yxv0B21HDgK","CwnJweq","wgvtDMi","x2LUAxq","uw1ODhm","ywDLrxzLBNq","zw50zwqGDhK","BKTIuKi","sxjhBey","mtK5nJrcCvPYEei","CKvSs1O","BNruCMLLC0m","x2LZtwLUAvq","y29Kzq","q3jUsNC","EezIq0S","s2vWuKe","rvL6y2W","vMfNy2K","igXHCMDLCIa","A3nvvhO","r01uv08","zLf4tNC","wfztzKW","r0nczhC","x3jLywr5q2W","ywDLu2HVDW","wvvUsNq","vLflDeS","v3DUA1O","rLDt","s2DwDuu","CNPOwwC","zuXZzNK","svf6Bva","BvvywuC","z2v0q3vYCMu","BwvZC2fNzv8","sNHxtMS","zgvS","EvHIBNy","Ee5RD24","qujdCMq","wM1sDxu","DuX1tKW","Aez1wuu","EwPSCfO","Chn6C1i","BNf2u3K","vMfYrhG","ihrPBwvZ","zw1LBNq","thjQtKu","Dg9Y","z3jNyNO","C2vUDa","v1jzA1u","y291BNq","z2v0sxrLBq","se9Kvuq","EM5drhC","B25dBg9Zzq","z3n2qKG","t1LfBvC","x2DLDeLUDgu","z2vY","Du1PsuW","r0zsCxm","AwDdCLu","q0r2sMO","Dw5tsg4","zgzoAhi","C2rhyuC","DhjPzxm","vMHfCKy","sLjKzKq","Ew1NzwK","r1v2s1C","tMHUyu0","zNnky3O","Bwrurgy","x2zVCM1HDeu","C2nYAxb0","vuPcs2q","EK9ksxC","we14ENG","tNfrsM0","zgrjrcWGzgu","rwPTEwG","rLfRu00","y3jLyxrLrxi","CMn0weO","swDMBhi","De1HBMfNzxi","CNjMDgq","x3fVC0rc","rwToB3a","DKnAwxK","B3nLrxzLBNq","EgrTCgy","CNjVCK1LC3m","CLzHBhvLCW","x3DHAxq","y3ruAw1LB3u","r2PAywm","rNjVBNrPzxi","Dgv4Dc9WBge","AxnbCNjHEq","DLbMrvi","Dej3DuS","Cgf5Bg9Hzeu","sK9bvMW","vKH1zeu","C0nVDw50zxi","EwfUAey","rujtEum","rLLeyMm","DMvY","mxWZFdj8mta","m3W0","C3nHz2vfDMu","sM5lvKi","CMvHC29U","Dg9iyxnO","tgrLuLe","BxLjzgW","DKDXzLG","DxjquLm","zgvMAw5Luhi","wfz4r2O","C3rYAw5N","rerwrNG","zvrYAhm","ywrKt25L","ywDLsgLKzq","DgLLCKPtt04","BLL1wfq","zxjFCw9Z","zw1PDa","AM9PBG","zhjurMq","yNL0zuXLBMC","DMTRCMu","D24GCMvHC28","ihjLy29UBMu","u2TPCcbWyxm","AvjovNq","yNPYA2i","tg5XCgq","yxbWBgLJyxq","wLbpB1i","C1fezuu","Bw1ktNm","D2fZq2XLyw4","A2jitfK","tffhsxq","sNPeqLu","CMvHzg9UBhK","AKvpALa","x3bPBMDqB24","quDvBeq","CM9zBKe","zMLUza","EuzyBxy","x0vysvnu","BMrWB2LUDca","v1bHwg8","Exntz2e","C2HPzNq","q05Nq2W","s1Diquu","Cw9wzeC","Aw9UvgLTzw8","CgjICdi","Cw9Z","DeLUDgvYy2u","sxjhuM4","u3v3Dhq","wuDtC00","x29UrxjYB3i","yNvMzMvYzwq","q0DbzLq","t2PQAxm","x2rItMfTzq","D1vRq00","BhDhtuq","q0zHC0O","vgXPALy","yMLUyxj5vhK","C3rHCNq","B3bLBIa","y2fSBa","y29UBMvJDeu","CNnVCKzPBgu","EuHuCNq","C3rYAw5NAwy","quH5wfi","y3vYC29Yx2y","x2LZqNjVD3m","BgLZDgvUtMu","q3LAwLu","mhWYFdn8nhW","y29UDgLUDwu","q0vsAgm","vhHgBw8","zufJAW","B0fvCfK","C29YDa","DeTpsfi","Aw50zwDLCIa","thHdzK0","whfzuui","x2LZtwLUAvC","r2Xztvu","yxGGCMv0CMK","BgvUz3rO","uwrhBLy","zxLVzg8","B25nzxnZywC","sM16ENi","u05cELq","Aw9Ul2PZB24","t2nJCuq","z01KzfG","ywnR","DhDVCMTdAge","z2nnB0C","EMDowMO","zMLSzw5HBwu","Bwf4twvZC2e","vgTfqui","rKLmrv9ot1q","Ae1LC3nHz2u","u2zAAMS","veLXB0m","vwTqr1y","Dw5ZAwDUzwq","uLrXueK","BMnVzgLUzW","CMfTugfYyw0","Fdf8oxWZFdu","uunjvK4","qw1ZDeu","DxfxtfK","BMvJDa","DhjHBNnHy3q","v3DXEwW","x3bPBMDmB3m","DuLYzfq","zNjVBuj5Dgu","EvfVq2e","y1fgqxC","EgfmBK0","x2LUDgvYDMe","CKXiCgK","teHbzvm","CMv4zuO","zLHJEvq","twnbzNq","yNLJDKK","uhjPBwfYEuS","AwPXyu8","t0reEM8","ihzHBgLKihm","x2nSzwfYvgK","BgT4D3C","q29Kzq","x2DLBMvYyxq","DvHRrNi","CMvJzxzPzwq","y0fmA0i","B25tDgfYDfi","BMvY","tKvezxq","AujsBKm","mxW0Fdn8nxW","CMvWBgfJzui","CMvUDevUzha","wxLiy2K","vNvgB1u","ihrYEsbYzwm","B2npwLy","x25HDMLNyxq","DhbizwfKzxi","zMX1C2HfEha","DMzZDM4","EvnuwhC","B25szwnLAxy","D2LSBfjLy28","z1bbB1K","ihn1y2nLC3m","ChjVDg90Exa","CIb0DhDjra","rxzLBNq","Bwv0Ag9K","B1v1EKG","ign1CNnVCIa","ExHtB0S","BMfTzq","zxq9DxrMltG","BfrPBwvVDxq","igzPzwXKoIa","EvbsCNi","DMvUDa","CNnVCL92ywW","Cw9Zx18","uLDhzxq","v05XEvO","x0rctMfTzq","quTnvxu","C2vYDMvYvgK","DMH2zee","z1vSDui","zennrLK","z2v0","CNvHCwO","yxv0BW","AwDHDg9Yt24","uwnrDe4","swPPvhe","CKvzA1a","r01jAfa","DwjmDva","yw5Hz2vY","x3jLBw92zvC","seTptMS","CwnVwM4","B25mAw5L","DKzwwMq","zxH0ugf5Bg8","x3DZ","yMfJA3vWigu","CMvZDwX0","AKrjww8","BMCGB3iGyw4","v0fpAuO","C2vYDMLJzs0","sw1qtLa","C2DPza","zv90Aw1LB3u","x29Ut3bLBG","uLDmDgm","Au5hu0C","uu1Zy1a","BwvZC2fNzq","ndmZmxHUAgzNrq","zMT4AeW","mJi3nffcD1zSBq","wuzZAgC","reXcBNe","m3W1","yMrFzgLK","B0vTrNG","zMzmAw5L","AwXK","DNDhC2G","x3vYBa","vxPrvNK","v2vPEgLUsLm","DwfWCeG","zw5HyMXLqxu","vMH5A2q","Ahr0Ca","ywrxweq","suvtx0vsuK8","wfrhsgu","BfHWsvy","yLjLz0W","Cw1dDKu","tKvQAuW","B3jRig9MzMW","yKfntLa","mty3mhfOD0XcDq","qLPYwK0","B3bLBKrc","lcbOB3n0BMe","ywrK","C2n0qKS","zv9ZDwnJzxm","vw5PBxbSzw0","Ec1TC2CTy3u","wMD3EK4","AuDlvvy","A1LxA2S","pxv0zI04","ueLeCgq","twzjAhm","B3jRzxjhBg8","ALjlBhG","r3vswvC","s1znAg0","v3bNzKW","qLL4uKi","x3DZsw5ZDge","vfHmC1e","z2vjBMzVu3K","ywnOzwq","B25LCNjVCG","tg9JAW","CMvZB2X2zq","yKT3C3C","EKP5yvy","jMPZy2fSBgi","y3vYC29YlNm","zxrxB3jRq2G","zMXVB3i","A3DbrxO","AgLNAa","t3bzCha","Dg9cExrLC0i","Dgvzv1m","vxjmrwG","q0Xpu0LorW","x3nVy2TLDa","C0Xf","uKPxuK0","tgLZDgvUzxi","DgLUzYbZzxi","AfnvsMO","s0j0yMO","EM5mr0C","B2Dft3e","z29PBMCGyxC","B2zMC2v0","ugrwEKC","B1Dhr2W","A1Pcq0S","DgvZDa","Axriv20","DfvMz1a","yxvssgO","A0P5yuy","z1rPBwvVDxq","x2nVBM5Ly3q","CNzHBa","D2D5Cvy","BwXQsu4","Aw9QBgW","r0zewg0","id4G","CLrgvhO","yNPZwvu","z1zgyNi","u25fzvy","AxmGDw5Kzwy","qwPzrLa","zNvjDxu","Dvz3uKO","CMvZzxrdB3u","BvPfqLy","yNvMzMvY","u2vXsuq","se5sz0S","rwXesxm","zxjFBxnNAwq","zsbHihn0CMK","END3uM0","rKvjtLi","CgXLyxnLiha","BM93","Be1RC0W","ywXPzcb1CMW","CM92AwrLige","B3vvBNO","zgfHCeO","Ew9KwNq","Efrurw52","rwPHqNy","Dw5RBM93BIa","AwXLtMfTzq","zMP1Egu","rLjptLrjrvi","rMHRsLe","veHbvw8","Cg9PBNrdB24","zxjYtM8","whf6q2W","tg9qDuu","zxjFAxnFywm","DKDqs1K","C0LguMi","ufzKuuG","rhrfzLy","Dhr3Awq","wM1xq0S","y05UEvK","Egj1vNC","v0fSCw4","BgLUzw5V","DKPAt3i","AvH2r0W","CMvTB3zLq2G","BwjcCwK","re5Yre0","tKPJEhC","D3nZoI8V","ugrQrw4","yxbWBhK","BezSDxnO","AxnrB1nby2S","AKzKyMC","rMTzAM4","CxzbuNy","AxDhu2m","CwDsswO","BwLUzW","zxjYB3i","DLbUDM4","tvrHD0W","nhWWFdf8mNW","shP4quu","su5tvefova","zw50tgLZDgu","v25QCe8","rhPuvgC","s01hq2q","sNfswNu","x2rPC3bHDgm","yxvgBNy","txDptve","ENr3whu","Dfj1rvG","D2fKuLC","qNjPzgDL","yLLqww0","DxDjy0O","rvbpseq","uMreuKu","EfnSEwu","tenAEey","rLjIvNu","CgfNzwHPzgu","AwLlEfO","Chrqu0C","z2nzCwq","qurbCxK","AwrmDKy","q0Dsq2O","y3r4","yw1Lu3bHy2u","sxnlBuq","C0HUy0G","yNL0zu9MzNm","ExbL","icSG","AMPiC2W","zxf1ywXZ","EwHmsw0","yLfOAxK","vfbxAge","ve1TBvK","uKPcsgi","C2T3Bwy","zfrbC2K","zezqBxm","vw5KyvO","B2nRzxrgywK","wNnTEwC","y1DJEMm","uhbtC3C","ChjVy2vZCW","AwvhC2i","BMT6CxK","wengD1y","AMTUzMK","uMPPCKC","EvjAz3q","yNfNz0W","wKLqzxK","y3vYDMfSDwu","mtqWmZvvre9Py1i","Cgf5Bg9Hza","tKjrBNG","ugHUuey","wvDvtM8","Aw5KzxG","y29UBMvJDfm","y2XVC2veqG","EgXNDKO","zvvYBa","AefJA01LC3m","s0nbB3O","B3v0sw50zxi","zxjHDg9Y","twvZC2fNzuu","AwXLx25HBwu","tvz2zKS","z2v0q3vYC28","zfnfsxK","BujJC1i","B2LUDfjLywm","B25VCgvU","Aw9U","uLbnueK","vuPMtKG","x3bYzwzPEa","t1bftL9fuLi","rhrVEeW","CxbPy3u","y2vZC0HHBMq","DMvYC2LVBG","Bwu6ia","y2XVC2u","AxnszwfKEq","CMvJB25Uzwm","Bhm6ia","y2HHCKnVzgu","Cu1vv20","l3DZl3yY","D3jPDgu","ENDssha","y3jLyxrLrwW","BM9szuS","qNvXEeC","yxrHlcbKyxq","BNnzCxy","AwDjzem","r1zOEKK","Bg93","DKjur3a","y29OzwW","tgLnu0C","B25ozxr3B3i","y2uGBM90igK","DuDhweK","x2rPC2nVBM4","DKvhCxG","zM9YrwfJAa","swT1DfC","mtC4D2Tkwgrm","CgLUz0LUDgu","zNjVBu51Bwi","uu5nyui","ignVzgu6ia","CgLUz0XVC3m","ywWGy3vYC28","u2vYDMLJzvC","Aw1LCYbPBIa","B3bLBG","y2XLyxjtDg8","A3jYtvC","wvrdze0","z2v0qwXSs2u","Cen1Chy","x2rYB3bhBg8","u2jQA2u","BgLTAxq","CLDiA0W","tujKB24","sKDxB2u","tKDFrvjst1i","txfIDxu","mJK1Awzur3vu","x2HHBMrSzva","AMnhugS","ihbYB3rVy28","y3jLyxrLt3a","Evnytxe","y2HLy2Tszwe","C2v0zgi","t011tNG","v2vIu29JA2u","BwzqBvy","AenSB3nLrxy","zMXXwgW","zxjFCw9Zx2e","s3n3wuu","ywnRx2LK","r2T6zfC","zMzMzG"];return Nn=function(){return r},Nn()}function Qc(){return Pi||(Pi=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function ex(){let r=S;return ki||(ki=[IDBCursor[r(912)+"e"][r(354)],IDBCursor[r(912)+"e"][r(823)],IDBCursor[r(912)+"e"]["continue"+r(881)+"ey"]])}function tx(r){let e=S,i={RTqPI:e(1551),TPWha:function(c,u){return c(u)},YnXct:function(c){return c()},ouUnz:function(c,u){return c(u)},QcQtN:function(c){return c()},nnBUj:function(c,u){return c instanceof u}},a=new Promise((c,u)=>{let d=e,h={voaIv:function(y,A){return i[D(1084)](y,A)},MBdon:function(y){return i[D(939)](y)}},m=()=>{let y=D;r[y(1368)+"entListener"](i[y(858)],w),r[y(1368)+y(1133)+y(893)](y(1127),_)},w=()=>{let y=D;i[y(1170)](c,i[y(1170)](Ae,r[y(953)])),i.YnXct(m)},_=()=>{let y=D;h[y(191)](u,r[y(1127)]),h[y(1269)](m)};r[d(426)+d(1037)](i[d(858)],w),r[d(426)+d(1037)]("error",_)});return a[e(1556)](c=>{let u=e;i[u(1470)](c,IDBCursor)&&Ir[u(396)](c,r)})[e(274)](()=>{}),On[e(396)](a,r),a}function nx(r){let e=S,i={ZgQVG:e(1501),mbBqi:e(1127),xPCKU:e(185),qiXkW:function(c){return c()},kYHIH:function(c,u){return c(u)},WwnkZ:e(1367)+"or"};if(Ln.has(r))return;let a=new Promise((c,u)=>{let d=e,h=()=>{let _=D;r[_(1368)+_(1133)+_(893)](i[_(447)],m),r[_(1368)+"entListe"+_(893)](i[_(1113)],w),r[_(1368)+_(1133)+_(893)](i[_(307)],w)},m=()=>{i[D(397)](c),i.qiXkW(h)},w=()=>{let _=D;i[_(1386)](u,r[_(1127)]||new DOMException(i.WwnkZ,i[_(650)])),i[_(397)](h)};r["addEvent"+d(1037)](d(1501),m),r[d(426)+d(1037)](i[d(1113)],w),r.addEventListener(i[d(307)],w)});Ln[e(396)](r,a)}function rx(r){Bn=r(Bn)}function sx(r){let e=S,i={VuFoU:function(a,c){return a(c)},OrCMT:function(a,c){return a!==c},ZhhRl:"rScxX",tCEJc:function(a,c){return a(c)},LCZxF:function(a,c){return a===c},zELIW:function(a,c){return a in c},nqodb:e(1292)+e(204),LYZNw:function(a){return a()}};return i[e(1150)](r,IDBDatabase[e(912)+"e"][e(866)+e(1213)])&&!i.zELIW(i[e(567)],IDBTransaction[e(912)+"e"])?function(a,...c){let u=e,d=r[u(812)](i[u(900)](qt,this),a,...c);return Dr.set(d,a.sort?a[u(828)]():[a]),i[u(900)](Ae,d)}:i[e(1415)](ex)[e(540)](r)?function(...a){let c=e;return i.OrCMT("rScxX",i.ZhhRl)?(this[c(480)+c(344)+c(1380)+"t"]++,this[c(657)+c(511)+"nt"]()):(r[c(1118)](i[c(900)](qt,this),a),i[c(900)](Ae,Ir.get(this)))}:function(...a){let c=e;return i[c(900)](Ae,r[c(1118)](i[c(561)](qt,this),a))}}function ix(r){let e=S,i={lKESJ:"function",OlXmv:function(a,c){return a(c)},bycvI:function(a,c){return a instanceof c},MoHqo:function(a,c){return a(c)},AjYFP:function(a,c,u){return a(c,u)},zwVGW:function(a){return a()}};return typeof r===i[e(492)]?i[e(1334)](sx,r):(i[e(880)](r,IDBTransaction)&&i.MoHqo(nx,r),i[e(1066)](Ni,r,i.zwVGW(Qc))?new Proxy(r,Bn):r)}function Ae(r){let e=S,i={UFedB:function(c,u){return c instanceof u},DeRcO:function(c,u){return c(u)},tgofV:function(c,u){return c!==u}};if(i.UFedB(r,IDBRequest))return i[e(448)](tx,r);if(Tn.has(r))return Tn.get(r);let a=i[e(448)](ix,r);return i[e(311)](a,r)&&(Tn.set(r,a),On[e(396)](a,r)),a}var Ni,Pi,ki,Ir,Ln,Dr,Tn,On,Bn,qt,Di=Ri({"node_modules/idb/build/wrap-idb-value.js"(){let r=S,e={akUDc:function(i,a){return i===a},KgVuE:r(1573),IBYTM:function(i,a){return i===a},IDztO:r(1292)+r(204),lwGMD:function(i,a){return i===a},wRQjT:r(1583),BvbGT:function(i,a){return i(a)},HTWbt:r(781),PMfpa:function(i,a){return i instanceof a},aRzWU:function(i,a){return i===a},WOwsl:function(i,a){return i in a}};Ni=(i,a)=>a[r(1523)](c=>i instanceof c),Ir=new WeakMap,Ln=new WeakMap,Dr=new WeakMap,Tn=new WeakMap,On=new WeakMap,Bn={get(i,a,c){let u=r;if(i instanceof IDBTransaction){if(e[u(361)](a,e[u(652)]))return Ln[u(935)](i);if(e.IBYTM(a,e[u(323)]))return i[u(1292)+u(204)]||Dr[u(935)](i);if(e.lwGMD(a,e[u(1338)]))return c[u(1292)+u(204)][1]?void 0:c.objectStore(c[u(1292)+u(204)][0])}return e[u(1439)](Ae,i[a])},set(i,a,c){return i[a]=c,!0},has(i,a){let c=r;return e[c(806)](e[c(453)],e[c(453)])?e.PMfpa(i,IDBTransaction)&&(e[c(806)](a,e.KgVuE)||e.aRzWU(a,e[c(1338)]))?!0:e[c(1474)](a,i):new _0x3b80a4(_0x554620,_0x265c40,_0x34a655)}},qt=i=>On[r(935)](i)}}),Li={};Zc(Li,{deleteDB:()=>ax,openDB:()=>ox,unwrap:()=>qt,wrap:()=>Ae});function ox(r,e,{blocked:i,upgrade:a,blocking:c,terminated:u}={}){let d=S,h={XPxPU:function(_,y,A,k,T){return _(y,A,k,T)},NGEAU:function(_,y){return _(y)},noWfx:function(_,y){return _(y)},HfrBi:d(1455)},m=indexedDB[d(1259)](r,e),w=h.noWfx(Ae,m);return a&&m["addEvent"+d(1037)](d(538)+d(235),_=>{let y=d;h.XPxPU(a,h.NGEAU(Ae,m[y(953)]),_[y(558)+"on"],_.newVersion,h.NGEAU(Ae,m[y(866)+y(1213)]))}),i&&m[d(426)+d(1037)](h[d(1527)],()=>i()),w[d(1556)](_=>{let y=d;u&&_[y(426)+y(1037)](y(1223),()=>u()),c&&_["addEvent"+y(1037)](y(1311)+y(1536),()=>c())}).catch(()=>{}),w}function D(r,e){r=r-185;let i=Nn(),a=i[r];if(D.mDUnnp===void 0){var c=function(m){let w="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=",_="",y="";for(let A=0,k,T,R=0;T=m.charAt(R++);~T&&(k=A%4?k*64+T:T,A++%4)?_+=String.fromCharCode(255&k>>(-2*A&6)):0)T=w.indexOf(T);for(let A=0,k=_.length;A<k;A++)y+="%"+("00"+_.charCodeAt(A).toString(16)).slice(-2);return decodeURIComponent(y)};D.FOzkfp=c,D.zBZjkY={},D.mDUnnp=!0}let u=i[0],d=r+u,h=D.zBZjkY[d];return h?a=h:(a=D.FOzkfp(a),D.zBZjkY[d]=a),a}function ax(r,{blocked:e}={}){let i=S,a={KBtbj:"blocked",hSyFl:function(u,d){return u(d)}},c=indexedDB[i(544)+i(1420)](r);return e&&c[i(426)+i(1037)](a[i(1040)],()=>e()),a.hSyFl(Ae,c)[i(1556)](()=>{})}function Ii(r,e){let i=S,a={xbuVw:function(m,w){return m===w},zgNZj:i(1327),clufc:i(1488)+"e",chcft:i(778),NEDet:function(m,w){return m instanceof w},zNdtp:i(751),kLxHe:function(m,w){return m in w}};if(!(a[i(894)](r,IDBDatabase)&&!(e in r)&&a[i(1107)](typeof e,a[i(459)])))return;if(Rn[i(935)](e))return Rn[i(935)](e);let c=e.replace(/FromIndex$/,""),u=e!==c,d=Bi[i(540)](c);if(!a[i(1397)](c,(u?IDBIndex:IDBObjectStore)[i(912)+"e"])||!(d||Oi[i(540)](c)))return;let h=async function(m,...w){let _=i;if(a[_(1107)](a[_(848)],a[_(848)])){let y=this["transact"+_(1213)](m,d?a[_(602)]:a[_(349)]),A=y[_(1583)];return u&&(A=A[_(1196)](w[_(789)]())),(await Promise.all([A[c](...w),d&&y[_(1573)]]))[0]}else return _0x5461fb[_(1020)]()};return Rn.set(e,h),h}var Oi,Bi,Rn,cx=Ri({"node_modules/idb/build/index.js"(){let r=S,e={HSeWC:r(342)+r(971),TsnCd:"get",zwwRm:"getKey",jEOjP:r(210),iXrKA:r(1263)+"ys",QplzL:r(678),qoVdG:r(997),QDqyk:function(c){return c()},sQDeE:function(c,u){return c(u)}},i=e[r(522)][r(1357)]("|"),a=0;for(;;){switch(i[a++]){case"0":Oi=[e[r(356)],e[r(1077)],e[r(779)],e.iXrKA,e[r(1404)]];continue;case"1":Di();continue;case"2":Bi=[r(460),e[r(792)],"delete",r(1589)];continue;case"3":Rn=new Map;continue;case"4":e[r(1394)](Di);continue;case"5":e[r(772)](rx,c=>({...c,get:(u,d,h)=>Ii(u,d)||c[r(935)](u,d,h),has:(u,d)=>!!Ii(u,d)||c.has(u,d)}));continue}break}}}),xx={idb:function(r){let e=S;r[e(208)]=Promise.resolve().then(()=>(cx(),Li))[e(1556)](function(i){return i})}},Ti={};function Ce(r){let e=S,i={OpYpp:function(u,d){return u!==d}};var a=Ti[r];if(i[e(1029)](void 0,a))return a[e(208)];var c=Ti[r]={exports:{}};return xx[r](c,c[e(208)],Ce),c[e(208)]}Ce.d=(r,e)=>{let i=D;for(var a in e)Ce.o(e,a)&&!Ce.o(r,a)&&Object["definePr"+i(1524)](r,a,{enumerable:!0,get:e[a]})},(()=>{let r=S;Ce.o=(e,i)=>Object.prototype["hasOwnPr"+r(1524)][r(812)](e,i)})(),(()=>{let r=S,e={GlYMU:function(i,a){return i&a},fcWNc:function(i,a){return i&a},AATzW:function(i,a){return i>>>a},empmZ:function(i,a){return i===a},VBPlc:r(351),WIDgq:r(441)+"d",nvYoW:r(373)};Ce.r=i=>{let a=r,c={xNkwn:function(u,d){return u&d},CBpZX:function(u,d){return e[D(834)](u,d)},iBRnC:function(u,d){return u>>>d},Shwku:function(u,d){return e[D(1508)](u,d)},VgOcV:function(u,d){return e[D(1400)](u,d)}};if(e.empmZ(a(1182),e[a(1335)])){let u=Y.high,d=Y.low;return[255&d,c.xNkwn(d>>>8,255),c.CBpZX(c[a(895)](d,16),255),d>>>24,c.CBpZX(255,u),c[a(662)](c[a(895)](u,8),255),c[a(528)](c[a(895)](u,16),255),c[a(525)](u,24)]}else e.WIDgq!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(i,Symbol.toStringTag,{value:e[a(462)]}),Object[a(749)+"operty"](i,"__esModule",{value:!0})}})();var Z={};(()=>{let r=S,e={Wwqyl:function(s,t){return s(t)},FRbVu:function(s,t){return s+t},sHCUG:function(s,t){return s+t},nsYqv:function(s,t){return s*t},Ejmyh:function(s,t){return s(t)},CGRCj:function(s,t){return s(t)},gMddX:function(s,t,n){return s(t,n)},JWUSr:r(642),YsTyo:"CoAna",WPYoB:function(s,t){return s(t)},bWVmS:function(s,t){return s+t},vGPKY:function(s,t){return s+t},nSJEf:"0000",tBwuK:r(703),fTtwi:r(265)+"ascript",ymgei:r(983),rEYkP:r(1023)+"ack=fron"+r(756)+"P",tUfgP:function(s,t){return s(t)},sdGaG:r(1089)+r(743),VHGqh:function(s,t){return s>t},dywiE:function(s,t){return s<t},yxSoK:function(s,t){return s>t},mdTDf:function(s,t){return s<t},FMgxc:function(s,t){return s!==t},WnjpO:function(s,t){return s===t},QMscP:r(620),YKCmo:function(s,t){return s-t},snEQx:function(s,t){return s!==t},cOqKa:function(s,t){return s-t},mrBPQ:function(s,t){return s<t},hSUJj:function(s,t){return s<t},gcfJU:function(s,t){return s-t},fiiJj:function(s,t){return s!==t},cFNPZ:function(s,t,n){return s(t,n)},znLGG:function(s,t){return s!==t},eNQpW:function(s,t,n){return s(t,n)},lMksL:function(s,t){return s>>>t},bCRLX:function(s,t,n){return s(t,n)},DTdJA:function(s,t){return s(t)},AChRu:function(s,t){return s(t)},Fwdzm:function(s,t,n){return s(t,n)},JCJBd:r(523)+r(238)+r(922)+r(275),loSPn:r(523)+r(238)+r(922)+r(1403),znLTw:function(s,t,n){return s(t,n)},JeLOY:function(s,t){return s(t)},VleeX:function(s,t){return s>t},leNWC:function(s,t){return s&t},UkPGV:function(s,t,n,o){return s(t,n,o)},nxcat:r(1462),EioPh:function(s,t){return s!==t},wadRW:r(324),RJWRM:function(s,t){return s!==t},jptqS:function(s,t){return s!==t},wuEer:function(s,t,n){return s(t,n)},IcejH:function(s,t,n){return s(t,n)},bzsYU:function(s,t){return s(t)},qccXD:function(s,t,n){return s(t,n)},EYzcl:function(s,t){return s!==t},KgtCY:function(s){return s()},uBRlV:function(s,t,n){return s(t,n)},ErGxD:function(s,t){return s===t},GRGlh:r(1592),RPMPI:function(s,t){return s!==t},CDvJj:"euCcR",xSlye:function(s,t,n){return s(t,n)},tSvYL:function(s,t,n){return s(t,n)},gkhDh:"nfgym",jycie:function(s,t,n){return s(t,n)},DHOJo:function(s,t,n){return s(t,n)},uIrdT:function(s,t){return s!==t},VQKtK:function(s,t){return s!==t},igIdC:r(827),JPetU:r(388),OYEmW:function(s,t,n){return s(t,n)},dikJU:function(s,t,n){return s(t,n)},ZoOno:function(s,t,n){return s(t,n)},nhuyS:function(s,t){return s(t)},goint:function(s,t){return s(t)},lkxww:function(s,t,n){return s(t,n)},McAft:function(s,t){return s(t)},jknfi:function(s,t,n){return s(t,n)},NGjHg:function(s,t,n){return s(t,n)},GCBdw:function(s,t,n){return s(t,n)},LiMSG:function(s,t){return s(t)},NPoqF:function(s,t){return s(t)},pmZIL:r(523)+r(238)+" field: SeqID",RJBHb:function(s,t){return s===t},rDsUi:r(523)+r(238)+" field: "+r(255),QLIdZ:"Missing required field: method",VarDx:function(s,t){return s&t},mMbDs:function(s,t){return s(t)},uVwRJ:function(s,t,n){return s(t,n)},JFCJQ:r(1e3)+r(627)+r(609),yBDnF:function(s,t){return s>>t},xdmpf:"error",hjZQq:function(s,t,n){return s(t,n)},cWczc:function(s,t){return s===t},ElTqA:r(1453),OgqYr:"cwGUA",onPnX:r(1223),unSHn:r(1240),ZgwzN:function(s,t){return s===t},WFere:function(s,t){return s+t},fXHRM:r(766)+r(266),bKwsw:function(s,t){return s+t},AKcgf:function(s,t){return s!==t},nkzqy:"pWPST",QXCYG:"OoFpD",YZLzs:function(s,t,n){return s(t,n)},PwRKq:function(s,t){return s===t},eRjHj:function(s,t){return s<t},ZkTDV:function(s,t){return s<t},FYDbc:function(s,t){return s===t},AcNDo:function(s,t){return s&t},iiKxZ:function(s,t){return s&t},crJGD:function(s,t){return s<<t},TXLsQ:function(s,t){return s<t},LoDtN:function(s,t){return s(t)},WDwbi:function(s,t){return s==t},iZbcz:function(s,t){return s!==t},TpGef:r(241),WnskB:r(669),MhGNu:function(s,t){return s+t},ySTXw:function(s,t){return s|t},vGycp:function(s,t){return s<<t},AHyXR:function(s,t){return s>=t},rzhYg:function(s,t){return s<=t},FGbRC:function(s,t){return s!==t},RjirG:r(1519),AMEBd:function(s,t){return s(t)},EnKEJ:function(s,t){return s+t},Fvbsu:function(s,t){return s+t},MwOMQ:function(s,t){return s+t},EBSyC:function(s,t){return s+t},ovmOR:function(s,t){return s+t},NqQJm:function(s,t){return s|t},DzTTg:function(s,t){return s|t},GSCQd:function(s,t){return s<<t},RULqK:function(s,t){return s|t},XkHZA:function(s,t){return s&t},YxVPh:function(s,t){return s<<t},qpicu:function(s,t){return s&t},pmqlz:function(s,t){return s&t},gsAZi:function(s,t){return s<t},vNgjO:function(s,t,n){return s(t,n)},uMiIL:function(s,t){return s>>t},WLtiO:function(s,t){return s>=t},VhErF:function(s,t){return s<=t},PIDpd:function(s,t){return s-t},Ojjis:function(s,t){return s<t},sCtRC:function(s,t,n){return s(t,n)},sIFRb:function(s,t){return s<t},EPOHD:function(s,t){return s>=t},cQfow:function(s,t){return s-t},NtMVi:function(s,t){return s+t},rtIwz:function(s,t){return s<t},eTrhs:function(s,t){return s&t},gWDZy:function(s,t){return s!==t},fIxaT:r(732),IjiTq:function(s,t){return s|t},bJuZg:function(s,t){return s&t},tnWXN:function(s,t){return s|t},XVSfL:function(s,t){return s&t},LrjNE:function(s,t){return s|t},bQhiy:function(s,t){return s|t},GUvKW:function(s,t,n){return s(t,n)},PdjEn:function(s,t){return s<t},qhWUg:function(s,t){return s+t},NKwUJ:r(202),HWgol:function(s,t){return s<t},Vagci:function(s,t,n){return s(t,n)},fsJcz:function(s,t){return s<t},bXFiG:function(s,t){return s>t},lPZyG:function(s,t){return s+t},ZqiIR:function(s,t){return s(t)},bYlKP:function(s,t){return s|t},UTAim:"BZbWl",iSTiW:r(973),ABIKk:function(s,t){return s&t},TIqoC:function(s,t){return s<<t},CnDbA:function(s,t){return s&t},CAyzp:function(s,t){return s<<t},bgrrf:function(s,t){return s<<t},ISruk:function(s,t){return s&t},TkEAB:"tbuSv",uSGYP:function(s,t){return s(t)},fXcyT:function(s,t){return s<<t},hwSVs:function(s,t){return s&t},opTAV:r(1358),RXlor:function(s,t){return s&t},tjrKO:function(s,t){return s(t)},maZvl:function(s,t){return s<<t},ABCrd:function(s,t){return s&t},itHWm:function(s,t){return s<<t},KHNwX:function(s,t){return s<<t},hVAqw:function(s,t){return s|t},MVPHd:function(s,t){return s>>>t},JqRZu:function(s,t){return s>>>t},LxCfM:function(s,t){return s<<t},xaLnM:function(s,t){return s===t},dzOWn:function(s,t){return s<t},DAtCH:function(s,t,n){return s(t,n)},SrFmX:function(s,t){return s+t},ZmRuu:function(s,t){return s>>>t},XqYQB:function(s,t){return s|t},Voopg:function(s,t){return s&t},JxWNk:function(s,t){return s+t},uYmch:function(s,t){return s+t},Piibw:function(s,t){return s!==t},xESbF:function(s,t){return s|t},iGKUV:function(s,t){return s>>>t},qSauf:function(s,t){return s>>>t},ljrUx:function(s,t){return s!==t},BMiQv:function(s,t){return s|t},mZEBV:function(s,t){return s&t},OXCqB:function(s,t){return s>>>t},RGSis:function(s,t){return s|t},QrOCH:function(s,t){return s>>>t},esPsm:function(s,t){return s&t},oPQOU:function(s,t){return s>>>t},lXpIV:function(s,t){return s!==t},GeIIw:function(s,t){return s===t},YuSSF:r(752),QCIVN:"XlNxs",toEAP:function(s,t){return s(t)},vmYzC:function(s,t){return s<<t},rLHpi:function(s,t){return s<<t},daapJ:function(s,t){return s|t},Jmzzr:function(s,t){return s|t},pKxCQ:function(s,t){return s|t},rOmbg:function(s,t){return s>>>t},WHyxa:function(s,t){return s|t},PHVcj:function(s,t){return s|t},wgyqV:function(s,t){return s<<t},pyvVH:function(s,t){return s>>>t},BuqxG:function(s,t){return s>=t},KCAoz:function(s,t){return s<=t},TggTB:function(s,t){return s%t},vJZOr:function(s,t){return s|t},znCDw:function(s,t){return s/t},uLvkJ:function(s,t){return s>>>t},noReK:function(s,t){return s>>>t},Jlxke:function(s,t){return s===t},PIpqi:function(s,t){return s&t},yanhF:function(s,t){return s&t},ysSga:function(s,t){return s<<t},roYnA:function(s,t){return s!==t},OByOQ:function(s,t){return s===t},mBcsR:function(s,t){return s>>>t},bRegL:function(s,t){return s===t},sLLcg:function(s,t){return s&t},vCZYy:function(s,t){return s>>>t},vPfER:function(s,t){return s>>>t},vhvdA:function(s,t){return s&t},uLeuT:function(s,t){return s>>>t},XVxGj:function(s,t){return s===t},uqWLY:r(1620),WAOiJ:function(s,t){return s&t},ADAqy:function(s,t){return s&t},pVGxK:r(896)+"0|2",MKeOh:r(1217)+"OR",JETSk:r(222)+r(336),kmAGN:r(399)+r(985)+"R",CERhc:r(425)+r(1271),SfZjk:r(243)+"ERROR",KMGCd:r(629),PhnPF:r(1130)+"3",SnEeV:function(s,t){return s===t},WApsD:r(352),bqggL:r(1013),ijqaO:"2|1|4|0|3",wUkCM:r(508),ftuvK:function(s,t){return s-t},fOBEP:function(s,t){return s>t},TMmmY:r(1573),YFshg:function(s,t){return s===t},LHpab:"objectSt"+r(204),yDCcw:function(s,t){return s===t},blLAw:r(1061),xhABy:function(s,t){return s instanceof t},XTGHe:function(s,t){return s+t},Vhykd:r(309)+r(1326),AEUtH:function(s,t){return s<t},iIWvI:function(s,t){return s===t},YSlYq:function(s,t,n){return s(t,n)},dCMFY:function(s,t,n){return s(t,n)},iojll:r(1259),xvZic:function(s,t,n){return s(t,n)},NEjiL:r(965),yhLIm:function(s,t){return s!==t},eyodo:r(636),iNGSG:function(s,t){return s===t},aMpVX:r(1262),IrGRn:r(1193),flqXl:function(s,t,n){return s(t,n)},usBZm:function(s,t){return s>t},FbDzb:function(s,t){return s===t},yodZt:r(930),kbHLY:function(s,t){return s instanceof t},GaNpk:r(818)+"ile_name",yFXmv:r(852)+r(785),gcMoG:r(976),VixQF:function(s,t){return s||t},gEAxi:r(441)+"d",VHudE:"1|0|2|3|4",yPRrr:function(s,t){return s||t},YabXI:function(s,t){return s!=t},zOJIw:function(s,t){return s<=t},qYwfG:"next() c"+r(463)+"ltiple t"+r(1258)+r(1181),TxFmo:function(s,t){return s<t},pszsR:function(s,t){return s<t},sHncH:function(s,t){return s&t},GwcfG:function(s,t){return s<t},qcoZn:function(s,t){return s>=t},pHgOy:function(s,t){return s<t},myIdl:function(s,t){return s|t},kJyaF:function(s,t){return s>=t},yQoCa:function(s,t){return s|t},OijsM:function(s,t){return s|t},QNMaB:function(s,t){return s&t},ZsDBK:function(s,t){return s&t},CyZZU:function(s,t){return s&t},eLsfy:function(s,t){return s&t},grgbz:function(s,t){return s!=t},CCmWI:r(751),IQzmP:"applicat"+r(842),hcxlW:r(676),sctBK:r(306),bhskc:function(s,t){return s>>t},DLBnq:function(s,t){return s|t},GMIhP:function(s,t){return s===t},pjJdZ:function(s,t){return s===t},xZYHj:"fVxsb",Lqvck:"sxWAM",suFJk:r(542)+r(740),hRmOO:function(s,t){return s&t},pcRMr:function(s,t){return s&t},PVOYU:function(s,t){return s|t},LbkvR:function(s,t){return s+t},WpFRG:function(s,t){return s&t},PcwdH:function(s,t){return s|t},AXxEl:function(s,t){return s&t},IsKmD:function(s,t){return s&t},VSZvN:function(s,t,n,o){return s(t,n,o)},eWnCh:function(s,t){return s!=t},oZFIg:function(s,t){return s instanceof t},ODDzo:function(s,t){return s instanceof t},bAMNP:function(s,t){return s!=t},KVMhm:r(727)+r(1479)+r(920),xuPVH:"boe",LQGIt:"stop imm"+r(303)+r(765)+"ct",MwAJi:function(s,t){return s===t},OMuNx:r(773),iNsIv:function(s,t){return s(t)},grMIv:function(s,t){return s+t},AmstE:r(1465),xNmNL:function(s,t){return s(t)},IvAIn:function(s,t){return s(t)},GzQvo:r(1545),EILYV:function(s,t,n){return s(t,n)},XSqIw:r(365),fgrDr:r(467),YlgmE:function(s,t,n,o){return s(t,n,o)},IjqPk:"success",SNBzT:function(s,t){return s!==t},pNQBt:r(1426),oOrcV:r(1268),iXvGL:r(1103),GNtYf:function(s,t,n){return s(t,n)},ltijy:function(s,t){return s+t},mFcxp:r(1510),RnekH:function(s,t){return s!==t},RWGet:r(288),NhuKQ:r(570),yFUrY:function(s,t){return s!==t},vcRis:r(355),onfme:"JfKsE",TZcwU:"TOXhb",vrSam:"kwqQZ",iRNVt:function(s,t){return s(t)},MPRdP:r(380),qTnZs:r(790),wNAWI:function(s,t){return s||t},mToTK:r(1031),fuIuu:r(1398),OHqxp:function(s,t){return s||t},DtoxL:r(1275),IbgQY:function(s,t){return s||t},dSEIy:function(s,t){return s||t},nKbRB:r(717),pKRik:r(382),HNRgK:function(s,t){return s||t},KBKWj:function(s,t){return s!=t},rctXJ:r(795),vcvHN:function(s,t){return s(t)},qiQmJ:function(s,t,n){return s(t,n)},uEdFI:function(s,t){return s+t},gVFbr:r(1231),IHTGh:function(s,t){return s-t},gferY:function(s,t){return s&t},OccqD:function(s,t){return s|t},azVAq:function(s,t){return s&t},iDrts:r(464),gAdcG:function(s,t,n,o){return s(t,n,o)},CrnJw:r(1382)+r(758),GkpBk:function(s,t,n,o){return s(t,n,o)},XqUWl:r(1382)+r(1286)+"ck",NzKVY:function(s,t,n,o){return s(t,n,o)},DNrDM:r(1382)+"er_ack_m"+r(959),orwKm:function(s,t){return s(t)},eeSWc:r(293),jpiBu:function(s,t,n,o){return s(t,n,o)},hVHRn:r(199),cMhEQ:function(s,t,n,o){return s(t,n,o)},fQxNw:r(1372),kVGWH:function(s,t){return s&&t},omCKd:r(1288),JkbOf:function(s,t){return s||t},AhpLS:"received",ocOZV:function(s,t){return s instanceof t},RpvOG:function(s,t){return s===t},kwAEz:r(398),SEogJ:function(s,t){return s!==t},dnPSV:r(656),KlAsr:"DBTOv",WpgfL:function(s,t){return s instanceof t},ElDIs:r(770)+r(842)+r(440)+r(1005),WRYkU:"none_none",IkutW:function(s,t,n,o){return s(t,n,o)},auRHj:function(s,t){return s>t},RZjDA:function(s,t){return s(t)},xnaTj:function(s,t){return s>t},TlijV:function(s,t){return s+t},QRKuj:function(s,t){return s||t},PpSsw:function(s,t){return s>>>t},lnnfm:function(s,t){return s!==t},fsZLh:r(829),THAUo:function(s,t){return s+t},CNgTz:"index ou"+r(611)+r(217),LeVJx:r(1165),hyPBs:function(s,t){return s||t},vPnvn:function(s,t){return s&t},HummS:function(s,t,n,o){return s(t,n,o)},skBic:function(s,t){return s+t},IxcnJ:function(s,t,n){return s(t,n)},LhEiz:"4|1|3|2|0",OOnel:function(s,t){return s+t},rwlLv:function(s,t,n,o){return s(t,n,o)},LHAeS:function(s,t){return s+t},mfPmV:function(s,t,n,o){return s(t,n,o)},ccHul:function(s,t){return s+t},yWlIF:function(s,t){return s+t},EKvhq:function(s,t){return s|t},wTjDY:function(s,t){return s<<t},QKOgQ:function(s,t){return s+t},ZKyjj:function(s,t){return s<<t},iwGSc:function(s,t){return s+t},kgVbb:function(s,t){return s+t},MscWo:function(s,t){return s+t},wTTVB:function(s,t){return s|t},AXUVN:function(s,t){return s<<t},UlpKB:function(s,t){return s+t},dWTSg:function(s,t){return s+t},GjZac:function(s,t){return s>>>t},SngSl:function(s,t){return s+t},dFPms:function(s,t){return s&t},CGAfT:function(s,t){return s+t},GFDXm:function(s,t){return s+t},gsvBH:function(s,t){return s&t},NwSrd:function(s,t){return s&t},lAMtm:function(s,t){return s&t},gJbEK:function(s,t){return s|t},zUIub:function(s,t){return s>>t},XojXO:function(s,t){return s===t},JGWoe:r(451),NJcxw:r(1046),rElKZ:function(s,t){return s!==t},YosCX:function(s,t){return s!==t},DRCCE:function(s,t){return s>>>t},IsEHg:function(s,t){return s|t},UloIV:function(s,t){return s&t},xWrUJ:function(s,t){return s|t},fkxhL:function(s,t){return s>>>t},mtLCZ:function(s,t){return s|t},SVBxF:function(s,t){return s<<t},CDETF:function(s,t){return s>>>t},JRdfD:function(s,t){return s&t},kYTRG:function(s,t){return s|t},pCupv:function(s,t){return s===t},ptPSG:r(1466),nJbDG:function(s,t){return s|t},JtQwi:function(s,t){return s!==t},wrMDh:"QWdzW",gcYqd:"JOxue",RWVrx:function(s,t){return s(t)},WAlqn:function(s,t){return s+t},TbXao:r(739)+"|7|4|9|6|8|5|0",DEjkR:r(1190),ROtCV:r(1024)+"ervice",bmFhL:function(s,t,n,o){return s(t,n,o)},uXkFr:r(919),vGqfX:function(s,t){return s(t)},gOHHJ:function(s,t){return s<t},XDlZY:function(s,t,n){return s(t,n)},EVaNS:function(s,t,n,o){return s(t,n,o)},Duftw:function(s,t,n){return s(t,n)},jFdbg:function(s,t,n){return s(t,n)},DvYSw:function(s,t){return s===t},KMkSo:r(1321),uappH:"allCurso"+r(722),gaslx:r(360),drTFd:function(s,t,n,o){return s(t,n,o)},rexeJ:r(1132),QMezL:r(1387),EjaBv:function(s,t,n,o){return s(t,n,o)},ZmWCK:r(1280),efHEw:function(s,t){return s|t},SqlkZ:function(s,t){return s<<t},uGGXI:function(s,t){return s<<t},RjCxG:function(s,t){return s<<t},XMxzx:function(s,t){return s|t},MdtFt:function(s,t){return s===t},dmcRj:r(1412),MLKQj:r(763),mljIN:function(s,t,n){return s(t,n)},yjlpZ:function(s,t){return s||t},ogEOq:r(455),HFAeT:function(s,t,n,o){return s(t,n,o)},mCIfX:r(634),JnKVB:"x_fronti"+r(1075),kUMth:function(s,t){return s(t)},kYWkk:r(1382)+r(393),odQcx:function(s,t,n,o){return s(t,n,o)},eHvoe:r(433)+"s",FloOg:r(1001)+r(1498)+"e",adWXD:function(s,t,n){return s(t,n)},QIOUJ:"x-msg-cu"+r(925)+"ue",HtXhB:function(s){return s()},wWCiO:function(s,t){return s<t},FtciR:function(s){return s()},WjExt:function(s,t,n){return s(t,n)},UJfNH:function(s){return s()},qmCvE:function(s,t){return s!==t},RjTYz:function(s,t){return s<t},HOdUD:function(s,t){return s===t},gUluB:function(s){return s()},bulYw:function(s,t,n){return s(t,n)},NFiCr:function(s,t,n){return s(t,n)},bzrkb:r(1425),HmcNJ:function(s){return s()},EXwlN:r(207),xlgvJ:function(s,t,n){return s(t,n)},WNqyZ:function(s,t){return s===t},KepRA:r(1614),sEvEh:function(s,t){return s!==t},Igflr:function(s,t,n){return s(t,n)},XamOx:function(s,t){return s!==t},jSiGZ:function(s,t,n){return s(t,n)},uwIcJ:function(s,t,n){return s(t,n)},iyCFI:r(228),auFnv:"pIwbk",cNnyY:r(794),qvARv:r(937),vEGqx:function(s,t){return s===t},FwdRg:r(1079)+r(1300)+r(477)+", WebSoc"+r(363)+r(1374)+r(1065)+r(314),ZPOoR:function(s,t,n){return s(t,n)},mwrRe:r(1225)+"t",YyHci:r(1481),dTAsi:r(1152),qomxi:r(466),yHTrt:r(972),RFpMQ:r(1104),lafFS:r(1458)+"d",Zsmyg:function(s,t,n){return s(t,n)},VAuJB:r(1417),oJqRZ:function(s,t,n){return s(t,n)},TXYHv:function(s,t){return s||t},hFuYE:function(s,t,n){return s(t,n)},rrftd:r(810),GVhzI:function(s,t){return s>t},FQkSM:function(s,t){return s-t},qgRIj:function(s,t){return s(t)},SMZrb:"WGRjF",UrLEh:r(1092)+">",igCrU:function(s,t){return s===t},oTpRp:"vtFvh",IXVZC:function(s,t){return s>t},MfIhs:function(s,t,n,o){return s(t,n,o)},YBOWF:"dCVVT",WEzxw:r(1402)+r(960)+"t",XeSvb:r(1594),GNTKM:r(1043)+r(1473)+r(1225)+r(1038)+r(738),JzDBU:r(1450),tMocb:"xAjMn",ebvPe:r(270),ySXMq:function(s,t,n,o){return s(t,n,o)},RYMkX:r(255),FkYjn:r(1572)+r(901)+"onnecting",jjHsl:r(1362),CFasJ:r(822)+"1",oUuzH:function(s,t){return s!==t},AeUqd:r(1141),CYOJw:function(s,t,n){return s(t,n)},cohel:"PdVzG",krkEo:function(s,t,n){return s(t,n)},JYFdY:function(s,t,n){return s(t,n)},JpaJW:r(1043)+r(1517)+r(991)+r(1590),lVGoi:r(1093),Qmhts:function(s,t){return s(t)},OzKSe:function(s,t){return s!==t},vxssM:r(457),HzxAE:function(s,t){return s|t},APQGM:"SiSjK",krrMW:r(509),efFvQ:r(1142),GkzdW:r(386)+r(521),iFBFQ:function(s,t){return s===t},GuRYW:"close, ws instan"+r(1244)+"nitialized",RBbZr:"please p"+r(1083)+r(200)+r(1235)+r(1293)+r(1076)+r(955)+r(482)+r(1569),zAUUt:r(472),YGSsM:function(s,t){return s!=t},sREcf:function(s,t){return s(t)},GTWJD:function(s,t){return s(t)},LoPuE:function(s,t){return s instanceof t},zJyaV:function(s,t){return s===t},LdeRQ:"LrNEO",btpOA:function(s,t){return s||t},yRZgt:function(s,t){return s==t},VPSjG:function(s,t){return s!==t},eBaWQ:r(294)+r(1469)+"ing",HJFEZ:"1|0|4|2|3",aTxZs:function(s,t,n){return s(t,n)},QcclB:function(s,t){return s(t)},SKGWL:r(598),bYPYm:function(s,t){return s*t},YBKUP:r(1560),vfsvn:function(s,t){return s===t},KswYE:r(374),idLvF:r(490)+r(531)+"lobalScope",GFRqs:function(s,t){return s!=t},tfXHP:function(s,t){return s===t},ADzWv:r(1257)+r(1008)+r(1579),TtQQt:function(s,t){return s!=t},ITwwy:function(s,t){return s===t},uLuNL:function(s,t){return s===t},gPAoY:function(s,t,n){return s(t,n)},TGCao:r(428)+r(926)};Ce.r(Z),Ce.d(Z,{FWS:()=>t0,CustomErrorEvent:()=>ms,createCloseEvent:()=>me,ReconnectEvent:()=>ps,createErrorEvent:()=>le,decodedFrame:()=>ds,createOpenEvent:()=>Ss,CustomCloseEvent:()=>ws,createReconnectEvent:()=>cr,FrontierMessageEvent:()=>ys,encodeFrame:()=>ar,createMessageEvent:()=>vs,OpenEvent:()=>bs,ErrorCode:()=>Ue,Event:()=>ot,MessageEvent:()=>_s});let i="";function a(s=""){let t=r,n="02",o=""+Date[t(1080)](),x=i||(i=e[t(867)](m,s)),l=Math[t(1325)]().toString(16)[t(258)](-6);return e.FRbVu(e[t(1151)](e[t(1151)](n,o),x),l)}function c(){let s=r;return e[s(1558)](e.nsYqv(1e4,Date.now()),Math[s(1026)](e[s(1236)](1e4,Math[s(1325)]())))}function u(s){let t=r;return e[t(1151)](e[t(709)](Array,8)[t(760)]("0"),parseInt(s,10)[t(187)](2)).slice(-8)}function d(s){let t=r;return e.FRbVu(e[t(1158)](Array,4).join("0"),e.gMddX(parseInt,s,2).toString(16))[t(258)](-4)}function h(s){let t=r;if(e[t(343)]!==e[t(1538)]){let n=s[t(1357)](/\./)[t(1494)](l=>u(l)),o=[];return o[0]=e.WPYoB(d,e[t(1511)](n[0],n[1])),o[1]=d(e[t(1100)](n[2],n[3])),[e[t(568)],e[t(568)],e[t(568)],t(1331),t(1331),t(1290),o[0],o[1]][t(760)]("")}else return _0x9432c0["objectSt"+t(204)]||_0x25bd17[t(935)](_0x5658b1)}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(1048)](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]))/.test(s);return n?h(s):o?w(s):"00000000"+t(267)+t(267)+"00000000"}function w(s){let t=r,n={plPWc:function(b,v){return e.tUfgP(b,v)},niZIb:e[t(693)]},o="",x=[],l=0,g=0,p=!0,f="0000";if(e.VHGqh(s[t(496)]("::"),-1)){let b=s[t(1357)]("::");for(let C=0;e[t(1599)](C,b[t(836)]);C++){let I=b[C];if(e[t(918)](I[t(496)](":"),0)){let O=I.split(":");p&&(l=O.length),g+=O[t(836)];for(let L=0;e[t(701)](L,O[t(836)]);L++)if(e[t(1363)](4,O[L][t(836)]))if(e[t(1134)](e[t(964)],e.QMscP)){let B=f[t(1603)+"g"](0,e.YKCmo(4,O[L][t(836)])),Q=B[t(1499)](O[L]);x[t(547)](Q)}else{let B=_0x21ffcb[t(1232)+t(672)](e[t(730)]);_0x40d8c1[t(506)+t(562)]=Q=>{let $=t;_0x349a1a[$(297)][$(1112)+$(975)](B),_0x1c19f9["frontier"+$(562)]=void 0,n.plPWc(_0x4db6ac,Q&&Q[$(359)]||n[$(252)])},B[t(317)]=e[t(260)],B.src=_0x5a6961[t(1399)](/^ws/,e[t(697)])+e[t(941)];try{_0x16e771.body[t(271)+t(975)](B)}catch{_0x10d54f[t(297)][t(1112)+"ild"](B)}}else x[t(547)](O[L]);p=!1}else{if(e[t(545)](4,I[t(836)]))if(e[t(545)](t(704),t(954))){let O=f[t(1603)+"g"](0,e[t(571)](4,I.length)),L=O[t(1499)](I);x.push(L)}else return this[t(480)+t(344)+t(1380)+"t"];else x[t(547)](I);p&&(l+=1),g+=1,p=!1}}let v="";for(let C=0;e.mrBPQ(C,e[t(378)](8,g));C++)v=v[t(1499)](f);for(let C=0;e[t(233)](C,x[t(836)]);C++)e[t(1134)](C,l)?(o=o.concat(v),o=o.concat(x[C])):o=o[t(1499)](x[C]);return o}{let b=s[t(1357)](":");for(let v=0;e[t(1039)](v,b.length);v++){let C=b[v];if(e[t(1363)](4,b[v][t(836)])){let I=f.substring(0,e[t(554)](4,b[v][t(836)])),O=I[t(1499)](C);o=o[t(1499)](O)}else o=o[t(1499)](C)}return o}}function _(s,t){let n=r,o=s.key;e[n(607)](void 0,o)&&(e[n(1482)](V,t,10),e[n(1482)](ve,t,o));let x=s.value;e.znLGG(void 0,x)&&(e[n(1482)](V,t,18),e[n(608)](ve,t,x))}function y(s){let t=r,n={};e:for(;!e[t(1050)](ke,s);){let o=e[t(1050)](H,s);switch(e[t(1081)](o,3)){case 0:break e;case 1:n[t(275)]=e.bCRLX(be,s,e[t(216)](H,s));break;case 2:n[t(1403)]=e[t(608)](be,s,e[t(289)](H,s));break;default:e[t(421)](oe,s,7&o)}}if(e[t(1134)](void 0,n[t(275)]))throw new Error(e[t(1606)]);if(e[t(1134)](void 0,n[t(1403)]))throw new Error(e.loSPn);return n}function A(s){let t=r,n=xe();return e[t(1574)](k,s,n),e[t(1546)](J,n)}function k(s,t){let n=r,o={BZrZM:function(l,g){return e.VleeX(l,g)},LtflP:n(830)+n(446)+"e",isOvN:function(l,g){return l>=g},ubLuP:function(l,g){return e[n(348)](l,g)},WOtXI:function(l,g,p,f){return e[n(856)](l,g,p,f)},DGnNn:function(l,g){return e[n(1558)](l,g)},wjbcu:function(l,g){return l+g}};if(n(1462)!==e.nxcat)this[n(476)]=!0,this[n(1054)]();else{let l=s.SeqID;if(e[n(454)](void 0,l))if(e[n(1143)]!==e.wadRW){if(o[n(994)](_0x5bee0c,_0x58db7f))throw new _0x3c63d9(o.LtflP);let $=3;for(;o.isOvN($,0);){let Ie=o[n(943)](255,_0x573375);o[n(502)](_0x1d4ae9,Ie,_0x4f782e,o.DGnNn(_0x19f8ad,$)),_0x1ca22a>>>=8,$--}return o[n(1448)](_0x5cf8cc,4)}else e[n(1476)](V,t,8),e[n(1482)](Ct,t,l);let g=s[n(196)];e[n(1036)](void 0,g)&&(e[n(1476)](V,t,16),e[n(608)](Ct,t,g));let p=s[n(255)];e.jptqS(void 0,p)&&(e[n(350)](V,t,24),e[n(1356)](Ct,t,e[n(1062)](te,p)));let f=s[n(915)];f!==void 0&&(V(t,32),e[n(622)](Ct,t,e[n(1546)](te,f)));let b=s[n(1457)];if(e[n(638)](void 0,b))for(let $ of b){e[n(1574)](V,t,42);let Ie=e.KgtCY(xe);_($,Ie),e[n(844)](V,t,Ie.limit),e.uBRlV(Yt,t,Ie),e[n(289)](P,Ie)}let v=s["payloadE"+n(859)];if(e[n(1036)](void 0,v))if(e[n(1602)](e[n(1608)],e[n(1608)]))V(t,50),e[n(421)](ve,t,v);else for(var x in _0x168721)VbOySU[n(502)](_0x1e0f73,_0x1036e5,x,{get:_0x5976b1[x],enumerable:!0});let C=s["payloadT"+n(1164)];e[n(545)](void 0,C)&&(V(t,58),ve(t,C));let I=s[n(1192)];if(I!==void 0){if(e[n(1214)](e.CDvJj,e[n(690)]))return this._socket[n(1528)+"ns"];e[n(1149)](V,t,66),V(t,I[n(836)]),e[n(1588)](Vt,t,I)}let O=s[n(581)];if(O!==void 0)if(e[n(1134)](e.gkhDh,e[n(529)]))e[n(194)](V,t,74),e.DHOJo(ve,t,O);else return new _0x29cfcd(_0x3149a0,{message:_0x1a39e3});let L=s[n(931)+n(1126)];e[n(869)](void 0,L)&&(e[n(1588)](V,t,82),ve(t,L));let B=s.msgID;if(e[n(1214)](void 0,B))if(e[n(649)](e[n(1237)],e[n(318)]))e[n(684)](V,t,90),ve(t,B);else{let $=new _0x373154(e[n(1236)](2,_0x4107d8));$[n(396)](_0xb343f2),_0x4fb73f[n(1585)]=$}let Q=s[n(519)+"e"];e[n(869)](void 0,Q)&&(e.dikJU(V,t,96),e[n(292)](Ct,t,e[n(330)](te,Q)))}}function T(s){let t=r;return e.tUfgP(R,e[t(1350)](F,s))}function R(s){let t=r,n={};e:for(;!ke(s);){let o=H(s);switch(e[t(1081)](o,3)){case 0:break e;case 1:n[t(1072)]=e[t(1476)](De,s,!0);break;case 2:n[t(196)]=e.lkxww(De,s,!0);break;case 3:n[t(255)]=H(s);break;case 4:n.method=e.McAft(H,s);break;case 5:{let x=e[t(1050)](q,s);(n.headers||(n.headers=[]))[t(547)](e[t(1062)](y,s)),s.limit=x;break}case 6:n[t(731)+"ncoding"]=e[t(471)](be,s,e[t(1062)](H,s));break;case 7:n["payloadT"+t(1164)]=e[t(1185)](be,s,H(s));break;case 8:n[t(1192)]=e.cFNPZ(Et,s,e[t(1158)](H,s));break;case 9:n[t(581)]=e[t(1618)](be,s,H(s));break;case 10:n[t(931)+t(1126)]=e[t(645)](be,s,e[t(1350)](H,s));break;case 11:n[t(1306)]=e[t(471)](be,s,e[t(1242)](H,s));break;case 12:n[t(519)+"e"]=e.NPoqF(H,s);break;default:oe(s,7&o)}}if(e[t(1602)](void 0,n.SeqID))throw new Error(e[t(1314)]);if(e.RJBHb(void 0,n.LogID))throw new Error("Missing "+t(238)+" field: "+t(196));if(e[t(1602)](void 0,n[t(255)]))throw new Error(e.rDsUi);if(n[t(915)]===void 0)throw new Error(e[t(1575)]);return n}function q(s){let t=r,n=e.CGRCj(H,s),o=s[t(1267)];return s[t(1267)]=s.offset+n,o}function oe(s,t){let n=r;switch(t){case 0:for(;e[n(670)](128,e[n(610)](ae,s)););break;case 2:e[n(292)](ne,s,H(s));break;case 5:e[n(1068)](ne,s,4);break;case 1:e[n(1618)](ne,s,8);break;default:throw new Error(e.JFCJQ+t)}}function te(s){let t=r;return s|=0,{low:s,high:e[t(298)](s,31),unsigned:s>=0}}let ye=[];function xe(){let s=r,t={gJuvd:e[s(720)],Sjbkq:function(n,o,x){return e.hjZQq(n,o,x)}};if(e[s(1179)](e.ElTqA,e.OgqYr))this[s(759)](t[s(1365)],t[s(1500)](_0x217a60,t[s(1365)],{message:this[s(702)+"rrorMess"+s(302)](_0x3cf098)}));else{let n=ye.pop();return n?(n.offset=n.limit=0,n):{bytes:new Uint8Array(64),offset:0,limit:0}}}function P(s){let t=r;e[t(1041)](e.unSHn,e[t(691)])?(_0x1d5746&&_0x49a088[t(426)+t(1037)](WjnquI[t(1540)],()=>_0x37801b()),_0x16b6f8&&_0x159e21[t(426)+t(1037)](t(1311)+"hange",()=>_0x1d3e54())):ye[t(547)](s)}function F(s){return{bytes:s,offset:0,limit:s[r(836)]}}function J(s){let t=r,n=s.bytes,o=s[t(1267)];return e[t(1002)](n[t(836)],o)?n:n[t(500)](0,o)}function ne(s,t){let n=r;if(e.yxSoK(e[n(1443)](s[n(1044)],t),s.limit))throw new Error(e.fXHRM);s.offset+=t}function ke(s){let t=r;return s[t(1044)]>=s[t(1267)]}function pe(s,t){let n=r,o=s[n(1585)],x=s[n(1044)],l=s[n(1267)],g=e[n(1021)](x,t);if(g>o[n(836)]){let p=new Uint8Array(2*g);p[n(396)](o),s.bytes=p}return s[n(1044)]=g,g>l&&(s.limit=g),x}function $e(s,t){let n=r,o={ZPXgB:e[n(720)],vdNuy:function(x,l,g){return e[n(684)](x,l,g)},ruaqj:function(x,l){return x+l}};if(e.AKcgf(n(444),e[n(1183)])){let x=s[n(1044)];if(e[n(1021)](x,t)>s[n(1267)])throw new Error("Read pas"+n(266));return s[n(1044)]+=t,x}else{let x={PyWIf:o.ZPXgB,slbCU:function(g,p,f){return o.vdNuy(g,p,f)}},l=_0x12191c[n(1071)][n(258)](_0x28567b[n(1163)+"et"],o[n(936)](_0x5899dc[n(762)+"th"],_0x1a0d50[n(1163)+"et"]));this[n(1034)]&&this[n(1034)][n(537)]({data:l,fail:g=>{let p=n;this.emit(x.PyWIf,x.slbCU(_0x3148e0,x[p(1593)],{message:this["_formatE"+p(721)+p(302)](g)}))}})}}function Et(s,t){let n=r,o={euWAx:function(x){return e[D(364)](x)}};if(e[n(1172)](e[n(1413)],e[n(1413)])){let x=$e(s,t);return s[n(1585)][n(500)](x,e[n(1151)](x,t))}else this[n(476)]=!1,_0x16a899(this[n(1054)+n(793)+n(1543)]),o.euWAx(_0x1c118e)}function Vt(s,t){let n=r,o=e.YZLzs(pe,s,t[n(836)]);s[n(1585)][n(396)](t,o)}function be(s,t){let n=r,o={PZRuu:function(b,v){return e.CGRCj(b,v)}},x=e.IcejH($e,s,t),l=String["fromChar"+n(887)],g=s[n(1585)],p="\uFFFD",f="";for(let b=0;e[n(384)](b,t);b++){let v=g[b+x],C,I,O,L;if(e[n(737)](128&v,0))f+=l(v);else if(e.cWczc(e[n(1477)](224,v),192))e[n(1443)](b,1)>=t?f+=p:(C=g[e[n(1511)](b+x,1)],e[n(869)](e[n(1153)](192,C),128)?f+=p:(L=e[n(242)](e.leNWC(31,v),6)|e[n(670)](63,C),e[n(1015)](L,128)?f+=p:(f+=e.LoDtN(l,L),b++)));else if(e[n(1348)](240&v,224))if(e[n(1558)](b,2)>=t)f+=p;else if(e.iZbcz(e[n(1291)],e[n(1351)]))if(C=g[e[n(478)](e[n(1151)](b,x),1)],I=g[b+x+2],e[n(1601)](e.leNWC(C|e.crJGD(I,8),49344),32896))f+=p;else if(L=e.ySTXw((15&v)<<12,e[n(225)](e[n(670)](63,C),6))|e.VarDx(63,I),e[n(1586)](L,2048)||e[n(817)](L,55296)&&e[n(653)](L,57343))f+=p;else if(e[n(1421)](e[n(1186)],e.RjirG)){let B=new _0xa44acd(o.PZRuu(_0x30d343,_0x15df65));return _0x2aa328(_0x51b189,B,0),B}else f+=e[n(1370)](l,L),b+=2;else{if(e[n(518)](void 0,_0x83c1c0))this[n(479)+"rs"]={};else if(_0x1af374===void 0)this._listeners[_0x32b127]=null;else{let B=this._listeners[_0x5e182f];if(B)for(let Q=0;e[n(1586)](Q,B[n(836)]);)B[Q].fn===_0x5cd812?B[n(1375)](Q,1):++Q}return this}else e.VarDx(248,v)==240?e[n(1021)](b,3)>=t?f+=p:(C=g[e[n(1541)](e[n(1539)](b,x),1)],I=g[e[n(1140)](e[n(736)](b,x),2)],O=g[e[n(299)](b,x)+3],(e[n(707)](e[n(1135)](C,e[n(1318)](I,8)),O<<16)&12632256)!==8421504?f+=p:(L=e[n(312)](e[n(707)](e[n(225)](e[n(512)](7,v),18),e.leNWC(63,C)<<12)|e[n(1303)](e[n(1219)](63,I),6),e[n(593)](63,O)),e[n(559)](L,65536)||e.yxSoK(L,1114111)?f+=p:(L-=65536,f+=e[n(1565)](l,e[n(1021)](e.uMiIL(L,10),55296),(1023&L)+56320),b+=3))):f+=p}return f}function ve(s,t){let n=r,o=t.length,x=0;for(let p=0;e.mdTDf(p,o);p++){let f=t[n(1227)+"At"](p);e[n(279)](f,55296)&&e[n(695)](f,56319)&&e[n(1586)](e[n(1539)](p,1),o)&&(f=e[n(1006)](e[n(1511)](e[n(242)](f,10),t.charCodeAt(++p)),56613888)),x+=e[n(384)](f,128)?1:e[n(803)](f,2048)?2:e[n(384)](f,65536)?3:4}V(s,x);let l=e.sCtRC(pe,s,x),g=s[n(1585)];for(let p=0;e[n(1101)](p,o);p++){let f=t[n(1227)+"At"](p);if(e[n(1147)](f,55296)&&f<=56319&&e[n(1599)](p+1,o)&&(f=e.cQfow(e[n(404)](f<<10,t.charCodeAt(++p)),56613888)),e[n(290)](f,128))g[l++]=f;else{if(e[n(803)](f,2048))g[l++]=e[n(1477)](e[n(687)](f,6),31)|192;else{if(f<65536)g[l++]=e.RULqK(e[n(753)](f>>12,15),224);else{if(e[n(587)]("JOAVl",e.fIxaT))return(this._listeners[_0x2eb1e7]||(this._listeners[_0x11767d]=[]))[n(547)]({fn:_0x4d6fd1,ctx:_0x413bb6||this}),this;g[l++]=e.IjiTq(e[n(401)](e[n(687)](f,18),7),240),g[l++]=e[n(394)](e[n(644)](f>>12,63),128)}g[l++]=e[n(673)](f>>6&63,128)}g[l++]=e.bQhiy(e.leNWC(63,f),128)}}}function Yt(s,t){let n=r,o=e[n(698)](pe,s,t.limit),x=s[n(1585)],l=t[n(1585)];for(let g=0,p=t[n(1267)];e[n(1117)](g,p);g++)x[g+o]=l[g]}function ae(s){return s[r(1585)][e.YZLzs($e,s,1)]}function $t(s,t){let n=r;if(e[n(1602)](e.NKwUJ,n(202))){let o=pe(s,1);s[n(1585)][o]=t}else return _0x54bad2[n(367)+"8"]?{value:_0x4a1383[n(367)+"8"](_0x103b46),offset:e[n(619)](_0x15cbf3,1)}:{value:e[n(348)](255,_0x359a41[_0x5c583e]),offset:_0x10586b+1}}function H(s){let t=r,n=0,o=0,x;do x=ae(s),e[t(417)](n,32)&&(o|=e[t(593)](127,x)<<n),n+=7;while(128&x);return o}function V(s,t){let n=r;for(t>>>=0;t>=128;)e.cFNPZ($t,s,e[n(1135)](e[n(401)](127,t),128)),t>>>=7;e[n(1618)]($t,s,t)}function De(s,t){let n=r,o={FnkQJ:function(x,l,g){return e[D(639)](x,l,g)},haeoV:e.onPnX,JRSAa:function(x,l){return e[D(700)](x,l)},cQFAw:function(x,l){return e.bXFiG(x,l)},ImPNP:function(x,l){return e[D(1613)](x,l)},SgBDz:function(x,l){return e.ZqiIR(x,l)},PJopA:function(x,l){return e[D(232)](x,l)},MVvfK:function(x,l){return x||l},QdGnV:function(x,l){return x>>>l}};if(e.RJBHb(e.UTAim,e[n(475)]))this[n(203)+n(938)+n(533)]=_0x4cdec2,_0x3a81b7?this["_handleO"+n(370)]():this[n(536)+n(974)]();else{let x=0,l=0,g=0,p;if(p=ae(s),x=e[n(262)](127,p),128&p&&(p=e[n(1050)](ae,s),x|=e[n(855)](e[n(1477)](127,p),7),e[n(310)](128,p)&&(p=e[n(1158)](ae,s),x|=e[n(278)](e[n(1477)](127,p),14),128&p&&(p=e[n(1342)](ae,s),x|=e.bgrrf(e[n(248)](127,p),21),128&p&&(p=e[n(1546)](ae,s),l=127&p,e[n(512)](128,p)))))){if(e[n(1363)](e[n(851)],e[n(851)])){let f=this[n(1296)][n(1225)+n(796)+"ptor"](_0x26f1ed,_0x2dd72a);this[n(1138)+n(1284)+n(1346)](o[n(614)](_0x22eeb9,o[n(237)],{code:_0xef637b,reason:_0x5a2642,wasClean:!0,willReconnect:f})),f&&this._connect()}else if(p=e.uSGYP(ae,s),l|=e[n(878)](e.hwSVs(127,p),7),128&p)if(n(1358)===e.opTAV)p=e[n(879)](ae,s),l|=e[n(855)](e[n(512)](127,p),14),e[n(497)](128,p)&&(p=e[n(313)](ae,s),l|=e[n(1531)](e[n(663)](127,p),21),128&p&&(p=e[n(313)](ae,s),g=e[n(593)](127,p),128&p&&(p=ae(s),g|=e[n(1049)](e.CnDbA(127,p),7))));else{let f=o[n(1207)](_0x42756e,8192),b=o[n(837)](f,1),v=null,C=f;return function(I){let O=n;if(o[O(1446)](I,1)||I>b)return _0x3ac57f(I);o[O(872)](o.ImPNP(C,I),f)&&(v=o.SgBDz(_0x564687,f),C=0);let L=_0x1e10a1[O(812)](v,C,C+=I);return 7&C&&(C=o[O(958)](o.PJopA(7,C),1)),L}}}return{low:x|e.KHNwX(l,28),high:e[n(1553)](e[n(524)](l,4),g<<24),unsigned:t}}}function Ct(s,t){let n=r,o=e[n(1137)](t[n(1239)],0),x=(t[n(1239)]>>>28|e[n(831)](t[n(1028)],4))>>>0,l=e.JqRZu(t[n(1028)],24),g=e[n(873)](0,l)?x===0?e[n(559)](o,16384)?o<128?1:2:e[n(417)](o,2097152)?3:4:e.dzOWn(x,16384)?e.PdjEn(x,128)?5:6:e.mrBPQ(x,2097152)?7:8:e[n(803)](l,128)?9:10,p=e[n(1442)](pe,s,g),f=s[n(1585)];switch(g){case 10:f[e[n(427)](p,9)]=e.VarDx(e[n(664)](l,7),1);case 9:f[e[n(1443)](p,8)]=g!==9?e[n(832)](128,l):e[n(213)](127,l);case 8:f[e[n(659)](p,7)]=e[n(649)](8,g)?x>>>21|128:e[n(348)](x>>>21,127);case 7:f[e.uYmch(p,6)]=e[n(218)](7,g)?e[n(707)](e[n(1137)](x,14),128):e[n(497)](e[n(1081)](x,14),127);case 6:f[p+5]=e[n(638)](6,g)?e[n(412)](e[n(1003)](x,7),128):e[n(590)](x,7)&127;case 5:f[e[n(299)](p,4)]=e[n(649)](5,g)?e[n(940)](128,x):127&x;case 4:f[e[n(1151)](p,3)]=e.ljrUx(4,g)?e.xESbF(o>>>21,128):o>>>21&127;case 3:f[e[n(736)](p,2)]=g!==3?e[n(1576)](o>>>14,128):e.mZEBV(e[n(1433)](o,14),127);case 2:f[p+1]=e[n(869)](2,g)?e[n(389)](e[n(1312)](o,7),128):e[n(1323)](e.oPQOU(o,7),127);case 1:f[p]=e[n(987)](1,g)?e.BMiQv(128,o):e[n(1219)](127,o)}}function ds(s){return e.CGRCj(T,s)}function ar(s){let t=r,n={vhQMD:function(o,x){return o(x)},OLWzU:function(o,x){return e[D(659)](o,x)}};if(e[t(498)](e[t(1431)],e[t(862)])){let o=nBbWdd.vhQMD(_0x5c63ce,_0x2d76eb),x=_0x1713fa[t(1267)];return _0xb0317a[t(1267)]=nBbWdd[t(432)](_0xb8e439[t(1044)],o),x}else return e.toEAP(A,s)}let fs=65536,fa=e[r(296)],it=e.nsYqv(fs,fs),ls=e[r(1145)](it,it),hs=e[r(681)](ls,2),Fe=String.prototype.charCodeAt;class z{constructor(t,n,o){let x=r;this[x(1467)]=!0,this[x(1239)]=e[x(232)](0,t),this.high=e[x(832)](0,n),this[x(857)]=!!o}static[r(1467)](t){return t&&t[r(1467)]===!0}static[r(599)](t,n,o){return new z(t,n,o)}static[r(870)+"s"](t,n,o){return o?z["fromByte"+r(1035)](t,n):z.fromBytesBE(t,n)}static[r(870)+"sLE"](t,n){let o=r;return new z(e.bQhiy(e[o(1576)](e[o(232)](t[0],e[o(1416)](t[1],8)),e[o(875)](t[2],16)),e[o(855)](t[3],24)),e[o(232)](t[4]|e[o(1303)](t[5],8)|t[6]<<16,e[o(1531)](t[7],24)),n)}static["fromByte"+r(1486)](t,n){let o=r;return new z(e[o(1553)](e.XqYQB(e[o(1085)](t[4]<<24,t[5]<<16),t[6]<<8),t[7]),e[o(840)](e.pKxCQ(e[o(1169)](e[o(1318)](t[0],24),e[o(1531)](t[1],16)),t[2]<<8),t[3]),n)}static fromHash(t){let n=r;return e[n(1602)](t,fa)?gs:new z(e[n(510)](e[n(226)](e[n(312)](Fe[n(812)](t,0),e[n(278)](Fe[n(812)](t,1),8)),e[n(831)](Fe[n(812)](t,2),16))|Fe[n(812)](t,3)<<24,0),e[n(664)](e.PHVcj(e.IjiTq(Fe[n(812)](t,4),e[n(878)](Fe.call(t,5),8))|e.TIqoC(Fe[n(812)](t,6),16),e[n(1056)](Fe[n(812)](t,7),24)),0),!0)}[r(744)](){let t=r;return String[t(1385)+t(887)](e[t(670)](255,this[t(1239)]),this[t(1239)]>>>8&255,e[t(664)](this.low,16)&255,e[t(221)](this[t(1239)],24),e[t(644)](255,this.high),e[t(1137)](this[t(1028)],8)&255,e[t(644)](this[t(1028)]>>>16,255),this[t(1028)]>>>24)}static[r(1252)+"er"](t,n=!0){let o=r;if(e[o(551)](isNaN,t))return n?la:gs;if(n){if(e[o(1234)](t,ls))return ga}else{if(e[o(1202)](t,-hs))return pa;if(t+1>=hs)return ha}return z[o(599)](e[o(1576)](e.TggTB(t,it),0),e[o(1110)](e[o(681)](t,it),0),n)}[r(1406)](){let t=r;return this.unsigned?e[t(1613)](e[t(1236)](e[t(1480)](this[t(1028)],0),it),e[t(1233)](this[t(1239)],0)):e.Fvbsu(this[t(1028)]*it,e.pyvVH(this[t(1239)],0))}[r(1320)](){let t=r;return e[t(219)](0,this[t(1028)])&&this.low===0}[r(997)](t){let n=r;z[n(1467)](t)||(t=z.fromNumber(t));let o=e[n(1081)](this[n(1028)],16),x=e[n(560)](65535,this[n(1028)]),l=e.lMksL(this.low,16),g=65535&this[n(1239)],p=t.high>>>16,f=e[n(670)](65535,t[n(1028)]),b=e[n(1433)](t.low,16),v=e[n(735)](65535,t[n(1239)]),C=0,I=0,O=0,L=0;return L+=e[n(299)](g,v),O+=e[n(524)](L,16),L&=65535,O+=l+b,I+=e[n(1495)](O,16),O&=65535,I+=x+f,C+=e[n(664)](I,16),I&=65535,C+=o+p,C&=65535,z[n(599)](e[n(226)](e[n(788)](O,16),L),e[n(1553)](C<<16,I),this[n(857)])}[r(1167)](t){let n=r;return z.isLong(t)||(t=z[n(1252)+"er"](t)),e.roYnA(this[n(857)],t.unsigned)&&e[n(1137)](this.high,31)===1&&e[n(569)](e[n(1210)](t.high,31),1)?!1:this.high===t[n(1028)]&&e.PwRKq(this.low,t[n(1239)])}[r(754)](){let t=r;return e[t(988)](-1,this.low)&&this[t(1028)]===-1?z[t(599)](0,0,this[t(857)]):this[t(1239)]===-1?z.fromBits(0,e[t(478)](this[t(1028)],1),this[t(857)]):z[t(599)](e[t(619)](this.low,1),this[t(1028)],this[t(857)])}toBytes(t){return t?this.toBytesLE():this[r(1030)+"E"]()}[r(439)+"E"](){let t=r,n=this[t(1028)],o=this[t(1239)];return[e[t(1323)](255,o),e[t(383)](e[t(718)](o,8),255),e[t(512)](e[t(664)](o,16),255),e.vPfER(o,24),255&n,e.esPsm(n>>>8,255),e[t(932)](e[t(1081)](n,16),255),e[t(1447)](n,24)]}[r(1030)+"E"](){let t=r;if(e[t(750)](t(1407),e[t(864)]))this.on(_0x189863,_0x1166c1);else{let n=this[t(1028)],o=this[t(1239)];return[n>>>24,e[t(310)](e[t(590)](n,16),255),e[t(956)](e[t(729)](n,8),255),255&n,e.uLvkJ(o,24),e[t(753)](o>>>16,255),e[t(1480)](o,8)&255,e[t(1156)](255,o)]}}}let gs=new z(0,0,!1),la=new z(0,0,!0),ha=z[r(599)](-1,2147483647,!1),ga=z[r(599)](-1,-1,!0),pa=z[r(599)](0,-2147483648,!1);var Ue=(function(s){let t=r,n=e[t(1615)][t(1357)]("|"),o=0;for(;;){switch(n[o++]){case"0":s[s[e[t(1445)]]=5005]=e[t(1445)];continue;case"1":s[s[e[t(1595)]]=5001]=e[t(1595)];continue;case"2":return s;case"3":s[s[e[t(1390)]]=5003]=e[t(1390)];continue;case"4":s[s[e[t(824)]]=5002]=e[t(824)];continue;case"5":s[s[e[t(854)]]=5004]=e.SfZjk;continue}break}})({});class ot{constructor(t){let n=r;e[n(1136)]!==e[n(1136)]?(_0x41c46c(_0x37f002,50),_0x5021a2(_0x3a3a74,_0x13a220)):(this[n(317)]=t,this[n(304)]=null)}}class ps extends ot{constructor(t,n){let o=r;super(t),this[o(965)]=n&&n.message||null}}class ms extends ot{constructor(t,n){let o=r,x=(o(415)+o(1376)).split("|"),l=0;for(;;){switch(x[l++]){case"0":this[o(1127)]=n&&n.error||null;continue;case"1":this[o(849)]=n&&n.filename||"";continue;case"2":this.colno=n&&n[o(319)]||0;continue;case"3":this[o(634)]=n&&n[o(634)]||5001;continue;case"4":super(t);continue;case"5":this[o(965)]=n&&n.message||"";continue;case"6":this[o(1109)]=n&&n[o(1109)]||0;continue}break}}}class ws extends ot{constructor(t,n){let o=r,x=e[o(1194)][o(1357)]("|"),l=0;for(;;){switch(x[l++]){case"0":this.code=n&&n[o(634)]||0;continue;case"1":this[o(743)]=n&&n[o(743)]||"";continue;case"2":this[o(774)]=n&&n.wasClean||!1;continue;case"3":this[o(909)+"nnect"]=n&&n[o(909)+o(458)]||!1;continue;case"4":super(t);continue}break}}}class _s extends ot{constructor(t,n){let o=r;super(t),this[o(1355)]=n&&n[o(1355)]||null}}class ys extends _s{constructor(t,n){let o=r;super(t),this[o(1355)]=n&&n[o(1355)]||null,this.message=n&&n[o(965)]||null}}class bs extends ot{constructor(t,n){let o=r;super(t),this[o(1355)]=n&&n.data||null}}function le(s,{message:t,code:n,error:o}){return new ms(s,{message:t,code:n,error:o})}function me(s,{code:t,reason:n,wasClean:o,willReconnect:x}){return new ws(s,{code:t,reason:n,wasClean:o,willReconnect:x})}function vs(s,{data:t,message:n}){return new ys(s,{data:t,message:n})}function Ss(s,{data:t}){return new bs(s,{data:t})}function cr(s,{message:t}){return new ps(s,{message:t})}class Es{constructor(t,n){let o=r;e[o(1064)](e[o(1360)],e[o(1188)])?this[o(253)](_0x290f3a,_0x1c1004):(this[o(507)+"s"]=t,this.maxRetries=n,this["currentI"+o(429)]=0,this[o(480)+o(344)+o(1380)+"t"]=0)}["resetEnd"+r(1095)+"fig"](){let t=r;if(e.ljrUx(e[t(805)],t(1605)))this[t(337)+t(429)]=0,this[t(480)+"ndpointT"+t(1380)+"t"]=0;else{let n=e[t(882)].split("|"),o=0;for(;;){switch(n[o++]){case"0":this._isInit=!0;continue;case"1":this[t(868)+t(734)]?.[t(1069)+t(1341)]();continue;case"2":this["_endpoin"+t(714)]?.[t(1384)+t(1095)+"fig"]();continue;case"3":this[t(1054)]();continue;case"4":this._readyClosed=!1;continue}break}}}[r(612)+"es"](){let t=r;this[t(480)+t(344)+t(1380)+"t"]=0}[r(657)+r(511)+"nt"](){return this[r(507)+"s"][this.currentIndex]}["getCurre"+r(511)+r(632)+r(1310)](){let t=r;return this[t(480)+t(344)+t(1380)+"t"]}[r(1279)+"chMaxTries"](){let t=r;return!!(e[t(817)](this[t(337)+t(429)],this[t(507)+"s"][t(836)])||this[t(337)+t(429)]===e[t(346)](this.endpoints[t(836)],1)&&e[t(988)](this["currentE"+t(344)+t(1380)+"t"],this[t(1617)+"es"]))}[r(1381)+r(898)+r(1211)+r(487)+r(694)](){let t=r;return this[t(337)+t(429)]==this.endpoints[t(836)]?!0:e[t(585)](this[t(480)+"ndpointTriesCount"],this[t(1617)+"es"])}[r(897)+r(366)+r(387)+r(229)+r(1313)](){let t=r;return this["currentE"+t(344)+t(1380)+"t"]=1,this[t(337)+t(429)]++,this.endpoints[this["currentI"+t(429)]]}["getCurrentEndpointAndUpd"+r(368)](){let t=r;if(e[t(338)](e[t(1461)],e[t(1461)]))return this["currentE"+t(344)+"riesCount"]++,this[t(657)+"ntEndpoint"]();if(WjnquI[t(1602)](_0x6be0c9,WjnquI[t(1171)]))return _0x4c983a[t(935)](_0x288c1d);if(WjnquI[t(969)](_0x122bac,WjnquI.LHpab))return _0x546a9b[t(1292)+t(204)]||_0x5f0445.get(_0x448273);if(WjnquI[t(750)](_0x365217,t(1583)))return _0x55a3a8[t(1292)+t(204)][1]?void 0:_0x5772f1[t(1292)+t(345)](_0x2b6908[t(1292)+t(204)][0])}}let at=(e[r(675)]("undefined",typeof globalThis)&&e[r(750)](e[r(527)],globalThis.constructor[r(919)])||e[r(1487)]!=typeof window&&e[r(906)](e.YBKUP,window[r(1389)+r(674)][r(919)]))&&e[r(1515)](r(441)+"d",typeof document),Xe=e.gEAxi!=typeof globalThis&&(e[r(1287)]===globalThis[r(1389)+r(674)][r(919)]||e.idLvF===globalThis[r(1389)+r(674)][r(919)])&&e[r(1487)]!=typeof tt,At=(e[r(799)](e[r(1487)],typeof globalThis)&&e.KswYE===globalThis["construc"+r(674)][r(919)]||r(441)+"d"==typeof globalThis||e.YGSsM(e.gEAxi,typeof globalThis)&&!!globalThis[r(979)+r(1144)])&&e.grgbz(r(441)+"d",typeof wx),Pt=e[r(688)](e[r(1487)],typeof globalThis)&&(e[r(601)](e[r(1157)],globalThis[r(1389)+r(674)][r(919)])||e.MwAJi(r(1430)+"rkerGlob"+r(1493),globalThis[r(1389)+r(674)].name)||e[r(1591)]===globalThis[r(1389)+r(674)][r(919)])&&e[r(1401)]("undefined",typeof self),ma=e[r(992)](e.gEAxi,typeof globalThis)&&e.ITwwy(e[r(1287)],globalThis[r(1389)+r(674)][r(919)])&&e[r(1487)]!=typeof global&&e[r(665)](e[r(1287)],global["construc"+r(674)][r(919)])&&e[r(1487)]!=typeof process&&!!process[r(1221)];class xr{constructor(){this._listeners={}}[r(759)](t,...n){let o=r,x=this[o(479)+"rs"][t];if(x)x[o(258)]().forEach(l=>l.fn.apply(l[o(1159)],n));else if(e.xdmpf===t&&!this[o(1018)]){let l=n[o(836)]&&n[0];if(e[o(1432)](l,Error))throw l;let g=new Error(e[o(986)](e[o(982)],l?e.vGPKY(e[o(1539)](" (",l[o(965)]),")"):""));throw g[o(534)]=l,l}return this}off(t,n){let o=r;if(t===void 0)this._listeners={};else if(e[o(219)](void 0,n))this._listeners[t]=null;else{let x=this[o(479)+"rs"][t];if(x)for(let l=0;e.AEUtH(l,x[o(836)]);)e.iIWvI(x[l].fn,n)?x.splice(l,1):++l}return this}on(t,n,o){let x=r;return(this._listeners[t]||(this[x(479)+"rs"][t]=[])).push({fn:n,ctx:o||this}),this}}class wa extends xr{[r(702)+r(721)+r(302)](t){let n=r;return t[n(291)]||t[n(1096)]?("message: "+(t[n(291)]||"")+n(1254)+(t.errNo||""))[n(192)]():JSON[n(816)+"y"](t)}constructor(t,n,o){let x=r;super(),this._socket=null,At&&wx.connectSocket&&(this._socket=wx[x(1197)+x(566)]({url:t,protocols:n,header:o,fail:this[x(618)+x(1177)+"lHandler"][x(1408)](this),success:this[x(618)+x(259)+"cessHandler"][x(1408)](this)})),Xe&&tt[x(1197)+x(566)]&&(this[x(1034)]=tt[x(1197)+x(566)]({url:t,protocols:n,header:o,fail:this[x(618)+x(1177)+"lHandler"][x(1408)](this),success:this["_createS"+x(259)+x(1220)+"ler"][x(1408)](this)}))}[r(618)+"ocketSuc"+r(1220)+r(1578)](){let t=r;Promise[t(1020)]()[t(1556)](()=>{let n=t;this[n(247)+n(501)]()})}["_createSocketFai"+r(227)](t){let n=r;Promise[n(1020)]()[n(1556)](()=>{let o=n,x=e[o(239)](le,e[o(720)],{message:this[o(702)+o(721)+"age"](t)});this.emit(e[o(720)],x);let l=e[o(934)](me,"close",{reason:this[o(702)+o(721)+o(302)](t)});this[o(759)](o(1223),l)})}[r(247)+r(501)](){let t=r;this[t(1034)].onOpen(n=>{let o=t;this[o(759)](e[o(1058)],e[o(481)](Ss,o(1259),{...n,data:n.errMsg||""}))}),this._socket[t(682)](n=>{let o=t;this[o(759)](e[o(1540)],e[o(608)](me,e[o(1540)],{...n}))}),this._socket[t(839)+"e"](n=>{let o=t;this[o(759)](e.NEjiL,e[o(1565)](vs,e[o(990)],{...n}))}),this._socket.onError(n=>{let o=t;this[o(759)](e[o(720)],le(e.xdmpf,{...n,message:n[o(291)]||""}))})}[r(537)](t){let n=r,o={FEINR:function(x,l){return x==l},ESyfD:function(x,l){return e[D(408)](x,l)}};if(e[n(1607)](e[n(1086)],"AKMUu"))if(e[n(775)](t,Uint8Array)){let x=t[n(1071)][n(258)](t[n(1163)+"et"],e[n(619)](t.byteLength,t[n(1163)+"et"]));this[n(1034)]&&this[n(1034)][n(537)]({data:x,fail:l=>{let g=n;if(e[g(1168)](e[g(838)],e[g(838)]))return _0x470ef6[g(291)]||_0x5a29fa[g(1096)]?(g(1598)+" "+(_0x4414eb[g(291)]||"")+g(1254)+(_0xa6efed[g(1096)]||"")).trim():_0x119885.stringify(_0x305a39);this[g(759)](e[g(720)],e[g(608)](le,e[g(720)],{message:this[g(702)+"rrorMess"+g(302)](l)}))}})}else this[n(1034)]&&this._socket.send({data:t,fail:x=>{let l=n;e[l(963)](e.aMpVX,e[l(797)])?this.on(_0x3194d8,_0x4cbc46):this.emit(l(1127),e[l(1285)](le,e[l(720)],{message:this[l(702)+l(721)+l(302)](x)}))}});else return iiPNMi[n(1078)](this["currentI"+n(429)],this[n(507)+"s"][n(836)])?!0:iiPNMi.ESyfD(this[n(480)+n(344)+n(1380)+"t"],this[n(1617)+"es"])}[r(1223)](t,n){let o=r;this[o(1034)]&&this[o(1034)][o(1223)]({code:t,reason:n})}[r(426)+"Listener"](t,n){this.on(t,n)}["removeEventListe"+r(893)](t,n){let o=r;if(e[o(518)](e[o(847)],e.gcMoG))this[o(253)](t,n);else return{frameType:_0x5909be,headers:[{key:e.GaNpk,value:e[o(784)]}],payload:void 0}}get[r(272)+"te"](){return this[r(1034)].readyState}get[r(809)+"pe"](){let t=r;return this[t(1034)][t(809)+"pe"]}set[r(809)+"pe"](t){}get url(){return this[r(1034)].url}get[r(420)](){let t=r;return this._socket[t(420)]}get[r(1528)+"ns"](){let t=r;return this[t(1034)][t(1528)+"ns"]}get[r(801)+r(1410)](){return 0}}function _a(s,t){let n=r;if(t)return new t(s[n(188)],s[n(420)]);if(e[n(1535)](At,Xe))return new wa(s[n(188)],s[n(420)],s[n(1457)]);if(e[n(1535)](at,Pt)&&e[n(1487)]!=typeof WebSocket&&WebSocket)return new WebSocket(s.url,s[n(420)+"s"])}function ya(s){let t=r,n=e[t(733)].split("|"),o=0;for(;;){switch(n[o++]){case"0":if(At&&wx[t(1197)+t(566)])return!0;continue;case"1":if(s)return!0;continue;case"2":if(Xe&&tt[t(1197)+t(566)])return!0;continue;case"3":if(e[t(923)](at,Pt)&&e.YabXI(e.gEAxi,typeof WebSocket)&&WebSocket)return!0;continue;case"4":return!1}break}}function Cs(s,t,n){let o=-1;async function x(l){let g=D;return e[g(705)](l,o)?Promise[g(516)](new Error(e[g(617)])):(o=l,l===n[g(836)]?Promise[g(1020)]():n[l].bind(s)(t,x[g(1408)](null,e.WFere(l,1))))}e.CGRCj(x,0)}function As(s){let t=r,n=0,o=0;for(let x=0;e[t(825)](x,s[t(836)]);++x)o=s[t(1227)+"At"](x),e[t(668)](o,128)?n+=1:o<2048?n+=2:e.GeIIw(e[t(1162)](64512,o),55296)&&e[t(1002)](e[t(1070)](64512,s[t(1227)+"At"](x+1)),56320)?(++x,n+=4):n+=3;return n}function Ps(s,t,n){let o=r;if(e[o(1006)](n,t)<1)return"";let x="";for(let l=t;e[o(1557)](l,n);){let g=s[l++];if(g<=127)x+=String[o(1385)+o(887)](g);else if(e[o(947)](g,192)&&e[o(335)](g,224))x+=String[o(1385)+o(887)](e[o(746)](e[o(788)](31&g,6),e.esPsm(63,s[l++])));else if(e[o(1052)](g,224)&&e[o(335)](g,240))x+=String[o(1385)+o(887)](e[o(871)](e.OijsM(e[o(1156)](15,g)<<12,e[o(348)](63,s[l++])<<6),e[o(1253)](63,s[l++])));else if(g>=240){let p=e[o(378)](e[o(495)](e[o(871)](e.rLHpi(e[o(334)](7,g),18)|e[o(831)](e[o(956)](63,s[l++]),12),e[o(1049)](e[o(821)](63,s[l++]),6)),e[o(1477)](63,s[l++])),65536);x+=String[o(1385)+o(887)](e.SrFmX(55296,e[o(687)](p,10))),x+=String[o(1385)+o(887)](e.MhGNu(56320,e[o(654)](1023,p)))}}return x}function ur(s,t,n){let o=r,x={uaTaB:e[o(1529)]};if(e.yDCcw(e[o(998)],o(347)))this[o(951)]&&this[o(951)][o(537)](_0x1a67dd),this[o(206)](x.uaTaB,_0x253473);else{let l=n,g,p;for(let f=0;e[o(1101)](f,s.length);++f)if(g=s[o(1227)+"At"](f),e[o(701)](g,128))t[n++]=g;else if(e[o(668)](g,2048))t[n++]=e[o(746)](e[o(564)](g,6),192),t[n++]=e[o(970)](63&g,128);else if(e[o(942)](e[o(1219)](64512,g),55296)&&e[o(1566)](64512&(p=s[o(1227)+"At"](f+1)),56320))if(e[o(782)](e[o(515)],e[o(552)])){let b=e.suFJk[o(1357)]("|"),v=0;for(;;){switch(b[v++]){case"0":++f;continue;case"1":t[n++]=e[o(1085)](g>>18,240);continue;case"2":t[n++]=e.hRmOO(e[o(564)](g,12),63)|128;continue;case"3":t[n++]=e[o(1169)](e[o(1377)](e.yBDnF(g,6),63),128);continue;case"4":t[n++]=e[o(1542)](63&g,128);continue;case"5":g=e.LbkvR(e.sHCUG(65536,e[o(278)](e[o(1377)](1023,g),10)),e[o(357)](1023,p));continue}break}}else return e.grgbz(o(751),typeof _0x1691b5)&&(_0x5b037d instanceof _0x2644e4||_0x4f113f.buffer&&e[o(775)](_0x237106[o(1071)],_0x1b9d5e))||e[o(1515)](e[o(541)],typeof _0x5f3c34)?"":(_0x22c6e9[o(1512)](_0x2082ea),e[o(655)]);else t[n++]=e[o(1169)](g>>12,224),t[n++]=e[o(320)](e.AXxEl(g>>6,63),128),t[n++]=e[o(1161)](63,g)|128;return n-l}}async function ks(s){let t=r;if(e.CCmWI==typeof s){let n=new Uint8Array(e.ZqiIR(As,s));return e[t(452)](ur,s,n,0),n}return s instanceof ArrayBuffer?new Uint8Array(s):new Uint8Array(s[t(1071)],s.byteOffset,s[t(762)+"th"])}function ba(s){let t=r;try{return e[t(435)](t(751),typeof s)&&(e.oZFIg(s,ArrayBuffer)||s[t(1071)]&&e[t(883)](s[t(1071)],ArrayBuffer))||e[t(992)](e.CCmWI,typeof s)?"":(JSON[t(1512)](s),e[t(655)])}catch{return e[t(541)]==typeof s?e.KVMhm:""}}let va=(s,t)=>{let n=r;switch(s){case e.xuPVH:case n(1491):return{["x-use-"+s]:1,"x-tt-env":t};default:return{}}};class Sa{constructor(t){let n=r;if(e[n(1436)](e.OMuNx,e[n(1281)]))this[n(211)+"ount"]=t,this[n(678)]=0;else{this[n(305)+"WebSocket"]();let o=_0x5d62f1("reconnect",{message:e[n(776)]});this[n(331)+n(215)+n(424)+"ct"]&&this[n(331)+"mediatel"+n(424)+"ct"](o)}}[r(1518)](){let t=r;this[t(678)]++}["checkRea"+r(251)+"nt"](){let t=r;return this.count>=this[t(211)+t(1310)]}[r(1069)+"nter"](t=0){this.maxLossCount=t,this.count=0}}async function Ea(s){let t={ksUTz:function(n,o){return e[D(1555)](n,o)}};return new Promise(n=>{let o=D;if(!at)return e[o(1581)](n,e.sdGaG);try{let x=document[o(1232)+o(672)](e[o(730)]);window[o(506)+o(562)]=l=>{let g=o;document[g(297)][g(1112)+g(975)](x),window["frontier"+g(562)]=void 0,t[g(641)](n,l&&l.msg||"unknown "+g(743))},x[o(317)]=e[o(260)],x[o(514)]=e.grMIv(s[o(1399)](/^ws/,e.ymgei),"&jscallb"+o(461)+o(756)+"P");try{if(e.snEQx(e[o(863)],e.AmstE)){this[o(1456)+o(240)](),this._pingPongTimeoutId=_0xe94204(this._ping[o(1408)](this),this._options[o(1251)+o(1055)]);return}else document[o(297)]["appendCh"+o(975)](x)}catch{document[o(297)][o(1112)+"ild"](x)}}catch{window["frontier"+o(562)]=void 0,e[o(214)](n,e.sdGaG)}})}function Ge(s,t,n){let o=r;if(e.GzQvo!==o(280))return!!s?.[o(783)](x=>x[o(275)]===t&&x[o(1403)]===n);_0x8e967[o(1409)](_0x5bed20)}function ct(s,t){let n=r;return s?.[n(783)](o=>o[n(275)]===t)?.[n(1403)]}let dr=null;async function Ca(){let s=r,t={UndaZ:function(n,o,x){return e[D(1340)](n,o,x)},etsLo:s(1223)};if(s(1347)!==e[s(504)])return dr||(dr=Promise[s(1020)]().then(Ce[s(1408)](Ce,e[s(468)]))),dr;{let n=_0x12d1f6(s(1127),{message:this[s(702)+s(721)+s(302)](_0x3e510f)});this[s(759)]("error",n);let o=xOvZYA[s(1176)](_0x40fba4,xOvZYA[s(282)],{reason:this[s(702)+s(721)+s(302)](_0x36a03b)});this[s(759)](xOvZYA[s(282)],o)}}class Aa extends xr{constructor(t,n){let o=r;super(),this[o(804)]=t,this[o(1343)]=n,this[o(716)]=void 0,this[o(1507)+o(535)]=null}async openDB(){await this[r(624)]()}async[r(624)](){let t=r,n={fjuxe:function(o,x,l,g){return e[D(256)](o,x,l,g)},Mqbuu:e.IjqPk,jZAUl:e[t(720)]};if(!this._qosDB){if(this["_initPro"+t(535)])return this[t(1507)+t(535)];try{let o=this[t(804)],x=this[t(1343)];this[t(1507)+t(535)]=(async()=>{let l=t,{openDB:g}=await Ca();this[l(716)]=await n[l(1091)](g,l(506)+"_"+o,1,{upgrade(p){p[l(1506)+"jectStore"](o,{keyPath:x})}})})(),await this["_initPro"+t(535)]}catch(o){e[t(841)](t(1582),e[t(517)])?console[t(1409)](o):(_0x414022[t(1368)+"entListe"+t(893)](XnXpDf[t(1272)],_0x1a7272),_0xb5d63[t(1368)+t(1133)+"ner"](XnXpDf[t(422)],_0x5639e1))}finally{this[t(1507)+t(535)]=null}}}async[r(935)](t){let n=r;try{return await this[n(624)](),this[n(716)]?.[n(935)](this[n(804)],t)}catch(o){console[n(1409)](o)}}async set(t,n){let o=r,x={dfNhr:function(l,g){return e.yPRrr(l,g)}};if(e[o(942)](e.oOrcV,e[o(1111)])){let l=this[o(716)][o(679)](this._prefix);return _0x589d68[o(1512)](x[o(692)](l,"{}"))[_0x282428]}else return await this._init(),this[o(716)]?.[o(460)](this[o(804)],t)}async[r(660)](t){let n=r;try{return await this[n(624)](),this._qosDB?.delete(this[n(804)],t)}catch(o){console[n(1409)](o)}}async[r(1589)](){let t=r;try{return await this[t(624)](),this._qosDB?.[t(1589)](this[t(804)])}catch(n){console[t(1409)](n)}}async[r(1460)](){let t=r;if(e[t(1421)](e.mFcxp,t(431)))return await this._init(),this[t(716)]?.[t(1263)+"ys"](this[t(804)]);{let{offset:n}=e[t(886)](_0x303f9a,_0x94bbc9,_0x1bf061);_0x4a68d0=n;let o={cursor_name:"",cursor:0,service:0},{value:x,offset:l}=e.OYEmW(_0x334a75,_0x589505,_0x144984);o.service=x,_0x490dc7=l;let{value:g,offset:p}=e[t(362)](_0x3c1b5a,_0x57c695,_0xb00c16);_0x20d1ec=p,o[t(316)+t(1395)]=e[t(856)](_0x36e031,_0x8deb09,_0x20ad3c,e.ltijy(_0xa97060,g)),_0x2a512d+=g;let{value:f,offset:b}=e.dCMFY(_0x5825c8,_0x24b759,_0x56ca6d);o[t(606)]=f.toNumber(),_0x5856d3=b,_0x2320d2[t(547)](o)}}async[r(210)](){let t=r;return await this._init(),this[t(716)]?.[t(210)](this._dbName)}async[r(1198)](){let t=r,n={buyhf:function(o,x){return e.ljrUx(o,x)},tfreG:function(o,x){return e[D(1533)](o,x)},urPRS:e.RWGet,Suwtt:e[t(328)]};try{e.yFUrY(e[t(1463)],e.onfme)?(this[t(716)]?.[t(1223)](),this[t(716)]=void 0):_0x569d77.persisted&&(this["_navigat"+t(1544)]()&&(!this._ws||n[t(1419)](this[t(951)].readyState,this[t(375)])||n[t(474)](this._ws[t(272)+"te"],this[t(425)+"NG"]))&&this[t(536)+t(370)](),this[t(819)+"er"]&&_0xfbf8a0["addEvent"+t(1037)](n[t(748)],this[t(536)+t(370)]),this[t(819)+"er"]&&_0x25ecf2[t(426)+"Listener"](n[t(798)],this[t(536)+t(974)]))}catch(o){console[t(1409)](o)}}get[r(1224)](){let t=r;try{return!!this[t(716)]}catch(n){return console[t(1409)](n),!1}}}class Pa{constructor(t,n){let o=r;this[o(929)]=t,this._pathKey=n,this._qosDB=localStorage}async openDB(){}get[r(1216)](){let t=r,n={VvDgt:function(o,x,l){return e[D(362)](o,x,l)},vfZBo:function(o,x,l){return o(x,l)},wGTvI:function(o,x){return e[D(551)](o,x)}};if(e[t(1339)]!==e[t(1492)])return t(506)+"_"+this[t(929)];XdxPWh[t(1319)](_0x1239bc,_0x158b58,96),XdxPWh[t(434)](_0x435ff6,_0x242c4d,XdxPWh.wGTvI(_0x25859c,_0x3b2d4e))}async[r(935)](t){let n=r,o={mXEbH:function(x,l){return e[D(767)](x,l)},oJiyT:function(x,l){return e.xNmNL(x,l)}};{let x=this[n(716)].getItem(this[n(1216)]);return JSON[n(1512)](x||"{}")[t]}}async[r(396)](t,n){let o=r,x=this[o(716)].getItem(this[o(1216)]),l=JSON.parse(e.VixQF(x,"{}"));return l[n||t[this[o(220)]]]=t,this[o(716)][o(1459)](this[o(1216)],JSON[o(816)+"y"](l)),n||t[this._pathKey]}async[r(660)](t){let n=r;if(e[n(1577)]===e[n(263)])return this._ws?this._ws[n(420)]:"";{let o=this[n(716)].getItem(this[n(1216)]),x=JSON[n(1512)](e[n(923)](o,"{}"));return x[t]=void 0,this[n(716)].setItem(this[n(1216)],JSON[n(816)+"y"](x))}}async[r(1589)](){let t=r;return this[t(716)][t(1589)]()}async[r(1460)](){let t=r,n=this._qosDB[t(679)](this[t(1216)]),o=JSON[t(1512)](e[t(449)](n,"{}"));return Object[t(1460)](o)}async[r(210)](){let t=r;if(e[t(638)](e.mToTK,e[t(332)])){let x="3|2|1|0|4"[t(1357)]("|"),l=0;for(;;){switch(x[l++]){case"0":_0x5d2fbb[_0x2e3e73](n,n.exports,_0x7c2a5b);continue;case"1":var n=_0x3a33c1[_0x4beecc]={exports:{}};continue;case"2":if(WjnquI[t(195)](void 0,o))return o[t(208)];continue;case"3":var o=_0x15ac21[_0x1c3d16];continue;case"4":return n[t(208)]}break}}else{let x=this[t(716)][t(679)](this[t(1216)]),l=JSON.parse(e[t(1535)](x,"{}"));return Object[t(573)](l)}}[r(1198)](){let t=r;return t(553)===e[t(1067)]?new _0x364a57(_0x57f6d5,{code:_0x6916dc,reason:_0x3531dd,wasClean:_0x1eba26,willReconnect:_0x2ee9be}):Promise[t(1020)]()}get[r(1224)](){return!!this[r(716)]}}class ka{constructor(t,n){let o=r;this[o(929)]=t,this[o(220)]=n,this[o(716)]=Xe?tt:At?wx:null}async[r(995)](){}get[r(1216)](){return r(506)+"_"+this._DBName}async[r(935)](t){let n=r,o=this[n(716)][n(1304)+n(371)](this._prefix);return JSON.parse(e.wNAWI(o,"{}"))[t]}async[r(396)](t,n){let o=r,x=this[o(716)]["getStora"+o(371)](this._prefix),l=JSON[o(1512)](e[o(1535)](x,"{}"));return l[n||t[this[o(220)]]]=t,this[o(716)][o(407)+o(371)](this._prefix,JSON[o(816)+"y"](l)),n||t[this[o(220)]]}async[r(660)](t){let n=r,o=this._qosDB[n(1304)+n(371)](this[n(1216)]),x=JSON[n(1512)](e[n(1490)](o,"{}"));return x[t]=void 0,this[n(716)]["setStora"+n(371)](this._prefix,JSON.stringify(x))}async clear(){let t=r;if(e[t(841)](t(301),e[t(1218)]))return this[t(716)][t(1260)+t(1440)]();_0x195b68[t(396)](_0xf2e04d,_0x2f00fe)}async[r(1460)](){let t=r,n=this[t(716)][t(1304)+t(1016)+"nc"](this[t(1216)]),o=JSON.parse(e.IbgQY(n,"{}"));return Object[t(1460)](o)}async getAll(){let t=r,n=this[t(716)][t(1304)+t(1016)+"nc"](this._prefix),o=JSON[t(1512)](e[t(1209)](n,"{}"));return Object[t(573)](o)}[r(1198)](){let t=r;if(e[t(628)]===e[t(315)])_0x4b2dfb=_0x11ba49[t(1499)](_0x460006),_0x1d8b4d=_0x138318[t(1499)](_0x3211e8[_0xd9dcc9]);else return Promise[t(1020)]()}get[r(1224)](){return!!this._qosDB}}function Ds(s,t){let n=r;if(e[n(1073)](Xe,Xe))return new ka(s,t);if((at||Pt)&&e.bAMNP("undefined",typeof indexedDB))return new Aa(s,t);if(e[n(1490)](at,Pt)&&e[n(358)](e.gEAxi,typeof localStorage))return new Pa(s,t);throw new Error("init QoSDB failed")}class Da{constructor(){let t=r;this[t(874)+t(921)+"Id"]=null,this[t(874)+"l"]=36e5,this[t(716)]=e[t(1476)](Ds,e[t(712)],"message_id")}async[r(874)+r(1119)](){let t=r;e.vcvHN(clearInterval,this._intervalTimeoutId),this["_interva"+t(921)+"Id"]=e.qiQmJ(setInterval,()=>{let n=t;this[n(905)+n(576)]()},this[t(874)+"l"])}async[r(995)](){let t=r;await this[t(716)][t(995)]().then(()=>{let n=t;this[n(874)+n(1119)]()})}async flushExpired(){let t=r,n={vLELL:function(o,x){return e[D(1295)](o,x)},SjSQA:function(o,x){return o(x)},QefgP:function(o,x,l){return e.flqXl(o,x,l)}};if(t(1231)!==e[t(1063)])return zbETFi.vLELL(zbETFi[t(1504)](_0x57d385,4)[t(760)]("0"),zbETFi.QefgP(_0x4aba83,_0x5104bc,2)[t(187)](16))[t(258)](-4);(await this[t(716)]?.[t(210)]()||[]).filter(({timestamp:l})=>l<Date.now())[t(1248)](l=>{let g=t;this._qosDB?.del(l[g(658)+"id"])})}async del(t){return this[r(716)]?.del(t)}async[r(396)](t,n){let o=r;if(e[o(205)]===o(464))return this._qosDB?.[o(396)]({message_id:t,timestamp:n});{let x=_0x5a0b54[o(1227)+"At"](_0x22cbca);x>=55296&&x<=56319&&_0x2dc755+1<_0x4d2f78&&(x=e[o(592)]((x<<10)+_0x55dfdd[o(1227)+"At"](++_0x42c0fc),56613888)),e[o(335)](x,128)?_0x235be6[_0x5d2def++]=x:(e[o(1101)](x,2048)?_0x30da6c[_0x6a83ce++]=e.yQoCa(e[o(564)](x,6)&31,192):(e.PdjEn(x,65536)?_0x3f01c6[_0x368c35++]=e[o(907)](e[o(1162)](e[o(687)](x,12),15),224):(_0x13804d[_0xa14956++]=e[o(320)](e[o(1383)](e[o(564)](x,18),7),240),_0x2bd884[_0x3116f1++]=e[o(746)](e.pcRMr(e[o(564)](x,12),63),128)),_0x494a9a[_0x4c3e1e++]=e[o(843)](e[o(1307)](e[o(687)](x,6),63),128)),_0x8fef66[_0x3f625f++]=e[o(832)](e[o(1161)](63,x),128))}}async[r(935)](t){let n=r;return this[n(716)]?.[n(935)](t)}async[r(1198)](){let t=r;e[t(551)](clearInterval,this[t(874)+t(921)+"Id"]),await this[t(716)]?.[t(1198)]()}get isReady(){let t=r;return this._qosDB?.[t(1224)]}}function fr(s){let t=r,n=!!this._options.enableQoS;if(!n)return{enabled:n,isQoSMessage:!1,isQoSAck:!1,isAckCleanupMessage:!1,ackMsgIds:[]};let o=e.gAdcG(Ge,s.message[t(1457)],e[t(635)],"2"),x=o&&e[t(546)](Ge,s.message[t(1457)],e.XqUWl,"1"),l=o&&e[t(577)](Ge,s[t(965)].headers,t(1382)+t(1099)+"k","1"),g=l?e.ZoOno(ct,s.message[t(1457)],e[t(1114)])?.[t(1357)](",").filter(Boolean)||[]:[];return{enabled:n,isQoSMessage:o,isQoSAck:x,isAckCleanupMessage:l,ackMsgIds:g}}async function Is(){let s=r;return e[s(300)]!==e[s(300)]?e[s(484)](_0x6b7a05,e[s(193)](_0x118b40,_0x4c575a)):(this[s(409)+s(686)]||(this[s(409)+"ger"]=new Da),this[s(409)+"ger"][s(1224)]||await this[s(409)+s(686)].openDB(),this[s(409)+s(686)])}async function Ia(s,t){let n=r,{enableAutoAck:o}=this[n(1296)],x=e[n(1522)](Ge,s[n(965)][n(1457)],e[n(604)],"1"),l=e[n(1604)](Ge,s[n(965)][n(1457)],e[n(643)],"1"),g=fr[n(812)](this,s);if(e[n(1521)](o,x)){let{SeqID:p,LogID:f,service:b,LogIDNew:v,method:C}=s.message;this[n(1509)]({SeqID:p,LogID:f,LogIDNew:v,service:b,method:C,headers:[{key:e[n(643)],value:"1"},{key:e[n(1345)],value:e.JkbOf(v,"")},{key:n(418),value:"0"}]})}l&&!g[n(1120)]&&this[n(1138)+n(1201)+n(626)](s),e[n(364)](t)}async function Ta(s,t){let n=r;this._debug(e[n(1616)],s[n(965)]),t()}async function Ra(s,t){let n=r,o={LfQkk:function(x,l){return e[D(902)](x,l)},kHflr:e[n(1011)],DOdby:e[n(655)],aefia:"none_none",xQtpr:function(x,l,g,p){return e[n(452)](x,l,g,p)},WPaXo:function(x,l){return e.cOqKa(x,l)}};if(e[n(548)]("DqlOq",e[n(1027)])){let x=o[n(1441)](this._options[n(731)+n(859)],_0x3b36b0)?{force:!!this[n(1296)][n(731)+n(859)][n(250)],encoding:this._options[n(731)+n(859)].encoding?this[n(1296)][n(731)+n(859)][n(1373)][n(1399)](/\s/g,"")["toLowerC"+n(1405)]():""}:{force:!1,encoding:this[n(1296)][n(731)+n(859)]?this[n(1296)]["payloadE"+n(859)][n(1399)](/\s/g,"")[n(1369)+n(1405)]():""},l=_0x5b8894.payloadEncoding?_0x2d1d57["payloadE"+n(859)][n(1399)](/\s/g,"")[n(1369)+"ase"]():"",g=o[n(1441)](this[n(1296)]["payloadT"+n(1164)],_0x54ab97)?{force:!!this[n(1296)]["payloadT"+n(1164)][n(250)],type:this._options[n(1392)+n(1164)].type?this[n(1296)][n(1392)+n(1164)][n(317)][n(1399)](/\s/g,"").toLowerCase():""}:{force:!1,type:this[n(1296)][n(1392)+n(1164)]?this[n(1296)][n(1392)+"ype"][n(1399)](/\s/g,"")[n(1369)+"ase"]():""},p=_0x12acbd[n(1392)+n(1164)]?_0x163618[n(1392)+n(1164)][n(1399)](/\s/g,"")[n(1369)+"ase"]():"",f=g[n(250)]?g[n(317)]:p||g.type,b=x[n(250)]?x.encoding:l||x[n(1373)],v=[o[n(557)],o.DOdby,n(770)+"ion/json"+n(440)+n(1005),"string"],C=[o.aefia,"binary"];this[n(1296)][n(1468)+"ansformT"+n(950)+"ad"]&&v.includes(f)&&(!b||C[n(540)](b))?_0x1c96a9[n(1423)+n(400)]=o[n(600)](_0x2a69cf,_0x1ba97b[n(1192)],0,_0x1293b0.payload[n(762)+"th"]):_0x49c29d[n(1423)+n(400)]=""}else{let x=ds(await ks(s[n(1355)]));try{if(x[n(1192)]instanceof Uint8Array)if(e[n(406)](e[n(1337)],e.KlAsr)){let l=this[n(1296)][n(731)+n(859)]instanceof Object?{force:!!this[n(1296)]["payloadE"+n(859)][n(250)],encoding:this[n(1296)][n(731)+"ncoding"][n(1373)]?this[n(1296)][n(731)+n(859)][n(1373)][n(1399)](/\s/g,"")["toLowerC"+n(1405)]():""}:{force:!1,encoding:this[n(1296)][n(731)+n(859)]?this[n(1296)][n(731)+n(859)][n(1399)](/\s/g,"")[n(1369)+n(1405)]():""},g=x[n(731)+n(859)]?x[n(731)+n(859)][n(1399)](/\s/g,"")[n(1369)+"ase"]():"",p=e[n(1012)](this._options[n(1392)+"ype"],Object)?{force:!!this._options[n(1392)+n(1164)][n(250)],type:this._options[n(1392)+"ype"][n(317)]?this[n(1296)]["payloadT"+n(1164)][n(317)].replace(/\s/g,"")["toLowerC"+n(1405)]():""}:{force:!1,type:this._options.payloadType?this[n(1296)][n(1392)+n(1164)].replace(/\s/g,"")[n(1369)+n(1405)]():""},f=x.payloadType?x[n(1392)+n(1164)].replace(/\s/g,"").toLowerCase():"",b=p[n(250)]?p[n(317)]:f||p[n(317)],v=l[n(250)]?l[n(1373)]:g||l.encoding,C=["text/pla"+n(1479)+n(920),e[n(655)],e[n(1074)],e[n(541)]],I=[e[n(677)],n(603)];this._options[n(1468)+"ansformT"+n(950)+"ad"]&&C[n(540)](b)&&(!v||I[n(540)](v))?x[n(1423)+n(400)]=e[n(1249)](Ps,x.payload,0,x[n(1192)].byteLength):x[n(1423)+n(400)]=""}else{let l=_0x73bbf8[n(1603)+"g"](0,jzNfBk[n(787)](4,_0x4a9098[n(836)])),g=l[n(1499)](_0x18adc2);_0x59a4a1[n(547)](g)}else x[n(1423)+"oad"]=""}catch(l){x[n(1423)+n(400)]="",console[n(1409)](l)}s.message=x,t()}}function Na(s,t,n){let o=r,x=e.QRKuj(n,8192),l=e[o(1180)](x,1),g=null,p=x;return function(f){let b=o;if(e[b(1599)](f,1)||e[b(1051)](f,l))return e[b(1418)](s,f);e[b(231)](e[b(808)](p,f),x)&&(g=e[b(867)](s,x),p=0);let v=t[b(812)](g,p,p+=f);return 7&p&&(p=e[b(970)](7,p)+1),v}}let La=4294967295;function Oa(s,t,n){let o=r;if(e[o(236)](e.fsZLh,e.fsZLh)){if(e[o(541)]==typeof _0x2846c6){let x=new _0x4f52f0(_0x4d5199(_0x5550d3));return e.gAdcG(_0x6f0383,_0x19dc8e,x,0),x}return e.xhABy(_0x5844d5,_0x1c66e6)?new _0x432b9e(_0x2fb08f):new _0x43fee8(_0x5c4762[o(1071)],_0x32faa2.byteOffset,_0x113922.byteLength)}else return e[o(879)](RangeError,e[o(411)](e[o(1094)](e[o(1558)](e[o(1021)](e[o(594)],s)+e[o(584)],e.hyPBs(t,1)),o(1060)),n))}function Ba(s,t,n){let o=r;if(n>La)throw new Error(o(830)+"too large");let x=3;for(;x>=0;){let l=e[o(1128)](255,n);e[o(1309)](hr,l,s,e[o(1140)](t,x)),n>>>=8,x--}return e[o(308)](t,4)}function Ma(s,t){let n=r,o=0,x=t,l=t+4;for(;e[n(1039)](x,l);){let{value:g,offset:p}=e[n(578)](lr,s,x);x=p,o=e[n(242)](o,8)>>>0,o+=g}return{value:o,offset:l}}function za(s,t,n){let o=r,x=e.LhEiz[o(1357)]("|"),l=0;for(;;){switch(x[l++]){case"0":return e.OOnel(e[o(1502)](ur,s,t,n),n);case"1":if(e[o(233)](s.length,40))return e[o(876)](e[o(1283)](ur,s,t,n),n);continue;case"2":if(t[o(1230)])return e[o(385)](t.write(s,n),n);continue;case"3":if(t[o(244)+"e"])return e[o(340)](t[o(244)+"e"](s,n),n);continue;case"4":if(!s)return n;continue}break}}function qa(s,t){let n=r,o=new z(e.EKvhq(e.yQoCa(e[n(450)](s[e[n(1454)](t,4)],24)|e.ZKyjj(s[e[n(1124)](t,5)],16),s[e.kgVbb(t,6)]<<8),s[e.MscWo(t,7)]),e.xESbF(e[n(520)](e.AXUVN(s[e[n(1454)](t,0)],24),s[e.UlpKB(t,1)]<<16)|e[n(242)](s[t+2],8),s[e[n(736)](t,3)]),!0);return t+=8,{value:o,offset:e[n(283)](t,8)}}function Fa(s,t,n){let o=r,x=s[o(1239)],l=s[o(1028)];return t[n]=e[o(725)](l,24),t[e[o(385)](n,1)]=e[o(334)](l>>>16,255),t[e[o(1414)](n,2)]=e[o(1175)](e[o(718)](l,8),255),t[e[o(1558)](n,3)]=255&l,t[e[o(802)](n,4)]=e[o(664)](x,24),t[e[o(1059)](n,5)]=e[o(644)](e[o(1233)](x,16),255),t[e[o(478)](n,6)]=e[o(683)](e[o(1081)](x,8),255),t[n+7]=e[o(419)](255,x),n+=8,n}function lr(s,t){let n=r;return s[n(367)+"8"]?{value:s[n(367)+"8"](t),offset:t+1}:{value:e.lAMtm(255,s[t]),offset:e[n(299)](t,1)}}function hr(s,t,n){let o=r;return t[o(1344)+"t8"]?t.writeUint8(s,n):t[n]=e[o(735)](255,s),e.EnKEJ(n,1)}let Ua=function(s){let t=r;if(e[t(473)](e[t(1270)],e[t(1115)]))_0x503fbc[_0x2cf9e0++]=e[t(1611)](e[t(298)](_0x10c707,12),224),_0x10b418[_0x282c2f++]=e.gJbEK(e[t(1548)](_0x5f474b,6)&63,128),_0xbcac73[_0x37ce8f++]=e.RGSis(63&_0x3721cd,128);else return new Uint8Array(s)},Ga=e[r(675)](e[r(1487)],typeof Buffer)?Buffer[r(1422)+r(197)]:e[r(910)](Na,Ua,Uint8Array[r(912)+"e"][r(500)]);(()=>{let s=r,t={cALkB:function(n,o){return e[D(1503)](n,o)},WdjAB:function(n,o){return e[D(1110)](n,o)},sKoKt:function(n,o){return e.CyZZU(n,o)}};if(e[s(579)](e[s(1452)],e[s(1155)])){let n=4294967295;return function(o,x,l=!0){let g=s,p={QsStg:function(f,b){return e[D(631)](f,b)},waawD:function(f,b){return e[D(1302)](f,b)},KFDYW:e[g(328)]};if(n=e[g(310)](127,o[x])>>>0,o[x++]<128)return{value:l?n:0|n,offset:x};if(n=e.DRCCE(e.IsEHg(n,e[g(875)](127&o[x],7)),0),o[x++]<128)return{value:l?n:e.RGSis(0,n),offset:x};if(n=e[g(1233)](e[g(1464)](n,e[g(878)](e.UloIV(127,o[x]),14)),0),o[x++]<128)return{value:l?n:e[g(1563)](0,n),offset:x};if(n=e[g(967)](e.mtLCZ(n,e.SVBxF(e[g(644)](127,o[x]),21)),0),o[x++]<128)return{value:l?n:0|n,offset:x};if(n=e[g(1411)](n|e[g(696)](15,o[x])<<28,0),e[g(559)](o[x++],128))return{value:l?n:e[g(1525)](0,n),offset:x};if(e[g(585)](x+=5,o[g(836)])){if(e[g(1264)](e.ptPSG,e[g(1154)]))throw x=o[g(836)],e[g(1249)](Oa,x,10,o[g(836)]);this[g(903)+g(1544)]()&&(!this[g(951)]||p[g(284)](this[g(951)].readyState,this[g(375)])||p.waawD(this[g(951)][g(272)+"te"],this.CONNECTING))&&this._handleOnLine(),this[g(819)+"er"]&&_0xb013d8["addEvent"+g(1037)](g(288),this[g(536)+g(370)]),this._isBrowser&&_0x321b8f[g(426)+g(1037)](p.KFDYW,this[g(536)+"ffLine"])}return{value:l?n:0|n,offset:x}}}else _0x521413[_0x2ed277++]=PdAXUL[s(891)](_0x881dc3>>6,192),_0x551842[_0x2180e6++]=PdAXUL[s(268)](PdAXUL.sKoKt(63,_0x27b07f),128)})();let Ka=16,gr=32;function Ha(s){let t=r,n=0,o={};for(let x=0;e[t(417)](x,s[t(836)]);x++)o[s[x][t(316)+t(1395)]]=e.RWVrx(As,s[x][t(316)+t(1395)]),n+=e[t(1108)](14,o[s[x][t(316)+t(1395)]]);return[n,o]}function Ts(s,t,n){let o=r,x={gaCeS:e.TbXao,zTRcx:e.DEjkR,PVdQH:e.ROtCV,YWUNo:function(b,v,C,I){return e.bmFhL(b,v,C,I)},KWHAE:function(b,v,C,I){return e.UkPGV(b,v,C,I)},UzQVy:o(255),xtLvh:e[o(889)],RdDRE:"service-"+o(919)},[l,g]=e[o(747)](Ha,s),p=Ga(l),f=0;return s[o(1248)](b=>{let v=o,C=x.gaCeS[v(1357)]("|"),I=0;for(;;){switch(C[I++]){case"0":console[v(1409)](x.zTRcx,f);continue;case"1":console.log(x[v(1102)],b,b.service);continue;case"2":console.log(v(402),f);continue;case"3":f=x[v(1195)](hr,0,p,f);continue;case"4":f=x[v(1195)](hr,g[b[v(316)+v(1395)]],p,f);continue;case"5":f=Fa(z[v(1252)+"er"](b.cursor||t),p,f);continue;case"6":f=x[v(791)](za,b[v(316)+v(1395)],p,f);continue;case"7":console[v(1409)](x[v(978)],f);continue;case"8":console[v(1409)](x[v(1489)],f);continue;case"9":console[v(1409)](x[v(1148)],f);continue;case"10":f=x[v(1195)](Ba,p,f,b[v(255)]||0);continue}break}}),{frameType:gr,headers:[{key:o(818)+o(1206),value:n}],payload:p}}function ja(s){let t=r,n=0,o=[];for(;e.gOHHJ(n,s.byteLength);){let{offset:x}=e.XDlZY(lr,s,n);n=x;let l={cursor_name:"",cursor:0,service:0},{value:g,offset:p}=e.GUvKW(Ma,s,n);l[t(255)]=g,n=p;let{value:f,offset:b}=e[t(684)](lr,s,n);n=b,l.cursor_name=e[t(1437)](Ps,s,n,e[t(1100)](n,f)),n+=f;let{value:v,offset:C}=e[t(1359)](qa,s,n);l[t(606)]=v[t(1406)](),n=C,o[t(547)](l)}return o}function Wa(){let s=r;return{frameType:gr,headers:[{key:e.GaNpk,value:e[s(784)]}],payload:void 0}}class Ja{constructor(t,n,o){let x=r;e[x(201)](x(1484),e[x(379)])?e[x(1121)](_0x4da140,_0x29395f,this[x(685)+x(209)+"e"](_0x9ff9c4)):(this[x(1472)+x(1160)]=t,this._cursorFileName=n,this[x(341)+x(369)]=o,this[x(716)]=e[x(596)](Ds,this[x(1472)+x(1160)],"cursor_n"+x(1395)))}async openDB(){let t=r;await this[t(716)][t(995)]()}async[r(1208)+"rs"](){let t=r;if(!this[t(716)][t(1224)])return;let n=this[t(341)+t(369)],o=await this[t(716)][t(210)]();switch(console[t(1409)](e[t(980)],o),n){case e[t(485)]:return o&&o[t(836)]?e[t(761)](Ts,o,0,this._cursorFileName):void 0;case e[t(877)]:return;case e[t(1435)]:return o&&o.length?e[t(1088)](Ts,o,0,this["_cursorF"+t(1090)]):Wa()}}async set(t,n,o){let x=r;return console[x(1409)](e[x(1105)],t,n,o),this[x(716)][x(396)]({cursor_name:t,cursor:n,service:o})}async[r(550)+"rs"](t){let n=r,o=ja(t);for(let x of o)console[n(1409)]("setcursor",o),await this._qosDB.set(x)}async[r(935)](t){let n=r;return(await this[n(716)][n(935)](t))?.[n(606)]}async[r(1198)](){let t=r;await this[t(716)][t(1198)]()}["updateCu"+r(814)+"Name"](t){let n=r;this[n(390)+n(1090)]=t}get isReady(){let t=r;return e[t(1534)](e[t(189)],e[t(287)])?new _0x30640c(e[t(1611)](e[t(907)](e[t(565)](_0x1bb437[0],e.SqlkZ(_0xab737f[1],8)),e[t(1245)](_0x149e8d[2],16)),e.RjCxG(_0x355173[3],24)),e[t(1110)](e[t(970)](e[t(706)](_0x4e5d4e[4],_0x28f314[5]<<8),_0xe4867[6]<<16),_0x4ef38a[7]<<24),_0x40defa):this._qosDB[t(1224)]}}let Va=e.TGCao;async function Rs(s){let t=r,n={DsglW:function(p,f,b){return e[D(1057)](p,f,b)}};if(!this[t(1296)][t(489)+"S"])return null;let{aID:o,fpID:x,messageStrategy:l}=this[t(1296)],g=e[t(667)](s,Va);try{if(this[t(1438)+t(944)])if(e.bRegL(t(455),e[t(1042)]))s&&this[t(1438)+t(944)][t(198)+t(814)+"Name"](s);else return new _0x4ebc04(p=>{let f=t;n[f(438)](_0x14a412,p,this[f(685)+f(209)+"e"](_0x5a6a30))});else this[t(1438)+"anager"]=new Ja(x+"_"+o+"_"+g,g,l);return this["_cursorM"+t(944)][t(1224)]||await this[t(1438)+"anager"][t(995)](),this[t(1438)+"anager"]}catch{return null}}async function Ya(s,t){let n=r,o=e[n(430)](Ge,s[n(965)][n(1457)],e.mCIfX,"-1"),x=e[n(1522)](Ge,s[n(965)][n(1457)],e[n(643)],"1"),l=e[n(1537)](ct,s.message[n(1457)],e[n(742)]),g=e[n(1610)](Number,e[n(362)](ct,s[n(965)][n(1457)],e[n(1004)]))||0,p=fr.call(this,s),f=e.odQcx(Ge,s[n(965)][n(1457)],e[n(1570)],"2"),b=ct(s.message.headers,e[n(414)]),v=e[n(867)](Number,e[n(984)](ct,s[n(965)][n(1457)],e.QIOUJ));if(p[n(1120)])return e[n(364)](t);let C=p[n(1562)+n(329)]?await Is[n(812)](this):null;if(e[n(1051)](s[n(965)][n(255)],0)&&x&&!o||e[n(1051)](s[n(965)][n(255)],0)){if(l&&p["isQoSMes"+n(329)]&&C)return!!!await C[n(935)](l)&&(this[n(1138)+n(853)+n(914)](s),await C.set(l,Date[n(1080)]()+g)),e[n(249)](t);if(f){let I=await Rs[n(812)](this);if(!I)return this[n(1138)+n(853)+"Event"](s),t();let O=await I[n(935)](b)??-1;if(e[n(1378)](O,v))if(e[n(1302)](n(246),n(543)))this._dispatchMessageEvent(s),I[n(396)](b,v,s.message[n(255)]);else return e.VhErF(_0x56b1a8,_0x39b306)?_0x6b28cc[n(516)](new _0x886571(e[n(617)])):(_0x429bb3=_0x17aafe,_0x5c0f7d===_0xaf0846[n(836)]?_0x3b91a9[n(1020)]():_0x37a306[_0x235c85][n(1408)](_0x69c92)(_0x55551f,_0x3a354d[n(1408)](null,_0x1d73a8+1)));else throw new Error(n(890)+" message"+n(917)+v+(n(640)+n(395)+n(1256)+"r ")+O);return e.KgtCY(t)}return this[n(1138)+n(853)+n(914)](s),t()}}async function $a(s,t){let n=r,o=fr[n(812)](this,s);if(!o[n(1562)+"sage"])return e.FtciR(t);let x=await Is[n(812)](this);if(o[n(1336)+n(269)+n(302)]&&o[n(273)+"s"][n(836)])for(let l of o.ackMsgIds)await x[n(660)](l);t()}async function Xa(s,t){let n=r,o=s[n(965)][n(519)+"e"]===Ka,x=e[n(1566)](s[n(965)][n(519)+"e"],gr);if(e[n(1521)](!o,!x))return t();let l=e[n(1622)](ct,s[n(965)][n(1457)],e.GaNpk);if(!l)return e[n(249)](t);let g=await Rs.call(this,l);if(!g)return e[n(1215)](t);if(o){let p=await g.getCursors(),f={frameType:p?.[n(519)+"e"],SeqID:z.fromNumber(this[n(445)]++),LogID:z.fromNumber(this._options[n(321)+n(1204)]()),service:9e3,method:5,headers:p?.[n(1457)],payload:p?.[n(1192)]},b=A(f);this[n(951)]&&this._ws.readyState&&this[n(951)][n(537)](b)}if(x){let p=s[n(965)][n(1192)];p&&g[n(550)+"rs"](p)}}let Za=async function(s,t){let n=r;this[n(476)]=!1,clearTimeout(this[n(1054)+n(793)+"utId"]),e[n(364)](t)},Qa=async function(s,t){let n=r;if(!this._ws||e[n(989)](this[n(951)].readyState,this[n(375)]))return e.HtXhB(t);let{pingInterval:o}=this[n(1296)];this[n(1520)+n(714)]?.[n(1384)+n(1095)+"fig"]();for(let l=0;e.RjTYz(l,this[n(341)+n(469)][n(836)]);l++){let g=this[n(341)+"Queue"][l];if(e[n(680)](this[n(951)][n(272)+"te"],this[n(375)])&&g!==null)this[n(951)]&&this[n(951)][n(537)](g),this[n(341)+n(469)][l]=null;else break}this._messageQueue=this[n(341)+n(469)][n(377)](l=>!!l),this[n(780)+n(1053)+"Id"]=e[n(437)](setTimeout,()=>this[n(583)](),o),this[n(1138)+"hOpenEvent"](s),this[n(819)+"er"]&&this[n(951)]&&(this[n(951)][n(809)+"pe"]=this[n(1571)+n(1164)]);let x=this["_endpoin"+n(714)]?.[n(657)+"ntEndpoint"]();this[n(206)](n(811)+x+n(911)),e[n(933)](t)},e0=async function(s,t){let n=r,o={vFVZd:function(x,l,g){return e[D(470)](x,l,g)},CrAJT:function(x,l,g){return e[D(1609)](x,l,g)},BHLOx:function(x,l){return e[D(1242)](x,l)}};if(e[n(201)](e[n(768)],n(769)))BzfTkO[n(949)](_0x346e03,_0x3dd79e,24),BzfTkO.CrAJT(_0x5c38b1,_0x92df24,BzfTkO[n(413)](_0x4ccdec,_0x311c12));else{let x=this[n(1520)+n(714)]?.[n(657)+n(511)+"nt"]();this[n(206)](n(811)+x),e[n(532)](t)}};class t0 extends xr{constructor(t){let n=r,o={HLGZH:function(p,f){return e[D(473)](p,f)},skwmf:e[n(1391)],XCFwV:n(937),ZIPey:e[n(1139)],yXbnv:n(1551),cWHpy:function(p,f,b){return e[n(645)](p,f,b)},NhnaM:function(p,f){return e[n(1436)](p,f)},JMsgn:function(p,f,b,v){return e.HFAeT(p,f,b,v)},FFkxr:e[n(720)],ELEPa:function(p,f){return e.OHqxp(p,f)}};super(),this[n(203)+"igatorOn"+n(533)]=!0,this[n(819)+"er"]=at,this._isNode=ma,this[n(633)+"T"]=Xe,this._isMiniWX=At,this[n(1580)+"r"]=Pt,this[n(341)+n(469)]=[],this[n(1520)+n(714)]=null,this[n(646)+n(436)]=!1,this[n(1571)+"ype"]=n(1305)+n(1475),this[n(1054)+n(1019)]=!1,this[n(1054)+n(793)+"utId"]=null,this[n(234)+"ctTimeoutId"]=null,this[n(780)+n(1053)+"Id"]=null,this._seqId=0,this._isInit=!1,this[n(977)]="",this[n(409)+n(686)]=null,this[n(1438)+n(944)]=null,this[n(868)+n(734)]=null,this[n(1564)+"ls"]=e[n(1106)],this[n(1621)]=3,this[n(425)+"NG"]=0,this[n(375)]=1,this[n(1033)]=2,this[n(961)]=p=>{let f=n;try{e[f(856)](Cs,this,p,[Za,Qa,e0])}catch(b){if(e[f(1134)](e[f(549)],f(223)))return this[f(1520)+f(714)]?.["getCurre"+f(511)+"ntTriesCount"]()||0;{let v=le(e[f(720)],{message:b[f(965)],code:Ue[f(1217)+"OR"],error:b});this[f(1138)+f(575)+"ent"](v)}}},this._onMessage=async p=>{let f=n,{pingInterval:b,pingFrequency:v}=this[f(1296)];if((p[f(1355)]==="hi"&&o[f(1549)](o[f(1173)],v)||o[f(1549)](o[f(1184)],v))&&(o[f(1189)]!==o[f(1189)]?(this[f(341)+f(469)].shift(),this[f(341)+f(469)][f(547)](_0x18da11)):(this[f(1456)+f(240)](),this[f(759)](f(1402)+f(999)+"s",o[f(661)]),this[f(780)+"gTimeoutId"]=o[f(1451)](setTimeout,this[f(583)][f(1408)](this),b))),!o[f(699)]("hi",p[f(1355)]))try{o[f(530)](Cs,this,p,[Ra,Ia,$a,Xa,Ya,Ta])}catch(C){let I=o[f(1451)](le,o.FFkxr,{message:C[f(965)],code:Ue[f(243)+f(190)],error:C});this[f(1138)+f(575)+f(1346)](I)}},this[n(800)]=p=>{let f=n,b=this[f(1520)+"tManager"]?.[f(1279)+f(613)+"es"](),v=this[f(1520)+f(714)]?.[f(657)+f(511)+"nt"]();if(b&&!p[f(965)]){let C=f(555)+v+(" fail, max retri"+f(1396)+"ed");this[f(1138)+f(575)+"ent"](e[f(1199)](le,e[f(720)],{message:C,code:Ue.MAX_RETRIES_ERROR,error:p}));return}this[f(951)]&&e.WNqyZ(this._ws[f(272)+"te"],this.OPEN)&&this[f(1246)+f(372)](),this["_dispatc"+f(575)+"ent"](le(e[f(720)],{message:p[f(965)],code:Ue[f(222)+"RROR"],error:p}))},this[n(1329)]=async p=>{let f=n;this[f(885)+f(327)](),this[f(1456)+f(240)](),this[f(945)+"sListeners"](),this._ws=null,this[f(1054)+f(1019)]=!1;let b=this[f(1520)+"tManager"]?.["checkRea"+f(613)+"es"]();if(!b&&this[f(903)+"orOnline"]()&&!this[f(646)+"osed"])if(e[f(637)]==="PHEhd"){let v=this._qosDB[f(679)](this[f(1216)]),C=_0x59de93[f(1512)](seCEHz[f(322)](v,"{}"));return C[_0x163975]=void 0,this._qosDB[f(1459)](this[f(1216)],_0x563196.stringify(C))}else{let v=this[f(1520)+f(714)]?.[f(657)+f(511)+"nt"](),C=this[f(1296)]["reconnec"+f(796)+"ptor"](p[f(634)],p[f(743)]);this["_dispatchCloseEv"+f(1346)](e[f(1622)](me,e[f(1540)],{code:1006,reason:p[f(743)]||f(616)+"ng faile"+f(1600)+f(764)+f(1550)+"ame: "+v,willReconnect:C})),C&&this[f(1054)]();return}if(e[f(410)](1e3,p[f(634)])&&this[f(646)+f(436)]){this[f(1138)+f(1284)+"ent"](e[f(713)](me,e.onPnX,{code:1e3,reason:f(381)})),this[f(1520)+"tManager"]?.["resetEndpointCon"+f(1526)](),this["_pingLos"+f(734)]?.[f(1069)+f(1341)]();return}if(e[f(277)](1e3,p.code)&&b){let v=this[f(1520)+"tManager"]?.[f(657)+f(511)+"nt"](),C=p.reason;C||(C=await e[f(1342)](Ea,this[f(977)])),C="connecti"+f(1567)+f(286)+C+(f(996)+f(1222))+v+(f(491)+"tries re"+f(1017)),this[f(1138)+"hCloseEv"+f(1346)](e[f(353)](me,e[f(1540)],{code:p.code,reason:C}));let I=f(555)+v+(f(1587)+f(835)+f(1396)+"ed");this["_dispatc"+f(575)+f(1346)](e[f(1146)](le,f(1127),{message:I,code:Ue[f(399)+f(985)+"R"]})),this[f(1520)+f(714)]?.[f(1384)+f(1095)+f(1526)](),this[f(868)+"sCounter"]?.["resetCou"+f(1341)]();return}if(e[f(579)](1e3,p[f(634)])&&!p.reason){let v=this[f(1520)+"tManager"]?.["getCurre"+f(511)+"nt"]();this[f(1138)+"hCloseEv"+f(1346)](me(e[f(1540)],{code:p[f(634)],reason:f(616)+"ng faile"+f(1600)+f(764)+f(1550)+"ame: "+v})),this[f(1520)+f(714)]?.["resetEnd"+f(1095)+f(1526)](),this[f(868)+f(734)]?.["resetCou"+f(1341)]();return}this[f(1138)+f(1284)+f(1346)](p),this[f(1520)+f(714)]?.[f(1384)+f(1095)+f(1526)](),this[f(868)+f(734)]?.[f(1069)+"nter"]()},this[n(1597)]=null,this[n(1018)]=null,this[n(1371)+"e"]=null,this[n(1212)]=null,this[n(892)+n(1469)]=null,this[n(908)+n(826)]=null,this[n(331)+"mediatel"+n(424)+"ct"]=null,this[n(536)+n(370)]=this[n(536)+"nLine"][n(1408)](this),this[n(536)+n(974)]=this[n(536)+n(974)][n(1408)](this),this["_handleP"+n(755)]=this[n(1274)+n(755)][n(1408)](this),this[n(1274)+n(647)]=this._handlePageShow[n(1408)](this),this[n(1296)]={url:"",automaticOpen:!0,initReconnectInterval:1e3,maxReconnectInterval:1e4,reconnectIntervalGrowFactor:2,timeoutInterval:5e3,maxRetries:5,debug:!1,maxMessageQueueLength:1/0,service:0,logIDGenerator:c,headers:void 0,payloadEncoding:"",payloadType:"",fpID:"",deviceID:"",accessKey:"",ttwID:"",bddID:"",aID:"",disableAutoReconnect:!1,customParams:{},pingInterval:15e3,pingTimeoutInterval:4e3,pingFrequency:e[n(1123)],pingLossCount:2,enableTransformTextPayload:!1,logIDNewConfig:{enableAutoGenerateLogIDNew:!1,userIp:""},miniProgramParams:{customHttpHeader:{}},enableAutoAck:!1,reconnectInterceptor:()=>!0,enableQoS:!1,QoSLevel:2,messageStrategy:e[n(1435)],env:{xTTEnv:"",xUseEnv:""},listenNetworkChanged:!0};let{url:x,ws:l}=t,g=Array.isArray(x)?x:e[n(541)]==typeof x?[x]:[];if(!g||e[n(1247)](0,g[n(836)]))throw new Error(n(1079)+n(513)+n(1082));if(!e[n(1568)](ya,l))throw new Error(e.FwdRg);Object[n(264)](this[n(1296)],t),this[n(1520)+"tManager"]=new Es(g,this[n(1296)][n(1617)+"es"]),this[n(868)+n(734)]=new Sa(this._options[n(1255)+n(257)]),this._options[n(621)+"cOpen"]&&(this[n(476)]=!0,this._connect()),this[n(1296)][n(820)+"tworkChanged"]&&(this[n(633)+"T"]||this[n(833)+"X"]?this[n(503)+n(1025)+n(1505)]():this._isBrowser&&this[n(605)+"balEvent"+n(1037)]())}[r(536)+"nLine"](){let t=r;this[t(1296)]["disableAutoRecon"+t(865)]||this["_readyCl"+t(436)]||this[t(493)+"econnect"]()}[r(536)+"ffLine"](){let t=r;this["_destroy"+t(1282)+"t"]();let n=e[t(771)](cr,e.mwrRe,{message:e[t(776)]});this["onStopImmediatel"+t(424)+"ct"]&&this[t(331)+t(215)+t(424)+"ct"](n)}[r(605)+"balEvent"+r(1037)](){let t=r;this._isBrowser&&window[t(426)+t(1037)](e[t(927)],this[t(536)+"nLine"]),this[t(819)+"er"]&&window.addEventListener(e.NhuKQ,this[t(536)+t(974)]),this._isBrowser&&window["addEvent"+t(1037)]("pagehide",this[t(1274)+t(755)]),this[t(819)+"er"]&&window[t(426)+t(1037)](e[t(899)],this[t(1274)+t(647)])}[r(1265)+"balEvent"+r(1037)](){let t=r;this._isBrowser&&window[t(1368)+t(1133)+t(893)](e[t(927)],this._handleOnLine),this[t(819)+"er"]&&window[t(1368)+"entListe"+t(893)](e.NhuKQ,this[t(536)+t(974)]),this[t(819)+"er"]&&window[t(1368)+t(1133)+t(893)](e[t(1174)],this[t(1274)+"ageHide"]),this[t(819)+"er"]&&window["removeEv"+t(1133)+t(893)](e[t(899)],this._handlePageShow)}["_handleP"+r(755)](t){let n=r;!t[n(1429)+"d"]&&(this._isBrowser&&window[n(1368)+"entListe"+n(893)](n(1152),this[n(1274)+n(755)]),this[n(819)+"er"]&&window["removeEv"+n(1133)+n(893)](e[n(899)],this[n(1274)+"ageShow"]),this.close()),this[n(819)+"er"]&&window[n(1368)+"entListe"+n(893)](e.RWGet,this[n(536)+"nLine"]),this[n(819)+"er"]&&window.removeEventListener(e[n(328)],this[n(536)+n(974)])}[r(1274)+r(647)](t){let n=r;t[n(1429)+"d"]&&(this[n(903)+n(1544)]()&&(!this[n(951)]||e[n(579)](this[n(951)][n(272)+"te"],this.OPEN)||e.XamOx(this[n(951)][n(272)+"te"],this[n(425)+"NG"]))&&this[n(536)+n(370)](),this._isBrowser&&window[n(426)+n(1037)]("online",this[n(536)+n(370)]),this[n(819)+"er"]&&window[n(426)+n(1037)](e.NhuKQ,this[n(536)+n(974)]))}async["_generat"+r(1200)](t){let n=r,{fpID:o,deviceID:x,bddID:l,ttwID:g,accessKey:p,aID:f,customParams:b={},enableAutoAck:v,enableQoS:C,QoSLevel:I,env:O}=this[n(1296)],L,B,Q;this[n(819)+"er"]||this._isMiniWX||this[n(633)+"T"]?(L=location&&location[n(420)]=="https:"?n(1116):e[n(1330)],B=t[n(1399)](/((^ws)|(^http))((?:[s]*:\/\/))/,""),Q=/^wss(.*:\/\/)/[n(1048)](t)?t:""+L+B):(L=n(1116),B=t[n(1399)](/(^http)((?:[s]*:\/\/))/,""),Q=/(^ws)((?:[s]*:\/\/))/[n(1048)](B)?B:""+L+B);let $=l?e[n(815)]:g?e[n(595)]:e[n(1308)],Ie=l||g||x;if(!Ie||!$)throw new Error(n(1079)+"rovide b"+n(708)+n(1349)+n(913));let n0=n(339)==typeof b?await e.FtciR(b):b,r0=O?e[n(1178)](va,O[n(1424)],O[n(1087)]):{},pr=Object[n(264)]({device_platform:e.VAuJB,version_code:"fws_1.0.0",access_key:p,fpid:o,aid:f,[$]:Ie,xsack:v?1:0,xaack:v?1:0,xsqos:C?1:0,qos_level:C?I:void 0,qos_sdk_version:2,...r0},n0),s0=Object[n(1460)](pr)[n(392)]((mr,wr)=>pr[wr]!==void 0?""+mr+(mr?"&":"?")+wr+"="+pr[wr]:mr,"");return Q+n(1229)+s0}async[r(1054)](){let t=r;if(!(this[t(1054)+t(1019)]||this[t(646)+t(436)])){this[t(1054)+"Lock"]=!0;try{let n=this[t(1520)+t(714)]?.[t(1381)+"rentEndp"+t(1211)+"hedMaxRe"+t(694)](),{timeoutInterval:o}=this[t(1296)];if(n){let l=this[t(1520)+t(714)]?.[t(657)+t(511)+"nt"](),g=this["_endpoin"+t(714)]?.[t(897)+"ackupEnd"+t(387)+t(229)+t(1313)](),p=this[t(1520)+"tManager"]?.[t(657)+t(511)+t(632)+t(1310)]();if(g){let f=t(555)+l+(t(254)+t(491)+t(245)+t(1328)+t(539)+t(952)+t(786))+g+(t(1315)+"y"),b=e.oJqRZ(le,e.xdmpf,{message:f,code:Ue["MAX_RETR"+t(985)+"R"]});this[t(206)](f),this[t(1138)+t(575)+t(1346)](b),this[t(977)]=await this[t(888)+t(1200)](g),this[t(206)](t(555)+g+" "+p+t(671)),this[t(945)+t(1612)+"rs"]()}else{let f="connect "+l+(t(254)+t(491)+"tries re"+t(1017));this[t(206)](f),this[t(1138)+t(575)+"ent"](e[t(481)](le,e[t(720)],{message:f,code:Ue[t(399)+t(985)+"R"]}));return}}else{let l=this._endpointManager?.[t(657)+"ntEndpoi"+t(572)+"ateCount"](),g=this[t(1520)+t(714)]?.[t(657)+"ntEndpoi"+t(632)+t(1310)]();this._url=await this["_generat"+t(1200)](e.TXYHv(l,"")),this[t(206)](t(555)+l+" "+g+" times"),this[t(945)+t(1612)+"rs"]()}if(this._isInit)this[t(476)]=!1;else{let l=e[t(666)](cr,e.mwrRe,{message:e[t(715)]});this.onStartReconnect&&this[t(892)+t(1469)](l)}let x=this[t(1520)+t(714)]?.[t(657)+t(511)+t(632)+t(1310)]()||0;e[t(1238)](x,1)&&await this._wait(e[t(710)](x,1)),this[t(206)](t(616)+t(325)+this[t(977)]+(t(1276)+t(1226))+this._protocols),this[t(951)]=e[t(353)](_a,{url:this[t(977)],protocols:[this[t(1564)+"ls"]],headers:this[t(1296)][t(505)+t(860)+"s"][t(615)+t(904)]},this._options.ws),(this[t(819)+"er"]||this[t(1580)+"r"])&&this[t(951)]&&(this[t(951)][t(809)+"pe"]=this[t(1571)+"ype"]),this[t(247)+t(501)](),this[t(1054)+t(793)+t(1543)]=e.uVwRJ(setTimeout,this[t(582)+"ut"].bind(this),o)}catch(n){throw this[t(1054)+t(1019)]=!1,n}}}[r(885)+r(327)](){let t=r,n={oErVi:function(o,x){return e[D(1125)](o,x)}};if(e[t(1427)]===t(1129)){let o={RWLtc:function(x,l){let g=t;return CNGMDy[g(1532)](x,l)}};return function(x,...l){let g=t,p=_0x1dfba4[g(812)](_0x3af3c2(this),x,...l);return _0x27e33c[g(396)](p,x[g(828)]?x[g(828)]():[x]),o[g(962)](_0x12e4a6,p)}}else clearTimeout(this[t(1054)+"ionTimeo"+t(1543)]),this[t(1054)+t(793)+"utId"]=null}[r(1456)+r(240)](){let t=r;clearTimeout(this[t(780)+t(1053)+"Id"]),e.uSGYP(clearTimeout,this[t(234)+t(724)+"tId"]),this["_pingPon"+t(1053)+"Id"]=null,this[t(234)+"ctTimeou"+t(1496)]=null}[r(206)](...t){let n=r;this._options[n(1478)]&&console[n(1409)][n(1118)](console,[e[n(1032)],...t])}["_getInte"+r(209)+"e"](t){let n=r;if(e[n(689)](n(443),e.oTpRp))return new _0x19cd4b(_0x32659f,{data:_0x41f9ff,message:_0x306472});{let{initReconnectInterval:o,maxReconnectInterval:x,reconnectIntervalGrowFactor:l}=this[n(1296)],g=e[n(1236)](o,Math[n(1516)](l,e[n(571)](t,1)));return e.IXVZC(g,x)?x:g}}_ping(){let t=r,n={nLIrj:function(o,x){return o<x},vIFNt:function(o,x,l){return o(x,l)},BoUPG:function(o,x,l,g){return e[D(1007)](o,x,l,g)},qMUWm:function(o,x){return e[D(802)](o,x)}};if(this[t(951)]&&this._ws[t(272)+"te"]===this[t(425)+"NG"])if(e[t(1214)](e[t(1333)],e[t(1333)])){let o=0,x=[];for(;ljUkWg.nLIrj(o,_0x1aa2a4[t(762)+"th"]);){let{offset:l}=ljUkWg[t(1322)](_0x255cf8,_0x439c68,o);o=l;let g={cursor_name:"",cursor:0,service:0},{value:p,offset:f}=_0x4a0bc7(_0x49ae69,o);g[t(255)]=p,o=f;let{value:b,offset:v}=_0x27fb74(_0x3cbd1f,o);o=v,g[t(316)+"ame"]=ljUkWg.BoUPG(_0x15e0c4,_0x31efdf,o,ljUkWg[t(1228)](o,b)),o+=b;let{value:C,offset:I}=_0x51dd64(_0x1ebf93,o);g[t(606)]=C[t(1406)](),o=I,x[t(547)](g)}return x}else{this[t(1456)+"ngTimer"](),this[t(780)+t(1053)+"Id"]=e[t(1359)](setTimeout,this[t(583)][t(1408)](this),this[t(1296)][t(1251)+t(1055)]);return}if(!this[t(951)]||e[t(1363)](this[t(951)].readyState,this[t(375)]))return void this[t(493)+t(1469)]();this[t(951)]&&this[t(951)][t(537)]("hi"),this["_reconnectTimeou"+t(1496)]=e.jycie(setTimeout,this[t(493)+t(1469)+t(1547)][t(1408)](this),this[t(1296)][t(556)+t(1203)+t(1324)])}["_handleR"+r(1469)+r(1547)](){let t=r;this[t(868)+t(734)]?.[t(1518)](),this[t(759)](e.WEzxw,e[t(623)]),this[t(868)+t(734)]?.[t(1279)+t(251)+"nt"]()?this[t(493)+t(1469)]():this[t(583)]()}[r(903)+r(1544)](){let t=r;return this[t(633)+"T"]||this[t(833)+"X"]?this[t(203)+t(938)+t(533)]:(this[t(819)+"er"]||this[t(1580)+"r"])&&this[t(1296)]["listenNe"+t(846)+"nged"]?navigator[t(948)]:!0}["_handleR"+r(1469)](){let t=r;!this[t(903)+t(1544)]()||this[t(646)+t(436)]||(this[t(1520)+"tManager"]?.[t(1384)+t(1095)+t(1526)](),this[t(868)+"sCounter"]?.["resetCou"+t(1341)](),this[t(951)]?this["_disconn"+t(372)](1001,e.GNTKM,!0):this[t(1054)]())}[r(503)+r(1025)+r(1505)](){let t=r;this[t(633)+"T"]?tt["onNetwor"+t(391)+t(1536)](({isConnected:n})=>{let o=t;this[o(203)+o(938)+o(533)]=n,n?this[o(536)+o(370)]():this[o(536)+o(974)]()}):this[t(833)+"X"]&&wx[t(1243)+t(391)+t(1536)](({isConnected:n})=>{let o=t;if(e[o(942)](e[o(777)],e[o(526)]))return this[o(716)]?.[o(660)](_0x16daea);this[o(203)+o(938)+o(533)]=n,n?this["_handleO"+o(370)]():this[o(536)+"ffLine"]()})}[r(723)](t){let n=r,o={saqUt:n(1298)+n(861)+n(597),ShJpG:function(x,l,g,p){return e[n(1278)](x,l,g,p)},XqzCl:e[n(465)],SwsGd:n(1190),KYDrK:e[n(889)],jRKlx:n(1024)+"ervice",HKONk:function(x,l,g,p){return e[n(1278)](x,l,g,p)}};return new Promise(x=>{let l=n;if(e.ErGxD(e[l(212)],e[l(212)]))setTimeout(x,this[l(685)+l(209)+"e"](t));else{let g=o.saqUt[l(1357)]("|"),p=0;for(;;){switch(g[p++]){case"0":_0x37a8fe=bfBtxI[l(1513)](_0x36cfba,_0x5b9521[l(1252)+"er"](_0x49d0f6[l(606)]||_0xf6cac9),_0x4bae9f,_0xd91d39);continue;case"1":_0x4cd0af[l(1409)](bfBtxI[l(1097)],_0x2d7401);continue;case"2":_0x40aaa9[l(1409)](bfBtxI[l(591)],_0x881029);continue;case"3":_0x4cbae7[l(1409)](l(957)+l(919),_0x3d92ac);continue;case"4":_0xfad75[l(1409)](bfBtxI.KYDrK,_0x2c6dc2);continue;case"5":_0x3cf2f4=_0x5ab47d(_0x47dad1[l(316)+l(1395)],_0x4134c8,_0x21e090);continue;case"6":_0xf5a71c[l(1409)](bfBtxI[l(1009)],_0x5c1ac9,_0x41d04d[l(255)]);continue;case"7":_0x724c1b[l(1409)](l(402),_0x720c67);continue;case"8":_0x3fcd40=_0x2c2f5d(_0x8a1597,_0x1fffc5,_0x462157[l(255)]||0);continue;case"9":_0x3c5c76=bfBtxI[l(946)](_0x18dc5d,_0x251cf0[_0x43af9a[l(316)+l(1395)]],_0x4934fa,_0x226b78);continue;case"10":_0x365224=bfBtxI.HKONk(_0x55ca34,0,_0x2552f0,_0x672d75);continue}break}}})}[r(1246)+r(372)](t=1e3,n="",o=!1){let x=r;this._ws&&this[x(305)+x(1282)+"t"](t,n,o)}_onTimeout(){let t=r,n=this[t(1520)+t(714)]?.[t(657)+"ntEndpoint"]();this[t(206)](t(555)+n+" timeout"),this["_disconn"+t(372)](1001,e[t(1122)],!0)}[r(1509)](t){let n=r,o=e[n(1242)](ar,t);this[n(951)]&&e[n(498)](this[n(951)][n(272)+"te"],this[n(375)])&&(this[n(951)]&&this._ws.send(o),this[n(206)](e[n(1166)],t))}[r(945)+"sListeners"](){let t=r;this._ws&&(this[t(951)][t(1368)+t(1133)+t(893)](e.iojll,this[t(961)]),this[t(951)][t(1368)+t(1133)+"ner"](e.onPnX,this[t(1329)]),this._ws[t(1368)+t(1133)+t(893)](e.NEjiL,this[t(1301)+"ge"]),this[t(951)][t(1368)+t(1133)+"ner"](e[t(720)],this[t(800)]))}[r(247)+r(501)](){let t=r,n=e[t(807)][t(1357)]("|"),o=0;for(;;){switch(n[o++]){case"0":if(!this[t(951)])return;continue;case"1":this[t(951)].addEventListener(e[t(720)],this[t(800)]);continue;case"2":this[t(951)][t(426)+t(1037)](e[t(1058)],this[t(961)]);continue;case"3":this._ws[t(426)+t(1037)]("close",this._onClose);continue;case"4":this._ws[t(426)+"Listener"]("message",this[t(1301)+"ge"]);continue}break}}[r(1014)+r(588)](t=1e3,n=""){let o=r;if(e[o(916)](e[o(1297)],e[o(1297)]))this.emit(e[o(1058)],_0x277e1e),this[o(1212)]&&this[o(1212)](_0x42c8ef);else try{this[o(951)]&&this._ws[o(1223)](t,n)}catch{}}[r(305)+"WebSocket"](t=1e3,n="",o=!1){let x=r,l={Sbjke:function(g,p,f){return e.CYOJw(g,p,f)},xjZNM:e.onPnX};if(this[x(1456)+"ngTimer"](),this[x(885)+"mer"](),this[x(945)+x(1612)+"rs"](),this[x(1014)+"nceClose"](1e3,n),this[x(1054)+"Lock"]=!1,o&&this[x(903)+x(1544)]()&&!this["_readyCl"+x(436)]){if(this[x(1520)+"tManager"]?.[x(1279)+x(613)+"es"]())if(x(1045)===e[x(1241)]){let p=this[x(1520)+x(714)]?.["getCurre"+x(511)+"nt"]();this[x(1138)+x(1284)+x(1346)](e[x(1514)](me,x(1223),{code:1006,reason:x(555)+p+(x(254)+", max re"+x(245)+"ached"),wasClean:!0}))}else{if(this["_endpoin"+x(714)]?.[x(1279)+x(613)+"es"]()){let f=this[x(1520)+x(714)]?.[x(657)+x(511)+"nt"]();this[x(1138)+x(1284)+x(1346)](l[x(1266)](_0xeeec5e,l[x(1393)],{code:1006,reason:x(555)+f+(x(254)+x(491)+x(245)+x(1017)),wasClean:!0}))}else{let f=this[x(1296)][x(1225)+x(796)+x(1353)](_0x46a9c4,_0x110a10);this[x(1138)+"hCloseEv"+x(1346)](l.Sbjke(_0x4cf9ff,l[x(1393)],{code:_0x515380,reason:_0x4b8cfb,wasClean:!0,willReconnect:f})),f&&this[x(1054)]()}return}else{let p=this[x(1296)][x(1225)+"tInterceptor"](t,n);this[x(1138)+x(1284)+x(1346)](e[x(276)](me,x(1223),{code:t,reason:n,wasClean:!0,willReconnect:p})),p&&this[x(1054)]()}return}this[x(903)+x(1544)]()||this[x(646)+x(436)]?this[x(1138)+x(1284)+x(1346)](e[x(1178)](me,e.onPnX,{code:t,reason:x(381)})):this["_dispatc"+x(1284)+x(1346)](me(e[x(1540)],{code:1006,reason:e[x(1388)]})),this._ws=null,this[x(1520)+x(714)]?.[x(1384)+x(1095)+x(1526)](),this[x(868)+x(734)]?.[x(1069)+x(1341)]()}[r(1138)+"hOpenEvent"](t){let n=r;if(e[n(928)](e[n(403)],e[n(403)]))this[n(759)](e.iojll,t),this[n(1212)]&&this[n(1212)](t);else return!!this[n(716)]}[r(1138)+r(853)+"Event"](t){let n=r;this[n(759)](e[n(990)],t),this[n(1371)+"e"]&&this[n(1371)+"e"](t)}[r(1138)+"hAckMess"+r(626)](t){let n=r;this.emit(n(845),t),this[n(908)+n(826)]&&this["onReceiv"+n(826)](t)}[r(1138)+r(575)+"ent"](t){let n=r;this[n(759)](e[n(720)],t),this[n(1018)]&&this[n(1018)](t)}[r(1138)+r(1284)+r(1346)](t){let n=r;this.emit(e.onPnX,t),this[n(1597)]&&this.onclose(t)}get[r(809)+"pe"](){let t=r;return this._ws?this[t(951)][t(809)+"pe"]:this[t(1571)+t(1164)]}set[r(809)+"pe"](t){let n=r,o={kZBCK:function(x,l,g){return e[D(470)](x,l,g)},DcgXI:function(x,l){return e[D(625)](x,l)}};if(e.OzKSe(e[n(494)],e[n(494)])){let x=_0x19cdc5();return QMWKXW[n(1047)](_0x3d3e01,_0x5b4d17,x),QMWKXW[n(1554)](_0x2b315f,x)}else this["_binaryT"+n(1164)]=t,this._ws&&(this[n(951)][n(809)+"pe"]=t)}get[r(326)+"nt"](){let t=r;return this[t(1520)+"tManager"]?.[t(657)+"ntEndpoi"+t(632)+t(1310)]()||0}get["buffered"+r(1410)](){let t=r;return this[t(341)+"Queue"][t(392)]((o,x)=>(o+=x&&x[t(762)+"th"]||0,o),0)+(this[t(951)]?this[t(951)][t(801)+t(1410)]:0)}get[r(1528)+"ns"](){let t=r;return this[t(951)]?this._ws[t(1528)+"ns"]:""}get[r(420)](){let t=r;return this._ws?this._ws[t(420)]:""}get[r(272)+"te"](){let t=r,n={RDXXE:function(o,x){return e[D(1131)](o,x)},FNQoH:function(o,x){return e[D(843)](o,x)},koKsJ:function(o,x){return o<<x},uGbys:function(o,x){return e[D(1070)](o,x)},BuAOr:function(o,x){return e[D(653)](o,x)}};if(e[t(1601)](t(405),e.APQGM))return this._ws?this[t(951)][t(272)+"te"]:this[t(1296)][t(621)+t(1485)]?this.CONNECTING:this[t(1621)];_0x515cf5=VCnkoB.RDXXE(VCnkoB[t(483)](VCnkoB[t(1354)](VCnkoB[t(1428)](15,_0xbee6e9),12),VCnkoB[t(1354)](VCnkoB[t(1428)](63,_0x169540),6)),VCnkoB[t(1428)](63,_0x7d00f1)),_0x379ac2<2048||_0x3680aa>=55296&&VCnkoB.BuAOr(_0x45dcc4,57343)?_0x377855+=_0x5397a7:(_0x2d7cc3+=_0x1894e0(_0x1a6aa2),_0x103e7b+=2)}get url(){let t=r;return this[t(951)]?this[t(951)].url:this[t(977)]}close(t=1e3,n){let o=r,x={HUVhA:function(l,g){return e[D(1147)](l,g)}};if(e[o(1261)]===e.efFvQ)return eCIfPw[o(486)](this.count,this[o(211)+o(1310)]);{let l=e[o(1289)].split("|"),g=0;for(;;){switch(l[g++]){case"0":if(e[o(488)](this[o(951)][o(272)+"te"],this[o(1621)])||this[o(951)][o(272)+"te"]===this.CLOSING)return void this._debug("close, ws alread"+o(230));continue;case"1":this[o(885)+o(327)]();continue;case"2":this[o(409)+o(686)]?.[o(1198)]();continue;case"3":this._destroyWebSocket(t,n);continue;case"4":this[o(1265)+o(1559)+o(1037)]();continue;case"5":if(!this[o(951)])return void this._debug(e[o(1010)]);continue;case"6":this[o(1456)+o(240)]();continue;case"7":this[o(646)+o(436)]=!0;continue}break}}}async[r(537)](t,n){let o=r,x={VbvLt:function(Q,$){return e.WDwbi(Q,$)},qQAbk:e[o(541)],uYBbG:e[o(1011)]};if(t==null)throw new Error(e[o(574)]);e[o(1348)](e[o(261)],typeof t)&&(t=JSON[o(816)+"y"](t)),e.YGSsM(o(751),typeof t)&&!(t instanceof ArrayBuffer)&&!(t[o(1071)]&&t[o(1071)]instanceof ArrayBuffer)&&(t=JSON[o(816)+"y"](t));let l=await e[o(1555)](ks,t),g=e.sREcf(ba,t),{method:p=0,service:f=this[o(1296)][o(255)],logID:b=this[o(1296)][o(321)+o(1204)](),headers:v=this[o(1296)][o(1457)],payloadEncoding:C=this[o(1296)][o(731)+o(859)],payloadType:I=this[o(1296)].payloadType,logIDNew:O=this[o(1296)][o(589)+o(1332)][o(981)+o(333)+"teLogIDNew"]?e.GTWJD(a,this[o(1296)][o(589)+o(1332)][o(1317)]):""}=n||{};if(!f)throw new Error(o(1079)+"rovide a"+o(884)+o(1444));let L={SeqID:z[o(1252)+"er"](this[o(445)]++),LogID:z[o(1252)+"er"](b),service:f,method:p,headers:v,payloadEncoding:e[o(1098)](C,Object)?C.encoding?C.encoding:"":C,payloadType:e[o(1432)](I,Object)?I[o(317)]?I[o(317)]:g:I||g,payload:l,LogIDNew:O},B=e[o(214)](ar,L);if(this[o(951)]&&e[o(1436)](this[o(951)].readyState,this[o(375)]))this[o(951)]&&this[o(951)][o(537)](B),this[o(206)](e.hcxlW,L);else if(this[o(341)+o(469)][o(836)]<this._options[o(850)+o(281)+o(1449)])this[o(341)+o(469)][o(547)](B),this._debug(o(1316),L);else if(e[o(1022)](e[o(745)],e[o(745)]))this[o(341)+"Queue"][o(789)](),this[o(341)+o(469)][o(547)](B);else return iuVcwZ[o(285)](iuVcwZ.qQAbk,typeof _0x7f4e14)?iuVcwZ.uYBbG:"";return{seqID:this._seqId,logID:b,logIDNew:O}}async[r(1225)+"t"](t){let n=r,{url:o}=e.btpOA(t,{}),x=Array[n(728)](o)?o:e[n(1187)](e[n(541)],typeof o)?[o]:[];t&&Object[n(264)](this._options,t),x&&x[n(836)]?this[n(1520)+n(714)]=new Es(x,this[n(1296)][n(1617)+"es"]):this[n(1520)+"tManager"]?.["resetEnd"+n(1095)+n(1526)](),this._pingLossCounter?.[n(1069)+n(1341)](this[n(1296)]["pingLoss"+n(257)]),this[n(646)+n(436)]=!1,this[n(951)]&&e.VPSjG(this[n(951)][n(272)+"te"],this[n(1621)])?this["_disconn"+n(372)](1e3,e.eBaWQ,!0):(this[n(476)]=!0,this[n(1054)]())}async[r(1619)](){let t=r;if(!this[t(1054)+t(1019)]){let n=e[t(224)][t(1357)]("|"),o=0;for(;;){switch(n[o++]){case"0":this._pingLossCounter?.[t(1069)+"nter"]();continue;case"1":this[t(1520)+t(714)]?.[t(1384)+"pointCon"+t(1526)]();continue;case"2":this[t(476)]=!0;continue;case"3":this[t(1054)]();continue;case"4":this["_readyCl"+t(436)]=!1;continue}break}}}[r(426)+r(1037)](t,n){this.on(t,n)}[r(1596)+r(914)](t){let n=r,{type:o}=t;this[n(759)](o,t)}[r(1368)+"entListe"+r(893)](t,n){this[r(253)](t,n)}[r(1584)](){let t={eSIDC:function(n,o){return e[D(1530)](n,o)},YUnJt:"success"};return new Promise((n,o)=>{let x=D,l={TMyur:e.WEzxw};this[x(1456)+x(240)](),this[x(780)+x(1053)+"Id"]=e.aTxZs(setTimeout,this._ping[x(1408)](this),this._options[x(1251)+x(1055)]);let g=()=>{let f=x;t.eSIDC(n,t[f(648)]),this[f(253)](f(1402)+f(999)+"s",g),this.off("ping_onc"+f(960)+"t",p)},p=()=>{let f=x;o(f(1594)),this[f(253)](f(1402)+f(999)+"s",g),this.off(l[f(456)],p)};this.on(x(1402)+"e_success",g),this.on(x(1402)+x(960)+"t",p),this[x(583)]()})}}})(),Y[S(423)+S(719)]=Z[S(423)+S(719)],Y[S(376)+S(1483)]=Z[S(376)+"rorEvent"],Y[S(1366)+"e"]=Z[S(1366)+"e"],Y[S(914)]=Z.Event,Y[S(651)]=Z.FWS,Y[S(726)+S(1205)+S(924)]=Z[S(726)+"MessageE"+S(924)],Y[S(1205)+S(924)]=Z[S(1205)+S(924)],Y[S(442)+"t"]=Z.OpenEvent,Y[S(499)+S(1561)]=Z["Reconnec"+S(1561)],Y[S(1299)+S(719)]=Z.createCloseEvent,Y["createEr"+S(1483)]=Z[S(711)+S(1483)],Y[S(586)+S(741)+"nt"]=Z.createMessageEvent,Y[S(1277)+S(563)]=Z["createOp"+S(563)],Y[S(1497)+S(813)+S(924)]=Z[S(1497)+S(813)+S(924)],Y["decodedF"+S(1379)]=Z["decodedF"+S(1379)],Y.encodeFrame=Z[S(416)+S(1395)];for(In in Z)[S(423)+"oseEvent",S(376)+S(1483),S(1366)+"e",S(914),"FWS",S(726)+"MessageEvent","MessageE"+S(924),S(442)+"t",S(499)+S(1561),"createCl"+S(719),"createEr"+S(1483),S(586)+S(741)+"nt",S(1277)+"enEvent",S(1497)+S(813)+S(924),S(1361)+S(1379),S(416)+"ame"][S(496)](In)===-1&&(Y[In]=Z[In]);var In;Object[S(749)+S(1524)](Y,S(1552)+"le",{value:!0})});var Be=ce((ph,Fi)=>{"use strict";var zi=["nodebuffer","arraybuffer","fragments"],qi=typeof Blob<"u";qi&&zi.push("blob");Fi.exports={BINARY_TYPES:zi,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:qi,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var Ft=ce((mh,Mn)=>{"use strict";var{EMPTY_BUFFER:ux}=Be(),Tr=Buffer[Symbol.species];function dx(r,e){if(r.length===0)return ux;if(r.length===1)return r[0];let i=Buffer.allocUnsafe(e),a=0;for(let c=0;c<r.length;c++){let u=r[c];i.set(u,a),a+=u.length}return a<e?new Tr(i.buffer,i.byteOffset,a):i}function Ui(r,e,i,a,c){for(let u=0;u<c;u++)i[a+u]=r[u]^e[u&3]}function Gi(r,e){for(let i=0;i<r.length;i++)r[i]^=e[i&3]}function fx(r){return r.length===r.buffer.byteLength?r.buffer:r.buffer.slice(r.byteOffset,r.byteOffset+r.length)}function Rr(r){if(Rr.readOnly=!0,Buffer.isBuffer(r))return r;let e;return r instanceof ArrayBuffer?e=new Tr(r):ArrayBuffer.isView(r)?e=new Tr(r.buffer,r.byteOffset,r.byteLength):(e=Buffer.from(r),Rr.readOnly=!1),e}Mn.exports={concat:dx,mask:Ui,toArrayBuffer:fx,toBuffer:Rr,unmask:Gi};if(!process.env.WS_NO_BUFFER_UTIL)try{let r=X("bufferutil");Mn.exports.mask=function(e,i,a,c,u){u<48?Ui(e,i,a,c,u):r.mask(e,i,a,c,u)},Mn.exports.unmask=function(e,i){e.length<32?Gi(e,i):r.unmask(e,i)}}catch{}});var ji=ce((wh,Hi)=>{"use strict";var Ki=Symbol("kDone"),Nr=Symbol("kRun"),Lr=class{constructor(e){this[Ki]=()=>{this.pending--,this[Nr]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[Nr]()}[Nr](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[Ki])}}};Hi.exports=Lr});var mt=ce((_h,Yi)=>{"use strict";var Ut=X("zlib"),Wi=Ft(),lx=ji(),{kStatusCode:Ji}=Be(),hx=Buffer[Symbol.species],gx=Buffer.from([0,0,255,255]),qn=Symbol("permessage-deflate"),Me=Symbol("total-length"),gt=Symbol("callback"),Je=Symbol("buffers"),pt=Symbol("error"),zn,Or=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,!zn){let i=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;zn=new lx(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[gt];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(c=>!(i.serverNoContextTakeover===!1&&c.server_no_context_takeover||c.server_max_window_bits&&(i.serverMaxWindowBits===!1||typeof i.serverMaxWindowBits=="number"&&i.serverMaxWindowBits>c.server_max_window_bits)||typeof i.clientMaxWindowBits=="number"&&!c.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 c=i[a];if(c.length>1)throw new Error(`Parameter "${a}" must have only a single value`);if(c=c[0],a==="client_max_window_bits"){if(c!==!0){let u=+c;if(!Number.isInteger(u)||u<8||u>15)throw new TypeError(`Invalid value for parameter "${a}": ${c}`);c=u}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${a}": ${c}`)}else if(a==="server_max_window_bits"){let u=+c;if(!Number.isInteger(u)||u<8||u>15)throw new TypeError(`Invalid value for parameter "${a}": ${c}`);c=u}else if(a==="client_no_context_takeover"||a==="server_no_context_takeover"){if(c!==!0)throw new TypeError(`Invalid value for parameter "${a}": ${c}`)}else throw new Error(`Unknown parameter "${a}"`);i[a]=c})}),e}decompress(e,i,a){zn.add(c=>{this._decompress(e,i,(u,d)=>{c(),a(u,d)})})}compress(e,i,a){zn.add(c=>{this._compress(e,i,(u,d)=>{c(),a(u,d)})})}_decompress(e,i,a){let c=this._isServer?"client":"server";if(!this._inflate){let u=`${c}_max_window_bits`,d=typeof this.params[u]!="number"?Ut.Z_DEFAULT_WINDOWBITS:this.params[u];this._inflate=Ut.createInflateRaw({...this._options.zlibInflateOptions,windowBits:d}),this._inflate[qn]=this,this._inflate[Me]=0,this._inflate[Je]=[],this._inflate.on("error",mx),this._inflate.on("data",Vi)}this._inflate[gt]=a,this._inflate.write(e),i&&this._inflate.write(gx),this._inflate.flush(()=>{let u=this._inflate[pt];if(u){this._inflate.close(),this._inflate=null,a(u);return}let d=Wi.concat(this._inflate[Je],this._inflate[Me]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[Me]=0,this._inflate[Je]=[],i&&this.params[`${c}_no_context_takeover`]&&this._inflate.reset()),a(null,d)})}_compress(e,i,a){let c=this._isServer?"server":"client";if(!this._deflate){let u=`${c}_max_window_bits`,d=typeof this.params[u]!="number"?Ut.Z_DEFAULT_WINDOWBITS:this.params[u];this._deflate=Ut.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:d}),this._deflate[Me]=0,this._deflate[Je]=[],this._deflate.on("data",px)}this._deflate[gt]=a,this._deflate.write(e),this._deflate.flush(Ut.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let u=Wi.concat(this._deflate[Je],this._deflate[Me]);i&&(u=new hx(u.buffer,u.byteOffset,u.length-4)),this._deflate[gt]=null,this._deflate[Me]=0,this._deflate[Je]=[],i&&this.params[`${c}_no_context_takeover`]&&this._deflate.reset(),a(null,u)})}};Yi.exports=Or;function px(r){this[Je].push(r),this[Me]+=r.length}function Vi(r){if(this[Me]+=r.length,this[qn]._maxPayload<1||this[Me]<=this[qn]._maxPayload){this[Je].push(r);return}this[pt]=new RangeError("Max payload size exceeded"),this[pt].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[pt][Ji]=1009,this.removeListener("data",Vi),this.reset()}function mx(r){if(this[qn]._inflate=null,this[pt]){this[gt](this[pt]);return}r[Ji]=1007,this[gt](r)}});var wt=ce((yh,Fn)=>{"use strict";var{isUtf8:$i}=X("buffer"),{hasBlob:_x}=Be(),yx=[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 bx(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 vx(r){return _x&&typeof r=="object"&&typeof r.arrayBuffer=="function"&&typeof r.type=="string"&&typeof r.stream=="function"&&(r[Symbol.toStringTag]==="Blob"||r[Symbol.toStringTag]==="File")}Fn.exports={isBlob:vx,isValidStatusCode:bx,isValidUTF8:Br,tokenChars:yx};if($i)Fn.exports.isValidUTF8=function(r){return r.length<24?Br(r):$i(r)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let r=X("utf-8-validate");Fn.exports.isValidUTF8=function(e){return e.length<32?Br(e):r(e)}}catch{}});var Ur=ce((bh,ro)=>{"use strict";var{Writable:Sx}=X("stream"),Xi=mt(),{BINARY_TYPES:Ex,EMPTY_BUFFER:Zi,kStatusCode:Cx,kWebSocket:Ax}=Be(),{concat:Mr,toArrayBuffer:Px,unmask:kx}=Ft(),{isValidStatusCode:Dx,isValidUTF8:Qi}=wt(),Un=Buffer[Symbol.species],he=0,eo=1,to=2,no=3,zr=4,qr=5,Gn=6,Fr=class extends Sx{constructor(e={}){super(),this._allowSynchronousEvents=e.allowSynchronousEvents!==void 0?e.allowSynchronousEvents:!0,this._binaryType=e.binaryType||Ex[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxPayload=e.maxPayload|0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[Ax]=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=he}_write(e,i,a){if(this._opcode===8&&this._state==he)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 Un(a.buffer,a.byteOffset+e,a.length-e),new Un(a.buffer,a.byteOffset,e)}let i=Buffer.allocUnsafe(e);do{let a=this._buffers[0],c=i.length-e;e>=a.length?i.set(this._buffers.shift(),c):(i.set(new Uint8Array(a.buffer,a.byteOffset,e),c),this._buffers[0]=new Un(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 he:this.getInfo(e);break;case eo:this.getPayloadLength16(e);break;case to:this.getPayloadLength64(e);break;case no:this.getMask();break;case zr:this.getData(e);break;case qr:case Gn: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 c=this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");e(c);return}let a=(i[0]&64)===64;if(a&&!this._extensions[Xi.extensionName]){let c=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(c);return}if(this._fin=(i[0]&128)===128,this._opcode=i[0]&15,this._payloadLength=i[1]&127,this._opcode===0){if(a){let c=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(c);return}if(!this._fragmented){let c=this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");e(c);return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){let c=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");e(c);return}this._compressed=a}else if(this._opcode>7&&this._opcode<11){if(!this._fin){let c=this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");e(c);return}if(a){let c=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(c);return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){let c=this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");e(c);return}}else{let c=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");e(c);return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(i[1]&128)===128,this._isServer){if(!this._masked){let c=this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK");e(c);return}}else if(this._masked){let c=this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");e(c);return}this._payloadLength===126?this._state=eo:this._payloadLength===127?this._state=to: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 c=this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");e(c);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=no:this._state=zr}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=zr}getData(e){let i=Zi;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&&kx(i,this._mask)}if(this._opcode>7){this.controlMessage(i,e);return}if(this._compressed){this._state=qr,this.decompress(i,e);return}i.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(i)),this.dataMessage(e)}decompress(e,i){this._extensions[Xi.extensionName].decompress(e,this._fin,(c,u)=>{if(c)return i(c);if(u.length){if(this._messageLength+=u.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let d=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");i(d);return}this._fragments.push(u)}this.dataMessage(i),this._state===he&&this.startLoop(i)})}dataMessage(e){if(!this._fin){this._state=he;return}let i=this._messageLength,a=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let c;this._binaryType==="nodebuffer"?c=Mr(a,i):this._binaryType==="arraybuffer"?c=Px(Mr(a,i)):this._binaryType==="blob"?c=new Blob(a):c=a,this._allowSynchronousEvents?(this.emit("message",c,!0),this._state=he):(this._state=Gn,setImmediate(()=>{this.emit("message",c,!0),this._state=he,this.startLoop(e)}))}else{let c=Mr(a,i);if(!this._skipUTF8Validation&&!Qi(c)){let u=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");e(u);return}this._state===qr||this._allowSynchronousEvents?(this.emit("message",c,!1),this._state=he):(this._state=Gn,setImmediate(()=>{this.emit("message",c,!1),this._state=he,this.startLoop(e)}))}}controlMessage(e,i){if(this._opcode===8){if(e.length===0)this._loop=!1,this.emit("conclude",1005,Zi),this.end();else{let a=e.readUInt16BE(0);if(!Dx(a)){let u=this.createError(RangeError,`invalid status code ${a}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");i(u);return}let c=new Un(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!Qi(c)){let u=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");i(u);return}this._loop=!1,this.emit("conclude",a,c),this.end()}this._state=he;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?"ping":"pong",e),this._state=he):(this._state=Gn,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",e),this._state=he,this.startLoop(i)}))}createError(e,i,a,c,u){this._loop=!1,this._errored=!0;let d=new e(a?`Invalid WebSocket frame: ${i}`:i);return Error.captureStackTrace(d,this.createError),d.code=u,d[Cx]=c,d}};ro.exports=Fr});var Hr=ce((Sh,oo)=>{"use strict";var{Duplex:vh}=X("stream"),{randomFillSync:Ix}=X("crypto"),so=mt(),{EMPTY_BUFFER:Tx,kWebSocket:Rx,NOOP:Nx}=Be(),{isBlob:_t,isValidStatusCode:Lx}=wt(),{mask:io,toBuffer:Qe}=Ft(),ge=Symbol("kByteLength"),Ox=Buffer.alloc(4),Kn=8*1024,et,yt=Kn,_e=0,Bx=1,Mx=2,Gr=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=_e,this.onerror=Nx,this[Rx]=void 0}static frame(e,i){let a,c=!1,u=2,d=!1;i.mask&&(a=i.maskBuffer||Ox,i.generateMask?i.generateMask(a):(yt===Kn&&(et===void 0&&(et=Buffer.alloc(Kn)),Ix(et,0,Kn),yt=0),a[0]=et[yt++],a[1]=et[yt++],a[2]=et[yt++],a[3]=et[yt++]),d=(a[0]|a[1]|a[2]|a[3])===0,u=6);let h;typeof e=="string"?(!i.mask||d)&&i[ge]!==void 0?h=i[ge]:(e=Buffer.from(e),h=e.length):(h=e.length,c=i.mask&&i.readOnly&&!d);let m=h;h>=65536?(u+=8,m=127):h>125&&(u+=2,m=126);let w=Buffer.allocUnsafe(c?h+u:u);return w[0]=i.fin?i.opcode|128:i.opcode,i.rsv1&&(w[0]|=64),w[1]=m,m===126?w.writeUInt16BE(h,2):m===127&&(w[2]=w[3]=0,w.writeUIntBE(h,4,6)),i.mask?(w[1]|=128,w[u-4]=a[0],w[u-3]=a[1],w[u-2]=a[2],w[u-1]=a[3],d?[w,e]:c?(io(e,a,w,u,h),[w]):(io(e,a,e,0,h),[w,e])):[w,e]}close(e,i,a,c){let u;if(e===void 0)u=Tx;else{if(typeof e!="number"||!Lx(e))throw new TypeError("First argument must be a valid error code number");if(i===void 0||!i.length)u=Buffer.allocUnsafe(2),u.writeUInt16BE(e,0);else{let h=Buffer.byteLength(i);if(h>123)throw new RangeError("The message must not be greater than 123 bytes");u=Buffer.allocUnsafe(2+h),u.writeUInt16BE(e,0),typeof i=="string"?u.write(i,2):u.set(i,2)}}let d={[ge]:u.length,fin:!0,generateMask:this._generateMask,mask:a,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state!==_e?this.enqueue([this.dispatch,u,!1,d,c]):this.sendFrame(r.frame(u,d),c)}ping(e,i,a){let c,u;if(typeof e=="string"?(c=Buffer.byteLength(e),u=!1):_t(e)?(c=e.size,u=!1):(e=Qe(e),c=e.length,u=Qe.readOnly),c>125)throw new RangeError("The data size must not be greater than 125 bytes");let d={[ge]:c,fin:!0,generateMask:this._generateMask,mask:i,maskBuffer:this._maskBuffer,opcode:9,readOnly:u,rsv1:!1};_t(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,i,a){let c,u;if(typeof e=="string"?(c=Buffer.byteLength(e),u=!1):_t(e)?(c=e.size,u=!1):(e=Qe(e),c=e.length,u=Qe.readOnly),c>125)throw new RangeError("The data size must not be greater than 125 bytes");let d={[ge]:c,fin:!0,generateMask:this._generateMask,mask:i,maskBuffer:this._maskBuffer,opcode:10,readOnly:u,rsv1:!1};_t(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,i,a){let c=this._extensions[so.extensionName],u=i.binary?2:1,d=i.compress,h,m;typeof e=="string"?(h=Buffer.byteLength(e),m=!1):_t(e)?(h=e.size,m=!1):(e=Qe(e),h=e.length,m=Qe.readOnly),this._firstFragment?(this._firstFragment=!1,d&&c&&c.params[c._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(d=h>=c._threshold),this._compress=d):(d=!1,u=0),i.fin&&(this._firstFragment=!0);let w={[ge]:h,fin:i.fin,generateMask:this._generateMask,mask:i.mask,maskBuffer:this._maskBuffer,opcode:u,readOnly:m,rsv1:d};_t(e)?this._state!==_e?this.enqueue([this.getBlobData,e,this._compress,w,a]):this.getBlobData(e,this._compress,w,a):this._state!==_e?this.enqueue([this.dispatch,e,this._compress,w,a]):this.dispatch(e,this._compress,w,a)}getBlobData(e,i,a,c){this._bufferedBytes+=a[ge],this._state=Mx,e.arrayBuffer().then(u=>{if(this._socket.destroyed){let h=new Error("The socket was closed while the blob was being read");process.nextTick(Kr,this,h,c);return}this._bufferedBytes-=a[ge];let d=Qe(u);i?this.dispatch(d,i,a,c):(this._state=_e,this.sendFrame(r.frame(d,a),c),this.dequeue())}).catch(u=>{process.nextTick(zx,this,u,c)})}dispatch(e,i,a,c){if(!i){this.sendFrame(r.frame(e,a),c);return}let u=this._extensions[so.extensionName];this._bufferedBytes+=a[ge],this._state=Bx,u.compress(e,a.fin,(d,h)=>{if(this._socket.destroyed){let m=new Error("The socket was closed while data was being compressed");Kr(this,m,c);return}this._bufferedBytes-=a[ge],this._state=_e,a.readOnly=!1,this.sendFrame(r.frame(h,a),c),this.dequeue()})}dequeue(){for(;this._state===_e&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[3][ge],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][ge],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)}};oo.exports=Gr;function Kr(r,e,i){typeof i=="function"&&i(e);for(let a=0;a<r._queue.length;a++){let c=r._queue[a],u=c[c.length-1];typeof u=="function"&&u(e)}}function zx(r,e,i){Kr(r,e,i),r.onerror(e)}});var po=ce((Eh,go)=>{"use strict";var{kForOnEventAttribute:Gt,kListener:jr}=Be(),ao=Symbol("kCode"),co=Symbol("kData"),xo=Symbol("kError"),uo=Symbol("kMessage"),fo=Symbol("kReason"),bt=Symbol("kTarget"),lo=Symbol("kType"),ho=Symbol("kWasClean"),ze=class{constructor(e){this[bt]=null,this[lo]=e}get target(){return this[bt]}get type(){return this[lo]}};Object.defineProperty(ze.prototype,"target",{enumerable:!0});Object.defineProperty(ze.prototype,"type",{enumerable:!0});var nt=class extends ze{constructor(e,i={}){super(e),this[ao]=i.code===void 0?0:i.code,this[fo]=i.reason===void 0?"":i.reason,this[ho]=i.wasClean===void 0?!1:i.wasClean}get code(){return this[ao]}get reason(){return this[fo]}get wasClean(){return this[ho]}};Object.defineProperty(nt.prototype,"code",{enumerable:!0});Object.defineProperty(nt.prototype,"reason",{enumerable:!0});Object.defineProperty(nt.prototype,"wasClean",{enumerable:!0});var vt=class extends ze{constructor(e,i={}){super(e),this[xo]=i.error===void 0?null:i.error,this[uo]=i.message===void 0?"":i.message}get error(){return this[xo]}get message(){return this[uo]}};Object.defineProperty(vt.prototype,"error",{enumerable:!0});Object.defineProperty(vt.prototype,"message",{enumerable:!0});var Kt=class extends ze{constructor(e,i={}){super(e),this[co]=i.data===void 0?null:i.data}get data(){return this[co]}};Object.defineProperty(Kt.prototype,"data",{enumerable:!0});var qx={addEventListener(r,e,i={}){for(let c of this.listeners(r))if(!i[Gt]&&c[jr]===e&&!c[Gt])return;let a;if(r==="message")a=function(u,d){let h=new Kt("message",{data:d?u:u.toString()});h[bt]=this,Hn(e,this,h)};else if(r==="close")a=function(u,d){let h=new nt("close",{code:u,reason:d.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});h[bt]=this,Hn(e,this,h)};else if(r==="error")a=function(u){let d=new vt("error",{error:u,message:u.message});d[bt]=this,Hn(e,this,d)};else if(r==="open")a=function(){let u=new ze("open");u[bt]=this,Hn(e,this,u)};else return;a[Gt]=!!i[Gt],a[jr]=e,i.once?this.once(r,a):this.on(r,a)},removeEventListener(r,e){for(let i of this.listeners(r))if(i[jr]===e&&!i[Gt]){this.removeListener(r,i);break}}};go.exports={CloseEvent:nt,ErrorEvent:vt,Event:ze,EventTarget:qx,MessageEvent:Kt};function Hn(r,e,i){typeof r=="object"&&r.handleEvent?r.handleEvent.call(r,i):r.call(e,i)}});var jn=ce((Ch,mo)=>{"use strict";var{tokenChars:Ht}=wt();function Pe(r,e,i){r[e]===void 0?r[e]=[i]:r[e].push(i)}function Fx(r){let e=Object.create(null),i=Object.create(null),a=!1,c=!1,u=!1,d,h,m=-1,w=-1,_=-1,y=0;for(;y<r.length;y++)if(w=r.charCodeAt(y),d===void 0)if(_===-1&&Ht[w]===1)m===-1&&(m=y);else if(y!==0&&(w===32||w===9))_===-1&&m!==-1&&(_=y);else if(w===59||w===44){if(m===-1)throw new SyntaxError(`Unexpected character at index ${y}`);_===-1&&(_=y);let k=r.slice(m,_);w===44?(Pe(e,k,i),i=Object.create(null)):d=k,m=_=-1}else throw new SyntaxError(`Unexpected character at index ${y}`);else if(h===void 0)if(_===-1&&Ht[w]===1)m===-1&&(m=y);else if(w===32||w===9)_===-1&&m!==-1&&(_=y);else if(w===59||w===44){if(m===-1)throw new SyntaxError(`Unexpected character at index ${y}`);_===-1&&(_=y),Pe(i,r.slice(m,_),!0),w===44&&(Pe(e,d,i),i=Object.create(null),d=void 0),m=_=-1}else if(w===61&&m!==-1&&_===-1)h=r.slice(m,y),m=_=-1;else throw new SyntaxError(`Unexpected character at index ${y}`);else if(c){if(Ht[w]!==1)throw new SyntaxError(`Unexpected character at index ${y}`);m===-1?m=y:a||(a=!0),c=!1}else if(u)if(Ht[w]===1)m===-1&&(m=y);else if(w===34&&m!==-1)u=!1,_=y;else if(w===92)c=!0;else throw new SyntaxError(`Unexpected character at index ${y}`);else if(w===34&&r.charCodeAt(y-1)===61)u=!0;else if(_===-1&&Ht[w]===1)m===-1&&(m=y);else if(m!==-1&&(w===32||w===9))_===-1&&(_=y);else if(w===59||w===44){if(m===-1)throw new SyntaxError(`Unexpected character at index ${y}`);_===-1&&(_=y);let k=r.slice(m,_);a&&(k=k.replace(/\\/g,""),a=!1),Pe(i,h,k),w===44&&(Pe(e,d,i),i=Object.create(null),d=void 0),h=void 0,m=_=-1}else throw new SyntaxError(`Unexpected character at index ${y}`);if(m===-1||u||w===32||w===9)throw new SyntaxError("Unexpected end of input");_===-1&&(_=y);let A=r.slice(m,_);return d===void 0?Pe(e,A,i):(h===void 0?Pe(i,A,!0):a?Pe(i,h,A.replace(/\\/g,"")):Pe(i,h,A),Pe(e,d,i)),e}function Ux(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(c=>{let u=a[c];return Array.isArray(u)||(u=[u]),u.map(d=>d===!0?c:`${c}=${d}`).join("; ")})).join("; ")).join(", ")}).join(", ")}mo.exports={format:Ux,parse:Fx}});var Yn=ce((kh,Do)=>{"use strict";var Gx=X("events"),Kx=X("https"),Hx=X("http"),yo=X("net"),jx=X("tls"),{randomBytes:Wx,createHash:Jx}=X("crypto"),{Duplex:Ah,Readable:Ph}=X("stream"),{URL:Wr}=X("url"),Ve=mt(),Vx=Ur(),Yx=Hr(),{isBlob:$x}=wt(),{BINARY_TYPES:wo,CLOSE_TIMEOUT:Xx,EMPTY_BUFFER:Wn,GUID:Zx,kForOnEventAttribute:Jr,kListener:Qx,kStatusCode:eu,kWebSocket:ee,NOOP:bo}=Be(),{EventTarget:{addEventListener:tu,removeEventListener:nu}}=po(),{format:ru,parse:su}=jn(),{toBuffer:iu}=Ft(),vo=Symbol("kAborted"),Vr=[8,13],qe=["CONNECTING","OPEN","CLOSING","CLOSED"],ou=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,K=class r extends Gx{constructor(e,i,a){super(),this._binaryType=wo[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=Wn,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]),So(this,e,i,a)):(this._autoPong=a.autoPong,this._closeTimeout=a.closeTimeout,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(e){wo.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 c=new Vx({allowSynchronousEvents:a.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:a.maxPayload,skipUTF8Validation:a.skipUTF8Validation}),u=new Yx(e,this._extensions,a.generateMask);this._receiver=c,this._sender=u,this._socket=e,c[ee]=this,u[ee]=this,e[ee]=this,c.on("conclude",xu),c.on("drain",uu),c.on("error",du),c.on("message",fu),c.on("ping",lu),c.on("pong",hu),u.onerror=gu,e.setTimeout&&e.setTimeout(0),e.setNoDelay&&e.setNoDelay(),i.length>0&&e.unshift(i),e.on("close",Ao),e.on("data",Vn),e.on("end",Po),e.on("error",ko),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[Ve.extensionName]&&this._extensions[Ve.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){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,i,!this._isServer,a=>{a||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),Co(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){Yr(this,e,a);return}i===void 0&&(i=!this._isServer),this._sender.ping(e||Wn,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){Yr(this,e,a);return}i===void 0&&(i=!this._isServer),this._sender.pong(e||Wn,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){Yr(this,e,a);return}let c={binary:typeof e!="string",mask:!this._isServer,compress:!0,fin:!0,...i};this._extensions[Ve.extensionName]||(c.compress=!1),this._sender.send(e||Wn,c,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(K,"CONNECTING",{enumerable:!0,value:qe.indexOf("CONNECTING")});Object.defineProperty(K.prototype,"CONNECTING",{enumerable:!0,value:qe.indexOf("CONNECTING")});Object.defineProperty(K,"OPEN",{enumerable:!0,value:qe.indexOf("OPEN")});Object.defineProperty(K.prototype,"OPEN",{enumerable:!0,value:qe.indexOf("OPEN")});Object.defineProperty(K,"CLOSING",{enumerable:!0,value:qe.indexOf("CLOSING")});Object.defineProperty(K.prototype,"CLOSING",{enumerable:!0,value:qe.indexOf("CLOSING")});Object.defineProperty(K,"CLOSED",{enumerable:!0,value:qe.indexOf("CLOSED")});Object.defineProperty(K.prototype,"CLOSED",{enumerable:!0,value:qe.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(r=>{Object.defineProperty(K.prototype,r,{enumerable:!0})});["open","error","close","message"].forEach(r=>{Object.defineProperty(K.prototype,`on${r}`,{enumerable:!0,get(){for(let e of this.listeners(r))if(e[Jr])return e[Qx];return null},set(e){for(let i of this.listeners(r))if(i[Jr]){this.removeListener(r,i);break}typeof e=="function"&&this.addEventListener(r,e,{[Jr]:!0})}})});K.prototype.addEventListener=tu;K.prototype.removeEventListener=nu;Do.exports=K;function So(r,e,i,a){let c={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:Xx,protocolVersion:Vr[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=c.autoPong,r._closeTimeout=c.closeTimeout,!Vr.includes(c.protocolVersion))throw new RangeError(`Unsupported protocol version: ${c.protocolVersion} (supported versions: ${Vr.join(", ")})`);let u;if(e instanceof Wr)u=e;else try{u=new Wr(e)}catch{throw new SyntaxError(`Invalid URL: ${e}`)}u.protocol==="http:"?u.protocol="ws:":u.protocol==="https:"&&(u.protocol="wss:"),r._url=u.href;let d=u.protocol==="wss:",h=u.protocol==="ws+unix:",m;if(u.protocol!=="ws:"&&!d&&!h?m=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:h&&!u.pathname?m="The URL's pathname is empty":u.hash&&(m="The URL contains a fragment identifier"),m){let R=new SyntaxError(m);if(r._redirects===0)throw R;Jn(r,R);return}let w=d?443:80,_=Wx(16).toString("base64"),y=d?Kx.request:Hx.request,A=new Set,k;if(c.createConnection=c.createConnection||(d?cu:au),c.defaultPort=c.defaultPort||w,c.port=u.port||w,c.host=u.hostname.startsWith("[")?u.hostname.slice(1,-1):u.hostname,c.headers={...c.headers,"Sec-WebSocket-Version":c.protocolVersion,"Sec-WebSocket-Key":_,Connection:"Upgrade",Upgrade:"websocket"},c.path=u.pathname+u.search,c.timeout=c.handshakeTimeout,c.perMessageDeflate&&(k=new Ve({...c.perMessageDeflate,isServer:!1,maxPayload:c.maxPayload}),c.headers["Sec-WebSocket-Extensions"]=ru({[Ve.extensionName]:k.offer()})),i.length){for(let R of i){if(typeof R!="string"||!ou.test(R)||A.has(R))throw new SyntaxError("An invalid or duplicated subprotocol was specified");A.add(R)}c.headers["Sec-WebSocket-Protocol"]=i.join(",")}if(c.origin&&(c.protocolVersion<13?c.headers["Sec-WebSocket-Origin"]=c.origin:c.headers.Origin=c.origin),(u.username||u.password)&&(c.auth=`${u.username}:${u.password}`),h){let R=c.path.split(":");c.socketPath=R[0],c.path=R[1]}let T;if(c.followRedirects){if(r._redirects===0){r._originalIpc=h,r._originalSecure=d,r._originalHostOrSocketPath=h?c.socketPath:u.host;let R=a&&a.headers;if(a={...a,headers:{}},R)for(let[q,oe]of Object.entries(R))a.headers[q.toLowerCase()]=oe}else if(r.listenerCount("redirect")===0){let R=h?r._originalIpc?c.socketPath===r._originalHostOrSocketPath:!1:r._originalIpc?!1:u.host===r._originalHostOrSocketPath;(!R||r._originalSecure&&!d)&&(delete c.headers.authorization,delete c.headers.cookie,R||delete c.headers.host,c.auth=void 0)}c.auth&&!a.headers.authorization&&(a.headers.authorization="Basic "+Buffer.from(c.auth).toString("base64")),T=r._req=y(c),r._redirects&&r.emit("redirect",r.url,T)}else T=r._req=y(c);c.timeout&&T.on("timeout",()=>{fe(r,T,"Opening handshake has timed out")}),T.on("error",R=>{T===null||T[vo]||(T=r._req=null,Jn(r,R))}),T.on("response",R=>{let q=R.headers.location,oe=R.statusCode;if(q&&c.followRedirects&&oe>=300&&oe<400){if(++r._redirects>c.maxRedirects){fe(r,T,"Maximum redirects exceeded");return}T.abort();let te;try{te=new Wr(q,e)}catch{let xe=new SyntaxError(`Invalid URL: ${q}`);Jn(r,xe);return}So(r,te,i,a)}else r.emit("unexpected-response",T,R)||fe(r,T,`Unexpected server response: ${R.statusCode}`)}),T.on("upgrade",(R,q,oe)=>{if(r.emit("upgrade",R),r.readyState!==K.CONNECTING)return;T=r._req=null;let te=R.headers.upgrade;if(te===void 0||te.toLowerCase()!=="websocket"){fe(r,q,"Invalid Upgrade header");return}let ye=Jx("sha1").update(_+Zx).digest("base64");if(R.headers["sec-websocket-accept"]!==ye){fe(r,q,"Invalid Sec-WebSocket-Accept header");return}let xe=R.headers["sec-websocket-protocol"],P;if(xe!==void 0?A.size?A.has(xe)||(P="Server sent an invalid subprotocol"):P="Server sent a subprotocol but none was requested":A.size&&(P="Server sent no subprotocol"),P){fe(r,q,P);return}xe&&(r._protocol=xe);let F=R.headers["sec-websocket-extensions"];if(F!==void 0){if(!k){fe(r,q,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let J;try{J=su(F)}catch{fe(r,q,"Invalid Sec-WebSocket-Extensions header");return}let ne=Object.keys(J);if(ne.length!==1||ne[0]!==Ve.extensionName){fe(r,q,"Server indicated an extension that was not requested");return}try{k.accept(J[Ve.extensionName])}catch{fe(r,q,"Invalid Sec-WebSocket-Extensions header");return}r._extensions[Ve.extensionName]=k}r.setSocket(q,oe,{allowSynchronousEvents:c.allowSynchronousEvents,generateMask:c.generateMask,maxPayload:c.maxPayload,skipUTF8Validation:c.skipUTF8Validation})}),c.finishRequest?c.finishRequest(T,r):T.end()}function Jn(r,e){r._readyState=K.CLOSING,r._errorEmitted=!0,r.emit("error",e),r.emitClose()}function au(r){return r.path=r.socketPath,yo.connect(r)}function cu(r){return r.path=void 0,!r.servername&&r.servername!==""&&(r.servername=yo.isIP(r.host)?"":r.host),jx.connect(r)}function fe(r,e,i){r._readyState=K.CLOSING;let a=new Error(i);Error.captureStackTrace(a,fe),e.setHeader?(e[vo]=!0,e.abort(),e.socket&&!e.socket.destroyed&&e.socket.destroy(),process.nextTick(Jn,r,a)):(e.destroy(a),e.once("error",r.emit.bind(r,"error")),e.once("close",r.emitClose.bind(r)))}function Yr(r,e,i){if(e){let a=$x(e)?e.size:iu(e).length;r._socket?r._sender._bufferedBytes+=a:r._bufferedAmount+=a}if(i){let a=new Error(`WebSocket is not open: readyState ${r.readyState} (${qe[r.readyState]})`);process.nextTick(i,a)}}function xu(r,e){let i=this[ee];i._closeFrameReceived=!0,i._closeMessage=e,i._closeCode=r,i._socket[ee]!==void 0&&(i._socket.removeListener("data",Vn),process.nextTick(Eo,i._socket),r===1005?i.close():i.close(r,e))}function uu(){let r=this[ee];r.isPaused||r._socket.resume()}function du(r){let e=this[ee];e._socket[ee]!==void 0&&(e._socket.removeListener("data",Vn),process.nextTick(Eo,e._socket),e.close(r[eu])),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",r))}function _o(){this[ee].emitClose()}function fu(r,e){this[ee].emit("message",r,e)}function lu(r){let e=this[ee];e._autoPong&&e.pong(r,!this._isServer,bo),e.emit("ping",r)}function hu(r){this[ee].emit("pong",r)}function Eo(r){r.resume()}function gu(r){let e=this[ee];e.readyState!==K.CLOSED&&(e.readyState===K.OPEN&&(e._readyState=K.CLOSING,Co(e)),this._socket.end(),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",r)))}function Co(r){r._closeTimer=setTimeout(r._socket.destroy.bind(r._socket),r._closeTimeout)}function Ao(){let r=this[ee];if(this.removeListener("close",Ao),this.removeListener("data",Vn),this.removeListener("end",Po),r._readyState=K.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[ee]=void 0,clearTimeout(r._closeTimer),r._receiver._writableState.finished||r._receiver._writableState.errorEmitted?r.emitClose():(r._receiver.on("error",_o),r._receiver.on("finish",_o))}function Vn(r){this[ee]._receiver.write(r)||this.pause()}function Po(){let r=this[ee];r._readyState=K.CLOSING,r._receiver.end(),this.end()}function ko(){let r=this[ee];this.removeListener("error",ko),this.on("error",bo),r&&(r._readyState=K.CLOSING,this.destroy())}});var No=ce((Ih,Ro)=>{"use strict";var Dh=Yn(),{Duplex:pu}=X("stream");function Io(r){r.emit("close")}function mu(){!this.destroyed&&this._writableState.finished&&this.destroy()}function To(r){this.removeListener("error",To),this.destroy(),this.listenerCount("error")===0&&this.emit("error",r)}function wu(r,e){let i=!0,a=new pu({...e,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return r.on("message",function(u,d){let h=!d&&a._readableState.objectMode?u.toString():u;a.push(h)||r.pause()}),r.once("error",function(u){a.destroyed||(i=!1,a.destroy(u))}),r.once("close",function(){a.destroyed||a.push(null)}),a._destroy=function(c,u){if(r.readyState===r.CLOSED){u(c),process.nextTick(Io,a);return}let d=!1;r.once("error",function(m){d=!0,u(m)}),r.once("close",function(){d||u(c),process.nextTick(Io,a)}),i&&r.terminate()},a._final=function(c){if(r.readyState===r.CONNECTING){r.once("open",function(){a._final(c)});return}r._socket!==null&&(r._socket._writableState.finished?(c(),a._readableState.endEmitted&&a.destroy()):(r._socket.once("finish",function(){c()}),r.close()))},a._read=function(){r.isPaused&&r.resume()},a._write=function(c,u,d){if(r.readyState===r.CONNECTING){r.once("open",function(){a._write(c,u,d)});return}r.send(c,d)},a.on("end",mu),a.on("error",To),a}Ro.exports=wu});var $r=ce((Th,Lo)=>{"use strict";var{tokenChars:_u}=wt();function yu(r){let e=new Set,i=-1,a=-1,c=0;for(c;c<r.length;c++){let d=r.charCodeAt(c);if(a===-1&&_u[d]===1)i===-1&&(i=c);else if(c!==0&&(d===32||d===9))a===-1&&i!==-1&&(a=c);else if(d===44){if(i===-1)throw new SyntaxError(`Unexpected character at index ${c}`);a===-1&&(a=c);let h=r.slice(i,a);if(e.has(h))throw new SyntaxError(`The "${h}" subprotocol is duplicated`);e.add(h),i=a=-1}else throw new SyntaxError(`Unexpected character at index ${c}`)}if(i===-1||a!==-1)throw new SyntaxError("Unexpected end of input");let u=r.slice(i,c);if(e.has(u))throw new SyntaxError(`The "${u}" subprotocol is duplicated`);return e.add(u),e}Lo.exports={parse:yu}});var Uo=ce((Nh,Fo)=>{"use strict";var bu=X("events"),$n=X("http"),{Duplex:Rh}=X("stream"),{createHash:vu}=X("crypto"),Oo=jn(),rt=mt(),Su=$r(),Eu=Yn(),{CLOSE_TIMEOUT:Cu,GUID:Au,kWebSocket:Pu}=Be(),ku=/^[+/0-9A-Za-z]{22}==$/,Bo=0,Mo=1,qo=2,Xr=class extends bu{constructor(e,i){if(super(),e={allowSynchronousEvents:!0,autoPong:!0,maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:Cu,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:Eu,...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=$n.createServer((a,c)=>{let u=$n.STATUS_CODES[426];c.writeHead(426,{"Content-Length":u.length,"Content-Type":"text/plain"}),c.end(u)}),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=Du(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(c,u,d)=>{this.handleUpgrade(c,u,d,a)}})}e.perMessageDeflate===!0&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=Bo}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===qo){e&&this.once("close",()=>{e(new Error("The server is not running"))}),process.nextTick(jt,this);return}if(e&&this.once("close",e),this._state!==Mo)if(this._state=Mo,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(jt,this):process.nextTick(jt,this);else{let i=this._server;this._removeListeners(),this._removeListeners=this._server=null,i.close(()=>{jt(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,c){i.on("error",zo);let u=e.headers["sec-websocket-key"],d=e.headers.upgrade,h=+e.headers["sec-websocket-version"];if(e.method!=="GET"){st(this,e,i,405,"Invalid HTTP method");return}if(d===void 0||d.toLowerCase()!=="websocket"){st(this,e,i,400,"Invalid Upgrade header");return}if(u===void 0||!ku.test(u)){st(this,e,i,400,"Missing or invalid Sec-WebSocket-Key header");return}if(h!==13&&h!==8){st(this,e,i,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});return}if(!this.shouldHandle(e)){Wt(i,400);return}let m=e.headers["sec-websocket-protocol"],w=new Set;if(m!==void 0)try{w=Su.parse(m)}catch{st(this,e,i,400,"Invalid Sec-WebSocket-Protocol header");return}let _=e.headers["sec-websocket-extensions"],y={};if(this.options.perMessageDeflate&&_!==void 0){let A=new rt({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let k=Oo.parse(_);k[rt.extensionName]&&(A.accept(k[rt.extensionName]),y[rt.extensionName]=A)}catch{st(this,e,i,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let A={origin:e.headers[`${h===8?"sec-websocket-origin":"origin"}`],secure:!!(e.socket.authorized||e.socket.encrypted),req:e};if(this.options.verifyClient.length===2){this.options.verifyClient(A,(k,T,R,q)=>{if(!k)return Wt(i,T||401,R,q);this.completeUpgrade(y,u,w,e,i,a,c)});return}if(!this.options.verifyClient(A))return Wt(i,401)}this.completeUpgrade(y,u,w,e,i,a,c)}completeUpgrade(e,i,a,c,u,d,h){if(!u.readable||!u.writable)return u.destroy();if(u[Pu])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>Bo)return Wt(u,503);let w=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${vu("sha1").update(i+Au).digest("base64")}`],_=new this.options.WebSocket(null,void 0,this.options);if(a.size){let y=this.options.handleProtocols?this.options.handleProtocols(a,c):a.values().next().value;y&&(w.push(`Sec-WebSocket-Protocol: ${y}`),_._protocol=y)}if(e[rt.extensionName]){let y=e[rt.extensionName].params,A=Oo.format({[rt.extensionName]:[y]});w.push(`Sec-WebSocket-Extensions: ${A}`),_._extensions=e}this.emit("headers",w,c),u.write(w.concat(`\r
12
12
  `).join(`\r
13
- `)),x.removeListener("error",qo),b.setSocket(x,f,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(b),b.on("close",()=>{this.clients.delete(b),this._shouldEmitClose&&!this.clients.size&&process.nextTick(Kt,this)})),d(b,c)}};Uo.exports=Xr;function Pu(r,e){for(let i of Object.keys(e))r.on(i,e[i]);return function(){for(let o of Object.keys(e))r.removeListener(o,e[o])}}function Kt(r){r._state=Fo,r.emit("close")}function qo(){this.destroy()}function Gt(r,e,i,o){i=i||Vn.STATUS_CODES[e],o={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(i),...o},r.once("finish",r.destroy),r.end(`HTTP/1.1 ${e} ${Vn.STATUS_CODES[e]}\r
14
- `+Object.keys(o).map(c=>`${c}: ${o[c]}`).join(`\r
13
+ `)),u.removeListener("error",zo),_.setSocket(u,d,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(_),_.on("close",()=>{this.clients.delete(_),this._shouldEmitClose&&!this.clients.size&&process.nextTick(jt,this)})),h(_,c)}};Fo.exports=Xr;function Du(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 jt(r){r._state=qo,r.emit("close")}function zo(){this.destroy()}function Wt(r,e,i,a){i=i||$n.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} ${$n.STATUS_CODES[e]}\r
14
+ `+Object.keys(a).map(c=>`${c}: ${a[c]}`).join(`\r
15
15
  `)+`\r
16
16
  \r
17
- `+i)}function nt(r,e,i,o,c,x){if(r.listenerCount("wsClientError")){let f=new Error(c);Error.captureStackTrace(f,nt),r.emit("wsClientError",f,i,e)}else Gt(i,o,c,x)}});import{spawn as Yu}from"node:child_process";import{existsSync as Xu,openSync as $u}from"node:fs";import{mkdir as Qu}from"node:fs/promises";import{dirname as Zu}from"node:path";import{fileURLToPath as ef}from"node:url";function Zr(r=G()){return Xu(r.libEntry)?r.libEntry:ef(new URL("../index.ts",import.meta.url))}async function ta(r={}){let e=r.paths??G(),i=r.entryOverride??Zr(e);await Qu(Zu(e.logFile),{recursive:!0});let o=$u(e.logFile,"a"),x=i.endsWith(".ts")?["--import","tsx/esm",i,"--daemon"]:[i,"--daemon"],f=Yu(process.execPath,x,{detached:!0,stdio:["ignore",o,o],env:{...process.env,COZE_BRIDGE_DAEMON:"1"}});if(f.unref(),typeof f.pid!="number")throw new Error("failed to spawn daemon (no pid)");return tf.info("daemon spawned",{pid:f.pid,entry:i}),{pid:f.pid,entry:i}}var tf,es=De(()=>{"use strict";U();xe();tf=L("spawn-daemon")});import{spawn as uf}from"node:child_process";import{mkdir as ff,unlink as df,writeFile as lf}from"node:fs/promises";import{dirname as hf,join as gf}from"node:path";function er(r){return r.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function oa(r,e){return new Promise((i,o)=>{let c=uf(r,e,{stdio:["ignore","pipe","pipe"]}),x="";c.stderr?.on("data",f=>{x+=f.toString("utf8")}),c.on("error",o),c.on("close",f=>{f===0?i():o(new Error(`${r} ${e.join(" ")} exited ${f}: ${x.trim()}`))})})}var Zn,rs,ss,aa=De(()=>{"use strict";U();Zn=L("supervisor.launchd"),rs="ai.coze.bridge",ss={platform:"darwin",renderConfig(r){return`<?xml version="1.0" encoding="UTF-8"?>
17
+ `+i)}function st(r,e,i,a,c,u){if(r.listenerCount("wsClientError")){let d=new Error(c);Error.captureStackTrace(d,st),r.emit("wsClientError",d,i,e)}else Wt(i,a,c,u)}});import{spawn as $u}from"node:child_process";import{existsSync as Xu,openSync as Zu}from"node:fs";import{mkdir as Qu}from"node:fs/promises";import{dirname as ed}from"node:path";import{fileURLToPath as td}from"node:url";function es(r=j()){return Xu(r.libEntry)?r.libEntry:td(new URL("../index.ts",import.meta.url))}async function ea(r={}){let e=r.paths??j(),i=r.entryOverride??es(e);await Qu(ed(e.logFile),{recursive:!0});let a=Zu(e.logFile,"a"),u=i.endsWith(".ts")?["--import","tsx/esm",i,"--daemon"]:[i,"--daemon"],d=$u(process.execPath,u,{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 nd.info("daemon spawned",{pid:d.pid,entry:i}),{pid:d.pid,entry:i}}var nd,ts=Te(()=>{"use strict";G();ue();nd=N("spawn-daemon")});import{spawn as ud}from"node:child_process";import{mkdir as dd,unlink as fd,writeFile as ld}from"node:fs/promises";import{dirname as hd,join as gd}from"node:path";function nr(r){return r.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function ia(r,e){return new Promise((i,a)=>{let c=ud(r,e,{stdio:["ignore","pipe","pipe"]}),u="";c.stderr?.on("data",d=>{u+=d.toString("utf8")}),c.on("error",a),c.on("close",d=>{d===0?i():a(new Error(`${r} ${e.join(" ")} exited ${d}: ${u.trim()}`))})})}var tr,ss,is,oa=Te(()=>{"use strict";G();tr=N("supervisor.launchd"),ss="ai.coze.bridge",is={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>${rs}</string>
22
+ <string>${ss}</string>
23
23
  <key>ProgramArguments</key>
24
24
  <array>
25
- <string>${er(r.nodeBin)}</string>
26
- <string>${er(r.entry)}</string>
25
+ <string>${nr(r.nodeBin)}</string>
26
+ <string>${nr(r.entry)}</string>
27
27
  <string>--daemon</string>
28
28
  </array>
29
29
  <key>RunAtLoad</key>
@@ -33,12 +33,12 @@ var o0=Object.create;var wr=Object.defineProperty;var a0=Object.getOwnPropertyDe
33
33
  <key>ThrottleInterval</key>
34
34
  <integer>10</integer>
35
35
  <key>StandardOutPath</key>
36
- <string>${er(r.logFile)}</string>
36
+ <string>${nr(r.logFile)}</string>
37
37
  <key>StandardErrorPath</key>
38
- <string>${er(r.logFile)}</string>
38
+ <string>${nr(r.logFile)}</string>
39
39
  </dict>
40
40
  </plist>
41
- `},configPath(r){return gf(r.homeDir,"Library","LaunchAgents",`${rs}.plist`)},async install(r){let e=this.configPath(r);await ff(hf(e),{recursive:!0}),await lf(e,this.renderConfig(r),"utf8"),Zn.info("plist written",{plistPath:e}),await oa("launchctl",["load","-w",e]),Zn.info("launchd job loaded",{label:rs})},async uninstall(r){let e=this.configPath(r);await oa("launchctl",["unload","-w",e]).catch(i=>Zn.warn("launchctl unload failed (ignored)",{err:String(i)})),await df(e).catch(i=>{if(i.code!=="ENOENT")throw i}),Zn.info("launchd job removed",{plistPath:e})}}});import{spawn as pf}from"node:child_process";import{mkdir as mf,unlink as wf,writeFile as _f}from"node:fs/promises";import{dirname as yf,join as bf}from"node:path";function rr(r,e){return new Promise((i,o)=>{let c=pf(r,e,{stdio:["ignore","pipe","pipe"]}),x="";c.stderr?.on("data",f=>{x+=f.toString("utf8")}),c.on("error",o),c.on("close",f=>{f===0?i():o(new Error(`${r} ${e.join(" ")} exited ${f}: ${x.trim()}`))})})}var tr,nr,is,ca=De(()=>{"use strict";U();tr=L("supervisor.systemd"),nr="coze-bridge.service",is={platform:"linux",renderConfig(r){return`[Unit]
41
+ `},configPath(r){return gd(r.homeDir,"Library","LaunchAgents",`${ss}.plist`)},async install(r){let e=this.configPath(r);await dd(hd(e),{recursive:!0}),await ld(e,this.renderConfig(r),"utf8"),tr.info("plist written",{plistPath:e}),await ia("launchctl",["load","-w",e]),tr.info("launchd job loaded",{label:ss})},async uninstall(r){let e=this.configPath(r);await ia("launchctl",["unload","-w",e]).catch(i=>tr.warn("launchctl unload failed (ignored)",{err:String(i)})),await fd(e).catch(i=>{if(i.code!=="ENOENT")throw i}),tr.info("launchd job removed",{plistPath:e})}}});import{spawn as pd}from"node:child_process";import{mkdir as md,unlink as wd,writeFile as _d}from"node:fs/promises";import{dirname as yd,join as bd}from"node:path";function ir(r,e){return new Promise((i,a)=>{let c=pd(r,e,{stdio:["ignore","pipe","pipe"]}),u="";c.stderr?.on("data",d=>{u+=d.toString("utf8")}),c.on("error",a),c.on("close",d=>{d===0?i():a(new Error(`${r} ${e.join(" ")} exited ${d}: ${u.trim()}`))})})}var rr,sr,os,aa=Te(()=>{"use strict";G();rr=N("supervisor.systemd"),sr="coze-bridge.service",os={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 bf(r.homeDir,".config","systemd","user",nr)},async install(r){let e=this.configPath(r);await mf(yf(e),{recursive:!0}),await _f(e,this.renderConfig(r),"utf8"),tr.info("systemd unit written",{unitPath:e}),await rr("systemctl",["--user","daemon-reload"]),await rr("systemctl",["--user","enable","--now",nr]),tr.info("systemd unit enabled",{unitName:nr})},async uninstall(r){let e=this.configPath(r);await rr("systemctl",["--user","disable","--now",nr]).catch(i=>tr.warn("systemctl disable failed (ignored)",{err:String(i)})),await wf(e).catch(i=>{if(i.code!=="ENOENT")throw i}),await rr("systemctl",["--user","daemon-reload"]).catch(()=>{}),tr.info("systemd unit removed",{unitPath:e})}}});import{spawn as vf}from"node:child_process";import{join as Sf}from"node:path";function xa(r,e){return new Promise((i,o)=>{let c=vf(r,e,{stdio:["ignore","pipe","pipe"],shell:!1}),x="";c.stderr?.on("data",f=>{x+=f.toString("utf8")}),c.on("error",o),c.on("close",f=>{f===0?i():o(new Error(`${r} ${e.join(" ")} exited ${f}: ${x.trim()}`))})})}var os,sr,as,ua=De(()=>{"use strict";U();os=L("supervisor.taskscheduler"),sr="CozeBridge",as={platform:"win32",renderConfig(r){return`<?xml version="1.0" encoding="UTF-16"?>
55
+ `},configPath(r){return bd(r.homeDir,".config","systemd","user",sr)},async install(r){let e=this.configPath(r);await md(yd(e),{recursive:!0}),await _d(e,this.renderConfig(r),"utf8"),rr.info("systemd unit written",{unitPath:e}),await ir("systemctl",["--user","daemon-reload"]),await ir("systemctl",["--user","enable","--now",sr]),rr.info("systemd unit enabled",{unitName:sr})},async uninstall(r){let e=this.configPath(r);await ir("systemctl",["--user","disable","--now",sr]).catch(i=>rr.warn("systemctl disable failed (ignored)",{err:String(i)})),await wd(e).catch(i=>{if(i.code!=="ENOENT")throw i}),await ir("systemctl",["--user","daemon-reload"]).catch(()=>{}),rr.info("systemd unit removed",{unitPath:e})}}});import{spawn as vd}from"node:child_process";import{join as Sd}from"node:path";function ca(r,e){return new Promise((i,a)=>{let c=vd(r,e,{stdio:["ignore","pipe","pipe"],shell:!1}),u="";c.stderr?.on("data",d=>{u+=d.toString("utf8")}),c.on("error",a),c.on("close",d=>{d===0?i():a(new Error(`${r} ${e.join(" ")} exited ${d}: ${u.trim()}`))})})}var as,or,cs,xa=Te(()=>{"use strict";G();as=N("supervisor.taskscheduler"),or="CozeBridge",cs={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,22 +76,22 @@ WantedBy=default.target
76
76
  </Exec>
77
77
  </Actions>
78
78
  </Task>
79
- `},configPath(r){return Sf(r.homeDir,".coze","bridge","task.xml")},async install(r){let e=`"${r.nodeBin}" "${r.entry}" --daemon`;await xa("schtasks",["/Create","/SC","ONLOGON","/TN",sr,"/TR",e,"/RU",r.userName,"/F"]),os.info("task scheduler entry created",{task:sr})},async uninstall(r){await xa("schtasks",["/Delete","/TN",sr,"/F"]).catch(e=>os.warn("schtasks /Delete failed (ignored)",{err:String(e)})),os.info("task scheduler entry removed",{task:sr})}}});var cs={};Ns(cs,{buildContext:()=>kf,getSupervisor:()=>Af,launchdSupervisor:()=>ss,systemdSupervisor:()=>is,taskSchedulerSupervisor:()=>as});import{homedir as Cf,userInfo as Ef}from"node:os";function Af(r=process.platform){switch(r){case"darwin":return ss;case"linux":return is;case"win32":return as;default:throw new Error(`unsupported platform for OS supervisor: ${r}`)}}function kf(){let r=G();return{nodeBin:process.execPath,entry:Zr(r),logFile:r.logFile,homeDir:Cf(),userName:Ef().username}}var xs=De(()=>{"use strict";xe();es();aa();ca();ua()});Ue();U();import{readdir as k0}from"node:fs/promises";import{mkdir as v0,writeFile as S0}from"node:fs/promises";import{join as C0}from"node:path";var E0={"claude-code":"CLAUDE.md",codex:"AGENTS.md",openclaw:"SOUL.md"};async function ct(r,e,i,o){await v0(r,{recursive:!0});let c=E0[e],x=C0(r,c),f=A0(e,i,o);return await S0(x,f,"utf8"),x}function A0(r,e,i){let o=`# Coze Agent: ${e}
79
+ `},configPath(r){return Sd(r.homeDir,".coze","bridge","task.xml")},async install(r){let e=`"${r.nodeBin}" "${r.entry}" --daemon`;await ca("schtasks",["/Create","/SC","ONLOGON","/TN",or,"/TR",e,"/RU",r.userName,"/F"]),as.info("task scheduler entry created",{task:or})},async uninstall(r){await ca("schtasks",["/Delete","/TN",or,"/F"]).catch(e=>as.warn("schtasks /Delete failed (ignored)",{err:String(e)})),as.info("task scheduler entry removed",{task:or})}}});var xs={};Ns(xs,{buildContext:()=>Pd,getSupervisor:()=>Ad,launchdSupervisor:()=>is,systemdSupervisor:()=>os,taskSchedulerSupervisor:()=>cs});import{homedir as Ed,userInfo as Cd}from"node:os";function Ad(r=process.platform){switch(r){case"darwin":return is;case"linux":return os;case"win32":return cs;default:throw new Error(`unsupported platform for OS supervisor: ${r}`)}}function Pd(){let r=j();return{nodeBin:process.execPath,entry:es(r),logFile:r.logFile,homeDir:Ed(),userName:Cd().username}}var us=Te(()=>{"use strict";ue();ts();oa();aa();xa()});Ke();G();import{readdir as A0}from"node:fs/promises";import{mkdir as b0,writeFile as v0}from"node:fs/promises";import{join as S0}from"node:path";var E0={"claude-code":"CLAUDE.md",codex:"AGENTS.md",openclaw:"SOUL.md"};async function ut(r,e,i,a){await b0(r,{recursive:!0});let c=E0[e],u=S0(r,c),d=C0(e,i,a);return await v0(u,d,"utf8"),u}function C0(r,e,i){let a=`# Coze Agent: ${e}
80
80
 
81
81
  > framework: \`${r}\`
82
82
 
83
83
  `,c=i?.trim()?i.endsWith(`
84
84
  `)?i:`${i}
85
85
  `:`_No instructions provided._
86
- `;return`${o}---
86
+ `;return`${a}---
87
87
 
88
- ${c}`}var ve=L("agent-detail-sync"),nn=class{constructor(e){this.opts=e}opts;async syncAll(e){let i=this.opts.paths.agentsRoot,o;try{o=await k0(i)}catch(c){ve.info("agents dir not found, skip detail sync",{root:i,err:String(c)});return}ve.info("starting detail sync",{reason:e,count:o.length});for(let c of o)try{await this.syncOne(c)}catch(x){ve.warn("detail sync failed for agent, skipping",{agentId:c,err:String(x)})}ve.info("detail sync done",{reason:e})}async syncOne(e){let i=await ue(e,this.opts.paths);if(!i){ve.info("detail sync: agent config missing, skip",{agentId:e});return}let o;try{o=await this.opts.sendDetail({_meta:{cozeAgentId:e}})}catch(f){ve.warn("detail RPC failed, using local data",{agentId:e,err:String(f)});return}if(o.agentId&&o.agentId!==e){ve.warn("detail response agentId mismatch, ignoring",{agentId:e,responseAgentId:o.agentId});return}let c=!1,x=!1;if(o.agentName&&o.agentName!==i.agentName&&(i.agentName=o.agentName,c=!0),o.description!==void 0&&o.description!==i.description&&(i.description=o.description,c=!0),o.cozeIdentity&&o.cozeIdentity!==i.cozeIdentity&&(i.cozeIdentity=o.cozeIdentity,c=!0,x=!0),o.deployType&&ve.info("detail.deployType",{agentId:e,deployType:o.deployType}),!c){ve.debug("detail sync: no diff",{agentId:e});return}await me(i,this.opts.paths),ve.info("detail sync: config updated",{agentId:e,identityChanged:x,agentName:i.agentName}),x&&(await ct(i.workspace,i.framework,e,i.cozeIdentity),await this.opts.handlers.reloadAgentSessionsPublic(e,"detail-sync"))}};Ue();import{spawn as si}from"node:child_process";import{lstat as Cr,mkdir as T0,readFile as ii,readdir as L0,rm as R0,stat as N0,writeFile as O0}from"node:fs/promises";import{join as Re,normalize as B0,relative as oi,resolve as M0,sep as ai}from"node:path";var Se={PAIR:"_agent/pair",CREATE:"_agent/create",HEALTH:"_agent/health",LIST_SKILLS:"_agent/listSkills",ADD_SKILLS:"_agent/addSkills",REMOVE_SKILLS:"_agent/removeSkills",GET_FILE_TREE:"_agent/getFileTree",GET_FILE_CONTENT:"_agent/getFileContent",DETAIL:"_agent/detail",UPDATE:"_agent/update",DISCONNECT:"_agent/disconnect",SWITCH_MODEL:"_agent/switchModel",GEN_MODEL_TOKEN:"_agent/genModelToken",RESET:"_agent/reset",REPAIR:"_agent/repair",DELETE:"_agent/delete"};function At(r){return r?.cozeDeployType==="cloud"?"cloud":"local"}function Us(r){let{_meta:e,...i}=r;return{stripped:i,meta:e}}function xt(r){if(!r?.cozeAgentId)throw new Error("missing _meta.cozeAgentId");return r.cozeAgentId}var E=class extends Error{code;retriable;cause;constructor(e,i,o){super(i),this.name="BridgeError",this.code=e,this.retriable=o?.retriable??!1,o?.cause!==void 0&&(this.cause=o.cause)}};U();xe();function Le(r,e){if(At(r)!=="cloud")throw new E("OPERATION_NOT_ALLOWED_FOR_LOCAL",`${e} is not allowed for local agent`)}function kt(r){return r.replace(/[^A-Za-z0-9._-]+/g,"-")}U();var rn="1008033",Hs="1289";var Ks="pbbp2",Gs="https://www.coze.cn",Ws="/api/coze_claw/resource/get_frontier_key",P0="https://www.coze.cn",D0="wss://frontier.coze.cn";function js(r){return r??process.env.COZE_BRIDGE_HANDSHAKE_URL??P0}function Js(r){return r??process.env.COZE_BRIDGE_FRONTIER_URL??D0}function sn(r){let e={},i=r?.ttEnv??process.env.COZE_BRIDGE_TT_ENV,o=r?.usePpe??process.env.COZE_BRIDGE_USE_PPE;return i&&(e["x-tt-env"]=i),o&&(e["x-use-ppe"]=o),e}function on(r){return r?r.startsWith("boe_")?{ttEnv:r}:{ttEnv:r,usePpe:"1"}:{}}var Vs=L("handshake");async function Ys(r){let e=js(r.endpoint),i=r.timeoutMs??1e4,o=`${I0(e)}${Ws}?aid=${encodeURIComponent(rn)}`,c={Authorization:`Bearer ${r.privatecode}`,Accept:"application/json",...sn(r.ppeOverride)},x=new AbortController,f=setTimeout(()=>x.abort(),i);Vs.info("frontier key handshake",{base:e});try{let d=await fetch(o,{method:"GET",headers:c,signal:x.signal}),g=d.headers.get("x-tt-logid")??"",w=d.headers.get("x-tt-trace-id")??"";if(!d.ok){let P=await d.text().catch(()=>"");throw new E("UPSTREAM_HANDSHAKE_FAILED",`handshake HTTP ${d.status} logid=${g}: ${P.slice(0,200)}`)}let b=await d.json();if(b.code!==void 0&&b.code!==0)throw new E("UPSTREAM_HANDSHAKE_FAILED",`handshake code=${b.code} msg=${b.msg??"-"} logid=${g}`);let y=b.data?.access_key,C=b.data?.device_id;if(!y||!C)throw new E("UPSTREAM_HANDSHAKE_FAILED",`handshake response missing access_key/device_id logid=${g}: ${JSON.stringify(b)}`);return Vs.info("handshake ok",{remoteDeviceId:C,logid:g,traceId:w}),{accessKey:y,deviceId:C}}catch(d){throw d instanceof E?d:d.name==="AbortError"?new E("UPSTREAM_HANDSHAKE_FAILED",`handshake timeout (${i}ms)`):new E("UPSTREAM_HANDSHAKE_FAILED",String(d),{cause:d})}finally{clearTimeout(f)}}function I0(r){return r.endsWith("/")?r.slice(0,-1):r}var br="https://llm-gateway.coze.cn",He="auto";function Xs(r){return{model:r.model??He,...r.modelToken?{modelToken:r.modelToken}:{}}}function Pt(r){return!r||r===He}function $s(r){let e={};return r.modelToken?(e.ANTHROPIC_BASE_URL=br,e.ANTHROPIC_AUTH_TOKEN=r.modelToken,e.ANTHROPIC_MODEL=r.model||He):Pt(r.model)||(e.ANTHROPIC_MODEL=r.model),e}function Qs(r){let e=[];return r.modelToken?e.push("-c",`model="${r.model||He}"`):Pt(r.model)||e.push("-c",`model="${r.model}"`),r.modelToken&&(e.push("-c",'model_providers.coze.name="coze"'),e.push("-c",`model_providers.coze.base_url="${br}/v1"`),e.push("-c",'model_providers.coze.env_key="OPENAI_API_KEY"'),e.push("-c",'model_providers.coze.wire_api="responses"'),e.push("-c","model_providers.coze.requires_openai_auth=false"),e.push("-c","model_providers.coze.supports_websockets=false"),e.push("-c",'model_provider="coze"')),e}function Zs(r){return r.modelToken?{OPENAI_API_KEY:r.modelToken}:{}}function vr(r){let{ttEnv:e,usePpe:i}=on(r),o={};return e&&(o["x-tt-env"]=e),i&&(o["x-use-ppe"]=i),o}function ei(r,e){if(!r.modelToken)return{};let i=vr(e);return Object.keys(i).length===0?{}:{ANTHROPIC_CUSTOM_HEADERS:Object.entries(i).map(([c,x])=>`${c}:${x}`).join(`
89
- `)}}function Sr(r){return`coze-session-${r.replace(/[^A-Za-z0-9_-]+/g,"-")}`}function ti(r,e){if(!r.modelToken||Pt(r.model))return null;let i=vr(e),o={baseUrl:`${br}/v1`,api:"openai-completions",apiKey:r.modelToken,models:[{id:r.model,name:r.model,reasoning:!1,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8192,api:"openai-completions"}]};return Object.keys(i).length>0&&(o.headers=i),o}function ni(r,e){if(!r.modelToken)return[];let i=vr(e),o=[];for(let[c,x]of Object.entries(i))o.push("-c",`model_providers.coze.http_headers.${c}="${x}"`);return o}var te=L("agent-handlers"),ri=5*1024*1024,z0=1,q0=6,F0=new Set(["node_modules",".git",".coze","dist","build",".next"]),cn=class{constructor(e){this.opts=e}opts;async listSkills(e){Le(e._meta,"_agent/listSkills");let i=xt(e._meta),o=await this.loadAgentCfg(i),c=o?.workspace??Te(i).workspace,x=o?.skills??[],f=[];for(let d of x){let g=Re(c,d.relPath,"SKILL.md");await N0(g).then(b=>b.isFile()).catch(()=>!1)&&f.push({skillId:d.skillId,skillName:d.skillName,downloadUrl:d.downloadUrl??"",...d.description?{description:d.description}:{},...d.version?{version:d.version}:{}})}return{skills:f}}async addSkills(e){Le(e._meta,"_agent/addSkills");let i=xt(e._meta),o=await this.requireAgentCfg(i),c=e.skills??[],x=[...o.skills??[]],f=new Map(x.map((g,w)=>[g.skillId,w])),d=[];for(let g of c){if(!g.skillName)throw new E("IPC_BAD_REQUEST","skill missing skillName");let w=U0(g.skillName),b=H0(o.framework),y=Re(b,w),C=Re(o.workspace,y);await T0(C,{recursive:!0});let P=await W0(g.downloadUrl);J0(P)?await V0(P,C):await O0(Re(C,"SKILL.md"),P.toString("utf8"),"utf8");let I={skillId:g.skillId,skillName:g.skillName,relPath:y,installedAt:Date.now(),...g.description?{description:g.description}:{},...g.version?{version:g.version}:{},...g.downloadUrl?{downloadUrl:g.downloadUrl}:{}},T=f.get(g.skillId);T!==void 0?x[T]=I:(f.set(g.skillId,x.length),x.push(I)),d.push(g),te.info("skill installed",{agentId:i,skillId:g.skillId,skillName:g.skillName,relPath:y})}return await en(i,x),await this.reloadAgentSessions(i,"skills-added"),{installedSkills:d}}async removeSkills(e){Le(e._meta,"_agent/removeSkills");let i=xt(e._meta),o=await this.requireAgentCfg(i),c=new Set(e.skillIds??[]),x=o.skills??[],f=[];for(let d of x){if(!c.has(d.skillId)){f.push(d);continue}let g=Re(o.workspace,d.relPath);await R0(g,{recursive:!0,force:!0}),te.info("skill removed",{agentId:i,skillId:d.skillId,relPath:d.relPath})}return await en(i,f),await this.reloadAgentSessions(i,"skills-removed"),{ok:!0}}reloadAgentSessionsPublic(e,i){return this.reloadAgentSessions(e,i)}async reloadAgentSessions(e,i){let o=this.opts.agents.get(e);if(o&&o.framework!=="codex"){for(let[c,x]of o.sessions)if(!(!x.downstream||!x.acpSessionId)){x.loadingSession=!0;try{await x.downstream.sessionLoad({sessionId:x.acpSessionId,cwd:o.workspace}),te.info("session reloaded",{reason:i,agentId:e,framework:o.framework,cloudId:c,acpId:x.acpSessionId})}catch(f){te.warn("session reload failed",{reason:i,agentId:e,framework:o.framework,cloudId:c,acpId:x.acpSessionId,err:String(f)})}finally{x.loadingSession=!1}}}}async updateAgent(e){if(!e.cozeIdentity?.trim())return te.info("_agent/update: empty cozeIdentity, noop",{agentId:e.agentId}),{ok:!0};let i=e.agentId,o=await ue(i);if(!o)throw new E("AGENT_NOT_FOUND",`agent not found: ${i}`);return o.cozeIdentity===e.cozeIdentity?(te.info("_agent/update: cozeIdentity unchanged, noop",{agentId:i}),{ok:!0}):(o.cozeIdentity=e.cozeIdentity,await me(o),await ct(o.workspace,o.framework,i,e.cozeIdentity),te.info("_agent/update: cozeIdentity rewritten",{agentId:i,framework:o.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 o=await ue(i);return o?(o.disconnectedAt=Date.now(),o.disconnectReason=e.reason??"",await me(o),te.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}):(te.warn("_agent/disconnect: agent not found, ignoring",{agentId:i}),{ok:!0})}async switchModel(e){if(Le(e._meta,"_agent/switchModel"),!e.agentId)throw new E("IPC_BAD_REQUEST","_agent/switchModel: missing agentId");let i=e.model?.trim()?e.model:He,o=await ue(e.agentId);if(!o)throw new E("AGENT_NOT_FOUND",`agent not found: ${e.agentId}`);o.model=i,await me(o),te.info("_agent/switchModel: model persisted",{agentId:e.agentId,model:i,reason:e.reason??""});let c=this.opts.agents.get(e.agentId);if(!c)return te.info("_agent/switchModel: agent not running, config persisted only",{agentId:e.agentId}),{ok:!0};c.model=i;let x=[];for(let[f,d]of c.allSessionQueues())x.push(d.enqueue(async()=>{let g=c.sessions.get(f);g?.downstream&&(await g.downstream.stop(`switchModel: ${i}`).catch(()=>{}),g.downstream=void 0)}));return await Promise.all(x),te.info("_agent/switchModel: all session runtimes killed, next prompt will respawn",{agentId:e.agentId,model:i,cloudSessions:x.length}),{ok:!0}}async resetAgent(e){if(Le(e._meta,Se.RESET),!e.agentId)throw new E("IPC_BAD_REQUEST",`${Se.RESET}: missing agentId`);return await this.runDetailSync(e.agentId,Se.RESET,e.reason),{ok:!0}}async repairAgent(e){if(Le(e._meta,Se.REPAIR),!e.agentId)throw new E("IPC_BAD_REQUEST",`${Se.REPAIR}: missing agentId`);let i=await this.loadAgentCfg(e.agentId);if(i&&i.framework!=="openclaw")throw new E("IPC_BAD_REQUEST",`${Se.REPAIR} only allowed for openclaw, got ${i.framework}`);if(i&&this.opts.openclawRepair)try{await this.opts.openclawRepair(e.agentId,i.workspace)}catch(o){te.warn("openclaw repair (delete+add) failed (ignored)",{agentId:e.agentId,reason:e.reason,err:String(o)})}return await this.runDetailSync(e.agentId,Se.REPAIR,e.reason),{ok:!0}}async runDetailSync(e,i,o){if(!this.opts.detailSyncer){te.warn("detailSyncer not wired, skipping sync",{method:i,agentId:e});return}try{await this.opts.detailSyncer(e)}catch(c){te.warn("detail sync failed (ignored)",{method:i,agentId:e,reason:o,err:String(c)})}}async getFileTree(e){Le(e._meta,"_agent/getFileTree");let i=e._meta,o=xt(i),c=await this.resolveWorkspace(o),x=e.filePath??"",f=this.safeJoin(c,x),d=await Cr(f).catch(()=>null);if(!d)throw new E("IPC_BAD_REQUEST",`path not found: ${x}`);if(d.isSymbolicLink())throw new E("IPC_BAD_REQUEST",`symlink not allowed: ${x}`);let g=X0(e.depth);return d.isDirectory()?{tree:await ci(c,f,x,g)}:{tree:[{name:$0(x),path:xi(x||"."),isDir:!1,size:d.size,modifiedAt:Math.floor(d.mtimeMs)}]}}async getFileContent(e){Le(e._meta,"_agent/getFileContent");let i=xt(e._meta),o=await this.resolveWorkspace(i);if(!e.filePath)throw new E("IPC_BAD_REQUEST","filePath required");let c=this.safeJoin(o,e.filePath),x=await Cr(c).catch(()=>null);if(!x||!x.isFile())throw new E("IPC_BAD_REQUEST",`not a file: ${e.filePath}`);if(x.isSymbolicLink())throw new E("IPC_BAD_REQUEST",`symlink not allowed: ${e.filePath}`);if(x.size>ri)throw new E("IPC_BAD_REQUEST",`file too large: ${x.size} bytes (max ${ri})`);let f=await ii(c);return f.includes(0)?{content:f.toString("base64"),encoding:"base64",size:x.size}:{content:f.toString("utf8"),encoding:"utf-8",size:x.size}}async resolveWorkspace(e){let i=this.opts.agents.get(e);return i?i.workspace:(await ue(e).catch(()=>null))?.workspace??Te(e).workspace}safeJoin(e,i){let o=M0(e,i||"."),c=oi(e,o);if(c.startsWith("..")||c===".."||c.startsWith(`..${ai}`))throw new E("IPC_BAD_REQUEST",`path escapes workspace: ${i}`);return o}loadAgentCfg(e){return ue(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 U0(r){let e=kt(r.trim()).replace(/^-+|-+$/g,"").slice(0,64);if(!e||e==="."||e==="..")throw new E("IPC_BAD_REQUEST",`invalid skill name: ${r}`);return e}function H0(r){return r==="claude-code"?Re(".claude","skills"):Re(".agents","skills")}var K0=3e4,G0=50*1024*1024,xn=3e4;async function W0(r){if(!r)throw new E("IPC_BAD_REQUEST","skill missing downloadUrl");if(r.startsWith("data:")){let e=Math.floor(r.length*3/4);an(e);let i=j0(r);return an(i.length),i}if(r.startsWith("file:")){let e=new URL(r).pathname,i=await ii(e);return an(i.length),i}if(r.startsWith("http://")||r.startsWith("https://")){let e=new AbortController,i=setTimeout(()=>e.abort(),K0);try{let o=await fetch(r,{signal:e.signal});if(!o.ok)throw new E("IPC_BAD_REQUEST",`fetch skill failed HTTP ${o.status} ${r}`);let c=await o.arrayBuffer();return an(c.byteLength),Buffer.from(c)}finally{clearTimeout(i)}}throw new E("IPC_BAD_REQUEST",`unsupported downloadUrl scheme (\u8981 https/data/file): ${r.slice(0,80)}`)}function an(r){if(r>G0)throw new E("IPC_BAD_REQUEST",`skill too large: ${r} bytes`)}function j0(r){let e=/^data:([^,;]*)(;base64)?,(.*)$/s.exec(r);if(!e)throw new E("IPC_BAD_REQUEST","bad data URL");let i=!!e[2],o=e[3]??"";return i?Buffer.from(o,"base64"):Buffer.from(decodeURIComponent(o),"utf8")}function J0(r){return r.length>=2&&r[0]===31&&r[1]===139}async function V0(r,e){await Y0(r),await new Promise((i,o)=>{let c=si("tar",["-xzf","-","-C",e,"--strip-components=1","--no-same-owner"],{stdio:["pipe","pipe","pipe"]}),x="";c.stderr?.on("data",d=>{x+=String(d)});let f=setTimeout(()=>{c.kill("SIGKILL"),o(new E("IPC_BAD_REQUEST",`tar extract timeout (${xn}ms)`))},xn);c.on("error",d=>{clearTimeout(f),o(new E("IPC_BAD_REQUEST",`tar spawn failed: ${d.message}`,{cause:d}))}),c.on("exit",d=>{clearTimeout(f),d===0?i():o(new E("IPC_BAD_REQUEST",`tar exit ${d}${x?`: ${x.trim().slice(0,200)}`:""}`))}),c.stdin?.end(r)})}async function Y0(r){let e=await new Promise((i,o)=>{let c=si("tar",["-tzvf","-"],{stdio:["pipe","pipe","pipe"]}),x="",f="";c.stdout?.on("data",g=>{x+=String(g)}),c.stderr?.on("data",g=>{f+=String(g)});let d=setTimeout(()=>{c.kill("SIGKILL"),o(new E("IPC_BAD_REQUEST",`tar list timeout (${xn}ms)`))},xn);c.on("error",g=>{clearTimeout(d),o(new E("IPC_BAD_REQUEST",`tar list spawn failed: ${g.message}`))}),c.on("exit",g=>{clearTimeout(d),g===0?i(x):o(new E("IPC_BAD_REQUEST",`tar list exit ${g}${f?`: ${f.trim().slice(0,200)}`:""}`))}),c.stdin?.end(r)});for(let i of e.split(`
90
- `)){let o=i.trim();if(!o)continue;let c=o.charCodeAt(0);if(c!==45&&c!==100)throw new E("IPC_BAD_REQUEST",`tar entry kind '${o[0]}' not allowed (symlink/hardlink/special): ${o.slice(0,100)}`);let f=(o.match(/\s(\S.*)$/)?.[1]??"").split(" -> ")[0]?.trim()??"";if(!f)continue;if(f.startsWith("/"))throw new E("IPC_BAD_REQUEST",`tar entry absolute path: ${f}`);if(f.split(/[/\\]/).some(g=>g===".."))throw new E("IPC_BAD_REQUEST",`tar entry contains '..': ${f}`)}}async function ci(r,e,i,o){if(o<=0)return[];let c;try{c=await L0(e,{withFileTypes:!0})}catch{return[]}let x=[];for(let f of c){if(F0.has(f.name)||f.isSymbolicLink())continue;let d=Re(e,f.name),g=B0(Re(i,f.name)),w=null;try{w=await Cr(d)}catch{continue}if(w.isSymbolicLink())continue;let b={name:f.name,path:xi(oi(r,d)),isDir:w.isDirectory(),size:w.size,modifiedAt:Math.floor(w.mtimeMs)};w.isDirectory()&&o>1&&(b.children=await ci(r,d,g,o-1)),x.push(b)}return x.sort((f,d)=>f.isDir!==d.isDir?f.isDir?-1:1:f.name.localeCompare(d.name)),x}function X0(r){return!r||r<=0?z0:Math.min(r,q0)}function $0(r){if(!r||r==="."||r==="/")return".";let e=r.split(/[/\\]/);return e[e.length-1]||"."}function xi(r){return r.split(ai).join("/")}U();var Dt=L("agent-health-reporter"),Q0=1e4,un=class{constructor(e){this.opts=e;this.intervalMs=e.intervalMs??Q0}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=[];for(let c of this.opts.core.agents.values()){let x=Z0(c);x&&i.push({agentId:c.agentId,status:x})}if(i.length===0)return;let o={agents:i,_meta:{cozeDeviceId:e}};try{await this.opts.core.sendRequest("_agent/health",o)}catch(c){Dt.warn("heartbeat batch send failed",{count:i.length,err:String(c)})}}finally{this.inFlight=!1}}};function Z0(r){return r.status==="error"?"error":r.activeTriggers.size>0?"busy":r.status==="ok"?"online":null}Ue();import{mkdir as Ar,rm as Cc}from"node:fs/promises";U();import{execFile as ec}from"node:child_process";import{promisify as tc}from"node:util";var fi=tc(ec),It=L("agents.acp-installer"),nc={"claude-code":{npmPackage:"@agentclientprotocol/claude-agent-acp",binary:"claude-agent-acp"},codex:{npmPackage:"@zed-industries/codex-acp",binary:"codex-acp"}},rc=5e4,sc=5e3,ic=5*6e4,dn=new Map,fn=new Map,Er=new Map;async function ui(r){let e=process.platform==="win32"?"where":"which";try{let{stdout:i}=await fi(e,[r],{timeout:sc});return i.split(`
91
- `)[0]?.trim()||void 0}catch{return}}async function oc(r){It.info("npm install -g start",{npmPackage:r}),await fi("npm",["install","-g",`${r}@latest`],{timeout:rc,maxBuffer:10*1024*1024}),It.info("npm install -g done",{npmPackage:r})}async function di(r){let e=nc[r];if(!e)return;let i=dn.get(r);if(i)return i;let o=fn.get(r);if(o&&Date.now()-o<ic)return;let c=Er.get(r);if(c)return c;let x=(async()=>{let f=await ui(e.binary);if(f)return dn.set(r,f),It.info("acp wrapper found on PATH",{binary:e.binary,path:f}),f;try{await oc(e.npmPackage)}catch(g){It.warn("acp wrapper install failed (will fallback to npx)",{npmPackage:e.npmPackage,err:String(g)}),fn.set(r,Date.now());return}let d=await ui(e.binary);if(!d){It.warn("acp wrapper installed but binary not found on PATH",{binary:e.binary}),fn.set(r,Date.now());return}return dn.set(r,d),fn.delete(r),d})().finally(()=>{Er.delete(r)});return Er.set(r,x),x}function ln(r){return dn.get(r)}import{spawn as fc}from"node:child_process";function Tt(r,e,i){return i===void 0?{jsonrpc:"2.0",id:r,method:e}:{jsonrpc:"2.0",id:r,method:e,params:i}}function hn(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 gn=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)}},W={PARSE_ERROR:-32700,INVALID_REQUEST:-32600,METHOD_NOT_FOUND:-32601,INVALID_PARAMS:-32602,INTERNAL_ERROR:-32603,AGENT_NOT_FOUND:-32001,AGENT_BUSY:-32002,AGENT_TIMEOUT:-32003,AGENT_SPAWN_FAILED:-32004,OPERATION_NOT_ALLOWED_FOR_LOCAL:-32005,AGENT_DISCONNECTED:-32006,MODEL_TOKEN_GEN_FAILED:-32009};function li(r){return"method"in r&&"id"in r&&r.id!==void 0}function hi(r){return"method"in r&&!("id"in r)}function pn(r){return!("method"in r)&&"id"in r}var ac={AGENT_NOT_FOUND:W.AGENT_NOT_FOUND,AGENT_BUSY:W.AGENT_BUSY,AGENT_DISCONNECTED:W.AGENT_DISCONNECTED,AGENT_TIMEOUT:W.AGENT_TIMEOUT,AGENT_SPAWN_FAILED:W.AGENT_SPAWN_FAILED,AGENT_PROTOCOL_ERROR:W.INTERNAL_ERROR,BRIDGE_CONFIG_INVALID:W.INTERNAL_ERROR,BRIDGE_INTERNAL:W.INTERNAL_ERROR,IPC_AUTH_FAILED:W.INTERNAL_ERROR,IPC_BAD_REQUEST:W.INVALID_REQUEST,MODEL_TOKEN_GEN_FAILED:W.MODEL_TOKEN_GEN_FAILED,OPERATION_NOT_ALLOWED_FOR_LOCAL:W.OPERATION_NOT_ALLOWED_FOR_LOCAL,UPSTREAM_DISCONNECTED:W.INTERNAL_ERROR,UPSTREAM_HANDSHAKE_FAILED:W.INTERNAL_ERROR};function mn(r){return r instanceof E?{code:ac[r.code]??W.INTERNAL_ERROR,message:r.message,data:{bridgeCode:r.code,retriable:r.retriable}}:{code:W.INTERNAL_ERROR,message:r instanceof Error?r.message:String(r)}}function gi(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 pi(r){return`${JSON.stringify(r)}
92
- `}var wn=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(`
93
- `);this.buffer=i.pop()??"";let o=[];for(let c of i){let x=c.replace(/\r$/,"").trim();if(x)try{o.push(JSON.parse(x))}catch(f){this.onError?.({line:x,error:f})}}return o}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 wi={"session/prompt":"session.prompt","session/cancel":"session.cancel","session/new":"session.new","session/load":"session.load","_agent/create":"agent.create","_agent/health":"agent.health","_agent/pair":"agent.pair","_agent/listSkills":"agent.listSkills","_agent/addSkills":"agent.addSkills","_agent/removeSkills":"agent.removeSkills","_agent/getFileTree":"agent.getFileTree","_agent/getFileContent":"agent.getFileContent","_agent/detail":"agent.detail","_agent/update":"agent.update","_agent/disconnect":"agent.disconnect","_agent/switchModel":"agent.switchModel","_agent/genModelToken":"agent.genModelToken","_agent/reset":"agent.reset","_agent/repair":"agent.repair","session/request_permission":"session.requestPermission",initialize:"initialize"},Wd=Object.fromEntries(Object.entries(wi).map(([r,e])=>[e,r])),cc={"session.prompt":["agentId","triggerMsgId","sessionId"],"session.cancel":["agentId","triggerMsgId","sessionId"],"session.new":["agentId"],"session.load":["agentId"],"agent.create":["agentId"],"agent.health":[],"agent.listSkills":["agentId"],"agent.addSkills":["agentId"],"agent.removeSkills":["agentId"],"agent.getFileTree":["agentId"],"agent.getFileContent":["agentId"],"agent.detail":["agentId"],"agent.update":["agentId"],"agent.disconnect":["agentId"],"agent.switchModel":["agentId"],"agent.genModelToken":["agentId","sessionId"],"agent.reset":["agentId"],"agent.repair":["agentId"],"session.requestPermission":["agentId","sessionId"],"agent.pair":[],initialize:[]},ft=class{seq=0;next(e,i){this.seq+=1;let o=wi[e]??xc(e),c=cc[o]??[],x=[o,String(this.seq)];if(c.length>0){let f=c.map(g=>mi(i?.[g]??"")),d=uc(f).join(":");d&&x.push(d)}else i&&Object.values(i).some(f=>f)&&x.push(Object.values(i).filter(Boolean).map(f=>mi(String(f))).join(":"));return x.join("_")}reset(){this.seq=0}};function xc(r){return r.replace(/[\s/]+/g,".").replace(/_+/g,"-")}function mi(r){return r.replace(/[:_\s]+/g,"-")}function uc(r){let e=r.length;for(;e>0&&!r[e-1];)e-=1;return r.slice(0,e)}U();var dc=3e4;function _i(r,e){if(!(typeof r!="number"||r<=0))try{process.platform==="win32"?process.kill(r,e):process.kill(-r,e)}catch{}}var Ke=class{constructor(e){this.opts=e;this.log=L(`downstream.${this.constructor.name}`),this.decoder=new wn({onError:i=>this.log.warn("decode line failed",{line:i.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",i=fc(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",o=>{for(let c of this.decoder.push(o))this.dispatch(c)}),i.stderr?.setEncoding("utf8"),i.stderr?.on("data",o=>{this.log.debug("stderr",{text:o.trimEnd()})}),i.on("exit",(o,c)=>{this.stopped=!0,this.failAllPending(new E("AGENT_PROTOCOL_ERROR",`agent exited (${o}/${c})`));for(let x of this.exitHandlers)x(o,c)}),i.on("error",o=>{this.log.error("child error",{err:String(o)}),this.failAllPending(new E("AGENT_SPAWN_FAILED",String(o),{cause:o}))}),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,o=new Promise(x=>i.once("exit",()=>x()));_i(i.pid,"SIGTERM");let c=setTimeout(()=>{i.killed||_i(i.pid,"SIGKILL")},5e3);try{await o}finally{clearTimeout(c)}}pid(){return this.child?.pid}isAlive(){return!!this.child&&!this.stopped}initialize(e){return this.call("initialize",e)}sessionNew(e){return this.call("session/new",{mcpServers:[],...e})}sessionLoad(e){return this.call("session/load",{mcpServers:[],...e})}sessionPrompt(e){return this.call("session/prompt",e,0)}async sessionCancel(e){!this.child||this.stopped||this.writeFrame(hn("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(o){this.log.warn("respondAgentRequest write failed",{id:e,err:String(o)})}}respondAgentRequestError(e,i){if(!(!this.child||this.stopped))try{this.writeFrame(Xe(e,i))}catch(o){this.log.warn("respondAgentRequestError write failed",{id:e,err:String(o)})}}onExit(e){this.exitHandlers.push(e)}call(e,i,o=dc){if(!this.child||this.stopped)return Promise.reject(new E("AGENT_PROTOCOL_ERROR","downstream not started"));let c=this.idAllocator.next(e),x=Tt(c,e,i),f=o>0&&Number.isFinite(o);return new Promise((d,g)=>{let w=f?setTimeout(()=>{this.pending.delete(c),g(new E("AGENT_TIMEOUT",`${e} timed out after ${o}ms`))},o):null;this.pending.set(c,{resolve:d,reject:g,timer:w,method:e});try{this.writeFrame(x)}catch(b){w&&clearTimeout(w),this.pending.delete(c),g(b)}})}writeFrame(e){if(!this.child?.stdin||this.child.stdin.destroyed)throw new E("AGENT_PROTOCOL_ERROR","downstream stdin not writable");this.child.stdin.write(pi(e))}dispatch(e){if(pn(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(gi(e.error)):i.resolve(e.result);return}if(hi(e)){if(e.method==="session/update")for(let i of this.updateHandlers)Promise.resolve(i(e.params)).catch(o=>this.log.warn("update handler failed",{err:String(o)}));else this.log.debug("unknown notification",{method:e.method});return}if(li(e)){let i=e;this.handleAgentRequest(i).catch(o=>this.log.error("agent request handler failed",{method:i.method,err:String(o)}))}}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(o){this.log.error("agentRequestHandler threw",{method:e.method,err:String(o)});try{this.writeFrame(Xe(e.id,mn(o)))}catch{}}}failAllPending(e){for(let i of this.pending.values())i.timer&&clearTimeout(i.timer),i.reject(e);this.pending.clear()}};var lc="@agentclientprotocol/claude-agent-acp@latest";function hc(r){let e={};for(let[i,o]of Object.entries(r))o!==void 0&&(i.startsWith("CLAUDE")||i==="AI_AGENT"||i==="BAGGAGE"||(e[i]=o));return e}var _n=class extends Ke{framework="claude-code";constructor(e){let i=ln("claude-code"),[o,c]=i?[i,[]]:["npx",["-y",lc]],x=e.command??o,f=e.args??c,d={command:x,args:f,cwd:e.cwd,...e.env?{env:e.env}:{}};super(d)}sanitizeEnv(e){return hc(e)}};import{mkdtempSync as gc,rmSync as pc}from"node:fs";import{tmpdir as mc}from"node:os";import{join as wc}from"node:path";var _c="@zed-industries/codex-acp@latest",yn=class extends Ke{framework="codex";authMethodId;codexHomeDir;constructor(e){let i=ln("codex"),[o,c]=i?[i,[]]:["npx",["-y",_c]],x=e.command??o,f=e.args??c,d=e.extraArgs?[...f,...e.extraArgs]:f,g=e.isolateCodexHome?gc(wc(mc(),"coze-bridge-codex-home-")):void 0,w=g?{...e.env??{},CODEX_HOME:g}:e.env,b={command:x,args:d,cwd:e.cwd,...w?{env:w}:{}};super(b),this.authMethodId=e.authMethodId,this.codexHomeDir=g}async initialize(e){let i=await super.initialize(e);return this.authMethodId&&await this.call("authenticate",{methodId:this.authMethodId}),i}async stop(e){if(await super.stop(e),this.codexHomeDir)try{pc(this.codexHomeDir,{recursive:!0,force:!0})}catch{}}};var Lt=class extends Ke{framework="openclaw";agentId;sessionName;slashModelOnStart;constructor(e){let i=e.sessionName??"default",o=["acp","--session",`agent:${e.agentId}:${i}`];e.gatewayToken&&o.push("--token",e.gatewayToken);let c={command:e.command,args:o,cwd:e.cwd,...e.env?{env:e.env}:{}};super(c),this.agentId=e.agentId,this.sessionName=i,this.slashModelOnStart=e.slashModelOnStart}async afterSessionEstablished(e){this.slashModelOnStart&&(this.log.info("switching session to per-session provider via /model",{agentId:this.agentId,sessionName:this.sessionName,slash:this.slashModelOnStart}),await this.sessionPrompt({sessionId:e,prompt:[{type:"text",text:`/model ${this.slashModelOnStart}`}]}))}get acpSessionName(){return this.sessionName}};U();xe();var dt=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,o)=>{this.slots.push({task:e,resolve:i,reject:o}),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 bn=class{agentId;framework;workspace;deployType;sessions=new Map;sessionQueues=new Map;activeTriggers=new Map;status="ok";model;lastActiveAt=Date.now();constructor(e){this.agentId=e.agentId,this.framework=e.framework,this.workspace=e.workspace,this.model=e.model,this.deployType=e.deployType??"local"}getSessionQueue(e){let i=this.sessionQueues.get(e);return i||(i=new dt,this.sessionQueues.set(e,i)),i}allSessionQueues(){return this.sessionQueues.entries()}async dispose(e){this.status="stopped";let i=new Error(`AgentSession disposed${e?`: ${e}`:""}`);for(let o of this.sessionQueues.values())o.dispose(i);this.sessionQueues.clear(),await this.killAllRuntimes(e??"dispose")}async killAllRuntimes(e){let i=[];for(let[,o]of this.sessions)Rt(o),o.downstream&&(i.push(o.downstream.stop(e).catch(()=>{})),o.downstream=void 0);await Promise.all(i),this.activeTriggers.clear()}};function Rt(r){r.idleTimer&&(clearTimeout(r.idleTimer),r.idleTimer=void 0)}import{spawn as yc}from"node:child_process";import{homedir as bc}from"node:os";import{join as vc}from"node:path";Xt();U();async function vi(){let r=vc(bc(),".openclaw/openclaw.json");return(await at(r))?.gateway?.auth?.token??""}var yi=L("openclaw.config"),Sc=[0,5e3,5e3],bi="models.providers.",vn="agents.defaults.models",Sn=class{command;env;retryDelaysMs;queue=new dt;constructor(e){this.command=e.command,this.env=e.env??process.env,this.retryDelaysMs=e.retryDelaysMs??Sc}async withRetry(e,i){let o;for(let c=0;c<this.retryDelaysMs.length;c++){let x=this.retryDelaysMs[c]??0;x>0&&await new Promise(f=>setTimeout(f,x));try{return await i()}catch(f){o=f,yi.warn("openclaw cli failed, will retry",{label:e,attempt:c+1,err:String(f)})}}throw new E("AGENT_SPAWN_FAILED",`openclaw cli ${e} failed after ${this.retryDelaysMs.length} attempts: ${o?.message??"unknown"}`)}runCli(e){return new Promise((i,o)=>{let c=yc(this.command,e,{stdio:["ignore","pipe","pipe"],env:this.env}),x="";c.stderr?.on("data",f=>{x+=f.toString("utf8")}),c.on("error",o),c.on("close",f=>{f===0?i():o(new Error(`exit ${f}: ${x.trim().slice(0,500)}`))})})}async runCliTolerant(e,i){try{await this.runCli(e)}catch(o){let c=String(o);if(i.some(x=>c.includes(x)))return;throw o}}async bestEffortUnset(e,i){try{await this.queue.enqueue(()=>this.withRetry(e,()=>this.runCli(["config","unset",i])))}catch(o){yi.warn(`${e} failed (best-effort)`,{configPath:i,err:String(o)})}}ensureProvider(e,i){return this.queue.enqueue(()=>this.withRetry(`config set models.providers.${e}`,()=>this.runCli(["config","set",`${bi}${e}`,JSON.stringify(i),"--strict-json","--merge"])))}removeProvider(e){return this.bestEffortUnset(`config unset models.providers.${e}`,`${bi}${e}`)}addModelToAllowlist(e,i){let o={[e]:i?{alias:i}:{}};return this.queue.enqueue(()=>this.withRetry(`config set ${vn}[${e}]`,()=>this.runCli(["config","set",vn,JSON.stringify(o),"--strict-json","--merge"])))}removeModelFromAllowlist(e){return this.bestEffortUnset(`config unset ${vn}[${e}]`,`${vn}.${e}`)}ensureAgent(e,i,o){let c=["agents","add",e,"--workspace",i,"--non-interactive"];return o&&c.push("--model",o),this.queue.enqueue(()=>this.withRetry(`agents add ${e}`,()=>this.runCliTolerant(c,["already exists","already registered"])))}deleteAgent(e){return this.queue.enqueue(()=>this.withRetry(`agents delete ${e}`,()=>this.runCliTolerant(["agents","delete",e,"--force"],["not found","does not exist"])))}};var Ge=L("agent-manager"),Ec=(r,e,i,o,c,x,f)=>{switch(r){case"claude-code":{let d=c?{...$s(c),...ei(c,f)}:void 0;return new _n({cwd:i,...d&&Object.keys(d).length>0?{env:d}:{}})}case"codex":{let d=c?[...Qs(c),...ni(c,f)]:[],g=c?Zs(c):void 0,w=!!c;return new yn({cwd:i,...d.length>0?{extraArgs:d}:{},...g&&Object.keys(g).length>0?{env:g}:{},...w?{authMethodId:"openai-api-key",isolateCodexHome:!0}:{}})}case"openclaw":return new Lt({command:e,cwd:i,agentId:o,...x?{sessionName:kt(x)}:{}})}};function Si(r){return r==="claude-code"||r==="codex"}var Ac={path:"",version:"cloud-deployed"},kc={protocolVersion:1,clientCapabilities:{fs:{readTextFile:!0,writeTextFile:!0}}},Pc=6e4,Cn=class{paths;config;registry;factory;createTimeoutMs;openclawConfigCache;ensuredProviders=new Set;constructor(e){this.paths=e.paths,this.config=e.config,this.registry=e.registry,this.factory=e.downstreamFactory??Ec,this.createTimeoutMs=e.createTimeoutMs??Pc}getOpenclawConfig(){if(!this.openclawConfigCache){let e=this.config.frameworksCache?.openclaw;if(!e?.path)throw new E("AGENT_SPAWN_FAILED","openclaw binary not detected on this machine");this.openclawConfigCache=new Sn({command:e.path})}return this.openclawConfigCache}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 i=At(e._meta)==="cloud";this.registry.reviveIfDisconnected?.(e.agentId);let o=this.registry.get(e.agentId);if(o){if(o.framework!==e.framework)throw new E("AGENT_BUSY",`agent ${e.agentId} exists with different framework (${o.framework})`);if(o.status==="error")Ge.warn("existing agent in error state, rebuilding",{agentId:e.agentId}),await o.dispose("rebuild after error").catch(C=>Ge.warn("dispose stale agent failed (ignored)",{err:String(C)})),this.registry.unregister(e.agentId);else return Ge.info("agent already exists, return current",{agentId:e.agentId}),{ok:!0,agentId:o.agentId,workspace:o.workspace,framework:o.framework}}if(!i&&!this.config.frameworksCache?.[e.framework])throw new E("AGENT_SPAWN_FAILED",`framework ${e.framework} not detected on this machine; rerun daemon to refresh frameworks_cache`);i&&Si(e.framework)&&await di(e.framework);let x=Te(e.agentId,this.paths),f=e.workspace??x.workspace,d=At(e._meta),g=new AbortController,w=setTimeout(()=>g.abort(new E("AGENT_TIMEOUT",`_agent/create timed out after ${this.createTimeoutMs}ms`)),this.createTimeoutMs),b,y=!1;try{let C=()=>{if(g.signal.aborted)throw g.signal.reason instanceof Error?g.signal.reason:new E("AGENT_TIMEOUT","_agent/create aborted")};await Ar(x.root,{recursive:!0}),await Ar(f,{recursive:!0}),await Ar(x.logs,{recursive:!0}),C(),await ct(f,e.framework,e.agentId,e.cozeIdentity),C();let P=await ue(e.agentId,this.paths).catch(()=>null),I=Xs({model:e.model??P?.model});if(b=new bn({agentId:e.agentId,framework:e.framework,workspace:f,model:I.model??He,deployType:d}),b.status="ok",P?.sessions){for(let[re,Q]of Object.entries(P.sessions))b.sessions.set(re,{acpSessionId:Q.acpSessionId,modelToken:Q.modelToken,tokenGeneratedAt:Q.tokenGeneratedAt,lastActiveAt:Date.now(),loadingSession:!1,replySeq:0});let z=Object.keys(P.sessions).length;z>0&&Ge.info("restored persisted session records (no spawn)",{agentId:e.agentId,count:z})}this.registry.register(b),y=!0;let T={agentId:e.agentId,framework:e.framework,workspace:f,cozeIdentity:e.cozeIdentity,createdAt:P?.createdAt??Date.now(),sessions:P?.sessions??{},model:I.model};return d==="cloud"&&(T.deployType="cloud"),P?.skills&&(T.skills=P.skills),P?.agentName&&(T.agentName=P.agentName),P?.description&&(T.description=P.description),await me(T,this.paths),e.framework==="openclaw"&&(this.config.frameworksCache?.openclaw?.path?await this.getOpenclawConfig().ensureAgent(e.agentId,f):Ge.warn("openclaw binary not on this machine, skip agents add (will fail at session/prompt)",{agentId:e.agentId})),Ge.info("agent created (no spawn, lazy on first prompt)",{agentId:e.agentId,framework:e.framework,deployType:d}),{ok:!0,agentId:e.agentId,workspace:f,framework:e.framework}}catch(C){throw Ge.error("agent create failed, rolling back",{agentId:e.agentId,err:String(C)}),y&&b&&(await b.dispose("rollback").catch(()=>{}),this.registry.unregister(e.agentId)),await Cc(x.root,{recursive:!0,force:!0}).catch(P=>Ge.warn("rm agent dir failed (ignored)",{err:String(P)})),C instanceof E?C:new E("AGENT_SPAWN_FAILED",String(C),{cause:C})}finally{clearTimeout(w)}}async spawnSessionDownstream(e,i,o,c){let f=this.config.frameworksCache?.[e.framework];if(!f)if(e.deployType==="cloud"&&Si(e.framework))f=Ac;else throw new E("AGENT_SPAWN_FAILED",`framework ${e.framework} not detected on this machine`);let d=e.deployType==="cloud"?{model:e.model,modelToken:i}:void 0,g;e.framework==="openclaw"?g=await this.buildOpenclawDownstream({session:e,modelConfig:d,cloudSessionId:o,cozeEnv:c,command:f.path}):g=this.factory(e.framework,f.path,e.workspace,e.agentId,d,o,c);try{return await g.start(),await g.initialize(kc),g}catch(w){throw await g.stop("spawnSessionDownstream failed").catch(()=>{}),w instanceof E?w:new E("AGENT_SPAWN_FAILED",w instanceof Error?w.message:String(w),{cause:w})}}async buildOpenclawDownstream(e){let{session:i,modelConfig:o,cloudSessionId:c,cozeEnv:x,command:f}=e,d=kt(c),g=await vi(),w=o?.modelToken&&!Pt(o.model)?ti(o,x):null,b;if(w){let y=Sr(c),C=`${y}/${o.model}`;if(!this.ensuredProviders.has(C)){let P=this.getOpenclawConfig();await P.ensureProvider(y,w),await P.addModelToAllowlist(C),this.ensuredProviders.add(C)}b=C}return new Lt({command:f,cwd:i.workspace,agentId:i.agentId,sessionName:d,...g?{gatewayToken:g}:{},...b?{slashModelOnStart:b}:{}})}async openclawRepair(e,i){let o=this.getOpenclawConfig();await o.deleteAgent(e),await o.ensureAgent(e,i)}async cleanupOpenclawSessionProviders(e){if(e.framework!=="openclaw"||!this.openclawConfigCache)return;let i=this.openclawConfigCache;for(let o of e.sessions.keys()){let c=Sr(o),x=`${c}/${e.model}`;this.ensuredProviders.delete(x),await i.removeProvider(c),await i.removeModelFromAllowlist(x)}}};U();import{spawn as Dc}from"node:child_process";import{constants as Ci,access as Ic}from"node:fs/promises";import{delimiter as Tc,join as Lc}from"node:path";var Rc=L("framework-detector"),Ei={"claude-code":"claude",codex:"codex",openclaw:"openclaw"},Nc=[".exe",".cmd",".bat",".ps1"],Nt=class{env;constructor(e={}){this.env={pathEnv:e.pathEnv??process.env.PATH??"",platform:e.platform??process.platform,spawn:e.spawn??Dc,access:e.access??Ic}}async detect(e){let i=Ei[e],o=await this.which(i);if(!o)return Rc.debug("framework binary not found",{framework:e,bin:i}),null;let c=await this.probeVersion(o);return{path:o,version:c}}async detectAll(){let e=await Promise.all(Object.keys(Ei).map(async o=>[o,await this.detect(o)])),i={};for(let[o,c]of e)c&&(i[o]=c);return i}async which(e){let i=this.env.pathEnv.split(Tc).filter(Boolean),o=this.env.platform==="win32"?["",...Nc]:[""];for(let c of i)for(let x of o){let f=Lc(c,e+x);if(await this.isExecutable(f))return f}return null}async isExecutable(e){try{let i=this.env.platform==="win32"?Ci.F_OK:Ci.X_OK;return await this.env.access(e,i),!0}catch{return!1}}async probeVersion(e){return new Promise(i=>{let o="",c=!1,x,f=d=>{c||(c=!0,x&&clearTimeout(x),i(d.trim()||"unknown"))};try{let d=this.env.spawn(e,["--version"],{stdio:["ignore","pipe","pipe"]});x=setTimeout(()=>{d.kill("SIGKILL"),f("unknown")},5e3),d.stdout?.on("data",g=>{o+=g.toString("utf8")}),d.on("error",()=>f("unknown")),d.on("close",()=>{let g=Bc(o).split(/\r?\n/)[0]??"";f(g)})}catch{f("unknown")}})}},Oc=new RegExp("\x1B\\[[0-9;]*[A-Za-z]","g");function Bc(r){return r.replace(Oc,"")}Xt();xe();var Mc=10*6e4;function Ai(r){let e=r?.sessionIdleTimeoutMs;return typeof e!="number"||!Number.isFinite(e)||e<=0?Mc:e}function En(r){return at(r??G().configFile)}function Ot(r,e){return Yt(e??G().configFile,r)}import{randomBytes as zc}from"node:crypto";Ue();U();var F=L("core"),qc=3e4,Fc=3e4,An=class{upstream;agents=new Map;disconnectedAgents=new Set;extensions;paths;sessionSpawner;sessionIdleTimeoutMs;upstreamIds=new ft;pendingUpstream=new Map;pendingBridge=new Map;currentCozeEnv;constructor(e){this.upstream=e.upstream,this.extensions=e.extensions??{},this.paths=e.paths,this.sessionSpawner=e.sessionSpawner,this.sessionIdleTimeoutMs=Ai(e.bridgeConfig)}registerExtension(e,i){this.extensions[e]=i}getCozeEnv(){return this.currentCozeEnv}async start(){this.upstream.onFrame(e=>this.handleFrame(e)),await this.upstream.start(),F.info("Core started",{extensions:Object.keys(this.extensions)})}async stop(e){F.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),F.info("agent registered",{agentId:e.agentId,framework:e.framework});for(let i of this.registerHandlers)try{i(e.agentId)}catch(o){F.warn("onAgentRegister handler threw (ignored)",{agentId:e.agentId,err:String(o)})}}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)&&F.info("agent revived from disconnect",{agentId:e})}attachRuntimeHooks(e,i,o){let c=o.downstream;c&&(c.onUpdate(x=>{o.loadingSession||this.forwardUpdate(e,x)}),c.onAgentRequest(x=>{this.handleAgentRequest(e,c,x)}),c.onExit((x,f)=>{F.info("session runtime exited",{agentId:e.agentId,cloudId:i,code:x,signal:f}),Rt(o),o.downstream=void 0,o.acpSessionId&&e.activeTriggers.delete(o.acpSessionId)}))}async handleFrame(e){if(pn(e)){this.handleUpstreamResponse(e);return}if(!("method"in e)||typeof e.method!="string")return;let i="id"in e&&e.id!==void 0?e.id:null,o=e.params?._meta?.cozeEnv;o&&(this.currentCozeEnv=o);try{if(e.method.startsWith("_agent/")){let c=this.extensions[e.method];if(!c){i!==null?await this.sendError(i,W.METHOD_NOT_FOUND,`extension not registered: ${e.method}`):F.warn("drop notification: extension not registered",{method:e.method});return}let x=await c(e,this);i!==null&&await this.upstream.send(ut(i,x));return}if(e.method.startsWith("session/")){let c=await this.routeSessionMethod(e);i!==null&&await this.upstream.send(ut(i,c));return}if(e.method==="initialize"){i!==null&&await this.upstream.send(ut(i,{protocolVersion:1,agentCapabilities:{loadSession:!0}}));return}i!==null?await this.sendError(i,W.METHOD_NOT_FOUND,`method not implemented: ${e.method}`):F.warn("drop unknown notification",{method:e.method})}catch(c){F.error("handleFrame failed",{method:e.method,err:String(c)}),i!==null&&await this.upstream.send(Xe(i,mn(c)))}}async routeSessionMethod(e){if(!e.params||typeof e.params!="object")throw new E("IPC_BAD_REQUEST",`${e.method} requires params`);let i=e.params,o=i._meta?.cozeAgentId;if(!o)throw new E("IPC_BAD_REQUEST",`${e.method}: missing _meta.cozeAgentId`);let c=this.agents.get(o);if(!c)throw this.disconnectedAgents.has(o)?new E("AGENT_DISCONNECTED",`agent ${o} has been disconnected; cloud must _agent/create to revive`):new E("AGENT_NOT_FOUND",`agent not found: ${o}`);let x=typeof i.sessionId=="string"?i.sessionId:void 0;if(e.method==="session/cancel"||e.method==="session/new"||!x)return this.dispatchSessionCall(c,e.method,i);let f=Date.now(),d=!1;try{let g=await c.getSessionQueue(x).enqueue(()=>this.dispatchSessionCall(c,e.method,i));return d=!0,g}finally{F.info("session call done",{agentId:c.agentId,method:e.method,durationMs:Date.now()-f,ok:d})}}async dispatchSessionCall(e,i,o){e.lastActiveAt=Date.now();let{stripped:c}=Us(o);switch(i){case"session/new":{let x=Uc();return F.info("session/new ack (lazy spawn)",{agentId:e.agentId,cloudId:x}),{sessionId:x}}case"session/load":{let x=c;return F.info("session/load ack (lazy spawn)",{agentId:e.agentId,cloudId:x.sessionId}),{}}case"session/prompt":{let x=c,f=x.sessionId;if(!f)throw new E("IPC_BAD_REQUEST","session/prompt: missing sessionId");let d=await this.ensureRuntime(e,f);if(d.replySeq=0,await this.ensureDownstream(e,f,d),!d.downstream||!d.acpSessionId)throw new E("BRIDGE_INTERNAL","session runtime not ready after ensureDownstream");let g=o._meta?.cozeTriggerMsgId;g?e.activeTriggers.set(d.acpSessionId,g):e.activeTriggers.delete(d.acpSessionId);try{let w=await d.downstream.sessionPrompt({...x,sessionId:d.acpSessionId});return d.lastActiveAt=Date.now(),w}finally{e.activeTriggers.delete(d.acpSessionId),d.downstream?.isAlive()&&this.armIdleTimer(e,f,d)}}case"session/cancel":{let f=c.sessionId;if(!f)throw new E("IPC_BAD_REQUEST","session/cancel: missing sessionId");let d=e.sessions.get(f);return d?.downstream?.isAlive()&&d.acpSessionId&&await d.downstream.sessionCancel({sessionId:d.acpSessionId}),{ok:!0}}default:throw new E("IPC_BAD_REQUEST",`session method not supported: ${i}`)}}async ensureRuntime(e,i){let o=e.sessions.get(i);if(o)return o;let x={modelToken:e.deployType==="cloud"?await this.requestSessionToken(e.agentId,i):"",tokenGeneratedAt:Date.now(),lastActiveAt:Date.now(),loadingSession:!1,replySeq:0};return e.sessions.set(i,x),await this.persistSessionMapping(e),x}async requestSessionToken(e,i){let o={sessionId:i,_meta:{cozeAgentId:e}};try{let c=await this.sendRequest(Se.GEN_MODEL_TOKEN,o,Fc);if(!c?.modelToken)throw new E("MODEL_TOKEN_GEN_FAILED",`cloud returned empty modelToken (agentId=${e}, cloudSessionId=${i})`);return c.modelToken}catch(c){throw c instanceof E&&c.code==="MODEL_TOKEN_GEN_FAILED"?c:new E("MODEL_TOKEN_GEN_FAILED",c instanceof Error?c.message:String(c),{cause:c})}}async ensureDownstream(e,i,o){if(Rt(o),o.downstream?.isAlive())return;if(!this.sessionSpawner)throw new E("AGENT_SPAWN_FAILED","sessionSpawner not wired (cannot spawn per-session downstream)");let c=await this.sessionSpawner(e,o.modelToken,i,this.currentCozeEnv);if(o.downstream=c,this.attachRuntimeHooks(e,i,o),o.acpSessionId){o.loadingSession=!0;try{await c.sessionLoad({sessionId:o.acpSessionId,cwd:e.workspace}),F.info("session restored via session/load",{agentId:e.agentId,cloudId:i,acpId:o.acpSessionId})}catch(x){F.warn("session/load failed, fallback to session/new",{agentId:e.agentId,cloudId:i,acpId:o.acpSessionId,err:String(x)}),o.acpSessionId=void 0;let f=await c.sessionNew({cwd:e.workspace});o.acpSessionId=f.sessionId,await this.persistSessionMapping(e)}finally{o.loadingSession=!1}}else{let x=await c.sessionNew({cwd:e.workspace});o.acpSessionId=x.sessionId,await this.persistSessionMapping(e)}c.afterSessionEstablished&&o.acpSessionId&&await c.afterSessionEstablished(o.acpSessionId)}armIdleTimer(e,i,o){if(Rt(o),this.isRuntimeBusy(e,o)){F.debug("skip idle timer: runtime busy (in-flight turn / pending permission)",{agentId:e.agentId,cloudId:i});return}o.idleTimer=setTimeout(()=>{if(o.idleTimer=void 0,this.isRuntimeBusy(e,o)){F.info("idle reaper fired but runtime busy, re-arming",{agentId:e.agentId,cloudId:i}),this.armIdleTimer(e,i,o);return}F.info("session runtime idle timeout, killing downstream",{agentId:e.agentId,cloudId:i});let c=o.downstream;o.downstream=void 0,o.acpSessionId&&e.activeTriggers.delete(o.acpSessionId),c&&c.stop("idle timeout").catch(x=>F.warn("idle stop failed (ignored)",{agentId:e.agentId,cloudId:i,err:String(x)}))},this.sessionIdleTimeoutMs),o.idleTimer.unref?.()}isRuntimeBusy(e,i){if(i.acpSessionId&&e.activeTriggers.has(i.acpSessionId))return!0;let o=i.downstream;if(!o)return!1;for(let c of this.pendingUpstream.values())if(c.downstream===o)return!0;return!1}forwardUpdate(e,i){let o=i.sessionId,c=this.reverseSessionId(e,o);if(!c){F.debug("drop update for unknown session",{agentId:e.agentId,acpId:o});return}let x=e.sessions.get(c);if(!x){F.debug("drop update: runtime gone",{agentId:e.agentId,cloudId:c});return}let f={cozeAgentId:e.agentId,cozeReplySeqID:++x.replySeq},d=e.activeTriggers.get(o);d&&(f.cozeTriggerMsgId=d),this.upstream.send(hn("session/update",{...i,sessionId:c,_meta:f})).catch(g=>F.warn("forward update failed",{agentId:e.agentId,err:String(g)}))}handleAgentRequest(e,i,o){if(o.method==="session/request_permission"){this.forwardPermissionRequest(e,i,o);return}F.warn("unhandled agent request,returning method_not_found",{agentId:e.agentId,method:o.method}),i.respondAgentRequestError(o.id,{code:W.METHOD_NOT_FOUND,message:`method not handled by Bridge: ${o.method}`})}forwardPermissionRequest(e,i,o){let c=this.upstreamIds.next("session/request_permission"),x=o.params??{},d=x.sessionId,g=d?e.activeTriggers.get(d):void 0,w={cozeAgentId:e.agentId};g&&(w.cozeTriggerMsgId=g);let b=d?this.reverseSessionId(e,d):void 0,y={...x,...b?{sessionId:b}:{},_meta:w};this.pendingUpstream.set(c,{agentRequestId:o.id,agentId:e.agentId,downstream:i,method:o.method}),this.upstream.send(Tt(c,"session/request_permission",y)).catch(C=>{this.pendingUpstream.delete(c),F.error("forward permission request failed",{agentId:e.agentId,err:String(C)}),i.respondAgentRequestError(o.id,{code:W.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),e.error?i.downstream.respondAgentRequestError(i.agentRequestId,e.error):i.downstream.respondAgentRequest(i.agentRequestId,e.result);return}let o=this.pendingBridge.get(e.id);if(o){this.pendingBridge.delete(e.id),clearTimeout(o.timer),e.error?o.reject(new gn(e.error)):o.resolve(e.result);return}F.debug("orphan upstream response (no pending)",{id:e.id})}sendRequest(e,i,o=qc){let c=this.upstreamIds.next(e);return new Promise((x,f)=>{let d=setTimeout(()=>{this.pendingBridge.delete(c),f(new E("AGENT_TIMEOUT",`${e} timed out after ${o}ms`))},o);this.pendingBridge.set(c,{method:e,resolve:x,reject:f,timer:d}),this.upstream.send(Tt(c,e,i)).catch(g=>{let w=this.pendingBridge.get(c);w&&(clearTimeout(w.timer),this.pendingBridge.delete(c)),f(g)})})}async persistSessionMapping(e){if(this.paths)try{let i=new Map;for(let[o,c]of e.sessions){let x={modelToken:c.modelToken,tokenGeneratedAt:c.tokenGeneratedAt};c.acpSessionId&&(x.acpSessionId=c.acpSessionId),i.set(o,x)}await yr(e.agentId,i,this.paths)}catch(i){F.warn("persist session mapping failed",{agentId:e.agentId,err:String(i)})}}reverseSessionId(e,i){for(let[o,c]of e.sessions.entries())if(c.acpSessionId===i)return o}sendError(e,i,o){return this.upstream.send(Xe(e,{code:i,message:o}))}};function Uc(){return zc(16).toString("hex")}U();xe();import{randomBytes as Hc}from"node:crypto";import{chmod as Kc,mkdir as Gc,writeFile as ki}from"node:fs/promises";import{createServer as Wc}from"node:http";import{dirname as jc}from"node:path";var Jc=1e6,kr=L("ipc"),kn=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??G()}async start(){this.token=Hc(32).toString("hex");let e=Wc((o,c)=>{this.dispatch(o,c)});this.server=e,await new Promise((o,c)=>{e.once("error",c),e.listen(0,"127.0.0.1",()=>o())});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(),kr.info("IPC listening",{port:this.port}),{port:this.port,token:this.token}}async stop(){let e=this.server;e&&(await new Promise((i,o)=>{e.close(c=>c?o(c):i())}),this.server=null)}async persistAuthFiles(){await Gc(jc(this.paths.portFile),{recursive:!0}),await ki(this.paths.portFile,String(this.port),"utf8"),await ki(this.paths.tokenFile,this.token,{encoding:"utf8",mode:384});try{await Kc(this.paths.tokenFile,384)}catch(e){kr.warn("chmod token file failed (non-POSIX?)",{err:String(e)})}}async dispatch(e,i){if(e.headers.authorization!==`Bearer ${this.token}`){Bt(i,401,{error:"unauthorized"});return}let c=`${e.method} ${(e.url??"").split("?")[0]}`,x=this.routes.get(c);if(!x){Bt(i,404,{error:"not found"});return}let f=null;if(e.method==="POST")try{f=await Vc(e)}catch(d){Bt(i,400,{error:"invalid json",detail:String(d)});return}try{let d=await x.handler(f,e);Bt(i,200,d??{ok:!0})}catch(d){kr.error("IPC handler failed",{key:c,err:String(d)}),Bt(i,500,{error:d instanceof Error?d.message:String(d)})}}};function Bt(r,e,i){r.statusCode=e,r.setHeader("content-type","application/json"),r.end(JSON.stringify(i))}async function Vc(r){let e=[],i=0;for await(let c of r){let x=c;if(i+=x.length,i>Jc)throw new Error("body too large");e.push(x)}let o=Buffer.concat(e).toString("utf8");return o?JSON.parse(o):null}var Vo=Ie(zi(),1);var Du=Ie(No(),1),Iu=Ie(Kn(),1),Tu=Ie(gt(),1),Lu=Ie(Fr(),1),Ru=Ie(Kr(),1),Nu=Ie(Yr(),1),Ko=Ie(Jn(),1),Ou=Ie(Ho(),1);var Go=Ko.default;U();var ne=L("upstream.frontier"),jo="application/json",Jo="none",Yn=class{constructor(e){this.opts=e}opts;fws=null;handler=null;connectHandler=null;opened=!1;openCount=0;async start(){if(this.fws){ne.warn("start called on already-started FrontierUpstream; noop");return}let e={Authorization:`Bearer ${this.opts.privatecode}`,Origin:Gs,...sn(this.opts.ppeOverride)};class i extends Go{constructor(d){super(d,Ks,{headers:e})}send(d,...g){if(qs("debug"))try{let w;typeof d=="string"?w=Buffer.from(d,"utf8"):d instanceof Buffer?w=d:d instanceof ArrayBuffer?w=new Uint8Array(d):ArrayBuffer.isView(d)?w=new Uint8Array(d.buffer,d.byteOffset,d.byteLength):w=new Uint8Array(0);let b=Buffer.from(w.slice(0,128)).toString("hex");ne.debug("WS raw frame out",{bytes:w.byteLength,headHex:b})}catch(w){ne.warn("WS raw frame dump failed",{err:String(w)})}super.send(d,...g)}}let o=Js(this.opts.urlOverride),c={url:o,ws:i,fpID:Hs,aID:rn,accessKey:this.opts.handshake.accessKey,deviceID:this.opts.handshake.deviceId,payloadType:{type:jo,force:!0},payloadEncoding:{encoding:Jo,force:!0},enableTransformTextPayload:!0,enableQoS:!1,enableAutoAck:!1,automaticOpen:!1,debug:this.opts.debug??!1},x=new Vo.FWS(c);x.onopen=()=>{this.opened=!0,this.openCount+=1;let f=this.openCount===1;ne.info("frontier opened",{url:o,remoteDeviceId:this.opts.handshake.deviceId,initial:f,openCount:this.openCount}),this.connectHandler&&Promise.resolve(this.connectHandler({initial:f})).catch(d=>ne.warn("onConnect handler threw (ignored)",{err:String(d)}))},x.onclose=f=>{this.opened=!1,ne.info("frontier closed",{code:f.code,reason:f.reason,willReconnect:f.willReconnect})},x.onerror=f=>{ne.warn("frontier error",{code:f.code,msg:f.message})},x.onmessage=f=>this.handleMessage(f),this.fws=x,await x.connect()}async stop(e){let i=this.fws;if(i){this.fws=null,this.opened=!1;try{i.close(1e3,e??"bridge shutdown")}catch(o){ne.warn("frontier close threw (ignored)",{err:String(o)})}}}async send(e){let i=this.fws;if(!i)throw new E("UPSTREAM_DISCONNECTED","frontier upstream not started");let o=JSON.stringify(e),c=e;ne.info("frontier frame out",{method:c.method,jsonrpcId:c.id,size:o.length});try{await i.send(o,{service:33555712,method:1,payloadType:jo,payloadEncoding:Jo})}catch(x){throw new E("UPSTREAM_DISCONNECTED",`frontier send failed: ${String(x)}`,{cause:x})}}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){ne.debug("drop non-adapter frontier frame",{service:i});return}let o=zu(e);if(!o){ne.debug("frontier message without text payload, drop",{payloadType:e.message?.payloadType});return}if(!this.handler){ne.debug("frame received but no onFrame handler",{size:o.length});return}let c;try{c=JSON.parse(o)}catch(x){ne.warn("frontier message JSON parse failed",{err:String(x),head:o.slice(0,80)});return}ne.info("frontier frame in",{logid:Mu(e.message?.LogID),logidNew:e.message?.LogIDNew,msgId:e.message?.msgID,jsonrpcId:c.id}),Promise.resolve(this.handler(c)).catch(x=>ne.warn("frontier frame handler threw",{err:String(x)}))}};function Mu(r){return r?r.high===0?String(r.low>>>0):`${r.high.toString(16)}${(r.low>>>0).toString(16).padStart(8,"0")}`:""}function zu(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}}U();var $r=L("upstream.switchable"),Xn=class{inner;handler=null;connectHandler=null;constructor(e){this.inner=e}async swap(e,i){if(this.inner===e)return;$r.info("swap upstream",{reason:i});let o=this.inner;this.inner=e,this.handler&&e.onFrame(this.handler),this.connectHandler&&e.onConnect&&e.onConnect(this.connectHandler);try{await e.start()}catch(c){throw $r.error("swap target start failed, reverting",{err:String(c)}),this.inner=o,c}await o.stop(i??"swapped").catch(c=>$r.warn("previous upstream stop threw (ignored)",{err:String(c)}))}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()}};U();var Qr=L("upstream"),Wt=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)}};U();xe();U();xe();import{execSync as qu}from"node:child_process";import{readFileSync as Yo,unlinkSync as Fu}from"node:fs";import{mkdir as Uu,readFile as Xo,unlink as $o,writeFile as Hu}from"node:fs/promises";import{dirname as Ku}from"node:path";var Gu=L("single-instance"),$n=class{pidFile;acquired=!1;constructor(e={}){this.pidFile=e.pidFile??G().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&&(Gu.warn("removing stale pid file",{stalePid:e}),await $o(this.pidFile).catch(()=>{})),await Uu(Ku(this.pidFile),{recursive:!0}),await Hu(this.pidFile,String(process.pid),"utf8"),this.acquired=!0,this.installCleanupHooks(),{kind:"acquired"})}async release(){if(this.acquired){try{(await Xo(this.pidFile,"utf8")).trim()===String(process.pid)&&await $o(this.pidFile)}catch{}this.acquired=!1}}async readExistingPid(){try{let e=await Xo(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{process.kill(e,0)}catch(i){return i.code==="EPERM"}return this.matchesDaemonTitle(e)}matchesDaemonTitle(e){try{let i=Yo(`/proc/${e}/cmdline`,"utf8").replace(/\0/g," ");return!!(i.includes("coze-bridge-daemon")||i.includes("lib/index.js"))}catch{}try{let i=qu(`ps -o command= -p ${e}`,{stdio:["ignore","pipe","ignore"],timeout:1e3}).toString();return i.trim()?i.includes("coze-bridge-daemon")||i.includes("lib/index.js"):!1}catch{return!0}}installCleanupHooks(){process.once("exit",()=>{if(this.acquired)try{Yo(this.pidFile,"utf8").trim()===String(process.pid)&&Fu(this.pidFile)}catch{}})}};var B=L("daemon"),Wu="coze-bridge-daemon";async function ea(){let r=new $n({processTitle:Wu}),e=await r.acquire();if(e.kind==="already-running")throw new Error(`coze-bridge daemon already running (pid=${e.pid})`);let i=await En(),o=i??{};_r({pid:process.pid}),B.info(i?"loaded bridge config":"initialized bridge config");try{let D=new Nt;o.frameworksCache=await D.detectAll(),B.info("refreshed frameworks_cache",{detected:Object.keys(o.frameworksCache)})}catch(D){B.warn("framework detection failed",{err:String(D)})}await Ot(o);let c=new Xn(new Wt),x=G(),f=null,d=new An({upstream:c,paths:x,bridgeConfig:o,sessionSpawner:async(D,q,j,Z)=>{if(!f)throw new Error("agentManager not ready");return f.spawnSessionDownstream(D,q,j,Z)}});await Ju(x,d);let g=new Cn({paths:x,config:o,registry:d});f=g;let w,b,y=null,C=null;d.registerExtension("_agent/create",async D=>g.createAgent(D.params)),d.registerExtension("_agent/health",async()=>({ok:!0}));let P={},I=new cn({agents:d.agents,disposeAndMarkDisconnected:async(D,q)=>{let j=d.agents.get(D);j&&(await g.cleanupOpenclawSessionProviders(j).catch(Z=>B.warn("cleanup openclaw providers failed (ignored)",{agentId:D,err:String(Z)})),await j.dispose(`disconnect: ${q}`).catch(Z=>B.warn("dispose during disconnect failed (ignored)",{agentId:D,err:String(Z)})),j.status="disconnected",d.unregister(D)),d.disconnectedAgents.add(D)},detailSyncer:async D=>{if(!P.ref)throw new Error("agent-detail-sync not initialized yet");await P.ref.syncOne(D)},openclawRepair:async(D,q)=>{await g.openclawRepair(D,q)}});d.registerExtension("_agent/listSkills",D=>I.listSkills(D.params)),d.registerExtension("_agent/addSkills",D=>I.addSkills(D.params)),d.registerExtension("_agent/removeSkills",D=>I.removeSkills(D.params)),d.registerExtension("_agent/getFileTree",D=>I.getFileTree(D.params)),d.registerExtension("_agent/getFileContent",D=>I.getFileContent(D.params)),d.registerExtension("_agent/update",D=>I.updateAgent(D.params)),d.registerExtension("_agent/disconnect",D=>I.disconnectAgent(D.params)),d.registerExtension("_agent/switchModel",D=>I.switchModel(D.params)),d.registerExtension("_agent/reset",D=>I.resetAgent(D.params)),d.registerExtension("_agent/repair",D=>I.repairAgent(D.params));let T=new nn({paths:x,handlers:I,sendDetail:D=>d.sendRequest("_agent/detail",D)});P.ref=T,c.onConnect(({initial:D})=>{B.info("frontier upstream connected, triggering detail sync",{initial:D}),T.syncAll(D?"initial-connect":"reconnect").catch(q=>B.warn("detail sync top-level error (ignored)",{err:String(q)}))});let z=new kn({paths:x,routes:[{method:"GET",path:"/status",handler:async()=>({running:!0,pid:process.pid,agents:[...d.agents.keys()],deviceId:y??"",frameworksCache:o.frameworksCache??{}})},{method:"POST",path:"/pair",handler:async D=>{let q=D,j=q?.privatecode,Z=q?.pairing_code;if(!j||!Z)throw new E("IPC_BAD_REQUEST","/pair requires privatecode + pairing_code");let ke=on(q.env),ge=q.handshake_url,Ve=q.frontier_url,vt=ju(q.env,ge,Ve),jt=!!w&&w!==j,ye=b!==void 0&&b!==vt,be=jt||ye;if(be){B.warn("pair config switched, resetting agents",{pcChanged:jt,envChanged:ye,previousPc:w?Qo(w):"",nextPc:Qo(j),previousEnvKey:b??"",nextEnvKey:vt});for(let K of[...d.agents.values()])await K.dispose("pair config switch").catch(()=>{}),d.agents.delete(K.agentId);await c.swap(new Wt,"pair switch").catch(()=>{})}let Jt=await Ys({privatecode:j,...ge?{endpoint:ge}:{},ppeOverride:ke});y=Jt.deviceId,_r({deviceId:y,pid:process.pid});let se=new Yn({handshake:Jt,privatecode:j,...Ve?{urlOverride:Ve}:{},ppeOverride:ke});await c.swap(se,"pair");let Vt=Object.keys(o.frameworksCache??{});try{let K=await d.sendRequest("_agent/pair",{pairCode:Z,patToken:j,frameworks:Vt,_meta:{cozeDeviceId:y}});B.info("_agent/pair ok",{pairResult:K}),w=j,b=vt,C||(C=new un({core:d,getDeviceId:()=>y??""})),C.start(),be&&Zo(x,g).catch(Pe=>B.warn("post-pair-switch auto-revive error (ignored)",{err:String(Pe)}));let J;return q.agent_id&&(J=await Vu(q.agent_id,x,g,Pe=>d.sendRequest("_agent/detail",Pe)).catch(Pe=>(B.error("--agent-id ensureAgent failed",{agentId:q.agent_id,err:String(Pe)}),{ok:!1,agentId:q.agent_id??"",note:String(Pe)}))),{ok:!0,note:"paired with cloud",...J?{agent:J}:{}}}catch(K){return B.error("_agent/pair failed",{err:String(K)}),{ok:!1,note:`pair failed: ${String(K)}`}}}},{method:"POST",path:"/_agent/create",handler:async D=>{let q=D;return{ok:!0,result:await g.createAgent(q)}}},{method:"POST",path:"/refresh",handler:async()=>{B.info("IPC /refresh: re-detecting frameworks");let D=new Nt;return o.frameworksCache=await D.detectAll(),await Ot(o),{ok:!0,frameworks:o.frameworksCache}}},{method:"POST",path:"/shutdown",handler:async()=>(B.info("IPC /shutdown received"),setImmediate(()=>{ae.shutdown("ipc /shutdown")}),{ok:!0})}]}),{port:re,token:Q}=await z.start();await d.start(),Zo(x,g).catch(D=>B.warn("auto-revive top-level error (ignored)",{err:String(D)}));let _e=null,ae={port:re,token:Q,core:d,ipc:z,shutdown(D){return _e||(B.info("daemon shutdown",{reason:D}),_e=(async()=>{C?.stop(),await d.stop(D),await z.stop(),await r.release()})(),_e)}};for(let D of["SIGTERM","SIGINT"])process.on(D,()=>{ae.shutdown(D).then(()=>process.exit(0))});return B.info("daemon ready",{port:re,pid:process.pid,nodeVersion:process.version,platform:process.platform,frameworks:Object.keys(o.frameworksCache??{}),libVersion:o.libVersion??"dev"}),ae}function Qo(r){return r.length<=8?"***":`${r.slice(0,4)}***${r.slice(-4)}`}function ju(r,e,i){return`${r??""}|${e??""}|${i??""}`}async function Ju(r,e){let{readdir:i}=await import("node:fs/promises"),o;try{o=await i(r.agentsRoot)}catch{return}let{loadAgentConfig:c,enforceAgentConfigMode:x}=await Promise.resolve().then(()=>(Ue(),tn));for(let f of o){await x(f,r).catch(d=>B.warn("enforceAgentConfigMode failed (ignored)",{agentId:f,err:String(d)}));try{let d=await c(f,r);d?.disconnectedAt&&(e.disconnectedAgents.add(f),B.info("agent marked disconnected on startup",{agentId:f,disconnectedAt:d.disconnectedAt,reason:d.disconnectReason??""}))}catch(d){B.warn("failed to load agent config on startup, skipping",{agentId:f,err:String(d)})}}}async function Vu(r,e,i,o){let{loadAgentConfig:c}=await Promise.resolve().then(()=>(Ue(),tn)),x=await c(r,e);if(x){B.info("--agent-id: local config found, reconnecting",{agentId:r,framework:x.framework,hadDisconnect:!!x.disconnectedAt});let w={agentId:x.agentId,framework:x.framework,...x.cozeIdentity?{cozeIdentity:x.cozeIdentity}:{},...x.model?{model:x.model}:{}};return await i.createAgent(w),{ok:!0,agentId:r,note:x.disconnectedAt?"revived from local config":"connected from local config"}}B.info("--agent-id: local config missing, pulling _agent/detail from cloud",{agentId:r});let f=await o({_meta:{cozeAgentId:r}});if(!f.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 d={agentId:f.agentId,framework:f.framework,...f.cozeIdentity?{cozeIdentity:f.cozeIdentity}:{},...f.model?{model:f.model}:{},...f.deployType?{_meta:{cozeDeployType:f.deployType}}:{}};await i.createAgent(d);let g=f.deployType==="cloud"&&f.framework==="openclaw";return{ok:!0,agentId:r,note:g?"cloud agent acknowledged":"created from cloud detail"}}async function Zo(r,e){let{readdir:i}=await import("node:fs/promises"),o;try{o=await i(r.agentsRoot)}catch{return{revived:0,skipped:0,total:0}}if(o.length===0)return{revived:0,skipped:0,total:0};let{loadAgentConfig:c}=await Promise.resolve().then(()=>(Ue(),tn));B.info("auto-revive: scanning local agents on startup",{count:o.length});let x=0,f=0;for(let d of o){let g;try{g=await c(d,r)}catch(w){B.warn("auto-revive: load config failed (skipping)",{agentId:d,err:String(w)}),f+=1;continue}if(!g){f+=1;continue}if(g.disconnectedAt){B.info("auto-revive: skip disconnected agent",{agentId:d,disconnectedAt:g.disconnectedAt}),f+=1;continue}try{B.info("auto-revive: re-registering agent (D44 no spawn)",{agentId:d,framework:g.framework}),await e.createAgent({agentId:g.agentId,framework:g.framework,...g.cozeIdentity?{cozeIdentity:g.cozeIdentity}:{},...g.model?{model:g.model}:{},...g.deployType?{_meta:{cozeDeployType:g.deployType}}:{}}),x+=1}catch(w){B.warn("auto-revive: createAgent failed (skipping)",{agentId:d,framework:g.framework,err:String(w)}),f+=1}}return B.info("auto-revive: done",{revived:x,skipped:f,total:o.length}),{revived:x,skipped:f,total:o.length}}es();xe();import{readFile as na}from"node:fs/promises";var Je=class{paths;constructor(e){this.paths=e??G()}async probe(e=1e3){let i=await this.readAuth();if(!i)return{kind:"not-running"};try{let o=await this.fetch(i,{method:"GET",path:"/status",timeoutMs:e});return o.status===200?{kind:"connected",...i}:{kind:"stale",reason:`unexpected status ${o.status}`}}catch(o){return{kind:"stale",reason:rf(o)}}}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([na(this.paths.portFile,"utf8"),na(this.paths.tokenFile,"utf8")]),o=Number.parseInt(e.trim(),10),c=i.trim();return!Number.isFinite(o)||o<=0||!c?null:{port:o,token:c}}catch(e){if(e.code==="ENOENT")return null;throw e}}async fetch(e,i){let o=i.body!==void 0,c={Authorization:`Bearer ${e.token}`};o&&(c["content-type"]="application/json");let x=new AbortController,f=setTimeout(()=>x.abort(),i.timeoutMs??5e3);try{let d=await fetch(`http://127.0.0.1:${e.port}${i.path}`,{method:i.method,headers:c,body:o?JSON.stringify(i.body):void 0,signal:x.signal}),g=await d.text();return{status:d.status,body:nf(g)}}finally{clearTimeout(f)}}};function nf(r){if(!r)return null;try{return JSON.parse(r)}catch{return r}}function rf(r){return r instanceof Error?r.message:String(r)}U();xe();import{copyFile as ra,mkdir as sf,readFile as ts,writeFile as of}from"node:fs/promises";import{dirname as af,resolve as ns,sep as Qn}from"node:path";import{fileURLToPath as cf}from"node:url";U();xe();var sa=L("dist-install");function xf(r){let e=cf(r),i=af(e),o=`${Qn}src${Qn}`;if(i.includes(o)||i.endsWith(`${Qn}src${Qn}cli`))return null;let c=ns(i,"index.js"),x=ns(i,"..","package.json");return{dist:c,pkgJson:x}}async function ia(r={}){let e=r.paths??G(),i=xf(import.meta.url),o=r.sourceDist??i?.dist,c=r.sourcePackageJson??i?.pkgJson;if(!o||!c)return{kind:"dev-mode-skip",reason:"running from src/(tsx loader);no dist/ to install"};let x;try{x=JSON.parse(await ts(c,"utf8")).version??"unknown"}catch(y){return sa.warn("cannot read source package.json,skip dist install",{err:String(y)}),{kind:"dev-mode-skip",reason:`package.json read failed: ${String(y)}`}}let f=await En(e.configFile)??{},d=f.libVersion;if(d===x)try{return await ts(e.libEntry),{kind:"already-current",libVersion:x}}catch{}await sf(e.libDir,{recursive:!0}),await ra(o,e.libEntry),await ra(`${o}.map`,`${e.libEntry}.map`).catch(()=>{});let g=ns(e.libDir,"package.json"),w=`${JSON.stringify({type:"module"},null,2)}
94
- `;return await ts(g,"utf8").catch(()=>null)!==w&&await of(g,w),f.libVersion=x,await Ot(f,e.configFile),sa.info("dist installed",{libEntry:e.libEntry,fromVersion:d,toVersion:x}),d?{kind:"version-changed",fromVersion:d,toVersion:x,libEntry:e.libEntry}:{kind:"first-install",libVersion:x,libEntry:e.libEntry}}var Pf=L("cli");function bt(r,e){let i=[],o;for(let c=0;c<r.length;c++){let x=r[c];if(x===e){o=r[c+1],c+=1;continue}if(x.startsWith(`${e}=`)){o=x.slice(e.length+1);continue}i.push(x)}return{value:o,rest:i}}function Df(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:o,rest:c}=bt(i,"--pat-token");i=c;let{value:x,rest:f}=bt(i,"--pair-code");i=f;let{value:d,rest:g}=bt(i,"--env");i=g;let{value:w,rest:b}=bt(i,"--handshake-url");i=b;let{value:y,rest:C}=bt(i,"--frontier-url");i=C;let{value:P}=bt(i,"--agent-id");if(!o||!x)return{mode:"help"};let I={mode:"pair",privatecode:o,pairingCode:x};return d&&(I.env=d),w&&(I.handshakeUrl=w),y&&(I.frontierUrl=y),P&&(I.agentId=P),I}var If=`
88
+ ${c}`}var Se=N("agent-detail-sync"),sn=class{constructor(e){this.opts=e}opts;async syncAll(e){let i=this.opts.paths.agentsRoot,a;try{a=await A0(i)}catch(c){Se.info("agents dir not found, skip detail sync",{root:i,err:String(c)});return}Se.info("starting detail sync",{reason:e,count:a.length});for(let c of a)try{await this.syncOne(c)}catch(u){Se.warn("detail sync failed for agent, skipping",{agentId:c,err:String(u)})}Se.info("detail sync done",{reason:e})}async syncOne(e){let i=await de(e,this.opts.paths);if(!i){Se.info("detail sync: agent config missing, skip",{agentId:e});return}let a;try{a=await this.opts.sendDetail({_meta:{cozeAgentId:e}})}catch(d){Se.warn("detail RPC failed, using local data",{agentId:e,err:String(d)});return}if(a.agentId&&a.agentId!==e){Se.warn("detail response agentId mismatch, ignoring",{agentId:e,responseAgentId:a.agentId});return}let c=!1,u=!1;if(a.agentName&&a.agentName!==i.agentName&&(i.agentName=a.agentName,c=!0),a.description!==void 0&&a.description!==i.description&&(i.description=a.description,c=!0),a.cozeIdentity&&a.cozeIdentity!==i.cozeIdentity&&(i.cozeIdentity=a.cozeIdentity,c=!0,u=!0),a.deployType&&Se.info("detail.deployType",{agentId:e,deployType:a.deployType}),!c){Se.debug("detail sync: no diff",{agentId:e});return}await we(i,this.opts.paths),Se.info("detail sync: config updated",{agentId:e,identityChanged:u,agentName:i.agentName}),u&&(await ut(i.workspace,i.framework,e,i.cozeIdentity),await this.opts.handlers.reloadAgentSessionsPublic(e,"detail-sync"))}};Ke();import{spawn as ri}from"node:child_process";import{lstat as Cr,mkdir as I0,readFile as si,readdir as T0,rm as R0,stat as N0,writeFile as L0}from"node:fs/promises";import{join as Oe,normalize as O0,relative as ii,resolve as B0,sep as oi}from"node:path";var Ee={PAIR:"_agent/pair",CREATE:"_agent/create",HEALTH:"_agent/health",LIST_SKILLS:"_agent/listSkills",ADD_SKILLS:"_agent/addSkills",REMOVE_SKILLS:"_agent/removeSkills",GET_FILE_TREE:"_agent/getFileTree",GET_FILE_CONTENT:"_agent/getFileContent",DETAIL:"_agent/detail",UPDATE:"_agent/update",DISCONNECT:"_agent/disconnect",SWITCH_MODEL:"_agent/switchModel",GEN_MODEL_TOKEN:"_agent/genModelToken",RESET:"_agent/reset",REPAIR:"_agent/repair",DELETE:"_agent/delete"};function kt(r){return r?.cozeDeployType==="cloud"?"cloud":"local"}function Fs(r){let{_meta:e,...i}=r;return{stripped:i,meta:e}}function dt(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)}};G();ue();function Le(r,e){if(kt(r)!=="cloud")throw new E("OPERATION_NOT_ALLOWED_FOR_LOCAL",`${e} is not allowed for local agent`)}function Dt(r){return r.replace(/[^A-Za-z0-9._-]+/g,"-")}G();var on="1008033",Us="1289";var Gs="pbbp2",Ks="https://www.coze.cn",Hs="/api/coze_claw/resource/get_frontier_key",P0="https://www.coze.cn",k0="wss://frontier.coze.cn";function js(r){return r??process.env.COZE_BRIDGE_HANDSHAKE_URL??P0}function Ws(r){return r??process.env.COZE_BRIDGE_FRONTIER_URL??k0}function an(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}function cn(r){return r?r.startsWith("boe_")?{ttEnv:r}:{ttEnv:r,usePpe:"1"}:{}}var Js=N("handshake");async function Vs(r){let e=js(r.endpoint),i=r.timeoutMs??1e4,a=`${D0(e)}${Hs}?aid=${encodeURIComponent(on)}`,c={Authorization:`Bearer ${r.privatecode}`,Accept:"application/json",...an(r.ppeOverride)},u=new AbortController,d=setTimeout(()=>u.abort(),i);Js.info("frontier key handshake",{base:e});try{let h=await fetch(a,{method:"GET",headers:c,signal:u.signal}),m=h.headers.get("x-tt-logid")??"",w=h.headers.get("x-tt-trace-id")??"";if(!h.ok){let k=await h.text().catch(()=>"");throw new E("UPSTREAM_HANDSHAKE_FAILED",`handshake HTTP ${h.status} logid=${m}: ${k.slice(0,200)}`)}let _=await h.json();if(_.code!==void 0&&_.code!==0)throw new E("UPSTREAM_HANDSHAKE_FAILED",`handshake code=${_.code} msg=${_.msg??"-"} logid=${m}`);let y=_.data?.access_key,A=_.data?.device_id;if(!y||!A)throw new E("UPSTREAM_HANDSHAKE_FAILED",`handshake response missing access_key/device_id logid=${m}: ${JSON.stringify(_)}`);return Js.info("handshake ok",{remoteDeviceId:A,logid:m,traceId:w}),{accessKey:y,deviceId:A}}catch(h){throw h instanceof E?h:h.name==="AbortError"?new E("UPSTREAM_HANDSHAKE_FAILED",`handshake timeout (${i}ms)`):new E("UPSTREAM_HANDSHAKE_FAILED",String(h),{cause:h})}finally{clearTimeout(d)}}function D0(r){return r.endsWith("/")?r.slice(0,-1):r}var vr="https://llm-gateway.coze.cn",He="auto";function Ys(r){return{model:r.model??He,...r.modelToken?{modelToken:r.modelToken}:{}}}function It(r){return!r||r===He}function $s(r){let e={};return r.modelToken?(e.ANTHROPIC_BASE_URL=vr,e.ANTHROPIC_AUTH_TOKEN=r.modelToken,e.ANTHROPIC_MODEL=r.model||He):It(r.model)||(e.ANTHROPIC_MODEL=r.model),e}function Xs(r){let e=[];return r.modelToken?e.push("-c",`model="${r.model||He}"`):It(r.model)||e.push("-c",`model="${r.model}"`),r.modelToken&&(e.push("-c",'model_providers.coze.name="coze"'),e.push("-c",`model_providers.coze.base_url="${vr}/v1"`),e.push("-c",'model_providers.coze.env_key="OPENAI_API_KEY"'),e.push("-c",'model_providers.coze.wire_api="responses"'),e.push("-c","model_providers.coze.requires_openai_auth=false"),e.push("-c","model_providers.coze.supports_websockets=false"),e.push("-c",'model_provider="coze"')),e}function Zs(r){return r.modelToken?{OPENAI_API_KEY:r.modelToken}:{}}function Sr(r){let{ttEnv:e,usePpe:i}=cn(r),a={};return e&&(a["x-tt-env"]=e),i&&(a["x-use-ppe"]=i),a}function Qs(r,e){if(!r.modelToken)return{};let i=Sr(e);return Object.keys(i).length===0?{}:{ANTHROPIC_CUSTOM_HEADERS:Object.entries(i).map(([c,u])=>`${c}:${u}`).join(`
89
+ `)}}function Er(r){return`coze-session-${r.replace(/[^A-Za-z0-9_-]+/g,"-")}`}function ei(r,e){if(!r.modelToken||It(r.model))return null;let i=Sr(e),a={baseUrl:`${vr}/v1`,api:"openai-completions",apiKey:r.modelToken,models:[{id:r.model,name:r.model,reasoning:!1,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8192,api:"openai-completions"}]};return Object.keys(i).length>0&&(a.headers=i),a}function ti(r,e){if(!r.modelToken)return[];let i=Sr(e),a=[];for(let[c,u]of Object.entries(i))a.push("-c",`model_providers.coze.http_headers.${c}="${u}"`);return a}var se=N("agent-handlers"),ni=5*1024*1024,M0=1,z0=6,q0=new Set(["node_modules",".git",".coze","dist","build",".next"]),un=class{constructor(e){this.opts=e}opts;async listSkills(e){Le(e._meta,"_agent/listSkills");let i=dt(e._meta),a=await this.loadAgentCfg(i),c=a?.workspace??Ne(i).workspace,u=a?.skills??[],d=[];for(let h of u){let m=Oe(c,h.relPath,"SKILL.md");await N0(m).then(_=>_.isFile()).catch(()=>!1)&&d.push({skillId:h.skillId,skillName:h.skillName,downloadUrl:h.downloadUrl??"",...h.description?{description:h.description}:{},...h.version?{version:h.version}:{}})}return{skills:d}}async addSkills(e){Le(e._meta,"_agent/addSkills");let i=dt(e._meta),a=await this.requireAgentCfg(i),c=e.skills??[],u=[...a.skills??[]],d=new Map(u.map((m,w)=>[m.skillId,w])),h=[];for(let m of c){if(!m.skillName)throw new E("IPC_BAD_REQUEST","skill missing skillName");let w=F0(m.skillName),_=U0(a.framework),y=Oe(_,w),A=Oe(a.workspace,y);await I0(A,{recursive:!0});let k=await H0(m.downloadUrl);W0(k)?await J0(k,A):await L0(Oe(A,"SKILL.md"),k.toString("utf8"),"utf8");let T={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=d.get(m.skillId);R!==void 0?u[R]=T:(d.set(m.skillId,u.length),u.push(T)),h.push(m),se.info("skill installed",{agentId:i,skillId:m.skillId,skillName:m.skillName,relPath:y})}return await nn(i,u),await this.reloadAgentSessions(i,"skills-added"),{installedSkills:h}}async removeSkills(e){Le(e._meta,"_agent/removeSkills");let i=dt(e._meta),a=await this.requireAgentCfg(i),c=new Set(e.skillIds??[]),u=a.skills??[],d=[];for(let h of u){if(!c.has(h.skillId)){d.push(h);continue}let m=Oe(a.workspace,h.relPath);await R0(m,{recursive:!0,force:!0}),se.info("skill removed",{agentId:i,skillId:h.skillId,relPath:h.relPath})}return await nn(i,d),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[c,u]of a.sessions)if(!(!u.downstream||!u.acpSessionId)){u.loadingSession=!0;try{await u.downstream.sessionLoad({sessionId:u.acpSessionId,cwd:a.workspace}),se.info("session reloaded",{reason:i,agentId:e,framework:a.framework,cloudId:c,acpId:u.acpSessionId})}catch(d){se.warn("session reload failed",{reason:i,agentId:e,framework:a.framework,cloudId:c,acpId:u.acpSessionId,err:String(d)})}finally{u.loadingSession=!1}}}}async updateAgent(e){if(!e.cozeIdentity?.trim())return se.info("_agent/update: empty cozeIdentity, noop",{agentId:e.agentId}),{ok:!0};let i=e.agentId,a=await de(i);if(!a)throw new E("AGENT_NOT_FOUND",`agent not found: ${i}`);return a.cozeIdentity===e.cozeIdentity?(se.info("_agent/update: cozeIdentity unchanged, noop",{agentId:i}),{ok:!0}):(a.cozeIdentity=e.cozeIdentity,await we(a),await ut(a.workspace,a.framework,i,e.cozeIdentity),se.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 de(i);return a?(a.disconnectedAt=Date.now(),a.disconnectReason=e.reason??"",await we(a),se.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}):(se.warn("_agent/disconnect: agent not found, ignoring",{agentId:i}),{ok:!0})}async switchModel(e){if(Le(e._meta,"_agent/switchModel"),!e.agentId)throw new E("IPC_BAD_REQUEST","_agent/switchModel: missing agentId");let i=e.model?.trim()?e.model:He,a=await de(e.agentId);if(!a)throw new E("AGENT_NOT_FOUND",`agent not found: ${e.agentId}`);a.model=i,await we(a),se.info("_agent/switchModel: model persisted",{agentId:e.agentId,model:i,reason:e.reason??""});let c=this.opts.agents.get(e.agentId);if(!c)return se.info("_agent/switchModel: agent not running, config persisted only",{agentId:e.agentId}),{ok:!0};c.model=i;let u=[];for(let[d,h]of c.allSessionQueues())u.push(h.enqueue(async()=>{let m=c.sessions.get(d);m?.downstream&&(await m.downstream.stop(`switchModel: ${i}`).catch(()=>{}),m.downstream=void 0)}));return await Promise.all(u),se.info("_agent/switchModel: all session runtimes killed, next prompt will respawn",{agentId:e.agentId,model:i,cloudSessions:u.length}),{ok:!0}}async resetAgent(e){if(Le(e._meta,Ee.RESET),!e.agentId)throw new E("IPC_BAD_REQUEST",`${Ee.RESET}: missing agentId`);return await this.runDetailSync(e.agentId,Ee.RESET,e.reason),{ok:!0}}async repairAgent(e){if(Le(e._meta,Ee.REPAIR),!e.agentId)throw new E("IPC_BAD_REQUEST",`${Ee.REPAIR}: missing agentId`);let i=await this.loadAgentCfg(e.agentId);if(i&&i.framework!=="openclaw")throw new E("IPC_BAD_REQUEST",`${Ee.REPAIR} only allowed for openclaw, got ${i.framework}`);if(i&&this.opts.openclawRepair)try{await this.opts.openclawRepair(e.agentId,i.workspace)}catch(a){se.warn("openclaw repair (delete+add) failed (ignored)",{agentId:e.agentId,reason:e.reason,err:String(a)})}return await this.runDetailSync(e.agentId,Ee.REPAIR,e.reason),{ok:!0}}async runDetailSync(e,i,a){if(!this.opts.detailSyncer){se.warn("detailSyncer not wired, skipping sync",{method:i,agentId:e});return}try{await this.opts.detailSyncer(e)}catch(c){se.warn("detail sync failed (ignored)",{method:i,agentId:e,reason:a,err:String(c)})}}async getFileTree(e){Le(e._meta,"_agent/getFileTree");let i=e._meta,a=dt(i),c=await this.resolveWorkspace(a),u=e.filePath??"",d=this.safeJoin(c,u),h=await Cr(d).catch(()=>null);if(!h)throw new E("IPC_BAD_REQUEST",`path not found: ${u}`);if(h.isSymbolicLink())throw new E("IPC_BAD_REQUEST",`symlink not allowed: ${u}`);let m=Y0(e.depth);return h.isDirectory()?{tree:await ai(c,d,u,m)}:{tree:[{name:$0(u),path:ci(u||"."),isDir:!1,size:h.size,modifiedAt:Math.floor(h.mtimeMs)}]}}async getFileContent(e){Le(e._meta,"_agent/getFileContent");let i=dt(e._meta),a=await this.resolveWorkspace(i);if(!e.filePath)throw new E("IPC_BAD_REQUEST","filePath required");let c=this.safeJoin(a,e.filePath),u=await Cr(c).catch(()=>null);if(!u||!u.isFile())throw new E("IPC_BAD_REQUEST",`not a file: ${e.filePath}`);if(u.isSymbolicLink())throw new E("IPC_BAD_REQUEST",`symlink not allowed: ${e.filePath}`);if(u.size>ni)throw new E("IPC_BAD_REQUEST",`file too large: ${u.size} bytes (max ${ni})`);let d=await si(c);return d.includes(0)?{content:d.toString("base64"),encoding:"base64",size:u.size}:{content:d.toString("utf8"),encoding:"utf-8",size:u.size}}async resolveWorkspace(e){let i=this.opts.agents.get(e);return i?i.workspace:(await de(e).catch(()=>null))?.workspace??Ne(e).workspace}safeJoin(e,i){let a=B0(e,i||"."),c=ii(e,a);if(c.startsWith("..")||c===".."||c.startsWith(`..${oi}`))throw new E("IPC_BAD_REQUEST",`path escapes workspace: ${i}`);return a}loadAgentCfg(e){return de(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 F0(r){let e=Dt(r.trim()).replace(/^-+|-+$/g,"").slice(0,64);if(!e||e==="."||e==="..")throw new E("IPC_BAD_REQUEST",`invalid skill name: ${r}`);return e}function U0(r){return r==="claude-code"?Oe(".claude","skills"):Oe(".agents","skills")}var G0=3e4,K0=50*1024*1024,dn=3e4;async function H0(r){if(!r)throw new E("IPC_BAD_REQUEST","skill missing downloadUrl");if(r.startsWith("data:")){let e=Math.floor(r.length*3/4);xn(e);let i=j0(r);return xn(i.length),i}if(r.startsWith("file:")){let e=new URL(r).pathname,i=await si(e);return xn(i.length),i}if(r.startsWith("http://")||r.startsWith("https://")){let e=new AbortController,i=setTimeout(()=>e.abort(),G0);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 c=await a.arrayBuffer();return xn(c.byteLength),Buffer.from(c)}finally{clearTimeout(i)}}throw new E("IPC_BAD_REQUEST",`unsupported downloadUrl scheme (\u8981 https/data/file): ${r.slice(0,80)}`)}function xn(r){if(r>K0)throw new E("IPC_BAD_REQUEST",`skill too large: ${r} bytes`)}function j0(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 W0(r){return r.length>=2&&r[0]===31&&r[1]===139}async function J0(r,e){await V0(r),await new Promise((i,a)=>{let c=ri("tar",["-xzf","-","-C",e,"--strip-components=1","--no-same-owner"],{stdio:["pipe","pipe","pipe"]}),u="";c.stderr?.on("data",h=>{u+=String(h)});let d=setTimeout(()=>{c.kill("SIGKILL"),a(new E("IPC_BAD_REQUEST",`tar extract timeout (${dn}ms)`))},dn);c.on("error",h=>{clearTimeout(d),a(new E("IPC_BAD_REQUEST",`tar spawn failed: ${h.message}`,{cause:h}))}),c.on("exit",h=>{clearTimeout(d),h===0?i():a(new E("IPC_BAD_REQUEST",`tar exit ${h}${u?`: ${u.trim().slice(0,200)}`:""}`))}),c.stdin?.end(r)})}async function V0(r){let e=await new Promise((i,a)=>{let c=ri("tar",["-tzvf","-"],{stdio:["pipe","pipe","pipe"]}),u="",d="";c.stdout?.on("data",m=>{u+=String(m)}),c.stderr?.on("data",m=>{d+=String(m)});let h=setTimeout(()=>{c.kill("SIGKILL"),a(new E("IPC_BAD_REQUEST",`tar list timeout (${dn}ms)`))},dn);c.on("error",m=>{clearTimeout(h),a(new E("IPC_BAD_REQUEST",`tar list spawn failed: ${m.message}`))}),c.on("exit",m=>{clearTimeout(h),m===0?i(u):a(new E("IPC_BAD_REQUEST",`tar list exit ${m}${d?`: ${d.trim().slice(0,200)}`:""}`))}),c.stdin?.end(r)});for(let i of e.split(`
90
+ `)){let a=i.trim();if(!a)continue;let c=a.charCodeAt(0);if(c!==45&&c!==100)throw new E("IPC_BAD_REQUEST",`tar entry kind '${a[0]}' not allowed (symlink/hardlink/special): ${a.slice(0,100)}`);let d=(a.match(/\s(\S.*)$/)?.[1]??"").split(" -> ")[0]?.trim()??"";if(!d)continue;if(d.startsWith("/"))throw new E("IPC_BAD_REQUEST",`tar entry absolute path: ${d}`);if(d.split(/[/\\]/).some(m=>m===".."))throw new E("IPC_BAD_REQUEST",`tar entry contains '..': ${d}`)}}async function ai(r,e,i,a){if(a<=0)return[];let c;try{c=await T0(e,{withFileTypes:!0})}catch{return[]}let u=[];for(let d of c){if(q0.has(d.name)||d.isSymbolicLink())continue;let h=Oe(e,d.name),m=O0(Oe(i,d.name)),w=null;try{w=await Cr(h)}catch{continue}if(w.isSymbolicLink())continue;let _={name:d.name,path:ci(ii(r,h)),isDir:w.isDirectory(),size:w.size,modifiedAt:Math.floor(w.mtimeMs)};w.isDirectory()&&a>1&&(_.children=await ai(r,h,m,a-1)),u.push(_)}return u.sort((d,h)=>d.isDir!==h.isDir?d.isDir?-1:1:d.name.localeCompare(h.name)),u}function Y0(r){return!r||r<=0?M0:Math.min(r,z0)}function $0(r){if(!r||r==="."||r==="/")return".";let e=r.split(/[/\\]/);return e[e.length-1]||"."}function ci(r){return r.split(oi).join("/")}G();var Tt=N("agent-health-reporter"),X0=1e4,fn=class{constructor(e){this.opts=e;this.intervalMs=e.intervalMs??X0}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()}),Tt.info("heartbeat started",{intervalMs:this.intervalMs}),this.tick())}stop(){this.timer&&(clearInterval(this.timer),this.timer=null,this.unsubscribeRegister&&(this.unsubscribeRegister(),this.unsubscribeRegister=null),Tt.info("heartbeat stopped"))}async tick(){if(this.inFlight){Tt.debug("previous tick still in-flight, skip");return}let e=this.opts.getDeviceId();if(!e){Tt.debug("deviceId not available, skip tick (\u5C1A\u672A pair)");return}this.inFlight=!0;try{let i=[];for(let c of this.opts.core.agents.values()){let u=Z0(c);u&&i.push({agentId:c.agentId,status:u})}if(i.length===0)return;let a={agents:i,_meta:{cozeDeviceId:e}};try{await this.opts.core.sendRequest("_agent/health",a)}catch(c){Tt.warn("heartbeat batch send failed",{count:i.length,err:String(c)})}}finally{this.inFlight=!1}}};function Z0(r){return r.status==="error"?"error":r.activeTriggers.size>0?"busy":r.status==="ok"?"online":null}Ke();import{mkdir as Pr,rm as Cc}from"node:fs/promises";G();import{execFile as Q0}from"node:child_process";import{promisify as ec}from"node:util";var ui=ec(Q0),Rt=N("agents.acp-installer"),tc={"claude-code":{npmPackage:"@agentclientprotocol/claude-agent-acp",binary:"claude-agent-acp"},codex:{npmPackage:"@zed-industries/codex-acp",binary:"codex-acp"}},nc=5e4,rc=5e3,sc=5*6e4,hn=new Map,ln=new Map,Ar=new Map;async function xi(r){let e=process.platform==="win32"?"where":"which";try{let{stdout:i}=await ui(e,[r],{timeout:rc});return i.split(`
91
+ `)[0]?.trim()||void 0}catch{return}}async function ic(r){Rt.info("npm install -g start",{npmPackage:r}),await ui("npm",["install","-g",`${r}@latest`],{timeout:nc,maxBuffer:10*1024*1024}),Rt.info("npm install -g done",{npmPackage:r})}async function di(r){let e=tc[r];if(!e)return;let i=hn.get(r);if(i)return i;let a=ln.get(r);if(a&&Date.now()-a<sc)return;let c=Ar.get(r);if(c)return c;let u=(async()=>{let d=await xi(e.binary);if(d)return hn.set(r,d),Rt.info("acp wrapper found on PATH",{binary:e.binary,path:d}),d;try{await ic(e.npmPackage)}catch(m){Rt.warn("acp wrapper install failed (will fallback to npx)",{npmPackage:e.npmPackage,err:String(m)}),ln.set(r,Date.now());return}let h=await xi(e.binary);if(!h){Rt.warn("acp wrapper installed but binary not found on PATH",{binary:e.binary}),ln.set(r,Date.now());return}return hn.set(r,h),ln.delete(r),h})().finally(()=>{Ar.delete(r)});return Ar.set(r,u),u}function gn(r){return hn.get(r)}import{spawn as uc}from"node:child_process";function Nt(r,e,i){return i===void 0?{jsonrpc:"2.0",id:r,method:e}:{jsonrpc:"2.0",id:r,method:e,params:i}}function pn(r,e){return e===void 0?{jsonrpc:"2.0",method:r}:{jsonrpc:"2.0",method:r,params:e}}function ft(r,e){return{jsonrpc:"2.0",id:r,result:e}}function Ze(r,e){return{jsonrpc:"2.0",id:r,error:e}}var mn=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)}},W={PARSE_ERROR:-32700,INVALID_REQUEST:-32600,METHOD_NOT_FOUND:-32601,INVALID_PARAMS:-32602,INTERNAL_ERROR:-32603,AGENT_NOT_FOUND:-32001,AGENT_BUSY:-32002,AGENT_TIMEOUT:-32003,AGENT_SPAWN_FAILED:-32004,OPERATION_NOT_ALLOWED_FOR_LOCAL:-32005,AGENT_DISCONNECTED:-32006,MODEL_TOKEN_GEN_FAILED:-32009};function fi(r){return"method"in r&&"id"in r&&r.id!==void 0}function li(r){return"method"in r&&!("id"in r)}function wn(r){return!("method"in r)&&"id"in r}var oc={AGENT_NOT_FOUND:W.AGENT_NOT_FOUND,AGENT_BUSY:W.AGENT_BUSY,AGENT_DISCONNECTED:W.AGENT_DISCONNECTED,AGENT_TIMEOUT:W.AGENT_TIMEOUT,AGENT_SPAWN_FAILED:W.AGENT_SPAWN_FAILED,AGENT_PROTOCOL_ERROR:W.INTERNAL_ERROR,BRIDGE_CONFIG_INVALID:W.INTERNAL_ERROR,BRIDGE_INTERNAL:W.INTERNAL_ERROR,IPC_AUTH_FAILED:W.INTERNAL_ERROR,IPC_BAD_REQUEST:W.INVALID_REQUEST,MODEL_TOKEN_GEN_FAILED:W.MODEL_TOKEN_GEN_FAILED,OPERATION_NOT_ALLOWED_FOR_LOCAL:W.OPERATION_NOT_ALLOWED_FOR_LOCAL,UPSTREAM_DISCONNECTED:W.INTERNAL_ERROR,UPSTREAM_HANDSHAKE_FAILED:W.INTERNAL_ERROR};function _n(r){return r instanceof E?{code:oc[r.code]??W.INTERNAL_ERROR,message:r.message,data:{bridgeCode:r.code,retriable:r.retriable}}:{code:W.INTERNAL_ERROR,message:r instanceof Error?r.message:String(r)}}function hi(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 gi(r){return`${JSON.stringify(r)}
92
+ `}var yn=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(`
93
+ `);this.buffer=i.pop()??"";let a=[];for(let c of i){let u=c.replace(/\r$/,"").trim();if(u)try{a.push(JSON.parse(u))}catch(d){this.onError?.({line:u,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(i){return this.onError?.({line:e,error:i}),[]}}};var mi={"session/prompt":"session.prompt","session/cancel":"session.cancel","session/new":"session.new","session/load":"session.load","_agent/create":"agent.create","_agent/health":"agent.health","_agent/pair":"agent.pair","_agent/listSkills":"agent.listSkills","_agent/addSkills":"agent.addSkills","_agent/removeSkills":"agent.removeSkills","_agent/getFileTree":"agent.getFileTree","_agent/getFileContent":"agent.getFileContent","_agent/detail":"agent.detail","_agent/update":"agent.update","_agent/disconnect":"agent.disconnect","_agent/switchModel":"agent.switchModel","_agent/genModelToken":"agent.genModelToken","_agent/reset":"agent.reset","_agent/repair":"agent.repair","session/request_permission":"session.requestPermission",initialize:"initialize"},Wf=Object.fromEntries(Object.entries(mi).map(([r,e])=>[e,r])),ac={"session.prompt":["agentId","triggerMsgId","sessionId"],"session.cancel":["agentId","triggerMsgId","sessionId"],"session.new":["agentId"],"session.load":["agentId"],"agent.create":["agentId"],"agent.health":[],"agent.listSkills":["agentId"],"agent.addSkills":["agentId"],"agent.removeSkills":["agentId"],"agent.getFileTree":["agentId"],"agent.getFileContent":["agentId"],"agent.detail":["agentId"],"agent.update":["agentId"],"agent.disconnect":["agentId"],"agent.switchModel":["agentId"],"agent.genModelToken":["agentId","sessionId"],"agent.reset":["agentId"],"agent.repair":["agentId"],"session.requestPermission":["agentId","sessionId"],"agent.pair":[],initialize:[]},lt=class{seq=0;next(e,i){this.seq+=1;let a=mi[e]??cc(e),c=ac[a]??[],u=[a,String(this.seq)];if(c.length>0){let d=c.map(m=>pi(i?.[m]??"")),h=xc(d).join(":");h&&u.push(h)}else i&&Object.values(i).some(d=>d)&&u.push(Object.values(i).filter(Boolean).map(d=>pi(String(d))).join(":"));return u.join("_")}reset(){this.seq=0}};function cc(r){return r.replace(/[\s/]+/g,".").replace(/_+/g,"-")}function pi(r){return r.replace(/[:_\s]+/g,"-")}function xc(r){let e=r.length;for(;e>0&&!r[e-1];)e-=1;return r.slice(0,e)}G();var dc=3e4,fc=50,lc=20;function wi(r,e){if(!(typeof r!="number"||r<=0))try{process.platform==="win32"?process.kill(r,e):process.kill(-r,e)}catch{}}var je=class{constructor(e){this.opts=e;this.log=N(`downstream.${this.constructor.name}`),this.decoder=new yn({onError:i=>this.log.warn("decode line failed",{line:i.line})})}opts;child;decoder;pending=new Map;idAllocator=new lt;updateHandlers=[];agentRequestHandlers=[];exitHandlers=[];log;stopped=!1;stderrRing=[];sanitizeEnv(e){return e}async start(){if(this.child)throw new E("BRIDGE_INTERNAL","Downstream already started");let e=process.platform!=="win32",i=uc(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 c of this.decoder.push(a))this.dispatch(c)}),i.stderr?.setEncoding("utf8"),i.stderr?.on("data",a=>{let c=a.trimEnd();this.stderrRing.push(c),this.stderrRing.length>fc&&this.stderrRing.shift(),this.log.debug("stderr",{text:c})}),i.on("exit",(a,c)=>{this.stopped=!0,(a!==0||c!==null)&&this.stderrRing.length>0&&this.log.warn("downstream exited abnormally, recent stderr",{code:a,signal:c,recentStderr:this.stderrRing.slice(-lc)}),this.failAllPending(new E("AGENT_PROTOCOL_ERROR",`agent exited (${a}/${c})`));for(let d of this.exitHandlers)d(a,c)}),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(u=>i.once("exit",()=>u()));wi(i.pid,"SIGTERM");let c=setTimeout(()=>{i.killed||wi(i.pid,"SIGKILL")},5e3);try{await a}finally{clearTimeout(c)}}pid(){return this.child?.pid}isAlive(){return!!this.child&&!this.stopped}initialize(e){return this.call("initialize",e)}sessionNew(e){return this.call("session/new",{mcpServers:[],...e})}sessionLoad(e){return this.call("session/load",{mcpServers:[],...e})}sessionPrompt(e){return this.call("session/prompt",e,0)}async sessionCancel(e){!this.child||this.stopped||this.writeFrame(pn("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(ft(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(Ze(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=dc){if(!this.child||this.stopped)return Promise.reject(new E("AGENT_PROTOCOL_ERROR","downstream not started"));let c=this.idAllocator.next(e),u=Nt(c,e,i),d=a>0&&Number.isFinite(a);return new Promise((h,m)=>{let w=d?setTimeout(()=>{this.pending.delete(c),m(new E("AGENT_TIMEOUT",`${e} timed out after ${a}ms`))},a):null;this.pending.set(c,{resolve:h,reject:m,timer:w,method:e});try{this.writeFrame(u)}catch(_){w&&clearTimeout(w),this.pending.delete(c),m(_)}})}writeFrame(e){if(!this.child?.stdin||this.child.stdin.destroyed)throw new E("AGENT_PROTOCOL_ERROR","downstream stdin not writable");this.child.stdin.write(gi(e))}dispatch(e){if(wn(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?(this.log.warn("downstream returned error frame",{id:e.id,method:i.method,code:e.error.code,message:e.error.message,data:e.error.data}),i.reject(hi(e.error))):i.resolve(e.result);return}if(li(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(fi(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(Ze(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(Ze(e.id,_n(a)))}catch{}}}failAllPending(e){for(let i of this.pending.values())i.timer&&clearTimeout(i.timer),i.reject(e);this.pending.clear()}};var hc="@agentclientprotocol/claude-agent-acp@latest";function gc(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 bn=class extends je{framework="claude-code";constructor(e){let i=gn("claude-code"),[a,c]=i?[i,[]]:["npx",["-y",hc]],u=e.command??a,d=e.args??c,h={command:u,args:d,cwd:e.cwd,...e.env?{env:e.env}:{}};super(h)}sanitizeEnv(e){return gc(e)}};import{mkdtempSync as pc,rmSync as mc}from"node:fs";import{tmpdir as wc}from"node:os";import{join as _c}from"node:path";var yc="@zed-industries/codex-acp@latest",vn=class extends je{framework="codex";authMethodId;codexHomeDir;constructor(e){let i=gn("codex"),[a,c]=i?[i,[]]:["npx",["-y",yc]],u=e.command??a,d=e.args??c,h=e.extraArgs?[...d,...e.extraArgs]:d,m=e.isolateCodexHome?pc(_c(wc(),"coze-bridge-codex-home-")):void 0,w=m?{...e.env??{},CODEX_HOME:m}:e.env,_={command:u,args:h,cwd:e.cwd,...w?{env:w}:{}};super(_),this.authMethodId=e.authMethodId,this.codexHomeDir=m}async initialize(e){let i=await super.initialize(e);return this.authMethodId&&await this.call("authenticate",{methodId:this.authMethodId}),i}async stop(e){if(await super.stop(e),this.codexHomeDir)try{mc(this.codexHomeDir,{recursive:!0,force:!0})}catch{}}};var Lt=class extends je{framework="openclaw";agentId;sessionName;slashModelOnStart;constructor(e){let i=e.sessionName??"default",a=["acp","--session",`agent:${e.agentId}:${i}`];e.gatewayToken&&a.push("--token",e.gatewayToken);let c={command:e.command,args:a,cwd:e.cwd,...e.env?{env:e.env}:{}};super(c),this.agentId=e.agentId,this.sessionName=i,this.slashModelOnStart=e.slashModelOnStart}async afterSessionEstablished(e){this.slashModelOnStart&&(this.log.info("switching session to per-session provider via /model",{agentId:this.agentId,sessionName:this.sessionName,slash:this.slashModelOnStart}),await this.sessionPrompt({sessionId:e,prompt:[{type:"text",text:`/model ${this.slashModelOnStart}`}]}))}get acpSessionName(){return this.sessionName}};G();ue();var ht=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 Sn=class{agentId;framework;workspace;deployType;sessions=new Map;sessionQueues=new Map;activeTriggers=new Map;status="ok";model;lastActiveAt=Date.now();constructor(e){this.agentId=e.agentId,this.framework=e.framework,this.workspace=e.workspace,this.model=e.model,this.deployType=e.deployType??"local"}getSessionQueue(e){let i=this.sessionQueues.get(e);return i||(i=new ht,this.sessionQueues.set(e,i)),i}allSessionQueues(){return this.sessionQueues.entries()}async dispose(e){this.status="stopped";let i=new Error(`AgentSession disposed${e?`: ${e}`:""}`);for(let a of this.sessionQueues.values())a.dispose(i);this.sessionQueues.clear(),await this.killAllRuntimes(e??"dispose")}async killAllRuntimes(e){let i=[];for(let[,a]of this.sessions)Ot(a),a.downstream&&(i.push(a.downstream.stop(e).catch(()=>{})),a.downstream=void 0);await Promise.all(i),this.activeTriggers.clear()}};function Ot(r){r.idleTimer&&(clearTimeout(r.idleTimer),r.idleTimer=void 0)}import{spawn as bc}from"node:child_process";import{homedir as vc}from"node:os";import{join as Sc}from"node:path";Zt();G();async function bi(){let r=Sc(vc(),".openclaw/openclaw.json");return(await xt(r))?.gateway?.auth?.token??""}var _i=N("openclaw.config"),Ec=[0,5e3,5e3],yi="models.providers.",En="agents.defaults.models",Cn=class{command;env;retryDelaysMs;queue=new ht;constructor(e){this.command=e.command,this.env=e.env??process.env,this.retryDelaysMs=e.retryDelaysMs??Ec}async withRetry(e,i){let a;for(let c=0;c<this.retryDelaysMs.length;c++){let u=this.retryDelaysMs[c]??0;u>0&&await new Promise(d=>setTimeout(d,u));try{return await i()}catch(d){a=d,_i.warn("openclaw cli failed, will retry",{label:e,attempt:c+1,err:String(d)})}}throw new E("AGENT_SPAWN_FAILED",`openclaw cli ${e} failed after ${this.retryDelaysMs.length} attempts: ${a?.message??"unknown"}`)}runCli(e){return new Promise((i,a)=>{let c=bc(this.command,e,{stdio:["ignore","pipe","pipe"],env:this.env}),u="";c.stderr?.on("data",d=>{u+=d.toString("utf8")}),c.on("error",a),c.on("close",d=>{d===0?i():a(new Error(`exit ${d}: ${u.trim().slice(0,500)}`))})})}async runCliTolerant(e,i){try{await this.runCli(e)}catch(a){let c=String(a);if(i.some(u=>c.includes(u)))return;throw a}}async bestEffortUnset(e,i){try{await this.queue.enqueue(()=>this.withRetry(e,()=>this.runCli(["config","unset",i])))}catch(a){_i.warn(`${e} failed (best-effort)`,{configPath:i,err:String(a)})}}ensureProvider(e,i){return this.queue.enqueue(()=>this.withRetry(`config set models.providers.${e}`,()=>this.runCli(["config","set",`${yi}${e}`,JSON.stringify(i),"--strict-json","--merge"])))}removeProvider(e){return this.bestEffortUnset(`config unset models.providers.${e}`,`${yi}${e}`)}addModelToAllowlist(e,i){let a={[e]:i?{alias:i}:{}};return this.queue.enqueue(()=>this.withRetry(`config set ${En}[${e}]`,()=>this.runCli(["config","set",En,JSON.stringify(a),"--strict-json","--merge"])))}removeModelFromAllowlist(e){return this.bestEffortUnset(`config unset ${En}[${e}]`,`${En}.${e}`)}ensureAgent(e,i,a){let c=["agents","add",e,"--workspace",i,"--non-interactive"];return a&&c.push("--model",a),this.queue.enqueue(()=>this.withRetry(`agents add ${e}`,()=>this.runCliTolerant(c,["already exists","already registered"])))}deleteAgent(e){return this.queue.enqueue(()=>this.withRetry(`agents delete ${e}`,()=>this.runCliTolerant(["agents","delete",e,"--force"],["not found","does not exist"])))}};var We=N("agent-manager"),Ac=(r,e,i,a,c,u,d)=>{switch(r){case"claude-code":{let h=c?{...$s(c),...Qs(c,d)}:void 0;return new bn({cwd:i,...h&&Object.keys(h).length>0?{env:h}:{}})}case"codex":{let h=c?[...Xs(c),...ti(c,d)]:[],m=c?Zs(c):void 0,w=!!c;return new vn({cwd:i,...h.length>0?{extraArgs:h}:{},...m&&Object.keys(m).length>0?{env:m}:{},...w?{authMethodId:"openai-api-key",isolateCodexHome:!0}:{}})}case"openclaw":return new Lt({command:e,cwd:i,agentId:a,...u?{sessionName:Dt(u)}:{}})}};function vi(r){return r==="claude-code"||r==="codex"}var Pc={path:"",version:"cloud-deployed"},kc={protocolVersion:1,clientCapabilities:{fs:{readTextFile:!0,writeTextFile:!0}}},Dc=6e4,An=class{paths;config;registry;factory;createTimeoutMs;openclawConfigCache;ensuredProviders=new Set;constructor(e){this.paths=e.paths,this.config=e.config,this.registry=e.registry,this.factory=e.downstreamFactory??Ac,this.createTimeoutMs=e.createTimeoutMs??Dc}getOpenclawConfig(){if(!this.openclawConfigCache){let e=this.config.frameworksCache?.openclaw;if(!e?.path)throw new E("AGENT_SPAWN_FAILED","openclaw binary not detected on this machine");this.openclawConfigCache=new Cn({command:e.path})}return this.openclawConfigCache}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 i=kt(e._meta)==="cloud";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")We.warn("existing agent in error state, rebuilding",{agentId:e.agentId}),await a.dispose("rebuild after error").catch(A=>We.warn("dispose stale agent failed (ignored)",{err:String(A)})),this.registry.unregister(e.agentId);else return We.info("agent already exists, return current",{agentId:e.agentId}),{ok:!0,agentId:a.agentId,workspace:a.workspace,framework:a.framework}}if(!i&&!this.config.frameworksCache?.[e.framework])throw new E("AGENT_SPAWN_FAILED",`framework ${e.framework} not detected on this machine; rerun daemon to refresh frameworks_cache`);i&&vi(e.framework)&&await di(e.framework);let u=Ne(e.agentId,this.paths),d=e.workspace??u.workspace,h=kt(e._meta),m=new AbortController,w=setTimeout(()=>m.abort(new E("AGENT_TIMEOUT",`_agent/create timed out after ${this.createTimeoutMs}ms`)),this.createTimeoutMs),_,y=!1;try{let A=()=>{if(m.signal.aborted)throw m.signal.reason instanceof Error?m.signal.reason:new E("AGENT_TIMEOUT","_agent/create aborted")};await Pr(u.root,{recursive:!0}),await Pr(d,{recursive:!0}),await Pr(u.logs,{recursive:!0}),A(),await ut(d,e.framework,e.agentId,e.cozeIdentity),A();let k=await de(e.agentId,this.paths).catch(()=>null),T=Ys({model:e.model??k?.model});if(_=new Sn({agentId:e.agentId,framework:e.framework,workspace:d,model:T.model??He,deployType:h}),_.status="ok",k?.sessions){for(let[oe,te]of Object.entries(k.sessions))_.sessions.set(oe,{acpSessionId:te.acpSessionId,modelToken:te.modelToken,tokenGeneratedAt:te.tokenGeneratedAt,lastActiveAt:Date.now(),loadingSession:!1,replySeq:0});let q=Object.keys(k.sessions).length;q>0&&We.info("restored persisted session records (no spawn)",{agentId:e.agentId,count:q})}this.registry.register(_),y=!0;let R={agentId:e.agentId,framework:e.framework,workspace:d,cozeIdentity:e.cozeIdentity,createdAt:k?.createdAt??Date.now(),sessions:k?.sessions??{},model:T.model};return h==="cloud"&&(R.deployType="cloud"),k?.skills&&(R.skills=k.skills),k?.agentName&&(R.agentName=k.agentName),k?.description&&(R.description=k.description),await we(R,this.paths),e.framework==="openclaw"&&(this.config.frameworksCache?.openclaw?.path?await this.getOpenclawConfig().ensureAgent(e.agentId,d):We.warn("openclaw binary not on this machine, skip agents add (will fail at session/prompt)",{agentId:e.agentId})),We.info("agent created (no spawn, lazy on first prompt)",{agentId:e.agentId,framework:e.framework,deployType:h}),{ok:!0,agentId:e.agentId,workspace:d,framework:e.framework}}catch(A){throw We.error("agent create failed, rolling back",{agentId:e.agentId,err:String(A)}),y&&_&&(await _.dispose("rollback").catch(()=>{}),this.registry.unregister(e.agentId)),await Cc(u.root,{recursive:!0,force:!0}).catch(k=>We.warn("rm agent dir failed (ignored)",{err:String(k)})),A instanceof E?A:new E("AGENT_SPAWN_FAILED",String(A),{cause:A})}finally{clearTimeout(w)}}async spawnSessionDownstream(e,i,a,c){let d=this.config.frameworksCache?.[e.framework];if(!d)if(e.deployType==="cloud"&&vi(e.framework))d=Pc;else throw new E("AGENT_SPAWN_FAILED",`framework ${e.framework} not detected on this machine`);let h=e.deployType==="cloud"?{model:e.model,modelToken:i}:void 0,m;e.framework==="openclaw"?m=await this.buildOpenclawDownstream({session:e,modelConfig:h,cloudSessionId:a,cozeEnv:c,command:d.path}):m=this.factory(e.framework,d.path,e.workspace,e.agentId,h,a,c);try{return await m.start(),await m.initialize(kc),m}catch(w){throw await m.stop("spawnSessionDownstream failed").catch(()=>{}),w instanceof E?w:new E("AGENT_SPAWN_FAILED",w instanceof Error?w.message:String(w),{cause:w})}}async buildOpenclawDownstream(e){let{session:i,modelConfig:a,cloudSessionId:c,cozeEnv:u,command:d}=e,h=Dt(c),m=await bi(),w=a?.modelToken&&!It(a.model)?ei(a,u):null,_;if(w){let y=Er(c),A=`${y}/${a.model}`;if(!this.ensuredProviders.has(A)){let k=this.getOpenclawConfig();await k.ensureProvider(y,w),await k.addModelToAllowlist(A),this.ensuredProviders.add(A)}_=A}return new Lt({command:d,cwd:i.workspace,agentId:i.agentId,sessionName:h,...m?{gatewayToken:m}:{},..._?{slashModelOnStart:_}:{}})}async openclawRepair(e,i){let a=this.getOpenclawConfig();await a.deleteAgent(e),await a.ensureAgent(e,i)}async cleanupOpenclawSessionProviders(e){if(e.framework!=="openclaw"||!this.openclawConfigCache)return;let i=this.openclawConfigCache;for(let a of e.sessions.keys()){let c=Er(a),u=`${c}/${e.model}`;this.ensuredProviders.delete(u),await i.removeProvider(c),await i.removeModelFromAllowlist(u)}}};G();import{spawn as Ic}from"node:child_process";import{constants as Si,access as Tc}from"node:fs/promises";import{delimiter as Rc,join as Nc}from"node:path";var Lc=N("framework-detector"),Ei={"claude-code":"claude",codex:"codex",openclaw:"openclaw"},Oc=[".exe",".cmd",".bat",".ps1"],Bt=class{env;constructor(e={}){this.env={pathEnv:e.pathEnv??process.env.PATH??"",platform:e.platform??process.platform,spawn:e.spawn??Ic,access:e.access??Tc}}async detect(e){let i=Ei[e],a=await this.which(i);if(!a)return Lc.debug("framework binary not found",{framework:e,bin:i}),null;let c=await this.probeVersion(a);return{path:a,version:c}}async detectAll(){let e=await Promise.all(Object.keys(Ei).map(async a=>[a,await this.detect(a)])),i={};for(let[a,c]of e)c&&(i[a]=c);return i}async which(e){let i=this.env.pathEnv.split(Rc).filter(Boolean),a=this.env.platform==="win32"?["",...Oc]:[""];for(let c of i)for(let u of a){let d=Nc(c,e+u);if(await this.isExecutable(d))return d}return null}async isExecutable(e){try{let i=this.env.platform==="win32"?Si.F_OK:Si.X_OK;return await this.env.access(e,i),!0}catch{return!1}}async probeVersion(e){return new Promise(i=>{let a="",c=!1,u,d=h=>{c||(c=!0,u&&clearTimeout(u),i(h.trim()||"unknown"))};try{let h=this.env.spawn(e,["--version"],{stdio:["ignore","pipe","pipe"]});u=setTimeout(()=>{h.kill("SIGKILL"),d("unknown")},5e3),h.stdout?.on("data",m=>{a+=m.toString("utf8")}),h.on("error",()=>d("unknown")),h.on("close",()=>{let m=Mc(a).split(/\r?\n/)[0]??"";d(m)})}catch{d("unknown")}})}},Bc=new RegExp("\x1B\\[[0-9;]*[A-Za-z]","g");function Mc(r){return r.replace(Bc,"")}Zt();ue();var zc=10*6e4;function Ci(r){let e=r?.sessionIdleTimeoutMs;return typeof e!="number"||!Number.isFinite(e)||e<=0?zc:e}function Pn(r){return xt(r??j().configFile)}function Mt(r,e){return Xt(e??j().configFile,r)}import{randomBytes as qc}from"node:crypto";Ke();G();var U=N("core"),Fc=3e4,Uc=3e4,kn=class{upstream;agents=new Map;disconnectedAgents=new Set;extensions;paths;sessionSpawner;sessionIdleTimeoutMs;upstreamIds=new lt;pendingUpstream=new Map;pendingBridge=new Map;currentCozeEnv;constructor(e){this.upstream=e.upstream,this.extensions=e.extensions??{},this.paths=e.paths,this.sessionSpawner=e.sessionSpawner,this.sessionIdleTimeoutMs=Ci(e.bridgeConfig)}registerExtension(e,i){this.extensions[e]=i}getCozeEnv(){return this.currentCozeEnv}async start(){this.upstream.onFrame(e=>this.handleFrame(e)),await this.upstream.start(),U.info("Core started",{extensions:Object.keys(this.extensions)})}async stop(e){U.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),U.info("agent registered",{agentId:e.agentId,framework:e.framework});for(let i of this.registerHandlers)try{i(e.agentId)}catch(a){U.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)&&U.info("agent revived from disconnect",{agentId:e})}attachRuntimeHooks(e,i,a){let c=a.downstream;c&&(c.onUpdate(u=>{a.loadingSession||this.forwardUpdate(e,u)}),c.onAgentRequest(u=>{this.handleAgentRequest(e,c,u)}),c.onExit((u,d)=>{U.info("session runtime exited",{agentId:e.agentId,cloudId:i,code:u,signal:d}),Ot(a),a.downstream=void 0,a.acpSessionId&&e.activeTriggers.delete(a.acpSessionId)}))}async handleFrame(e){if(wn(e)){this.handleUpstreamResponse(e);return}if(!("method"in e)||typeof e.method!="string")return;let i="id"in e&&e.id!==void 0?e.id:null,a=e.params?._meta?.cozeEnv;a&&(this.currentCozeEnv=a);try{if(e.method.startsWith("_agent/")){let c=this.extensions[e.method];if(!c){i!==null?await this.sendError(i,W.METHOD_NOT_FOUND,`extension not registered: ${e.method}`):U.warn("drop notification: extension not registered",{method:e.method});return}let u=await c(e,this);i!==null&&await this.upstream.send(ft(i,u));return}if(e.method.startsWith("session/")){let c=await this.routeSessionMethod(e);i!==null&&await this.upstream.send(ft(i,c));return}if(e.method==="initialize"){i!==null&&await this.upstream.send(ft(i,{protocolVersion:1,agentCapabilities:{loadSession:!0}}));return}i!==null?await this.sendError(i,W.METHOD_NOT_FOUND,`method not implemented: ${e.method}`):U.warn("drop unknown notification",{method:e.method})}catch(c){U.error("handleFrame failed",{method:e.method,err:String(c)}),i!==null&&await this.upstream.send(Ze(i,_n(c)))}}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 c=this.agents.get(a);if(!c)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}`);let u=typeof i.sessionId=="string"?i.sessionId:void 0;if(e.method==="session/cancel"||e.method==="session/new"||!u)return this.dispatchSessionCall(c,e.method,i);let d=Date.now(),h=!1;try{let m=await c.getSessionQueue(u).enqueue(()=>this.dispatchSessionCall(c,e.method,i));return h=!0,m}finally{U.info("session call done",{agentId:c.agentId,method:e.method,durationMs:Date.now()-d,ok:h})}}async dispatchSessionCall(e,i,a){e.lastActiveAt=Date.now();let{stripped:c}=Fs(a);switch(i){case"session/new":{let u=Gc();return U.info("session/new ack (lazy spawn)",{agentId:e.agentId,cloudId:u}),{sessionId:u}}case"session/load":{let u=c;return U.info("session/load ack (lazy spawn)",{agentId:e.agentId,cloudId:u.sessionId}),{}}case"session/prompt":{let u=c,d=u.sessionId;if(!d)throw new E("IPC_BAD_REQUEST","session/prompt: missing sessionId");let h=await this.ensureRuntime(e,d);if(h.replySeq=0,await this.ensureDownstream(e,d,h),!h.downstream||!h.acpSessionId)throw new E("BRIDGE_INTERNAL","session runtime not ready after ensureDownstream");let m=a._meta?.cozeTriggerMsgId;m?e.activeTriggers.set(h.acpSessionId,m):e.activeTriggers.delete(h.acpSessionId);try{let w=await h.downstream.sessionPrompt({...u,sessionId:h.acpSessionId});return h.lastActiveAt=Date.now(),w}finally{e.activeTriggers.delete(h.acpSessionId),h.downstream?.isAlive()&&this.armIdleTimer(e,d,h)}}case"session/cancel":{let d=c.sessionId;if(!d)throw new E("IPC_BAD_REQUEST","session/cancel: missing sessionId");let h=e.sessions.get(d);return h?.downstream?.isAlive()&&h.acpSessionId&&await h.downstream.sessionCancel({sessionId:h.acpSessionId}),{ok:!0}}default:throw new E("IPC_BAD_REQUEST",`session method not supported: ${i}`)}}async ensureRuntime(e,i){let a=e.sessions.get(i);if(a)return a;let u={modelToken:e.deployType==="cloud"?await this.requestSessionToken(e.agentId,i):"",tokenGeneratedAt:Date.now(),lastActiveAt:Date.now(),loadingSession:!1,replySeq:0};return e.sessions.set(i,u),await this.persistSessionMapping(e),u}async requestSessionToken(e,i){let a={sessionId:i,_meta:{cozeAgentId:e}};try{let c=await this.sendRequest(Ee.GEN_MODEL_TOKEN,a,Uc);if(!c?.modelToken)throw new E("MODEL_TOKEN_GEN_FAILED",`cloud returned empty modelToken (agentId=${e}, cloudSessionId=${i})`);return c.modelToken}catch(c){throw c instanceof E&&c.code==="MODEL_TOKEN_GEN_FAILED"?c:new E("MODEL_TOKEN_GEN_FAILED",c instanceof Error?c.message:String(c),{cause:c})}}async ensureDownstream(e,i,a){if(Ot(a),a.downstream?.isAlive())return;if(!this.sessionSpawner)throw new E("AGENT_SPAWN_FAILED","sessionSpawner not wired (cannot spawn per-session downstream)");let c=await this.sessionSpawner(e,a.modelToken,i,this.currentCozeEnv);if(a.downstream=c,this.attachRuntimeHooks(e,i,a),a.acpSessionId){a.loadingSession=!0;try{await c.sessionLoad({sessionId:a.acpSessionId,cwd:e.workspace}),U.info("session restored via session/load",{agentId:e.agentId,cloudId:i,acpId:a.acpSessionId})}catch(u){U.warn("session/load failed, fallback to session/new",{agentId:e.agentId,cloudId:i,acpId:a.acpSessionId,err:String(u)}),a.acpSessionId=void 0;let d=await c.sessionNew({cwd:e.workspace});a.acpSessionId=d.sessionId,await this.persistSessionMapping(e)}finally{a.loadingSession=!1}}else{let u=await c.sessionNew({cwd:e.workspace});a.acpSessionId=u.sessionId,await this.persistSessionMapping(e)}c.afterSessionEstablished&&a.acpSessionId&&await c.afterSessionEstablished(a.acpSessionId)}armIdleTimer(e,i,a){if(Ot(a),this.isRuntimeBusy(e,a)){U.debug("skip idle timer: runtime busy (in-flight turn / pending permission)",{agentId:e.agentId,cloudId:i});return}a.idleTimer=setTimeout(()=>{if(a.idleTimer=void 0,this.isRuntimeBusy(e,a)){U.info("idle reaper fired but runtime busy, re-arming",{agentId:e.agentId,cloudId:i}),this.armIdleTimer(e,i,a);return}U.info("session runtime idle timeout, killing downstream",{agentId:e.agentId,cloudId:i});let c=a.downstream;a.downstream=void 0,a.acpSessionId&&e.activeTriggers.delete(a.acpSessionId),c&&c.stop("idle timeout").catch(u=>U.warn("idle stop failed (ignored)",{agentId:e.agentId,cloudId:i,err:String(u)}))},this.sessionIdleTimeoutMs),a.idleTimer.unref?.()}isRuntimeBusy(e,i){if(i.acpSessionId&&e.activeTriggers.has(i.acpSessionId))return!0;let a=i.downstream;if(!a)return!1;for(let c of this.pendingUpstream.values())if(c.downstream===a)return!0;return!1}forwardUpdate(e,i){let a=i.sessionId,c=this.reverseSessionId(e,a);if(!c){U.debug("drop update for unknown session",{agentId:e.agentId,acpId:a});return}let u=e.sessions.get(c);if(!u){U.debug("drop update: runtime gone",{agentId:e.agentId,cloudId:c});return}let d={cozeAgentId:e.agentId,cozeReplySeqID:++u.replySeq},h=e.activeTriggers.get(a);h&&(d.cozeTriggerMsgId=h),this.upstream.send(pn("session/update",{...i,sessionId:c,_meta:d})).catch(m=>U.warn("forward update failed",{agentId:e.agentId,err:String(m)}))}handleAgentRequest(e,i,a){if(a.method==="session/request_permission"){this.forwardPermissionRequest(e,i,a);return}U.warn("unhandled agent request,returning method_not_found",{agentId:e.agentId,method:a.method}),i.respondAgentRequestError(a.id,{code:W.METHOD_NOT_FOUND,message:`method not handled by Bridge: ${a.method}`})}forwardPermissionRequest(e,i,a){let c=this.upstreamIds.next("session/request_permission"),u=a.params??{},h=u.sessionId,m=h?e.activeTriggers.get(h):void 0,w={cozeAgentId:e.agentId};m&&(w.cozeTriggerMsgId=m);let _=h?this.reverseSessionId(e,h):void 0,y={...u,..._?{sessionId:_}:{},_meta:w};this.pendingUpstream.set(c,{agentRequestId:a.id,agentId:e.agentId,downstream:i,method:a.method}),this.upstream.send(Nt(c,"session/request_permission",y)).catch(A=>{this.pendingUpstream.delete(c),U.error("forward permission request failed",{agentId:e.agentId,err:String(A)}),i.respondAgentRequestError(a.id,{code:W.INTERNAL_ERROR,message:`upstream send failed: ${String(A)}`})})}handleUpstreamResponse(e){if(e.id===null)return;let i=this.pendingUpstream.get(e.id);if(i){this.pendingUpstream.delete(e.id),e.error?i.downstream.respondAgentRequestError(i.agentRequestId,e.error):i.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 mn(e.error)):a.resolve(e.result);return}U.debug("orphan upstream response (no pending)",{id:e.id})}sendRequest(e,i,a=Fc){let c=this.upstreamIds.next(e);return new Promise((u,d)=>{let h=setTimeout(()=>{this.pendingBridge.delete(c),d(new E("AGENT_TIMEOUT",`${e} timed out after ${a}ms`))},a);this.pendingBridge.set(c,{method:e,resolve:u,reject:d,timer:h}),this.upstream.send(Nt(c,e,i)).catch(m=>{let w=this.pendingBridge.get(c);w&&(clearTimeout(w.timer),this.pendingBridge.delete(c)),d(m)})})}async persistSessionMapping(e){if(this.paths)try{let i=new Map;for(let[a,c]of e.sessions){let u={modelToken:c.modelToken,tokenGeneratedAt:c.tokenGeneratedAt};c.acpSessionId&&(u.acpSessionId=c.acpSessionId),i.set(a,u)}await br(e.agentId,i,this.paths)}catch(i){U.warn("persist session mapping failed",{agentId:e.agentId,err:String(i)})}}reverseSessionId(e,i){for(let[a,c]of e.sessions.entries())if(c.acpSessionId===i)return a}sendError(e,i,a){return this.upstream.send(Ze(e,{code:i,message:a}))}};function Gc(){return qc(16).toString("hex")}G();ue();import{randomBytes as Kc}from"node:crypto";import{chmod as Hc,mkdir as jc,writeFile as Ai}from"node:fs/promises";import{createServer as Wc}from"node:http";import{dirname as Jc}from"node:path";var Vc=1e6,kr=N("ipc"),Dn=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??j()}async start(){this.token=Kc(32).toString("hex");let e=Wc((a,c)=>{this.dispatch(a,c)});this.server=e,await new Promise((a,c)=>{e.once("error",c),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(),kr.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(c=>c?a(c):i())}),this.server=null)}async persistAuthFiles(){await jc(Jc(this.paths.portFile),{recursive:!0}),await Ai(this.paths.portFile,String(this.port),"utf8"),await Ai(this.paths.tokenFile,this.token,{encoding:"utf8",mode:384});try{await Hc(this.paths.tokenFile,384)}catch(e){kr.warn("chmod token file failed (non-POSIX?)",{err:String(e)})}}async dispatch(e,i){if(e.headers.authorization!==`Bearer ${this.token}`){zt(i,401,{error:"unauthorized"});return}let c=`${e.method} ${(e.url??"").split("?")[0]}`,u=this.routes.get(c);if(!u){zt(i,404,{error:"not found"});return}let d=null;if(e.method==="POST")try{d=await Yc(e)}catch(h){zt(i,400,{error:"invalid json",detail:String(h)});return}try{let h=await u.handler(d,e);zt(i,200,h??{ok:!0})}catch(h){kr.error("IPC handler failed",{key:c,err:String(h)}),zt(i,500,{error:h instanceof Error?h.message:String(h)})}}};function zt(r,e,i){r.statusCode=e,r.setHeader("content-type","application/json"),r.end(JSON.stringify(i))}async function Yc(r){let e=[],i=0;for await(let c of r){let u=c;if(i+=u.length,i>Vc)throw new Error("body too large");e.push(u)}let a=Buffer.concat(e).toString("utf8");return a?JSON.parse(a):null}var Jo=Re(Mi(),1);var Iu=Re(No(),1),Tu=Re(jn(),1),Ru=Re(mt(),1),Nu=Re(Ur(),1),Lu=Re(Hr(),1),Ou=Re($r(),1),Go=Re(Yn(),1),Bu=Re(Uo(),1);var Ko=Go.default;G();var ie=N("upstream.frontier"),jo="application/json",Wo="none",Xn=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:Ks,...an(this.opts.ppeOverride)};class i extends Ko{constructor(h){super(h,Gs,{headers:e})}send(h,...m){if(zs("debug"))try{let w;typeof h=="string"?w=Buffer.from(h,"utf8"):h instanceof Buffer?w=h:h instanceof ArrayBuffer?w=new Uint8Array(h):ArrayBuffer.isView(h)?w=new Uint8Array(h.buffer,h.byteOffset,h.byteLength):w=new Uint8Array(0);let _=Buffer.from(w.slice(0,128)).toString("hex");ie.debug("WS raw frame out",{bytes:w.byteLength,headHex:_})}catch(w){ie.warn("WS raw frame dump failed",{err:String(w)})}super.send(h,...m)}}let a=Ws(this.opts.urlOverride),c={url:a,ws:i,fpID:Us,aID:on,accessKey:this.opts.handshake.accessKey,deviceID:this.opts.handshake.deviceId,payloadType:{type:jo,force:!0},payloadEncoding:{encoding:Wo,force:!0},enableTransformTextPayload:!0,enableQoS:!1,enableAutoAck:!1,automaticOpen:!1,debug:this.opts.debug??!1},u=new Jo.FWS(c);u.onopen=()=>{this.opened=!0,this.openCount+=1;let d=this.openCount===1;ie.info("frontier opened",{url:a,remoteDeviceId:this.opts.handshake.deviceId,initial:d,openCount:this.openCount}),this.connectHandler&&Promise.resolve(this.connectHandler({initial:d})).catch(h=>ie.warn("onConnect handler threw (ignored)",{err:String(h)}))},u.onclose=d=>{this.opened=!1,ie.info("frontier closed",{code:d.code,reason:d.reason,willReconnect:d.willReconnect})},u.onerror=d=>{ie.warn("frontier error",{code:d.code,msg:d.message})},u.onmessage=d=>this.handleMessage(d),this.fws=u,await u.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),c=e;ie.info("frontier frame out",{method:c.method,jsonrpcId:c.id,size:a.length});try{await i.send(a,{service:33555712,method:1,payloadType:jo,payloadEncoding:Wo})}catch(u){throw new E("UPSTREAM_DISCONNECTED",`frontier send failed: ${String(u)}`,{cause:u})}}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=qu(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 c;try{c=JSON.parse(a)}catch(u){ie.warn("frontier message JSON parse failed",{err:String(u),head:a.slice(0,80)});return}ie.info("frontier frame in",{logid:zu(e.message?.LogID),logidNew:e.message?.LogIDNew,msgId:e.message?.msgID,jsonrpcId:c.id}),Promise.resolve(this.handler(c)).catch(u=>ie.warn("frontier frame handler threw",{err:String(u)}))}};function zu(r){return r?r.high===0?String(r.low>>>0):`${r.high.toString(16)}${(r.low>>>0).toString(16).padStart(8,"0")}`:""}function qu(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}}G();var Zr=N("upstream.switchable"),Zn=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(c){throw Zr.error("swap target start failed, reverting",{err:String(c)}),this.inner=a,c}await a.stop(i??"swapped").catch(c=>Zr.warn("previous upstream stop threw (ignored)",{err:String(c)}))}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()}};G();var Qr=N("upstream"),Jt=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)}};G();ue();G();ue();import{execSync as Fu}from"node:child_process";import{readFileSync as Vo,unlinkSync as Uu}from"node:fs";import{mkdir as Gu,readFile as Yo,unlink as $o,writeFile as Ku}from"node:fs/promises";import{dirname as Hu}from"node:path";var ju=N("single-instance"),Qn=class{pidFile;acquired=!1;constructor(e={}){this.pidFile=e.pidFile??j().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&&(ju.warn("removing stale pid file",{stalePid:e}),await $o(this.pidFile).catch(()=>{})),await Gu(Hu(this.pidFile),{recursive:!0}),await Ku(this.pidFile,String(process.pid),"utf8"),this.acquired=!0,this.installCleanupHooks(),{kind:"acquired"})}async release(){if(this.acquired){try{(await Yo(this.pidFile,"utf8")).trim()===String(process.pid)&&await $o(this.pidFile)}catch{}this.acquired=!1}}async readExistingPid(){try{let e=await Yo(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{process.kill(e,0)}catch(i){return i.code==="EPERM"}return this.matchesDaemonTitle(e)}matchesDaemonTitle(e){try{let i=Vo(`/proc/${e}/cmdline`,"utf8").replace(/\0/g," ");return!!(i.includes("coze-bridge-daemon")||i.includes("lib/index.js"))}catch{}try{let i=Fu(`ps -o command= -p ${e}`,{stdio:["ignore","pipe","ignore"],timeout:1e3}).toString();return i.trim()?i.includes("coze-bridge-daemon")||i.includes("lib/index.js"):!1}catch{return!0}}installCleanupHooks(){process.once("exit",()=>{if(this.acquired)try{Vo(this.pidFile,"utf8").trim()===String(process.pid)&&Uu(this.pidFile)}catch{}})}};var M=N("daemon"),Wu="coze-bridge-daemon";async function Qo(){let r=new Qn({processTitle:Wu}),e=await r.acquire();if(e.kind==="already-running")throw new Error(`coze-bridge daemon already running (pid=${e.pid})`);let i=await Pn(),a=i??{};yr({pid:process.pid}),M.info(i?"loaded bridge config":"initialized bridge config");try{let P=new Bt;a.frameworksCache=await P.detectAll(),M.info("refreshed frameworks_cache",{detected:Object.keys(a.frameworksCache)})}catch(P){M.warn("framework detection failed",{err:String(P)})}await Mt(a);let c=new Zn(new Jt),u=j(),d=null,h=new kn({upstream:c,paths:u,bridgeConfig:a,sessionSpawner:async(P,F,J,ne)=>{if(!d)throw new Error("agentManager not ready");return d.spawnSessionDownstream(P,F,J,ne)}});await Vu(u,h);let m=new An({paths:u,config:a,registry:h});d=m;let w,_,y=null,A=null;h.registerExtension("_agent/create",async P=>m.createAgent(P.params)),h.registerExtension("_agent/health",async()=>({ok:!0}));let k={},T=new un({agents:h.agents,disposeAndMarkDisconnected:async(P,F)=>{let J=h.agents.get(P);J&&(await m.cleanupOpenclawSessionProviders(J).catch(ne=>M.warn("cleanup openclaw providers failed (ignored)",{agentId:P,err:String(ne)})),await J.dispose(`disconnect: ${F}`).catch(ne=>M.warn("dispose during disconnect failed (ignored)",{agentId:P,err:String(ne)})),J.status="disconnected",h.unregister(P)),h.disconnectedAgents.add(P)},detailSyncer:async P=>{if(!k.ref)throw new Error("agent-detail-sync not initialized yet");await k.ref.syncOne(P)},openclawRepair:async(P,F)=>{await m.openclawRepair(P,F)}});h.registerExtension("_agent/listSkills",P=>T.listSkills(P.params)),h.registerExtension("_agent/addSkills",P=>T.addSkills(P.params)),h.registerExtension("_agent/removeSkills",P=>T.removeSkills(P.params)),h.registerExtension("_agent/getFileTree",P=>T.getFileTree(P.params)),h.registerExtension("_agent/getFileContent",P=>T.getFileContent(P.params)),h.registerExtension("_agent/update",P=>T.updateAgent(P.params)),h.registerExtension("_agent/disconnect",P=>T.disconnectAgent(P.params)),h.registerExtension("_agent/switchModel",P=>T.switchModel(P.params)),h.registerExtension("_agent/reset",P=>T.resetAgent(P.params)),h.registerExtension("_agent/repair",P=>T.repairAgent(P.params));let R=new sn({paths:u,handlers:T,sendDetail:P=>h.sendRequest("_agent/detail",P)});k.ref=R,c.onConnect(({initial:P})=>{M.info("frontier upstream connected, triggering detail sync",{initial:P}),R.syncAll(P?"initial-connect":"reconnect").catch(F=>M.warn("detail sync top-level error (ignored)",{err:String(F)}))});let q=new Dn({paths:u,routes:[{method:"GET",path:"/status",handler:async()=>({running:!0,pid:process.pid,agents:[...h.agents.keys()],deviceId:y??"",frameworksCache:a.frameworksCache??{}})},{method:"POST",path:"/pair",handler:async P=>{let F=P,J=F?.privatecode,ne=F?.pairing_code;if(!J||!ne)throw new E("IPC_BAD_REQUEST","/pair requires privatecode + pairing_code");let ke=cn(F.env),pe=F.handshake_url,$e=F.frontier_url,Et=Ju(F.env,pe,$e),Vt=!!w&&w!==J,be=_!==void 0&&_!==Et,ve=Vt||be;if(ve){M.warn("pair config switched, resetting agents",{pcChanged:Vt,envChanged:be,previousPc:w?Xo(w):"",nextPc:Xo(J),previousEnvKey:_??"",nextEnvKey:Et});for(let H of[...h.agents.values()])await H.dispose("pair config switch").catch(()=>{}),h.agents.delete(H.agentId);await c.swap(new Jt,"pair switch").catch(()=>{})}let Yt=await Vs({privatecode:J,...pe?{endpoint:pe}:{},ppeOverride:ke});y=Yt.deviceId,yr({deviceId:y,pid:process.pid});let ae=new Xn({handshake:Yt,privatecode:J,...$e?{urlOverride:$e}:{},ppeOverride:ke});await c.swap(ae,"pair");let $t=Object.keys(a.frameworksCache??{});try{let H=await h.sendRequest("_agent/pair",{pairCode:ne,patToken:J,frameworks:$t,_meta:{cozeDeviceId:y}});M.info("_agent/pair ok",{pairResult:H}),w=J,_=Et,A||(A=new fn({core:h,getDeviceId:()=>y??""})),A.start(),ve&&Zo(u,m).catch(De=>M.warn("post-pair-switch auto-revive error (ignored)",{err:String(De)}));let V;return F.agent_id&&(V=await Yu(F.agent_id,u,m,De=>h.sendRequest("_agent/detail",De)).catch(De=>(M.error("--agent-id ensureAgent failed",{agentId:F.agent_id,err:String(De)}),{ok:!1,agentId:F.agent_id??"",note:String(De)}))),{ok:!0,note:"paired with cloud",...V?{agent:V}:{}}}catch(H){return M.error("_agent/pair failed",{err:String(H)}),{ok:!1,note:`pair failed: ${String(H)}`}}}},{method:"POST",path:"/_agent/create",handler:async P=>{let F=P;return{ok:!0,result:await m.createAgent(F)}}},{method:"POST",path:"/refresh",handler:async()=>{M.info("IPC /refresh: re-detecting frameworks");let P=new Bt;return a.frameworksCache=await P.detectAll(),await Mt(a),{ok:!0,frameworks:a.frameworksCache}}},{method:"POST",path:"/shutdown",handler:async()=>(M.info("IPC /shutdown received"),setImmediate(()=>{xe.shutdown("ipc /shutdown")}),{ok:!0})}]}),{port:oe,token:te}=await q.start();await h.start(),Zo(u,m).catch(P=>M.warn("auto-revive top-level error (ignored)",{err:String(P)}));let ye=null,xe={port:oe,token:te,core:h,ipc:q,shutdown(P){return ye||(M.info("daemon shutdown",{reason:P}),ye=(async()=>{A?.stop(),await h.stop(P),await q.stop(),await r.release()})(),ye)}};for(let P of["SIGTERM","SIGINT"])process.on(P,()=>{xe.shutdown(P).then(()=>process.exit(0))});return M.info("daemon ready",{port:oe,pid:process.pid,nodeVersion:process.version,platform:process.platform,frameworks:Object.keys(a.frameworksCache??{}),libVersion:a.libVersion??"dev"}),xe}function Xo(r){return r.length<=8?"***":`${r.slice(0,4)}***${r.slice(-4)}`}function Ju(r,e,i){return`${r??""}|${e??""}|${i??""}`}async function Vu(r,e){let{readdir:i}=await import("node:fs/promises"),a;try{a=await i(r.agentsRoot)}catch{return}let{loadAgentConfig:c,enforceAgentConfigMode:u}=await Promise.resolve().then(()=>(Ke(),rn));for(let d of a){await u(d,r).catch(h=>M.warn("enforceAgentConfigMode failed (ignored)",{agentId:d,err:String(h)}));try{let h=await c(d,r);h?.disconnectedAt&&(e.disconnectedAgents.add(d),M.info("agent marked disconnected on startup",{agentId:d,disconnectedAt:h.disconnectedAt,reason:h.disconnectReason??""}))}catch(h){M.warn("failed to load agent config on startup, skipping",{agentId:d,err:String(h)})}}}async function Yu(r,e,i,a){let{loadAgentConfig:c}=await Promise.resolve().then(()=>(Ke(),rn)),u=await c(r,e);if(u){M.info("--agent-id: local config found, reconnecting",{agentId:r,framework:u.framework,hadDisconnect:!!u.disconnectedAt});let w={agentId:u.agentId,framework:u.framework,...u.cozeIdentity?{cozeIdentity:u.cozeIdentity}:{},...u.model?{model:u.model}:{}};return await i.createAgent(w),{ok:!0,agentId:r,note:u.disconnectedAt?"revived from local config":"connected from local config"}}M.info("--agent-id: local config missing, pulling _agent/detail from cloud",{agentId:r});let d=await a({_meta:{cozeAgentId:r}});if(!d.framework)throw new 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 h={agentId:d.agentId,framework:d.framework,...d.cozeIdentity?{cozeIdentity:d.cozeIdentity}:{},...d.model?{model:d.model}:{},...d.deployType?{_meta:{cozeDeployType:d.deployType}}:{}};await i.createAgent(h);let m=d.deployType==="cloud"&&d.framework==="openclaw";return{ok:!0,agentId:r,note:m?"cloud agent acknowledged":"created from cloud detail"}}async function Zo(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:c}=await Promise.resolve().then(()=>(Ke(),rn));M.info("auto-revive: scanning local agents on startup",{count:a.length});let u=0,d=0;for(let h of a){let m;try{m=await c(h,r)}catch(w){M.warn("auto-revive: load config failed (skipping)",{agentId:h,err:String(w)}),d+=1;continue}if(!m){d+=1;continue}if(m.disconnectedAt){M.info("auto-revive: skip disconnected agent",{agentId:h,disconnectedAt:m.disconnectedAt}),d+=1;continue}try{M.info("auto-revive: re-registering agent (D44 no spawn)",{agentId:h,framework:m.framework}),await e.createAgent({agentId:m.agentId,framework:m.framework,...m.cozeIdentity?{cozeIdentity:m.cozeIdentity}:{},...m.model?{model:m.model}:{},...m.deployType?{_meta:{cozeDeployType:m.deployType}}:{}}),u+=1}catch(w){M.warn("auto-revive: createAgent failed (skipping)",{agentId:h,framework:m.framework,err:String(w)}),d+=1}}return M.info("auto-revive: done",{revived:u,skipped:d,total:a.length}),{revived:u,skipped:d,total:a.length}}ts();ue();import{readFile as ta}from"node:fs/promises";var Ye=class{paths;constructor(e){this.paths=e??j()}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:sd(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([ta(this.paths.portFile,"utf8"),ta(this.paths.tokenFile,"utf8")]),a=Number.parseInt(e.trim(),10),c=i.trim();return!Number.isFinite(a)||a<=0||!c?null:{port:a,token:c}}catch(e){if(e.code==="ENOENT")return null;throw e}}async fetch(e,i){let a=i.body!==void 0,c={Authorization:`Bearer ${e.token}`};a&&(c["content-type"]="application/json");let u=new AbortController,d=setTimeout(()=>u.abort(),i.timeoutMs??5e3);try{let h=await fetch(`http://127.0.0.1:${e.port}${i.path}`,{method:i.method,headers:c,body:a?JSON.stringify(i.body):void 0,signal:u.signal}),m=await h.text();return{status:h.status,body:rd(m)}}finally{clearTimeout(d)}}};function rd(r){if(!r)return null;try{return JSON.parse(r)}catch{return r}}function sd(r){return r instanceof Error?r.message:String(r)}G();ue();import{copyFile as na,mkdir as id,readFile as ns,writeFile as od}from"node:fs/promises";import{dirname as ad,resolve as rs,sep as er}from"node:path";import{fileURLToPath as cd}from"node:url";G();ue();var ra=N("dist-install");function xd(r){let e=cd(r),i=ad(e),a=`${er}src${er}`;if(i.includes(a)||i.endsWith(`${er}src${er}cli`))return null;let c=rs(i,"index.js"),u=rs(i,"..","package.json");return{dist:c,pkgJson:u}}async function sa(r={}){let e=r.paths??j(),i=xd(import.meta.url),a=r.sourceDist??i?.dist,c=r.sourcePackageJson??i?.pkgJson;if(!a||!c)return{kind:"dev-mode-skip",reason:"running from src/(tsx loader);no dist/ to install"};let u;try{u=JSON.parse(await ns(c,"utf8")).version??"unknown"}catch(y){return ra.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 Pn(e.configFile)??{},h=d.libVersion;if(h===u)try{return await ns(e.libEntry),{kind:"already-current",libVersion:u}}catch{}await id(e.libDir,{recursive:!0}),await na(a,e.libEntry),await na(`${a}.map`,`${e.libEntry}.map`).catch(()=>{});let m=rs(e.libDir,"package.json"),w=`${JSON.stringify({type:"module"},null,2)}
94
+ `;return await ns(m,"utf8").catch(()=>null)!==w&&await od(m,w),d.libVersion=u,await Mt(d,e.configFile),ra.info("dist installed",{libEntry:e.libEntry,fromVersion:h,toVersion:u}),h?{kind:"version-changed",fromVersion:h,toVersion:u,libEntry:e.libEntry}:{kind:"first-install",libVersion:u,libEntry:e.libEntry}}var kd=N("cli");function St(r,e){let i=[],a;for(let c=0;c<r.length;c++){let u=r[c];if(u===e){a=r[c+1],c+=1;continue}if(u.startsWith(`${e}=`)){a=u.slice(e.length+1);continue}i.push(u)}return{value:a,rest:i}}function Dd(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:c}=St(i,"--pat-token");i=c;let{value:u,rest:d}=St(i,"--pair-code");i=d;let{value:h,rest:m}=St(i,"--env");i=m;let{value:w,rest:_}=St(i,"--handshake-url");i=_;let{value:y,rest:A}=St(i,"--frontier-url");i=A;let{value:k}=St(i,"--agent-id");if(!a||!u)return{mode:"help"};let T={mode:"pair",privatecode:a,pairingCode:u};return h&&(T.env=h),w&&(T.handshakeUrl=w),y&&(T.frontierUrl=y),k&&(T.agentId=k),T}var Id=`
95
95
  coze-bridge - local bridge daemon for cloud Agent Service
96
96
 
97
97
  Usage:
@@ -118,35 +118,35 @@ Auto-connect agent (optional):
118
118
 
119
119
  Internal:
120
120
  <node> <entry> --daemon daemon mode (OS supervisor only)
121
- `.trimStart();async function fa(r=process.argv,e={}){let i=Df(r);switch(i.mode){case"help":return process.stdout.write(If),0;case"daemon":{try{await ea()}catch(o){return Pf.error("daemon start failed",{err:String(o)}),1}return new Promise(()=>{})}case"status":return Tf(e);case"stop":return Lf(e);case"refresh":return Rf(e);case"uninstall":return Nf(e);case"install-service":return Of();case"pair":{let o={};return i.env&&(o.env=i.env),i.handshakeUrl&&(o.handshakeUrl=i.handshakeUrl),i.frontierUrl&&(o.frontierUrl=i.frontierUrl),Bf(i.privatecode,i.pairingCode,e,o,i.agentId)}}}async function da(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 Tf(r){let e=r.paths??G(),i=new Je(e),o=await i.probe();if(o.kind==="not-running")return process.stdout.write(`coze-bridge: not running
122
- `),1;if(o.kind==="stale")return await da(e),process.stdout.write(`coze-bridge: not running (cleaned stale state)
121
+ `.trimStart();async function ua(r=process.argv,e={}){let i=Dd(r);switch(i.mode){case"help":return process.stdout.write(Id),0;case"daemon":{try{await Qo()}catch(a){return kd.error("daemon start failed",{err:String(a)}),1}return new Promise(()=>{})}case"status":return Td(e);case"stop":return Rd(e);case"refresh":return Nd(e);case"uninstall":return Ld(e);case"install-service":return Od();case"pair":{let a={};return i.env&&(a.env=i.env),i.handshakeUrl&&(a.handshakeUrl=i.handshakeUrl),i.frontierUrl&&(a.frontierUrl=i.frontierUrl),Bd(i.privatecode,i.pairingCode,e,a,i.agentId)}}}async function da(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 Td(r){let e=r.paths??j(),i=new Ye(e),a=await i.probe();if(a.kind==="not-running")return process.stdout.write(`coze-bridge: not running
122
+ `),1;if(a.kind==="stale")return await da(e),process.stdout.write(`coze-bridge: not running (cleaned stale state)
123
123
  `),1;let c=await i.request({method:"GET",path:"/status"});return process.stdout.write(`coze-bridge: running
124
124
  ${JSON.stringify(c.body,null,2)}
125
- `),0}async function Lf(r){let e=r.paths??G(),i=new Je(e),o=await i.probe();if(o.kind==="not-running")return process.stdout.write(`coze-bridge: not running
126
- `),0;if(o.kind==="stale")return await da(e),process.stdout.write(`coze-bridge: not running (cleaned stale state)
125
+ `),0}async function Rd(r){let e=r.paths??j(),i=new Ye(e),a=await i.probe();if(a.kind==="not-running")return process.stdout.write(`coze-bridge: not running
126
+ `),0;if(a.kind==="stale")return await da(e),process.stdout.write(`coze-bridge: not running (cleaned stale state)
127
127
  `),0;try{return await i.request({method:"POST",path:"/shutdown"}),process.stdout.write(`coze-bridge: stopped
128
128
  `),0}catch(c){return process.stdout.write(`coze-bridge: stop failed: ${String(c)}
129
- `),1}}async function Rf(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)
130
- `),1;try{let o=await e.request({method:"POST",path:"/refresh"});return o.status===200?(process.stdout.write(`coze-bridge: refreshed
131
- ${JSON.stringify(o.body,null,2)}
132
- `),0):(process.stderr.write(`coze-bridge: refresh failed: ${JSON.stringify(o.body)}
133
- `),1)}catch(o){return process.stderr.write(`coze-bridge: refresh failed: ${String(o)}
134
- `),1}}async function Nf(r){let e=new Je(r.paths);if((await e.probe()).kind==="connected"){process.stdout.write(`coze-bridge: stopping daemon...
135
- `);try{await e.request({method:"POST",path:"/shutdown"})}catch(x){process.stderr.write(`coze-bridge: stop failed (continuing): ${String(x)}
136
- `)}await new Promise(x=>setTimeout(x,500))}if(!r.skipSupervisor)try{let{getSupervisor:x,buildContext:f}=await Promise.resolve().then(()=>(xs(),cs)),d=x();await d.uninstall(f()),process.stdout.write(`coze-bridge: ${d.platform} supervisor unregistered
137
- `)}catch(x){process.stderr.write(`coze-bridge: supervisor uninstall failed (continuing): ${String(x)}
138
- `)}let o=r.paths??G(),{rm:c}=await import("node:fs/promises");try{await c(o.cozeRoot,{recursive:!0,force:!0}),process.stdout.write(`coze-bridge: removed ${o.cozeRoot}
139
- `)}catch(x){return process.stderr.write(`coze-bridge: remove failed: ${String(x)}
129
+ `),1}}async function Nd(r){let e=new Ye(r.paths);if((await e.probe()).kind==="not-running")return process.stdout.write(`coze-bridge: not running (start daemon first)
130
+ `),1;try{let a=await e.request({method:"POST",path:"/refresh"});return a.status===200?(process.stdout.write(`coze-bridge: refreshed
131
+ ${JSON.stringify(a.body,null,2)}
132
+ `),0):(process.stderr.write(`coze-bridge: refresh failed: ${JSON.stringify(a.body)}
133
+ `),1)}catch(a){return process.stderr.write(`coze-bridge: refresh failed: ${String(a)}
134
+ `),1}}async function Ld(r){let e=new Ye(r.paths);if((await e.probe()).kind==="connected"){process.stdout.write(`coze-bridge: stopping daemon...
135
+ `);try{await e.request({method:"POST",path:"/shutdown"})}catch(u){process.stderr.write(`coze-bridge: stop failed (continuing): ${String(u)}
136
+ `)}await new Promise(u=>setTimeout(u,500))}if(!r.skipSupervisor)try{let{getSupervisor:u,buildContext:d}=await Promise.resolve().then(()=>(us(),xs)),h=u();await h.uninstall(d()),process.stdout.write(`coze-bridge: ${h.platform} supervisor unregistered
137
+ `)}catch(u){process.stderr.write(`coze-bridge: supervisor uninstall failed (continuing): ${String(u)}
138
+ `)}let a=r.paths??j(),{rm:c}=await import("node:fs/promises");try{await c(a.cozeRoot,{recursive:!0,force:!0}),process.stdout.write(`coze-bridge: removed ${a.cozeRoot}
139
+ `)}catch(u){return process.stderr.write(`coze-bridge: remove failed: ${String(u)}
140
140
  `),1}return process.stdout.write(`coze-bridge: uninstalled
141
- `),0}async function Of(){try{let{getSupervisor:r,buildContext:e}=await Promise.resolve().then(()=>(xs(),cs)),i=r(),o=e();return process.stdout.write(`coze-bridge: installing ${i.platform} supervisor...
142
- `),await i.install(o),process.stdout.write(`coze-bridge: supervisor installed (daemon will auto-start on login)
141
+ `),0}async function Od(){try{let{getSupervisor:r,buildContext:e}=await Promise.resolve().then(()=>(us(),xs)),i=r(),a=e();return process.stdout.write(`coze-bridge: installing ${i.platform} supervisor...
142
+ `),await i.install(a),process.stdout.write(`coze-bridge: supervisor installed (daemon will auto-start on login)
143
143
  `),0}catch(r){return process.stderr.write(`coze-bridge: --install-service failed: ${String(r)}
144
- `),1}}async function Bf(r,e,i,o={},c){let x=new Je(i.paths),f=i.spawnDaemon??ta;if(!i.skipDistInstall){let w=await ia({paths:i.paths});w.kind==="version-changed"?(process.stdout.write(`coze-bridge: upgraded ${w.fromVersion} \u2192 ${w.toVersion}
145
- `),(await x.probe()).kind==="connected"&&(await x.request({method:"POST",path:"/shutdown"}).catch(()=>{}),await new Promise(y=>setTimeout(y,500)))):w.kind==="first-install"&&process.stdout.write(`coze-bridge: installed ${w.libVersion}
146
- `)}let d=await x.probe();if(d.kind!=="connected"&&(process.stdout.write(`coze-bridge: starting daemon...
147
- `),await f({paths:i.paths}),d=await Mf(x,i.waitTimeoutMs??1e4,i.sleep??zf),d.kind!=="connected"))return process.stderr.write(`coze-bridge: daemon did not come up: ${d.kind}
148
- `),1;let g={privatecode:r,pairing_code:e};o.env&&(g.env=o.env),o.handshakeUrl&&(g.handshake_url=o.handshakeUrl),o.frontierUrl&&(g.frontier_url=o.frontierUrl),c&&(g.agent_id=c);try{let w=await x.request({method:"POST",path:"/pair",body:g,timeoutMs:35e3});return w.status===200&&w.body?.ok?(process.stdout.write(`coze-bridge: paired (${w.body.note??"ok"})
144
+ `),1}}async function Bd(r,e,i,a={},c){let u=new Ye(i.paths),d=i.spawnDaemon??ea;if(!i.skipDistInstall){let w=await sa({paths:i.paths});w.kind==="version-changed"?(process.stdout.write(`coze-bridge: upgraded ${w.fromVersion} \u2192 ${w.toVersion}
145
+ `),(await u.probe()).kind==="connected"&&(await u.request({method:"POST",path:"/shutdown"}).catch(()=>{}),await new Promise(y=>setTimeout(y,500)))):w.kind==="first-install"&&process.stdout.write(`coze-bridge: installed ${w.libVersion}
146
+ `)}let h=await u.probe();if(h.kind!=="connected"&&(process.stdout.write(`coze-bridge: starting daemon...
147
+ `),await d({paths:i.paths}),h=await Md(u,i.waitTimeoutMs??1e4,i.sleep??zd),h.kind!=="connected"))return process.stderr.write(`coze-bridge: daemon did not come up: ${h.kind}
148
+ `),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),c&&(m.agent_id=c);try{let w=await u.request({method:"POST",path:"/pair",body:m,timeoutMs:35e3});return w.status===200&&w.body?.ok?(process.stdout.write(`coze-bridge: paired (${w.body.note??"ok"})
149
149
  `),0):(process.stderr.write(`coze-bridge: pair failed: ${JSON.stringify(w.body)}
150
150
  `),1)}catch(w){return process.stderr.write(`coze-bridge: pair failed: ${String(w)}
151
- `),1}}async function Mf(r,e,i){let o=Date.now()+e;for(;Date.now()<o;){let c=await r.probe(500);if(c.kind==="connected")return c;await i(200)}return r.probe(500)}function zf(r){return new Promise(e=>setTimeout(e,r))}fa(process.argv).then(r=>process.exit(r),r=>{process.stderr.write(`fatal: ${r instanceof Error?r.stack??r.message:String(r)}
151
+ `),1}}async function Md(r,e,i){let a=Date.now()+e;for(;Date.now()<a;){let c=await r.probe(500);if(c.kind==="connected")return c;await i(200)}return r.probe(500)}function zd(r){return new Promise(e=>setTimeout(e,r))}ua(process.argv).then(r=>process.exit(r),r=>{process.stderr.write(`fatal: ${r instanceof Error?r.stack??r.message:String(r)}
152
152
  `),process.exit(1)});