coze-bridge 0.1.12 → 0.1.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +38 -38
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -5,25 +5,25 @@ import { dirname as __coze_dirname } from 'node:path';
5
5
  const require = __coze_createRequire(import.meta.url);
6
6
  const __filename = __coze_fileURLToPath(import.meta.url);
7
7
  const __dirname = __coze_dirname(__filename);
8
- var H0=Object.create;var fr=Object.defineProperty;var j0=Object.getOwnPropertyDescriptor;var G0=Object.getOwnPropertyNames;var W0=Object.getPrototypeOf,J0=Object.prototype.hasOwnProperty;var J=(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),vs=(r,e)=>{for(var i in e)fr(r,i,{get:e[i],enumerable:!0})},V0=(r,e,i,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let x of G0(e))!J0.call(r,x)&&x!==i&&fr(r,x,{get:()=>e[x],enumerable:!(a=j0(e,x))||a.enumerable});return r};var Pe=(r,e,i)=>(i=r!=null?H0(W0(r)):{},V0(e||!r||!r.__esModule?fr(i,"default",{value:r,enumerable:!0}):i,r));import{chmod as Y0,mkdir as X0,readFile as Z0,rename as Ss,writeFile as Cs}from"node:fs/promises";import{dirname as $0}from"node:path";async function Gt(r){try{let e=await Z0(r,"utf8");return JSON.parse(e)}catch(e){if(e.code==="ENOENT")return null;throw e}}async function Wt(r,e,i){await X0($0(r),{recursive:!0});let a=`${JSON.stringify(e,null,2)}
9
- `,x=`${r}.tmp-${process.pid}-${Math.random().toString(36).slice(2,10)}`;try{i?.mode!==void 0?await Cs(x,a,{encoding:"utf8",mode:i.mode}):await Cs(x,a,"utf8"),await Ss(x,r),i?.mode!==void 0&&await Y0(r,i.mode)}catch(f){await Ss(x,x).catch(()=>{});let{rm:l}=await import("node:fs/promises");throw await l(x,{force:!0}).catch(()=>{}),f}}var ur=Ie(()=>{"use strict"});function Ds(r){return Vt[Es]<=Vt[r]}function dr(r){As={...r}}function Jt(r,e,i,a){if(Vt[r]<Vt[Es])return;let x=JSON.stringify({ts:new Date().toISOString(),level:r,module:e,msg:i,...As,...a});r==="error"||r==="warn"?ea.write(`${x}
10
- `):Q0.write(`${x}
11
- `)}function R(r){return{debug:(e,i)=>Jt("debug",r,e,i),info:(e,i)=>Jt("info",r,e,i),warn:(e,i)=>Jt("warn",r,e,i),error:(e,i)=>Jt("error",r,e,i),child:e=>R(`${r}.${e}`)}}var Vt,Es,Q0,ea,As,K=Ie(()=>{"use strict";Vt={debug:10,info:20,warn:30,error:40},Es=(()=>{let r=process.env.COZE_BRIDGE_LOG_LEVEL;return r==="debug"||r==="info"||r==="warn"||r==="error"?r:"info"})(),Q0=process.stdout,ea=process.stderr,As={}});import{homedir as ta}from"node:os";import{join as ee}from"node:path";function H(r){let e=r??ta(),i=ee(e,".coze"),a=ee(i,"bridge"),x=ee(a,"lib");return{cozeRoot:i,bridgeRoot:a,libDir:x,libEntry:ee(x,"index.js"),pidFile:ee(a,"bridge.pid"),portFile:ee(a,"bridge.port"),tokenFile:ee(a,"bridge.token"),logFile:ee(a,"bridge.log"),installLock:ee(a,"install.lock"),configFile:ee(a,"config.json"),agentsRoot:ee(i,"agents")}}function Te(r,e=H()){let i=ee(e.agentsRoot,r);return{root:i,config:ee(i,"config.json"),workspace:ee(i,"workspace"),logs:ee(i,"logs")}}var oe=Ie(()=>{"use strict"});var Zt={};vs(Zt,{AGENT_CONFIG_FILE_MODE:()=>Yt,enforceAgentConfigMode:()=>sa,loadAgentConfig:()=>ae,persistAgentSessions:()=>lr,persistAgentSkills:()=>Xt,saveAgentConfig:()=>ge});import{chmod as na,stat as ra}from"node:fs/promises";function ae(r,e){return Gt(Te(r,e).config)}function ge(r,e){return Wt(Te(r.agentId,e).config,r,{mode:Yt})}async function sa(r,e){if(process.platform==="win32")return;let i=Te(r,e).config;try{let a=await ra(i);if(!a.isFile())return;let x=a.mode&511;x!==Yt&&(await na(i,Yt),ks.warn("agent config mode auto-corrected to 0600",{path:i,from:x.toString(8)}))}catch(a){if(a.code==="ENOENT")return;ks.warn("enforceAgentConfigMode: chmod failed (ignored)",{path:i,err:String(a)})}}async function lr(r,e,i){let a=await ae(r,i);a&&(a.sessions=Object.fromEntries(e),await ge(a,i))}async function Xt(r,e,i){let a=await ae(r,i);a&&(a.skills=e,await ge(a,i))}var ks,Yt,Ue=Ie(()=>{"use strict";ur();K();oe();ks=R("agent-config"),Yt=384});var di=ie(j=>{"use strict";var S=P;(function(r,e){let i=P,a=r();for(;;)try{if(parseInt(i(1185))/1*(parseInt(i(1860))/2)+-parseInt(i(1009))/3+parseInt(i(1324))/4+parseInt(i(833))/5*(-parseInt(i(534))/6)+parseInt(i(1079))/7*(-parseInt(i(1533))/8)+-parseInt(i(931))/9*(-parseInt(i(1814))/10)+parseInt(i(526))/11*(parseInt(i(753))/12)===e)break;a.push(a.shift())}catch{a.push(a.shift())}})(vn,828896);function P(r,e){r=r-378;let i=vn(),a=i[r];if(P.WIebtq===void 0){var x=function(m){let _="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=",b="",w="";for(let C=0,k,T,L=0;T=m.charAt(L++);~T&&(k=C%4?k*64+T:T,C++%4)?b+=String.fromCharCode(255&k>>(-2*C&6)):0)T=_.indexOf(T);for(let C=0,k=b.length;C<k;C++)w+="%"+("00"+b.charCodeAt(C).toString(16)).slice(-2);return decodeURIComponent(w)};P.eZGfgU=x,P.ZQPubA={},P.WIebtq=!0}let f=i[0],l=r+f,h=P.ZQPubA[l];return h?a=h:(a=P.eZGfgU(a),P.ZQPubA[l]=a),a}var yx=Object[S(1676)+"operty"],bx=Object[S(400)+S(1366)+S(1308)],ai=(r,e)=>function(){return r&&(e=(0,r[{wupeG:function(x,f){return x(f)}}.wupeG(bx,r)[0]])(r=0)),e},vx=(r,e)=>{let i={wVjQY:function(x,f,l,h){return x(f,l,h)}};for(var a in e)i.wVjQY(yx,r,a,{get:e[a],enumerable:!0})};function Sx(){return ni||(ni=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function Cx(){let r=S;return ri||(ri=[IDBCursor[r(1276)+"e"].advance,IDBCursor[r(1276)+"e"][r(1787)],IDBCursor[r(1276)+"e"][r(1787)+r(733)+"ey"]])}function Ex(r){let e=S,i={fjTlc:function(x,f){return x(f)},EwidR:function(x){return x()},KLNwn:function(x){return x()},VLkwd:e(831),GSaRr:e(1227),UrXVl:function(x,f,l){return x(f,l)},eAoeU:e(1559)+"t",CosvY:e(715),NKWdF:function(x,f){return x===f},JRgiL:e(1260)},a=new Promise((x,f)=>{let l=e,h={iaXjE:l(1227),mkUxG:function(w,C){return i[l(1443)](w,C)},jDFBG:function(w){return i[l(1854)](w)}},m=()=>{let w=l;r[w(447)+w(502)+w(1163)](w(831),_),r[w(447)+w(502)+"ner"](h[w(976)],b)},_=()=>{let w=l;x(i[w(1443)](Ce,r[w(721)])),i[w(452)](m)},b=()=>{let w=l;h[w(1638)](f,r[w(1227)]),h[w(1278)](m)};r[l(635)+"Listener"](i.VLkwd,_),r.addEventListener(i[l(1118)],b)});return a[e(1407)](x=>{let f=e;if(x instanceof IDBCursor)if(i[f(1747)](i[f(1241)],f(1370))){let l=i[f(1007)](_0x4ca72c,i[f(1773)],{message:i[f(1650)]});this["onStartR"+f(918)]&&this["onStartR"+f(918)](l)}else wr[f(756)](x,r)}).catch(()=>{}),Cn[e(756)](a,r),a}function vn(){let r=["Dvb6wLO","q0vkDge","DfbZyLG","Ef9MCM9UDgK","y2HHCKnVzgu","Cg9PBNrdB24","wM9SD0m","DgfIyxnL","z2v0sxrLBq","zw5JB2rLrNi","Ew50swi","t0Hutha","quHTvgW","swngrwe","rwPnBMq","y3jLyxrLt3a","x2rLC3rYB3K","Bg9Nsurhzw4","uvzmvK0","zxmGCMvHy2G","B21tv0e","AgjRtK8","DcbSAw1PDa","yMfSu2nVCgu","zMX1C2HfEha","twLZC2LUzYa","quzjuNu","x3bHDgHlzxK","Duz6yLK","zNbgvgi","sLr4CwC","DMvYC2LVBMm","y3jLyxrLq2W","wLDbt3u","zufns2G","CMfTugfYyw0","Ber5qxC","Bu9vyNi","uNn4z0S","Dgv6reW","y2vZC0HHBMq","tKTxzey","sfDsD3O","rgnjCem","zffjsLO","A01fy1y","x3vYBa","zujWBvq","u2vXsuq","ChvZAa","ChjVDg9JB2W","AxnrB1nnzxm","u2jlCg0","tfPhvLi","q2fRALK","BKLnEeO","zNjHBwvuExa","DLPXyva","B1Desuy","Dg9iyxnO","tuDoswu","x2jPBMfYEvq","swH3wwO","y3vYDMfSDwu","BLPztLi","zcWG","sKzQCfy","zufVzvu","vLv0r00","BNrczgG","Bw5xuxO","A05wtKC","ug1Vu2C","rfHwALi","EwDwruu","yMLUyxj5vhK","BgPfuhe","Be1OAhm","r0rtuuG","r1vmugu","Ag5yBhG","y29UDgLUDwu","BxrzD1q","shvuv24","zgvSzxrLrge","BffKCfK","sgHxCxy","yxv0B21HDgK","BMv3vMvYC2K","CMvXDwLYzwq","tgfrEM8","Bhb5u1K","x3fVC0rc","ExbL","C0TRvvu","B1zZAxa","CunuzuG","yNPeD2y","zLvZCMW","rMTSr04","tg9NsurozxC","C0XPC3rLBMu","DMvUDa","zNjVBunOyxi","BMXVsKW","yM9L","AxbrDg4","rLP2ExK","mtbxAfLKuLK","zLbkEhe","Bw9TCeq","A0jQA3u","CuP5Aei","sKX3q0K","Auz4ANG","t1fJwxm","s0T0s2y","zM1br0y","B2fK","BgLZDgvUtMu","z29PBMCGyxC","BwrXvKu","tefcDhC","BNrbBMrvCgq","ihn1y2nLC3m","tg9Nsuq","zwrWv0W","x29Uq2XVC2u","qw5TCNC","Dener3i","sLnptLa","tKfPqNq","v2LjsMS","yvfxA2y","txPkq28","vhnJtKK","sxLVDxO","DMfSDwu","suXxAMW","rw1wDgi","D3njDK8","BNruCMLLC0m","z1PgA3a","DhjHBNnHy3q","x2rPC3bHDgm","ExHyExK","DKffAwS","q2DOrey","s0XoD24","Aw5JBhvKzxm","zKPdzeW","AwDHDg9Yt24","D0jWCKu","z2PTDvi","mLjtq0LoqW","EwPnsfK","C3nHz2vfDMu","DuPNAuu","u0LSBxm","sgv0DMO","vejuzMK","Dwj6uuO","BLbhyLC","Axf4tgq","zenNBLC","v3fwC0C","ANfRy1q","EKrkrxm","y29UDgv4Da","A0HPzMu","ywXPzcb1CMW","ywDL","AffSuee","CMvHC29U","DhjPzxmGCMu","Dhj3vMq","x2XPC3rLBMu","m3W0Fdj8mhW","zxH0zw5ZAw8","AwrI","zMjIqKS","EeXMB1O","q291BNq","r1jKweO","ihrYEsbYzwm","BfDSBxu","qLrWt3i","EMjLwhe","C3L2C24","Aw50zwDLCIa","BvPbvLO","AfbyBee","txfREgi","BwvZC2fNzv8","igzPzwXKoIa","B3vIueW","y2uGBM90igK","x21LC3nHz2u","yuL1tuK","qLrxDNO","ExzjA1G","x2rItMfTzq","C2vYDMLJzq","y25PCeq","zg9Uzq","zgLZCgf0y2G","ENrxs3O","tNvYzMm","Cg9PBNrbBMq","sKTdtg8","CMvZzxrfBMq","Ahr0Chm6","BNrfBMrWB2K","suHxrxO","D3nZoI8V","EsbJBg9Zzwq","z2v0t3DUuhi","vLDKEu4","y29Kzq","C0z5yKS","BwvZC2fNztO","q2TJzuO","vNzgC1a","x3bPBMDqB24","uxDPzeG","AgjSB2S","DxbKyxrLq3u","uMfIuxy","DMzRANu","DhvJvey","rwzhCgm","vfbUz3O","vMXksve","DMvLtMq","Dg9cExrLCW","EwTcwxe","uK5Qz2e","BwjrCK8","y1rSCKK","t3bdDwC","Aw5Lza","y3jLyxrLt2i","BMDLza","wxn4Eg0","vxDUEw4","y3r4","u0zkre4","BMnrtfm","qwLHBMC","yMLUyxj5","zwn0","sg56vKS","CMfNzvn5BMm","yw1LoIa","BgD5C3O","wuTksKS","svnnCMG","zw5fDMvUDa","wxviz3q","qMzpEwi","zw50","tejewey","BNnqD1q","CMvTB3zLrxy","EfL2r0y","B25szwnLAxy","BvPtEhq","s0D2v0O","rxDPzfi","Dg9hzw5LCMe","thr2ywS","DLvXCLG","EwjkBha","uM14Ag0","D3f4vfO","sgjdufy","Dgv4Dc9Qyxy","CKz4y3K","ywrKq291BNq","DeLK","tMfTzq","s0net0S","DKDVzge","rKLmrv9ot1q","x2fKzfDZtgK","BM5ssgC","q3zsrhe","vLHruhe","s0zHuMS","zwvVA2i","D0vkDLO","C2vUza","AxjLza","wMf0B1m","yLvWwfi","CMfTzq","Cvj6ufG","wg90q0O","r0HnBNG","vNLpBxG","ywrK","BgLUzw5V","t0XdEgK","su5Pyue","wKPSwMm","C0ruDeW","mdaWma","BNrLCG","Dw50","wLf5wuK","AgLNAa","t1PMuuy","zKDduMC","q3vZDg9Tq2W","AM9PBG","revcANe","DeLUDgvYy2u","ig1LC3nHz2u","zw50tgLZDgu","BwvY","z2v0q3vYCMu","ANvYD2i","CM92AwrLige","zKH3vKq","AeXiENi","Dxrjza","B25dBg9Zzq","AwDjtKm","sKP3z1u","ueT4Aha","yMrtt2e","zxjYtM8","q3DJsw8","B25TzxnZywC","CwvvBM4","svfVAgK","AM5ytKO","uKXfrvG","C29YDa","svflCeS","CenxB1i","BMnLq2XVC2u","otLvv0TQwNG","zujvChC","vgfN","yMfJA3vWigu","B25nzxnZywC","zeXKCKq","DgvmB2Djre4","vgXsCKC","mZC5mZHHAvrwwMe","tLfjuvK","uNH2qLO","BuztCMG","zgHkzgm","ignVzgu6ia","rvjst1i","CMvQzwn0","re5lv0e","x2LZsw5PDa","y3vYC29YlNm","qw1VDw50","y29SBM8","AxzzuMS","yw5Nzq","uwPqBgq","z2v0","AMzoz3K","C2v0q3vYC28","Agriu2u","sKvOsvO","B3LvyuW","CwPYD08","zMLN","yMnsDMW","ugjHsgu","y2PmzhC","Dgv4Dc9WBge","y3ruAw1LB3u","zNvUy3rPB24","C3jJ","x2rLyNvN","uvzAuvi","AuzhBKq","uMvHzcbWyxm","B3jL","Ec1TC2CTCw8","r0npyw4","AgvHzgvYCW","uezvue0","qLL0Ewi","wxLJDg4","x21PBMLoyxy","x2vUzhbVAw4","ExDvv1O","BgLUzq","y0DwBwu","AefpC1a","yNLL","BM1uEvq","yxr0CgC","Cg93","CYbWyxjHBxm","CM92AwrLihC","zw50zwqGDhK","B25JBg9Zzq","CMvHzfvjBNq","nxWZFdz8mxW","x2HHBMrSzva","x2nVBM5Ly3q","AxfVAMS","AxLWC2i","tw9KDwXL","Aw9UvgLTzw8","qNfpy0K","y2XVC2uSihC","u3DQtfO","y3vYC29Yx2y","qvzJtNK","vMTss1O","Aw5XuMe","B3D4A1O","tufjBfK","wfLdzee","BxnNsuq","x3nLBMrby2S","B3bLBKrc","s2TusuC","q0HTDum","wND5Bg4","q05kBMC","y2HLy2TdDxi","rhjeyMO","rLjptLrjrvi","wvPOrKS","lcbOB3n0BMe","rLfTqLK","qwjYy20","D2LSBfjLy28","zw5HyMXLuw8","s2jVDuy","y2XVC2u","B25Uzwn0Aw4","DMDgA2e","Bwf4tg9ZC0m","C29Tzq","BezxA3O","Aejoz04","wgTvs2u","uMvJB25Uzwm","zLvVsgS","ywrKrxzLBNq","DxbrqM0","ChrVCG","u2fMwLm","uNHKwxu","CMvTB3zLq2G","B3jLtMfTzxm","t1bftL9fuLi","CNzHBfzHBhu","seXTwNm","CgLUz0XVC3m","zLDqsxO","Dw5KzwzPBMu","wMjNA2e","q2H4rey","ww1KAxq","CMP6uvu","tKLszgi","whbdA3i","BfHzugK","t3bLBKv2zw4","CgLUz09Uy2u","uhLTuvi","B25LCNjVCG","BKXPBMu","wgjwqLu","yNvMzMvY","CKP1qvK","CM92AwrLigi","DgfYz2v0","EMrxuxy","B2zM","Ae1LC3nHz2u","x194x21Zz18","tffPreS","AePPs1K","BeHHBMrSzxi","ve9yEhC","CxnPEgK","y2XLyxi","y2HnyxHdB3u","su5tvefova","ywTbvxK","BwLUzW","EezbD2m","AMHNCuO","zKnru0K","D24GCMvHC28","DgPqB20","tfrKs0S","ALv2yNu","ywzL","CMHqANm","Bg9N","x3jLBw92zvC","Dg9oDw1Izxi","ve5qB3C","uMzOwxi","y1zbvha","zLfvqLO","qNLSs0m","x3bPBMDmB3m","q0Xpu0LorW","qMD0AeG","rxjYB3jdB2q","CNnVCL9Uyw0","C2fNzq","we1lz28","ihbYB3rVy28","yvzNC0S","AxnmB25N","CNjVCK1LC3m","mNWZFdf8nhW","uNzNy2y","CgfNzxnOB3C","B2zMC2v0","zMLmrvO","y2HLy2Tszwe","BhfOBNO","zLPPAgK","C3rHCNq","sg1otKy","Cgf5Bg9Hzeu","DMfSDwvZ","CMnlr2q","C3bSAxq","CMvZDwX0","zxjFDhrS","vhPPvg8","ywrKt25L","AMz4EwW","sfLbq2W","ENfYqwq","Bwf4uMv0CMK","tLv6tu0","DNnNDxe","AejNrMC","DNHXue0","uhjPBwfYEuS","zw5HyMXLqxu","EwTVBLG","x3jLywr5q2W","v2vIu29JA2u","zw5JB2rPBMC","shrZy08","zgvS","zxq9DxrMltG","rxzQBum","zKrVsLG","yxHVA3i","r1rYA1e","Euruv1K","AKv1qva","mhWZFdr8mNW","zvfbt1O","B3nLza","DvPtuwO","AuDjsuK","ntmWndeYr0fstLHp","t3D2vNu","svjnEvq","C2v0","t1LvDKK","vfPhEu8","ENjUs3K","r25twwO","D2fZq2XLyw4","y1nJBK0","uxvLDwu","A2v5","AhfvCxC","zxDHyxy","A3zgA0q","Dw5RBM93BIa","z2v0qwXS","yxrLq291BNq","yxGGCMv0CMK","zfDVCMTLCKC","zw5NDgG","AwTzrfK","uePxz2u","yKTrAuO","rNvuCvy","vgLTzw91Da","vfHfAKK","AxnVwgC","vMXpvMi","veHPA2q","Aw1LCYbPBIa","qNfRCgS","Dg9cExrLC0W","shbvyMO","C2vYDMLJzs0","rvPYqLG","EvDQEue","BvzsD1u","zxrxB3jRq2G","BMCGB3iGyw4","tgLZDgvUzxi","y29UBMvJDgK","C3vIyxjYyxK","uKfMy0K","u2HHCMvKv28","EMXxDeG","B2LTEvq","x3nLCuLK","CgLUz0LUDgu","Ag1ru0G","D29Hrfm","yNvMzMvYzwq","sgXUA0e","C2vYDMvYvgK","z0ToEeW","AwXLx25HBwu","Du9Ryuu","CMTSrKW","sg9XuuC","Bwu6ia","s1zYtvu","vhDWC1a","u2TPCcbWyxm","rNzqBMi","z0XQBMe","zcbLCNjVCI4","CMvHzg9UBhK","CND5EwO","Au13tw0","CMrpwwC","Bg93","BvPHCNq","CMvWBgfJzui","CMT1swO","tgjhzve","Aw5KzxHpzG","zNjVBNrPzxi","tw1OAu4","C3vJy2vZCW","yM5euhe","nZe1B2Hvwenl","se9qyxm","zhLfDuS","zw5KCg9PBNq","yxHbrhe","Dxrlz2i","qKvlEhO","C0DrwKu","wurtuM4","sxjht3y","wuTRtKK","CMLLC0nVDw4","t1bAAvC","y29UBMvJDeu","yMP2y0C","Aw5KzxGGB3u","BMHHDeC","D1Dyvey","Bhm6ia","B2nRzxrgywK","A2DWvfa","q3H4CuK","sgDXwLa","EK5Lywe","u0nJyuy","t2jtDei","yu5VweO","r3bvzNe","ywjVCNq","vunwq2i","BxnxyNm","qNjPzgDL","mdaWmdaWmda","DxbNCMfKzw4","DgLTzw91Da","BIWGAg9ZDg4","EhnOAvG","vLnmtKG","zK5KDxe","C3bSAwnL","ywnR","DhbizwfKzxi","ywnRDxbfBMq","ihrPBwvVDxq","tgThue0","BwLUAvbYB2C","yxrHlcbKyxq","u2PMCLa","uuTpuMm","zgDHt24","AgfUz2u","AhfTDuu","uMnOz3e","yNL0zxm","y09Wzw4","C1Dbwwu","C3rLBMvYCW","vxDvq2e","ugvnyMu","A2v0ignVBNm","ywXSB2nvBNm","y0vVB3q","Dev2zw50","igzHAwWSig0","q3PoqxK","qNHqDxC","EfHAEKW","B25fCNjVCG","Cw9Z","vfD0B1G","EMLTEuu","v0TNy0m","z29py0W","A1H0yK8","CNfkvNi","x2LZtwLUAvq","vwjIC3e","rNLAuLu","zuvwvhG","x2n1CNnVCK0","zvnrB0S","wxDWC3y","z0XAy2C","y2XLyxjtDg8","ww9yy3m","zwnVBM5Ly3q","quXst1C","BhHbte4","rKzmExi","zLn1yvO","vKX3Aue","qurnELK","Bg9NsurozxC","AwXK","DgvZDa","vNzuqNq","zMzLCG","Cg9W","ote3ntq3m3nYt3rRqW","EMPjB0y","vxrYCwy","x0vysvnu","q3D1te8","D1vmzha","ywDLsgLKzq","AK1eCva","CKrUv2O","Dw5ZAwDUzwq","tgjythG","y29UC3rYDwm","zv9ZDwnJzxm","v3nduvy","z2v0u3rVCMe","AgfZ","DevYC2i","zMz1rvC","CerQAw0","u0LrqMG","tufyx1jfvfi","Auzovvy","tuvtu0fhrv8","Dhj1y3rVCIa","zwzWqKS","y3jLyxrLrxi","Dhvique","rLbIEuK","B3LxAMy","CMvHzhLtDge","zgvIDwC","zxjFAxnFywm","BMnVzgLUzW","nxWX","C2vUzf9Hy2S","BMfTzq","BezSDxnO","yxnZAwDU","Ae11vLi","rgH6C08","ChbL","z1v0rvy","DxrMofDYAxq","uhH0BLy","C3rVCMu","AwfyAKu","CLzvEK4","CNfjDw0","q1f4yLC","Egjpt2C","CgvYC2LZDgu","q1f1D1O","BxnN","CfHgrMG","DhjPzxm","mNWWFdn8nhW","wvfcEwS","Dg9mB3DLCKm","DKXjCxy","Cgu6ia","zgvSzxrL","ALPeB2W","x2LZtwLUAvC","q29UzMLN","y291BNq","yMfyvey","mhWZFdr8mxW","A2r0wMq","CgLUz19VBMm","DuXNr2e","Ahr0Ca","AKHSrKq","x19LC01Vzhu","y2fTzMW","AfznC2W","Du5xuxi","vxjyvMW","zw1LBNq","mZq1nJCYmhDmAeXfCG","z2vtEw5J","CYbPBNn0yw4","wMfkz08","vxbKyxrLq28","BMCGzMfPBgu","D3jPDgvvAw4","ANfOExq","swLUD2O","y29UBMvJDfm","qxL4zKW","zxHWB3j0CW","whjzCMC","C2nYAxb0","B2fqwLi","A29yBNK","tKHMEuy","rhbKvLu","x2HHBMrSzvi","CwzVvhG","tg9RDNO","tMnhzKu","ANDis2q","v3LlzK4","wxDqsNK","B25mAw5L","BwvKAwf0zwW","r2nHvKm","Chr5AeG","ChveruW","zhnZAwm","t3D3Axa","t1PXvMy","B0LJqMW","wvrhwwm","AxnrB1nby2S","ufPHAw0","y09usLe","uNnOuwi","EuryrvG","x3bPBMC","rvv4qKG","CKjPzNC","C1fXEwC","tfrNA1y","rKHbCey","Eu1ZCfC","B2rpD2u","BML0AwfSAxO","EhjsBwi","wvDLwfG","Afr2Avi","vvjUC0W","AMvJDfn0B3i","D1zou1y","Exvhyw4","tKDFrvjst1i","z01mvwG","q3HtA2C","x2nSzwfYugK","wgnmBvq","B2zMBgLUzq","BezvC3O","oxW4Fdf8nNW","sxPpDLi","tLnVs0q","B25ozxr3B3i","CxfTAxu","quXm","y21oque","n1H0rfHHuq","s1Ltuw0","zxjHDg9Y","swv2reC","x1fVu01HBMe","s3vJt0O","y29TCgXLDgu","igXHCMDLCIa","CNzHBa","DKP1Eue","DgHHBIbSB2m","DxrVuMvJB24","A2vfAgC","z09AEe4","ihzHBgLKihm","EfDJwNa","s1Dir2K","Dg9tDhjPBMC","q0nergW","Dg9VigXHCMC","zMzmAw5L","x2n1CNnVCK4","BfHOtwG","m3WWFdj8mxW","DcbVzIbYyw4","ve1ws0C","v1bWyum","y3jLyxrLuMu","x3nVy2TLDa","yMfSrxzLBNq","q3rMueS","tNnSwKO","Eevly3y","AMnwv2K","rgnVy0e","D0jZruW","Ec11C2uT","wNfsthC","C0nVDw50zxi","r1nHuNi","BMDNsgi","yKzuBgy","Dgv4DfbHEwW","B2LltKq","zcWGDw5RBM8","Aejbsvu","whLqzfC","rxDMD1u","sMDQDfa","Ew9OseC","AMvTzxe","yNL0zuXLBMC","C3nQq0O","tMHRBvu","x29UugfNzu4","B25tDgfYDfi","yKHuA0u","Cefgs3m","yxbWBhK","y29UBMvJDca","AejMBw8","seDAzM0","z1HLvNe","wM9vvwW","DvDNzxK","Bwv0Ag9K","uMXyC0y","sKTVCNy","x2n1CNnVCKy","sNntrxa","uufWrwm","swzLzMy","x2LUDgvYDMe","zw5XDwv1zq","BufmDwy","CKLpCNK","x3bYB3rVy28","CLLrz3m","yvriB1C","zw5HyMXLvhi","vwz5C3i","qKjmEge","x2LZqNjVD3m","s0zWBwS","BMvY","vhnLzK8","Chv0","CM92AwrLihy","x2LUAxrqCM8","ALzJBuu","yxbWzw5Kq2G","DKvirK4","x29UvgLTzw8","Bg9IywXty28","C2HPzNq","Cgzvs2u","A2fKExm","BhDRzMm","C2v0u3rVCMe","tvv3Beq","yxbWBgLJyxq","u1LnsNG","y3vYCMvUDeu","y2Pet2q","BM5Ly3q","x2LZtM9Kzq","nJy5ndmXChnxswDk","zgLZywjSzue","shz1uvy","DhLWzq","z2vjBMzVu3K","BMHwzha","B3bLBG","yMXVy2TLza","u3rhufC","zxjYtxnN","y3jLyxrLtwu","DgLLCKPtt04","BMrWB2LUDfq","zwrPyxrLBhK","vKrTshG","vhrnr2y","we51B2m","s1npCMm","x2DLDeLUDgu","tvv0whm","tuXiCuW","ExrfwMu","q29Kzq","t2zmq20","De1RDxm","CMvUDevUzha","yuvjB1i","BhP0qNi","sNDPqKi","y29Uy2f0","DgLUzYbZzxi","zv90Aw1LB3u","DhjPBq","z0DorgK","qLLYDNy","EvDeBxq","q09oveLovuu","sgLZC3C","qxbxEe4","zxjFywnRx20","vg15CgS","lcbTyxGGCMu","zxjYB3i","ExvTuui","zNjVBujPDhm","AenSB3nLrxy","AuzoshO","weDxueO","Dej6z20","DgDvtMG","ENvpB1O","D0TID0G","CMvWBgfJzq","AunryKC","BwvZC2fNzq","yM5lz20","sLjNAuW","vLzOvgK","u3rYyxrLz3K","te5Uwwi","AwXLtMfTzq","ihrPBwvZ","x2zVCM1HDeu","z3Hyrgy","C3rYAw5NAwy","reHzz0G","mtf8mtb8mNW","yxnJCMLWDa","BKPuu3e","x2nSzwfYvgK","A0vvB2y","y3LuDui","seTPtgK","BwfJCfq","B2nRzxrtDwm","sLjsz1a","s1DItgu","ue5Uy0S","re5pr28","vxv4vLG","B25SAw5L","BM93","yMLUza","C0PyBM4","y29UBMvJDa","Aw9Ul2PZB24","y01qEMS","v2firei","B3bLBIa","DgDbtK0","q29mrMu","ChjVDg90Exa","q3vZDg9Trxi","AKrgqKC","zgH3q1y","wML6vNy","CNnVCKzPBgu","rxzLBNq","y2TOAeW","wxPKvNm","C2HmtKe","sMfqyNq","wfPvrwO","x2nYzwf0zvm","quTlAee","tLHwqxK","q2HwEee","DuXws2K","txrxtKC","rNPKC0u","Ehnyy0m","D3jPDgu","uLnfv2S","AKTuzNu","swXhsxa","C2rQsNa","CKL1vwG","vMPizuG","zw1PDa","DMvY","AgDrCKO","DurABhG","lcbxzwjtB2m","BwvZ","CgLMywm","uhfcvw0","rhrHz3O","zgv2AwnLx2K","rvjtteS","q3z0qu0","D1P1A2q","sgLrwuK","yxKSihrYEsa","twjABui","Bvfgtfq","sKrvEe8","AMvIC2C","uMr6t1C","z0TUEeG","ntCYodG4mg53u3jgEa","tKfusvzfx0u","CKzyA3O","EvjLy29UBMu","t2X2ExO","y2fSBa","DwzgCwO","reiGzMfPBgu","DxjS","ELPZsNa","y2HmuMu","thnhrKO","x3DHAxq","s2XZBui","yxv0BW","A2Hrs08","Auv5s0K","vuXZzwC","y2XVC2veqG","ufHwyuG","ywnRpwzYB24","v1PorNi","sunlv2i","DxnLCKLW","y3vYC29Y","txLju2O","sxHzEKm","CgfYC2u","vhnPCwO","vw9UEhy","D3jVBeG","ywX3yxLZ","q0r6uMC","qLnrwg8","uNPJBu8","A2XuuNC","yw51Ce1LC3m","EgLyvxy","zvnctLy","tMzQqxi","AxLsz3G","qKLeu3G","B3bLCNr5tMe","BwfUDwfSihi","B3bLCNr5","zxj2AwnL","D25hrNG","ywXS","B2nRzxq","Dfr4vwG","yw1Lu3bHy2u","zgf0yq","yMXcsfC","CMvKDwnL","B2jQzwn0u3q","CMnqv2G","zuP4rhy","C2XPy2u","zxf1ywXZ","BwHqz3y","sNLeEu8","rxD0EwG","uhP0sLu","zwHbCNG","DKz2tvm","DNb1zuK","x2HHBMrSzu8","C2TWwvK","x29Ut3bLBG","z1rPBwvVDxq","Cgf5Bg9Hzfq","x2LUAxrhBg8","surhA1a","wgv6uwq","yxnL","z2jwAfy","tLHtCw8","wNnmyNG","uM1ywK8","zwPRv2G","zxHrsuG","sLnUBNK","CIb0DhDjra","DgHLBG","ywnOzwq","C3rYAw5N","BgvUz3rO","BwLZzq","D1DjB20","Ae1dqvO","CLzHBhvLCW","ug92swq","vvzRD2y","CxrPyLu","EgDRq00","DvHiywi","x3bYzwzPEa","z2v0q3vYC28","A1n0yxr1C0m","Aw5L","vuPjA1O","ugjcC08","DuvAq1K","x2rYB3bhBg8","uK1LtMW","BgTlDey","wfrUDLy","B25tDg9Wsw0","ywnRx2nVzgu","x2LZv29YA2u","CgXLyxnLiha","D2vI","EuLZuKG","x29WDgLVBNm","BfrPBwvVDxq","tMvrCwK","uvb1z0y","CMvJzwL2zwq","y01sz0W","zMPuBgm","uuLAu04","zNjVBu51Bwi","yuvZsg0","Cw9Zx18","BgD1A1m","rgvKAwnHDgu","sfrzqvG","tLfWCKy","A25Qz3y","EgDqv3q","x25HDMLNyxq","vuDKruS","x0rctMfTzq","CfnUvfa","Ber4CLq","yM9KEq","vuPorKG","DeXovNq","y3fvs3y","AefJA01LC3m","zfzSDfG","D21fEhK","Aw47y2HHCNm","qvnXtK0","AKPurMi","s0DYteK","yuDdDeK","ywXty29Wzq","C3vIC3rYAw4","wKzQBM4","CLPkteK","zwvKzwq","tMrrDuS","CMvJzxzPzwq","BgLTAxq","uLjpuG","CgLUz1rPBwu","ywnRtxnNswq","Aejyywm","ENPyr1u","ywDLu2HVDW","swvVEMm","vxPWD0e","CwTRsvG","uM5TALe","sMn1quC","sfnKCLC","y3vZDg9Tshq","u2v4zKC","qLDsyKe","BMDuAw1LCG","CgfNzwHPzgu","CMLADwG","zMXVB3i","tNzsr0C","y3vYC29Yx24","x2rPC2nVBM4","vM9YDhu","B3vUDa","CMTLCKDSB2i","zgvJB2rLzey","BMvJDa","yw5Hz2vY","BLvprgW","BMrWB2LUDca","Aw5KzxG","AevYCM9Yrxy","z2vY","ENbcA0S","D3m6lY8","rgnvDem","C1fdq0W","s2PJs3G","DhzQD1a","zMLSDgvY","jMPZy2fSBgi","rfLsAfe","CgXPuNG","x3jLy29UBMu","t1bftG","yxfHu3G","y3vYCMvUDeK","zufJAW","Cg9Yt0u","q3jxuha","zM9Yy2u","rfbkqK8","q0f3wwq","rLDt","nta2ota1nKf4Ew51Aa","v2vPEgLUsLm","vgnetgK","B2XKvMvYC2K","suvtx0vsuK8","x3DZ","v1vpsMq","A2v5CW","ywnRx2LK","CNnVCL92ywW","Ae9Wzw5fDMu","r2TOAvO","EwvYBKO","De1HBMfNzxi","Axnby2TdBgu","q0Huvhe","AgvKtwf4uMu","z2v0s2v5","C1rwr3a","wffZC2C","sKvzuMi","rNjVBNrPzxi","ANDmthi","u0rzyuC","Cxz3rM0","z1beB1e","CMvJB25Uzwm","uxjysLy","CxzjtLC","qu11v2u","tfzwCu4","q3n4v1m","sMj6Egm","BLH4wuS","t2HeDge","zePNugG","DLLnCNO","qwjVCNrfCNi","seXODeK","ExfZDgS","twvZC2fNzuu","sgvyDg0","ywXSq3vYC28","BwfW","A0HfwuK","uhfryNC","u2Leuhy","qxLgv2i","y2HnyxHuCMK","CMfUzg9T","vfvhshq","DKrNBg4","zerczee","B3jpBMXPBMu","D1nVA0O","zMLSzw5HBwu","zMLUza","EeHfqKq","x2DLBMvYyxq","uKrpuhG","CMvZB2X2zq","AxfoEgW","Egfxzum","DwHJuM8","uK5nBMu","zvvYBa","Aw9U","txzvt3C","we1rDLO","B1f1rfO","AxnszwfKEq","B2LUDfjLywm","z2v0qwXSs2u","z2TNsNe","BgvY","Dfj4ufa","AenMqxy","C2zvsKq","C3rVCcbPBw0","zxH0ugf5Bg8","q25pB1K","yw1L","BMrLEa","AxnFywnR","EK9ws1a","whbjtxi","BKXWu1q","tffqB0e","wff0Ae0","wKL5zfu","Dg9Y","wen5C3u","AxnAzxjV","EfjNt3m","EwrLs08","quTtDeO","suHIrge","C2v0zgi","B3nLrxzLBNq","CMvMtgy","rNrJAuu","x29UtwvZC2e","yw5ZzM9YBvq","Aw5PDcbrB1m","t0Psu3u","BwTvEeC","t1n4vhi","AgfZt3DUuhi","yNL0zu9MzNm","nxWW","CgjICdi","Buzpq1u","zKTvuuy","t2jQzwn0","C2DPza","EgjQweK","yKvhuKS","q29ZDLK","x2LUAxq","zwTtC28","vgXZt1C","CM9YrxzLBNq","tg9JAW","wgzWzha","tKPzqwK","A21kyMO","t0LusMO","vw5Oyw5KBgu","teD2sva","suHgr0K","rhHLD1i","EMLmr0q","vuvkrfC","Cgf5Bg9Hza","Ec1TC2CTy3u","sKTVsuG","q0Xpu0ve","sMjkswi","DgPLrwi","x29UrxjYB3i","ru1uAMS","q09otKvdveK","yvD6z0C","zgvMAw5Luhi","DgLTzw91DcW","EwrWyMW","r0jkweS","B25VCgvU","t3fKsMm","CMvZzxrdB3u","zNDZxZeUmc4","x3DZsw5ZDge","BxDvDhe","we1JsuO","vxvvr3a","zNjVBuj5Dgu","CKfeuMC","BLLQvgK","Dhr3Awq","x2TLEvbHDgG","ywDLrxzLBNq","C0jf","v3zcANa","tKHiv0S","BgjXCw4","zM9YrwfJAa","A0HzCeC","ALHmD3O","quDdy0y","y3HJtKK","B2nbzvy","r1Hctvq","EMr6uhK"];return vn=function(){return r},vn()}function Ax(r){let e=S,i={JlrIU:e(1085),SFJDN:e(1227),EjGOd:function(x,f){return x(f)},nJTSq:e(1570)+"or",omSWA:function(x){return x()},RfhYr:function(x,f){return x===f},bzoEY:"abort"};if(Sn[e(946)](r))return;let a=new Promise((x,f)=>{let l=e,h={dJgPh:l(1227),WvBjp:function(w,C){return i[l(692)](w,C)},tucTF:l(996),nWTgg:function(w){return w()}},m=()=>{let w=l;r[w(447)+"entListener"](i.JlrIU,_),r[w(447)+w(502)+w(1163)](i[w(430)],b),r["removeEventListe"+w(1163)](w(861),b)},_=()=>{let w=l,C={xaWeC:function(k,T,L){return k(T,L)},CwcIo:h[w(1568)]};if(h[w(1695)](h[w(413)],"baXTF"))h.nWTgg(x),m();else{let k=this[w(577)+w(1546)]?.["checkRea"+w(1581)+"es"](),T=this[w(577)+w(1546)]?.[w(504)+"ntEndpoint"]();if(k&&!_0xf685ec[w(1239)]){let L="connect "+T+(w(896)+"ax retri"+w(1725)+"ed");this["_dispatc"+w(1510)+w(444)](C[w(1595)](_0x4e578b,C[w(516)],{message:L,code:_0xd8d9e2[w(951)+"IES_ERROR"],error:_0x240e06}));return}this[w(1538)]&&this[w(1538)].readyState===this[w(1523)]&&this[w(1500)+w(434)](),this[w(1850)+w(1510)+w(444)](C.xaWeC(_0x2763e8,C[w(516)],{message:_0x19eb2b[w(1239)],code:_0x48ab7c[w(1325)+w(1479)],error:_0x316873}))}},b=()=>{let w=l;i.EjGOd(f,r[w(1227)]||new DOMException(i.nJTSq,i[w(1253)])),i[w(1726)](m)};r[l(635)+"Listener"](l(1085),_),r[l(635)+l(793)](i[l(430)],b),r["addEvent"+l(793)](i.bzoEY,b)});Sn.set(r,a)}function Dx(r){En=r(En)}function kx(r){let e=S,i={XMcIJ:function(a,x){return a==x},EqbUm:e(395),yWDmt:e(398),YKkNI:e(1513),FQmBY:function(a,x){return a(x)},JgjtP:function(a,x){return a(x)},ALROW:function(a,x){return a===x},XpIMr:e(1501),attpg:function(a,x){return a(x)},HpUbj:function(a,x){return a in x},kMEcV:e(507),wFZPV:function(a){return a()}};if(i.ALROW(r,IDBDatabase[e(1276)+"e"]["transact"+e(1599)])&&!i[e(786)](e(1378)+e(641),IDBTransaction[e(1276)+"e"]))if(i.ALROW(e(802),i[e(1751)]))_0xa555a4=_0x29ecf9&&i[e(1686)](i.EqbUm,_0x1a4349[e(1756)])?i[e(1220)]:i[e(843)],_0x3e29c4=_0x3d2b64.replace(/((^ws)|(^http))((?:[s]*:\/\/))/,""),_0x540d2b=/^wss(.*:\/\/)/[e(927)](_0x22624c)?_0x1ff454:""+_0xe569a+_0x274219;else return function(a,...x){let f=e,l=r[f(1329)](i[f(620)](Rt,this),a,...x);return mr[f(756)](l,a.sort?a[f(522)]():[a]),i[f(620)](Ce,l)};return i.wFZPV(Cx)[e(1855)](r)?function(...a){let x=e;return r[x(1137)](i[x(1127)](Rt,this),a),Ce(wr[x(550)](this))}:function(...a){let x=e;return i.XpIMr===i[x(1618)]?Ce(r[x(1137)](i[x(584)](Rt,this),a)):i[x(919)](0,this[x(494)])&&this.low===0}}function Ix(r){let e=S,i={hAOsP:"function",qeUnn:function(a,x){return a instanceof x},TscNI:function(a,x){return a(x)},CHmuC:function(a){return a()}};return typeof r===i[e(581)]?kx(r):(i[e(518)](r,IDBTransaction)&&i[e(1841)](Ax,r),xi(r,i[e(612)](Sx))?new Proxy(r,En):r)}function Ce(r){let e=S,i={pSnTP:function(x,f){return x instanceof f},yvIkX:function(x,f){return x(f)},uPzZZ:function(x,f){return x!==f}};if(i[e(1457)](r,IDBRequest))return i[e(384)](Ex,r);if(yn.has(r))return yn[e(550)](r);let a=Ix(r);return i[e(1706)](a,r)&&(yn[e(756)](r,a),Cn[e(756)](a,r)),a}var xi,ni,ri,wr,Sn,mr,yn,Cn,En,Rt,si=ai({"node_modules/idb/build/wrap-idb-value.js"(){let r=S,e={ASqNM:function(i,a,x){return i(a,x)},GcaVC:function(i,a){return i(a)},IrGOv:function(i,a){return i instanceof a},syvsn:function(i,a){return i===a},yumQB:r(1168),cEoot:"done",yIsRH:function(i,a){return i+a},AwGnK:r(1660)+r(818),UCVCb:function(i,a){return i+a},rjzQU:function(i,a){return i===a},mVRwU:r(1222),PbaHe:function(i,a){return i===a},Abrcm:r(975)};xi=(i,a)=>a[r(629)](x=>i instanceof x),wr=new WeakMap,Sn=new WeakMap,mr=new WeakMap,yn=new WeakMap,Cn=new WeakMap,En={get(i,a,x){let f=r;if(e[f(842)](i,IDBTransaction))if(e.syvsn(e[f(1228)],e[f(1228)])){if(a===e[f(894)])return Sn[f(550)](i);if(e[f(1894)](a,f(1378)+f(641)))return i["objectSt"+f(641)]||mr[f(550)](i);if(e[f(1894)](a,f(975)))return x[f(1378)+f(641)][1]?void 0:x[f(1378)+"ore"](x[f(1378)+f(641)][0])}else e[f(1467)](_0x1f4367,_0x53eb2d,32),e[f(1467)](_0x23715e,_0x69297e,e[f(1036)](_0x3b1b4b,_0xb8af83));return e[f(1036)](Ce,i[a])},set(i,a,x){let f=r;if(e.rjzQU(e[f(790)],f(1222)))return i[a]=x,!0;{let l=_0x5dba50[f(1410)]&&_0x3b3f92[0];if(e[f(842)](l,_0x235ce9))throw l;let h=new _0x1c82ec(e[f(1436)](e.AwGnK,l?e[f(862)](e[f(1436)](" (",l[f(1239)]),")"):""));throw h.context=l,l}},has(i,a){let x=r;return i instanceof IDBTransaction&&(e[x(651)](a,e[x(894)])||e[x(559)](a,e[x(621)]))?!0:a in i}},Rt=i=>Cn[r(550)](i)}}),ci={};vx(ci,{deleteDB:()=>Tx,openDB:()=>Px,unwrap:()=>Rt,wrap:()=>Ce});function Px(r,e,{blocked:i,upgrade:a,blocking:x,terminated:f}={}){let l=S,h={rdOYg:function(b,w){return b===w},yDXEX:l(1272),TOXxw:"SDgGs",WsCQV:function(b,w,C,k,T){return b(w,C,k,T)},BEKxz:function(b,w){return b(w)},eSQoK:function(b,w){return b||w},EwfwU:function(b,w){return b!==w},ffuEW:"nUQih",KwUms:l(1005),DPCWx:l(1737)+l(883),kWOUA:function(b,w){return b(w)},mQFLT:"blocked"},m=indexedDB[l(1191)](r,e),_=h.kWOUA(Ce,m);return a&&m[l(635)+l(793)]("upgradeneeded",b=>{let w=l;h[w(822)](h[w(1048)],h[w(672)])||h[w(944)](a,h[w(839)](Ce,m[w(721)]),b[w(1536)+"on"],b[w(1794)+"on"],Ce(m[w(1849)+w(1599)]))}),i&&m["addEvent"+l(793)](h[l(1319)],()=>i()),_.then(b=>{let w=l;if(h[w(1126)](h[w(948)],h.KwUms))f&&b[w(635)+w(793)](w(625),()=>f()),x&&b[w(635)+w(793)](h.DPCWx,()=>x());else{let C=this[w(1798)].getItem(this[w(1420)]),k=_0x4acf05.parse(h[w(913)](C,"{}"));return _0x3acc94.values(k)}}).catch(()=>{}),_}function Tx(r,{blocked:e}={}){let i=S,a={iGIII:function(f,l){return f(l)}},x=indexedDB[i(1790)+i(1713)](r);return e&&x[i(635)+i(793)](i(1192),()=>e()),a[i(752)](Ce,x)[i(1407)](()=>{})}function ii(r,e){let i=S,a={ntBdh:function(m,_){return m(_)},Mqkxb:i(1570)+"or",LTnQP:function(m){return m()},Ufysr:i(1152),KCDOK:"nbVmt",YiGJJ:"readwrite",jUvbu:i(819),wKbwH:function(m,_){return m instanceof _},VgpUC:function(m,_){return m in _},lztBr:i(1409),TlsOW:function(m,_){return m!==_},qJyhB:function(m,_){return m===_},XcLmT:"lkshk"};if(!(a[i(1236)](r,IDBDatabase)&&!a.VgpUC(e,r)&&typeof e===a[i(1212)]))return;if(bn[i(550)](e))return bn.get(e);let x=e[i(1237)](/FromIndex$/,""),f=a[i(1653)](e,x),l=ui[i(1855)](x);if(!(x in(f?IDBIndex:IDBObjectStore)[i(1276)+"e"])||!(l||fi.includes(x))){if(a[i(1818)](a[i(1069)],a[i(1069)]))return;zJIeZX[i(1775)](_0x55fe6c,_0x3b9c6f[i(1227)]||new _0xd0e62f("AbortError",zJIeZX[i(1898)])),zJIeZX.LTnQP(_0x23d350)}let h=async function(m,..._){let b=i,w={Rmxhm:a[b(1159)]};if(a[b(465)]!=="nbVmt")this[b(381)+b(763)][b(1755)](_0x2461bf),this[b(565)](w[b(457)],_0x46ceca);else{let C=this.transaction(m,l?a.YiGJJ:a[b(685)]),k=C[b(975)];return f&&(k=k[b(1509)](_[b(1173)]())),(await Promise[b(1371)]([k[x](..._),l&&C.done]))[0]}};return bn[i(756)](e,h),h}var fi,ui,bn,Lx=ai({"node_modules/idb/build/index.js"(){let r=S,e={WUOJd:function(i){return i()},PymQR:r(550),skpYY:r(1550),LkGPM:r(1605)+"ys",PqBUm:r(995),ZaJgO:r(484),HWRwz:r(991),jHTiV:r(674)};e[r(1539)](si),e[r(1539)](si),fi=[e[r(657)],e[r(1391)],r(769),e[r(877)],e[r(1310)]],ui=[r(1165),e[r(1012)],e[r(1748)],e.jHTiV],bn=new Map,Dx(i=>({...i,get:(a,x,f)=>ii(a,x)||i[r(550)](a,x,f),has:(a,x)=>!!ii(a,x)||i[r(946)](a,x)}))}}),Nx={idb:function(r){let e=S;r[e(1020)]=Promise.resolve().then(()=>(Lx(),ci)).then(function(i){return i})}},oi={};function Se(r){let e=S,i={tTxUh:e(1883)+"1"},a=i[e(1373)].split("|"),x=0;for(;;){switch(a[x++]){case"0":Nx[r](f,f[e(1020)],Se);continue;case"1":return f.exports;case"2":var f=oi[r]={exports:{}};continue;case"3":var l=oi[r];continue;case"4":if(l!==void 0)return l.exports;continue}break}}Se.d=(r,e)=>{let i=P;for(var a in e)Se.o(e,a)&&!Se.o(r,a)&&Object[i(1676)+i(1368)](r,a,{enumerable:!0,get:e[a]})},(()=>{let r=S;Se.o=(e,i)=>Object.prototype[r(1640)+r(1368)][r(1329)](e,i)})(),(()=>{let r=S,e={camfl:"undefined",ksqrQ:r(596),OqdJc:r(1003)+"le"};Se.r=i=>{let a=r;e[a(1004)]!=typeof Symbol&&Symbol["toString"+a(528)]&&Object[a(1676)+a(1368)](i,Symbol[a(1096)+"Tag"],{value:e.ksqrQ}),Object["definePr"+a(1368)](i,e[a(1681)],{value:!0})}})();var V={};(()=>{let r=S,e={ULseg:function(s,t){return s+t},tezDL:function(s,t){return s+t},puDEL:function(s,t){return s!==t},ydpbl:r(1213),tjPom:function(s,t){return s*t},nsPwT:r(1085),JFjpV:r(1227),rJuAY:"abort",ZIydU:function(s,t){return s===t},TNPow:r(673),Ewtyh:function(s,t){return s(t)},DxewR:function(s,t,n){return s(t,n)},XMKgo:function(s,t){return s+t},jnXNJ:r(1418),edpWL:function(s,t){return s(t)},bFTlf:function(s,t){return s+t},XCysu:r(490),xRgOs:function(s,t){return s(t)},koXny:r(865)+"000000000000000000000000",xgPWt:function(s,t){return s!=t},yxXyy:function(s,t){return s instanceof t},ILWjl:r(561)+r(1466)+r(741),ZWAOu:r(1891),jfxyl:"qKXSN",pcGUf:"ESUwI",XbVBU:function(s,t){return s>t},oVsip:function(s,t){return s<t},LABtw:function(s,t){return s!==t},iqNxl:function(s,t){return s-t},utKgb:function(s,t){return s<t},Xsbel:function(s,t){return s-t},vEHFN:function(s,t,n){return s(t,n)},OHTLp:function(s,t,n){return s(t,n)},xXZzL:function(s,t,n){return s(t,n)},kvFkD:function(s,t){return s>>>t},PqQbw:function(s,t){return s(t)},tErsb:function(s,t,n){return s(t,n)},OZfQF:function(s,t){return s&t},pliRx:r(1731)+r(1795)+r(378)+r(764),hBAIU:function(s,t){return s===t},pyvGg:r(1731)+r(1795)+" field: value",hqUqw:function(s){return s()},nloJL:function(s,t,n,o){return s(t,n,o)},vxqPM:"x_frontier_qos",sQCCL:r(1709)+"er_qos_ack",lXYPi:function(s,t,n,o){return s(t,n,o)},jqhyt:"x_fronti"+r(962)+"k",Lokvz:function(s,t,n){return s(t,n)},Olvyz:r(1239),DXVjR:function(s,t,n){return s(t,n)},wBprE:r(1545),wULdp:function(s,t){return s!==t},rqIum:function(s,t){return s===t},eBUpw:r(471),LBDXF:function(s,t,n){return s(t,n)},EMTjk:function(s){return s()},hLHzr:function(s,t,n){return s(t,n)},NSoKD:function(s,t,n){return s(t,n)},fPJxq:function(s,t){return s(t)},RxdYu:function(s,t,n){return s(t,n)},shLNA:function(s,t,n){return s(t,n)},UVkwf:function(s,t,n){return s(t,n)},CNJng:function(s,t,n){return s(t,n)},gjmuR:function(s,t,n){return s(t,n)},qCMBG:function(s,t){return s!==t},HhWqv:function(s,t,n){return s(t,n)},IqSbU:function(s,t){return s!==t},porOE:function(s,t){return s!==t},ZqRLw:function(s,t){return s(t)},zzXGU:function(s,t){return s(t)},jXLwz:function(s,t){return s(t)},cywoN:function(s,t,n){return s(t,n)},PNncK:function(s,t,n){return s(t,n)},rIuUh:function(s,t){return s(t)},BYtyb:function(s,t){return s(t)},HLmZs:function(s,t,n){return s(t,n)},EZrBX:function(s,t){return s(t)},rcKGd:function(s,t,n){return s(t,n)},fmAGF:function(s,t,n){return s(t,n)},QVLVM:function(s,t){return s(t)},LNnYb:function(s,t,n){return s(t,n)},tLNVt:"Missing required"+r(378)+"SeqID",BTpOr:function(s,t){return s===t},UJIkZ:"Missing required"+r(378)+r(386),wsIvO:function(s,t){return s===t},tuHAA:"Missing "+r(1795)+r(378)+r(1144),oaPZR:function(s,t){return s|t},uhcRo:function(s,t){return s&t},fCQSI:r(419),RBEzj:function(s,t){return s(t)},aqaSx:function(s,t){return s(t)},CoLFe:function(s,t,n){return s(t,n)},vYKQw:function(s,t,n){return s(t,n)},VSLNH:function(s,t,n){return s(t,n)},jurwb:function(s,t){return s+t},sOAtx:"Unimplem"+r(588)+r(990),ziLGD:function(s,t){return s>>t},gSkxr:function(s,t){return s!==t},gOZxN:r(1718),ZoUUl:function(s,t){return s>t},DNOGo:function(s,t){return s+t},KKtKf:"WgaLk",FROBS:r(1555),Uonxv:function(s,t){return s>t},sJXnn:function(s,t){return s>t},OhDta:r(568)+r(1728),UYFtA:function(s,t,n){return s(t,n)},wEJvZ:function(s,t){return s+t},gXeVq:function(s,t){return s+t},kmJbj:function(s,t){return s&t},GwDtQ:function(s,t){return s(t)},LVVqN:function(s,t){return s===t},ICKWb:function(s,t){return s&t},HiQYI:function(s,t){return s>=t},mbQrO:function(s,t){return s+t},lMhhs:function(s,t){return s<<t},CKOxP:function(s,t){return s!==t},wVNSV:r(1512),odOwe:function(s,t){return s==t},DBwwn:function(s,t){return s+t},rcPWh:function(s,t){return s+t},HuTWn:function(s,t){return s+t},CnOoY:function(s,t){return s!==t},HtscO:function(s,t){return s|t},yuGan:function(s,t){return s<<t},LsGFJ:function(s,t){return s|t},jJTFb:function(s,t){return s<<t},qvwFm:function(s,t){return s&t},isoXg:function(s,t){return s&t},EmVtb:function(s,t){return s>=t},kgpTP:function(s,t){return s<=t},hTviR:function(s,t){return s==t},dVltX:function(s,t){return s>=t},OfLCm:function(s,t){return s+t},gkbFt:function(s,t){return s+t},hnXlx:function(s,t){return s!==t},RNjga:function(s,t){return s<<t},nhatG:function(s,t){return s|t},cOTJQ:function(s,t){return s<<t},Ymdit:function(s,t){return s&t},OaVlU:function(s,t){return s<t},cVATp:function(s,t){return s>>t},RxvBZ:function(s,t){return s|t},rqJVr:function(s,t){return s<t},DYRhQ:function(s,t){return s<t},NHfyF:function(s,t){return s<t},CQuwZ:function(s,t){return s<t},DhzsO:function(s,t){return s<t},lDxrT:function(s,t){return s>=t},XyPdW:function(s,t){return s<=t},YtAHv:function(s,t){return s-t},TUGHt:function(s,t){return s===t},MUwlD:r(1294),hdHSe:function(s,t){return s|t},SiDPv:function(s,t){return s&t},Rchgq:function(s,t){return s|t},ztWKz:function(s,t){return s&t},etwVe:function(s,t){return s===t},pXFFh:r(1742),sdOfp:r(1091),xrRmb:function(s,t){return s|t},PXVaH:function(s,t){return s&t},QjPld:function(s,t){return s>>t},SneRU:function(s,t){return s&t},QppcK:function(s,t){return s|t},TlRrG:function(s,t){return s&t},opNHF:function(s,t,n){return s(t,n)},oIcBl:function(s,t){return s<t},zuOoZ:function(s,t,n){return s(t,n)},iqojk:function(s,t,n){return s(t,n)},vLIqv:function(s,t){return s(t)},FuTqV:function(s,t){return s>=t},xHEBD:function(s,t,n){return s(t,n)},nHUmw:function(s,t){return s-t},cjDOd:function(s,t,n){return s(t,n)},DEBjq:function(s,t,n){return s(t,n)},WyKfN:r(625),jHlFD:function(s,t){return s!==t},HmNNF:r(814),gKNxL:function(s,t){return s&t},ykonX:function(s,t){return s(t)},tgANM:function(s,t){return s&t},VjHeH:function(s,t){return s&t},dssic:function(s,t){return s(t)},FPbyI:function(s,t){return s<<t},vfkju:function(s,t){return s(t)},ybJlp:function(s,t){return s&t},CtfPK:r(1019),macpT:function(s,t){return s<<t},lwkfc:function(s,t){return s&t},fQUBZ:function(s,t){return s===t},jxmZk:r(1473),bcRvl:function(s,t){return s(t)},LUVGL:function(s,t){return s<<t},BIDSx:r(1112),MgkRU:r(551),HTYAX:function(s,t){return s(t)},QKORc:function(s,t){return s<<t},tMkus:function(s,t){return s|t},HeXtm:function(s,t){return s<<t},GRdXJ:function(s,t){return s|t},SIQBh:"dkmLx",Ifeff:function(s,t){return s>>>t},mhPgv:function(s,t){return s>>>t},gbVhV:function(s,t){return s>>>t},OSxTr:function(s,t){return s===t},VlOVb:function(s,t){return s<t},PFUPM:function(s,t){return s<t},Dtagz:function(s,t,n){return s(t,n)},GULPe:function(s,t){return s>>>t},nggHb:function(s,t){return s!==t},AKKhA:function(s,t){return s&t},bKQiJ:function(s,t){return s>>>t},OpCug:function(s,t){return s+t},NdQuK:function(s,t){return s|t},qRzPX:function(s,t){return s&t},DcocA:function(s,t){return s>>>t},sDTtL:function(s,t){return s|t},xshiX:function(s,t){return s>>>t},fjOJn:function(s,t){return s>>>t},aEIoR:function(s,t){return s+t},XZUEj:function(s,t){return s&t},RlXsF:function(s,t){return s>>>t},YWeXX:function(s,t){return s+t},gkgJq:function(s,t){return s!==t},iypsb:function(s,t){return s|t},LGvIP:function(s,t){return s>>>t},IzOvR:function(s,t){return s&t},CQxbW:function(s,t){return s>>>t},qfoTx:function(s,t){return s+t},QPugF:function(s,t){return s>>>t},YQByk:function(s,t){return s&t},inqRa:function(s,t){return s|t},BBLxa:function(s,t){return s&t},LaQzo:r(684),VuvCV:function(s,t){return s(t)},WwUPl:function(s,t){return s!==t},blBHW:function(s,t){return s(t)},hBNgN:function(s,t){return s|t},TZGyO:function(s,t){return s<<t},hqmuE:function(s,t){return s&t},hoyid:function(s,t){return s<<t},nLpST:function(s,t){return s&t},cmNAA:r(1204),RdzOW:function(s,t){return s===t},YDSRn:function(s,t){return s|t},MtWNG:function(s,t){return s<<t},eBpmT:function(s,t){return s<<t},eSBNV:function(s,t){return s|t},DrDbj:function(s,t){return s|t},VDmHx:function(s,t){return s<<t},Rvgcf:function(s,t){return s===t},yohHG:function(s,t){return s<<t},iFxjx:function(s,t){return s&t},IcFEa:function(s,t){return s>>>t},iyRgx:function(s,t){return s>>>t},mFSrh:function(s,t){return s>>>t},hCfAv:function(s,t){return s>=t},vgFka:function(s,t){return s<=t},NPLCn:function(s,t){return s+t},qiwTS:function(s,t){return s|t},XnEcc:function(s,t){return s%t},hPXlA:function(s,t){return s/t},cScnM:function(s,t){return s+t},lvRsB:function(s,t){return s*t},UzpwA:function(s,t){return s>>>t},SafZS:function(s,t){return s>>>t},wrolH:function(s,t){return s===t},xiXUv:function(s,t){return s===t},mbsVs:function(s,t){return s>>>t},GpUfq:function(s,t){return s+t},Nurfc:function(s,t){return s+t},xFAwc:function(s,t){return s|t},DHYgH:function(s,t){return s<<t},QApEc:function(s,t){return s|t},KlsmB:function(s,t){return s<<t},BZkRH:function(s,t){return s===t},XotCJ:function(s,t){return s===t},rFXkz:function(s,t){return s===t},uWgey:function(s,t){return s===t},ejkWh:function(s,t){return s&t},wDKCR:function(s,t){return s>>>t},VvTBt:function(s,t){return s&t},FHApF:function(s,t){return s>>>t},XpCkr:function(s,t){return s&t},zLmqb:function(s,t){return s&t},sifMa:r(707)+r(1642),KkTIG:r(951)+r(1537)+"R",TcDLi:r(1325)+r(1479),Mouli:"MESSAGE_"+r(540),GkhiZ:r(642)+"OR",IlGIp:function(s,t){return s!==t},knjgv:r(974),wBsEL:r(591)+"0|2|4",YoXcs:r(748)+"1",GXBMT:r(1191),tRxPP:r(1791),uJgiE:function(s,t){return s-t},kHEYI:function(s,t){return s===t},VHhJr:function(s,t){return s==t},sQqyg:function(s,t){return s instanceof t},zdWQv:r(1660)+r(818),sFybK:function(s,t){return s+t},ZxqDd:function(s,t){return s+t},SbKpm:function(s,t){return s===t},bjvcG:function(s,t,n){return s(t,n)},TBTfi:r(1030),qCTeH:"uWlnL",EfGpc:function(s,t,n){return s(t,n)},HYACl:"IxpqF",WhzhO:function(s,t,n){return s(t,n)},VVhTi:function(s,t,n){return s(t,n)},MbZmB:function(s,t,n){return s(t,n)},JbJIb:function(s,t){return s instanceof t},VUtGM:function(s,t){return s||t},Hetvj:r(986)+"1",kHYpG:function(s,t){return s!=t},GCOan:r(647)+"d",wmExy:function(s,t){return s<=t},CCDDl:"next() called multiple t"+r(783)+"process",zOVKP:function(s,t){return s===t},ApWxN:function(s,t){return s+t},uXHab:function(s,t){return s<t},nFWsh:function(s,t){return s<t},AyFWb:function(s,t){return s&t},nYjTi:function(s,t){return s+t},nnRHg:function(s,t){return s===t},uSytC:r(560),LTgkV:function(s,t){return s-t},ptyhH:function(s,t){return s<t},TkAst:function(s,t){return s|t},Tsiqj:function(s,t){return s<<t},fbbBK:function(s,t){return s&t},IQohi:function(s,t){return s>=t},XezQd:function(s,t){return s|t},nZYNR:function(s,t){return s&t},bHTkE:function(s,t){return s<<t},TXEjI:function(s,t){return s>>t},xbOOg:function(s,t){return s+t},UJNFH:function(s,t){return s&t},zDJEs:function(s,t){return s===t},pfUKe:function(s,t){return s|t},gKnxH:function(s,t){return s|t},vUqrX:function(s,t){return s|t},VvFsP:function(s,t){return s<<t},ywUWZ:function(s,t){return s<<t},QVZQR:function(s,t){return s<<t},XUeKZ:r(388),MmhiN:function(s,t){return s<t},lgukS:"pqcaS",YZhFK:"qdaJq",VWdyN:function(s,t){return s&t},fUsrl:function(s,t){return s===t},hBXac:"3|2|4|0|"+r(964),PovId:function(s,t){return s&t},jjEel:function(s,t){return s+t},gxXDf:function(s,t){return s&t},fZihi:function(s,t){return s|t},ADMzY:function(s,t){return s&t},MGNIe:function(s,t){return s!==t},NJYAi:r(1632),Xfpdp:function(s,t){return s|t},Yyctn:function(s,t){return s>>t},oiKND:function(s,t){return s>>t},woaDS:function(s,t){return s|t},vDgln:function(s){return s()},UmInX:r(903),kEUof:r(1409),YTGYc:function(s,t){return s instanceof t},NQprF:r(1179)+r(1270),qukAD:r(1811),DpdVU:r(971),jMDqP:function(s,t){return s===t},IhwYj:r(600),LZGVR:function(s,t){return s>=t},AMuWe:function(s,t){return s>=t},ZatoS:r(1061),poRZR:"owCNs",rhPjs:function(s,t){return s|t},YKJJK:function(s,t){return s<<t},jhgqJ:function(s,t){return s|t},hGDiM:function(s,t){return s<<t},nIMxJ:r(768)+r(1879),PJWge:r(460)+r(1252),sxPpN:r(1001),FDdgj:r(1519)+r(1344)+r(1196)+"P",lCehN:r(1084),EUxBH:function(s,t){return s(t)},GTrkQ:r(1295),dQIJZ:function(s,t){return s(t)},ssjCJ:r(677),KWHGi:function(s){return s()},NXVAy:function(s,t){return s>=t},cGVme:function(s,t){return s<t},mZart:function(s,t){return s<<t},vGoda:function(s,t){return s>>t},yjMHY:function(s,t){return s&t},TziTo:function(s,t){return s>>t},AtajX:function(s,t){return s!==t},lkKtF:r(906),Ltvak:r(1072)+r(1251)+"3|5|4|0|7",CghDF:function(s,t){return s>>>t},sGQZE:function(s,t){return s|t},BAYwG:function(s,t){return s<t},IQKpK:function(s,t){return s<t},KFpmk:function(s,t){return s|t},KYSQm:function(s,t){return s<<t},fKUQF:r(1047),bnDPq:function(s,t){return s||t},eJxDv:function(s,t){return s||t},ocAeV:function(s,t,n){return s(t,n)},rwyyj:function(s,t){return s===t},sKkUU:r(1006),fiLEZ:r(1777),mdqVE:function(s,t){return s===t},PPLEu:r(897),OQcYs:r(1633),Ewxov:"RUcYw",YzdVs:function(s,t){return s|t},fJCdL:function(s,t){return s|t},CsxWS:function(s,t){return s<<t},NAiBt:function(s,t){return s|t},sfUJD:function(s,t){return s===t},fSuaZ:r(1805),JyDyO:function(s,t){return s||t},DDagx:function(s,t){return s||t},uEZCY:function(s,t){return s||t},XTnvV:function(s,t){return s!=t},fWPIz:r(901),hblok:"message_id",NfjAr:function(s,t){return s(t)},RabQv:function(s,t){return s===t},jwHKd:r(1556),Zbgka:function(s,t){return s===t},uDZlx:r(1238),dyEuK:function(s,t,n,o){return s(t,n,o)},lpySY:"need_ack",OJRSu:r(1616),LQiDK:function(s,t){return s&&t},rklFL:r(1740),uLVKi:r(1541),htwCU:r(1432),zdzPy:function(s){return s()},cyTuB:r(1441),ehArx:function(s){return s()},hMuVR:"hsOjW",CDzRg:function(s,t){return s(t)},NbVoO:function(s,t){return s(t)},mwUtq:function(s,t){return s instanceof t},KSOrc:function(s,t){return s instanceof t},trwVd:"applicat"+r(1270)+";charset=utf-8",hBfmo:"none_none",oyWjf:r(433),MzJCo:function(s,t,n,o){return s(t,n,o)},XrYrg:function(s,t){return s>t},HKiLi:function(s,t){return s+t},zlWtH:function(s,t){return s+t},HlnkA:"iQeho",SexfG:function(s,t){return s||t},qtibU:function(s,t){return s>>>t},MLHqL:function(s,t){return s(t)},fDoJX:function(s,t){return s+t},CAwYd:function(s,t){return s+t},PKxhp:r(848)+r(1103)+"ge: ",VLwiA:" + ",GDSQH:function(s,t){return s||t},NUzMM:" > ",dCgnW:function(s,t){return s&t},LInEG:function(s,t,n,o){return s(t,n,o)},IHbDa:function(s,t){return s+t},xbjXI:r(1488),Utrqf:r(1895)+r(1098)+"e",JDUxO:function(s,t){return s>=t},SjfrP:function(s,t){return s!==t},Ywpsv:"CARbt",dYnzR:function(s,t){return s&t},HpUYH:function(s,t){return s+t},bdSMU:function(s,t){return s+t},iFNHz:function(s,t){return s===t},qvINW:"ydcQW",qkkIX:function(s,t){return s<t},CEJta:r(1102)+"4",QwidH:function(s,t){return s+t},ikYDY:function(s,t){return s===t},JcuAG:r(1234),ZsLbx:function(s,t){return s+t},JEhIZ:function(s,t){return s+t},vYMrz:function(s,t){return s<<t},gGNDi:function(s,t){return s<<t},PZaim:function(s,t){return s<<t},jEuAP:function(s,t){return s<<t},BTWvz:function(s,t){return s>>>t},aWzgG:function(s,t){return s&t},yWjyA:function(s,t){return s&t},JTxqg:function(s,t){return s&t},mZSxt:function(s,t){return s&t},nmTyT:function(s,t){return s+t},ISMrh:function(s,t){return s&t},NXSqo:function(s,t){return s+t},oyUaL:function(s,t){return s(t)},HGZfm:r(1566),RLEEX:function(s,t){return s===t},qjrwO:function(s,t){return s>>>t},gUtEV:function(s,t){return s===t},MiSJt:function(s,t){return s>>>t},SUGdJ:function(s,t){return s|t},ufFqj:function(s,t){return s<<t},rZJLI:function(s,t){return s|t},wWXTF:function(s,t,n,o){return s(t,n,o)},HKOXc:r(1697),chLRe:r(511),CakjY:function(s,t){return s!==t},fSzub:r(898),ivYRk:r(397),lgysz:function(s,t){return s(t)},klTRw:"idb",bnKgm:r(1507),LWsme:r(544)+r(1369),RzcmO:"header",Ubbsq:function(s,t,n,o){return s(t,n,o)},rDnWj:r(787)+r(966),Zwyln:r(966),kdtZd:function(s,t){return s+t},PbBsO:"THdjM",yntIb:r(1493),ewaav:function(s,t,n){return s(t,n)},Bqkpk:r(1499)+r(1614),qqmiu:r(1575)+r(1414),ThTMd:r(1077),JVEhp:r(676),JKoIH:r(1221),DcIpC:function(s,t,n,o){return s(t,n,o)},AJZKb:r(1630),rkuIj:"setcursor",LbGeQ:r(431),zbeXq:function(s,t,n){return s(t,n)},oWDIF:function(s,t){return s(t)},KbouF:r(1585),XMQvZ:r(1232),bEGRK:r(1200),hJiKY:function(s,t){return s!==t},pifac:"oKYIT",QNaaH:"WYgef",VlJIQ:function(s,t,n,o){return s(t,n,o)},UsuPc:r(402),UuxVX:function(s,t,n,o){return s(t,n,o)},HoqQG:r(1709)+r(722),HSdrW:r(570)+"s",ZQyYI:r(1667)+r(700)+"e",rPOKN:function(s,t){return s(t)},dhJdc:function(s,t,n){return s(t,n)},lrnwy:function(s){return s()},owxkZ:"jIpIh",HnzVK:r(1132),RAfcI:function(s,t){return s+t},JJwgU:function(s){return s()},MyISj:function(s){return s()},JDOYn:function(s){return s()},hQlPA:r(1070),CvtAM:function(s,t,n){return s(t,n)},rYVhd:function(s){return s()},XVzjZ:r(415),XQssg:function(s,t){return s(t)},awlhK:function(s,t){return s!==t},jZDol:function(s,t){return s<t},FFLyr:function(s,t){return s===t},ERSLK:function(s){return s()},iqxLd:function(s,t,n){return s(t,n)},uLgGa:function(s,t,n){return s(t,n)},NvRGG:r(582),JaPbt:r(857),sWAYe:r(1553),WqVsG:function(s,t){return s(t)},rIOry:function(s,t){return s!==t},sdjJp:function(s,t){return s!=t},mNJIA:function(s,t){return s===t},zrnKy:r(1355),CwuLO:function(s,t){return s===t},AKStJ:r(1338),BgthH:r(999)+r(943)+"s",NeQqi:r(1129),eZWDN:"arraybuffer",OlSWN:r(1643),WZNFr:function(s,t){return s/t},ydeKO:function(s,t){return s==t},fNduq:function(s,t){return s===t},gLjna:r(1434)+r(1166)+r(1876),ecjwC:r(1434)+r(587)+r(586)+r(1307)+r(892)+r(954)+"is undef"+r(424),IevDG:function(s,t,n){return s(t,n)},iFNUV:r(1559)+"t",ygVEE:r(1265),WPpaC:r(1495),KVrMU:r(709),RmXZO:function(s,t){return s!==t},HvuQV:function(s,t){return s!==t},AJAOh:function(s,t){return s==t},rVUzN:r(395),vZqaP:r(398),CkceJ:r(1513),YiDYk:r(1462),eQAOZ:r(902),JKorv:r(1691),joKeX:r(1434)+r(663)+"ddID, deviceID o"+r(1406),CHTTq:function(s,t){return s==t},YwPJy:r(563),rABbc:function(s,t,n){return s(t,n)},nSzTm:r(1435),Iyouz:r(1683)+"0",zNeaa:r(1817),fUoHk:function(s,t,n){return s(t,n)},StGPW:r(617)+">",ckhhL:function(s,t){return s*t},Jbzxc:function(s,t){return s-t},tPsbX:function(s,t,n){return s(t,n)},mtYwT:function(s,t,n){return s(t,n)},IDGkP:"ping_onc"+r(1216)+"t",Aiang:"going aw"+r(1317)+"reconnec"+r(1215)+r(1304),riZuh:function(s,t){return s!==t},PmoSg:function(s,t){return s!==t},KGvWJ:r(782),zLIIT:r(1677)+r(1890)+r(626)+"g",OPZiW:r(965),DDCVa:function(s,t){return s+t},efpBK:function(s,t){return s||t},wqxTZ:function(s,t){return s!==t},IHFGI:r(1867),FvPnb:r(1834),elXDL:r(1839),AcBzz:function(s,t,n){return s(t,n)},DNKWA:function(s,t,n){return s(t,n)},JKCLo:function(s,t){return s!==t},vAEik:r(473),LBxsn:r(1826)+"ay, network offl"+r(1423),tBzgm:r(873),UGdEK:r(1602),wQxDi:r(1219),fOwFZ:function(s,t){return s>>t},VkRKZ:r(1136),ZolwC:r(599)+r(1011)+r(380)+r(1057)+"ed",nhVdp:function(s,t){return s===t},QIZSN:function(s,t){return s===t},Uwnyn:r(599)+"s alread"+r(399),ObStB:r(1434)+"rovide a valid d"+r(879)+"a must be a stri"+r(792)+" arraybu"+r(929),OLCxi:"number",SYMJx:function(s,t){return s!=t},knEGD:function(s,t){return s(t)},pCWoR:function(s,t){return s(t)},CrWPp:r(1434)+r(506)+r(1093)+r(1369),sVHEj:function(s,t){return s instanceof t},CvRDq:function(s,t){return s(t)},rYQgs:"sent",HLhtI:function(s,t){return s==t},dhwCV:r(1367)+r(918)+"ing",AFIRu:function(s,t){return s(t)},lqhnz:function(s,t){return s!==t},Owwip:"OdrIL",LQPoA:function(s,t){return s*t},FtnpV:"Window",OwvVu:function(s,t){return s!=t},ZpqIa:function(s,t){return s===t},dgaOn:r(1646),LbXLx:function(s,t){return s!=t},SIlms:r(1449)+r(772)+r(1172)+"pe",DPJBO:r(797)+r(1503)+r(1471),WKgcC:"ServiceWorkerGlo"+r(1729),yDTWY:function(s,t){return s!=t},QrXJV:function(s,t){return s===t},jqkcT:function(s,t){return s!=t},bzDwf:r(668)+r(1447)};Se.r(V),Se.d(V,{FWS:()=>q0,CustomErrorEvent:()=>os,createCloseEvent:()=>he,ReconnectEvent:()=>is,createErrorEvent:()=>ce,decodedFrame:()=>es,createOpenEvent:()=>ds,CustomCloseEvent:()=>as,createReconnectEvent:()=>er,FrontierMessageEvent:()=>cs,encodeFrame:()=>Qn,createMessageEvent:()=>us,OpenEvent:()=>fs,ErrorCode:()=>Me,Event:()=>rt,MessageEvent:()=>xs});let i="";function a(s=""){let t=r,n="02",o=""+Date.now(),c=i||(i=m(s)),d=Math.random()[t(1096)](16)[t(1381)](-6);return e[t(1341)](e[t(1745)](e.tezDL(n,o),c),d)}function x(){let s=r;if(e[s(1038)](e[s(1678)],e[s(1678)])){let t=_0x45e832[s(930)]();return t?(t[s(710)]=t[s(1478)]=0,t):{bytes:new _0x492624(64),offset:0,limit:0}}else return e.tezDL(e[s(683)](1e4,Date.now()),Math[s(1497)](e.tjPom(1e4,Math[s(1582)]())))}function f(s){let t=r,n={ljEPq:e[t(446)],vsguq:e[t(1772)],YqdvW:e[t(662)]};if(e[t(1622)](t(673),e[t(691)]))return e[t(1341)](e.Ewtyh(Array,8)[t(498)]("0"),e.DxewR(parseInt,s,10)[t(1096)](2)).slice(-8);_0x4fe0ef[t(447)+t(502)+t(1163)](STlEyl[t(1782)],_0x144e7e),_0x151aac[t(447)+t(502)+t(1163)](STlEyl[t(730)],_0x1102d1),_0x4c2d68[t(447)+t(502)+t(1163)](STlEyl.YqdvW,_0x12ef14)}function l(s){let t=r;return e[t(702)](Array(4).join("0"),parseInt(s,2)[t(1096)](16))[t(1381)](-4)}function h(s){let t=r;if(e[t(520)]==="uwrIq")this[t(1538)]&&this[t(1538)][t(625)](_0x3f3254,_0x11a265);else{let n=s[t(720)](/\./)[t(1576)](d=>f(d)),o=[];return o[0]=e[t(1832)](l,e[t(1120)](n[0],n[1])),o[1]=l(n[2]+n[3]),[e.XCysu,t(490),e[t(1624)],e.XCysu,e[t(1624)],"ffff",o[0],o[1]][t(498)]("")}}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(927)](s),o=/(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))/[t(927)](s);return n?e[t(1626)](h,s):o?_(s):e[t(1024)]}function _(s){let t=r,n={BylKC:function(y,v){return y(v)},HgqZP:function(y,v){return e[P(1453)](y,v)},ytEZe:t(1409),zKzqJ:function(y,v){return e[t(1851)](y,v)},aIuMI:function(y,v){return e[t(1851)](y,v)},dpRtL:e[t(1844)]},o="",c=[],d=0,g=0,p=!0,u=t(490);if(s[t(828)]("::")>-1)if(t(809)!==e[t(1739)]){let y=s.split("::");for(let A=0;A<y[t(1410)];A++)if(e.puDEL(e[t(725)],e.pcGUf)){let N=y[A];if(e[t(660)](N[t(828)](":"),0)){let D=N[t(720)](":");p&&(d=D[t(1410)]),g+=D[t(1410)];for(let O=0;e.oVsip(O,D[t(1410)]);O++)if(e[t(1828)](4,D[O][t(1410)])){let ke=u[t(1472)+"g"](0,4-D[O][t(1410)]),$=ke[t(1214)](D[O]);c.push($)}else c[t(1755)](D[O]);p=!1}else{if(e.puDEL(4,N[t(1410)])){let D=u[t(1472)+"g"](0,4-N.length),O=D.concat(N);c[t(1755)](O)}else c[t(1755)](N);p&&(d+=1),g+=1,p=!1}}else _0x4a056b=gHmsQi[t(695)](_0x44bac3,_0x23ec7f);let v="";for(let A=0;e[t(1801)](A,e[t(1594)](8,g));A++)v=v[t(1214)](u);for(let A=0;A<c[t(1410)];A++)e[t(1622)](A,d)?(o=o[t(1214)](v),o=o.concat(c[A])):o=o[t(1214)](c[A]);return o}else try{return n[t(855)](n[t(1206)],typeof _0x1e82f9)&&(n.zKzqJ(_0x8c4e9f,_0x2acffb)||_0x41d358[t(661)]&&n[t(382)](_0x1f3fb9[t(661)],_0xe7d436))||n[t(855)](n[t(1206)],typeof _0x52ef12)?"":(_0x3a8b9b[t(1351)](_0x39426c),t(1179)+t(1270))}catch{return n.ytEZe==typeof _0x3459bf?n.dpRtL:""}{let y=s[t(720)](":");for(let v=0;e[t(838)](v,y[t(1410)]);v++){let A=y[v];if(e[t(1038)](4,y[v].length)){let N=u.substring(0,e.Xsbel(4,y[v][t(1410)])),D=N[t(1214)](A);o=o[t(1214)](D)}else o=o[t(1214)](A)}return o}}function b(s,t){let n=r,o=s[n(764)];e[n(1828)](void 0,o)&&(e[n(1170)](q,t,10),e[n(1717)](ye,t,o));let c=s[n(1843)];e.puDEL(void 0,c)&&(e[n(1663)](q,t,18),e.xXZzL(ye,t,c))}function w(s){let t=r,n={};e:for(;!we(s);){let o=e[t(1626)](X,s);switch(e[t(767)](o,3)){case 0:break e;case 1:n[t(764)]=e[t(899)](_e,s,e[t(1578)](X,s));break;case 2:n[t(1843)]=e[t(947)](_e,s,e.xRgOs(X,s));break;default:e[t(1717)](Q,s,e[t(495)](7,o))}}if(n[t(764)]===void 0)throw new Error(e[t(1521)]);if(e[t(1124)](void 0,n[t(1843)]))throw new Error(e.pyvGg);return n}function C(s){let t=r,n=e[t(765)](I);return k(s,n),e[t(1578)](me,n)}function k(s,t){let n=r,o={sKAeF:function($,se,ot){return $(se,ot)},YfVgm:e[n(1328)]},c=s.SeqID;e[n(1038)](void 0,c)&&(e[n(1717)](q,t,8),e[n(1779)](bt,t,c));let d=s[n(1831)];e.puDEL(void 0,d)&&(q(t,16),e.DXVjR(bt,t,d));let g=s[n(386)];e.puDEL(void 0,g)&&(e[n(1622)](e[n(1858)],e[n(1858)])?(e[n(1779)](q,t,24),e.xXZzL(bt,t,e.Ewtyh(ne,g))):this[n(1303)](n(1239),o.sKAeF(_0x3a4045,o.YfVgm,{..._0x363c2d})));let p=s[n(1144)];if(e[n(936)](void 0,p))if(e[n(978)](e[n(527)],e[n(527)]))e.Lokvz(q,t,32),e[n(445)](bt,t,e[n(1578)](ne,p));else{let $=!!this[n(1437)].enableQoS;if(!$)return{enabled:$,isQoSMessage:!1,isQoSAck:!1,isAckCleanupMessage:!1,ackMsgIds:[]};let se=e[n(1810)](_0x19ad06,_0x1dfd51[n(1239)][n(572)],e[n(732)],"2"),ot=se&&_0x2e8824(_0x3031fc.message[n(572)],e[n(1515)],"1"),Ct=se&&e[n(654)](_0x259ac5,_0x4fcfeb[n(1239)][n(572)],e[n(1016)],"1"),xr=Ct?e[n(1029)](_0x5c41fd,_0x2c53fc[n(1239)][n(572)],n(1709)+n(1224)+"sgid")?.[n(720)](",")[n(1518)](_0x3d8a89)||[]:[];return{enabled:$,isQoSMessage:se,isQoSAck:ot,isAckCleanupMessage:Ct,ackMsgIds:xr}}let u=s.headers;if(u!==void 0)for(let $ of u){q(t,42);let se=e[n(1673)](I);e.hLHzr(b,$,se),e[n(508)](q,t,se[n(1478)]),e[n(1074)]($n,t,se),e[n(1815)](M,se)}let y=s["payloadE"+n(963)];e.LABtw(void 0,y)&&(e.RxdYu(q,t,50),e[n(1285)](ye,t,y));let v=s["payloadT"+n(1799)];e[n(1038)](void 0,v)&&(e.UVkwf(q,t,58),e[n(1779)](ye,t,v));let A=s[n(1666)];A!==void 0&&(e[n(614)](q,t,66),q(t,A[n(1410)]),e[n(1663)](jt,t,A));let N=s[n(1806)];e[n(1828)](void 0,N)&&(e[n(1859)](q,t,74),ye(t,N));let D=s[n(806)+n(678)];e.qCMBG(void 0,D)&&(q(t,82),e[n(1792)](ye,t,D));let O=s[n(608)];e.IqSbU(void 0,O)&&(e[n(1029)](q,t,90),e.HhWqv(ye,t,O));let ke=s[n(1762)+"e"];e[n(1527)](void 0,ke)&&(q(t,96),e.CNJng(bt,t,e[n(1116)](ne,ke)))}function T(s){let t=r;return e[t(1385)](L,e[t(1116)](Y,s))}function L(s){let t=r,n={};e:for(;!e[t(1483)](we,s);){let o=e[t(1700)](X,s);switch(o>>>3){case 0:break e;case 1:n[t(1754)]=e.cywoN(Qr,s,!0);break;case 2:n.LogID=e[t(1262)](Qr,s,!0);break;case 3:n[t(386)]=e[t(1578)](X,s);break;case 4:n[t(1144)]=X(s);break;case 5:{let c=F(s);(n[t(572)]||(n.headers=[]))[t(1755)](e[t(1700)](w,s)),s[t(1478)]=c;break}case 6:n[t(717)+t(963)]=e.hLHzr(_e,s,e[t(1301)](X,s));break;case 7:n[t(1394)+t(1799)]=e[t(1029)](_e,s,e[t(1301)](X,s));break;case 8:n[t(1666)]=Ht(s,e[t(574)](X,s));break;case 9:n[t(1806)]=e[t(644)](_e,s,e[t(788)](X,s));break;case 10:n[t(806)+t(678)]=e[t(719)](_e,s,e.zzXGU(X,s));break;case 11:n[t(608)]=e[t(1823)](_e,s,e[t(1578)](X,s));break;case 12:n.frameType=e[t(1724)](X,s);break;default:e[t(1244)](Q,s,e.OZfQF(7,o))}}if(e[t(1124)](void 0,n[t(1754)]))throw new Error(e[t(1461)]);if(e[t(978)](void 0,n[t(1831)]))throw new Error(t(1731)+"required"+t(378)+t(1831));if(e[t(1892)](void 0,n[t(386)]))throw new Error(e[t(1424)]);if(e[t(1846)](void 0,n.method))throw new Error(e[t(957)]);return n}function F(s){let t=r,n={tjeEb:function(o,c,d){return e[P(1074)](o,c,d)},mALuf:function(o,c){return e[P(1023)](o,c)},hVFpO:function(o,c){return e[P(1596)](o,c)}};if(e[t(1622)](e[t(681)],e[t(681)])){let o=e.RBEzj(X,s),c=s[t(1478)];return s[t(1478)]=s[t(710)]+o,c}else n[t(1671)](_0x219293,_0x44a1e3,n[t(1153)](n.hVFpO(127,_0x4cd6b9),128)),_0x1394fb>>>=7}function Q(s,t){let n=r;switch(t){case 0:for(;e[n(495)](128,e[n(1524)](re,s)););break;case 2:e[n(1275)](De,s,e.RBEzj(X,s));break;case 5:e.vYKQw(De,s,4);break;case 1:e[n(870)](De,s,8);break;default:throw new Error(e.jurwb(e.sOAtx,t))}}function ne(s){let t=r;return s|=0,{low:s,high:e[t(1664)](s,31),unsigned:s>=0}}let Ae=[];function I(){let s=r,t=Ae[s(930)]();return t?(t.offset=t[s(1478)]=0,t):{bytes:new Uint8Array(64),offset:0,limit:0}}function M(s){let t=r;if(e.gSkxr(t(1718),e[t(1092)]))return this[t(1107)][t(960)+"te"];Ae[t(1755)](s)}function Y(s){return{bytes:s,offset:0,limit:s[r(1410)]}}function me(s){let t=r,n=s.bytes,o=s[t(1478)];return n[t(1410)]===o?n:n[t(795)](0,o)}function De(s,t){let n=r;if(e[n(1142)](e[n(1263)](s[n(710)],t),s[n(1478)]))throw new Error(n(815)+"t limit");s[n(710)]+=t}function we(s){let t=r;return e[t(1822)]===e.FROBS?new _0x227d5b(_0x343ef3,_0x2e5ae0,_0x25e408):s[t(710)]>=s[t(1478)]}function le(s,t){let n=r,o=s[n(886)],c=s[n(710)],d=s[n(1478)],g=c+t;if(e.Uonxv(g,o[n(1410)])){let p=new Uint8Array(e[n(683)](2,g));p[n(756)](o),s[n(886)]=p}return s[n(710)]=g,e[n(1268)](g,d)&&(s.limit=g),c}function We(s,t){let n=r,o=s[n(710)];if(e[n(660)](e.tezDL(o,t),s[n(1478)]))throw new Error(e[n(1567)]);return s[n(710)]+=t,o}function Ht(s,t){let n=r,o=e.UYFtA(We,s,t);return s[n(886)][n(795)](o,e[n(474)](o,t))}function jt(s,t){let n=r,o=le(s,t.length);s[n(886)][n(756)](t,o)}function _e(s,t){let n=r,o=e[n(445)](We,s,t),c=String[n(1809)+n(1207)],d=s.bytes,g="\uFFFD",p="";for(let u=0;u<t;u++){let y=d[e[n(1141)](u,o)],v,A,N,D;if(e.kmJbj(128,y)===0)p+=e.GwDtQ(c,y);else if(e[n(1563)](e.ICKWb(224,y),192))if(e.HiQYI(u+1,t))p+=g;else if(v=d[e.mbQrO(e[n(505)](u,o),1)],e[n(1658)](192,v)!==128)p+=g;else if(D=e.oaPZR(e[n(1783)](31&y,6),e[n(1346)](63,v)),e[n(1801)](D,128))p+=g;else{if(e.CKOxP(e[n(1063)],e[n(1063)]))return this._qosDB[n(916)+n(436)]();p+=e[n(1815)](c,D),u++}else e[n(1056)](e.kmJbj(240,y),224)?e.DBwwn(u,2)>=t?p+=g:(v=d[e[n(474)](u,o)+1],A=d[e.rcPWh(e.HuTWn(u,o),2)],e[n(1613)](e.OZfQF(e[n(739)](v,e.yuGan(A,8)),49344),32896)?p+=g:(D=e.LsGFJ(e[n(1468)](e[n(1557)](15,y),12)|e[n(780)](63,v)<<6,63&A),D<2048||e[n(1845)](D,55296)&&e[n(853)](D,57343)?p+=g:(p+=e[n(788)](c,D),u+=2))):e[n(1060)](248&y,240)?e[n(1464)](e[n(1789)](u,3),t)?p+=g:(v=d[e[n(1208)](u+o,1)],A=d[e[n(505)](u+o,2)],N=d[e[n(1208)](e.gkbFt(u,o),3)],e[n(1786)](e.qvwFm(e[n(739)](e[n(1023)](v,e[n(420)](A,8)),e[n(420)](N,16)),12632256),8421504)?p+=g:(D=e[n(849)](e[n(1335)](e.HtscO((7&y)<<18,e[n(1046)](e[n(650)](63,v),12)),e[n(1557)](63,A)<<6),e[n(650)](63,N)),e.OaVlU(D,65536)||e[n(660)](D,1114111)?p+=g:(D-=65536,p+=e.HhWqv(c,e[n(1341)](e[n(693)](D,10),55296),e[n(1557)](1023,D)+56320),u+=3))):p+=g}return p}function ye(s,t){let n=r,o={JLwCI:function(u,y){return e[P(536)](u,y)},CqzDT:function(u,y){return e[P(1658)](u,y)},FyZRU:function(u,y){return e[P(1557)](u,y)},TXcHv:function(u,y){return e[P(907)](u,y)},zuLgt:function(u,y){return e.jXLwz(u,y)}},c=t[n(1410)],d=0;for(let u=0;e.DYRhQ(u,c);u++){let y=t[n(1710)+"At"](u);e[n(1316)](y,55296)&&y<=56319&&e.NHfyF(u+1,c)&&(y=e[n(1594)]((y<<10)+t[n(1710)+"At"](++u),56613888)),d+=e[n(838)](y,128)?1:e.OaVlU(y,2048)?2:e[n(982)](y,65536)?3:4}q(s,d);let g=le(s,d),p=s[n(886)];for(let u=0;e.DhzsO(u,c);u++){let y=t[n(1710)+"At"](u);if(e[n(1458)](y,55296)&&e[n(1125)](y,56319)&&e[n(702)](u,1)<c&&(y=e.YtAHv(e[n(702)](y<<10,t[n(1710)+"At"](++u)),56613888)),e.rqJVr(y,128))p[g++]=y;else if(e[n(1583)](e[n(1178)],e[n(1178)]))e[n(1801)](y,2048)?p[g++]=e[n(553)](e[n(1579)](e[n(1664)](y,6),31),192):(e[n(970)](y,65536)?p[g++]=e.Rchgq(e[n(390)](y>>12,15),224):e.etwVe(e[n(984)],e.sdOfp)?(_0x3085f4=jUAkdv[n(1819)](jUAkdv.CqzDT(31,_0x3ce80d)<<6,jUAkdv[n(910)](63,_0x141022)),jUAkdv.TXcHv(_0x265453,128)?_0x31ee9c+=_0x134ba7:(_0x2f71b2+=jUAkdv.zuLgt(_0x5c6803,_0x4dc727),_0x4b2af7++)):(p[g++]=e[n(1058)](e[n(1343)](e[n(549)](y,18),7),240),p[g++]=e.RxvBZ(e.SneRU(e[n(1664)](y,12),63),128)),p[g++]=e.QppcK(e[n(693)](y,6)&63,128)),p[g++]=e.QppcK(e.TlRrG(63,y),128);else throw _0x329cae=_0xe6a4f[n(1410)],e[n(1810)](_0x24e92f,_0x33e89d,10,_0x42a4f4[n(1410)])}}function $n(s,t){let n=r,o=e.opNHF(le,s,t[n(1478)]),c=s.bytes,d=t[n(886)];for(let g=0,p=t.limit;e[n(1042)](g,p);g++)c[e[n(1341)](g,o)]=d[g]}function re(s){let t=r;return s.bytes[e[t(1235)](We,s,1)]}function be(s,t){let n=r,o=e[n(594)](le,s,1);s[n(886)][o]=t}function X(s){let t=r,n=0,o=0,c;do c=e.vLIqv(re,s),e.rqJVr(n,32)&&(o|=(127&c)<<n),n+=7;while(e[t(533)](128,c));return o}function q(s,t){let n=r;for(t>>>=0;e[n(777)](t,128);)e[n(1590)](be,s,127&t|128),t>>>=7;e[n(639)](be,s,t)}function Qr(s,t){let n=r,o={axADq:function(c,d,g){return e.cjDOd(c,d,g)},WiIJk:function(c,d){return e[P(849)](c,d)},rkmGy:function(c,d){return e[P(1579)](c,d)},vJuyA:function(c,d){return c>=d},UwUCa:function(c,d,g){return e[P(499)](c,d,g)},fGCRg:e[n(1032)]};if(e[n(1002)](e[n(716)],e[n(716)])){let c=_0xf4b199[n(1472)+"g"](0,e.nHUmw(4,_0x4dca91[n(1410)])),d=c[n(1214)](_0x35bd4a);_0x18696e[n(1755)](d)}else{let c=0,d=0,g=0,p;if(p=re(s),c=127&p,e[n(807)](128,p)&&(p=e[n(735)](re,s),c|=e[n(1346)](127,p)<<7,128&p&&(p=e[n(1815)](re,s),c|=e[n(1783)](e[n(1274)](127,p),14),e[n(1302)](128,p)&&(p=e.dssic(re,s),c|=e[n(958)](e[n(1274)](127,p),21),e[n(807)](128,p)&&(p=e[n(412)](re,s),d=127&p,e[n(456)](128,p)))))){if(e[n(1622)](e[n(1109)],"UZSYJ")){for(_0x43fa0b>>>=0;_0x5d1afd>=128;)VjsALS[n(837)](_0x21b851,_0x1781d1,VjsALS[n(1838)](VjsALS.rkmGy(127,_0x16b1dd),128)),_0x1b36ee>>>=7;VjsALS[n(837)](_0x4b9e91,_0x2818ef,_0xe7f4fb)}else if(p=e[n(1700)](re,s),d|=e[n(1258)](e.lwkfc(127,p),7),e[n(1274)](128,p)){if(e[n(694)](n(757),e.jxmZk))return VjsALS[n(1088)](_0x18149b[n(710)],_0x331a8f[n(1478)]);if(p=e[n(558)](re,s),d|=e.jJTFb(127&p,14),e.OZfQF(128,p)&&(p=e[n(1832)](re,s),d|=e.LUVGL(e[n(533)](127,p),21),e.uhcRo(128,p)))if(e[n(694)](e[n(1365)],e.MgkRU)){let u=this[n(577)+n(1546)]?.["getCurre"+n(396)+"nt"]();this[n(1850)+n(1230)+n(444)](o[n(890)](_0x37e4a8,o[n(496)],{code:_0x4e587e[n(402)],reason:"connecti"+n(1014)+"d, unkno"+n(682)+n(868)+n(437)+u})),this[n(577)+n(1546)]?.[n(394)+"pointCon"+n(557)](),this[n(696)+n(1117)]?.[n(1682)+n(491)]();return}else p=re(s),g=127&p,e.qvwFm(128,p)&&(p=e[n(1450)](re,s),g|=e[n(881)](e[n(495)](127,p),7))}}return{low:e.tMkus(c,e[n(1574)](d,28)),high:e[n(1889)](d>>>4,g<<24),unsigned:t}}}function bt(s,t){let n=r,o={rBifw:function(c,d){return e[P(1700)](c,d)},EuLLs:n(999)+n(1216)+"t"};if(n(1386)!==e[n(950)]){let c=e[n(767)](t[n(823)],0),d=e[n(1150)](e[n(885)](e.mhPgv(t[n(823)],28),e[n(420)](t[n(494)],4)),0),g=e[n(1399)](t[n(494)],24),p=e.LVVqN(0,g)?e[n(1639)](0,d)?c<16384?e.CQuwZ(c,128)?1:2:e[n(781)](c,2097152)?3:4:e[n(1520)](d,16384)?e[n(970)](d,128)?5:6:e[n(573)](d,2097152)?7:8:e[n(1520)](g,128)?9:10,u=e.Dtagz(le,s,p),y=s[n(886)];switch(p){case 10:y[e.XMKgo(u,9)]=e[n(1785)](g,7)&1;case 9:y[e[n(1120)](u,8)]=e[n(1119)](9,p)?128|g:127&g;case 8:y[e[n(1379)](u,7)]=p!==8?e.Ifeff(d,21)|128:e[n(1289)](e[n(776)](d,21),127);case 7:y[e[n(423)](u,6)]=p!==7?e[n(1476)](d>>>14,128):e[n(480)](e[n(1113)](d,14),127);case 6:y[e[n(1789)](u,5)]=p!==6?e[n(489)](e[n(869)](d,7),128):e.VjHeH(e.fjOJn(d,7),127);case 5:y[e.aEIoR(u,4)]=p!==5?e[n(1476)](128,d):e[n(1287)](127,d);case 4:y[e[n(1789)](u,3)]=p!==4?e.xrRmb(e[n(1145)](c,21),128):e.Ifeff(c,21)&127;case 3:y[e[n(1059)](u,2)]=e[n(1606)](3,p)?e[n(595)](e[n(1661)](c,14),128):e.IzOvR(e[n(979)](c,14),127);case 2:y[e[n(1028)](u,1)]=e[n(1606)](2,p)?e.QPugF(c,7)|128:e[n(987)](e[n(1145)](c,7),127);case 1:y[u]=p!==1?e.inqRa(128,c):e[n(1160)](127,c)}}else o[n(1051)](_0x362350,"success"),this[n(666)]("ping_once_success",_0x319b01),this[n(666)](o.EuLLs,_0x295870)}function es(s){let t=r;if(e[t(1606)](e[t(1796)],e[t(1796)]))this[t(1303)](e.JFjpV,_0x3dd518),this.onerror&&this[t(658)](_0x4bc2fa);else return e.VuvCV(T,s)}function Qn(s){let t=r;if(e.WwUPl(t(1514),t(949)))return e[t(1376)](C,s);_0x5eb2d8.d=(n,o)=>{let c=t;for(var d in o)_0x4b6f4d.o(o,d)&&!_0x2a5993.o(n,d)&&_0x4602e9[c(1676)+c(1368)](n,d,{enumerable:!0,get:o[d]})}}let ts=65536,Xo="\0\0\0\0\0\0\0\0",nt=ts*ts,ns=e[r(1620)](nt,nt),rs=e[r(1897)](ns,2),ze=String[r(1276)+"e"][r(1710)+"At"];class B{constructor(t,n,o){let c=r;this[c(705)]=!0,this[c(823)]=e[c(739)](0,t),this[c(494)]=e[c(631)](0,n),this[c(940)]=!!o}static isLong(t){let n=r,o={bUpXR:function(c,d){return e[P(536)](c,d)},LRIWw:function(c,d){return e[P(758)](c,d)},TsefO:function(c,d){return e[P(884)](c,d)},lxALN:function(c,d){return e.hoyid(c,d)},BqOcI:function(c,d){return e[P(1619)](c,d)},exQIH:function(c,d){return c<d},bdSOa:function(c,d){return e[P(1845)](c,d)},iFGnD:function(c,d){return c<=d}};if(n(1204)!==e[n(1078)])_0x4ce089=AyBwyg[n(478)](AyBwyg.LRIWw(AyBwyg[n(1164)](15,_0x4f638b),12),AyBwyg[n(920)](AyBwyg[n(598)](63,_0x4aa7d6),6))|AyBwyg.TsefO(63,_0xb33b2d),AyBwyg[n(1404)](_0x3c7f85,2048)||AyBwyg[n(514)](_0x1c3ae9,55296)&&AyBwyg[n(567)](_0x5941a3,57343)?_0x5a8d93+=_0x4db57b:(_0x52b858+=_0x9df4fe(_0xba943b),_0x117722+=2);else return t&&e[n(1322)](!0,t[n(705)])}static fromBits(t,n,o){return new B(t,n,o)}static[r(1688)+"s"](t,n,o){let c=r;return o?B[c(1688)+"sLE"](t,n):B["fromByte"+c(1694)](t,n)}static[r(1688)+"sLE"](t,n){let o=r;return new B(e[o(631)](e.xrRmb(e[o(604)](t[0],e[o(1064)](t[1],8)),t[2]<<16),e.jJTFb(t[3],24)),e.inqRa(e[o(595)](t[4],t[5]<<8)|e.lMhhs(t[6],16),e[o(1258)](t[7],24)),n)}static[r(1688)+"sBE"](t,n){let o=r;return new B(e.oaPZR(e[o(841)](e[o(885)](t[4]<<24,e[o(1293)](t[5],16)),e[o(1753)](t[6],8)),t[7]),e[o(1023)](e[o(1362)](e.DrDbj(e[o(958)](t[0],24),e[o(1199)](t[1],16)),t[2]<<8),t[3]),n)}static fromHash(t){let n=r;return e[n(708)](t,Xo)?ss:new B(e[n(1440)](e.eSBNV(e.xrRmb(ze[n(1329)](t,0),e[n(1128)](ze[n(1329)](t,1),8))|e[n(1468)](ze.call(t,2),16),ze[n(1329)](t,3)<<24),0),(e[n(616)](ze[n(1329)](t,4),ze[n(1329)](t,5)<<8)|ze[n(1329)](t,6)<<16|e.TZGyO(ze[n(1329)](t,7),24))>>>0,!0)}[r(1765)](){let t=r;return String["fromChar"+t(1207)](e[t(533)](255,this[t(823)]),e[t(1820)](this[t(823)]>>>8,255),e[t(456)](this[t(823)]>>>16,255),e[t(1719)](this[t(823)],24),255&this[t(494)],e.PXVaH(e[t(869)](this.high,8),255),e.SiDPv(e.iyRgx(this[t(494)],16),255),e[t(537)](this.high,24))}static[r(1445)+"er"](t,n=!0){let o=r;if(e.PqQbw(isNaN,t))return n?Zo:ss;if(n){if(e[o(1609)](t,ns))return Qo}else{if(e[o(627)](t,-rs))return e0;if(e.EmVtb(e.NPLCn(t,1),rs))return $o}return B[o(1229)](e.qiwTS(e.XnEcc(t,nt),0),e[o(1362)](e.hPXlA(t,nt),0),n)}toNumber(){let t=r;return this[t(940)]?e[t(762)](e.lvRsB(e.UzpwA(this[t(494)],0),nt),this[t(823)]>>>0):e[t(1120)](this[t(494)]*nt,e[t(638)](this[t(823)],0))}[r(1625)](){let t=r;return e.wrolH(0,this[t(494)])&&e[t(1361)](0,this[t(823)])}add(t){let n=r;B[n(705)](t)||(t=B.fromNumber(t));let o=e[n(979)](this[n(494)],16),c=65535&this.high,d=this[n(823)]>>>16,g=65535&this[n(823)],p=e.fjOJn(t[n(494)],16),u=e[n(1343)](65535,t[n(494)]),y=e.QPugF(t[n(823)],16),v=65535&t[n(823)],A=0,N=0,D=0,O=0;return O+=g+v,D+=e.mbsVs(O,16),O&=65535,D+=e[n(1059)](d,y),N+=D>>>16,D&=65535,N+=e[n(860)](c,u),A+=N>>>16,N&=65535,A+=e[n(391)](o,p),A&=65535,B.fromBits(e[n(679)](e[n(1250)](D,16),O),e[n(1149)](e[n(1337)](A,16),N),this.unsigned)}[r(1382)](t){let n=r;return B[n(705)](t)||(t=B[n(1445)+"er"](t)),this[n(940)]!==t[n(940)]&&e.BZkRH(e.bKQiJ(this.high,31),1)&&t[n(494)]>>>31===1?!1:e.XotCJ(this.high,t[n(494)])&&this[n(823)]===t[n(823)]}[r(724)](){let t=r;return e[t(1326)](-1,this[t(823)])&&e.uWgey(-1,this[t(494)])?B.fromBits(0,0,this[t(940)]):e[t(1563)](-1,this[t(823)])?B[t(1229)](0,e[t(1211)](this[t(494)],1),this[t(940)]):B[t(1229)](e.aEIoR(this[t(823)],1),this[t(494)],this[t(940)])}[r(418)](t){return t?this.toBytesLE():this.toBytesBE()}[r(785)+"E"](){let t=r,n=this.high,o=this.low;return[e[t(987)](255,o),e[t(1619)](o>>>8,255),o>>>16&255,o>>>24,255&n,e[t(1403)](n>>>8,255),e[t(1364)](n,16)&255,e.wDKCR(n,24)]}toBytesBE(){let t=r,n=this[t(494)],o=this.low;return[e.GULPe(n,24),e.VvTBt(e[t(1486)](n,16),255),e.ICKWb(e[t(1054)](n,8),255),255&n,e.wDKCR(o,24),e.XpCkr(e[t(1383)](o,16),255),e.zLmqb(e[t(1486)](o,8),255),255&o]}}let ss=new B(0,0,!1),Zo=new B(0,0,!0),$o=B.fromBits(-1,2147483647,!1),Qo=B[r(1229)](-1,-1,!0),e0=B[r(1229)](0,-2147483648,!1);var Me=(function(s){let t=r,n=e.sifMa[t(720)]("|"),o=0;for(;;){switch(n[o++]){case"0":return s;case"1":s[s[t(951)+"IES_ERROR"]=5003]=e[t(611)];continue;case"2":s[s[e[t(1535)]]=5001]=e.TcDLi;continue;case"3":s[s[t(1674)+"NG_ERROR"]=5002]=t(1674)+t(1065);continue;case"4":s[s[e.Mouli]=5004]=t(953)+t(540);continue;case"5":s[s[t(642)+"OR"]=5005]=e[t(1544)];continue}break}})({});class rt{constructor(t){let n=r;this[n(1188)]=t,this[n(664)]=null}}class is extends rt{constructor(t,n){let o=r;super(t),this[o(1239)]=n&&n.message||null}}class os extends rt{constructor(t,n){let o=r;if(e.IlGIp(e[o(1452)],e[o(1452)]))try{e[o(654)](_0x354eda,this,_0xde1186,[_0x155670,_0x34a731,_0x512bbe])}catch(c){let d=_0xe032ec(e[o(1772)],{message:c[o(1239)],code:_0x10d147[o(642)+"OR"],error:c});this[o(1850)+o(1510)+o(444)](d)}else{let c=e[o(1114)][o(720)]("|"),d=0;for(;;){switch(c[d++]){case"0":this[o(485)]=n&&n[o(485)]||0;continue;case"1":this[o(1588)]=n&&n[o(1588)]||"";continue;case"2":this[o(1239)]=n&&n.message||"";continue;case"3":this[o(1227)]=n&&n.error||null;continue;case"4":this[o(402)]=n&&n[o(402)]||5001;continue;case"5":super(t);continue;case"6":this[o(546)]=n&&n.colno||0;continue}break}}}}class as extends rt{constructor(t,n){let o=r;super(t),this[o(402)]=n&&n.code||0,this[o(1879)]=n&&n[o(1879)]||"",this[o(761)]=n&&n[o(761)]||!1,this[o(622)+o(1183)]=n&&n[o(622)+o(1183)]||!1}}class xs extends rt{constructor(t,n){let o=r;super(t),this[o(1375)]=n&&n.data||null}}class cs extends xs{constructor(t,n){let o=r;super(t),this[o(1375)]=n&&n[o(1375)]||null,this[o(1239)]=n&&n[o(1239)]||null}}class fs extends rt{constructor(t,n){let o=r;super(t),this[o(1375)]=n&&n[o(1375)]||null}}function ce(s,{message:t,code:n,error:o}){return new os(s,{message:t,code:n,error:o})}function he(s,{code:t,reason:n,wasClean:o,willReconnect:c}){return new as(s,{code:t,reason:n,wasClean:o,willReconnect:c})}function us(s,{data:t,message:n}){return new cs(s,{data:t,message:n})}function ds(s,{data:t}){return new fs(s,{data:t})}function er(s,{message:t}){let n=r;if(e[n(1613)](e.tRxPP,e[n(1608)])){let o=e[n(917)][n(720)]("|"),c=0;for(;;){switch(o[c++]){case"0":if(!this[n(1538)])return;continue;case"1":this._ws["addEvent"+n(793)](e[n(1772)],this[n(1672)]);continue;case"2":this._ws.addEventListener(e[n(1328)],this[n(1634)+"ge"]);continue;case"3":this[n(1538)]["addEvent"+n(793)](e[n(1704)],this[n(1392)]);continue;case"4":this[n(1538)][n(635)+n(793)](n(625),this[n(1833)]);continue}break}}else return new is(s,{message:t})}class ls{constructor(t,n){let o=r;this[o(836)+"s"]=t,this.maxRetries=n,this.currentIndex=0,this[o(1181)+o(1197)+o(844)+"t"]=0}[r(394)+r(1711)+r(557)](){let t=r;this[t(1525)+t(1615)]=0,this[t(1181)+t(1197)+"riesCount"]=0}resetTries(){let t=r;this["currentE"+t(1197)+t(844)+"t"]=0}[r(504)+r(396)+"nt"](){let t=r;return this[t(836)+"s"][this[t(1525)+t(1615)]]}[r(504)+r(396)+r(1847)+r(1502)](){let t=r;return this[t(1181)+t(1197)+t(844)+"t"]}[r(712)+"chMaxTries"](){let t=r;return!!(e[t(777)](this.currentIndex,this.endpoints.length)||this["currentI"+t(1615)]===e[t(1863)](this[t(836)+"s"][t(1410)],1)&&e.kHEYI(this[t(1181)+t(1197)+t(844)+"t"],this[t(728)+"es"]))}[r(615)+r(1210)+r(1604)+r(1549)+r(985)](){let t=r;return e.VHhJr(this[t(1525)+"ndex"],this[t(836)+"s"][t(1410)])?!0:e[t(1353)](this[t(1181)+t(1197)+"riesCount"],this[t(728)+"es"])}[r(825)+r(875)+r(392)+r(1013)+r(492)](){let t=r;return this[t(1181)+"ndpointT"+t(844)+"t"]=1,this[t(1525)+t(1615)]++,this.endpoints[this[t(1525)+t(1615)]]}[r(504)+"ntEndpointAndUpd"+r(770)](){let t=r;return this[t(1181)+"ndpointT"+t(844)+"t"]++,this[t(504)+"ntEndpoint"]()}}let st=(e.SYMJx(e.GCOan,typeof globalThis)&&e.FtnpV===globalThis[r(942)+r(1623)][r(966)]||r(647)+"d"!=typeof window&&e[r(1231)](e.FtnpV,window[r(942)+r(1623)][r(966)]))&&e[r(754)](e[r(571)],typeof document),Je=e[r(1699)](e[r(571)],typeof globalThis)&&(e[r(935)]("Object",globalThis[r(942)+"tor"][r(966)])||e.ZpqIa(r(1449)+r(772)+r(1172)+"pe",globalThis[r(942)+r(1623)].name))&&e[r(571)]!=typeof tt,vt=(e[r(1300)](e.GCOan,typeof globalThis)&&e[r(1873)](e[r(882)],globalThis[r(942)+"tor"][r(966)])||e[r(571)]==typeof globalThis||e.OwvVu("undefined",typeof globalThis)&&!!globalThis[r(1534)+r(864)])&&e[r(941)](e.GCOan,typeof wx),St=e[r(1180)](r(647)+"d",typeof globalThis)&&(e[r(1639)](e[r(1864)],globalThis["construc"+r(1623)][r(966)])||e[r(1354)](e[r(1530)],globalThis[r(942)+"tor"][r(966)])||e[r(411)](e[r(904)],globalThis[r(942)+r(1623)][r(966)]))&&e[r(571)]!=typeof self,t0=e[r(746)](r(647)+"d",typeof globalThis)&&e[r(1560)](r(1646),globalThis[r(942)+r(1623)][r(966)])&&r(647)+"d"!=typeof global&&r(1646)===global["construc"+r(1623)][r(966)]&&e[r(571)]!=typeof process&&!!process.version;class tr{constructor(){let t=r;this[t(1882)+"rs"]={}}[r(1303)](t,...n){let o=r,c=this[o(1882)+"rs"][t];if(c)c[o(1381)]().forEach(d=>d.fn[o(1137)](d[o(429)],n));else if(e.LVVqN(e[o(1772)],t)&&!this[o(658)]){let d=n[o(1410)]&&n[0];if(e[o(1052)](d,Error))throw d;let g=new Error(e[o(860)](e[o(665)],d?e[o(403)](e.ZxqDd(" (",d[o(1239)]),")"):""));throw g[o(1874)]=d,d}return this}[r(666)](t,n){let o=r;if(e[o(978)](void 0,t))this[o(1882)+"rs"]={};else if(n===void 0)this._listeners[t]=null;else{let c=this[o(1882)+"rs"][t];if(c)for(let d=0;e.VlOVb(d,c[o(1410)]);)e[o(1758)](c[d].fn,n)?c[o(872)](d,1):++d}return this}on(t,n,o){let c=r;return(this[c(1882)+"rs"][t]||(this[c(1882)+"rs"][t]=[])).push({fn:n,ctx:o||this}),this}}class n0 extends tr{[r(1247)+r(706)+r(1877)](t){let n=r;return t[n(1194)]||t.errNo?(n(404)+" "+(t[n(1194)]||"")+n(539)+(t[n(515)]||""))[n(1217)]():JSON.stringify(t)}constructor(t,n,o){let c=r;super(),this._socket=null,vt&&wx[c(1018)+"ocket"]&&(this[c(1107)]=wx[c(1018)+"ocket"]({url:t,protocols:n,header:o,fail:this[c(1288)+c(852)+c(671)][c(1267)](this),success:this[c(1288)+c(1259)+"cessHand"+c(1607)][c(1267)](this)})),Je&&tt[c(1018)+"ocket"]&&(this[c(1107)]=tt[c(1018)+"ocket"]({url:t,protocols:n,header:o,fail:this["_createSocketFai"+c(671)][c(1267)](this),success:this[c(1288)+c(1259)+c(1746)+"ler"][c(1267)](this)}))}[r(1288)+r(1259)+r(1746)+"ler"](){let t=r,n={EpFvN:function(o,c,d){return e[P(847)](o,c,d)}};e[t(1038)](e[t(1866)],e[t(1802)])?Promise[t(1593)]()[t(1407)](()=>{this[t(468)+"steners"]()}):n.EpFvN(_0x26428e,_0x344737,this["_getInte"+t(643)+"e"](_0x17df60))}[r(1288)+r(852)+"lHandler"](t){let n=r;if(e.LVVqN(e[n(726)],e.HYACl))Promise[n(1593)]().then(()=>{let o=n,c=ce(o(1227),{message:this[o(1247)+"rrorMess"+o(1877)](t)});this.emit(o(1227),c);let d=e[o(414)](he,o(625),{reason:this["_formatE"+o(706)+o(1877)](t)});this[o(1303)](e[o(1032)],d)});else{let o=new _0xa95e3(e[n(683)](2,_0xd75c0c));o.set(_0x5f178c),_0x4fa62e[n(886)]=o}}[r(468)+r(889)](){let t=r,n={lFUsz:t(1191),hgQrJ:function(o,c,d){return e[t(1242)](o,c,d)},pzsAM:e[t(1328)]};this._socket.onOpen(o=>{let c=t;this[c(1303)](n[c(1071)],n[c(1305)](ds,n[c(1071)],{...o,data:o[c(1194)]||""}))}),this[t(1107)][t(510)](o=>{let c=t;this[c(1303)](e[c(1032)],e.tErsb(he,c(625),{...o}))}),this[t(1107)][t(530)+"e"](o=>{let c=t;this[c(1303)](c(1239),n[c(1305)](us,n.pzsAM,{...o}))}),this[t(1107)][t(900)](o=>{let c=t;this.emit(e[c(1772)],e.WhzhO(ce,e[c(1772)],{...o,message:o.errMsg||""}))})}[r(475)](t){let n=r;if(e[n(1670)](t,Uint8Array)){let o=t[n(661)].slice(t[n(1641)+"et"],e[n(1341)](t[n(1130)+"th"],t.byteOffset));this[n(1107)]&&this[n(1107)][n(475)]({data:o,fail:c=>{let d=n;this[d(1303)](e[d(1772)],e[d(1416)](ce,e.JFjpV,{message:this[d(1247)+d(706)+d(1877)](c)}))}})}else this._socket&&this._socket.send({data:t,fail:o=>{let c=n;this[c(1303)](e[c(1772)],e[c(1318)](ce,e.JFjpV,{message:this[c(1247)+"rrorMessage"](o)}))}})}[r(625)](t,n){let o=r;this._socket&&this[o(1107)][o(625)]({code:t,reason:n})}["addEvent"+r(793)](t,n){this.on(t,n)}["removeEv"+r(502)+"ner"](t,n){this[r(666)](t,n)}get[r(960)+"te"](){let t=r;return this._socket[t(960)+"te"]}get[r(1781)+"pe"](){let t=r;return this[t(1107)][t(1781)+"pe"]}set[r(1781)+"pe"](t){}get[r(1332)](){let t=r;return this[t(1107)][t(1332)]}get protocol(){return this[r(1107)].protocol}get[r(1884)+"ns"](){return this[r(1107)].extensions}get bufferedAmount(){return 0}}function r0(s,t){let n=r;if(t)return new t(s.url,s[n(1756)]);if(e[n(1774)](vt,Je))return new n0(s.url,s.protocol,s[n(572)]);if(e[n(1774)](st,St)&&n(647)+"d"!=typeof WebSocket&&WebSocket)return new WebSocket(s[n(1332)],s.protocols)}function s0(s){let t=r,n=e[t(1865)].split("|"),o=0;for(;;){switch(n[o++]){case"0":if(vt&&wx[t(1018)+t(1372)])return!0;continue;case"1":return!1;case"2":if(s)return!0;continue;case"3":if(Je&&tt[t(1018)+t(1372)])return!0;continue;case"4":if((st||St)&&e[t(1699)](e[t(571)],typeof WebSocket)&&WebSocket)return!0;continue}break}}function hs(s,t,n){let o=r,c=-1;async function d(g){let p=P;return e[p(1465)](g,c)?Promise[p(541)](new Error(e[p(1097)])):(c=g,e.zOVKP(g,n[p(1410)])?Promise[p(1593)]():n[g][p(1267)](s)(t,d.bind(null,e[p(1223)](g,1))))}e[o(989)](d,0)}function gs(s){let t=r,n=0,o=0;for(let c=0;e.uXHab(c,s.length);++c)o=s[t(1710)+"At"](c),e.nFWsh(o,128)?n+=1:e.oVsip(o,2048)?n+=2:e[t(1892)](e[t(533)](64512,o),55296)&&e[t(1639)](e[t(1580)](64512,s[t(1710)+"At"](e[t(1690)](c,1))),56320)?e[t(469)](t(560),e.uSytC)?(++c,n+=4):(e.blBHW(_0x5d9fed,this[t(1151)+"lTimeoutId"]),this["_interva"+t(1438)+"Id"]=_0xcb5046(()=>{let d=t;this[d(1730)+d(476)]()},this[t(1151)+"l"])):n+=3;return n}function ps(s,t,n){let o=r;if(e[o(1053)](n,t)<1)return"";let c="";for(let d=t;e[o(1037)](d,n);){let g=s[d++];if(g<=127)c+=String[o(1809)+o(1207)](g);else if(g>=192&&e[o(1520)](g,224))c+=String[o(1809)+o(1207)](e.TkAst(e[o(1352)](31&g,6),e[o(1886)](63,s[d++])));else if(e[o(519)](g,224)&&g<240)c+=String["fromChar"+o(1207)](e.XezQd(e[o(881)](e[o(1770)](15,g),12)|e[o(1135)](e[o(456)](63,s[d++]),6),63&s[d++]));else if(e[o(1845)](g,240)){let p=e[o(885)](e[o(679)](e[o(1209)]((7&g)<<18,e[o(1064)](e[o(1343)](63,s[d++]),12)),e[o(1135)](e[o(928)](63,s[d++]),6)),e[o(495)](63,s[d++]))-65536;c+=String[o(1809)+"Code"](e[o(1379)](55296,e[o(779)](p,10))),c+=String["fromChar"+o(1207)](e[o(980)](56320,e[o(1460)](1023,p)))}}return c}function nr(s,t,n){let o=r,c={mOUbr:function(u,y){return u===y},ZNqtE:e.XUeKZ,upQBm:function(u,y){return u in y}},d=n,g,p;for(let u=0;e[o(830)](u,s[o(1410)]);++u){if(e[o(1613)](e[o(1448)],e[o(1448)]))return _0x32ee6f instanceof _0x455d59&&(HJlqFv[o(1743)](_0x2baa9f,HJlqFv.ZNqtE)||HJlqFv[o(1743)](_0x4b3764,o(975)))?!0:HJlqFv[o(636)](_0x46716d,_0x9f29cd);if(g=s[o(1710)+"At"](u),e[o(1025)](g,128))t[n++]=g;else if(e[o(1037)](g,2048)){if(e[o(1038)](e[o(618)],e[o(618)]))return e[o(1873)](_0x26ed65,_0x50fd02)?_0x5a4812:new _0xe49048(e.mbsVs(e[o(1174)](e[o(1323)](e[o(455)](_0x14b823[o(1329)](_0x49c444,0),e[o(406)](_0x2fe112.call(_0xe5c757,1),8)),e[o(578)](_0x627ff4[o(1329)](_0x5b66f8,2),16)),_0x40212e[o(1329)](_0x421300,3)<<24),0),e[o(1661)](e.sDTtL(e.DrDbj(e[o(631)](_0x5d3b30[o(1329)](_0x4410c5,4),e[o(758)](_0x3b67f8[o(1329)](_0x5853f6,5),8)),e[o(566)](_0x54f23c.call(_0x45d83a,6),16)),_0x419c41[o(1329)](_0x3ae960,7)<<24),0),!0);t[n++]=e[o(679)](e[o(549)](g,6),192),t[n++]=e[o(1770)](63,g)|128}else if(e[o(401)](64512,g)===55296&&e[o(1804)](e.isoXg(64512,p=s.charCodeAt(u+1)),56320)){let y=e[o(1482)][o(720)]("|"),v=0;for(;;){switch(y[v++]){case"0":t[n++]=e[o(1596)](e[o(693)](g,12),63)|128;continue;case"1":t[n++]=e[o(536)](e[o(1415)](63,g),128);continue;case"2":++u;continue;case"3":g=e.jjEel(65536+e[o(1468)](e[o(1248)](1023,g),10),e[o(1596)](1023,p));continue;case"4":t[n++]=e[o(714)](g>>18,240);continue;case"5":t[n++]=e[o(924)](e.QjPld(g,6),63)|128;continue}break}}else if(e[o(1766)](e[o(1657)],e[o(1657)])){if(this[o(1437)][o(1186)+"utoRecon"+o(1505)]||this[o(736)+"osed"])return;this[o(1027)+o(918)]()}else t[n++]=e[o(1656)](e[o(575)](g,12),224),t[n++]=e[o(1289)](e[o(1122)](g,6),63)|128,t[n++]=e.woaDS(e[o(1557)](63,g),128)}return n-d}async function ms(s){let t=r;if(e[t(1124)](e.UmInX,e.UmInX)){if(e[t(1060)](e[t(1255)],typeof s)){let n=new Uint8Array(e[t(1450)](gs,s));return e[t(654)](nr,s,n,0),n}return e[t(1052)](s,ArrayBuffer)?new Uint8Array(s):new Uint8Array(s[t(661)],s[t(1641)+"et"],s[t(1130)+"th"])}else return this[t(1850)+t(667)+t(1282)](_0x20ccc0),e[t(1584)](_0x27fcd9)}function i0(s){let t=r;try{return e.kHYpG(e[t(1255)],typeof s)&&(s instanceof ArrayBuffer||s[t(661)]&&e[t(1043)](s[t(661)],ArrayBuffer))||e[t(1699)](t(1409),typeof s)?"":(JSON.parse(s),e[t(1451)])}catch{return e[t(1255)]==typeof s?e[t(1844)]:""}}let o0=(s,t)=>{let n=r;switch(s){case e.qukAD:case e[n(1026)]:return{[n(1115)+s]:1,"x-tt-env":t};default:return{}}};class a0{constructor(t){let n=r;if(e[n(938)](e[n(1768)],n(600)))this[n(628)+n(1502)]=t,this[n(995)]=0;else return(this[n(1882)+"rs"][_0x2f060d]||(this._listeners[_0x201ef7]=[])).push({fn:_0x4f19a5,ctx:_0x252afd||this}),this}addCount(){let t=r;this[t(995)]++}[r(712)+"chMaxCount"](){let t=r;return e[t(1759)](this[t(995)],this[t(628)+"ount"])}[r(1682)+"nter"](t=0){let n=r;if(e[n(1577)](e[n(477)],e.poRZR))return!!(e[n(1562)](this[n(1525)+"ndex"],this[n(836)+"s"].length)||this[n(1525)+"ndex"]===this[n(836)+"s"][n(1410)]-1&&this[n(1181)+"ndpointT"+n(844)+"t"]===this[n(728)+"es"]);this[n(628)+n(1502)]=t,this[n(995)]=0}}async function x0(s){return new Promise(t=>{let n=P,o={xEKcv:n(768)+n(1879),aTHoW:function(c,d){return e[n(687)](c,d)},XkUKe:function(c,d){return e[n(1783)](c,d)},NIRdb:function(c,d){return e[n(439)](c,d)},RsxgK:function(c,d){return e[n(680)](c,d)},UJOIp:function(c,d){return e.hGDiM(c,d)}};if(!st)return t(e.nIMxJ);try{let c=document["createEl"+n(1008)](n(1022));window[n(829)+n(1836)]=d=>{let g=n;g(911)!==g(911)?(this[g(1525)+g(1615)]=0,this[g(1181)+g(1197)+g(844)+"t"]=0):(document[g(1459)][g(640)+g(926)](c),window[g(829)+g(1836)]=void 0,t(d&&d.msg||o[g(1111)]))},c[n(1188)]=e[n(775)],c[n(564)]=e[n(421)](s.replace(/^ws/,e.sxPpN),e.FDdgj);try{document.body[n(1169)+n(926)](c)}catch{document.body[n(640)+n(926)](c)}}catch{if(e.lCehN!==n(1875))window[n(829)+n(1836)]=void 0,e[n(1050)](t,e[n(1761)]);else return new _0x1c5e66(GCSkVQ[n(1157)](_0x4a7066[0]|GCSkVQ[n(632)](_0x62778c[1],8),_0x59266e[2]<<16)|GCSkVQ[n(652)](_0x490c03[3],24),GCSkVQ[n(1157)](GCSkVQ[n(1157)](GCSkVQ[n(1744)](_0x364edd[4],GCSkVQ[n(632)](_0x2358f4[5],8)),_0x2bd16e[6]<<16),GCSkVQ.UJOIp(_0x167810[7],24)),_0x137552)}})}function qe(s,t,n){let o=r;return!!s?.find(c=>c[o(764)]===t&&c[o(1843)]===n)}function it(s,t){let n=r;return s?.[n(1589)](o=>o[n(764)]===t)?.value}let rr=null;async function c0(){let s=r;if(e[s(1786)]("wLWGP",e[s(745)]))return rr||(rr=Promise[s(1593)]()[s(1407)](Se[s(1267)](Se,s(1885)))),rr;_0x16fcc8&&this._cursorManager["updateCu"+s(1281)+s(464)](_0x36edec)}class f0 extends tr{constructor(t,n){let o=r;super(),this._dbName=t,this[o(1692)]=n,this[o(1798)]=void 0,this[o(1167)+"mise"]=null}async[r(610)](){await this[r(1651)]()}async _init(){let t=r;if(!this[t(1798)]){if(this[t(1167)+"mise"])return this[t(1167)+"mise"];try{let n=this[t(385)],o=this._keyPath;this[t(1167)+t(1411)]=(async()=>{let c=t,d={ipQtn:function(p,u){return p(u)},NQIQY:function(p,u){return e[P(1750)](p,u)},OZqVf:e[c(1131)]},{openDB:g}=await e.KWHGi(c0);this[c(1798)]=await g(c(829)+"_"+n,1,{upgrade(p){let u=c;d.OZqVf!==d[u(1041)]?(d[u(1812)](_0x320fb3,this[u(407)+u(1393)+"Id"]),d[u(535)](_0x2ece98,this["_reconnectTimeou"+u(463)]),this[u(407)+"gTimeoutId"]=null,this[u(1522)+u(562)+u(463)]=null):p[u(425)+u(1062)+"e"](n,{keyPath:o})}})})(),await this[t(1167)+t(1411)]}catch(n){console[t(688)](n)}finally{this[t(1167)+"mise"]=null}}}async[r(550)](t){let n=r;try{return await this[n(1651)](),this[n(1798)]?.[n(550)](this[n(385)],t)}catch(o){console[n(688)](o)}}async[r(756)](t,n){let o=r;return await this[o(1651)](),this._qosDB?.put(this[o(385)],t)}async del(t){let n=r;try{return await this[n(1651)](),this._qosDB?.[n(991)](this._dbName,t)}catch(o){console[n(688)](o)}}async clear(){let t=r;try{return await this._init(),this[t(1798)]?.clear(this[t(385)])}catch(n){console[t(688)](n)}}async[r(1540)](){let t=r;return await this[t(1651)](),this[t(1798)]?.[t(1605)+"ys"](this[t(385)])}async[r(769)](){let t=r;return await this[t(1651)](),this._qosDB?.getAll(this[t(385)])}async[r(1342)](){let t=r;try{this[t(1798)]?.close(),this._qosDB=void 0}catch(n){console[t(688)](n)}}get isReady(){let t=r;try{if(e.zOVKP(t(1813),t(1067))){let n=_0xd9d1ed[t(1710)+"At"](_0x304e5e);e[t(1290)](n,55296)&&e.vgFka(n,56319)&&e[t(580)](e[t(1379)](_0x436961,1),_0x25b0b5)&&(n=e[t(1594)](e.Nurfc(e[t(824)](n,10),_0x2b95bc[t(1710)+"At"](++_0x525441)),56613888)),n<128?_0x56d360[_0x3c5849++]=n:(e[t(781)](n,2048)?_0x40c5ce[_0x957f38++]=e[t(466)](n,6)&31|192:(e[t(1419)](n,65536)?_0x247d7c[_0x322fdd++]=e[t(616)](e[t(1861)](e[t(723)](n,12),15),224):(_0x41bbda[_0x3e718c++]=e.RxvBZ(e[t(1073)](e[t(1122)](n,18),7),240),_0x5e0b51[_0x416d09++]=e[t(1397)](e[t(1287)](e[t(1664)](n,12),63),128)),_0x204efb[_0x3dfb27++]=e[t(1397)](e.Yyctn(n,6)&63,128)),_0x118d15[_0x360dda++]=e.iypsb(e[t(653)](63,n),128))}else return!!this._qosDB}catch(n){return console[t(688)](n),!1}}}class u0{constructor(t,n){let o=r;if(e[o(1766)](e[o(1429)],e.lkKtF)){var c=_0x455212[_0xe2e545];if(lEwhDQ.AtajX(void 0,c))return c[o(1020)];var d=_0x545d31[_0x51eb72]={exports:{}};return _0x57693c[_0x2528c4](d,d.exports,_0x4a699d),d[o(1020)]}else this[o(1456)]=t,this[o(1733)]=n,this[o(1798)]=localStorage}async[r(610)](){}get[r(1420)](){let t=r,n={wSokJ:e[t(454)],goOcL:function(o,c){return o>c},OWzJv:function(o,c,d,g){return o(c,d,g)},zhKtP:function(o,c){return e[t(869)](o,c)},IRMyT:function(o,c){return o&c},vFvMS:function(o,c){return e[t(1853)](o,c)},cTlrI:function(o,c){return e[t(840)](o,c)},gPDoQ:function(o,c){return e[t(1403)](o,c)},KFaRk:function(o,c){return e[t(580)](o,c)},cnipD:function(o,c){return e[t(1174)](o,c)},HbCPV:function(o,c){return o|c},RDOPx:function(o,c){return e[t(1403)](o,c)},IxYzC:function(o,c){return e.BAYwG(o,c)},PeMbe:function(o,c){return e[t(803)](o,c)},OITJj:function(o,c){return e[t(523)](o,c)},XQthM:function(o,c){return e[t(1042)](o,c)},kadys:function(o,c){return e[t(1162)](o,c)},yYGdG:function(o,c){return e[t(1080)](o,c)}};if(e[t(1606)]("RshQb",e[t(1645)])){let o=4294967295;return function(c,d,g=!0){let p=t,u=n[p(1587)].split("|"),y=0;for(;;){switch(u[y++]){case"0":if(n[p(905)](d+=5,c[p(1410)]))throw d=c.length,n.OWzJv(_0x5c45ea,d,10,c[p(1410)]);continue;case"1":o=n.zhKtP(o|n[p(755)](127,c[d])<<7,0);continue;case"2":o=n[p(1388)](n.cTlrI(o,n.gPDoQ(127,c[d])<<21),0);continue;case"3":if(n[p(472)](c[d++],128))return{value:g?o:n[p(422)](0,o),offset:d};continue;case"4":if(c[d++]<128)return{value:g?o:n[p(387)](0,o),offset:d};continue;case"5":o=n[p(1388)](n[p(459)](o,n[p(1592)](15,c[d])<<28),0);continue;case"6":if(n[p(1350)](c[d++],128))return{value:g?o:n[p(387)](0,o),offset:d};continue;case"7":return{value:g?o:n[p(891)](0,o),offset:d};case"8":if(n[p(1659)](c[d++],128))return{value:g?o:0|o,offset:d};continue;case"9":o=(127&c[d])>>>0;continue;case"10":if(n[p(1621)](c[d++],128))return{value:g?o:n[p(1175)](0,o),offset:d};continue;case"11":o=n[p(1388)](o|n.yYGdG(n[p(1558)](127,c[d]),14),0);continue}break}}}else return"frontier_"+this[t(1456)]}async get(t){let n=r,o=this._qosDB.getItem(this[n(1420)]);return JSON[n(1351)](e[n(832)](o,"{}"))[t]}async set(t,n){let o=r,c=this[o(1798)][o(1714)](this[o(1420)]),d=JSON[o(1351)](e[o(1380)](c,"{}"));return d[n||t[this._pathKey]]=t,this._qosDB.setItem(this[o(1420)],JSON[o(1249)+"y"](d)),n||t[this[o(1733)]]}async[r(740)](t){let n=r,o={xYvGF:function(c,d,g){return e[P(1703)](c,d,g)}};if(e[n(820)](e[n(1800)],e[n(1800)])){let c=this[n(1798)][n(1714)](this[n(1420)]),d=JSON.parse(e[n(1380)](c,"{}"));return d[t]=void 0,this._qosDB.setItem(this[n(1420)],JSON.stringify(d))}else{let c={EvjmC:function(d,g,p){return o[n(448)](d,g,p)}};return new _0x1888a4(d=>{let g=n;c[g(742)](_0x4bdcee,d,this[g(1203)+g(643)+"e"](_0x47f8bf))})}}async[r(674)](){let t=r;return this[t(1798)][t(674)]()}async[r(1540)](){let t=r,n=this[t(1798)][t(1714)](this[t(1420)]),o=JSON[t(1351)](n||"{}");return Object[t(1540)](o)}async[r(769)](){let t=r,n={yeGQX:function(o,c){return e.blBHW(o,c)},cMRgL:function(o,c){return e[P(1460)](o,c)}};if(e[t(711)]===e[t(711)]){let o=this[t(1798)][t(1714)](this[t(1420)]),c=JSON[t(1351)](o||"{}");return Object[t(718)](c)}else _0x653641=qmCwnX.yeGQX(_0x51eb19,_0x1a7b0a),_0x2dba56<32&&(_0x3e468c|=qmCwnX[t(1442)](127,_0x1a69a3)<<_0x4c6941),_0x3389df+=7}[r(1342)](){return Promise[r(1593)]()}get[r(1603)](){return!!this[r(1798)]}}class d0{constructor(t,n){let o=r;if(e[o(1827)]("UQAag",e.PPLEu))return _0x56bffa+=_0x23c52a&&_0x147665[o(1130)+"th"]||0,_0x6512f2;this._DBName=t,this[o(1733)]=n,this._qosDB=Je?tt:vt?wx:null}async openDB(){}get[r(1420)](){let t=r;return e[t(1143)](e[t(1821)],e.Ewxov)?_0x1a2319[t(1378)+t(641)][1]?void 0:_0x256bf5["objectSt"+t(569)](_0x458b42["objectSt"+t(641)][0]):t(829)+"_"+this._DBName}async[r(550)](t){let n=r,o=this._qosDB["getStora"+n(1010)](this[n(1420)]);return JSON.parse(e[n(832)](o,"{}"))[t]}async[r(756)](t,n){let o=r,c=this[o(1798)][o(945)+o(1010)](this._prefix),d=JSON[o(1351)](c||"{}");return d[n||t[this[o(1733)]]]=t,this[o(1798)]["setStora"+o(1010)](this[o(1420)],JSON[o(1249)+"y"](d)),n||t[this[o(1733)]]}async del(t){let n=r,o=this[n(1798)][n(945)+n(1010)](this[n(1420)]),c=JSON[n(1351)](e[n(832)](o,"{}"));return c[t]=void 0,this[n(1798)][n(1177)+n(1010)](this[n(1420)],JSON[n(1249)+"y"](c))}async[r(674)](){let t=r;return this._qosDB["clearSto"+t(436)]()}async[r(1540)](){let t=r;if(e[t(1610)](e[t(922)],"MKKUD"))return new _0x2c7208(e[t(841)](e[t(1284)](e[t(1856)](e.CsxWS(_0x43fa83[4],24),_0x225e63[5]<<16),_0x41091b[6]<<8),_0xff98bb[7]),e[t(803)](e[t(1837)](e[t(536)](e[t(1352)](_0x56b6e6[0],24),e[t(406)](_0x2d697[1],16)),e[t(1564)](_0x46b574[2],8)),_0x3eaa0e[3]),_0x653994);{let n=this[t(1798)][t(945)+t(1189)+"nc"](this._prefix),o=JSON[t(1351)](e[t(1384)](n,"{}"));return Object[t(1540)](o)}}async[r(769)](){let t=r,n=this._qosDB[t(945)+t(1189)+"nc"](this[t(1420)]),o=JSON.parse(e.DDagx(n,"{}"));return Object[t(718)](o)}[r(1342)](){return Promise[r(1593)]()}get[r(1603)](){return!!this._qosDB}}function ws(s,t){let n=r;if(e[n(1774)](Je,Je))return new d0(s,t);if(e.uEZCY(st,St)&&e.xgPWt("undefined",typeof indexedDB))return new f0(s,t);if(e.DDagx(st,St)&&e[n(1430)](e[n(571)],typeof localStorage))return new u0(s,t);throw new Error(n(1636)+n(1331)+"d")}class l0{constructor(){let t=r;this[t(1151)+t(1438)+"Id"]=null,this[t(1151)+"l"]=36e5,this[t(1798)]=e.bjvcG(ws,e[t(646)],e[t(409)])}async _intervalFlush(){let t=r;e[t(1363)](clearInterval,this["_interva"+t(1438)+"Id"]),this[t(1151)+t(1438)+"Id"]=setInterval(()=>{let n=t;this[n(1730)+n(476)]()},this[t(1151)+"l"])}async openDB(){let t=r;if(e.RabQv(e[t(1031)],"rzTDl"))return new _0x419a0b(_0x2327f3,{data:_0xdff350});await this[t(1798)].openDB()[t(1407)](()=>{let n=t;this[n(1151)+n(967)]()})}async[r(1730)+r(476)](){let t=r;(await this._qosDB?.[t(769)]()||[])[t(1518)](({timestamp:c})=>c<Date.now())[t(1698)](c=>{let d=t;this[d(1798)]?.[d(740)](c[d(1899)+"id"])})}async[r(740)](t){return this._qosDB?.del(t)}async[r(756)](t,n){return this._qosDB?.set({message_id:t,timestamp:n})}async get(t){return this[r(1798)]?.get(t)}async[r(1342)](){let t=r;e[t(1363)](clearInterval,this[t(1151)+t(1438)+"Id"]),await this[t(1798)]?.closeDB()}get[r(1603)](){let t=r;if(e[t(648)](t(1238),e[t(1306)]))return this._qosDB?.[t(1603)];if(!this[t(1538)])return;this[t(1722)+"WebSocket"](_0xfbdad8,_0x4c04a1,_0x7f3c29)}}function sr(s){let t=r,n=!!this[t(1437)].enableQoS;if(!n)return{enabled:n,isQoSMessage:!1,isQoSAck:!1,isAckCleanupMessage:!1,ackMsgIds:[]};let o=e[t(835)](qe,s[t(1239)][t(572)],e[t(732)],"2"),c=o&&qe(s[t(1239)][t(572)],e[t(1515)],"1"),d=o&&e[t(1810)](qe,s[t(1239)][t(572)],e[t(1016)],"1"),g=d?e[t(1275)](it,s[t(1239)][t(572)],t(1709)+t(1224)+t(1647))?.[t(720)](",")[t(1518)](Boolean)||[]:[];return{enabled:n,isQoSMessage:o,isQoSAck:c,isAckCleanupMessage:d,ackMsgIds:g}}async function _s(){let s=r;return this[s(1083)+s(1511)]||(this[s(1083)+s(1511)]=new l0),this[s(1083)+s(1511)][s(1603)]||await this[s(1083)+s(1511)].openDB(),this["_QoSMana"+s(1511)]}async function h0(s,t){let n=r,o={yqstk:function(u,y,v){return e.vEHFN(u,y,v)},jlErm:function(u,y,v){return e[P(1717)](u,y,v)},iEyKI:n(625)},{enableAutoAck:c}=this[n(1437)],d=e.lXYPi(qe,s[n(1239)][n(572)],e[n(1797)],"1"),g=e[n(1810)](qe,s[n(1239)][n(572)],e[n(1637)],"1"),p=sr.call(this,s);if(e[n(669)](c,d))if(e[n(411)](n(1315),e[n(810)])){let u=fxQETY[n(1572)](_0x2f72d0,"error",{message:this[n(1247)+n(706)+"age"](_0x2ead42)});this.emit("error",u);let y=fxQETY.jlErm(_0x44d029,fxQETY[n(1340)],{reason:this[n(1247)+n(706)+n(1877)](_0x428431)});this.emit(n(625),y)}else{let{SeqID:u,LogID:y,service:v,LogIDNew:A,method:N}=s[n(1239)];this[n(609)]({SeqID:u,LogID:y,LogIDNew:A,service:v,method:N,headers:[{key:e[n(1637)],value:"1"},{key:e[n(1292)],value:e[n(1426)](A,"")},{key:e.htwCU,value:"0"}]})}g&&!p[n(1044)]&&this[n(1850)+n(1463)+n(1693)](s),e[n(1705)](t)}async function g0(s,t){let n=r;this[n(565)](e[n(1256)],s[n(1239)]),e[n(1387)](t)}async function p0(s,t){let n=r;if(e[n(820)](e[n(969)],e[n(969)])){let o=e[n(1356)](es,await e.NbVoO(ms,s.data));try{if(o[n(1666)]instanceof Uint8Array){let c=e[n(1685)](this[n(1437)][n(717)+n(963)],Object)?{force:!!this[n(1437)][n(717)+"ncoding"].force,encoding:this[n(1437)][n(717)+n(963)].encoding?this[n(1437)][n(717)+n(963)].encoding[n(1237)](/\s/g,"")["toLowerC"+n(1398)]():""}:{force:!1,encoding:this[n(1437)]["payloadE"+n(963)]?this._options[n(717)+"ncoding"].replace(/\s/g,"")["toLowerC"+n(1398)]():""},d=o[n(717)+n(963)]?o[n(717)+"ncoding"][n(1237)](/\s/g,"").toLowerCase():"",g=e[n(1202)](this[n(1437)][n(1394)+"ype"],Object)?{force:!!this[n(1437)][n(1394)+"ype"][n(1529)],type:this[n(1437)][n(1394)+n(1799)][n(1188)]?this._options[n(1394)+n(1799)][n(1188)][n(1237)](/\s/g,"")["toLowerC"+n(1398)]():""}:{force:!1,type:this[n(1437)][n(1394)+"ype"]?this[n(1437)][n(1394)+n(1799)].replace(/\s/g,"")[n(988)+"ase"]():""},p=o[n(1394)+"ype"]?o[n(1394)+n(1799)][n(1237)](/\s/g,"").toLowerCase():"",u=g.force?g[n(1188)]:p||g[n(1188)],y=c[n(1529)]?c[n(738)]:d||c[n(738)],v=[e[n(1844)],e.NQprF,e[n(1881)],e[n(1255)]],A=[e[n(1139)],e[n(959)]];this[n(1437)][n(1158)+n(1635)+n(1612)+"ad"]&&v[n(1855)](u)&&(!y||A[n(1855)](y))?o[n(1121)+"oad"]=e[n(1840)](ps,o[n(1666)],0,o[n(1666)][n(1130)+"th"]):o["textPayl"+n(1824)]=""}else o[n(1121)+n(1824)]=""}catch(c){o["textPayl"+n(1824)]="",console[n(688)](c)}s[n(1239)]=o,e[n(1705)](t)}else this[n(1538)]&&this._ws.send(_0x5be088),this._debug("sent",_0x3e2eef)}function m0(s,t,n){let o=r;if(e[o(805)]!=="kADpp"){let c=e[o(1492)](n,8192),d=e[o(1417)](c,1),g=null,p=c;return function(u){let y=o;if(u<1||e[y(1353)](u,d))return e[y(1039)](s,u);e[y(1021)](e[y(1257)](p,u),c)&&(g=e[y(1450)](s,c),p=0);let v=t[y(1329)](g,p,p+=u);return e[y(1176)](7,p)&&(p=e[y(798)](7|p,1)),v}}else _0x504d7c[o(1459)].appendChild(_0x246d2f)}let w0=4294967295;function _0(s,t,n){let o=r;return e[o(1205)](RangeError,e[o(702)](e[o(743)](e[o(1531)](e[o(513)]+s,e[o(923)]),e[o(1784)](t,1)),e.NUzMM)+n)}function y0(s,t,n){let o=r;if(e.gkgJq(o(854),e[o(1648)])){if(e[o(1142)](n,w0))throw new Error(e[o(933)]);let c=3;for(;e[o(1320)](c,0);)if(e[o(880)](e[o(914)],e[o(914)]))this[o(576)+o(1857)+"line"]=_0x5db04f,_0x54a748?this[o(1390)+"nLine"]():this[o(1390)+"ffLine"]();else{let d=e.dYnzR(255,n);e[o(1840)](or,d,s,e.HpUYH(t,c)),n>>>=8,c--}return e.bdSMU(t,4)}else{let c=e[o(1870)](255,_0x257d79);e.LInEG(_0x588e92,c,_0x36fd3f,e[o(1629)](_0xbd6c40,_0x523157)),_0x18d542>>>=8,_0x1d73e8--}}function b0(s,t){let n=r;if(e[n(1561)]===e[n(1561)]){let o=0,c=t,d=t+4;for(;e[n(1487)](c,d);){let{value:g,offset:p}=e[n(1262)](ir,s,c);c=p,o=e[n(979)](o<<8,0),o+=g}return{value:o,offset:d}}else{let o=this[n(1882)+"rs"][_0x15cf4];if(o)for(let c=0;c<o[n(1410)];)e[n(1231)](o[c].fn,_0x255eaa)?o[n(872)](c,1):++c}}function v0(s,t,n){let o=r,c=e[o(1707)][o(720)]("|"),d=0;for(;;){switch(c[d++]){case"0":if(s.length<40)return e[o(762)](e[o(1810)](nr,s,t,n),n);continue;case"1":if(t.write)return e[o(1690)](t[o(1296)](s,n),n);continue;case"2":if(t[o(973)+"e"])return t[o(973)+"e"](s,n)+n;continue;case"3":if(!s)return n;continue;case"4":return e[o(408)](nr(s,t,n),n)}break}}function S0(s,t){let n=r,o={yMspW:function(c,d,g){return e[P(508)](c,d,g)},gLZcg:function(c,d){return c(d)}};if(e[n(774)](n(799),e[n(1489)]))WbgijN[n(1055)](_0x78729f,_0x2f7bef,96),_0x382c83(_0x500f4b,WbgijN[n(915)](_0x4c19cd,_0x5a8c4a));else{let c=new B(e[n(687)](e[n(1058)](e[n(1023)](e[n(958)](s[e[n(1401)](t,4)],24),e[n(1064)](s[e[n(554)](t,5)],16)),e[n(1569)](s[e[n(762)](t,6)],8)),s[e[n(1379)](t,7)]),e[n(616)](e[n(714)](e[n(1218)](s[e.JEhIZ(t,0)],24),e[n(1045)](s[t+1],16))|e[n(747)](s[e[n(702)](t,2)],8),s[e[n(1789)](t,3)]),!0);return t+=8,{value:c,offset:e[n(408)](t,8)}}}function C0(s,t,n){let o=r,c=s[o(823)],d=s[o(494)];return t[n]=e[o(383)](d,24),t[n+1]=e[o(1675)](e[o(767)](d,16),255),t[e[o(474)](n,2)]=e[o(789)](e[o(776)](d,8),255),t[e[o(421)](n,3)]=e.dYnzR(255,d),t[n+4]=c>>>24,t[n+5]=e[o(1736)](e[o(638)](c,16),255),t[e[o(505)](n,6)]=e.yjMHY(c>>>8,255),t[e[o(423)](n,7)]=e[o(450)](255,c),n+=8,n}function ir(s,t){let n=r;return s[n(590)+"8"]?{value:s[n(590)+"8"](t),offset:t+1}:{value:e[n(924)](255,s[t]),offset:e[n(583)](t,1)}}function or(s,t,n){let o=r;return t[o(1015)+"t8"]?t.writeUint8(s,n):t[n]=e.ISMrh(255,s),e[o(1400)](n,1)}let E0=function(s){let t=r,n={zZsJp:function(o,c){return e[P(555)](o,c)}};if(e[t(1617)](e[t(1140)],"NyAss"))_0x185570[t(635)+t(793)](t(866)+t(1475),o=>{let c=t;_0xed4cdf(wVkZVI[c(1333)](_0x29a5b3,_0x249f7e.result),o[c(1536)+"on"],o[c(1794)+"on"],_0x20bc5f(_0x5439d2.transaction))});else return new Uint8Array(s)},A0=e[r(1872)](e[r(571)],typeof Buffer)?Buffer[r(893)+r(686)]:m0(E0,Uint8Array[r(1276)+"e"].subarray);(()=>{let s=r,t={Ieozc:function(n,o){return e[P(1299)](n,o)},wpBhq:function(n,o){return e[P(521)](n,o)},sTVGp:function(n,o){return e[P(556)](n,o)},JsSEp:function(n,o){return e[P(972)](n,o)},ChxDF:function(n,o){return e.MiSJt(n,o)},HOPas:function(n,o){return e.DhzsO(n,o)},HLYEb:function(n,o){return e.SUGdJ(n,o)},iMwMm:function(n,o){return e[P(1330)](n,o)},aEsHm:function(n,o){return e[P(440)](n,o)},ZJlZc:function(n,o){return e[P(1474)](n,o)},cxcNI:function(n,o){return n>>>o},tvjwP:function(n,o){return e[P(595)](n,o)},mFOCU:function(n,o){return n<o},Tmypk:function(n,o){return e.hdHSe(n,o)},RNMne:function(n,o,c,d){return e[P(850)](n,o,c,d)}};if(e.HKOXc===e[s(1334)])return _0x332a3e[s(705)](_0x1c837d)||(_0x292ae7=_0x826772[s(1445)+"er"](_0x3c1309)),ZPtZIv[s(1485)](j[s(940)],_0x404bf4.unsigned)&&ZPtZIv.wpBhq(ZPtZIv.sTVGp(j.high,31),1)&&ZPtZIv[s(1148)](ZPtZIv.ChxDF(_0x111717[s(494)],31),1)?!1:j[s(494)]===_0x5b9438[s(494)]&&j[s(823)]===_0x421e2f[s(823)];{let n=4294967295;return function(o,c,d=!0){let g=s;if(n=t[g(1551)](127&o[c],0),t[g(834)](o[c++],128))return{value:d?n:0|n,offset:c};if(n=t.ChxDF(t.HLYEb(n,t.iMwMm(127&o[c],7)),0),o[c++]<128)return{value:d?n:0|n,offset:c};if(n=t[g(1551)](t.HLYEb(n,t[g(1446)](127,o[c])<<14),0),t[g(834)](o[c++],128))return{value:d?n:0|n,offset:c};if(n=t[g(649)](t[g(488)](n,t[g(821)](127&o[c],21)),0),t[g(834)](o[c++],128))return{value:d?n:t[g(488)](0,n),offset:c};if(n=t[g(1702)](t[g(1517)](n,(15&o[c])<<28),0),t[g(1644)](o[c++],128))return{value:d?n:t[g(1225)](0,n),offset:c};if((c+=5)>o.length)throw c=o[g(1410)],t[g(1597)](_0,c,10,o[g(1410)]);return{value:d?n:0|n,offset:c}}}})();let D0=16,ar=32;function k0(s){let t=r,n={MAIlY:function(o,c){return e[P(1774)](o,c)}};if(e[t(1760)](e.fSzub,e[t(547)])){let o=0,c={};for(let d=0;d<s[t(1410)];d++)c[s[d].cursor_name]=e[t(438)](gs,s[d]["cursor_n"+t(1614)]),o+=14+c[s[d]["cursor_n"+t(1614)]];return[o,c]}else{let o=this._qosDB.getItem(this[t(1420)]);return _0x1eb6bd[t(1351)](ncFpUi[t(606)](o,"{}"))[_0x14240d]}}function ys(s,t,n){let o=r,c={zjIoF:e[o(1359)],khQKO:function(y,v){return e[o(1892)](y,v)},msWbs:o(1110),hIrCF:e[o(1240)],mnWQz:e.LWsme,CkyDr:function(y,v,A,N){return e[o(654)](y,v,A,N)},rFxcy:e[o(1358)],Iinwj:o(386),jebsg:function(y,v,A,N){return e[o(909)](y,v,A,N)},nPGbW:e[o(939)],vmHgu:e[o(613)]},[d,g]=e[o(1376)](k0,s),p=e[o(1724)](A0,d),u=0;return s[o(1698)](y=>{let v=o;if(c[v(1339)](c[v(863)],c.hIrCF))return _0x2bbc3f||(_0x2c14f9=_0x4b3e2a[v(1593)]()[v(1407)](_0x3b2719[v(1267)](_0x2efae2,WLJgia[v(932)]))),_0x5bb31d;console[v(688)](c[v(1776)],y,y[v(386)]),u=c.CkyDr(or,0,p,u),console.log(c[v(461)],u),u=y0(p,u,y.service||0),console[v(688)](c[v(1017)],u),u=c[v(1321)](or,g[y[v(1499)+v(1614)]],p,u),console[v(688)](c[v(1868)],u),u=c[v(1321)](v0,y["cursor_n"+v(1614)],p,u),console[v(688)](c.vmHgu,u),u=C0(B.fromNumber(y[v(1348)]||t),p,u),console[v(688)](v(1769),u)}),{frameType:ar,headers:[{key:o(601)+o(808),value:n}],payload:p}}function I0(s){let t=r,n=0,o=[];for(;n<s.byteLength;){let{offset:c}=e[t(1311)](ir,s,n);n=c;let d={cursor_name:"",cursor:0,service:0},{value:g,offset:p}=e[t(1590)](b0,s,n);d[t(386)]=g,n=p;let{value:u,offset:y}=ir(s,n);n=y,d[t(1499)+t(1614)]=ps(s,n,e[t(998)](n,u)),n+=u;let{value:v,offset:A}=S0(s,n);d.cursor=v[t(690)](),n=A,o[t(1755)](d)}return o}function P0(){let s=r;return{frameType:ar,headers:[{key:s(601)+s(808),value:s(467)+s(934)}],payload:void 0}}class T0{constructor(t,n,o){let c=r;if(e.CakjY(e[c(1425)],e[c(1716)]))this[c(1100)+"ameSpace"]=t,this["_cursorF"+c(1245)]=n,this[c(381)+"Strategy"]=o,this[c(1798)]=e[c(766)](ws,this[c(1100)+c(1374)],e[c(784)]);else{let d=this[c(1437)][c(1559)+"tInterce"+c(637)](_0x2a4f26,_0xbf58e9);this[c(1850)+c(1230)+"ent"](e[c(1182)](_0x44ac60,c(625),{code:_0xe171cd,reason:_0x707bd,wasClean:!0,willReconnect:d})),d&&this[c(593)]()}}async[r(610)](){let t=r;await this[t(1798)][t(610)]()}async getCursors(){let t=r;if(!this[t(1798)][t(1603)])return;let n=this[t(381)+t(1243)],o=await this[t(1798)][t(769)]();switch(console[t(688)](e[t(1076)],o),n){case e.ThTMd:return o&&o[t(1410)]?ys(o,0,this["_cursorF"+t(1245)]):void 0;case e.JVEhp:return;case e.JKoIH:return o&&o[t(1410)]?e[t(1749)](ys,o,0,this[t(1147)+t(1245)]):e[t(1584)](P0)}}async[r(756)](t,n,o){let c=r;return console[c(688)](e.AJZKb,t,n,o),this[c(1798)][c(756)]({cursor_name:t,cursor:n,service:o})}async[r(552)+"rs"](t){let n=r,o=I0(t);for(let c of o)console[n(688)](e[n(826)],o),await this._qosDB.set(c)}async get(t){let n=r;return(await this._qosDB[n(550)](t))?.[n(1348)]}async[r(1342)](){let t=r;await this[t(1798)][t(1342)]()}[r(410)+r(1281)+r(464)](t){let n=r;if(e[n(827)]==="ncQLS")this["_cursorF"+n(1245)]=t;else return this[n(1107)][n(1756)]}get[r(1603)](){let t=r;return this[t(1798)][t(1603)]}}let L0=e[r(1803)];async function bs(s){let t=r,n={RSEWk:function(o,c,d){return e[P(1893)](o,c,d)},eriSJ:function(o,c){return e.nmTyT(o,c)},axokr:function(o,c){return e.PovId(o,c)},hMCAZ:function(o,c){return o|c},MvUOw:function(o,c){return e[P(1128)](o,c)},ywdbw:function(o,c){return e[P(830)](o,c)},lXhMh:function(o,c){return e[P(1764)](o,c)}};if(e[t(624)]!==e[t(1601)]){if(!this._options[t(623)+"S"])return null;let{aID:o,fpID:c,messageStrategy:d}=this[t(1437)],g=s||L0;try{if(this[t(912)+t(1506)])if(e.jHlFD(e[t(1649)],t(1469)))s&&this["_cursorM"+t(1506)][t(410)+"rsorFile"+t(464)](s);else{this[t(1068)+"ngTimer"](),this["_pingPon"+t(1393)+"Id"]=n[t(1297)](_0x3c2f79,this[t(1049)][t(1267)](this),this[t(1437)][t(801)+t(1087)]);return}else this[t(912)+t(1506)]=new T0(c+"_"+o+"_"+g,g,d);return this[t(912)+t(1506)].isReady||await this[t(912)+t(1506)][t(610)](),this._cursorManager}catch{return e.hJiKY(e[t(1309)],e.QNaaH)?null:this[t(1107)].url}}else _0x2069da=_0x34481d[aWQaNs.eriSJ(_0x1d09ab+_0x2e15f3,1)],aWQaNs[t(744)](192,_0x32ce7c)!==128?_0x272883+=_0x4a2a03:(_0x39b2e5=aWQaNs[t(1413)](aWQaNs[t(1600)](aWQaNs.axokr(31,_0x55ba13),6),aWQaNs[t(744)](63,_0x50c894)),aWQaNs.ywdbw(_0x322582,128)?_0x30c056+=_0x1cc9da:(_0x18eef6+=aWQaNs[t(1101)](_0x118070,_0x23395e),_0x98e56b++))}async function N0(s,t){let n=r,o={dLdrD:function(D,O){return D===O},GHMnx:function(D,O){return D<O}},c=e[n(416)](qe,s[n(1239)][n(572)],e.UsuPc,"-1"),d=e[n(1264)](qe,s[n(1239)].headers,e[n(1637)],"1"),g=it(s.message[n(572)],n(1709)+"er_msgid"),p=e.QVLVM(Number,e[n(1244)](it,s.message[n(572)],e[n(811)]))||0,u=sr.call(this,s),y=qe(s.message[n(572)],e[n(1490)],"2"),v=e.ewaav(it,s[n(1239)][n(572)],e[n(493)]),A=e.rPOKN(Number,e[n(538)](it,s.message[n(572)],n(1667)+n(1542)+"ue"));if(u.isQoSAck)return e.lrnwy(t);let N=u[n(1757)+n(701)]?await _s[n(1329)](this):null;if(s[n(1239)].service>0&&d&&!c||e[n(1353)](s.message[n(386)],0))if(n(731)!==e[n(605)]){if(g&&u[n(1757)+n(701)]&&N)return!!!await N.get(g)&&(e.HnzVK!==e[n(435)]?(this[n(1188)]=_0x272fa4,this[n(664)]=null):(this[n(1850)+n(667)+n(1282)](s),await N[n(756)](g,e[n(796)](Date[n(1266)](),p)))),t();if(y){let D=await bs[n(1329)](this);if(!D)return this[n(1850)+n(667)+n(1282)](s),e[n(512)](t);let O=await D[n(550)](v)??-1;if(e[n(982)](O,A))this["_dispatchMessage"+n(1282)](s),D[n(756)](v,A,s[n(1239)][n(386)]);else throw new Error(n(1477)+n(501)+" cursor "+A+(n(1086)+n(1089)+"al cursor ")+O);return t()}return this[n(1850)+n(667)+n(1282)](s),e[n(1349)](t)}else{if(_0x942f0===void 0)this[n(1882)+"rs"]={};else if(LjCCrH[n(531)](void 0,_0x224acc))this[n(1882)+"rs"][_0x1c9d80]=null;else{let D=this[n(1882)+"rs"][_0x3c5da1];if(D)for(let O=0;LjCCrH[n(482)](O,D[n(1410)]);)LjCCrH.dLdrD(D[O].fn,_0x554ccc)?D[n(872)](O,1):++O}return this}}async function R0(s,t){let n=r,o=sr[n(1329)](this,s);if(!o.isQoSMessage)return e[n(1705)](t);let c=await _s.call(this);if(o[n(1547)+n(1360)+"age"]&&o[n(1481)+"s"][n(1410)])for(let d of o[n(1481)+"s"])await c[n(740)](d);e.JDOYn(t)}async function O0(s,t){let n=r,o={fpFTb:e[n(1878)]},c=s[n(1239)].frameType===D0,d=e[n(1354)](s[n(1239)][n(1762)+"e"],ar);if(e[n(669)](!c,!d))return t();let g=e[n(1314)](it,s[n(1239)][n(572)],"cursor_f"+n(808));if(!g)return e.rYVhd(t);let p=await bs[n(1329)](this,g);if(!p)return e[n(512)](t);if(c){let u=await p[n(1421)+"rs"](),y={frameType:u?.["frameType"],SeqID:B[n(1445)+"er"](this._seqId++),LogID:B[n(1445)+"er"](this[n(1437)][n(1723)+n(1081)]()),service:9e3,method:5,headers:u?.[n(572)],payload:u?.[n(1666)]},v=e.edpWL(C,y);this[n(1538)]&&this._ws[n(960)+"te"]&&this._ws[n(475)](v)}if(d)if(e[n(481)](n(859),e.XVzjZ))!_0x531279.persisted&&(this._isBrowser&&_0x1dc5aa[n(447)+n(502)+"ner"](n(1495),this[n(592)+"ageHide"]),this._isBrowser&&_0x354062["removeEv"+n(502)+"ner"]("pageshow",this[n(592)+"ageShow"]),this.close()),this._isBrowser&&_0x440a19[n(447)+n(502)+"ner"](n(1265),this[n(1390)+n(659)]),this[n(1161)+"er"]&&_0x22b2b4[n(447)+"entListe"+n(1163)](o[n(1735)],this[n(1390)+n(1099)]);else{let u=s.message.payload;u&&p[n(552)+"rs"](u)}}let B0=async function(s,t){let n=r;this[n(543)]=!1,e[n(1552)](clearTimeout,this[n(593)+n(597)+"utId"]),t()},z0=async function(s,t){let n=r;if(!this[n(1538)]||e.awlhK(this[n(1538)][n(960)+"te"],this[n(1523)]))return e[n(1349)](t);let{pingInterval:o}=this[n(1437)];this["_endpoin"+n(1546)]?.[n(394)+"pointCon"+n(557)]();for(let d=0;e[n(992)](d,this[n(381)+"Queue"][n(1410)]);d++){let g=this["_message"+n(763)][d];if(e[n(921)](this._ws[n(960)+"te"],this[n(1523)])&&e[n(1002)](null,g))this[n(1538)]&&this._ws[n(475)](g),this[n(381)+n(763)][d]=null;else break}this[n(381)+n(763)]=this["_message"+n(763)][n(1518)](d=>!!d),this["_pingPon"+n(1393)+"Id"]=setTimeout(()=>this._ping(),o),this[n(1850)+n(1543)+"nt"](s),this._isBrowser&&this[n(1538)]&&(this[n(1538)][n(1781)+"pe"]=this[n(1767)+n(1799)]);let c=this[n(577)+n(1546)]?.[n(504)+"ntEndpoint"]();this[n(565)](n(1273)+c+n(1830)),e[n(1095)](t)},M0=async function(s,t){let n=r,o=this[n(577)+"tManager"]?.["getCurre"+n(396)+"nt"]();this[n(565)](n(1273)+o),e[n(1313)](t)};class q0 extends tr{constructor(t){let n=r,o={ZizVv:function(p,u,y,v){return p(u,y,v)},ChVxA:"wXBEN",GBJXK:function(p,u,y){return e[P(508)](p,u,y)},UEJDW:e[n(1772)],xLfoZ:n(997)+"2",Ysxxm:function(p,u){return e[n(1300)](p,u)},KjcKx:e[n(571)],gZFkp:function(p,u){return e.mNJIA(p,u)},JSnny:e[n(759)],veeNd:function(p,u){return e[n(935)](p,u)},XYCdA:e.AKStJ,KWbLe:e[n(698)],AGCcF:function(p,u,y){return e[n(1590)](p,u,y)},fcQic:e[n(1439)]};super(),this["_miniNav"+n(1857)+n(579)]=!0,this[n(1161)+"er"]=st,this[n(1184)]=t0,this[n(908)+"T"]=Je,this[n(993)+"X"]=vt,this[n(1433)+"r"]=St,this[n(381)+n(763)]=[],this[n(577)+"tManager"]=null,this[n(736)+n(750)]=!1,this[n(1767)+n(1799)]=e.eZWDN,this[n(593)+"Lock"]=!1,this[n(593)+n(597)+n(509)]=null,this[n(1522)+n(562)+n(463)]=null,this["_pingPon"+n(1393)+"Id"]=null,this[n(800)]=0,this[n(543)]=!1,this[n(1752)]="",this[n(1083)+"ger"]=null,this[n(912)+"anager"]=null,this[n(696)+"sCounter"]=null,this[n(1155)+"ls"]=e.OlSWN,this.CLOSED=3,this[n(1674)+"NG"]=0,this[n(1523)]=1,this[n(697)]=2,this._onOpen=p=>{let u=n,y={TWKvH:u(873)};try{o[u(1280)](hs,this,p,[B0,z0,M0])}catch(v){if(o[u(1291)]!==o.ChVxA)this[u(1303)](y.TWKvH,_0x318dfa),this[u(449)+u(1526)]&&this[u(449)+u(1526)](_0x354bc8);else{let A=o[u(1679)](ce,o[u(1665)],{message:v[u(1239)],code:Me[u(642)+"OR"],error:v});this[u(1850)+u(1510)+u(444)](A)}}},this[n(1634)+"ge"]=async p=>{let u=n,y={mZAVZ:o[u(1887)],cMPzk:function(N,D){return N||D},XNuoc:function(N,D){return o[u(427)](N,D)},TMVKG:o[u(1516)]},{pingInterval:v,pingFrequency:A}=this[u(1437)];if((o[u(1848)]("hi",p[u(1375)])&&o[u(1405)]===A||o[u(417)](o[u(607)],A))&&(this["_clearPi"+u(1494)](),this[u(1303)](o[u(1261)],u(831)),this[u(407)+u(1393)+"Id"]=o[u(1701)](setTimeout,this._ping[u(1267)](this),v)),p[u(1375)]!=="hi")try{if(o.veeNd(u(1389),o.fcQic)){let N=y[u(1896)].split("|"),D=0;for(;;){switch(N[D++]){case"0":if(_0x351629)return!0;continue;case"1":if(dpzfCZ[u(1271)](_0x1f224d,_0x472d6f)&&dpzfCZ[u(1201)](dpzfCZ[u(1104)],typeof _0x5bb1df)&&_0x487f76)return!0;continue;case"2":return!1;case"3":if(_0x4e07cc&&_0x5af0b2[u(1018)+"ocket"])return!0;continue;case"4":if(_0x32aaa4&&_0x182ce0.connectSocket)return!0;continue}break}}else hs(this,p,[p0,h0,R0,O0,N0,g0])}catch(N){let D=o[u(1679)](ce,o[u(1665)],{message:N[u(1239)],code:Me[u(953)+"ERROR"],error:N});this[u(1850)+"hErrorEv"+u(444)](D)}},this[n(1672)]=p=>{let u=n,y=this[u(577)+u(1546)]?.[u(712)+"chMaxTries"](),v=this[u(577)+u(1546)]?.[u(504)+u(396)+"nt"]();if(y&&!p.message){let A="connect "+v+(u(896)+u(771)+u(1725)+"ed");this[u(1850)+u(1510)+u(444)](ce(o[u(1665)],{message:A,code:Me[u(951)+"IES_ERROR"],error:p}));return}this._ws&&o[u(1848)](this[u(1538)][u(960)+"te"],this.OPEN)&&this[u(1500)+u(434)](),this[u(1850)+u(1510)+u(444)](ce(o[u(1665)],{message:p[u(1239)],code:Me[u(1325)+u(1479)],error:p}))},this[n(1833)]=async p=>{let u=n;this[u(1254)+"mer"](),this[u(1068)+u(1494)](),this[u(689)+"sListeners"](),this[u(1538)]=null,this[u(593)+"Lock"]=!1;let y=this[u(577)+"tManager"]?.[u(712)+u(1581)+"es"]();if(!y&&this[u(1454)+"orOnline"]()&&!this[u(736)+u(750)]){let v=this[u(577)+u(1546)]?.[u(504)+u(396)+"nt"](),A=this[u(1437)][u(1559)+u(500)+u(637)](p[u(402)],p[u(1879)]);this[u(1850)+u(1230)+u(444)](e[u(1869)](he,e.WyKfN,{code:1006,reason:p.reason||u(794)+u(1014)+u(1123)+"wn reaso"+u(868)+u(437)+v,willReconnect:A})),A&&this[u(593)]();return}if(e[u(670)](1e3,p[u(402)])&&this[u(736)+"osed"]){this[u(1850)+"hCloseEvent"](e[u(1e3)](he,e[u(1032)],{code:1e3,reason:e.NvRGG})),this[u(577)+u(1546)]?.[u(394)+u(1711)+u(557)](),this[u(696)+u(1117)]?.[u(1682)+u(491)]();return}if(e[u(1038)](1e3,p[u(402)])&&y)if(e[u(1827)](e[u(1286)],e[u(888)]))_0x3c13cf(_0x5f35a8,82),OqPYKz[u(1701)](_0x94ef49,_0x1ff08d,_0x1ac51c);else{let v=this[u(577)+"tManager"]?.[u(504)+u(396)+"nt"](),A=p[u(1879)];A||(A=await e[u(1871)](x0,this._url)),A=u(794)+u(1014)+u(1771)+A+(u(619)+u(812))+v+(", max re"+u(1880)+u(1408)),this[u(1850)+u(1230)+u(444)](e[u(1859)](he,u(625),{code:p[u(402)],reason:A}));let N="connect "+v+(" fail, max retri"+u(1725)+"ed");this[u(1850)+u(1510)+u(444)](ce(u(1227),{message:N,code:Me[u(951)+"IES_ERROR"]})),this["_endpoin"+u(1546)]?.["resetEnd"+u(1711)+u(557)](),this[u(696)+u(1117)]?.[u(1682)+u(491)]();return}if(e[u(1154)](1e3,p[u(402)])&&!p[u(1879)]){let v=this[u(577)+u(1546)]?.["getCurre"+u(396)+"nt"]();this[u(1850)+u(1230)+"ent"](he("close",{code:p[u(402)],reason:"connecting faile"+u(1123)+"wn reaso"+u(868)+u(437)+v})),this._endpointManager?.["resetEnd"+u(1711)+u(557)](),this[u(696)+u(1117)]?.[u(1682)+u(491)]();return}this[u(1850)+u(1230)+u(444)](p),this[u(577)+u(1546)]?.[u(394)+"pointCon"+u(557)](),this["_pingLos"+u(1117)]?.resetCounter()},this[n(589)]=null,this[n(658)]=null,this[n(517)+"e"]=null,this[n(1680)]=null,this[n(1134)+n(918)]=null,this[n(449)+n(1526)]=null,this[n(1431)+"mediatel"+n(1327)+"ct"]=null,this["_handleO"+n(659)]=this[n(1390)+n(659)][n(1267)](this),this[n(1390)+n(1099)]=this[n(1390)+"ffLine"][n(1267)](this),this[n(592)+n(937)]=this[n(592)+"ageHide"].bind(this),this["_handleP"+n(1484)]=this[n(592)+n(1484)][n(1267)](this),this[n(1437)]={url:"",automaticOpen:!0,initReconnectInterval:1e3,maxReconnectInterval:1e4,reconnectIntervalGrowFactor:2,timeoutInterval:5e3,maxRetries:5,debug:!1,maxMessageQueueLength:e[n(1345)](1,0),service:0,logIDGenerator:x,headers:void 0,payloadEncoding:"",payloadType:"",fpID:"",deviceID:"",accessKey:"",ttwID:"",bddID:"",aID:"",disableAutoReconnect:!1,customParams:{},pingInterval:15e3,pingTimeoutInterval:4e3,pingFrequency:e[n(1628)],pingLossCount:2,enableTransformTextPayload:!1,logIDNewConfig:{enableAutoGenerateLogIDNew:!1,userIp:""},miniProgramParams:{customHttpHeader:{}},enableAutoAck:!1,reconnectInterceptor:()=>!0,enableQoS:!1,QoSLevel:2,messageStrategy:e[n(1668)],env:{xTTEnv:"",xUseEnv:""},listenNetworkChanged:!0};let{url:c,ws:d}=t,g=Array.isArray(c)?c:e[n(1627)](e.kEUof,typeof c)?[c]:[];if(!g||e.fNduq(0,g[n(1410)]))throw new Error(e[n(817)]);if(!e[n(1626)](s0,d))throw new Error(e.ecjwC);Object[n(968)](this._options,t),this[n(577)+n(1546)]=new ls(g,this[n(1437)][n(728)+"es"]),this[n(696)+n(1117)]=new a0(this[n(1437)][n(645)+n(1888)]),this[n(1437)][n(1793)+n(887)]&&(this._isInit=!0,this[n(593)]()),this[n(1437)]["listenNetworkCha"+n(426)]&&(this[n(908)+"T"]||this[n(993)+"X"]?this["_onPageN"+n(791)+n(548)]():this[n(1161)+"er"]&&this._initGlobalEventListener())}[r(1390)+r(659)](){let t=r;this._options["disableA"+t(1090)+"nect"]||this[t(736)+t(750)]||this[t(1027)+t(918)]()}[r(1390)+r(1099)](){let t=r;this[t(1722)+t(737)+"t"]();let n=e[t(1082)](er,e.iFNUV,{message:t(1611)+t(1198)+" reconnect"});this[t(1431)+"mediatelyReconnect"]&&this[t(1431)+t(1035)+t(1327)+"ct"](n)}[r(1395)+r(1108)+r(793)](){let t=r;this[t(1161)+"er"]&&window["addEvent"+t(793)](e[t(1780)],this[t(1390)+t(659)]),this[t(1161)+"er"]&&window[t(635)+t(793)](e[t(1878)],this[t(1390)+t(1099)]),this[t(1161)+"er"]&&window["addEvent"+t(793)](e[t(1105)],this["_handleP"+t(937)]),this._isBrowser&&window[t(635)+t(793)](e[t(813)],this["_handleP"+t(1484)])}["_dropGlo"+r(1108)+"Listener"](){let t=r;this._isBrowser&&window[t(447)+"entListe"+t(1163)](e[t(1780)],this[t(1390)+"nLine"]),this._isBrowser&&window[t(447)+t(502)+t(1163)](t(1070),this[t(1390)+t(1099)]),this[t(1161)+"er"]&&window["removeEv"+t(502)+t(1163)](e[t(1105)],this[t(592)+t(937)]),this[t(1161)+"er"]&&window["removeEv"+t(502)+t(1163)](e.KVrMU,this[t(592)+t(1484)])}["_handleP"+r(937)](t){let n=r;!t[n(981)+"d"]&&(this[n(1161)+"er"]&&window[n(447)+n(502)+n(1163)](e[n(1105)],this[n(592)+n(937)]),this[n(1161)+"er"]&&window[n(447)+n(502)+"ner"](e.KVrMU,this[n(592)+n(1484)]),this.close()),this._isBrowser&&window["removeEv"+n(502)+"ner"](n(1265),this[n(1390)+n(659)]),this[n(1161)+"er"]&&window[n(447)+n(502)+n(1163)](e[n(1878)],this[n(1390)+n(1099)])}[r(592)+"ageShow"](t){let n=r;t.persisted&&(this[n(1454)+n(1586)]()&&(!this[n(1538)]||e[n(1402)](this[n(1538)][n(960)+"te"],this.OPEN)||e[n(1187)](this._ws[n(960)+"te"],this[n(1674)+"NG"]))&&this[n(1390)+n(659)](),this[n(1161)+"er"]&&window[n(635)+n(793)](e[n(1780)],this[n(1390)+"nLine"]),this[n(1161)+"er"]&&window[n(635)+n(793)](e[n(1878)],this[n(1390)+n(1099)]))}async[r(1591)+r(1598)](t){let n=r,o={BSQXo:function(Et,At,K0){return e.VVhTi(Et,At,K0)}},{fpID:c,deviceID:d,bddID:g,ttwID:p,accessKey:u,aID:y,customParams:v={},enableAutoAck:A,enableQoS:N,QoSLevel:D,env:O}=this[n(1437)],ke,$,se;this[n(1161)+"er"]||this[n(993)+"X"]||this[n(908)+"T"]?(ke=location&&e.AJAOh(e[n(977)],location.protocol)?e[n(1763)]:e[n(405)],$=t[n(1237)](/((^ws)|(^http))((?:[s]*:\/\/))/,""),se=/^wss(.*:\/\/)/[n(927)](t)?t:""+ke+$):e.YiDYk!==e[n(749)]?(ke=e.vZqaP,$=t[n(1237)](/(^http)((?:[s]*:\/\/))/,""),se=/(^ws)((?:[s]*:\/\/))/[n(927)]($)?$:""+ke+$):(this[n(1100)+n(1374)]=_0x37ad92,this[n(1147)+n(1245)]=_0xa9d3f4,this[n(381)+"Strategy"]=_0x1a9d3e,this._qosDB=OakMRT[n(1357)](_0x2e6bc4,this[n(1100)+n(1374)],"cursor_name"));let ot=g?"bd_did":p?e[n(1146)]:n(1312)+"d",Ct=g||p||d;if(!Ct||!ot)throw new Error(e.joKeX);let xr=e[n(1548)](e[n(1033)],typeof v)?await e.lrnwy(v):v,U0=O?e.rABbc(o0,O.xUseEnv,O.xTTEnv):{},cr=Object.assign({device_platform:e.nSzTm,version_code:e[n(1842)],access_key:u,fpid:c,aid:y,[ot]:Ct,xsack:A?1:0,xaack:A?1:0,xsqos:N?1:0,qos_level:N?D:void 0,qos_sdk_version:2,...U0},xr),F0=Object.keys(cr)[n(1377)]((Et,At)=>cr[At]!==void 0?""+Et+(Et?"&":"?")+At+"="+cr[At]:Et,"");return se+"/ws/v2"+F0}async[r(593)](){let t=r;if(!(this[t(593)+"Lock"]||this._readyClosed)){this["_connect"+t(1655)]=!0;try{let n=this[t(577)+"tManager"]?.["checkCur"+t(1210)+t(1604)+t(1549)+t(985)](),{timeoutInterval:o}=this[t(1437)];if(n){let d=this[t(577)+t(1546)]?.[t(504)+t(396)+"nt"](),g=this["_endpoin"+t(1546)]?.[t(825)+t(875)+"pointAndUpdateCo"+t(492)](),p=this[t(577)+t(1546)]?.["getCurre"+t(396)+t(1847)+"ount"]();if(g){let u=t(1138)+d+(t(876)+", max retries reached, will use "+t(529)+t(1508))+g+" to retry",y=e[t(847)](ce,e[t(1772)],{message:u,code:Me[t(951)+t(1537)+"R"]});this[t(565)](u),this[t(1850)+t(1510)+"ent"](y),this._url=await this[t(1591)+t(1598)](g),this[t(565)](t(1138)+g+" "+p+t(1246)),this[t(689)+t(1807)+"rs"]()}else{let u="connect "+d+(" timeout"+t(1226)+t(1880)+t(1408));this[t(565)](u),this[t(1850)+t(1510)+t(444)](ce(e[t(1772)],{message:u,code:Me["MAX_RETR"+t(1537)+"R"]}));return}}else{let d=this[t(577)+t(1546)]?.[t(504)+t(396)+t(1829)+t(770)](),g=this[t(577)+t(1546)]?.["getCurre"+t(396)+t(1847)+t(1502)]();this._url=await this[t(1591)+"eUrl"](e[t(832)](d,"")),this[t(565)](t(1138)+d+" "+g+" times"),this[t(689)+t(1807)+"rs"]()}if(this[t(543)])this[t(543)]=!1;else if(e[t(856)]!==t(1817)){let d=_0x82d7bf[t(1239)][t(1666)];d&&_0x4348f0[t(552)+"rs"](d)}else{let d=e[t(634)](er,e[t(952)],{message:t(715)});this[t(1134)+"econnect"]&&this[t(1134)+t(918)](d)}let c=this[t(577)+"tManager"]?.[t(504)+t(396)+"ntTriesC"+t(1502)]()||0;e.sJXnn(c,1)&&await this[t(1336)](c-1),this[t(565)](t(794)+"ng url: "+this[t(1752)]+(t(703)+t(851))+this[t(1155)+"ls"]),this._ws=e[t(1262)](r0,{url:this[t(1752)],protocols:[this[t(1155)+"ls"]],headers:this._options[t(878)+t(1741)+"s"][t(1491)+t(874)]},this[t(1437)].ws),(this._isBrowser||this[t(1433)+"r"])&&this[t(1538)]&&(this[t(1538)][t(1781)+"pe"]=this[t(1767)+"ype"]),this[t(468)+"steners"](),this[t(593)+t(597)+"utId"]=setTimeout(this[t(1171)+"ut"][t(1267)](this),o)}catch(n){throw this[t(593)+"Lock"]=!1,n}}}[r(1254)+r(503)](){let t=r;e.vfkju(clearTimeout,this["_connect"+t(597)+t(509)]),this["_connect"+t(597)+t(509)]=null}[r(1068)+r(1494)](){let t=r;clearTimeout(this[t(407)+t(1393)+"Id"]),clearTimeout(this[t(1522)+t(562)+"tId"]),this[t(407)+"gTimeoutId"]=null,this[t(1522)+"ctTimeoutId"]=null}[r(565)](...t){let n=r;this[n(1437)][n(961)]&&console[n(688)][n(1137)](console,[e[n(1193)],...t])}[r(1203)+r(643)+"e"](t){let n=r,{initReconnectInterval:o,maxReconnectInterval:c,reconnectIntervalGrowFactor:d}=this[n(1437)],g=e[n(1283)](o,Math[n(585)](d,e[n(1565)](t,1)));return g>c?c:g}[r(1049)](){let t=r;if(e[t(1124)](t(1470),t(379)))return!!this._qosDB;if(this[t(1538)]&&e[t(871)](this[t(1538)].readyState,this[t(1674)+"NG"])){this._clearPingTimer(),this[t(407)+"gTimeoutId"]=e[t(1708)](setTimeout,this._ping[t(1267)](this),this[t(1437)][t(801)+t(1087)]);return}if(!this[t(1538)]||e.LABtw(this._ws[t(960)+"te"],this[t(1523)]))return void this[t(1027)+t(918)]();this[t(1538)]&&this[t(1538)][t(475)]("hi"),this[t(1522)+"ctTimeou"+t(463)]=e[t(1788)](setTimeout,this[t(1027)+t(918)+t(778)][t(1267)](this),this[t(1437)][t(1480)+"outInterval"])}[r(1027)+r(918)+"Timeout"](){let t=r;this[t(696)+t(1117)]?.[t(462)](),this.emit(e[t(1396)],t(867)),this[t(696)+t(1117)]?.["checkRea"+t(675)+"nt"]()?this[t(1027)+t(918)]():this[t(1049)]()}[r(1454)+r(1586)](){let t=r;return this[t(908)+"T"]||this._isMiniWX?this._miniNavigatorOnline:(this[t(1161)+"er"]||this[t(1433)+"r"])&&this[t(1437)][t(1825)+"tworkCha"+t(426)]?navigator[t(1034)]:!0}[r(1027)+"econnect"](){let t=r;!this[t(1454)+t(1586)]()||this[t(736)+"osed"]||(this[t(577)+t(1546)]?.["resetEnd"+t(1711)+"fig"](),this[t(696)+t(1117)]?.["resetCou"+t(491)](),this[t(1538)]?this[t(1500)+"ect"](1001,e[t(432)],!0):this[t(593)]())}[r(1133)+r(791)+r(548)](){let t=r;this._isMiniTT?tt[t(1075)+t(1422)+"hange"](({isConnected:n})=>{let o=t;this["_miniNavigatorOn"+o(579)]=n,n?this[o(1390)+o(659)]():this[o(1390)+"ffLine"]()}):this[t(993)+"X"]&&wx[t(1075)+t(1422)+t(883)](({isConnected:n})=>{let o=t;this[o(576)+o(1857)+o(579)]=n,n?this[o(1390)+o(659)]():this[o(1390)+"ffLine"]()})}[r(1336)](t){let n=r,o={tpcki:function(c,d){return e[P(1496)](c,d)},hbkNO:function(c,d,g){return e.xXZzL(c,d,g)},uFzbY:function(c,d){return e[P(1778)](c,d)},NHHWK:function(c,d,g){return e[P(1074)](c,d,g)},mompD:function(c,d,g){return e[P(1e3)](c,d,g)}};if(e[n(972)](e[n(451)],e[n(451)]))return new Promise(c=>{let d=n;setTimeout(c,this[d(1203)+d(643)+"e"](t))});{let c=_0x206247.key;KhJXio.tpcki(void 0,c)&&(_0x476e8a(_0x2688b5,10),KhJXio[n(1727)](_0x1e6db6,_0x6ac497,c));let d=_0x102738.value;KhJXio[n(1734)](void 0,d)&&(KhJXio[n(1696)](_0x51494d,_0x570f49,18),KhJXio[n(1816)](_0x20fd48,_0x2761ee,d))}}_disconnect(t=1e3,n="",o=!1){this[r(1538)]&&this._destroyWebSocket(t,n,o)}[r(1171)+"ut"](){let t=r,n=this[t(577)+t(1546)]?.[t(504)+t(396)+"nt"]();this[t(565)](t(1138)+n+t(876)),this[t(1500)+t(434)](1001,e.zLIIT,!0)}_sendAck(t){let n=r,o=e[n(1578)](Qn,t);this._ws&&e[n(1873)](this[n(1538)][n(960)+"te"],this[n(1523)])&&(this[n(1538)]&&this[n(1538)][n(475)](o),this._debug(e[n(845)],t))}[r(689)+r(1807)+"rs"](){let t=r;this[t(1538)]&&(this._ws[t(447)+t(502)+t(1163)](e[t(1704)],this[t(1392)]),this[t(1538)]["removeEv"+t(502)+t(1163)](e[t(1032)],this._onClose),this[t(1538)][t(447)+"entListe"+t(1163)](e.Olvyz,this[t(1634)+"ge"]),this[t(1538)][t(447)+t(502)+t(1163)](e[t(1772)],this[t(1672)]))}[r(468)+r(889)](){let t=r,n={aVgsK:function(o,c){return o(c)},EFlju:function(o,c){return e.CAwYd(o,c)},jKTfu:function(o,c){return e.jjEel(o,c)},NCuzY:function(o,c){return o+c},aKwKu:function(o,c){return e.DDCVa(o,c)},gMLUh:e[t(513)],YuHgt:e[t(923)],VyOmx:function(o,c){return e[t(955)](o,c)},BfOyb:e[t(729)]};if(e[t(458)](e[t(1662)],e[t(1662)]))return nHwgFT[t(704)](_0x1e7d80,nHwgFT.EFlju(nHwgFT[t(1298)](nHwgFT.NCuzY(nHwgFT.aKwKu(nHwgFT[t(1066)],_0x370139),nHwgFT[t(442)]),nHwgFT[t(483)](_0x47d0b7,1)),nHwgFT[t(443)])+_0x15e92d);if(!this._ws)return;this._ws[t(635)+t(793)](e[t(1704)],this[t(1392)]),this[t(1538)]["addEvent"+t(793)](e[t(1032)],this[t(1833)]),this._ws[t(635)+"Listener"](t(1239),this[t(1634)+"ge"]),this[t(1538)][t(635)+t(793)](e[t(1772)],this[t(1672)])}[r(1684)+r(525)](t=1e3,n=""){let o=r;if(e[o(648)](e[o(816)],e.elXDL))this[o(628)+"ount"]=_0x2b605e,this[o(995)]=0;else try{this[o(1538)]&&this[o(1538)][o(625)](t,n)}catch{}}[r(1722)+r(737)+"t"](t=1e3,n="",o=!1){let c=r,d={rADRg:function(g,p,u){return e.AcBzz(g,p,u)},uZSQj:function(g){return g()},AVcNy:function(g,p,u){return e.iqojk(g,p,u)},wWIom:function(g,p,u){return g(p,u)}};if(this._clearPingTimer(),this["_clearTi"+c(503)](),this[c(689)+"sListeners"](),this[c(1684)+c(525)](1e3,n),this[c(593)+"Lock"]=!1,o&&this[c(1454)+"orOnline"]()&&!this[c(736)+c(750)]){if(this[c(577)+"tManager"]?.[c(712)+c(1581)+"es"]()){let p=this[c(577)+c(1546)]?.[c(504)+"ntEndpoint"]();this["_dispatc"+c(1230)+c(444)](e[c(542)](he,e.WyKfN,{code:1006,reason:c(1138)+p+(c(876)+c(1226)+c(1880)+c(1408)),wasClean:!0}))}else if(e[c(393)](c(1835),e[c(1852)])){let p=this._options[c(1559)+c(500)+"ptor"](t,n);this[c(1850)+"hCloseEv"+c(444)](e[c(1311)](he,e.WyKfN,{code:t,reason:n,wasClean:!0,willReconnect:p})),p&&this._connect()}else{DCbbWi[c(1689)](_0x2ea0e2,_0xd8cbd7,42);let p=DCbbWi[c(751)](_0xc71a2a);DCbbWi[c(602)](_0x361429,_0x4f7d21,p),DCbbWi[c(1689)](_0x27a3cd,_0x14dc05,p[c(1478)]),DCbbWi[c(1412)](_0x58d1d2,_0x42d33f,p),_0x215b2e(p)}return}this._navigatorOnline()||this[c(736)+c(750)]?this[c(1850)+c(1230)+c(444)](he(e.WyKfN,{code:t,reason:e[c(1498)]})):this[c(1850)+c(1230)+c(444)](he(e[c(1032)],{code:1006,reason:e.LBxsn})),this[c(1538)]=null,this[c(577)+c(1546)]?.[c(394)+"pointConfig"](),this[c(696)+c(1117)]?.[c(1682)+c(491)]()}["_dispatc"+r(1543)+"nt"](t){let n=r;this[n(1303)](e[n(1704)],t),this.onopen&&this[n(1680)](t)}[r(1850)+r(667)+r(1282)](t){let n=r;this[n(1303)](e.Olvyz,t),this[n(517)+"e"]&&this[n(517)+"e"](t)}[r(1850)+r(1463)+r(1693)](t){let n=r;this[n(1303)](e[n(1233)],t),this[n(449)+n(1526)]&&this["onReceiv"+n(1526)](t)}[r(1850)+r(1510)+r(444)](t){let n=r;this[n(1303)](e[n(1772)],t),this[n(658)]&&this[n(658)](t)}["_dispatc"+r(1230)+r(444)](t){let n=r;this[n(1303)](e[n(1032)],t),this[n(589)]&&this[n(589)](t)}get[r(1781)+"pe"](){let t=r;return this[t(1538)]?this[t(1538)][t(1781)+"pe"]:this[t(1767)+t(1799)]}set[r(1781)+"pe"](t){let n=r;this._binaryType=t,this[n(1538)]&&(this[n(1538)][n(1781)+"pe"]=t)}get retryCount(){let t=r;return this["_endpoin"+t(1546)]?.[t(504)+t(396)+t(1847)+t(1502)]()||0}get[r(804)+r(545)](){let t=r;return e.riZuh(e[t(1455)],e.wQxDi)?this[t(381)+t(763)][t(1377)]((o,c)=>(o+=c&&c[t(1130)+"th"]||0,o),0)+(this._ws?this[t(1538)][t(804)+t(545)]:0):this[t(1798)][t(674)]()}get[r(1884)+"ns"](){let t=r;return this[t(1538)]?this[t(1538)].extensions:""}get[r(1756)](){let t=r;if(e[t(1617)](t(1136),e[t(603)]))return this[t(1538)]?this._ws[t(1756)]:"";_0x2710b7[_0x537c7d++]=e[t(1343)](e.fOwFZ(_0x253240,18),7)|240,_0x42d24c[_0x300347++]=e.vGoda(_0x137475,12)&63|128}get[r(960)+"te"](){let t=r;return this[t(1538)]?this._ws[t(960)+"te"]:this[t(1437)][t(1793)+t(887)]?this.CONNECTING:this[t(1669)]}get[r(1332)](){let t=r;return this._ws?this._ws[t(1332)]:this[t(1752)]}close(t=1e3,n){let o=r;if(this[o(736)+o(750)]=!0,this["_clearTi"+o(503)](),this._clearPingTimer(),this[o(1427)+o(1108)+o(793)](),this[o(1083)+"ger"]?.[o(1342)](),!this._ws)return void this[o(565)](e[o(1712)]);if(e[o(1190)](this[o(1538)][o(960)+"te"],this[o(1669)])||e[o(1444)](this._ws[o(960)+"te"],this[o(697)]))return void this[o(565)](e[o(428)]);this[o(1722)+o(737)+"t"](t,n)}async[r(475)](t,n){let o=r;if(e[o(1548)](null,t))throw new Error(e[o(858)]);e[o(486)]==typeof t&&(t=JSON[o(1249)+"y"](t)),e[o(1180)](e[o(1255)],typeof t)&&!(t instanceof ArrayBuffer)&&!(t[o(661)]&&e[o(1851)](t[o(661)],ArrayBuffer))&&(t=JSON[o(1249)+"y"](t));let c=await e.knEGD(ms,t),d=e[o(524)](i0,t),{method:g=0,service:p=this[o(1437)][o(386)],logID:u=this[o(1437)]["logIDGen"+o(1081)](),headers:y=this[o(1437)][o(572)],payloadEncoding:v=this[o(1437)][o(717)+o(963)],payloadType:A=this[o(1437)][o(1394)+o(1799)],logIDNew:N=this[o(1437)][o(925)+"Config"][o(734)+o(453)+o(532)+"ew"]?a(this[o(1437)][o(925)+o(994)][o(1347)]):""}=e[o(1380)](n,{});if(!p)throw new Error(e[o(1528)]);let D={SeqID:B[o(1445)+"er"](this._seqId++),LogID:B[o(1445)+"er"](u),service:p,method:g,headers:y,payloadEncoding:e.sVHEj(v,Object)?v[o(738)]?v.encoding:"":v,payloadType:e[o(1043)](A,Object)?A[o(1188)]?A[o(1188)]:d:A||d,payload:c,LogIDNew:N},O=e[o(470)](Qn,D);return this[o(1538)]&&this[o(1538)][o(960)+"te"]===this[o(1523)]?(this[o(1538)]&&this[o(1538)][o(475)](O),this._debug(e[o(1156)],D)):e.IQKpK(this[o(381)+o(763)].length,this[o(1437)]["maxMessageQueueL"+o(773)])?(this["_message"+o(763)].push(O),this._debug(o(1152),D)):(this[o(381)+"Queue"][o(1173)](),this[o(381)+"Queue"][o(1755)](O)),{seqID:this[o(800)],logID:u,logIDNew:N}}async[r(1559)+"t"](t){let n=r,{url:o}=t||{},c=Array.isArray(o)?o:e[n(1571)](e.kEUof,typeof o)?[o]:[];if(t&&Object[n(968)](this[n(1437)],t),c&&c[n(1410)]?this[n(577)+n(1546)]=new ls(c,this[n(1437)][n(728)+"es"]):this[n(577)+n(1546)]?.[n(394)+"pointCon"+n(557)](),this[n(696)+n(1117)]?.[n(1682)+n(491)](this[n(1437)][n(645)+"Count"]),this[n(736)+n(750)]=!1,this[n(1538)]&&this[n(1538)][n(960)+"te"]!==this[n(1669)])this[n(1500)+n(434)](1e3,e[n(1279)],!0);else if(e[n(871)](n(1720),n(1720)))this._isInit=!0,this[n(593)]();else return!0}async[r(1269)](){let t=r;!this[t(593)+t(1655)]&&(this[t(577)+t(1546)]?.[t(394)+"pointCon"+t(557)](),this[t(696)+t(1117)]?.[t(1682)+t(491)](),this[t(736)+"osed"]=!1,this[t(543)]=!0,this[t(593)]())}[r(635)+r(793)](t,n){this.on(t,n)}[r(389)+r(1282)](t){let n=r,{type:o}=t;this[n(1303)](o,t)}["removeEv"+r(502)+r(1163)](t,n){this[r(666)](t,n)}[r(656)](){let t=r,n={zqrAd:t(999)+t(943)+"s",lFWkz:function(o,c){return e[t(1732)](o,c)},LuWvB:function(o,c){return e[t(713)](o,c)},ekSso:e[t(1040)],GnSYj:e[t(1396)]};return new Promise((o,c)=>{let d=t,g={xWcZp:"success",RMeNl:n[d(727)],tasDw:function(p,u){return n[d(630)](p,u)},INiaA:d(867),UuUGp:d(999)+d(1216)+"t"};if(n.LuWvB("OdrIL",n[d(1652)]))_0x5b4384[d(1459)][d(640)+"ild"](_0x3fd234),_0x476e56["frontier"+d(1836)]=void 0,_0x448df2(_0x55ac34&&_0x56b061[d(983)]||d(768)+d(1879));else{this[d(1068)+d(1494)](),this[d(407)+d(1393)+"Id"]=setTimeout(this._ping.bind(this),this[d(1437)]["pingInte"+d(1087)]);let p=()=>{let y=d;o(g[y(1094)]),this[y(666)](g[y(1428)],p),this.off(y(999)+y(1216)+"t",u)},u=()=>{let y=d;g.tasDw(c,g[y(487)]),this[y(666)](g[y(1428)],p),this.off(g[y(1687)],u)};this.on("ping_once_success",p),this.on(n[d(760)],u),this[d(1049)]()}})}}})(),j["CustomCl"+S(1631)]=V[S(497)+S(1631)],j["CustomEr"+S(1654)]=V[S(1277)+S(1654)],j[S(699)+"e"]=V[S(699)+"e"],j[S(1282)]=V[S(1282)],j[S(1532)]=V[S(1532)],j[S(1554)+S(1573)+S(1808)]=V[S(1554)+S(1573)+S(1808)],j[S(1573)+"vent"]=V[S(1573)+S(1808)],j.OpenEvent=V[S(655)+"t"],j[S(633)+S(895)]=V[S(633)+S(895)],j[S(1738)+"oseEvent"]=V["createCl"+S(1631)],j[S(956)+S(1654)]=V[S(956)+S(1654)],j["createMe"+S(1862)+"nt"]=V[S(1195)+S(1862)+"nt"],j["createOp"+S(441)]=V[S(1721)+S(441)],j["createRe"+S(846)+"vent"]=V[S(1106)+"connectE"+S(1808)],j[S(1504)+S(479)]=V[S(1504)+S(479)],j[S(1715)+"ame"]=V.encodeFrame;for(_n in V)[S(497)+S(1631),S(1277)+"rorEvent",S(699)+"e",S(1282),S(1532),S(1554)+S(1573)+S(1808),S(1573)+"vent",S(655)+"t",S(633)+S(895),S(1738)+S(1631),S(956)+S(1654),S(1195)+S(1862)+"nt",S(1721)+"enEvent",S(1106)+S(846)+S(1808),"decodedF"+S(479),"encodeFrame"][S(828)](_n)===-1&&(j[_n]=V[_n]);var _n;Object.defineProperty(j,"__esModule",{value:!0})});var Ne=ie((vl,gi)=>{"use strict";var li=["nodebuffer","arraybuffer","fragments"],hi=typeof Blob<"u";hi&&li.push("blob");gi.exports={BINARY_TYPES:li,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 Ot=ie((Sl,An)=>{"use strict";var{EMPTY_BUFFER:Rx}=Ne(),_r=Buffer[Symbol.species];function Ox(r,e){if(r.length===0)return Rx;if(r.length===1)return r[0];let i=Buffer.allocUnsafe(e),a=0;for(let x=0;x<r.length;x++){let f=r[x];i.set(f,a),a+=f.length}return a<e?new _r(i.buffer,i.byteOffset,a):i}function pi(r,e,i,a,x){for(let f=0;f<x;f++)i[a+f]=r[f]^e[f&3]}function mi(r,e){for(let i=0;i<r.length;i++)r[i]^=e[i&3]}function Bx(r){return r.length===r.buffer.byteLength?r.buffer:r.buffer.slice(r.byteOffset,r.byteOffset+r.length)}function yr(r){if(yr.readOnly=!0,Buffer.isBuffer(r))return r;let e;return r instanceof ArrayBuffer?e=new _r(r):ArrayBuffer.isView(r)?e=new _r(r.buffer,r.byteOffset,r.byteLength):(e=Buffer.from(r),yr.readOnly=!1),e}An.exports={concat:Ox,mask:pi,toArrayBuffer:Bx,toBuffer:yr,unmask:mi};if(!process.env.WS_NO_BUFFER_UTIL)try{let r=J("bufferutil");An.exports.mask=function(e,i,a,x,f){f<48?pi(e,i,a,x,f):r.mask(e,i,a,x,f)},An.exports.unmask=function(e,i){e.length<32?mi(e,i):r.unmask(e,i)}}catch{}});var yi=ie((Cl,_i)=>{"use strict";var wi=Symbol("kDone"),br=Symbol("kRun"),vr=class{constructor(e){this[wi]=()=>{this.pending--,this[br]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[br]()}[br](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[wi])}}};_i.exports=vr});var ht=ie((El,Ci)=>{"use strict";var Bt=J("zlib"),bi=Ot(),zx=yi(),{kStatusCode:vi}=Ne(),Mx=Buffer[Symbol.species],qx=Buffer.from([0,0,255,255]),kn=Symbol("permessage-deflate"),Re=Symbol("total-length"),dt=Symbol("callback"),He=Symbol("buffers"),lt=Symbol("error"),Dn,Sr=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,!Dn){let i=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;Dn=new zx(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[dt];this._deflate.close(),this._deflate=null,e&&e(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(e){let i=this._options,a=e.find(x=>!(i.serverNoContextTakeover===!1&&x.server_no_context_takeover||x.server_max_window_bits&&(i.serverMaxWindowBits===!1||typeof i.serverMaxWindowBits=="number"&&i.serverMaxWindowBits>x.server_max_window_bits)||typeof i.clientMaxWindowBits=="number"&&!x.client_max_window_bits));if(!a)throw new Error("None of the extension offers can be accepted");return i.serverNoContextTakeover&&(a.server_no_context_takeover=!0),i.clientNoContextTakeover&&(a.client_no_context_takeover=!0),typeof i.serverMaxWindowBits=="number"&&(a.server_max_window_bits=i.serverMaxWindowBits),typeof i.clientMaxWindowBits=="number"?a.client_max_window_bits=i.clientMaxWindowBits:(a.client_max_window_bits===!0||i.clientMaxWindowBits===!1)&&delete a.client_max_window_bits,a}acceptAsClient(e){let i=e[0];if(this._options.clientNoContextTakeover===!1&&i.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(!i.client_max_window_bits)typeof this._options.clientMaxWindowBits=="number"&&(i.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits=="number"&&i.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"');return i}normalizeParams(e){return e.forEach(i=>{Object.keys(i).forEach(a=>{let x=i[a];if(x.length>1)throw new Error(`Parameter "${a}" must have only a single value`);if(x=x[0],a==="client_max_window_bits"){if(x!==!0){let f=+x;if(!Number.isInteger(f)||f<8||f>15)throw new TypeError(`Invalid value for parameter "${a}": ${x}`);x=f}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${a}": ${x}`)}else if(a==="server_max_window_bits"){let f=+x;if(!Number.isInteger(f)||f<8||f>15)throw new TypeError(`Invalid value for parameter "${a}": ${x}`);x=f}else if(a==="client_no_context_takeover"||a==="server_no_context_takeover"){if(x!==!0)throw new TypeError(`Invalid value for parameter "${a}": ${x}`)}else throw new Error(`Unknown parameter "${a}"`);i[a]=x})}),e}decompress(e,i,a){Dn.add(x=>{this._decompress(e,i,(f,l)=>{x(),a(f,l)})})}compress(e,i,a){Dn.add(x=>{this._compress(e,i,(f,l)=>{x(),a(f,l)})})}_decompress(e,i,a){let x=this._isServer?"client":"server";if(!this._inflate){let f=`${x}_max_window_bits`,l=typeof this.params[f]!="number"?Bt.Z_DEFAULT_WINDOWBITS:this.params[f];this._inflate=Bt.createInflateRaw({...this._options.zlibInflateOptions,windowBits:l}),this._inflate[kn]=this,this._inflate[Re]=0,this._inflate[He]=[],this._inflate.on("error",Fx),this._inflate.on("data",Si)}this._inflate[dt]=a,this._inflate.write(e),i&&this._inflate.write(qx),this._inflate.flush(()=>{let f=this._inflate[lt];if(f){this._inflate.close(),this._inflate=null,a(f);return}let l=bi.concat(this._inflate[He],this._inflate[Re]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[Re]=0,this._inflate[He]=[],i&&this.params[`${x}_no_context_takeover`]&&this._inflate.reset()),a(null,l)})}_compress(e,i,a){let x=this._isServer?"server":"client";if(!this._deflate){let f=`${x}_max_window_bits`,l=typeof this.params[f]!="number"?Bt.Z_DEFAULT_WINDOWBITS:this.params[f];this._deflate=Bt.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:l}),this._deflate[Re]=0,this._deflate[He]=[],this._deflate.on("data",Ux)}this._deflate[dt]=a,this._deflate.write(e),this._deflate.flush(Bt.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let f=bi.concat(this._deflate[He],this._deflate[Re]);i&&(f=new Mx(f.buffer,f.byteOffset,f.length-4)),this._deflate[dt]=null,this._deflate[Re]=0,this._deflate[He]=[],i&&this.params[`${x}_no_context_takeover`]&&this._deflate.reset(),a(null,f)})}};Ci.exports=Sr;function Ux(r){this[He].push(r),this[Re]+=r.length}function Si(r){if(this[Re]+=r.length,this[kn]._maxPayload<1||this[Re]<=this[kn]._maxPayload){this[He].push(r);return}this[lt]=new RangeError("Max payload size exceeded"),this[lt].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[lt][vi]=1009,this.removeListener("data",Si),this.reset()}function Fx(r){if(this[kn]._inflate=null,this[lt]){this[dt](this[lt]);return}r[vi]=1007,this[dt](r)}});var gt=ie((Al,In)=>{"use strict";var{isUtf8:Ei}=J("buffer"),{hasBlob:Kx}=Ne(),Hx=[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 jx(r){return r>=1e3&&r<=1014&&r!==1004&&r!==1005&&r!==1006||r>=3e3&&r<=4999}function Cr(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 Gx(r){return Kx&&typeof r=="object"&&typeof r.arrayBuffer=="function"&&typeof r.type=="string"&&typeof r.stream=="function"&&(r[Symbol.toStringTag]==="Blob"||r[Symbol.toStringTag]==="File")}In.exports={isBlob:Gx,isValidStatusCode:jx,isValidUTF8:Cr,tokenChars:Hx};if(Ei)In.exports.isValidUTF8=function(r){return r.length<24?Cr(r):Ei(r)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let r=J("utf-8-validate");In.exports.isValidUTF8=function(e){return e.length<32?Cr(e):r(e)}}catch{}});var Ir=ie((Dl,Li)=>{"use strict";var{Writable:Wx}=J("stream"),Ai=ht(),{BINARY_TYPES:Jx,EMPTY_BUFFER:Di,kStatusCode:Vx,kWebSocket:Yx}=Ne(),{concat:Er,toArrayBuffer:Xx,unmask:Zx}=Ot(),{isValidStatusCode:$x,isValidUTF8:ki}=gt(),Pn=Buffer[Symbol.species],ue=0,Ii=1,Pi=2,Ti=3,Ar=4,Dr=5,Tn=6,kr=class extends Wx{constructor(e={}){super(),this._allowSynchronousEvents=e.allowSynchronousEvents!==void 0?e.allowSynchronousEvents:!0,this._binaryType=e.binaryType||Jx[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxPayload=e.maxPayload|0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[Yx]=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,a){if(this._opcode===8&&this._state==ue)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 Pn(a.buffer,a.byteOffset+e,a.length-e),new Pn(a.buffer,a.byteOffset,e)}let i=Buffer.allocUnsafe(e);do{let a=this._buffers[0],x=i.length-e;e>=a.length?i.set(this._buffers.shift(),x):(i.set(new Uint8Array(a.buffer,a.byteOffset,e),x),this._buffers[0]=new Pn(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 ue:this.getInfo(e);break;case Ii:this.getPayloadLength16(e);break;case Pi:this.getPayloadLength64(e);break;case Ti:this.getMask();break;case Ar:this.getData(e);break;case Dr:case Tn:this._loop=!1;return}while(this._loop);this._errored||e()}getInfo(e){if(this._bufferedBytes<2){this._loop=!1;return}let i=this.consume(2);if((i[0]&48)!==0){let x=this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");e(x);return}let a=(i[0]&64)===64;if(a&&!this._extensions[Ai.extensionName]){let x=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(x);return}if(this._fin=(i[0]&128)===128,this._opcode=i[0]&15,this._payloadLength=i[1]&127,this._opcode===0){if(a){let x=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(x);return}if(!this._fragmented){let x=this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");e(x);return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){let x=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");e(x);return}this._compressed=a}else if(this._opcode>7&&this._opcode<11){if(!this._fin){let x=this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");e(x);return}if(a){let x=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(x);return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){let x=this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");e(x);return}}else{let x=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");e(x);return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(i[1]&128)===128,this._isServer){if(!this._masked){let x=this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK");e(x);return}}else if(this._masked){let x=this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");e(x);return}this._payloadLength===126?this._state=Ii:this._payloadLength===127?this._state=Pi:this.haveLength(e)}getPayloadLength16(e){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(e)}getPayloadLength64(e){if(this._bufferedBytes<8){this._loop=!1;return}let i=this.consume(8),a=i.readUInt32BE(0);if(a>Math.pow(2,21)-1){let x=this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");e(x);return}this._payloadLength=a*Math.pow(2,32)+i.readUInt32BE(4),this.haveLength(e)}haveLength(e){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)){let i=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");e(i);return}this._masked?this._state=Ti:this._state=Ar}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=Ar}getData(e){let i=Di;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&&Zx(i,this._mask)}if(this._opcode>7){this.controlMessage(i,e);return}if(this._compressed){this._state=Dr,this.decompress(i,e);return}i.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(i)),this.dataMessage(e)}decompress(e,i){this._extensions[Ai.extensionName].decompress(e,this._fin,(x,f)=>{if(x)return i(x);if(f.length){if(this._messageLength+=f.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let l=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");i(l);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,a=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let x;this._binaryType==="nodebuffer"?x=Er(a,i):this._binaryType==="arraybuffer"?x=Xx(Er(a,i)):this._binaryType==="blob"?x=new Blob(a):x=a,this._allowSynchronousEvents?(this.emit("message",x,!0),this._state=ue):(this._state=Tn,setImmediate(()=>{this.emit("message",x,!0),this._state=ue,this.startLoop(e)}))}else{let x=Er(a,i);if(!this._skipUTF8Validation&&!ki(x)){let f=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");e(f);return}this._state===Dr||this._allowSynchronousEvents?(this.emit("message",x,!1),this._state=ue):(this._state=Tn,setImmediate(()=>{this.emit("message",x,!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,Di),this.end();else{let a=e.readUInt16BE(0);if(!$x(a)){let f=this.createError(RangeError,`invalid status code ${a}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");i(f);return}let x=new Pn(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!ki(x)){let f=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");i(f);return}this._loop=!1,this.emit("conclude",a,x),this.end()}this._state=ue;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?"ping":"pong",e),this._state=ue):(this._state=Tn,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",e),this._state=ue,this.startLoop(i)}))}createError(e,i,a,x,f){this._loop=!1,this._errored=!0;let l=new e(a?`Invalid WebSocket frame: ${i}`:i);return Error.captureStackTrace(l,this.createError),l.code=f,l[Vx]=x,l}};Li.exports=kr});var Lr=ie((Il,Oi)=>{"use strict";var{Duplex:kl}=J("stream"),{randomFillSync:Qx}=J("crypto"),Ni=ht(),{EMPTY_BUFFER:ec,kWebSocket:tc,NOOP:nc}=Ne(),{isBlob:pt,isValidStatusCode:rc}=gt(),{mask:Ri,toBuffer:Xe}=Ot(),de=Symbol("kByteLength"),sc=Buffer.alloc(4),Ln=8*1024,Ze,mt=Ln,pe=0,ic=1,oc=2,Pr=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=pe,this.onerror=nc,this[tc]=void 0}static frame(e,i){let a,x=!1,f=2,l=!1;i.mask&&(a=i.maskBuffer||sc,i.generateMask?i.generateMask(a):(mt===Ln&&(Ze===void 0&&(Ze=Buffer.alloc(Ln)),Qx(Ze,0,Ln),mt=0),a[0]=Ze[mt++],a[1]=Ze[mt++],a[2]=Ze[mt++],a[3]=Ze[mt++]),l=(a[0]|a[1]|a[2]|a[3])===0,f=6);let h;typeof e=="string"?(!i.mask||l)&&i[de]!==void 0?h=i[de]:(e=Buffer.from(e),h=e.length):(h=e.length,x=i.mask&&i.readOnly&&!l);let m=h;h>=65536?(f+=8,m=127):h>125&&(f+=2,m=126);let _=Buffer.allocUnsafe(x?h+f:f);return _[0]=i.fin?i.opcode|128:i.opcode,i.rsv1&&(_[0]|=64),_[1]=m,m===126?_.writeUInt16BE(h,2):m===127&&(_[2]=_[3]=0,_.writeUIntBE(h,4,6)),i.mask?(_[1]|=128,_[f-4]=a[0],_[f-3]=a[1],_[f-2]=a[2],_[f-1]=a[3],l?[_,e]:x?(Ri(e,a,_,f,h),[_]):(Ri(e,a,e,0,h),[_,e])):[_,e]}close(e,i,a,x){let f;if(e===void 0)f=ec;else{if(typeof e!="number"||!rc(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 l={[de]:f.length,fin:!0,generateMask:this._generateMask,mask:a,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state!==pe?this.enqueue([this.dispatch,f,!1,l,x]):this.sendFrame(r.frame(f,l),x)}ping(e,i,a){let x,f;if(typeof e=="string"?(x=Buffer.byteLength(e),f=!1):pt(e)?(x=e.size,f=!1):(e=Xe(e),x=e.length,f=Xe.readOnly),x>125)throw new RangeError("The data size must not be greater than 125 bytes");let l={[de]:x,fin:!0,generateMask:this._generateMask,mask:i,maskBuffer:this._maskBuffer,opcode:9,readOnly:f,rsv1:!1};pt(e)?this._state!==pe?this.enqueue([this.getBlobData,e,!1,l,a]):this.getBlobData(e,!1,l,a):this._state!==pe?this.enqueue([this.dispatch,e,!1,l,a]):this.sendFrame(r.frame(e,l),a)}pong(e,i,a){let x,f;if(typeof e=="string"?(x=Buffer.byteLength(e),f=!1):pt(e)?(x=e.size,f=!1):(e=Xe(e),x=e.length,f=Xe.readOnly),x>125)throw new RangeError("The data size must not be greater than 125 bytes");let l={[de]:x,fin:!0,generateMask:this._generateMask,mask:i,maskBuffer:this._maskBuffer,opcode:10,readOnly:f,rsv1:!1};pt(e)?this._state!==pe?this.enqueue([this.getBlobData,e,!1,l,a]):this.getBlobData(e,!1,l,a):this._state!==pe?this.enqueue([this.dispatch,e,!1,l,a]):this.sendFrame(r.frame(e,l),a)}send(e,i,a){let x=this._extensions[Ni.extensionName],f=i.binary?2:1,l=i.compress,h,m;typeof e=="string"?(h=Buffer.byteLength(e),m=!1):pt(e)?(h=e.size,m=!1):(e=Xe(e),h=e.length,m=Xe.readOnly),this._firstFragment?(this._firstFragment=!1,l&&x&&x.params[x._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(l=h>=x._threshold),this._compress=l):(l=!1,f=0),i.fin&&(this._firstFragment=!0);let _={[de]:h,fin:i.fin,generateMask:this._generateMask,mask:i.mask,maskBuffer:this._maskBuffer,opcode:f,readOnly:m,rsv1:l};pt(e)?this._state!==pe?this.enqueue([this.getBlobData,e,this._compress,_,a]):this.getBlobData(e,this._compress,_,a):this._state!==pe?this.enqueue([this.dispatch,e,this._compress,_,a]):this.dispatch(e,this._compress,_,a)}getBlobData(e,i,a,x){this._bufferedBytes+=a[de],this._state=oc,e.arrayBuffer().then(f=>{if(this._socket.destroyed){let h=new Error("The socket was closed while the blob was being read");process.nextTick(Tr,this,h,x);return}this._bufferedBytes-=a[de];let l=Xe(f);i?this.dispatch(l,i,a,x):(this._state=pe,this.sendFrame(r.frame(l,a),x),this.dequeue())}).catch(f=>{process.nextTick(ac,this,f,x)})}dispatch(e,i,a,x){if(!i){this.sendFrame(r.frame(e,a),x);return}let f=this._extensions[Ni.extensionName];this._bufferedBytes+=a[de],this._state=ic,f.compress(e,a.fin,(l,h)=>{if(this._socket.destroyed){let m=new Error("The socket was closed while data was being compressed");Tr(this,m,x);return}this._bufferedBytes-=a[de],this._state=pe,a.readOnly=!1,this.sendFrame(r.frame(h,a),x),this.dequeue()})}dequeue(){for(;this._state===pe&&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)}};Oi.exports=Pr;function Tr(r,e,i){typeof i=="function"&&i(e);for(let a=0;a<r._queue.length;a++){let x=r._queue[a],f=x[x.length-1];typeof f=="function"&&f(e)}}function ac(r,e,i){Tr(r,e,i),r.onerror(e)}});var ji=ie((Pl,Hi)=>{"use strict";var{kForOnEventAttribute:zt,kListener:Nr}=Ne(),Bi=Symbol("kCode"),zi=Symbol("kData"),Mi=Symbol("kError"),qi=Symbol("kMessage"),Ui=Symbol("kReason"),wt=Symbol("kTarget"),Fi=Symbol("kType"),Ki=Symbol("kWasClean"),Oe=class{constructor(e){this[wt]=null,this[Fi]=e}get target(){return this[wt]}get type(){return this[Fi]}};Object.defineProperty(Oe.prototype,"target",{enumerable:!0});Object.defineProperty(Oe.prototype,"type",{enumerable:!0});var $e=class extends Oe{constructor(e,i={}){super(e),this[Bi]=i.code===void 0?0:i.code,this[Ui]=i.reason===void 0?"":i.reason,this[Ki]=i.wasClean===void 0?!1:i.wasClean}get code(){return this[Bi]}get reason(){return this[Ui]}get wasClean(){return this[Ki]}};Object.defineProperty($e.prototype,"code",{enumerable:!0});Object.defineProperty($e.prototype,"reason",{enumerable:!0});Object.defineProperty($e.prototype,"wasClean",{enumerable:!0});var _t=class extends Oe{constructor(e,i={}){super(e),this[Mi]=i.error===void 0?null:i.error,this[qi]=i.message===void 0?"":i.message}get error(){return this[Mi]}get message(){return this[qi]}};Object.defineProperty(_t.prototype,"error",{enumerable:!0});Object.defineProperty(_t.prototype,"message",{enumerable:!0});var Mt=class extends Oe{constructor(e,i={}){super(e),this[zi]=i.data===void 0?null:i.data}get data(){return this[zi]}};Object.defineProperty(Mt.prototype,"data",{enumerable:!0});var xc={addEventListener(r,e,i={}){for(let x of this.listeners(r))if(!i[zt]&&x[Nr]===e&&!x[zt])return;let a;if(r==="message")a=function(f,l){let h=new Mt("message",{data:l?f:f.toString()});h[wt]=this,Nn(e,this,h)};else if(r==="close")a=function(f,l){let h=new $e("close",{code:f,reason:l.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});h[wt]=this,Nn(e,this,h)};else if(r==="error")a=function(f){let l=new _t("error",{error:f,message:f.message});l[wt]=this,Nn(e,this,l)};else if(r==="open")a=function(){let f=new Oe("open");f[wt]=this,Nn(e,this,f)};else return;a[zt]=!!i[zt],a[Nr]=e,i.once?this.once(r,a):this.on(r,a)},removeEventListener(r,e){for(let i of this.listeners(r))if(i[Nr]===e&&!i[zt]){this.removeListener(r,i);break}}};Hi.exports={CloseEvent:$e,ErrorEvent:_t,Event:Oe,EventTarget:xc,MessageEvent:Mt};function Nn(r,e,i){typeof r=="object"&&r.handleEvent?r.handleEvent.call(r,i):r.call(e,i)}});var Rn=ie((Tl,Gi)=>{"use strict";var{tokenChars:qt}=gt();function Ee(r,e,i){r[e]===void 0?r[e]=[i]:r[e].push(i)}function cc(r){let e=Object.create(null),i=Object.create(null),a=!1,x=!1,f=!1,l,h,m=-1,_=-1,b=-1,w=0;for(;w<r.length;w++)if(_=r.charCodeAt(w),l===void 0)if(b===-1&&qt[_]===1)m===-1&&(m=w);else if(w!==0&&(_===32||_===9))b===-1&&m!==-1&&(b=w);else if(_===59||_===44){if(m===-1)throw new SyntaxError(`Unexpected character at index ${w}`);b===-1&&(b=w);let k=r.slice(m,b);_===44?(Ee(e,k,i),i=Object.create(null)):l=k,m=b=-1}else throw new SyntaxError(`Unexpected character at index ${w}`);else if(h===void 0)if(b===-1&&qt[_]===1)m===-1&&(m=w);else if(_===32||_===9)b===-1&&m!==-1&&(b=w);else if(_===59||_===44){if(m===-1)throw new SyntaxError(`Unexpected character at index ${w}`);b===-1&&(b=w),Ee(i,r.slice(m,b),!0),_===44&&(Ee(e,l,i),i=Object.create(null),l=void 0),m=b=-1}else if(_===61&&m!==-1&&b===-1)h=r.slice(m,w),m=b=-1;else throw new SyntaxError(`Unexpected character at index ${w}`);else if(x){if(qt[_]!==1)throw new SyntaxError(`Unexpected character at index ${w}`);m===-1?m=w:a||(a=!0),x=!1}else if(f)if(qt[_]===1)m===-1&&(m=w);else if(_===34&&m!==-1)f=!1,b=w;else if(_===92)x=!0;else throw new SyntaxError(`Unexpected character at index ${w}`);else if(_===34&&r.charCodeAt(w-1)===61)f=!0;else if(b===-1&&qt[_]===1)m===-1&&(m=w);else if(m!==-1&&(_===32||_===9))b===-1&&(b=w);else if(_===59||_===44){if(m===-1)throw new SyntaxError(`Unexpected character at index ${w}`);b===-1&&(b=w);let k=r.slice(m,b);a&&(k=k.replace(/\\/g,""),a=!1),Ee(i,h,k),_===44&&(Ee(e,l,i),i=Object.create(null),l=void 0),h=void 0,m=b=-1}else throw new SyntaxError(`Unexpected character at index ${w}`);if(m===-1||f||_===32||_===9)throw new SyntaxError("Unexpected end of input");b===-1&&(b=w);let C=r.slice(m,b);return l===void 0?Ee(e,C,i):(h===void 0?Ee(i,C,!0):a?Ee(i,h,C.replace(/\\/g,"")):Ee(i,h,C),Ee(e,l,i)),e}function fc(r){return Object.keys(r).map(e=>{let i=r[e];return Array.isArray(i)||(i=[i]),i.map(a=>[e].concat(Object.keys(a).map(x=>{let f=a[x];return Array.isArray(f)||(f=[f]),f.map(l=>l===!0?x:`${x}=${l}`).join("; ")})).join("; ")).join(", ")}).join(", ")}Gi.exports={format:fc,parse:cc}});var Mn=ie((Rl,ro)=>{"use strict";var uc=J("events"),dc=J("https"),lc=J("http"),Vi=J("net"),hc=J("tls"),{randomBytes:gc,createHash:pc}=J("crypto"),{Duplex:Ll,Readable:Nl}=J("stream"),{URL:Rr}=J("url"),je=ht(),mc=Ir(),wc=Lr(),{isBlob:_c}=gt(),{BINARY_TYPES:Wi,CLOSE_TIMEOUT:yc,EMPTY_BUFFER:On,GUID:bc,kForOnEventAttribute:Or,kListener:vc,kStatusCode:Sc,kWebSocket:Z,NOOP:Yi}=Ne(),{EventTarget:{addEventListener:Cc,removeEventListener:Ec}}=ji(),{format:Ac,parse:Dc}=Rn(),{toBuffer:kc}=Ot(),Xi=Symbol("kAborted"),Br=[8,13],Be=["CONNECTING","OPEN","CLOSING","CLOSED"],Ic=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,U=class r extends uc{constructor(e,i,a){super(),this._binaryType=Wi[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=On,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]),Zi(this,e,i,a)):(this._autoPong=a.autoPong,this._closeTimeout=a.closeTimeout,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(e){Wi.includes(e)&&(this._binaryType=e,this._receiver&&(this._receiver._binaryType=e))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(e,i,a){let x=new mc({allowSynchronousEvents:a.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:a.maxPayload,skipUTF8Validation:a.skipUTF8Validation}),f=new wc(e,this._extensions,a.generateMask);this._receiver=x,this._sender=f,this._socket=e,x[Z]=this,f[Z]=this,e[Z]=this,x.on("conclude",Lc),x.on("drain",Nc),x.on("error",Rc),x.on("message",Oc),x.on("ping",Bc),x.on("pong",zc),f.onerror=Mc,e.setTimeout&&e.setTimeout(0),e.setNoDelay&&e.setNoDelay(),i.length>0&&e.unshift(i),e.on("close",eo),e.on("data",zn),e.on("end",to),e.on("error",no),this._readyState=r.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=r.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[je.extensionName]&&this._extensions[je.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=r.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(e,i){if(this.readyState!==r.CLOSED){if(this.readyState===r.CONNECTING){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,a=>{a||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),Qi(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){zr(this,e,a);return}i===void 0&&(i=!this._isServer),this._sender.ping(e||On,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){zr(this,e,a);return}i===void 0&&(i=!this._isServer),this._sender.pong(e||On,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){zr(this,e,a);return}let x={binary:typeof e!="string",mask:!this._isServer,compress:!0,fin:!0,...i};this._extensions[je.extensionName]||(x.compress=!1),this._sender.send(e||On,x,a)}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(U,"CONNECTING",{enumerable:!0,value:Be.indexOf("CONNECTING")});Object.defineProperty(U.prototype,"CONNECTING",{enumerable:!0,value:Be.indexOf("CONNECTING")});Object.defineProperty(U,"OPEN",{enumerable:!0,value:Be.indexOf("OPEN")});Object.defineProperty(U.prototype,"OPEN",{enumerable:!0,value:Be.indexOf("OPEN")});Object.defineProperty(U,"CLOSING",{enumerable:!0,value:Be.indexOf("CLOSING")});Object.defineProperty(U.prototype,"CLOSING",{enumerable:!0,value:Be.indexOf("CLOSING")});Object.defineProperty(U,"CLOSED",{enumerable:!0,value:Be.indexOf("CLOSED")});Object.defineProperty(U.prototype,"CLOSED",{enumerable:!0,value:Be.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(r=>{Object.defineProperty(U.prototype,r,{enumerable:!0})});["open","error","close","message"].forEach(r=>{Object.defineProperty(U.prototype,`on${r}`,{enumerable:!0,get(){for(let e of this.listeners(r))if(e[Or])return e[vc];return null},set(e){for(let i of this.listeners(r))if(i[Or]){this.removeListener(r,i);break}typeof e=="function"&&this.addEventListener(r,e,{[Or]:!0})}})});U.prototype.addEventListener=Cc;U.prototype.removeEventListener=Ec;ro.exports=U;function Zi(r,e,i,a){let x={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:yc,protocolVersion:Br[1],maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...a,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(r._autoPong=x.autoPong,r._closeTimeout=x.closeTimeout,!Br.includes(x.protocolVersion))throw new RangeError(`Unsupported protocol version: ${x.protocolVersion} (supported versions: ${Br.join(", ")})`);let f;if(e instanceof Rr)f=e;else try{f=new Rr(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 l=f.protocol==="wss:",h=f.protocol==="ws+unix:",m;if(f.protocol!=="ws:"&&!l&&!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 L=new SyntaxError(m);if(r._redirects===0)throw L;Bn(r,L);return}let _=l?443:80,b=gc(16).toString("base64"),w=l?dc.request:lc.request,C=new Set,k;if(x.createConnection=x.createConnection||(l?Tc:Pc),x.defaultPort=x.defaultPort||_,x.port=f.port||_,x.host=f.hostname.startsWith("[")?f.hostname.slice(1,-1):f.hostname,x.headers={...x.headers,"Sec-WebSocket-Version":x.protocolVersion,"Sec-WebSocket-Key":b,Connection:"Upgrade",Upgrade:"websocket"},x.path=f.pathname+f.search,x.timeout=x.handshakeTimeout,x.perMessageDeflate&&(k=new je({...x.perMessageDeflate,isServer:!1,maxPayload:x.maxPayload}),x.headers["Sec-WebSocket-Extensions"]=Ac({[je.extensionName]:k.offer()})),i.length){for(let L of i){if(typeof L!="string"||!Ic.test(L)||C.has(L))throw new SyntaxError("An invalid or duplicated subprotocol was specified");C.add(L)}x.headers["Sec-WebSocket-Protocol"]=i.join(",")}if(x.origin&&(x.protocolVersion<13?x.headers["Sec-WebSocket-Origin"]=x.origin:x.headers.Origin=x.origin),(f.username||f.password)&&(x.auth=`${f.username}:${f.password}`),h){let L=x.path.split(":");x.socketPath=L[0],x.path=L[1]}let T;if(x.followRedirects){if(r._redirects===0){r._originalIpc=h,r._originalSecure=l,r._originalHostOrSocketPath=h?x.socketPath:f.host;let L=a&&a.headers;if(a={...a,headers:{}},L)for(let[F,Q]of Object.entries(L))a.headers[F.toLowerCase()]=Q}else if(r.listenerCount("redirect")===0){let L=h?r._originalIpc?x.socketPath===r._originalHostOrSocketPath:!1:r._originalIpc?!1:f.host===r._originalHostOrSocketPath;(!L||r._originalSecure&&!l)&&(delete x.headers.authorization,delete x.headers.cookie,L||delete x.headers.host,x.auth=void 0)}x.auth&&!a.headers.authorization&&(a.headers.authorization="Basic "+Buffer.from(x.auth).toString("base64")),T=r._req=w(x),r._redirects&&r.emit("redirect",r.url,T)}else T=r._req=w(x);x.timeout&&T.on("timeout",()=>{xe(r,T,"Opening handshake has timed out")}),T.on("error",L=>{T===null||T[Xi]||(T=r._req=null,Bn(r,L))}),T.on("response",L=>{let F=L.headers.location,Q=L.statusCode;if(F&&x.followRedirects&&Q>=300&&Q<400){if(++r._redirects>x.maxRedirects){xe(r,T,"Maximum redirects exceeded");return}T.abort();let ne;try{ne=new Rr(F,e)}catch{let I=new SyntaxError(`Invalid URL: ${F}`);Bn(r,I);return}Zi(r,ne,i,a)}else r.emit("unexpected-response",T,L)||xe(r,T,`Unexpected server response: ${L.statusCode}`)}),T.on("upgrade",(L,F,Q)=>{if(r.emit("upgrade",L),r.readyState!==U.CONNECTING)return;T=r._req=null;let ne=L.headers.upgrade;if(ne===void 0||ne.toLowerCase()!=="websocket"){xe(r,F,"Invalid Upgrade header");return}let Ae=pc("sha1").update(b+bc).digest("base64");if(L.headers["sec-websocket-accept"]!==Ae){xe(r,F,"Invalid Sec-WebSocket-Accept header");return}let I=L.headers["sec-websocket-protocol"],M;if(I!==void 0?C.size?C.has(I)||(M="Server sent an invalid subprotocol"):M="Server sent a subprotocol but none was requested":C.size&&(M="Server sent no subprotocol"),M){xe(r,F,M);return}I&&(r._protocol=I);let Y=L.headers["sec-websocket-extensions"];if(Y!==void 0){if(!k){xe(r,F,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let me;try{me=Dc(Y)}catch{xe(r,F,"Invalid Sec-WebSocket-Extensions header");return}let De=Object.keys(me);if(De.length!==1||De[0]!==je.extensionName){xe(r,F,"Server indicated an extension that was not requested");return}try{k.accept(me[je.extensionName])}catch{xe(r,F,"Invalid Sec-WebSocket-Extensions header");return}r._extensions[je.extensionName]=k}r.setSocket(F,Q,{allowSynchronousEvents:x.allowSynchronousEvents,generateMask:x.generateMask,maxPayload:x.maxPayload,skipUTF8Validation:x.skipUTF8Validation})}),x.finishRequest?x.finishRequest(T,r):T.end()}function Bn(r,e){r._readyState=U.CLOSING,r._errorEmitted=!0,r.emit("error",e),r.emitClose()}function Pc(r){return r.path=r.socketPath,Vi.connect(r)}function Tc(r){return r.path=void 0,!r.servername&&r.servername!==""&&(r.servername=Vi.isIP(r.host)?"":r.host),hc.connect(r)}function xe(r,e,i){r._readyState=U.CLOSING;let a=new Error(i);Error.captureStackTrace(a,xe),e.setHeader?(e[Xi]=!0,e.abort(),e.socket&&!e.socket.destroyed&&e.socket.destroy(),process.nextTick(Bn,r,a)):(e.destroy(a),e.once("error",r.emit.bind(r,"error")),e.once("close",r.emitClose.bind(r)))}function zr(r,e,i){if(e){let a=_c(e)?e.size:kc(e).length;r._socket?r._sender._bufferedBytes+=a:r._bufferedAmount+=a}if(i){let a=new Error(`WebSocket is not open: readyState ${r.readyState} (${Be[r.readyState]})`);process.nextTick(i,a)}}function Lc(r,e){let i=this[Z];i._closeFrameReceived=!0,i._closeMessage=e,i._closeCode=r,i._socket[Z]!==void 0&&(i._socket.removeListener("data",zn),process.nextTick($i,i._socket),r===1005?i.close():i.close(r,e))}function Nc(){let r=this[Z];r.isPaused||r._socket.resume()}function Rc(r){let e=this[Z];e._socket[Z]!==void 0&&(e._socket.removeListener("data",zn),process.nextTick($i,e._socket),e.close(r[Sc])),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",r))}function Ji(){this[Z].emitClose()}function Oc(r,e){this[Z].emit("message",r,e)}function Bc(r){let e=this[Z];e._autoPong&&e.pong(r,!this._isServer,Yi),e.emit("ping",r)}function zc(r){this[Z].emit("pong",r)}function $i(r){r.resume()}function Mc(r){let e=this[Z];e.readyState!==U.CLOSED&&(e.readyState===U.OPEN&&(e._readyState=U.CLOSING,Qi(e)),this._socket.end(),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",r)))}function Qi(r){r._closeTimer=setTimeout(r._socket.destroy.bind(r._socket),r._closeTimeout)}function eo(){let r=this[Z];if(this.removeListener("close",eo),this.removeListener("data",zn),this.removeListener("end",to),r._readyState=U.CLOSING,!this._readableState.endEmitted&&!r._closeFrameReceived&&!r._receiver._writableState.errorEmitted&&this._readableState.length!==0){let e=this.read(this._readableState.length);r._receiver.write(e)}r._receiver.end(),this[Z]=void 0,clearTimeout(r._closeTimer),r._receiver._writableState.finished||r._receiver._writableState.errorEmitted?r.emitClose():(r._receiver.on("error",Ji),r._receiver.on("finish",Ji))}function zn(r){this[Z]._receiver.write(r)||this.pause()}function to(){let r=this[Z];r._readyState=U.CLOSING,r._receiver.end(),this.end()}function no(){let r=this[Z];this.removeListener("error",no),this.on("error",Yi),r&&(r._readyState=U.CLOSING,this.destroy())}});var ao=ie((Bl,oo)=>{"use strict";var Ol=Mn(),{Duplex:qc}=J("stream");function so(r){r.emit("close")}function Uc(){!this.destroyed&&this._writableState.finished&&this.destroy()}function io(r){this.removeListener("error",io),this.destroy(),this.listenerCount("error")===0&&this.emit("error",r)}function Fc(r,e){let i=!0,a=new qc({...e,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return r.on("message",function(f,l){let h=!l&&a._readableState.objectMode?f.toString():f;a.push(h)||r.pause()}),r.once("error",function(f){a.destroyed||(i=!1,a.destroy(f))}),r.once("close",function(){a.destroyed||a.push(null)}),a._destroy=function(x,f){if(r.readyState===r.CLOSED){f(x),process.nextTick(so,a);return}let l=!1;r.once("error",function(m){l=!0,f(m)}),r.once("close",function(){l||f(x),process.nextTick(so,a)}),i&&r.terminate()},a._final=function(x){if(r.readyState===r.CONNECTING){r.once("open",function(){a._final(x)});return}r._socket!==null&&(r._socket._writableState.finished?(x(),a._readableState.endEmitted&&a.destroy()):(r._socket.once("finish",function(){x()}),r.close()))},a._read=function(){r.isPaused&&r.resume()},a._write=function(x,f,l){if(r.readyState===r.CONNECTING){r.once("open",function(){a._write(x,f,l)});return}r.send(x,l)},a.on("end",Uc),a.on("error",io),a}oo.exports=Fc});var Mr=ie((zl,xo)=>{"use strict";var{tokenChars:Kc}=gt();function Hc(r){let e=new Set,i=-1,a=-1,x=0;for(x;x<r.length;x++){let l=r.charCodeAt(x);if(a===-1&&Kc[l]===1)i===-1&&(i=x);else if(x!==0&&(l===32||l===9))a===-1&&i!==-1&&(a=x);else if(l===44){if(i===-1)throw new SyntaxError(`Unexpected character at index ${x}`);a===-1&&(a=x);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 ${x}`)}if(i===-1||a!==-1)throw new SyntaxError("Unexpected end of input");let f=r.slice(i,x);if(e.has(f))throw new SyntaxError(`The "${f}" subprotocol is duplicated`);return e.add(f),e}xo.exports={parse:Hc}});var po=ie((ql,go)=>{"use strict";var jc=J("events"),qn=J("http"),{Duplex:Ml}=J("stream"),{createHash:Gc}=J("crypto"),co=Rn(),Qe=ht(),Wc=Mr(),Jc=Mn(),{CLOSE_TIMEOUT:Vc,GUID:Yc,kWebSocket:Xc}=Ne(),Zc=/^[+/0-9A-Za-z]{22}==$/,fo=0,uo=1,ho=2,qr=class extends jc{constructor(e,i){if(super(),e={allowSynchronousEvents:!0,autoPong:!0,maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:Vc,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:Jc,...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=qn.createServer((a,x)=>{let f=qn.STATUS_CODES[426];x.writeHead(426,{"Content-Length":f.length,"Content-Type":"text/plain"}),x.end(f)}),this._server.listen(e.port,e.host,e.backlog,i)):e.server&&(this._server=e.server),this._server){let a=this.emit.bind(this,"connection");this._removeListeners=$c(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(x,f,l)=>{this.handleUpgrade(x,f,l,a)}})}e.perMessageDeflate===!0&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=fo}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(Ut,this);return}if(e&&this.once("close",e),this._state!==uo)if(this._state=uo,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(Ut,this):process.nextTick(Ut,this);else{let i=this._server;this._removeListeners(),this._removeListeners=this._server=null,i.close(()=>{Ut(this)})}}shouldHandle(e){if(this.options.path){let i=e.url.indexOf("?");if((i!==-1?e.url.slice(0,i):e.url)!==this.options.path)return!1}return!0}handleUpgrade(e,i,a,x){i.on("error",lo);let f=e.headers["sec-websocket-key"],l=e.headers.upgrade,h=+e.headers["sec-websocket-version"];if(e.method!=="GET"){et(this,e,i,405,"Invalid HTTP method");return}if(l===void 0||l.toLowerCase()!=="websocket"){et(this,e,i,400,"Invalid Upgrade header");return}if(f===void 0||!Zc.test(f)){et(this,e,i,400,"Missing or invalid Sec-WebSocket-Key header");return}if(h!==13&&h!==8){et(this,e,i,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});return}if(!this.shouldHandle(e)){Ft(i,400);return}let m=e.headers["sec-websocket-protocol"],_=new Set;if(m!==void 0)try{_=Wc.parse(m)}catch{et(this,e,i,400,"Invalid Sec-WebSocket-Protocol header");return}let b=e.headers["sec-websocket-extensions"],w={};if(this.options.perMessageDeflate&&b!==void 0){let C=new Qe({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let k=co.parse(b);k[Qe.extensionName]&&(C.accept(k[Qe.extensionName]),w[Qe.extensionName]=C)}catch{et(this,e,i,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let C={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(C,(k,T,L,F)=>{if(!k)return Ft(i,T||401,L,F);this.completeUpgrade(w,f,_,e,i,a,x)});return}if(!this.options.verifyClient(C))return Ft(i,401)}this.completeUpgrade(w,f,_,e,i,a,x)}completeUpgrade(e,i,a,x,f,l,h){if(!f.readable||!f.writable)return f.destroy();if(f[Xc])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>fo)return Ft(f,503);let _=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${Gc("sha1").update(i+Yc).digest("base64")}`],b=new this.options.WebSocket(null,void 0,this.options);if(a.size){let w=this.options.handleProtocols?this.options.handleProtocols(a,x):a.values().next().value;w&&(_.push(`Sec-WebSocket-Protocol: ${w}`),b._protocol=w)}if(e[Qe.extensionName]){let w=e[Qe.extensionName].params,C=co.format({[Qe.extensionName]:[w]});_.push(`Sec-WebSocket-Extensions: ${C}`),b._extensions=e}this.emit("headers",_,x),f.write(_.concat(`\r
8
+ var Ua=Object.create;var cr=Object.defineProperty;var Ka=Object.getOwnPropertyDescriptor;var Ha=Object.getOwnPropertyNames;var Ga=Object.getPrototypeOf,ja=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 se=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),bs=(r,e)=>{for(var i in e)cr(r,i,{get:e[i],enumerable:!0})},Wa=(r,e,i,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let x of Ha(e))!ja.call(r,x)&&x!==i&&cr(r,x,{get:()=>e[x],enumerable:!(a=Ka(e,x))||a.enumerable});return r};var De=(r,e,i)=>(i=r!=null?Ua(Ga(r)):{},Wa(e||!r||!r.__esModule?cr(i,"default",{value:r,enumerable:!0}):i,r));import{chmod as Ja,mkdir as Va,readFile as Ya,rename as vs,writeFile as Ss}from"node:fs/promises";import{dirname as $a}from"node:path";async function Ht(r){try{let e=await Ya(r,"utf8");return JSON.parse(e)}catch(e){if(e.code==="ENOENT")return null;throw e}}async function Gt(r,e,i){await Va($a(r),{recursive:!0});let a=`${JSON.stringify(e,null,2)}
9
+ `,x=`${r}.tmp-${process.pid}-${Math.random().toString(36).slice(2,10)}`;try{i?.mode!==void 0?await Ss(x,a,{encoding:"utf8",mode:i.mode}):await Ss(x,a,"utf8"),await vs(x,r),i?.mode!==void 0&&await Ja(r,i.mode)}catch(u){await vs(x,x).catch(()=>{});let{rm:d}=await import("node:fs/promises");throw await d(x,{force:!0}).catch(()=>{}),u}}var xr=Ie(()=>{"use strict"});function As(r){return Wt[Es]<=Wt[r]}function ur(r){Cs={...r}}function jt(r,e,i,a){if(Wt[r]<Wt[Es])return;let x=JSON.stringify({ts:new Date().toISOString(),level:r,module:e,msg:i,...Cs,...a});r==="error"||r==="warn"?Xa.write(`${x}
10
+ `):Qa.write(`${x}
11
+ `)}function N(r){return{debug:(e,i)=>jt("debug",r,e,i),info:(e,i)=>jt("info",r,e,i),warn:(e,i)=>jt("warn",r,e,i),error:(e,i)=>jt("error",r,e,i),child:e=>N(`${r}.${e}`)}}var Wt,Es,Qa,Xa,Cs,K=Ie(()=>{"use strict";Wt={debug:10,info:20,warn:30,error:40},Es=(()=>{let r=process.env.COZE_BRIDGE_LOG_LEVEL;return r==="debug"||r==="info"||r==="warn"||r==="error"?r:"info"})(),Qa=process.stdout,Xa=process.stderr,Cs={}});import{homedir as Za}from"node:os";import{join as te}from"node:path";function H(r){let e=r??Za(),i=te(e,".coze"),a=te(i,"bridge"),x=te(a,"lib");return{cozeRoot:i,bridgeRoot:a,libDir:x,libEntry:te(x,"index.js"),pidFile:te(a,"bridge.pid"),portFile:te(a,"bridge.port"),tokenFile:te(a,"bridge.token"),logFile:te(a,"bridge.log"),installLock:te(a,"install.lock"),configFile:te(a,"config.json"),agentsRoot:te(i,"agents")}}function Te(r,e=H()){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 Yt={};bs(Yt,{AGENT_CONFIG_FILE_MODE:()=>Jt,enforceAgentConfigMode:()=>n0,loadAgentConfig:()=>ce,persistAgentSessions:()=>fr,persistAgentSkills:()=>Vt,saveAgentConfig:()=>me});import{chmod as e0,stat as t0}from"node:fs/promises";function ce(r,e){return Ht(Te(r,e).config)}function me(r,e){return Gt(Te(r.agentId,e).config,r,{mode:Jt})}async function n0(r,e){if(process.platform==="win32")return;let i=Te(r,e).config;try{let a=await t0(i);if(!a.isFile())return;let x=a.mode&511;x!==Jt&&(await e0(i,Jt),ks.warn("agent config mode auto-corrected to 0600",{path:i,from:x.toString(8)}))}catch(a){if(a.code==="ENOENT")return;ks.warn("enforceAgentConfigMode: chmod failed (ignored)",{path:i,err:String(a)})}}async function fr(r,e,i){let a=await ce(r,i);a&&(a.sessions=Object.fromEntries(e),await me(a,i))}async function Vt(r,e,i){let a=await ce(r,i);a&&(a.skills=e,await me(a,i))}var ks,Jt,Ue=Ie(()=>{"use strict";xr();K();ae();ks=N("agent-config"),Jt=384});var ui=se(Q=>{"use strict";var S=P;(function(r,e){let i=P,a=r();for(;;)try{if(parseInt(i(1052))/1+parseInt(i(839))/2+parseInt(i(1598))/3+-parseInt(i(538))/4+-parseInt(i(1755))/5*(parseInt(i(1781))/6)+-parseInt(i(734))/7+parseInt(i(1360))/8*(parseInt(i(1292))/9)===e)break;a.push(a.shift())}catch{a.push(a.shift())}})(Sn,778249);var mc=Object[S(1588)+"operty"],wc=Object[S(1318)+"opertyNames"],ii=(r,e)=>function(){return r&&(e=(0,r[{OyzEe:function(u,d){return u(d)}}[S(1628)](wc,r)[0]])(r=0)),e},_c=(r,e)=>{let i={cdVaZ:function(x,u,d,h){return x(u,d,h)}};for(var a in e)i.cdVaZ(mc,r,a,{get:e[a],enumerable:!0})};function yc(){return ei||(ei=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function bc(){let r=S;return ti||(ti=[IDBCursor[r(1268)+"e"].advance,IDBCursor[r(1268)+"e"][r(1104)],IDBCursor[r(1268)+"e"][r(1104)+r(497)+"ey"]])}function vc(r){let e=S,i={bwUDx:"success",hofvv:"error",cbpxP:function(x,u){return x(u)},EPtSg:function(x){return x()},UiMKb:function(x,u){return x instanceof u}},a=new Promise((x,u)=>{let d=P,h={aFCWh:function(_){return i[P(1876)](_)}},m=()=>{let _=P;r[_(938)+_(1425)+_(733)](i[_(999)],w),r[_(938)+_(1425)+"ner"](i[_(940)],b)},w=()=>{let _=P;i[_(1769)](x,Ce(r[_(1456)])),m()},b=()=>{let _=P;u(r[_(533)]),h[_(783)](m)};r[d(1149)+"Listener"](i[d(999)],w),r["addEvent"+d(1538)](i[d(940)],b)});return a[e(568)](x=>{let u=e;i[u(1280)](x,IDBCursor)&&pr[u(510)](x,r)})[e(1163)](()=>{}),bn.set(a,r),a}function Sc(r){let e=S,i={szFWk:e(1016),tEmio:"error",mjvQQ:e(1379),rrkiu:function(x,u){return x>u},rQYag:function(x,u){return x===u},SAgiY:e(408),jpgxj:function(x){return x()},xHFEH:function(x,u){return x(u)},kTSQu:e(516)+"or"};if(yn[e(1270)](r))return;let a=new Promise((x,u)=>{let d=e,h={yIIXm:function(_,C){return i.rrkiu(_,C)},fjRVN:function(_,C){return i[P(1535)](_,C)},nFMRx:i[d(1184)],Kehvq:function(_){return i[d(1710)](_)},EeUNy:function(_,C){return i[d(1707)](_,C)},cqdsJ:i[d(1233)]},m=()=>{let _=d;r[_(938)+"entListe"+_(733)](i[_(1446)],w),r["removeEventListe"+_(733)](i.tEmio,b),r["removeEventListe"+_(733)](i[_(1075)],b)},w=()=>{let _=d,C={KpeWr:function(L,I){return h[P(707)](L,I)}};if(h[_(1024)](h[_(1009)],"wtynF"))h[_(1166)](x),m();else return this[_(1062)+"ndex"]==this[_(1217)+"s"].length?!0:C.KpeWr(this[_(1489)+"ndpointT"+_(1338)+"t"],this[_(1770)+"es"])},b=()=>{let _=d;h[_(1589)](u,r[_(533)]||new DOMException(h[_(625)],"AbortError")),m()};r[d(1149)+"Listener"](i[d(1446)],w),r[d(1149)+d(1538)](i[d(623)],b),r[d(1149)+d(1538)](i[d(1075)],b)});yn[e(510)](r,a)}function Ec(r){vn={EEzQH:function(i,a){return i(a)}}.EEzQH(r,vn)}function Cc(r){let e=S,i={JJSeL:function(a,x){return a(x)},gcmNU:function(a,x){return a(x)},KPhwu:function(a,x){return a>x},HRLhA:function(a,x){return a+x},yNmxV:e(778)+e(523),WMbCv:function(a,x){return a(x)},JGSEm:function(a,x){return a===x},CqRnn:function(a,x){return a in x},mbwpd:function(a){return a()},FXYgv:e(1746)};if(i[e(638)](r,IDBDatabase[e(1268)+"e"][e(660)+"ion"])&&!i.CqRnn("objectSt"+e(541),IDBTransaction[e(1268)+"e"]))return function(a,...x){let u=e,d=r[u(1236)](i.JJSeL(Tt,this),a,...x);return gr[u(510)](d,a.sort?a[u(1169)]():[a]),i[u(468)](Ce,d)};if(i[e(572)](bc).includes(r))if(i.JGSEm(i.FXYgv,e(1406))){let a=_0x4a22df[e(646)];if(i[e(418)](i[e(1802)](a,_0x2e770d),_0x2b3adb[e(1199)]))throw new _0x4fa9b5(i[e(1115)]);return _0x12f499.offset+=_0x51c418,a}else return function(...a){let x=e;return r[x(1203)](Tt(this),a),Ce(pr[x(1528)](this))};return function(...a){let x=e;return Ce(r[x(1203)](i[x(787)](Tt,this),a))}}function Ac(r){let e=S,i={OWoPe:e(1368),FlgFu:function(a,x){return a(x)},knZHw:function(a,x){return a instanceof x},QZexg:function(a,x){return a(x)},OKxUM:function(a,x,u){return a(x,u)},VuAbz:function(a){return a()}};return typeof r===i[e(1819)]?i.FlgFu(Cc,r):(i[e(675)](r,IDBTransaction)&&i[e(1245)](Sc,r),i[e(685)](oi,r,i.VuAbz(yc))?new Proxy(r,vn):r)}function Ce(r){let e=S,i={eJePC:function(x,u){return x(u)},cXvIi:function(x,u){return x!==u}};if(r instanceof IDBRequest)return i[e(1451)](vc,r);if(wn[e(1270)](r))return wn.get(r);let a=i[e(1451)](Ac,r);return i.cXvIi(a,r)&&(wn[e(510)](r,a),bn[e(510)](a,r)),a}function P(r,e){r=r-386;let i=Sn(),a=i[r];if(P.OpPqTh===void 0){var x=function(m){let w="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=",b="",_="";for(let C=0,L,I,R=0;I=m.charAt(R++);~I&&(L=C%4?L*64+I:I,C++%4)?b+=String.fromCharCode(255&L>>(-2*C&6)):0)I=w.indexOf(I);for(let C=0,L=b.length;C<L;C++)_+="%"+("00"+b.charCodeAt(C).toString(16)).slice(-2);return decodeURIComponent(_)};P.KaQcMq=x,P.FNDdER={},P.OpPqTh=!0}let u=i[0],d=r+u,h=P.FNDdER[d];return h?a=h:(a=P.KaQcMq(a),P.FNDdER[d]=a),a}var oi,ei,ti,pr,yn,gr,wn,bn,vn,Tt,ni=ii({"node_modules/idb/build/wrap-idb-value.js"(){let r=S,e={MIZEd:function(i,a){return i instanceof a},IdRBs:function(i,a){return i!==a},bGama:r(1556),LEvSR:r(648),uaOxB:r(1145),HMWQs:function(i,a){return i===a},PuHyT:r(1603)+r(541),zbten:r(838),JCEmt:function(i,a){return i(a)},oMatY:function(i,a){return i===a},uaSCS:"YRfjM",JiYZq:function(i,a){return i instanceof a},WpwUH:function(i,a){return i===a}};oi=(i,a)=>a.some(x=>i instanceof x),pr=new WeakMap,yn=new WeakMap,gr=new WeakMap,wn=new WeakMap,bn=new WeakMap,vn={get(i,a,x){let u=r;if(e.MIZEd(i,IDBTransaction))if(e[u(1095)](e.bGama,e[u(1416)])){if(a===e.uaOxB)return yn[u(1528)](i);if(e.HMWQs(a,e[u(1112)]))return i[u(1603)+u(541)]||gr[u(1528)](i);if(a===e[u(780)])return x[u(1603)+u(541)][1]?void 0:x[u(1603)+u(528)](x[u(1603)+"oreNames"][0])}else _0x4146f8[u(1030)](_0x4acadd);return e[u(1023)](Ce,i[a])},set(i,a,x){return i[a]=x,!0},has(i,a){let x=r;return e[x(754)](e.uaSCS,e[x(469)])?e[x(532)](i,IDBTransaction)&&(e[x(754)](a,e[x(947)])||e[x(1806)](a,e[x(780)]))?!0:a in i:_0x2c7ebe}},Tt=i=>bn[r(1528)](i)}}),ai={};_c(ai,{deleteDB:()=>Pc,openDB:()=>kc,unwrap:()=>Tt,wrap:()=>Ce});function kc(r,e,{blocked:i,upgrade:a,blocking:x,terminated:u}={}){let d=S,h={FYzFt:function(b,_,C,L,I){return b(_,C,L,I)},AqYdB:function(b,_){return b(_)},ctnZf:function(b,_){return b(_)},sCeca:function(b,_){return b||_},vvezs:d(1547)+"hange",aLhgE:d(1822),RAWKX:d(1089)+d(1772),qWRts:"blocked"},m=indexedDB[d(1875)](r,e),w=h[d(1014)](Ce,m);if(a)if(d(1822)===h[d(1817)])m["addEvent"+d(1538)](h.RAWKX,b=>{let _=d;h[_(1594)](a,h[_(628)](Ce,m[_(1456)]),b[_(1180)+"on"],b[_(1823)+"on"],h[_(1014)](Ce,m["transact"+_(474)]))});else{let b=this._qosDB[d(1505)+d(848)+"nc"](this[d(1353)]),_=_0x51b547[d(1525)](h.sCeca(b,"{}"));return _0x561aab[d(1035)](_)}return i&&m[d(1149)+"Listener"](h[d(1469)],()=>i()),w[d(568)](b=>{let _=d;u&&b[_(1149)+_(1538)]("close",()=>u()),x&&b[_(1149)+"Listener"](h[_(1886)],()=>x())}).catch(()=>{}),w}function Pc(r,{blocked:e}={}){let i=S,a={swFbl:i(1078),SNKwm:function(u,d){return u(d)}},x=indexedDB[i(544)+i(1777)](r);return e&&x[i(1149)+"Listener"](a[i(865)],()=>e()),a[i(450)](Ce,x)[i(568)](()=>{})}function ri(r,e){let i=S,a={bORpm:i(1605),sbknl:i(551),rswbi:function(m,w){return m!==w},apMmI:function(m,w){return m in w}};if(!(r instanceof IDBDatabase&&!(e in r)&&typeof e===a[i(937)]))return;if(_n[i(1528)](e))return _n[i(1528)](e);let x=e[i(1493)](/FromIndex$/,""),u=a[i(1609)](e,x),d=xi.includes(x);if(!a[i(781)](x,(u?IDBIndex:IDBObjectStore).prototype)||!(d||ci[i(1386)](x)))return;let h=async function(m,...w){let b=i,_=this[b(660)+"ion"](m,d?b(878)+"e":a[b(1357)]),C=_[b(838)];return u&&(C=C[b(455)](w[b(678)]())),(await Promise.all([C[x](...w),d&&_[b(1145)]]))[0]};return _n[i(510)](e,h),h}var ci,xi,_n,Ic=ii({"node_modules/idb/build/index.js"(){let r=S,e={hswFy:function(x){return x()},qgdzi:r(1581)+"ys",KWyBJ:r(1248),wUpwo:r(972),MmGSZ:r(1799),ZNCVx:function(x,u){return x(u)}},i=(r(1752)+"0|5")[r(862)]("|"),a=0;for(;;){switch(i[a++]){case"0":_n=new Map;continue;case"1":e[r(1610)](ni);continue;case"2":ci=[r(1528),"getKey","getAll",e[r(1563)],r(429)];continue;case"3":e[r(1610)](ni);continue;case"4":xi=[r(1006),e[r(1855)],e.wUpwo,e[r(994)]];continue;case"5":e[r(1512)](Ec,x=>({...x,get:(u,d,h)=>ri(u,d)||x[r(1528)](u,d,h),has:(u,d)=>!!ri(u,d)||x[r(1270)](u,d)}));continue}break}}}),Dc={idb:function(r){let e=S;r[e(1887)]=Promise[e(1061)]()[e(568)](()=>(Ic(),ai))[e(568)](function(i){return i})}},si={};function Ee(r){let e=S,i={XgrFo:e(681)+"0",WkxOJ:function(h,m){return h!==m}},a=i[e(1327)][e(862)]("|"),x=0;for(;;){switch(a[x++]){case"0":return d[e(1887)];case"1":var u=si[r];continue;case"2":var d=si[r]={exports:{}};continue;case"3":Dc[r](d,d[e(1887)],Ee);continue;case"4":if(i[e(801)](void 0,u))return u[e(1887)];continue}break}}function Sn(){let r=["y2XQvuO","u0LbCNK","uLHIAhm","r091q1O","rvjst1i","y2jWEfa","Bwf4uMv0CMK","AMDcvxq","zwvKzwq","AMTABNi","yMfSrxzLBNq","AM9PBG","ihzHBgLKigq","DgfIyxnL","BeviDee","zgf0yq","ruDcCM4","mJrfzxPetxG","rNjVBNrPzxi","qw5UD2W","BfHWu2C","x2nYzwf0zvm","q09otKvdveK","Bwf4tg9ZC0m","CMvWBgfJzui","suvRAuS","sLzvwLC","nNWXFdb8nW","tMjpvLi","yxjdqNa","z0nWzfG","x19LC01Vzhu","ze9NAe0","BNHgEgS","zw1VvuO","y2XLyxi","zLbkDNO","AKPVB20","sfjmAee","zw5JB2rPBMC","u1nIDhi","DxrMofDYAxq","v3b3vuG","C2vrAxu","Bu5rC2G","BezSDxnO","sKDlsvG","BfrqEM8","ywPjzeC","yLP6vMK","r3nOtM4","zvfKvxy","DxnLCKLW","yuXOz0u","zxq9DxrMltG","t1DVugu","A2vmq24","CLzHBhvLCW","CgPKCK0","BMv3vMvYC2K","q0D0uNa","Bwv0Ag9K","wLrtqNi","AwPmvuu","CMvZzxrfBMq","yxrHlcbKyxq","CvjUENK","q0Xpu0LorW","sfLIuvy","B3bLBKrc","Du5sD3e","EhfWvvu","sMD3zgK","yw5Hz2vY","x3jLBw92zvC","BML0AwfSAxO","v0DXz2e","AxmGDw5Kzwy","ruTMC0q","BgvUz3rO","CuvMAui","AgLNAa","BhnhD2m","v3vZu0S","uNLUCLC","yuH1uuG","u3LSBxq","yM9L","CMvKDwnL","ywnRtxnNswq","y25Hz3u","s1D5qKO","DKL3uvq","sLzkA0q","Cg9W","y29UC3rYDwm","yu9YreK","y3nWBMO","y2zHCuK","AxnFywnR","A0LuBei","r3Hszuq","B2nRzxq","x3bPBMDqB24","qNHkCKW","ALncDwq","x29UugfNzu4","x29WDgLVBNm","DeLUDgvYy2u","B3PnAg8","zMrKueS","B3bLBG","rvb0u2C","DvjAq2i","qNz0BLe","yxvks28","zK1PDgu","wfzrCLG","y3jLyxrLq2W","zxf1ywXZ","ExzuEhm","Dgntww8","DNzLENm","zxHWB3j0CW","x3bHDgHlzxK","zMLUza","C3rquLy","y3jLyxrLuMu","D1Hvv04","AxnszwfKEq","Dg9Y","CLzLD0m","CMfTzq","vvP1s3O","ywWGy3vYC28","DhDVu1m","BwvKAwf0zwW","zevgvMW","rNPfA1m","z1rPBwvVDxq","CYbPBNn0yw4","BMrLEa","vxjkAg0","rxnUswG","yvPYv08","vKHZyxm","ywDLu2HVDW","sKLxrvi","tufyx1jfvfi","x2HHBMrSzu8","Aw5KzxHpzG","x3jLywr5q2W","Dw5KzwzPBMu","yuPXBgW","v2X6BKm","zK5Kz3u","CNnVCL9Uyw0","y1fSz3m","DMfSDwu","yNLL","uuzVswy","D3r5BKy","zxjFBxnNAwq","rLDt","CgjICdi","ww9PCva","DefwALm","zMPuDuy","z0PNAgi","DgTzEwS","x3nLBMrby2S","s1bOD3u","q2fgvwS","EvzcqMO","Dgv4DfbHEwW","AxnAzxjV","yxnKve4","CMvUDevUzha","wxzOqLC","Ahr0Ca","Bg9Nsurhzw4","zcWGDw5RBM8","y291BNq","ANPWEMS","quzhqMm","yMrFzgLK","DuHvEem","AvvTuwm","suz6D2m","B25pCgvU","uxjvt3e","C3rYAw5NAwy","DcbVzIbYyw4","y1PHqu4","CxvYvKS","uuHsEee","DKnTug0","x3DZ","Aw5L","t29TzMG","B25ozxr3B3i","x2rPC2nVBM4","v3LYtwq","u05lD20","Eu9eDeO","zgTAALy","yw5Nzq","D1LNANC","Aw5KzxG","BxHnBM4","z2HrB1e","A0f3B2u","v0vIqum","zw5XDwv1zq","qw1VDw50","u0TjAu0","B25LCNjVCG","uu9Otfe","icSG","CNfivg0","AuzAuw0","z2nTtLu","Dwftq1m","wevzy1K","ywrKt25L","yMfuEwK","s1fWu2e","Aw9U","zwPJAKK","wKXwCwu","ug9jsgy","y3r4","t1HsweK","zw5HyMXLqxu","Bhj4AMG","zNjHBwvuExa","ChvZAa","BMDLza","DvjlChu","CYbWyxjHBxm","vgLsse8","yxbWBgLJyxq","z2v0qwXS","wuvcqwC","x2HHBMrSzva","tNnpuhm","CgLUz1rPBwu","tgz0BLu","ywrKq291BNq","rgDPANG","uhjPBwfYEuS","ugTrr3u","AvnuwwC","rfjIwem","B3rvtg0","uKrfBeO","zfbPBwq","z2v0sxrLBq","q3vZDg9Trxi","Aw9Ul2PZB24","ywDLsgLKzq","yMDuChO","wgHvzu8","C2v0","whPJCMK","z3LhteS","zKfrBvm","C2jkENK","wfDRwum","qwjVCNrfCNi","B3bLBIa","uNPcs2u","tKHAC1a","yMLUyxj5","DhjPBq","s2nsD3a","DcbSAw1PDa","BwnMzNq","CMvTB3zLq2G","DgrTC2S","uxfLDuW","B3jL","uKXTCe4","r3Lkq0e","ALLjvK4","sMLzwNe","zxjYB3i","qxzVEwu","BM9Uzv9UB24","Dev2zw50","q0LtzMK","mJy5odqYohLyDK5JrW","AefsqM0","C3rHCNq","B3jLtMfTzxm","EK1QyuC","qw1iuMq","zgvSzxrLrge","y2XVC2uSihC","CxziBgW","ruPire8","DuHuuwS","tMfTzq","yvLQBhK","C3rYAw5N","CNbmCKG","yw5tveC","Dg9cExrLC0W","nxW0Fdf8nNW","Ec11C2uT","vNPosw4","DvjjDfC","yw51Ce1LC3m","DuLhB0G","CxDrCxu","wvf0qwm","svbyqxG","CxLrC1y","sef1vwW","s1f3EKS","tKfrEKu","DgHLBG","zM9Yy2u","x3nVy2TLDa","ihn1y2nLC3m","Bwj3Cgq","CuTsAwe","ANLwvui","ChLlr0q","sw1XBgC","u2DIB2q","Cvbmq0O","qwTpuei","DMLJzuLeig8","rgX5qKm","zNrHAw8","s1LfAve","DunlrLe","Aw5KzxGGB3u","zgvS","CKXeDxK","CgLUz0XVC3m","AK1yEwC","AxnrB1nnzxm","Bxrkq2i","BMCGDxjSoIa","ELbsC2C","tunpCvO","Cxjpuhq","y3jLyxrLrwW","y2HHCKnVzgu","sNPsue0","y2vZC0HHBMq","zMXVB3i","C2TPExG","B25tDgfYDfi","Aw9UvgLTzw8","ENvTz2m","rMjxywC","x2DLDeLUDgu","uNf6C0W","tMHjAfK","rLLvwuq","y3jLyxrLtwu","Cg5Xyvq","q2zJzwG","zujZruO","BwfUDwfSihi","Aw5N","CgfNzxnOB3C","AMvmyxK","t3bLBKv2zw4","yvDwz1e","C3rLBMvYCW","z05yBeG","shPft20","DevTAw8","yw1Lu3bHy2u","y3fKC0O","C3bSAwnL","B3nLrxzLBNq","qxfzzei","Dg9hzw5LCMe","r1HWyKy","uejpAwS","zv90Aw1LB3u","Dezcs2e","z3jQv2S","D2P0BM8","rLzcs0u","zNjVBunOyxi","sKDtrw0","B25SAw5L","Bxfntvy","vKPsA3q","vvjhsNa","DgvmB2Djre4","Efn4rxO","q291BNq","B2zMC2v0","BgLUzq","DMnfCu0","DMTgAeO","wvHRugi","yNzxEM4","zNjVBu51Bwi","s21LtLO","BMrWB2LUDfq","CMLVCKu","wNzkDfm","Ee16seu","Dg9VigXHCMC","AxnbCNjHEq","DhjHBNnHy3q","sNHoqxu","BMvLzf9Hy2S","ENreCvm","y0rmze8","C2DNvLa","vxPwrK0","o2nOyxjZzxq","B0LZqLq","BgvY","EhDWwvq","B2fK","Dg9mB3DLCKm","x2LZtwLUAvC","zLnTrg0","A25AshC","CM92AwrLihC","zxmGCMvHy2G","C2HPzNq","x3fVC0rc","EwrVu28","mxW0Fdj8m3W","EgLhB2i","CgXOweK","BxzrEey","t0T4vu0","zgrjrcWGzgu","tw96BM0","tg9JAW","mdaWma","aaaaaaaaaaa","C2vYDMvYvgK","vMX0ELm","vuLZANi","Cgf5Bg9Hzeu","s01kv1a","zKvesgq","A0DPzwq","s29wrMe","r3jmr2S","CM1nsgi","rMvTqvK","tefhrMK","AgfTzLC","zKP2zvK","DM9XBw4","yxrLq291BNq","EuLjwg0","yxKSihrYEsa","ue9Sq1q","CNnVCKzPBgu","AefJA01LC3m","quXwB1K","BeXiCxa","DgHHBIbSB2m","Ef9MCM9UDgK","rLjptLrjrvi","yxfoD1e","wgrQEM4","Bwf4twvZC2e","v1DRywe","D2vI","DuDNA1G","s2rNDK0","sMPwCg8","BwfW","C21cAhC","De9KALK","yM5ZEwi","x0vysvnu","ALDHseO","ChjVDg9JB2W","y2rmChy","BMvY","ota4ntG3neThzgzUAW","y0fLy28","A2v5","CLjotKC","C2nYAxb0","BxDxwhq","EuTrA0u","DNfxsvO","t2LWDxq","swrQB2G","sg9ZDwm","uLbszLm","zw5fDMvUDa","BM5Ly3q","DxjS","y2HnyxHuCMK","BuLQt0y","tg9UC3G","yLfMDgO","sLnAv2u","B01HDfK","zw50zwqGDhK","BxnN","r2P4sNG","AeziExK","CKHhAgK","DMvY","q1vxq3i","wxP5Dhq","vgLTzw91Da","Dhr3Awq","B2PxwKO","DLDPvhG","y3nzAe8","x2LUAxrqCM8","ywnRDxbfBMq","tfzfBgG","BgLZDgvUtMu","q09oveLovuu","Dhjjvxy","mdaWmdaWmda","C3bLufG","nNWZFdr8mG","C2vYDMLJzs0","uMvHzcbWyxm","BMnLq2XVC2u","EMj0zw4","yxbnBuK","CKfOwKy","yuzdv2G","igzHAwWSig0","u3rYyxrLz3K","v2vIu29JA2u","v01Iq3y","tfbYv3K","C0jf","x2zVCM1HDeu","uNvbuvu","seDuELK","ALv6uMu","Bfb4zfO","CMv0CNLdB3u","zLDvBuK","uMvJB25Uzwm","uLnRqMu","x3DZsw5ZDge","v0T4zhy","v2T4t0O","x2LZtwLUAvq","x2XPC3rLBMu","tgHYuNi","t2TOthK","zw1PDa","rM1qDfO","shzsBMK","DxDwt3i","B1vOyuC","u2HHCMvKv28","vfDcvMG","CMXRC00","z2vrDwv1zuW","ugrtqLq","t1LNrvO","y2vXD0y","ihbYB3rVy28","sK1dCfa","sKHrEui","Bg93","rKrvrwe","B25TzxnZywC","x2DLBMvYyxq","C2vUzf9Hy2S","AwXLtMfTzq","wLD4swm","C1jHww8","x2fKzfDZtgK","ywzL","B2zM","DMTWwwq","AgfZt3DUuhi","tg9Nsuq","vMPbzKi","rfjNtKy","z1HQs3y","C3rVCMu","mJGXmty1ngnICgzwDW","Bfr1BeK","svf6DKy","C3jJ","sMPfsw4","CMrvqLm","CfncCMq","Dg9tDhjPBMC","A2fgyKK","z2vjBMzVu3K","shrxCuy","D2fZq2XLyw4","sNfJAue","s0HIqwK","yKfmwKW","D25Rqve","EwfmsLu","EsbJBg9Zzwq","zwnVBM5Ly3q","qKXAAMO","Aw47y2HHCNm","Ew9ZAMi","B3zpBeC","C3bSAxq","EfPryuy","Dxrjza","C3DgyMW","Efrurw52","Be1ozfy","t0vwwLe","t2jQzwn0","rLvpC08","zxH0zw5ZAw8","zw5HyMXLvhi","thfjzfy","x2jPBMfYEvq","AMftCLC","y29SBM8","x2rPC3bHDgm","CMvHzhDYAxq","sNDoCNC","q3vZDg9Tq2W","q29Kzq","CLDMAMG","rxzLBNq","AwXK","sw1gCK8","Axnby2TdBgu","mhWYFdn8mxW","AxnmB25N","B2LUDfjLywm","Chvitum","B25szwnLAxy","Bwu6ia","Dw5ZAwDUzwq","Cgu6ia","tuntCKq","mhWZFdi","zKT2sKG","rxvzt2K","t21urge","suPTzeC","y1rxv00","tfrMwum","CxLJv3q","A2PVAgi","CvPRBwm","sg1itKC","yvDevMC","x2LZsw5PDa","BNruCMLLC0m","uwvSEM0","BKj2sgW","BMCGB3iGyw4","vujZD3a","t3f5tuC","t1nKEey","AgPMvgW","BNrLCG","r05JB3i","uvbZswS","C3HVu1K","x2n1CNnVCK0","AKfzEe0","uMzwzgS","tLvfr2K","AevYCM9Yrxy","zMvY","t0P6DxG","Agzwru8","D01Hzha","uu5hDg4","Cwjczhi","yxnJCMLWDa","quvzBfG","AgvHzgvYCW","quD1y0e","BNzpB0u","C2jRBMW","CMvTB3zLrxy","x3bPBMDmB3m","Ag9MDNy","t2nXyNu","u3DxsKq","B2fIy0C","B25fCNjVCG","vu5NBxq","q0Xpu0ve","DwfpEei","s1bvDg8","CMvZzxrdB3u","tNjVwgm","wwPLywG","Cg93","yMLUza","x29Ut3bLBG","A1n0yxr1C0m","ALfpuhm","EwPrEw0","B3jpBMXPBMu","vgfN","zw1Pyw8","BKXvrLG","CKHIz2i","qMnfCfe","wMjZvKe","zu9sDgu","vgXfCM0","vLvAvNu","DufNqwi","AKzzBMC","vwLxqu4","Cg56AuG","zgvSzxrL","Bhm6ia","uMrzvKu","q2vvDM0","zMPrvhO","AMvJDfn0B3i","yxPdwwq","x2TLEvbHDgG","uunctgO","tKDFrvjst1i","AeH3DMu","B25tDg9Wsw0","y0nvrwu","ufvvwM8","yNL0zuXLBMC","EvjLy29UBMu","r2HQAhO","yw1L","zxrxB3jRq2G","zLrQAuC","mhW0Fdn8mNW","BePoshi","tw1hu1O","y29UBMvJDca","Aw5PDcbrB1m","thLtEhq","u3Hpy0C","yNDvrhG","DejIANC","tMfjBvu","z29PBMCGyxC","B3nZy2S","DxDir2y","id4G","Chv0","mNWWFdf8nxW","CNzHBfzHBhu","BKznuNG","AgvHzgvY","Ce5fsMS","CMfUzg9T","uLjpuG","y3rUwMy","y2uGBM90igK","y29TCgXLDgu","u3Ddr2y","uu5QqwO","v3bkzKC","zK1zAe8","x2nSzwfYvgK","CIb0DhDjra","sKnfBxq","zMPsvK4","ENHPuNC","thfJDKy","B3bbA1C","twvZC2fNzuu","rNDIBhO","Bg9N","pxv0zI04","vgvntxO","u2vXsuq","q3Pvrem","DMfSDwvZ","z2u6ia","zgLNDNy","s0r5B20","ihrVihjLDhi","x2nSzwfYugK","t09rB3q","yxnL","x2rYB3bhBg8","AMzNDfa","sufoBxa","BLb4BMG","u0PgBLC","t1bsywS","DhjPzxmGCMu","zLvVsxy","x21LC3nHz2u","mteYmZC1oxveq01UBW","zNDZxZeUmc4","CgfNzwHPzgu","zgzwyLC","yxGGCMv0CMK","ywnRpwzYB24","vMzoBu0","rxjYB3jdB2q","EvbvzM4","CMvZB2X2zq","y3vYCMvUDeK","DLzWDvK","DxLVB28","sxjqtfe","ywDL","BNvTyMvY","quXm","Eu1cyue","vhb6AKG","BeDnyK8","vMrYzvu","y0jbDhm","rwHLBe0","BwP2uve","CMvJzxzPzwq","uxvLDwu","yMXVy2TLza","BwLZzq","zcWG","CffvsgW","swHmshe","Dg9cExrLCW","DLLWtgm","wxLTrMG","BgLUzw5V","uKzHtu8","s3PitKm","DxbNCMfKzw4","AunUEuq","C0HmDuS","vxbKyxrLq28","rxbXseC","vuD1se0","swrsqNm","BNfJAfm","rgXXAw0","BKPODhO","zuzAq04","s2vJCKO","suDQCve","zKrSsve","x29UtwvZC2e","y29UDgLUDwu","D24GCMvHC28","DLPhwLq","y3vYDMfSDwu","y2rbEKi","y29UBMvJDeu","AgnryvO","shf6tha","uhviEvq","zen1shK","ExbL","Eu5TEfy","yMDdAgC","Efvsr0C","zcbLCNjVCI4","Cuzjq0e","zw5HyMXLuw8","qMXMrxe","jMPZy2fSBgi","tuvtu0fhrv8","CKThtfC","C3vIC3rYAw4","t1Pku08","C2fNzq","CgLUz09Uy2u","ignVzgu6ia","DgfYz2v0","rxLcs1u","AKzUrvC","B3nLza","A2LHCfe","AgvKtwf4uMu","D3m6lY8","t1bftL9fuLi","Dg5ssxa","Eez5D2e","swvsv1m","Aw50zwDLCIa","B3vUDa","s1PwrLC","zMzMzG","zg9Uzq","ywXSB2nvBNm","txfWs3G","zePTrMm","ywrKrxzLBNq","C0nYsgK","yNvMzMvYzwq","yMfdvfK","rxLytLy","x2n1CNnVCK4","yKT2zKG","DffovuG","s1f4rKS","BwvZC2fNzv8","txfnv28","B3feuK0","weT6ze0","tfbJs0m","y2f0y2G","suDjC2G","CNnzs3i","s2vODNe","wwH6y2q","x29UvgLTzw8","C29YDa","zM9YrwfJAa","D3jPDgvvAw4","s05bu0S","zuDmBe8","CMvZzxruCMK","whnHuvy","BuDetwW","ywXmv2S","CNzHBa","y3jLyxrLt3a","B2XKvMvYC2K","BMrWB2LUDca","rKLmrv9ot1q","BMnVzgLUzW","u0fNAvK","CgvYC2LZDgu","zgvJB2rLzey","tuDYCuW","wKT3y2q","v2PhB3i","BMDuAw1LCG","DMjWuwK","zfDVCMTLCKC","CNjVCK1LC3m","r0nwBNG","s0XHyve","uw1wCuW","s3v5yKK","yxzlt3u","BgLTAxq","BNrbBMrvCgq","sxzYse4","sfPdtxi","yxbWBhK","y3vYC29Yx2y","qNrquK8","r25NBgC","A1H3rxe","uNPku3O","CfPqt2y","BNrfBMrWB2K","D3vRueC","tefvuw4","suvtx0vsuK8","vLrizha","y2HnyxHdB3u","uffnsxi","zw5KCg9PBNq","rNbzwfK","x194x21Zz18","y29UBMvJDgK","y0nJAg0","zw50","uMHxq1O","yxv0B21HDgK","x25HDMLNyxq","nhWZ","y29UBMvJDfm","B25nzxnZywC","CwzTuwO","yNL0zu9MzNm","C2vYDMLJzq","zxjFCw9Z","A1rtuxu","tKTHD2e","ruHPA1a","y2fSBa","sLfUAvG","CgLUz19VBMm","A25stvq","rK9NrNa","ign1CNnVCIa","u2fqrLi","yw5ZzM9YBvq","D3jPDgu","uvPLEgC","x2LUDgvYDMe","tw9KDwXL","ywrK","zNrvzNy","t2L0wge","vKvdBNu","qMTovw0","uxPmwgS","x2nVBM5Ly3q","u1rcue0","DgLTzw91DcW","Ec1TC2CTy3u","C2v0q3vYC28","t2Tpy2i","twLZC2LUzYa","qNjPzgDL","rvvPEgi","zu9Ks3O","v1bYELq","ywnRx2LK","tMHZrvm","zgLZCgf0y2G","ChjVDg90Exa","zw5JB2rLrNi","AgfZ","Ae1LC3nHz2u","BfPKCLm","txnctNK","wLDrthi","DgzJvu4","ig1LC3nHz2u","q2HnAvu","sMPqBLq","sKHyrLm","vwLns2i","uevsCuS","y29Uy2f0","wuXnvhi","zuLJz3O","BNrSqM8","BKnKqMy","CM9YrxzLBNq","C2v0u3rVCMe","AwXLx25HBwu","tKTPzhq","B1j2BMe","oxvHCg1qsq","EwLOB3a","DhvZDem","BxngEfG","Aw1LCYbPBIa","zwn0","CvnMzfK","qMrQDM8","Cw1zCNG","t0PMtNa","CKPZzvK","Axz4EuS","zhzbB0C","m3W4Fdb8n3W","zgHiA0O","A3bAALa","x2LZqNjVD3m","zu9PCNC","twrmBgC","vurzuLa","Dg9oDw1Izxi","z2v0q3vYC28","y2XVC2u","AvD5uvK","EfngB04","zvDnCwG","z2v0t3DUuhi","reiGzMfPBgu","rLLeBui","wwH4zeS","sevhqLa","shH0twu","CuXbD3G","zxDTBvC","ChLwAMe","wgDYrM8","CeHiC1a","EgTPEeG","ug9At0e","vLb6EuK","y29UDgv4Da","vwTNCg0","BwLUAvbYB2C","vgvhy1C","qwTkt08","DfDAA1C","CMLLC0nVDw4","tun0t0e","whbhChC","DNr2Deq","BgvSyMO","C0Xf","BwvY","BwvZC2fNztO","x2rLC3rYB3K","BxjrtvO","x3vYBa","sfLVqKe","y2HLy2Tszwe","D3LeBKG","x29UrxjYB3i","x3bYzwzPEa","uKfmqva","x2LUAxq","B2zMBgLUzq","yK9sCg0","D2LSBfjLy28","q0LqBwe","mtaYodi0oe10zhvwua","zgnQBKy","CNnVCL92ywW","rLjSvue","yw1LoIa","lcbxzwjtB2m","DMTxDNq","BxnNsuq","zNvUy3rPB24","zufJAW","Dw50","tePvqNi","z2v0q3vYCMu","B3LPBNq","sLPKCgm","B3bLCNr5","Cg9PBNrbBMq","v0DWtwW","zMDSuhy","ywjVCNq","x2LZv29YA2u","uK5Hz2O","wLDMAeG","AwDHDg9Yt24","EKX1r1i","CM92AwrLige","Aw5JBhvKzxm","x3jLy29UBMu","ywr2yw5Jzq","EfvZzuvUDG","wuPutKK","r2XvDeK","zNjVBuj5Dgu","rgvKAwnHDgu","wujOAvO","Dwr0y2W","CMvHzhLtDge","yvnWz1u","DgLTzw91Da","BwvZC2fNzq","wMLdEee","q1v1yKe","BgrlEwy","l3DZl3yY","ywHbDgu","r2XpEKm","zNDftLC","vw5Oyw5KBgu","ENbss24","C0nVDw50zxi","yNzwyMi","uKHOwhm","vfjLB1O","x3bPBMC","D1nwuuG","wgrlBgK","tev2u1i","z2vtEw5J","x21PBMLoyxy","DMfS","zw1LBNq","vgnfzxq","x2LUAxrhBg8","zNjVBuHHC2G","x2rLyNvN","zw50tgLZDgu","AxPOsLq","ywXty29Wzq","rhD2B2W","tMDWAgG","uwjkrui","uM9syu8","t3jAs3O","DhLWzq","AeL0rhu","u0nAC0i","CMvXDwLYzwq","y3vYC29Yx24","zxjYtxnN","zLP3EhC","wvvXExC","uMfwBKi","wurRuhu","uMTktxe","rg9Lz3y","yMfXAgO","C3Pgv2S","BM93","Ahr0Chm6","s05Qy3G","DeLAv2W","zuPLuem","ywXSzwqGBxu","DeDhBuO","zMzLCG","t292BvG","CMvZDwX0","yM9KEq","Ae9Wzw5fDMu","y3jLyxrLt2i","zg5uq04","ALr0CKS","Auv5wNO","zuX4C1y","yNL0zxm","v2LUzg93","DLnpCeC","DKDRAfC","y3vYC29YlNm","CvDsDhm","C0XPC3rLBMu","vhHgreS","x2rItMfTzq","tg9NsurozxC","C2DPza","y3vZDg9Tshq","yufRqMW","Awr6CxK","zMzmAw5L","qMTgvgq","A2v5CW","ihjLy29UBMu","yMfJA3vWigu","shrzwhK","y2XLyxjtDg8","Cgf5Bg9Hza","zxj2AwnL","ywXPzcb1CMW","zfDTtMi","y3vYCMvUDeu","x3nLCuLK","AgL0zeS","yxKSig5LDhC","CMvWBgfJzq","q2Pms0u","wvLhwfq","ihrPBwvZ","C2v0zgi","yxHqqK8","yxbWzw5Kq2G","BMvJDa","B3jRig9MzMW","zMLSDgvY","C3nHz2vfDMu","y1fRyuW","z2v0u3rVCMe","ihrYEsbYzwm","y0PyC3a","C1nOr2u","zv9ZDwnJzxm","x2HHBMrSzvi","BIWGAg9ZDg4","wK5dvNG","s3vns2u","C0TgD3m","r0zerMO","rMHArfe","CMvHC29U","Dw5RBM93BIa","yMzbELy","yuPRu3m","uNbpuue","DMvUDa","AenSB3nLrxy","sxHbyMm","CgfYC2u","m3WYFdr8mxW","ANHvtui","z2v0","BwLUzW","CMvJB25Uzwm","rvvztvy","rg1kBhm","B2nRzxrgywK","BfjvEe4","CLfzywC","B2nRzxrtDwm","vgrzr0W","tgLZDgvUzxi","CMTLCKDSB2i","x3bYB3rVy28","qwLQA3q","Cw1Lv1C","BM5hAue","zgLZywjSzue","ywnOzwq","BMfTzq","DMvYC2LVBMm","yNvMzMvY","CgXLyxnLiha","B25mAw5L","zu5cD2G","C3HUDva","y1rNs08","t1bftG","AgfUz2u","yKTbqMW","x2n1CNnVCKy","q29UzMLN","rvjrww4","rKDkwxu","sfjcwKu","v25zC3i","CwDKEMK","zwTiAKy","Bg9IywXty28","DKjYBwm","v05QBxG","sK1nvKm","zxjFDhrS","u1HPveq","y1b5t3i","qMXxqxq","Dhj1y3rVCIa","uwfMvvm","CMT0vvK","DhDVCMTdAge","zxflELu","wwLIwfe","t3ftEwm","y2HLy2TdDxi","z2v0qwXSs2u","Cg9PBNrdB24","s0zdCfa","ExrKuuS","ChrVCG","D2r0s1a","yLLtzhy","zgvMAw5Luhi","rwvvtNK","yMLUyxj5vhK","yw1QrNq","wwzPwvG","z2vY","rLL6rNq","CxbHru4","vfvpAxq","sgfOzKe","mZm5otC0n3LmzhnRvW","ywDLrxzLBNq","AvDvvM8","shPSzvq","txDNtgC","B2jQzwn0u3q","DxrVuMvJB24","CMvHzg9UBhK","ru1qwwK","BLfYD00","tMHVExq","CNn3yMK","Ahn3rNK","C2vUza","x1fVu01HBMe","x29Uq2XVC2u","EwXjvfq","uu9LsNy","tMTSCuq","zNjVBNrPzxi","r1HIr0i","wu9Nug4","tKfusvzfx0u","y3ruAw1LB3u","x0rctMfTzq","rgHts2W","wMvRqNe","rM1HyMe","C3vIyxjYyxK","vKXez2y","t3L6rwu","zgv2AwnLx2K","mNW1Fdn8nhW","s2v6twS","mxWZ","tvHwA3K","sK1Pru4","DK9mEeq","wgPRyKm","zMX1C2HfEha","Avb6shO","sLnptLa","C2v0sxrLBq","ChD5wNm","BvntvfK","r2HsA2K","tLDVA1u","zNjVBujPDhm","mxWYFdr8nNW","EuzsreK","qwHAD3a","CLzbDgq","igfYCMf5yNu","uxDLsMq","DhrUvwO","qwXWAKO","tLPKwNC","zu9xENa","qNr6y0u","r3fKDKG","s1HxBMy","wKPXvum","AhH5rMG","yNDXy2u","v1vxwKW","BhrPCgXLihq","zMLSzw5HBwu","Dgv4Dc9Qyxy","v3nNCxq","rfbNvfO","uuDLu2S","qxnmv3K","uNLNseS","CgLUz0LUDgu","t0Xbs04","v1LNEwG","EwPxzfy","vMLSzha","De1HBMfNzxi","y2H6q0C","Dgj5C0K","ihrPBwvVDxq","sg9PAgW","A25rB04","quD2sKK","DeLK","txjztLG","Cgf5Bg9Hzfq","rujsswW","mxWWFdr8m3W","ze1ZrhO","rKXfuuK","ChbL","n3W1Fdb8mxW","uwP2u3e","CeTIzuG","vhrKsKC","v0LLAwG","vw1NAfu","C0v2sKe","tNzxAwS","y3r4rgG","CKPjCvC","u2LwEwC","DgvZDa","zwrPyxrLBhK","y2XVC2veqG","wenJvw8","CMfTugfYyw0","EeHgruG","B1z5Chm","u2zjv0u","ANbNEgO","vhLKENC","yxv0BW","BfrPBwvVDxq","BKXPBMu","zhP3uLO","DhnRrhG","y3vYC29Y","wMnTqwq","Cw9Zx18","EKjVCva","BMCGzMfPBgu","B25JBg9Zzq","yLDvAum","DNPvrhy","B25VCgvU","y29Kzq","C2XPy2u","sgLrEwq","sKXLyMS","Dg9iyxnO","zNfwq3O","y3jLyxrLrxi","A2v0ignVBNm","DvbNDxG","DwnACeG","rfDzCLu","lcbTyxGGCMu","yxnZAwDU","CwzcCMu","AxjLza","x2vUzhbVAw4","z0vMAwu","zvvYBa","CNHSrKu","wNbjz3y","uNDusvO","zxjYtM8","BeHHBMrSzxi","sgPUDhK","sNzTuhy","wMTWAMG","m3WXFdj8nhW","Dg9cExrLC0i","DxbKyxrLq3u","mtmWmdy2mffIChPtqq","igzPzwXKoIa","y09Wzw4","Aw5Lza","zMLN","zxjHDg9Y","zNrJuwG","AxnrB1nby2S","DNHPqKG"];return Sn=function(){return r},Sn()}Ee.d=(r,e)=>{let i=P;for(var a in e)Ee.o(e,a)&&!Ee.o(r,a)&&Object[i(1588)+i(1375)](r,a,{enumerable:!0,get:e[a]})},(()=>{let r=S;Ee.o=(e,i)=>Object.prototype[r(833)+r(1375)][r(1236)](e,i)})(),(()=>{let r=S,e={uyooo:function(i,a){return i!=a},iTeAu:r(399)+"d",gyGLK:"Module"};Ee.r=i=>{let a=r;e[a(1064)](e.iTeAu,typeof Symbol)&&Symbol[a(846)+a(959)]&&Object[a(1588)+a(1375)](i,Symbol["toString"+a(959)],{value:e[a(512)]}),Object[a(1588)+a(1375)](i,"__esModule",{value:!0})}})();var $={};(()=>{let r=S,e={LhrRr:function(s,t){return s+t},SJFnW:function(s,t){return s*t},VPzyI:function(s,t){return s+t},JzRPM:function(s,t){return s(t)},rAhZF:function(s,t,n){return s(t,n)},uRKpu:function(s,t){return s(t)},zPRsg:function(s,t,n){return s(t,n)},QzLXk:function(s,t){return s(t)},QOhLQ:function(s,t){return s+t},NKidt:r(689),uRItW:function(s,t){return s!==t},XVQrX:r(1583),YymFh:r(903),RzBKe:function(s,t){return s>t},ozMho:function(s,t){return s<t},ftaio:function(s,t){return s-t},zpgTv:r(564),OLAKN:function(s,t){return s-t},cCchm:function(s,t){return s===t},HGTzY:function(s,t){return s<t},oIsBT:function(s,t){return s|t},qpaEN:function(s,t){return s<<t},axPBO:function(s,t){return s<<t},fAQmS:function(s,t){return s&t},stPRV:function(s,t,n){return s(t,n)},aHuQH:function(s,t){return s>>t},avKOu:function(s,t){return s===t},nvOoE:r(1382),xiGob:"ysKVA",trIUv:function(s,t,n){return s(t,n)},nnGiA:function(s,t,n){return s(t,n)},QbJEB:function(s,t){return s===t},zBoqP:r(1667),vSOpG:r(1302),lXpSg:function(s,t){return s>>>t},mvQxF:function(s,t,n){return s(t,n)},ZWxIc:function(s,t,n){return s(t,n)},Oomfh:function(s,t){return s===t},GQoPJ:r(1260)+r(1436)+r(1756)+r(736),anSTG:function(s){return s()},YXkPb:function(s,t){return s(t)},vqWIZ:function(s,t){return s>>>t},cQkaL:function(s,t){return s&t},BvtnQ:function(s,t){return s>>>t},EuYOi:r(545)+"s alread"+r(856),cCUEe:function(s,t){return s===t},HEGBP:r(1160),RNagj:function(s,t){return s!==t},RpyOS:"mwltf",UDYRP:r(1559),PJPeZ:function(s,t,n){return s(t,n)},riorE:function(s,t){return s!==t},lelbj:function(s,t,n){return s(t,n)},eBsEJ:function(s,t,n){return s(t,n)},eqKzU:function(s,t){return s(t)},tustC:function(s,t,n){return s(t,n)},SXiTD:function(s,t,n){return s(t,n)},tbysI:r(542),TxFDK:function(s,t,n){return s(t,n)},KNjcx:function(s,t,n){return s(t,n)},IeRWS:function(s,t,n){return s(t,n)},cAeco:r(1444),MuKdv:r(757),skiyx:function(s,t,n){return s(t,n)},UGuHM:function(s,t){return s!==t},kjohb:function(s,t,n){return s(t,n)},WlznC:function(s,t,n){return s(t,n)},hitdK:function(s,t,n){return s(t,n)},JVJkD:function(s,t,n){return s(t,n)},CUubA:function(s,t,n){return s(t,n)},mIjOF:function(s,t,n){return s(t,n)},KoVFa:function(s,t){return s>>>t},OPRak:function(s,t,n){return s(t,n)},vZGZT:function(s,t){return s(t)},sbJzy:function(s,t,n){return s(t,n)},LySxt:function(s,t,n){return s(t,n)},HZCMr:function(s,t){return s(t)},GwXQm:function(s,t,n){return s(t,n)},JjPnT:function(s,t){return s(t)},CUWCr:function(s,t,n){return s(t,n)},OZJSO:function(s,t){return s===t},uGgkX:r(1260)+r(1436)+" field: "+r(1033),LPrWy:r(1260)+r(1436)+r(1756)+r(834),KcRwp:r(1260)+r(1436)+r(1756)+"service",UpIcY:r(1260)+r(1436)+r(1756)+r(1825),QweJd:"close",CeKOF:r(496),nxFxk:function(s,t){return s+t},RzJSz:function(s,t){return s&t},ChMiU:function(s,t){return s(t)},iFZQm:function(s,t,n){return s(t,n)},Sgbod:function(s,t,n){return s(t,n)},qSfdY:"Unimplem"+r(755)+r(894),bYSdv:function(s,t){return s>=t},tdmsk:function(s,t){return s>=t},IGjqQ:function(s,t,n,o){return s(t,n,o)},JGKIX:function(s,t){return s+t},udtcl:function(s,t){return s!==t},oUhaG:r(1815),xqpUU:r(702),rdUBS:function(s,t){return s===t},cljUJ:function(s,t){return s+t},bwqce:function(s,t){return s>=t},lTulI:function(s,t){return s<t},rKGLW:function(s,t){return s|t},oabcG:function(s,t){return s&t},UIsjr:function(s,t){return s>=t},Dwvol:function(s,t){return s>>t},dkZjV:function(s,t){return s===t},kAwoe:r(442),JMMVC:function(s,t){return s>t},JLebk:function(s,t){return s>t},mtJCb:"Read past limit",baCTY:function(s,t,n){return s(t,n)},mSSTY:function(s,t){return s+t},LTfYC:function(s,t,n){return s(t,n)},yKQkE:function(s,t){return s&t},Qelzm:function(s,t){return s+t},ceqwF:function(s,t){return s&t},EGBrn:function(s,t){return s==t},WEbAC:function(s,t){return s+t},eOirw:function(s,t){return s+t},TlErm:function(s,t){return s+t},AFGBc:function(s,t){return s!==t},DRgNF:function(s,t){return s|t},RHhXs:function(s,t){return s<<t},SiVyg:function(s,t){return s|t},JMCpP:function(s,t){return s&t},bKvfH:function(s,t){return s&t},NhsES:function(s,t){return s&t},OitXa:function(s,t){return s<=t},tnRIp:function(s,t){return s&t},MCtOA:function(s,t){return s+t},AGvJI:function(s,t){return s+t},QNjAj:function(s,t){return s+t},QrUOq:function(s,t){return s!==t},LqcvF:function(s,t){return s<<t},sCrHi:function(s,t){return s<<t},qurVK:function(s,t){return s&t},uIGoH:function(s,t){return s>=t},Ivgth:function(s,t){return s+t},bgChg:function(s,t){return s-t},dfVbW:function(s,t){return s+t},rLDuy:function(s,t){return s<t},TpzjH:function(s,t){return s>=t},xSewm:function(s,t){return s<=t},yosjb:function(s,t){return s<t},hGbFg:function(s,t){return s+t},NZdZw:function(s,t){return s<t},JwNrw:function(s,t){return s|t},tBbjw:function(s,t){return s&t},PoZOA:function(s,t){return s<t},JHXFS:function(s,t){return s&t},azCYd:function(s,t){return s|t},OvgOA:function(s,t){return s>>t},oyint:function(s,t){return s&t},zxiRw:function(s,t){return s&t},qmeWW:function(s,t){return s>>t},YJTNI:function(s,t){return s&t},JSZWe:function(s,t){return s>>>t},TUOit:function(s,t){return s&t},FemAY:function(s,t){return s>>>t},vOLxD:r(619),yMBaA:function(s,t){return s<t},VzNIn:function(s,t){return s+t},Ocqbu:r(825),xSFoN:r(1263),EUixb:r(631),iaJts:function(s,t,n){return s(t,n)},iWUVo:function(s,t){return s<<t},rktUY:function(s,t){return s&t},Hjnty:function(s,t){return s&t},MdLlg:function(s,t){return s&t},RhWCZ:r(1016),uRZCb:r(533),Hoihl:function(s){return s()},WWkaa:r(516)+"or",rRNNG:function(s,t){return s&t},dvAoG:function(s,t){return s&t},hfVEO:function(s,t){return s<<t},jaSrW:function(s,t){return s&t},IxUTz:function(s,t){return s&t},dJmFc:function(s,t){return s&t},JMiEN:function(s,t){return s<<t},OJfNp:function(s,t){return s&t},alLWk:function(s,t){return s&t},pQUHl:function(s,t){return s<<t},FmPtZ:function(s,t){return s&t},wnkAQ:function(s,t){return s&t},dzwRZ:function(s,t){return s|t},yPUfn:function(s,t){return s>>>t},RuAQU:function(s,t){return s>>>t},plhXI:function(s,t){return s|t},BlWAt:function(s,t){return s>>>t},iSTYg:function(s,t){return s<t},AVFzs:function(s,t){return s<t},cZaAN:function(s,t,n){return s(t,n)},Hosuc:function(s,t){return s&t},eORte:function(s,t){return s+t},HvRni:function(s,t){return s|t},hARBm:function(s,t){return s>>>t},LPcKC:function(s,t){return s+t},GqdvH:function(s,t){return s!==t},ZvJtS:function(s,t){return s|t},iCnyD:function(s,t){return s&t},bgTpz:function(s,t){return s>>>t},NsOPs:function(s,t){return s>>>t},uCKFQ:function(s,t){return s+t},cDLdO:function(s,t){return s!==t},aJqll:function(s,t){return s+t},lGMbO:function(s,t){return s>>>t},iWyQY:function(s,t){return s!==t},LqIdV:function(s,t){return s|t},TcEet:function(s,t){return s>>>t},uPgux:function(s,t){return s&t},KQwzK:function(s,t){return s>>>t},HEJUR:function(s,t){return s&t},YfJKs:function(s,t){return s|t},HzleT:function(s,t){return s&t},PERqK:"RNGjT",digvv:r(466),FhZDQ:function(s,t,n,o,c){return s(t,n,o,c)},RSkBe:function(s,t){return s(t)},bZzVi:function(s,t){return s!==t},xwpYT:r(1689),lJNHr:"QyQDm",AFxaG:function(s,t){return s|t},wukPG:function(s,t){return s<<t},YUqyw:function(s,t){return s<<t},Lonsx:function(s,t){return s|t},fqVCz:function(s,t){return s<<t},gNXlH:function(s,t){return s===t},RPRfS:function(s,t){return s|t},yaerY:function(s,t){return s<<t},WUWZL:function(s,t){return s<<t},lPxdZ:function(s,t){return s<<t},bWUiC:function(s,t){return s>>>t},HuHjX:function(s,t){return s|t},YDkPu:function(s,t){return s|t},qfBre:function(s,t){return s|t},otULm:function(s,t){return s>>>t},MsBNy:function(s,t){return s&t},vCmPm:function(s,t){return s&t},HjOEK:function(s,t){return s>>>t},fWUmI:function(s,t){return s<=t},sRaYo:function(s,t){return s>=t},tWZkW:function(s,t){return s|t},WKxdv:function(s,t){return s%t},OqyMG:function(s,t){return s|t},aWDVg:function(s,t){return s/t},eFZCN:function(s,t){return s!==t},YYGXT:function(s,t){return s>>>t},iUmQc:function(s,t){return s*t},gMdaj:function(s,t){return s(t)},oVyps:"ROGrF",kaFbI:r(1616),NUEGi:function(s,t){return s===t},WjGor:function(s,t){return s&t},Zkpjh:function(s,t){return s>>>t},ZVplU:function(s,t){return s&t},Idjoh:function(s,t){return s>>>t},pNEJk:function(s,t){return s+t},ksOQA:function(s,t){return s>>>t},Avoye:function(s,t){return s+t},hcQaZ:function(s,t){return s>>>t},idzqy:function(s,t){return s+t},lTPzo:function(s,t){return s|t},Sylmt:function(s,t){return s!==t},pZPOf:function(s,t){return s===t},bnsyb:function(s,t){return s>>>t},xJvZG:function(s,t){return s===t},ZNDUj:function(s,t){return s===t},kiapQ:function(s,t){return s+t},knRMT:function(s,t){return s>>>t},ZLVqe:function(s,t){return s&t},nBvHl:function(s,t){return s>>>t},JQniX:function(s,t){return s>>>t},VfNmM:function(s,t){return s&t},sEvJA:function(s,t){return s&t},XjkbC:function(s,t){return s&t},xGioe:function(s,t){return s&t},vkpYd:r(1007)+r(1226),WusSK:r(1786)+r(981),RXbhs:r(395)+r(1213)+"R",aSpgU:r(1620)+r(1013),HRBZE:r(1137)+"OR",XEYcY:r(1123)+"ERROR",cfaqI:r(555)+r(896),wYgjw:"4|2|3|1|0",Ngphh:function(s,t){return s>t},pwyZs:r(1901),HYbQV:function(s,t,n){return s(t,n)},tfcUN:function(s,t){return s!==t},KNASK:r(1460),keLCn:r(462),yjQym:function(s,t){return s===t},UZuKz:function(s,t){return s-t},aYjly:function(s,t){return s===t},QqeuL:function(s,t){return s instanceof t},mGDMl:r(1407)+r(1118),XKzdM:function(s,t){return s+t},FDUEa:r(1439),rsBWX:function(s,t){return s===t},dPimd:r(1206),jMXyg:r(1800),NAQzE:"DaPvT",mqMMV:"message",YBhiZ:function(s,t,n){return s(t,n)},KuybI:function(s,t,n){return s(t,n)},qLAwx:function(s,t,n){return s(t,n)},rsyIF:function(s,t,n){return s(t,n)},dOghM:"geVgS",hItDu:r(1627),SCZsB:function(s,t){return s||t},ttnUj:function(s,t){return s||t},HqzLp:r(1526)+"0",wXUWN:function(s,t){return s||t},lsGwc:function(s,t){return s!=t},CISfi:"undefined",yVBBj:function(s,t){return s<=t},Scxza:"next() c"+r(1452)+r(1663)+r(1296)+"process",IJmdG:function(s,t){return s===t},NKawa:function(s,t){return s+t},aOrDI:function(s,t){return s<t},Annwl:function(s,t){return s===t},OXRXI:function(s,t){return s<t},OkhLy:function(s,t){return s-t},glwqU:function(s,t){return s<=t},GXbGB:function(s,t){return s>=t},msFxX:function(s,t){return s<t},uNRwq:function(s,t){return s|t},uwHGf:function(s,t){return s<<t},lEHtA:function(s,t){return s|t},tQNUH:function(s,t){return s&t},asdTN:function(s,t){return s|t},iEyZz:function(s,t){return s<<t},cdAzB:function(s,t){return s<<t},adpaz:function(s,t){return s&t},lMNdV:function(s,t){return s+t},csYhO:function(s,t){return s+t},DhSKl:function(s,t){return s&t},wSVQH:r(551),lRUxN:function(s,t){return s(t)},Nneem:function(s,t){return s!==t},ekHjF:function(s,t){return s<t},ZmDaV:function(s,t){return s|t},vkWvt:function(s,t){return s===t},cTgKO:function(s,t){return s&t},GpaEk:"4|2|5|0|"+r(1632),RAzuB:function(s,t){return s|t},hxyFh:function(s,t){return s>>t},XydME:function(s,t){return s&t},FGJYu:function(s,t){return s+t},VdreU:function(s,t){return s|t},EsnIh:function(s,t){return s&t},Xzcri:function(s,t){return s instanceof t},jgBUt:function(s,t){return s instanceof t},OaLAW:function(s,t){return s!=t},fTjiG:function(s,t){return s==t},mcfft:"text/pla"+r(859)+r(1818),fjQTz:r(1851),gJghb:r(1247),nqchS:"__esModule",ydoSo:function(s,t){return s===t},NGYFc:r(905),OJzux:function(s,t){return s<t},ZbsVA:function(s,t){return s+t},jxUMB:function(s,t){return s(t)},opAkW:r(1518)+"reason",TiRHO:r(639),fMYhO:r(1054),GOuCZ:r(738),bOLnI:r(1665)+"ascript",QafUS:"&jscallback=frontierJSONP",YfiYX:"TWBVh",KXWnf:r(1029),IANmp:r(1735),nnhZr:r(1463),RkJMq:r(717),vbpQi:r(726),HYoBA:function(s){return s()},twoSS:function(s,t){return s===t},baTyi:r(1488),gXjKv:function(s,t){return s===t},JxNAu:r(449),OOQot:r(697),WnYsr:function(s,t){return s===t},AkOPB:function(s,t){return s in t},ctxDh:r(1865),PUUZo:function(s,t){return s===t},ajIdG:r(1567),DRbXC:function(s,t){return s||t},jJoom:function(s,t){return s||t},RaVnB:"4|2|1|0|3",OYgEZ:function(s,t){return s!==t},yaLJU:function(s,t){return s||t},sHLuK:function(s,t){return s||t},IxAbc:function(s,t){return s(t)},FpYXY:function(s,t){return s!==t},LftnU:r(612),MgTPf:function(s,t){return s||t},OkOcb:"ymSim",wMadp:"xwCcR",XdKli:function(s,t){return s||t},KuMKe:r(996)+r(1319)+"d",WPrzT:function(s,t){return s*t},ALVoY:function(s,t){return s!==t},PdSBT:r(1467),JHYGo:function(s,t,n){return s(t,n)},JjVpo:"qos",nPzWu:r(1158)+"id",Moznm:"OmTDa",EhelM:function(s,t){return s(t)},IPXAx:r(885),izhJT:r(1201),ZTSBr:function(s,t){return s(t)},FUOsO:r(715)+r(1232),grjWk:r(715)+"er_qos_ack",jRnqY:"x_frontier_is_ack",HbOOs:"x_frontier_ack_m"+r(1474),cQlgs:function(s,t,n,o){return s(t,n,o)},ewmmW:"is_ack",GhRki:function(s,t){return s&&t},CIPma:r(1265),emwGa:"ack_code",ftUfv:function(s){return s()},ZcmAd:function(s,t){return s(t)},jxwqa:r(1728),DlyBC:r(752),Oiput:"application/json",VTHdp:"application/json"+r(667)+r(1031),rlksM:r(535)+"e",cJXsp:r(520),YOgPn:function(s,t){return s(t)},jWaHJ:function(s,t){return s+t},EOPUq:function(s,t){return s|t},CGtRp:r(1724),SElGD:r(630),RynrW:function(s,t){return s>>>t},fKvJH:function(s,t){return s(t)},GyJCA:function(s,t){return s+t},AlpjJ:function(s,t){return s+t},tAVjS:function(s,t){return s+t},VHsas:r(465),JqciA:r(1005),yJVhE:function(s,t){return s+t},BkFTd:r(531),DZGxx:function(s,t){return s>>>t},ghQoQ:r(992)+"1",hHwve:function(s,t){return s+t},domhM:function(s,t){return s+t},qRnzy:function(s,t){return s+t},MoGHH:function(s,t){return s<t},jFYng:function(s,t){return s|t},EJHDO:function(s,t){return s+t},YoiqP:function(s,t){return s+t},wjtno:function(s,t){return s+t},xoUPL:function(s,t){return s<<t},ovOlG:function(s,t){return s+t},RoRaO:function(s,t){return s+t},rHGhi:function(s,t){return s+t},SyTdW:function(s,t){return s>>>t},qYYVI:function(s,t){return s&t},OSdxF:function(s,t){return s>>>t},seQiu:function(s,t){return s+t},ELuwT:function(s,t){return s&t},tkYyk:function(s,t){return s>>>t},lAVmG:function(s,t){return s+t},KQpSa:function(s,t){return s&t},YhxdK:function(s,t){return s>>>t},TeGcW:r(1363),pnziH:function(s,t){return s+t},dbNHp:function(s,t){return s+t},Aijkt:function(s,t){return s&t},LsWgr:function(s,t){return s>>>t},ZKwcd:function(s,t){return s&t},sKFws:function(s,t){return s&t},OYrls:function(s,t){return s|t},CZpya:function(s,t){return s>>>t},qEfiB:function(s,t){return s<t},MCSrD:function(s,t){return s|t},puHMC:function(s,t){return s!==t},pyVja:function(s,t,n,o){return s(t,n,o)},fDlIQ:function(s,t){return s===t},emoUJ:"xAfRD",QjvSq:"BRTTL",cyyND:function(s,t){return s(t)},MXVky:r(1305)+r(1646)+"10|5|9",PQMIr:r(1010),SxOcG:"service",aAkBl:r(1468)+r(1486),KMJWP:function(s,t,n,o){return s(t,n,o)},JHQyB:function(s,t,n,o){return s(t,n,o)},kvcDj:r(1107),rsYKr:r(1705),EyXNV:r(1204)+r(1289),JVUZW:"success",jFnEW:r(1238)+r(632)+"t",NvWik:function(s,t){return s<t},KZVFW:r(696),OrZKz:function(s,t){return s+t},QYRLx:r(1182)+r(729),WMasM:"cursor_name",rpLrH:function(s,t){return s(t)},qbBdr:"ping_onc"+r(1509)+"s",EKfsD:r(951),AmHRd:"vgmmj",FVBKE:"allCurso"+r(1821),RdYVE:r(1068),KzHNC:"INSTANT",vYpLc:r(772),IEkiK:r(1497),baqhj:function(s,t){return s(t)},DWYrU:"setcursor",xRyJa:function(s,t){return s>=t},WGpMl:function(s,t){return s===t},UrJhm:function(s,t){return s===t},fJveY:r(391),JIWER:r(565),UNgmt:r(573),qPLCJ:function(s,t){return s||t},Wsgqt:r(674),ojWZJ:r(845),cBAts:r(843),mwWXt:r(1687)+"2",cPyOr:"yoFVf",SaPFR:r(1019),nCdBf:function(s,t,n,o){return s(t,n,o)},ZpIgv:r(1726),mxMnn:function(s,t,n){return s(t,n)},ossck:r(715)+r(409),zLuGR:r(715)+r(1569),qfmQj:"x-msg-qos",OovmX:function(s,t,n){return s(t,n)},bALZL:r(1257)+r(1362)+"ue",Ghjhz:function(s){return s()},arCBp:function(s){return s()},mDsYa:function(s){return s()},HahfA:r(1356),vWiTx:r(616),hFHyy:function(s,t){return s===t},NhIhY:r(1272),rVewC:r(1750),EHikP:function(s,t){return s===t},EUYMV:function(s,t){return s===t},NHZsP:function(s){return s()},voqmn:function(s){return s()},RfVdk:function(s){return s()},hamfW:function(s,t){return s===t},pHHsP:function(s,t,n){return s(t,n)},ZiCxA:function(s,t,n,o){return s(t,n,o)},RLmpN:function(s,t,n){return s(t,n)},eWMqh:"always",tVaAR:function(s,t){return s===t},spePX:function(s,t,n){return s(t,n)},fMite:function(s,t){return s|t},KLaaQ:function(s,t){return s>>t},Hqhgm:function(s,t){return s>>t},tIZWl:function(s,t){return s&t},amjFt:r(1157),DmJls:function(s,t,n){return s(t,n)},eOWzp:"arraybuf"+r(926),QKoLZ:"auto",ShQCX:r(1549)+r(676)+r(486)+r(1365)+r(1733)+r(1573)+r(1841)+r(1758),yjWdV:r(1530)+"t",wVPRn:function(s,t){return s===t},bfAzV:"lZPSf",PUEmD:r(1520),Ukgpm:function(s,t){return s!==t},BtPRO:function(s,t){return s!==t},PoIHf:r(1804),dCuHy:function(s,t){return s==t},EyBKU:r(1448),LVElh:"wss://",PkQGu:r(1136),tnucL:r(764),yFRDI:r(1629)+"d",jUzRe:function(s,t){return s||t},NGFiD:"please provide b"+r(686)+r(580)+r(1022),Jgwdi:"function",PXQmB:r(721),tcVxy:r(1053)+"0",jTtrK:function(s,t,n){return s(t,n)},qwQqu:r(540),cnagu:function(s,t,n){return s(t,n)},yihop:function(s,t){return s(t)},oAhWv:r(716)+">",OqSyc:function(s,t){return s*t},LCvVA:function(s,t){return s-t},POlCT:function(s,t){return s>t},xMzHE:function(s,t,n){return s(t,n)},GrLGk:function(s,t){return s!==t},VJRkt:function(s,t,n){return s(t,n)},fddPK:r(1002)+r(708)+r(1530)+"ting ser"+r(760),YgyaE:function(s,t){return s===t},lLHqp:r(961),iPzHz:r(1256)+r(1506)+"onnecting",KezMk:"open",XJQQU:function(s,t){return s!==t},Fofiv:r(1082),YLMTr:r(607),VltzS:function(s,t,n){return s(t,n)},zpRKn:function(s,t){return s===t},QCBLj:r(1869),MCOqZ:function(s,t,n){return s(t,n)},eNBwh:r(1002)+r(1492)+r(1501)+r(445),SJnwz:"ack",DUfaG:function(s,t){return s===t},fUoIv:function(s,t){return s(t)},Dlqim:r(426),tskDx:r(1065),URGJp:r(644),PjPcd:function(s,t){return s==t},bvVbb:r(1549)+r(1385)+r(1776)+r(1829)+"a must be a stri"+r(912)+r(1650)+r(1454),uHTQk:r(1067),OEVZQ:function(s,t){return s instanceof t},MwgLg:function(s,t){return s instanceof t},xmVXT:r(1549)+"rovide a valid service",vIwQT:function(s,t){return s instanceof t},CaFUk:function(s,t){return s instanceof t},cTWWM:function(s,t){return s(t)},UBswp:"sent",Yhzcd:function(s,t){return s!==t},KdgvM:"rTnCp",ftcQh:r(460),nZAih:function(s,t){return s||t},AEYlX:function(s,t){return s==t},QPsIk:function(s,t){return s!==t},vVpuY:r(614)+r(857)+r(615),PyANF:r(887)+"4",ztDqS:r(1354),FYDmB:"timeout",EBRIl:function(s,t,n){return s(t,n)},KDyom:r(1378),HmHNG:r(690),szihn:function(s,t){return s*t},NWokU:function(s,t){return s!=t},ZoNCt:function(s,t){return s===t},kITlB:r(1465),rHbgb:function(s,t){return s!=t},BcEpQ:function(s,t){return s!=t},SwWJD:function(s,t){return s!=t},ZWQLr:r(869),RPRaO:r(1393)+r(1192)+r(1565)+"pe",kpZjP:function(s,t){return s!=t},XsaQV:function(s,t){return s==t},tOdjY:function(s,t){return s!=t},XhUeO:"ServiceWorkerGlobalScope",AhZwp:function(s,t){return s!=t},qjKKt:r(1219)+r(1719)};Ee.r($),Ee.d($,{FWS:()=>Ma,CustomErrorEvent:()=>rs,createCloseEvent:()=>pe,ReconnectEvent:()=>ns,createErrorEvent:()=>ue,decodedFrame:()=>Qr,createOpenEvent:()=>xs,CustomCloseEvent:()=>ss,createReconnectEvent:()=>Qn,FrontierMessageEvent:()=>os,encodeFrame:()=>$n,createMessageEvent:()=>cs,OpenEvent:()=>as,ErrorCode:()=>Fe,Event:()=>rt,MessageEvent:()=>is});let i="";function a(s=""){let t=r,n="02",o=""+Date.now(),c=i||(i=m(s)),f=Math[t(1012)]()[t(846)](16)[t(1727)](-6);return e[t(804)](n+o+c,f)}function x(){let s=r;return e[s(804)](1e4*Date[s(1447)](),Math[s(600)](e[s(1047)](1e4,Math[s(1012)]())))}function u(s){let t=r;return e[t(1331)](e[t(598)](Array,8)[t(1775)]("0"),e.rAhZF(parseInt,s,10)[t(846)](2))[t(1727)](-8)}function d(s){let t=r;return e[t(1331)](e[t(485)](Array,4)[t(1775)]("0"),e[t(593)](parseInt,s,2)[t(846)](16))[t(1727)](-4)}function h(s){let t=r,n=s[t(862)](/\./)[t(725)](f=>u(f)),o=[];return o[0]=e[t(1253)](d,e[t(464)](n[0],n[1])),o[1]=e[t(1253)](d,e[t(464)](n[2],n[3])),[e[t(1290)],e[t(1290)],e[t(1290)],e[t(1290)],"0000",t(1144),o[0],o[1]][t(1775)]("")}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}/.test(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?e.JzRPM(w,s):t(774)+t(774)+t(774)+t(774)}function w(s){let t=r;if(e.uRItW(e[t(1881)],e[t(1085)])){let n="",o=[],c=0,f=0,g=!0,p=e[t(1290)];if(e[t(518)](s.indexOf("::"),-1)){let l=s[t(862)]("::");for(let k=0;k<l.length;k++){let v=l[k];if(v[t(397)](":")>0){let A=v[t(862)](":");g&&(c=A[t(1843)]),f+=A[t(1843)];for(let T=0;e[t(1873)](T,A[t(1843)]);T++)if(A[T][t(1843)]!==4){let G=p[t(1125)+"g"](0,e.ftaio(4,A[T].length)),M=G[t(1282)](A[T]);o[t(483)](M)}else o.push(A[T]);g=!1}else{if(e.uRItW(4,v[t(1843)]))if(e[t(558)](e.zpgTv,"YHmso")){let A=p[t(1125)+"g"](0,e[t(1672)](4,v[t(1843)])),T=A[t(1282)](v);o.push(T)}else{let{type:A}=_0x4215b0;this[t(806)](A,_0xb3633e)}else o.push(v);g&&(c+=1),f+=1,g=!1}}let y="";for(let k=0;e[t(1873)](k,e[t(582)](8,f));k++)y=y[t(1282)](p);for(let k=0;e.ozMho(k,o[t(1843)]);k++)e[t(1221)](k,c)&&(n=n.concat(y)),n=n[t(1282)](o[k]);return n}{let l=s[t(862)](":");for(let y=0;e[t(792)](y,l[t(1843)]);y++){let k=l[y];if(e[t(558)](4,l[y].length)){let v=p[t(1125)+"g"](0,e[t(582)](4,l[y][t(1843)])),A=v[t(1282)](k);n=n[t(1282)](A)}else n=n[t(1282)](k)}return n}}else this[t(570)]&&this._socket[t(1314)]({code:_0x31da35,reason:_0x39a77f})}function b(s,t){let n=r;if(e[n(1198)](e[n(936)],e[n(682)]))_0x417983=e.oIsBT(e[n(668)](e[n(668)](e[n(1595)](7&_0xf7825c,18),e.axPBO(e[n(513)](63,_0x934929),12)),e[n(513)](63,_0xd67c70)<<6),e[n(513)](63,_0x39fe21)),e.ozMho(_0x14b0d0,65536)||e[n(518)](_0x4c76c0,1114111)?_0x1ad72b+=_0x49669b:(_0x10f74e-=65536,_0x192e16+=e[n(1890)](_0x21fa86,e[n(464)](e[n(1849)](_0x21b3ed,10),55296),e[n(804)](1023&_0xbbe878,56320)),_0x3ae52c+=3);else{let o=s[n(736)];e[n(558)](void 0,o)&&(e[n(773)](J,t,10),e.zPRsg(be,t,o));let c=s[n(405)];e[n(558)](void 0,c)&&(e[n(782)](J,t,18),e[n(1543)](be,t,c))}}function _(s){let t=r;if(e[t(1430)](e[t(1720)],e[t(1466)]))this[t(444)]&&this[t(444)][t(1611)](_0x509cca),this[t(1051)+t(1077)][_0x514e4f]=null;else{let n={};e:for(;!ke(s);){let o=U(s);switch(e[t(1784)](o,3)){case 0:break e;case 1:n[t(736)]=ye(s,e[t(598)](U,s));break;case 2:n[t(405)]=e.mvQxF(ye,s,e[t(485)](U,s));break;default:e.ZWxIc(ee,s,e.fAQmS(7,o))}}if(e[t(446)](void 0,n.key))throw new Error(e.GQoPJ);if(e[t(1430)](void 0,n[t(405)]))throw new Error(t(1260)+t(1436)+t(1756)+t(405));return n}}function C(s){let t=r,n=e[t(553)](oe);return L(s,n),e.YXkPb(V,n)}function L(s,t){let n=r;if(e[n(984)](e[n(1322)],e[n(1322)])){let o=s[n(1033)];e[n(1381)](void 0,o)&&(e[n(827)](J,t,8),bt(t,o));let c=s[n(834)];if(e[n(1381)](void 0,c))if(e[n(558)](e.RpyOS,e[n(1311)]))J(t,16),e[n(684)](bt,t,c);else{let M=this[n(1845)],X=this[n(821)];return[e[n(513)](255,X),e[n(513)](e[n(1784)](X,8),255),e.fAQmS(e[n(1784)](X,16),255),e[n(741)](X,24),255&M,e[n(1504)](e[n(1878)](M,8),255),e[n(513)](e[n(1878)](M,16),255),M>>>24]}let f=s[n(1231)];e[n(558)](void 0,f)&&(e[n(593)](J,t,24),e.PJPeZ(bt,t,le(f)));let g=s[n(1825)];g!==void 0&&(J(t,32),bt(t,le(g)));let p=s[n(934)];if(e.riorE(void 0,p))for(let M of p){e[n(1342)](J,t,42);let X=oe();b(M,X),e[n(593)](J,t,X.limit),e.eBsEJ(Ut,t,X),e[n(1577)](D,X)}let l=s[n(694)+n(1183)];e.RNagj(void 0,l)&&(e.tustC(J,t,50),be(t,l));let y=s["payloadT"+n(1114)];e[n(655)](void 0,y)&&(e.SXiTD(J,t,58),be(t,y));let k=s[n(1485)];if(k!==void 0)if(e[n(1221)](e[n(1678)],e[n(1678)]))e[n(1471)](J,t,66),e.KNjcx(J,t,k[n(1843)]),e[n(1140)](qt,t,k);else{let M=(n(1630)+n(1791))[n(862)]("|"),X=0;for(;;){switch(M[X++]){case"0":if(e[n(1198)](this._ws.readyState,this[n(946)])||this._ws[n(1396)+"te"]===this[n(1831)])return void this[n(1424)](e[n(898)]);continue;case"1":if(!this[n(444)])return void this[n(1424)](n(545)+n(387)+n(1015)+n(1839)+"ed");continue;case"2":this[n(398)+n(1133)]=!0;continue;case"3":this["_clearPi"+n(1190)]();continue;case"4":this["_dropGlo"+n(1774)+"Listener"]();continue;case"5":this[n(1021)+n(1344)]();continue;case"6":this[n(1612)+n(1593)]?.[n(1704)]();continue;case"7":this[n(1346)+n(786)+"t"](_0x13896d,_0x4ffc78);continue}break}}let v=s[n(1473)];if(e[n(558)](void 0,v))if(e[n(735)]!==e.MuKdv)e[n(1342)](J,t,74),e[n(601)](be,t,v);else return this._ws?this[n(444)][n(731)]:"";let A=s.serverTiming;e[n(1094)](void 0,A)&&(e[n(904)](J,t,82),e[n(401)](be,t,A));let T=s[n(1367)];e[n(1094)](void 0,T)&&(e[n(1491)](J,t,90),e[n(1857)](be,t,T));let G=s[n(482)+"e"];e.uRItW(void 0,G)&&(e[n(1401)](J,t,96),e[n(750)](bt,t,e[n(598)](le,G)))}else this[n(1787)+"ount"]=_0x3c3caa,this[n(429)]=0}function I(s){return R(q(s))}function R(s){let t=r,n={};e:for(;!ke(s);){let o=e[t(1253)](U,s);switch(e[t(698)](o,3)){case 0:break e;case 1:n[t(1033)]=e[t(1048)](Pe,s,!0);break;case 2:n[t(834)]=Pe(s,!0);break;case 3:n.service=e[t(1253)](U,s);break;case 4:n[t(1825)]=e[t(1253)](U,s);break;case 5:{let c=e[t(1106)](z,s);(n[t(934)]||(n[t(934)]=[]))[t(483)](e[t(598)](_,s)),s[t(1199)]=c;break}case 6:n.payloadEncoding=e[t(514)](ye,s,e[t(485)](U,s));break;case 7:n.payloadType=e[t(997)](ye,s,e[t(485)](U,s));break;case 8:n[t(1485)]=yt(s,e[t(1202)](U,s));break;case 9:n[t(1473)]=ye(s,e[t(650)](U,s));break;case 10:n[t(691)+t(1529)]=e.GwXQm(ye,s,e[t(485)](U,s));break;case 11:n[t(1367)]=e[t(514)](ye,s,U(s));break;case 12:n[t(482)+"e"]=e[t(1278)](U,s);break;default:e[t(761)](ee,s,e[t(1504)](7,o))}}if(e[t(1126)](void 0,n[t(1033)]))throw new Error(e[t(722)]);if(e[t(1430)](void 0,n[t(834)]))throw new Error(e[t(788)]);if(n[t(1231)]===void 0)throw new Error(e[t(522)]);if(e.avKOu(void 0,n[t(1825)]))throw new Error(e.UpIcY);return n}function z(s){let t=r,n={QOeJv:function(o,c,f){return o(c,f)},AsLWy:t(533),chzCG:e[t(1651)]};if(e.CeKOF===t(496)){let o=e[t(485)](U,s),c=s[t(1199)];return s[t(1199)]=e[t(1797)](s[t(646)],o),c}else _0x5f5c76[t(1061)]()[t(568)](()=>{let o=t,c=n[o(1615)](_0x2f0dca,n[o(1669)],{message:this[o(790)+"rrorMessage"](_0x220be7)});this[o(806)](n[o(1669)],c);let f=n.QOeJv(_0x1409be,n.chzCG,{reason:this[o(790)+"rrorMessage"](_0x758619)});this[o(806)](n[o(1677)],f)})}function ee(s,t){let n=r;switch(t){case 0:for(;e[n(1208)](128,re(s)););break;case 2:e[n(1449)](he,s,e[n(1277)](U,s));break;case 5:e[n(467)](he,s,4);break;case 1:e[n(577)](he,s,8);break;default:throw new Error(e[n(464)](e[n(1298)],t))}}function le(s){return s|=0,{low:s,high:s>>31,unsigned:e.bYSdv(s,0)}}let _e=[];function oe(){let s=r,t=_e[s(1858)]();return t?(t[s(646)]=t.limit=0,t):{bytes:new Uint8Array(64),offset:0,limit:0}}function D(s){_e.push(s)}function q(s){return{bytes:s,offset:0,limit:s[r(1843)]}}function V(s){let t=r,n={YvhBW:function(o,c){return e[P(526)](o,c)},SIAry:function(o,c,f,g){return e.IGjqQ(o,c,f,g)},ynmWj:function(o,c){return e[P(1331)](o,c)},nQBQU:function(o,c){return e[P(1810)](o,c)}};if(e[t(1395)](e[t(810)],e[t(1835)])){let o=s.bytes,c=s[t(1199)];return e[t(844)](o[t(1843)],c)?o:o[t(1626)](0,c)}else{if(_0x38b849>_0x369e57)throw new _0x20a960(t(1141)+t(658)+"e");let o=3;for(;n[t(425)](o,0);){let c=255&_0x308b55;n[t(1765)](_0x4f73bf,c,_0x1379ca,n.ynmWj(_0x1a48d8,o)),_0x3dcf03>>>=8,o--}return n.nQBQU(_0x3eceeb,4)}}function he(s,t){let n=r;if(e.cljUJ(s.offset,t)>s[n(1199)])throw new Error("Skip pas"+n(523));s[n(646)]+=t}function ke(s){let t=r;return e.bwqce(s[t(646)],s[t(1199)])}function ge(s,t){let n=r,o={BkNUm:function(c,f){return c<=f},KPUto:function(c,f){return e.bYSdv(c,f)},yXLvH:function(c,f){return e[P(840)](c,f)},ZJqUC:function(c,f){return e[P(1124)](c,f)},HtWqF:function(c,f){return c<<f},kOqAd:function(c,f){return c&f},bmATN:function(c,f){return c&f},ejcjI:function(c,f){return e[P(943)](c,f)},GCVnx:function(c,f){return e[P(1504)](c,f)},BtzcE:function(c,f){return e[P(693)](c,f)},ldKyf:function(c,f){return e[P(1672)](c,f)},KYEiQ:function(c,f){return c|f},emiao:function(c,f){return e[P(1208)](c,f)},yODtJ:function(c,f){return c&f},vBrmc:function(c,f){return c&f},HxtMe:function(c,f){return e[P(1810)](c,f)},jfgtP:function(c,f){return e.Dwvol(c,f)},TtdJG:function(c,f){return e[P(1810)](c,f)}};if(e[n(452)](e[n(458)],e[n(458)])){let c=s.bytes,f=s[n(646)],g=s[n(1199)],p=e.VPzyI(f,t);if(e.RzBKe(p,c[n(1843)])){let l=new Uint8Array(e.SJFnW(2,p));l[n(510)](c),s[n(1464)]=l}return s[n(646)]=p,e.JMMVC(p,g)&&(s.limit=p),f}else{let c=_0x2695e1[_0x2c8e6a++];if(o[n(1252)](c,127))_0x286180+=_0x16c64e["fromChar"+n(881)](c);else if(o[n(948)](c,192)&&o.yXLvH(c,224))_0x16f554+=_0x1a7661["fromChar"+n(881)](o[n(1659)](o[n(849)](o.kOqAd(31,c),6),o.bmATN(63,_0x4f9d5c[_0x599ee7++])));else if(c>=224&&c<240)_0x34211b+=_0x3bb547.fromCharCode(o.ZJqUC(o[n(1659)](o[n(849)](o[n(475)](15,c),12),o.HtWqF(o[n(1194)](63,_0x21df5d[_0x49de96++]),6)),63&_0x4da420[_0x4bf492++]));else if(o[n(1656)](c,240)){let f=o[n(1402)](o[n(583)](o[n(583)](o.HtWqF(o.emiao(7,c),18)|o[n(451)](63,_0x30050c[_0x279631++])<<12,o[n(849)](o[n(1566)](63,_0x260b04[_0x530ab1++]),6)),o[n(960)](63,_0x3aaa53[_0x47f70d++])),65536);_0x1e64f1+=_0xd9d745.fromCharCode(o[n(1323)](55296,o[n(1044)](f,10))),_0x4073ba+=_0x4f412b[n(637)+n(881)](o[n(1694)](56320,1023&f))}}}function Je(s,t){let n=r,o=s[n(646)];if(e[n(1729)](e[n(1764)](o,t),s.limit))throw new Error(e[n(591)]);return s[n(646)]+=t,o}function yt(s,t){let n=r,o=e[n(1152)](Je,s,t);return s.bytes[n(1626)](o,e[n(1642)](o,t))}function qt(s,t){let n=r,o=ge(s,t[n(1843)]);s[n(1464)][n(510)](t,o)}function ye(s,t){let n=r,o=e[n(902)](Je,s,t),c=String.fromCharCode,f=s[n(1464)],g="\uFFFD",p="";for(let l=0;l<t;l++){let y=f[l+o],k,v,A,T;e[n(740)](128,y)===0?p+=c(y):e[n(943)](224,y)===192?e[n(1661)](e[n(910)](l,1),t)?p+=g:(k=f[e[n(1764)](l+o,1)],e[n(655)](e.RzJSz(192,k),128)?p+=g:(T=e[n(1124)](e[n(1498)](31&y,6),e[n(817)](63,k)),e.lTulI(T,128)?p+=g:(p+=e[n(485)](c,T),l++))):e[n(1780)](e[n(1208)](240,y),224)?e[n(459)](l,2)>=t?p+=g:(k=f[e[n(1309)](e.cljUJ(l,o),1)],v=f[e[n(966)](l+o,2)],e[n(431)](e[n(817)](e[n(836)](k,e[n(1411)](v,8)),49344),32896)?p+=g:(T=e.SiVyg(e[n(819)](15,y)<<12|e.RHhXs(e[n(1155)](63,k),6),e[n(1266)](63,v)),e[n(840)](T,2048)||T>=55296&&e[n(1250)](T,57343)?p+=g:(p+=e[n(650)](c,T),l+=2))):e.EGBrn(e[n(1138)](248,y),240)?e[n(1339)](l,3)>=t?p+=g:(k=f[e[n(1682)](l,o)+1],v=f[e.QNjAj(e[n(804)](l,o),2)],A=f[l+o+3],e[n(437)](e.RzJSz(e[n(836)](k|e.qpaEN(v,8),A<<16),12632256),8421504)?p+=g:(T=e[n(1701)](e[n(1026)](7&y,18),e[n(1150)](e[n(1155)](63,k),12))|e[n(1498)](e[n(441)](63,v),6)|63&A,e[n(840)](T,65536)||e.JMMVC(T,1114111)?p+=g:(T-=65536,p+=c((T>>10)+55296,(1023&T)+56320),l+=3))):p+=g}return p}function be(s,t){let n=r,o=t[n(1843)],c=0;for(let p=0;p<o;p++){let l=t[n(597)+"At"](p);e[n(560)](l,55296)&&l<=56319&&e.Ivgth(p,1)<o&&(l=e[n(1116)](e[n(1055)](l<<10,t[n(597)+"At"](++p)),56613888)),c+=e.lTulI(l,128)?1:e[n(587)](l,2048)?2:l<65536?3:4}e.LTfYC(J,s,c);let f=e.OPRak(ge,s,c),g=s[n(1464)];for(let p=0;p<o;p++){let l=t[n(597)+"At"](p);e[n(1070)](l,55296)&&e.xSewm(l,56319)&&e[n(860)](e[n(1682)](p,1),o)&&(l=e[n(1672)](e.hGbFg(e[n(1595)](l,10),t.charCodeAt(++p)),56613888)),l<128?g[f++]=l:(e.NZdZw(l,2048)?g[f++]=e[n(879)](e[n(1e3)](e[n(1849)](l,6),31),192):(e[n(1330)](l,65536)?g[f++]=e[n(1279)](e[n(1428)](l,12),15)|224:(g[f++]=e[n(978)](e.OvgOA(l,18)&7,240),g[f++]=e[n(668)](e[n(1373)](l>>12,63),128)),g[f++]=e[n(1701)](e[n(1025)](e.qmeWW(l,6),63),128)),g[f++]=e[n(879)](e[n(1390)](63,l),128))}}function Ut(s,t){let n=r,o={sShGe:function(c,f){return e.JSZWe(c,f)},rVAtd:function(c,f){return e[P(943)](c,f)},rmMHb:function(c,f){return e[P(1504)](c,f)},lrxjh:function(c,f){return e[P(1596)](c,f)},cspnj:function(c,f){return e[P(701)](c,f)}};if(e[n(1635)]!==e[n(1635)]){let c=this[n(1845)],f=this[n(821)];return[o[n(1508)](c,24),o[n(1649)](o[n(1508)](c,16),255),o[n(1649)](o[n(1508)](c,8),255),o[n(700)](255,c),f>>>24,o[n(481)](o[n(1508)](f,16),255),o[n(481)](o[n(1861)](f,8),255),o[n(1649)](255,f)]}else{let c=e[n(1140)](ge,s,t[n(1199)]),f=s.bytes,g=t[n(1464)];for(let p=0,l=t.limit;e[n(1069)](p,l);p++)f[e[n(557)](p,c)]=g[p]}}function re(s){let t=r;if(e[t(1316)]!==e[t(1262)])return s[t(1464)][e.iaJts(Je,s,1)];this[t(444)]&&this._ws[t(1611)](_0x4556f8),this[t(1424)](e[t(941)],_0x6dbf25)}function Kt(s,t){let n=r,o=e[n(1294)](ge,s,1);s.bytes[o]=t}function U(s){let t=r,n=0,o=0,c;do c=re(s),e.yMBaA(n,32)&&(o|=e[t(1600)](e.rktUY(127,c),n)),n+=7;while(e[t(1749)](128,c));return o}function J(s,t){let n=r;for(t>>>=0;e.bYSdv(t,128);)e[n(514)](Kt,s,e.SiVyg(e[n(1310)](127,t),128)),t>>>=7;Kt(s,t)}function Pe(s,t){let n=r,o={RupMG:e[n(1223)],KHbAi:e[n(1877)],uVwPf:function(l){return e[n(1680)](l)},EpqHG:e[n(720)],WioSy:function(l){return l()},nPxnh:n(1379)},c=0,f=0,g=0,p;if(p=e[n(1253)](re,s),c=127&p,e.rRNNG(128,p)&&(p=re(s),c|=e[n(1498)](e[n(1304)](127,p),7),e[n(737)](128,p)&&(p=re(s),c|=e[n(928)](e[n(1266)](127,p),14),e[n(1749)](128,p)&&(p=re(s),c|=e[n(875)](127,p)<<21,e[n(819)](128,p)))))if(e.rdUBS("IGIsh",n(1164)))p=e[n(1253)](re,s),f=e.IxUTz(127,p),e[n(1148)](128,p)&&(p=re(s),f|=e[n(1634)](e[n(1301)](127,p),7),e[n(1279)](128,p)&&(p=e[n(650)](re,s),f|=e[n(1177)](127,p)<<14,e[n(1504)](128,p)&&(p=re(s),f|=e.pQUHl(e[n(1304)](127,p),21),128&p&&(p=e.JjPnT(re,s),g=e[n(807)](127,p),e[n(854)](128,p)&&(p=e[n(1277)](re,s),g|=e[n(1595)](127&p,7))))));else{let l=()=>{let v=n;_0x518a0f["removeEventListe"+v(733)](XFyLAB.RupMG,y),_0x1d2bdf[v(938)+v(1425)+v(733)](XFyLAB.KHbAi,k),_0x3e182c[v(938)+v(1425)+v(733)]("abort",k)},y=()=>{XFyLAB.uVwPf(_0x366d18),l()},k=()=>{let v=n;_0x511d44(_0x239afa[v(533)]||new _0x51ff55(XFyLAB.EpqHG,XFyLAB[v(1093)])),XFyLAB.WioSy(l)};_0x2a07e2[n(1149)+"Listener"](XFyLAB.RupMG,y),_0x1dc4cc[n(1149)+n(1538)](XFyLAB[n(852)],k),_0xef1562[n(1149)+n(1538)](XFyLAB[n(1046)],k)}return{low:e.rKGLW(c,f<<28),high:e[n(1715)](e[n(1060)](f,4),e[n(1634)](g,24)),unsigned:t}}function bt(s,t){let n=r,o=e[n(791)](t.low,0),c=e[n(683)](e[n(791)](t[n(821)],28),t[n(1845)]<<4)>>>0,f=e[n(1572)](t.high,24),g=e.cCchm(0,f)?c===0?e.yMBaA(o,16384)?e.NZdZw(o,128)?1:2:e[n(499)](o,2097152)?3:4:e.AVFzs(c,16384)?e.lTulI(c,128)?5:6:e[n(1654)](c,2097152)?7:8:f<128?9:10,p=e[n(440)](ge,s,g),l=s[n(1464)];switch(g){case 10:l[e.WEbAC(p,9)]=e[n(744)](f>>>7,1);case 9:l[e[n(965)](p,8)]=e[n(1381)](9,g)?128|f:e[n(740)](127,f);case 8:l[e[n(1339)](p,7)]=e[n(437)](8,g)?e[n(808)](e[n(539)](c,21),128):e[n(854)](e[n(1060)](c,21),127);case 7:l[e[n(1162)](p,6)]=e.GqdvH(7,g)?e[n(656)](e.RuAQU(c,14),128):e[n(1090)](e[n(508)](c,14),127);case 6:l[p+5]=e.riorE(6,g)?e[n(492)](c,7)|128:e.TUOit(c>>>7,127);case 5:l[e[n(584)](p,4)]=e[n(664)](5,g)?e[n(808)](128,c):e[n(1575)](127,c);case 4:l[e[n(1339)](p,3)]=e[n(431)](4,g)?e[n(1124)](o>>>21,128):e[n(807)](e[n(698)](o,21),127);case 3:l[e[n(400)](p,2)]=e.riorE(3,g)?e.lGMbO(o,14)|128:o>>>14&127;case 2:l[p+1]=e[n(1315)](2,g)?e[n(873)](e.TcEet(o,7),128):e[n(1734)](e[n(566)](o,7),127);case 1:l[p]=g!==1?e[n(836)](128,o):e.HEJUR(127,o)}}function Qr(s){return I(s)}function $n(s){return e.ChMiU(C,s)}let Xr=65536,Vo=e[r(906)],nt=e.szihn(Xr,Xr),Zr=nt*nt,es=e[r(907)](Zr,2),ze=String[r(1268)+"e"][r(597)+"At"];class O{constructor(t,n,o){let c=r;this[c(888)]=!0,this[c(821)]=0|t,this[c(1845)]=e[c(1701)](0,n),this[c(893)]=!!o}static isLong(t){return t&&t.isLong===!0}static[r(1645)](t,n,o){let c=r;if(e[c(1281)]!==e[c(1037)])return new O(t,n,o);_0x164df7[_0x131ef7++]=e.dzwRZ(e[c(1542)](_0x55bfe9,6),192),_0x193dcb[_0xf90bd7++]=e.YfJKs(e[c(1601)](63,_0x33b172),128)}static[r(1392)+"s"](t,n,o){let c=r;if(e[c(1813)](e[c(670)],e[c(993)]))return o?O[c(1392)+c(1343)](t,n):O[c(1392)+c(789)](t,n);VTKkRk[c(1516)](_0x394b6b,VTKkRk[c(798)](_0x1e73a0,_0x54a1f0[c(1456)]),_0xf11f7e[c(1180)+"on"],_0x2f882a[c(1823)+"on"],_0x55544a(_0x3da622[c(660)+c(474)]))}static[r(1392)+"sLE"](t,n){let o=r;return new O(e.AFxaG(t[0]|e.LqcvF(t[1],8),e[o(1600)](t[2],16))|e[o(1150)](t[3],24),e.DRgNF(t[4]|t[5]<<8,t[6]<<16)|e[o(1211)](t[7],24),n)}static[r(1392)+r(789)](t,n){let o=r;return new O(e[o(656)](e[o(668)](t[4]<<24,e[o(1634)](t[5],16))|e[o(1440)](t[6],8),t[7]),e.LqIdV(e[o(751)](e[o(873)](e[o(1150)](t[0],24),e[o(1731)](t[1],16)),t[2]<<8),t[3]),n)}static[r(1423)](t){let n=r;return e[n(621)](t,Vo)?ts:new O(e[n(668)](e[n(745)](ze[n(1236)](t,0)|e.yaerY(ze.call(t,1),8),e.WUWZL(ze.call(t,2),16)),e.lPxdZ(ze[n(1236)](t,3),24))>>>0,e.bWUiC(e.HuHjX(e.YDkPu(e[n(1739)](ze.call(t,4),ze[n(1236)](t,5)<<8),e[n(1662)](ze.call(t,6),16)),ze[n(1236)](t,7)<<24),0),!0)}[r(1730)](){let t=r;return String[t(637)+"Code"](e[t(1301)](255,this[t(821)]),e.HEJUR(e[t(791)](this[t(821)],8),255),e[t(1177)](e[t(501)](this.low,16),255),this[t(821)]>>>24,e[t(1273)](255,this[t(1845)]),e[t(443)](e[t(1071)](this[t(1845)],8),255),e.hARBm(this.high,16)&255,e.HjOEK(this[t(1845)],24))}static fromNumber(t,n=!0){let o=r;if(e[o(1202)](isNaN,t))return n?Yo:ts;if(n){if(e[o(560)](t,Zr))return Qo}else{if(e[o(796)](t,-es))return Xo;if(e[o(828)](t+1,es))return $o}return O[o(1645)](e[o(1337)](e[o(800)](t,nt),0),e[o(914)](e.aWDVg(t,nt),0),n)}[r(1312)](){let t=r;if(e[t(1099)]("FbWag",t(605)))this[t(806)](t(1314),_0x28ae7f),this[t(1722)]&&this[t(1722)](_0x453985);else return this[t(893)]?e.YYGXT(this[t(1845)],0)*nt+e[t(753)](this[t(821)],0):e[t(434)](this[t(1845)],nt)+e[t(1495)](this[t(821)],0)}[r(422)](){let t=r;if(e[t(1708)]!==e[t(847)])return e[t(924)](0,this[t(1845)])&&e.avKOu(0,this[t(821)]);VTKkRk[t(1106)](_0x51da65,VTKkRk.gMdaj(_0x152813,_0x1e094d[t(1456)])),VTKkRk[t(1680)](_0x1cc1a3)}add(t){let n=r;O[n(888)](t)||(t=O[n(652)+"er"](t));let o=this[n(1845)]>>>16,c=e[n(1189)](65535,this[n(1845)]),f=this[n(821)]>>>16,g=65535&this[n(821)],p=e[n(1751)](t.high,16),l=e.ZVplU(65535,t[n(1845)]),y=e[n(743)](t[n(821)],16),k=65535&t[n(821)],v=0,A=0,T=0,G=0;return G+=e[n(1011)](g,k),T+=e.ksOQA(G,16),G&=65535,T+=f+y,A+=e[n(1723)](T,16),T&=65535,A+=e[n(534)](c,l),v+=e[n(1110)](A,16),A&=65535,v+=e[n(1477)](o,p),v&=65535,O[n(1645)](e[n(1811)](T<<16,G),e[n(808)](v<<16,A),this[n(893)])}[r(1883)](t){let n=r;return O.isLong(t)||(t=O.fromNumber(t)),e[n(1850)](this[n(893)],t.unsigned)&&e[n(924)](this[n(1845)]>>>31,1)&&e[n(1209)](e[n(728)](t[n(1845)],31),1)?!1:this[n(1845)]===t[n(1845)]&&e.xJvZG(this[n(821)],t.low)}[r(471)](){let t=r;return this[t(821)]===-1&&this.high===-1?O[t(1645)](0,0,this[t(893)]):e.ZNDUj(-1,this[t(821)])?O[t(1645)](0,e[t(1134)](this[t(1845)],1),this.unsigned):O.fromBits(e[t(1810)](this.low,1),this.high,this[t(893)])}[r(1083)](t){let n=r;return t?this[n(554)+"E"]():this[n(1753)+"E"]()}[r(554)+"E"](){let t=r,n=this.high,o=this.low;return[e.RzJSz(255,o),e[t(875)](o>>>8,255),e[t(1208)](e[t(1421)](o,16),255),e[t(1239)](o,24),e[t(476)](255,n),e.MdLlg(n>>>8,255),e[t(1390)](e[t(911)](n,16),255),e[t(1784)](n,24)]}toBytesBE(){let t=r,n=this.high,o=this.low;return[n>>>24,e[t(1237)](n,16)&255,e[t(1058)](e[t(508)](n,8),255),255&n,o>>>24,e[t(1697)](e[t(911)](o,16),255),e[t(1636)](e[t(1878)](o,8),255),e.xGioe(255,o)]}}let ts=new O(0,0,!1),Yo=new O(0,0,!0),$o=O.fromBits(-1,2147483647,!1),Qo=O[r(1645)](-1,-1,!0),Xo=O[r(1645)](0,-2147483648,!1);var Fe=(function(s){let t=r,n=e[t(832)][t(862)]("|"),o=0;for(;;){switch(n[o++]){case"0":s[s[e[t(1847)]]=5002]=t(1786)+t(981);continue;case"1":s[s[e[t(1766)]]=5003]=e[t(1766)];continue;case"2":s[s[e[t(1397)]]=5001]=e[t(1397)];continue;case"3":return s;case"4":s[s[e[t(1561)]]=5005]=e[t(1561)];continue;case"5":s[s[e.XEYcY]=5004]=e[t(470)];continue}break}})({});class rt{constructor(t){let n=r;this[n(1433)]=t,this[n(1130)]=null}}class ns extends rt{constructor(t,n){let o=r;super(t),this[o(1399)]=n&&n.message||null}}class rs extends rt{constructor(t,n){let o=r,c=e[o(1862)][o(862)]("|"),f=0;for(;;){switch(c[f++]){case"0":this[o(1086)]=n&&n[o(1086)]||0;continue;case"1":this[o(876)]=n&&n[o(876)]||0;continue;case"2":this[o(1726)]=n&&n.code||5001;continue;case"3":this[o(1399)]=n&&n[o(1399)]||"";continue;case"4":this[o(533)]=n&&n[o(533)]||null;continue;case"5":super(t);continue;case"6":this.filename=n&&n[o(1664)]||"";continue}break}}}class ss extends rt{constructor(t,n){let o=r,c=e[o(454)][o(862)]("|"),f=0;for(;;){switch(c[f++]){case"0":this[o(1358)+o(747)]=n&&n[o(1358)+o(747)]||!1;continue;case"1":this[o(850)]=n&&n[o(850)]||!1;continue;case"2":this.code=n&&n[o(1726)]||0;continue;case"3":this[o(1517)]=n&&n[o(1517)]||"";continue;case"4":super(t);continue}break}}}class is extends rt{constructor(t,n){let o=r;super(t),this[o(1779)]=n&&n[o(1779)]||null}}class os extends is{constructor(t,n){let o=r;super(t),this.data=n&&n[o(1779)]||null,this[o(1399)]=n&&n[o(1399)]||null}}class as extends rt{constructor(t,n){let o=r;if(e.eFZCN("aFpBJ",e[o(1641)]))super(t),this[o(1779)]=n&&n[o(1779)]||null;else{let{initReconnectInterval:c,maxReconnectInterval:f,reconnectIntervalGrowFactor:g}=this._options,p=e[o(434)](c,_0x2eec90.pow(g,e[o(1672)](_0xdeac8a,1)));return e.Ngphh(p,f)?f:p}}}function ue(s,{message:t,code:n,error:o}){return new rs(s,{message:t,code:n,error:o})}function pe(s,{code:t,reason:n,wasClean:o,willReconnect:c}){return new ss(s,{code:t,reason:n,wasClean:o,willReconnect:c})}function cs(s,{data:t,message:n}){return new os(s,{data:t,message:n})}function xs(s,{data:t}){return new as(s,{data:t})}function Qn(s,{message:t}){return new ns(s,{message:t})}class us{constructor(t,n){let o=r,c={QNGtn:"error",xFywa:function(f,g,p){return e[P(1832)](f,g,p)},rWfjh:function(f,g){return f+g}};if(e[o(1275)](e.KNASK,e[o(1172)])){let f=_0x44145f[o(1548)][o(1727)](_0x42283c[o(1230)+"et"],c[o(882)](_0x2c3a69[o(986)+"th"],_0x18091a[o(1230)+"et"]));this[o(570)]&&this[o(570)][o(1611)]({data:f,fail:g=>{let p=o;this[p(806)](c[p(930)],c[p(1139)](_0x1b48db,p(533),{message:this[p(790)+"rrorMess"+p(1066)](g)}))}})}else this[o(1217)+"s"]=t,this[o(1770)+"es"]=n,this[o(1062)+o(388)]=0,this[o(1489)+o(654)+o(1338)+"t"]=0}[r(1828)+"pointCon"+r(1759)](){let t=r;e[t(1820)]!==t(653)?(this[t(1062)+t(388)]=0,this[t(1489)+"ndpointT"+t(1338)+"t"]=0):(_0x56a081(_0xe96a13,90),e.CUWCr(_0x3018fb,_0x398e3d,_0x42a89f))}[r(1174)+"es"](){let t=r;this[t(1489)+"ndpointT"+t(1338)+"t"]=0}getCurrentEndpoint(){let t=r;return this[t(1217)+"s"][this["currentI"+t(388)]]}["getCurre"+r(1210)+"ntTriesCount"](){let t=r;return this[t(1489)+t(654)+t(1338)+"t"]}[r(1350)+r(749)+"es"](){let t=r;return!!(e[t(1661)](this[t(1062)+"ndex"],this.endpoints[t(1843)])||e[t(957)](this["currentI"+t(388)],e[t(1897)](this[t(1217)+"s"][t(1843)],1))&&this[t(1489)+t(654)+t(1338)+"t"]===this[t(1770)+"es"])}[r(1580)+r(424)+r(889)+r(1135)+"tries"](){let t=r;return this["currentI"+t(388)]==this[t(1217)+"s"][t(1843)]?!0:e[t(1729)](this[t(1489)+"ndpointT"+t(1338)+"t"],this[t(1770)+"es"])}[r(1788)+r(769)+r(1376)+r(1092)+r(1370)](){let t=r;return this[t(1489)+t(654)+"riesCount"]=1,this[t(1062)+t(388)]++,this[t(1217)+"s"][this[t(1062)+t(388)]]}["getCurre"+r(1210)+r(1200)+r(706)](){let t=r;return this[t(1489)+t(654)+t(1338)+"t"]++,this.getCurrentEndpoint()}}let st=(e[r(1644)]("undefined",typeof globalThis)&&e.ZoNCt(e.kITlB,globalThis[r(1859)+r(1894)].name)||e[r(962)](e[r(537)],typeof window)&&e.UrJhm(e[r(1864)],window["construc"+r(1894)].name))&&e[r(963)](e.CISfi,typeof document),Ve=e[r(942)](e.CISfi,typeof globalThis)&&(e[r(1408)](e[r(1274)],globalThis[r(1859)+r(1894)][r(1546)])||e[r(1899)](e.RPRaO,globalThis[r(1859)+"tor"][r(1546)]))&&e[r(537)]!=typeof tt,vt=(e[r(1307)](r(399)+"d",typeof globalThis)&&e[r(1274)]===globalThis[r(1859)+r(1894)][r(1546)]||e[r(1175)](e[r(537)],typeof globalThis)||e[r(1644)](e[r(537)],typeof globalThis)&&!!globalThis["WeixinJS"+r(1261)])&&e[r(727)](r(399)+"d",typeof wx),St=e.BcEpQ(r(399)+"d",typeof globalThis)&&(e.OZJSO(e.RPRaO,globalThis[r(1859)+r(1894)].name)||r(811)+r(1539)+r(1427)===globalThis[r(1859)+r(1894)][r(1546)]||e[r(509)]===globalThis[r(1859)+"tor"][r(1546)])&&e[r(537)]!=typeof self,Zo=e[r(1846)](e[r(537)],typeof globalThis)&&e.hFHyy(e[r(1274)],globalThis[r(1859)+r(1894)].name)&&r(399)+"d"!=typeof global&&e[r(1274)]===global[r(1859)+r(1894)][r(1546)]&&e.CISfi!=typeof process&&!!process.version;class Xn{constructor(){let t=r;this[t(803)+"rs"]={}}emit(t,...n){let o=r,c=this[o(803)+"rs"][t];if(c)c[o(1727)]()[o(1170)](f=>f.fn.apply(f[o(478)],n));else if(e[o(550)](e.uRZCb,t)&&!this[o(463)]){let f=n[o(1843)]&&n[0];if(e[o(527)](f,Error))throw f;let g=new Error(e[o(1176)]+(f?e[o(1161)](e[o(1764)](" (",f[o(1399)]),")"):""));throw g[o(1332)]=f,f}return this}[r(831)](t,n){let o=r,c={ntlBo:function(f,g,p){return e.stPRV(f,g,p)}};if(o(1306)!==e[o(822)]){if(e.rsBWX(void 0,t))this._listeners={};else if(e[o(1221)](void 0,n))this._listeners[t]=null;else if(e[o(550)](e[o(503)],o(1032))){let f="connect "+_0xc6b42a+(o(784)+o(1056)+o(677)+"ed");this[o(877)+o(925)+o(1222)](c[o(1285)](_0x31b941,o(533),{message:f,code:_0x2ef8e4[o(395)+"IES_ERROR"],error:_0xb89cea}));return}else{let f=this[o(803)+"rs"][t];if(f)for(let g=0;e[o(792)](g,f[o(1843)]);)e[o(621)](f[g].fn,n)?f[o(626)](g,1):++g}return this}else{let f=e[o(1570)](_0x191283,_0x3b4ca2,_0x44dde2.length);_0x218b0a[o(1464)][o(510)](_0x4f973d,f)}}on(t,n,o){let c=r;return(this[c(803)+"rs"][t]||(this._listeners[t]=[]))[c(483)]({fn:n,ctx:o||this}),this}}class ea extends Xn{[r(790)+r(1193)+r(1066)](t){let n=r;return t[n(1438)]||t.errNo?(n(1345)+" "+(t[n(1438)]||"")+n(1129)+(t[n(1747)]||""))[n(521)]():JSON[n(438)+"y"](t)}constructor(t,n,o){let c=r;super(),this[c(570)]=null,vt&&wx["connectS"+c(1866)]&&(this[c(570)]=wx[c(1227)+"ocket"]({url:t,protocols:n,header:o,fail:this["_createS"+c(1533)+c(1748)][c(953)](this),success:this[c(1785)+c(1536)+c(599)+"ler"][c(953)](this)})),Ve&&tt[c(1227)+c(1866)]&&(this._socket=tt["connectS"+c(1866)]({url:t,protocols:n,header:o,fail:this["_createS"+c(1533)+"lHandler"][c(953)](this),success:this[c(1785)+c(1536)+c(599)+c(669)].bind(this)}))}[r(1785)+"ocketSuccessHand"+r(669)](){let t=r;Promise[t(1061)]()[t(568)](()=>{this[t(829)+"steners"]()})}[r(1785)+"ocketFai"+r(1748)](t){let n=r;if(e[n(1850)](e[n(589)],e[n(567)]))Promise.resolve()[n(568)](()=>{let o=n,c=ue(e[o(1877)],{message:this["_formatE"+o(1193)+o(1066)](t)});this[o(806)](e[o(1877)],c);let f=e[o(1048)](pe,e.QweJd,{reason:this[o(790)+o(1193)+o(1066)](t)});this.emit(e[o(1651)],f)});else return e.uIGoH(_0x201b21[n(646)],_0x1ce6de[n(1199)])}["_addWsLi"+r(620)](){let t=r,n={dcjnF:t(1875),mNQsh:e[t(640)],GlOzC:function(o,c,f){return e[t(1394)](o,c,f)},vxiBH:e[t(1877)],lEmmA:function(o,c,f){return o(c,f)}};this[t(570)][t(436)](o=>{let c=t;this[c(806)](n.dcjnF,xs(n[c(1361)],{...o,data:o[c(1438)]||""}))}),this[t(570)].onClose(o=>{let c=t;this.emit("close",e.OPRak(pe,c(1314),{...o}))}),this[t(570)][t(1228)+"e"](o=>{let c=t;this[c(806)](n[c(1808)],n[c(1405)](cs,n[c(1808)],{...o}))}),this[t(570)][t(944)](o=>{let c=t;this.emit(n[c(1763)],n.lEmmA(ue,n[c(1763)],{...o,message:o[c(1438)]||""}))})}[r(1611)](t){let n=r,o={AGucA:e.uRZCb,aOGtp:function(c,f,g){return e[P(1324)](c,f,g)}};if(t instanceof Uint8Array){let c=t.buffer.slice(t[n(1230)+"et"],e[n(1309)](t.byteLength,t[n(1230)+"et"]));this[n(570)]&&this[n(570)][n(1611)]({data:c,fail:f=>{let g=n;this.emit(e[g(1877)],e.KuybI(ue,e[g(1877)],{message:this[g(790)+g(1193)+g(1066)](f)}))}})}else this[n(570)]&&this[n(570)][n(1611)]({data:t,fail:c=>{let f=n;this[f(806)](o[f(935)],o.aOGtp(ue,f(533),{message:this[f(790)+f(1193)+f(1066)](c)}))}})}close(t,n){let o=r;this._socket&&this[o(570)].close({code:t,reason:n})}[r(1149)+r(1538)](t,n){this.on(t,n)}[r(938)+r(1425)+"ner"](t,n){this.off(t,n)}get[r(1396)+"te"](){let t=r;return this[t(570)][t(1396)+"te"]}get[r(1590)+"pe"](){let t=r;return this._socket[t(1590)+"pe"]}set[r(1590)+"pe"](t){}get[r(748)](){let t=r;if(e[t(1657)](e[t(1796)],e[t(1796)]))_0x425871(_0x38129a,66),e.rsyIF(_0x5b3cec,_0x5c74db,_0x5c3f6a[t(1843)]),_0x2b479b(_0x5697ef,_0x1490b6);else return this[t(570)][t(748)]}get[r(731)](){return this[r(570)].protocol}get[r(871)+"ns"](){let t=r;return e.dkZjV(e[t(1434)],"VLDgf")?this[t(570)][t(871)+"ns"]:!!this[t(679)]}get[r(1151)+r(461)](){return 0}}function ta(s,t){let n=r;if(t)return new t(s[n(748)],s[n(731)]);if(e[n(1435)](vt,Ve))return new ea(s[n(748)],s.protocol,s.headers);if(e[n(1652)](st,St)&&n(399)+"d"!=typeof WebSocket&&WebSocket)return new WebSocket(s[n(748)],s.protocols)}function na(s){let t=r,n=e[t(1111)][t(862)]("|"),o=0;for(;;){switch(n[o++]){case"0":return!1;case"1":if(e[t(1892)](st,St)&&e.lsGwc(e[t(537)],typeof WebSocket)&&WebSocket)return!0;continue;case"2":if(vt&&wx[t(1227)+t(1866)])return!0;continue;case"3":if(s)return!0;continue;case"4":if(Ve&&tt[t(1227)+t(1866)])return!0;continue}break}}function fs(s,t,n){let o=-1;async function c(f){let g=P;return e[g(420)](f,o)?Promise.reject(new Error(e.Scxza)):(o=f,e.IJmdG(f,n.length)?Promise[g(1061)]():n[f].bind(s)(t,c.bind(null,e[g(1234)](f,1))))}c(0)}function ds(s){let t=r,n=0,o=0;for(let c=0;e[t(1860)](c,s[t(1843)]);++c)o=s[t(597)+"At"](c),e[t(1069)](o,128)?n+=1:e[t(499)](o,2048)?n+=2:e[t(476)](64512,o)===55296&&e[t(1783)](e[t(1155)](64512,s.charCodeAt(e[t(1309)](c,1))),56320)?(++c,n+=4):n+=3;return n}function ls(s,t,n){let o=r;if(e[o(479)](e[o(805)](n,t),1))return"";let c="";for(let f=t;e[o(479)](f,n);){let g=s[f++];if(e.glwqU(g,127))c+=String[o(637)+o(881)](g);else if(e[o(1618)](g,192)&&e[o(1295)](g,224))c+=String[o(637)+o(881)](e[o(1834)](e[o(1004)](31&g,6),63&s[f++]));else if(e[o(693)](g,224)&&g<240)c+=String[o(637)+"Code"](e[o(1442)](e[o(1778)](e.lPxdZ(e[o(1156)](15,g),12),e[o(1304)](63,s[f++])<<6),63&s[f++]));else if(e[o(1587)](g,240)){let p=e.asdTN(e[o(1811)](e[o(1081)](7&g,18)|e[o(1462)](e[o(1301)](63,s[f++]),12),e.cdAzB(63&s[f++],6)),e.adpaz(63,s[f++]))-65536;c+=String[o(637)+o(881)](e[o(867)](55296,e[o(1428)](p,10))),c+=String["fromChar"+o(881)](e[o(767)](56320,e[o(1623)](1023,p)))}}return c}function Zn(s,t,n){let o=r,c={LAUQn:function(f,g){return e[P(1780)](f,g)},IFzwc:e[o(1414)],wdtKP:function(f,g){return e[o(1534)](f,g)},kspSH:function(f,g,p,l){return e[o(1101)](f,g,p,l)}};if(e.Nneem(o(1255),"abery")){let f=n,g,p;for(let l=0;l<s[o(1843)];++l)if(g=s[o(597)+"At"](l),e[o(1564)](g,128))t[n++]=g;else if(e.AVFzs(g,2048))t[n++]=e.ZmDaV(g>>6,192),t[n++]=e[o(1636)](63,g)|128;else if(e[o(1138)](64512,g)===55296&&e[o(1366)](e[o(1553)](64512,p=s[o(597)+"At"](l+1)),56320)){let y=e.GpaEk[o(862)]("|"),k=0;for(;;){switch(y[k++]){case"0":t[n++]=e.RAzuB(e[o(1542)](g,12)&63,128);continue;case"1":t[n++]=e[o(1715)](e.adpaz(e[o(1660)](g,6),63),128);continue;case"2":++l;continue;case"3":t[n++]=e.XydME(63,g)|128;continue;case"4":g=e[o(1560)](e[o(1134)](65536,e[o(1634)](1023&g,10)),1023&p);continue;case"5":t[n++]=e[o(1660)](g,18)|240;continue}break}}else t[n++]=g>>12|224,t[n++]=e[o(683)](e[o(1156)](g>>6,63),128),t[n++]=e[o(1072)](e[o(390)](63,g),128);return n-f}else{if(c[o(1212)](c[o(435)],typeof _0x28b12c)){let f=new _0x5cba6e(c[o(1586)](_0xdb88d2,_0x209d1d));return c.kspSH(_0x10da37,_0x3f1386,f,0),f}return _0x4e0813 instanceof _0x44d21a?new _0x1598ec(_0x543636):new _0x3cf503(_0xbdcf20[o(1548)],_0x3b4d94[o(1230)+"et"],_0x3868db.byteLength)}}async function hs(s){let t=r;if(e[t(1414)]==typeof s){let n=new Uint8Array(e.RSkBe(ds,s));return Zn(s,n,0),n}return e[t(511)](s,ArrayBuffer)?new Uint8Array(s):new Uint8Array(s[t(1548)],s[t(1230)+"et"],s[t(986)+"th"])}function ra(s){let t=r;try{return e[t(1414)]!=typeof s&&(e[t(511)](s,ArrayBuffer)||s.buffer&&e.jgBUt(s.buffer,ArrayBuffer))||e.OaLAW(e[t(1414)],typeof s)?"":(JSON[t(1525)](s),t(488)+t(506))}catch{return e[t(991)](e[t(1414)],typeof s)?e[t(524)]:""}}let sa=(s,t)=>{let n=r;switch(s){case e[n(976)]:case n(1690):return{[n(556)+s]:1,"x-tt-env":t};default:return{}}};class ia{constructor(t){let n=r;this[n(1787)+n(1142)]=t,this.count=0}[r(495)](){let t=r;e[t(680)](t(905),e.NGYFc)?this.count++:(VTKkRk[t(537)]!=typeof _0x466e&&_0x42759a[t(846)+"Tag"]&&_0x352fc0["definePr"+t(1375)](_0x19373c,_0x9d49d9[t(846)+t(959)],{value:VTKkRk[t(415)]}),_0xe4ca35.defineProperty(_0x4c13d8,VTKkRk[t(1096)],{value:!0}))}[r(1350)+"chMaxCount"](){let t=r;return this.count>=this["maxLossC"+t(1142)]}[r(949)+r(917)](t=0){let n=r;this[n(1787)+"ount"]=t,this[n(429)]=0}}async function oa(s){let t=r,n={JMmjO:function(o,c){return e[P(1250)](o,c)},YEBAg:function(o,c){return e[P(927)](o,c)},uHUxC:function(o,c){return e[P(964)](o,c)},JCfgh:function(o,c){return o-c},MbdVt:function(o,c){return o<<c},Fmaba:function(o,c){return e[P(927)](o,c)},HzEOm:function(o,c){return e.jxUMB(o,c)},qrOPt:e[t(1027)],Nhoyt:e[t(487)],cYxiT:e[t(1020)],MrYNX:function(o,c){return o&c},bvWzn:function(o,c){return e[t(1099)](o,c)},sxnuP:t(611),Vildp:t(1494),lWeJu:e[t(1767)],BxJrL:e.bOLnI,Tydzw:e[t(1574)],zumgc:function(o,c){return o===c},hjfTl:e[t(1592)],oRvna:e[t(1658)],yvTxs:e[t(1045)],rxlFE:e.nnhZr};return new Promise(o=>{let c=t,f={RFaMO:function(g,p){return n[P(622)](g,p)},MbFJp:n[c(595)],VECnu:n[c(1608)],WVJNN:n.cYxiT,fmhYS:"pageshow",Lught:function(g,p){return n[c(1684)](g,p)},VUZVu:function(g,p){return n[c(433)](g,p)}};if(n.bvWzn(n[c(1552)],n[c(1675)])){if(!st)return o(n[c(595)]);try{let g=document.createElement(n.lWeJu);window["frontier"+c(1639)]=p=>{let l=c;document[l(1457)][l(525)+"ild"](g),window[l(1617)+"JSONP"]=void 0,f[l(1087)](o,p&&p[l(756)]||f.MbFJp)},g.type=n[c(1868)],g[c(842)]=n[c(433)](s[c(1493)](/^ws/,"http"),n[c(1711)]);try{n[c(604)](n[c(916)],c(812))?document.body[c(1499)+c(884)](g):(this[c(1308)+"er"]&&_0x42bab4["removeEv"+c(1425)+"ner"](f[c(1251)],this[c(396)+c(1714)]),this[c(1308)+"er"]&&_0x26acf5[c(938)+"entListe"+c(733)](c(1356),this[c(396)+c(1478)]),this[c(1308)+"er"]&&_0x1583be[c(938)+c(1425)+c(733)](f.WVJNN,this[c(491)+c(507)]),this._isBrowser&&_0x260dbb["removeEventListe"+c(733)](f.fmhYS,this[c(491)+c(393)]))}catch{if(n[c(651)]("casDc",n[c(1291)]))document[c(1457)][c(525)+c(884)](g);else try{return!!this[c(679)]}catch(p){return _0xe85e82[c(1030)](p),!1}}}catch{if(n.bvWzn(n[c(1884)],n[c(1744)]))window[c(1617)+"JSONP"]=void 0,n[c(622)](o,c(1518)+c(1517));else{let g=_0x3eff87.charCodeAt(_0x4851f4);g>=55296&&bzaUbV.JMmjO(g,56319)&&bzaUbV[c(490)](bzaUbV.uHUxC(_0x37c9b5,1),_0x3ad501)&&(g=bzaUbV.JCfgh(bzaUbV[c(433)](bzaUbV.MbdVt(g,10),_0x574c87[c(597)+"At"](++_0x37c842)),56613888)),_0x4f014b+=bzaUbV[c(1625)](g,128)?1:bzaUbV[c(490)](g,2048)?2:g<65536?3:4}}}else return _0x1b62fb[c(1171)+"t8"]?_0x14930e[c(1171)+"t8"](_0x3b33c4,_0x2970fb):_0x20ce65[_0x2a2dfd]=f.Lught(255,_0x4d8d34),f[c(967)](_0x310947,1)})}function qe(s,t,n){let o=r,c={jAYxM:function(f,g,p){return e[P(1543)](f,g,p)},xbQpc:e.QweJd};if(e[o(900)](e[o(1443)],e[o(1191)])){let f=this[o(1741)+o(1676)]?.[o(1372)+o(1210)+"nt"]();this[o(877)+o(1523)+o(1222)](c[o(922)](_0x1fad0b,c.xbQpc,{code:_0x3076ec.code,reason:o(1220)+o(1721)+o(428)+o(1105)+"n, hostname: "+f})),this[o(1741)+"tManager"]?.[o(1828)+o(1582)+"fig"](),this[o(939)+o(1409)]?.[o(949)+o(917)]();return}else return!!s?.[o(1889)](f=>f[o(736)]===t&&f[o(405)]===n)}function it(s,t){let n=r;return s?.find(o=>o[n(736)]===t)?.[n(405)]}let er=null;async function aa(){let s=r;return er||(er=Promise[s(1061)]()[s(568)](Ee[s(953)](Ee,"idb"))),er}class ca extends Xn{constructor(t,n){let o=r;super(),this[o(1472)]=t,this[o(979)]=n,this[o(679)]=void 0,this._initPromise=null}async[r(1833)](){await this[r(1355)]()}async[r(1355)](){let t=r,n={FYUYD:function(o){return e[P(1349)](o)},xURGG:function(o,c,f,g){return o(c,f,g)}};if(!this[t(679)]){if(this[t(768)+t(1079)])return this["_initPro"+t(1079)];try{let o=this[t(1472)],c=this._keyPath;this[t(768)+t(1079)]=(async()=>{let f=t,{openDB:g}=await n[f(609)](aa);this[f(679)]=await n[f(1117)](g,f(1617)+"_"+o,1,{upgrade(p){let l=f;p[l(1459)+l(977)+"e"](o,{keyPath:c})}})})(),await this["_initPro"+t(1079)]}catch(o){console[t(1030)](o)}finally{this[t(768)+t(1079)]=null}}}async[r(1528)](t){let n=r;try{return await this[n(1355)](),this[n(679)]?.[n(1528)](this[n(1472)],t)}catch(o){console[n(1030)](o)}}async set(t,n){let o=r;return await this[o(1355)](),this[o(679)]?.[o(1006)](this[o(1472)],t)}async[r(586)](t){let n=r;if(e[n(1899)](e[n(472)],e[n(472)]))try{return await this[n(1355)](),this[n(679)]?.[n(972)](this[n(1472)],t)}catch(o){console[n(1030)](o)}else return null}async[r(1799)](){let t=r;try{return await this._init(),this[t(679)]?.[t(1799)](this[t(1472)])}catch(n){console[t(1030)](n)}}async[r(1480)](){let t=r;return e[t(837)](e[t(661)],e[t(1041)])?this[t(570)].protocol:(await this[t(1355)](),this[t(679)]?.[t(1581)+"ys"](this[t(1472)]))}async[r(489)](){let t=r;return await this[t(1355)](),this[t(679)]?.[t(489)](this[t(1472)])}async closeDB(){let t=r,n={BLZjj:function(o,c){return o instanceof c},tJLYg:function(o,c){return e.WnYsr(o,c)},GlUtI:function(o,c){return e[P(579)](o,c)}};try{this._qosDB?.[t(1314)](),this[t(679)]=void 0}catch(o){if(e[t(1699)]!==e.ctxDh)return yALsff[t(858)](_0x4f0739,_0x59bb7c)&&(yALsff.tJLYg(_0x81aeb5,"done")||_0x5d6265===t(838))?!0:yALsff[t(1391)](_0x35b38a,_0x2f74e8);console[t(1030)](o)}}get isReady(){let t=r;try{return e[t(985)](e[t(1812)],e[t(1812)])?!!this[t(679)]:this[t(444)]?this[t(444)][t(1590)+"pe"]:this[t(874)+t(1114)]}catch(n){return console.log(n),!1}}}class xa{constructor(t,n){let o=r;this._DBName=t,this[o(1888)]=n,this[o(679)]=localStorage}async[r(1833)](){}get[r(1353)](){let t=r;return t(1617)+"_"+this[t(1622)]}async[r(1528)](t){let n=r,o=this[n(679)][n(504)](this[n(1353)]);return JSON[n(1525)](o||"{}")[t]}async[r(510)](t,n){let o=r,c=this[o(679)][o(504)](this._prefix),f=JSON[o(1525)](e[o(1435)](c,"{}"));return f[n||t[this[o(1888)]]]=t,this[o(679)][o(1640)](this[o(1353)],JSON[o(438)+"y"](f)),n||t[this[o(1888)]]}async del(t){let n=r,o=this[n(679)][n(504)](this[n(1353)]),c=JSON[n(1525)](e[n(500)](o,"{}"));return c[t]=void 0,this[n(679)].setItem(this[n(1353)],JSON.stringify(c))}async[r(1799)](){return this[r(679)].clear()}async[r(1480)](){let t=r,n=this[t(679)].getItem(this[t(1353)]),o=JSON[t(1525)](e.jJoom(n,"{}"));return Object.keys(o)}async[r(489)](){let t=r,n=this._qosDB.getItem(this[t(1353)]),o=JSON[t(1525)](e[t(1801)](n,"{}"));return Object.values(o)}[r(1704)](){return Promise[r(1061)]()}get[r(1893)](){return!!this[r(679)]}}class ua{constructor(t,n){let o=r;this._DBName=t,this[o(1888)]=n,this[o(679)]=Ve?tt:vt?wx:null}async[r(1833)](){}get[r(1353)](){return"frontier_"+this[r(1622)]}async[r(1528)](t){let n=r,o={pyKGD:e[n(1441)],GshNn:e[n(640)],RygHK:e[n(1651)],rneQD:n(533)};if(e[n(816)]("qznDB",n(1688))){let c=this[n(679)][n(1505)+"geSync"](this._prefix);return JSON[n(1525)](e.yaLJU(c,"{}"))[t]}else{let c=o[n(575)].split("|"),f=0;for(;;){switch(c[f++]){case"0":this._ws[n(938)+n(1425)+n(733)](o[n(1814)],this._onMessage);continue;case"1":this[n(444)][n(938)+n(1425)+n(733)](o[n(1670)],this[n(1613)]);continue;case"2":this[n(444)]["removeEv"+n(1425)+n(733)](n(1875),this[n(954)]);continue;case"3":this[n(444)][n(938)+n(1425)+n(733)](o.rneQD,this[n(1352)]);continue;case"4":if(!this[n(444)])return;continue}break}}}async[r(510)](t,n){let o=r,c=this[o(679)]["getStora"+o(1417)](this[o(1353)]),f=JSON[o(1525)](e[o(500)](c,"{}"));return f[n||t[this._pathKey]]=t,this[o(679)][o(1288)+o(1417)](this[o(1353)],JSON[o(438)+"y"](f)),n||t[this._pathKey]}async del(t){let n=r,o=this[n(679)][n(1505)+n(1417)](this._prefix),c=JSON.parse(e[n(1091)](o,"{}"));return c[t]=void 0,this._qosDB[n(1288)+"geSync"](this[n(1353)],JSON[n(438)+"y"](c))}async[r(1799)](){let t=r;if(e.FpYXY(e[t(494)],e[t(494)]))_0x51df41[t(1617)+t(1639)]=void 0,e[t(1524)](_0x48b90a,t(1518)+t(1517));else return this[t(679)][t(1484)+"rageSync"]()}async[r(1480)](){let t=r,n=this[t(679)][t(1505)+t(848)+"nc"](this._prefix),o=JSON[t(1525)](e[t(855)](n,"{}"));return Object[t(1480)](o)}async getAll(){let t=r,n=this[t(679)][t(1505)+t(848)+"nc"](this[t(1353)]),o=JSON[t(1525)](e.MgTPf(n,"{}"));return Object[t(1035)](o)}[r(1704)](){let t=r,n={MGrqL:function(o){return o()}};if(e[t(1850)](e[t(1259)],e[t(929)]))return Promise.resolve();{let o=this[t(1741)+t(1676)]?.[t(1372)+t(1210)+"nt"]();this[t(1424)](t(517)+o),n[t(1187)](_0x58dc78)}}get[r(1893)](){return!!this[r(679)]}}function gs(s,t){let n=r;if(Ve||Ve)return new ua(s,t);if(e[n(1415)](st,St)&&e[n(1846)](e[n(537)],typeof indexedDB))return new ca(s,t);if((st||St)&&n(399)+"d"!=typeof localStorage)return new xa(s,t);throw new Error(e[n(1513)])}class fa{constructor(){let t=r;if(e[t(712)](e[t(815)],t(1467))){let n=new _0x5f47d5(e[t(1264)](2,_0x52e70a));n[t(510)](_0x585fad),_0xee6fb6[t(1464)]=n}else this["_interva"+t(1713)+"Id"]=null,this[t(1246)+"l"]=36e5,this[t(679)]=e.JHYGo(gs,e[t(724)],e.nPzWu)}async _intervalFlush(){let t=r,n={MqMWo:t(1399),fjTuF:function(o,c){return e[t(712)](o,c)},ivxyK:t(1147),MJahr:"jOWzd"};e[t(1275)](e[t(687)],t(899))?(this.emit(n[t(1159)],_0x5db4c8),this[t(823)+"e"]&&this.onmessage(_0x404c6b)):(e[t(1074)](clearInterval,this[t(1246)+"lTimeoutId"]),this[t(1246)+t(1713)+"Id"]=e.mIjOF(setInterval,()=>{let o=t;n[o(414)](n[o(1303)],n.MJahr)?this[o(1637)+o(1740)]():(this[o(877)+o(1271)+"Event"](_0x552c5a),_0xc5e642[o(510)](_0x54c2d1,_0x46fe79,_0x5e32ed[o(1399)].service))},this[t(1246)+"l"]))}async[r(1833)](){let t=r,n={wtBHS:function(o,c,f){return e.mvQxF(o,c,f)}};await this[t(679)].openDB()[t(568)](()=>{let o=t;if(e[o(563)]==="CZhUt")return _0x296622[o(1464)][DrTBrw.wtBHS(_0x1e9218,_0x1109c5,1)];this[o(1246)+o(1809)]()})}async[r(1637)+r(1740)](){let t=r,n={UmghU:e[t(1426)]};(await this[t(679)]?.getAll()||[])[t(1502)](({timestamp:f})=>f<Date[t(1447)]())[t(1170)](f=>{let g=t;if(n[g(1696)]!==n[g(1696)])return new _0x311155(_0x320b06,{message:_0x1f5b8e});this[g(679)]?.[g(586)](f.message_id)})}async[r(586)](t){return this[r(679)]?.del(t)}async set(t,n){return this[r(679)]?.set({message_id:t,timestamp:n})}async[r(1528)](t){let n=r;return this[n(679)]?.[n(1528)](t)}async[r(1704)](){let t=r;e.ZTSBr(clearInterval,this["_interva"+t(1713)+"Id"]),await this._qosDB?.[t(1704)]()}get isReady(){let t=r;return this[t(679)]?.[t(1893)]}}function tr(s){let t=r,n=!!this[t(1871)][t(1120)+"S"];if(!n)return{enabled:n,isQoSMessage:!1,isQoSAck:!1,isAckCleanupMessage:!1,ackMsgIds:[]};let o=qe(s[t(1399)].headers,e[t(870)],"2"),c=o&&e[t(1101)](qe,s[t(1399)][t(934)],e[t(634)],"1"),f=o&&e[t(1101)](qe,s[t(1399)].headers,e.jRnqY,"1"),g=f?it(s[t(1399)].headers,e.HbOOs)?.[t(862)](",").filter(Boolean)||[]:[];return{enabled:n,isQoSMessage:o,isQoSAck:c,isAckCleanupMessage:f,ackMsgIds:g}}async function ps(){let s=r;return this._QoSManager||(this[s(1612)+s(1593)]=new fa),this[s(1612)+s(1593)][s(1893)]||await this[s(1612)+"ger"][s(1833)](),this["_QoSMana"+s(1593)]}async function da(s,t){let n=r,{enableAutoAck:o}=this._options,c=e[n(1101)](qe,s[n(1399)][n(934)],n(662),"1"),f=e[n(404)](qe,s[n(1399)][n(934)],e[n(1325)],"1"),g=tr[n(1236)](this,s);if(e[n(1643)](o,c)){let{SeqID:p,LogID:l,service:y,LogIDNew:k,method:v}=s.message;this._sendAck({SeqID:p,LogID:l,LogIDNew:k,service:y,method:v,headers:[{key:e[n(1325)],value:"1"},{key:e[n(1359)],value:k||""},{key:e.emwGa,value:"0"}]})}f&&!g[n(1762)]&&this[n(877)+n(711)+n(1599)](s),e.HYoBA(t)}async function la(s,t){let n=r;this[n(1424)]("received",s[n(1399)]),e.ftUfv(t)}async function ha(s,t){let n=r,o={kXwEq:function(f,g,p){return e[P(601)](f,g,p)},jpvQJ:e[n(1651)]},c=e[n(1718)](Qr,await hs(s[n(1779)]));try{if(e[n(511)](c[n(1485)],Uint8Array))if(e[n(1218)](e.jxwqa,e[n(581)])){let f=e[n(1771)](this[n(1871)]["payloadE"+n(1183)],Object)?{force:!!this[n(1871)][n(694)+n(1183)].force,encoding:this._options.payloadEncoding[n(1803)]?this[n(1871)][n(694)+"ncoding"][n(1803)].replace(/\s/g,"")[n(672)+"ase"]():""}:{force:!1,encoding:this._options[n(694)+n(1183)]?this[n(1871)][n(694)+n(1183)][n(1493)](/\s/g,"")[n(672)+"ase"]():""},g=c["payloadE"+n(1183)]?c[n(694)+n(1183)].replace(/\s/g,"")[n(672)+n(1042)]():"",p=e.Xzcri(this[n(1871)][n(1685)+n(1114)],Object)?{force:!!this._options[n(1685)+n(1114)].force,type:this[n(1871)][n(1685)+n(1114)][n(1433)]?this[n(1871)][n(1685)+n(1114)][n(1433)][n(1493)](/\s/g,"")[n(672)+n(1042)]():""}:{force:!1,type:this[n(1871)][n(1685)+n(1114)]?this[n(1871)][n(1685)+n(1114)][n(1493)](/\s/g,"").toLowerCase():""},l=c[n(1685)+n(1114)]?c[n(1685)+n(1114)][n(1493)](/\s/g,"")[n(672)+n(1042)]():"",y=p[n(569)]?p[n(1433)]:l||p.type,k=f[n(569)]?f[n(1803)]:g||f.encoding,v=[e[n(524)],e[n(742)],e[n(1214)],e[n(1414)]],A=[e[n(813)],e[n(1507)]];this._options[n(872)+n(1243)+"extPayload"]&&v.includes(y)&&(!k||A[n(1386)](k))?c[n(421)+n(671)]=e.IGjqQ(ls,c[n(1485)],0,c[n(1485)][n(986)+"th"]):c[n(421)+"oad"]=""}else{this[n(877)+"hCloseEv"+n(1222)](o[n(1207)](_0x2054bf,o.jpvQJ,{code:1e3,reason:"bye"})),this[n(1741)+n(1676)]?.[n(1828)+n(1582)+"fig"](),this._pingLossCounter?.[n(949)+"nter"]();return}else c["textPayl"+n(671)]=""}catch(f){c[n(421)+"oad"]="",console[n(1030)](f)}s[n(1399)]=c,t()}function ga(s,t,n){let o=r,c={eGLlO:function(f,g){return e[P(1619)](f,g)},ZekBq:function(f,g){return e.ZTSBr(f,g)},SfIWE:function(f,g){return f&g},KqHST:function(f,g){return e[P(730)](f,g)},JYDQC:function(f,g){return e.EOPUq(f,g)}};if(e[o(1824)]===e.SElGD)try{this[o(444)]&&this[o(444)].close(_0x4d9d04,_0x369e42)}catch{}else{let f=n||8192,g=e[o(1848)](f,1),p=null,l=f;return function(y){let k=o;if(y<1||y>g)return c[k(1173)](s,y);l+y>f&&(p=c[k(1624)](s,f),l=0);let v=t[k(1236)](p,l,l+=y);return c[k(1709)](7,l)&&(l=c.KqHST(c.JYDQC(7,l),1)),v}}}let pa=4294967295;function ma(s,t,n){let o=r;return e[o(897)](RangeError,e.GyJCA(e[o(1653)](e[o(413)](e.AlpjJ(o(585)+o(439)+o(1036),s),e[o(392)])+e[o(1091)](t,1),e[o(851)]),n))}function wa(s,t,n){let o=r;if(e[o(1568)](n,pa))throw new Error(o(1141)+o(658)+"e");let c=3;for(;c>=0;){let f=e[o(1734)](255,n);rr(f,s,e.yJVhE(t,c)),n>>>=8,c--}return t+4}function _a(s,t){let n=r;if(e[n(1562)](e.BkFTd,e[n(1479)])){let o=0,c=t,f=e.AGvJI(t,4);for(;c<f;){let{value:g,offset:p}=e[n(1197)](nr,s,c);c=p,o=e.DZGxx(e[n(1411)](o,8),0),o+=g}return{value:o,offset:f}}else return _0x40fc60||(_0x2819be=[_0x120ade,_0x5d4a21,_0x3862b7,_0x10f388,_0x2ada81])}function ya(s,t,n){let o=r,c=e[o(457)][o(862)]("|"),f=0;for(;;){switch(c[f++]){case"0":if(!s)return n;continue;case"1":return e[o(982)](Zn(s,t,n),n);case"2":if(t[o(1244)])return e.domhM(t[o(1244)](s,n),n);continue;case"3":if(t.utf8Write)return e[o(1830)](t[o(1805)+"e"](s,n),n);continue;case"4":if(e.MoGHH(s[o(1843)],40))return e[o(1018)](e[o(404)](Zn,s,t,n),n);continue}break}}function ba(s,t){let n=r,o=new O(e[n(969)](e[n(1462)](s[e[n(547)](t,4)],24)|s[t+5]<<16,e[n(1108)](s[t+6],8))|s[e[n(412)](t,7)],e[n(873)](e.LqIdV(e[n(423)](e.fqVCz(s[e[n(635)](t,0)],24),e.xoUPL(s[t+1],16)),e[n(794)](s[e[n(1162)](t,2)],8)),s[e[n(861)](t,3)]),!0);return t+=8,{value:o,offset:e[n(1431)](t,8)}}function va(s,t,n){let o=r,c=s[o(821)],f=s[o(1845)];return t[n]=e.RynrW(f,24),t[n+1]=e[o(1878)](f,16)&255,t[e[o(759)](n,2)]=e.SyTdW(f,8)&255,t[e[o(530)](n,3)]=e.qYYVI(255,f),t[e[o(1810)](n,4)]=e[o(915)](c,24),t[e[o(1807)](n,5)]=e.ELuwT(e[o(416)](c,16),255),t[e.lAVmG(n,6)]=e[o(473)](e[o(1321)](c,8),255),t[n+7]=e[o(1553)](255,c),n+=8,n}function nr(s,t){let n=r;if(e[n(1335)]!==n(1521))return s.readUInt8?{value:s.readUInt8(t),offset:e[n(971)](t,1)}:{value:255&s[t],offset:e.dbNHp(t,1)};_0x92fbfe[n(1030)](_0x22e644)}function rr(s,t,n){let o=r;return t[o(1171)+"t8"]?t.writeUint8(s,n):t[n]=e[o(1541)](255,s),e[o(1309)](n,1)}let Sa=function(s){return new Uint8Array(s)},Ea=e[r(1648)](r(399)+"d",typeof Buffer)?Buffer[r(1146)+r(830)]:ga(Sa,Uint8Array[r(1268)+"e"][r(1626)]);(()=>{let s=r,t={JZdpc:function(o,c){return e.LsWgr(o,c)},YQtAc:function(o,c){return e[P(1188)](o,c)},fNdgu:function(o,c){return e[P(1124)](o,c)},ijLUE:function(o,c){return o<<c},UCsyS:function(o,c){return e[P(1514)](o,c)},XWkYC:function(o,c){return o&c},jQOPs:function(o,c){return e[P(792)](o,c)},uwVOr:function(o,c){return o|c},UGmTH:function(o,c){return o<c},nJhtz:function(o,c){return e.OYrls(o,c)},TReoZ:function(o,c){return e.CZpya(o,c)},SwCGf:function(o,c){return e[P(1844)](o,c)},knQoN:function(o,c){return e[P(895)](o,c)},AkJOO:function(o,c){return e.puHMC(o,c)},HtYXy:s(430),KecrJ:function(o,c,f,g){return e[s(1326)](o,c,f,g)},wzAmY:function(o,c){return o|c}},n=4294967295;return function(o,c,f=!0){let g=s;if(n=t[g(1374)](t[g(562)](127,o[c]),0),o[c++]<128)return{value:f?n:t[g(402)](0,n),offset:c};if(n=(n|t[g(1827)](t.UCsyS(127,o[c]),7))>>>0,o[c++]<128)return{value:f?n:0|n,offset:c};if(n=(n|t[g(1827)](t[g(515)](127,o[c]),14))>>>0,t[g(956)](o[c++],128))return{value:f?n:0|n,offset:c};if(n=t[g(809)](n,t[g(1827)](t[g(562)](127,o[c]),21))>>>0,t.UGmTH(o[c++],128))return{value:f?n:t[g(1098)](0,n),offset:c};if(n=t[g(1412)](n|(15&o[c])<<28,0),t[g(1017)](o[c++],128))return{value:f?n:t[g(1681)](0,n),offset:c};if((c+=5)>o[g(1843)])if(t[g(1336)](t[g(1483)],t[g(1483)]))this[g(679)]?.[g(586)](_0x40e77c[g(1158)+"id"]);else throw c=o[g(1843)],t[g(1100)](ma,c,10,o[g(1843)]);return{value:f?n:t.wzAmY(0,n),offset:c}}})();let Ca=16,sr=32;function Aa(s){let t=r,n=0,o={};for(let c=0;c<s[t(1843)];c++)if(e[t(1102)](e[t(1798)],e[t(1692)])){let f=this[t(679)][t(1505)+t(1417)](this[t(1353)]);return _0x47daef[t(1525)](e.wXUWN(f,"{}"))[_0x1255ca]}else o[s[c][t(1437)+t(989)]]=e.cyyND(ds,s[c][t(1437)+t(989)]),n+=e.tAVjS(14,o[s[c][t(1437)+t(989)]]);return[n,o]}function ms(s,t,n){let o=r;if(e[o(1275)](e[o(1165)],e[o(1165)]))e[o(1449)](_0x2bafda,_0x1ae890,32),e[o(1394)](_0x4f8704,_0x4751e3,e[o(1826)](_0x3098cd,_0x455ae5));else{let[c,f]=e[o(1277)](Aa,s),g=Ea(c),p=0;return s[o(1170)](l=>{let y=o,k=e[y(1633)][y(862)]("|"),v=0;for(;;){switch(k[v++]){case"0":console[y(1030)](e[y(1216)],p);continue;case"1":console[y(1030)](e[y(998)],p);continue;case"2":p=rr(f[l[y(1437)+"ame"]],g,p);continue;case"3":console[y(1030)](e[y(1476)],l,l[y(1231)]);continue;case"4":console[y(1030)](y(777)+y(1546),p);continue;case"5":p=e[y(695)](va,O.fromNumber(l[y(1717)]||t),g,p);continue;case"6":p=e[y(1326)](ya,l[y(1437)+y(989)],g,p);continue;case"7":p=e[y(820)](wa,g,p,l[y(1231)]||0);continue;case"8":p=e[y(1101)](rr,0,g,p);continue;case"9":console[y(1030)](e.kvcDj,p);continue;case"10":console.log(y(1546),p);continue}break}}),{frameType:sr,headers:[{key:e[o(1153)],value:n}],payload:g}}}function ka(s){let t=r,n=0,o=[];for(;e.NvWik(n,s[t(986)+"th"]);)if(e.udtcl(e[t(1143)],t(696)))e[t(1106)](_0x578a15,e[t(1790)]),this[t(831)](t(1238)+"e_success",_0x9080aa),this[t(831)](e[t(1132)],_0x18d1b1);else{let{offset:c}=e[t(904)](nr,s,n);n=c;let f={cursor_name:"",cursor:0,service:0},{value:g,offset:p}=e.KuybI(_a,s,n);f[t(1231)]=g,n=p;let{value:l,offset:y}=e.CUubA(nr,s,n);n=y,f[t(1437)+"ame"]=e[t(404)](ls,s,n,e[t(1432)](n,l)),n+=l;let{value:k,offset:v}=e.iaJts(ba,s,n);f[t(1717)]=k[t(1312)](),n=v,o[t(483)](f)}return o}function Pa(){return{frameType:sr,headers:[{key:e.EyXNV,value:e.QYRLx}],payload:void 0}}class Ia{constructor(t,n,o){let c=r;this["_cursorN"+c(624)]=t,this["_cursorF"+c(826)]=n,this[c(1051)+c(785)]=o,this._qosDB=e[c(1394)](gs,this[c(1154)+c(624)],e.WMasM)}async[r(1833)](){let t=r;await this[t(679)][t(1833)]()}async[r(1313)+"rs"](){let t=r,n={FOgFp:function(o,c){return e[P(552)](o,c)},cdLpv:e[t(1790)],QFoIf:e[t(1132)],SRkKw:function(o,c){return o(c)},UiWAN:function(o,c,f){return o(c,f)},QmVqL:e[t(931)]};if(e.FpYXY(e[t(1842)],e[t(543)])){if(!this[t(679)][t(1893)])return;let o=this._messageStrategy,c=await this._qosDB.getAll();switch(console[t(1030)](e[t(636)],c),o){case e[t(974)]:return c&&c[t(1843)]?e.JHQyB(ms,c,0,this[t(1557)+t(826)]):void 0;case e[t(1088)]:return;case e[t(1084)]:return c&&c[t(1843)]?ms(c,0,this[t(1557)+t(826)]):Pa()}}else return new _0x4310d8((o,c)=>{let f=t,g={nQrwM:function(y,k){return n[P(1240)](y,k)},CzUDC:n[f(732)],bljTH:n[f(407)],gCpdX:function(y,k){return n.SRkKw(y,k)},QGeSk:f(1238)+f(1509)+"s"};this[f(1040)+f(1190)](),this[f(1867)+"gTimeoutId"]=n[f(970)](_0x451e04,this[f(1413)].bind(this),this[f(1871)][f(1671)+f(1178)]);let p=()=>{let y=f;g[y(1607)](o,g[y(1034)]),this.off("ping_onc"+y(1509)+"s",p),this[y(831)](g.bljTH,l)},l=()=>{let y=f;g[y(1794)](c,y(1398)),this[y(831)](g[y(1668)],p),this[y(831)](y(1238)+y(632)+"t",l)};this.on(n[f(1196)],p),this.on(n.QFoIf,l),this._ping()})}async[r(510)](t,n,o){let c=r;return console[c(1030)](e[c(1789)],t,n,o),this[c(679)][c(510)]({cursor_name:t,cursor:n,service:o})}async[r(1258)+"rs"](t){let n=r,o=e[n(1445)](ka,t);for(let c of o)console[n(1030)](e[n(1736)],o),await this[n(679)][n(510)](c)}async[r(1528)](t){let n=r;return(await this[n(679)][n(1528)](t))?.[n(1717)]}async[r(1704)](){let t=r;if(e[t(655)](e[t(704)],e[t(394)]))await this[t(679)][t(1704)]();else return!!(e.xRyJa(this[t(1062)+t(388)],this[t(1217)+"s"][t(1843)])||e[t(1377)](this[t(1062)+t(388)],e.OkhLy(this.endpoints.length,1))&&e[t(389)](this["currentEndpointT"+t(1338)+"t"],this[t(1770)+"es"]))}[r(1754)+r(710)+"Name"](t){this._cursorFileName=t}get[r(1893)](){let t=r;return this[t(679)][t(1893)]}}let Da=e.qjKKt;async function ws(s){let t=r,n={ytdQK:e[t(1877)]};if(e[t(900)](e[t(945)],e.UNgmt)){if(!this._options[t(1120)+"S"])return null;let{aID:o,fpID:c,messageStrategy:f}=this[t(1871)],g=e[t(578)](s,Da);try{if(this[t(921)+t(1837)]){if(e.NUEGi(e[t(1666)],e[t(765)]))return this._socket[t(871)+"ns"];s&&this[t(921)+t(1837)][t(1754)+t(710)+t(549)](s)}else this[t(921)+t(1837)]=new Ia(c+"_"+o+"_"+g,g,f);return this[t(921)+t(1837)][t(1893)]||await this[t(921)+t(1837)][t(1833)](),this[t(921)+t(1837)]}catch{return e[t(1562)](e[t(1073)],t(843))?null:_0xf1399e[t(1061)]()}}else{let o=_0x1292bd(n[t(1584)],{message:_0x4331ca[t(1399)],code:_0x1065d1[t(1123)+t(1768)],error:_0x1d9a5a});this[t(877)+t(925)+t(1222)](o)}}async function Ta(s,t){let n=r,o={Yzytt:e[n(739)],crkmg:function(g,p){return g!==p}};if(e[n(924)](e[n(1571)],e[n(1242)])){let g=o[n(762)][n(862)]("|"),p=0;for(;;){switch(g[p++]){case"0":if(NDwjXa.crkmg(void 0,c))return c.exports;continue;case"1":var c=_0x1ec981[_0x1c5947];continue;case"2":return f[n(1887)];case"3":_0x558ccd[_0x547061](f,f[n(1887)],_0x721850);continue;case"4":var f=_0x515c0d[_0x1e4401]={exports:{}};continue}break}}else{let g=e.nCdBf(qe,s[n(1399)][n(934)],e[n(1745)],"-1"),p=e[n(1286)](qe,s[n(1399)][n(934)],n(1863),"1"),l=e[n(456)](it,s[n(1399)][n(934)],e[n(1003)]),y=Number(e[n(514)](it,s[n(1399)].headers,e[n(1384)]))||0,k=tr[n(1236)](this,s),v=qe(s[n(1399)][n(934)],e[n(1229)],"2"),A=it(s[n(1399)][n(934)],n(1257)+n(403)+"e"),T=Number(e[n(1455)](it,s.message[n(934)],e[n(853)]));if(k.isQoSAck)return t();let G=k[n(590)+n(1127)]?await ps.call(this):null;if(e[n(1729)](s[n(1399)][n(1231)],0)&&p&&!g||s.message[n(1231)]>0){if(l&&k["isQoSMes"+n(1127)]&&G)return!!!await G[n(1528)](l)&&(this[n(877)+n(1271)+"Event"](s),await G.set(l,Date[n(1447)]()+y)),e[n(1249)](t);if(v){let M=await ws[n(1236)](this);if(!M)return this[n(877)+"hMessage"+n(883)](s),e[n(1249)](t);let X=await M[n(1528)](A)??-1;if(e[n(1844)](X,T))this[n(877)+n(1271)+"Event"](s),M[n(510)](A,T,s.message[n(1231)]);else throw new Error(n(1076)+n(1276)+n(1241)+T+(" larger "+n(714)+n(1898)+"r ")+X);return e[n(988)](t)}return this[n(877)+n(1271)+n(883)](s),t()}}}async function La(s,t){let n=r,o=tr[n(1236)](this,s);if(!o[n(590)+n(1127)])return e[n(1793)](t);let c=await ps[n(1236)](this);if(o[n(886)+n(559)+n(1066)]&&o.ackMsgIds[n(1843)])for(let f of o[n(1853)+"s"])await c[n(586)](f);e.mDsYa(t)}async function Ra(s,t){let n=r;if(e[n(758)](e[n(608)],e[n(1895)]))this[n(1308)+"er"]&&_0x50ca96[n(1149)+n(1538)](n(639),this["_handleO"+n(1714)]),this[n(1308)+"er"]&&_0x26a9b0[n(1149)+"Listener"](e[n(1597)],this._handleOffLine),this[n(1308)+"er"]&&_0x2df1b9[n(1149)+n(1538)](n(1054),this[n(491)+"ageHide"]),this[n(1308)+"er"]&&_0x3ae05f[n(1149)+n(1538)](e[n(766)],this[n(491)+n(393)]);else{let o=e[n(1235)](s[n(1399)].frameType,Ca),c=e[n(1531)](s.message.frameType,sr);if(e[n(1643)](!o,!c))return t();let f=e.SXiTD(it,s[n(1399)].headers,e[n(1153)]);if(!f)return e[n(519)](t);let g=await ws.call(this,f);if(!g)return e[n(705)](t);if(o){let p=await g[n(1313)+"rs"](),l={frameType:p?.[n(482)+"e"],SeqID:O.fromNumber(this[n(1490)]++),LogID:O[n(652)+"er"](this[n(1871)][n(427)+"erator"]()),service:9e3,method:5,headers:p?.[n(934)],payload:p?.[n(1485)]},y=C(l);this[n(444)]&&this._ws[n(1396)+"te"]&&this[n(444)][n(1611)](y)}if(c){let p=s[n(1399)].payload;p&&g[n(1258)+"rs"](p)}}}let Na=async function(s,t){let n=r;this._isInit=!1,clearTimeout(this[n(1254)+"ionTimeo"+n(864)]),e[n(923)](t)},Oa=async function(s,t){let n=r;if(!this[n(444)]||e[n(816)](this[n(444)][n(1396)+"te"],this[n(1554)]))return e[n(988)](t);let{pingInterval:o}=this[n(1871)];this[n(1741)+"tManager"]?.[n(1828)+n(1582)+n(1759)]();for(let f=0;e.AVFzs(f,this[n(1051)+"Queue"].length);f++){let g=this[n(1051)+n(1077)][f];if(e[n(703)](this[n(444)][n(1396)+"te"],this[n(1554)])&&e[n(816)](null,g))this[n(444)]&&this[n(444)][n(1611)](g),this[n(1051)+n(1077)][f]=null;else break}this[n(1051)+n(1077)]=this[n(1051)+n(1077)][n(1502)](f=>!!f),this[n(1867)+n(386)+"Id"]=e[n(1328)](setTimeout,()=>this[n(1413)](),o),this["_dispatc"+n(1458)+"nt"](s),this._isBrowser&&this[n(444)]&&(this[n(444)][n(1590)+"pe"]=this._binaryType);let c=this[n(1741)+"tManager"]?.[n(1372)+n(1210)+"nt"]();this[n(1424)]("open "+c+n(571)),t()},Ba=async function(s,t){let n=r,o=this[n(1741)+n(1676)]?.[n(1372)+n(1210)+"nt"]();this[n(1424)](n(517)+o),e.RfVdk(t)};class Ma extends Xn{constructor(t){let n=r,o={DVVeI:function(p,l){return p<l},WGqga:function(p,l){return e[P(1880)](p,l)},Xdjzn:function(p,l){return e[P(1195)](p,l)},CeUvm:function(p,l){return e.Hqhgm(p,l)},NaImU:function(p,l){return e[P(1450)](p,l)},RDElJ:function(p,l){return e[P(890)](p,l)},uAgAb:n(1119),jeLay:e[n(1651)],VjAfB:n(406),jkZnr:function(p,l){return p===l},gEfie:n(1453),qmYrx:e[n(1591)],WIeih:function(p,l){return e[n(798)](p,l)},xkixH:function(p,l,y){return e.RLmpN(p,l,y)},IQzvF:function(p,l,y){return e[n(1532)](p,l,y)}};super(),this["_miniNav"+n(1383)+"line"]=!0,this._isBrowser=st,this._isNode=Zo,this[n(802)+"T"]=Ve,this[n(673)+"X"]=vt,this[n(1380)+"r"]=St,this[n(1051)+n(1077)]=[],this[n(1741)+n(1676)]=null,this["_readyCl"+n(1133)]=!1,this[n(874)+n(1114)]=e[n(1655)],this[n(1254)+"Lock"]=!1,this[n(1254)+n(603)+n(864)]=null,this._reconnectTimeoutId=null,this[n(1867)+n(386)+"Id"]=null,this[n(1490)]=0,this._isInit=!1,this[n(1348)]="",this[n(1612)+n(1593)]=null,this[n(921)+n(1837)]=null,this[n(939)+"sCounter"]=null,this[n(1540)+"ls"]=n(411),this[n(946)]=3,this.CONNECTING=0,this[n(1554)]=1,this[n(1831)]=2,this[n(954)]=p=>{let l=n;try{e[l(1400)](fs,this,p,[Na,Oa,Ba])}catch(y){let k=e[l(529)](ue,e[l(1877)],{message:y[l(1399)],code:Fe[l(1137)+"OR"],error:y});this[l(877)+l(925)+l(1222)](k)}},this[n(1103)+"ge"]=async p=>{let l=n,{pingInterval:y,pingFrequency:k}=this._options;if((e[l(984)]("hi",p[l(1779)])&&e[l(1317)]===k||e[l(758)](l(1712),k))&&(this[l(1040)+l(1190)](),this[l(806)](e.qbBdr,e.JVUZW),this["_pingPon"+l(386)+"Id"]=setTimeout(this[l(1413)][l(953)](this),y)),p[l(1779)]!=="hi")try{e[l(1101)](fs,this,p,[ha,da,La,Ra,Ta,la])}catch(v){let A=ue(e.uRZCb,{message:v[l(1399)],code:Fe[l(1123)+"ERROR"],error:v});this["_dispatc"+l(925)+"ent"](A)}},this[n(1352)]=p=>{let l=n,y=this[l(1741)+"tManager"]?.[l(1350)+l(749)+"es"](),k=this[l(1741)+l(1676)]?.["getCurre"+l(1210)+"nt"]();if(y&&!p.message){let v=l(995)+k+(l(784)+l(1056)+l(677)+"ed");this["_dispatc"+l(925)+l(1222)](ue(e.uRZCb,{message:v,code:Fe[l(395)+l(1213)+"R"],error:p}));return}this._ws&&e.tVaAR(this[l(444)][l(1396)+"te"],this[l(1554)])&&this[l(448)+l(1297)](),this[l(877)+l(925)+l(1222)](e[l(775)](ue,e[l(1877)],{message:p[l(1399)],code:Fe[l(1620)+l(1013)],error:p}))},this._onClose=async p=>{let l=n,y={qvHll:function(v,A){return o.DVVeI(v,A)},pKbeH:function(v,A){return o[P(1840)](v,A)},FzEkS:function(v,A){return v&A},oVaLH:function(v,A){return o[P(718)](v,A)},tcSYo:function(v,A){return o[P(1840)](v,A)},NroXc:function(v,A){return v&A},xZQaF:function(v,A){return v>>A},YibXQ:function(v,A){return o[P(1840)](v,A)},ahAte:function(v,A){return o[P(975)](v,A)},vtvtD:function(v,A){return o[P(1001)](v,A)},rJIqW:function(v,A,T){return v(A,T)},NbOVR:function(v,A){return v|A},eIcgz:function(v,A){return o[P(1001)](v,A)}};this["_clearTi"+l(1344)](),this[l(1040)+l(1190)](),this[l(1838)+l(1470)+"rs"](),this._ws=null,this[l(1254)+l(688)]=!1;let k=this[l(1741)+l(1676)]?.[l(1350)+"chMaxTries"]();if(!k&&this["_navigat"+l(958)]()&&!this["_readyCl"+l(1133)])if(o[l(502)](o[l(968)],o[l(968)]))FafJKr[l(546)](_0x5ba17f,2048)?_0x17cb9c[_0x13b0f2++]=FafJKr[l(1693)](FafJKr[l(1902)](FafJKr.oVaLH(_0x51e8c4,6),31),192):(FafJKr[l(546)](_0x570ac5,65536)?_0x109f4b[_0x1f4edd++]=FafJKr[l(1885)](FafJKr[l(950)](FafJKr[l(863)](_0x5e272c,12),15),224):(_0x39507f[_0x205bf6++]=FafJKr[l(1578)](FafJKr[l(950)](_0x22e877>>18,7),240),_0x561ab9[_0x110cd2++]=FafJKr[l(950)](_0x51b550>>12,63)|128),_0x3412de[_0x1b25fa++]=FafJKr[l(1578)](FafJKr[l(1404)](_0x4cc913,6)&63,128)),_0x571416[_0x1ca6dd++]=FafJKr[l(1693)](FafJKr[l(1341)](63,_0x2614a0),128);else{let v=this["_endpoin"+l(1676)]?.["getCurre"+l(1210)+"nt"](),A=this._options["reconnec"+l(1872)+l(1585)](p[l(1726)],p[l(1517)]);this["_dispatc"+l(1523)+l(1222)](pe(o[l(617)],{code:1006,reason:p.reason||l(1220)+l(1721)+l(428)+l(1105)+l(1511)+l(1364)+v,willReconnect:A})),A&&this[l(1254)]();return}if(o[l(502)](1e3,p[l(1726)])&&this[l(398)+l(1133)]){this[l(877)+l(1523)+l(1222)](pe(l(1314),{code:1e3,reason:o[l(835)]})),this["_endpoin"+l(1676)]?.[l(1828)+l(1582)+"fig"](),this[l(939)+"sCounter"]?.[l(949)+"nter"]();return}if(p[l(1726)]!==1e3&&k)if(o[l(1773)](o[l(1742)],o[l(1300)]))FafJKr[l(1700)](_0x34d565,_0x514d10,FafJKr[l(1792)](FafJKr[l(1284)](127,_0x3dfb71),128)),_0xa3bccc>>>=7;else{let v=this[l(1741)+l(1676)]?.[l(1372)+l(1210)+"nt"](),A=p.reason;A||(A=await o[l(1695)](oa,this._url)),A=l(1220)+"ng faile"+l(1080)+A+(", hostna"+l(892))+v+(l(1737)+l(1049)+l(1545)),this["_dispatchCloseEv"+l(1222)](pe(o[l(617)],{code:p[l(1726)],reason:A}));let T="connect "+v+(l(784)+"ax retri"+l(677)+"ed");this[l(877)+l(925)+"ent"](o[l(1329)](ue,"error",{message:T,code:Fe["MAX_RETR"+l(1213)+"R"]})),this[l(1741)+l(1676)]?.["resetEndpointCon"+l(1759)](),this[l(939)+l(1409)]?.[l(949)+"nter"]();return}if(p[l(1726)]!==1e3&&!p.reason){let v=this[l(1741)+l(1676)]?.[l(1372)+"ntEndpoint"]();this[l(877)+l(1523)+"ent"](o[l(841)](pe,o[l(617)],{code:p[l(1726)],reason:l(1220)+l(1721)+l(428)+l(1105)+l(1511)+"ame: "+v})),this[l(1741)+l(1676)]?.[l(1828)+l(1582)+l(1759)](),this[l(939)+"sCounter"]?.[l(949)+l(917)]();return}this["_dispatc"+l(1523)+l(1222)](p),this[l(1741)+l(1676)]?.[l(1828)+l(1582)+l(1759)](),this[l(939)+"sCounter"]?.["resetCou"+l(917)]()},this[n(1722)]=null,this[n(463)]=null,this.onmessage=null,this[n(1725)]=null,this["onStartR"+n(857)]=null,this["onReceiv"+n(1369)]=null,this["onStopIm"+n(1900)+n(987)+"ct"]=null,this[n(396)+n(1714)]=this._handleOnLine[n(953)](this),this["_handleO"+n(1478)]=this[n(396)+n(1478)][n(953)](this),this["_handleP"+n(507)]=this[n(491)+"ageHide"][n(953)](this),this[n(491)+"ageShow"]=this[n(491)+"ageShow"][n(953)](this),this[n(1871)]={url:"",automaticOpen:!0,initReconnectInterval:1e3,maxReconnectInterval:1e4,reconnectIntervalGrowFactor:2,timeoutInterval:5e3,maxRetries:5,debug:!1,maxMessageQueueLength:e[n(907)](1,0),service:0,logIDGenerator:x,headers:void 0,payloadEncoding:"",payloadType:"",fpID:"",deviceID:"",accessKey:"",ttwID:"",bddID:"",aID:"",disableAutoReconnect:!1,customParams:{},pingInterval:15e3,pingTimeoutInterval:4e3,pingFrequency:e.QKoLZ,pingLossCount:2,enableTransformTextPayload:!1,logIDNewConfig:{enableAutoGenerateLogIDNew:!1,userIp:""},miniProgramParams:{customHttpHeader:{}},enableAutoAck:!1,reconnectInterceptor:()=>!0,enableQoS:!1,QoSLevel:2,messageStrategy:e.vYpLc,env:{xTTEnv:"",xUseEnv:""},listenNetworkChanged:!0};let{url:c,ws:f}=t,g=Array[n(659)](c)?c:e[n(1780)](e[n(1414)],typeof c)?[c]:[];if(!g||g.length===0)throw new Error(n(1549)+"rovide v"+n(1487));if(!e[n(1277)](na,f))throw new Error(e.ShQCX);Object[n(1738)](this[n(1871)],t),this["_endpoin"+n(1676)]=new us(g,this._options[n(1770)+"es"]),this[n(939)+"sCounter"]=new ia(this[n(1871)][n(588)+n(645)]),this[n(1871)][n(1224)+"cOpen"]&&(this[n(908)]=!0,this[n(1254)]()),this[n(1871)][n(771)+n(1576)+"nged"]&&(this._isMiniTT||this[n(673)+"X"]?this[n(1870)+n(990)+n(453)]():this._isBrowser&&this[n(1422)+"balEventListener"]())}[r(396)+r(1714)](){let t=r;this._options[t(1544)+t(1604)+t(1500)]||this[t(398)+"osed"]||this["_handleR"+t(857)]()}[r(396)+r(1478)](){let t=r;this[t(1346)+t(786)+"t"]();let n=Qn(e.yjWdV,{message:"stop imm"+t(1703)+t(1481)+"ct"});this[t(983)+t(1900)+t(987)+"ct"]&&this[t(983)+t(1900)+t(987)+"ct"](n)}[r(1422)+r(1774)+r(1538)](){let t=r;this[t(1308)+"er"]&&window[t(1149)+t(1538)](e.TiRHO,this[t(396)+t(1714)]),this[t(1308)+"er"]&&window[t(1149)+t(1538)](e[t(1597)],this["_handleO"+t(1478)]),this._isBrowser&&window[t(1149)+"Listener"](e[t(1020)],this[t(491)+"ageHide"]),this[t(1308)+"er"]&&window[t(1149)+t(1538)](e[t(766)],this[t(491)+"ageShow"])}[r(1043)+r(1774)+r(1538)](){let t=r,n={FROny:t(1851)};if(e.wVPRn(e[t(1519)],e.PUEmD))switch(_0xaebddf){case sQoQwC.FROny:case t(1690):return{[t(556)+_0x2a770b]:1,"x-tt-env":_0x2f6d95};default:return{}}else this[t(1308)+"er"]&&window[t(938)+"entListener"](e[t(487)],this[t(396)+"nLine"]),this[t(1308)+"er"]&&window[t(938)+t(1425)+t(733)](t(1356),this[t(396)+t(1478)]),this[t(1308)+"er"]&&window[t(938)+t(1425)+t(733)](e[t(1020)],this[t(491)+"ageHide"]),this[t(1308)+"er"]&&window[t(938)+t(1425)+t(733)](e[t(766)],this[t(491)+t(393)])}[r(491)+r(507)](t){let n=r;!t[n(1185)+"d"]&&(this[n(1308)+"er"]&&window["removeEv"+n(1425)+n(733)](e.fMYhO,this[n(491)+n(507)]),this._isBrowser&&window[n(938)+n(1425)+n(733)](n(616),this[n(491)+n(393)]),this.close()),this[n(1308)+"er"]&&window[n(938)+"entListe"+n(733)](e[n(487)],this[n(396)+n(1714)]),this[n(1308)+"er"]&&window[n(938)+n(1425)+n(733)](e[n(1597)],this[n(396)+"ffLine"])}["_handleP"+r(393)](t){let n=r;t[n(1185)+"d"]&&(this[n(1225)+n(958)]()&&(!this[n(444)]||e[n(1333)](this._ws[n(1396)+"te"],this[n(1554)])||e[n(1205)](this[n(444)].readyState,this[n(1786)+"NG"]))&&this[n(396)+"nLine"](),this._isBrowser&&window[n(1149)+n(1538)](e[n(487)],this["_handleO"+n(1714)]),this[n(1308)+"er"]&&window[n(1149)+"Listener"]("offline",this[n(396)+n(1478)]))}async[r(824)+r(1743)](t){let n=r,{fpID:o,deviceID:c,bddID:f,ttwID:g,accessKey:p,aID:l,customParams:y={},enableAutoAck:k,enableQoS:v,QoSLevel:A,env:T}=this._options,G,M,X;if(this[n(1308)+"er"]||this[n(673)+"X"]||this._isMiniTT)if(e[n(477)]===e[n(477)])G=location&&e[n(1113)](e[n(1131)],location[n(731)])?e[n(770)]:e[n(498)],M=t[n(1493)](/((^ws)|(^http))((?:[s]*:\/\/))/,""),X=/^wss(.*:\/\/)/[n(1702)](t)?t:""+G+M;else return this._socket[n(748)];else G=e[n(770)],M=t[n(1493)](/(^http)((?:[s]*:\/\/))/,""),X=/(^ws)((?:[s]*:\/\/))/[n(1702)](M)?M:""+G+M;let _s=f?n(432):g?e.tnucL:e[n(1647)],ys=f||g||c;if(e[n(793)](!ys,!_s))throw new Error(e.NGFiD);let za=e.EGBrn(e[n(1836)],typeof y)?await e[n(1793)](y):y,Fa=T?e[n(1471)](sa,T[n(1389)],T[n(866)]):{},ir=Object[n(1738)]({device_platform:e.PXQmB,version_code:e.tcVxy,access_key:p,fpid:o,aid:l,[_s]:ys,xsack:k?1:0,xaack:k?1:0,xsqos:v?1:0,qos_level:v?A:void 0,qos_sdk_version:2,...Fa},za),qa=Object[n(1480)](ir)[n(1852)]((or,ar)=>ir[ar]!==void 0?""+or+(or?"&":"?")+ar+"="+ir[ar]:or,"");return X+n(1403)+qa}async[r(1254)](){let t=r;if(!(this[t(1254)+t(688)]||this[t(398)+t(1133)])){this[t(1254)+t(688)]=!0;try{let n=this[t(1741)+t(1676)]?.[t(1580)+t(424)+"ointReac"+t(1135)+"tries"](),{timeoutInterval:o}=this[t(1871)];if(n){let f=this["_endpoin"+t(1676)]?.[t(1372)+"ntEndpoint"](),g=this[t(1741)+t(1676)]?.[t(1788)+t(769)+"pointAnd"+t(1092)+t(1370)](),p=this[t(1741)+t(1676)]?.[t(1372)+"ntEndpoi"+t(909)+t(1142)]();if(g){let l=t(995)+f+(t(1679)+t(1737)+t(1049)+"ached, will use "+t(1482)+t(1181))+g+(t(1039)+"y"),y=ue(t(533),{message:l,code:Fe["MAX_RETR"+t(1213)+"R"]});this[t(1424)](l),this[t(877)+t(925)+t(1222)](y),this[t(1348)]=await this[t(824)+t(1743)](g),this[t(1424)](t(995)+g+" "+p+t(1496)),this[t(1838)+"sListeners"]()}else{let l=t(995)+f+(t(1679)+t(1737)+"tries re"+t(1545));this._debug(l),this[t(877)+t(925)+t(1222)](e[t(1461)](ue,e[t(1877)],{message:l,code:Fe[t(395)+t(1213)+"R"]}));return}}else{let f=this[t(1741)+t(1676)]?.["getCurre"+t(1210)+t(1200)+t(706)](),g=this[t(1741)+t(1676)]?.[t(1372)+"ntEndpoi"+t(909)+t(1142)]();this[t(1348)]=await this[t(824)+t(1743)](e.qPLCJ(f,"")),this._debug(t(995)+f+" "+g+t(1496)),this["_removeW"+t(1470)+"rs"]()}if(this[t(908)])this._isInit=!1;else{let f=e.lelbj(Qn,e[t(1674)],{message:e[t(561)]});this[t(602)+t(857)]&&this[t(602)+t(857)](f)}let c=this._endpointManager?.[t(1372)+t(1210)+t(909)+t(1142)]()||0;e[t(1429)](c,1)&&await this._wait(e[t(1672)](c,1)),this[t(1424)](t(1220)+t(592)+this._url+(t(818)+t(973))+this[t(1540)+"ls"]),this._ws=e[t(613)](ta,{url:this[t(1348)],protocols:[this[t(1540)+"ls"]],headers:this[t(1871)][t(1334)+t(1706)+"s"][t(1475)+"tpHeader"]},this._options.ws),(this[t(1308)+"er"]||this._isWorker)&&this[t(444)]&&(this[t(444)][t(1590)+"pe"]=this[t(874)+"ype"]),this["_addWsLi"+t(620)](),this[t(1254)+t(603)+t(864)]=e[t(1854)](setTimeout,this[t(1168)+"ut"].bind(this),o)}catch(n){throw this[t(1254)+t(688)]=!1,n}}}[r(1021)+r(1344)](){let t=r;e[t(1293)](clearTimeout,this[t(1254)+t(603)+"utId"]),this["_connect"+t(603)+t(864)]=null}[r(1040)+r(1190)](){let t=r;e[t(552)](clearTimeout,this._pingPongTimeoutId),e[t(1527)](clearTimeout,this[t(1387)+t(1621)+"tId"]),this[t(1867)+t(386)+"Id"]=null,this[t(1387)+"ctTimeou"+t(1683)]=null}[r(1424)](...t){let n=r;this._options.debug&&console.log[n(1203)](console,[e.oAhWv,...t])}_getIntervalValue(t){let n=r,{initReconnectInterval:o,maxReconnectInterval:c,reconnectIntervalGrowFactor:f}=this[n(1871)],g=e[n(1579)](o,Math[n(952)](f,e.LCvVA(t,1)));return e[n(709)](g,c)?c:g}[r(1413)](){let t=r;if(this[t(444)]&&e.twoSS(this[t(444)][t(1396)+"te"],this[t(1786)+"NG"])){this[t(1040)+t(1190)](),this[t(1867)+t(386)+"Id"]=e[t(657)](setTimeout,this[t(1413)][t(953)](this),this[t(1871)][t(1671)+t(1178)]);return}if(!this[t(444)]||e[t(699)](this[t(444)][t(1396)+"te"],this[t(1554)]))return void this[t(1510)+t(857)]();this[t(444)]&&this[t(444)][t(1611)]("hi"),this[t(1387)+t(1621)+t(1683)]=e[t(641)](setTimeout,this[t(1510)+t(857)+t(763)].bind(this),this[t(1871)][t(493)+"outInter"+t(1419)])}["_handleR"+r(857)+"Timeout"](){let t=r;this[t(939)+t(1409)]?.[t(495)](),this[t(806)](e[t(1132)],t(1398)),this._pingLossCounter?.[t(1350)+t(1215)+"nt"]()?this[t(1510)+"econnect"]():this._ping()}[r(1225)+r(958)](){let t=r;return this[t(802)+"T"]||this[t(673)+"X"]?this[t(1418)+t(1383)+t(647)]:(this[t(1308)+"er"]||this[t(1380)+"r"])&&this[t(1871)][t(771)+"tworkCha"+t(484)]?navigator[t(1550)]:!0}[r(1510)+"econnect"](){let t=r;!this["_navigat"+t(958)]()||this[t(398)+t(1133)]||(this[t(1741)+"tManager"]?.resetEndpointConfig(),this[t(939)+t(1409)]?.[t(949)+t(917)](),this[t(444)]?this[t(448)+t(1297)](1001,e[t(1874)],!0):this[t(1254)]())}[r(1870)+"etWorkCh"+r(453)](){let t=r,n={TdYGL:function(o,c){return e[P(578)](o,c)}};this._isMiniTT?tt[t(447)+t(955)+t(1555)](({isConnected:o})=>{let c=t;if(e.YgyaE(e[c(713)],e[c(713)]))this["_miniNav"+c(1383)+c(647)]=o,o?this[c(396)+c(1714)]():this[c(396)+"ffLine"]();else{let f=this[c(679)][c(504)](this[c(1353)]),g=_0x4de035[c(1525)](WHXqeu[c(1537)](f,"{}"));return g[_0x3c1e04]=void 0,this[c(679)].setItem(this[c(1353)],_0x3b9fc8[c(438)+"y"](g))}}):this._isMiniWX&&wx[t(447)+"kStatusC"+t(1555)](({isConnected:o})=>{let c=t;this[c(1418)+c(1383)+c(647)]=o,o?this["_handleO"+c(1714)]():this["_handleO"+c(1478)]()})}_wait(t){return new Promise(n=>{let o=P;setTimeout(n,this[o(606)+o(1008)+"e"](t))})}[r(448)+r(1297)](t=1e3,n="",o=!1){let c=r;this._ws&&this[c(1346)+"WebSocket"](t,n,o)}_onTimeout(){let t=r,n=this[t(1741)+t(1676)]?.[t(1372)+t(1210)+"nt"]();this[t(1424)](t(995)+n+t(1679)),this[t(448)+t(1297)](1001,e[t(1638)],!0)}[r(417)](t){let n=r,o=e[n(1074)]($n,t);this._ws&&e[n(1102)](this[n(444)].readyState,this.OPEN)&&(this[n(444)]&&this[n(444)].send(o),this[n(1424)](e[n(941)],t))}["_removeW"+r(1470)+"rs"](){let t=r;this[t(444)]&&(this._ws["removeEv"+t(1425)+"ner"](e[t(1631)],this._onOpen),this[t(444)][t(938)+t(1425)+t(733)](t(1314),this._onClose),this[t(444)][t(938)+t(1425)+t(733)](e[t(640)],this[t(1103)+"ge"]),this[t(444)][t(938)+t(1425)+t(733)]("error",this[t(1352)]))}[r(829)+r(620)](){let t=r;this._ws&&(this[t(444)][t(1149)+t(1538)](t(1875),this._onOpen),this[t(444)]["addEvent"+t(1538)](e[t(1651)],this[t(1613)]),this[t(444)].addEventListener(e[t(640)],this[t(1103)+"ge"]),this._ws[t(1149)+t(1538)](e[t(1877)],this[t(1352)]))}["_wsInsta"+r(779)](t=1e3,n=""){let o=r;try{this._ws&&this[o(444)].close(t,n)}catch{}}["_destroy"+r(786)+"t"](t=1e3,n="",o=!1){let c=r;if(this[c(1040)+c(1190)](),this[c(1021)+"mer"](),this[c(1838)+c(1470)+"rs"](),this[c(799)+c(779)](1e3,n),this[c(1254)+c(688)]=!1,o&&this[c(1225)+"orOnline"]()&&!this[c(398)+c(1133)])if(e.XJQQU(e.Fofiv,e[c(1283)])){if(this[c(1741)+c(1676)]?.[c(1350)+"chMaxTries"]()){let g=this[c(1741)+c(1676)]?.[c(1372)+c(1210)+"nt"]();this[c(877)+c(1523)+c(1222)](e[c(692)](pe,c(1314),{code:1006,reason:c(995)+g+(c(1679)+", max re"+c(1049)+c(1545)),wasClean:!0}))}else if(e.zpRKn(e.QCBLj,e[c(980)])){let g=this._options[c(1530)+c(1872)+"ptor"](t,n);this["_dispatc"+c(1523)+c(1222)](pe(e[c(1651)],{code:t,reason:n,wasClean:!0,willReconnect:g})),g&&this[c(1254)]()}else this["currentI"+c(388)]=0,this[c(1489)+c(654)+c(1338)+"t"]=0;return}else return _0x1abb14||(_0x1bf37c=[_0x41a6a9.prototype[c(1388)],_0x3a6627[c(1268)+"e"][c(1104)],_0xbc0b6c[c(1268)+"e"].continuePrimaryKey]);this[c(1225)+c(958)]()||this[c(398)+"osed"]?this[c(877)+c(1523)+c(1222)](e.JVJkD(pe,"close",{code:t,reason:c(406)})):this[c(877)+c(1523)+c(1222)](e[c(594)](pe,e[c(1651)],{code:1006,reason:e[c(1551)]})),this[c(444)]=null,this[c(1741)+c(1676)]?.[c(1828)+"pointCon"+c(1759)](),this[c(939)+c(1409)]?.[c(949)+c(917)]()}[r(877)+r(1458)+"nt"](t){let n=r;this[n(806)](e[n(1631)],t),this[n(1725)]&&this[n(1725)](t)}[r(877)+r(1271)+r(883)](t){let n=r;this.emit(e[n(640)],t),this[n(823)+"e"]&&this[n(823)+"e"](t)}[r(877)+r(711)+r(1599)](t){let n=r;this[n(806)](e.SJnwz,t),this[n(891)+n(1369)]&&this[n(891)+n(1369)](t)}[r(877)+r(925)+r(1222)](t){let n=r;this[n(806)](n(533),t),this[n(463)]&&this[n(463)](t)}[r(877)+r(1523)+r(1222)](t){let n=r;this.emit(n(1314),t),this[n(1722)]&&this.onclose(t)}get binaryType(){let t=r;return this._ws?this[t(444)][t(1590)+"pe"]:this["_binaryT"+t(1114)]}set[r(1590)+"pe"](t){let n=r;this[n(874)+n(1114)]=t,this._ws&&(this[n(444)][n(1590)+"pe"]=t)}get[r(795)+"nt"](){let t=r;return this[t(1741)+t(1676)]?.[t(1372)+"ntEndpoi"+t(909)+"ount"]()||0}get["buffered"+r(461)](){let t=r;return this[t(1051)+t(1077)].reduce((o,c)=>(o+=c&&c.byteLength||0,o),0)+(this[t(444)]?this[t(444)]["buffered"+t(461)]:0)}get[r(871)+"ns"](){let t=r;return this[t(444)]?this[t(444)][t(871)+"ns"]:""}get[r(731)](){let t=r;return this[t(444)]?this._ws[t(731)]:""}get[r(1396)+"te"](){let t=r;return this[t(444)]?this[t(444)][t(1396)+"te"]:this[t(1871)][t(1224)+t(1757)]?this[t(1786)+"NG"]:this[t(946)]}get[r(748)](){let t=r;return this[t(444)]?this[t(444)][t(748)]:this[t(1348)]}[r(1314)](t=1e3,n){let o=r,c=(o(1691)+o(776))[o(862)]("|"),f=0;for(;;){switch(c[f++]){case"0":this["_clearPi"+o(1190)]();continue;case"1":this[o(1043)+"balEvent"+o(1538)]();continue;case"2":this[o(1346)+o(786)+"t"](t,n);continue;case"3":if(!this[o(444)])return void this[o(1424)](o(545)+o(387)+"ce not i"+o(1839)+"ed");continue;case"4":if(e.DUfaG(this[o(444)][o(1396)+"te"],this[o(946)])||this[o(444)].readyState===this[o(1831)])return void this._debug(e.EuYOi);continue;case"5":this[o(1021)+o(1344)]();continue;case"6":this._QoSManager?.[o(1704)]();continue;case"7":this[o(398)+"osed"]=!0;continue}break}}async[r(1611)](t,n){let o=r,c={UzVFM:function(f,g){return e[P(1050)](f,g)},Frjbp:e[o(1767)],yIIsr:o(1665)+o(932),tFBKa:function(f,g){return e[o(1161)](f,g)},sxoSY:e[o(1097)],EMPYi:function(f,g,p){return e.rsyIF(f,g,p)},auJKo:function(f,g,p){return e[o(684)](f,g,p)}};if(e[o(1716)]===e[o(642)]){let f=_0x1dff97[o(596)+o(1420)](sgxtvQ.Frjbp);_0x1c49ea["frontier"+o(1639)]=g=>{let p=o;_0x3ade73[p(1457)][p(525)+p(884)](f),_0x469e98["frontier"+p(1639)]=void 0,sgxtvQ[p(666)](_0x1514e9,g&&g.msg||p(1518)+p(1517))},f[o(1433)]=sgxtvQ.yIIsr,f[o(842)]=sgxtvQ[o(633)](_0x2df7be.replace(/^ws/,sgxtvQ[o(920)]),o(1122)+o(1057)+"tierJSONP");try{_0x4386c9[o(1457)][o(1499)+o(884)](f)}catch{_0x6c27ee.body["removeCh"+o(884)](f)}}else{if(e.PjPcd(null,t))throw new Error(e[o(1410)]);e[o(548)]==typeof t&&(t=JSON[o(438)+"y"](t)),e[o(1846)](o(551),typeof t)&&!e[o(868)](t,ArrayBuffer)&&!(t[o(1548)]&&e[o(1602)](t.buffer,ArrayBuffer))&&(t=JSON.stringify(t));let f=await e[o(1826)](hs,t),g=ra(t),{method:p=0,service:l=this[o(1871)].service,logID:y=this[o(1871)][o(427)+o(1760)](),headers:k=this[o(1871)][o(934)],payloadEncoding:v=this._options["payloadE"+o(1183)],payloadType:A=this._options[o(1685)+o(1114)],logIDNew:T=this[o(1871)]["logIDNew"+o(1558)][o(480)+o(629)+o(643)+"ew"]?e.YXkPb(a,this[o(1871)]["logIDNew"+o(1558)][o(1816)]):""}=e[o(1801)](n,{});if(!l)throw new Error(e.xmVXT);let G={SeqID:O[o(652)+"er"](this[o(1490)]++),LogID:O[o(652)+"er"](y),service:l,method:p,headers:k,payloadEncoding:e[o(1856)](v,Object)?v[o(1803)]?v[o(1803)]:"":v,payloadType:e[o(419)](A,Object)?A[o(1433)]?A[o(1433)]:g:A||g,payload:f,LogIDNew:T},M=e[o(901)]($n,G);return this[o(444)]&&e[o(1408)](this._ws[o(1396)+"te"],this.OPEN)?(this[o(444)]&&this[o(444)][o(1611)](M),this[o(1424)](e[o(913)],G)):e[o(1698)](this[o(1051)+o(1077)][o(1843)],this._options[o(719)+o(814)+"ength"])?e[o(1167)]("rTnCp",e[o(723)])?(sgxtvQ[o(1606)](_0x3590d9,_0x3888d9,50),sgxtvQ[o(1879)](_0x5f01fa,_0x441fc2,_0x16ddbb)):(this[o(1051)+"Queue"].push(M),this[o(1424)](e[o(1761)],G)):(this[o(1051)+o(1077)][o(678)](),this[o(1051)+"Queue"][o(483)](M)),{seqID:this[o(1490)],logID:y,logIDNew:T}}}async[r(1530)+"t"](t){let n=r,{url:o}=e.nZAih(t,{}),c=Array[n(659)](o)?o:e[n(933)](e[n(1414)],typeof o)?[o]:[];t&&Object.assign(this[n(1871)],t),c&&c[n(1843)]?this[n(1741)+"tManager"]=new us(c,this[n(1871)][n(1770)+"es"]):this._endpointManager?.[n(1828)+n(1582)+n(1759)](),this["_pingLos"+n(1409)]?.["resetCou"+n(917)](this[n(1871)][n(588)+n(645)]),this[n(398)+n(1133)]=!1,this[n(444)]&&e[n(919)](this[n(444)][n(1396)+"te"],this[n(946)])?this[n(448)+n(1297)](1e3,e[n(1063)],!0):(this._isInit=!0,this._connect())}async connect(){let t=r;if(!this[t(1254)+t(688)]){let n=e.PyANF.split("|"),o=0;for(;;){switch(n[o++]){case"0":this[t(1741)+t(1676)]?.[t(1828)+t(1582)+t(1759)]();continue;case"1":this[t(908)]=!0;continue;case"2":this[t(939)+"sCounter"]?.[t(949)+t(917)]();continue;case"3":this["_readyCl"+t(1133)]=!1;continue;case"4":this[t(1254)]();continue}break}}}[r(1149)+"Listener"](t,n){this.on(t,n)}[r(1267)+r(883)](t){let n=r;if(e[n(1221)]("RALAP",e[n(663)])){let{type:o}=t;this.emit(o,t)}else{let o=_0x4e8423[n(1858)]();return o?(o[n(646)]=o.limit=0,o):{bytes:new _0x4f0c60(64),offset:0,limit:0}}}["removeEv"+r(1425)+r(733)](t,n){this[r(831)](t,n)}[r(1128)](){let t=r,n={GFDFj:e[t(537)],XpGpw:function(o,c){return o!=c},Imqlg:function(o,c){return e.QrUOq(o,c)},Bdjvo:e[t(1038)],mrQMZ:e[t(1790)],BlfEq:t(1238)+t(1509)+"s"};return new Promise((o,c)=>{let f=t,g={ylITT:function(y,k){return y(k)},WYgyh:e[f(1320)],jyVUB:f(1238)+f(1509)+"s",GNcor:f(1238)+"e_timeout"};this[f(1040)+f(1190)](),this[f(1867)+f(386)+"Id"]=e[f(1686)](setTimeout,this[f(1413)][f(953)](this),this[f(1871)].pingInterval);let p=()=>{let y=f,k={wyDnH:function(v,A){return v||A},vkFhJ:function(v,A){return v!=A},sggVP:n[y(1515)],LJUBr:function(v,A){return n[y(1340)](v,A)}};if(n[y(576)](y(1378),n[y(1299)])){if(tIkiUj[y(1351)](_0x2b84b1,_0x178b10))return new _0x404d2f(_0x5093a4,_0x444729);if(tIkiUj.wyDnH(_0x2dee9e,_0x3398f4)&&tIkiUj[y(649)](tIkiUj[y(665)],typeof _0x27eba3))return new _0x82f157(_0x1ff8ad,_0x253d97);if(tIkiUj[y(1351)](_0x8489fe,_0x456be6)&&tIkiUj[y(1371)](tIkiUj.sggVP,typeof _0x15c573))return new _0x195939(_0x3bf7d8,_0x3edac4);throw new _0x43a4e5(y(996)+y(1319)+"d")}else o(n[y(1347)]),this[y(831)](n[y(1121)],p),this.off(y(1238)+"e_timeout",l)},l=()=>{let y=f;g[y(1614)](c,g[y(1673)]),this[y(831)](g[y(574)],p),this[y(831)](g[y(918)],l)};this.on(e[f(931)],p),this.on(f(1238)+f(632)+"t",l),this._ping()})}}})(),Q[S(880)+S(627)]=$[S(880)+"oseEvent"],Q[S(505)+S(1287)]=$[S(505)+"rorEvent"],Q[S(1059)+"e"]=$[S(1059)+"e"],Q[S(883)]=$.Event,Q.FWS=$[S(410)],Q[S(1782)+S(1028)+"vent"]=$[S(1782)+S(1028)+"vent"],Q[S(1028)+S(1522)]=$["MessageE"+S(1522)],Q.OpenEvent=$.OpenEvent,Q[S(797)+"tEvent"]=$[S(797)+S(536)],Q[S(1882)+"oseEvent"]=$[S(1882)+S(627)],Q[S(1732)+S(1287)]=$["createEr"+S(1287)],Q[S(610)+"ssageEvent"]=$[S(610)+S(1503)+"nt"],Q[S(1179)+S(746)]=$[S(1179)+S(746)],Q[S(1891)+"connectE"+S(1522)]=$[S(1891)+S(1109)+S(1522)],Q[S(1186)+S(1896)]=$[S(1186)+"rame"],Q[S(1269)+S(989)]=$[S(1269)+S(989)];for(mn in $)[S(880)+S(627),S(505)+S(1287),"ErrorCode",S(883),S(410),"Frontier"+S(1028)+S(1522),"MessageE"+S(1522),S(618)+"t",S(797)+S(536),S(1882)+S(627),"createErrorEvent",S(610)+S(1503)+"nt",S(1179)+S(746),S(1891)+"connectE"+S(1522),S(1186)+S(1896),S(1269)+"ame"][S(397)](mn)===-1&&(Q[mn]=$[mn]);var mn;Object.defineProperty(Q,S(1795)+"le",{value:!0})});var Ne=se((bl,li)=>{"use strict";var fi=["nodebuffer","arraybuffer","fragments"],di=typeof Blob<"u";di&&fi.push("blob");li.exports={BINARY_TYPES:fi,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:di,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var Lt=se((vl,En)=>{"use strict";var{EMPTY_BUFFER:Tc}=Ne(),mr=Buffer[Symbol.species];function Lc(r,e){if(r.length===0)return Tc;if(r.length===1)return r[0];let i=Buffer.allocUnsafe(e),a=0;for(let x=0;x<r.length;x++){let u=r[x];i.set(u,a),a+=u.length}return a<e?new mr(i.buffer,i.byteOffset,a):i}function hi(r,e,i,a,x){for(let u=0;u<x;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 Rc(r){return r.length===r.buffer.byteLength?r.buffer:r.buffer.slice(r.byteOffset,r.byteOffset+r.length)}function wr(r){if(wr.readOnly=!0,Buffer.isBuffer(r))return r;let e;return r instanceof ArrayBuffer?e=new mr(r):ArrayBuffer.isView(r)?e=new mr(r.buffer,r.byteOffset,r.byteLength):(e=Buffer.from(r),wr.readOnly=!1),e}En.exports={concat:Lc,mask:hi,toArrayBuffer:Rc,toBuffer:wr,unmask:gi};if(!process.env.WS_NO_BUFFER_UTIL)try{let r=Y("bufferutil");En.exports.mask=function(e,i,a,x,u){u<48?hi(e,i,a,x,u):r.mask(e,i,a,x,u)},En.exports.unmask=function(e,i){e.length<32?gi(e,i):r.unmask(e,i)}}catch{}});var wi=se((Sl,mi)=>{"use strict";var pi=Symbol("kDone"),_r=Symbol("kRun"),yr=class{constructor(e){this[pi]=()=>{this.pending--,this[_r]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[_r]()}[_r](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[pi])}}};mi.exports=yr});var lt=se((El,vi)=>{"use strict";var Rt=Y("zlib"),_i=Lt(),Nc=wi(),{kStatusCode:yi}=Ne(),Oc=Buffer[Symbol.species],Bc=Buffer.from([0,0,255,255]),An=Symbol("permessage-deflate"),Oe=Symbol("total-length"),ft=Symbol("callback"),Ge=Symbol("buffers"),dt=Symbol("error"),Cn,br=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,!Cn){let i=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;Cn=new Nc(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[ft];this._deflate.close(),this._deflate=null,e&&e(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(e){let i=this._options,a=e.find(x=>!(i.serverNoContextTakeover===!1&&x.server_no_context_takeover||x.server_max_window_bits&&(i.serverMaxWindowBits===!1||typeof i.serverMaxWindowBits=="number"&&i.serverMaxWindowBits>x.server_max_window_bits)||typeof i.clientMaxWindowBits=="number"&&!x.client_max_window_bits));if(!a)throw new Error("None of the extension offers can be accepted");return i.serverNoContextTakeover&&(a.server_no_context_takeover=!0),i.clientNoContextTakeover&&(a.client_no_context_takeover=!0),typeof i.serverMaxWindowBits=="number"&&(a.server_max_window_bits=i.serverMaxWindowBits),typeof i.clientMaxWindowBits=="number"?a.client_max_window_bits=i.clientMaxWindowBits:(a.client_max_window_bits===!0||i.clientMaxWindowBits===!1)&&delete a.client_max_window_bits,a}acceptAsClient(e){let i=e[0];if(this._options.clientNoContextTakeover===!1&&i.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(!i.client_max_window_bits)typeof this._options.clientMaxWindowBits=="number"&&(i.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits=="number"&&i.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"');return i}normalizeParams(e){return e.forEach(i=>{Object.keys(i).forEach(a=>{let x=i[a];if(x.length>1)throw new Error(`Parameter "${a}" must have only a single value`);if(x=x[0],a==="client_max_window_bits"){if(x!==!0){let u=+x;if(!Number.isInteger(u)||u<8||u>15)throw new TypeError(`Invalid value for parameter "${a}": ${x}`);x=u}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${a}": ${x}`)}else if(a==="server_max_window_bits"){let u=+x;if(!Number.isInteger(u)||u<8||u>15)throw new TypeError(`Invalid value for parameter "${a}": ${x}`);x=u}else if(a==="client_no_context_takeover"||a==="server_no_context_takeover"){if(x!==!0)throw new TypeError(`Invalid value for parameter "${a}": ${x}`)}else throw new Error(`Unknown parameter "${a}"`);i[a]=x})}),e}decompress(e,i,a){Cn.add(x=>{this._decompress(e,i,(u,d)=>{x(),a(u,d)})})}compress(e,i,a){Cn.add(x=>{this._compress(e,i,(u,d)=>{x(),a(u,d)})})}_decompress(e,i,a){let x=this._isServer?"client":"server";if(!this._inflate){let u=`${x}_max_window_bits`,d=typeof this.params[u]!="number"?Rt.Z_DEFAULT_WINDOWBITS:this.params[u];this._inflate=Rt.createInflateRaw({...this._options.zlibInflateOptions,windowBits:d}),this._inflate[An]=this,this._inflate[Oe]=0,this._inflate[Ge]=[],this._inflate.on("error",zc),this._inflate.on("data",bi)}this._inflate[ft]=a,this._inflate.write(e),i&&this._inflate.write(Bc),this._inflate.flush(()=>{let u=this._inflate[dt];if(u){this._inflate.close(),this._inflate=null,a(u);return}let d=_i.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[`${x}_no_context_takeover`]&&this._inflate.reset()),a(null,d)})}_compress(e,i,a){let x=this._isServer?"server":"client";if(!this._deflate){let u=`${x}_max_window_bits`,d=typeof this.params[u]!="number"?Rt.Z_DEFAULT_WINDOWBITS:this.params[u];this._deflate=Rt.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:d}),this._deflate[Oe]=0,this._deflate[Ge]=[],this._deflate.on("data",Mc)}this._deflate[ft]=a,this._deflate.write(e),this._deflate.flush(Rt.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let u=_i.concat(this._deflate[Ge],this._deflate[Oe]);i&&(u=new Oc(u.buffer,u.byteOffset,u.length-4)),this._deflate[ft]=null,this._deflate[Oe]=0,this._deflate[Ge]=[],i&&this.params[`${x}_no_context_takeover`]&&this._deflate.reset(),a(null,u)})}};vi.exports=br;function Mc(r){this[Ge].push(r),this[Oe]+=r.length}function bi(r){if(this[Oe]+=r.length,this[An]._maxPayload<1||this[Oe]<=this[An]._maxPayload){this[Ge].push(r);return}this[dt]=new RangeError("Max payload size exceeded"),this[dt].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[dt][yi]=1009,this.removeListener("data",bi),this.reset()}function zc(r){if(this[An]._inflate=null,this[dt]){this[ft](this[dt]);return}r[yi]=1007,this[ft](r)}});var ht=se((Cl,kn)=>{"use strict";var{isUtf8:Si}=Y("buffer"),{hasBlob:Fc}=Ne(),qc=[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 Uc(r){return r>=1e3&&r<=1014&&r!==1004&&r!==1005&&r!==1006||r>=3e3&&r<=4999}function vr(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 Kc(r){return Fc&&typeof r=="object"&&typeof r.arrayBuffer=="function"&&typeof r.type=="string"&&typeof r.stream=="function"&&(r[Symbol.toStringTag]==="Blob"||r[Symbol.toStringTag]==="File")}kn.exports={isBlob:Kc,isValidStatusCode:Uc,isValidUTF8:vr,tokenChars:qc};if(Si)kn.exports.isValidUTF8=function(r){return r.length<24?vr(r):Si(r)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let r=Y("utf-8-validate");kn.exports.isValidUTF8=function(e){return e.length<32?vr(e):r(e)}}catch{}});var kr=se((Al,Di)=>{"use strict";var{Writable:Hc}=Y("stream"),Ei=lt(),{BINARY_TYPES:Gc,EMPTY_BUFFER:Ci,kStatusCode:jc,kWebSocket:Wc}=Ne(),{concat:Sr,toArrayBuffer:Jc,unmask:Vc}=Lt(),{isValidStatusCode:Yc,isValidUTF8:Ai}=ht(),Pn=Buffer[Symbol.species],fe=0,ki=1,Pi=2,Ii=3,Er=4,Cr=5,In=6,Ar=class extends Hc{constructor(e={}){super(),this._allowSynchronousEvents=e.allowSynchronousEvents!==void 0?e.allowSynchronousEvents:!0,this._binaryType=e.binaryType||Gc[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxPayload=e.maxPayload|0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[Wc]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=fe}_write(e,i,a){if(this._opcode===8&&this._state==fe)return a();this._bufferedBytes+=e.length,this._buffers.push(e),this.startLoop(a)}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){let a=this._buffers[0];return this._buffers[0]=new Pn(a.buffer,a.byteOffset+e,a.length-e),new Pn(a.buffer,a.byteOffset,e)}let i=Buffer.allocUnsafe(e);do{let a=this._buffers[0],x=i.length-e;e>=a.length?i.set(this._buffers.shift(),x):(i.set(new Uint8Array(a.buffer,a.byteOffset,e),x),this._buffers[0]=new Pn(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 fe:this.getInfo(e);break;case ki:this.getPayloadLength16(e);break;case Pi:this.getPayloadLength64(e);break;case Ii:this.getMask();break;case Er:this.getData(e);break;case Cr:case In:this._loop=!1;return}while(this._loop);this._errored||e()}getInfo(e){if(this._bufferedBytes<2){this._loop=!1;return}let i=this.consume(2);if((i[0]&48)!==0){let x=this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");e(x);return}let a=(i[0]&64)===64;if(a&&!this._extensions[Ei.extensionName]){let x=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(x);return}if(this._fin=(i[0]&128)===128,this._opcode=i[0]&15,this._payloadLength=i[1]&127,this._opcode===0){if(a){let x=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(x);return}if(!this._fragmented){let x=this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");e(x);return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){let x=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");e(x);return}this._compressed=a}else if(this._opcode>7&&this._opcode<11){if(!this._fin){let x=this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");e(x);return}if(a){let x=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(x);return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){let x=this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");e(x);return}}else{let x=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");e(x);return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(i[1]&128)===128,this._isServer){if(!this._masked){let x=this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK");e(x);return}}else if(this._masked){let x=this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");e(x);return}this._payloadLength===126?this._state=ki:this._payloadLength===127?this._state=Pi:this.haveLength(e)}getPayloadLength16(e){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(e)}getPayloadLength64(e){if(this._bufferedBytes<8){this._loop=!1;return}let i=this.consume(8),a=i.readUInt32BE(0);if(a>Math.pow(2,21)-1){let x=this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");e(x);return}this._payloadLength=a*Math.pow(2,32)+i.readUInt32BE(4),this.haveLength(e)}haveLength(e){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)){let i=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");e(i);return}this._masked?this._state=Ii:this._state=Er}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=Er}getData(e){let i=Ci;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&&Vc(i,this._mask)}if(this._opcode>7){this.controlMessage(i,e);return}if(this._compressed){this._state=Cr,this.decompress(i,e);return}i.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(i)),this.dataMessage(e)}decompress(e,i){this._extensions[Ei.extensionName].decompress(e,this._fin,(x,u)=>{if(x)return i(x);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===fe&&this.startLoop(i)})}dataMessage(e){if(!this._fin){this._state=fe;return}let i=this._messageLength,a=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let x;this._binaryType==="nodebuffer"?x=Sr(a,i):this._binaryType==="arraybuffer"?x=Jc(Sr(a,i)):this._binaryType==="blob"?x=new Blob(a):x=a,this._allowSynchronousEvents?(this.emit("message",x,!0),this._state=fe):(this._state=In,setImmediate(()=>{this.emit("message",x,!0),this._state=fe,this.startLoop(e)}))}else{let x=Sr(a,i);if(!this._skipUTF8Validation&&!Ai(x)){let u=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");e(u);return}this._state===Cr||this._allowSynchronousEvents?(this.emit("message",x,!1),this._state=fe):(this._state=In,setImmediate(()=>{this.emit("message",x,!1),this._state=fe,this.startLoop(e)}))}}controlMessage(e,i){if(this._opcode===8){if(e.length===0)this._loop=!1,this.emit("conclude",1005,Ci),this.end();else{let a=e.readUInt16BE(0);if(!Yc(a)){let u=this.createError(RangeError,`invalid status code ${a}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");i(u);return}let x=new Pn(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!Ai(x)){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,x),this.end()}this._state=fe;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?"ping":"pong",e),this._state=fe):(this._state=In,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",e),this._state=fe,this.startLoop(i)}))}createError(e,i,a,x,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[jc]=x,d}};Di.exports=Ar});var Dr=se((Pl,Ri)=>{"use strict";var{Duplex:kl}=Y("stream"),{randomFillSync:$c}=Y("crypto"),Ti=lt(),{EMPTY_BUFFER:Qc,kWebSocket:Xc,NOOP:Zc}=Ne(),{isBlob:gt,isValidStatusCode:ex}=ht(),{mask:Li,toBuffer:$e}=Lt(),de=Symbol("kByteLength"),tx=Buffer.alloc(4),Dn=8*1024,Qe,pt=Dn,we=0,nx=1,rx=2,Pr=class r{constructor(e,i,a){this._extensions=i||{},a&&(this._generateMask=a,this._maskBuffer=Buffer.alloc(4)),this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=we,this.onerror=Zc,this[Xc]=void 0}static frame(e,i){let a,x=!1,u=2,d=!1;i.mask&&(a=i.maskBuffer||tx,i.generateMask?i.generateMask(a):(pt===Dn&&(Qe===void 0&&(Qe=Buffer.alloc(Dn)),$c(Qe,0,Dn),pt=0),a[0]=Qe[pt++],a[1]=Qe[pt++],a[2]=Qe[pt++],a[3]=Qe[pt++]),d=(a[0]|a[1]|a[2]|a[3])===0,u=6);let h;typeof e=="string"?(!i.mask||d)&&i[de]!==void 0?h=i[de]:(e=Buffer.from(e),h=e.length):(h=e.length,x=i.mask&&i.readOnly&&!d);let m=h;h>=65536?(u+=8,m=127):h>125&&(u+=2,m=126);let w=Buffer.allocUnsafe(x?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]:x?(Li(e,a,w,u,h),[w]):(Li(e,a,e,0,h),[w,e])):[w,e]}close(e,i,a,x){let u;if(e===void 0)u=Qc;else{if(typeof e!="number"||!ex(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={[de]:u.length,fin:!0,generateMask:this._generateMask,mask:a,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state!==we?this.enqueue([this.dispatch,u,!1,d,x]):this.sendFrame(r.frame(u,d),x)}ping(e,i,a){let x,u;if(typeof e=="string"?(x=Buffer.byteLength(e),u=!1):gt(e)?(x=e.size,u=!1):(e=$e(e),x=e.length,u=$e.readOnly),x>125)throw new RangeError("The data size must not be greater than 125 bytes");let d={[de]:x,fin:!0,generateMask:this._generateMask,mask:i,maskBuffer:this._maskBuffer,opcode:9,readOnly:u,rsv1:!1};gt(e)?this._state!==we?this.enqueue([this.getBlobData,e,!1,d,a]):this.getBlobData(e,!1,d,a):this._state!==we?this.enqueue([this.dispatch,e,!1,d,a]):this.sendFrame(r.frame(e,d),a)}pong(e,i,a){let x,u;if(typeof e=="string"?(x=Buffer.byteLength(e),u=!1):gt(e)?(x=e.size,u=!1):(e=$e(e),x=e.length,u=$e.readOnly),x>125)throw new RangeError("The data size must not be greater than 125 bytes");let d={[de]:x,fin:!0,generateMask:this._generateMask,mask:i,maskBuffer:this._maskBuffer,opcode:10,readOnly:u,rsv1:!1};gt(e)?this._state!==we?this.enqueue([this.getBlobData,e,!1,d,a]):this.getBlobData(e,!1,d,a):this._state!==we?this.enqueue([this.dispatch,e,!1,d,a]):this.sendFrame(r.frame(e,d),a)}send(e,i,a){let x=this._extensions[Ti.extensionName],u=i.binary?2:1,d=i.compress,h,m;typeof e=="string"?(h=Buffer.byteLength(e),m=!1):gt(e)?(h=e.size,m=!1):(e=$e(e),h=e.length,m=$e.readOnly),this._firstFragment?(this._firstFragment=!1,d&&x&&x.params[x._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(d=h>=x._threshold),this._compress=d):(d=!1,u=0),i.fin&&(this._firstFragment=!0);let w={[de]:h,fin:i.fin,generateMask:this._generateMask,mask:i.mask,maskBuffer:this._maskBuffer,opcode:u,readOnly:m,rsv1:d};gt(e)?this._state!==we?this.enqueue([this.getBlobData,e,this._compress,w,a]):this.getBlobData(e,this._compress,w,a):this._state!==we?this.enqueue([this.dispatch,e,this._compress,w,a]):this.dispatch(e,this._compress,w,a)}getBlobData(e,i,a,x){this._bufferedBytes+=a[de],this._state=rx,e.arrayBuffer().then(u=>{if(this._socket.destroyed){let h=new Error("The socket was closed while the blob was being read");process.nextTick(Ir,this,h,x);return}this._bufferedBytes-=a[de];let d=$e(u);i?this.dispatch(d,i,a,x):(this._state=we,this.sendFrame(r.frame(d,a),x),this.dequeue())}).catch(u=>{process.nextTick(sx,this,u,x)})}dispatch(e,i,a,x){if(!i){this.sendFrame(r.frame(e,a),x);return}let u=this._extensions[Ti.extensionName];this._bufferedBytes+=a[de],this._state=nx,u.compress(e,a.fin,(d,h)=>{if(this._socket.destroyed){let m=new Error("The socket was closed while data was being compressed");Ir(this,m,x);return}this._bufferedBytes-=a[de],this._state=we,a.readOnly=!1,this.sendFrame(r.frame(h,a),x),this.dequeue()})}dequeue(){for(;this._state===we&&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)}};Ri.exports=Pr;function Ir(r,e,i){typeof i=="function"&&i(e);for(let a=0;a<r._queue.length;a++){let x=r._queue[a],u=x[x.length-1];typeof u=="function"&&u(e)}}function sx(r,e,i){Ir(r,e,i),r.onerror(e)}});var Ki=se((Il,Ui)=>{"use strict";var{kForOnEventAttribute:Nt,kListener:Tr}=Ne(),Ni=Symbol("kCode"),Oi=Symbol("kData"),Bi=Symbol("kError"),Mi=Symbol("kMessage"),zi=Symbol("kReason"),mt=Symbol("kTarget"),Fi=Symbol("kType"),qi=Symbol("kWasClean"),Be=class{constructor(e){this[mt]=null,this[Fi]=e}get target(){return this[mt]}get type(){return this[Fi]}};Object.defineProperty(Be.prototype,"target",{enumerable:!0});Object.defineProperty(Be.prototype,"type",{enumerable:!0});var Xe=class extends Be{constructor(e,i={}){super(e),this[Ni]=i.code===void 0?0:i.code,this[zi]=i.reason===void 0?"":i.reason,this[qi]=i.wasClean===void 0?!1:i.wasClean}get code(){return this[Ni]}get reason(){return this[zi]}get wasClean(){return this[qi]}};Object.defineProperty(Xe.prototype,"code",{enumerable:!0});Object.defineProperty(Xe.prototype,"reason",{enumerable:!0});Object.defineProperty(Xe.prototype,"wasClean",{enumerable:!0});var wt=class extends Be{constructor(e,i={}){super(e),this[Bi]=i.error===void 0?null:i.error,this[Mi]=i.message===void 0?"":i.message}get error(){return this[Bi]}get message(){return this[Mi]}};Object.defineProperty(wt.prototype,"error",{enumerable:!0});Object.defineProperty(wt.prototype,"message",{enumerable:!0});var Ot=class extends Be{constructor(e,i={}){super(e),this[Oi]=i.data===void 0?null:i.data}get data(){return this[Oi]}};Object.defineProperty(Ot.prototype,"data",{enumerable:!0});var ix={addEventListener(r,e,i={}){for(let x of this.listeners(r))if(!i[Nt]&&x[Tr]===e&&!x[Nt])return;let a;if(r==="message")a=function(u,d){let h=new Ot("message",{data:d?u:u.toString()});h[mt]=this,Tn(e,this,h)};else if(r==="close")a=function(u,d){let h=new Xe("close",{code:u,reason:d.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});h[mt]=this,Tn(e,this,h)};else if(r==="error")a=function(u){let d=new wt("error",{error:u,message:u.message});d[mt]=this,Tn(e,this,d)};else if(r==="open")a=function(){let u=new Be("open");u[mt]=this,Tn(e,this,u)};else return;a[Nt]=!!i[Nt],a[Tr]=e,i.once?this.once(r,a):this.on(r,a)},removeEventListener(r,e){for(let i of this.listeners(r))if(i[Tr]===e&&!i[Nt]){this.removeListener(r,i);break}}};Ui.exports={CloseEvent:Xe,ErrorEvent:wt,Event:Be,EventTarget:ix,MessageEvent:Ot};function Tn(r,e,i){typeof r=="object"&&r.handleEvent?r.handleEvent.call(r,i):r.call(e,i)}});var Ln=se((Dl,Hi)=>{"use strict";var{tokenChars:Bt}=ht();function Ae(r,e,i){r[e]===void 0?r[e]=[i]:r[e].push(i)}function ox(r){let e=Object.create(null),i=Object.create(null),a=!1,x=!1,u=!1,d,h,m=-1,w=-1,b=-1,_=0;for(;_<r.length;_++)if(w=r.charCodeAt(_),d===void 0)if(b===-1&&Bt[w]===1)m===-1&&(m=_);else if(_!==0&&(w===32||w===9))b===-1&&m!==-1&&(b=_);else if(w===59||w===44){if(m===-1)throw new SyntaxError(`Unexpected character at index ${_}`);b===-1&&(b=_);let L=r.slice(m,b);w===44?(Ae(e,L,i),i=Object.create(null)):d=L,m=b=-1}else throw new SyntaxError(`Unexpected character at index ${_}`);else if(h===void 0)if(b===-1&&Bt[w]===1)m===-1&&(m=_);else if(w===32||w===9)b===-1&&m!==-1&&(b=_);else if(w===59||w===44){if(m===-1)throw new SyntaxError(`Unexpected character at index ${_}`);b===-1&&(b=_),Ae(i,r.slice(m,b),!0),w===44&&(Ae(e,d,i),i=Object.create(null),d=void 0),m=b=-1}else if(w===61&&m!==-1&&b===-1)h=r.slice(m,_),m=b=-1;else throw new SyntaxError(`Unexpected character at index ${_}`);else if(x){if(Bt[w]!==1)throw new SyntaxError(`Unexpected character at index ${_}`);m===-1?m=_:a||(a=!0),x=!1}else if(u)if(Bt[w]===1)m===-1&&(m=_);else if(w===34&&m!==-1)u=!1,b=_;else if(w===92)x=!0;else throw new SyntaxError(`Unexpected character at index ${_}`);else if(w===34&&r.charCodeAt(_-1)===61)u=!0;else if(b===-1&&Bt[w]===1)m===-1&&(m=_);else if(m!==-1&&(w===32||w===9))b===-1&&(b=_);else if(w===59||w===44){if(m===-1)throw new SyntaxError(`Unexpected character at index ${_}`);b===-1&&(b=_);let L=r.slice(m,b);a&&(L=L.replace(/\\/g,""),a=!1),Ae(i,h,L),w===44&&(Ae(e,d,i),i=Object.create(null),d=void 0),h=void 0,m=b=-1}else throw new SyntaxError(`Unexpected character at index ${_}`);if(m===-1||u||w===32||w===9)throw new SyntaxError("Unexpected end of input");b===-1&&(b=_);let C=r.slice(m,b);return d===void 0?Ae(e,C,i):(h===void 0?Ae(i,C,!0):a?Ae(i,h,C.replace(/\\/g,"")):Ae(i,h,C),Ae(e,d,i)),e}function ax(r){return Object.keys(r).map(e=>{let i=r[e];return Array.isArray(i)||(i=[i]),i.map(a=>[e].concat(Object.keys(a).map(x=>{let u=a[x];return Array.isArray(u)||(u=[u]),u.map(d=>d===!0?x:`${x}=${d}`).join("; ")})).join("; ")).join(", ")}).join(", ")}Hi.exports={format:ax,parse:ox}});var Bn=se((Rl,to)=>{"use strict";var cx=Y("events"),xx=Y("https"),ux=Y("http"),Wi=Y("net"),fx=Y("tls"),{randomBytes:dx,createHash:lx}=Y("crypto"),{Duplex:Tl,Readable:Ll}=Y("stream"),{URL:Lr}=Y("url"),je=lt(),hx=kr(),gx=Dr(),{isBlob:px}=ht(),{BINARY_TYPES:Gi,CLOSE_TIMEOUT:mx,EMPTY_BUFFER:Rn,GUID:_x,kForOnEventAttribute:Rr,kListener:yx,kStatusCode:bx,kWebSocket:Z,NOOP:Ji}=Ne(),{EventTarget:{addEventListener:vx,removeEventListener:Sx}}=Ki(),{format:Ex,parse:Cx}=Ln(),{toBuffer:Ax}=Lt(),Vi=Symbol("kAborted"),Nr=[8,13],Me=["CONNECTING","OPEN","CLOSING","CLOSED"],kx=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,F=class r extends cx{constructor(e,i,a){super(),this._binaryType=Gi[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=Rn,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol="",this._readyState=r.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,e!==null?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,i===void 0?i=[]:Array.isArray(i)||(typeof i=="object"&&i!==null?(a=i,i=[]):i=[i]),Yi(this,e,i,a)):(this._autoPong=a.autoPong,this._closeTimeout=a.closeTimeout,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(e){Gi.includes(e)&&(this._binaryType=e,this._receiver&&(this._receiver._binaryType=e))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(e,i,a){let x=new hx({allowSynchronousEvents:a.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:a.maxPayload,skipUTF8Validation:a.skipUTF8Validation}),u=new gx(e,this._extensions,a.generateMask);this._receiver=x,this._sender=u,this._socket=e,x[Z]=this,u[Z]=this,e[Z]=this,x.on("conclude",Dx),x.on("drain",Tx),x.on("error",Lx),x.on("message",Rx),x.on("ping",Nx),x.on("pong",Ox),u.onerror=Bx,e.setTimeout&&e.setTimeout(0),e.setNoDelay&&e.setNoDelay(),i.length>0&&e.unshift(i),e.on("close",Xi),e.on("data",On),e.on("end",Zi),e.on("error",eo),this._readyState=r.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=r.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[je.extensionName]&&this._extensions[je.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=r.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(e,i){if(this.readyState!==r.CLOSED){if(this.readyState===r.CONNECTING){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,a=>{a||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),Qi(this)}}pause(){this.readyState===r.CONNECTING||this.readyState===r.CLOSED||(this._paused=!0,this._socket.pause())}ping(e,i,a){if(this.readyState===r.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(a=e,e=i=void 0):typeof i=="function"&&(a=i,i=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==r.OPEN){Or(this,e,a);return}i===void 0&&(i=!this._isServer),this._sender.ping(e||Rn,i,a)}pong(e,i,a){if(this.readyState===r.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(a=e,e=i=void 0):typeof i=="function"&&(a=i,i=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==r.OPEN){Or(this,e,a);return}i===void 0&&(i=!this._isServer),this._sender.pong(e||Rn,i,a)}resume(){this.readyState===r.CONNECTING||this.readyState===r.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(e,i,a){if(this.readyState===r.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof i=="function"&&(a=i,i={}),typeof e=="number"&&(e=e.toString()),this.readyState!==r.OPEN){Or(this,e,a);return}let x={binary:typeof e!="string",mask:!this._isServer,compress:!0,fin:!0,...i};this._extensions[je.extensionName]||(x.compress=!1),this._sender.send(e||Rn,x,a)}terminate(){if(this.readyState!==r.CLOSED){if(this.readyState===r.CONNECTING){xe(this,this._req,"WebSocket was closed before the connection was established");return}this._socket&&(this._readyState=r.CLOSING,this._socket.destroy())}}};Object.defineProperty(F,"CONNECTING",{enumerable:!0,value:Me.indexOf("CONNECTING")});Object.defineProperty(F.prototype,"CONNECTING",{enumerable:!0,value:Me.indexOf("CONNECTING")});Object.defineProperty(F,"OPEN",{enumerable:!0,value:Me.indexOf("OPEN")});Object.defineProperty(F.prototype,"OPEN",{enumerable:!0,value:Me.indexOf("OPEN")});Object.defineProperty(F,"CLOSING",{enumerable:!0,value:Me.indexOf("CLOSING")});Object.defineProperty(F.prototype,"CLOSING",{enumerable:!0,value:Me.indexOf("CLOSING")});Object.defineProperty(F,"CLOSED",{enumerable:!0,value:Me.indexOf("CLOSED")});Object.defineProperty(F.prototype,"CLOSED",{enumerable:!0,value:Me.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(r=>{Object.defineProperty(F.prototype,r,{enumerable:!0})});["open","error","close","message"].forEach(r=>{Object.defineProperty(F.prototype,`on${r}`,{enumerable:!0,get(){for(let e of this.listeners(r))if(e[Rr])return e[yx];return null},set(e){for(let i of this.listeners(r))if(i[Rr]){this.removeListener(r,i);break}typeof e=="function"&&this.addEventListener(r,e,{[Rr]:!0})}})});F.prototype.addEventListener=vx;F.prototype.removeEventListener=Sx;to.exports=F;function Yi(r,e,i,a){let x={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:mx,protocolVersion:Nr[1],maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...a,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(r._autoPong=x.autoPong,r._closeTimeout=x.closeTimeout,!Nr.includes(x.protocolVersion))throw new RangeError(`Unsupported protocol version: ${x.protocolVersion} (supported versions: ${Nr.join(", ")})`);let u;if(e instanceof Lr)u=e;else try{u=new Lr(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;Nn(r,R);return}let w=d?443:80,b=dx(16).toString("base64"),_=d?xx.request:ux.request,C=new Set,L;if(x.createConnection=x.createConnection||(d?Ix:Px),x.defaultPort=x.defaultPort||w,x.port=u.port||w,x.host=u.hostname.startsWith("[")?u.hostname.slice(1,-1):u.hostname,x.headers={...x.headers,"Sec-WebSocket-Version":x.protocolVersion,"Sec-WebSocket-Key":b,Connection:"Upgrade",Upgrade:"websocket"},x.path=u.pathname+u.search,x.timeout=x.handshakeTimeout,x.perMessageDeflate&&(L=new je({...x.perMessageDeflate,isServer:!1,maxPayload:x.maxPayload}),x.headers["Sec-WebSocket-Extensions"]=Ex({[je.extensionName]:L.offer()})),i.length){for(let R of i){if(typeof R!="string"||!kx.test(R)||C.has(R))throw new SyntaxError("An invalid or duplicated subprotocol was specified");C.add(R)}x.headers["Sec-WebSocket-Protocol"]=i.join(",")}if(x.origin&&(x.protocolVersion<13?x.headers["Sec-WebSocket-Origin"]=x.origin:x.headers.Origin=x.origin),(u.username||u.password)&&(x.auth=`${u.username}:${u.password}`),h){let R=x.path.split(":");x.socketPath=R[0],x.path=R[1]}let I;if(x.followRedirects){if(r._redirects===0){r._originalIpc=h,r._originalSecure=d,r._originalHostOrSocketPath=h?x.socketPath:u.host;let R=a&&a.headers;if(a={...a,headers:{}},R)for(let[z,ee]of Object.entries(R))a.headers[z.toLowerCase()]=ee}else if(r.listenerCount("redirect")===0){let R=h?r._originalIpc?x.socketPath===r._originalHostOrSocketPath:!1:r._originalIpc?!1:u.host===r._originalHostOrSocketPath;(!R||r._originalSecure&&!d)&&(delete x.headers.authorization,delete x.headers.cookie,R||delete x.headers.host,x.auth=void 0)}x.auth&&!a.headers.authorization&&(a.headers.authorization="Basic "+Buffer.from(x.auth).toString("base64")),I=r._req=_(x),r._redirects&&r.emit("redirect",r.url,I)}else I=r._req=_(x);x.timeout&&I.on("timeout",()=>{xe(r,I,"Opening handshake has timed out")}),I.on("error",R=>{I===null||I[Vi]||(I=r._req=null,Nn(r,R))}),I.on("response",R=>{let z=R.headers.location,ee=R.statusCode;if(z&&x.followRedirects&&ee>=300&&ee<400){if(++r._redirects>x.maxRedirects){xe(r,I,"Maximum redirects exceeded");return}I.abort();let le;try{le=new Lr(z,e)}catch{let oe=new SyntaxError(`Invalid URL: ${z}`);Nn(r,oe);return}Yi(r,le,i,a)}else r.emit("unexpected-response",I,R)||xe(r,I,`Unexpected server response: ${R.statusCode}`)}),I.on("upgrade",(R,z,ee)=>{if(r.emit("upgrade",R),r.readyState!==F.CONNECTING)return;I=r._req=null;let le=R.headers.upgrade;if(le===void 0||le.toLowerCase()!=="websocket"){xe(r,z,"Invalid Upgrade header");return}let _e=lx("sha1").update(b+_x).digest("base64");if(R.headers["sec-websocket-accept"]!==_e){xe(r,z,"Invalid Sec-WebSocket-Accept header");return}let oe=R.headers["sec-websocket-protocol"],D;if(oe!==void 0?C.size?C.has(oe)||(D="Server sent an invalid subprotocol"):D="Server sent a subprotocol but none was requested":C.size&&(D="Server sent no subprotocol"),D){xe(r,z,D);return}oe&&(r._protocol=oe);let q=R.headers["sec-websocket-extensions"];if(q!==void 0){if(!L){xe(r,z,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let V;try{V=Cx(q)}catch{xe(r,z,"Invalid Sec-WebSocket-Extensions header");return}let he=Object.keys(V);if(he.length!==1||he[0]!==je.extensionName){xe(r,z,"Server indicated an extension that was not requested");return}try{L.accept(V[je.extensionName])}catch{xe(r,z,"Invalid Sec-WebSocket-Extensions header");return}r._extensions[je.extensionName]=L}r.setSocket(z,ee,{allowSynchronousEvents:x.allowSynchronousEvents,generateMask:x.generateMask,maxPayload:x.maxPayload,skipUTF8Validation:x.skipUTF8Validation})}),x.finishRequest?x.finishRequest(I,r):I.end()}function Nn(r,e){r._readyState=F.CLOSING,r._errorEmitted=!0,r.emit("error",e),r.emitClose()}function Px(r){return r.path=r.socketPath,Wi.connect(r)}function Ix(r){return r.path=void 0,!r.servername&&r.servername!==""&&(r.servername=Wi.isIP(r.host)?"":r.host),fx.connect(r)}function xe(r,e,i){r._readyState=F.CLOSING;let a=new Error(i);Error.captureStackTrace(a,xe),e.setHeader?(e[Vi]=!0,e.abort(),e.socket&&!e.socket.destroyed&&e.socket.destroy(),process.nextTick(Nn,r,a)):(e.destroy(a),e.once("error",r.emit.bind(r,"error")),e.once("close",r.emitClose.bind(r)))}function Or(r,e,i){if(e){let a=px(e)?e.size:Ax(e).length;r._socket?r._sender._bufferedBytes+=a:r._bufferedAmount+=a}if(i){let a=new Error(`WebSocket is not open: readyState ${r.readyState} (${Me[r.readyState]})`);process.nextTick(i,a)}}function Dx(r,e){let i=this[Z];i._closeFrameReceived=!0,i._closeMessage=e,i._closeCode=r,i._socket[Z]!==void 0&&(i._socket.removeListener("data",On),process.nextTick($i,i._socket),r===1005?i.close():i.close(r,e))}function Tx(){let r=this[Z];r.isPaused||r._socket.resume()}function Lx(r){let e=this[Z];e._socket[Z]!==void 0&&(e._socket.removeListener("data",On),process.nextTick($i,e._socket),e.close(r[bx])),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",r))}function ji(){this[Z].emitClose()}function Rx(r,e){this[Z].emit("message",r,e)}function Nx(r){let e=this[Z];e._autoPong&&e.pong(r,!this._isServer,Ji),e.emit("ping",r)}function Ox(r){this[Z].emit("pong",r)}function $i(r){r.resume()}function Bx(r){let e=this[Z];e.readyState!==F.CLOSED&&(e.readyState===F.OPEN&&(e._readyState=F.CLOSING,Qi(e)),this._socket.end(),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",r)))}function Qi(r){r._closeTimer=setTimeout(r._socket.destroy.bind(r._socket),r._closeTimeout)}function Xi(){let r=this[Z];if(this.removeListener("close",Xi),this.removeListener("data",On),this.removeListener("end",Zi),r._readyState=F.CLOSING,!this._readableState.endEmitted&&!r._closeFrameReceived&&!r._receiver._writableState.errorEmitted&&this._readableState.length!==0){let e=this.read(this._readableState.length);r._receiver.write(e)}r._receiver.end(),this[Z]=void 0,clearTimeout(r._closeTimer),r._receiver._writableState.finished||r._receiver._writableState.errorEmitted?r.emitClose():(r._receiver.on("error",ji),r._receiver.on("finish",ji))}function On(r){this[Z]._receiver.write(r)||this.pause()}function Zi(){let r=this[Z];r._readyState=F.CLOSING,r._receiver.end(),this.end()}function eo(){let r=this[Z];this.removeListener("error",eo),this.on("error",Ji),r&&(r._readyState=F.CLOSING,this.destroy())}});var io=se((Ol,so)=>{"use strict";var Nl=Bn(),{Duplex:Mx}=Y("stream");function no(r){r.emit("close")}function zx(){!this.destroyed&&this._writableState.finished&&this.destroy()}function ro(r){this.removeListener("error",ro),this.destroy(),this.listenerCount("error")===0&&this.emit("error",r)}function Fx(r,e){let i=!0,a=new Mx({...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(x,u){if(r.readyState===r.CLOSED){u(x),process.nextTick(no,a);return}let d=!1;r.once("error",function(m){d=!0,u(m)}),r.once("close",function(){d||u(x),process.nextTick(no,a)}),i&&r.terminate()},a._final=function(x){if(r.readyState===r.CONNECTING){r.once("open",function(){a._final(x)});return}r._socket!==null&&(r._socket._writableState.finished?(x(),a._readableState.endEmitted&&a.destroy()):(r._socket.once("finish",function(){x()}),r.close()))},a._read=function(){r.isPaused&&r.resume()},a._write=function(x,u,d){if(r.readyState===r.CONNECTING){r.once("open",function(){a._write(x,u,d)});return}r.send(x,d)},a.on("end",zx),a.on("error",ro),a}so.exports=Fx});var Br=se((Bl,oo)=>{"use strict";var{tokenChars:qx}=ht();function Ux(r){let e=new Set,i=-1,a=-1,x=0;for(x;x<r.length;x++){let d=r.charCodeAt(x);if(a===-1&&qx[d]===1)i===-1&&(i=x);else if(x!==0&&(d===32||d===9))a===-1&&i!==-1&&(a=x);else if(d===44){if(i===-1)throw new SyntaxError(`Unexpected character at index ${x}`);a===-1&&(a=x);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 ${x}`)}if(i===-1||a!==-1)throw new SyntaxError("Unexpected end of input");let u=r.slice(i,x);if(e.has(u))throw new SyntaxError(`The "${u}" subprotocol is duplicated`);return e.add(u),e}oo.exports={parse:Ux}});var ho=se((zl,lo)=>{"use strict";var Kx=Y("events"),Mn=Y("http"),{Duplex:Ml}=Y("stream"),{createHash:Hx}=Y("crypto"),ao=Ln(),Ze=lt(),Gx=Br(),jx=Bn(),{CLOSE_TIMEOUT:Wx,GUID:Jx,kWebSocket:Vx}=Ne(),Yx=/^[+/0-9A-Za-z]{22}==$/,co=0,xo=1,fo=2,Mr=class extends Kx{constructor(e,i){if(super(),e={allowSynchronousEvents:!0,autoPong:!0,maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:Wx,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:jx,...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=Mn.createServer((a,x)=>{let u=Mn.STATUS_CODES[426];x.writeHead(426,{"Content-Length":u.length,"Content-Type":"text/plain"}),x.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=$x(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(x,u,d)=>{this.handleUpgrade(x,u,d,a)}})}e.perMessageDeflate===!0&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=co}address(){if(this.options.noServer)throw new Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(e){if(this._state===fo){e&&this.once("close",()=>{e(new Error("The server is not running"))}),process.nextTick(Mt,this);return}if(e&&this.once("close",e),this._state!==xo)if(this._state=xo,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients?this.clients.size?this._shouldEmitClose=!0:process.nextTick(Mt,this):process.nextTick(Mt,this);else{let i=this._server;this._removeListeners(),this._removeListeners=this._server=null,i.close(()=>{Mt(this)})}}shouldHandle(e){if(this.options.path){let i=e.url.indexOf("?");if((i!==-1?e.url.slice(0,i):e.url)!==this.options.path)return!1}return!0}handleUpgrade(e,i,a,x){i.on("error",uo);let u=e.headers["sec-websocket-key"],d=e.headers.upgrade,h=+e.headers["sec-websocket-version"];if(e.method!=="GET"){et(this,e,i,405,"Invalid HTTP method");return}if(d===void 0||d.toLowerCase()!=="websocket"){et(this,e,i,400,"Invalid Upgrade header");return}if(u===void 0||!Yx.test(u)){et(this,e,i,400,"Missing or invalid Sec-WebSocket-Key header");return}if(h!==13&&h!==8){et(this,e,i,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});return}if(!this.shouldHandle(e)){zt(i,400);return}let m=e.headers["sec-websocket-protocol"],w=new Set;if(m!==void 0)try{w=Gx.parse(m)}catch{et(this,e,i,400,"Invalid Sec-WebSocket-Protocol header");return}let b=e.headers["sec-websocket-extensions"],_={};if(this.options.perMessageDeflate&&b!==void 0){let C=new Ze({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let L=ao.parse(b);L[Ze.extensionName]&&(C.accept(L[Ze.extensionName]),_[Ze.extensionName]=C)}catch{et(this,e,i,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let C={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(C,(L,I,R,z)=>{if(!L)return zt(i,I||401,R,z);this.completeUpgrade(_,u,w,e,i,a,x)});return}if(!this.options.verifyClient(C))return zt(i,401)}this.completeUpgrade(_,u,w,e,i,a,x)}completeUpgrade(e,i,a,x,u,d,h){if(!u.readable||!u.writable)return u.destroy();if(u[Vx])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>co)return zt(u,503);let w=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${Hx("sha1").update(i+Jx).digest("base64")}`],b=new this.options.WebSocket(null,void 0,this.options);if(a.size){let _=this.options.handleProtocols?this.options.handleProtocols(a,x):a.values().next().value;_&&(w.push(`Sec-WebSocket-Protocol: ${_}`),b._protocol=_)}if(e[Ze.extensionName]){let _=e[Ze.extensionName].params,C=ao.format({[Ze.extensionName]:[_]});w.push(`Sec-WebSocket-Extensions: ${C}`),b._extensions=e}this.emit("headers",w,x),u.write(w.concat(`\r
12
12
  `).join(`\r
13
- `)),f.removeListener("error",lo),b.setSocket(f,l,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(b),b.on("close",()=>{this.clients.delete(b),this._shouldEmitClose&&!this.clients.size&&process.nextTick(Ut,this)})),h(b,x)}};go.exports=qr;function $c(r,e){for(let i of Object.keys(e))r.on(i,e[i]);return function(){for(let a of Object.keys(e))r.removeListener(a,e[a])}}function Ut(r){r._state=ho,r.emit("close")}function lo(){this.destroy()}function Ft(r,e,i,a){i=i||qn.STATUS_CODES[e],a={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(i),...a},r.once("finish",r.destroy),r.end(`HTTP/1.1 ${e} ${qn.STATUS_CODES[e]}\r
13
+ `)),u.removeListener("error",uo),b.setSocket(u,d,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(b),b.on("close",()=>{this.clients.delete(b),this._shouldEmitClose&&!this.clients.size&&process.nextTick(Mt,this)})),h(b,x)}};lo.exports=Mr;function $x(r,e){for(let i of Object.keys(e))r.on(i,e[i]);return function(){for(let a of Object.keys(e))r.removeListener(a,e[a])}}function Mt(r){r._state=fo,r.emit("close")}function uo(){this.destroy()}function zt(r,e,i,a){i=i||Mn.STATUS_CODES[e],a={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(i),...a},r.once("finish",r.destroy),r.end(`HTTP/1.1 ${e} ${Mn.STATUS_CODES[e]}\r
14
14
  `+Object.keys(a).map(x=>`${x}: ${a[x]}`).join(`\r
15
15
  `)+`\r
16
16
  \r
17
- `+i)}function et(r,e,i,a,x,f){if(r.listenerCount("wsClientError")){let l=new Error(x);Error.captureStackTrace(l,et),r.emit("wsClientError",l,i,e)}else Ft(i,a,x,f)}});import{spawn as Sf}from"node:child_process";import{existsSync as Cf,openSync as Ef}from"node:fs";import{mkdir as Af}from"node:fs/promises";import{dirname as Df}from"node:path";import{fileURLToPath as kf}from"node:url";function Kr(r=H()){return Cf(r.libEntry)?r.libEntry:kf(new URL("../index.ts",import.meta.url))}async function Mo(r={}){let e=r.paths??H(),i=r.entryOverride??Kr(e);await Af(Df(e.logFile),{recursive:!0});let a=Ef(e.logFile,"a"),f=i.endsWith(".ts")?["--import","tsx/esm",i,"--daemon"]:[i,"--daemon"],l=Sf(process.execPath,f,{detached:!0,stdio:["ignore",a,a],env:{...process.env,COZE_BRIDGE_DAEMON:"1"}});if(l.unref(),typeof l.pid!="number")throw new Error("failed to spawn daemon (no pid)");return If.info("daemon spawned",{pid:l.pid,entry:i}),{pid:l.pid,entry:i}}var If,Hr=Ie(()=>{"use strict";K();oe();If=R("spawn-daemon")});import{spawn as zf}from"node:child_process";import{mkdir as Mf,unlink as qf,writeFile as Uf}from"node:fs/promises";import{dirname as Ff,join as Kf}from"node:path";function Jn(r){return r.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function Ho(r,e){return new Promise((i,a)=>{let x=zf(r,e,{stdio:["ignore","pipe","pipe"]}),f="";x.stderr?.on("data",l=>{f+=l.toString("utf8")}),x.on("error",a),x.on("close",l=>{l===0?i():a(new Error(`${r} ${e.join(" ")} exited ${l}: ${f.trim()}`))})})}var Wn,Wr,Jr,jo=Ie(()=>{"use strict";K();Wn=R("supervisor.launchd"),Wr="ai.coze.bridge",Jr={platform:"darwin",renderConfig(r){return`<?xml version="1.0" encoding="UTF-8"?>
17
+ `+i)}function et(r,e,i,a,x,u){if(r.listenerCount("wsClientError")){let d=new Error(x);Error.captureStackTrace(d,et),r.emit("wsClientError",d,i,e)}else zt(i,a,x,u)}});import{spawn as yu}from"node:child_process";import{existsSync as bu,openSync as vu}from"node:fs";import{mkdir as Su}from"node:fs/promises";import{dirname as Eu}from"node:path";import{fileURLToPath as Cu}from"node:url";function qr(r=H()){return bu(r.libEntry)?r.libEntry:Cu(new URL("../index.ts",import.meta.url))}async function Bo(r={}){let e=r.paths??H(),i=r.entryOverride??qr(e);await Su(Eu(e.logFile),{recursive:!0});let a=vu(e.logFile,"a"),u=i.endsWith(".ts")?["--import","tsx/esm",i,"--daemon"]:[i,"--daemon"],d=yu(process.execPath,u,{detached:!0,stdio:["ignore",a,a],env:{...process.env,COZE_BRIDGE_DAEMON:"1"}});if(d.unref(),typeof d.pid!="number")throw new Error("failed to spawn daemon (no pid)");return Au.info("daemon spawned",{pid:d.pid,entry:i}),{pid:d.pid,entry:i}}var Au,Ur=Ie(()=>{"use strict";K();ae();Au=N("spawn-daemon")});import{spawn as Nu}from"node:child_process";import{mkdir as Ou,unlink as Bu,writeFile as Mu}from"node:fs/promises";import{dirname as zu,join as Fu}from"node:path";function jn(r){return r.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function Uo(r,e){return new Promise((i,a)=>{let x=Nu(r,e,{stdio:["ignore","pipe","pipe"]}),u="";x.stderr?.on("data",d=>{u+=d.toString("utf8")}),x.on("error",a),x.on("close",d=>{d===0?i():a(new Error(`${r} ${e.join(" ")} exited ${d}: ${u.trim()}`))})})}var Gn,Gr,jr,Ko=Ie(()=>{"use strict";K();Gn=N("supervisor.launchd"),Gr="ai.coze.bridge",jr={platform:"darwin",renderConfig(r){return`<?xml version="1.0" encoding="UTF-8"?>
18
18
  <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
19
19
  <plist version="1.0">
20
20
  <dict>
21
21
  <key>Label</key>
22
- <string>${Wr}</string>
22
+ <string>${Gr}</string>
23
23
  <key>ProgramArguments</key>
24
24
  <array>
25
- <string>${Jn(r.nodeBin)}</string>
26
- <string>${Jn(r.entry)}</string>
25
+ <string>${jn(r.nodeBin)}</string>
26
+ <string>${jn(r.entry)}</string>
27
27
  <string>--daemon</string>
28
28
  </array>
29
29
  <key>RunAtLoad</key>
@@ -33,12 +33,12 @@ var H0=Object.create;var fr=Object.defineProperty;var j0=Object.getOwnPropertyDe
33
33
  <key>ThrottleInterval</key>
34
34
  <integer>10</integer>
35
35
  <key>StandardOutPath</key>
36
- <string>${Jn(r.logFile)}</string>
36
+ <string>${jn(r.logFile)}</string>
37
37
  <key>StandardErrorPath</key>
38
- <string>${Jn(r.logFile)}</string>
38
+ <string>${jn(r.logFile)}</string>
39
39
  </dict>
40
40
  </plist>
41
- `},configPath(r){return Kf(r.homeDir,"Library","LaunchAgents",`${Wr}.plist`)},async install(r){let e=this.configPath(r);await Mf(Ff(e),{recursive:!0}),await Uf(e,this.renderConfig(r),"utf8"),Wn.info("plist written",{plistPath:e}),await Ho("launchctl",["load","-w",e]),Wn.info("launchd job loaded",{label:Wr})},async uninstall(r){let e=this.configPath(r);await Ho("launchctl",["unload","-w",e]).catch(i=>Wn.warn("launchctl unload failed (ignored)",{err:String(i)})),await qf(e).catch(i=>{if(i.code!=="ENOENT")throw i}),Wn.info("launchd job removed",{plistPath:e})}}});import{spawn as Hf}from"node:child_process";import{mkdir as jf,unlink as Gf,writeFile as Wf}from"node:fs/promises";import{dirname as Jf,join as Vf}from"node:path";function Xn(r,e){return new Promise((i,a)=>{let x=Hf(r,e,{stdio:["ignore","pipe","pipe"]}),f="";x.stderr?.on("data",l=>{f+=l.toString("utf8")}),x.on("error",a),x.on("close",l=>{l===0?i():a(new Error(`${r} ${e.join(" ")} exited ${l}: ${f.trim()}`))})})}var Vn,Yn,Vr,Go=Ie(()=>{"use strict";K();Vn=R("supervisor.systemd"),Yn="coze-bridge.service",Vr={platform:"linux",renderConfig(r){return`[Unit]
41
+ `},configPath(r){return Fu(r.homeDir,"Library","LaunchAgents",`${Gr}.plist`)},async install(r){let e=this.configPath(r);await Ou(zu(e),{recursive:!0}),await Mu(e,this.renderConfig(r),"utf8"),Gn.info("plist written",{plistPath:e}),await Uo("launchctl",["load","-w",e]),Gn.info("launchd job loaded",{label:Gr})},async uninstall(r){let e=this.configPath(r);await Uo("launchctl",["unload","-w",e]).catch(i=>Gn.warn("launchctl unload failed (ignored)",{err:String(i)})),await Bu(e).catch(i=>{if(i.code!=="ENOENT")throw i}),Gn.info("launchd job removed",{plistPath:e})}}});import{spawn as qu}from"node:child_process";import{mkdir as Uu,unlink as Ku,writeFile as Hu}from"node:fs/promises";import{dirname as Gu,join as ju}from"node:path";function Vn(r,e){return new Promise((i,a)=>{let x=qu(r,e,{stdio:["ignore","pipe","pipe"]}),u="";x.stderr?.on("data",d=>{u+=d.toString("utf8")}),x.on("error",a),x.on("close",d=>{d===0?i():a(new Error(`${r} ${e.join(" ")} exited ${d}: ${u.trim()}`))})})}var Wn,Jn,Wr,Ho=Ie(()=>{"use strict";K();Wn=N("supervisor.systemd"),Jn="coze-bridge.service",Wr={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 Vf(r.homeDir,".config","systemd","user",Yn)},async install(r){let e=this.configPath(r);await jf(Jf(e),{recursive:!0}),await Wf(e,this.renderConfig(r),"utf8"),Vn.info("systemd unit written",{unitPath:e}),await Xn("systemctl",["--user","daemon-reload"]),await Xn("systemctl",["--user","enable","--now",Yn]),Vn.info("systemd unit enabled",{unitName:Yn})},async uninstall(r){let e=this.configPath(r);await Xn("systemctl",["--user","disable","--now",Yn]).catch(i=>Vn.warn("systemctl disable failed (ignored)",{err:String(i)})),await Gf(e).catch(i=>{if(i.code!=="ENOENT")throw i}),await Xn("systemctl",["--user","daemon-reload"]).catch(()=>{}),Vn.info("systemd unit removed",{unitPath:e})}}});import{spawn as Yf}from"node:child_process";import{join as Xf}from"node:path";function Wo(r,e){return new Promise((i,a)=>{let x=Yf(r,e,{stdio:["ignore","pipe","pipe"],shell:!1}),f="";x.stderr?.on("data",l=>{f+=l.toString("utf8")}),x.on("error",a),x.on("close",l=>{l===0?i():a(new Error(`${r} ${e.join(" ")} exited ${l}: ${f.trim()}`))})})}var Yr,Zn,Xr,Jo=Ie(()=>{"use strict";K();Yr=R("supervisor.taskscheduler"),Zn="CozeBridge",Xr={platform:"win32",renderConfig(r){return`<?xml version="1.0" encoding="UTF-16"?>
55
+ `},configPath(r){return ju(r.homeDir,".config","systemd","user",Jn)},async install(r){let e=this.configPath(r);await Uu(Gu(e),{recursive:!0}),await Hu(e,this.renderConfig(r),"utf8"),Wn.info("systemd unit written",{unitPath:e}),await Vn("systemctl",["--user","daemon-reload"]),await Vn("systemctl",["--user","enable","--now",Jn]),Wn.info("systemd unit enabled",{unitName:Jn})},async uninstall(r){let e=this.configPath(r);await Vn("systemctl",["--user","disable","--now",Jn]).catch(i=>Wn.warn("systemctl disable failed (ignored)",{err:String(i)})),await Ku(e).catch(i=>{if(i.code!=="ENOENT")throw i}),await Vn("systemctl",["--user","daemon-reload"]).catch(()=>{}),Wn.info("systemd unit removed",{unitPath:e})}}});import{spawn as Wu}from"node:child_process";import{join as Ju}from"node:path";function Go(r,e){return new Promise((i,a)=>{let x=Wu(r,e,{stdio:["ignore","pipe","pipe"],shell:!1}),u="";x.stderr?.on("data",d=>{u+=d.toString("utf8")}),x.on("error",a),x.on("close",d=>{d===0?i():a(new Error(`${r} ${e.join(" ")} exited ${d}: ${u.trim()}`))})})}var Jr,Yn,Vr,jo=Ie(()=>{"use strict";K();Jr=N("supervisor.taskscheduler"),Yn="CozeBridge",Vr={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,7 +76,7 @@ WantedBy=default.target
76
76
  </Exec>
77
77
  </Actions>
78
78
  </Task>
79
- `},configPath(r){return Xf(r.homeDir,".coze","bridge","task.xml")},async install(r){let e=`"${r.nodeBin}" "${r.entry}" --daemon`;await Wo("schtasks",["/Create","/SC","ONLOGON","/TN",Zn,"/TR",e,"/RU",r.userName,"/F"]),Yr.info("task scheduler entry created",{task:Zn})},async uninstall(r){await Wo("schtasks",["/Delete","/TN",Zn,"/F"]).catch(e=>Yr.warn("schtasks /Delete failed (ignored)",{err:String(e)})),Yr.info("task scheduler entry removed",{task:Zn})}}});var Zr={};vs(Zr,{buildContext:()=>eu,getSupervisor:()=>Qf,launchdSupervisor:()=>Jr,systemdSupervisor:()=>Vr,taskSchedulerSupervisor:()=>Xr});import{homedir as Zf,userInfo as $f}from"node:os";function Qf(r=process.platform){switch(r){case"darwin":return Jr;case"linux":return Vr;case"win32":return Xr;default:throw new Error(`unsupported platform for OS supervisor: ${r}`)}}function eu(){let r=H();return{nodeBin:process.execPath,entry:Kr(r),logFile:r.logFile,homeDir:Zf(),userName:$f().username}}var $r=Ie(()=>{"use strict";oe();Hr();jo();Go();Jo()});Ue();K();import{readdir as fa}from"node:fs/promises";import{mkdir as ia,writeFile as oa}from"node:fs/promises";import{join as aa}from"node:path";var xa={"claude-code":"CLAUDE.md",codex:"AGENTS.md",openclaw:"SOUL.md"};async function at(r,e,i,a){await ia(r,{recursive:!0});let x=xa[e],f=aa(r,x),l=ca(e,i,a);return await oa(f,l,"utf8"),f}function ca(r,e,i){let a=`# Coze Agent: ${e}
79
+ `},configPath(r){return Ju(r.homeDir,".coze","bridge","task.xml")},async install(r){let e=`"${r.nodeBin}" "${r.entry}" --daemon`;await Go("schtasks",["/Create","/SC","ONLOGON","/TN",Yn,"/TR",e,"/RU",r.userName,"/F"]),Jr.info("task scheduler entry created",{task:Yn})},async uninstall(r){await Go("schtasks",["/Delete","/TN",Yn,"/F"]).catch(e=>Jr.warn("schtasks /Delete failed (ignored)",{err:String(e)})),Jr.info("task scheduler entry removed",{task:Yn})}}});var Yr={};bs(Yr,{buildContext:()=>Qu,getSupervisor:()=>$u,launchdSupervisor:()=>jr,systemdSupervisor:()=>Wr,taskSchedulerSupervisor:()=>Vr});import{homedir as Vu,userInfo as Yu}from"node:os";function $u(r=process.platform){switch(r){case"darwin":return jr;case"linux":return Wr;case"win32":return Vr;default:throw new Error(`unsupported platform for OS supervisor: ${r}`)}}function Qu(){let r=H();return{nodeBin:process.execPath,entry:qr(r),logFile:r.logFile,homeDir:Vu(),userName:Yu().username}}var $r=Ie(()=>{"use strict";ae();Ur();Ko();Ho();jo()});Ue();K();import{readdir as c0}from"node:fs/promises";import{mkdir as r0,writeFile as s0}from"node:fs/promises";import{join as i0}from"node:path";var o0={"claude-code":"CLAUDE.md",codex:"AGENTS.md",openclaw:"SOUL.md"};async function ot(r,e,i,a){await r0(r,{recursive:!0});let x=o0[e],u=i0(r,x),d=a0(e,i,a);return await s0(u,d,"utf8"),u}function a0(r,e,i){let a=`# Coze Agent: ${e}
80
80
 
81
81
  > framework: \`${r}\`
82
82
 
@@ -85,11 +85,11 @@ WantedBy=default.target
85
85
  `:`_No instructions provided._
86
86
  `;return`${a}---
87
87
 
88
- ${x}`}var ve=R("agent-detail-sync"),$t=class{constructor(e){this.opts=e}opts;async syncAll(e){let i=this.opts.paths.agentsRoot,a;try{a=await fa(i)}catch(x){ve.info("agents dir not found, skip detail sync",{root:i,err:String(x)});return}ve.info("starting detail sync",{reason:e,count:a.length});for(let x of a)try{await this.syncOne(x)}catch(f){ve.warn("detail sync failed for agent, skipping",{agentId:x,err:String(f)})}ve.info("detail sync done",{reason:e})}async syncOne(e){let i=await ae(e,this.opts.paths);if(!i){ve.info("detail sync: agent config missing, skip",{agentId:e});return}let a;try{a=await this.opts.sendDetail({_meta:{cozeAgentId:e}})}catch(l){ve.warn("detail RPC failed, using local data",{agentId:e,err:String(l)});return}if(a.agentId&&a.agentId!==e){ve.warn("detail response agentId mismatch, ignoring",{agentId:e,responseAgentId:a.agentId});return}let x=!1,f=!1;if(a.agentName&&a.agentName!==i.agentName&&(i.agentName=a.agentName,x=!0),a.description!==void 0&&a.description!==i.description&&(i.description=a.description,x=!0),a.cozeIdentity&&a.cozeIdentity!==i.cozeIdentity&&(i.cozeIdentity=a.cozeIdentity,x=!0,f=!0),a.deployType&&ve.info("detail.deployType",{agentId:e,deployType:a.deployType}),!x){ve.debug("detail sync: no diff",{agentId:e});return}await ge(i,this.opts.paths),ve.info("detail sync: config updated",{agentId:e,identityChanged:f,agentName:i.agentName}),f&&(await at(i.workspace,i.framework,e,i.cozeIdentity),await this.opts.handlers.reloadAgentSessionsPublic(e,"detail-sync"))}};Ue();import{spawn as zs}from"node:child_process";import{lstat as hr,mkdir as ua,readFile as Ms,readdir as da,rm as la,stat as ha,writeFile as ga}from"node:fs/promises";import{join as Le,normalize as pa,relative as qs,resolve as ma,sep as Us}from"node:path";function Dt(r){return r?.cozeDeployType==="cloud"?"cloud":"local"}function Is(r){let{_meta:e,...i}=r;return{stripped:i,meta:e}}function xt(r){if(!r?.cozeAgentId)throw new Error("missing _meta.cozeAgentId");return r.cozeAgentId}var E=class extends Error{code;retriable;cause;constructor(e,i,a){super(i),this.name="BridgeError",this.code=e,this.retriable=a?.retriable??!1,a?.cause!==void 0&&(this.cause=a.cause)}};K();oe();function Ve(r,e){if(Dt(r)!=="cloud")throw new E("OPERATION_NOT_ALLOWED_FOR_LOCAL",`${e} is not allowed for local agent`)}function Qt(r){return r.replace(/[^A-Za-z0-9._-]+/g,"-")}var Ps="https://llm-gateway.coze.cn",ct="auto";function Ts(r){return{model:r.model??ct,...r.modelToken?{modelToken:r.modelToken}:{}}}function Ls(r){return!r||r===ct}function Ns(r){let e={};return r.modelToken&&(e.ANTHROPIC_BASE_URL=Ps,e.ANTHROPIC_AUTH_TOKEN=r.modelToken),Ls(r.model)||(e.ANTHROPIC_MODEL=r.model),e}function Rs(r){let e=[];return Ls(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="${Ps}/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 Os(r){return r.modelToken?{OPENAI_API_KEY:r.modelToken}:{}}var fe=R("agent-handlers"),Bs=5*1024*1024,wa=1,_a=6,ya=new Set(["node_modules",".git",".coze","dist","build",".next"]),tn=class{constructor(e){this.opts=e}opts;async listSkills(e){Ve(e._meta,"_agent/listSkills");let i=xt(e._meta),a=await this.loadAgentCfg(i),x=a?.workspace??Te(i).workspace,f=a?.skills??[],l=[];for(let h of f){let m=Le(x,h.relPath,"SKILL.md");await ha(m).then(b=>b.isFile()).catch(()=>!1)&&l.push({skillId:h.skillId,skillName:h.skillName,downloadUrl:h.downloadUrl??"",...h.description?{description:h.description}:{},...h.version?{version:h.version}:{}})}return{skills:l}}async addSkills(e){Ve(e._meta,"_agent/addSkills");let i=xt(e._meta),a=await this.requireAgentCfg(i),x=e.skills??[],f=[...a.skills??[]],l=new Map(f.map((m,_)=>[m.skillId,_])),h=[];for(let m of x){if(!m.skillName)throw new E("IPC_BAD_REQUEST","skill missing skillName");let _=ba(m.skillName),b=va(a.framework),w=Le(b,_),C=Le(a.workspace,w);await ua(C,{recursive:!0});let k=await Ea(m.downloadUrl);Da(k)?await ka(k,C):await ga(Le(C,"SKILL.md"),k.toString("utf8"),"utf8");let T={skillId:m.skillId,skillName:m.skillName,relPath:w,installedAt:Date.now(),...m.description?{description:m.description}:{},...m.version?{version:m.version}:{},...m.downloadUrl?{downloadUrl:m.downloadUrl}:{}},L=l.get(m.skillId);L!==void 0?f[L]=T:(l.set(m.skillId,f.length),f.push(T)),h.push(m),fe.info("skill installed",{agentId:i,skillId:m.skillId,skillName:m.skillName,relPath:w})}return await Xt(i,f),await this.reloadAgentSessions(i,"skills-added"),{installedSkills:h}}async removeSkills(e){Ve(e._meta,"_agent/removeSkills");let i=xt(e._meta),a=await this.requireAgentCfg(i),x=new Set(e.skillIds??[]),f=a.skills??[],l=[];for(let h of f){if(!x.has(h.skillId)){l.push(h);continue}let m=Le(a.workspace,h.relPath);await la(m,{recursive:!0,force:!0}),fe.info("skill removed",{agentId:i,skillId:h.skillId,relPath:h.relPath})}return await Xt(i,l),await this.reloadAgentSessions(i,"skills-removed"),{ok:!0}}reloadAgentSessionsPublic(e,i){return this.reloadAgentSessions(e,i)}async reloadAgentSessions(e,i){let a=this.opts.agents.get(e);if(a&&a.framework!=="codex"){for(let[x,f]of a.sessions)if(!(!f.downstream||!f.acpSessionId)){f.loadingSession=!0;try{await f.downstream.sessionLoad({sessionId:f.acpSessionId,cwd:a.workspace}),fe.info("session reloaded",{reason:i,agentId:e,framework:a.framework,cloudId:x,acpId:f.acpSessionId})}catch(l){fe.warn("session reload failed",{reason:i,agentId:e,framework:a.framework,cloudId:x,acpId:f.acpSessionId,err:String(l)})}finally{f.loadingSession=!1}}}}async updateAgent(e){if(!e.cozeIdentity?.trim())return fe.info("_agent/update: empty cozeIdentity, noop",{agentId:e.agentId}),{ok:!0};let i=e.agentId,a=await ae(i);if(!a)throw new E("AGENT_NOT_FOUND",`agent not found: ${i}`);return a.cozeIdentity===e.cozeIdentity?(fe.info("_agent/update: cozeIdentity unchanged, noop",{agentId:i}),{ok:!0}):(a.cozeIdentity=e.cozeIdentity,await ge(a),await at(a.workspace,a.framework,i,e.cozeIdentity),fe.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 ae(i);return a?(a.disconnectedAt=Date.now(),a.disconnectReason=e.reason??"",await ge(a),fe.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}):(fe.warn("_agent/disconnect: agent not found, ignoring",{agentId:i}),{ok:!0})}async switchModel(e){if(Ve(e._meta,"_agent/switchModel"),!e.agentId)throw new E("IPC_BAD_REQUEST","_agent/switchModel: missing agentId");let i=e.model?.trim()?e.model:ct,a=await ae(e.agentId);if(!a)throw new E("AGENT_NOT_FOUND",`agent not found: ${e.agentId}`);a.model=i,await ge(a),fe.info("_agent/switchModel: model persisted",{agentId:e.agentId,model:i,reason:e.reason??""});let x=this.opts.agents.get(e.agentId);return x?(await x.msgQueue.enqueue(async()=>{x.model=i,await x.killAllRuntimes(`switchModel: ${i}`)}),fe.info("_agent/switchModel: all session runtimes killed, next prompt will respawn",{agentId:e.agentId,model:i}),{ok:!0}):(fe.info("_agent/switchModel: agent not running, config persisted only",{agentId:e.agentId}),{ok:!0})}async getFileTree(e){Ve(e._meta,"_agent/getFileTree");let i=e._meta,a=xt(i),x=await this.resolveWorkspace(a),f=e.filePath??"",l=this.safeJoin(x,f),h=await hr(l).catch(()=>null);if(!h)throw new E("IPC_BAD_REQUEST",`path not found: ${f}`);if(h.isSymbolicLink())throw new E("IPC_BAD_REQUEST",`symlink not allowed: ${f}`);let m=Pa(e.depth);return h.isDirectory()?{tree:await Fs(x,l,f,m)}:{tree:[{name:Ta(f),path:Ks(f||"."),isDir:!1,size:h.size,modifiedAt:Math.floor(h.mtimeMs)}]}}async getFileContent(e){Ve(e._meta,"_agent/getFileContent");let i=xt(e._meta),a=await this.resolveWorkspace(i);if(!e.filePath)throw new E("IPC_BAD_REQUEST","filePath required");let x=this.safeJoin(a,e.filePath),f=await hr(x).catch(()=>null);if(!f||!f.isFile())throw new E("IPC_BAD_REQUEST",`not a file: ${e.filePath}`);if(f.isSymbolicLink())throw new E("IPC_BAD_REQUEST",`symlink not allowed: ${e.filePath}`);if(f.size>Bs)throw new E("IPC_BAD_REQUEST",`file too large: ${f.size} bytes (max ${Bs})`);let l=await Ms(x);return l.includes(0)?{content:l.toString("base64"),encoding:"base64",size:f.size}:{content:l.toString("utf8"),encoding:"utf-8",size:f.size}}async resolveWorkspace(e){let i=this.opts.agents.get(e);return i?i.workspace:(await ae(e).catch(()=>null))?.workspace??Te(e).workspace}safeJoin(e,i){let a=ma(e,i||"."),x=qs(e,a);if(x.startsWith("..")||x===".."||x.startsWith(`..${Us}`))throw new E("IPC_BAD_REQUEST",`path escapes workspace: ${i}`);return a}loadAgentCfg(e){return ae(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 ba(r){let e=Qt(r.trim()).replace(/^-+|-+$/g,"").slice(0,64);if(!e||e==="."||e==="..")throw new E("IPC_BAD_REQUEST",`invalid skill name: ${r}`);return e}function va(r){return r==="claude-code"?Le(".claude","skills"):Le(".agents","skills")}var Sa=3e4,Ca=50*1024*1024,nn=3e4;async function Ea(r){if(!r)throw new E("IPC_BAD_REQUEST","skill missing downloadUrl");if(r.startsWith("data:")){let e=Math.floor(r.length*3/4);en(e);let i=Aa(r);return en(i.length),i}if(r.startsWith("file:")){let e=new URL(r).pathname,i=await Ms(e);return en(i.length),i}if(r.startsWith("http://")||r.startsWith("https://")){let e=new AbortController,i=setTimeout(()=>e.abort(),Sa);try{let a=await fetch(r,{signal:e.signal});if(!a.ok)throw new E("IPC_BAD_REQUEST",`fetch skill failed HTTP ${a.status} ${r}`);let x=await a.arrayBuffer();return en(x.byteLength),Buffer.from(x)}finally{clearTimeout(i)}}throw new E("IPC_BAD_REQUEST",`unsupported downloadUrl scheme (\u8981 https/data/file): ${r.slice(0,80)}`)}function en(r){if(r>Ca)throw new E("IPC_BAD_REQUEST",`skill too large: ${r} bytes`)}function Aa(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 Da(r){return r.length>=2&&r[0]===31&&r[1]===139}async function ka(r,e){await Ia(r),await new Promise((i,a)=>{let x=zs("tar",["-xzf","-","-C",e,"--strip-components=1","--no-same-owner"],{stdio:["pipe","pipe","pipe"]}),f="";x.stderr?.on("data",h=>{f+=String(h)});let l=setTimeout(()=>{x.kill("SIGKILL"),a(new E("IPC_BAD_REQUEST",`tar extract timeout (${nn}ms)`))},nn);x.on("error",h=>{clearTimeout(l),a(new E("IPC_BAD_REQUEST",`tar spawn failed: ${h.message}`,{cause:h}))}),x.on("exit",h=>{clearTimeout(l),h===0?i():a(new E("IPC_BAD_REQUEST",`tar exit ${h}${f?`: ${f.trim().slice(0,200)}`:""}`))}),x.stdin?.end(r)})}async function Ia(r){let e=await new Promise((i,a)=>{let x=zs("tar",["-tzvf","-"],{stdio:["pipe","pipe","pipe"]}),f="",l="";x.stdout?.on("data",m=>{f+=String(m)}),x.stderr?.on("data",m=>{l+=String(m)});let h=setTimeout(()=>{x.kill("SIGKILL"),a(new E("IPC_BAD_REQUEST",`tar list timeout (${nn}ms)`))},nn);x.on("error",m=>{clearTimeout(h),a(new E("IPC_BAD_REQUEST",`tar list spawn failed: ${m.message}`))}),x.on("exit",m=>{clearTimeout(h),m===0?i(f):a(new E("IPC_BAD_REQUEST",`tar list exit ${m}${l?`: ${l.trim().slice(0,200)}`:""}`))}),x.stdin?.end(r)});for(let i of e.split(`
89
- `)){let a=i.trim();if(!a)continue;let x=a.charCodeAt(0);if(x!==45&&x!==100)throw new E("IPC_BAD_REQUEST",`tar entry kind '${a[0]}' not allowed (symlink/hardlink/special): ${a.slice(0,100)}`);let l=(a.match(/\s(\S.*)$/)?.[1]??"").split(" -> ")[0]?.trim()??"";if(!l)continue;if(l.startsWith("/"))throw new E("IPC_BAD_REQUEST",`tar entry absolute path: ${l}`);if(l.split(/[/\\]/).some(m=>m===".."))throw new E("IPC_BAD_REQUEST",`tar entry contains '..': ${l}`)}}async function Fs(r,e,i,a){if(a<=0)return[];let x;try{x=await da(e,{withFileTypes:!0})}catch{return[]}let f=[];for(let l of x){if(ya.has(l.name)||l.isSymbolicLink())continue;let h=Le(e,l.name),m=pa(Le(i,l.name)),_=null;try{_=await hr(h)}catch{continue}if(_.isSymbolicLink())continue;let b={name:l.name,path:Ks(qs(r,h)),isDir:_.isDirectory(),size:_.size,modifiedAt:Math.floor(_.mtimeMs)};_.isDirectory()&&a>1&&(b.children=await Fs(r,h,m,a-1)),f.push(b)}return f.sort((l,h)=>l.isDir!==h.isDir?l.isDir?-1:1:l.name.localeCompare(h.name)),f}function Pa(r){return!r||r<=0?wa:Math.min(r,_a)}function Ta(r){if(!r||r==="."||r==="/")return".";let e=r.split(/[/\\]/);return e[e.length-1]||"."}function Ks(r){return r.split(Us).join("/")}K();var kt=R("agent-health-reporter"),La=1e4,rn=class{constructor(e){this.opts=e;this.intervalMs=e.intervalMs??La}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()}),kt.info("heartbeat started",{intervalMs:this.intervalMs}),this.tick())}stop(){this.timer&&(clearInterval(this.timer),this.timer=null,this.unsubscribeRegister&&(this.unsubscribeRegister(),this.unsubscribeRegister=null),kt.info("heartbeat stopped"))}async tick(){if(this.inFlight){kt.debug("previous tick still in-flight, skip");return}let e=this.opts.getDeviceId();if(!e){kt.debug("deviceId not available, skip tick (\u5C1A\u672A pair)");return}this.inFlight=!0;try{let i=[];for(let x of this.opts.core.agents.values()){let f=Na(x);f&&i.push({agentId:x.agentId,status:f})}if(i.length===0)return;let a={agents:i,_meta:{cozeDeviceId:e}};try{await this.opts.core.sendRequest("_agent/health",a)}catch(x){kt.warn("heartbeat batch send failed",{count:i.length,err:String(x)})}}finally{this.inFlight=!1}}};function Na(r){return r.status==="error"?"error":r.activeTriggers.size>0?"busy":r.status==="ok"?"online":null}Ue();import{mkdir as gr,rm as Ja}from"node:fs/promises";import{spawn as Ma}from"node:child_process";function It(r,e,i){return i===void 0?{jsonrpc:"2.0",id:r,method:e}:{jsonrpc:"2.0",id:r,method:e,params:i}}function sn(r,e){return e===void 0?{jsonrpc:"2.0",method:r}:{jsonrpc:"2.0",method:r,params:e}}function ft(r,e){return{jsonrpc:"2.0",id:r,result:e}}function Ye(r,e){return{jsonrpc:"2.0",id:r,error:e}}var on=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 Hs(r){return"method"in r&&"id"in r&&r.id!==void 0}function js(r){return"method"in r&&!("id"in r)}function an(r){return!("method"in r)&&"id"in r}var Ra={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 xn(r){return r instanceof E?{code:Ra[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 Gs(r){let e=r.data,i=e?.bridgeCode??"AGENT_PROTOCOL_ERROR";return new E(i,r.message,{retriable:e?.retriable??!1,cause:r.data})}function Ws(r){return`${JSON.stringify(r)}
90
- `}var cn=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(`
91
- `);this.buffer=i.pop()??"";let a=[];for(let x of i){let f=x.replace(/\r$/,"").trim();if(f)try{a.push(JSON.parse(f))}catch(l){this.onError?.({line:f,error:l})}}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 Vs={"session/prompt":"session.prompt","session/cancel":"session.cancel","session/new":"session.new","session/load":"session.load","_agent/create":"agent.create","_agent/health":"agent.health","_agent/pair":"agent.pair","_agent/listSkills":"agent.listSkills","_agent/addSkills":"agent.addSkills","_agent/removeSkills":"agent.removeSkills","_agent/getFileTree":"agent.getFileTree","_agent/getFileContent":"agent.getFileContent","_agent/detail":"agent.detail","_agent/update":"agent.update","_agent/disconnect":"agent.disconnect","_agent/switchModel":"agent.switchModel","_agent/genModelToken":"agent.genModelToken","session/request_permission":"session.requestPermission",initialize:"initialize"},od=Object.fromEntries(Object.entries(Vs).map(([r,e])=>[e,r])),Oa={"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"],"session.requestPermission":["agentId","sessionId"],"agent.pair":[],initialize:[]},ut=class{seq=0;next(e,i){this.seq+=1;let a=Vs[e]??Ba(e),x=Oa[a]??[],f=[a,String(this.seq)];if(x.length>0){let l=x.map(m=>Js(i?.[m]??"")),h=za(l).join(":");h&&f.push(h)}else i&&Object.values(i).some(l=>l)&&f.push(Object.values(i).filter(Boolean).map(l=>Js(String(l))).join(":"));return f.join("_")}reset(){this.seq=0}};function Ba(r){return r.replace(/[\s/]+/g,".").replace(/_+/g,"-")}function Js(r){return r.replace(/[:_\s]+/g,"-")}function za(r){let e=r.length;for(;e>0&&!r[e-1];)e-=1;return r.slice(0,e)}K();var qa=3e4;function Ys(r,e){if(!(typeof r!="number"||r<=0))try{process.platform==="win32"?process.kill(r,e):process.kill(-r,e)}catch{}}var Fe=class{constructor(e){this.opts=e;this.log=R(`downstream.${this.constructor.name}`),this.decoder=new cn({onError:i=>this.log.warn("decode line failed",{line:i.line})})}opts;child;decoder;pending=new Map;idAllocator=new ut;updateHandlers=[];agentRequestHandlers=[];exitHandlers=[];log;stopped=!1;sanitizeEnv(e){return e}async start(){if(this.child)throw new E("BRIDGE_INTERNAL","Downstream already started");let e=process.platform!=="win32",i=Ma(this.opts.command,this.opts.args,{cwd:this.opts.cwd,env:{...this.sanitizeEnv(process.env),...this.opts.env},stdio:["pipe","pipe","pipe"],detached:e});this.child=i,i.stdout?.setEncoding("utf8"),i.stdout?.on("data",a=>{for(let x of this.decoder.push(a))this.dispatch(x)}),i.stderr?.setEncoding("utf8"),i.stderr?.on("data",a=>{this.log.debug("stderr",{text:a.trimEnd()})}),i.on("exit",(a,x)=>{this.stopped=!0,this.failAllPending(new E("AGENT_PROTOCOL_ERROR",`agent exited (${a}/${x})`));for(let f of this.exitHandlers)f(a,x)}),i.on("error",a=>{this.log.error("child error",{err:String(a)}),this.failAllPending(new E("AGENT_SPAWN_FAILED",String(a),{cause:a}))}),this.log.info("downstream started",{command:this.opts.command,pid:i.pid,cwd:this.opts.cwd})}async stop(e){if(!this.child||this.stopped)return;this.stopped=!0,this.log.info("downstream stopping",{reason:e});let i=this.child,a=new Promise(f=>i.once("exit",()=>f()));Ys(i.pid,"SIGTERM");let x=setTimeout(()=>{i.killed||Ys(i.pid,"SIGKILL")},5e3);try{await a}finally{clearTimeout(x)}}pid(){return this.child?.pid}isAlive(){return!!this.child&&!this.stopped}initialize(e){return this.call("initialize",e)}sessionNew(e){return this.call("session/new",{mcpServers:[],...e})}sessionLoad(e){return this.call("session/load",{mcpServers:[],...e})}sessionPrompt(e){return this.call("session/prompt",e,0)}async sessionCancel(e){!this.child||this.stopped||this.writeFrame(sn("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(Ye(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=qa){if(!this.child||this.stopped)return Promise.reject(new E("AGENT_PROTOCOL_ERROR","downstream not started"));let x=this.idAllocator.next(e),f=It(x,e,i),l=a>0&&Number.isFinite(a);return new Promise((h,m)=>{let _=l?setTimeout(()=>{this.pending.delete(x),m(new E("AGENT_TIMEOUT",`${e} timed out after ${a}ms`))},a):null;this.pending.set(x,{resolve:h,reject:m,timer:_,method:e});try{this.writeFrame(f)}catch(b){_&&clearTimeout(_),this.pending.delete(x),m(b)}})}writeFrame(e){if(!this.child?.stdin||this.child.stdin.destroyed)throw new E("AGENT_PROTOCOL_ERROR","downstream stdin not writable");this.child.stdin.write(Ws(e))}dispatch(e){if(an(e)){let i=e.id!==null?this.pending.get(e.id):void 0;if(!i){this.log.warn("orphan response",{id:e.id});return}this.pending.delete(e.id),i.timer&&clearTimeout(i.timer),e.error?i.reject(Gs(e.error)):i.resolve(e.result);return}if(js(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(Hs(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(Ye(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(Ye(e.id,xn(a)))}catch{}}}failAllPending(e){for(let i of this.pending.values())i.timer&&clearTimeout(i.timer),i.reject(e);this.pending.clear()}};var Ua="@agentclientprotocol/claude-agent-acp@latest";function Fa(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 fn=class extends Fe{framework="claude-code";constructor(e){let i=e.command??"npx",a=e.args??["-y",Ua],x={command:i,args:a,cwd:e.cwd,...e.env?{env:e.env}:{}};super(x)}sanitizeEnv(e){return Fa(e)}};import{mkdtempSync as Ka,rmSync as Ha}from"node:fs";import{tmpdir as ja}from"node:os";import{join as Ga}from"node:path";var Wa="@zed-industries/codex-acp@latest",un=class extends Fe{framework="codex";authMethodId;codexHomeDir;constructor(e){let i=e.command??"npx",a=e.args??["-y",Wa],x=e.extraArgs?[...a,...e.extraArgs]:a,f=e.isolateCodexHome?Ka(Ga(ja(),"coze-bridge-codex-home-")):void 0,l=f?{...e.env??{},CODEX_HOME:f}:e.env,h={command:i,args:x,cwd:e.cwd,...l?{env:l}:{}};super(h),this.authMethodId=e.authMethodId,this.codexHomeDir=f}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{Ha(this.codexHomeDir,{recursive:!0,force:!0})}catch{}}};import{spawn as Xs}from"node:child_process";K();var dn=class extends Fe{framework="openclaw";registerLog;profile;agentId;sessionName;registered=!1;constructor(e){let i=e.profile??"coze",a=e.sessionName??"default",x=["--profile",i,"acp","--session",`agent:${e.agentId}:${a}`],f={command:e.command,args:x,cwd:e.cwd,...e.env?{env:e.env}:{}};super(f),this.profile=i,this.agentId=e.agentId,this.sessionName=a,this.registerLog=R("downstream.openclaw.register")}async start(){await this.registerAgent().catch(e=>{this.registerLog.warn("openclaw agents add failed (will continue to acp anyway)",{agentId:this.agentId,err:String(e)})}),await super.start()}registerAgent(){return new Promise((e,i)=>{let a=Xs(this.opts.command,["--profile",this.profile,"agents","add",this.agentId,"--workspace",this.opts.cwd,"--non-interactive"],{stdio:["ignore","pipe","pipe"],env:{...process.env,...this.opts.env}}),x="";a.stderr?.on("data",f=>{x+=f.toString("utf8")}),a.on("error",i),a.on("close",f=>{f===0?(this.registered=!0,this.registerLog.info("agent registered",{agentId:this.agentId,profile:this.profile}),e()):i(new E("AGENT_SPAWN_FAILED",`openclaw agents add ${this.agentId} exited ${f}: ${x.trim()}`))})})}async cleanup(e){this.registered&&await new Promise(i=>{let a=Xs(this.opts.command,["--profile",this.profile,"agents","delete",this.agentId,"--force"],{stdio:["ignore","pipe","pipe"],env:{...process.env,...this.opts.env}}),x="";a.stderr?.on("data",f=>{x+=f.toString("utf8")}),a.on("error",f=>{this.registerLog.warn("openclaw agents delete failed (best-effort)",{agentId:this.agentId,err:String(f)}),i()}),a.on("close",f=>{f===0?this.registerLog.info("agent unregistered",{agentId:this.agentId}):this.registerLog.warn("openclaw agents delete non-zero exit",{agentId:this.agentId,code:f,stderr:x.trim()}),this.registered=!1,i()})})}get acpSessionName(){return this.sessionName}};K();oe();var ln=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 hn=class{agentId;framework;workspace;deployType;msgQueue;sessions=new Map;activeTriggers=new Map;status="ok";model;lastActiveAt=Date.now();constructor(e){this.agentId=e.agentId,this.framework=e.framework,this.workspace=e.workspace,this.model=e.model,this.deployType=e.deployType??"local",this.msgQueue=new ln}async dispose(e){this.status="stopped",this.msgQueue.dispose(new Error(`AgentSession disposed${e?`: ${e}`:""}`)),await this.killAllRuntimes(e??"dispose")}async killAllRuntimes(e){let i=[];for(let[,a]of this.sessions)Pt(a),a.downstream&&(i.push(a.downstream.stop(e).catch(()=>{})),a.downstream=void 0);await Promise.all(i),this.activeTriggers.clear()}};function Pt(r){r.idleTimer&&(clearTimeout(r.idleTimer),r.idleTimer=void 0)}var Ke=R("agent-manager"),Va=(r,e,i,a,x,f)=>{switch(r){case"claude-code":{let l=x?Ns(x):void 0;return new fn({cwd:i,...l&&Object.keys(l).length>0?{env:l}:{}})}case"codex":{let l=x?Rs(x):[],h=x?Os(x):void 0,m=!!x;return new un({cwd:i,...l.length>0?{extraArgs:l}:{},...h&&Object.keys(h).length>0?{env:h}:{},...m?{authMethodId:"openai-api-key",isolateCodexHome:!0}:{}})}case"openclaw":return new dn({command:e,cwd:i,agentId:a,...f?{sessionName:Qt(f)}:{}})}};function Ya(r){return r==="claude-code"||r==="codex"}var Xa={path:"",version:"cloud-deployed"},Za={protocolVersion:1,clientCapabilities:{fs:{readTextFile:!0,writeTextFile:!0}}},$a=2e4,gn=class{paths;config;registry;factory;createTimeoutMs;constructor(e){this.paths=e.paths,this.config=e.config,this.registry=e.registry,this.factory=e.downstreamFactory??Va,this.createTimeoutMs=e.createTimeoutMs??$a}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=Dt(e._meta)==="cloud";if(i&&e.framework==="openclaw")return Ke.info("cloud-deployed openclaw, ack without local spawn",{agentId:e.agentId,framework:e.framework}),{ok:!0,agentId:e.agentId,framework:e.framework};this.registry.reviveIfDisconnected?.(e.agentId);let a=this.registry.get(e.agentId);if(a){if(a.framework!==e.framework)throw new E("AGENT_BUSY",`agent ${e.agentId} exists with different framework (${a.framework})`);if(a.status==="error")Ke.warn("existing agent in error state, rebuilding",{agentId:e.agentId}),await a.dispose("rebuild after error").catch(w=>Ke.warn("dispose stale agent failed (ignored)",{err:String(w)})),this.registry.unregister(e.agentId);else return Ke.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`);let x=Te(e.agentId,this.paths),f=e.workspace??x.workspace,l=Dt(e._meta),h=new AbortController,m=setTimeout(()=>h.abort(new E("AGENT_TIMEOUT",`_agent/create timed out after ${this.createTimeoutMs}ms`)),this.createTimeoutMs),_,b=!1;try{let w=()=>{if(h.signal.aborted)throw h.signal.reason instanceof Error?h.signal.reason:new E("AGENT_TIMEOUT","_agent/create aborted")};await gr(x.root,{recursive:!0}),await gr(f,{recursive:!0}),await gr(x.logs,{recursive:!0}),w(),await at(f,e.framework,e.agentId,e.cozeIdentity),w();let C=await ae(e.agentId,this.paths).catch(()=>null),k=Ts({model:e.model??C?.model});if(_=new hn({agentId:e.agentId,framework:e.framework,workspace:f,model:k.model??ct,deployType:l}),_.status="ok",C?.sessions){for(let[F,Q]of Object.entries(C.sessions))_.sessions.set(F,{acpSessionId:Q.acpSessionId,modelToken:Q.modelToken,tokenGeneratedAt:Q.tokenGeneratedAt,lastActiveAt:Date.now(),loadingSession:!1});let L=Object.keys(C.sessions).length;L>0&&Ke.info("restored persisted session records (no spawn)",{agentId:e.agentId,count:L})}this.registry.register(_),b=!0;let T={agentId:e.agentId,framework:e.framework,workspace:f,cozeIdentity:e.cozeIdentity,createdAt:C?.createdAt??Date.now(),sessions:C?.sessions??{},model:k.model};return l==="cloud"&&(T.deployType="cloud"),C?.skills&&(T.skills=C.skills),C?.agentName&&(T.agentName=C.agentName),C?.description&&(T.description=C.description),await ge(T,this.paths),Ke.info("agent created (no spawn, lazy on first prompt)",{agentId:e.agentId,framework:e.framework,deployType:l}),{ok:!0,agentId:e.agentId,workspace:f,framework:e.framework}}catch(w){throw Ke.error("agent create failed, rolling back",{agentId:e.agentId,err:String(w)}),b&&_&&(await _.dispose("rollback").catch(()=>{}),this.registry.unregister(e.agentId)),await Ja(x.root,{recursive:!0,force:!0}).catch(C=>Ke.warn("rm agent dir failed (ignored)",{err:String(C)})),w instanceof E?w:new E("AGENT_SPAWN_FAILED",String(w),{cause:w})}finally{clearTimeout(m)}}async spawnSessionDownstream(e,i,a){let f=this.config.frameworksCache?.[e.framework];if(!f)if(e.deployType==="cloud"&&Ya(e.framework))f=Xa;else throw new E("AGENT_SPAWN_FAILED",`framework ${e.framework} not detected on this machine`);let l=e.deployType==="cloud"?{model:e.model,modelToken:i}:void 0,h=this.factory(e.framework,f.path,e.workspace,e.agentId,l,a);try{return await h.start(),await h.initialize(Za),h}catch(m){throw await h.stop("spawnSessionDownstream failed").catch(()=>{}),m instanceof E?m:new E("AGENT_SPAWN_FAILED",m instanceof Error?m.message:String(m),{cause:m})}}};K();import{spawn as Qa}from"node:child_process";import{constants as Zs,access as ex}from"node:fs/promises";import{delimiter as tx,join as nx}from"node:path";var rx=R("framework-detector"),$s={"claude-code":"claude",codex:"codex",openclaw:"openclaw"},sx=[".exe",".cmd",".bat",".ps1"],Tt=class{env;constructor(e={}){this.env={pathEnv:e.pathEnv??process.env.PATH??"",platform:e.platform??process.platform,spawn:e.spawn??Qa,access:e.access??ex}}async detect(e){let i=$s[e],a=await this.which(i);if(!a)return rx.debug("framework binary not found",{framework:e,bin:i}),null;let x=await this.probeVersion(a);return{path:a,version:x}}async detectAll(){let e=await Promise.all(Object.keys($s).map(async a=>[a,await this.detect(a)])),i={};for(let[a,x]of e)x&&(i[a]=x);return i}async which(e){let i=this.env.pathEnv.split(tx).filter(Boolean),a=this.env.platform==="win32"?["",...sx]:[""];for(let x of i)for(let f of a){let l=nx(x,e+f);if(await this.isExecutable(l))return l}return null}async isExecutable(e){try{let i=this.env.platform==="win32"?Zs.F_OK:Zs.X_OK;return await this.env.access(e,i),!0}catch{return!1}}async probeVersion(e){return new Promise(i=>{let a="",x=!1,f,l=h=>{x||(x=!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"),l("unknown")},5e3),h.stdout?.on("data",m=>{a+=m.toString("utf8")}),h.on("error",()=>l("unknown")),h.on("close",()=>{let m=ox(a).split(/\r?\n/)[0]??"";l(m)})}catch{l("unknown")}})}},ix=new RegExp("\x1B\\[[0-9;]*[A-Za-z]","g");function ox(r){return r.replace(ix,"")}ur();oe();var ax=10*6e4;function Qs(r){let e=r?.sessionIdleTimeoutMs;return typeof e!="number"||!Number.isFinite(e)||e<=0?ax:e}function pn(r){return Gt(r??H().configFile)}function Lt(r,e){return Wt(e??H().configFile,r)}import{randomBytes as xx}from"node:crypto";Ue();var ei={PAIR:"_agent/pair",CREATE:"_agent/create",HEALTH:"_agent/health",LIST_SKILLS:"_agent/listSkills",ADD_SKILLS:"_agent/addSkills",REMOVE_SKILLS:"_agent/removeSkills",GET_FILE_TREE:"_agent/getFileTree",GET_FILE_CONTENT:"_agent/getFileContent",DETAIL:"_agent/detail",UPDATE:"_agent/update",DISCONNECT:"_agent/disconnect",SWITCH_MODEL:"_agent/switchModel",GEN_MODEL_TOKEN:"_agent/genModelToken",DELETE:"_agent/delete"};K();var W=R("core"),cx=3e4,fx=3e4,mn=class{upstream;agents=new Map;disconnectedAgents=new Set;extensions;paths;sessionSpawner;sessionIdleTimeoutMs;upstreamIds=new ut;pendingUpstream=new Map;pendingBridge=new Map;constructor(e){this.upstream=e.upstream,this.extensions=e.extensions??{},this.paths=e.paths,this.sessionSpawner=e.sessionSpawner,this.sessionIdleTimeoutMs=Qs(e.bridgeConfig)}registerExtension(e,i){this.extensions[e]=i}async start(){this.upstream.onFrame(e=>this.handleFrame(e)),await this.upstream.start(),W.info("Core started",{extensions:Object.keys(this.extensions)})}async stop(e){W.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),W.info("agent registered",{agentId:e.agentId,framework:e.framework});for(let i of this.registerHandlers)try{i(e.agentId)}catch(a){W.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)&&W.info("agent revived from disconnect",{agentId:e})}attachRuntimeHooks(e,i,a){let x=a.downstream;x&&(x.onUpdate(f=>{a.loadingSession||this.forwardUpdate(e,f)}),x.onAgentRequest(f=>{this.handleAgentRequest(e,x,f)}),x.onExit((f,l)=>{W.info("session runtime exited",{agentId:e.agentId,cloudId:i,code:f,signal:l}),Pt(a),a.downstream=void 0,a.acpSessionId&&e.activeTriggers.delete(a.acpSessionId)}))}async handleFrame(e){if(an(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;try{if(e.method.startsWith("_agent/")){let a=this.extensions[e.method];if(!a){i!==null?await this.sendError(i,G.METHOD_NOT_FOUND,`extension not registered: ${e.method}`):W.warn("drop notification: extension not registered",{method:e.method});return}let x=await a(e,this);i!==null&&await this.upstream.send(ft(i,x));return}if(e.method.startsWith("session/")){let a=await this.routeSessionMethod(e);i!==null&&await this.upstream.send(ft(i,a));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,G.METHOD_NOT_FOUND,`method not implemented: ${e.method}`):W.warn("drop unknown notification",{method:e.method})}catch(a){W.error("handleFrame failed",{method:e.method,err:String(a)}),i!==null&&await this.upstream.send(Ye(i,xn(a)))}}async routeSessionMethod(e){if(!e.params||typeof e.params!="object")throw new E("IPC_BAD_REQUEST",`${e.method} requires params`);let i=e.params,a=i._meta?.cozeAgentId;if(!a)throw new E("IPC_BAD_REQUEST",`${e.method}: missing _meta.cozeAgentId`);let x=this.agents.get(a);if(!x)throw this.disconnectedAgents.has(a)?new E("AGENT_DISCONNECTED",`agent ${a} has been disconnected; cloud must _agent/create to revive`):new E("AGENT_NOT_FOUND",`agent not found: ${a}`);if(e.method==="session/cancel")return this.dispatchSessionCall(x,e.method,i);let f=Date.now(),l=!1;try{let h=await x.msgQueue.enqueue(()=>this.dispatchSessionCall(x,e.method,i));return l=!0,h}finally{W.info("session call done",{agentId:x.agentId,method:e.method,durationMs:Date.now()-f,ok:l})}}async dispatchSessionCall(e,i,a){e.lastActiveAt=Date.now();let{stripped:x}=Is(a);switch(i){case"session/new":{let f=ux();return W.info("session/new ack (lazy spawn)",{agentId:e.agentId,cloudId:f}),{sessionId:f}}case"session/load":{let f=x;return W.info("session/load ack (lazy spawn)",{agentId:e.agentId,cloudId:f.sessionId}),{}}case"session/prompt":{let f=x,l=f.sessionId;if(!l)throw new E("IPC_BAD_REQUEST","session/prompt: missing sessionId");let h=await this.ensureRuntime(e,l);if(await this.ensureDownstream(e,l,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 _=await h.downstream.sessionPrompt({...f,sessionId:h.acpSessionId});return h.lastActiveAt=Date.now(),_}finally{e.activeTriggers.delete(h.acpSessionId),h.downstream?.isAlive()&&this.armIdleTimer(e,l,h)}}case"session/cancel":{let l=x.sessionId;if(!l)throw new E("IPC_BAD_REQUEST","session/cancel: missing sessionId");let h=e.sessions.get(l);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 f={modelToken:e.deployType==="cloud"?await this.requestSessionToken(e.agentId,i):"",tokenGeneratedAt:Date.now(),lastActiveAt:Date.now(),loadingSession:!1};return e.sessions.set(i,f),await this.persistSessionMapping(e),f}async requestSessionToken(e,i){let a={sessionId:i,_meta:{cozeAgentId:e}};try{let x=await this.sendRequest(ei.GEN_MODEL_TOKEN,a,fx);if(!x?.modelToken)throw new E("MODEL_TOKEN_GEN_FAILED",`cloud returned empty modelToken (agentId=${e}, cloudSessionId=${i})`);return x.modelToken}catch(x){throw x instanceof E&&x.code==="MODEL_TOKEN_GEN_FAILED"?x:new E("MODEL_TOKEN_GEN_FAILED",x instanceof Error?x.message:String(x),{cause:x})}}async ensureDownstream(e,i,a){if(Pt(a),a.downstream?.isAlive())return;if(!this.sessionSpawner)throw new E("AGENT_SPAWN_FAILED","sessionSpawner not wired (cannot spawn per-session downstream)");let x=await this.sessionSpawner(e,a.modelToken,i);if(a.downstream=x,this.attachRuntimeHooks(e,i,a),a.acpSessionId){a.loadingSession=!0;try{await x.sessionLoad({sessionId:a.acpSessionId,cwd:e.workspace}),W.info("session restored via session/load",{agentId:e.agentId,cloudId:i,acpId:a.acpSessionId})}catch(f){W.warn("session/load failed, fallback to session/new",{agentId:e.agentId,cloudId:i,acpId:a.acpSessionId,err:String(f)}),a.acpSessionId=void 0;let l=await x.sessionNew({cwd:e.workspace});a.acpSessionId=l.sessionId,await this.persistSessionMapping(e)}finally{a.loadingSession=!1}}else{let f=await x.sessionNew({cwd:e.workspace});a.acpSessionId=f.sessionId,await this.persistSessionMapping(e)}}armIdleTimer(e,i,a){Pt(a),a.idleTimer=setTimeout(()=>{W.info("session runtime idle timeout, killing downstream",{agentId:e.agentId,cloudId:i});let x=a.downstream;a.downstream=void 0,a.idleTimer=void 0,a.acpSessionId&&e.activeTriggers.delete(a.acpSessionId),x&&x.stop("idle timeout").catch(f=>W.warn("idle stop failed (ignored)",{agentId:e.agentId,cloudId:i,err:String(f)}))},this.sessionIdleTimeoutMs),a.idleTimer.unref?.()}forwardUpdate(e,i){let a=i.sessionId,x=this.reverseSessionId(e,a);if(!x){W.debug("drop update for unknown session",{agentId:e.agentId,acpId:a});return}let f={cozeAgentId:e.agentId},l=e.activeTriggers.get(a);l&&(f.cozeTriggerMsgId=l),this.upstream.send(sn("session/update",{...i,sessionId:x,_meta:f})).catch(h=>W.warn("forward update failed",{agentId:e.agentId,err:String(h)}))}handleAgentRequest(e,i,a){if(a.method==="session/request_permission"){this.forwardPermissionRequest(e,i,a);return}W.warn("unhandled agent request,returning method_not_found",{agentId:e.agentId,method:a.method}),i.respondAgentRequestError(a.id,{code:G.METHOD_NOT_FOUND,message:`method not handled by Bridge: ${a.method}`})}forwardPermissionRequest(e,i,a){let x=this.upstreamIds.next("session/request_permission"),f=a.params??{},h=f.sessionId,m=h?e.activeTriggers.get(h):void 0,_={cozeAgentId:e.agentId};m&&(_.cozeTriggerMsgId=m);let b=h?this.reverseSessionId(e,h):void 0,w={...f,...b?{sessionId:b}:{},_meta:_};this.pendingUpstream.set(x,{agentRequestId:a.id,agentId:e.agentId,downstream:i,method:a.method}),this.upstream.send(It(x,"session/request_permission",w)).catch(C=>{this.pendingUpstream.delete(x),W.error("forward permission request failed",{agentId:e.agentId,err:String(C)}),i.respondAgentRequestError(a.id,{code:G.INTERNAL_ERROR,message:`upstream send failed: ${String(C)}`})})}handleUpstreamResponse(e){if(e.id===null)return;let i=this.pendingUpstream.get(e.id);if(i){this.pendingUpstream.delete(e.id),e.error?i.downstream.respondAgentRequestError(i.agentRequestId,e.error):i.downstream.respondAgentRequest(i.agentRequestId,e.result);return}let a=this.pendingBridge.get(e.id);if(a){this.pendingBridge.delete(e.id),clearTimeout(a.timer),e.error?a.reject(new on(e.error)):a.resolve(e.result);return}W.debug("orphan upstream response (no pending)",{id:e.id})}sendRequest(e,i,a=cx){let x=this.upstreamIds.next(e);return new Promise((f,l)=>{let h=setTimeout(()=>{this.pendingBridge.delete(x),l(new E("AGENT_TIMEOUT",`${e} timed out after ${a}ms`))},a);this.pendingBridge.set(x,{method:e,resolve:f,reject:l,timer:h}),this.upstream.send(It(x,e,i)).catch(m=>{let _=this.pendingBridge.get(x);_&&(clearTimeout(_.timer),this.pendingBridge.delete(x)),l(m)})})}async persistSessionMapping(e){if(this.paths)try{let i=new Map;for(let[a,x]of e.sessions){let f={modelToken:x.modelToken,tokenGeneratedAt:x.tokenGeneratedAt};x.acpSessionId&&(f.acpSessionId=x.acpSessionId),i.set(a,f)}await lr(e.agentId,i,this.paths)}catch(i){W.warn("persist session mapping failed",{agentId:e.agentId,err:String(i)})}}reverseSessionId(e,i){for(let[a,x]of e.sessions.entries())if(x.acpSessionId===i)return a}sendError(e,i,a){return this.upstream.send(Ye(e,{code:i,message:a}))}};function ux(){return xx(16).toString("hex")}K();oe();import{randomBytes as dx}from"node:crypto";import{chmod as lx,mkdir as hx,writeFile as ti}from"node:fs/promises";import{createServer as gx}from"node:http";import{dirname as px}from"node:path";var mx=1e6,pr=R("ipc"),wn=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??H()}async start(){this.token=dx(32).toString("hex");let e=gx((a,x)=>{this.dispatch(a,x)});this.server=e,await new Promise((a,x)=>{e.once("error",x),e.listen(0,"127.0.0.1",()=>a())});let i=e.address();if(!i||typeof i!="object")throw new Error("failed to obtain IPC port");return this.port=i.port,await this.persistAuthFiles(),pr.info("IPC listening",{port:this.port}),{port:this.port,token:this.token}}async stop(){let e=this.server;e&&(await new Promise((i,a)=>{e.close(x=>x?a(x):i())}),this.server=null)}async persistAuthFiles(){await hx(px(this.paths.portFile),{recursive:!0}),await ti(this.paths.portFile,String(this.port),"utf8"),await ti(this.paths.tokenFile,this.token,{encoding:"utf8",mode:384});try{await lx(this.paths.tokenFile,384)}catch(e){pr.warn("chmod token file failed (non-POSIX?)",{err:String(e)})}}async dispatch(e,i){if(e.headers.authorization!==`Bearer ${this.token}`){Nt(i,401,{error:"unauthorized"});return}let x=`${e.method} ${(e.url??"").split("?")[0]}`,f=this.routes.get(x);if(!f){Nt(i,404,{error:"not found"});return}let l=null;if(e.method==="POST")try{l=await _x(e)}catch(h){Nt(i,400,{error:"invalid json",detail:String(h)});return}try{let h=await f.handler(l,e);Nt(i,200,h??{ok:!0})}catch(h){pr.error("IPC handler failed",{key:x,err:String(h)}),Nt(i,500,{error:h instanceof Error?h.message:String(h)})}}};function Nt(r,e,i){r.statusCode=e,r.setHeader("content-type","application/json"),r.end(JSON.stringify(i))}async function _x(r){let e=[],i=0;for await(let x of r){let f=x;if(i+=f.length,i>mx)throw new Error("body too large");e.push(f)}let a=Buffer.concat(e).toString("utf8");return a?JSON.parse(a):null}var ko=Pe(di(),1);var Qc=Pe(ao(),1),ef=Pe(Rn(),1),tf=Pe(ht(),1),nf=Pe(Ir(),1),rf=Pe(Lr(),1),sf=Pe(Mr(),1),mo=Pe(Mn(),1),of=Pe(po(),1);var wo=mo.default;K();var Un="1008033",_o="1289";var yo="pbbp2",bo="https://www.coze.cn",vo="/api/coze_claw/resource/get_frontier_key",af="https://www.coze.cn",xf="wss://frontier.coze.cn";function So(r){return r??process.env.COZE_BRIDGE_HANDSHAKE_URL??af}function Co(r){return r??process.env.COZE_BRIDGE_FRONTIER_URL??xf}function Fn(r){let e={},i=r?.ttEnv??process.env.COZE_BRIDGE_TT_ENV,a=r?.usePpe??process.env.COZE_BRIDGE_USE_PPE;return i&&(e["x-tt-env"]=i),a&&(e["x-use-ppe"]=a),e}var te=R("upstream.frontier"),Ao="application/json",Do="none",Kn=class{constructor(e){this.opts=e}opts;fws=null;handler=null;connectHandler=null;opened=!1;openCount=0;async start(){if(this.fws){te.warn("start called on already-started FrontierUpstream; noop");return}let e={Authorization:`Bearer ${this.opts.privatecode}`,Origin:bo,...Fn(this.opts.ppeOverride)};class i extends wo{constructor(h){super(h,yo,{headers:e})}send(h,...m){if(Ds("debug"))try{let _;typeof h=="string"?_=Buffer.from(h,"utf8"):h instanceof Buffer?_=h:h instanceof ArrayBuffer?_=new Uint8Array(h):ArrayBuffer.isView(h)?_=new Uint8Array(h.buffer,h.byteOffset,h.byteLength):_=new Uint8Array(0);let b=Buffer.from(_.slice(0,128)).toString("hex");te.debug("WS raw frame out",{bytes:_.byteLength,headHex:b})}catch(_){te.warn("WS raw frame dump failed",{err:String(_)})}super.send(h,...m)}}let a=Co(this.opts.urlOverride),x={url:a,ws:i,fpID:_o,aID:Un,accessKey:this.opts.handshake.accessKey,deviceID:this.opts.handshake.deviceId,payloadType:{type:Ao,force:!0},payloadEncoding:{encoding:Do,force:!0},enableTransformTextPayload:!0,enableQoS:!1,enableAutoAck:!1,automaticOpen:!1,debug:this.opts.debug??!1},f=new ko.FWS(x);f.onopen=()=>{this.opened=!0,this.openCount+=1;let l=this.openCount===1;te.info("frontier opened",{url:a,remoteDeviceId:this.opts.handshake.deviceId,initial:l,openCount:this.openCount}),this.connectHandler&&Promise.resolve(this.connectHandler({initial:l})).catch(h=>te.warn("onConnect handler threw (ignored)",{err:String(h)}))},f.onclose=l=>{this.opened=!1,te.info("frontier closed",{code:l.code,reason:l.reason,willReconnect:l.willReconnect})},f.onerror=l=>{te.warn("frontier error",{code:l.code,msg:l.message})},f.onmessage=l=>this.handleMessage(l),this.fws=f,await f.connect()}async stop(e){let i=this.fws;if(i){this.fws=null,this.opened=!1;try{i.close(1e3,e??"bridge shutdown")}catch(a){te.warn("frontier close threw (ignored)",{err:String(a)})}}}async send(e){let i=this.fws;if(!i)throw new E("UPSTREAM_DISCONNECTED","frontier upstream not started");let a=JSON.stringify(e),x=e;te.info("frontier frame out",{method:x.method,jsonrpcId:x.id,size:a.length});try{await i.send(a,{service:33555712,method:1,payloadType:Ao,payloadEncoding:Do})}catch(f){throw new E("UPSTREAM_DISCONNECTED",`frontier send failed: ${String(f)}`,{cause:f})}}onFrame(e){this.handler=e}onConnect(e){this.connectHandler=e}isConnected(){return this.opened&&this.fws?.readyState===1}handleMessage(e){let i=e.message?.service;if(i!==33555712){te.debug("drop non-adapter frontier frame",{service:i});return}let a=uf(e);if(!a){te.debug("frontier message without text payload, drop",{payloadType:e.message?.payloadType});return}if(!this.handler){te.debug("frame received but no onFrame handler",{size:a.length});return}let x;try{x=JSON.parse(a)}catch(f){te.warn("frontier message JSON parse failed",{err:String(f),head:a.slice(0,80)});return}te.info("frontier frame in",{logid:ff(e.message?.LogID),logidNew:e.message?.LogIDNew,msgId:e.message?.msgID,jsonrpcId:x.id}),Promise.resolve(this.handler(x)).catch(f=>te.warn("frontier frame handler threw",{err:String(f)}))}};function ff(r){return r?r.high===0?String(r.low>>>0):`${r.high.toString(16)}${(r.low>>>0).toString(16).padStart(8,"0")}`:""}function uf(r){let e=r.message;if(e?.textPayload)return e.textPayload;let i=e?.payload;if(!i)return null;try{return Buffer.from(i).toString("utf8")}catch{return null}}K();function Po(r){return r?r.startsWith("boe_")?{ttEnv:r}:{ttEnv:r,usePpe:"1"}:{}}var Io=R("handshake");async function To(r){let e=So(r.endpoint),i=r.timeoutMs??1e4,a=`${df(e)}${vo}?aid=${encodeURIComponent(Un)}`,x={Authorization:`Bearer ${r.privatecode}`,Accept:"application/json",...Fn(r.ppeOverride)},f=new AbortController,l=setTimeout(()=>f.abort(),i);Io.info("frontier key handshake",{base:e});try{let h=await fetch(a,{method:"GET",headers:x,signal:f.signal}),m=h.headers.get("x-tt-logid")??"",_=h.headers.get("x-tt-trace-id")??"";if(!h.ok){let k=await h.text().catch(()=>"");throw new E("UPSTREAM_HANDSHAKE_FAILED",`handshake HTTP ${h.status} logid=${m}: ${k.slice(0,200)}`)}let b=await h.json();if(b.code!==void 0&&b.code!==0)throw new E("UPSTREAM_HANDSHAKE_FAILED",`handshake code=${b.code} msg=${b.msg??"-"} logid=${m}`);let w=b.data?.access_key,C=b.data?.device_id;if(!w||!C)throw new E("UPSTREAM_HANDSHAKE_FAILED",`handshake response missing access_key/device_id logid=${m}: ${JSON.stringify(b)}`);return Io.info("handshake ok",{remoteDeviceId:C,logid:m,traceId:_}),{accessKey:w,deviceId:C}}catch(h){throw h instanceof E?h:h.name==="AbortError"?new E("UPSTREAM_HANDSHAKE_FAILED",`handshake timeout (${i}ms)`):new E("UPSTREAM_HANDSHAKE_FAILED",String(h),{cause:h})}finally{clearTimeout(l)}}function df(r){return r.endsWith("/")?r.slice(0,-1):r}K();var Ur=R("upstream.switchable"),Hn=class{inner;handler=null;connectHandler=null;constructor(e){this.inner=e}async swap(e,i){if(this.inner===e)return;Ur.info("swap upstream",{reason:i});let a=this.inner;this.inner=e,this.handler&&e.onFrame(this.handler),this.connectHandler&&e.onConnect&&e.onConnect(this.connectHandler);try{await e.start()}catch(x){throw Ur.error("swap target start failed, reverting",{err:String(x)}),this.inner=a,x}await a.stop(i??"swapped").catch(x=>Ur.warn("previous upstream stop threw (ignored)",{err:String(x)}))}current(){return this.inner}start(){return this.inner.start()}stop(e){return this.inner.stop(e)}send(e){return this.inner.send(e)}onFrame(e){this.handler=e,this.inner.onFrame(e)}onConnect(e){this.connectHandler=e,this.inner.onConnect?.(e)}isConnected(){return this.inner.isConnected()}};K();var Fr=R("upstream"),Kt=class{handler=null;async start(){Fr.info("NoopUpstream started (M1 skeleton; real Frontier wired in M4)")}async stop(e){Fr.info("NoopUpstream stopped",{reason:e})}async send(e){Fr.debug("NoopUpstream.send (dropped)",{method:"method"in e?e.method:void 0})}onFrame(e){this.handler=e}isConnected(){return!1}async injectFrame(e){this.handler&&await this.handler(e)}};K();oe();K();oe();import{execSync as lf}from"node:child_process";import{readFileSync as Lo,unlinkSync as hf}from"node:fs";import{mkdir as gf,readFile as No,unlink as Ro,writeFile as pf}from"node:fs/promises";import{dirname as mf}from"node:path";var wf=R("single-instance"),jn=class{pidFile;acquired=!1;constructor(e={}){this.pidFile=e.pidFile??H().pidFile,e.processTitle&&(process.title=e.processTitle)}async acquire(){let e=await this.readExistingPid();return e!==null&&this.isAlive(e)?{kind:"already-running",pid:e}:(e!==null&&(wf.warn("removing stale pid file",{stalePid:e}),await Ro(this.pidFile).catch(()=>{})),await gf(mf(this.pidFile),{recursive:!0}),await pf(this.pidFile,String(process.pid),"utf8"),this.acquired=!0,this.installCleanupHooks(),{kind:"acquired"})}async release(){if(this.acquired){try{(await No(this.pidFile,"utf8")).trim()===String(process.pid)&&await Ro(this.pidFile)}catch{}this.acquired=!1}}async readExistingPid(){try{let e=await No(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=Lo(`/proc/${e}/cmdline`,"utf8").replace(/\0/g," ");return!!(i.includes("coze-bridge-daemon")||i.includes("lib/index.js"))}catch{}try{let i=lf(`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{Lo(this.pidFile,"utf8").trim()===String(process.pid)&&hf(this.pidFile)}catch{}})}};var z=R("daemon"),_f="coze-bridge-daemon";async function zo(){let r=new jn({processTitle:_f}),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??{};dr({pid:process.pid}),z.info(i?"loaded bridge config":"initialized bridge config");try{let I=new Tt;a.frameworksCache=await I.detectAll(),z.info("refreshed frameworks_cache",{detected:Object.keys(a.frameworksCache)})}catch(I){z.warn("framework detection failed",{err:String(I)})}await Lt(a);let x=new Hn(new Kt),f=H(),l=null,h=new mn({upstream:x,paths:f,bridgeConfig:a,sessionSpawner:async(I,M,Y)=>{if(!l)throw new Error("agentManager not ready");return l.spawnSessionDownstream(I,M,Y)}});await bf(f,h);let m=new gn({paths:f,config:a,registry:h});l=m;let _,b,w=null,C=null;h.registerExtension("_agent/create",async I=>m.createAgent(I.params)),h.registerExtension("_agent/health",async()=>({ok:!0}));let k=new tn({agents:h.agents,disposeAndMarkDisconnected:async(I,M)=>{let Y=h.agents.get(I);Y&&(await Y.dispose(`disconnect: ${M}`).catch(me=>z.warn("dispose during disconnect failed (ignored)",{agentId:I,err:String(me)})),Y.status="disconnected",h.unregister(I)),h.disconnectedAgents.add(I)}});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));let T=new $t({paths:f,handlers:k,sendDetail:I=>h.sendRequest("_agent/detail",I)});x.onConnect(({initial:I})=>{z.info("frontier upstream connected, triggering detail sync",{initial:I}),T.syncAll(I?"initial-connect":"reconnect").catch(M=>z.warn("detail sync top-level error (ignored)",{err:String(M)}))});let L=new wn({paths:f,routes:[{method:"GET",path:"/status",handler:async()=>({running:!0,pid:process.pid,agents:[...h.agents.keys()],deviceId:w??"",frameworksCache:a.frameworksCache??{}})},{method:"POST",path:"/pair",handler:async I=>{let M=I,Y=M?.privatecode,me=M?.pairing_code;if(!Y||!me)throw new E("IPC_BAD_REQUEST","/pair requires privatecode + pairing_code");let De=Po(M.env),we=M.handshake_url,le=M.frontier_url,We=yf(M.env,we,le),Ht=!!_&&_!==Y,jt=b!==void 0&&b!==We,_e=Ht||jt;if(_e){z.warn("pair config switched, resetting agents",{pcChanged:Ht,envChanged:jt,previousPc:_?Oo(_):"",nextPc:Oo(Y),previousEnvKey:b??"",nextEnvKey:We});for(let be of[...h.agents.values()])await be.dispose("pair config switch").catch(()=>{}),h.agents.delete(be.agentId);await x.swap(new Kt,"pair switch").catch(()=>{})}let ye=await To({privatecode:Y,...we?{endpoint:we}:{},ppeOverride:De});w=ye.deviceId,dr({deviceId:w,pid:process.pid});let $n=new Kn({handshake:ye,privatecode:Y,...le?{urlOverride:le}:{},ppeOverride:De});await x.swap($n,"pair");let re=Object.keys(a.frameworksCache??{});try{let be=await h.sendRequest("_agent/pair",{pairCode:me,patToken:Y,frameworks:re,_meta:{cozeDeviceId:w}});z.info("_agent/pair ok",{pairResult:be}),_=Y,b=We,C||(C=new rn({core:h,getDeviceId:()=>w??""})),C.start(),_e&&Bo(f,m).catch(q=>z.warn("post-pair-switch auto-revive error (ignored)",{err:String(q)}));let X;return M.agent_id&&(X=await vf(M.agent_id,f,m,q=>h.sendRequest("_agent/detail",q)).catch(q=>(z.error("--agent-id ensureAgent failed",{agentId:M.agent_id,err:String(q)}),{ok:!1,agentId:M.agent_id??"",note:String(q)}))),{ok:!0,note:"paired with cloud",...X?{agent:X}:{}}}catch(be){return z.error("_agent/pair failed",{err:String(be)}),{ok:!1,note:`pair failed: ${String(be)}`}}}},{method:"POST",path:"/_agent/create",handler:async I=>{let M=I;return{ok:!0,result:await m.createAgent(M)}}},{method:"POST",path:"/refresh",handler:async()=>{z.info("IPC /refresh: re-detecting frameworks");let I=new Tt;return a.frameworksCache=await I.detectAll(),await Lt(a),{ok:!0,frameworks:a.frameworksCache}}},{method:"POST",path:"/shutdown",handler:async()=>(z.info("IPC /shutdown received"),setImmediate(()=>{Ae.shutdown("ipc /shutdown")}),{ok:!0})}]}),{port:F,token:Q}=await L.start();await h.start(),Bo(f,m).catch(I=>z.warn("auto-revive top-level error (ignored)",{err:String(I)}));let ne=null,Ae={port:F,token:Q,core:h,ipc:L,shutdown(I){return ne||(z.info("daemon shutdown",{reason:I}),ne=(async()=>{C?.stop(),await h.stop(I),await L.stop(),await r.release()})(),ne)}};for(let I of["SIGTERM","SIGINT"])process.on(I,()=>{Ae.shutdown(I).then(()=>process.exit(0))});return z.info("daemon ready",{port:F,pid:process.pid,nodeVersion:process.version,platform:process.platform,frameworks:Object.keys(a.frameworksCache??{}),libVersion:a.libVersion??"dev"}),Ae}function Oo(r){return r.length<=8?"***":`${r.slice(0,4)}***${r.slice(-4)}`}function yf(r,e,i){return`${r??""}|${e??""}|${i??""}`}async function bf(r,e){let{readdir:i}=await import("node:fs/promises"),a;try{a=await i(r.agentsRoot)}catch{return}let{loadAgentConfig:x,enforceAgentConfigMode:f}=await Promise.resolve().then(()=>(Ue(),Zt));for(let l of a){await f(l,r).catch(h=>z.warn("enforceAgentConfigMode failed (ignored)",{agentId:l,err:String(h)}));try{let h=await x(l,r);h?.disconnectedAt&&(e.disconnectedAgents.add(l),z.info("agent marked disconnected on startup",{agentId:l,disconnectedAt:h.disconnectedAt,reason:h.disconnectReason??""}))}catch(h){z.warn("failed to load agent config on startup, skipping",{agentId:l,err:String(h)})}}}async function vf(r,e,i,a){let{loadAgentConfig:x}=await Promise.resolve().then(()=>(Ue(),Zt)),f=await x(r,e);if(f){z.info("--agent-id: local config found, reconnecting",{agentId:r,framework:f.framework,hadDisconnect:!!f.disconnectedAt});let _={agentId:f.agentId,framework:f.framework,...f.cozeIdentity?{cozeIdentity:f.cozeIdentity}:{},...f.model?{model:f.model}:{}};return await i.createAgent(_),{ok:!0,agentId:r,note:f.disconnectedAt?"revived from local config":"connected from local config"}}z.info("--agent-id: local config missing, pulling _agent/detail from cloud",{agentId:r});let l=await a({_meta:{cozeAgentId:r}});if(!l.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:l.agentId,framework:l.framework,...l.cozeIdentity?{cozeIdentity:l.cozeIdentity}:{},...l.model?{model:l.model}:{},...l.deployType?{_meta:{cozeDeployType:l.deployType}}:{}};await i.createAgent(h);let m=l.deployType==="cloud"&&l.framework==="openclaw";return{ok:!0,agentId:r,note:m?"cloud agent acknowledged":"created from cloud detail"}}async function Bo(r,e){let{readdir:i}=await import("node:fs/promises"),a;try{a=await i(r.agentsRoot)}catch{return{revived:0,skipped:0,total:0}}if(a.length===0)return{revived:0,skipped:0,total:0};let{loadAgentConfig:x}=await Promise.resolve().then(()=>(Ue(),Zt));z.info("auto-revive: scanning local agents on startup",{count:a.length});let f=0,l=0;for(let h of a){let m;try{m=await x(h,r)}catch(_){z.warn("auto-revive: load config failed (skipping)",{agentId:h,err:String(_)}),l+=1;continue}if(!m){l+=1;continue}if(m.disconnectedAt){z.info("auto-revive: skip disconnected agent",{agentId:h,disconnectedAt:m.disconnectedAt}),l+=1;continue}try{z.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(_){z.warn("auto-revive: createAgent failed (skipping)",{agentId:h,framework:m.framework,err:String(_)}),l+=1}}return z.info("auto-revive: done",{revived:f,skipped:l,total:a.length}),{revived:f,skipped:l,total:a.length}}Hr();oe();import{readFile as qo}from"node:fs/promises";var Ge=class{paths;constructor(e){this.paths=e??H()}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:Tf(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([qo(this.paths.portFile,"utf8"),qo(this.paths.tokenFile,"utf8")]),a=Number.parseInt(e.trim(),10),x=i.trim();return!Number.isFinite(a)||a<=0||!x?null:{port:a,token:x}}catch(e){if(e.code==="ENOENT")return null;throw e}}async fetch(e,i){let a=i.body!==void 0,x={Authorization:`Bearer ${e.token}`};a&&(x["content-type"]="application/json");let f=new AbortController,l=setTimeout(()=>f.abort(),i.timeoutMs??5e3);try{let h=await fetch(`http://127.0.0.1:${e.port}${i.path}`,{method:i.method,headers:x,body:a?JSON.stringify(i.body):void 0,signal:f.signal}),m=await h.text();return{status:h.status,body:Pf(m)}}finally{clearTimeout(l)}}};function Pf(r){if(!r)return null;try{return JSON.parse(r)}catch{return r}}function Tf(r){return r instanceof Error?r.message:String(r)}K();oe();import{copyFile as Uo,mkdir as Lf,readFile as jr,writeFile as Nf}from"node:fs/promises";import{dirname as Rf,resolve as Gr,sep as Gn}from"node:path";import{fileURLToPath as Of}from"node:url";K();oe();var Fo=R("dist-install");function Bf(r){let e=Of(r),i=Rf(e),a=`${Gn}src${Gn}`;if(i.includes(a)||i.endsWith(`${Gn}src${Gn}cli`))return null;let x=Gr(i,"index.js"),f=Gr(i,"..","package.json");return{dist:x,pkgJson:f}}async function Ko(r={}){let e=r.paths??H(),i=Bf(import.meta.url),a=r.sourceDist??i?.dist,x=r.sourcePackageJson??i?.pkgJson;if(!a||!x)return{kind:"dev-mode-skip",reason:"running from src/(tsx loader);no dist/ to install"};let f;try{f=JSON.parse(await jr(x,"utf8")).version??"unknown"}catch(w){return Fo.warn("cannot read source package.json,skip dist install",{err:String(w)}),{kind:"dev-mode-skip",reason:`package.json read failed: ${String(w)}`}}let l=await pn(e.configFile)??{},h=l.libVersion;if(h===f)try{return await jr(e.libEntry),{kind:"already-current",libVersion:f}}catch{}await Lf(e.libDir,{recursive:!0}),await Uo(a,e.libEntry),await Uo(`${a}.map`,`${e.libEntry}.map`).catch(()=>{});let m=Gr(e.libDir,"package.json"),_=`${JSON.stringify({type:"module"},null,2)}
92
- `;return await jr(m,"utf8").catch(()=>null)!==_&&await Nf(m,_),l.libVersion=f,await Lt(l,e.configFile),Fo.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 tu=R("cli");function yt(r,e){let i=[],a;for(let x=0;x<r.length;x++){let f=r[x];if(f===e){a=r[x+1],x+=1;continue}if(f.startsWith(`${e}=`)){a=f.slice(e.length+1);continue}i.push(f)}return{value:a,rest:i}}function nu(r){let e=r.slice(2);if(e.includes("--daemon"))return{mode:"daemon"};if(e.includes("--status"))return{mode:"status"};if(e.includes("--stop"))return{mode:"stop"};if(e.includes("--refresh"))return{mode:"refresh"};if(e.includes("--uninstall"))return{mode:"uninstall"};if(e.includes("--install-service"))return{mode:"install-service"};if(e.includes("--help")||e.includes("-h")||e.length===0)return{mode:"help"};let i=e,{value:a,rest:x}=yt(i,"--pat-token");i=x;let{value:f,rest:l}=yt(i,"--pair-code");i=l;let{value:h,rest:m}=yt(i,"--env");i=m;let{value:_,rest:b}=yt(i,"--handshake-url");i=b;let{value:w,rest:C}=yt(i,"--frontier-url");i=C;let{value:k}=yt(i,"--agent-id");if(!a||!f)return{mode:"help"};let T={mode:"pair",privatecode:a,pairingCode:f};return h&&(T.env=h),_&&(T.handshakeUrl=_),w&&(T.frontierUrl=w),k&&(T.agentId=k),T}var ru=`
88
+ ${x}`}var ve=N("agent-detail-sync"),$t=class{constructor(e){this.opts=e}opts;async syncAll(e){let i=this.opts.paths.agentsRoot,a;try{a=await c0(i)}catch(x){ve.info("agents dir not found, skip detail sync",{root:i,err:String(x)});return}ve.info("starting detail sync",{reason:e,count:a.length});for(let x of a)try{await this.syncOne(x)}catch(u){ve.warn("detail sync failed for agent, skipping",{agentId:x,err:String(u)})}ve.info("detail sync done",{reason:e})}async syncOne(e){let i=await ce(e,this.opts.paths);if(!i){ve.info("detail sync: agent config missing, skip",{agentId:e});return}let a;try{a=await this.opts.sendDetail({_meta:{cozeAgentId:e}})}catch(d){ve.warn("detail RPC failed, using local data",{agentId:e,err:String(d)});return}if(a.agentId&&a.agentId!==e){ve.warn("detail response agentId mismatch, ignoring",{agentId:e,responseAgentId:a.agentId});return}let x=!1,u=!1;if(a.agentName&&a.agentName!==i.agentName&&(i.agentName=a.agentName,x=!0),a.description!==void 0&&a.description!==i.description&&(i.description=a.description,x=!0),a.cozeIdentity&&a.cozeIdentity!==i.cozeIdentity&&(i.cozeIdentity=a.cozeIdentity,x=!0,u=!0),a.deployType&&ve.info("detail.deployType",{agentId:e,deployType:a.deployType}),!x){ve.debug("detail sync: no diff",{agentId:e});return}await me(i,this.opts.paths),ve.info("detail sync: config updated",{agentId:e,identityChanged:u,agentName:i.agentName}),u&&(await ot(i.workspace,i.framework,e,i.cozeIdentity),await this.opts.handlers.reloadAgentSessionsPublic(e,"detail-sync"))}};Ue();import{spawn as Bs}from"node:child_process";import{lstat as dr,mkdir as x0,readFile as Ms,readdir as u0,rm as f0,stat as d0,writeFile as l0}from"node:fs/promises";import{join as Re,normalize as h0,relative as zs,resolve as g0,sep as Fs}from"node:path";var Se={PAIR:"_agent/pair",CREATE:"_agent/create",HEALTH:"_agent/health",LIST_SKILLS:"_agent/listSkills",ADD_SKILLS:"_agent/addSkills",REMOVE_SKILLS:"_agent/removeSkills",GET_FILE_TREE:"_agent/getFileTree",GET_FILE_CONTENT:"_agent/getFileContent",DETAIL:"_agent/detail",UPDATE:"_agent/update",DISCONNECT:"_agent/disconnect",SWITCH_MODEL:"_agent/switchModel",GEN_MODEL_TOKEN:"_agent/genModelToken",RESET:"_agent/reset",REPAIR:"_agent/repair",DELETE:"_agent/delete"};function Et(r){return r?.cozeDeployType==="cloud"?"cloud":"local"}function Ps(r){let{_meta:e,...i}=r;return{stripped:i,meta:e}}function at(r){if(!r?.cozeAgentId)throw new Error("missing _meta.cozeAgentId");return r.cozeAgentId}var E=class extends Error{code;retriable;cause;constructor(e,i,a){super(i),this.name="BridgeError",this.code=e,this.retriable=a?.retriable??!1,a?.cause!==void 0&&(this.cause=a.cause)}};K();ae();function Le(r,e){if(Et(r)!=="cloud")throw new E("OPERATION_NOT_ALLOWED_FOR_LOCAL",`${e} is not allowed for local agent`)}function Qt(r){return r.replace(/[^A-Za-z0-9._-]+/g,"-")}var Is="https://llm-gateway.coze.cn",ct="auto";function Ds(r){return{model:r.model??ct,...r.modelToken?{modelToken:r.modelToken}:{}}}function Ts(r){return!r||r===ct}function Ls(r){let e={};return r.modelToken&&(e.ANTHROPIC_BASE_URL=Is,e.ANTHROPIC_AUTH_TOKEN=r.modelToken),Ts(r.model)||(e.ANTHROPIC_MODEL=r.model),e}function Rs(r){let e=[];return Ts(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="${Is}/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 Ns(r){return r.modelToken?{OPENAI_API_KEY:r.modelToken}:{}}var ie=N("agent-handlers"),Os=5*1024*1024,p0=1,m0=6,w0=new Set(["node_modules",".git",".coze","dist","build",".next"]),Zt=class{constructor(e){this.opts=e}opts;async listSkills(e){Le(e._meta,"_agent/listSkills");let i=at(e._meta),a=await this.loadAgentCfg(i),x=a?.workspace??Te(i).workspace,u=a?.skills??[],d=[];for(let h of u){let m=Re(x,h.relPath,"SKILL.md");await d0(m).then(b=>b.isFile()).catch(()=>!1)&&d.push({skillId:h.skillId,skillName:h.skillName,downloadUrl:h.downloadUrl??"",...h.description?{description:h.description}:{},...h.version?{version:h.version}:{}})}return{skills:d}}async addSkills(e){Le(e._meta,"_agent/addSkills");let i=at(e._meta),a=await this.requireAgentCfg(i),x=e.skills??[],u=[...a.skills??[]],d=new Map(u.map((m,w)=>[m.skillId,w])),h=[];for(let m of x){if(!m.skillName)throw new E("IPC_BAD_REQUEST","skill missing skillName");let w=_0(m.skillName),b=y0(a.framework),_=Re(b,w),C=Re(a.workspace,_);await x0(C,{recursive:!0});let L=await S0(m.downloadUrl);C0(L)?await A0(L,C):await l0(Re(C,"SKILL.md"),L.toString("utf8"),"utf8");let I={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}:{}},R=d.get(m.skillId);R!==void 0?u[R]=I:(d.set(m.skillId,u.length),u.push(I)),h.push(m),ie.info("skill installed",{agentId:i,skillId:m.skillId,skillName:m.skillName,relPath:_})}return await Vt(i,u),await this.reloadAgentSessions(i,"skills-added"),{installedSkills:h}}async removeSkills(e){Le(e._meta,"_agent/removeSkills");let i=at(e._meta),a=await this.requireAgentCfg(i),x=new Set(e.skillIds??[]),u=a.skills??[],d=[];for(let h of u){if(!x.has(h.skillId)){d.push(h);continue}let m=Re(a.workspace,h.relPath);await f0(m,{recursive:!0,force:!0}),ie.info("skill removed",{agentId:i,skillId:h.skillId,relPath:h.relPath})}return await Vt(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[x,u]of a.sessions)if(!(!u.downstream||!u.acpSessionId)){u.loadingSession=!0;try{await u.downstream.sessionLoad({sessionId:u.acpSessionId,cwd:a.workspace}),ie.info("session reloaded",{reason:i,agentId:e,framework:a.framework,cloudId:x,acpId:u.acpSessionId})}catch(d){ie.warn("session reload failed",{reason:i,agentId:e,framework:a.framework,cloudId:x,acpId:u.acpSessionId,err:String(d)})}finally{u.loadingSession=!1}}}}async updateAgent(e){if(!e.cozeIdentity?.trim())return ie.info("_agent/update: empty cozeIdentity, noop",{agentId:e.agentId}),{ok:!0};let i=e.agentId,a=await ce(i);if(!a)throw new E("AGENT_NOT_FOUND",`agent not found: ${i}`);return a.cozeIdentity===e.cozeIdentity?(ie.info("_agent/update: cozeIdentity unchanged, noop",{agentId:i}),{ok:!0}):(a.cozeIdentity=e.cozeIdentity,await me(a),await ot(a.workspace,a.framework,i,e.cozeIdentity),ie.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 ce(i);return a?(a.disconnectedAt=Date.now(),a.disconnectReason=e.reason??"",await me(a),ie.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}):(ie.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:ct,a=await ce(e.agentId);if(!a)throw new E("AGENT_NOT_FOUND",`agent not found: ${e.agentId}`);a.model=i,await me(a),ie.info("_agent/switchModel: model persisted",{agentId:e.agentId,model:i,reason:e.reason??""});let x=this.opts.agents.get(e.agentId);return x?(await x.msgQueue.enqueue(async()=>{x.model=i,await x.killAllRuntimes(`switchModel: ${i}`)}),ie.info("_agent/switchModel: all session runtimes killed, next prompt will respawn",{agentId:e.agentId,model:i}),{ok:!0}):(ie.info("_agent/switchModel: agent not running, config persisted only",{agentId:e.agentId}),{ok:!0})}async resetAgent(e){if(Le(e._meta,Se.RESET),!e.agentId)throw new E("IPC_BAD_REQUEST",`${Se.RESET}: missing agentId`);return await this.runDetailSync(e.agentId,Se.RESET,e.reason),{ok:!0}}async repairAgent(e){if(Le(e._meta,Se.REPAIR),!e.agentId)throw new E("IPC_BAD_REQUEST",`${Se.REPAIR}: missing agentId`);let i=await this.loadAgentCfg(e.agentId);if(i&&i.framework!=="openclaw")throw new E("IPC_BAD_REQUEST",`${Se.REPAIR} only allowed for openclaw, got ${i.framework}`);return await this.runDetailSync(e.agentId,Se.REPAIR,e.reason),{ok:!0}}async runDetailSync(e,i,a){if(!this.opts.detailSyncer){ie.warn("detailSyncer not wired, skipping sync",{method:i,agentId:e});return}try{await this.opts.detailSyncer(e)}catch(x){ie.warn("detail sync failed (ignored)",{method:i,agentId:e,reason:a,err:String(x)})}}async getFileTree(e){Le(e._meta,"_agent/getFileTree");let i=e._meta,a=at(i),x=await this.resolveWorkspace(a),u=e.filePath??"",d=this.safeJoin(x,u),h=await dr(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=P0(e.depth);return h.isDirectory()?{tree:await qs(x,d,u,m)}:{tree:[{name:I0(u),path:Us(u||"."),isDir:!1,size:h.size,modifiedAt:Math.floor(h.mtimeMs)}]}}async getFileContent(e){Le(e._meta,"_agent/getFileContent");let i=at(e._meta),a=await this.resolveWorkspace(i);if(!e.filePath)throw new E("IPC_BAD_REQUEST","filePath required");let x=this.safeJoin(a,e.filePath),u=await dr(x).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>Os)throw new E("IPC_BAD_REQUEST",`file too large: ${u.size} bytes (max ${Os})`);let d=await Ms(x);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 ce(e).catch(()=>null))?.workspace??Te(e).workspace}safeJoin(e,i){let a=g0(e,i||"."),x=zs(e,a);if(x.startsWith("..")||x===".."||x.startsWith(`..${Fs}`))throw new E("IPC_BAD_REQUEST",`path escapes workspace: ${i}`);return a}loadAgentCfg(e){return ce(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 _0(r){let e=Qt(r.trim()).replace(/^-+|-+$/g,"").slice(0,64);if(!e||e==="."||e==="..")throw new E("IPC_BAD_REQUEST",`invalid skill name: ${r}`);return e}function y0(r){return r==="claude-code"?Re(".claude","skills"):Re(".agents","skills")}var b0=3e4,v0=50*1024*1024,en=3e4;async function S0(r){if(!r)throw new E("IPC_BAD_REQUEST","skill missing downloadUrl");if(r.startsWith("data:")){let e=Math.floor(r.length*3/4);Xt(e);let i=E0(r);return Xt(i.length),i}if(r.startsWith("file:")){let e=new URL(r).pathname,i=await Ms(e);return Xt(i.length),i}if(r.startsWith("http://")||r.startsWith("https://")){let e=new AbortController,i=setTimeout(()=>e.abort(),b0);try{let a=await fetch(r,{signal:e.signal});if(!a.ok)throw new E("IPC_BAD_REQUEST",`fetch skill failed HTTP ${a.status} ${r}`);let x=await a.arrayBuffer();return Xt(x.byteLength),Buffer.from(x)}finally{clearTimeout(i)}}throw new E("IPC_BAD_REQUEST",`unsupported downloadUrl scheme (\u8981 https/data/file): ${r.slice(0,80)}`)}function Xt(r){if(r>v0)throw new E("IPC_BAD_REQUEST",`skill too large: ${r} bytes`)}function E0(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 C0(r){return r.length>=2&&r[0]===31&&r[1]===139}async function A0(r,e){await k0(r),await new Promise((i,a)=>{let x=Bs("tar",["-xzf","-","-C",e,"--strip-components=1","--no-same-owner"],{stdio:["pipe","pipe","pipe"]}),u="";x.stderr?.on("data",h=>{u+=String(h)});let d=setTimeout(()=>{x.kill("SIGKILL"),a(new E("IPC_BAD_REQUEST",`tar extract timeout (${en}ms)`))},en);x.on("error",h=>{clearTimeout(d),a(new E("IPC_BAD_REQUEST",`tar spawn failed: ${h.message}`,{cause:h}))}),x.on("exit",h=>{clearTimeout(d),h===0?i():a(new E("IPC_BAD_REQUEST",`tar exit ${h}${u?`: ${u.trim().slice(0,200)}`:""}`))}),x.stdin?.end(r)})}async function k0(r){let e=await new Promise((i,a)=>{let x=Bs("tar",["-tzvf","-"],{stdio:["pipe","pipe","pipe"]}),u="",d="";x.stdout?.on("data",m=>{u+=String(m)}),x.stderr?.on("data",m=>{d+=String(m)});let h=setTimeout(()=>{x.kill("SIGKILL"),a(new E("IPC_BAD_REQUEST",`tar list timeout (${en}ms)`))},en);x.on("error",m=>{clearTimeout(h),a(new E("IPC_BAD_REQUEST",`tar list spawn failed: ${m.message}`))}),x.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)}`:""}`))}),x.stdin?.end(r)});for(let i of e.split(`
89
+ `)){let a=i.trim();if(!a)continue;let x=a.charCodeAt(0);if(x!==45&&x!==100)throw new E("IPC_BAD_REQUEST",`tar entry kind '${a[0]}' not allowed (symlink/hardlink/special): ${a.slice(0,100)}`);let d=(a.match(/\s(\S.*)$/)?.[1]??"").split(" -> ")[0]?.trim()??"";if(!d)continue;if(d.startsWith("/"))throw new E("IPC_BAD_REQUEST",`tar entry absolute path: ${d}`);if(d.split(/[/\\]/).some(m=>m===".."))throw new E("IPC_BAD_REQUEST",`tar entry contains '..': ${d}`)}}async function qs(r,e,i,a){if(a<=0)return[];let x;try{x=await u0(e,{withFileTypes:!0})}catch{return[]}let u=[];for(let d of x){if(w0.has(d.name)||d.isSymbolicLink())continue;let h=Re(e,d.name),m=h0(Re(i,d.name)),w=null;try{w=await dr(h)}catch{continue}if(w.isSymbolicLink())continue;let b={name:d.name,path:Us(zs(r,h)),isDir:w.isDirectory(),size:w.size,modifiedAt:Math.floor(w.mtimeMs)};w.isDirectory()&&a>1&&(b.children=await qs(r,h,m,a-1)),u.push(b)}return u.sort((d,h)=>d.isDir!==h.isDir?d.isDir?-1:1:d.name.localeCompare(h.name)),u}function P0(r){return!r||r<=0?p0:Math.min(r,m0)}function I0(r){if(!r||r==="."||r==="/")return".";let e=r.split(/[/\\]/);return e[e.length-1]||"."}function Us(r){return r.split(Fs).join("/")}K();var Ct=N("agent-health-reporter"),D0=1e4,tn=class{constructor(e){this.opts=e;this.intervalMs=e.intervalMs??D0}opts;timer=null;inFlight=!1;unsubscribeRegister=null;intervalMs;start(){this.timer||(this.timer=setInterval(()=>{this.tick()},this.intervalMs),this.timer.unref?.(),this.unsubscribeRegister=this.opts.core.onAgentRegister(()=>{this.tick()}),Ct.info("heartbeat started",{intervalMs:this.intervalMs}),this.tick())}stop(){this.timer&&(clearInterval(this.timer),this.timer=null,this.unsubscribeRegister&&(this.unsubscribeRegister(),this.unsubscribeRegister=null),Ct.info("heartbeat stopped"))}async tick(){if(this.inFlight){Ct.debug("previous tick still in-flight, skip");return}let e=this.opts.getDeviceId();if(!e){Ct.debug("deviceId not available, skip tick (\u5C1A\u672A pair)");return}this.inFlight=!0;try{let i=[];for(let x of this.opts.core.agents.values()){let u=T0(x);u&&i.push({agentId:x.agentId,status:u})}if(i.length===0)return;let a={agents:i,_meta:{cozeDeviceId:e}};try{await this.opts.core.sendRequest("_agent/health",a)}catch(x){Ct.warn("heartbeat batch send failed",{count:i.length,err:String(x)})}}finally{this.inFlight=!1}}};function T0(r){return r.status==="error"?"error":r.activeTriggers.size>0?"busy":r.status==="ok"?"online":null}Ue();import{mkdir as lr,rm as j0}from"node:fs/promises";import{spawn as B0}from"node:child_process";function At(r,e,i){return i===void 0?{jsonrpc:"2.0",id:r,method:e}:{jsonrpc:"2.0",id:r,method:e,params:i}}function nn(r,e){return e===void 0?{jsonrpc:"2.0",method:r}:{jsonrpc:"2.0",method:r,params:e}}function xt(r,e){return{jsonrpc:"2.0",id:r,result:e}}function Ye(r,e){return{jsonrpc:"2.0",id:r,error:e}}var rn=class extends Error{code;data;constructor(e){super(`JSON-RPC error code=${e.code} ${e.message}`),this.name="RemoteRpcError",this.code=e.code,e.data!==void 0&&(this.data=e.data)}},j={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 Ks(r){return"method"in r&&"id"in r&&r.id!==void 0}function Hs(r){return"method"in r&&!("id"in r)}function sn(r){return!("method"in r)&&"id"in r}var L0={AGENT_NOT_FOUND:j.AGENT_NOT_FOUND,AGENT_BUSY:j.AGENT_BUSY,AGENT_DISCONNECTED:j.AGENT_DISCONNECTED,AGENT_TIMEOUT:j.AGENT_TIMEOUT,AGENT_SPAWN_FAILED:j.AGENT_SPAWN_FAILED,AGENT_PROTOCOL_ERROR:j.INTERNAL_ERROR,BRIDGE_CONFIG_INVALID:j.INTERNAL_ERROR,BRIDGE_INTERNAL:j.INTERNAL_ERROR,IPC_AUTH_FAILED:j.INTERNAL_ERROR,IPC_BAD_REQUEST:j.INVALID_REQUEST,MODEL_TOKEN_GEN_FAILED:j.MODEL_TOKEN_GEN_FAILED,OPERATION_NOT_ALLOWED_FOR_LOCAL:j.OPERATION_NOT_ALLOWED_FOR_LOCAL,UPSTREAM_DISCONNECTED:j.INTERNAL_ERROR,UPSTREAM_HANDSHAKE_FAILED:j.INTERNAL_ERROR};function on(r){return r instanceof E?{code:L0[r.code]??j.INTERNAL_ERROR,message:r.message,data:{bridgeCode:r.code,retriable:r.retriable}}:{code:j.INTERNAL_ERROR,message:r instanceof Error?r.message:String(r)}}function Gs(r){let e=r.data,i=e?.bridgeCode??"AGENT_PROTOCOL_ERROR";return new E(i,r.message,{retriable:e?.retriable??!1,cause:r.data})}function js(r){return`${JSON.stringify(r)}
90
+ `}var an=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(`
91
+ `);this.buffer=i.pop()??"";let a=[];for(let x of i){let u=x.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 Js={"session/prompt":"session.prompt","session/cancel":"session.cancel","session/new":"session.new","session/load":"session.load","_agent/create":"agent.create","_agent/health":"agent.health","_agent/pair":"agent.pair","_agent/listSkills":"agent.listSkills","_agent/addSkills":"agent.addSkills","_agent/removeSkills":"agent.removeSkills","_agent/getFileTree":"agent.getFileTree","_agent/getFileContent":"agent.getFileContent","_agent/detail":"agent.detail","_agent/update":"agent.update","_agent/disconnect":"agent.disconnect","_agent/switchModel":"agent.switchModel","_agent/genModelToken":"agent.genModelToken","_agent/reset":"agent.reset","_agent/repair":"agent.repair","session/request_permission":"session.requestPermission",initialize:"initialize"},od=Object.fromEntries(Object.entries(Js).map(([r,e])=>[e,r])),R0={"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:[]},ut=class{seq=0;next(e,i){this.seq+=1;let a=Js[e]??N0(e),x=R0[a]??[],u=[a,String(this.seq)];if(x.length>0){let d=x.map(m=>Ws(i?.[m]??"")),h=O0(d).join(":");h&&u.push(h)}else i&&Object.values(i).some(d=>d)&&u.push(Object.values(i).filter(Boolean).map(d=>Ws(String(d))).join(":"));return u.join("_")}reset(){this.seq=0}};function N0(r){return r.replace(/[\s/]+/g,".").replace(/_+/g,"-")}function Ws(r){return r.replace(/[:_\s]+/g,"-")}function O0(r){let e=r.length;for(;e>0&&!r[e-1];)e-=1;return r.slice(0,e)}K();var M0=3e4;function Vs(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=N(`downstream.${this.constructor.name}`),this.decoder=new an({onError:i=>this.log.warn("decode line failed",{line:i.line})})}opts;child;decoder;pending=new Map;idAllocator=new ut;updateHandlers=[];agentRequestHandlers=[];exitHandlers=[];log;stopped=!1;sanitizeEnv(e){return e}async start(){if(this.child)throw new E("BRIDGE_INTERNAL","Downstream already started");let e=process.platform!=="win32",i=B0(this.opts.command,this.opts.args,{cwd:this.opts.cwd,env:{...this.sanitizeEnv(process.env),...this.opts.env},stdio:["pipe","pipe","pipe"],detached:e});this.child=i,i.stdout?.setEncoding("utf8"),i.stdout?.on("data",a=>{for(let x of this.decoder.push(a))this.dispatch(x)}),i.stderr?.setEncoding("utf8"),i.stderr?.on("data",a=>{this.log.debug("stderr",{text:a.trimEnd()})}),i.on("exit",(a,x)=>{this.stopped=!0,this.failAllPending(new E("AGENT_PROTOCOL_ERROR",`agent exited (${a}/${x})`));for(let u of this.exitHandlers)u(a,x)}),i.on("error",a=>{this.log.error("child error",{err:String(a)}),this.failAllPending(new E("AGENT_SPAWN_FAILED",String(a),{cause:a}))}),this.log.info("downstream started",{command:this.opts.command,pid:i.pid,cwd:this.opts.cwd})}async stop(e){if(!this.child||this.stopped)return;this.stopped=!0,this.log.info("downstream stopping",{reason:e});let i=this.child,a=new Promise(u=>i.once("exit",()=>u()));Vs(i.pid,"SIGTERM");let x=setTimeout(()=>{i.killed||Vs(i.pid,"SIGKILL")},5e3);try{await a}finally{clearTimeout(x)}}pid(){return this.child?.pid}isAlive(){return!!this.child&&!this.stopped}initialize(e){return this.call("initialize",e)}sessionNew(e){return this.call("session/new",{mcpServers:[],...e})}sessionLoad(e){return this.call("session/load",{mcpServers:[],...e})}sessionPrompt(e){return this.call("session/prompt",e,0)}async sessionCancel(e){!this.child||this.stopped||this.writeFrame(nn("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(xt(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(Ye(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=M0){if(!this.child||this.stopped)return Promise.reject(new E("AGENT_PROTOCOL_ERROR","downstream not started"));let x=this.idAllocator.next(e),u=At(x,e,i),d=a>0&&Number.isFinite(a);return new Promise((h,m)=>{let w=d?setTimeout(()=>{this.pending.delete(x),m(new E("AGENT_TIMEOUT",`${e} timed out after ${a}ms`))},a):null;this.pending.set(x,{resolve:h,reject:m,timer:w,method:e});try{this.writeFrame(u)}catch(b){w&&clearTimeout(w),this.pending.delete(x),m(b)}})}writeFrame(e){if(!this.child?.stdin||this.child.stdin.destroyed)throw new E("AGENT_PROTOCOL_ERROR","downstream stdin not writable");this.child.stdin.write(js(e))}dispatch(e){if(sn(e)){let i=e.id!==null?this.pending.get(e.id):void 0;if(!i){this.log.warn("orphan response",{id:e.id});return}this.pending.delete(e.id),i.timer&&clearTimeout(i.timer),e.error?i.reject(Gs(e.error)):i.resolve(e.result);return}if(Hs(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(Ks(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(Ye(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(Ye(e.id,on(a)))}catch{}}}failAllPending(e){for(let i of this.pending.values())i.timer&&clearTimeout(i.timer),i.reject(e);this.pending.clear()}};var z0="@agentclientprotocol/claude-agent-acp@latest";function F0(r){let e={};for(let[i,a]of Object.entries(r))a!==void 0&&(i.startsWith("CLAUDE")||i==="AI_AGENT"||i==="BAGGAGE"||(e[i]=a));return e}var cn=class extends Ke{framework="claude-code";constructor(e){let i=e.command??"npx",a=e.args??["-y",z0],x={command:i,args:a,cwd:e.cwd,...e.env?{env:e.env}:{}};super(x)}sanitizeEnv(e){return F0(e)}};import{mkdtempSync as q0,rmSync as U0}from"node:fs";import{tmpdir as K0}from"node:os";import{join as H0}from"node:path";var G0="@zed-industries/codex-acp@latest",xn=class extends Ke{framework="codex";authMethodId;codexHomeDir;constructor(e){let i=e.command??"npx",a=e.args??["-y",G0],x=e.extraArgs?[...a,...e.extraArgs]:a,u=e.isolateCodexHome?q0(H0(K0(),"coze-bridge-codex-home-")):void 0,d=u?{...e.env??{},CODEX_HOME:u}:e.env,h={command:i,args:x,cwd:e.cwd,...d?{env:d}:{}};super(h),this.authMethodId=e.authMethodId,this.codexHomeDir=u}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{U0(this.codexHomeDir,{recursive:!0,force:!0})}catch{}}};import{spawn as Ys}from"node:child_process";K();var un=class extends Ke{framework="openclaw";registerLog;profile;agentId;sessionName;registered=!1;constructor(e){let i=e.profile??"coze",a=e.sessionName??"default",x=["--profile",i,"acp","--session",`agent:${e.agentId}:${a}`],u={command:e.command,args:x,cwd:e.cwd,...e.env?{env:e.env}:{}};super(u),this.profile=i,this.agentId=e.agentId,this.sessionName=a,this.registerLog=N("downstream.openclaw.register")}async start(){await this.registerAgent().catch(e=>{this.registerLog.warn("openclaw agents add failed (will continue to acp anyway)",{agentId:this.agentId,err:String(e)})}),await super.start()}registerAgent(){return new Promise((e,i)=>{let a=Ys(this.opts.command,["--profile",this.profile,"agents","add",this.agentId,"--workspace",this.opts.cwd,"--non-interactive"],{stdio:["ignore","pipe","pipe"],env:{...process.env,...this.opts.env}}),x="";a.stderr?.on("data",u=>{x+=u.toString("utf8")}),a.on("error",i),a.on("close",u=>{u===0?(this.registered=!0,this.registerLog.info("agent registered",{agentId:this.agentId,profile:this.profile}),e()):i(new E("AGENT_SPAWN_FAILED",`openclaw agents add ${this.agentId} exited ${u}: ${x.trim()}`))})})}async cleanup(e){this.registered&&await new Promise(i=>{let a=Ys(this.opts.command,["--profile",this.profile,"agents","delete",this.agentId,"--force"],{stdio:["ignore","pipe","pipe"],env:{...process.env,...this.opts.env}}),x="";a.stderr?.on("data",u=>{x+=u.toString("utf8")}),a.on("error",u=>{this.registerLog.warn("openclaw agents delete failed (best-effort)",{agentId:this.agentId,err:String(u)}),i()}),a.on("close",u=>{u===0?this.registerLog.info("agent unregistered",{agentId:this.agentId}):this.registerLog.warn("openclaw agents delete non-zero exit",{agentId:this.agentId,code:u,stderr:x.trim()}),this.registered=!1,i()})})}get acpSessionName(){return this.sessionName}};K();ae();var fn=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 dn=class{agentId;framework;workspace;deployType;msgQueue;sessions=new Map;activeTriggers=new Map;status="ok";model;lastActiveAt=Date.now();constructor(e){this.agentId=e.agentId,this.framework=e.framework,this.workspace=e.workspace,this.model=e.model,this.deployType=e.deployType??"local",this.msgQueue=new fn}async dispose(e){this.status="stopped",this.msgQueue.dispose(new Error(`AgentSession disposed${e?`: ${e}`:""}`)),await this.killAllRuntimes(e??"dispose")}async killAllRuntimes(e){let i=[];for(let[,a]of this.sessions)kt(a),a.downstream&&(i.push(a.downstream.stop(e).catch(()=>{})),a.downstream=void 0);await Promise.all(i),this.activeTriggers.clear()}};function kt(r){r.idleTimer&&(clearTimeout(r.idleTimer),r.idleTimer=void 0)}var He=N("agent-manager"),W0=(r,e,i,a,x,u)=>{switch(r){case"claude-code":{let d=x?Ls(x):void 0;return new cn({cwd:i,...d&&Object.keys(d).length>0?{env:d}:{}})}case"codex":{let d=x?Rs(x):[],h=x?Ns(x):void 0,m=!!x;return new xn({cwd:i,...d.length>0?{extraArgs:d}:{},...h&&Object.keys(h).length>0?{env:h}:{},...m?{authMethodId:"openai-api-key",isolateCodexHome:!0}:{}})}case"openclaw":return new un({command:e,cwd:i,agentId:a,...u?{sessionName:Qt(u)}:{}})}};function J0(r){return r==="claude-code"||r==="codex"}var V0={path:"",version:"cloud-deployed"},Y0={protocolVersion:1,clientCapabilities:{fs:{readTextFile:!0,writeTextFile:!0}}},$0=2e4,ln=class{paths;config;registry;factory;createTimeoutMs;constructor(e){this.paths=e.paths,this.config=e.config,this.registry=e.registry,this.factory=e.downstreamFactory??W0,this.createTimeoutMs=e.createTimeoutMs??$0}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=Et(e._meta)==="cloud";if(i&&e.framework==="openclaw")return He.info("cloud-deployed openclaw, ack without local spawn",{agentId:e.agentId,framework:e.framework}),{ok:!0,agentId:e.agentId,framework:e.framework};this.registry.reviveIfDisconnected?.(e.agentId);let a=this.registry.get(e.agentId);if(a){if(a.framework!==e.framework)throw new E("AGENT_BUSY",`agent ${e.agentId} exists with different framework (${a.framework})`);if(a.status==="error")He.warn("existing agent in error state, rebuilding",{agentId:e.agentId}),await a.dispose("rebuild after error").catch(_=>He.warn("dispose stale agent failed (ignored)",{err:String(_)})),this.registry.unregister(e.agentId);else return He.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`);let x=Te(e.agentId,this.paths),u=e.workspace??x.workspace,d=Et(e._meta),h=new AbortController,m=setTimeout(()=>h.abort(new E("AGENT_TIMEOUT",`_agent/create timed out after ${this.createTimeoutMs}ms`)),this.createTimeoutMs),w,b=!1;try{let _=()=>{if(h.signal.aborted)throw h.signal.reason instanceof Error?h.signal.reason:new E("AGENT_TIMEOUT","_agent/create aborted")};await lr(x.root,{recursive:!0}),await lr(u,{recursive:!0}),await lr(x.logs,{recursive:!0}),_(),await ot(u,e.framework,e.agentId,e.cozeIdentity),_();let C=await ce(e.agentId,this.paths).catch(()=>null),L=Ds({model:e.model??C?.model});if(w=new dn({agentId:e.agentId,framework:e.framework,workspace:u,model:L.model??ct,deployType:d}),w.status="ok",C?.sessions){for(let[z,ee]of Object.entries(C.sessions))w.sessions.set(z,{acpSessionId:ee.acpSessionId,modelToken:ee.modelToken,tokenGeneratedAt:ee.tokenGeneratedAt,lastActiveAt:Date.now(),loadingSession:!1});let R=Object.keys(C.sessions).length;R>0&&He.info("restored persisted session records (no spawn)",{agentId:e.agentId,count:R})}this.registry.register(w),b=!0;let I={agentId:e.agentId,framework:e.framework,workspace:u,cozeIdentity:e.cozeIdentity,createdAt:C?.createdAt??Date.now(),sessions:C?.sessions??{},model:L.model};return d==="cloud"&&(I.deployType="cloud"),C?.skills&&(I.skills=C.skills),C?.agentName&&(I.agentName=C.agentName),C?.description&&(I.description=C.description),await me(I,this.paths),He.info("agent created (no spawn, lazy on first prompt)",{agentId:e.agentId,framework:e.framework,deployType:d}),{ok:!0,agentId:e.agentId,workspace:u,framework:e.framework}}catch(_){throw He.error("agent create failed, rolling back",{agentId:e.agentId,err:String(_)}),b&&w&&(await w.dispose("rollback").catch(()=>{}),this.registry.unregister(e.agentId)),await j0(x.root,{recursive:!0,force:!0}).catch(C=>He.warn("rm agent dir failed (ignored)",{err:String(C)})),_ instanceof E?_:new E("AGENT_SPAWN_FAILED",String(_),{cause:_})}finally{clearTimeout(m)}}async spawnSessionDownstream(e,i,a){let u=this.config.frameworksCache?.[e.framework];if(!u)if(e.deployType==="cloud"&&J0(e.framework))u=V0;else throw new E("AGENT_SPAWN_FAILED",`framework ${e.framework} not detected on this machine`);let d=e.deployType==="cloud"?{model:e.model,modelToken:i}:void 0,h=this.factory(e.framework,u.path,e.workspace,e.agentId,d,a);try{return await h.start(),await h.initialize(Y0),h}catch(m){throw await h.stop("spawnSessionDownstream failed").catch(()=>{}),m instanceof E?m:new E("AGENT_SPAWN_FAILED",m instanceof Error?m.message:String(m),{cause:m})}}};K();import{spawn as Q0}from"node:child_process";import{constants as $s,access as X0}from"node:fs/promises";import{delimiter as Z0,join as ec}from"node:path";var tc=N("framework-detector"),Qs={"claude-code":"claude",codex:"codex",openclaw:"openclaw"},nc=[".exe",".cmd",".bat",".ps1"],Pt=class{env;constructor(e={}){this.env={pathEnv:e.pathEnv??process.env.PATH??"",platform:e.platform??process.platform,spawn:e.spawn??Q0,access:e.access??X0}}async detect(e){let i=Qs[e],a=await this.which(i);if(!a)return tc.debug("framework binary not found",{framework:e,bin:i}),null;let x=await this.probeVersion(a);return{path:a,version:x}}async detectAll(){let e=await Promise.all(Object.keys(Qs).map(async a=>[a,await this.detect(a)])),i={};for(let[a,x]of e)x&&(i[a]=x);return i}async which(e){let i=this.env.pathEnv.split(Z0).filter(Boolean),a=this.env.platform==="win32"?["",...nc]:[""];for(let x of i)for(let u of a){let d=ec(x,e+u);if(await this.isExecutable(d))return d}return null}async isExecutable(e){try{let i=this.env.platform==="win32"?$s.F_OK:$s.X_OK;return await this.env.access(e,i),!0}catch{return!1}}async probeVersion(e){return new Promise(i=>{let a="",x=!1,u,d=h=>{x||(x=!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=sc(a).split(/\r?\n/)[0]??"";d(m)})}catch{d("unknown")}})}},rc=new RegExp("\x1B\\[[0-9;]*[A-Za-z]","g");function sc(r){return r.replace(rc,"")}xr();ae();var ic=10*6e4;function Xs(r){let e=r?.sessionIdleTimeoutMs;return typeof e!="number"||!Number.isFinite(e)||e<=0?ic:e}function hn(r){return Ht(r??H().configFile)}function It(r,e){return Gt(e??H().configFile,r)}import{randomBytes as oc}from"node:crypto";Ue();K();var W=N("core"),ac=3e4,cc=3e4,gn=class{upstream;agents=new Map;disconnectedAgents=new Set;extensions;paths;sessionSpawner;sessionIdleTimeoutMs;upstreamIds=new ut;pendingUpstream=new Map;pendingBridge=new Map;constructor(e){this.upstream=e.upstream,this.extensions=e.extensions??{},this.paths=e.paths,this.sessionSpawner=e.sessionSpawner,this.sessionIdleTimeoutMs=Xs(e.bridgeConfig)}registerExtension(e,i){this.extensions[e]=i}async start(){this.upstream.onFrame(e=>this.handleFrame(e)),await this.upstream.start(),W.info("Core started",{extensions:Object.keys(this.extensions)})}async stop(e){W.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),W.info("agent registered",{agentId:e.agentId,framework:e.framework});for(let i of this.registerHandlers)try{i(e.agentId)}catch(a){W.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)&&W.info("agent revived from disconnect",{agentId:e})}attachRuntimeHooks(e,i,a){let x=a.downstream;x&&(x.onUpdate(u=>{a.loadingSession||this.forwardUpdate(e,u)}),x.onAgentRequest(u=>{this.handleAgentRequest(e,x,u)}),x.onExit((u,d)=>{W.info("session runtime exited",{agentId:e.agentId,cloudId:i,code:u,signal:d}),kt(a),a.downstream=void 0,a.acpSessionId&&e.activeTriggers.delete(a.acpSessionId)}))}async handleFrame(e){if(sn(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;try{if(e.method.startsWith("_agent/")){let a=this.extensions[e.method];if(!a){i!==null?await this.sendError(i,j.METHOD_NOT_FOUND,`extension not registered: ${e.method}`):W.warn("drop notification: extension not registered",{method:e.method});return}let x=await a(e,this);i!==null&&await this.upstream.send(xt(i,x));return}if(e.method.startsWith("session/")){let a=await this.routeSessionMethod(e);i!==null&&await this.upstream.send(xt(i,a));return}if(e.method==="initialize"){i!==null&&await this.upstream.send(xt(i,{protocolVersion:1,agentCapabilities:{loadSession:!0}}));return}i!==null?await this.sendError(i,j.METHOD_NOT_FOUND,`method not implemented: ${e.method}`):W.warn("drop unknown notification",{method:e.method})}catch(a){W.error("handleFrame failed",{method:e.method,err:String(a)}),i!==null&&await this.upstream.send(Ye(i,on(a)))}}async routeSessionMethod(e){if(!e.params||typeof e.params!="object")throw new E("IPC_BAD_REQUEST",`${e.method} requires params`);let i=e.params,a=i._meta?.cozeAgentId;if(!a)throw new E("IPC_BAD_REQUEST",`${e.method}: missing _meta.cozeAgentId`);let x=this.agents.get(a);if(!x)throw this.disconnectedAgents.has(a)?new E("AGENT_DISCONNECTED",`agent ${a} has been disconnected; cloud must _agent/create to revive`):new E("AGENT_NOT_FOUND",`agent not found: ${a}`);if(e.method==="session/cancel")return this.dispatchSessionCall(x,e.method,i);let u=Date.now(),d=!1;try{let h=await x.msgQueue.enqueue(()=>this.dispatchSessionCall(x,e.method,i));return d=!0,h}finally{W.info("session call done",{agentId:x.agentId,method:e.method,durationMs:Date.now()-u,ok:d})}}async dispatchSessionCall(e,i,a){e.lastActiveAt=Date.now();let{stripped:x}=Ps(a);switch(i){case"session/new":{let u=xc();return W.info("session/new ack (lazy spawn)",{agentId:e.agentId,cloudId:u}),{sessionId:u}}case"session/load":{let u=x;return W.info("session/load ack (lazy spawn)",{agentId:e.agentId,cloudId:u.sessionId}),{}}case"session/prompt":{let u=x,d=u.sessionId;if(!d)throw new E("IPC_BAD_REQUEST","session/prompt: missing sessionId");let h=await this.ensureRuntime(e,d);if(await this.ensureDownstream(e,d,h),!h.downstream||!h.acpSessionId)throw new 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=x.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};return e.sessions.set(i,u),await this.persistSessionMapping(e),u}async requestSessionToken(e,i){let a={sessionId:i,_meta:{cozeAgentId:e}};try{let x=await this.sendRequest(Se.GEN_MODEL_TOKEN,a,cc);if(!x?.modelToken)throw new E("MODEL_TOKEN_GEN_FAILED",`cloud returned empty modelToken (agentId=${e}, cloudSessionId=${i})`);return x.modelToken}catch(x){throw x instanceof E&&x.code==="MODEL_TOKEN_GEN_FAILED"?x:new E("MODEL_TOKEN_GEN_FAILED",x instanceof Error?x.message:String(x),{cause:x})}}async ensureDownstream(e,i,a){if(kt(a),a.downstream?.isAlive())return;if(!this.sessionSpawner)throw new E("AGENT_SPAWN_FAILED","sessionSpawner not wired (cannot spawn per-session downstream)");let x=await this.sessionSpawner(e,a.modelToken,i);if(a.downstream=x,this.attachRuntimeHooks(e,i,a),a.acpSessionId){a.loadingSession=!0;try{await x.sessionLoad({sessionId:a.acpSessionId,cwd:e.workspace}),W.info("session restored via session/load",{agentId:e.agentId,cloudId:i,acpId:a.acpSessionId})}catch(u){W.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 x.sessionNew({cwd:e.workspace});a.acpSessionId=d.sessionId,await this.persistSessionMapping(e)}finally{a.loadingSession=!1}}else{let u=await x.sessionNew({cwd:e.workspace});a.acpSessionId=u.sessionId,await this.persistSessionMapping(e)}}armIdleTimer(e,i,a){kt(a),a.idleTimer=setTimeout(()=>{W.info("session runtime idle timeout, killing downstream",{agentId:e.agentId,cloudId:i});let x=a.downstream;a.downstream=void 0,a.idleTimer=void 0,a.acpSessionId&&e.activeTriggers.delete(a.acpSessionId),x&&x.stop("idle timeout").catch(u=>W.warn("idle stop failed (ignored)",{agentId:e.agentId,cloudId:i,err:String(u)}))},this.sessionIdleTimeoutMs),a.idleTimer.unref?.()}forwardUpdate(e,i){let a=i.sessionId,x=this.reverseSessionId(e,a);if(!x){W.debug("drop update for unknown session",{agentId:e.agentId,acpId:a});return}let u={cozeAgentId:e.agentId},d=e.activeTriggers.get(a);d&&(u.cozeTriggerMsgId=d),this.upstream.send(nn("session/update",{...i,sessionId:x,_meta:u})).catch(h=>W.warn("forward update failed",{agentId:e.agentId,err:String(h)}))}handleAgentRequest(e,i,a){if(a.method==="session/request_permission"){this.forwardPermissionRequest(e,i,a);return}W.warn("unhandled agent request,returning method_not_found",{agentId:e.agentId,method:a.method}),i.respondAgentRequestError(a.id,{code:j.METHOD_NOT_FOUND,message:`method not handled by Bridge: ${a.method}`})}forwardPermissionRequest(e,i,a){let x=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 b=h?this.reverseSessionId(e,h):void 0,_={...u,...b?{sessionId:b}:{},_meta:w};this.pendingUpstream.set(x,{agentRequestId:a.id,agentId:e.agentId,downstream:i,method:a.method}),this.upstream.send(At(x,"session/request_permission",_)).catch(C=>{this.pendingUpstream.delete(x),W.error("forward permission request failed",{agentId:e.agentId,err:String(C)}),i.respondAgentRequestError(a.id,{code:j.INTERNAL_ERROR,message:`upstream send failed: ${String(C)}`})})}handleUpstreamResponse(e){if(e.id===null)return;let i=this.pendingUpstream.get(e.id);if(i){this.pendingUpstream.delete(e.id),e.error?i.downstream.respondAgentRequestError(i.agentRequestId,e.error):i.downstream.respondAgentRequest(i.agentRequestId,e.result);return}let a=this.pendingBridge.get(e.id);if(a){this.pendingBridge.delete(e.id),clearTimeout(a.timer),e.error?a.reject(new rn(e.error)):a.resolve(e.result);return}W.debug("orphan upstream response (no pending)",{id:e.id})}sendRequest(e,i,a=ac){let x=this.upstreamIds.next(e);return new Promise((u,d)=>{let h=setTimeout(()=>{this.pendingBridge.delete(x),d(new E("AGENT_TIMEOUT",`${e} timed out after ${a}ms`))},a);this.pendingBridge.set(x,{method:e,resolve:u,reject:d,timer:h}),this.upstream.send(At(x,e,i)).catch(m=>{let w=this.pendingBridge.get(x);w&&(clearTimeout(w.timer),this.pendingBridge.delete(x)),d(m)})})}async persistSessionMapping(e){if(this.paths)try{let i=new Map;for(let[a,x]of e.sessions){let u={modelToken:x.modelToken,tokenGeneratedAt:x.tokenGeneratedAt};x.acpSessionId&&(u.acpSessionId=x.acpSessionId),i.set(a,u)}await fr(e.agentId,i,this.paths)}catch(i){W.warn("persist session mapping failed",{agentId:e.agentId,err:String(i)})}}reverseSessionId(e,i){for(let[a,x]of e.sessions.entries())if(x.acpSessionId===i)return a}sendError(e,i,a){return this.upstream.send(Ye(e,{code:i,message:a}))}};function xc(){return oc(16).toString("hex")}K();ae();import{randomBytes as uc}from"node:crypto";import{chmod as fc,mkdir as dc,writeFile as Zs}from"node:fs/promises";import{createServer as lc}from"node:http";import{dirname as hc}from"node:path";var gc=1e6,hr=N("ipc"),pn=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??H()}async start(){this.token=uc(32).toString("hex");let e=lc((a,x)=>{this.dispatch(a,x)});this.server=e,await new Promise((a,x)=>{e.once("error",x),e.listen(0,"127.0.0.1",()=>a())});let i=e.address();if(!i||typeof i!="object")throw new Error("failed to obtain IPC port");return this.port=i.port,await this.persistAuthFiles(),hr.info("IPC listening",{port:this.port}),{port:this.port,token:this.token}}async stop(){let e=this.server;e&&(await new Promise((i,a)=>{e.close(x=>x?a(x):i())}),this.server=null)}async persistAuthFiles(){await dc(hc(this.paths.portFile),{recursive:!0}),await Zs(this.paths.portFile,String(this.port),"utf8"),await Zs(this.paths.tokenFile,this.token,{encoding:"utf8",mode:384});try{await fc(this.paths.tokenFile,384)}catch(e){hr.warn("chmod token file failed (non-POSIX?)",{err:String(e)})}}async dispatch(e,i){if(e.headers.authorization!==`Bearer ${this.token}`){Dt(i,401,{error:"unauthorized"});return}let x=`${e.method} ${(e.url??"").split("?")[0]}`,u=this.routes.get(x);if(!u){Dt(i,404,{error:"not found"});return}let d=null;if(e.method==="POST")try{d=await pc(e)}catch(h){Dt(i,400,{error:"invalid json",detail:String(h)});return}try{let h=await u.handler(d,e);Dt(i,200,h??{ok:!0})}catch(h){hr.error("IPC handler failed",{key:x,err:String(h)}),Dt(i,500,{error:h instanceof Error?h.message:String(h)})}}};function Dt(r,e,i){r.statusCode=e,r.setHeader("content-type","application/json"),r.end(JSON.stringify(i))}async function pc(r){let e=[],i=0;for await(let x of r){let u=x;if(i+=u.length,i>gc)throw new Error("body too large");e.push(u)}let a=Buffer.concat(e).toString("utf8");return a?JSON.parse(a):null}var Ao=De(ui(),1);var Qx=De(io(),1),Xx=De(Ln(),1),Zx=De(lt(),1),eu=De(kr(),1),tu=De(Dr(),1),nu=De(Br(),1),go=De(Bn(),1),ru=De(ho(),1);var po=go.default;K();var zn="1008033",mo="1289";var wo="pbbp2",_o="https://www.coze.cn",yo="/api/coze_claw/resource/get_frontier_key",su="https://www.coze.cn",iu="wss://frontier.coze.cn";function bo(r){return r??process.env.COZE_BRIDGE_HANDSHAKE_URL??su}function vo(r){return r??process.env.COZE_BRIDGE_FRONTIER_URL??iu}function Fn(r){let e={},i=r?.ttEnv??process.env.COZE_BRIDGE_TT_ENV,a=r?.usePpe??process.env.COZE_BRIDGE_USE_PPE;return i&&(e["x-tt-env"]=i),a&&(e["x-use-ppe"]=a),e}var ne=N("upstream.frontier"),Eo="application/json",Co="none",qn=class{constructor(e){this.opts=e}opts;fws=null;handler=null;connectHandler=null;opened=!1;openCount=0;async start(){if(this.fws){ne.warn("start called on already-started FrontierUpstream; noop");return}let e={Authorization:`Bearer ${this.opts.privatecode}`,Origin:_o,...Fn(this.opts.ppeOverride)};class i extends po{constructor(h){super(h,wo,{headers:e})}send(h,...m){if(As("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 b=Buffer.from(w.slice(0,128)).toString("hex");ne.debug("WS raw frame out",{bytes:w.byteLength,headHex:b})}catch(w){ne.warn("WS raw frame dump failed",{err:String(w)})}super.send(h,...m)}}let a=vo(this.opts.urlOverride),x={url:a,ws:i,fpID:mo,aID:zn,accessKey:this.opts.handshake.accessKey,deviceID:this.opts.handshake.deviceId,payloadType:{type:Eo,force:!0},payloadEncoding:{encoding:Co,force:!0},enableTransformTextPayload:!0,enableQoS:!1,enableAutoAck:!1,automaticOpen:!1,debug:this.opts.debug??!1},u=new Ao.FWS(x);u.onopen=()=>{this.opened=!0,this.openCount+=1;let d=this.openCount===1;ne.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=>ne.warn("onConnect handler threw (ignored)",{err:String(h)}))},u.onclose=d=>{this.opened=!1,ne.info("frontier closed",{code:d.code,reason:d.reason,willReconnect:d.willReconnect})},u.onerror=d=>{ne.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){ne.warn("frontier close threw (ignored)",{err:String(a)})}}}async send(e){let i=this.fws;if(!i)throw new E("UPSTREAM_DISCONNECTED","frontier upstream not started");let a=JSON.stringify(e),x=e;ne.info("frontier frame out",{method:x.method,jsonrpcId:x.id,size:a.length});try{await i.send(a,{service:33555712,method:1,payloadType:Eo,payloadEncoding:Co})}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){ne.debug("drop non-adapter frontier frame",{service:i});return}let a=cu(e);if(!a){ne.debug("frontier message without text payload, drop",{payloadType:e.message?.payloadType});return}if(!this.handler){ne.debug("frame received but no onFrame handler",{size:a.length});return}let x;try{x=JSON.parse(a)}catch(u){ne.warn("frontier message JSON parse failed",{err:String(u),head:a.slice(0,80)});return}ne.info("frontier frame in",{logid:au(e.message?.LogID),logidNew:e.message?.LogIDNew,msgId:e.message?.msgID,jsonrpcId:x.id}),Promise.resolve(this.handler(x)).catch(u=>ne.warn("frontier frame handler threw",{err:String(u)}))}};function au(r){return r?r.high===0?String(r.low>>>0):`${r.high.toString(16)}${(r.low>>>0).toString(16).padStart(8,"0")}`:""}function cu(r){let e=r.message;if(e?.textPayload)return e.textPayload;let i=e?.payload;if(!i)return null;try{return Buffer.from(i).toString("utf8")}catch{return null}}K();function Po(r){return r?r.startsWith("boe_")?{ttEnv:r}:{ttEnv:r,usePpe:"1"}:{}}var ko=N("handshake");async function Io(r){let e=bo(r.endpoint),i=r.timeoutMs??1e4,a=`${xu(e)}${yo}?aid=${encodeURIComponent(zn)}`,x={Authorization:`Bearer ${r.privatecode}`,Accept:"application/json",...Fn(r.ppeOverride)},u=new AbortController,d=setTimeout(()=>u.abort(),i);ko.info("frontier key handshake",{base:e});try{let h=await fetch(a,{method:"GET",headers:x,signal:u.signal}),m=h.headers.get("x-tt-logid")??"",w=h.headers.get("x-tt-trace-id")??"";if(!h.ok){let L=await h.text().catch(()=>"");throw new E("UPSTREAM_HANDSHAKE_FAILED",`handshake HTTP ${h.status} logid=${m}: ${L.slice(0,200)}`)}let b=await h.json();if(b.code!==void 0&&b.code!==0)throw new E("UPSTREAM_HANDSHAKE_FAILED",`handshake code=${b.code} msg=${b.msg??"-"} logid=${m}`);let _=b.data?.access_key,C=b.data?.device_id;if(!_||!C)throw new E("UPSTREAM_HANDSHAKE_FAILED",`handshake response missing access_key/device_id logid=${m}: ${JSON.stringify(b)}`);return ko.info("handshake ok",{remoteDeviceId:C,logid:m,traceId:w}),{accessKey:_,deviceId:C}}catch(h){throw h instanceof E?h:h.name==="AbortError"?new E("UPSTREAM_HANDSHAKE_FAILED",`handshake timeout (${i}ms)`):new E("UPSTREAM_HANDSHAKE_FAILED",String(h),{cause:h})}finally{clearTimeout(d)}}function xu(r){return r.endsWith("/")?r.slice(0,-1):r}K();var zr=N("upstream.switchable"),Un=class{inner;handler=null;connectHandler=null;constructor(e){this.inner=e}async swap(e,i){if(this.inner===e)return;zr.info("swap upstream",{reason:i});let a=this.inner;this.inner=e,this.handler&&e.onFrame(this.handler),this.connectHandler&&e.onConnect&&e.onConnect(this.connectHandler);try{await e.start()}catch(x){throw zr.error("swap target start failed, reverting",{err:String(x)}),this.inner=a,x}await a.stop(i??"swapped").catch(x=>zr.warn("previous upstream stop threw (ignored)",{err:String(x)}))}current(){return this.inner}start(){return this.inner.start()}stop(e){return this.inner.stop(e)}send(e){return this.inner.send(e)}onFrame(e){this.handler=e,this.inner.onFrame(e)}onConnect(e){this.connectHandler=e,this.inner.onConnect?.(e)}isConnected(){return this.inner.isConnected()}};K();var Fr=N("upstream"),Ft=class{handler=null;async start(){Fr.info("NoopUpstream started (M1 skeleton; real Frontier wired in M4)")}async stop(e){Fr.info("NoopUpstream stopped",{reason:e})}async send(e){Fr.debug("NoopUpstream.send (dropped)",{method:"method"in e?e.method:void 0})}onFrame(e){this.handler=e}isConnected(){return!1}async injectFrame(e){this.handler&&await this.handler(e)}};K();ae();K();ae();import{execSync as uu}from"node:child_process";import{readFileSync as Do,unlinkSync as fu}from"node:fs";import{mkdir as du,readFile as To,unlink as Lo,writeFile as lu}from"node:fs/promises";import{dirname as hu}from"node:path";var gu=N("single-instance"),Kn=class{pidFile;acquired=!1;constructor(e={}){this.pidFile=e.pidFile??H().pidFile,e.processTitle&&(process.title=e.processTitle)}async acquire(){let e=await this.readExistingPid();return e!==null&&this.isAlive(e)?{kind:"already-running",pid:e}:(e!==null&&(gu.warn("removing stale pid file",{stalePid:e}),await Lo(this.pidFile).catch(()=>{})),await du(hu(this.pidFile),{recursive:!0}),await lu(this.pidFile,String(process.pid),"utf8"),this.acquired=!0,this.installCleanupHooks(),{kind:"acquired"})}async release(){if(this.acquired){try{(await To(this.pidFile,"utf8")).trim()===String(process.pid)&&await Lo(this.pidFile)}catch{}this.acquired=!1}}async readExistingPid(){try{let e=await To(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=Do(`/proc/${e}/cmdline`,"utf8").replace(/\0/g," ");return!!(i.includes("coze-bridge-daemon")||i.includes("lib/index.js"))}catch{}try{let i=uu(`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{Do(this.pidFile,"utf8").trim()===String(process.pid)&&fu(this.pidFile)}catch{}})}};var B=N("daemon"),pu="coze-bridge-daemon";async function Oo(){let r=new Kn({processTitle:pu}),e=await r.acquire();if(e.kind==="already-running")throw new Error(`coze-bridge daemon already running (pid=${e.pid})`);let i=await hn(),a=i??{};ur({pid:process.pid}),B.info(i?"loaded bridge config":"initialized bridge config");try{let D=new Pt;a.frameworksCache=await D.detectAll(),B.info("refreshed frameworks_cache",{detected:Object.keys(a.frameworksCache)})}catch(D){B.warn("framework detection failed",{err:String(D)})}await It(a);let x=new Un(new Ft),u=H(),d=null,h=new gn({upstream:x,paths:u,bridgeConfig:a,sessionSpawner:async(D,q,V)=>{if(!d)throw new Error("agentManager not ready");return d.spawnSessionDownstream(D,q,V)}});await wu(u,h);let m=new ln({paths:u,config:a,registry:h});d=m;let w,b,_=null,C=null;h.registerExtension("_agent/create",async D=>m.createAgent(D.params)),h.registerExtension("_agent/health",async()=>({ok:!0}));let L={},I=new Zt({agents:h.agents,disposeAndMarkDisconnected:async(D,q)=>{let V=h.agents.get(D);V&&(await V.dispose(`disconnect: ${q}`).catch(he=>B.warn("dispose during disconnect failed (ignored)",{agentId:D,err:String(he)})),V.status="disconnected",h.unregister(D)),h.disconnectedAgents.add(D)},detailSyncer:async D=>{if(!L.ref)throw new Error("agent-detail-sync not initialized yet");await L.ref.syncOne(D)}});h.registerExtension("_agent/listSkills",D=>I.listSkills(D.params)),h.registerExtension("_agent/addSkills",D=>I.addSkills(D.params)),h.registerExtension("_agent/removeSkills",D=>I.removeSkills(D.params)),h.registerExtension("_agent/getFileTree",D=>I.getFileTree(D.params)),h.registerExtension("_agent/getFileContent",D=>I.getFileContent(D.params)),h.registerExtension("_agent/update",D=>I.updateAgent(D.params)),h.registerExtension("_agent/disconnect",D=>I.disconnectAgent(D.params)),h.registerExtension("_agent/switchModel",D=>I.switchModel(D.params)),h.registerExtension("_agent/reset",D=>I.resetAgent(D.params)),h.registerExtension("_agent/repair",D=>I.repairAgent(D.params));let R=new $t({paths:u,handlers:I,sendDetail:D=>h.sendRequest("_agent/detail",D)});L.ref=R,x.onConnect(({initial:D})=>{B.info("frontier upstream connected, triggering detail sync",{initial:D}),R.syncAll(D?"initial-connect":"reconnect").catch(q=>B.warn("detail sync top-level error (ignored)",{err:String(q)}))});let z=new pn({paths:u,routes:[{method:"GET",path:"/status",handler:async()=>({running:!0,pid:process.pid,agents:[...h.agents.keys()],deviceId:_??"",frameworksCache:a.frameworksCache??{}})},{method:"POST",path:"/pair",handler:async D=>{let q=D,V=q?.privatecode,he=q?.pairing_code;if(!V||!he)throw new E("IPC_BAD_REQUEST","/pair requires privatecode + pairing_code");let ke=Po(q.env),ge=q.handshake_url,Je=q.frontier_url,yt=mu(q.env,ge,Je),qt=!!w&&w!==V,ye=b!==void 0&&b!==yt,be=qt||ye;if(be){B.warn("pair config switched, resetting agents",{pcChanged:qt,envChanged:ye,previousPc:w?Ro(w):"",nextPc:Ro(V),previousEnvKey:b??"",nextEnvKey:yt});for(let U of[...h.agents.values()])await U.dispose("pair config switch").catch(()=>{}),h.agents.delete(U.agentId);await x.swap(new Ft,"pair switch").catch(()=>{})}let Ut=await Io({privatecode:V,...ge?{endpoint:ge}:{},ppeOverride:ke});_=Ut.deviceId,ur({deviceId:_,pid:process.pid});let re=new qn({handshake:Ut,privatecode:V,...Je?{urlOverride:Je}:{},ppeOverride:ke});await x.swap(re,"pair");let Kt=Object.keys(a.frameworksCache??{});try{let U=await h.sendRequest("_agent/pair",{pairCode:he,patToken:V,frameworks:Kt,_meta:{cozeDeviceId:_}});B.info("_agent/pair ok",{pairResult:U}),w=V,b=yt,C||(C=new tn({core:h,getDeviceId:()=>_??""})),C.start(),be&&No(u,m).catch(Pe=>B.warn("post-pair-switch auto-revive error (ignored)",{err:String(Pe)}));let J;return q.agent_id&&(J=await _u(q.agent_id,u,m,Pe=>h.sendRequest("_agent/detail",Pe)).catch(Pe=>(B.error("--agent-id ensureAgent failed",{agentId:q.agent_id,err:String(Pe)}),{ok:!1,agentId:q.agent_id??"",note:String(Pe)}))),{ok:!0,note:"paired with cloud",...J?{agent:J}:{}}}catch(U){return B.error("_agent/pair failed",{err:String(U)}),{ok:!1,note:`pair failed: ${String(U)}`}}}},{method:"POST",path:"/_agent/create",handler:async D=>{let q=D;return{ok:!0,result:await m.createAgent(q)}}},{method:"POST",path:"/refresh",handler:async()=>{B.info("IPC /refresh: re-detecting frameworks");let D=new Pt;return a.frameworksCache=await D.detectAll(),await It(a),{ok:!0,frameworks:a.frameworksCache}}},{method:"POST",path:"/shutdown",handler:async()=>(B.info("IPC /shutdown received"),setImmediate(()=>{oe.shutdown("ipc /shutdown")}),{ok:!0})}]}),{port:ee,token:le}=await z.start();await h.start(),No(u,m).catch(D=>B.warn("auto-revive top-level error (ignored)",{err:String(D)}));let _e=null,oe={port:ee,token:le,core:h,ipc:z,shutdown(D){return _e||(B.info("daemon shutdown",{reason:D}),_e=(async()=>{C?.stop(),await h.stop(D),await z.stop(),await r.release()})(),_e)}};for(let D of["SIGTERM","SIGINT"])process.on(D,()=>{oe.shutdown(D).then(()=>process.exit(0))});return B.info("daemon ready",{port:ee,pid:process.pid,nodeVersion:process.version,platform:process.platform,frameworks:Object.keys(a.frameworksCache??{}),libVersion:a.libVersion??"dev"}),oe}function Ro(r){return r.length<=8?"***":`${r.slice(0,4)}***${r.slice(-4)}`}function mu(r,e,i){return`${r??""}|${e??""}|${i??""}`}async function wu(r,e){let{readdir:i}=await import("node:fs/promises"),a;try{a=await i(r.agentsRoot)}catch{return}let{loadAgentConfig:x,enforceAgentConfigMode:u}=await Promise.resolve().then(()=>(Ue(),Yt));for(let d of a){await u(d,r).catch(h=>B.warn("enforceAgentConfigMode failed (ignored)",{agentId:d,err:String(h)}));try{let h=await x(d,r);h?.disconnectedAt&&(e.disconnectedAgents.add(d),B.info("agent marked disconnected on startup",{agentId:d,disconnectedAt:h.disconnectedAt,reason:h.disconnectReason??""}))}catch(h){B.warn("failed to load agent config on startup, skipping",{agentId:d,err:String(h)})}}}async function _u(r,e,i,a){let{loadAgentConfig:x}=await Promise.resolve().then(()=>(Ue(),Yt)),u=await x(r,e);if(u){B.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"}}B.info("--agent-id: local config missing, pulling _agent/detail from cloud",{agentId:r});let d=await a({_meta:{cozeAgentId:r}});if(!d.framework)throw new E("AGENT_NOT_FOUND",`agent ${r} \u4E0D\u5728\u672C\u5730; \u4E91\u7AEF _agent/detail \u54CD\u5E94\u7F3A framework \u5B57\u6BB5 (D36 \u534F\u8BAE\u6269\u5C55\u672A\u751F\u6548), \u65E0\u6CD5\u5728\u672C\u673A\u65B0\u5EFA`);let 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 No(r,e){let{readdir:i}=await import("node:fs/promises"),a;try{a=await i(r.agentsRoot)}catch{return{revived:0,skipped:0,total:0}}if(a.length===0)return{revived:0,skipped:0,total:0};let{loadAgentConfig:x}=await Promise.resolve().then(()=>(Ue(),Yt));B.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 x(h,r)}catch(w){B.warn("auto-revive: load config failed (skipping)",{agentId:h,err:String(w)}),d+=1;continue}if(!m){d+=1;continue}if(m.disconnectedAt){B.info("auto-revive: skip disconnected agent",{agentId:h,disconnectedAt:m.disconnectedAt}),d+=1;continue}try{B.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){B.warn("auto-revive: createAgent failed (skipping)",{agentId:h,framework:m.framework,err:String(w)}),d+=1}}return B.info("auto-revive: done",{revived:u,skipped:d,total:a.length}),{revived:u,skipped:d,total:a.length}}Ur();ae();import{readFile as Mo}from"node:fs/promises";var We=class{paths;constructor(e){this.paths=e??H()}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:Pu(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([Mo(this.paths.portFile,"utf8"),Mo(this.paths.tokenFile,"utf8")]),a=Number.parseInt(e.trim(),10),x=i.trim();return!Number.isFinite(a)||a<=0||!x?null:{port:a,token:x}}catch(e){if(e.code==="ENOENT")return null;throw e}}async fetch(e,i){let a=i.body!==void 0,x={Authorization:`Bearer ${e.token}`};a&&(x["content-type"]="application/json");let 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:x,body:a?JSON.stringify(i.body):void 0,signal:u.signal}),m=await h.text();return{status:h.status,body:ku(m)}}finally{clearTimeout(d)}}};function ku(r){if(!r)return null;try{return JSON.parse(r)}catch{return r}}function Pu(r){return r instanceof Error?r.message:String(r)}K();ae();import{copyFile as zo,mkdir as Iu,readFile as Kr,writeFile as Du}from"node:fs/promises";import{dirname as Tu,resolve as Hr,sep as Hn}from"node:path";import{fileURLToPath as Lu}from"node:url";K();ae();var Fo=N("dist-install");function Ru(r){let e=Lu(r),i=Tu(e),a=`${Hn}src${Hn}`;if(i.includes(a)||i.endsWith(`${Hn}src${Hn}cli`))return null;let x=Hr(i,"index.js"),u=Hr(i,"..","package.json");return{dist:x,pkgJson:u}}async function qo(r={}){let e=r.paths??H(),i=Ru(import.meta.url),a=r.sourceDist??i?.dist,x=r.sourcePackageJson??i?.pkgJson;if(!a||!x)return{kind:"dev-mode-skip",reason:"running from src/(tsx loader);no dist/ to install"};let u;try{u=JSON.parse(await Kr(x,"utf8")).version??"unknown"}catch(_){return Fo.warn("cannot read source package.json,skip dist install",{err:String(_)}),{kind:"dev-mode-skip",reason:`package.json read failed: ${String(_)}`}}let d=await hn(e.configFile)??{},h=d.libVersion;if(h===u)try{return await Kr(e.libEntry),{kind:"already-current",libVersion:u}}catch{}await Iu(e.libDir,{recursive:!0}),await zo(a,e.libEntry),await zo(`${a}.map`,`${e.libEntry}.map`).catch(()=>{});let m=Hr(e.libDir,"package.json"),w=`${JSON.stringify({type:"module"},null,2)}
92
+ `;return await Kr(m,"utf8").catch(()=>null)!==w&&await Du(m,w),d.libVersion=u,await It(d,e.configFile),Fo.info("dist installed",{libEntry:e.libEntry,fromVersion:h,toVersion:u}),h?{kind:"version-changed",fromVersion:h,toVersion:u,libEntry:e.libEntry}:{kind:"first-install",libVersion:u,libEntry:e.libEntry}}var Xu=N("cli");function _t(r,e){let i=[],a;for(let x=0;x<r.length;x++){let u=r[x];if(u===e){a=r[x+1],x+=1;continue}if(u.startsWith(`${e}=`)){a=u.slice(e.length+1);continue}i.push(u)}return{value:a,rest:i}}function Zu(r){let e=r.slice(2);if(e.includes("--daemon"))return{mode:"daemon"};if(e.includes("--status"))return{mode:"status"};if(e.includes("--stop"))return{mode:"stop"};if(e.includes("--refresh"))return{mode:"refresh"};if(e.includes("--uninstall"))return{mode:"uninstall"};if(e.includes("--install-service"))return{mode:"install-service"};if(e.includes("--help")||e.includes("-h")||e.length===0)return{mode:"help"};let i=e,{value:a,rest:x}=_t(i,"--pat-token");i=x;let{value:u,rest:d}=_t(i,"--pair-code");i=d;let{value:h,rest:m}=_t(i,"--env");i=m;let{value:w,rest:b}=_t(i,"--handshake-url");i=b;let{value:_,rest:C}=_t(i,"--frontier-url");i=C;let{value:L}=_t(i,"--agent-id");if(!a||!u)return{mode:"help"};let I={mode:"pair",privatecode:a,pairingCode:u};return h&&(I.env=h),w&&(I.handshakeUrl=w),_&&(I.frontierUrl=_),L&&(I.agentId=L),I}var ef=`
93
93
  coze-bridge - local bridge daemon for cloud Agent Service
94
94
 
95
95
  Usage:
@@ -116,35 +116,35 @@ Auto-connect agent (optional):
116
116
 
117
117
  Internal:
118
118
  <node> <entry> --daemon daemon mode (OS supervisor only)
119
- `.trimStart();async function Vo(r=process.argv,e={}){let i=nu(r);switch(i.mode){case"help":return process.stdout.write(ru),0;case"daemon":{try{await zo()}catch(a){return tu.error("daemon start failed",{err:String(a)}),1}return new Promise(()=>{})}case"status":return su(e);case"stop":return iu(e);case"refresh":return ou(e);case"uninstall":return au(e);case"install-service":return xu();case"pair":{let a={};return i.env&&(a.env=i.env),i.handshakeUrl&&(a.handshakeUrl=i.handshakeUrl),i.frontierUrl&&(a.frontierUrl=i.frontierUrl),cu(i.privatecode,i.pairingCode,e,a,i.agentId)}}}async function Yo(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 su(r){let e=r.paths??H(),i=new Ge(e),a=await i.probe();if(a.kind==="not-running")return process.stdout.write(`coze-bridge: not running
120
- `),1;if(a.kind==="stale")return await Yo(e),process.stdout.write(`coze-bridge: not running (cleaned stale state)
119
+ `.trimStart();async function Wo(r=process.argv,e={}){let i=Zu(r);switch(i.mode){case"help":return process.stdout.write(ef),0;case"daemon":{try{await Oo()}catch(a){return Xu.error("daemon start failed",{err:String(a)}),1}return new Promise(()=>{})}case"status":return tf(e);case"stop":return nf(e);case"refresh":return rf(e);case"uninstall":return sf(e);case"install-service":return of();case"pair":{let a={};return i.env&&(a.env=i.env),i.handshakeUrl&&(a.handshakeUrl=i.handshakeUrl),i.frontierUrl&&(a.frontierUrl=i.frontierUrl),af(i.privatecode,i.pairingCode,e,a,i.agentId)}}}async function Jo(r){let{unlink:e}=await import("node:fs/promises");await Promise.all([e(r.pidFile).catch(()=>{}),e(r.portFile).catch(()=>{}),e(r.tokenFile).catch(()=>{})])}async function tf(r){let e=r.paths??H(),i=new We(e),a=await i.probe();if(a.kind==="not-running")return process.stdout.write(`coze-bridge: not running
120
+ `),1;if(a.kind==="stale")return await Jo(e),process.stdout.write(`coze-bridge: not running (cleaned stale state)
121
121
  `),1;let x=await i.request({method:"GET",path:"/status"});return process.stdout.write(`coze-bridge: running
122
122
  ${JSON.stringify(x.body,null,2)}
123
- `),0}async function iu(r){let e=r.paths??H(),i=new Ge(e),a=await i.probe();if(a.kind==="not-running")return process.stdout.write(`coze-bridge: not running
124
- `),0;if(a.kind==="stale")return await Yo(e),process.stdout.write(`coze-bridge: not running (cleaned stale state)
123
+ `),0}async function nf(r){let e=r.paths??H(),i=new We(e),a=await i.probe();if(a.kind==="not-running")return process.stdout.write(`coze-bridge: not running
124
+ `),0;if(a.kind==="stale")return await Jo(e),process.stdout.write(`coze-bridge: not running (cleaned stale state)
125
125
  `),0;try{return await i.request({method:"POST",path:"/shutdown"}),process.stdout.write(`coze-bridge: stopped
126
126
  `),0}catch(x){return process.stdout.write(`coze-bridge: stop failed: ${String(x)}
127
- `),1}}async function ou(r){let e=new Ge(r.paths);if((await e.probe()).kind==="not-running")return process.stdout.write(`coze-bridge: not running (start daemon first)
127
+ `),1}}async function rf(r){let e=new We(r.paths);if((await e.probe()).kind==="not-running")return process.stdout.write(`coze-bridge: not running (start daemon first)
128
128
  `),1;try{let a=await e.request({method:"POST",path:"/refresh"});return a.status===200?(process.stdout.write(`coze-bridge: refreshed
129
129
  ${JSON.stringify(a.body,null,2)}
130
130
  `),0):(process.stderr.write(`coze-bridge: refresh failed: ${JSON.stringify(a.body)}
131
131
  `),1)}catch(a){return process.stderr.write(`coze-bridge: refresh failed: ${String(a)}
132
- `),1}}async function au(r){let e=new Ge(r.paths);if((await e.probe()).kind==="connected"){process.stdout.write(`coze-bridge: stopping daemon...
133
- `);try{await e.request({method:"POST",path:"/shutdown"})}catch(f){process.stderr.write(`coze-bridge: stop failed (continuing): ${String(f)}
134
- `)}await new Promise(f=>setTimeout(f,500))}if(!r.skipSupervisor)try{let{getSupervisor:f,buildContext:l}=await Promise.resolve().then(()=>($r(),Zr)),h=f();await h.uninstall(l()),process.stdout.write(`coze-bridge: ${h.platform} supervisor unregistered
135
- `)}catch(f){process.stderr.write(`coze-bridge: supervisor uninstall failed (continuing): ${String(f)}
132
+ `),1}}async function sf(r){let e=new We(r.paths);if((await e.probe()).kind==="connected"){process.stdout.write(`coze-bridge: stopping daemon...
133
+ `);try{await e.request({method:"POST",path:"/shutdown"})}catch(u){process.stderr.write(`coze-bridge: stop failed (continuing): ${String(u)}
134
+ `)}await new Promise(u=>setTimeout(u,500))}if(!r.skipSupervisor)try{let{getSupervisor:u,buildContext:d}=await Promise.resolve().then(()=>($r(),Yr)),h=u();await h.uninstall(d()),process.stdout.write(`coze-bridge: ${h.platform} supervisor unregistered
135
+ `)}catch(u){process.stderr.write(`coze-bridge: supervisor uninstall failed (continuing): ${String(u)}
136
136
  `)}let a=r.paths??H(),{rm:x}=await import("node:fs/promises");try{await x(a.cozeRoot,{recursive:!0,force:!0}),process.stdout.write(`coze-bridge: removed ${a.cozeRoot}
137
- `)}catch(f){return process.stderr.write(`coze-bridge: remove failed: ${String(f)}
137
+ `)}catch(u){return process.stderr.write(`coze-bridge: remove failed: ${String(u)}
138
138
  `),1}return process.stdout.write(`coze-bridge: uninstalled
139
- `),0}async function xu(){try{let{getSupervisor:r,buildContext:e}=await Promise.resolve().then(()=>($r(),Zr)),i=r(),a=e();return process.stdout.write(`coze-bridge: installing ${i.platform} supervisor...
139
+ `),0}async function of(){try{let{getSupervisor:r,buildContext:e}=await Promise.resolve().then(()=>($r(),Yr)),i=r(),a=e();return process.stdout.write(`coze-bridge: installing ${i.platform} supervisor...
140
140
  `),await i.install(a),process.stdout.write(`coze-bridge: supervisor installed (daemon will auto-start on login)
141
141
  `),0}catch(r){return process.stderr.write(`coze-bridge: --install-service failed: ${String(r)}
142
- `),1}}async function cu(r,e,i,a={},x){let f=new Ge(i.paths),l=i.spawnDaemon??Mo;if(!i.skipDistInstall){let _=await Ko({paths:i.paths});_.kind==="version-changed"?(process.stdout.write(`coze-bridge: upgraded ${_.fromVersion} \u2192 ${_.toVersion}
143
- `),(await f.probe()).kind==="connected"&&(await f.request({method:"POST",path:"/shutdown"}).catch(()=>{}),await new Promise(w=>setTimeout(w,500)))):_.kind==="first-install"&&process.stdout.write(`coze-bridge: installed ${_.libVersion}
144
- `)}let h=await f.probe();if(h.kind!=="connected"&&(process.stdout.write(`coze-bridge: starting daemon...
145
- `),await l({paths:i.paths}),h=await fu(f,i.waitTimeoutMs??1e4,i.sleep??uu),h.kind!=="connected"))return process.stderr.write(`coze-bridge: daemon did not come up: ${h.kind}
146
- `),1;let m={privatecode:r,pairing_code:e};a.env&&(m.env=a.env),a.handshakeUrl&&(m.handshake_url=a.handshakeUrl),a.frontierUrl&&(m.frontier_url=a.frontierUrl),x&&(m.agent_id=x);try{let _=await f.request({method:"POST",path:"/pair",body:m,timeoutMs:35e3});return _.status===200&&_.body?.ok?(process.stdout.write(`coze-bridge: paired (${_.body.note??"ok"})
147
- `),0):(process.stderr.write(`coze-bridge: pair failed: ${JSON.stringify(_.body)}
148
- `),1)}catch(_){return process.stderr.write(`coze-bridge: pair failed: ${String(_)}
149
- `),1}}async function fu(r,e,i){let a=Date.now()+e;for(;Date.now()<a;){let x=await r.probe(500);if(x.kind==="connected")return x;await i(200)}return r.probe(500)}function uu(r){return new Promise(e=>setTimeout(e,r))}Vo(process.argv).then(r=>process.exit(r),r=>{process.stderr.write(`fatal: ${r instanceof Error?r.stack??r.message:String(r)}
142
+ `),1}}async function af(r,e,i,a={},x){let u=new We(i.paths),d=i.spawnDaemon??Bo;if(!i.skipDistInstall){let w=await qo({paths:i.paths});w.kind==="version-changed"?(process.stdout.write(`coze-bridge: upgraded ${w.fromVersion} \u2192 ${w.toVersion}
143
+ `),(await u.probe()).kind==="connected"&&(await u.request({method:"POST",path:"/shutdown"}).catch(()=>{}),await new Promise(_=>setTimeout(_,500)))):w.kind==="first-install"&&process.stdout.write(`coze-bridge: installed ${w.libVersion}
144
+ `)}let h=await u.probe();if(h.kind!=="connected"&&(process.stdout.write(`coze-bridge: starting daemon...
145
+ `),await d({paths:i.paths}),h=await cf(u,i.waitTimeoutMs??1e4,i.sleep??xf),h.kind!=="connected"))return process.stderr.write(`coze-bridge: daemon did not come up: ${h.kind}
146
+ `),1;let m={privatecode:r,pairing_code:e};a.env&&(m.env=a.env),a.handshakeUrl&&(m.handshake_url=a.handshakeUrl),a.frontierUrl&&(m.frontier_url=a.frontierUrl),x&&(m.agent_id=x);try{let w=await u.request({method:"POST",path:"/pair",body:m,timeoutMs:35e3});return w.status===200&&w.body?.ok?(process.stdout.write(`coze-bridge: paired (${w.body.note??"ok"})
147
+ `),0):(process.stderr.write(`coze-bridge: pair failed: ${JSON.stringify(w.body)}
148
+ `),1)}catch(w){return process.stderr.write(`coze-bridge: pair failed: ${String(w)}
149
+ `),1}}async function cf(r,e,i){let a=Date.now()+e;for(;Date.now()<a;){let x=await r.probe(500);if(x.kind==="connected")return x;await i(200)}return r.probe(500)}function xf(r){return new Promise(e=>setTimeout(e,r))}Wo(process.argv).then(r=>process.exit(r),r=>{process.stderr.write(`fatal: ${r instanceof Error?r.stack??r.message:String(r)}
150
150
  `),process.exit(1)});