coze-bridge 0.1.25 → 0.1.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +48 -46
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -5,25 +5,25 @@ import { dirname as __coze_dirname } from 'node:path';
|
|
|
5
5
|
const require = __coze_createRequire(import.meta.url);
|
|
6
6
|
const __filename = __coze_fileURLToPath(import.meta.url);
|
|
7
7
|
const __dirname = __coze_dirname(__filename);
|
|
8
|
-
var
|
|
9
|
-
`,c=`${r}.tmp-${process.pid}-${Math.random().toString(36).slice(2,10)}`;try{i?.mode!==void 0?await
|
|
10
|
-
`):
|
|
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
|
|
8
|
+
var x0=Object.create;var yr=Object.defineProperty;var f0=Object.getOwnPropertyDescriptor;var u0=Object.getOwnPropertyNames;var d0=Object.getPrototypeOf,l0=Object.prototype.hasOwnProperty;var Y=(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 Ie=(r,e)=>()=>(r&&(e=r(r=0)),e);var ie=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),Os=(r,e)=>{for(var i in e)yr(r,i,{get:e[i],enumerable:!0})},h0=(r,e,i,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let c of u0(e))!l0.call(r,c)&&c!==i&&yr(r,c,{get:()=>e[c],enumerable:!(o=f0(e,c))||o.enumerable});return r};var De=(r,e,i)=>(i=r!=null?x0(d0(r)):{},h0(e||!r||!r.__esModule?yr(i,"default",{value:r,enumerable:!0}):i,r));import{chmod as g0,mkdir as p0,readFile as m0,rename as Ms,writeFile as Bs}from"node:fs/promises";import{dirname as w0}from"node:path";async function ct(r){try{let e=await m0(r,"utf8");return JSON.parse(e)}catch(e){if(e.code==="ENOENT")return null;throw e}}async function Xt(r,e,i){await p0(w0(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 Ms(c,r),i?.mode!==void 0&&await g0(r,i.mode)}catch(f){await Ms(c,c).catch(()=>{});let{rm:u}=await import("node:fs/promises");throw await u(c,{force:!0}).catch(()=>{}),f}}var Qt=Ie(()=>{"use strict"});function Fs(r){return en[zs]<=en[r]}function br(r){qs={...r}}function Zt(r,e,i,o){if(en[r]<en[zs])return;let c=JSON.stringify({ts:new Date().toISOString(),level:r,module:e,msg:i,...qs,...o});r==="error"||r==="warn"?y0.write(`${c}
|
|
10
|
+
`):_0.write(`${c}
|
|
11
|
+
`)}function L(r){return{debug:(e,i)=>Zt("debug",r,e,i),info:(e,i)=>Zt("info",r,e,i),warn:(e,i)=>Zt("warn",r,e,i),error:(e,i)=>Zt("error",r,e,i),child:e=>L(`${r}.${e}`)}}var en,zs,_0,y0,qs,U=Ie(()=>{"use strict";en={debug:10,info:20,warn:30,error:40},zs=(()=>{let r=process.env.COZE_BRIDGE_LOG_LEVEL;return r==="debug"||r==="info"||r==="warn"||r==="error"?r:"info"})(),_0=process.stdout,y0=process.stderr,qs={}});import{homedir as b0}from"node:os";import{join as te}from"node:path";function j(r){let e=r??b0(),i=te(e,".coze"),o=te(i,"bridge"),c=te(o,"lib");return{cozeRoot:i,bridgeRoot:o,libDir:c,libEntry:te(c,"index.js"),pidFile:te(o,"bridge.pid"),portFile:te(o,"bridge.port"),tokenFile:te(o,"bridge.token"),logFile:te(o,"bridge.log"),installLock:te(o,"install.lock"),configFile:te(o,"config.json"),agentsRoot:te(i,"agents")}}function Te(r,e=j()){let i=te(e.agentsRoot,r);return{root:i,config:te(i,"config.json"),workspace:te(i,"workspace"),logs:te(i,"logs")}}var ae=Ie(()=>{"use strict"});var rn={};Os(rn,{AGENT_CONFIG_FILE_MODE:()=>tn,enforceAgentConfigMode:()=>E0,loadAgentConfig:()=>ce,persistAgentSessions:()=>vr,persistAgentSkills:()=>nn,saveAgentConfig:()=>pe});import{chmod as v0,stat as S0}from"node:fs/promises";function ce(r,e){return ct(Te(r,e).config)}function pe(r,e){return Xt(Te(r.agentId,e).config,r,{mode:tn})}async function E0(r,e){if(process.platform==="win32")return;let i=Te(r,e).config;try{let o=await S0(i);if(!o.isFile())return;let c=o.mode&511;c!==tn&&(await v0(i,tn),Us.warn("agent config mode auto-corrected to 0600",{path:i,from:c.toString(8)}))}catch(o){if(o.code==="ENOENT")return;Us.warn("enforceAgentConfigMode: chmod failed (ignored)",{path:i,err:String(o)})}}async function vr(r,e,i){let o=await ce(r,i);o&&(o.sessions=Object.fromEntries(e),await pe(o,i))}async function nn(r,e,i){let o=await ce(r,i);o&&(o.skills=e,await pe(o,i))}var Us,tn,Ue=Ie(()=>{"use strict";Qt();U();ae();Us=L("agent-config"),tn=384});var Fi=ie(H=>{"use strict";var S=D;(function(r,e){let i=D,o=r();for(;;)try{if(-parseInt(i(1515))/1+-parseInt(i(1504))/2*(parseInt(i(530))/3)+-parseInt(i(1811))/4*(parseInt(i(547))/5)+-parseInt(i(826))/6+-parseInt(i(624))/7+parseInt(i(971))/8*(-parseInt(i(790))/9)+parseInt(i(502))/10===e)break;o.push(o.shift())}catch{o.push(o.shift())}})(Bn,553787);var nx=Object[S(1081)+S(1534)],rx=Object[S(503)+S(413)+"mes"],Oi=(r,e)=>function(){return r&&(e=(0,r[{hJBPh:function(f,u){return f(u)}}[S(1425)](rx,r)[0]])(r=0)),e},sx=(r,e)=>{let i=S,o={ZxTLv:function(f,u,h,m){return f(u,h,m)}};for(var c in e)o[i(1567)](nx,r,c,{get:e[c],enumerable:!0})};function ix(){return Di||(Di=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function ox(){let r=S;return Ti||(Ti=[IDBCursor.prototype[r(539)],IDBCursor[r(1468)+"e"].continue,IDBCursor[r(1468)+"e"][r(950)+r(1870)+"ey"]])}function ax(r){let e=S,i={pJhLu:function(c,f){return c!==f},gTdTR:e(1844),FapBq:function(c,f){return c<<f},vVVWl:function(c,f){return c&f},WQzWw:function(c,f){return c===f},XeiIl:e(693),oLbLt:function(c,f){return c(f)},Jdnxt:function(c){return c()},cMkVB:e(1147),dBxDg:function(c,f,u){return c(f,u)},yLaHZ:"error",HSaxH:function(c,f){return c instanceof f}},o=new Promise((c,f)=>{let u=e,h={yPsmo:i[u(1075)],NXTyz:function(_,E,A){return i.dBxDg(_,E,A)},FIpPQ:i[u(1767)]},m=()=>{let _=u;r[_(764)+_(703)+"ner"](h[_(1625)],w),r[_(764)+_(703)+_(779)](_(430),y)},w=()=>{let _=u;if(i[_(1593)](i[_(1454)],i.gTdTR)){let E=h[_(550)](_0x258077,h[_(411)],{message:_0x356ff7[_(841)],code:_0x182b59[_(1266)+_(818)],error:_0x1df43d});this[_(1374)+"hErrorEv"+_(763)](E)}else c(Ee(r.result)),m()},y=()=>{let _=u,E={dvOVb:function(A,k){return A(k)},LxtGd:function(A,k){return i.FapBq(A,k)},Pgrhp:function(A,k){return i[D(479)](A,k)}};if(i[_(1522)](i.XeiIl,i.XeiIl))i[_(1121)](f,r[_(430)]),i[_(627)](m);else{let A=0,k=0,T;do T=E[_(1264)](_0x230e8e,_0x2ee847),A<32&&(k|=E[_(911)](E.Pgrhp(127,T),A)),A+=7;while(E[_(741)](128,T));return k}};r[u(856)+u(719)](u(1147),w),r[u(856)+u(719)](i[u(1767)],y)});return o.then(c=>{i[e(560)](c,IDBCursor)&&Tr.set(c,r)}).catch(()=>{}),On[e(1421)](o,r),o}function cx(r){let e=S,i={IfdVj:e(616),WGzHY:e(1033),FJCMy:"abort",fHwCj:function(c,f){return c!==f},zbFtz:e(1422),KCmEk:function(c){return c()},AnPUF:e(1823)+"or",uoMqr:function(c){return c()}};if(Nn[e(640)](r))return;let o=new Promise((c,f)=>{let u=e,h={WpeGk:i.IfdVj,gafWp:i[u(1022)],ruryX:i[u(1139)],VLGDY:function(_,E){return i[u(696)](_,E)},SSJeL:i[u(945)],YlwAe:function(_){return i[u(477)](_)},cbbHl:function(_,E){return _(E)},UyorF:i[u(887)],fczOa:function(_){return i[u(991)](_)}},m=()=>{let _=u;if(h.WpeGk!==h[_(594)])return _0x351498.resolve();r[_(764)+"entListe"+_(779)](h[_(1769)],w),r[_(764)+"entListener"](_(430),y),r[_(764)+_(703)+_(779)](h[_(1257)],y)},w=()=>{let _=u;h[_(1631)](h[_(1602)],_(1422))?(this["_message"+_(1834)].shift(),this["_message"+_(1834)][_(1628)](_0x4c6260)):(c(),h[_(937)](m))},y=()=>{let _=u;h[_(1002)](f,r[_(430)]||new DOMException(h[_(1302)],_(1823)+"or")),h[_(1560)](m)};r[u(856)+"Listener"](i.WGzHY,w),r.addEventListener(u(430),y),r[u(856)+u(719)](i[u(1139)],y)});Nn[e(1421)](r,o)}function xx(r){Mn={JPRro:function(o,c){return o(c)}}[S(1813)](r,Mn)}function fx(r){let e=S,i={sOdIl:function(o,c){return o(c)},sVlFy:function(o,c){return o(c)},hVTIM:function(o,c){return o(c)},dUrTw:function(o,c){return o(c)},nxrWB:function(o,c){return o===c},piyXL:function(o,c){return o in c},Fzurl:function(o){return o()}};return i[e(1490)](r,IDBDatabase[e(1468)+"e"][e(1365)+e(1508)])&&!i.piyXL(e(708)+e(960),IDBTransaction.prototype)?function(o,...c){let f=e,u=r[f(996)](i[f(909)](zt,this),o,...c);return Dr[f(1421)](u,o[f(1708)]?o[f(1708)]():[o]),i[f(713)](Ee,u)}:i[e(1723)](ox)[e(1791)](r)?function(...o){let c=e;return r[c(1179)](i.hVTIM(zt,this),o),i[c(1151)](Ee,Tr.get(this))}:function(...o){let c=e;return i.sOdIl(Ee,r[c(1179)](i[c(1497)](zt,this),o))}}function ux(r){let e=S,i={gLlaJ:function(o,c){return o(c)},LzQXl:function(o,c){return o instanceof c},mcDAp:function(o,c){return o(c)},jYPMy:function(o,c,f){return o(c,f)}};return typeof r===e(1683)?i[e(1041)](fx,r):(i.LzQXl(r,IDBTransaction)&&i[e(1263)](cx,r),i.jYPMy(Mi,r,ix())?new Proxy(r,Mn):r)}function Ee(r){let e=S,i={BthgI:function(c,f){return c instanceof f},faBZU:function(c,f){return c!==f}};if(i[e(1445)](r,IDBRequest))return ax(r);if(Ln[e(640)](r))return Ln.get(r);let o=ux(r);return i[e(1691)](o,r)&&(Ln.set(r,o),On[e(1421)](o,r)),o}var Mi,Di,Ti,Tr,Nn,Dr,Ln,On,Mn,zt,Li=Oi({"node_modules/idb/build/wrap-idb-value.js"(){let r=S,e={NxHzD:function(i,o){return i instanceof o},QbGgH:function(i,o){return i===o},bfAbm:r(537),Ezvyt:"objectSt"+r(960),HbSsD:function(i,o){return i===o},vGKHN:r(1740),fsJio:function(i,o,c){return i(o,c)},TYvht:r(723),rwXDT:function(i,o){return i instanceof o},lytiF:function(i,o){return i===o}};Mi=(i,o)=>o.some(c=>i instanceof c),Tr=new WeakMap,Nn=new WeakMap,Dr=new WeakMap,Ln=new WeakMap,On=new WeakMap,Mn={get(i,o,c){let f=r;if(e[f(707)](i,IDBTransaction)){if(e[f(670)](o,e[f(1124)]))return Nn.get(i);if(e.QbGgH(o,e[f(1046)]))return i[f(708)+f(960)]||Dr[f(1018)](i);if(e.HbSsD(o,e[f(1827)]))return c["objectSt"+f(960)][1]?void 0:c.objectStore(c[f(708)+f(960)][0])}return Ee(i[o])},set(i,o,c){return i[o]=c,!0},has(i,o){let c=r;if(e[c(637)]!==c(723)){let f=c(1110)+_0x2c654b+(c(1491)+c(1086)+c(1669)+c(1783));this[c(608)](f),this["_dispatc"+c(536)+"ent"](e[c(485)](_0xc923de,c(430),{message:f,code:_0x4fa519["MAX_RETR"+c(1634)+"R"]}));return}else return e.rwXDT(i,IDBTransaction)&&(e[c(912)](o,e[c(1124)])||o===c(1740))?!0:o in i}},zt=i=>On[r(1018)](i)}}),Bi={};sx(Bi,{deleteDB:()=>lx,openDB:()=>dx,unwrap:()=>zt,wrap:()=>Ee});function dx(r,e,{blocked:i,upgrade:o,blocking:c,terminated:f}={}){let u=S,h={eZRYW:function(y,_,E,A,k){return y(_,E,A,k)},oROla:function(y,_){return y(_)},LvHbG:"close",SmVCd:"versionc"+u(1810),ejAkB:u(625)},m=indexedDB[u(516)](r,e),w=h[u(1506)](Ee,m);return o&&m.addEventListener(u(1736)+u(731),y=>{let _=u;h.eZRYW(o,h[_(1506)](Ee,m.result),y[_(917)+"on"],y[_(664)+"on"],h[_(1506)](Ee,m[_(1365)+_(1508)]))}),i&&m[u(856)+"Listener"](h[u(1661)],()=>i()),w[u(555)](y=>{let _=u;f&&y[_(856)+_(719)](h[_(720)],()=>f()),c&&y["addEvent"+_(719)](h[_(798)],()=>c())})[u(905)](()=>{}),w}function lx(r,{blocked:e}={}){let i=S,o={chJuS:i(625),lSITk:function(f,u){return f(u)}},c=indexedDB[i(1313)+i(648)](r);return e&&c[i(856)+"Listener"](o[i(1815)],()=>e()),o[i(1548)](Ee,c).then(()=>{})}function Ri(r,e){let i=S,o={QAnrr:i(1695),ZJXpg:function(m,w){return m instanceof w},bmyTK:function(m,w){return m in w},bZNQD:function(m,w){return m===w},BcsyN:i(462),OFLbz:i(459),oNPYA:function(m,w){return m!==w}};if(!(o[i(439)](r,IDBDatabase)&&!o[i(1542)](e,r)&&o[i(753)](typeof e,o.BcsyN))){if(o[i(1300)]===o[i(1300)])return;_0x539452(this[i(1336)+i(1538)+"utId"]),this["_connect"+i(1538)+i(694)]=null}if(Rn[i(1018)](e))return Rn[i(1018)](e);let c=e[i(1579)](/FromIndex$/,""),f=o[i(792)](e,c),u=qi[i(1791)](c);if(!o[i(1542)](c,(f?IDBIndex:IDBObjectStore)[i(1468)+"e"])||!(u||zi[i(1791)](c)))return;let h=async function(m,...w){let y=i,_=this["transact"+y(1508)](m,u?y(1352)+"e":o[y(1246)]),E=_.store;return f&&(E=E.index(w[y(567)]())),(await Promise[y(1401)]([E[c](...w),u&&_[y(537)]]))[0]};return Rn[i(1421)](e,h),h}var zi,qi,Rn,hx=Oi({"node_modules/idb/build/index.js"(){let r=S,e={xTWfe:r(1301)+r(1130),NTJut:function(c){return c()},nQbiy:function(c,f){return c(f)},uSvBZ:r(1764)+"ys",QAbAc:r(1615),UxFap:"add",BoRcf:"delete",nLKie:r(1513)},i=e[r(1234)].split("|"),o=0;for(;;){switch(i[o++]){case"0":e[r(1251)](Li);continue;case"1":Rn=new Map;continue;case"2":Li();continue;case"3":e[r(725)](xx,c=>({...c,get:(f,u,h)=>Ri(f,u)||c.get(f,u,h),has:(f,u)=>!!Ri(f,u)||c[r(640)](f,u)}));continue;case"4":zi=[r(1018),r(1267),"getAll",e[r(1111)],e[r(436)]];continue;case"5":qi=[r(1821),e.UxFap,e.BoRcf,e[r(1074)]];continue}break}}}),gx={idb:function(r){let e=S;r[e(1164)]=Promise[e(1269)]().then(()=>(hx(),Bi)).then(function(i){return i})}},Ni={};function Se(r){let e=S,i={uHHlu:e(1297)+"4",aQcdF:function(h,m){return h!==m}},o=i[e(1428)][e(839)]("|"),c=0;for(;;){switch(o[c++]){case"0":gx[r](f,f[e(1164)],Se);continue;case"1":var f=Ni[r]={exports:{}};continue;case"2":if(i[e(1388)](void 0,u))return u[e(1164)];continue;case"3":var u=Ni[r];continue;case"4":return f[e(1164)]}break}}(()=>{let r={ohzLa:function(e,i){return e!==i},JqdpQ:"TLybq"};Se.d=(e,i)=>{let o=D;if(r[o(528)](r[o(1223)],r.JqdpQ))return H[o(447)]?H[o(447)][o(1562)+"te"]:H[o(715)][o(941)+o(1327)]?H[o(1539)+"NG"]:H[o(1868)];for(var c in i)Se.o(i,c)&&!Se.o(e,c)&&Object[o(1081)+o(1534)](e,c,{enumerable:!0,get:i[c]})}})(),(()=>{let r=S;Se.o=(e,i)=>Object.prototype.hasOwnProperty[r(996)](e,i)})(),(()=>{let r=S,e={OFHpP:function(i,o){return i!=o},VjZJL:r(1330)+"d"};Se.r=i=>{let o=r;e[o(1038)](e[o(1505)],typeof Symbol)&&Symbol[o(1648)+o(1385)]&&Object[o(1081)+o(1534)](i,Symbol["toString"+o(1385)],{value:o(1218)}),Object[o(1081)+"operty"](i,o(1426)+"le",{value:!0})}})();function D(r,e){r=r-400;let i=Bn(),o=i[r];if(D.ggIQKk===void 0){var c=function(m){let w="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=",y="",_="";for(let E=0,A,k,T=0;k=m.charAt(T++);~k&&(A=E%4?A*64+k:k,E++%4)?y+=String.fromCharCode(255&A>>(-2*E&6)):0)k=w.indexOf(k);for(let E=0,A=y.length;E<A;E++)_+="%"+("00"+y.charCodeAt(E).toString(16)).slice(-2);return decodeURIComponent(_)};D.mArgWq=c,D.rOdCqz={},D.ggIQKk=!0}let f=i[0],u=r+f,h=D.rOdCqz[u];return h?o=h:(o=D.mArgWq(o),D.rOdCqz[u]=o),o}var V={};(()=>{let r=S,e={trsTn:function(s,t){return s+t},snkjm:function(s,t){return s+t},ZEDZY:function(s,t){return s+t},kSWoF:function(s,t){return s*t},QEJyU:function(s,t){return s+t},RoOaX:function(s,t){return s(t)},LwQdJ:function(s,t,n){return s(t,n)},HsgEX:function(s,t,n){return s(t,n)},iveDz:function(s,t){return s(t)},FNEat:function(s,t){return s+t},AKgLE:"0000",rbmmG:"ffff",CvHqL:"00000000"+r(443)+r(443)+"00000000",JyiLu:function(s,t){return s>t},sateq:function(s,t){return s!==t},XMYYh:"xYpYh",TjAwA:function(s,t){return s>t},xrMwG:function(s,t){return s-t},XFTJZ:function(s,t){return s!==t},yksuW:function(s,t){return s<t},SVvTF:function(s,t){return s-t},RRAEj:function(s,t){return s===t},vdDbx:function(s,t){return s<t},nnDnG:function(s,t,n){return s(t,n)},RqaGm:function(s,t,n){return s(t,n)},SbrBv:function(s,t){return s&t},xgigA:r(434)+"required"+r(1797)+r(1274),itgBM:r(434)+"required field: "+r(1611),rYWhM:r(430),TCOzO:function(s,t,n){return s(t,n)},fXasl:r(1488),YBMrx:function(s,t,n){return s(t,n)},hbovx:function(s,t){return s===t},XpFQt:r(1662),CieBz:function(s,t,n){return s(t,n)},KqcKk:function(s,t,n){return s(t,n)},CKcHU:function(s,t,n){return s(t,n)},DwoWR:function(s,t,n){return s(t,n)},TQXqC:function(s,t){return s(t)},goioU:r(1004),rukcS:r(1470),lMxdF:function(s){return s()},kwqxz:function(s,t,n){return s(t,n)},wkGxP:function(s,t,n){return s(t,n)},HGojz:function(s,t,n){return s(t,n)},txzKn:function(s,t){return s(t)},qWvFm:"YYige",xlWRt:function(s,t){return s!==t},MohEU:function(s,t,n){return s(t,n)},EblQH:function(s,t,n){return s(t,n)},yNBfG:function(s,t){return s!==t},OrVXi:function(s,t,n){return s(t,n)},mmvDP:r(1255),gHydE:r(740),MOuFa:function(s,t,n){return s(t,n)},XWcOJ:function(s,t){return s!==t},RpzLh:function(s,t){return s(t)},dTjmK:function(s,t,n){return s(t,n)},FjwHF:function(s,t){return s(t)},DdHFR:function(s,t){return s(t)},RfECd:function(s,t,n){return s(t,n)},UylNt:function(s,t,n){return s(t,n)},yVqVA:function(s,t,n){return s(t,n)},oULFi:r(434)+r(902)+r(1797)+"SeqID",vBsgp:r(434)+r(902)+r(1797)+r(805),vQUfS:function(s,t){return s===t},dggjt:r(434)+"required"+r(1797)+"service",RjdCE:function(s,t){return s===t},uIFSh:"Missing "+r(902)+r(1797)+r(745),bxPHP:function(s,t){return s+t},bazMc:function(s,t){return s&t},saWZe:function(s,t){return s(t)},cPoNj:function(s,t,n){return s(t,n)},xKSot:function(s,t,n){return s(t,n)},oWurm:r(904)+"ented type: ",vVTxl:"soauG",BkxKY:function(s,t){return s>=t},gpnNf:function(s,t){return s>t},CRMVX:function(s,t){return s>=t},HTFVE:function(s,t){return s+t},KhMDY:function(s,t){return s>t},HMNPm:"Read pas"+r(1779),aVHdX:function(s,t){return s+t},AzVOz:function(s,t,n){return s(t,n)},yFOOF:function(s,t){return s<t},xIrGa:function(s,t){return s+t},sYhpq:function(s,t){return s&t},PWhjk:function(s,t){return s===t},kserA:function(s,t){return s+t},FWgGP:function(s,t){return s+t},LxLId:function(s,t){return s+t},Aslcj:function(s,t){return s&t},Akclj:function(s,t){return s<<t},nsimS:function(s,t){return s==t},aDsRq:function(s,t){return s+t},UKdfe:function(s,t){return s+t},WgaKr:function(s,t){return s!==t},aJKMz:function(s,t){return s&t},lKwbg:function(s,t){return s>=t},nALPN:function(s,t){return s<=t},UGQxc:function(s,t){return s==t},hLfbr:function(s,t){return s&t},lxqjZ:function(s,t){return s+t},EKFor:function(s,t){return s!==t},aBDnI:function(s,t){return s|t},YSZzM:function(s,t){return s<<t},RQKmI:r(1516),BGruf:function(s,t){return s|t},Wxqnr:function(s,t){return s|t},Kfrys:function(s,t){return s<<t},aZszm:function(s,t){return s<<t},bXEYj:function(s,t){return s<<t},Riivc:function(s,t){return s>>t},MzQLz:function(s,t){return s>=t},IrLfJ:function(s,t){return s<=t},pdggA:function(s,t){return s<t},qLTPw:function(s,t){return s+t},NhoIR:function(s,t){return s<<t},Scwuc:function(s,t){return s<t},nzofR:function(s,t){return s<t},hnvFq:function(s,t,n){return s(t,n)},nJHqE:function(s,t){return s>=t},XtdZJ:function(s,t){return s-t},FQhHK:function(s,t){return s+t},yPImm:function(s,t){return s<t},CAnDb:function(s,t){return s>>t},XKhvh:function(s,t){return s<t},WMyaR:function(s,t){return s===t},FgIIY:r(922),hJiXp:r(1299),pzgFx:function(s,t){return s|t},HvRsp:function(s,t){return s>>t},ZlBFK:function(s,t){return s>>t},wxJsT:function(s,t){return s|t},BTvor:function(s,t){return s&t},VYDyt:function(s,t){return s<t},pMiPd:"gqLGZ",mVJLx:function(s,t){return s(t)},GIyyE:function(s,t){return s<t},zNSeL:function(s,t,n){return s(t,n)},SfefU:function(s,t){return s|t},IPuPj:function(s,t){return s<<t},mvagh:function(s,t){return s&t},AyAYW:function(s,t){return s&t},SVvjV:function(s,t){return s&t},ZHrJK:function(s,t){return s&t},SGpCQ:function(s,t){return s&t},WxRdZ:function(s,t){return s===t},nNAWV:"QsqOb",frriL:function(s,t){return s&t},StsXe:function(s,t){return s(t)},pZZQO:function(s,t){return s<<t},zUEOl:function(s,t){return s&t},RiOtv:function(s,t){return s(t)},yxLdJ:function(s,t){return s<<t},GJIIK:function(s,t){return s&t},OwOXT:function(s,t){return s&t},hIWEy:function(s,t){return s&t},iwrTG:r(405),PiDEd:function(s,t){return s&t},nspPZ:function(s,t){return s(t)},qCRnq:function(s,t){return s&t},ucKPK:function(s,t){return s>>>t},STXac:function(s,t){return s>>>t},fsIEv:function(s,t){return s<t},JaTZO:function(s,t){return s<t},ypzDv:function(s,t){return s<t},fMVcN:function(s,t,n){return s(t,n)},UFwhQ:function(s,t){return s+t},LboJJ:function(s,t){return s>>>t},ZyfDx:function(s,t){return s!==t},NlcRt:function(s,t){return s>>>t},SMOfZ:function(s,t){return s!==t},Jdhkr:function(s,t){return s>>>t},KXFWg:function(s,t){return s>>>t},CBZIn:function(s,t){return s+t},qSWYo:function(s,t){return s!==t},ieRbM:function(s,t){return s|t},dbLTh:function(s,t){return s&t},FHMqr:function(s,t){return s>>>t},iriIt:function(s,t){return s+t},pXWoz:function(s,t){return s|t},DKvrt:function(s,t){return s>>>t},GGLRP:function(s,t){return s+t},rRlSA:function(s,t){return s!==t},QkUUe:function(s,t){return s>>>t},dukAv:function(s,t){return s|t},sityD:function(s,t){return s>>t},uPgZl:function(s,t){return s|t},GBgnt:function(s,t){return s&t},HjtKj:function(s,t){return s===t},rWQjp:r(1415),HXLzP:"kWIVj",unpNu:function(s,t){return s(t)},NhHfJ:function(s,t){return s===t},LgBWx:r(822),mJMka:function(s,t){return s===t},UtgVK:function(s,t){return s|t},nSPkS:function(s,t){return s|t},UQmcV:function(s,t){return s|t},zxUri:function(s,t){return s|t},TLlla:function(s,t){return s<<t},cUQcH:r(907),KYpIp:function(s,t){return s|t},HHCLy:function(s,t){return s|t},NLWUL:r(964),sWdpv:r(843),hfLOC:function(s,t){return s===t},Rcwdx:function(s,t){return s>>>t},bOhFJ:function(s,t){return s|t},GpJaY:function(s,t){return s<<t},JfNnj:function(s,t){return s<<t},SvkXO:function(s,t){return s|t},zlasg:function(s,t){return s|t},NuGWe:function(s,t,n,a){return s(t,n,a)},Oekvj:r(1796),KBIHQ:r(469),JZYGv:function(s,t){return s>>>t},BrXQD:function(s,t){return s>>>t},lJstq:function(s,t){return s(t)},LIuoJ:function(s,t){return s>=t},FLxHi:function(s,t){return s|t},xrgNy:function(s,t){return s/t},qHJid:function(s,t){return s*t},OFWWq:function(s,t){return s>>>t},qPuFP:function(s,t){return s>>>t},CFaWF:function(s,t){return s===t},ynsJj:function(s,t){return s&t},mqrwn:function(s,t){return s>>>t},gJfGp:function(s,t){return s>>>t},tgwar:function(s,t){return s+t},mWxcq:function(s,t){return s+t},MyFab:function(s,t){return s<<t},QXzZm:"complete",EtwKL:function(s,t){return s!==t},ZeREa:r(1106),YRFCm:function(s,t){return s===t},SMWRl:function(s,t){return s>>>t},yInQV:function(s,t){return s===t},slozr:function(s,t){return s===t},XSYJn:function(s,t){return s===t},PcidF:function(s,t){return s+t},yCiYQ:function(s,t){return s+t},LOYbI:function(s,t){return s>>>t},tjRzb:function(s,t){return s>>>t},USWJd:function(s,t){return s>>>t},zIaPa:function(s,t){return s&t},NIDzm:function(s,t){return s>>>t},HRHre:function(s,t){return s>>>t},QtMkD:function(s,t){return s>>>t},DEgWa:function(s,t){return s&t},sUzRS:r(669)+r(1741),cOKYt:r(1539)+"NG_ERROR",ZQjpo:"MAX_RETRIES_ERROR",KhdpJ:r(1266)+r(818),ffdKj:r(1349)+"OR",LUdxa:r(1210)+"0",heQMh:function(s,t){return s>>>t},BLbAt:function(s,t){return s+t},ahdIv:function(s,t){return s+t},amAVM:function(s,t){return s&t},eqtpz:function(s,t){return s>>>t},HNctY:r(780),fkxax:function(s,t){return s>>>t},bOKhn:function(s,t){return s|t},SNgbL:function(s,t){return s<<t},reJRR:function(s,t){return s<<t},rOvug:r(1277),dAwDP:r(1295),WGgrc:function(s,t){return s!==t},YSAPo:r(799),hvdDj:function(s,t){return s===t},qkjQw:function(s,t){return s==t},RDWDi:function(s,t){return s>t},lHxfe:function(s,t){return s===t},GzRRz:r(1438)+"d error.",GQYEs:function(s,t){return s+t},tCWwH:function(s,t){return s+t},ueIYA:function(s,t){return s===t},Hrywd:r(1626),UcBTP:function(s,t){return s===t},yQnSh:function(s,t){return s<t},cJfMP:function(s,t){return s===t},GOTsc:"close",XRJSS:function(s,t,n){return s(t,n)},xfxfV:function(s,t){return s*t},ILApt:r(516),FSCeR:r(602),KxPBJ:r(989),VALkE:function(s,t,n){return s(t,n)},aqefs:r(841),lRirh:"fzZhN",lpPGM:r(766),sVYJJ:function(s,t,n){return s(t,n)},Pdraz:function(s,t){return s instanceof t},wohxj:function(s,t){return s===t},VoxFc:function(s,t){return s||t},xafoy:function(s,t){return s!=t},rpJZg:r(1330)+"d",xGrqm:"naZcq",LBVrF:r(1535)+"4",lhDRF:function(s,t){return s!=t},peDIm:function(s,t){return s<=t},yhVzO:r(1384)+r(1545)+r(1194)+"imes in "+r(1440),PZHdH:r(1642),cjnmY:function(s,t){return s(t)},FKedo:function(s,t){return s<t},miLGx:function(s,t){return s<t},fBhrY:function(s,t){return s===t},IlmuM:function(s,t){return s&t},bRwDR:function(s,t){return s===t},SbnJx:function(s,t){return s+t},bFuSE:function(s,t){return s>=t},NASZK:function(s,t){return s<t},lswtm:function(s,t){return s|t},oQpTX:function(s,t){return s&t},fBvxm:function(s,t){return s|t},bFIrG:function(s,t){return s&t},ayZJA:function(s,t){return s!==t},OqsWl:r(1571),yOVPf:r(1777),qCfaC:function(s,t){return s-t},OTEXG:function(s,t){return s<<t},AGIli:function(s,t){return s&t},aEMxQ:function(s,t){return s+t},eKDNs:function(s,t){return s&t},nxLkh:function(s,t){return s<t},QBWRF:function(s,t){return s<t},hYULc:function(s,t){return s|t},kOLRO:function(s,t){return s&t},ekLBj:function(s,t){return s&t},LxUHK:r(1707)+r(1156),OcfUQ:function(s,t){return s+t},TlHOM:function(s,t){return s&t},syQDb:function(s,t){return s&t},bXubV:function(s,t){return s|t},HuKqG:function(s,t){return s&t},uHdmO:function(s,t){return s&t},OQwpo:function(s,t){return s>>t},Dnifw:function(s,t){return s|t},wjMNm:function(s,t){return s!==t},Ndkcw:r(1703),TmXXO:r(955),neuNL:function(s,t){return s|t},EvLdW:function(s,t){return s&t},sJzlD:r(462),XUUjh:r(1603),ZZgYD:r(1118),RIQwW:function(s,t,n,a){return s(t,n,a)},QPGoL:function(s,t){return s instanceof t},Hwmta:r(1347)+"ion/json",HBwYo:r(928)+r(1607)+"et=utf-8",gBZbn:function(s,t){return s===t},mikia:r(1559),YQydO:"geiZI",uDNDA:r(643),qDEKT:r(1346),XEWdk:function(s,t){return s|t},omqYd:function(s,t){return s<<t},MXBJo:function(s,t){return s&t},ZrTKb:function(s,t){return s<t},bgSwq:r(899),KExKg:function(s,t){return s>=t},LGdGu:r(1465)+"ascript",RfVfs:function(s,t){return s+t},FkuMy:r(580),UCSbd:r(944),bZeLp:r(862)+r(1028),wMono:function(s,t,n,a){return s(t,n,a)},WFzzV:function(s,t,n){return s(t,n)},BKqIA:function(s,t){return s!==t},bqhlz:r(778),lTHrN:r(509),sHRYv:function(s,t){return s===t},oXMOK:"rvclw",RfVue:function(s,t){return s||t},nRRSf:r(1512),Optwa:r(471),iGTNN:function(s,t){return s||t},wLPYw:"RUpuk",ThcQp:function(s,t){return s||t},rxxWG:function(s,t){return s||t},KXDPR:function(s,t){return s||t},UImwZ:function(s,t){return s||t},tsgYQ:function(s,t){return s||t},NYLHR:function(s,t){return s>=t},TgTZH:function(s,t){return s%t},ebdCG:function(s,t){return s|t},yiARZ:function(s,t){return s/t},GiYbb:function(s,t){return s!=t},sAlGy:function(s,t){return s||t},bVyAn:"init QoS"+r(470)+"d",PUxzZ:function(s,t,n){return s(t,n)},sxBWE:r(1498)+"_EXIST",UppPo:r(1499),DTZDF:function(s,t){return s+t},RrJyQ:function(s,t){return s!==t},RKLhj:function(s,t){return s<<t},mKWhu:function(s,t){return s|t},XFEYB:function(s,t){return s&t},LMZYh:function(s,t){return s>=t},PUpML:function(s,t){return s<=t},wFiJk:function(s,t){return s===t},boHwL:r(870),LBbxM:"x_frontier_qos",mSDzZ:r(1577)+r(1104)+"k",DcDAX:function(s,t,n){return s(t,n)},nTlYf:r(1577)+"er_ack_m"+r(884),nCITN:r(957),BWmVR:r(1867),PICae:r(1117),CFGEG:r(1010),HEHZX:function(s,t){return s||t},pRKOQ:r(1350),qTelE:function(s){return s()},GTkkE:r(814),Juukg:function(s){return s()},FzhYA:function(s,t){return s(t)},VAeZs:function(s,t){return s!==t},qhyNa:r(1729),dLfKV:function(s,t){return s instanceof t},zytMO:r(1347)+r(1311)+";charset"+r(1292),DhnET:function(s,t,n,a){return s(t,n,a)},gWvPr:function(s,t){return s<t},JcGtX:function(s,t){return s(t)},RNUtg:function(s,t){return s||t},xBtiA:function(s,t){return s+t},Wbwls:function(s,t){return s+t},UIOjO:function(s,t){return s+t},nCOzW:function(s,t){return s+t},bYFff:function(s,t){return s+t},HzMsX:r(721)+"t of ran"+r(1547),reJMX:r(915),fCCql:function(s,t){return s||t},mhAzf:r(1517),imEff:function(s,t){return s>t},QdJyL:"integer too large",CxiIM:function(s,t){return s>=t},TszSK:"fLShE",qQfud:r(1725),REHsG:function(s,t){return s&t},llKvD:function(s,t,n,a){return s(t,n,a)},lvitN:function(s,t){return s+t},RqPlM:function(s,t){return s<t},NlLmt:function(s,t,n){return s(t,n)},jPgKT:function(s,t){return s!==t},wUCuG:r(1398),iWcsr:r(1659)+"1",Sagiu:function(s,t){return s+t},LOUcL:function(s,t){return s+t},YYOga:function(s,t,n,a){return s(t,n,a)},sStWn:function(s,t){return s|t},dmsWH:function(s,t){return s+t},VkTgC:function(s,t){return s<<t},SNvrj:function(s,t){return s+t},tMOwO:function(s,t){return s|t},yqrWr:function(s,t){return s|t},tsgig:function(s,t){return s+t},rkaaE:function(s,t){return s+t},QnlQj:function(s,t){return s&t},BHiFw:function(s,t){return s+t},buheI:function(s,t){return s&t},rgfDL:function(s,t){return s>>>t},OmYKC:function(s,t){return s&t},wIdYl:function(s,t){return s>>>t},DgnuL:function(s,t){return s+t},KRzGG:"2|10|11|"+r(1093)+"5|4|1|8|9",zLBNd:function(s,t){return s|t},NJkNS:function(s,t){return s&t},oPFjk:function(s,t){return s>>>t},CrBWj:function(s,t){return s<<t},MrsTG:function(s,t){return s<t},KzyCA:function(s,t,n,a){return s(t,n,a)},Ghpdc:function(s,t){return s|t},TxKsv:function(s,t){return s===t},jSTsJ:r(1526),ftWsT:r(1172),pyLza:r(1572),oLKSu:function(s,t){return s(t)},MisYZ:r(427)+r(1114),jbhTp:function(s,t,n,a){return s(t,n,a)},jBclC:r(1114),NKNXR:r(1790),xfIfV:r(1746)+r(1095),GNkAX:function(s,t){return s===t},TdplN:r(474),wwyaP:function(s,t,n){return s(t,n)},nRSRO:function(s,t,n){return s(t,n)},ehHOl:function(s,t,n){return s(t,n)},LAaQe:r(1793)+r(1141),mWDQi:function(s,t,n){return s(t,n)},adKEq:function(s,t){return s<t},esMZu:function(s,t){return s+t},sJPOq:"WELpH",NuGAq:r(487),gsEEU:r(901)+"rValues",baZUU:r(1231),FgUDA:function(s,t,n,a){return s(t,n,a)},OnYjp:"setdb",DxxAd:r(1597)+"e_success",UqiKS:r(1597)+r(644)+"t",ImTvM:r(1710),EweoS:function(s,t){return s!==t},uLjLQ:r(478),HtWjw:"setcursor",LOXpS:function(s,t){return s!==t},plCpZ:function(s,t){return s!==t},nYgrZ:r(1191),qXQrJ:r(1701),YGFnF:r(1453),dQfbO:"fGuYy",tFjAa:r(1550),LkaRj:function(s,t){return s||t},DQahX:function(s,t){return s!=t},HzLUI:r(1496),Qwwqd:function(s,t){return s-t},KQDQu:function(s,t){return s!==t},LOJAK:r(1243),VLvSH:r(783),tmGHn:function(s,t){return s||t},cnHuh:r(1744),BxtYB:r(1577)+r(1831),VCRQG:function(s,t,n){return s(t,n)},JTGhs:r(1087)+"s",UaiIq:r(432)+r(522)+"e",aCIXP:r(432)+r(1318)+"ue",rZjUd:function(s){return s()},toCCY:"YueiT",kzYFf:function(s,t){return s===t},ziEqP:function(s,t,n){return s(t,n)},sqBIZ:function(s){return s()},WRCkS:function(s,t){return s(t)},MgnZE:function(s,t){return s+t},ltvle:function(s,t){return s+t},bnUZu:r(1203),frnVV:function(s,t){return s<t},rqkTY:function(s,t){return s===t},QNYEL:r(1013),IDoqB:function(s,t,n){return s(t,n)},HxqXS:function(s){return s()},gPRNb:r(1360),jfHgP:r(1166),tynyt:function(s,t,n){return s(t,n)},DQIkF:function(s,t,n){return s(t,n)},pqMGU:r(982),DsByX:function(s,t){return s===t},fDCjv:r(1600),zJXCK:function(s,t,n,a){return s(t,n,a)},YGVOX:r(1444),KTsnT:r(687),DUXlA:function(s,t){return s===t},xzLIo:r(1244),YkHdu:function(s,t){return s===t},UFgqY:r(1147),mqHZv:function(s,t){return s===t},EGZJI:r(1006),iDZLY:function(s,t,n){return s(t,n)},mbnNd:function(s,t){return s!==t},safDA:r(1469),jjvVy:r(1557)+r(455),CGTVd:r(1549),ouFes:r(1781),uUaPh:function(s,t){return s==t},OMkrP:function(s,t){return s(t)},WzZva:r(1594)+"t",rAlyy:"pagehide",guDtB:r(1079),TDTVC:r(1061),IgyPB:function(s,t){return s!==t},mnhdC:function(s,t){return s instanceof t},qUiSA:r(537),AlFsC:function(s,t){return s===t},WMEMJ:"store",pQdyR:r(1632),XcEDC:r(1368),DRoae:"wss://",fzvpY:r(1587),CeTvX:function(s,t){return s||t},wCKQZ:r(1298)+r(532)+"ddID, deviceID o"+r(1310),EDNvb:r(1683),Iecxg:r(1293),XvrvL:"fws_1.0.0",nBuNz:r(1212),rJhce:function(s,t,n){return s(t,n)},YHGUD:r(463),WUgvS:function(s,t,n){return s(t,n)},hIIOP:function(s,t){return s(t)},XMpKL:function(s,t){return s(t)},pHNRr:r(1727)+">",ksCWY:function(s,t){return s*t},zehBG:function(s,t){return s>t},dExKD:r(840),Attcl:r(619),IPuac:"MzUvo",eWmrd:r(1730),LqkQC:"going aw"+r(506)+r(1594)+r(1248)+r(1586),lKqxk:r(1037)+r(1585)+r(1591)+"ct",OntJG:r(1688),Cbfcm:"CoaLq",GiKcu:r(650)+r(1324)+"onnecting",iVOLk:r(441),LsJgH:r(412),gHpIJ:r(746),mwKOw:function(s,t){return s===t},anvLs:"JOoNa",HKmLm:function(s,t,n){return s(t,n)},dZTHl:function(s,t,n){return s(t,n)},Zajax:r(735)+r(791)+r(1315)+r(665),MMFvb:function(s,t){return s===t},qkacA:r(660),IzwKv:r(1866),ZZgCn:function(s,t){return s+t},QsyEQ:function(s,t){return s===t},hFqRi:function(s,t){return s===t},cVKSB:r(1298)+"rovide a"+r(930)+r(414)+r(1679)+"e a stri"+r(709)+r(1148)+"ffer",uyAqW:function(s,t){return s!=t},bqOEd:function(s,t){return s instanceof t},PVaxF:function(s,t){return s(t)},CtEmC:function(s,t){return s instanceof t},TWSjS:function(s,t){return s(t)},BzKtx:function(s,t){return s===t},TXGcP:r(423),EOpXa:function(s,t){return s<t},LEumk:r(1530),xlkOb:function(s,t){return s||t},ERdYd:function(s,t){return s==t},tslsM:function(s,t){return s!==t},jDjEr:r(421)+r(1259)+r(1208),fPCrU:r(597),HLUue:"\0\0\0\0\0\0\0\0",Aqoci:function(s,t){return s!=t},OuHeG:"Window",MMlge:function(s,t){return s===t},wbNva:r(860),FrKIj:r(1676)+r(607)+r(1058)+"pe",SNerq:function(s,t){return s!=t},bHWBy:function(s,t){return s==t},clePG:function(s,t){return s!=t},amcUr:function(s,t){return s!=t},xmetk:function(s,t){return s===t},gnaRa:r(948)+r(1798)+"balScope",Cqloj:function(s,t){return s!=t},bSsRj:function(s,t){return s!=t},XCIGz:function(s,t,n){return s(t,n)},BMSpK:r(486)+r(673)};Se.r(V),Se.d(V,{FWS:()=>o0,CustomErrorEvent:()=>ws,createCloseEvent:()=>he,ReconnectEvent:()=>ms,createErrorEvent:()=>fe,decodedFrame:()=>ds,createOpenEvent:()=>Es,CustomCloseEvent:()=>_s,createReconnectEvent:()=>xr,FrontierMessageEvent:()=>bs,encodeFrame:()=>cr,createMessageEvent:()=>Ss,OpenEvent:()=>vs,ErrorCode:()=>qe,Event:()=>it,MessageEvent:()=>ys});let i="";function o(s=""){let t=r,n="02",a=""+Date[t(639)](),x=i||(i=m(s)),l=Math.random().toString(16)[t(1621)](-6);return e[t(1394)](e[t(1478)](n,a),x)+l}function c(){let s=r;return e[s(1544)](e[s(718)](1e4,Date[s(639)]()),Math[s(558)](e[s(718)](1e4,Math[s(1644)]())))}function f(s){let t=r;return e[t(1345)](e[t(1043)](Array,8)[t(454)]("0"),e[t(1553)](parseInt,s,10)[t(1648)](2))[t(1621)](-8)}function u(s){let t=r;return e[t(1478)](e[t(1043)](Array,4)[t(454)]("0"),e.HsgEX(parseInt,s,2)[t(1648)](16))[t(1621)](-4)}function h(s){let t=r,n=s[t(839)](/\./)[t(1598)](l=>f(l)),a=[];return a[0]=e.iveDz(u,e[t(1543)](n[0],n[1])),a[1]=e[t(1043)](u,e[t(1345)](n[2],n[3])),[t(636),e[t(420)],e[t(420)],e[t(420)],e.AKgLE,e[t(1670)],a[0],a[1]][t(454)]("")}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(1239)](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(1239)](s);return n?e[t(614)](h,s):a?e[t(614)](w,s):e[t(613)]}function w(s){let t=r,n="",a=[],x=0,l=0,g=!0,p=e[t(420)];if(e[t(583)](s[t(808)]("::"),-1)){let d=s[t(839)]("::");for(let v=0;v<d[t(612)];v++){if(e.sateq(t(603),e[t(1647)]))return _0x5ae3dd?.[t(1067)](P=>P.key===_0x51acda)?.[t(1611)];{let P=d[v];if(e.TjAwA(P[t(808)](":"),0)){let R=P[t(839)](":");g&&(x=R[t(612)]),l+=R[t(612)];for(let N=0;N<R[t(612)];N++)if(R[N][t(612)]!==4){let $=p[t(1851)+"g"](0,e[t(679)](4,R[N].length)),ge=$.concat(R[N]);a[t(1628)](ge)}else a.push(R[N]);g=!1}else{if(e[t(589)](4,P[t(612)])){let R=p[t(1851)+"g"](0,e[t(679)](4,P[t(612)])),N=R[t(851)](P);a[t(1628)](N)}else a.push(P);g&&(x+=1),l+=1,g=!1}}}let b="";for(let v=0;e.yksuW(v,e[t(1857)](8,l));v++)b=b[t(851)](p);for(let v=0;e[t(1485)](v,a.length);v++)e[t(1288)](v,x)&&(n=n[t(851)](b)),n=n[t(851)](a[v]);return n}{let d=s.split(":");for(let b=0;e[t(1801)](b,d[t(612)]);b++){let v=d[b];if(d[b][t(612)]!==4){let P=p[t(1851)+"g"](0,e[t(679)](4,d[b][t(612)])),R=P[t(851)](v);n=n[t(851)](R)}else n=n[t(851)](v)}return n}}function y(s,t){let n=r,a=s[n(1274)];a!==void 0&&(J(t,10),e.nnDnG(ye,t,a));let x=s.value;e.XFTJZ(void 0,x)&&(J(t,18),ye(t,x))}function _(s){let t=r,n={};e:for(;!e[t(614)](Ae,s);){let a=e[t(614)](B,s);switch(a>>>3){case 0:break e;case 1:n.key=e[t(1391)](_e,s,e[t(614)](B,s));break;case 2:n[t(1611)]=_e(s,e.RoOaX(B,s));break;default:e[t(1553)](re,s,e[t(559)](7,a))}}if(n[t(1274)]===void 0)throw new Error(e[t(582)]);if(e[t(1288)](void 0,n[t(1611)]))throw new Error(e[t(565)]);return n}function E(s){let t=r,n=oe();return e[t(704)](A,s,n),e[t(614)](W,n)}function A(s,t){let n=r,a={MINaG:function($e,Pe,$t){return e[D(517)]($e,Pe,$t)},CavzM:n(1568),drBdM:e[n(1252)]},x=s[n(1624)];e[n(589)](void 0,x)&&(e[n(704)](J,t,8),e[n(1017)](At,t,x));let l=s.LogID;if(e[n(1371)](void 0,l))if(e.hbovx(n(1662),e[n(1584)]))e.HsgEX(J,t,16),e.CieBz(At,t,l);else{this[n(1374)+"hCloseEv"+n(763)](a.MINaG(_0x2a95f8,a.CavzM,{code:1e3,reason:a[n(1864)]})),this["_endpoin"+n(1475)]?.[n(1341)+n(1471)+"fig"](),this[n(1447)+n(824)]?.["resetCou"+n(1160)]();return}let g=s[n(1820)];e.sateq(void 0,g)&&(e.KqcKk(J,t,24),e.CKcHU(At,t,Z(g)));let p=s.method;p!==void 0&&(e.DwoWR(J,t,32),e[n(1391)](At,t,e[n(1237)](Z,p)));let d=s[n(1712)];if(d!==void 0)for(let $e of d)if(e[n(1288)](e[n(1034)],e.rukcS))this.emit(e[n(1722)],e[n(1258)](_0xc0e7ed,n(430),{..._0x1a8624,message:_0x22580e.errMsg||""}));else{J(t,42);let Pe=e[n(988)](oe);e.kwqxz(y,$e,Pe),e[n(943)](J,t,Pe[n(885)]),e.HGojz(Yt,t,Pe),e[n(733)](I,Pe)}let b=s[n(1635)+n(1306)];e[n(1371)](void 0,b)&&(e[n(943)](J,t,50),ye(t,b));let v=s[n(1167)+"ype"];if(v!==void 0){if(e[n(1743)](e[n(501)],"gLqbl"))return(this[n(697)+"rs"][_0xc7956d]||(this[n(697)+"rs"][_0x136ebc]=[])).push({fn:_0x146948,ctx:_0x19ba25||this}),this;J(t,58),ye(t,v)}let P=s[n(1806)];e[n(1303)](void 0,P)&&(e[n(1784)](J,t,66),e.EblQH(J,t,P.length),e[n(1108)](Jt,t,P));let R=s[n(645)];e[n(601)](void 0,R)&&(e[n(1391)](J,t,74),e[n(704)](ye,t,R));let N=s[n(1370)+"ming"];e.yNBfG(void 0,N)&&(J(t,82),e[n(1359)](ye,t,N));let $=s[n(1358)];if(e[n(1303)](void 0,$))if(e.mmvDP!==e[n(1021)])e.MOuFa(J,t,90),e.CKcHU(ye,t,$);else return this.low===-1&&e[n(1288)](-1,this[n(1690)])?_0x5f05a0[n(512)](0,0,this[n(1150)]):this.low===-1?_0x1116d5[n(512)](0,e[n(1543)](this[n(1690)],1),this[n(1150)]):_0x482f1e[n(512)](this[n(515)]+1,this.high,this[n(1150)]);let ge=s.frameType;e[n(1048)](void 0,ge)&&(J(t,96),e[n(1569)](At,t,Z(ge)))}function k(s){return e[r(614)](T,e.iveDz(F,s))}function T(s){let t=r,n={};e:for(;!e.RpzLh(Ae,s);){let a=B(s);switch(a>>>3){case 0:break e;case 1:n[t(1624)]=ke(s,!0);break;case 2:n.LogID=e[t(742)](ke,s,!0);break;case 3:n[t(1820)]=e.FjwHF(B,s);break;case 4:n[t(745)]=B(s);break;case 5:{let x=e[t(1482)](q,s);(n[t(1712)]||(n.headers=[]))[t(1628)](_(s)),s[t(885)]=x;break}case 6:n[t(1635)+t(1306)]=e.KqcKk(_e,s,e[t(1875)](B,s));break;case 7:n["payloadT"+t(1474)]=_e(s,e[t(1237)](B,s));break;case 8:n[t(1806)]=e.RfECd(Ct,s,B(s));break;case 9:n[t(645)]=e[t(742)](_e,s,B(s));break;case 10:n[t(1370)+t(521)]=e[t(1035)](_e,s,B(s));break;case 11:n[t(1358)]=e[t(820)](_e,s,B(s));break;case 12:n.frameType=B(s);break;default:e.DwoWR(re,s,7&a)}}if(e.hbovx(void 0,n[t(1624)]))throw new Error(e[t(1188)]);if(e[t(1288)](void 0,n[t(805)]))throw new Error(e[t(830)]);if(e[t(1489)](void 0,n[t(1820)]))throw new Error(e[t(1097)]);if(e[t(701)](void 0,n[t(745)]))throw new Error(e[t(1760)]);return n}function q(s){let t=r,n=e[t(1237)](B,s),a=s.limit;return s[t(885)]=e.bxPHP(s[t(1501)],n),a}function re(s,t){let n=r;switch(t){case 0:for(;e.bazMc(128,se(s)););break;case 2:e[n(686)](ee,s,e[n(1174)](B,s));break;case 5:e.cPoNj(ee,s,4);break;case 1:e[n(641)](ee,s,8);break;default:throw new Error(e[n(1055)]+t)}}function Z(s){let t=r;return e.xlWRt(e[t(1828)],e[t(1828)])?"frontier_"+this._DBName:(s|=0,{low:s,high:s>>31,unsigned:e.BkxKY(s,0)})}let we=[];function oe(){let s=r,t=we[s(444)]();return t?(t.offset=t[s(885)]=0,t):{bytes:new Uint8Array(64),offset:0,limit:0}}function I(s){we[r(1628)](s)}function F(s){return{bytes:s,offset:0,limit:s[r(612)]}}function W(s){let t=r,n=s[t(711)],a=s[t(885)];return n.length===a?n:n.subarray(0,a)}function ee(s,t){let n=r;if(e[n(869)](e[n(1544)](s.offset,t),s.limit))throw new Error(n(680)+n(1779));s[n(1501)]+=t}function Ae(s){return e[r(1211)](s.offset,s.limit)}function le(s,t){let n=r,a=s[n(711)],x=s.offset,l=s.limit,g=e[n(739)](x,t);if(e[n(450)](g,a[n(612)])){let p=new Uint8Array(e[n(718)](2,g));p[n(1421)](a),s[n(711)]=p}return s[n(1501)]=g,g>l&&(s[n(885)]=g),x}function Ye(s,t){let n=r,a=s[n(1501)];if(e[n(583)](e[n(1543)](a,t),s[n(885)]))throw new Error(e.HMNPm);return s.offset+=t,a}function Ct(s,t){let n=r,a=e.CKcHU(Ye,s,t);return s[n(711)].subarray(a,e[n(561)](a,t))}function Jt(s,t){let n=r,a=e[n(1665)](le,s,t[n(612)]);s[n(711)][n(1421)](t,a)}function _e(s,t){let n=r,a=e[n(620)](Ye,s,t),x=String[n(1275)+n(710)],l=s[n(711)],g="\uFFFD",p="";for(let d=0;e.yFOOF(d,t);d++){let b=l[e[n(1616)](d,a)],v,P,R,N;if(e.sYhpq(128,b)===0)p+=e.RpzLh(x,b);else if(e[n(562)](e[n(559)](224,b),192))e[n(1211)](e.kserA(d,1),t)?p+=g:(v=l[e.FWgGP(e.LxLId(d,a),1)],e.Aslcj(192,v)!==128?p+=g:(N=e[n(1529)](31&b,6)|e[n(1749)](63,v),N<128?p+=g:(p+=x(N),d++)));else if(e[n(1455)](e[n(861)](240,b),224))d+2>=t?p+=g:(v=l[e[n(992)](e[n(969)](d,a),1)],P=l[d+a+2],e.WgaKr(e[n(1749)](v|e[n(1529)](P,8),49344),32896)?p+=g:(N=(15&b)<<12|(63&v)<<6|e[n(736)](63,P),e[n(1485)](N,2048)||e[n(1281)](N,55296)&&e[n(1226)](N,57343)?p+=g:(p+=e[n(1043)](x,N),d+=2)));else if(e.UGQxc(e[n(784)](248,b),240))if(e.BkxKY(e[n(1402)](d,3),t))p+=g;else if(v=l[e[n(1113)](e[n(1478)](d,a),1)],P=l[e[n(1633)](e[n(1616)](d,a),2)],R=l[e[n(561)](e.kserA(d,a),3)],e[n(622)](e[n(1749)](e[n(652)](e.aBDnI(v,e[n(1289)](P,8)),R<<16),12632256),8421504))p+=g;else{if(e[n(1361)]!==e[n(1361)])return _0x53bc69.objectStoreNames[1]?void 0:_0x4b0f67[n(708)+n(1366)](_0x52e10d[n(708)+n(960)][0]);N=e[n(1431)](e.Wxqnr(e[n(800)](7&b,18),e[n(1015)](e[n(559)](63,v),12)),e.bXEYj(e[n(559)](63,P),6))|63&R,e[n(1801)](N,65536)||N>1114111?p+=g:(N-=65536,p+=x(e.trsTn(e[n(730)](N,10),55296),e[n(992)](1023&N,56320)),d+=3)}else p+=g}return p}function ye(s,t){let n=r,a=t[n(612)],x=0;for(let p=0;e[n(533)](p,a);p++){let d=t[n(973)+"At"](p);e.MzQLz(d,55296)&&e[n(1658)](d,56319)&&e[n(1057)](e.qLTPw(p,1),a)&&(d=e[n(1857)](e[n(956)](d,10)+t.charCodeAt(++p),56613888)),x+=e[n(1859)](d,128)?1:e[n(1576)](d,2048)?2:d<65536?3:4}e.hnvFq(J,s,x);let l=e[n(1592)](le,s,x),g=s[n(711)];for(let p=0;p<a;p++){let d=t[n(973)+"At"](p);e.nJHqE(d,55296)&&e[n(1226)](d,56319)&&p+1<a&&(d=e.XtdZJ(e[n(590)](d<<10,t.charCodeAt(++p)),56613888)),e[n(771)](d,128)?g[l++]=d:(d<2048?g[l++]=e[n(1088)](e[n(559)](e[n(1238)](d,6),31),192):(e[n(794)](d,65536)?g[l++]=e[n(1238)](d,12)&15|224:e[n(1291)](e[n(563)],e.hJiXp)?this[n(1045)+"T"]||this[n(1e3)+"X"]?this[n(729)+"etWorkCh"+n(1100)]():this[n(426)+"er"]&&this["_initGlo"+n(1323)+n(719)]():(g[l++]=e.pzgFx(e.bazMc(e[n(659)](d,18),7),240),g[l++]=e[n(1088)](e[n(861)](e.ZlBFK(d,12),63),128)),g[l++]=e[n(815)](e[n(559)](d>>6,63),128)),g[l++]=e[n(1073)](63,d)|128)}}function Yt(s,t){let n=r,a=e[n(852)](le,s,t.limit),x=s[n(711)],l=t.bytes;for(let g=0,p=t.limit;e.VYDyt(g,p);g++)x[g+a]=l[g]}function se(s){let t=r;return s[t(711)][e[t(1569)](Ye,s,1)]}function Vt(s,t){let n=r,a=le(s,1);s[n(711)][a]=t}function B(s){let t=r;if(e[t(1489)](e[t(1589)],t(1337)))_0x53acd2.exports=_0x3fb0d8[t(1269)]()[t(555)](()=>(_0x1d972f(),_0x2a71c8))[t(555)](function(n){return n});else{let n=0,a=0,x;do x=e[t(449)](se,s),e[t(939)](n,32)&&(a|=e[t(1128)](127,x)<<n),n+=7;while(128&x);return a}}function J(s,t){let n=r;for(t>>>=0;t>=128;)e[n(1536)](Vt,s,e[n(1389)](e[n(1128)](127,t),128)),t>>>=7;e.RqaGm(Vt,s,t)}function ke(s,t){let n=r,a=0,x=0,l=0,g;if(g=e[n(1237)](se,s),a=e[n(854)](127,g),e.AyAYW(128,g)&&(g=se(s),a|=e[n(1417)](127,g)<<7,128&g&&(g=e.RpzLh(se,s),a|=e[n(800)](127&g,14),128&g&&(g=se(s),a|=e[n(1852)](127,g)<<21,e[n(1686)](128,g))))){if(e[n(1219)](e[n(1649)],n(1262)))_0x5b6d9a=e[n(449)](_0x19d002,_0x53e425),_0x2e6b49|=e[n(1843)](e[n(559)](127,_0x1303aa),7);else if(g=e[n(1043)](se,s),x=e[n(1070)](127,g),e[n(784)](128,g)&&(g=e[n(1573)](se,s),x|=e[n(1685)](127&g,7),e[n(1452)](128,g)&&(g=e[n(1733)](se,s),x|=e.yxLdJ(e.BTvor(127,g),14),e[n(1487)](128,g)&&(g=e[n(1482)](se,s),x|=e[n(1753)](127,g)<<21,e[n(760)](128,g)))))if(e[n(1291)](n(405),e.iwrTG))g=e[n(1875)](se,s),l=e[n(1261)](127,g),e[n(1128)](128,g)&&(g=e.nspPZ(se,s),l|=e.aZszm(e.qCRnq(127,g),7));else for(var p in _0x5b0078)_0x1302c1(_0x502377,p,{get:_0x23b0a0[p],enumerable:!0})}return{low:e[n(1088)](a,e[n(956)](x,28)),high:e.ucKPK(x,4)|e[n(1289)](l,24),unsigned:t}}function At(s,t){let n=r,a=e[n(1317)](t[n(515)],0),x=e[n(1317)](e.BGruf(e[n(758)](t[n(515)],28),t.high<<4),0),l=t[n(1690)]>>>24,g=e[n(1291)](0,l)?x===0?e[n(873)](a,16384)?e.pdggA(a,128)?1:2:e.fsIEv(a,2097152)?3:4:x<16384?e.JaTZO(x,128)?5:6:x<2097152?7:8:e[n(1138)](l,128)?9:10,p=e.fMVcN(le,s,g),d=s[n(711)];switch(g){case 10:d[e[n(460)](p,9)]=e[n(700)](e[n(1697)](l,7),1);case 9:d[p+8]=e[n(748)](9,g)?128|l:127&l;case 8:d[p+7]=g!==8?e[n(1656)](x,21)|128:e[n(760)](x>>>21,127);case 7:d[e.UFwhQ(p,6)]=e[n(1750)](7,g)?e[n(1331)](e[n(1386)](x,14),128):e.sYhpq(e[n(1059)](x,14),127);case 6:d[e[n(1692)](p,5)]=e[n(1750)](6,g)?e[n(1389)](e[n(1386)](x,7),128):e[n(861)](x>>>7,127);case 5:d[p+4]=e[n(662)](5,g)?e.ieRbM(128,x):e.dbLTh(127,x);case 4:d[e[n(561)](p,3)]=e[n(589)](4,g)?e[n(542)](e.KXFWg(a,21),128):e[n(760)](e[n(832)](a,21),127);case 3:d[e[n(1072)](p,2)]=e[n(622)](3,g)?e[n(1340)](e[n(408)](a,14),128):e[n(1540)](e[n(758)](a,14),127);case 2:d[e[n(651)](p,1)]=e[n(453)](2,g)?e.Wxqnr(e[n(1126)](a,7),128):e.STXac(a,7)&127;case 1:d[p]=e.sateq(1,g)?e[n(1084)](128,a):e.qCRnq(127,a)}}function ds(s){return e[r(1043)](k,s)}function cr(s){let t=r;if(e[t(1664)](e[t(1756)],e[t(769)]))_0x5e9f1d[_0x563c33++]=e.aBDnI(e.sityD(_0x1665fb,6),192),_0x3fdbd1[_0x361f91++]=e[t(1131)](e[t(667)](63,_0x2f16fc),128);else return e.unpNu(E,s)}let ls=65536,ma=e.HLUue,st=e.kSWoF(ls,ls),hs=st*st,gs=e[r(428)](hs,2),ze=String[r(1468)+"e"][r(973)+"At"];class z{constructor(t,n,a){let x=r;e[x(947)](x(822),e.LgBWx)?(this.isLong=!0,this[x(515)]=e[x(1131)](0,t),this.high=0|n,this[x(1150)]=!!a):this[x(1716)+"steners"]()}static[r(842)](t){let n=r;return t&&e[n(1507)](!0,t[n(842)])}static fromBits(t,n,a){return new z(t,n,a)}static[r(1524)+"s"](t,n,a){let x=r;return a?z.fromBytesLE(t,n):z[x(1524)+x(568)](t,n)}static["fromByte"+r(1663)](t,n){let a=r;return new z(e[a(542)](e[a(1581)](e.nSPkS(t[0],e.pZZQO(t[1],8)),t[2]<<16),t[3]<<24),e[a(1392)](e[a(1131)](e[a(1803)](t[4],t[5]<<8),e.TLlla(t[6],16)),t[7]<<24),n)}static["fromByte"+r(568)](t,n){let a=r;return e[a(748)](a(907),e[a(936)])?new _0x3eb01e(_0x2505f4):new z(e[a(1192)](e[a(1610)](e[a(1088)](t[4]<<24,e[a(1015)](t[5],16)),t[6]<<8),t[7]),e.pXWoz(e[a(1192)](e.YSZzM(t[0],24)|e[a(588)](t[1],16),e[a(1289)](t[2],8)),t[3]),n)}static[r(1771)](t){let n=r;return e[n(724)](e[n(1666)],e.sWdpv)?e[n(633)](t,ma)?ps:new z(e[n(1847)](e[n(728)](e[n(1389)](ze.call(t,0),e[n(788)](ze[n(996)](t,1),8))|e.JfNnj(ze.call(t,2),16),ze[n(996)](t,3)<<24),0),e[n(758)](e.SvkXO(e.UQmcV(e.zlasg(ze.call(t,4),e[n(1843)](ze[n(996)](t,5),8)),ze[n(996)](t,6)<<16),e.aZszm(ze[n(996)](t,7),24)),0),!0):this[n(803)]?.[n(1754)]}[r(1383)](){let t=r;if(e[t(579)]===e[t(1380)])e[t(1705)](_0x34e635,this,_0x49d08c,[_0x92f5a6,_0x36458c,_0x277554,_0x11b78b,_0x35ff85,_0xbd9e3d]);else return String[t(1275)+t(710)](e[t(861)](255,this[t(515)]),this.low>>>8&255,e[t(1852)](e[t(1839)](this[t(515)],16),255),e.BrXQD(this[t(515)],24),255&this[t(1690)],this[t(1690)]>>>8&255,e[t(1852)](e[t(408)](this[t(1690)],16),255),this.high>>>24)}static[r(1667)+"er"](t,n=!0){let a=r;if(e[a(1287)](isNaN,t))return n?wa:ps;if(n){if(e.nJHqE(t,hs))return ya}else{if(e.nALPN(t,-gs))return ba;if(e.LIuoJ(e[a(460)](t,1),gs))return _a}return z[a(512)](e.BGruf(t%st,0),e.FLxHi(e[a(1541)](t,st),0),n)}toNumber(){let t=r;return this.unsigned?e.UFwhQ(e[t(910)](e[t(1747)](this.high,0),st),e.Rcwdx(this[t(515)],0)):this[t(1690)]*st+e[t(1158)](this.low,0)}[r(1135)](){let t=r;return e[t(1774)](0,this.high)&&this[t(515)]===0}add(t){let n=r;z[n(842)](t)||(t=z[n(1667)+"er"](t));let a=e[n(1136)](this.high,16),x=e[n(1814)](65535,this[n(1690)]),l=e[n(1748)](this[n(515)],16),g=e.bazMc(65535,this.low),p=e[n(888)](t[n(1690)],16),d=65535&t[n(1690)],b=e.qPuFP(t[n(515)],16),v=e[n(700)](65535,t[n(515)]),P=0,R=0,N=0,$=0;return $+=e.trsTn(g,v),N+=e[n(1747)]($,16),$&=65535,N+=e[n(1072)](l,b),R+=e[n(888)](N,16),N&=65535,R+=e[n(1761)](x,d),P+=R>>>16,R&=65535,P+=e[n(491)](a,p),P&=65535,z.fromBits(e[n(1389)](N<<16,$),e[n(1595)](P,16)|R,this[n(1150)])}[r(1604)](t){let n=r;if(e[n(596)](n(1296),e[n(932)]))return z[n(842)](t)||(t=z[n(1667)+"er"](t)),this[n(1150)]!==t.unsigned&&e[n(1446)](e[n(494)](this[n(1690)],31),1)&&e[n(1601)](t[n(1690)]>>>31,1)?!1:this.high===t.high&&e[n(980)](this[n(515)],t[n(515)]);_0xc901c2[n(764)+"entListe"+n(779)](ONsNSj[n(963)],_0x1992fa),_0x33a8b9[n(764)+n(703)+n(779)](ONsNSj[n(1722)],_0x5c97b2),_0x5a0256[n(764)+n(703)+n(779)](n(638),_0x5546ae)}[r(1206)](){let t=r;return e[t(570)](-1,this[t(515)])&&e[t(701)](-1,this.high)?z.fromBits(0,0,this[t(1150)]):e[t(947)](-1,this.low)?z.fromBits(0,e.PcidF(this.high,1),this[t(1150)]):z[t(512)](e[t(618)](this[t(515)],1),this[t(1690)],this[t(1150)])}[r(1280)](t){let n=r;return t?this[n(1738)+"E"]():this[n(1249)+"E"]()}toBytesLE(){let t=r,n=this.high,a=this.low;return[e[t(1852)](255,a),e[t(1332)](e[t(472)](a,8),255),e.SVvjV(e[t(615)](a,16),255),e.tjRzb(a,24),e[t(667)](255,n),e[t(1261)](n>>>8,255),e[t(861)](e[t(476)](n,16),255),n>>>24]}[r(1249)+"E"](){let t=r,n=this.high,a=this[t(515)];return[e.KXFWg(n,24),e[t(593)](e[t(1645)](n,16),255),e[t(1329)](n,8)&255,e[t(1332)](255,n),e[t(1196)](a,24),e.DEgWa(a>>>16,255),a>>>8&255,255&a]}}let ps=new z(0,0,!1),wa=new z(0,0,!0),_a=z[r(512)](-1,2147483647,!1),ya=z[r(512)](-1,-1,!0),ba=z[r(512)](0,-2147483648,!1);var qe=(function(s){let t=r;return s[s[e[t(827)]]=5001]=t(669)+t(1741),s[s[e.cOKYt]=5002]=e[t(878)],s[s[e[t(467)]]=5003]=e[t(467)],s[s.MESSAGE_ERROR=5004]=e[t(1532)],s[s[e[t(1047)]]=5005]=e[t(1047)],s})({});class it{constructor(t){let n=r;this[n(1163)]=t,this[n(934)]=null}}class ms extends it{constructor(t,n){let a=r;super(t),this.message=n&&n[a(841)]||null}}class ws extends it{constructor(t,n){let a=r;super(t),this.error=n&&n[a(430)]||null,this[a(1854)]=n&&n[a(1854)]||0,this.filename=n&&n[a(468)]||"",this[a(903)]=n&&n[a(903)]||0,this[a(841)]=n&&n[a(841)]||"",this[a(1744)]=n&&n[a(1744)]||5001}}class _s extends it{constructor(t,n){let a=r,x=e[a(1773)][a(839)]("|"),l=0;for(;;){switch(x[l++]){case"0":this[a(1250)+a(1776)]=n&&n[a(1250)+a(1776)]||!1;continue;case"1":this.wasClean=n&&n[a(1555)]||!1;continue;case"2":this.reason=n&&n.reason||"";continue;case"3":super(t);continue;case"4":this[a(1744)]=n&&n[a(1744)]||0;continue}break}}}class ys extends it{constructor(t,n){let a=r,x={EIWMR:function(l,g){return e[D(1510)](l,g)},UFnDq:function(l,g){return l&g},AtUTv:function(l,g){return e[D(1460)](l,g)},wmFsy:function(l,g){return l&g},goCjF:function(l,g){return e[D(1158)](l,g)},DfbQv:function(l,g){return e[D(1410)](l,g)},tVqbs:function(l,g){return e[D(993)](l,g)},JaKen:function(l,g){return e[D(773)](l,g)},AHoeB:function(l,g){return e.tjRzb(l,g)},Qbfkw:function(l,g){return e[D(760)](l,g)}};if(e[a(1601)](e[a(1115)],a(780)))super(t),this[a(575)]=n&&n[a(575)]||null;else{let l=_0x2af1b7.low,g=_0x5c6c12[a(1690)];return _0x2be46c[_0x54dfd8]=x[a(1574)](g,24),_0x35bee0[_0xbb20df+1]=x.UFnDq(g>>>16,255),_0x2a9b73[x.AtUTv(_0x31c9d6,2)]=x.wmFsy(x[a(1693)](g,8),255),_0x3075b8[x.DfbQv(_0x5a6c1d,3)]=x.tVqbs(255,g),_0x286328[_0x2c720c+4]=x[a(994)](l,24),_0x48e413[_0x2dcdac+5]=x[a(1775)](l>>>16,255),_0x43de8c[x[a(1826)](_0x1da03f,6)]=x[a(1157)](x[a(1393)](l,8),255),_0x3f13ec[_0x565e17+7]=x[a(1207)](255,l),_0x230bc3+=8,_0x316c15}}}class bs extends ys{constructor(t,n){let a=r;super(t),this[a(575)]=n&&n[a(575)]||null,this[a(841)]=n&&n.message||null}}class vs extends it{constructor(t,n){let a=r;super(t),this[a(575)]=n&&n[a(575)]||null}}function fe(s,{message:t,code:n,error:a}){let x=r,l={zhDxA:function(g,p){return g===p},XLvFN:function(g,p){return e[D(1765)](g,p)},GBHDF:function(g,p){return e.bOKhn(g,p)},weEiU:function(g,p){return e[D(1843)](g,p)},VDydy:function(g,p){return g<<p},RyAmY:function(g,p){return e.SNgbL(g,p)},InmHF:function(g,p){return g|p},rxGKr:function(g,p){return g|p},CbpiU:function(g,p){return e[D(481)](g,p)}};return e[x(724)](e[x(656)],e[x(1786)])?new ws(s,{message:t,code:n,error:a}):eiwbjh.zhDxA(_0x4e732c,_0x3356c2)?_0x4fce94:new _0x5b3b42(eiwbjh[x(1787)](eiwbjh[x(1406)](eiwbjh[x(1406)](_0x3ef0dc[x(996)](_0x6ea70,0),eiwbjh[x(1071)](_0x21698f.call(_0x2888d1,1),8))|eiwbjh.VDydy(_0x1c62c5[x(996)](_0x2f7be3,2),16),eiwbjh[x(672)](_0x57f46e[x(996)](_0x4c1036,3),24)),0),eiwbjh.XLvFN(eiwbjh.InmHF(eiwbjh[x(1709)](_0x1c0e0d.call(_0x1efc50,4),eiwbjh[x(935)](_0xeab0de[x(996)](_0x2b5474,5),8)),eiwbjh.VDydy(_0x533cfd[x(996)](_0x42d1c2,6),16))|eiwbjh[x(1228)](_0x45846c[x(996)](_0x310e8d,7),24),0),!0)}function he(s,{code:t,reason:n,wasClean:a,willReconnect:x}){return new _s(s,{code:t,reason:n,wasClean:a,willReconnect:x})}function Ss(s,{data:t,message:n}){let a=r;return e[a(422)](e.YSAPo,e[a(1145)])?(_0x460d44[_0xf030cf]=_0x87ece1,!0):new bs(s,{data:t,message:n})}function Es(s,{data:t}){return new vs(s,{data:t})}function xr(s,{message:t}){return new ms(s,{message:t})}class Cs{constructor(t,n){let a=r;this[a(1768)+"s"]=t,this[a(1682)+"es"]=n,this[a(688)+a(1011)]=0,this["currentE"+a(1381)+a(812)+"t"]=0}[r(1341)+r(1471)+r(1613)](){let t=r;this[t(688)+t(1011)]=0,this["currentE"+t(1381)+"riesCount"]=0}resetTries(){let t=r;this[t(404)+t(1381)+t(812)+"t"]=0}[r(406)+r(961)+"nt"](){let t=r;return this[t(1768)+"s"][this[t(688)+t(1011)]]}[r(406)+"ntEndpointTriesC"+r(1596)](){let t=r;return this["currentE"+t(1381)+t(812)+"t"]}[r(867)+r(1427)+"es"](){let t=r;return!!(this[t(688)+t(1011)]>=this[t(1768)+"s"][t(612)]||e[t(475)](this.currentIndex,e[t(1857)](this.endpoints[t(612)],1))&&e[t(1288)](this[t(404)+t(1381)+"riesCount"],this[t(1682)+"es"]))}[r(918)+"rentEndp"+r(1342)+r(1436)+r(473)](){let t=r;return e[t(924)](this[t(688)+t(1011)],this[t(1768)+"s"][t(612)])?!0:e.RDWDi(this[t(404)+"ndpointT"+t(812)+"t"],this.maxRetries)}["replaceB"+r(1123)+r(976)+r(520)+r(691)](){let t=r;return this["currentE"+t(1381)+t(812)+"t"]=1,this["currentI"+t(1011)]++,this[t(1768)+"s"][this["currentI"+t(1011)]]}["getCurrentEndpoi"+r(1841)+r(1134)](){let t=r;return this[t(404)+t(1381)+t(812)+"t"]++,this[t(406)+t(961)+"nt"]()}}let ot=(e[r(677)](e[r(1554)],typeof globalThis)&&e[r(1533)]("Window",globalThis[r(1265)+r(1486)][r(1114)])||e.Aqoci(e.rpJZg,typeof window)&&e[r(1282)]===window[r(1265)+"tor"][r(1114)])&&e.Aqoci(e[r(1554)],typeof document),Ve=e[r(1554)]!=typeof globalThis&&(e[r(1399)](e[r(1726)],globalThis[r(1265)+r(1486)][r(1114)])||e.FrKIj===globalThis[r(1265)+r(1486)][r(1114)])&&e.SNerq(r(1330)+"d",typeof tt),kt=(typeof globalThis<"u"&&e[r(972)](e[r(1726)],globalThis[r(1265)+r(1486)][r(1114)])||e[r(642)](e[r(1554)],typeof globalThis)||e[r(1623)](r(1330)+"d",typeof globalThis)&&!!globalThis["WeixinJS"+r(953)])&&e[r(1146)](e[r(1554)],typeof wx),Pt=e[r(1554)]!=typeof globalThis&&(e[r(786)]===globalThis[r(1265)+r(1486)].name||"SharedWo"+r(541)+r(858)===globalThis[r(1265)+r(1486)][r(1114)]||e[r(1065)](e[r(564)],globalThis[r(1265)+r(1486)][r(1114)]))&&e.clePG(e[r(1554)],typeof self),va=e[r(1652)](r(1330)+"d",typeof globalThis)&&e[r(972)](e[r(1726)],globalThis[r(1265)+"tor"].name)&&e[r(1554)]!=typeof global&&e[r(1726)]===global[r(1265)+"tor"][r(1114)]&&e[r(975)](e[r(1554)],typeof process)&&!!process[r(1367)];class fr{constructor(){let t=r;this[t(697)+"rs"]={}}[r(1780)](t,...n){let a=r,x=this._listeners[t];if(x)x[a(1621)]()[a(1102)](l=>l.fn[a(1179)](l[a(1711)],n));else if(e.lHxfe(e[a(1722)],t)&&!this[a(1235)]){let l=n.length&&n[0];if(l instanceof Error)throw l;let g=new Error(e[a(1762)]+(l?e[a(785)](" (",l.message)+")":""));throw g[a(1405)]=l,l}return this}[r(810)](t,n){let a=r;if(e[a(965)](e[a(1816)],e[a(1816)])){if(e[a(1416)](void 0,t))this[a(697)+"rs"]={};else if(n===void 0)this[a(697)+"rs"][t]=null;else{let x=this[a(697)+"rs"][t];if(x)for(let l=0;e[a(1155)](l,x[a(612)]);)e[a(775)](x[l].fn,n)?x.splice(l,1):++l}return this}else{let x=0,l=_0x835b64,g=e[a(1451)](_0x1ab262,4);for(;e.fsIEv(l,g);){let{value:p,offset:d}=_0x3d9282(_0x3279fe,l);l=d,x=x<<8>>>0,x+=p}return{value:x,offset:g}}}on(t,n,a){let x=r;return(this[x(697)+"rs"][t]||(this[x(697)+"rs"][t]=[]))[x(1628)]({fn:n,ctx:a||this}),this}}class Sa extends fr{[r(1173)+r(1285)+r(1023)](t){let n=r;return t[n(1245)]||t.errNo?("message: "+(t.errMsg||"")+" code: "+(t.errNo||"")).trim():JSON[n(1185)+"y"](t)}constructor(t,n,a){let x=r;super(),this[x(1039)]=null,kt&&wx[x(1309)+x(712)]&&(this[x(1039)]=wx[x(1309)+x(712)]({url:t,protocols:n,header:a,fail:this[x(1333)+x(1307)+x(1409)][x(1805)](this),success:this["_createSocketSuc"+x(1279)+x(663)].bind(this)})),Ve&&tt.connectSocket&&(this[x(1039)]=tt[x(1309)+x(712)]({url:t,protocols:n,header:a,fail:this["_createS"+x(1307)+x(1409)][x(1805)](this),success:this[x(1333)+x(1413)+x(1279)+x(663)][x(1805)](this)}))}["_createS"+r(1413)+r(1279)+r(663)](){Promise.resolve().then(()=>{let t=D;this[t(1716)+t(1651)]()})}[r(1333)+"ocketFai"+r(1409)](t){let n=r;Promise.resolve()[n(555)](()=>{let a=n;if(e[a(596)](a(658),"rvaFW"))return new _0x3aac54(_0x467fc8,{code:_0x2453e0,reason:_0x38eb51,wasClean:_0x1b5484,willReconnect:_0x4c1b43});{let x=e[a(1553)](fe,a(430),{message:this["_formatE"+a(1285)+a(1023)](t)});this.emit(e[a(1722)],x);let l=he(e[a(1650)],{reason:this[a(1173)+a(1285)+a(1023)](t)});this[a(1780)](e[a(1650)],l)}})}[r(1716)+r(1651)](){let t=r,n={zPAZX:function(a,x){return e[D(1215)](a,x)},hbQXR:function(a,x,l){return e[D(1199)](a,x,l)},SvpiT:e.ILApt,Nsywb:function(a,x){return e[D(1371)](a,x)},GDUrH:e[t(1290)],XpaJv:e.KxPBJ,LIGIY:e[t(1650)],SdUfj:function(a,x,l){return e.VALkE(a,x,l)},HlIQR:e[t(1714)]};if(e[t(933)]===e.lpPGM){let a=new _0x5a02f4(HgnLTC[t(1339)](2,_0x45cbb6));a[t(1421)](_0x1eb199),_0x26af1b[t(711)]=a}else this._socket[t(1316)](a=>{let x=t;this[x(1780)](x(516),n.hbQXR(Es,n.SvpiT,{...a,data:a[x(1245)]||""}))}),this[t(1039)][t(508)](a=>{let x=t;n[x(828)](n[x(762)],n[x(649)])?this.emit(n[x(674)],n[x(1582)](he,n[x(674)],{...a})):(this[x(882)+x(1201)+x(675)]=_0x23e099,_0x154f49?this[x(1202)+"nLine"]():this._handleOffLine())}),this[t(1039)].onMessage(a=>{let x=t;this.emit(n[x(1694)],Ss(n[x(1694)],{...a}))}),this._socket[t(1481)](a=>{let x=t;this[x(1780)](x(430),e.XRJSS(fe,e[x(1722)],{...a,message:a[x(1245)]||""}))})}[r(1408)](t){let n=r,a={WqbOx:e.rYWhM};if(e[n(846)](t,Uint8Array)){let x=t[n(727)][n(1621)](t.byteOffset,t.byteLength+t[n(1500)+"et"]);this._socket&&this[n(1039)][n(1408)]({data:x,fail:l=>{let g=n;this[g(1780)](e[g(1722)],e[g(855)](fe,e[g(1722)],{message:this[g(1173)+g(1285)+"age"](l)}))}})}else this._socket&&this[n(1039)][n(1408)]({data:t,fail:x=>{let l=n;this.emit(a[l(545)],fe(a[l(545)],{message:this[l(1173)+l(1285)+l(1023)](x)}))}})}[r(1568)](t,n){let a=r;this[a(1039)]&&this[a(1039)][a(1568)]({code:t,reason:n})}[r(856)+r(719)](t,n){let a=r,x={QjRGT:function(l,g){return l+g}};if(e[a(1133)](a(927),a(927)))this.on(t,n);else{let l=this["_message"+a(1834)][a(1640)]((g,p)=>(g+=p&&p.byteLength||0,g),0);return x[a(1804)](l,this._ws?this[a(447)][a(552)+"Amount"]:0)}}[r(764)+r(703)+r(779)](t,n){this[r(810)](t,n)}get readyState(){let t=r;return this[t(1039)][t(1562)+"te"]}get[r(1162)+"pe"](){return this._socket.binaryType}set[r(1162)+"pe"](t){}get[r(1217)](){let t=r;return this._socket[t(1217)]}get protocol(){let t=r;return this[t(1039)][t(1056)]}get extensions(){let t=r;return this._socket[t(1556)+"ns"]}get[r(552)+"Amount"](){return 0}}function Ea(s,t){let n=r;if(t)return new t(s[n(1217)],s[n(1056)]);if(e.VoxFc(kt,Ve))return new Sa(s.url,s.protocol,s.headers);if(e.VoxFc(ot,Pt)&&e[n(749)](e[n(1554)],typeof WebSocket)&&WebSocket)return new WebSocket(s.url,s[n(1056)+"s"])}function Ca(s){let t=r;if(e[t(1048)](e.xGrqm,t(1180)))return _0x2a4b4d["objectSt"+t(960)]||_0x262c4f.get(_0x145171);{let n=e[t(1862)][t(839)]("|"),a=0;for(;;){switch(n[a++]){case"0":if(Ve&&tt[t(1309)+"ocket"])return!0;continue;case"1":if(s)return!0;continue;case"2":if(e[t(1643)](ot,Pt)&&e[t(1566)](e[t(1554)],typeof WebSocket)&&WebSocket)return!0;continue;case"3":if(kt&&wx[t(1309)+"ocket"])return!0;continue;case"4":return!1}break}}}function As(s,t,n){let a=r;if(e.XFTJZ(a(789),e[a(913)])){let x=-1;async function l(g){let p=a;return e.peDIm(g,x)?Promise.reject(new Error(e[p(1758)])):(x=g,g===n[p(612)]?Promise.resolve():n[g].bind(s)(t,l[p(1805)](null,g+1)))}e.cjnmY(l,0)}else{let x=this._qosDB[a(1184)](this._prefix),l=_0x5221d2.parse(x||"{}");return l[_0x4b70e4]=void 0,this[a(803)][a(1363)](this[a(817)],_0x25a1ef.stringify(l))}}function ks(s){let t=r,n=0,a=0;for(let x=0;e.FKedo(x,s[t(612)]);++x)a=s[t(973)+"At"](x),e[t(600)](a,128)?n+=1:e[t(533)](a,2048)?n+=2:e[t(1863)](e[t(431)](64512,a),55296)&&e.bRwDR(e[t(993)](64512,s[t(973)+"At"](e.SbnJx(x,1))),56320)?(++x,n+=4):n+=3;return n}function Ps(s,t,n){let a=r;if(e[a(1057)](e[a(1857)](n,t),1))return"";let x="";for(let l=t;l<n;){let g=s[l++];if(g<=127)x+=String[a(1275)+a(710)](g);else if(e[a(1525)](g,192)&&e[a(1808)](g,224))x+=String[a(1275)+a(710)](e[a(1178)](e.AyAYW(31,g)<<6,e[a(1494)](63,s[l++])));else if(e[a(634)](g,224)&&e[a(533)](g,240))x+=String[a(1275)+"Code"](e[a(609)](e[a(1419)](e[a(966)](15,g),12),e[a(1015)](63&s[l++],6))|63&s[l++]);else if(e[a(1525)](g,240))if(e[a(452)](e[a(1606)],e.yOVPf)){let p=e.qCfaC(e[a(815)](e[a(706)](e[a(1170)](7,g),18)|(63&s[l++])<<12,e[a(588)](e[a(993)](63,s[l++]),6))|e[a(1452)](63,s[l++]),65536);x+=String["fromChar"+a(710)](55296+(p>>10)),x+=String[a(1275)+a(710)](e[a(1240)](56320,e[a(1785)](1023,p)))}else{let p=this[a(803)]["getStora"+a(585)](this._prefix);return _0x3845e8.parse(p||"{}")[_0x426ad5]}}return x}function ur(s,t,n){let a=r,x=n,l,g;for(let p=0;e[a(747)](p,s[a(612)]);++p)if(l=s[a(973)+"At"](p),e[a(1057)](l,128))t[n++]=l;else if(e.QBWRF(l,2048))t[n++]=e[a(659)](l,6)|192,t[n++]=e[a(416)](e.hLfbr(63,l),128);else if(e.hfLOC(e[a(809)](64512,l),55296)&&e.ekLBj(64512,g=s[a(973)+"At"](e.QEJyU(p,1)))===56320){let d=e[a(1531)][a(839)]("|"),b=0;for(;;){switch(d[b++]){case"0":t[n++]=e[a(728)](l>>18,240);continue;case"1":l=e[a(511)](65536+e[a(588)](e[a(1439)](1023,l),10),e[a(793)](1023,g));continue;case"2":t[n++]=e.bXubV(e[a(1232)](63,l),128);continue;case"3":t[n++]=e[a(1434)](e.uHdmO(e[a(1766)](l,6),63),128);continue;case"4":t[n++]=e[a(591)](e[a(1417)](l>>12,63),128);continue;case"5":++p;continue}break}}else if(e[a(1031)](e[a(1877)],e[a(573)]))t[n++]=e.neuNL(l>>12,224),t[n++]=e[a(981)](e[a(1766)](l,6),63)|128,t[n++]=e[a(1753)](63,l)|128;else return!0;return n-x}async function Is(s){let t=r;if(e[t(1609)]==typeof s)if(e[t(422)](e.XUUjh,e.ZZgYD)){let n=new Uint8Array(ks(s));return e[t(777)](ur,s,n,0),n}else this[t(404)+t(1381)+t(812)+"t"]=0;return e[t(797)](s,ArrayBuffer)?new Uint8Array(s):new Uint8Array(s.buffer,s[t(1500)+"et"],s[t(938)+"th"])}function Aa(s){let t=r;try{return e.xafoy(e[t(1609)],typeof s)&&(e[t(797)](s,ArrayBuffer)||s[t(727)]&&e.QPGoL(s[t(727)],ArrayBuffer))||e[t(749)](e[t(1609)],typeof s)?"":(JSON.parse(s),e.Hwmta)}catch{return e.nsimS(e[t(1609)],typeof s)?e[t(717)]:""}}let ka=(s,t)=>{let n=r;if(e[n(1874)](e[n(1537)],e[n(1165)]))return new _0x564235(_0x5b73c9,{message:_0x306844});switch(s){case e.uDNDA:case e[n(1414)]:return{[n(1845)+s]:1,"x-tt-env":t};default:return{}}};class Pa{constructor(t){let n=r;e[n(1743)](n(1563),e[n(1091)])?(_0x118381=e.nSPkS(e[n(1125)](e[n(997)](e[n(920)](15,_0x1a1e17),12),e[n(800)](63&_0xaa5860,6)),63&_0x3521cf),e[n(1561)](_0x155865,2048)||_0x3b9924>=55296&&_0x3a0923<=57343?_0x5af888+=_0x44854a:(_0x405c40+=_0x9e90f6(_0x4759f6),_0x3ff7e1+=2)):(this["maxLossC"+n(1596)]=t,this[n(1615)]=0)}[r(1304)](){let t=r;this[t(1615)]++}[r(867)+r(880)+"nt"](){let t=r;return e[t(610)](this[t(1615)],this[t(768)+t(1596)])}[r(1678)+"nter"](t=0){let n=r;this["maxLossC"+n(1596)]=t,this[n(1615)]=0}}async function Ia(s){let t=r,n={gwjkk:function(a,x){return e.iveDz(a,x)},KoEmI:"script",OoOsa:e.LGdGu,QTLhM:function(a,x){return e[D(1588)](a,x)},oRtUW:t(1681)+t(804)+"tierJSONP",jqmHk:function(a,x){return e[t(1763)](a,x)},ayuWU:e[t(1140)],iqYsq:e[t(605)],LCDHd:e[t(1527)]};if(e[t(1048)](t(1865),t(504)))return new Promise(a=>{let x=t,l={QMUWa:function(g,p){return n.gwjkk(g,p)},HXAgg:x(862)+x(1028)};if(!ot)return n[x(647)](a,x(862)+x(1028));try{let g=document[x(1032)+x(584)](n.KoEmI);window["frontier"+x(1092)]=p=>{let d=x;document.body[d(877)+d(1198)](g),window[d(514)+d(1092)]=void 0,l[d(848)](a,p&&p[d(1718)]||l[d(926)])},g[x(1163)]=n[x(1757)],g[x(401)]=n[x(1653)](s.replace(/^ws/,x(1846)),n[x(1029)]);try{document[x(1225)][x(483)+"ild"](g)}catch{document[x(1225)][x(877)+x(1198)](g)}}catch{if(n[x(1590)](n[x(1076)],n[x(1153)]))return{bytes:_0x11dad8,offset:0,limit:_0x7beaf0[x(612)]};window[x(514)+x(1092)]=void 0,n[x(647)](a,n[x(554)])}});this[t(1768)+"s"]=_0x594a4c,this[t(1682)+"es"]=_0x44e7b4,this[t(688)+t(1011)]=0,this[t(404)+t(1381)+t(812)+"t"]=0}function Fe(s,t,n){let a=r;return!!s?.find(x=>x[a(1274)]===t&&x[a(1611)]===n)}function at(s,t){return s?.find(n=>n.key===t)?.value}let dr=null;async function Da(){let s=r;return dr||(dr=Promise.resolve()[s(555)](Se.bind(Se,s(1284)))),dr}class Ta extends fr{constructor(t,n){let a=r;super(),this[a(1646)]=t,this._keyPath=n,this._qosDB=void 0,this[a(623)+a(916)]=null}async[r(1830)](){await this[r(1005)]()}async _init(){let t=r,n={VLKAU:function(a){return e[D(988)](a)},gmSZn:function(a,x,l,g){return e.wMono(a,x,l,g)}};if(!this[t(803)]){if(this[t(623)+t(916)])return this[t(623)+t(916)];try{let a=this[t(1646)],x=this[t(1614)];this["_initPro"+t(916)]=(async()=>{let l=t,{openDB:g}=await n[l(819)](Da);this[l(803)]=await n[l(1872)](g,"frontier_"+a,1,{upgrade(p){let d=l;p[d(734)+d(1089)+"e"](a,{keyPath:x})}})})(),await this[t(623)+t(916)]}catch(a){console[t(757)](a)}finally{this[t(623)+t(916)]=null}}}async[r(1018)](t){let n=r;try{return await this[n(1005)](),this._qosDB?.get(this[n(1646)],t)}catch(a){console[n(757)](a)}}async set(t,n){let a=r;return await this[a(1005)](),this[a(803)]?.[a(1821)](this[a(1646)],t)}async[r(683)](t){let n=r;if(e[n(1495)](e[n(681)],e[n(490)]))try{return await this._init(),this[n(803)]?.[n(549)](this[n(1646)],t)}catch(a){e[n(1364)](e.oXMOK,"ZmyoO")?(_0x2a1553[n(1421)](_0x16203a,_0x28d64c),_0x2a322a[n(1421)](_0x240ccc,_0x44d66a)):console[n(757)](a)}else{let a=this[n(1182)+n(1475)]?.["getCurre"+n(961)+"nt"]();this[n(1374)+n(1183)+n(763)](e[n(1418)](_0x3e2446,e[n(1650)],{code:_0x36e396.code,reason:n(611)+"ng faile"+n(626)+"wn reaso"+n(1483)+n(1819)+a})),this["_endpoin"+n(1475)]?.[n(1341)+n(1471)+"fig"](),this._pingLossCounter?.[n(1678)+n(1160)]();return}}async clear(){let t=r;try{return await this[t(1005)](),this._qosDB?.[t(1513)](this[t(1646)])}catch(n){console[t(757)](n)}}async keys(){let t=r;return await this._init(),this._qosDB?.[t(1764)+"ys"](this[t(1646)])}async[r(1064)](){let t=r;return await this[t(1005)](),this[t(803)]?.[t(1064)](this[t(1646)])}async[r(1637)](){let t=r;try{this[t(803)]?.[t(1568)](),this[t(803)]=void 0}catch(n){console.log(n)}}get[r(1754)](){let t=r;try{return!!this[t(803)]}catch(n){return console[t(757)](n),!1}}}class La{constructor(t,n){let a=r;this[a(1849)]=t,this[a(1752)]=n,this[a(803)]=localStorage}async[r(1830)](){}get[r(817)](){return r(514)+"_"+this._DBName}async[r(1018)](t){let n=r,a=this[n(803)][n(1184)](this[n(817)]);return JSON[n(523)](e[n(750)](a,"{}"))[t]}async set(t,n){let a=r;if(e[a(947)](e[a(1630)],e[a(865)])){let x=_0x1ee59e[a(841)][a(1806)];x&&_0x54b5c5[a(883)+"rs"](x)}else{let x=this[a(803)][a(1184)](this[a(817)]),l=JSON[a(523)](e[a(689)](x,"{}"));return l[n||t[this[a(1752)]]]=t,this[a(803)][a(1363)](this[a(817)],JSON[a(1185)+"y"](l)),n||t[this._pathKey]}}async[r(683)](t){let n=r,a=this[n(803)][n(1184)](this._prefix),x=JSON[n(523)](a||"{}");return x[t]=void 0,this[n(803)][n(1363)](this[n(817)],JSON[n(1185)+"y"](x))}async[r(1513)](){let t=r;return this[t(803)][t(1513)]()}async[r(1335)](){let t=r;if(e[t(570)](e[t(1403)],"RUpuk")){let n=this[t(803)].getItem(this[t(817)]),a=JSON[t(523)](n||"{}");return Object[t(1335)](a)}else return new _0x3b9766(_0x596910,{data:_0x35149b,message:_0x11143d})}async[r(1064)](){let t=r,n=this[t(803)][t(1184)](this[t(817)]),a=JSON[t(523)](e.ThcQp(n,"{}"));return Object[t(1704)](a)}[r(1637)](){return Promise[r(1269)]()}get[r(1754)](){return!!this[r(803)]}}class Ra{constructor(t,n){let a=r;this[a(1849)]=t,this[a(1752)]=n,this._qosDB=Ve?tt:kt?wx:null}async[r(1830)](){}get[r(817)](){return"frontier_"+this._DBName}async[r(1018)](t){let n=r,a=this[n(803)][n(1466)+n(585)](this[n(817)]);return JSON[n(523)](e[n(1552)](a,"{}"))[t]}async set(t,n){let a=r,x=this[a(803)]["getStora"+a(585)](this[a(817)]),l=JSON[a(523)](e[a(750)](x,"{}"));return l[n||t[this._pathKey]]=t,this[a(803)][a(587)+"geSync"](this[a(817)],JSON.stringify(l)),n||t[this._pathKey]}async[r(683)](t){let n=r,a=this[n(803)].getStorageSync(this[n(817)]),x=JSON[n(523)](e.KXDPR(a,"{}"));return x[t]=void 0,this[n(803)].setStorageSync(this[n(817)],JSON.stringify(x))}async[r(1513)](){let t=r;return this[t(803)][t(1003)+t(825)]()}async keys(){let t=r,n=this[t(803)]["getStora"+t(1025)+"nc"](this[t(817)]),a=JSON.parse(e[t(1129)](n,"{}"));return Object[t(1335)](a)}async[r(1064)](){let t=r,n=this[t(803)][t(1466)+t(1025)+"nc"](this._prefix),a=JSON[t(523)](e.tsgYQ(n,"{}"));return Object[t(1704)](a)}[r(1637)](){return Promise[r(1269)]()}get[r(1754)](){let t=r,n={vGeXB:function(a,x){return e[D(614)](a,x)},ivYOe:function(a,x){return e[D(716)](a,x)},tcaRP:function(a,x){return e[D(1658)](a,x)},tAbIs:function(a,x){return e[D(561)](a,x)},ELeVu:function(a,x){return e.TgTZH(a,x)},APAZp:function(a,x){return e[D(1050)](a,x)},BzpoZ:function(a,x){return e.yiARZ(a,x)}};if(t(1109)===t(776)){if(JAkTPh[t(1713)](_0x1caf8e,_0x42b82d))return _0x5cd046?_0x44cde4:_0x11c533;if(_0x56f342){if(JAkTPh[t(737)](_0x5375cc,_0x4e35ab))return _0x11fd4f}else{if(JAkTPh.tcaRP(_0x32893e,-_0x5374f1))return _0x1cf307;if(JAkTPh[t(737)](JAkTPh[t(1473)](_0x1278d2,1),_0x44bb68))return _0x1ef1e7}return _0x4f9811.fromBits(JAkTPh[t(1687)](_0x39184d,_0x34542c)|0,JAkTPh.APAZp(JAkTPh[t(546)](_0x1e92ef,_0x4a0625),0),_0x445042)}else return!!this[t(803)]}}function Ds(s,t){let n=r;if(e[n(689)](Ve,Ve))return new Ra(s,t);if(e[n(857)](ot,Pt)&&e[n(1143)](n(1330)+"d",typeof indexedDB))return new Ta(s,t);if(e[n(983)](ot,Pt)&&e.xafoy(e[n(1554)],typeof localStorage))return new La(s,t);throw new Error(e[n(978)])}class Na{constructor(){let t=r;this[t(1355)+t(921)+"Id"]=null,this[t(1355)+"l"]=36e5,this._qosDB=Ds("qos",t(1122)+"id")}async[r(1355)+r(1176)](){let t=r;clearInterval(this[t(1355)+"lTimeoutId"]),this["_interva"+t(921)+"Id"]=e[t(890)](setInterval,()=>{this["flushExp"+t(863)]()},this[t(1355)+"l"])}async[r(1830)](){let t=r;await this[t(803)][t(1830)]()[t(555)](()=>{this["_interva"+t(1176)]()})}async[r(451)+r(863)](){let t=r;(await this[t(803)]?.[t(1064)]()||[]).filter(({timestamp:x})=>x<Date[t(639)]())[t(1102)](x=>{let l=t;this[l(803)]?.[l(683)](x[l(1122)+"id"])})}async[r(683)](t){let n=r;return this[n(803)]?.[n(683)](t)}async[r(1421)](t,n){let a=r;return e[a(606)]===a(1407)?{frameType:_0x14168f,headers:[{key:a(1746)+"ile_name",value:e[a(458)]}],payload:void 0}:this._qosDB?.set({message_id:t,timestamp:n})}async[r(1018)](t){let n=r,a={UiKLv:function(x,l){return e[D(1855)](x,l)},zQxrF:function(x,l){return e[D(1272)](x,l)},XwrcL:function(x,l){return e[D(544)](x,l)},YdNHt:function(x,l){return e.mKWhu(x,l)},BAOkW:function(x,l){return x<<l},eQRAH:function(x,l){return e[D(1502)](x,l)},ojxHE:function(x,l){return e.hIWEy(x,l)},wefnf:function(x,l){return e.LMZYh(x,l)},PpRpj:function(x,l){return e[D(1698)](x,l)},yBluB:function(x,l){return e[D(1271)](x,l)}};if(e[n(1242)](n(967),e.boHwL))_0x9f7978=_0x456bee[uCxxai.UiKLv(uCxxai.UiKLv(_0x52f43d,_0x264c32),1)],_0x12292d=_0x1c0518[uCxxai[n(1193)](uCxxai[n(1193)](_0x9b6175,_0x3db6ed),2)],uCxxai[n(1354)]((_0x30b0ba|uCxxai[n(836)](_0x544639,8))&49344,32896)?_0x439785+=_0x54fd5d:(_0x48525a=uCxxai[n(543)](uCxxai[n(543)](uCxxai[n(836)](15&_0x1a8b83,12),uCxxai[n(1328)](uCxxai.eQRAH(63,_0x463ff3),6)),uCxxai.ojxHE(63,_0x47215f)),_0x3e1015<2048||uCxxai[n(524)](_0x4dd469,55296)&&uCxxai[n(949)](_0x96fc70,57343)?_0x52f013+=_0x22fc8e:(_0x548166+=uCxxai[n(974)](_0x52a246,_0x2b9bd4),_0x5782e3+=2));else return this._qosDB?.[n(1018)](t)}async[r(1637)](){let t=r;e[t(1287)](clearInterval,this["_interva"+t(921)+"Id"]),await this[t(803)]?.closeDB()}get isReady(){let t=r;return this[t(803)]?.[t(1754)]}}function lr(s){let t=r,n=!!this[t(715)][t(838)+"S"];if(!n)return{enabled:n,isQoSMessage:!1,isQoSAck:!1,isAckCleanupMessage:!1,ackMsgIds:[]};let a=e[t(777)](Fe,s[t(841)][t(1712)],e[t(553)],"2"),x=a&&Fe(s[t(841)][t(1712)],t(1577)+t(1599)+"ck","1"),l=a&&e.NuGWe(Fe,s[t(841)][t(1712)],e[t(1353)],"1"),g=l?e[t(507)](at,s[t(841)].headers,e[t(1051)])?.[t(839)](",").filter(Boolean)||[]:[];return{enabled:n,isQoSMessage:a,isQoSAck:x,isAckCleanupMessage:l,ackMsgIds:g}}async function Ts(){let s=r;return this["_QoSMana"+s(1717)]||(this["_QoSMana"+s(1717)]=new Na),this["_QoSMana"+s(1717)][s(1754)]||await this._QoSManager[s(1830)](),this[s(894)+"ger"]}async function Oa(s,t){let n=r,{enableAutoAck:a}=this[n(715)],x=e[n(1705)](Fe,s[n(841)][n(1712)],"need_ack","1"),l=e[n(1186)](Fe,s.message.headers,e[n(621)],"1"),g=lr[n(996)](this,s);if(a&&x)if(e[n(1446)](e[n(726)],e[n(872)]))_0x34bc70.d=(p,d)=>{let b=n;for(var v in d)_0x3a3ccd.o(d,v)&&!_0x5da3b7.o(p,v)&&_0x5ca475[b(1081)+b(1534)](p,v,{enumerable:!0,get:d[v]})};else{let{SeqID:p,LogID:d,service:b,LogIDNew:v,method:P}=s[n(841)];this[n(845)]({SeqID:p,LogID:d,LogIDNew:v,service:b,method:P,headers:[{key:e[n(621)],value:"1"},{key:e[n(853)],value:e[n(1731)](v,"")},{key:e[n(1177)],value:"0"}]})}l&&!g[n(1551)]&&this[n(1374)+n(787)+n(1338)](s),e.qTelE(t)}async function Ma(s,t){let n=r;this._debug(e[n(1684)],s[n(841)]),e[n(990)](t)}async function Ba(s,t){let n=r,a=e[n(1174)](ds,await e.FzhYA(Is,s[n(575)]));try{if(e[n(797)](a[n(1806)],Uint8Array))if(e[n(1871)](e[n(821)],n(1729))){let x=this[n(803)].getStorageSync(this[n(817)]),l=_0x2b1888[n(523)](x||"{}");return l[_0x5a26b1||_0x32ed98[this._pathKey]]=_0x3cf231,this[n(803)][n(587)+n(585)](this._prefix,_0x11c3a5[n(1185)+"y"](l)),_0x2d6c1a||_0x5e6e12[this[n(1752)]]}else{let x=e.dLfKV(this[n(715)][n(1635)+n(1306)],Object)?{force:!!this[n(715)][n(1635)+n(1306)][n(1509)],encoding:this[n(715)]["payloadE"+n(1306)][n(962)]?this[n(715)]["payloadE"+n(1306)][n(962)][n(1579)](/\s/g,"")[n(433)+"ase"]():""}:{force:!1,encoding:this[n(715)][n(1635)+n(1306)]?this._options[n(1635)+n(1306)][n(1579)](/\s/g,"")[n(433)+"ase"]():""},l=a[n(1635)+"ncoding"]?a["payloadE"+n(1306)][n(1579)](/\s/g,"")[n(433)+"ase"]():"",g=this[n(715)]["payloadT"+n(1474)]instanceof Object?{force:!!this[n(715)][n(1167)+n(1474)][n(1509)],type:this._options[n(1167)+n(1474)][n(1163)]?this[n(715)][n(1167)+n(1474)].type.replace(/\s/g,"")["toLowerC"+n(1441)]():""}:{force:!1,type:this._options.payloadType?this[n(715)][n(1167)+n(1474)][n(1579)](/\s/g,"")[n(433)+n(1441)]():""},p=a["payloadT"+n(1474)]?a[n(1167)+n(1474)].replace(/\s/g,"")[n(433)+"ase"]():"",d=g[n(1509)]?g[n(1163)]:p||g[n(1163)],b=x.force?x[n(962)]:l||x.encoding,v=[e[n(717)],e[n(1817)],e[n(671)],e[n(1609)]],P=[n(951)+"e","binary"];this[n(715)][n(513)+n(488)+n(1187)+"ad"]&&v[n(1791)](d)&&(!b||P[n(1791)](b))?a[n(1094)+n(1379)]=e[n(864)](Ps,a[n(1806)],0,a.payload[n(938)+"th"]):a[n(1094)+n(1379)]=""}else a.textPayload=""}catch(x){a["textPayl"+n(1379)]="",console[n(757)](x)}s[n(841)]=a,e.Juukg(t)}function za(s,t,n){let a={sZkjP:function(d,b){return e.gWvPr(d,b)},Agzsn:function(d,b){return e[D(1528)](d,b)},CAHja:function(d,b){return e[D(1394)](d,b)},RXkho:function(d,b){return e.Wxqnr(d,b)}},x=e.RNUtg(n,8192),l=e.SMWRl(x,1),g=null,p=x;return function(d){let b=D;if(a[b(1432)](d,1)||d>l)return a[b(1511)](s,d);p+d>x&&(g=a[b(1511)](s,x),p=0);let v=t[b(996)](g,p,p+=d);return 7&p&&(p=a[b(1463)](a[b(1580)](7,p),1)),v}}let qa=4294967295;function Fa(s,t,n){let a=r;return RangeError(e.xBtiA(e.Wbwls(e[a(464)](e[a(415)](e.bYFff(e.HzMsX,s),e.reJMX),e[a(847)](t,1)),e[a(657)]),n))}function Ua(s,t,n){let a=r,x={kYARe:function(g,p,d){return g(p,d)},FNrZX:function(g,p){return e[D(733)](g,p)}};if(e[a(456)](n,qa))throw new Error(e[a(1519)]);let l=3;for(;e[a(1319)](l,0);)if(e[a(1303)](e[a(1009)],e.qQfud)){let g=e[a(569)](255,n);e[a(816)](gr,g,s,e[a(739)](t,l)),n>>>=8,l--}else _0x2ca99c(_0x428d8d,24),uICQnm[a(493)](_0x59565d,_0x120d52,uICQnm.FNrZX(_0xfc68fd,_0x3a7a27));return e[a(1410)](t,4)}function Ha(s,t){let n=r,a=0,x=t,l=e[n(886)](t,4);for(;e.RqPlM(x,l);){let{value:g,offset:p}=e[n(1258)](hr,s,x);x=p,a=e[n(1595)](a,8)>>>0,a+=g}return{value:a,offset:l}}function Ka(s,t,n){let a=r;if(e[a(889)](a(1078),e[a(895)])){let x=e[a(429)][a(839)]("|"),l=0;for(;;){switch(x[l++]){case"0":if(t[a(714)+"e"])return e.Sagiu(t[a(714)+"e"](s,n),n);continue;case"1":return e[a(1410)](e.RIQwW(ur,s,t,n),n);case"2":if(!s)return n;continue;case"3":if(s[a(612)]<40)return e[a(806)](e.YYOga(ur,s,t,n),n);continue;case"4":if(t.write)return t.write(s,n)+n;continue}break}}else e[a(1675)](_0x17bf7e,_0x34e84b,18),_0x156abb(_0x1e9b37,_0x2727f3)}function ja(s,t){let n=r,a=new z(e[n(1286)](s[e[n(1457)](t,4)]<<24,e[n(1101)](s[e[n(1809)](t,5)],16))|s[t+6]<<8|s[t+7],e[n(1392)](e[n(1230)](e[n(1800)](s[t+0]<<24,e.NhoIR(s[e[n(1260)](t,1)],16)),s[e.rkaaE(t,2)]<<8),s[e[n(1394)](t,3)]),!0);return t+=8,{value:a,offset:t+8}}function Ga(s,t,n){let a=r,x=s[a(515)],l=s[a(1690)];return t[n]=l>>>24,t[e[a(1402)](n,1)]=e[a(1070)](l>>>16,255),t[e[a(977)](n,2)]=e[a(1142)](l>>>8,255),t[e[a(1189)](n,3)]=e[a(914)](255,l),t[e[a(1544)](n,4)]=e[a(722)](x,24),t[n+5]=e[a(920)](x>>>16,255),t[n+6]=e[a(1420)](e[a(1040)](x,8),255),t[e[a(415)](n,7)]=e[a(784)](255,x),n+=8,n}function hr(s,t){let n=r;return s[n(1464)+"8"]?{value:s.readUInt8(t),offset:t+1}:{value:e.zIaPa(255,s[t]),offset:e[n(1260)](t,1)}}function gr(s,t,n){let a=r;return t[a(979)+"t8"]?t[a(979)+"t8"](s,n):t[n]=255&s,e[a(1377)](n,1)}let Wa=function(s){return new Uint8Array(s)},Ja=e[r(1412)](e[r(1554)],typeof Buffer)?Buffer[r(925)+r(1699)]:e.XCIGz(za,Wa,Uint8Array[r(1468)+"e"].subarray);(()=>{let s=r,t={zRZRA:e[s(1221)],SOStA:function(n,a){return n<a},bGsQR:function(n,a){return e.zLBNd(n,a)},fnkUU:function(n,a){return e[s(494)](n,a)},XWtLk:function(n,a){return e[s(1472)](n,a)},ZXMtf:function(n,a){return e.oPFjk(n,a)},lMKSy:function(n,a){return e[s(1842)](n,a)},gePeY:function(n,a){return e[s(1747)](n,a)},pfWoJ:function(n,a){return n<<a},pxHOH:function(n,a){return e[s(920)](n,a)},LKFmr:function(n,a){return e.MrsTG(n,a)},xrRYM:function(n,a){return n<a},ByQEZ:function(n,a,x,l){return e[s(1449)](n,a,x,l)},XLgOh:function(n,a){return n<a},KQKPJ:function(n,a){return e[s(1434)](n,a)},bfgdY:function(n,a){return e.Ghpdc(n,a)}};if(e[s(1169)](e[s(1794)],e[s(1848)]))_0x420bfa[s(1628)](_0x25514b);else{let n=4294967295;return function(a,x,l=!0){let g=s,p=t[g(837)].split("|"),d=0;for(;;){switch(p[d++]){case"0":if(t[g(698)](a[x++],128))return{value:l?n:t[g(1429)](0,n),offset:x};continue;case"1":if(t[g(698)](a[x++],128))return{value:l?n:t[g(1429)](0,n),offset:x};continue;case"2":n=t[g(1020)](t[g(1181)](127,a[x]),0);continue;case"3":n=t.ZXMtf(n|t[g(1873)](127&a[x],14),0);continue;case"4":n=t.gePeY(n|t[g(770)](t.pxHOH(15,a[x]),28),0);continue;case"5":if(t.LKFmr(a[x++],128))return{value:l?n:t[g(1429)](0,n),offset:x};continue;case"6":n=t[g(1020)](n|t[g(1873)](t[g(1343)](127,a[x]),21),0);continue;case"7":if(t[g(893)](a[x++],128))return{value:l?n:0|n,offset:x};continue;case"8":if((x+=5)>a[g(612)])throw x=a[g(612)],t[g(440)](Fa,x,10,a[g(612)]);continue;case"9":return{value:l?n:0|n,offset:x};case"10":if(t[g(1378)](a[x++],128))return{value:l?n:t[g(1068)](0,n),offset:x};continue;case"11":n=t[g(774)](t.bfgdY(n,t[g(1181)](127,a[x])<<7),0);continue}break}}}})();let Ya=16,pr=32;function Va(s){let t=r,n=0,a={};for(let x=0;x<s[t(612)];x++)e.pyLza===e[t(1227)]?(a[s[x][t(1793)+"ame"]]=e[t(1137)](ks,s[x]["cursor_n"+t(1141)]),n+=14+a[s[x][t(1793)+t(1141)]]):this.emit(e[t(1722)],e[t(742)](_0x2a73b0,e[t(1722)],{message:this[t(1173)+t(1285)+t(1023)](_0x264608)}));return[n,a]}function Ls(s,t,n){let a=r,x={VmqtE:"0|5|7|9|10|8|2|3|4|6|1",fMfjM:e.MisYZ,nKsbR:function(b,v,P,R){return e[D(510)](b,v,P,R)},zUFmU:e.jBclC,xJkPo:function(b,v,P,R){return b(v,P,R)},ioFzh:e.NKNXR},[l,g]=Va(s),p=e.unpNu(Ja,l),d=0;return s.forEach(b=>{let v=D,P=x.VmqtE.split("|"),R=0;for(;;){switch(P[R++]){case"0":console.log(v(685)+"ervice",b,b.service);continue;case"1":console.log(v(1083),d);continue;case"2":console.log(x[v(1254)],d);continue;case"3":d=x[v(581)](Ka,b["cursor_n"+v(1141)],p,d);continue;case"4":console[v(757)](x[v(1395)],d);continue;case"5":d=x[v(581)](gr,0,p,d);continue;case"6":d=x[v(526)](Ga,z.fromNumber(b.cursor||t),p,d);continue;case"7":console[v(757)](x[v(1799)],d);continue;case"8":d=x.nKsbR(gr,g[b["cursor_n"+v(1141)]],p,d);continue;case"9":d=Ua(p,d,b[v(1820)]||0);continue;case"10":console[v(757)](v(1820),d);continue}break}}),{frameType:pr,headers:[{key:e[a(1719)],value:n}],payload:p}}function $a(s){let t=r;if(e.GNkAX("OXgtd",e[t(829)]))return _0x522322||(_0x4a0844=[_0x26cebb,_0x171e9c,_0x46a3af,_0x5d9a60,_0x5ce686]);{let n=0,a=[];for(;e.yPImm(n,s.byteLength);){let{offset:x}=e[t(466)](hr,s,n);n=x;let l={cursor_name:"",cursor:0,service:0},{value:g,offset:p}=e[t(595)](Ha,s,n);l.service=g,n=p;let{value:d,offset:b}=e[t(631)](hr,s,n);n=b,l[t(1793)+"ame"]=Ps(s,n,e.LOUcL(n,d)),n+=d;let{value:v,offset:P}=e[t(1391)](ja,s,n);l.cursor=v[t(743)](),n=P,a[t(1628)](l)}return a}}function Xa(){let s=r;return{frameType:pr,headers:[{key:e.xfIfV,value:e[s(458)]}],payload:void 0}}class Qa{constructor(t,n,a){let x=r;this._cursorNameSpace=t,this[x(1812)+x(1655)]=n,this[x(1546)+x(986)]=a,this[x(803)]=e[x(876)](Ds,this[x(752)+x(425)],e.LAaQe)}async[r(1830)](){let t=r;await this[t(803)][t(1830)]()}async[r(811)+"rs"](){let t=r,n={OyhXN:function(a,x,l){return e[D(1456)](a,x,l)},OWNCP:function(a,x){return e.adKEq(a,x)},peXeP:function(a,x){return e.esMZu(a,x)}};if(e[t(724)](e.sJPOq,e[t(1503)])){if(!this[t(803)][t(1754)])return;let a=this[t(1546)+"Strategy"],x=await this[t(803)][t(1064)]();switch(console.log(e[t(1654)],x),a){case e[t(1372)]:return x&&x.length?e.FgUDA(Ls,x,0,this[t(1812)+t(1655)]):void 0;case t(1838):return;case t(1781):return x&&x[t(612)]?e[t(668)](Ls,x,0,this["_cursorF"+t(1655)]):Xa()}}else{let a=QkkuLN[t(1063)](_0x130de2,_0x14434,_0x391fa1[t(885)]),x=_0x2605fe[t(711)],l=_0x3647fc[t(711)];for(let g=0,p=_0x43c13d[t(885)];QkkuLN[t(801)](g,p);g++)x[QkkuLN[t(946)](g,a)]=l[g]}}async[r(1421)](t,n,a){let x=r;return console.log(e.OnYjp,t,n,a),this[x(803)].set({cursor_name:t,cursor:n,service:a})}async[r(883)+"rs"](t){let n=r,a={AYwwQ:function(x,l,g){return x(l,g)},oonkZ:e[n(1570)],nyXjn:e[n(795)],XFfjy:function(x,l){return e[n(1528)](x,l)},NhkdH:e[n(1080)]};if(e[n(835)](e[n(1477)],e[n(1477)])){let x={CWnvR:"success",yBGrI:a.nyXjn,MefuQ:function(l,g){return a[n(538)](l,g)},lxkrt:a[n(1007)],SfYdP:a[n(1390)]};return new _0x48455((l,g)=>{let p=n;this[p(1700)+p(676)](),this._pingPongTimeoutId=a[p(1629)](_0x15a39a,this._ping[p(1805)](this),this[p(715)][p(754)+p(1423)]);let d=()=>{let v=p;l(x.CWnvR),this[v(810)](v(1597)+"e_success",d),this.off(x[v(751)],b)},b=()=>{let v=p;x[v(906)](g,x[v(1027)]),this.off(x[v(1459)],d),this.off(x[v(751)],b)};this.on(a[p(1390)],d),this.on(p(1597)+p(644)+"t",b),this[p(1175)]()})}else{let x=$a(t);for(let l of x)console[n(757)](e[n(1732)],x),await this[n(803)][n(1421)](l)}}async get(t){let n=r;return(await this[n(803)][n(1018)](t))?.cursor}async[r(1637)](){let t=r;e[t(1564)]!==e[t(1689)]?await this._qosDB[t(1637)]():_0x208c0c[t(571)+"d"]&&(this["_navigat"+t(1742)]()&&(!this[t(447)]||e[t(1520)](this[t(447)].readyState,this[t(813)])||e[t(1270)](this._ws[t(1562)+"te"],this[t(1539)+"NG"]))&&this[t(1202)+t(1668)](),this[t(426)+"er"]&&_0x2eafdf[t(856)+t(719)](e[t(418)],this[t(1202)+t(1668)]),this[t(426)+"er"]&&_0x4eb93b[t(856)+t(719)](e[t(1467)],this[t(1202)+t(1096)]))}[r(1120)+r(1835)+r(1019)](t){let n=r,a={GYZcE:e[n(1527)]};e[n(1219)](e.tFjAa,e.tFjAa)?this["_cursorF"+n(1655)]=t:(_0x549646[n(514)+n(1092)]=void 0,_0x211174(UznsOg[n(1480)]))}get[r(1754)](){let t=r,n={Jkdjm:function(a,x){return e[D(690)](a,x)},cCDUv:function(a,x){return e[D(677)](a,x)},zFDOK:t(1330)+"d"};if(e[t(1520)](e.HzLUI,e[t(765)])){if(_0x263d80)return new _0x418fe3(_0x3f2b6d[t(1217)],_0x2432b6.protocol);if(NqKCMv.Jkdjm(_0x18e4ac,_0x17b1a4))return new _0x54d198(_0x5aeebb[t(1217)],_0x5b0281.protocol,_0x554b28[t(1712)]);if(NqKCMv[t(1247)](_0x52b39e,_0x2087e0)&&NqKCMv.cCDUv(NqKCMv[t(1521)],typeof _0x31267c)&&_0x252dc4)return new _0x32f873(_0x451f0c.url,_0x4b3677[t(1056)+"s"])}else return this[t(803)][t(1754)]}}let Za=e[r(497)];async function Rs(s){let t=r;if(e[t(942)](e[t(1168)],e[t(1802)])){if(!this[t(715)][t(838)+"S"])return null;let{aID:n,fpID:a,messageStrategy:x}=this[t(715)],l=e[t(1578)](s,Za);try{return this[t(1054)+"anager"]?s&&this[t(1054)+"anager"][t(1120)+t(1835)+"Name"](s):this[t(1054)+t(409)]=new Qa(a+"_"+n+"_"+l,l,x),this[t(1054)+"anager"][t(1754)]||await this[t(1054)+t(409)][t(1830)](),this._cursorManager}catch{return null}}else{let n=_0x4aae55.substring(0,e.Qwwqd(4,_0x4d0ea4[_0x2350a5][t(612)])),a=n.concat(_0x388787[_0x47f149]);_0x327717.push(a)}}async function e0(s,t){let n=r,a=e[n(510)](Fe,s.message[n(1712)],e[n(1818)],"-1"),x=e[n(1705)](Fe,s[n(841)][n(1712)],e[n(621)],"1"),l=at(s[n(841)][n(1712)],e[n(919)]),g=Number(e[n(1671)](at,s[n(841)][n(1712)],n(1577)+"er_ttl"))||0,p=lr[n(996)](this,s),d=e.llKvD(Fe,s.message[n(1712)],e[n(500)],"2"),b=e[n(466)](at,s[n(841)][n(1712)],e[n(705)]),v=Number(at(s[n(841)][n(1712)],e[n(448)]));if(p.isQoSAck)return e[n(489)](t);let P=p[n(1724)+"sage"]?await Ts[n(996)](this):null;if(s.message.service>0&&x&&!a||e[n(583)](s[n(841)][n(1820)],0)){if(l&&p[n(1724)+n(1344)]&&P)return!!!await P[n(1018)](l)&&(this[n(1374)+"hMessage"+n(604)](s),await P[n(1421)](l,e.FWgGP(Date[n(639)](),g))),e.qTelE(t);if(d){let R=await Rs.call(this);if(!R)return this[n(1374)+n(1351)+n(604)](s),e[n(489)](t);let N=await R[n(1018)](b)??-1;if(e[n(1138)](N,v))this[n(1374)+"hMessage"+n(604)](s),R[n(1421)](b,v,s[n(841)][n(1820)]);else throw new Error(n(1437)+" message"+n(1161)+v+(n(1233)+n(834)+n(987)+"r ")+N);return e[n(990)](t)}return this[n(1374)+n(1351)+n(604)](s),t()}}async function t0(s,t){let n=r,a=lr[n(996)](this,s);if(!a[n(1724)+n(1344)])return e[n(1222)](t);let x=await Ts[n(996)](this);if(a[n(400)+n(985)+n(1023)]&&a[n(1461)+"s"].length)for(let l of a[n(1461)+"s"])await x[n(683)](l);t()}async function n0(s,t){let n=r;if(e[n(1190)]!==n(599)){let a=e.vQUfS(s.message[n(1770)+"e"],Ya),x=e.kzYFf(s[n(841)][n(1770)+"e"],pr);if(!a&&!x)return t();let l=e[n(1066)](at,s[n(841)].headers,e[n(1719)]);if(!l)return e.sqBIZ(t);let g=await Rs.call(this,l);if(!g)return t();if(a){let p=await g[n(811)+"rs"](),d={frameType:p?.[n(1770)+"e"],SeqID:z.fromNumber(this._seqId++),LogID:z[n(1667)+"er"](this[n(715)][n(1062)+"erator"]()),service:9e3,method:5,headers:p?.headers,payload:p?.payload},b=e[n(1733)](E,d);this._ws&&this._ws[n(1562)+"te"]&&this[n(447)][n(1408)](b)}if(x){let p=s[n(841)][n(1806)];p&&g[n(883)+"rs"](p)}}else{let a=this[n(1182)+n(1475)]?.[n(406)+n(961)+"nt"](),x=this._options["reconnec"+n(1387)+n(661)](_0x5b1d22[n(1744)],_0x1004c4[n(1028)]);this[n(1374)+"hCloseEv"+n(763)](_0x506de2(e[n(1650)],{code:1006,reason:_0x15f863[n(1028)]||"connecti"+n(1098)+n(626)+"wn reaso"+n(1483)+n(1819)+a,willReconnect:x})),x&&this[n(1336)]();return}}let r0=async function(s,t){let n=r;this[n(1850)]=!1,e[n(1060)](clearTimeout,this["_connect"+n(1538)+n(694)]),e[n(489)](t)},s0=async function(s,t){let n=r,a={BwOhc:function(x,l){return e[D(1195)](x,l)},kkWWV:function(x,l){return e[D(548)](x,l)},MNHXx:function(x,l){return x>>>l}};if(e[n(896)](n(1484),e.bnUZu))this[n(1045)+"T"]?_0x3d3473[n(1739)+n(732)+"hange"](({isConnected:x})=>{let l=n;this[l(882)+l(1201)+l(675)]=x,x?this[l(1202)+"nLine"]():this[l(1202)+l(1096)]()}):this._isMiniWX&&_0xff284a["onNetworkStatusC"+n(1810)](({isConnected:x})=>{let l=n;this[l(882)+"igatorOn"+l(675)]=x,x?this[l(1202)+l(1668)]():this["_handleO"+l(1096)]()});else{if(!this._ws||e[n(422)](this._ws[n(1562)+"te"],this[n(813)]))return e[n(988)](t);let{pingInterval:x}=this[n(715)];this[n(1182)+n(1475)]?.[n(1341)+n(1471)+n(1613)]();for(let g=0;e[n(1807)](g,this[n(1546)+n(1834)][n(612)]);g++){let p=this[n(1546)+"Queue"][g];if(e[n(1320)](this[n(447)][n(1562)+"te"],this[n(813)])&&e[n(748)](null,p))if(e.jPgKT(e.QNYEL,n(1090)))this[n(447)]&&this[n(447)].send(p),this[n(1546)+n(1834)][g]=null;else return this[n(1150)]?lmhdcG.BwOhc((this[n(1690)]>>>0)*_0x45d78f,this[n(515)]>>>0):lmhdcG.kkWWV(this[n(1690)]*_0x4f7cbf,lmhdcG[n(654)](this[n(515)],0));else break}this[n(1546)+n(1834)]=this[n(1546)+n(1834)].filter(g=>!!g),this[n(699)+n(592)+"Id"]=e[n(802)](setTimeout,()=>this[n(1175)](),x),this[n(1374)+"hOpenEvent"](s),this[n(426)+"er"]&&this[n(447)]&&(this._ws[n(1162)+"pe"]=this[n(505)+n(1474)]);let l=this["_endpoin"+n(1475)]?.[n(406)+n(961)+"nt"]();this[n(608)](n(1672)+l+n(598)),e[n(489)](t)}},i0=async function(s,t){let n=r,a=this[n(1182)+n(1475)]?.[n(406)+"ntEndpoint"]();this._debug(n(1672)+a),e[n(1789)](t)};class o0 extends fr{constructor(t){let n=r,a={eQKFs:function(p,d){return p!==d},RbqzI:e.pqMGU,KQzaw:function(p,d){return e[D(556)](p,d)},zjIwz:e[n(540)],LpQCs:function(p,d,b,v){return e.zJXCK(p,d,b,v)},ZhoXI:function(p,d,b){return e[n(1199)](p,d,b)},VcmKF:e[n(1722)],MiNKn:function(p,d){return e[n(1476)](p,d)},pdMsa:function(p,d){return e[n(760)](p,d)},xJfBL:e[n(1012)],SuZMc:e[n(1053)],szbQT:function(p,d){return e[n(1822)](p,d)},WsfeC:e[n(1518)],piOpf:function(p,d){return e[n(635)](p,d)},wMxCo:n(1597)+n(1049)+"s",iAajc:e[n(833)],PYPLL:function(p,d){return e[n(972)](p,d)},lsHqa:e.EGZJI,fDWVU:function(p,d){return e[n(1236)](p,d)},IQhIo:function(p,d){return p&d},UMtjx:function(p,d){return e.lswtm(p,d)},Poxpd:function(p,d){return e[n(1685)](p,d)},CVeOE:function(p,d){return e.FKedo(p,d)},qYdrw:function(p,d){return p(d)},TGEGa:e[n(1650)],nmfFx:"bye",JfiKt:function(p,d,b){return e[n(1256)](p,d,b)},jheOa:function(p,d){return e.mbnNd(p,d)},kdQzj:e.safDA};super(),this[n(882)+n(1201)+n(675)]=!0,this._isBrowser=ot,this[n(1103)]=va,this._isMiniTT=Ve,this[n(1e3)+"X"]=kt,this._isWorker=Pt,this[n(1546)+n(1834)]=[],this["_endpoin"+n(1475)]=null,this[n(1149)+n(1612)]=!1,this[n(505)+n(1474)]=e[n(931)],this[n(1336)+n(759)]=!1,this[n(1336)+n(1538)+n(694)]=null,this[n(1448)+n(1720)+n(1373)]=null,this["_pingPon"+n(592)+"Id"]=null,this[n(1558)]=0,this[n(1850)]=!1,this[n(1171)]="",this[n(894)+n(1717)]=null,this[n(1054)+"anager"]=null,this[n(1447)+n(824)]=null,this._protocols=n(900),this[n(1868)]=3,this[n(1539)+"NG"]=0,this.OPEN=1,this[n(1241)]=2,this[n(1792)]=p=>{let d=n;if(a.eQKFs(a.RbqzI,a[d(1622)]))_0x5367a6[d(764)+"entListener"](d(1147),_0x1992c3),_0x55bc63[d(764)+d(703)+d(779)](d(430),_0x1f320f);else try{a[d(1435)](a[d(557)],a.zjIwz)?a[d(1860)](As,this,p,[r0,s0,i0]):(this["_message"+d(1834)][d(1628)](_0x3830d8),this._debug("enqueue",_0x526034))}catch(b){let v=a[d(1314)](fe,a.VcmKF,{message:b[d(841)],code:qe.OPEN_ERROR,error:b});this["_dispatc"+d(536)+d(763)](v)}},this[n(577)+"ge"]=async p=>{let d=n;if(a[d(1751)]===d(687)){let{pingInterval:b,pingFrequency:v}=this[d(715)];if((p.data==="hi"&&a[d(1205)](a[d(959)],v)||a[d(410)](d(1549),v))&&(this["_clearPi"+d(676)](),this[d(1780)](a.wMxCo,a[d(1575)]),this[d(699)+d(592)+"Id"]=setTimeout(this[d(1175)][d(1805)](this),b)),a[d(1435)]("hi",p.data))return;try{a[d(702)](a[d(859)],a[d(859)])?As(this,p,[Ba,Oa,t0,n0,e0,Ma]):(kPLDcq[d(1314)](_0x55e71b,_0x48555b,kPLDcq.MiNKn(kPLDcq[d(417)](127,_0x2366e1),128)),_0x184670>>>=7)}catch(P){let R=fe(d(430),{message:P.message,code:qe[d(1266)+d(818)],error:P});this[d(1374)+d(536)+d(763)](R)}}else this[d(447)]&&this[d(447)][d(1408)](_0x510c92),this[d(608)](a[d(1356)],_0x28d3f1)},this._onError=p=>{let d=n;if(e[d(942)](e.gPRNb,e[d(1268)])){let b=this["_endpoin"+d(1475)]?.checkReachMaxTries(),v=this[d(1182)+d(1475)]?.[d(406)+d(961)+"nt"]();if(b&&!p[d(841)]){let P="connect "+v+(d(1334)+d(1433)+d(629)+"ed");this[d(1374)+d(536)+"ent"](e[d(1107)](fe,e.rYWhM,{message:P,code:qe["MAX_RETR"+d(1634)+"R"],error:p}));return}this._ws&&this[d(447)][d(1562)+"te"]===this[d(813)]&&this["_disconn"+d(1308)](),this[d(1374)+d(536)+d(763)](e.DQIkF(fe,e.rYWhM,{message:p.message,code:qe[d(669)+d(1741)],error:p}))}else this.count++},this[n(897)]=async p=>{let d=n;this["_clearTi"+d(566)](),this[d(1700)+"ngTimer"](),this[d(1204)+d(527)+"rs"](),this[d(447)]=null,this[d(1336)+"Lock"]=!1;let b=this["_endpoin"+d(1475)]?.[d(867)+"chMaxTries"]();if(!b&&this[d(446)+d(1742)]()&&!this[d(1149)+"osed"]){let v=this["_endpoin"+d(1475)]?.[d(406)+d(961)+"nt"](),P=this[d(715)]["reconnec"+d(1387)+d(661)](p.code,p[d(1028)]);this[d(1374)+d(1183)+d(763)](he(a[d(968)],{code:1006,reason:p[d(1028)]||"connecti"+d(1098)+"d, unknown reaso"+d(1483)+d(1819)+v,willReconnect:P})),P&&this[d(1336)]();return}if(a.eQKFs(1e3,p[d(1744)])&&this[d(1149)+d(1612)]){this["_dispatchCloseEv"+d(763)](a[d(1314)](he,d(1568),{code:1e3,reason:a[d(923)]})),this[d(1182)+d(1475)]?.[d(1341)+"pointCon"+d(1613)](),this[d(1447)+d(824)]?.[d(1678)+d(1160)]();return}if(p.code!==1e3&&b){let v=this[d(1182)+d(1475)]?.[d(406)+d(961)+"nt"](),P=p[d(1028)];P||(P=await a[d(1721)](Ia,this[d(1171)])),P=d(611)+d(1098)+d(551)+P+(", hostna"+d(534))+v+(d(1086)+d(1669)+d(1783)),this[d(1374)+d(1183)+d(763)](a[d(970)](he,a[d(968)],{code:p[d(1744)],reason:P}));let R=d(1110)+v+(d(1334)+d(1433)+d(629)+"ed");this[d(1374)+"hErrorEvent"](a[d(970)](fe,a[d(1305)],{message:R,code:qe[d(1273)+d(1634)+"R"]})),this._endpointManager?.[d(1341)+"pointConfig"](),this[d(1447)+d(824)]?.[d(1678)+d(1160)]();return}if(a[d(908)](1e3,p[d(1744)])&&!p.reason)if(a[d(1435)](a[d(695)],d(1469))){let v=this[d(1182)+"tManager"]?.["getCurre"+d(961)+"nt"]();this["_dispatc"+d(1183)+"ent"](a[d(970)](he,a[d(968)],{code:p[d(1744)],reason:d(611)+d(1098)+"d, unkno"+d(755)+d(1483)+d(1819)+v})),this[d(1182)+d(1475)]?.[d(1341)+d(1471)+"fig"](),this[d(1447)+"sCounter"]?.[d(1678)+d(1160)]();return}else _0x4ab95c=_0x4c44b7[kPLDcq[d(1627)](_0x2b56f5+_0x3cb020,1)],kPLDcq.eQKFs(kPLDcq[d(875)](192,_0x771592),128)?_0x108349+=_0x1a517e:(_0x2892b2=kPLDcq[d(435)](kPLDcq[d(1832)](kPLDcq.IQhIo(31,_0x35999f),6),kPLDcq.pdMsa(63,_0xf9aa9e)),kPLDcq[d(1660)](_0x4e0aff,128)?_0xea7ddb+=_0x1d803a:(_0x248289+=kPLDcq[d(1721)](_0x3fbb9b,_0xaba115),_0x5667cd++));this[d(1374)+d(1183)+d(763)](p),this["_endpoin"+d(1475)]?.resetEndpointConfig(),this[d(1447)+d(824)]?.[d(1678)+d(1160)]()},this.onclose=null,this[n(1235)]=null,this.onmessage=null,this[n(767)]=null,this[n(1795)+n(1259)]=null,this["onReceiv"+n(519)]=null,this[n(929)+"mediatelyReconnect"]=null,this["_handleO"+n(1668)]=this[n(1202)+n(1668)].bind(this),this[n(1202)+"ffLine"]=this["_handleO"+n(1096)][n(1805)](this),this["_handleP"+n(1424)]=this._handlePageHide.bind(this),this["_handleP"+n(1229)]=this[n(772)+"ageShow"][n(1805)](this),this[n(715)]={url:"",automaticOpen:!0,initReconnectInterval:1e3,maxReconnectInterval:1e4,reconnectIntervalGrowFactor:2,timeoutInterval:5e3,maxRetries:5,debug:!1,maxMessageQueueLength:e.xrgNy(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(1737)],pingLossCount:2,enableTransformTextPayload:!1,logIDNewConfig:{enableAutoGenerateLogIDNew:!1,userIp:""},miniProgramParams:{customHttpHeader:{}},enableAutoAck:!1,reconnectInterceptor:()=>!0,enableQoS:!1,QoSLevel:2,messageStrategy:e[n(402)],env:{xTTEnv:"",xUseEnv:""},listenNetworkChanged:!0};let{url:x,ws:l}=t,g=Array[n(823)](x)?x:e[n(403)](e[n(1609)],typeof x)?[x]:[];if(!g||g[n(612)]===0)throw new Error(n(1298)+n(1159)+n(1565));if(!e[n(1837)](Ca,l))throw new Error(n(1298)+n(1514)+n(482)+n(1782)+n(1620)+n(1326)+n(1680)+n(1099));Object[n(1127)](this[n(715)],t),this["_endpoin"+n(1475)]=new Cs(g,this[n(715)].maxRetries),this["_pingLos"+n(824)]=new Pa(this._options[n(1144)+n(1200)]),this[n(715)]["automati"+n(1327)]&&(this._isInit=!0,this._connect()),this[n(715)]["listenNe"+n(871)+n(1294)]&&(this[n(1045)+"T"]||this._isMiniWX?this[n(729)+n(1715)+n(1100)]():this._isBrowser&&this["_initGlo"+n(1323)+n(719)]())}[r(1202)+r(1668)](){let t=r;this[t(715)][t(1397)+t(628)+"nect"]||this[t(1149)+t(1612)]||this[t(1706)+"econnect"]()}[r(1202)+"ffLine"](){let t=r;this[t(998)+t(1772)+"t"]();let n=xr(e[t(892)],{message:t(1037)+t(1585)+t(1591)+"ct"});this["onStopImmediatel"+t(1618)+"ct"]&&this[t(929)+t(1856)+t(1618)+"ct"](n)}[r(1024)+r(1323)+r(719)](){let t=r;this[t(426)+"er"]&&window[t(856)+t(719)](e[t(418)],this[t(1202)+"nLine"]),this[t(426)+"er"]&&window.addEventListener(e[t(1467)],this[t(1202)+"ffLine"]),this[t(426)+"er"]&&window["addEvent"+t(719)](e.rAlyy,this[t(772)+t(1424)]),this[t(426)+"er"]&&window["addEvent"+t(719)](e[t(1369)],this._handlePageShow)}[r(653)+r(1323)+r(719)](){let t=r;this[t(426)+"er"]&&window["removeEv"+t(703)+t(779)](e[t(418)],this[t(1202)+t(1668)]),this[t(426)+"er"]&&window[t(764)+"entListe"+t(779)](t(1701),this["_handleO"+t(1096)]),this[t(426)+"er"]&&window["removeEv"+t(703)+t(779)](t(646),this[t(772)+t(1424)]),this._isBrowser&&window[t(764)+t(703)+t(779)](t(1079),this["_handleP"+t(1229)])}[r(772)+"ageHide"](t){let n=r;if(e[n(1664)](e.TDTVC,e[n(1276)]))!t[n(571)+"d"]&&(this[n(426)+"er"]&&window[n(764)+n(703)+n(779)](n(646),this[n(772)+n(1424)]),this[n(426)+"er"]&&window["removeEv"+n(703)+"ner"](e.guDtB,this[n(772)+n(1229)]),this[n(1568)]()),this[n(426)+"er"]&&window[n(764)+n(703)+n(779)](e[n(418)],this[n(1202)+"nLine"]),this[n(426)+"er"]&&window[n(764)+n(703)+n(779)](e[n(1467)],this[n(1202)+n(1096)]);else return this._socket.binaryType}[r(772)+r(1229)](t){let n=r;t[n(571)+"d"]&&(this[n(446)+n(1742)]()&&(!this._ws||e[n(453)](this[n(447)][n(1562)+"te"],this[n(813)])||e[n(1745)](this[n(447)].readyState,this.CONNECTING))&&this[n(1202)+n(1668)](),this[n(426)+"er"]&&window[n(856)+"Listener"](e[n(418)],this[n(1202)+"nLine"]),this[n(426)+"er"]&&window[n(856)+n(719)](e[n(1467)],this[n(1202)+n(1096)]))}async[r(1493)+r(457)](t){let n=r,{fpID:a,deviceID:x,bddID:l,ttwID:g,accessKey:p,aID:d,customParams:b={},enableAutoAck:v,enableQoS:P,QoSLevel:R,env:N}=this[n(715)],$,ge,$e;if(this[n(426)+"er"]||this[n(1e3)+"X"]||this[n(1045)+"T"])if(e[n(1641)]==="kICpa"){if(ONsNSj[n(1696)](_0x2a26e6,_0x68fcdb)){if(ONsNSj[n(1288)](_0x19a78c,ONsNSj[n(1325)]))return _0x3194ae[n(1018)](_0x4f5e1d);if(ONsNSj.AlFsC(_0x12a982,n(708)+n(960)))return _0x49843f[n(708)+n(960)]||_0x2f6ac8.get(_0x1f60bd);if(ONsNSj[n(1416)](_0x4bff7a,ONsNSj[n(1443)]))return _0xa8c9cd.objectStoreNames[1]?void 0:_0x5c8882[n(708)+"ore"](_0x1232a1["objectSt"+n(960)][0])}return _0x587b39(_0x12b8ed[_0x4ac8e8])}else $=location&&e[n(407)](e[n(1382)],location[n(1056)])?e[n(495)]:e.fzvpY,ge=t[n(1579)](/((^ws)|(^http))((?:[s]*:\/\/))/,""),$e=/^wss(.*:\/\/)/.test(t)?t:""+$+ge;else $=e[n(495)],ge=t[n(1579)](/(^http)((?:[s]*:\/\/))/,""),$e=/(^ws)((?:[s]*:\/\/))/.test(ge)?ge:""+$+ge;let Pe=l?"bd_did":g?n(1026):n(1829)+"d",$t=l||g||x;if(e[n(1069)](!$t,!Pe))throw new Error(e[n(529)]);let Ns=e.EDNvb==typeof b?await e.rZjUd(b):b,a0=N?e[n(820)](ka,N[n(1036)],N[n(1278)]):{},mr=Object[n(1127)]({device_platform:e[n(632)],version_code:e[n(1001)],access_key:p,fpid:a,aid:d,[Pe]:$t,xsack:v?1:0,xaack:v?1:0,xsqos:P?1:0,qos_level:P?R:void 0,qos_sdk_version:2,...a0},Ns),c0=Object[n(1335)](mr)[n(1640)]((wr,_r)=>mr[_r]!==void 0?""+wr+(wr?"&":"?")+_r+"="+mr[_r]:wr,"");return $e+n(1583)+c0}async[r(1336)](){let t=r;if(e[t(635)](e[t(1861)],t(1212))){if(this[t(1336)+t(759)]||this["_readyCl"+t(1612)])return;this["_connect"+t(759)]=!0;try{let n=this[t(1182)+"tManager"]?.[t(918)+t(1042)+"ointReac"+t(1436)+t(473)](),{timeoutInterval:a}=this[t(715)];if(n){let l=this[t(1182)+"tManager"]?.[t(406)+"ntEndpoint"](),g=this[t(1182)+t(1475)]?.[t(1735)+t(1123)+t(976)+t(520)+t(691)](),p=this["_endpoin"+t(1475)]?.[t(406)+t(961)+t(1636)+t(1596)]();if(g){let d=t(1110)+l+(" timeout"+t(1086)+t(1669)+"ached, will use "+t(445)+t(1462))+g+(t(1523)+"y"),b=e[t(855)](fe,e[t(1722)],{message:d,code:qe[t(1273)+t(1634)+"R"]});this[t(608)](d),this[t(1374)+t(536)+t(763)](b),this[t(1171)]=await this[t(1493)+t(457)](g),this._debug("connect "+g+" "+p+t(1450)),this[t(1204)+t(527)+"rs"]()}else{let d="connect "+l+(t(1491)+", max retries re"+t(1783));this._debug(d),this["_dispatchErrorEv"+t(763)](e.rJhce(fe,t(430),{message:d,code:qe.MAX_RETRIES_ERROR}));return}}else{let l=this["_endpoin"+t(1475)]?.[t(406)+t(961)+"ntAndUpd"+t(1134)](),g=this[t(1182)+t(1475)]?.[t(406)+t(961)+t(1636)+t(1596)]();this[t(1171)]=await this[t(1493)+t(457)](l||""),this[t(608)]("connect "+l+" "+g+t(1450)),this[t(1204)+t(527)+"rs"]()}if(this._isInit)this[t(1850)]=!1;else{let l=e[t(1108)](xr,e[t(892)],{message:e.YHGUD});this[t(1795)+t(1259)]&&this["onStartR"+t(1259)](l)}let x=this[t(1182)+t(1475)]?.[t(406)+t(961)+t(1636)+t(1596)]()||0;x>1&&await this[t(630)](x-1),this._debug("connecti"+t(1213)+this[t(1171)]+(t(831)+t(419))+this[t(518)+"ls"]),this[t(447)]=e[t(655)](Ea,{url:this[t(1171)],protocols:[this[t(518)+"ls"]],headers:this[t(715)]["miniProg"+t(866)+"s"][t(1492)+t(1216)]},this[t(715)].ws),(this[t(426)+"er"]||this._isWorker)&&this[t(447)]&&(this[t(447)][t(1162)+"pe"]=this[t(505)+t(1474)]),this["_addWsLi"+t(1651)](),this[t(1336)+"ionTimeo"+t(694)]=e.EblQH(setTimeout,this[t(499)+"ut"][t(1805)](this),a)}catch(n){throw this[t(1336)+t(759)]=!1,n}}else{let n=this._qosDB[t(1466)+t(585)](this._prefix),a=_0x72649b.parse(n||"{}");return a[_0x32021c]=void 0,this._qosDB[t(587)+t(585)](this._prefix,_0x474d1b[t(1185)+"y"](a))}}[r(1082)+r(566)](){let t=r;clearTimeout(this[t(1336)+t(1538)+t(694)]),this[t(1336)+t(1538)+"utId"]=null}_clearPingTimer(){let t=r;e[t(1014)](clearTimeout,this[t(699)+t(592)+"Id"]),e[t(461)](clearTimeout,this[t(1448)+t(1720)+"tId"]),this[t(699)+"gTimeoutId"]=null,this[t(1448)+t(1720)+"tId"]=null}[r(608)](...t){let n=r;this._options[n(1321)]&&console[n(757)][n(1179)](console,[e[n(1152)],...t])}[r(1362)+r(1836)+"e"](t){let n=r,{initReconnectInterval:a,maxReconnectInterval:x,reconnectIntervalGrowFactor:l}=this[n(715)],g=e[n(761)](a,Math[n(1411)](l,t-1));return e[n(1853)](g,x)?x:g}[r(1175)](){let t=r;if(e.dExKD===e.Attcl)return this[t(803)][t(1003)+t(825)]();if(this[t(447)]&&e[t(1601)](this[t(447)].readyState,this[t(1539)+"NG"])){this["_clearPi"+t(676)](),this[t(699)+t(592)+"Id"]=setTimeout(this[t(1175)][t(1805)](this),this[t(715)][t(754)+t(1423)]);return}if(!this[t(447)]||e[t(1303)](this[t(447)].readyState,this[t(813)]))return void this["_handleR"+t(1259)]();this[t(447)]&&this[t(447)][t(1408)]("hi"),this[t(1448)+t(1720)+t(1373)]=e[t(1035)](setTimeout,this[t(1706)+t(1259)+t(1052)][t(1805)](this),this[t(715)]["pingTime"+t(1220)+t(1674)])}["_handleR"+r(1259)+r(1052)](){let t=r,n={lvRFd:function(a,x){return e[D(771)](a,x)},oczQg:function(a,x){return e[D(1389)](a,x)},NaJIV:function(a,x){return e[D(1540)](a,x)},hSFQt:function(a,x){return a&x},HcIDE:function(a,x){return e[D(1238)](a,x)}};e[t(1759)](e[t(678)],e[t(678)])?(aTCTOM[t(844)](_0x2737ed,65536)?_0x1c6424[_0x2fd9b7++]=aTCTOM[t(1617)](aTCTOM[t(999)](_0x2326be>>12,15),224):(_0x532d6e[_0x576ed5++]=aTCTOM.hSFQt(_0x43360d>>18,7)|240,_0xd57d82[_0x33cc8c++]=aTCTOM[t(1617)](aTCTOM[t(586)](_0x1e9374,12)&63,128)),_0x1e677d[_0x23b28b++]=aTCTOM[t(999)](_0x5ac727>>6,63)|128):(this[t(1447)+t(824)]?.[t(1304)](),this.emit(e.UqiKS,e[t(1080)]),this[t(1447)+t(824)]?.[t(867)+"chMaxCount"]()?this[t(1706)+"econnect"]():this[t(1175)]())}_navigatorOnline(){let t=r;return this[t(1045)+"T"]||this[t(1e3)+"X"]?this[t(882)+t(1201)+t(675)]:(this[t(426)+"er"]||this[t(617)+"r"])&&this._options[t(666)+"tworkCha"+t(1294)]?navigator[t(1116)]:!0}[r(1706)+r(1259)](){let t=r;if(e[t(874)]==="lfVdm"){if(!this._navigatorOnline()||this[t(1149)+"osed"])return;this[t(1182)+t(1475)]?.["resetEnd"+t(1471)+t(1613)](),this[t(1447)+"sCounter"]?.[t(1678)+"nter"](),this[t(447)]?this[t(1375)+t(1308)](1001,e[t(1348)],!0):this[t(1336)]()}else return _0x4d049f[_0x31da31[e[t(827)]]=5001]=e[t(827)],_0x421f84[_0x49de28[e[t(878)]]=5002]=e.cOKYt,_0x56075b[_0x1253c0[t(1273)+t(1634)+"R"]=5003]=e[t(467)],_0x583252[_0x29d59a[t(1266)+"ERROR"]=5004]=e[t(1532)],_0x44cb67[_0x2add75[e[t(1047)]]=5005]=e[t(1047)],_0x3e6b83}[r(729)+r(1715)+r(1100)](){let t=r,n={REQxI:e[t(892)],onfdv:e[t(1214)],BlZfP:e[t(879)],VaMwM:e[t(1677)]};this[t(1045)+"T"]?tt[t(1739)+t(732)+t(1810)](({isConnected:a})=>{let x=t,l={LlRzI:function(g,p,d){return g(p,d)},ioUrg:n.REQxI,eMnDj:n[x(1085)]};if(n[x(940)]===n.VaMwM){this[x(998)+"WebSocket"]();let g=iwEjbR.LlRzI(_0x2d2580,iwEjbR.ioUrg,{message:iwEjbR[x(1044)]});this[x(929)+"mediatelyReconnect"]&&this[x(929)+x(1856)+x(1618)+"ct"](g)}else this[x(882)+x(1201)+x(675)]=a,a?this[x(1202)+"nLine"]():this[x(1202)+x(1096)]()}):this[t(1e3)+"X"]&&wx[t(1739)+t(732)+t(1810)](({isConnected:a})=>{let x=t;this[x(882)+x(1201)+x(675)]=a,a?this[x(1202)+x(1668)]():this[x(1202)+x(1096)]()})}[r(630)](t){let n={bWvrb:function(a,x,l){return e[D(1675)](a,x,l)}};return new Promise(a=>{let x=D;n[x(984)](setTimeout,a,this[x(1362)+x(1836)+"e"](t))})}[r(1375)+r(1308)](t=1e3,n="",a=!1){let x=r;this[x(447)]&&this[x(998)+"WebSocket"](t,n,a)}[r(499)+"ut"](){let t=r,n=this._endpointManager?.[t(406)+t(961)+"nt"]();this._debug(t(1110)+n+t(1491)),this[t(1375)+"ect"](1001,e.GiKcu,!0)}[r(845)](t){let n=r,a={BhHAW:function(x,l,g){return x(l,g)}};if(e[n(1495)](e[n(1778)],n(1016))){let x=e[n(1733)](cr,t);this._ws&&e[n(1291)](this._ws[n(1562)+"te"],this.OPEN)&&(this[n(447)]&&this[n(447)][n(1408)](x),this[n(608)](n(1444),t))}else hbqHOo.BhHAW(_0xd60c5b,_0x1b17b5,58),_0x258e9a(_0x283d3c,_0x5a80d0)}[r(1204)+r(527)+"rs"](){let t=r;this[t(447)]&&(this[t(447)][t(764)+t(703)+t(779)](e[t(692)],this[t(1792)]),this[t(447)][t(764)+t(703)+t(779)](e[t(1650)],this._onClose),this[t(447)]["removeEv"+t(703)+"ner"]("message",this[t(577)+"ge"]),this._ws[t(764)+t(703)+t(779)](t(430),this[t(1876)]))}[r(1716)+r(1651)](){let t=r,n={qLdiu:function(a,x){return e[D(1287)](a,x)}};if(e[t(1404)]===e[t(1224)])return lgFDdD.qLdiu(_0x5491c6,_0x30b9a7);if(!this[t(447)])return;this._ws[t(856)+t(719)](e.ILApt,this._onOpen),this._ws[t(856)+t(719)](t(1568),this[t(897)]),this._ws[t(856)+t(719)](e.aqefs,this[t(577)+"ge"]),this[t(447)][t(856)+t(719)](e.rYWhM,this[t(1876)])}[r(781)+r(891)](t=1e3,n=""){let a=r;try{if(e[a(1605)](e[a(1619)],"AbSML")){let x=e[a(1154)](_0x378ed9,_0x515cd1,_0x4be9fe);return _0x4d4a99[a(711)][a(850)](x,x+_0x384a83)}else this[a(447)]&&this[a(447)][a(1568)](t,n)}catch{}}["_destroy"+r(1772)+"t"](t=1e3,n="",a=!1){let x=r;if(this[x(1700)+x(676)](),this[x(1082)+x(566)](),this["_removeW"+x(527)+"rs"](),this[x(781)+"nceClose"](1e3,n),this[x(1336)+x(759)]=!1,a&&this[x(446)+"orOnline"]()&&!this[x(1149)+"osed"]){if(this[x(1182)+x(1475)]?.[x(867)+x(1427)+"es"]()){let g=this["_endpoin"+x(1475)]?.[x(406)+x(961)+"nt"]();this[x(1374)+x(1183)+"ent"](e.YBMrx(he,e.GOTsc,{code:1006,reason:"connect "+g+(x(1491)+x(1086)+x(1669)+x(1783)),wasClean:!0}))}else{let g=this._options["reconnec"+x(1387)+"ptor"](t,n);this[x(1374)+"hCloseEv"+x(763)](e[x(1253)](he,e.GOTsc,{code:t,reason:n,wasClean:!0,willReconnect:g})),g&&this._connect()}return}this[x(446)+x(1742)]()||this[x(1149)+"osed"]?this[x(1374)+"hCloseEvent"](e.dZTHl(he,e[x(1650)],{code:t,reason:e[x(1252)]})):this["_dispatc"+x(1183)+"ent"](e[x(1017)](he,e.GOTsc,{code:1006,reason:e.Zajax})),this[x(447)]=null,this[x(1182)+x(1475)]?.[x(1341)+x(1471)+x(1613)](),this._pingLossCounter?.[x(1678)+x(1160)]()}[r(1374)+"hOpenEvent"](t){let n=r,a={LQHNP:function(x,l,g){return e[D(1675)](x,l,g)}};e.MMFvb(e.qkacA,e[n(849)])?(this[n(1780)](n(516),t),this.onopen&&this.onopen(t)):(XawPKv.LQHNP(_0x3c87de,_0x139de8,82),XawPKv[n(572)](_0x3c6748,_0x2bbd3a,_0x39143a))}_dispatchMessageEvent(t){let n=r;this.emit(e[n(1714)],t),this[n(1312)+"e"]&&this[n(1312)+"e"](t)}[r(1374)+r(787)+"ageEvent"](t){let n=r;if(e[n(531)]!==e[n(531)])return _0x313ef1[n(1179)](_0x5a1337(this),_0x55bd93),_0x3a484e(_0x45d9c9[n(1018)](this));this.emit(n(1112),t),this[n(442)+n(519)]&&this[n(442)+n(519)](t)}[r(1374)+r(536)+r(763)](t){let n=r;this[n(1780)](e.rYWhM,t),this[n(1235)]&&this[n(1235)](t)}[r(1374)+r(1183)+r(763)](t){let n=r;this[n(1780)](e[n(1650)],t),this[n(868)]&&this.onclose(t)}get[r(1162)+"pe"](){let t=r;return this[t(447)]?this[t(447)][t(1162)+"pe"]:this[t(505)+t(1474)]}set[r(1162)+"pe"](t){let n=r;this[n(505)+n(1474)]=t,this._ws&&(this._ws[n(1162)+"pe"]=t)}get[r(492)+"nt"](){let t=r;return this["_endpoin"+t(1475)]?.[t(406)+t(961)+"ntTriesC"+t(1596)]()||0}get[r(552)+r(1376)](){let t=r,n=this[t(1546)+"Queue"].reduce((a,x)=>(a+=x&&x[t(938)+"th"]||0,a),0);return e[t(1479)](n,this[t(447)]?this[t(447)][t(552)+t(1376)]:0)}get[r(1556)+"ns"](){let t=r;return this[t(447)]?this._ws[t(1556)+"ns"]:""}get[r(1056)](){let t=r;return this[t(447)]?this[t(447)][t(1056)]:""}get readyState(){let t=r;return this._ws?this[t(447)].readyState:this[t(715)][t(941)+t(1327)]?this[t(1539)+"NG"]:this[t(1868)]}get[r(1217)](){let t=r;return this[t(447)]?this[t(447)].url:this[t(1171)]}[r(1568)](t=1e3,n){let a=r,x=(a(498)+"3|7|0|1")[a(839)]("|"),l=0;for(;;){switch(x[l++]){case"0":if(e[a(1357)](this[a(447)][a(1562)+"te"],this.CLOSED)||e[a(995)](this[a(447)][a(1562)+"te"],this[a(1241)]))return void this._debug(a(1608)+a(1458)+a(1755));continue;case"1":this[a(998)+"WebSocket"](t,n);continue;case"2":this[a(1700)+"ngTimer"]();continue;case"3":this[a(894)+"ger"]?.closeDB();continue;case"4":this["_clearTi"+a(566)]();continue;case"5":this[a(1149)+a(1612)]=!0;continue;case"6":this["_dropGlo"+a(1323)+a(719)]();continue;case"7":if(!this[a(447)])return void this[a(608)](a(1608)+a(465)+a(954)+a(1869)+"ed");continue}break}}async[r(1408)](t,n){let a=r;if(e[a(407)](null,t))throw new Error(e[a(1639)]);a(952)==typeof t&&(t=JSON[a(1185)+"y"](t)),e[a(958)](e[a(1609)],typeof t)&&!e[a(797)](t,ArrayBuffer)&&!(t[a(727)]&&e[a(1400)](t[a(727)],ArrayBuffer))&&(t=JSON[a(1185)+"y"](t));let x=await e[a(1482)](Is,t),l=e.FjwHF(Aa,t),{method:g=0,service:p=this[a(715)][a(1820)],logID:d=this[a(715)][a(1062)+"erator"](),headers:b=this[a(715)][a(1712)],payloadEncoding:v=this[a(715)][a(1635)+a(1306)],payloadType:P=this[a(715)]["payloadT"+a(1474)],logIDNew:R=this[a(715)].logIDNewConfig["enableAutoGenera"+a(1132)+"ew"]?e[a(682)](o,this[a(715)][a(1396)+a(1878)].userIp):""}=n||{};if(!p)throw new Error(a(1298)+a(1030)+a(484)+"ervice");let N={SeqID:z.fromNumber(this._seqId++),LogID:z[a(1667)+"er"](d),service:p,method:g,headers:b,payloadEncoding:e[a(1638)](v,Object)?v.encoding?v[a(962)]:"":v,payloadType:e.CtEmC(P,Object)?P[a(1163)]?P[a(1163)]:l:P||l,payload:x,LogIDNew:R},$=e[a(1734)](cr,N);return this[a(447)]&&e[a(1197)](this[a(447)][a(1562)+"te"],this[a(813)])?(this._ws&&this._ws[a(1408)]($),this[a(608)](e.TXGcP,N)):e[a(574)](this[a(1546)+a(1834)][a(612)],this[a(715)][a(525)+a(1322)+"ength"])?(this["_message"+a(1834)][a(1628)]($),this[a(608)](e[a(576)],N)):(this[a(1546)+a(1834)][a(567)](),this["_message"+a(1834)].push($)),{seqID:this[a(1558)],logID:d,logIDNew:R}}async[r(1594)+"t"](t){let n=r,{url:a}=e.xlkOb(t,{}),x=Array[n(823)](a)?a:e[n(1824)](e[n(1609)],typeof a)?[a]:[];t&&Object[n(1127)](this[n(715)],t),x&&x[n(612)]?this["_endpoin"+n(1475)]=new Cs(x,this[n(715)][n(1682)+"es"]):this["_endpoin"+n(1475)]?.[n(1341)+"pointConfig"](),this["_pingLos"+n(824)]?.["resetCou"+n(1160)](this[n(715)][n(1144)+n(1200)]),this[n(1149)+n(1612)]=!1,this[n(447)]&&e.tslsM(this[n(447)][n(1562)+"te"],this[n(1868)])?this["_disconn"+n(1308)](1e3,e[n(807)],!0):(this._isInit=!0,this[n(1336)]())}async[r(437)](){let t=r,n={RIrUh:function(a,x,l){return e[D(1418)](a,x,l)}};if(!this._connectLock)if(t(597)===e[t(535)])this[t(1182)+"tManager"]?.[t(1341)+t(1471)+"fig"](),this[t(1447)+t(824)]?.[t(1678)+t(1160)](),this[t(1149)+t(1612)]=!1,this[t(1850)]=!0,this[t(1336)]();else{let a=hKYTHG[t(1430)](_0x39dc50,_0x5c48f4,_0x1fab77[t(612)]);_0x8939c6[t(711)][t(1421)](_0x21e088,a)}}addEventListener(t,n){this.on(t,n)}["dispatch"+r(604)](t){let n=r,{type:a}=t;this[n(1780)](a,t)}[r(764)+r(703)+r(779)](t,n){this.off(t,n)}[r(1008)](){let t=r,n={KJsmm:function(a,x){return e[D(1482)](a,x)},tJSlB:e[t(1080)],GmGFi:e[t(1570)],LttfC:e[t(795)]};return new Promise((a,x)=>{let l=t,g={msgWo:function(b,v){return b(v)},QobZC:e[l(795)]};this[l(1700)+l(676)](),this._pingPongTimeoutId=e[l(742)](setTimeout,this[l(1175)][l(1805)](this),this[l(715)][l(754)+l(1423)]);let p=()=>{let b=l;g[b(782)](a,"success"),this[b(810)](b(1597)+b(1049)+"s",p),this[b(810)](g[b(424)],d)},d=()=>{let b=l;n[b(756)](x,n[b(1702)]),this[b(810)](n[b(578)],p),this.off(n.LttfC,d)};this.on(e[l(1570)],p),this.on(e.UqiKS,d),this._ping()})}}})(),H["CustomCl"+S(1858)]=V[S(898)+"oseEvent"],H[S(1119)+S(1105)]=V[S(1119)+"rorEvent"],H[S(744)+"e"]=V[S(744)+"e"],H[S(604)]=V[S(604)],H.FWS=V[S(438)],H[S(796)+"MessageE"+S(1673)]=V[S(796)+"MessageEvent"],H[S(1283)+"vent"]=V[S(1283)+S(1673)],H[S(1077)+"t"]=V[S(1077)+"t"],H[S(738)+S(1657)]=V["Reconnec"+S(1657)],H[S(1825)+S(1858)]=V["createCl"+S(1858)],H[S(480)+S(1105)]=V[S(480)+S(1105)],H[S(684)+S(1840)+"nt"]=V["createMe"+S(1840)+"nt"],H["createOp"+S(1728)]=V[S(1833)+S(1728)],H[S(1788)+S(881)+S(1673)]=V[S(1788)+S(881)+S(1673)],H[S(1442)+"rame"]=V["decodedF"+S(496)],H[S(1209)+S(1141)]=V[S(1209)+S(1141)];for(Tn in V)[S(898)+S(1858),S(1119)+S(1105),"ErrorCode",S(604),S(438),"Frontier"+S(1283)+S(1673),S(1283)+S(1673),S(1077)+"t","Reconnec"+S(1657),S(1825)+S(1858),S(480)+S(1105),S(684)+"ssageEvent","createOp"+S(1728),S(1788)+S(881)+S(1673),"decodedFrame",S(1209)+S(1141)].indexOf(Tn)===-1&&(H[Tn]=V[Tn]);function Bn(){let r=["tKPRtLm","DefIsxm","ExbL","De1HBMfNzxi","BLnqA1m","DuXQtfe","C25RAM0","wLPNq24","r1LAy0u","B25fCNjVCG","rgrirLi","BIWGAg9ZDg4","AhrQqLu","EwTZDvC","Dg9Y","r0PjsuS","yNLL","DLfvzLm","BNHYv0i","ihrPBwvVDxq","y3vZDg9Tshq","x2DLBMvYyxq","B1fWvfG","qKTXsue","rMHQBNa","Afzusu0","rKLmrv9ot1q","r3v3sgW","yNL0zu9MzNm","B2zMC2v0","wezfwui","tNvhqxe","mZK5ohPqsMTNsa","vMPAsKW","B1jpBge","BuPnA2e","Aw9U","zM9Yy2u","AgvrtwG","qwD6C24","zvP5vhC","y2XLyxi","CM92AwrLihC","nJC0mti0sfrpAerd","C2fKEwu","id4G","EhPmsw8","uwrkEuW","te9yCfm","EKzet0S","v1f6v3C","ihrVihjLDhi","zNjVBuj5Dgu","yKz1u0u","z2HeALu","yLPLtha","sMnhDfG","qwTJBgO","zw5XDwv1zq","thHvseS","s2HKCeO","tu1gDMi","B3bLCNr5","mxWZFdb8mNW","EK5tzuW","BwLRAwe","Aw9UvgLTzw8","q09otKvdveK","zgjmvgG","EhjNtNK","yM15veS","rK5fyxq","wKvewLK","ywXSzwqGBxu","x21LC3nHz2u","z2u6ia","BfnjvgS","yxv0BW","BePYqKy","AxnrB1nby2S","CNH4v0C","thDrzeO","CNbkwMC","D2fZq2XLyw4","zxH0zw5ZAw8","yxjYyxLIDwy","x3nLCuLK","DeHlsKi","zMn6t2e","wNjus2i","CMvHzhLtDge","se1Ut00","wuDgBKy","ywXPzcb1CMW","BgHeuKy","wNHuthy","y2XVC2u","tu91rMe","rhH4qwq","rM14v1y","uNLhAhi","u3rZwgu","ruLxtvi","AufHAMm","BNPVzLi","Ef9MCM9UDgK","Dg1hsg4","CMvWBgfJzq","uLHRAg8","vxrNvKS","u2rvzMO","l3DZl3yY","whbguxq","zwrPyxrLBhK","DMvY","D3m6lY8","uMzwzNm","Ce1Pugq","ANfTsgS","ihjLy29UBMu","q0TJsfu","CePOthu","CMvJB25Uzwm","txLgywi","B3vUDa","CgLUz19VBMm","BwfW","zxjFCw9Zx2e","r1bztgO","EuLUuvy","u1nkzuW","BNfKwxq","zxf1ywXZ","BxDlt3C","t3fZv2W","Aw47y2HHCNm","y2XVC2uSihC","C0P6Beq","seHdthK","DMfSDwu","B3nLza","zMLN","x2TLEvbHDgG","y291BNq","EeLYr2e","B2n6uwC","EvjLy29UBMu","yw52thm","A2v0ignVBNm","C2XPy2u","uMjXEKK","y2XLueC","u2vXsuq","EvbZBw8","AK1MruO","zKrxvLu","ChvZAa","qvL3D1e","BLjsu2y","vKXhrfK","wgPlrum","BhHXALO","suvtx0vsuK8","Cgf5Bg9Hzeu","BNruCMLLC0m","y2XVC2veqG","q3rfBum","y1zlu0i","CMvKDwnL","CffKEvi","yvLRv28","vM94rMm","CMfUzg9T","tKLeEM0","x2rItMfTzq","we1zwwG","Dg9tDhjPBMC","BK5bv1y","r09uC2m","C3rLBMvYCW","q3fSB2O","uvrmAe0","z3nfrvu","AwXLtMfTzq","tMXJuNq","Dev2zw50","sxjmzKO","mNWZFdb8nhW","q1zLt0u","zwPbA0i","v1HRuxC","C0Xf","sgP0s2O","y1bVtMO","tKXxvuW","zNjVBu51Bwi","BKXPBMu","DhjPzxmGCMu","CMjTBuC","vKnsuuC","B3bLBIa","DMvUDa","DMfS","tMXmBxq","rgvKAwnHDgu","q2jMy20","CMvZzxrdB3u","ysbTDxn0igi","AxmGDw5Kzwy","jMPZy2fSBgi","Bwf4uMv0CMK","zNvUy3rPB24","r1rRA0u","CfPAuu8","u0DWq1e","ruXLvNu","z2nozLi","zffMyK8","AgLNAa","zMfcwLu","q0jAsw4","z29dAKy","sgXjuvi","CMvHzg9UBhK","Bw5Ozem","tgjVsKO","ufvWtuW","ywzL","x2nSzwfYugK","B2zMBgLUzq","DePtBei","rhjIB1m","DMfSDwvZ","tNvhv2u","x2HHBMrSzvi","mxW1Fdb8nhW","C29YDa","CNHhs3i","DgLTzw91Da","y3r4","AgvHzgvYCW","DKDLwei","yxfLzNm","zxrxB3jRq2G","x2fKzfDZtgK","z2vY","BxnN","EgzjzLy","y3ruAw1LB3u","CvLKCNC","CLLxAe0","rNP1CMW","AxnrB1nnzxm","CM5MtwC","D2joDMe","rLjptLrjrvi","zw5fDMvUDa","uujWrhq","Bgzwzg0","seviwLG","shrxANC","uMLpDhy","vfDtALm","CMvWBgfJzui","DxbNCMfKzw4","q0DuvMq","Dg9cExrLC0W","B25ozxr3B3i","C3rVCMu","uLjpuG","B3jpBMXPBMu","AgjVDNG","y29Kzq","swD5uei","y3vYC29Yx2y","t0zxv3e","BxfYD24","yMf6twm","u01pzLO","u3vAtwm","x3bHDgHlzxK","t3Dpwfq","AxnszwfKEq","EsbJBg9Zzwq","CLDrANa","t29pC2e","EwHwEK8","BwjUtMq","DuLgu2G","DgD3yxi","r3PsuNO","BeH4zMu","z2v0qwXSs2u","zMT4yxG","t1f3Cg8","EuXHsfO","zw5KCg9PBNq","z2fMv3a","zNjHBwvuExa","zNjVBuHHC2G","v2vIu29JA2u","tfvKEge","q0zHv0y","D21gC3K","BM5Ly3q","DvPWq3K","AvzptgS","DcbSAw1PDa","zw1PDa","q09oveLovuu","lcbxzwjtB2m","ywnOzwq","tw9Orvu","zuTetNm","zef3rfa","weX2rK4","y3jLyxrLuMu","shHXwfm","AgvHzgvY","Aw5JBhvKzxm","x29Ut3bLBG","y3vYC29Yx24","ALnuC0O","B25tDgfYDfi","tNzpuNm","igzPzwXKoIa","B3jRzxjhBg8","Aw9gEMG","ExfYv3i","DMreyNG","vKX2u0G","ENHvCMK","uwPsr1q","yMLUza","Cgf5Bg9Hza","zNjUvLy","tKftwKS","u052CMO","AgfUz2u","oeTly2DcyG","x2n1CNnVCKy","sLbsCM8","Ew5ZsMO","y2HkDvm","shj5D2q","shDTDge","y25iDwG","yw1LoIa","C2vYDMLJzq","Chv0","rfvyBee","qwjVCNrfCNi","rvjKwwq","y3jLyxrLq2W","qxrvvhy","DKDlse4","DLzuEgW","zgv2AwnLx2K","B3bLBKrc","zxjFBxnNAwq","ug94Cgq","y3jLyxrLt3a","uxvLDwu","CNnVCKzPBgu","CNzHBfzHBhu","t01RCLa","su5tvefova","sLPzr3y","C3nHz2vfDMu","BNrbBMrvCgq","q3jcv2O","svb1ugO","qwXgr1C","Ec11C2uT","Ahr0Ca","uMn3zhG","zNrxC1q","x0rctMfTzq","x2LZsw5PDa","C3vIC3rYAw4","wKHYsKS","EMvOqKC","y29SBM8","rfrArey","BwvKAwf0zwW","u1z2vey","B3nLrxzLBNq","u2n3Dwm","thbrq3m","BKj1tNO","tejwCKy","zKjOCLK","zhjcze0","CgT4Du8","vxDyuuW","B1jKDKS","q0Xpu0ve","BML0AwfSAxO","uhjPBwfYEuS","vKfLwNm","z21twM4","Be1lu3K","z0jAyM4","rMP3sey","x29UrxjYB3i","tMrRy3C","q29UzMLN","Axnby2TdBgu","C3jJ","B3vgzxm","DvvHugG","y3vYCMvUDeu","AerjwKG","z2v0q3vYCMu","vuDrEgm","reT2CNq","yw5Hz2vY","CgLpCgy","rKLWufe","s3byugS","B3bLCNr5tMe","yxrHlcbKyxq","BKnpELC","AfLvtgm","CgrnC2e","BLLNCLO","Bhm6ia","quTNteu","BwfUDwfSihi","v0DNCMm","C2vUDa","uw9IwKm","yw1Lu3bHy2u","x2LZqNjVD3m","C2vYDMLJzs0","EwLbuLO","AvDJC3i","zxjYB3i","swXTDu0","Ec1TC2CTy3u","Dg9mB3DLCKm","twLZC2LUzYa","vu10ANG","uufIqwm","y29UBMvJDa","rLDt","wKPyCgC","qNLrrvO","v2n1B1q","B25szwnLAxy","mdaWmdaWmda","Cg9W","yMfJA3vWigu","x25HDMLNyxq","x3DZ","yunjwfa","BvzkthG","s2HnrfK","zMX1C2HfEha","yxLAsKe","CLjSu0e","AM9PBG","zMvY","Aw1fzMy","zvvYBa","C3Hcv0u","yMX3EMW","vuz3Afe","we1Ws0W","C3rYAw5N","C3rHCNq","vuLpAK8","CYbPBNn0yw4","D3D5yva","wLfQCg8","zMLSzw5HBwu","yMHdAfy","reiGzMfPBgu","DMTyEhu","te9zyKK","DhjPzxm","u21Kteu","AhzKrgO","vvnxsMq","s0nTrwS","q01lCha","DLzwv2W","y3jLyxrLrxi","CMvkuLi","CYbWyxjHBxm","yxbWzw5Kq2G","ihzHBgLKihm","zNnkAw8","x194x21Zz18","u1jOvvK","yw5ZzM9YBvq","CvrLBeu","BfriCK4","BvD4y3e","CMv0CNLdB3u","A1LbuMu","u01xuMW","rfjVywu","CMfTzq","qK1tCeS","nxW0Fdj8nNW","x29UvgLTzw8","sLrhAhm","CvD2rM0","ndq5mZyZnJb1AwnnEgC","z2v0t3DUuhi","zxH2D2i","x2jPBMfYEvq","yxKSihrYEsa","rgneqvG","B25dBg9Zzq","tuPOvMK","AMjOvha","t2nMvve","zNjVBujPDhm","zw5HyMXLvhi","zNjVBNrPzxi","Bg93","B3bLBG","venpEK8","x3bYB3rVy28","zufJAW","vxbKyxrLq28","BwLUzW","CNnVCL9Uyw0","CgfYC2u","D2vMBMy","Bwf4twvZC2e","EePRug8","C0XPC3rLBMu","B2H6tge","D0nluvO","mti2m09rs096BW","sxP3s3y","CM92AwrLigi","Euzpt0y","Bwu6ia","zLbdCLu","AevYCM9Yrxy","zg9Uzq","wezMANK","ywr2yw5Jzq","zKrdANy","CMTLCKDSB2i","AwvsyK0","wwroshq","uKTmAgO","v3fIt3G","qNPWB1O","mtu3mZa4nuvxsffozq","Bhr2Bgu","zgvSzxrL","tLHuExO","zcWG","yNvMzMvYzwq","tejIEe0","tenesgq","DgHLBG","rhncEvG","EMPjD3O","zMXVB3i","u2jYqNy","sfnHEeG","yvzizfG","ufDOAMS","rMDjsvK","z25HuMe","AxrNqK0","BwvY","C2HPzNq","C0jf","uKviC0C","wfnzsM4","CgvYC2LZDgu","tffitLa","vg1ywe8","ru9Wwge","zgf0yq","tev1BwS","x29UtwvZC2e","r21hrMK","t2vRDMO","ELLTtLu","BKTZyLi","EgDPz0e","sNLPthu","zw1LBNq","z2vtEw5J","sgnjreu","C2v0u3rVCMe","veXSBge","wezusLO","rLfOseS","rg5PzNC","z1rPBwvVDxq","EKLHuge","v3bLr2S","vKfmA0u","rxr3s0W","BK9mww4","ihn1y2nLC3m","DevKzeO","BwLmr3G","Eu5czKC","EMfgt3G","EfLWwwG","rxzLBNq","vuntyMq","vxbWug8","zfDVCMTLCKC","x2rLyNvN","zKj2Eg0","s0v4s2C","y29UBMvJDgK","BgvUz3rO","q3ziCuW","AxzLrhO","DgPsEMi","rKzJqMi","x2LZv29YA2u","EunPwve","yxrju2G","qxPwt3O","BKnjve4","ruTgB3i","x2LUAxrqCM8","mZGZodm4n1bgyNPisq","yMXVy2TLza","zcWGDw5RBM8","sMrUEhq","DxrVuMvJB24","zxmGCMvHy2G","x3DHAxq","BLjtuK8","swvJEgC","Agzmt0m","BKPiCuu","wwTizhu","mdaWma","vfL2Ahq","ywjVCNq","BM93","AgfZ","EeTtB3q","yKHxqNK","yM9L","zv90Aw1LB3u","tg9NsurozxC","CgfNzwHPzgu","z3DQA2S","DgfIyxnL","whbHsNy","DgLTzw91DcW","r0DmuLa","yujeBKK","x2rYB3bhBg8","tu5iwhG","v1vNDLm","CK92DwC","BwHbEMy","CNzHrLC","shzsC3a","r25PruS","ChrVCG","Cvnxww8","BgvY","BMv3vMvYC2K","Aw5L","BgLZDgvUtMu","r0jNBNq","wvLpz2e","tKfusvzfx0u","uwjhz0G","ENL0tu8","uNLbBvK","Cw9Zx18","teLhsvK","BgLUzq","BMDuAw1LCG","rffHAfG","svb1ywm","EhjnD0C","u2TPCcbWyxm","yNfOBhO","ufzHEey","zgvS","y3jLyxrLtwu","y3vYC29YlNm","rwjSuuG","A2LSCLy","y3vYCMvUDeK","AuDutK4","tgTHuMO","Dw50","suXbChq","AhfPue4","Dxrjza","A2rrEMO","zKH3q2O","x2XPC3rLBMu","u09tDee","x3bPBMDqB24","CunsBNe","uMPKq0u","ufLqteW","zw50tgLZDgu","shnNrvG","vwfPsxe","t1rfweC","tNHiEKq","B2jQzwn0u3q","BMCGB3iGyw4","q29Kzq","yNL0zxm","B2nRzxq","C1zSrNK","DxrMofDYAxq","x29WDgLVBNm","tLLmsfi","sej3ww8","A1nxB0y","tgLZDgvUzxi","thziyKC","Aw5KzxGGB3u","CMDMreW","qNLkCee","v2DHs3i","BLfIAxK","qLDTvLi","yNvMzMvY","yK9OrKO","x29UugfNzu4","uMLPDMm","zwvKzwq","A1n0yxr1C0m","DhH6s24","y3jLyxrLt2i","z29PBMCGyxC","yuPltxO","Axzzt2u","uMvJB25Uzwm","sfrgvKu","EvnuuwK","ugDYAha","zfrQBuS","Dg9oDw1Izxi","rxjYB3jdB2q","Bwv0Ag9K","qvHczM8","BNHmA2G","wNLMrhG","EgfMB3K","uMzwDwu","EujhCKK","x2n1CNnVCK4","yLPouuq","CgLUz0LUDgu","D24GCMvHC28","s0PZBw0","Bg9N","u1ryywm","tg9JAW","AeLxrxK","A3ndv1K","r0rvCKG","zw50","CMvTB3zLrxy","shPmvuK","CuHiB3G","B25VCgvU","Bwf4tg9ZC0m","sfHmELa","CgzxB0O","EvbjBw0","x2HHBMrSzva","zxf0ChO","wLHnDgy","y0PMtva","A01rrfa","uKLrD1C","wxfJy04","BMvY","t2HJAKu","x3DZsw5ZDge","BxnNv28","DejlwLK","AeXMyNi","r1fzrxm","rNjlswO","AefJA01LC3m","r3bkyvK","s3bqu24","ndi1mZq5AgL3uw5w","yxKSig5LDhC","B05qwue","C3Lrrgi","weTODMG","vxfPs1m","rNjVBNrPzxi","uvbhB0W","u21wq2q","runWCuq","s2zYExm","t1Doq1a","surVCui","x3fVC0rc","ywnRpwzYB24","tg9Nsuq","te9vy0W","AKrQrxi","Aw5KzxHpzG","A09muK8","B2zM","z2v0q3vYC28","CMLLC0nVDw4","t1bftG","CMvJzwL2zwq","D3HkC1q","BgXlDKq","x3bYzwzPEa","rvjst1i","vKXlqvu","EvzXvKe","CwH5tMe","AuPcAva","AxnbCNjHEq","C0nVDw50zxi","CMfNzvn5BMm","ntq5ndq2nhzrAgvnrG","C1v6uLm","tNn5D2i","vgrWBe4","DKjZz3a","ihbYB3rVy28","rKHnCxi","vuzNCvK","DgHHBIbSB2m","rxDLB1m","whDYy0W","ELjAuKe","zw5HyMXLuw8","C3bSAxq","uhjgthu","BwvZC2fNzq","AxnmB25N","sK9vD0q","BhzsrMq","x3nLBMrby2S","ugrYyxO","zKndCwW","uu1vv2e","CwTHy0e","C3vIyxjYyxK","y29Uy2f0","A3DXEhO","q0zhruC","BxzHz2G","C1zzsKO","ywrKrxzLBNq","s1Heufi","ywXty29Wzq","BhniCwe","t2jQzwn0","C1LOChe","Dw5RBM93BIa","AxjLza","rgHUrvq","t3b0D2e","CMfTugfYyw0","y2HLy2Tszwe","B25JBg9Zzq","z3bUtMy","vhzcz0W","DhDVCMTdAge","ueLdywu","zNnjrxy","zvDTCMq","svfOsw8","zwHit2W","CMvTB3zLq2G","y09lwxq","t250sKC","y2HnyxHdB3u","y29UBMvJDeu","x21PBMLoyxy","C2v0q3vYC28","C2DPza","BgLTAxq","BhzPDe4","qw5qvuy","z0PMr3a","ALbNs1q","ufv4ELO","BMnLq2XVC2u","v3PADMe","Ehjswu0","x1fVu01HBMe","D1vdDuC","r05RqvG","x29Uq2XVC2u","q3vZDg9Tq2W","uMfhALi","CgjICdi","ywXSq3vYC28","CMvXDwLYzwq","BgLUzw5V","vw5PBxbSzw0","y2f0y2G","twvMDve","EuLKt3e","AMHLt2e","C09KswW","CuHkAwq","thH0r2q","BhL0Auy","ufPizeG","yNvOzuK","icSG","BwLZzq","B2XKvMvYC2K","y2HLy2TdDxi","qNH0wui","tvHcsM8","BfrPBwvVDxq","ufbUBK0","BM1MrNG","CwTQuxC","ywXSB2nvBNm","sfHbz2C","y01zsuG","Dgv4Dc9WBge","B25tDg9Wsw0","ihzHBgLKigq","AMP2vNK","wMvsrwe","BfjPCMG","DgfYz2v0","q2jWAvu","y1vry0G","wwX3qwu","yNL0zuXLBMC","r0L5Euu","qMXAzLa","yxv0B21HDgK","s1feuxu","D2ThEfa","qM1jwwu","EMjgDhO","Cgvyzva","tMHizKO","u2vYDMLJzvC","uhbsCgO","y29UDgLUDwu","BM9Uzv9UB24","BNvTyMvY","qNjPzgDL","y2uGBM90igK","wfDkDgK","tMHVsvi","AxnFywnR","DxLbCvC","v3nMzum","B3jLtMfTzxm","BNrfBMrWB2K","zw5JB2rPBMC","uvH6wM0","DgDiyKq","Dwvjwue","yKzjCKC","rMveDeK","veDfr2e","vuTKzMu","sMzPs3q","ntzzv1nvr1y","BxfiwNy","y2HHCKnVzgu","EujSDui","yLnZuMO","Cg9PBNrbBMq","ugnPzey","yLz5qw4","D3jPDgvvAw4","C2XVENi","rxzmzfC","BKjuy0y","C0fSr3K","yLD2CMi","yw51Ce1LC3m","u3rYyxrLz3K","ywWGy3vYC28","Be14zey","ugT4Cwi","sNv1A2C","Dw9nCxi","yurZuNe","yw1bvK0","sMflzw4","AezXuMK","y2fSBa","B21Xwwq","x2rLC3rYB3K","tMfksvy","x2LZtwLUAvC","whzYDKW","y2jIsgW","y2XLyxjtDg8","C1PSwuy","x2LUAxq","BffUEuS","tMHRzeG","CgLUz09Uy2u","vhn6u0S","ywnRx2LK","BMrLEa","wuDwt1G","vxPOuwi","AeLjt1a","yvPZEM0","EhbOB2m","wujnCNG","z2v0","tMfTzq","zM5Rvvu","z0H5zeu","v0D6sfK","ywDL","x2LUAxrhBg8","z2vjBMzVu3K","Dhr3Awq","BhHRCNq","CMvHC29U","B1j0vvC","CM92AwrLige","D2PntM0","y3jLyxrLrwW","y29TCgXLDgu","z29PB1u","vxLStNq","EfvZzuvUDG","C3rVCcbPBw0","t0ziCfa","x3nVy2TLDa","D0LKwwW","z0XSyuO","CMvUDevUzha","uM9pyvG","zu1UrgO","x2LZtwLUAvq","rxP2Exq","zMzKs2O","wfDJt0O","zv9ZDwnJzxm","zwjKq0C","BLrSwwy","vgLTzw91Da","s1rZBLq","x2n1CNnVCK0","B1D1CM0","ChjVDg9JB2W","CgrNz0e","Bg9IywXty28","s1Hgv2C","v1jdA1m","yu1JvM0","Bg9Nsurhzw4","t3LOwe4","z2v0qwXS","Eg1LDgS","EMLfCva","zMLUza","s1flueO","q2vuDLG","zNjYAuW","D2vfAvu","AxjPsxq","qLr2B3i","BKXlAwu","y01RvKi","yxL1v1u","t3bLBKv2zw4","z2jwrxy","CgfNzxnOB3C","sw1uDK0","zgvMAw5Luhi","x2nSzwfYvgK","y3vYDMfSDwu","zhvRqxy","B25Mzhy","lcbTyxGGCMu","Ec1TC2CTCw8","v3HXBNi","AMvJDfn0B3i","Bgn5uxa","yMDtD3e","sLnptLa","mhWZFdD8nNW","Dgv4DfbHEwW","AwXLx25HBwu","zMzmAw5L","zgDNANq","BMCGzMfPBgu","Aw5Lza","yw5Nzq","vMTuz0m","zM9YrwfJAa","x2LZtM9Kzq","zxjFAxnFywm","CM9YrxzLBNq","CNfOqNa","DhLUExq","rhDVv1i","rM5Lrxq","y29UBMvJDca","Dvn2qLO","ywnR","thHmswq","BMfTzq","se5JDfK","B25mAw5L","EujoA2C","ruXYy1m","q3vZDg9Trxi","DxbKyxrLq3u","B0XIthq","BwvZC2fNzv8","ywnRDxbfBMq","yMzbyM0","wevxzgS","uwTvvwu","yxnZAwDU","qxnSy2O","vuLTD1O","mxWZ","DvbNwMW","DgvmB2Djre4","D29OEgO","yxrLq291BNq","AxnAzxjV","qNjyuuq","B0Xlu3u","Exb6rhy","rKPdtxK","rMT1txK","yw1L","uw5SuwO","r2LzyMi","CgLUz0XVC3m","wvnbug8","yw1Jvxi","C3vJy2vZCW","igfYCMf5yNu","x3jLywr5q2W","Dw5ZAwDUzwq","zfvYvhC","CeHouNi","AxfzC3e","uMzfq2q","EvfUu2G","m3WY","vuzUrhe","Cvb1rLa","CM92AwrLihy","BNrLCG","ign1CNnVCIa","yMLUyxj5vhK","DhLWzq","zxHWB3j0CW","wvf5ze8","qNjwAfi","Cgf5Bg9Hzfq","te9kquS","vhHlC3y","quDjBgK","x3vYBa","swHlwKO","x2zVCM1HDeu","C2fxwMu","x3bPBMC","BezSDxnO","Cfjlt1e","Bhn3Dg0","yxbWBhK","BMfAy3e","wfD0tgS","x2vUzhbVAw4","AenSB3nLrxy","z2v0sxrLBq","C3rYAw5NAwy","D01VBM8","zxH0ugf5Bg8","B1vmrMK","qKHPrNC","Dg9dq1K","B25SAw5L","s1LWsxa","vwLlthy","BhrPCgXLihq","twDUwKu","uxrnA0q","qNPlDhG","AwXK","Ag52rNe","q291BNq","AwDHDg9Yt24","x2HHBMrSzu8","vuv4ve0","x3jLBw92zvC","C3PIuvq","ywrKt25L","uwjMA3C","Aw5N","zw5JB2rLrNi","m3W0Fdj8mxW","q1jnvLG","yw15qLa","BMCGDxjSoIa","BeTXEgS","Egz4zLy","DhbizwfKzxi","DxjS","tw9KDwXL","v3HszfO","B3v0sw50zxi","s1j6r0C","CLPQvwq","sNfKCfe","z0HWsuO","yM9KEq","BKfmue4","ChLmEMe","vKr5zhK","ywDLu2HVDW","De1pD08","quXm","shvlCuC","igXHCMDLCIa","EfrxzMu","B25LCNjVCG","yLLgzMy","vffyCum","q0fUrgi","DgvZDa","yuvnEfe","q0Xpu0LorW","D0zPsMS","rNHcDwe","ywX3yxLZ","zxjYtxnN","uufUCNi","sMTKAM0","DgLUzYbZzxi","Dg9cExrLC0i","D2LSBfjLy28","tLrkDxq","zLHHC2W","seTTtg0","zK1MAK0","CeDIu00","AurAtfK","CNvYEvG","BM5eBKC","zwnVBM5Ly3q","DhnNAwC","ugLerwq","Ee1TBhi","Bwneqxa","zhzpvMi","y29UC3rYDwm","tuvtu0fhrv8","z2v0s2v5","AMziz1a","CMvZB2X2zq","CgXdCfO","BNnWufO","uNjkEve","tufyx1jfvfi","A2v5","zNjVBunOyxi","veruvKm","DMfKD1K","Efrurw52","y2vZC0HHBMq","Dg9cExrLCW","BeT3yMC","t3vizuC","twvZC2fNzuu","AwrI","CNjVCK1LC3m","C1n0v24","BePZDhe","uLjbrwO","wvnAEK0","rLndzvi","v015yvi","pxv0zI04","D2vI","BMDLza","Bu1gthe","ELPdyxe","m3WYFdf8mhW","CgXLyxnLiha","y3fuDxe","t0zmyNO","mhWYFdr8nxW","vxLVCKy","EgXxuNq","ywrKq291BNq","vMnTs0y","BMnVzgLUzW","B2nRzxrgywK","zwn0","y29UBMvJDfm","CIb0DhDjra","Aw9Ul2PZB24","B25TzxnZywC","zgvSzxrLrge","wMHVweK","B3jRig9MzMW","B25pCgvU","DwnlueS","CNnVCL92ywW","q3HPsu0","CNfRvfK","zgvIDwC","z2vrDwv1zuW","yMfSrxzLBNq","ihrYEsbYzwm","CvvPu0e","Dhj1y3rVCIa","y09Wzw4","qKfpA1C","sfjiCMu","Dw5KzwzPBMu","ChPNrNG","qxLbwvC","x2nYzwf0zvm","igzHAwWSig0","A2v5CW","x2nVBM5Ly3q","qMH3y0K","ywDLrxzLBNq","ELbbwLG","CfHxB3O","CMvZzxrfBMq","B2LUDfjLywm","ChHit0G","C2fNzq","uuvkEvu","ChbL","yxbWBgLJyxq","thfRuum","t1bftL9fuLi","ywnRx2nVzgu","Ae1LC3nHz2u","CMvHzhDYAxq","BvneELO","ELf4CKy","x2LUDgvYDMe","EePMqKW","uxn5rve","BxnNsuq","t3jwwgK","DNH3DgC","uLflBuK","x2DLDeLUDgu","C2v0sxrLBq","C0Hswxy","DhjHBNnHy3q","B3jL","DMvYC2LVBG","Ahr0Chm6","z3veDei","C2vYDMvYvgK","C2f0zxe","yMfAvvu","DeLK","x2rPC3bHDgm","x2rPC2nVBM4","qw1VDw50","rgDUDuW","weXNt2G","B2fK","s0jjsfe","BMrWB2LUDfq","wgnfrem","Dg9iyxnO","BMv4DcGPigm","vgfN","sMrOA3i","DeLUDgvYy2u","yvfJzey","u2zLzLu","B29UA1O","uNfHr20","vvfTy1y","quHVzui","DhjZvg4","ELvgBvu","Bg9NsurozxC","zgLZywjSzue","D0vtu3a","tu1Sz2u","yNfprwq","ywXS","A3nLCKe","D0XqwxC","thnkz0G","y29UDgv4Da","r0jirey","ChLhvLK","C2vUza","BeHHBMrSzxi","ywHKsxy","Cg93","qxfVy2K","B2nRzxrtDwm","Curfs1q","yxPJCuC","vwncvfa","u1z2ALy","v0z6ELy","u05NyKW","t21zs0m","C2v0","qNPJDgm","CNzHBa","ywDLsgLKzq","AePcugG","x19LC01Vzhu","y2HnyxHuCMK","DuHiBhu","yKDZuvi","uKLYvwG","qKDYDwy","C1PRALa","yxGGCMv0CMK","yLH1yLy","s1f6yxC","AgvKtwf4uMu","CMvJzxzPzwq","vw5Oyw5KBgu","vgXit00","ChjVy2vZCW","yxnL","zgvJB2rLzey","v01ftuO","C2vUzf9Hy2S","qNrOz0K","wvjgq20","x3bPBMDmB3m","x3jLy29UBMu","s3P5q0e","ihrPBwvZ","DenxD0G","ELvft2W","txLkEMO","z1rKvfi","BNnPBvm","BvDeuwK","zg1Zv0G","CYbHBhjLywq","u2zzzfa","qKXIqxq","ywnRtxnNswq","BMrWB2LUDca","q0fiAMe","CMvHzfvjBNq","Dgv4Dc9Qyxy","z2v0u3rVCMe","CvHrCKO","ChjVDg90Exa","z0fZsve","vK9Is0m","Cg9PBNrdB24"];return Bn=function(){return r},Bn()}var Tn;Object[S(1081)+S(1534)](H,S(1426)+"le",{value:!0})});var Ne=ie((Lh,Ki)=>{"use strict";var Ui=["nodebuffer","arraybuffer","fragments"],Hi=typeof Blob<"u";Hi&&Ui.push("blob");Ki.exports={BINARY_TYPES:Ui,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:Hi,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var qt=ie((Rh,zn)=>{"use strict";var{EMPTY_BUFFER:px}=Ne(),Lr=Buffer[Symbol.species];function mx(r,e){if(r.length===0)return px;if(r.length===1)return r[0];let i=Buffer.allocUnsafe(e),o=0;for(let c=0;c<r.length;c++){let f=r[c];i.set(f,o),o+=f.length}return o<e?new Lr(i.buffer,i.byteOffset,o):i}function ji(r,e,i,o,c){for(let f=0;f<c;f++)i[o+f]=r[f]^e[f&3]}function Gi(r,e){for(let i=0;i<r.length;i++)r[i]^=e[i&3]}function _x(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 Lr(r):ArrayBuffer.isView(r)?e=new Lr(r.buffer,r.byteOffset,r.byteLength):(e=Buffer.from(r),Rr.readOnly=!1),e}zn.exports={concat:mx,mask:ji,toArrayBuffer:_x,toBuffer:Rr,unmask:Gi};if(!process.env.WS_NO_BUFFER_UTIL)try{let r=Y("bufferutil");zn.exports.mask=function(e,i,o,c,f){f<48?ji(e,i,o,c,f):r.mask(e,i,o,c,f)},zn.exports.unmask=function(e,i){e.length<32?Gi(e,i):r.unmask(e,i)}}catch{}});var Yi=ie((Nh,Ji)=>{"use strict";var Wi=Symbol("kDone"),Nr=Symbol("kRun"),Or=class{constructor(e){this[Wi]=()=>{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[Wi])}}};Ji.exports=Or});var wt=ie((Oh,Qi)=>{"use strict";var Ft=Y("zlib"),Vi=qt(),yx=Yi(),{kStatusCode:$i}=Ne(),bx=Buffer[Symbol.species],vx=Buffer.from([0,0,255,255]),Fn=Symbol("permessage-deflate"),Oe=Symbol("total-length"),pt=Symbol("callback"),Ge=Symbol("buffers"),mt=Symbol("error"),qn,Mr=class{constructor(e){if(this._options=e||{},this._threshold=this._options.threshold!==void 0?this._options.threshold:1024,this._maxPayload=this._options.maxPayload|0,this._isServer=!!this._options.isServer,this._deflate=null,this._inflate=null,this.params=null,!qn){let i=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;qn=new yx(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[pt];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 f=+c;if(!Number.isInteger(f)||f<8||f>15)throw new TypeError(`Invalid value for parameter "${o}": ${c}`);c=f}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${o}": ${c}`)}else if(o==="server_max_window_bits"){let f=+c;if(!Number.isInteger(f)||f<8||f>15)throw new TypeError(`Invalid value for parameter "${o}": ${c}`);c=f}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){qn.add(c=>{this._decompress(e,i,(f,u)=>{c(),o(f,u)})})}compress(e,i,o){qn.add(c=>{this._compress(e,i,(f,u)=>{c(),o(f,u)})})}_decompress(e,i,o){let c=this._isServer?"client":"server";if(!this._inflate){let f=`${c}_max_window_bits`,u=typeof this.params[f]!="number"?Ft.Z_DEFAULT_WINDOWBITS:this.params[f];this._inflate=Ft.createInflateRaw({...this._options.zlibInflateOptions,windowBits:u}),this._inflate[Fn]=this,this._inflate[Oe]=0,this._inflate[Ge]=[],this._inflate.on("error",Ex),this._inflate.on("data",Xi)}this._inflate[pt]=o,this._inflate.write(e),i&&this._inflate.write(vx),this._inflate.flush(()=>{let f=this._inflate[mt];if(f){this._inflate.close(),this._inflate=null,o(f);return}let u=Vi.concat(this._inflate[Ge],this._inflate[Oe]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[Oe]=0,this._inflate[Ge]=[],i&&this.params[`${c}_no_context_takeover`]&&this._inflate.reset()),o(null,u)})}_compress(e,i,o){let c=this._isServer?"server":"client";if(!this._deflate){let f=`${c}_max_window_bits`,u=typeof this.params[f]!="number"?Ft.Z_DEFAULT_WINDOWBITS:this.params[f];this._deflate=Ft.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:u}),this._deflate[Oe]=0,this._deflate[Ge]=[],this._deflate.on("data",Sx)}this._deflate[pt]=o,this._deflate.write(e),this._deflate.flush(Ft.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let f=Vi.concat(this._deflate[Ge],this._deflate[Oe]);i&&(f=new bx(f.buffer,f.byteOffset,f.length-4)),this._deflate[pt]=null,this._deflate[Oe]=0,this._deflate[Ge]=[],i&&this.params[`${c}_no_context_takeover`]&&this._deflate.reset(),o(null,f)})}};Qi.exports=Mr;function Sx(r){this[Ge].push(r),this[Oe]+=r.length}function Xi(r){if(this[Oe]+=r.length,this[Fn]._maxPayload<1||this[Oe]<=this[Fn]._maxPayload){this[Ge].push(r);return}this[mt]=new RangeError("Max payload size exceeded"),this[mt].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[mt][$i]=1009,this.removeListener("data",Xi),this.reset()}function Ex(r){if(this[Fn]._inflate=null,this[mt]){this[pt](this[mt]);return}r[$i]=1007,this[pt](r)}});var _t=ie((Mh,Un)=>{"use strict";var{isUtf8:Zi}=Y("buffer"),{hasBlob:Cx}=Ne(),Ax=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function kx(r){return r>=1e3&&r<=1014&&r!==1004&&r!==1005&&r!==1006||r>=3e3&&r<=4999}function Br(r){let e=r.length,i=0;for(;i<e;)if((r[i]&128)===0)i++;else if((r[i]&224)===192){if(i+1===e||(r[i+1]&192)!==128||(r[i]&254)===192)return!1;i+=2}else if((r[i]&240)===224){if(i+2>=e||(r[i+1]&192)!==128||(r[i+2]&192)!==128||r[i]===224&&(r[i+1]&224)===128||r[i]===237&&(r[i+1]&224)===160)return!1;i+=3}else if((r[i]&248)===240){if(i+3>=e||(r[i+1]&192)!==128||(r[i+2]&192)!==128||(r[i+3]&192)!==128||r[i]===240&&(r[i+1]&240)===128||r[i]===244&&r[i+1]>143||r[i]>244)return!1;i+=4}else return!1;return!0}function Px(r){return Cx&&typeof r=="object"&&typeof r.arrayBuffer=="function"&&typeof r.type=="string"&&typeof r.stream=="function"&&(r[Symbol.toStringTag]==="Blob"||r[Symbol.toStringTag]==="File")}Un.exports={isBlob:Px,isValidStatusCode:kx,isValidUTF8:Br,tokenChars:Ax};if(Zi)Un.exports.isValidUTF8=function(r){return r.length<24?Br(r):Zi(r)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let r=Y("utf-8-validate");Un.exports.isValidUTF8=function(e){return e.length<32?Br(e):r(e)}}catch{}});var Hr=ie((Bh,oo)=>{"use strict";var{Writable:Ix}=Y("stream"),eo=wt(),{BINARY_TYPES:Dx,EMPTY_BUFFER:to,kStatusCode:Tx,kWebSocket:Lx}=Ne(),{concat:zr,toArrayBuffer:Rx,unmask:Nx}=qt(),{isValidStatusCode:Ox,isValidUTF8:no}=_t(),Hn=Buffer[Symbol.species],ue=0,ro=1,so=2,io=3,qr=4,Fr=5,Kn=6,Ur=class extends Ix{constructor(e={}){super(),this._allowSynchronousEvents=e.allowSynchronousEvents!==void 0?e.allowSynchronousEvents:!0,this._binaryType=e.binaryType||Dx[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxPayload=e.maxPayload|0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[Lx]=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=ue}_write(e,i,o){if(this._opcode===8&&this._state==ue)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 Hn(o.buffer,o.byteOffset+e,o.length-e),new Hn(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 Hn(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 ue:this.getInfo(e);break;case ro:this.getPayloadLength16(e);break;case so:this.getPayloadLength64(e);break;case io:this.getMask();break;case qr:this.getData(e);break;case Fr:case Kn: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[eo.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=ro:this._payloadLength===127?this._state=so: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=io:this._state=qr}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=qr}getData(e){let i=to;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}i=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0&&Nx(i,this._mask)}if(this._opcode>7){this.controlMessage(i,e);return}if(this._compressed){this._state=Fr,this.decompress(i,e);return}i.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(i)),this.dataMessage(e)}decompress(e,i){this._extensions[eo.extensionName].decompress(e,this._fin,(c,f)=>{if(c)return i(c);if(f.length){if(this._messageLength+=f.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let u=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");i(u);return}this._fragments.push(f)}this.dataMessage(i),this._state===ue&&this.startLoop(i)})}dataMessage(e){if(!this._fin){this._state=ue;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=zr(o,i):this._binaryType==="arraybuffer"?c=Rx(zr(o,i)):this._binaryType==="blob"?c=new Blob(o):c=o,this._allowSynchronousEvents?(this.emit("message",c,!0),this._state=ue):(this._state=Kn,setImmediate(()=>{this.emit("message",c,!0),this._state=ue,this.startLoop(e)}))}else{let c=zr(o,i);if(!this._skipUTF8Validation&&!no(c)){let f=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");e(f);return}this._state===Fr||this._allowSynchronousEvents?(this.emit("message",c,!1),this._state=ue):(this._state=Kn,setImmediate(()=>{this.emit("message",c,!1),this._state=ue,this.startLoop(e)}))}}controlMessage(e,i){if(this._opcode===8){if(e.length===0)this._loop=!1,this.emit("conclude",1005,to),this.end();else{let o=e.readUInt16BE(0);if(!Ox(o)){let f=this.createError(RangeError,`invalid status code ${o}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");i(f);return}let c=new Hn(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!no(c)){let f=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");i(f);return}this._loop=!1,this.emit("conclude",o,c),this.end()}this._state=ue;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?"ping":"pong",e),this._state=ue):(this._state=Kn,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",e),this._state=ue,this.startLoop(i)}))}createError(e,i,o,c,f){this._loop=!1,this._errored=!0;let u=new e(o?`Invalid WebSocket frame: ${i}`:i);return Error.captureStackTrace(u,this.createError),u.code=f,u[Tx]=c,u}};oo.exports=Ur});var Gr=ie((qh,xo)=>{"use strict";var{Duplex:zh}=Y("stream"),{randomFillSync:Mx}=Y("crypto"),ao=wt(),{EMPTY_BUFFER:Bx,kWebSocket:zx,NOOP:qx}=Ne(),{isBlob:yt,isValidStatusCode:Fx}=_t(),{mask:co,toBuffer:Qe}=qt(),de=Symbol("kByteLength"),Ux=Buffer.alloc(4),jn=8*1024,Ze,bt=jn,me=0,Hx=1,Kx=2,Kr=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=me,this.onerror=qx,this[zx]=void 0}static frame(e,i){let o,c=!1,f=2,u=!1;i.mask&&(o=i.maskBuffer||Ux,i.generateMask?i.generateMask(o):(bt===jn&&(Ze===void 0&&(Ze=Buffer.alloc(jn)),Mx(Ze,0,jn),bt=0),o[0]=Ze[bt++],o[1]=Ze[bt++],o[2]=Ze[bt++],o[3]=Ze[bt++]),u=(o[0]|o[1]|o[2]|o[3])===0,f=6);let h;typeof e=="string"?(!i.mask||u)&&i[de]!==void 0?h=i[de]:(e=Buffer.from(e),h=e.length):(h=e.length,c=i.mask&&i.readOnly&&!u);let m=h;h>=65536?(f+=8,m=127):h>125&&(f+=2,m=126);let w=Buffer.allocUnsafe(c?h+f:f);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[f-4]=o[0],w[f-3]=o[1],w[f-2]=o[2],w[f-1]=o[3],u?[w,e]:c?(co(e,o,w,f,h),[w]):(co(e,o,e,0,h),[w,e])):[w,e]}close(e,i,o,c){let f;if(e===void 0)f=Bx;else{if(typeof e!="number"||!Fx(e))throw new TypeError("First argument must be a valid error code number");if(i===void 0||!i.length)f=Buffer.allocUnsafe(2),f.writeUInt16BE(e,0);else{let h=Buffer.byteLength(i);if(h>123)throw new RangeError("The message must not be greater than 123 bytes");f=Buffer.allocUnsafe(2+h),f.writeUInt16BE(e,0),typeof i=="string"?f.write(i,2):f.set(i,2)}}let u={[de]:f.length,fin:!0,generateMask:this._generateMask,mask:o,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state!==me?this.enqueue([this.dispatch,f,!1,u,c]):this.sendFrame(r.frame(f,u),c)}ping(e,i,o){let c,f;if(typeof e=="string"?(c=Buffer.byteLength(e),f=!1):yt(e)?(c=e.size,f=!1):(e=Qe(e),c=e.length,f=Qe.readOnly),c>125)throw new RangeError("The data size must not be greater than 125 bytes");let u={[de]:c,fin:!0,generateMask:this._generateMask,mask:i,maskBuffer:this._maskBuffer,opcode:9,readOnly:f,rsv1:!1};yt(e)?this._state!==me?this.enqueue([this.getBlobData,e,!1,u,o]):this.getBlobData(e,!1,u,o):this._state!==me?this.enqueue([this.dispatch,e,!1,u,o]):this.sendFrame(r.frame(e,u),o)}pong(e,i,o){let c,f;if(typeof e=="string"?(c=Buffer.byteLength(e),f=!1):yt(e)?(c=e.size,f=!1):(e=Qe(e),c=e.length,f=Qe.readOnly),c>125)throw new RangeError("The data size must not be greater than 125 bytes");let u={[de]:c,fin:!0,generateMask:this._generateMask,mask:i,maskBuffer:this._maskBuffer,opcode:10,readOnly:f,rsv1:!1};yt(e)?this._state!==me?this.enqueue([this.getBlobData,e,!1,u,o]):this.getBlobData(e,!1,u,o):this._state!==me?this.enqueue([this.dispatch,e,!1,u,o]):this.sendFrame(r.frame(e,u),o)}send(e,i,o){let c=this._extensions[ao.extensionName],f=i.binary?2:1,u=i.compress,h,m;typeof e=="string"?(h=Buffer.byteLength(e),m=!1):yt(e)?(h=e.size,m=!1):(e=Qe(e),h=e.length,m=Qe.readOnly),this._firstFragment?(this._firstFragment=!1,u&&c&&c.params[c._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(u=h>=c._threshold),this._compress=u):(u=!1,f=0),i.fin&&(this._firstFragment=!0);let w={[de]:h,fin:i.fin,generateMask:this._generateMask,mask:i.mask,maskBuffer:this._maskBuffer,opcode:f,readOnly:m,rsv1:u};yt(e)?this._state!==me?this.enqueue([this.getBlobData,e,this._compress,w,o]):this.getBlobData(e,this._compress,w,o):this._state!==me?this.enqueue([this.dispatch,e,this._compress,w,o]):this.dispatch(e,this._compress,w,o)}getBlobData(e,i,o,c){this._bufferedBytes+=o[de],this._state=Kx,e.arrayBuffer().then(f=>{if(this._socket.destroyed){let h=new Error("The socket was closed while the blob was being read");process.nextTick(jr,this,h,c);return}this._bufferedBytes-=o[de];let u=Qe(f);i?this.dispatch(u,i,o,c):(this._state=me,this.sendFrame(r.frame(u,o),c),this.dequeue())}).catch(f=>{process.nextTick(jx,this,f,c)})}dispatch(e,i,o,c){if(!i){this.sendFrame(r.frame(e,o),c);return}let f=this._extensions[ao.extensionName];this._bufferedBytes+=o[de],this._state=Hx,f.compress(e,o.fin,(u,h)=>{if(this._socket.destroyed){let m=new Error("The socket was closed while data was being compressed");jr(this,m,c);return}this._bufferedBytes-=o[de],this._state=me,o.readOnly=!1,this.sendFrame(r.frame(h,o),c),this.dequeue()})}dequeue(){for(;this._state===me&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[3][de],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][de],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)}};xo.exports=Kr;function jr(r,e,i){typeof i=="function"&&i(e);for(let o=0;o<r._queue.length;o++){let c=r._queue[o],f=c[c.length-1];typeof f=="function"&&f(e)}}function jx(r,e,i){jr(r,e,i),r.onerror(e)}});var _o=ie((Fh,wo)=>{"use strict";var{kForOnEventAttribute:Ut,kListener:Wr}=Ne(),fo=Symbol("kCode"),uo=Symbol("kData"),lo=Symbol("kError"),ho=Symbol("kMessage"),go=Symbol("kReason"),vt=Symbol("kTarget"),po=Symbol("kType"),mo=Symbol("kWasClean"),Me=class{constructor(e){this[vt]=null,this[po]=e}get target(){return this[vt]}get type(){return this[po]}};Object.defineProperty(Me.prototype,"target",{enumerable:!0});Object.defineProperty(Me.prototype,"type",{enumerable:!0});var et=class extends Me{constructor(e,i={}){super(e),this[fo]=i.code===void 0?0:i.code,this[go]=i.reason===void 0?"":i.reason,this[mo]=i.wasClean===void 0?!1:i.wasClean}get code(){return this[fo]}get reason(){return this[go]}get wasClean(){return this[mo]}};Object.defineProperty(et.prototype,"code",{enumerable:!0});Object.defineProperty(et.prototype,"reason",{enumerable:!0});Object.defineProperty(et.prototype,"wasClean",{enumerable:!0});var St=class extends Me{constructor(e,i={}){super(e),this[lo]=i.error===void 0?null:i.error,this[ho]=i.message===void 0?"":i.message}get error(){return this[lo]}get message(){return this[ho]}};Object.defineProperty(St.prototype,"error",{enumerable:!0});Object.defineProperty(St.prototype,"message",{enumerable:!0});var Ht=class extends Me{constructor(e,i={}){super(e),this[uo]=i.data===void 0?null:i.data}get data(){return this[uo]}};Object.defineProperty(Ht.prototype,"data",{enumerable:!0});var Gx={addEventListener(r,e,i={}){for(let c of this.listeners(r))if(!i[Ut]&&c[Wr]===e&&!c[Ut])return;let o;if(r==="message")o=function(f,u){let h=new Ht("message",{data:u?f:f.toString()});h[vt]=this,Gn(e,this,h)};else if(r==="close")o=function(f,u){let h=new et("close",{code:f,reason:u.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});h[vt]=this,Gn(e,this,h)};else if(r==="error")o=function(f){let u=new St("error",{error:f,message:f.message});u[vt]=this,Gn(e,this,u)};else if(r==="open")o=function(){let f=new Me("open");f[vt]=this,Gn(e,this,f)};else return;o[Ut]=!!i[Ut],o[Wr]=e,i.once?this.once(r,o):this.on(r,o)},removeEventListener(r,e){for(let i of this.listeners(r))if(i[Wr]===e&&!i[Ut]){this.removeListener(r,i);break}}};wo.exports={CloseEvent:et,ErrorEvent:St,Event:Me,EventTarget:Gx,MessageEvent:Ht};function Gn(r,e,i){typeof r=="object"&&r.handleEvent?r.handleEvent.call(r,i):r.call(e,i)}});var Wn=ie((Uh,yo)=>{"use strict";var{tokenChars:Kt}=_t();function Ce(r,e,i){r[e]===void 0?r[e]=[i]:r[e].push(i)}function Wx(r){let e=Object.create(null),i=Object.create(null),o=!1,c=!1,f=!1,u,h,m=-1,w=-1,y=-1,_=0;for(;_<r.length;_++)if(w=r.charCodeAt(_),u===void 0)if(y===-1&&Kt[w]===1)m===-1&&(m=_);else if(_!==0&&(w===32||w===9))y===-1&&m!==-1&&(y=_);else if(w===59||w===44){if(m===-1)throw new SyntaxError(`Unexpected character at index ${_}`);y===-1&&(y=_);let A=r.slice(m,y);w===44?(Ce(e,A,i),i=Object.create(null)):u=A,m=y=-1}else throw new SyntaxError(`Unexpected character at index ${_}`);else if(h===void 0)if(y===-1&&Kt[w]===1)m===-1&&(m=_);else if(w===32||w===9)y===-1&&m!==-1&&(y=_);else if(w===59||w===44){if(m===-1)throw new SyntaxError(`Unexpected character at index ${_}`);y===-1&&(y=_),Ce(i,r.slice(m,y),!0),w===44&&(Ce(e,u,i),i=Object.create(null),u=void 0),m=y=-1}else if(w===61&&m!==-1&&y===-1)h=r.slice(m,_),m=y=-1;else throw new SyntaxError(`Unexpected character at index ${_}`);else if(c){if(Kt[w]!==1)throw new SyntaxError(`Unexpected character at index ${_}`);m===-1?m=_:o||(o=!0),c=!1}else if(f)if(Kt[w]===1)m===-1&&(m=_);else if(w===34&&m!==-1)f=!1,y=_;else if(w===92)c=!0;else throw new SyntaxError(`Unexpected character at index ${_}`);else if(w===34&&r.charCodeAt(_-1)===61)f=!0;else if(y===-1&&Kt[w]===1)m===-1&&(m=_);else if(m!==-1&&(w===32||w===9))y===-1&&(y=_);else if(w===59||w===44){if(m===-1)throw new SyntaxError(`Unexpected character at index ${_}`);y===-1&&(y=_);let A=r.slice(m,y);o&&(A=A.replace(/\\/g,""),o=!1),Ce(i,h,A),w===44&&(Ce(e,u,i),i=Object.create(null),u=void 0),h=void 0,m=y=-1}else throw new SyntaxError(`Unexpected character at index ${_}`);if(m===-1||f||w===32||w===9)throw new SyntaxError("Unexpected end of input");y===-1&&(y=_);let E=r.slice(m,y);return u===void 0?Ce(e,E,i):(h===void 0?Ce(i,E,!0):o?Ce(i,h,E.replace(/\\/g,"")):Ce(i,h,E),Ce(e,u,i)),e}function Jx(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 f=o[c];return Array.isArray(f)||(f=[f]),f.map(u=>u===!0?c:`${c}=${u}`).join("; ")})).join("; ")).join(", ")}).join(", ")}yo.exports={format:Jx,parse:Wx}});var $n=ie((jh,Lo)=>{"use strict";var Yx=Y("events"),Vx=Y("https"),$x=Y("http"),So=Y("net"),Xx=Y("tls"),{randomBytes:Qx,createHash:Zx}=Y("crypto"),{Duplex:Hh,Readable:Kh}=Y("stream"),{URL:Jr}=Y("url"),We=wt(),ef=Hr(),tf=Gr(),{isBlob:nf}=_t(),{BINARY_TYPES:bo,CLOSE_TIMEOUT:rf,EMPTY_BUFFER:Jn,GUID:sf,kForOnEventAttribute:Yr,kListener:of,kStatusCode:af,kWebSocket:X,NOOP:Eo}=Ne(),{EventTarget:{addEventListener:cf,removeEventListener:xf}}=_o(),{format:ff,parse:uf}=Wn(),{toBuffer:df}=qt(),Co=Symbol("kAborted"),Vr=[8,13],Be=["CONNECTING","OPEN","CLOSING","CLOSED"],lf=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,K=class r extends Yx{constructor(e,i,o){super(),this._binaryType=bo[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=Jn,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]),Ao(this,e,i,o)):(this._autoPong=o.autoPong,this._closeTimeout=o.closeTimeout,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(e){bo.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 ef({allowSynchronousEvents:o.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:o.maxPayload,skipUTF8Validation:o.skipUTF8Validation}),f=new tf(e,this._extensions,o.generateMask);this._receiver=c,this._sender=f,this._socket=e,c[X]=this,f[X]=this,e[X]=this,c.on("conclude",pf),c.on("drain",mf),c.on("error",wf),c.on("message",_f),c.on("ping",yf),c.on("pong",bf),f.onerror=vf,e.setTimeout&&e.setTimeout(0),e.setNoDelay&&e.setNoDelay(),i.length>0&&e.unshift(i),e.on("close",Io),e.on("data",Vn),e.on("end",Do),e.on("error",To),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[We.extensionName]&&this._extensions[We.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){xe(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())}),Po(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){$r(this,e,o);return}i===void 0&&(i=!this._isServer),this._sender.ping(e||Jn,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){$r(this,e,o);return}i===void 0&&(i=!this._isServer),this._sender.pong(e||Jn,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){$r(this,e,o);return}let c={binary:typeof e!="string",mask:!this._isServer,compress:!0,fin:!0,...i};this._extensions[We.extensionName]||(c.compress=!1),this._sender.send(e||Jn,c,o)}terminate(){if(this.readyState!==r.CLOSED){if(this.readyState===r.CONNECTING){xe(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:Be.indexOf("CONNECTING")});Object.defineProperty(K.prototype,"CONNECTING",{enumerable:!0,value:Be.indexOf("CONNECTING")});Object.defineProperty(K,"OPEN",{enumerable:!0,value:Be.indexOf("OPEN")});Object.defineProperty(K.prototype,"OPEN",{enumerable:!0,value:Be.indexOf("OPEN")});Object.defineProperty(K,"CLOSING",{enumerable:!0,value:Be.indexOf("CLOSING")});Object.defineProperty(K.prototype,"CLOSING",{enumerable:!0,value:Be.indexOf("CLOSING")});Object.defineProperty(K,"CLOSED",{enumerable:!0,value:Be.indexOf("CLOSED")});Object.defineProperty(K.prototype,"CLOSED",{enumerable:!0,value:Be.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[Yr])return e[of];return null},set(e){for(let i of this.listeners(r))if(i[Yr]){this.removeListener(r,i);break}typeof e=="function"&&this.addEventListener(r,e,{[Yr]:!0})}})});K.prototype.addEventListener=cf;K.prototype.removeEventListener=xf;Lo.exports=K;function Ao(r,e,i,o){let c={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:rf,protocolVersion:Vr[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,!Vr.includes(c.protocolVersion))throw new RangeError(`Unsupported protocol version: ${c.protocolVersion} (supported versions: ${Vr.join(", ")})`);let f;if(e instanceof Jr)f=e;else try{f=new Jr(e)}catch{throw new SyntaxError(`Invalid URL: ${e}`)}f.protocol==="http:"?f.protocol="ws:":f.protocol==="https:"&&(f.protocol="wss:"),r._url=f.href;let u=f.protocol==="wss:",h=f.protocol==="ws+unix:",m;if(f.protocol!=="ws:"&&!u&&!h?m=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:h&&!f.pathname?m="The URL's pathname is empty":f.hash&&(m="The URL contains a fragment identifier"),m){let T=new SyntaxError(m);if(r._redirects===0)throw T;Yn(r,T);return}let w=u?443:80,y=Qx(16).toString("base64"),_=u?Vx.request:$x.request,E=new Set,A;if(c.createConnection=c.createConnection||(u?gf:hf),c.defaultPort=c.defaultPort||w,c.port=f.port||w,c.host=f.hostname.startsWith("[")?f.hostname.slice(1,-1):f.hostname,c.headers={...c.headers,"Sec-WebSocket-Version":c.protocolVersion,"Sec-WebSocket-Key":y,Connection:"Upgrade",Upgrade:"websocket"},c.path=f.pathname+f.search,c.timeout=c.handshakeTimeout,c.perMessageDeflate&&(A=new We({...c.perMessageDeflate,isServer:!1,maxPayload:c.maxPayload}),c.headers["Sec-WebSocket-Extensions"]=ff({[We.extensionName]:A.offer()})),i.length){for(let T of i){if(typeof T!="string"||!lf.test(T)||E.has(T))throw new SyntaxError("An invalid or duplicated subprotocol was specified");E.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),(f.username||f.password)&&(c.auth=`${f.username}:${f.password}`),h){let T=c.path.split(":");c.socketPath=T[0],c.path=T[1]}let k;if(c.followRedirects){if(r._redirects===0){r._originalIpc=h,r._originalSecure=u,r._originalHostOrSocketPath=h?c.socketPath:f.host;let T=o&&o.headers;if(o={...o,headers:{}},T)for(let[q,re]of Object.entries(T))o.headers[q.toLowerCase()]=re}else if(r.listenerCount("redirect")===0){let T=h?r._originalIpc?c.socketPath===r._originalHostOrSocketPath:!1:r._originalIpc?!1:f.host===r._originalHostOrSocketPath;(!T||r._originalSecure&&!u)&&(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")),k=r._req=_(c),r._redirects&&r.emit("redirect",r.url,k)}else k=r._req=_(c);c.timeout&&k.on("timeout",()=>{xe(r,k,"Opening handshake has timed out")}),k.on("error",T=>{k===null||k[Co]||(k=r._req=null,Yn(r,T))}),k.on("response",T=>{let q=T.headers.location,re=T.statusCode;if(q&&c.followRedirects&&re>=300&&re<400){if(++r._redirects>c.maxRedirects){xe(r,k,"Maximum redirects exceeded");return}k.abort();let Z;try{Z=new Jr(q,e)}catch{let oe=new SyntaxError(`Invalid URL: ${q}`);Yn(r,oe);return}Ao(r,Z,i,o)}else r.emit("unexpected-response",k,T)||xe(r,k,`Unexpected server response: ${T.statusCode}`)}),k.on("upgrade",(T,q,re)=>{if(r.emit("upgrade",T),r.readyState!==K.CONNECTING)return;k=r._req=null;let Z=T.headers.upgrade;if(Z===void 0||Z.toLowerCase()!=="websocket"){xe(r,q,"Invalid Upgrade header");return}let we=Zx("sha1").update(y+sf).digest("base64");if(T.headers["sec-websocket-accept"]!==we){xe(r,q,"Invalid Sec-WebSocket-Accept header");return}let oe=T.headers["sec-websocket-protocol"],I;if(oe!==void 0?E.size?E.has(oe)||(I="Server sent an invalid subprotocol"):I="Server sent a subprotocol but none was requested":E.size&&(I="Server sent no subprotocol"),I){xe(r,q,I);return}oe&&(r._protocol=oe);let F=T.headers["sec-websocket-extensions"];if(F!==void 0){if(!A){xe(r,q,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let W;try{W=uf(F)}catch{xe(r,q,"Invalid Sec-WebSocket-Extensions header");return}let ee=Object.keys(W);if(ee.length!==1||ee[0]!==We.extensionName){xe(r,q,"Server indicated an extension that was not requested");return}try{A.accept(W[We.extensionName])}catch{xe(r,q,"Invalid Sec-WebSocket-Extensions header");return}r._extensions[We.extensionName]=A}r.setSocket(q,re,{allowSynchronousEvents:c.allowSynchronousEvents,generateMask:c.generateMask,maxPayload:c.maxPayload,skipUTF8Validation:c.skipUTF8Validation})}),c.finishRequest?c.finishRequest(k,r):k.end()}function Yn(r,e){r._readyState=K.CLOSING,r._errorEmitted=!0,r.emit("error",e),r.emitClose()}function hf(r){return r.path=r.socketPath,So.connect(r)}function gf(r){return r.path=void 0,!r.servername&&r.servername!==""&&(r.servername=So.isIP(r.host)?"":r.host),Xx.connect(r)}function xe(r,e,i){r._readyState=K.CLOSING;let o=new Error(i);Error.captureStackTrace(o,xe),e.setHeader?(e[Co]=!0,e.abort(),e.socket&&!e.socket.destroyed&&e.socket.destroy(),process.nextTick(Yn,r,o)):(e.destroy(o),e.once("error",r.emit.bind(r,"error")),e.once("close",r.emitClose.bind(r)))}function $r(r,e,i){if(e){let o=nf(e)?e.size:df(e).length;r._socket?r._sender._bufferedBytes+=o:r._bufferedAmount+=o}if(i){let o=new Error(`WebSocket is not open: readyState ${r.readyState} (${Be[r.readyState]})`);process.nextTick(i,o)}}function pf(r,e){let i=this[X];i._closeFrameReceived=!0,i._closeMessage=e,i._closeCode=r,i._socket[X]!==void 0&&(i._socket.removeListener("data",Vn),process.nextTick(ko,i._socket),r===1005?i.close():i.close(r,e))}function mf(){let r=this[X];r.isPaused||r._socket.resume()}function wf(r){let e=this[X];e._socket[X]!==void 0&&(e._socket.removeListener("data",Vn),process.nextTick(ko,e._socket),e.close(r[af])),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",r))}function vo(){this[X].emitClose()}function _f(r,e){this[X].emit("message",r,e)}function yf(r){let e=this[X];e._autoPong&&e.pong(r,!this._isServer,Eo),e.emit("ping",r)}function bf(r){this[X].emit("pong",r)}function ko(r){r.resume()}function vf(r){let e=this[X];e.readyState!==K.CLOSED&&(e.readyState===K.OPEN&&(e._readyState=K.CLOSING,Po(e)),this._socket.end(),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",r)))}function Po(r){r._closeTimer=setTimeout(r._socket.destroy.bind(r._socket),r._closeTimeout)}function Io(){let r=this[X];if(this.removeListener("close",Io),this.removeListener("data",Vn),this.removeListener("end",Do),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[X]=void 0,clearTimeout(r._closeTimer),r._receiver._writableState.finished||r._receiver._writableState.errorEmitted?r.emitClose():(r._receiver.on("error",vo),r._receiver.on("finish",vo))}function Vn(r){this[X]._receiver.write(r)||this.pause()}function Do(){let r=this[X];r._readyState=K.CLOSING,r._receiver.end(),this.end()}function To(){let r=this[X];this.removeListener("error",To),this.on("error",Eo),r&&(r._readyState=K.CLOSING,this.destroy())}});var Mo=ie((Wh,Oo)=>{"use strict";var Gh=$n(),{Duplex:Sf}=Y("stream");function Ro(r){r.emit("close")}function Ef(){!this.destroyed&&this._writableState.finished&&this.destroy()}function No(r){this.removeListener("error",No),this.destroy(),this.listenerCount("error")===0&&this.emit("error",r)}function Cf(r,e){let i=!0,o=new Sf({...e,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return r.on("message",function(f,u){let h=!u&&o._readableState.objectMode?f.toString():f;o.push(h)||r.pause()}),r.once("error",function(f){o.destroyed||(i=!1,o.destroy(f))}),r.once("close",function(){o.destroyed||o.push(null)}),o._destroy=function(c,f){if(r.readyState===r.CLOSED){f(c),process.nextTick(Ro,o);return}let u=!1;r.once("error",function(m){u=!0,f(m)}),r.once("close",function(){u||f(c),process.nextTick(Ro,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,f,u){if(r.readyState===r.CONNECTING){r.once("open",function(){o._write(c,f,u)});return}r.send(c,u)},o.on("end",Ef),o.on("error",No),o}Oo.exports=Cf});var Xr=ie((Jh,Bo)=>{"use strict";var{tokenChars:Af}=_t();function kf(r){let e=new Set,i=-1,o=-1,c=0;for(c;c<r.length;c++){let u=r.charCodeAt(c);if(o===-1&&Af[u]===1)i===-1&&(i=c);else if(c!==0&&(u===32||u===9))o===-1&&i!==-1&&(o=c);else if(u===44){if(i===-1)throw new SyntaxError(`Unexpected character at index ${c}`);o===-1&&(o=c);let h=r.slice(i,o);if(e.has(h))throw new SyntaxError(`The "${h}" subprotocol is duplicated`);e.add(h),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 f=r.slice(i,c);if(e.has(f))throw new SyntaxError(`The "${f}" subprotocol is duplicated`);return e.add(f),e}Bo.exports={parse:kf}});var jo=ie((Vh,Ko)=>{"use strict";var Pf=Y("events"),Xn=Y("http"),{Duplex:Yh}=Y("stream"),{createHash:If}=Y("crypto"),zo=Wn(),nt=wt(),Df=Xr(),Tf=$n(),{CLOSE_TIMEOUT:Lf,GUID:Rf,kWebSocket:Nf}=Ne(),Of=/^[+/0-9A-Za-z]{22}==$/,qo=0,Fo=1,Ho=2,Qr=class extends Pf{constructor(e,i){if(super(),e={allowSynchronousEvents:!0,autoPong:!0,maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:Lf,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:Tf,...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=Xn.createServer((o,c)=>{let f=Xn.STATUS_CODES[426];c.writeHead(426,{"Content-Length":f.length,"Content-Type":"text/plain"}),c.end(f)}),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=Mf(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(c,f,u)=>{this.handleUpgrade(c,f,u,o)}})}e.perMessageDeflate===!0&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=qo}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===Ho){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!==Fo)if(this._state=Fo,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,o,c){i.on("error",Uo);let f=e.headers["sec-websocket-key"],u=e.headers.upgrade,h=+e.headers["sec-websocket-version"];if(e.method!=="GET"){rt(this,e,i,405,"Invalid HTTP method");return}if(u===void 0||u.toLowerCase()!=="websocket"){rt(this,e,i,400,"Invalid Upgrade header");return}if(f===void 0||!Of.test(f)){rt(this,e,i,400,"Missing or invalid Sec-WebSocket-Key header");return}if(h!==13&&h!==8){rt(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 m=e.headers["sec-websocket-protocol"],w=new Set;if(m!==void 0)try{w=Df.parse(m)}catch{rt(this,e,i,400,"Invalid Sec-WebSocket-Protocol header");return}let y=e.headers["sec-websocket-extensions"],_={};if(this.options.perMessageDeflate&&y!==void 0){let E=new nt({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let A=zo.parse(y);A[nt.extensionName]&&(E.accept(A[nt.extensionName]),_[nt.extensionName]=E)}catch{rt(this,e,i,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let E={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(E,(A,k,T,q)=>{if(!A)return Gt(i,k||401,T,q);this.completeUpgrade(_,f,w,e,i,o,c)});return}if(!this.options.verifyClient(E))return Gt(i,401)}this.completeUpgrade(_,f,w,e,i,o,c)}completeUpgrade(e,i,o,c,f,u,h){if(!f.readable||!f.writable)return f.destroy();if(f[Nf])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>qo)return Gt(f,503);let w=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${If("sha1").update(i+Rf).digest("base64")}`],y=new this.options.WebSocket(null,void 0,this.options);if(o.size){let _=this.options.handleProtocols?this.options.handleProtocols(o,c):o.values().next().value;_&&(w.push(`Sec-WebSocket-Protocol: ${_}`),y._protocol=_)}if(e[nt.extensionName]){let _=e[nt.extensionName].params,E=zo.format({[nt.extensionName]:[_]});w.push(`Sec-WebSocket-Extensions: ${E}`),y._extensions=e}this.emit("headers",w,c),f.write(w.concat(`\r
|
|
12
12
|
`).join(`\r
|
|
13
|
-
`)),
|
|
14
|
-
`+Object.keys(
|
|
13
|
+
`)),f.removeListener("error",Uo),y.setSocket(f,u,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(y),y.on("close",()=>{this.clients.delete(y),this._shouldEmitClose&&!this.clients.size&&process.nextTick(jt,this)})),h(y,c)}};Ko.exports=Qr;function Mf(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 jt(r){r._state=Ho,r.emit("close")}function Uo(){this.destroy()}function Gt(r,e,i,o){i=i||Xn.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} ${Xn.STATUS_CODES[e]}\r
|
|
14
|
+
`+Object.keys(o).map(c=>`${c}: ${o[c]}`).join(`\r
|
|
15
15
|
`)+`\r
|
|
16
16
|
\r
|
|
17
|
-
`+i)}function
|
|
17
|
+
`+i)}function rt(r,e,i,o,c,f){if(r.listenerCount("wsClientError")){let u=new Error(c);Error.captureStackTrace(u,rt),r.emit("wsClientError",u,i,e)}else Gt(i,o,c,f)}});import{spawn as su}from"node:child_process";import{existsSync as iu,openSync as ou}from"node:fs";import{mkdir as au}from"node:fs/promises";import{dirname as cu}from"node:path";import{fileURLToPath as xu}from"node:url";function ts(r=j()){return iu(r.libEntry)?r.libEntry:xu(new URL("../index.ts",import.meta.url))}async function ia(r={}){let e=r.paths??j(),i=r.entryOverride??ts(e);await au(cu(e.logFile),{recursive:!0});let o=ou(e.logFile,"a"),f=i.endsWith(".ts")?["--import","tsx/esm",i,"--daemon"]:[i,"--daemon"],u=su(process.execPath,f,{detached:!0,stdio:["ignore",o,o],env:{...process.env,COZE_BRIDGE_DAEMON:"1"}});if(u.unref(),typeof u.pid!="number")throw new Error("failed to spawn daemon (no pid)");return fu.info("daemon spawned",{pid:u.pid,entry:i}),{pid:u.pid,entry:i}}var fu,ns=Ie(()=>{"use strict";U();ae();fu=L("spawn-daemon")});import{spawn as wu}from"node:child_process";import{mkdir as _u,unlink as yu,writeFile as bu}from"node:fs/promises";import{dirname as vu,join as Su}from"node:path";function rr(r){return r.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""")}function fa(r,e){return new Promise((i,o)=>{let c=wu(r,e,{stdio:["ignore","pipe","pipe"]}),f="";c.stderr?.on("data",u=>{f+=u.toString("utf8")}),c.on("error",o),c.on("close",u=>{u===0?i():o(new Error(`${r} ${e.join(" ")} exited ${u}: ${f.trim()}`))})})}var nr,is,os,ua=Ie(()=>{"use strict";U();nr=L("supervisor.launchd"),is="ai.coze.bridge",os={platform:"darwin",renderConfig(r){return`<?xml version="1.0" encoding="UTF-8"?>
|
|
18
18
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
19
19
|
<plist version="1.0">
|
|
20
20
|
<dict>
|
|
21
21
|
<key>Label</key>
|
|
22
|
-
<string>${
|
|
22
|
+
<string>${is}</string>
|
|
23
23
|
<key>ProgramArguments</key>
|
|
24
24
|
<array>
|
|
25
|
-
<string>${
|
|
26
|
-
<string>${
|
|
25
|
+
<string>${rr(r.nodeBin)}</string>
|
|
26
|
+
<string>${rr(r.entry)}</string>
|
|
27
27
|
<string>--daemon</string>
|
|
28
28
|
</array>
|
|
29
29
|
<key>RunAtLoad</key>
|
|
@@ -33,12 +33,12 @@ var i0=Object.create;var _r=Object.defineProperty;var o0=Object.getOwnPropertyDe
|
|
|
33
33
|
<key>ThrottleInterval</key>
|
|
34
34
|
<integer>10</integer>
|
|
35
35
|
<key>StandardOutPath</key>
|
|
36
|
-
<string>${
|
|
36
|
+
<string>${rr(r.logFile)}</string>
|
|
37
37
|
<key>StandardErrorPath</key>
|
|
38
|
-
<string>${
|
|
38
|
+
<string>${rr(r.logFile)}</string>
|
|
39
39
|
</dict>
|
|
40
40
|
</plist>
|
|
41
|
-
`},configPath(r){return
|
|
41
|
+
`},configPath(r){return Su(r.homeDir,"Library","LaunchAgents",`${is}.plist`)},async install(r){let e=this.configPath(r);await _u(vu(e),{recursive:!0}),await bu(e,this.renderConfig(r),"utf8"),nr.info("plist written",{plistPath:e}),await fa("launchctl",["load","-w",e]),nr.info("launchd job loaded",{label:is})},async uninstall(r){let e=this.configPath(r);await fa("launchctl",["unload","-w",e]).catch(i=>nr.warn("launchctl unload failed (ignored)",{err:String(i)})),await yu(e).catch(i=>{if(i.code!=="ENOENT")throw i}),nr.info("launchd job removed",{plistPath:e})}}});import{spawn as Eu}from"node:child_process";import{mkdir as Cu,unlink as Au,writeFile as ku}from"node:fs/promises";import{dirname as Pu,join as Iu}from"node:path";function or(r,e){return new Promise((i,o)=>{let c=Eu(r,e,{stdio:["ignore","pipe","pipe"]}),f="";c.stderr?.on("data",u=>{f+=u.toString("utf8")}),c.on("error",o),c.on("close",u=>{u===0?i():o(new Error(`${r} ${e.join(" ")} exited ${u}: ${f.trim()}`))})})}var sr,ir,as,da=Ie(()=>{"use strict";U();sr=L("supervisor.systemd"),ir="coze-bridge.service",as={platform:"linux",renderConfig(r){return`[Unit]
|
|
42
42
|
Description=Coze Bridge daemon
|
|
43
43
|
After=network.target
|
|
44
44
|
|
|
@@ -52,7 +52,7 @@ StandardError=append:${r.logFile}
|
|
|
52
52
|
|
|
53
53
|
[Install]
|
|
54
54
|
WantedBy=default.target
|
|
55
|
-
`},configPath(r){return
|
|
55
|
+
`},configPath(r){return Iu(r.homeDir,".config","systemd","user",ir)},async install(r){let e=this.configPath(r);await Cu(Pu(e),{recursive:!0}),await ku(e,this.renderConfig(r),"utf8"),sr.info("systemd unit written",{unitPath:e}),await or("systemctl",["--user","daemon-reload"]),await or("systemctl",["--user","enable","--now",ir]),sr.info("systemd unit enabled",{unitName:ir})},async uninstall(r){let e=this.configPath(r);await or("systemctl",["--user","disable","--now",ir]).catch(i=>sr.warn("systemctl disable failed (ignored)",{err:String(i)})),await Au(e).catch(i=>{if(i.code!=="ENOENT")throw i}),await or("systemctl",["--user","daemon-reload"]).catch(()=>{}),sr.info("systemd unit removed",{unitPath:e})}}});import{spawn as Du}from"node:child_process";import{join as Tu}from"node:path";function la(r,e){return new Promise((i,o)=>{let c=Du(r,e,{stdio:["ignore","pipe","pipe"],shell:!1}),f="";c.stderr?.on("data",u=>{f+=u.toString("utf8")}),c.on("error",o),c.on("close",u=>{u===0?i():o(new Error(`${r} ${e.join(" ")} exited ${u}: ${f.trim()}`))})})}var cs,ar,xs,ha=Ie(()=>{"use strict";U();cs=L("supervisor.taskscheduler"),ar="CozeBridge",xs={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
|
|
79
|
+
`},configPath(r){return Tu(r.homeDir,".coze","bridge","task.xml")},async install(r){let e=`"${r.nodeBin}" "${r.entry}" --daemon`;await la("schtasks",["/Create","/SC","ONLOGON","/TN",ar,"/TR",e,"/RU",r.userName,"/F"]),cs.info("task scheduler entry created",{task:ar})},async uninstall(r){await la("schtasks",["/Delete","/TN",ar,"/F"]).catch(e=>cs.warn("schtasks /Delete failed (ignored)",{err:String(e)})),cs.info("task scheduler entry removed",{task:ar})}}});var fs={};Os(fs,{buildContext:()=>Ou,getSupervisor:()=>Nu,launchdSupervisor:()=>os,systemdSupervisor:()=>as,taskSchedulerSupervisor:()=>xs});import{homedir as Lu,userInfo as Ru}from"node:os";function Nu(r=process.platform){switch(r){case"darwin":return os;case"linux":return as;case"win32":return xs;default:throw new Error(`unsupported platform for OS supervisor: ${r}`)}}function Ou(){let r=j();return{nodeBin:process.execPath,entry:ts(r),logFile:r.logFile,homeDir:Lu(),userName:Ru().username}}var us=Ie(()=>{"use strict";ae();ns();ua();da();ha()});Ue();U();import{readdir as D0}from"node:fs/promises";import{mkdir as C0,writeFile as A0}from"node:fs/promises";import{join as k0}from"node:path";var P0={"claude-code":"CLAUDE.md",codex:"AGENTS.md",openclaw:"SOUL.md"};async function xt(r,e,i,o){await C0(r,{recursive:!0});let c=P0[e],f=k0(r,c),u=I0(e,i,o);return await A0(f,u,"utf8"),f}function I0(r,e,i){let o=`# 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`${
|
|
86
|
+
`;return`${o}---
|
|
87
87
|
|
|
88
|
-
${c}`}var
|
|
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
|
|
91
|
-
`)[0]?.trim()||void 0}catch{return}}async function
|
|
92
|
-
`}var
|
|
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
|
|
88
|
+
${c}`}var be=L("agent-detail-sync"),sn=class{constructor(e){this.opts=e}opts;async syncAll(e){let i=this.opts.paths.agentsRoot,o;try{o=await D0(i)}catch(c){be.info("agents dir not found, skip detail sync",{root:i,err:String(c)});return}be.info("starting detail sync",{reason:e,count:o.length});for(let c of o)try{await this.syncOne(c)}catch(f){be.warn("detail sync failed for agent, skipping",{agentId:c,err:String(f)})}be.info("detail sync done",{reason:e})}async syncOne(e){let i=await ce(e,this.opts.paths);if(!i){be.info("detail sync: agent config missing, skip",{agentId:e});return}let o;try{o=await this.opts.sendDetail({_meta:{cozeAgentId:e}})}catch(u){be.warn("detail RPC failed, using local data",{agentId:e,err:String(u)});return}if(o.agentId&&o.agentId!==e){be.warn("detail response agentId mismatch, ignoring",{agentId:e,responseAgentId:o.agentId});return}let c=!1,f=!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,f=!0),o.deployType&&be.info("detail.deployType",{agentId:e,deployType:o.deployType}),!c){be.debug("detail sync: no diff",{agentId:e});return}await pe(i,this.opts.paths),be.info("detail sync: config updated",{agentId:e,identityChanged:f,agentName:i.agentName}),f&&(await xt(i.workspace,i.framework,e,i.cozeIdentity),await this.opts.handlers.reloadAgentSessionsPublic(e,"detail-sync"))}};Ue();import{spawn as ii}from"node:child_process";import{lstat as Ar,mkdir as N0,readFile as oi,readdir as O0,rm as M0,stat as B0,writeFile as z0}from"node:fs/promises";import{join as Re,normalize as q0,relative as ai,resolve as F0,sep as ci}from"node:path";var ve={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 It(r){return r?.cozeDeployType==="cloud"?"cloud":"local"}function Hs(r){let{_meta:e,...i}=r;return{stripped:i,meta:e}}function ft(r){if(!r?.cozeAgentId)throw new Error("missing _meta.cozeAgentId");return r.cozeAgentId}var C=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();ae();function Le(r,e){if(It(r)!=="cloud")throw new C("OPERATION_NOT_ALLOWED_FOR_LOCAL",`${e} is not allowed for local agent`)}function Dt(r){return r.replace(/[^A-Za-z0-9._-]+/g,"-")}U();var on="1008033",Ks="1289";var js="pbbp2",Gs="https://www.coze.cn",Ws="/api/coze_claw/resource/get_frontier_key",T0="https://www.coze.cn",L0="wss://frontier.coze.cn";function Js(r){return r??process.env.COZE_BRIDGE_HANDSHAKE_URL??T0}function Ys(r){return r??process.env.COZE_BRIDGE_FRONTIER_URL??L0}function an(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 cn(r){return r?r.startsWith("boe_")?{ttEnv:r}:{ttEnv:r,usePpe:"1"}:{}}var Vs=L("handshake");async function $s(r){let e=Js(r.endpoint),i=r.timeoutMs??1e4,o=`${R0(e)}${Ws}?aid=${encodeURIComponent(on)}`,c={Authorization:`Bearer ${r.privatecode}`,Accept:"application/json",...an(r.ppeOverride)},f=new AbortController,u=setTimeout(()=>f.abort(),i);Vs.info("frontier key handshake",{base:e});try{let h=await fetch(o,{method:"GET",headers:c,signal:f.signal}),m=h.headers.get("x-tt-logid")??"",w=h.headers.get("x-tt-trace-id")??"";if(!h.ok){let A=await h.text().catch(()=>"");throw new C("UPSTREAM_HANDSHAKE_FAILED",`handshake HTTP ${h.status} logid=${m}: ${A.slice(0,200)}`)}let y=await h.json();if(y.code!==void 0&&y.code!==0)throw new C("UPSTREAM_HANDSHAKE_FAILED",`handshake code=${y.code} msg=${y.msg??"-"} logid=${m}`);let _=y.data?.access_key,E=y.data?.device_id;if(!_||!E)throw new C("UPSTREAM_HANDSHAKE_FAILED",`handshake response missing access_key/device_id logid=${m}: ${JSON.stringify(y)}`);return Vs.info("handshake ok",{remoteDeviceId:E,logid:m,traceId:w}),{accessKey:_,deviceId:E}}catch(h){throw h instanceof C?h:h.name==="AbortError"?new C("UPSTREAM_HANDSHAKE_FAILED",`handshake timeout (${i}ms)`):new C("UPSTREAM_HANDSHAKE_FAILED",String(h),{cause:h})}finally{clearTimeout(u)}}function R0(r){return r.endsWith("/")?r.slice(0,-1):r}var Sr="https://llm-gateway.coze.cn",He="auto";function Xs(r){return{model:r.model??He,...r.modelToken?{modelToken:r.modelToken}:{}}}function Tt(r){return!r||r===He}function Qs(r){let e={};return r.modelToken?(e.ANTHROPIC_BASE_URL=Sr,e.ANTHROPIC_AUTH_TOKEN=r.modelToken,e.ANTHROPIC_MODEL=r.model||He):Tt(r.model)||(e.ANTHROPIC_MODEL=r.model),e}function Zs(r){let e=[];return r.modelToken?e.push("-c",`model="${r.model||He}"`):Tt(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="${Sr}/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 ei(r){return r.modelToken?{OPENAI_API_KEY:r.modelToken}:{}}function Er(r){let{ttEnv:e,usePpe:i}=cn(r),o={};return e&&(o["x-tt-env"]=e),i&&(o["x-use-ppe"]=i),o}function ti(r,e){if(!r.modelToken)return{};let i=Er(e);return Object.keys(i).length===0?{}:{ANTHROPIC_CUSTOM_HEADERS:Object.entries(i).map(([c,f])=>`${c}:${f}`).join(`
|
|
89
|
+
`)}}function Cr(r){return`coze-session-${r.replace(/[^A-Za-z0-9_-]+/g,"-")}`}function ni(r,e){if(!r.modelToken||Tt(r.model))return null;let i=Er(e),o={baseUrl:`${Sr}/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 ri(r,e){if(!r.modelToken)return[];let i=Er(e),o=[];for(let[c,f]of Object.entries(i))o.push("-c",`model_providers.coze.http_headers.${c}="${f}"`);return o}var ne=L("agent-handlers"),si=5*1024*1024,U0=1,H0=6,K0=new Set(["node_modules",".git",".coze","dist","build",".next"]),fn=class{constructor(e){this.opts=e}opts;async listSkills(e){Le(e._meta,"_agent/listSkills");let i=ft(e._meta),o=await this.loadAgentCfg(i),c=o?.workspace??Te(i).workspace,f=o?.skills??[],u=[];for(let h of f){let m=Re(c,h.relPath,"SKILL.md");await B0(m).then(y=>y.isFile()).catch(()=>!1)&&u.push({skillId:h.skillId,skillName:h.skillName,downloadUrl:h.downloadUrl??"",...h.description?{description:h.description}:{},...h.version?{version:h.version}:{}})}return{skills:u}}async addSkills(e){Le(e._meta,"_agent/addSkills");let i=ft(e._meta),o=await this.requireAgentCfg(i),c=e.skills??[],f=[...o.skills??[]],u=new Map(f.map((m,w)=>[m.skillId,w])),h=[];for(let m of c){if(!m.skillName)throw new C("IPC_BAD_REQUEST","skill missing skillName");let w=j0(m.skillName),y=G0(o.framework),_=Re(y,w),E=Re(o.workspace,_);await N0(E,{recursive:!0});let A=await Y0(m.downloadUrl);$0(A)?await X0(A,E):await z0(Re(E,"SKILL.md"),A.toString("utf8"),"utf8");let k={skillId:m.skillId,skillName:m.skillName,relPath:_,installedAt:Date.now(),...m.description?{description:m.description}:{},...m.version?{version:m.version}:{},...m.downloadUrl?{downloadUrl:m.downloadUrl}:{}},T=u.get(m.skillId);T!==void 0?f[T]=k:(u.set(m.skillId,f.length),f.push(k)),h.push(m),ne.info("skill installed",{agentId:i,skillId:m.skillId,skillName:m.skillName,relPath:_})}return await nn(i,f),await this.reloadAgentSessions(i,"skills-added"),{installedSkills:h}}async removeSkills(e){Le(e._meta,"_agent/removeSkills");let i=ft(e._meta),o=await this.requireAgentCfg(i),c=new Set(e.skillIds??[]),f=o.skills??[],u=[];for(let h of f){if(!c.has(h.skillId)){u.push(h);continue}let m=Re(o.workspace,h.relPath);await M0(m,{recursive:!0,force:!0}),ne.info("skill removed",{agentId:i,skillId:h.skillId,relPath:h.relPath})}return await nn(i,u),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,f]of o.sessions)if(!(!f.downstream||!f.acpSessionId)){f.loadingSession=!0;try{await f.downstream.sessionLoad({sessionId:f.acpSessionId,cwd:o.workspace}),ne.info("session reloaded",{reason:i,agentId:e,framework:o.framework,cloudId:c,acpId:f.acpSessionId})}catch(u){ne.warn("session reload failed",{reason:i,agentId:e,framework:o.framework,cloudId:c,acpId:f.acpSessionId,err:String(u)})}finally{f.loadingSession=!1}}}}async updateAgent(e){if(!e.cozeIdentity?.trim())return ne.info("_agent/update: empty cozeIdentity, noop",{agentId:e.agentId}),{ok:!0};let i=e.agentId,o=await ce(i);if(!o)throw new C("AGENT_NOT_FOUND",`agent not found: ${i}`);return o.cozeIdentity===e.cozeIdentity?(ne.info("_agent/update: cozeIdentity unchanged, noop",{agentId:i}),{ok:!0}):(o.cozeIdentity=e.cozeIdentity,await pe(o),await xt(o.workspace,o.framework,i,e.cozeIdentity),ne.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 C("IPC_BAD_REQUEST","_agent/disconnect: missing agentId");let o=await ce(i);return o?(o.disconnectedAt=Date.now(),o.disconnectReason=e.reason??"",await pe(o),ne.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}):(ne.warn("_agent/disconnect: agent not found, ignoring",{agentId:i}),{ok:!0})}async switchModel(e){if(Le(e._meta,"_agent/switchModel"),!e.agentId)throw new C("IPC_BAD_REQUEST","_agent/switchModel: missing agentId");let i=e.model?.trim()?e.model:He,o=await ce(e.agentId);if(!o)throw new C("AGENT_NOT_FOUND",`agent not found: ${e.agentId}`);o.model=i,await pe(o),ne.info("_agent/switchModel: model persisted",{agentId:e.agentId,model:i,reason:e.reason??""});let c=this.opts.agents.get(e.agentId);if(!c)return ne.info("_agent/switchModel: agent not running, config persisted only",{agentId:e.agentId}),{ok:!0};c.model=i;let f=[];for(let[u,h]of c.allSessionQueues())f.push(h.enqueue(async()=>{let m=c.sessions.get(u);m?.downstream&&(await m.downstream.stop(`switchModel: ${i}`).catch(()=>{}),m.downstream=void 0)}));return await Promise.all(f),ne.info("_agent/switchModel: all session runtimes killed, next prompt will respawn",{agentId:e.agentId,model:i,cloudSessions:f.length}),{ok:!0}}async resetAgent(e){if(Le(e._meta,ve.RESET),!e.agentId)throw new C("IPC_BAD_REQUEST",`${ve.RESET}: missing agentId`);return await this.runDetailSync(e.agentId,ve.RESET,e.reason),{ok:!0}}async repairAgent(e){if(Le(e._meta,ve.REPAIR),!e.agentId)throw new C("IPC_BAD_REQUEST",`${ve.REPAIR}: missing agentId`);let i=await this.loadAgentCfg(e.agentId);if(i&&i.framework!=="openclaw")throw new C("IPC_BAD_REQUEST",`${ve.REPAIR} only allowed for openclaw, got ${i.framework}`);if(i&&this.opts.openclawRepair)try{await this.opts.openclawRepair(e.agentId,i.workspace)}catch(o){ne.warn("openclaw repair (delete+add) failed (ignored)",{agentId:e.agentId,reason:e.reason,err:String(o)})}return await this.runDetailSync(e.agentId,ve.REPAIR,e.reason),{ok:!0}}async runDetailSync(e,i,o){if(!this.opts.detailSyncer){ne.warn("detailSyncer not wired, skipping sync",{method:i,agentId:e});return}try{await this.opts.detailSyncer(e)}catch(c){ne.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=ft(i),c=await this.resolveWorkspace(o),f=e.filePath??"",u=this.safeJoin(c,f),h=await Ar(u).catch(()=>null);if(!h)throw new C("IPC_BAD_REQUEST",`path not found: ${f}`);if(h.isSymbolicLink())throw new C("IPC_BAD_REQUEST",`symlink not allowed: ${f}`);let m=Z0(e.depth);return h.isDirectory()?{tree:await xi(c,u,f,m)}:{tree:[{name:ec(f),path:fi(f||"."),isDir:!1,size:h.size,modifiedAt:Math.floor(h.mtimeMs)}]}}async getFileContent(e){Le(e._meta,"_agent/getFileContent");let i=ft(e._meta),o=await this.resolveWorkspace(i);if(!e.filePath)throw new C("IPC_BAD_REQUEST","filePath required");let c=this.safeJoin(o,e.filePath),f=await Ar(c).catch(()=>null);if(!f||!f.isFile())throw new C("IPC_BAD_REQUEST",`not a file: ${e.filePath}`);if(f.isSymbolicLink())throw new C("IPC_BAD_REQUEST",`symlink not allowed: ${e.filePath}`);if(f.size>si)throw new C("IPC_BAD_REQUEST",`file too large: ${f.size} bytes (max ${si})`);let u=await oi(c);return u.includes(0)?{content:u.toString("base64"),encoding:"base64",size:f.size}:{content:u.toString("utf8"),encoding:"utf-8",size:f.size}}async resolveWorkspace(e){let i=this.opts.agents.get(e);return i?i.workspace:(await ce(e).catch(()=>null))?.workspace??Te(e).workspace}safeJoin(e,i){let o=F0(e,i||"."),c=ai(e,o);if(c.startsWith("..")||c===".."||c.startsWith(`..${ci}`))throw new C("IPC_BAD_REQUEST",`path escapes workspace: ${i}`);return o}loadAgentCfg(e){return ce(e)}async requireAgentCfg(e){let i=await this.loadAgentCfg(e);if(!i)throw new C("AGENT_NOT_FOUND",`no config for agent: ${e}`);return i}};function j0(r){let e=Dt(r.trim()).replace(/^-+|-+$/g,"").slice(0,64);if(!e||e==="."||e==="..")throw new C("IPC_BAD_REQUEST",`invalid skill name: ${r}`);return e}function G0(r){return r==="claude-code"?Re(".claude","skills"):Re(".agents","skills")}var W0=3e4,J0=50*1024*1024,un=3e4;async function Y0(r){if(!r)throw new C("IPC_BAD_REQUEST","skill missing downloadUrl");if(r.startsWith("data:")){let e=Math.floor(r.length*3/4);xn(e);let i=V0(r);return xn(i.length),i}if(r.startsWith("file:")){let e=new URL(r).pathname,i=await oi(e);return xn(i.length),i}if(r.startsWith("http://")||r.startsWith("https://")){let e=new AbortController,i=setTimeout(()=>e.abort(),W0);try{let o=await fetch(r,{signal:e.signal});if(!o.ok)throw new C("IPC_BAD_REQUEST",`fetch skill failed HTTP ${o.status} ${r}`);let c=await o.arrayBuffer();return xn(c.byteLength),Buffer.from(c)}finally{clearTimeout(i)}}throw new C("IPC_BAD_REQUEST",`unsupported downloadUrl scheme (\u8981 https/data/file): ${r.slice(0,80)}`)}function xn(r){if(r>J0)throw new C("IPC_BAD_REQUEST",`skill too large: ${r} bytes`)}function V0(r){let e=/^data:([^,;]*)(;base64)?,(.*)$/s.exec(r);if(!e)throw new C("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 $0(r){return r.length>=2&&r[0]===31&&r[1]===139}async function X0(r,e){await Q0(r),await new Promise((i,o)=>{let c=ii("tar",["-xzf","-","-C",e,"--strip-components=1","--no-same-owner"],{stdio:["pipe","pipe","pipe"]}),f="";c.stderr?.on("data",h=>{f+=String(h)});let u=setTimeout(()=>{c.kill("SIGKILL"),o(new C("IPC_BAD_REQUEST",`tar extract timeout (${un}ms)`))},un);c.on("error",h=>{clearTimeout(u),o(new C("IPC_BAD_REQUEST",`tar spawn failed: ${h.message}`,{cause:h}))}),c.on("exit",h=>{clearTimeout(u),h===0?i():o(new C("IPC_BAD_REQUEST",`tar exit ${h}${f?`: ${f.trim().slice(0,200)}`:""}`))}),c.stdin?.end(r)})}async function Q0(r){let e=await new Promise((i,o)=>{let c=ii("tar",["-tzvf","-"],{stdio:["pipe","pipe","pipe"]}),f="",u="";c.stdout?.on("data",m=>{f+=String(m)}),c.stderr?.on("data",m=>{u+=String(m)});let h=setTimeout(()=>{c.kill("SIGKILL"),o(new C("IPC_BAD_REQUEST",`tar list timeout (${un}ms)`))},un);c.on("error",m=>{clearTimeout(h),o(new C("IPC_BAD_REQUEST",`tar list spawn failed: ${m.message}`))}),c.on("exit",m=>{clearTimeout(h),m===0?i(f):o(new C("IPC_BAD_REQUEST",`tar list exit ${m}${u?`: ${u.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 C("IPC_BAD_REQUEST",`tar entry kind '${o[0]}' not allowed (symlink/hardlink/special): ${o.slice(0,100)}`);let u=(o.match(/\s(\S.*)$/)?.[1]??"").split(" -> ")[0]?.trim()??"";if(!u)continue;if(u.startsWith("/"))throw new C("IPC_BAD_REQUEST",`tar entry absolute path: ${u}`);if(u.split(/[/\\]/).some(m=>m===".."))throw new C("IPC_BAD_REQUEST",`tar entry contains '..': ${u}`)}}async function xi(r,e,i,o){if(o<=0)return[];let c;try{c=await O0(e,{withFileTypes:!0})}catch{return[]}let f=[];for(let u of c){if(K0.has(u.name)||u.isSymbolicLink())continue;let h=Re(e,u.name),m=q0(Re(i,u.name)),w=null;try{w=await Ar(h)}catch{continue}if(w.isSymbolicLink())continue;let y={name:u.name,path:fi(ai(r,h)),isDir:w.isDirectory(),size:w.size,modifiedAt:Math.floor(w.mtimeMs)};w.isDirectory()&&o>1&&(y.children=await xi(r,h,m,o-1)),f.push(y)}return f.sort((u,h)=>u.isDir!==h.isDir?u.isDir?-1:1:u.name.localeCompare(h.name)),f}function Z0(r){return!r||r<=0?U0:Math.min(r,H0)}function ec(r){if(!r||r==="."||r==="/")return".";let e=r.split(/[/\\]/);return e[e.length-1]||"."}function fi(r){return r.split(ci).join("/")}U();import{readFileSync as Hd}from"node:fs";import{dirname as jd,join as Gd}from"node:path";import{fileURLToPath as Jd}from"node:url";var dn="0.1.28";var Lt=L("agent-health-reporter"),tc=1e4,ln=class{constructor(e){this.opts=e;this.intervalMs=e.intervalMs??tc}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()}),Lt.info("heartbeat started",{intervalMs:this.intervalMs}),this.tick())}stop(){this.timer&&(clearInterval(this.timer),this.timer=null,this.unsubscribeRegister&&(this.unsubscribeRegister(),this.unsubscribeRegister=null),Lt.info("heartbeat stopped"))}async tick(){if(this.inFlight){Lt.debug("previous tick still in-flight, skip");return}let e=this.opts.getDeviceId();if(!e){Lt.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 f=nc(c);f&&i.push({agentId:c.agentId,status:f})}if(i.length===0)return;let o={agents:i,bridgeVersion:dn,_meta:{cozeDeviceId:e}};try{await this.opts.core.sendRequest("_agent/health",o)}catch(c){Lt.warn("heartbeat batch send failed",{count:i.length,err:String(c)})}}finally{this.inFlight=!1}}};function nc(r){return r.status==="error"?"error":r.activeTriggers.size>0?"busy":r.status==="ok"?"online":null}Ue();import{mkdir as Pr,rm as Dc}from"node:fs/promises";U();import{execFile as rc}from"node:child_process";import{promisify as sc}from"node:util";var di=sc(rc),Rt=L("agents.acp-installer"),ic={"claude-code":{npmPackage:"@agentclientprotocol/claude-agent-acp",binary:"claude-agent-acp"},codex:{npmPackage:"@zed-industries/codex-acp",binary:"codex-acp"}},oc=5e4,ac=5e3,cc=5*6e4,gn=new Map,hn=new Map,kr=new Map;async function ui(r){let e=process.platform==="win32"?"where":"which";try{let{stdout:i}=await di(e,[r],{timeout:ac});return i.split(`
|
|
91
|
+
`)[0]?.trim()||void 0}catch{return}}async function xc(r){Rt.info("npm install -g start",{npmPackage:r}),await di("npm",["install","-g",`${r}@latest`],{timeout:oc,maxBuffer:10*1024*1024}),Rt.info("npm install -g done",{npmPackage:r})}async function li(r){let e=ic[r];if(!e)return;let i=gn.get(r);if(i)return i;let o=hn.get(r);if(o&&Date.now()-o<cc)return;let c=kr.get(r);if(c)return c;let f=(async()=>{let u=await ui(e.binary);if(u)return gn.set(r,u),Rt.info("acp wrapper found on PATH",{binary:e.binary,path:u}),u;try{await xc(e.npmPackage)}catch(m){Rt.warn("acp wrapper install failed (will fallback to npx)",{npmPackage:e.npmPackage,err:String(m)}),hn.set(r,Date.now());return}let h=await ui(e.binary);if(!h){Rt.warn("acp wrapper installed but binary not found on PATH",{binary:e.binary}),hn.set(r,Date.now());return}return gn.set(r,h),hn.delete(r),h})().finally(()=>{kr.delete(r)});return kr.set(r,f),f}function pn(r){return gn.get(r)}import{spawn as hc}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 mn(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 wn=class extends Error{code;data;constructor(e){super(`JSON-RPC error code=${e.code} ${e.message}`),this.name="RemoteRpcError",this.code=e.code,e.data!==void 0&&(this.data=e.data)}},G={PARSE_ERROR:-32700,INVALID_REQUEST:-32600,METHOD_NOT_FOUND:-32601,INVALID_PARAMS:-32602,INTERNAL_ERROR:-32603,AGENT_NOT_FOUND:-32001,AGENT_BUSY:-32002,AGENT_TIMEOUT:-32003,AGENT_SPAWN_FAILED:-32004,OPERATION_NOT_ALLOWED_FOR_LOCAL:-32005,AGENT_DISCONNECTED:-32006,MODEL_TOKEN_GEN_FAILED:-32009};function hi(r){return"method"in r&&"id"in r&&r.id!==void 0}function gi(r){return"method"in r&&!("id"in r)}function _n(r){return!("method"in r)&&"id"in r}var fc={AGENT_NOT_FOUND:G.AGENT_NOT_FOUND,AGENT_BUSY:G.AGENT_BUSY,AGENT_DISCONNECTED:G.AGENT_DISCONNECTED,AGENT_TIMEOUT:G.AGENT_TIMEOUT,AGENT_SPAWN_FAILED:G.AGENT_SPAWN_FAILED,AGENT_PROTOCOL_ERROR:G.INTERNAL_ERROR,BRIDGE_CONFIG_INVALID:G.INTERNAL_ERROR,BRIDGE_INTERNAL:G.INTERNAL_ERROR,IPC_AUTH_FAILED:G.INTERNAL_ERROR,IPC_BAD_REQUEST:G.INVALID_REQUEST,MODEL_TOKEN_GEN_FAILED:G.MODEL_TOKEN_GEN_FAILED,OPERATION_NOT_ALLOWED_FOR_LOCAL:G.OPERATION_NOT_ALLOWED_FOR_LOCAL,UPSTREAM_DISCONNECTED:G.INTERNAL_ERROR,UPSTREAM_HANDSHAKE_FAILED:G.INTERNAL_ERROR};function yn(r){return r instanceof C?{code:fc[r.code]??G.INTERNAL_ERROR,message:r.message,data:{bridgeCode:r.code,retriable:r.retriable}}:{code:G.INTERNAL_ERROR,message:r instanceof Error?r.message:String(r)}}function pi(r){let e=r.data,i=e?.bridgeCode??"AGENT_PROTOCOL_ERROR";return new C(i,r.message,{retriable:e?.retriable??!1,cause:r.data})}function mi(r){return`${JSON.stringify(r)}
|
|
92
|
+
`}var bn=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 f=c.replace(/\r$/,"").trim();if(f)try{o.push(JSON.parse(f))}catch(u){this.onError?.({line:f,error:u})}}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 _i={"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"},cl=Object.fromEntries(Object.entries(_i).map(([r,e])=>[e,r])),uc={"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:[]},dt=class{seq=0;next(e,i){this.seq+=1;let o=_i[e]??dc(e),c=uc[o]??[],f=[o,String(this.seq)];if(c.length>0){let u=c.map(m=>wi(i?.[m]??"")),h=lc(u).join(":");h&&f.push(h)}else i&&Object.values(i).some(u=>u)&&f.push(Object.values(i).filter(Boolean).map(u=>wi(String(u))).join(":"));return f.join("_")}reset(){this.seq=0}};function dc(r){return r.replace(/[\s/]+/g,".").replace(/_+/g,"-")}function wi(r){return r.replace(/[:_\s]+/g,"-")}function lc(r){let e=r.length;for(;e>0&&!r[e-1];)e-=1;return r.slice(0,e)}U();var gc=3e4,pc=50,mc=20,yi=500;function wc(r){try{let e=JSON.stringify(r);return e===void 0||e.length<=yi?r:`${e.slice(0,yi)}...<truncated, total ${e.length} chars>`}catch{return"<unserializable>"}}function bi(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 bn({onError:i=>this.log.warn("decode line failed",{line:i.line})})}opts;child;decoder;pending=new Map;idAllocator=new dt;updateHandlers=[];agentRequestHandlers=[];exitHandlers=[];log;stopped=!1;stderrRing=[];sanitizeEnv(e){return e}async start(){if(this.child)throw new C("BRIDGE_INTERNAL","Downstream already started");let e=process.platform!=="win32",i=hc(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=>{let c=o.trimEnd();this.stderrRing.push(c),this.stderrRing.length>pc&&this.stderrRing.shift(),this.log.debug("stderr",{text:c})}),i.on("exit",(o,c)=>{this.stopped=!0,(o!==0||c!==null)&&this.stderrRing.length>0&&this.log.warn("downstream exited abnormally, recent stderr",{code:o,signal:c,recentStderr:this.stderrRing.slice(-mc)}),this.failAllPending(new C("AGENT_PROTOCOL_ERROR",`agent exited (${o}/${c})`));for(let u of this.exitHandlers)u(o,c)}),i.on("error",o=>{this.log.error("child error",{err:String(o)}),this.failAllPending(new C("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(f=>i.once("exit",()=>f()));bi(i.pid,"SIGTERM");let c=setTimeout(()=>{i.killed||bi(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(mn("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=gc){if(!this.child||this.stopped)return Promise.reject(new C("AGENT_PROTOCOL_ERROR","downstream not started"));let c=this.idAllocator.next(e),f=Nt(c,e,i),u=o>0&&Number.isFinite(o);return new Promise((h,m)=>{let w=u?setTimeout(()=>{this.pending.delete(c),m(new C("AGENT_TIMEOUT",`${e} timed out after ${o}ms`))},o):null;this.pending.set(c,{resolve:h,reject:m,timer:w,method:e});try{this.writeFrame(f)}catch(y){w&&clearTimeout(w),this.pending.delete(c),m(y)}})}writeFrame(e){if(!this.child?.stdin||this.child.stdin.destroyed)throw new C("AGENT_PROTOCOL_ERROR","downstream stdin not writable");this.child.stdin.write(mi(e))}dispatch(e){if(_n(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(pi(e.error))):(this.log.info("downstream returned result",{id:e.id,method:i.method,result:wc(e.result)}),i.resolve(e.result));return}if(gi(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(hi(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,yn(o)))}catch{}}}failAllPending(e){for(let i of this.pending.values())i.timer&&clearTimeout(i.timer),i.reject(e);this.pending.clear()}};var _c="@agentclientprotocol/claude-agent-acp@latest";function yc(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 vn=class extends Ke{framework="claude-code";constructor(e){let i=pn("claude-code"),[o,c]=i?[i,[]]:["npx",["-y",_c]],f=e.command??o,u=e.args??c,h={command:f,args:u,cwd:e.cwd,...e.env?{env:e.env}:{}};super(h)}sanitizeEnv(e){return yc(e)}};import{mkdtempSync as bc,rmSync as vc}from"node:fs";import{tmpdir as Sc}from"node:os";import{join as Ec}from"node:path";var Cc="@zed-industries/codex-acp@latest",Sn=class extends Ke{framework="codex";authMethodId;codexHomeDir;constructor(e){let i=pn("codex"),[o,c]=i?[i,[]]:["npx",["-y",Cc]],f=e.command??o,u=e.args??c,h=e.extraArgs?[...u,...e.extraArgs]:u,m=e.isolateCodexHome?bc(Ec(Sc(),"coze-bridge-codex-home-")):void 0,w=m?{...e.env??{},CODEX_HOME:m}:e.env,y={command:f,args:h,cwd:e.cwd,...w?{env:w}:{}};super(y),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{vc(this.codexHomeDir,{recursive:!0,force:!0})}catch{}}};var Ot=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();ae();var lt=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 En=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 lt,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)Mt(o),o.downstream&&(i.push(o.downstream.stop(e).catch(()=>{})),o.downstream=void 0);await Promise.all(i),this.activeTriggers.clear()}};function Mt(r){r.idleTimer&&(clearTimeout(r.idleTimer),r.idleTimer=void 0)}import{spawn as Ac}from"node:child_process";import{homedir as kc}from"node:os";import{join as Pc}from"node:path";Qt();U();async function Ei(){let r=Pc(kc(),".openclaw/openclaw.json");return(await ct(r))?.gateway?.auth?.token??""}var vi=L("openclaw.config"),Ic=[0,5e3,5e3],Si="models.providers.",Cn="agents.defaults.models",An=class{command;env;retryDelaysMs;queue=new lt;constructor(e){this.command=e.command,this.env=e.env??process.env,this.retryDelaysMs=e.retryDelaysMs??Ic}async withRetry(e,i){let o;for(let c=0;c<this.retryDelaysMs.length;c++){let f=this.retryDelaysMs[c]??0;f>0&&await new Promise(u=>setTimeout(u,f));try{return await i()}catch(u){o=u,vi.warn("openclaw cli failed, will retry",{label:e,attempt:c+1,err:String(u)})}}throw new C("AGENT_SPAWN_FAILED",`openclaw cli ${e} failed after ${this.retryDelaysMs.length} attempts: ${o?.message??"unknown"}`)}runCli(e){return new Promise((i,o)=>{let c=Ac(this.command,e,{stdio:["ignore","pipe","pipe"],env:this.env}),f="";c.stderr?.on("data",u=>{f+=u.toString("utf8")}),c.on("error",o),c.on("close",u=>{u===0?i():o(new Error(`exit ${u}: ${f.trim().slice(0,500)}`))})})}async runCliTolerant(e,i){try{await this.runCli(e)}catch(o){let c=String(o);if(i.some(f=>c.includes(f)))return;throw o}}async bestEffortUnset(e,i){try{await this.queue.enqueue(()=>this.withRetry(e,()=>this.runCli(["config","unset",i])))}catch(o){vi.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",`${Si}${e}`,JSON.stringify(i),"--strict-json","--merge"])))}removeProvider(e){return this.bestEffortUnset(`config unset models.providers.${e}`,`${Si}${e}`)}addModelToAllowlist(e,i){let o={[e]:i?{alias:i}:{}};return this.queue.enqueue(()=>this.withRetry(`config set ${Cn}[${e}]`,()=>this.runCli(["config","set",Cn,JSON.stringify(o),"--strict-json","--merge"])))}removeModelFromAllowlist(e){return this.bestEffortUnset(`config unset ${Cn}[${e}]`,`${Cn}.${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 je=L("agent-manager"),Tc=(r,e,i,o,c,f,u)=>{switch(r){case"claude-code":{let h=c?{...Qs(c),...ti(c,u)}:void 0;return new vn({cwd:i,...h&&Object.keys(h).length>0?{env:h}:{}})}case"codex":{let h=c?[...Zs(c),...ri(c,u)]:[],m=c?ei(c):void 0,w=!!c;return new Sn({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 Ot({command:e,cwd:i,agentId:o,...f?{sessionName:Dt(f)}:{}})}};function Ci(r){return r==="claude-code"||r==="codex"}var Lc={path:"",version:"cloud-deployed"},Rc={protocolVersion:1,clientCapabilities:{fs:{readTextFile:!0,writeTextFile:!0}}},Nc=6e4,kn=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??Tc,this.createTimeoutMs=e.createTimeoutMs??Nc}getOpenclawConfig(){if(!this.openclawConfigCache){let e=this.config.frameworksCache?.openclaw;if(!e?.path)throw new C("AGENT_SPAWN_FAILED","openclaw binary not detected on this machine");this.openclawConfigCache=new An({command:e.path})}return this.openclawConfigCache}async createAgent(e){if(!e.agentId)throw new C("IPC_BAD_REQUEST","agentId required");if(!e.framework)throw new C("IPC_BAD_REQUEST","framework required");let i=It(e._meta)==="cloud";this.registry.reviveIfDisconnected?.(e.agentId);let o=this.registry.get(e.agentId);if(o){if(o.framework!==e.framework)throw new C("AGENT_BUSY",`agent ${e.agentId} exists with different framework (${o.framework})`);if(o.status==="error")je.warn("existing agent in error state, rebuilding",{agentId:e.agentId}),await o.dispose("rebuild after error").catch(E=>je.warn("dispose stale agent failed (ignored)",{err:String(E)})),this.registry.unregister(e.agentId);else return je.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 C("AGENT_SPAWN_FAILED",`framework ${e.framework} not detected on this machine; rerun daemon to refresh frameworks_cache`);i&&Ci(e.framework)&&await li(e.framework);let f=Te(e.agentId,this.paths),u=e.workspace??f.workspace,h=It(e._meta),m=new AbortController,w=setTimeout(()=>m.abort(new C("AGENT_TIMEOUT",`_agent/create timed out after ${this.createTimeoutMs}ms`)),this.createTimeoutMs),y,_=!1;try{let E=()=>{if(m.signal.aborted)throw m.signal.reason instanceof Error?m.signal.reason:new C("AGENT_TIMEOUT","_agent/create aborted")};await Pr(f.root,{recursive:!0}),await Pr(u,{recursive:!0}),await Pr(f.logs,{recursive:!0}),E(),await xt(u,e.framework,e.agentId,e.cozeIdentity),E();let A=await ce(e.agentId,this.paths).catch(()=>null),k=Xs({model:e.model??A?.model});if(y=new En({agentId:e.agentId,framework:e.framework,workspace:u,model:k.model??He,deployType:h}),y.status="ok",A?.sessions){for(let[re,Z]of Object.entries(A.sessions))y.sessions.set(re,{acpSessionId:Z.acpSessionId,modelToken:Z.modelToken,tokenGeneratedAt:Z.tokenGeneratedAt,lastActiveAt:Date.now(),loadingSession:!1,replySeq:0});let q=Object.keys(A.sessions).length;q>0&&je.info("restored persisted session records (no spawn)",{agentId:e.agentId,count:q})}this.registry.register(y),_=!0;let T={agentId:e.agentId,framework:e.framework,workspace:u,cozeIdentity:e.cozeIdentity,createdAt:A?.createdAt??Date.now(),sessions:A?.sessions??{},model:k.model};return h==="cloud"&&(T.deployType="cloud"),A?.skills&&(T.skills=A.skills),A?.agentName&&(T.agentName=A.agentName),A?.description&&(T.description=A.description),await pe(T,this.paths),e.framework==="openclaw"&&(this.config.frameworksCache?.openclaw?.path?await this.getOpenclawConfig().ensureAgent(e.agentId,u):je.warn("openclaw binary not on this machine, skip agents add (will fail at session/prompt)",{agentId:e.agentId})),je.info("agent created (no spawn, lazy on first prompt)",{agentId:e.agentId,framework:e.framework,deployType:h}),{ok:!0,agentId:e.agentId,workspace:u,framework:e.framework}}catch(E){throw je.error("agent create failed, rolling back",{agentId:e.agentId,err:String(E)}),_&&y&&(await y.dispose("rollback").catch(()=>{}),this.registry.unregister(e.agentId)),await Dc(f.root,{recursive:!0,force:!0}).catch(A=>je.warn("rm agent dir failed (ignored)",{err:String(A)})),E instanceof C?E:new C("AGENT_SPAWN_FAILED",String(E),{cause:E})}finally{clearTimeout(w)}}async spawnSessionDownstream(e,i,o,c){let u=this.config.frameworksCache?.[e.framework];if(!u)if(e.deployType==="cloud"&&Ci(e.framework))u=Lc;else throw new C("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:o,cozeEnv:c,command:u.path}):m=this.factory(e.framework,u.path,e.workspace,e.agentId,h,o,c);try{return await m.start(),await m.initialize(Rc),m}catch(w){throw await m.stop("spawnSessionDownstream failed").catch(()=>{}),w instanceof C?w:new C("AGENT_SPAWN_FAILED",w instanceof Error?w.message:String(w),{cause:w})}}async buildOpenclawDownstream(e){let{session:i,modelConfig:o,cloudSessionId:c,cozeEnv:f,command:u}=e,h=Dt(c),m=await Ei(),w=o?.modelToken&&!Tt(o.model)?ni(o,f):null,y;if(w){let _=Cr(c),E=`${_}/${o.model}`;if(!this.ensuredProviders.has(E)){let A=this.getOpenclawConfig();await A.ensureProvider(_,w),await A.addModelToAllowlist(E),this.ensuredProviders.add(E)}y=E}return new Ot({command:u,cwd:i.workspace,agentId:i.agentId,sessionName:h,...m?{gatewayToken:m}:{},...y?{slashModelOnStart:y}:{}})}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=Cr(o),f=`${c}/${e.model}`;this.ensuredProviders.delete(f),await i.removeProvider(c),await i.removeModelFromAllowlist(f)}}};U();import{spawn as Oc}from"node:child_process";import{constants as Ai,access as Mc}from"node:fs/promises";import{delimiter as Bc,join as zc}from"node:path";var qc=L("framework-detector"),ki={"claude-code":"claude",codex:"codex",openclaw:"openclaw"},Fc=[".exe",".cmd",".bat",".ps1"],ht=class{env;constructor(e={}){this.env={pathEnv:e.pathEnv??process.env.PATH??"",platform:e.platform??process.platform,spawn:e.spawn??Oc,access:e.access??Mc}}async detect(e){let i=ki[e],o=await this.which(i);if(!o)return qc.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(ki).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(Bc).filter(Boolean),o=this.env.platform==="win32"?["",...Fc]:[""];for(let c of i)for(let f of o){let u=zc(c,e+f);if(await this.isExecutable(u))return u}return null}async isExecutable(e){try{let i=this.env.platform==="win32"?Ai.F_OK:Ai.X_OK;return await this.env.access(e,i),!0}catch{return!1}}async probeVersion(e){return new Promise(i=>{let o="",c=!1,f,u=h=>{c||(c=!0,f&&clearTimeout(f),i(h.trim()||"unknown"))};try{let h=this.env.spawn(e,["--version"],{stdio:["ignore","pipe","pipe"]});f=setTimeout(()=>{h.kill("SIGKILL"),u("unknown")},5e3),h.stdout?.on("data",m=>{o+=m.toString("utf8")}),h.on("error",()=>u("unknown")),h.on("close",()=>{let m=Hc(o).split(/\r?\n/)[0]??"";u(m)})}catch{u("unknown")}})}},Uc=new RegExp("\x1B\\[[0-9;]*[A-Za-z]","g");function Hc(r){return r.replace(Uc,"")}Qt();ae();var Kc=10*6e4;function Pi(r){let e=r?.sessionIdleTimeoutMs;return typeof e!="number"||!Number.isFinite(e)||e<=0?Kc:e}function Pn(r){return ct(r??j().configFile)}function gt(r,e){return Xt(e??j().configFile,r)}import{randomBytes as jc}from"node:crypto";Ue();U();var M=L("core"),Gc=3e4,Wc=3e4,In=class{upstream;agents=new Map;disconnectedAgents=new Set;extensions;paths;sessionSpawner;sessionIdleTimeoutMs;upstreamIds=new dt;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=Pi(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(),M.info("Core started",{extensions:Object.keys(this.extensions)})}async stop(e){M.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),M.info("agent registered",{agentId:e.agentId,framework:e.framework});for(let i of this.registerHandlers)try{i(e.agentId)}catch(o){M.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)&&M.info("agent revived from disconnect",{agentId:e})}attachRuntimeHooks(e,i,o){let c=o.downstream;c&&(c.onUpdate(f=>{o.loadingSession||this.forwardUpdate(e,f)}),c.onAgentRequest(f=>{this.handleAgentRequest(e,c,f)}),c.onExit((f,u)=>{M.info("session runtime exited",{agentId:e.agentId,cloudId:i,code:f,signal:u}),Mt(o),o.downstream=void 0,o.acpSessionId&&e.activeTriggers.delete(o.acpSessionId)}))}async handleFrame(e){if(_n(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,G.METHOD_NOT_FOUND,`extension not registered: ${e.method}`):M.warn("drop notification: extension not registered",{method:e.method});return}let f=await c(e,this);i!==null&&await this.upstream.send(ut(i,f));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,G.METHOD_NOT_FOUND,`method not implemented: ${e.method}`):M.warn("drop unknown notification",{method:e.method})}catch(c){M.error("handleFrame failed",{method:e.method,err:String(c)}),i!==null&&await this.upstream.send(Xe(i,yn(c)))}}async routeSessionMethod(e){if(!e.params||typeof e.params!="object")throw new C("IPC_BAD_REQUEST",`${e.method} requires params`);let i=e.params,o=i._meta?.cozeAgentId;if(!o)throw new C("IPC_BAD_REQUEST",`${e.method}: missing _meta.cozeAgentId`);let c=this.agents.get(o);if(!c)throw this.disconnectedAgents.has(o)?new C("AGENT_DISCONNECTED",`agent ${o} has been disconnected; cloud must _agent/create to revive`):new C("AGENT_NOT_FOUND",`agent not found: ${o}`);let f=typeof i.sessionId=="string"?i.sessionId:void 0;if(e.method==="session/cancel"||e.method==="session/new"||!f)return this.dispatchSessionCall(c,e.method,i);let u=Date.now(),h=!1;try{let m=await c.getSessionQueue(f).enqueue(()=>this.dispatchSessionCall(c,e.method,i));return h=!0,m}finally{M.info("session call done",{agentId:c.agentId,method:e.method,durationMs:Date.now()-u,ok:h})}}async dispatchSessionCall(e,i,o){e.lastActiveAt=Date.now();let{stripped:c}=Hs(o);switch(i){case"session/new":{let f=Jc();return M.info("session/new ack (lazy spawn)",{agentId:e.agentId,cloudId:f}),{sessionId:f}}case"session/load":{let f=c;return M.info("session/load ack (lazy spawn)",{agentId:e.agentId,cloudId:f.sessionId}),{}}case"session/prompt":{let f=c,u=f.sessionId;if(!u)throw new C("IPC_BAD_REQUEST","session/prompt: missing sessionId");let h=await this.ensureRuntime(e,u);if(h.replySeq=0,await this.ensureDownstream(e,u,h),!h.downstream||!h.acpSessionId)throw new C("BRIDGE_INTERNAL","session runtime not ready after ensureDownstream");let m=o._meta?.cozeTriggerMsgId;m?e.activeTriggers.set(h.acpSessionId,m):e.activeTriggers.delete(h.acpSessionId);try{let w=await h.downstream.sessionPrompt({...f,sessionId:h.acpSessionId});return h.lastActiveAt=Date.now(),w}finally{e.activeTriggers.delete(h.acpSessionId),h.downstream?.isAlive()&&this.armIdleTimer(e,u,h)}}case"session/cancel":{let u=c.sessionId;if(!u)throw new C("IPC_BAD_REQUEST","session/cancel: missing sessionId");let h=e.sessions.get(u);return h?.downstream?.isAlive()&&h.acpSessionId&&await h.downstream.sessionCancel({sessionId:h.acpSessionId}),{ok:!0}}default:throw new C("IPC_BAD_REQUEST",`session method not supported: ${i}`)}}async ensureRuntime(e,i){let o=e.sessions.get(i);if(o)return o;let f={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,f),await this.persistSessionMapping(e),f}async requestSessionToken(e,i){let o={sessionId:i,_meta:{cozeAgentId:e}};try{let c=await this.sendRequest(ve.GEN_MODEL_TOKEN,o,Wc);if(!c?.modelToken)throw new C("MODEL_TOKEN_GEN_FAILED",`cloud returned empty modelToken (agentId=${e}, cloudSessionId=${i})`);return c.modelToken}catch(c){throw c instanceof C&&c.code==="MODEL_TOKEN_GEN_FAILED"?c:new C("MODEL_TOKEN_GEN_FAILED",c instanceof Error?c.message:String(c),{cause:c})}}async ensureDownstream(e,i,o){if(Mt(o),o.downstream?.isAlive())return;if(!this.sessionSpawner)throw new C("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}),M.info("session restored via session/load",{agentId:e.agentId,cloudId:i,acpId:o.acpSessionId})}catch(f){M.warn("session/load failed, fallback to session/new",{agentId:e.agentId,cloudId:i,acpId:o.acpSessionId,err:String(f)}),o.acpSessionId=void 0;let u=await c.sessionNew({cwd:e.workspace});o.acpSessionId=u.sessionId,await this.persistSessionMapping(e)}finally{o.loadingSession=!1}}else{let f=await c.sessionNew({cwd:e.workspace});o.acpSessionId=f.sessionId,await this.persistSessionMapping(e)}c.afterSessionEstablished&&o.acpSessionId&&await c.afterSessionEstablished(o.acpSessionId)}armIdleTimer(e,i,o){if(Mt(o),this.isRuntimeBusy(e,o)){M.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)){M.info("idle reaper fired but runtime busy, re-arming",{agentId:e.agentId,cloudId:i}),this.armIdleTimer(e,i,o);return}M.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(f=>M.warn("idle stop failed (ignored)",{agentId:e.agentId,cloudId:i,err:String(f)}))},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){M.debug("drop update for unknown session",{agentId:e.agentId,acpId:o});return}let f=e.sessions.get(c);if(!f){M.debug("drop update: runtime gone",{agentId:e.agentId,cloudId:c});return}if(Yc(i)){M.debug("drop codex metadata-warn chunk",{agentId:e.agentId,acpId:o});return}let u={cozeAgentId:e.agentId,cozeReplySeqID:++f.replySeq},h=e.activeTriggers.get(o);h&&(u.cozeTriggerMsgId=h),this.upstream.send(mn("session/update",{...i,sessionId:c,_meta:u})).catch(m=>M.warn("forward update failed",{agentId:e.agentId,err:String(m)}))}handleAgentRequest(e,i,o){if(o.method==="session/request_permission"){this.forwardPermissionRequest(e,i,o);return}M.warn("unhandled agent request,returning method_not_found",{agentId:e.agentId,method:o.method}),i.respondAgentRequestError(o.id,{code:G.METHOD_NOT_FOUND,message:`method not handled by Bridge: ${o.method}`})}forwardPermissionRequest(e,i,o){let c=this.upstreamIds.next("session/request_permission"),f=o.params??{},h=f.sessionId,m=h?e.activeTriggers.get(h):void 0,w={cozeAgentId:e.agentId};m&&(w.cozeTriggerMsgId=m);let y=h?this.reverseSessionId(e,h):void 0,_={...f,...y?{sessionId:y}:{},_meta:w};this.pendingUpstream.set(c,{agentRequestId:o.id,agentId:e.agentId,downstream:i,method:o.method}),M.info("forward permission_request \u2192 upstream",{agentId:e.agentId,upstreamId:c,acpSessionId:h,cloudSessionId:y,toolCallId:f.toolCall?.toolCallId,options:f.options?.map(E=>({optionId:E.optionId,kind:E.kind,name:E.name}))}),this.upstream.send(Nt(c,"session/request_permission",_)).catch(E=>{this.pendingUpstream.delete(c),M.error("forward permission request failed",{agentId:e.agentId,err:String(E)}),i.respondAgentRequestError(o.id,{code:G.INTERNAL_ERROR,message:`upstream send failed: ${String(E)}`})})}handleUpstreamResponse(e){if(e.id===null)return;let i=this.pendingUpstream.get(e.id);if(i){this.pendingUpstream.delete(e.id),e.error?(M.info("upstream \u2192 permission response (error)",{agentId:i.agentId,upstreamId:e.id,method:i.method,error:e.error}),i.downstream.respondAgentRequestError(i.agentRequestId,e.error)):(M.info("upstream \u2192 permission response (result)",{agentId:i.agentId,upstreamId:e.id,method:i.method,result:e.result}),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 wn(e.error)):o.resolve(e.result);return}M.debug("orphan upstream response (no pending)",{id:e.id})}sendRequest(e,i,o=Gc){let c=this.upstreamIds.next(e);return new Promise((f,u)=>{let h=setTimeout(()=>{this.pendingBridge.delete(c),u(new C("AGENT_TIMEOUT",`${e} timed out after ${o}ms`))},o);this.pendingBridge.set(c,{method:e,resolve:f,reject:u,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)),u(m)})})}async persistSessionMapping(e){if(this.paths)try{let i=new Map;for(let[o,c]of e.sessions){let f={modelToken:c.modelToken,tokenGeneratedAt:c.tokenGeneratedAt};c.acpSessionId&&(f.acpSessionId=c.acpSessionId),i.set(o,f)}await vr(e.agentId,i,this.paths)}catch(i){M.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 Jc(){return jc(16).toString("hex")}function Yc(r){let e=r.update;if(e?.sessionUpdate!=="agent_message_chunk")return!1;let i=e.content;if(!i||typeof i!="object")return!1;let o=i;return o.type!=="text"||typeof o.text!="string"?!1:o.text.startsWith("Model metadata for `")}U();ae();import{randomBytes as Vc}from"node:crypto";import{chmod as $c,mkdir as Xc,writeFile as Ii}from"node:fs/promises";import{createServer as Qc}from"node:http";import{dirname as Zc}from"node:path";var ex=1e6,Ir=L("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=Vc(32).toString("hex");let e=Qc((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(),Ir.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 Xc(Zc(this.paths.portFile),{recursive:!0}),await Ii(this.paths.portFile,String(this.port),"utf8"),await Ii(this.paths.tokenFile,this.token,{encoding:"utf8",mode:384});try{await $c(this.paths.tokenFile,384)}catch(e){Ir.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]}`,f=this.routes.get(c);if(!f){Bt(i,404,{error:"not found"});return}let u=null;if(e.method==="POST")try{u=await tx(e)}catch(h){Bt(i,400,{error:"invalid json",detail:String(h)});return}try{let h=await f.handler(u,e);Bt(i,200,h??{ok:!0})}catch(h){Ir.error("IPC handler failed",{key:c,err:String(h)}),Bt(i,500,{error:h instanceof Error?h.message:String(h)})}}};function Bt(r,e,i){r.statusCode=e,r.setHeader("content-type","application/json"),r.end(JSON.stringify(i))}async function tx(r){let e=[],i=0;for await(let c of r){let f=c;if(i+=f.length,i>ex)throw new Error("body too large");e.push(f)}let o=Buffer.concat(e).toString("utf8");return o?JSON.parse(o):null}var Qo=De(Fi(),1);var Bf=De(Mo(),1),zf=De(Wn(),1),qf=De(wt(),1),Ff=De(Hr(),1),Uf=De(Gr(),1),Hf=De(Xr(),1),Go=De($n(),1),Kf=De(jo(),1);var Wo=Go.default;U();var Q=L("upstream.frontier"),Yo="application/json",Vo="none",Qn=class{constructor(e){this.opts=e}opts;fws=null;handler=null;connectHandler=null;opened=!1;openCount=0;async start(){if(this.fws){Q.warn("start called on already-started FrontierUpstream; noop");return}let e={Authorization:`Bearer ${this.opts.privatecode}`,Origin:Gs,...an(this.opts.ppeOverride)};class i extends Wo{constructor(h){super(h,js,{headers:e})}send(h,...m){if(Fs("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 y=Buffer.from(w.slice(0,128)).toString("hex");Q.debug("WS raw frame out",{bytes:w.byteLength,headHex:y})}catch(w){Q.warn("WS raw frame dump failed",{err:String(w)})}super.send(h,...m)}}let o=Ys(this.opts.urlOverride),c={url:o,ws:i,fpID:Ks,aID:on,accessKey:this.opts.handshake.accessKey,deviceID:this.opts.handshake.deviceId,payloadType:{type:Yo,force:!0},payloadEncoding:{encoding:Vo,force:!0},enableTransformTextPayload:!0,enableQoS:!1,enableAutoAck:!1,automaticOpen:!1,debug:this.opts.debug??!1},f=new Qo.FWS(c);f.onopen=()=>{this.opened=!0,this.openCount+=1;let u=this.openCount===1;Q.info("frontier opened",{url:o,remoteDeviceId:this.opts.handshake.deviceId,initial:u,openCount:this.openCount}),this.connectHandler&&Promise.resolve(this.connectHandler({initial:u})).catch(h=>Q.warn("onConnect handler threw (ignored)",{err:String(h)}))},f.onclose=u=>{this.opened=!1,Q.info("frontier closed",{code:u.code,reason:u.reason,willReconnect:u.willReconnect})},f.onerror=u=>{Q.warn("frontier error",{code:u.code,msg:u.message})},f.onmessage=u=>this.handleMessage(u),this.fws=f,await f.connect()}async stop(e){let i=this.fws;if(i){this.fws=null,this.opened=!1;try{i.close(1e3,e??"bridge shutdown")}catch(o){Q.warn("frontier close threw (ignored)",{err:String(o)})}}}async send(e){let i=this.fws;if(!i)throw new C("UPSTREAM_DISCONNECTED","frontier upstream not started");let o=JSON.stringify(e),c=e;$o(c)||Q.info("frontier frame out",{method:c.method,jsonrpcId:c.id,size:o.length});try{await i.send(o,{service:33555712,method:1,payloadType:Yo,payloadEncoding:Vo})}catch(u){throw Q.warn("frontier frame send failed",{method:c.method,jsonrpcId:c.id,err:String(u)}),new C("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){Q.debug("drop non-adapter frontier frame",{service:i});return}let o=Jf(e);if(!o){Q.debug("frontier message without text payload, drop",{payloadType:e.message?.payloadType});return}if(!this.handler){Q.debug("frame received but no onFrame handler",{size:o.length});return}let c;try{c=JSON.parse(o)}catch(u){Q.warn("frontier message JSON parse failed",{err:String(u),head:o.slice(0,80)});return}let f=c;$o(f)||Q.info("frontier frame in",{logid:Wf(e.message?.LogID),logidNew:e.message?.LogIDNew,msgId:e.message?.msgID,jsonrpcId:f.id,method:f.method,body:Gf(o)}),Promise.resolve(this.handler(c)).catch(u=>Q.warn("frontier frame handler threw",{err:String(u)}))}};function $o(r){return r.method==="_agent/health"?!0:typeof r.id=="string"&&r.id.startsWith("agent.health_")}var Xo=2e3;function Gf(r){return r.length<=Xo?r:`${r.slice(0,Xo)}...<truncated, total ${r.length} chars>`}function Wf(r){return r?r.high===0?String(r.low>>>0):`${r.high.toString(16)}${(r.low>>>0).toString(16).padStart(8,"0")}`:""}function Jf(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 Zr=L("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 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 Zr.error("swap target start failed, reverting",{err:String(c)}),this.inner=o,c}await o.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()}};U();var es=L("upstream"),Wt=class{handler=null;async start(){es.info("NoopUpstream started (M1 skeleton; real Frontier wired in M4)")}async stop(e){es.info("NoopUpstream stopped",{reason:e})}async send(e){es.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();ae();U();ae();import{execSync as Yf}from"node:child_process";import{readFileSync as Zo,unlinkSync as Vf}from"node:fs";import{mkdir as $f,readFile as ea,unlink as ta,writeFile as Xf}from"node:fs/promises";import{dirname as Qf}from"node:path";var Zf=L("single-instance"),er=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&&(Zf.warn("removing stale pid file",{stalePid:e}),await ta(this.pidFile).catch(()=>{})),await $f(Qf(this.pidFile),{recursive:!0}),await Xf(this.pidFile,String(process.pid),"utf8"),this.acquired=!0,this.installCleanupHooks(),{kind:"acquired"})}async release(){if(this.acquired){try{(await ea(this.pidFile,"utf8")).trim()===String(process.pid)&&await ta(this.pidFile)}catch{}this.acquired=!1}}async readExistingPid(){try{let e=await ea(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=Zo(`/proc/${e}/cmdline`,"utf8").replace(/\0/g," ");return!!(i.includes("coze-bridge-daemon")||i.includes("lib/index.js"))}catch{}try{let i=Yf(`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{Zo(this.pidFile,"utf8").trim()===String(process.pid)&&Vf(this.pidFile)}catch{}})}};var O=L("daemon"),eu="coze-bridge-daemon";async function sa(){let r=new er({processTitle:eu}),e=await r.acquire();if(e.kind==="already-running")throw new Error(`coze-bridge daemon already running (pid=${e.pid})`);let i=await Pn(),o=i??{};br({pid:process.pid}),O.info(i?"loaded bridge config":"initialized bridge config");try{let I=new ht;o.frameworksCache=await I.detectAll(),O.info("refreshed frameworks_cache",{detected:Object.keys(o.frameworksCache)})}catch(I){O.warn("framework detection failed",{err:String(I)})}await gt(o);let c=new Zn(new Wt),f=j(),u=null,h=new In({upstream:c,paths:f,bridgeConfig:o,sessionSpawner:async(I,F,W,ee)=>{if(!u)throw new Error("agentManager not ready");return u.spawnSessionDownstream(I,F,W,ee)}});await nu(f,h);let m=new kn({paths:f,config:o,registry:h});u=m;let w,y,_=null,E=null;h.registerExtension("_agent/create",async I=>m.createAgent(I.params)),h.registerExtension("_agent/health",async()=>({ok:!0}));let A={},k=new fn({agents:h.agents,disposeAndMarkDisconnected:async(I,F)=>{let W=h.agents.get(I);W&&(await m.cleanupOpenclawSessionProviders(W).catch(ee=>O.warn("cleanup openclaw providers failed (ignored)",{agentId:I,err:String(ee)})),await W.dispose(`disconnect: ${F}`).catch(ee=>O.warn("dispose during disconnect failed (ignored)",{agentId:I,err:String(ee)})),W.status="disconnected",h.unregister(I)),h.disconnectedAgents.add(I)},detailSyncer:async I=>{if(!A.ref)throw new Error("agent-detail-sync not initialized yet");await A.ref.syncOne(I)},openclawRepair:async(I,F)=>{await m.openclawRepair(I,F)}});h.registerExtension("_agent/listSkills",I=>k.listSkills(I.params)),h.registerExtension("_agent/addSkills",I=>k.addSkills(I.params)),h.registerExtension("_agent/removeSkills",I=>k.removeSkills(I.params)),h.registerExtension("_agent/getFileTree",I=>k.getFileTree(I.params)),h.registerExtension("_agent/getFileContent",I=>k.getFileContent(I.params)),h.registerExtension("_agent/update",I=>k.updateAgent(I.params)),h.registerExtension("_agent/disconnect",I=>k.disconnectAgent(I.params)),h.registerExtension("_agent/switchModel",I=>k.switchModel(I.params)),h.registerExtension("_agent/reset",I=>k.resetAgent(I.params)),h.registerExtension("_agent/repair",I=>k.repairAgent(I.params));let T=new sn({paths:f,handlers:k,sendDetail:I=>h.sendRequest("_agent/detail",I)});A.ref=T,c.onConnect(({initial:I})=>{O.info("frontier upstream connected, triggering detail sync",{initial:I}),T.syncAll(I?"initial-connect":"reconnect").catch(F=>O.warn("detail sync top-level error (ignored)",{err:String(F)}))});let q=new Dn({paths:f,routes:[{method:"GET",path:"/status",handler:async()=>({running:!0,pid:process.pid,agents:[...h.agents.keys()],deviceId:_??"",frameworksCache:o.frameworksCache??{}})},{method:"POST",path:"/pair",handler:async I=>{let F=I,W=F?.privatecode,ee=F?.pairing_code;if(!W||!ee)throw new C("IPC_BAD_REQUEST","/pair requires privatecode + pairing_code");let Ae=cn(F.env),le=F.handshake_url,Ye=F.frontier_url,Ct=tu(F.env,le,Ye),Jt=!!w&&w!==W,_e=y!==void 0&&y!==Ct,ye=Jt||_e;if(ye){O.warn("pair config switched, resetting agents",{pcChanged:Jt,envChanged:_e,previousPc:w?na(w):"",nextPc:na(W),previousEnvKey:y??"",nextEnvKey:Ct});for(let B of[...h.agents.values()])await B.dispose("pair config switch").catch(()=>{}),h.agents.delete(B.agentId);await c.swap(new Wt,"pair switch").catch(()=>{})}let Yt=await $s({privatecode:W,...le?{endpoint:le}:{},ppeOverride:Ae});_=Yt.deviceId,br({deviceId:_,pid:process.pid});let se=new Qn({handshake:Yt,privatecode:W,...Ye?{urlOverride:Ye}:{},ppeOverride:Ae});await c.swap(se,"pair");try{let B=new ht;o.frameworksCache=await B.detectAll(),await gt(o),O.info("frameworks_cache refreshed before pair",{detected:Object.keys(o.frameworksCache)})}catch(B){O.warn("frameworks_cache refresh failed (ignored, using cached)",{err:String(B)})}let Vt=Object.keys(o.frameworksCache??{});try{let B=await h.sendRequest("_agent/pair",{pairCode:ee,patToken:W,frameworks:Vt,_meta:{cozeDeviceId:_}});O.info("_agent/pair ok",{pairResult:B}),w=W,y=Ct,E||(E=new ln({core:h,getDeviceId:()=>_??""})),E.start(),ye&&ra(f,m).catch(ke=>O.warn("post-pair-switch auto-revive error (ignored)",{err:String(ke)}));let J;return F.agent_id&&(J=await ru(F.agent_id,f,m,ke=>h.sendRequest("_agent/detail",ke)).catch(ke=>(O.error("--agent-id ensureAgent failed",{agentId:F.agent_id,err:String(ke)}),{ok:!1,agentId:F.agent_id??"",note:String(ke)}))),{ok:!0,note:"paired with cloud",...J?{agent:J}:{}}}catch(B){return O.error("_agent/pair failed",{err:String(B)}),{ok:!1,note:`pair failed: ${String(B)}`}}}},{method:"POST",path:"/_agent/create",handler:async I=>{let F=I;return{ok:!0,result:await m.createAgent(F)}}},{method:"POST",path:"/refresh",handler:async()=>{O.info("IPC /refresh: re-detecting frameworks");let I=new ht;return o.frameworksCache=await I.detectAll(),await gt(o),{ok:!0,frameworks:o.frameworksCache}}},{method:"POST",path:"/shutdown",handler:async()=>(O.info("IPC /shutdown received"),setImmediate(()=>{oe.shutdown("ipc /shutdown")}),{ok:!0})}]}),{port:re,token:Z}=await q.start();await h.start(),ra(f,m).catch(I=>O.warn("auto-revive top-level error (ignored)",{err:String(I)}));let we=null,oe={port:re,token:Z,core:h,ipc:q,shutdown(I){return we||(O.info("daemon shutdown",{reason:I}),we=(async()=>{E?.stop(),await h.stop(I),await q.stop(),await r.release()})(),we)}};for(let I of["SIGTERM","SIGINT"])process.on(I,()=>{oe.shutdown(I).then(()=>process.exit(0))});return O.info("daemon ready",{port:re,pid:process.pid,nodeVersion:process.version,platform:process.platform,frameworks:Object.keys(o.frameworksCache??{}),libVersion:o.libVersion??"dev"}),oe}function na(r){return r.length<=8?"***":`${r.slice(0,4)}***${r.slice(-4)}`}function tu(r,e,i){return`${r??""}|${e??""}|${i??""}`}async function nu(r,e){let{readdir:i}=await import("node:fs/promises"),o;try{o=await i(r.agentsRoot)}catch{return}let{loadAgentConfig:c,enforceAgentConfigMode:f}=await Promise.resolve().then(()=>(Ue(),rn));for(let u of o){await f(u,r).catch(h=>O.warn("enforceAgentConfigMode failed (ignored)",{agentId:u,err:String(h)}));try{let h=await c(u,r);h?.disconnectedAt&&(e.disconnectedAgents.add(u),O.info("agent marked disconnected on startup",{agentId:u,disconnectedAt:h.disconnectedAt,reason:h.disconnectReason??""}))}catch(h){O.warn("failed to load agent config on startup, skipping",{agentId:u,err:String(h)})}}}async function ru(r,e,i,o){let{loadAgentConfig:c}=await Promise.resolve().then(()=>(Ue(),rn)),f=await c(r,e);if(f){O.info("--agent-id: local config found, reconnecting",{agentId:r,framework:f.framework,hadDisconnect:!!f.disconnectedAt});let w={agentId:f.agentId,framework:f.framework,...f.cozeIdentity?{cozeIdentity:f.cozeIdentity}:{},...f.model?{model:f.model}:{}};return await i.createAgent(w),{ok:!0,agentId:r,note:f.disconnectedAt?"revived from local config":"connected from local config"}}O.info("--agent-id: local config missing, pulling _agent/detail from cloud",{agentId:r});let u=await o({_meta:{cozeAgentId:r}});if(!u.framework)throw new C("AGENT_NOT_FOUND",`agent ${r} \u4E0D\u5728\u672C\u5730; \u4E91\u7AEF _agent/detail \u54CD\u5E94\u7F3A framework \u5B57\u6BB5 (D36 \u534F\u8BAE\u6269\u5C55\u672A\u751F\u6548), \u65E0\u6CD5\u5728\u672C\u673A\u65B0\u5EFA`);let h={agentId:u.agentId,framework:u.framework,...u.cozeIdentity?{cozeIdentity:u.cozeIdentity}:{},...u.model?{model:u.model}:{},...u.deployType?{_meta:{cozeDeployType:u.deployType}}:{}};await i.createAgent(h);let m=u.deployType==="cloud"&&u.framework==="openclaw";return{ok:!0,agentId:r,note:m?"cloud agent acknowledged":"created from cloud detail"}}async function ra(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(),rn));O.info("auto-revive: scanning local agents on startup",{count:o.length});let f=0,u=0;for(let h of o){let m;try{m=await c(h,r)}catch(w){O.warn("auto-revive: load config failed (skipping)",{agentId:h,err:String(w)}),u+=1;continue}if(!m){u+=1;continue}if(m.disconnectedAt){O.info("auto-revive: skip disconnected agent",{agentId:h,disconnectedAt:m.disconnectedAt}),u+=1;continue}try{O.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}}:{}}),f+=1}catch(w){O.warn("auto-revive: createAgent failed (skipping)",{agentId:h,framework:m.framework,err:String(w)}),u+=1}}return O.info("auto-revive: done",{revived:f,skipped:u,total:o.length}),{revived:f,skipped:u,total:o.length}}ns();ae();import{readFile as oa}from"node:fs/promises";var Je=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 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:du(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([oa(this.paths.portFile,"utf8"),oa(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 f=new AbortController,u=setTimeout(()=>f.abort(),i.timeoutMs??5e3);try{let h=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:f.signal}),m=await h.text();return{status:h.status,body:uu(m)}}finally{clearTimeout(u)}}};function uu(r){if(!r)return null;try{return JSON.parse(r)}catch{return r}}function du(r){return r instanceof Error?r.message:String(r)}U();ae();import{copyFile as aa,mkdir as lu,readFile as rs,writeFile as hu}from"node:fs/promises";import{dirname as gu,resolve as ss,sep as tr}from"node:path";import{fileURLToPath as pu}from"node:url";U();ae();var ca=L("dist-install");function mu(r){let e=pu(r),i=gu(e),o=`${tr}src${tr}`;if(i.includes(o)||i.endsWith(`${tr}src${tr}cli`))return null;let c=ss(i,"index.js"),f=ss(i,"..","package.json");return{dist:c,pkgJson:f}}async function xa(r={}){let e=r.paths??j(),i=mu(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 f;try{f=JSON.parse(await rs(c,"utf8")).version??"unknown"}catch(_){return ca.warn("cannot read source package.json,skip dist install",{err:String(_)}),{kind:"dev-mode-skip",reason:`package.json read failed: ${String(_)}`}}let u=await Pn(e.configFile)??{},h=u.libVersion;if(h===f)try{return await rs(e.libEntry),{kind:"already-current",libVersion:f}}catch{}await lu(e.libDir,{recursive:!0}),await aa(o,e.libEntry),await aa(`${o}.map`,`${e.libEntry}.map`).catch(()=>{});let m=ss(e.libDir,"package.json"),w=`${JSON.stringify({type:"module"},null,2)}
|
|
94
|
+
`;return await rs(m,"utf8").catch(()=>null)!==w&&await hu(m,w),u.libVersion=f,await gt(u,e.configFile),ca.info("dist installed",{libEntry:e.libEntry,fromVersion:h,toVersion:f}),h?{kind:"version-changed",fromVersion:h,toVersion:f,libEntry:e.libEntry}:{kind:"first-install",libVersion:f,libEntry:e.libEntry}}var Mu=L("cli");function Et(r,e){let i=[],o;for(let c=0;c<r.length;c++){let f=r[c];if(f===e){o=r[c+1],c+=1;continue}if(f.startsWith(`${e}=`)){o=f.slice(e.length+1);continue}i.push(f)}return{value:o,rest:i}}function Bu(r){let e=r.slice(2);if(e.includes("--version")||e.includes("-v"))return{mode:"version"};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}=Et(i,"--pat-token");i=c;let{value:f,rest:u}=Et(i,"--pair-code");i=u;let{value:h,rest:m}=Et(i,"--env");i=m;let{value:w,rest:y}=Et(i,"--handshake-url");i=y;let{value:_,rest:E}=Et(i,"--frontier-url");i=E;let{value:A}=Et(i,"--agent-id");if(!o||!f)return{mode:"help"};let k={mode:"pair",privatecode:o,pairingCode:f};return h&&(k.env=h),w&&(k.handshakeUrl=w),_&&(k.frontierUrl=_),A&&(k.agentId=A),k}var zu=`
|
|
95
95
|
coze-bridge - local bridge daemon for cloud Agent Service
|
|
96
96
|
|
|
97
97
|
Usage:
|
|
@@ -100,6 +100,7 @@ Usage:
|
|
|
100
100
|
npx -y coze-bridge@latest --stop stop daemon
|
|
101
101
|
npx -y coze-bridge@latest --refresh re-detect agent binaries (claude/codex/openclaw)
|
|
102
102
|
npx -y coze-bridge@latest --uninstall stop daemon + remove ~/.coze
|
|
103
|
+
npx -y coze-bridge@latest --version print current Bridge version (D63)
|
|
103
104
|
|
|
104
105
|
Required (for pair):
|
|
105
106
|
--pat-token <sat_xxx> coze PAT token (\u4ECE coze \u5E73\u53F0\u62FF)
|
|
@@ -118,35 +119,36 @@ Auto-connect agent (optional):
|
|
|
118
119
|
|
|
119
120
|
Internal:
|
|
120
121
|
<node> <entry> --daemon daemon mode (OS supervisor only)
|
|
121
|
-
`.trimStart();async function
|
|
122
|
-
`),
|
|
122
|
+
`.trimStart();async function ga(r=process.argv,e={}){let i=Bu(r);switch(i.mode){case"help":return process.stdout.write(zu),0;case"version":return process.stdout.write(`${dn}
|
|
123
|
+
`),0;case"daemon":{try{await sa()}catch(o){return Mu.error("daemon start failed",{err:String(o)}),1}return new Promise(()=>{})}case"status":return qu(e);case"stop":return Fu(e);case"refresh":return Uu(e);case"uninstall":return Hu(e);case"install-service":return Ku();case"pair":{let o={};return i.env&&(o.env=i.env),i.handshakeUrl&&(o.handshakeUrl=i.handshakeUrl),i.frontierUrl&&(o.frontierUrl=i.frontierUrl),ju(i.privatecode,i.pairingCode,e,o,i.agentId)}}}async function pa(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 qu(r){let e=r.paths??j(),i=new Je(e),o=await i.probe();if(o.kind==="not-running")return process.stdout.write(`coze-bridge: not running
|
|
124
|
+
`),1;if(o.kind==="stale")return await pa(e),process.stdout.write(`coze-bridge: not running (cleaned stale state)
|
|
123
125
|
`),1;let c=await i.request({method:"GET",path:"/status"});return process.stdout.write(`coze-bridge: running
|
|
124
126
|
${JSON.stringify(c.body,null,2)}
|
|
125
|
-
`),0}async function
|
|
126
|
-
`),0;if(
|
|
127
|
+
`),0}async function Fu(r){let e=r.paths??j(),i=new Je(e),o=await i.probe();if(o.kind==="not-running")return process.stdout.write(`coze-bridge: not running
|
|
128
|
+
`),0;if(o.kind==="stale")return await pa(e),process.stdout.write(`coze-bridge: not running (cleaned stale state)
|
|
127
129
|
`),0;try{return await i.request({method:"POST",path:"/shutdown"}),process.stdout.write(`coze-bridge: stopped
|
|
128
130
|
`),0}catch(c){return process.stdout.write(`coze-bridge: stop failed: ${String(c)}
|
|
129
|
-
`),1}}async function
|
|
130
|
-
`),1;try{let
|
|
131
|
-
${JSON.stringify(
|
|
132
|
-
`),0):(process.stderr.write(`coze-bridge: refresh failed: ${JSON.stringify(
|
|
133
|
-
`),1)}catch(
|
|
134
|
-
`),1}}async function
|
|
135
|
-
`);try{await e.request({method:"POST",path:"/shutdown"})}catch(
|
|
136
|
-
`)}await new Promise(
|
|
137
|
-
`)}catch(
|
|
138
|
-
`)}let
|
|
139
|
-
`)}catch(
|
|
131
|
+
`),1}}async function Uu(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)
|
|
132
|
+
`),1;try{let o=await e.request({method:"POST",path:"/refresh"});return o.status===200?(process.stdout.write(`coze-bridge: refreshed
|
|
133
|
+
${JSON.stringify(o.body,null,2)}
|
|
134
|
+
`),0):(process.stderr.write(`coze-bridge: refresh failed: ${JSON.stringify(o.body)}
|
|
135
|
+
`),1)}catch(o){return process.stderr.write(`coze-bridge: refresh failed: ${String(o)}
|
|
136
|
+
`),1}}async function Hu(r){let e=new Je(r.paths);if((await e.probe()).kind==="connected"){process.stdout.write(`coze-bridge: stopping daemon...
|
|
137
|
+
`);try{await e.request({method:"POST",path:"/shutdown"})}catch(f){process.stderr.write(`coze-bridge: stop failed (continuing): ${String(f)}
|
|
138
|
+
`)}await new Promise(f=>setTimeout(f,500))}if(!r.skipSupervisor)try{let{getSupervisor:f,buildContext:u}=await Promise.resolve().then(()=>(us(),fs)),h=f();await h.uninstall(u()),process.stdout.write(`coze-bridge: ${h.platform} supervisor unregistered
|
|
139
|
+
`)}catch(f){process.stderr.write(`coze-bridge: supervisor uninstall failed (continuing): ${String(f)}
|
|
140
|
+
`)}let o=r.paths??j(),{rm:c}=await import("node:fs/promises");try{await c(o.cozeRoot,{recursive:!0,force:!0}),process.stdout.write(`coze-bridge: removed ${o.cozeRoot}
|
|
141
|
+
`)}catch(f){return process.stderr.write(`coze-bridge: remove failed: ${String(f)}
|
|
140
142
|
`),1}return process.stdout.write(`coze-bridge: uninstalled
|
|
141
|
-
`),0}async function
|
|
142
|
-
`),await i.install(
|
|
143
|
+
`),0}async function Ku(){try{let{getSupervisor:r,buildContext:e}=await Promise.resolve().then(()=>(us(),fs)),i=r(),o=e();return process.stdout.write(`coze-bridge: installing ${i.platform} supervisor...
|
|
144
|
+
`),await i.install(o),process.stdout.write(`coze-bridge: supervisor installed (daemon will auto-start on login)
|
|
143
145
|
`),0}catch(r){return process.stderr.write(`coze-bridge: --install-service failed: ${String(r)}
|
|
144
|
-
`),1}}async function
|
|
145
|
-
`),(await
|
|
146
|
-
`)}let h=await
|
|
147
|
-
`),await
|
|
148
|
-
`),1;let m={privatecode:r,pairing_code:e};
|
|
146
|
+
`),1}}async function ju(r,e,i,o={},c){let f=new Je(i.paths),u=i.spawnDaemon??ia;if(!i.skipDistInstall){let w=await xa({paths:i.paths});w.kind==="version-changed"?(process.stdout.write(`coze-bridge: upgraded ${w.fromVersion} \u2192 ${w.toVersion}
|
|
147
|
+
`),(await f.probe()).kind==="connected"&&(await f.request({method:"POST",path:"/shutdown"}).catch(()=>{}),await new Promise(_=>setTimeout(_,500)))):w.kind==="first-install"&&process.stdout.write(`coze-bridge: installed ${w.libVersion}
|
|
148
|
+
`)}let h=await f.probe();if(h.kind!=="connected"&&(process.stdout.write(`coze-bridge: starting daemon...
|
|
149
|
+
`),await u({paths:i.paths}),h=await Gu(f,i.waitTimeoutMs??1e4,i.sleep??Wu),h.kind!=="connected"))return process.stderr.write(`coze-bridge: daemon did not come up: ${h.kind}
|
|
150
|
+
`),1;let m={privatecode:r,pairing_code:e};o.env&&(m.env=o.env),o.handshakeUrl&&(m.handshake_url=o.handshakeUrl),o.frontierUrl&&(m.frontier_url=o.frontierUrl),c&&(m.agent_id=c);try{let w=await f.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
151
|
`),0):(process.stderr.write(`coze-bridge: pair failed: ${JSON.stringify(w.body)}
|
|
150
152
|
`),1)}catch(w){return process.stderr.write(`coze-bridge: pair failed: ${String(w)}
|
|
151
|
-
`),1}}async function
|
|
153
|
+
`),1}}async function Gu(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 Wu(r){return new Promise(e=>setTimeout(e,r))}ga(process.argv).then(r=>process.exit(r),r=>{process.stderr.write(`fatal: ${r instanceof Error?r.stack??r.message:String(r)}
|
|
152
154
|
`),process.exit(1)});
|