coze-bridge 0.1.8 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/dist/index.js +30 -29
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -5,16 +5,16 @@ 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 B0=Object.create;var sr=Object.defineProperty;var z0=Object.getOwnPropertyDescriptor;var q0=Object.getOwnPropertyNames;var F0=Object.getPrototypeOf,U0=Object.prototype.hasOwnProperty;var X=(r=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(r,{get:(e,o)=>(typeof require<"u"?require:e)[o]}):r)(function(r){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+r+'" is not supported')});var De=(r,e)=>()=>(r&&(e=r(r=0)),e);var oe=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),ms=(r,e)=>{for(var o in e)sr(r,o,{get:e[o],enumerable:!0})},H0=(r,e,o,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let x of q0(e))!U0.call(r,x)&&x!==o&&sr(r,x,{get:()=>e[x],enumerable:!(a=z0(e,x))||a.enumerable});return r};var Pe=(r,e,o)=>(o=r!=null?B0(F0(r)):{},H0(e||!r||!r.__esModule?sr(o,"default",{value:r,enumerable:!0}):o,r));import{chmod as K0,mkdir as j0,readFile as W0,writeFile as G0}from"node:fs/promises";import{dirname as J0}from"node:path";async function qt(r){try{let e=await W0(r,"utf8");return JSON.parse(e)}catch(e){if(e.code==="ENOENT")return null;throw e}}async function Ft(r,e,o){await j0(J0(r),{recursive:!0}),await G0(r,`${JSON.stringify(e,null,2)}
9
- `,"utf8"),o?.mode!==void 0&&await K0(r,o.mode)}var ir=De(()=>{"use strict"});function ys(r){return Ht[_s]<=Ht[r]}function or(r){ws={...r}}function Ut(r,e,o,a){if(Ht[r]<Ht[_s])return;let x=JSON.stringify({ts:new Date().toISOString(),level:r,module:e,msg:o,...ws,...a});r==="error"||r==="warn"?V0.write(`${x}
10
- `):X0.write(`${x}
11
- `)}function M(r){return{debug:(e,o)=>Ut("debug",r,e,o),info:(e,o)=>Ut("info",r,e,o),warn:(e,o)=>Ut("warn",r,e,o),error:(e,o)=>Ut("error",r,e,o),child:e=>M(`${r}.${e}`)}}var Ht,_s,X0,V0,ws,F=De(()=>{"use strict";Ht={debug:10,info:20,warn:30,error:40},_s=(()=>{let r=process.env.COZE_BRIDGE_LOG_LEVEL;return r==="debug"||r==="info"||r==="warn"||r==="error"?r:"info"})(),X0=process.stdout,V0=process.stderr,ws={}});import{homedir as Y0}from"node:os";import{join as re}from"node:path";function U(r){let e=r??Y0(),o=re(e,".coze"),a=re(o,"bridge"),x=re(a,"lib");return{cozeRoot:o,bridgeRoot:a,libDir:x,libEntry:re(x,"index.js"),pidFile:re(a,"bridge.pid"),portFile:re(a,"bridge.port"),tokenFile:re(a,"bridge.token"),logFile:re(a,"bridge.log"),installLock:re(a,"install.lock"),configFile:re(a,"config.json"),agentsRoot:re(o,"agents")}}function Ie(r,e=U()){let o=re(e.agentsRoot,r);return{root:o,config:re(o,"config.json"),workspace:re(o,"workspace"),logs:re(o,"logs")}}var ce=De(()=>{"use strict"});var Wt={};ms(Wt,{AGENT_CONFIG_FILE_MODE:()=>Kt,enforceAgentConfigMode:()=>Z0,loadAgentConfig:()=>ae,persistAgentSessions:()=>ar,persistAgentSkills:()=>jt,saveAgentConfig:()=>de});import{chmod as Q0,stat as $0}from"node:fs/promises";function ae(r,e){return qt(Ie(r,e).config)}function de(r,e){return Ft(Ie(r.agentId,e).config,r,{mode:Kt})}async function Z0(r,e){if(process.platform==="win32")return;let o=Ie(r,e).config;try{let a=await $0(o);if(!a.isFile())return;let x=a.mode&511;x!==Kt&&(await Q0(o,Kt),bs.warn("agent config mode auto-corrected to 0600",{path:o,from:x.toString(8)}))}catch(a){if(a.code==="ENOENT")return;bs.warn("enforceAgentConfigMode: chmod failed (ignored)",{path:o,err:String(a)})}}async function ar(r,e,o){let a=await ae(r,o);a&&(a.sessions=Object.fromEntries(e),await de(a,o))}async function jt(r,e,o){let a=await ae(r,o);a&&(a.skills=e,await de(a,o))}var bs,Kt,Fe=De(()=>{"use strict";ir();F();ce();bs=M("agent-config"),Kt=384});var ai=oe(Y=>{"use strict";var S=k;(function(r,e){let o=k,a=r();for(;;)try{if(-parseInt(o(1764))/1+parseInt(o(811))/2+-parseInt(o(1466))/3*(-parseInt(o(1431))/4)+parseInt(o(1562))/5+-parseInt(o(783))/6*(parseInt(o(1308))/7)+parseInt(o(1202))/8+parseInt(o(1906))/9===e)break;a.push(a.shift())}catch{a.push(a.shift())}})(gn,502323);var sx=Object[S(1490)+S(1571)],ix=Object[S(523)+S(554)+"mes"],ni=(r,e)=>function(){return r&&(e=(0,r[{zMRuE:function(f,d){return f(d)}}[S(646)](ix,r)[0]])(r=0)),e},ox=(r,e)=>{for(var o in e)sx(r,o,{get:e[o],enumerable:!0})};function gn(){let r=["rLL0DKi","y29UBMvJDeu","BerMweO","x29Uq2XVC2u","vKPgCgK","mNW0Fdn8mhW","s2TIz3K","uLr2wLK","uKv2B2m","y1DwqvK","suj3DhG","u2rSEve","BMv4DcGPigm","rNzvz28","BIWGAg9ZDg4","CMvTB3zLrxy","tvbAwNK","y29erue","qw5uqMu","x2HHBMrSzvi","C2v0y3vYC28","B3DpCwK","yM9KEq","CgDnBwC","tvDbwfG","t1bftL9fuLi","txvJtfu","zgvS","wgf1wwy","z0TvD2i","D0Xoz1a","CM92AwrLihC","A1Drv1a","yungsgu","AvfRuNK","B1zVyMe","wLzxC0W","x1fVu01HBMe","mNW0Fdb8mxW","sMHmAw8","ww1ltKS","EfvZzuvUDG","yxboBxe","sgTYy1O","CMPovK0","BwvZC2fNzq","wvztB3i","y2XLyxjtDg8","yw1L","x29UrxjYB3i","q1fZr2C","BMnVzgLUzW","B2nRzxrtDwm","tvjuuvm","y0PQCeO","BwjLB3y","v2nAz2q","s3LjCvG","BwvKAwf0zwW","AhDlC3y","BMv3vMvYC2K","vuLMy0u","tvfQsee","ihzHBgLKigq","Aw5KzxHpzG","Cfr1vxa","q0TPwMe","CNzHBa","rKLmrv9ot1q","oti1nZG5yKPQDK1R","x2fKzfDZtgK","BMnLq2XVC2u","z1P4C2S","ugjmyxi","tNDYtLi","ANDnte8","x2LUAxrqCM8","tNLSr1m","ANPhvLe","ywDuy1O","qLLMqwi","yw5Hz2vY","BLffELG","thbMAu8","z2v0qwXS","ANDiDvi","yKniuhC","q0Xpu0LorW","zvvYBa","B3jRig9MzMW","t0LnzNG","zKr3zNO","D2LSBfjLy28","qvnctw0","sfrcuMO","C2vUza","AgfZt3DUuhi","BvrKs3G","C3Dwshe","C1bes1q","AvLkq3y","q09otKvdveK","DKXHzvy","BfbIDxm","uLnYwfa","DMvYC2LVBG","CgjICdi","vvH0sey","q2XdqMq","y0zyrNe","ywXSq3vYC28","rLDt","DLHoC0C","txnUAhi","z0rpCKi","Def6rMe","EKfws08","Aw1LCYbPBIa","nhWXFdn8mNW","zujAr0O","x2vUzhbVAw4","EuzlCge","C0rvD0O","yMjcAwe","CMvJB25Uzwm","uvjkrLu","mhWYFdn8nxW","sKnYD2e","vK1nBM4","y29Uy2f0","zezwuNi","uKfPvMq","uMnArMO","CLzHBhvLCW","tK1HDNm","x3jLy29UBMu","rgTtqMG","ywrKt25L","vg9mAuO","ywDL","q3P1y3q","EMj1z20","vgLTzw91Da","whjwD2W","tufyx1jfvfi","C0jf","zxrxB3jRq2G","t2fwELC","Fdr8mxW3","s2jkC1m","uuHRDvu","q09oveLovuu","A1n0yxr1C0m","AwXLtMfTzq","uvLMzgq","EMvYtLm","Aw5L","swvNqLq","z2vY","u1vwwwu","vKzdAxm","yxv0BW","swvwAKK","uMLNBwq","mhW0Fdv8mNW","yMfSu2nVCgu","wKrkzgi","B3L3vMW","tKzntLq","vvbXC0K","C3Diu08","ywXSB2nvBNm","sNf1vuy","sMvTzvC","CKT0rxe","DKD6B0u","m3WXFdv8n3W","B3jLtMfTzxm","z3rAqvO","wfLlqK4","A2zRrNe","CMvKDwnL","zuXsyKS","CfrkDLC","qwvfrwi","x29Ut3bLBG","rfDyCxG","quDtBuS","zNvUy3rPB24","z3nOq24","zermC2e","sg9nsMi","ELPRy3C","ChrVCG","rLDsAMm","s0PPvKO","ywnRpwzYB24","BM5mqKG","z2v0s2v5","CNjVCK1LC3m","CIb0DhDjra","DNPdu00","uuXrCei","vu5ksvq","rvHqBxK","uvrjr0e","AeXPtKm","C3rVCMu","zgvIDwC","sKXutwW","tgzHtMe","mJKZoty1mLLfuuD5AG","CgLUz0XVC3m","C3rYAw5N","BKneCxK","C2X5v2G","ywrK","AxvMCK0","Euv6q2y","sMfUBKy","BgXsDei","BxDZtLi","B25mAw5L","Cg9PBNrbBMq","CM12quG","zNrNzw8","uxvLDwu","yKfpveW","tgHqtwS","wwXYt2y","DLHmtLy","nNW0FdD8m3W","ywrwAeW","t0D6C2e","twP6rKK","zw1PDa","DvrdtKy","vM5WBM0","CMH0EeW","EePvrNa","z2v0u3rVCMe","ueT3uhu","t21JzvG","DfHwtKG","tMLhvMS","y0j0se0","vMLhsKG","Dg9VigXHCMC","mxWWFdv8mNW","uwLnu1a","CMvJzxzPzwq","tw9KDwXL","zNjVBu51Bwi","qMz5q3C","ChvZAa","DfzLsgm","Ae9Wzw5fDMu","CezUzKG","y2HHCKnVzgu","AMTtvKS","AuPLB2W","CgLUz1rPBwu","rfrbs0q","whbAuey","y29UBMvJDa","txHesfe","sMrfDMi","B2jQzwn0u3q","sfLLsui","ohWYFdL8nxW","Dgf2rxK","rNHPChq","Axjkvum","yLvuBM4","vgjSyu0","y2HnyxHdB3u","C29YDa","uMfXt3O","Dg9Y","thzzrvy","A2vvu3O","DuXTtve","zcWG","BgLUzq","m3W0","tMfTzq","DxDPsuS","C2nYAxb0","s2DUr1G","zwDgrum","BwXIBM8","BwvZC2fNzv8","zu1isK8","q29Kzq","BgvUz3rO","z2v0qwXSs2u","D25wCNK","qxzizNy","weXqDfC","Ae1LC3nHz2u","CMvUDevUzha","vMrHBM0","zu9WtKi","u250ve4","C3jOBgi","AwXLx25HBwu","Dxrjza","ywjYBfe","y3vYCMvUDeu","EhvzCMu","rNzmEve","ChjVy2vZCW","EhrquLq","Cgn1v1y","yNPXugu","zM9Yy2u","Bg93","tMfMqM4","s05ovMu","vfjKBwK","C1riB3a","vfvlyNi","verjt08","zvHlDxq","seTwD0m","yw51Ce1LC3m","zxD0z08","wNnftLm","wunluM8","Ec1TC2CTy3u","ihrPBwvZ","ug5dBeu","A1LpCwy","AfDmywK","B3nLza","x2zVCM1HDeu","zxH0zw5ZAw8","uLjpuG","s1nPDu8","vvjsvgi","x2nYzwf0zvm","B0PKExK","yxKSig5LDhC","y3jUAxa","mdaWma","x2rPC3bHDgm","vwnbvxa","yw5ZzM9YBvq","AxLcwfy","rvDKrwq","B2zM","svPHAey","DcbSAw1PDa","x29UvgLTzw8","EgPRuMm","Aw9U","ugzuD2u","ywr2yw5Jzq","BxnNsuq","yNvkuxC","Aw47y2HHCNm","A2v5","B25tDgfYDfi","v0zkqwG","BwPoz08","u2XxAw8","Cgf5Bg9Hza","y2HnyxHuCMK","z29PBMCGyxC","wffJBuW","wvzLveG","yxnL","yMncr0q","rMXtD2y","q0Xpu0ve","ueLnsg4","x29UtwvZC2e","y0PovLO","zw1LBNq","D3m6lY8","Bg9IywXty28","D3jPDgu","zw50","z1Lgy0C","B0vhswe","x3nVy2TLDa","yMLUza","t2Per3O","zgvJB2rLzey","vLvJt2W","u1vlDg4","BhbdzLK","DwXIu08","AgvhCMO","y3vYC29Y","zufJAW","Bu1kEgW","uxHfteq","s0nwD0W","y3bvt28","zef2y04","C2nqB1q","r1zKq1m","Aw50zwDLCIa","vfLgrKm","ChzWEM4","B2nRzxrgywK","uM1yrwy","C2vYDMLJzq","y3jLyxrLtwu","BMfTzq","BhLnuue","rw1lsxy","qwTpsge","tKL6Eum","qxjpuw8","yKnyzxu","rxzLBNq","C0Xf","z2v0t3DUuhi","DeLK","D01kuwm","uxDQs0C","x3DZ","AxnmB25N","EvfPDeO","B3jpBMXPBMu","r09pD0e","AwXSihvZzsa","s1LpzKe","tuvtu0fhrv8","B0LKs3e","yMXVy2TLza","x2rLyNvN","rhP4Cgm","t3bLBKv2zw4","zKrntvy","zgLZCgf0y2G","A3HJD0m","B1zzt04","CMfTzq","sLfjA2G","DurRrg4","wLvfvu0","Dhr3Awq","zgLZywjSzue","veHky3q","s1fpyuu","y29UBMvJDgK","zwvKzwq","B3bLCNr5tMe","u29urwm","DMfSDwvZ","BuPOz2O","yu5gzve","v1fIwe0","tK5Qz2C","DxDlAKu","weTKAvi","q3nvvfa","yNndvue","qLDVze0","zcbLCNjVCI4","uMvJB25Uzwm","EMrwAxi","wNDSu28","wMrssxe","yvrstMq","y29UBMvJDfm","AxjLza","Bwf4tg9ZC0m","y3jLyxrLrxi","C2HPzNq","uMjbufu","sNLJwMK","CgfNzxnOB3C","uvjdExK","zw5fDMvUDa","t2XgDg0","y1vkCvC","Bg5pDg8","AMTKsuO","CMfUzg9T","uuXswKi","y3jLyxrLuMu","B2zMBgLUzq","AejOzMC","sufwELG","B25JBg9Zzq","EeTbrfC","rKrpuvK","qLPtDvK","zNjVBujPDhm","BeHHBMrSzxi","s0T3ENC","q291BNq","yxv0B21HDgK","x19LC01Vzhu","BvzdrNu","CMvZDwX0","wKjsswC","qwnzwNq","A1fmzKC","B2zMC2v0","CM5qCNG","CMvJzwL2zwq","D3PlseC","vKLjvKC","z1b2uu8","x2rPC2nVBM4","Dg9cExrLC0i","y2XVC2uSihC","D0HJr0u","BLn3uLq","uM9RELq","BNPAB3G","reXxre8","yuHct3q","zw5JB2rLrNi","yu5iAha","B25LCNjVCG","vhjRwMq","tgH4sfC","tuzfuem","tejoswq","uvHywg0","sgzAD2G","qLnczLe","DxrMofDYAxq","BMDLza","y29Kzq","wK1fBNq","B2nRzxq","C3fXDum","z3jpC1K","DhDVCMTdAge","wMjTquC","zuX3EvC","sfndB3K","ve1ZquO","q1LZD0y","zxjYtxnN","EK1sDuu","z09SqKy","C3vJy2vZCW","DxLgEMm","BNv2B1C","wLHzt00","yMLUyxj5vhK","Dg9cExrLC0W","A2Xeq0C","CevJwfa","C3rVCcbPBw0","BfrPBwvVDxq","q3jQzMW","x0vysvnu","ywnOzwq","BxzmyuW","DhjPzxmGCMu","tLbJtMi","zxrXuvi","vhnAwuG","Dg9Zq2q","EeDAqvy","DgLTzw91DcW","A0nMyxO","qw5YD24","y29UC3rYDwm","ywrKrxzLBNq","zv90Aw1LB3u","z2vrDwv1zuW","zxH0ugf5Bg8","C01czuu","B25szwnLAxy","ugHADwO","y2XLyxi","zwn0","DerOqM4","EKfyyNO","y2fSBa","Bw9AA1O","r3r4suK","zLzYCwW","rKXOvNe","rKn3tNa","zMLSDgvY","x3vYBa","DxbKyxrLq3u","q25Ot2q","BLnfsve","sNzKAe8","De1HBMfNzxi","Cgf5Bg9Hzfq","q1rir2e","wg1RrwK","AvvTCeS","AxLfrNi","t05vzKq","C0vkAfu","ywLXEgG","x2nSzwfYugK","sLnfuhe","EMDvvhG","zfDVCMTLCKC","zgLcCvK","sxPKD2q","BwDcDvK","B25tDg9Wsw0","DwPAwMy","x2LZtwLUAvq","yMfSrxzLBNq","AxmGDw5Kzwy","zw50zwqGDhK","u3rYyxrLz3K","r2HJAMS","rhDKq2m","Bwv0Ag9K","Ec11C2uT","tLPJseC","wNLQsw8","r2r6BNm","zxHWB3j0CW","CezfBu8","CM9YrxzLBNq","Cgj6Eu0","s0DuCwG","B3jRzxjhBg8","EvjLy29UBMu","C3bSAwnL","DurzCK0","qujywuy","Cu5uCfu","ugfktK0","t1vzquO","AePIq2K","v2PpAxK","wgTRzKy","x3jLywr5q2W","wgPduwm","CMvWBgfJzq","qw1VDw50","BMCGDxjSoIa","ywWGy3vYC28","uMTxree","swHOsvG","C2XPy2u","zNjVBuHHC2G","wwryv2O","ywnRDxbfBMq","B3vUDa","CNnVCL9Uyw0","yxbWBgLJyxq","txrHrKC","A2v5CW","BvDUs0m","r3fQDKe","zKjRquW","BMCGzMfPBgu","y3vYC29Yx24","A1rVyKu","B2TRAhC","zgvSzxrLrge","DhjPBq","DLzus3q","B3nLrxzLBNq","y2f0y2G","zevOBg8","Cw91Ce0","shvnC04","zuvyyKq","C3jJ","uuHgrwS","zvbqrLa","C3Let2q","r3HnENi","AgvKtwf4uMu","DMfS","yxrLq291BNq","zMLN","nLjXCfzxsW","tfj2ueG","DNbWwxq","zMvY","rMroq1G","BgvY","qNDXChK","uhnOEum","zMzLCG","CMvHzhLtDge","CMvHC29U","BM5Ly3q","C3vIyxjYyxK","qwnrBK4","t3zjugW","yuLiB0u","sLnXuhO","nhWWFdn8nxW","x2rItMfTzq","yMLJr1m","DwXxzKm","C3bSAxq","t3LbEvm","rfbmveG","uhjUsfi","ruv2s0O","zwXRrNe","D0zxq20","nde2mdmWvuvRAgzo","u215Dee","uvj6vM4","BerlyMm","q2fjCvK","x2jPBMfYEvq","qMftuMy","yKL1Auq","De5mqKG","wxjXzMm","v2ffu0u","yxrHlcbKyxq","uwXxuxy","x0rctMfTzq","C2v0zgi","uLjKDve","tLzAv0m","Chn3D1m","C0jAqLm","thHxAwi","Cg93","uK53DNG","tKH4uMu","CMvZzxrfBMq","zw5JB2rPBMC","CK5Uv3u","zhDVzfG","z29HEge","A2X4Ahm","qMXKBuW","C1Ddr0G","B3jL","z2v0sxrLBq","uwnRuxe","CMvQzwn0","Aw5KzxGGB3u","Dg9iyxnO","CMjkEMW","whnirwu","yxvNsKG","zNjVBunOyxi","A1HlBfu","wLbZsMu","q0Pvqwe","yMLUyxj5","y25YqNK","ywXty29Wzq","Ew1xsfG","wxjMthK","x2LUAxq","C3fdEMS","CLHhAuq","tMTiquu","Bg9Nsurhzw4","suf1quW","m3WWFdr8mNW","EhvUCgm","t1P5EM8","Bwu6ia","ywrKq291BNq","Dg9tDhjPBMC","zMzorLK","r2f2qxG","Ahr0Chm6","u2LpzMC","zMnoBu8","CwnmCwO","qK5VEMu","zxjYtM8","A0XmAg8","zMDnq3e","z2vjBMzVu3K","CgnzsLq","qKHhBw0","tvPKsva","yM1xquC","sej5vxK","BMrLEa","r2vPB1O","yLrNtKi","Cw9Z","yM9L","sefNy0S","AhzYuuy","x29WDgLVBNm","EhfRqNG","x3bYzwzPEa","BNrbBMrvCgq","sM5zCw0","AM9PBG","zhDXAKu","ruTrCw4","ExPhAw0","wgDKse8","AKz0weG","wgf6yNm","v2vIu29JA2u","q3vZDg9Trxi","zg9Uzq","txPgrhO","wfPYzK8","sNHuCKe","BerSzuy","Ef9MCM9UDgK","yNLL","vefkDxy","C2vUzf9Hy2S","Efrurw52","mNW2Fdb8na","CuzrEge","C29Tzq","ENHuANu","vwLHwwe","v2TiAee","zeDIC2q","zwrPyxrLBhK","vhHNzNO","C3vIC3rYAw4","zxjFywnRx20","rMjXwuG","uvr6wLK","mNWWFdn8nNW","CwzTyvq","ChjVDg90Exa","vw5Oyw5KBgu","ywnOzwqSihC","Dg9mB3DLCKm","yLvLrvG","rffYA2q","y2vZC0HHBMq","AuXxBgC","A2PwD2G","Evf1Cgq","ugrhD0S","CwLTue8","EfPsEvG","vgrVruS","BxnN","yxGGCMv0CMK","v2vjsuu","v3vIz0C","ruXMCNK","uhjPBwfYEuS","v1HjDgu","zwLwA2e","EuvVuvC","ihn1y2nLC3m","ihjLy29UBMu","x3bPBMDmB3m","vfbtt24","yw1Lu3bHy2u","CgfNzwHPzgu","CMvZzxrdB3u","z2v0","uK1JqMe","yxDTzgi","yLndrhG","BxPnveq","Ahvsq3G","DxrVuMvJB24","y3jLyxrLrwW","vvnozui","x2LUAxrhBg8","zxrhANu","B25pCgvU","BwLZzq","D09NrKC","vgfN","CgfYC2u","rxjYB3jdB2q","x2DLDeLUDgu","y3jLyxrLt3a","CYbWyxjHBxm","y3vYCMO","DgHLBG","mhWXmhWZFdy","u3vZAgG","AgvHzgvY","zxj2AwnL","y09Wzw4","ihrPBwvVDxq","uKzKq3q","y3HLvvm","v25Swwu","r0fdzg0","yxnZAwDU","ywXS","uuzZDKK","u2vXsuq","Aw9UvgLTzw8","wujHwvK","zxjFDhrS","zMX1C2HfEha","AwrI","igzHAwWSig0","BLDPy0q","z3z3vuG","AKT6zvq","zhzbzK8","q1zbD1i","zenkrxa","x3DZsw5ZDge","s0PRqNK","ueDluM8","ANb1BMS","mdaWmdaWmda","B1vkC3i","EgXfAMe","BwfW","wg9Ttva","yxKSihrYEsa","EwXjrhu","CNzHBfzHBhu","q1HLA1q","vg1QANK","A2Pev0O","ywXPzcb1CMW","s0L1ywi","qLziyxa","AxnrB1nnzxm","ANHrrM8","yMrFzgLK","zxjYB3i","sNz4r2u","DNPkAha","DxjS","wuLvB3q","CMLLC0nVDw4","z2vwyvG","Bg9NsurozxC","zM9YrwfJAa","CMres0y","sNzIvM4","seXOCge","tu1Kv3O","tvLoy1i","uhLcy24","Egv0BNO","CurvqMi","ywnRx2LK","z3vgzMm","CMvXDwLYzwq","B25dBg9Zzq","EhjbrgK","zg1Zz3q","DKnIuMW","v01MC1e","tKfusvzfx0u","EvDRsM8","Dw5RBM93BIa","AfL2CKq","CMvHzhDYAxq","z2u6ia","mxWY","D1LqC0O","rxPiBfe","DurKBvu","BwvZC2fNztO","zxjHDg9Y","tevWtum","AxD6wfO","BMDuAw1LCG","y0DLuLe","rMvvs1q","x2n1CNnVCK0","B25ozxr3B3i","rNbOqKK","re1NzgW","uw5IzvK","z3L0wvG","B3v0sw50zxi","zMDUqw4","yNL0zu9MzNm","CM92AwrLigi","x2LUDgvYDMe","D1vdt1O","Bg9N","CfPJsxu","CLvVwxe","BhDouLq","zw50tgLZDgu","ufbKC04","id4G","zwnVBM5Ly3q","DLLICwe","z2v0q3vYCMu","qvHLrfi","DgvZDa","r3r5s3a","Bwv4wKi","EvrXtMS","rKrXseC","EvjhDeu","DfLNqLG","BKTxCM8","s0zqzwW","Bhb0rxa","zKXeAue","B3bLBKrc","BuPsC04","x3jLBw92zvC","q21JqMi","sKPMv1e","uuPZrui","y3vYDMfSDwu","zxq9DxrMltG","BNruCMLLC0m","DNjIDgi","tMr1A0G","qNjPzgDL","zhz1Dwm","tLnnAwy","nhWX","yvjQsMS","y2Xiuu0","suvtx0vsuK8","y3jLyxrLt2i","u3vACKi","yuDRqwu","zgLxAgW","yxfXvgW","Bhm6ia","yxHYv0q","BvDkCKG","qND6s0G","x2HHBMrSzu8","ignVzgu6ia","uvjWChu","Cg9PBNrdB24","qwLkzNe","y29UDgLUDwu","C2P2D2m","zxjFCw9Zx2e","tMXisNC","tvjvz2C","Aw9Ul2PZB24","C3nHz2vfDMu","CfrYtvK","y2HLy2Tszwe","yKP2v1G","qMX1CNe","Cgf5Bg9Hzeu","uerotvm","EMrjCe4","DhLWzq","q0DHywW","zffYqKe","AevYCM9Yrxy","yvnUu3e","CNL6vwS","B2LUDfjLywm","ihzHBgLKihm","AgfZ","rLLszvG","qMnez2O","y2Dmq1i","igfYCMf5yNu","B25fCNjVCG","vLLfBMe","BM50Eu8","rvrXzhu","Dw5KzwzPBMu","weHbEge","tg9Nsuq","twPTtNq","zNjVBNrPzxi","ELLYBLO","t0DMqxa","DuffuuK","t3n5B2m","BeL2wuS","vMfOyKm","zMLSzw5HBwu","DLnyCxG","DgPjDKe","ChrAr3y","B3DAAMq","t2jQzwn0","r2vfzMy","tMPlEMm","yKzozMq","vuvXwgu","tKDFrvjst1i","yuf3t0O","rLLYsK0","qwHPuhe","sLfHDLi","vNfnteS","rwP4vK8","BNrLCG","vLfJzeS","mZe1odi5nKDgsvPxBq","CgLUz09Uy2u","CMTLCKDSB2i","z05RyMK","AwjHvMm","y3vZDg9Tshq","vgT0Aum","ywnRx2nVzgu","BNrfBMrWB2K","txjTu0K","qvDqreK","rgvxu0y","CMvZzxruCMK","thnewwC","C2v0","q2vKzK0","q29UzMLN","vufWq1G","vxPACeS","x2nSzwfYvgK","ywDLrxzLBNq","wMvjzKG","C3rYAw5NAwy","wKXZwvC","Cgu6ia","sxLdteS","y0HdrKy","reiGzMfPBgu","AwXK","tM1dBvK","yNvMzMvYzwq","t1bftG","rNjVBNrPzxi","BxHJwLK","yvb5CKe","CMfTugfYyw0","zenvuhi","EuLPAgK","AxnszwfKEq","Aw5JBhvKzxm","CMvTB3zLq2G","AwzgAKi","C2vYDMvYvgK","y3vYCMvUDeK","AgvHzgvYCW","y3vYC29Yx2y","x3nLCuLK","DgnPDhu","ru5hwNe","tvnby2S","BMfQs0e","shDtsfa","qxPoC0W","yMTlqvO","CK93zg0","Dgv4Dc9WBge","twvZC2fNzuu","y3rxCuu","qxbgwMC","C0nVDw50zxi","zwniugq","CeL5AwO","CvboEM4","x2DLBMvYyxq","uxDRy3q","qKjxDvG","tgLZDgvUzxi","v3DyEwu","ANzvuw4","Dw50","yw1LoIa","CvHWs2m","y3rwr0u","twLZC2LUzYa","su5tvefova","y2uGBM90igK","B0HHAfq","r0npuwG","yuTqrxe","qwjQy2q","nNWWFdv8mxW","x3bPBMDqB24","u1LkrLC","DwnsC1m","l3DZl3yY","v2LUzg93","Aw1SseO","AxnAzxjV","ze5eBey","BwLUzW","zMzmAw5L","rg5SAK8","EK55CwG","rvjst1i","t0fxChO","y2XVC2u","u3vYC3q","uwresLO","x3bHDgHlzxK","DhjHBNnHy3q","DhDoze4","Cg9W","x2TLEvbHDgG","B3bLBG","zvvqBuS","y25ivuO","nJqYntGZovPXDM5kAG","ywDLsgLKzq","v3DrEem","rvbIBxO","DxbNCMfKzw4","C055Ag8","CMvWBgfJzui","rhHQyui","D0Dlz08","BMrWB2LUDfq","y3jLyxrLq2W","yu9Iu2m","CgLUz0LUDgu","B2XKvMvYC2K","y29UBMvJDca","qKXQAK8","BgrXtLi","y291BNq","rKLgBxu","AhHRr0O","wvjXzey","m3WYFdb8nhW","whnWAwy","CerysNa","AgfUz2u","yNzltNq","yxbWzw5Kq2G","qNLAz2u","qLzby1u","z2vtEw5J","zw5HyMXLuw8","C2vYDMLJzs0","A1bMBLi","z0rpt2G","uM9Kquu","ANrStxe","AwvmCKe","vgTcALK","yNvMzMvY","ExbL","uKTgD0O","pxv0zI04","qwDODKW","Axv2yLy","BMCGB3iGyw4","EhLhreK","te5TCxu","sxL0s0e","EhryCvm","BNLgqMG","qu1YDhG","v05MzMO","zhDmzha","tg9NsurozxC","z0f4twm","BvvUA2q","thnQtLC","qu5JDxa","CYbPBNn0yw4","quPVzKq","ywnRtxnNswq","igzPzwXKoIa","Ahr0Ca","v3f6u1u","DLjqwMe","x2LZsw5PDa","CgvYC2LZDgu","DMfSDwu","v2vPEgLUsLm","q3vZDg9Tq2W","tfjowhG","rhbbEuS","x2HHBMrSzva","CM92AwrLige","yw5Nzq","wffUyNa","AxnrB1nby2S","uxbVt0m","zgnPt3u","DgXnCMi","x2rLC3rYB3K","DhjWwue","BwvY","vLzWuu4","sg9twxu","rLfAD2C","EgnoyvG","y2XVC2veqG","mtb8nxW5","wKvTDxe","x25HDMLNyxq","zMzMzG","yuPUq0O","B25VCgvU","sNjJy2m","A2L1DxO","y1bJrue","zKzdr0G","sNnIvfO","BezSDxnO","DgXfDMu","DgHHBIbSB2m","D2fZq2XLyw4","y2XgtgG","vxbKyxrLq28","BwXAz0W","wKXRAxy","B25TzxnZywC","Cu9muuG","ywjVCNq","vxDuAgi","tfHfz0y","x21PBMLoyxy","B0zUyue","zxmGCMvHy2G","uwjuBhC","yw9xyMG","x2XPC3rLBMu","qufpDwe","C1HABeq","qvrmEg8","Bwf4uMv0CMK","mxW3FdH8nhW","mJa5nJa1nMT6u0Hxsa","EsbJBg9Zzwq","q2rdvMu","C09OBKq","rM1Ay1y","wNrswNq","ihrVihjLDhi","DLfPy1i","tMfIvM0","DKnWrfu","u1vuC2y","DfvhuwG","Aw5Lza","DgfIyxnL","DMvUDa","x2LZv29YA2u","x2LZqNjVD3m","s0fmtwK","zw5HyMXLvhi","y3vYC29YlNm","CNzxsuu","vMfxyNq","ChDmC0e","shbpywe","AMTmEhy","DhjPzxm","ChjVDg9JB2W","CNnVCKzPBgu","EKrnyLm","CKz4ufq","wgXsCLq","ywjuCwm","ywPdz0G","sMHQww0","qM10D3q","m0vRDhj5sW","B3bLBIa","y3r4","zLfrshe","CNnVCL92ywW","zgf0yq","Ew12Bw4","yxjYyxLIDwy","uw95weO","x2LZtwLUAvC","DMziD0i","EKnqrfe","u1zOsMG","q05JBwe","vvbeAxK","AKnmsxy","B2fK","A3LgA08","x2n1CNnVCK4","ExPvyK4","CgXLyxnLiha","x3nLBMrby2S","zLHnz3e","u3zhvuS","zgvMAw5Luhi","ueHoEfu","vuDRrMG","txbRzeO","r3zxq24","reLJy0W","CMfNzvn5BMm","BgLTAxq","B25nzxnZywC","AxnbCNjHEq","txjXzgy","x3fVC0rc","DeLdwLC","x2rYB3bhBg8","AgLNAa","tvbhu2S","Awfnrha","yMLeAfK","tMzyAxG","tfLVrhe","uw1gseq","wxfxu3C","AxnFywnR","ChbL","z2v0q3vYC28","vxbWq2y","CvHisKy","C1rhtgy","u2HHCMvKv28","EeLkv1K","Dgv4DfbHEwW","BNvTyMvY","C2v0u3rVCMe","EMnvuKy","AeHuCLa","ENzRsvu","wgnVueO","zejgu1y","vvr4zgm","u2PMugq","AKHTq0u","DvneCxK","Chv0","ywXSzwqGBxu","Bwf4twvZC2e","veDqCfm","C3rLBMvYCW","BMvY","DvLrywK","rM1jtgO","BKXPBMu","zv9ZDwnJzxm","wxnYC0C","aaaaaaaaaaa","AKrZqNa","A3HODhi","rgv0ree","yxbWBhK","te14zMi","BNbeB1O","Aw5N","z0r6B3K","zNjHBwvuExa","r2vLv2u","BhrPCgXLihq","D2z2vxO","sNvirKm","yMPLDw8","DxLOvve","x3bPBMC","u0XTuuK","AefJA01LC3m","ndq2mZiYnxPMswPwwa","AwDHDg9Yt24","DMLJzuLeig8","BLbyrNu","ueP4ANm","u0jzy2e","vgnxtKe","D3nZoI8V","vgXJtfC","B3bLCNr5","qxHZCei","ANjuv2K","EhLmA1m","zxjFAxnFywm","ANDqqwO","C0XPC3rLBMu","CYbHBhjLywq","EujWzem","Dhj2rfO","BLLtzhC","qu5suwC","zw5KCg9PBNq","sLP1CNK","A2v0ignVBNm","AenSB3nLrxy","ihrYEsbYzwm","ExHry08","x2n1CNnVCKy","De1lthi","zgrjrcWGzgu","sNzuyMu","q0vis1e","B25Uzwn0Aw4","rMD2sxC","z1Ptq3G","zcWGDw5RBM8","uxvwzKG","yKzez2S","B2Dbwu0","lcbTyxGGCMu","Bfz5Dfy","z3nhAgO","EgfLrhC","z2DryM4","D3jPDgvvAw4","C2fNzq","EeLkBM0","vvfgDgq","yKnIyva","x194x21Zz18","B25SAw5L","vw5PBxbSzw0","tg9JAW","uMvHzcbWyxm","Aw5PDcbrB1m","x29UugfNzu4","EKXUuKO","Eenrwuu","sLrtA3u","rfrYtLq","y3ruAw1LB3u","CM5rvu8","zNDZxZeUmc4","vvjgr1O","x2nVBM5Ly3q","Dw5ZAwDUzwq","zMLUza","quPIAwm","AxjvEwS","zejYCLu","zKLXveC","y29TCgXLDgu","s0LyB1a","zM15q3C","DgvmB2Djre4","y3rtsve","sxjwEeC","q2nlCfe","ywX3yxLZ","tKXqzwy","sLnptLa","Ec1TC2CTCw8","qNzmELG","EKv6vMK","BgLZDgvUtMu","C2v0sxrLBq","D24GCMvHC28","vNfssvy","rwjWzgC","r29iDM4","Bfjry00","A0vnDgm","BM93","CgzXDee","DhbizwfKzxi","ywDLu2HVDW","zvvdz0K","teXVsLy","yNL0zuXLBMC","zgvSzxrL","z1rPBwvVDxq","yNL0zxm","o2nOyxjZzxq","zNjVBuj5Dgu","vNvUr3u","q29LD1u","CMvHzfvjBNq","ENvXBvi","z2P5s3G","vxz1tu4","Bhros1u","De5bDhu","D3DzEvi","t2LisLy","swHJzue","DffVtvC","CvvQyLC","Dev2zw50","y3rqu2W","zeHiwu4","wfrjug0","EMjYtKG","DeLUDgvYy2u","CgLUz19VBMm","rNjhDha","Dg9oDw1Izxi","x21LC3nHz2u","zMHHqMi","tg1vs20","ufbpwhG","CMvZB2X2zq","rNHjDuW","y2HLy2TdDxi"];return gn=function(){return r},gn()}function ax(){return Qs||(Qs=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function xx(){let r=S;return $s||($s=[IDBCursor[r(934)+"e"][r(461)],IDBCursor[r(934)+"e"][r(1141)],IDBCursor.prototype[r(1141)+r(953)+"ey"]])}function cx(r){let e=S,o={IytKA:function(x,f){return x(f)},KGTqh:"success",goaxa:function(x){return x()},GVdCS:e(1033),UFdbf:function(x,f){return x instanceof f}},a=new Promise((x,f)=>{let d=e,g={EjsPj:o[d(729)],klDCG:function(y){return o[d(838)](y)}},p=()=>{let y=d;r[y(1710)+y(1091)+"ner"](g.EjsPj,_),r["removeEv"+y(1091)+y(1537)]("error",w)},_=()=>{let y=d;x(o[y(1355)](Ce,r[y(603)])),p()},w=()=>{let y=d;f(r.error),g[y(654)](p)};r[d(672)+d(1268)](o.KGTqh,_),r[d(672)+d(1268)](o[d(506)],w)});return a[e(985)](x=>{let f=e;o.UFdbf(x,IDBCursor)&&dr[f(1216)](x,r)})[e(769)](()=>{}),mn[e(1216)](a,r),a}function fx(r){let e=S,o={ulbSO:e(1033),cxeUS:e(1417),nQgPv:function(x){return x()},mTdKx:function(x,f){return x===f},aSnSq:e(1695),cMIsh:function(x,f){return x(f)},Crjfl:"AbortError"};if(pn[e(1163)](r))return;let a=new Promise((x,f)=>{let d=e,g=()=>{let w=k;r["removeEv"+w(1091)+w(1537)]("complete",p),r[w(1710)+w(1091)+w(1537)](o.ulbSO,_),r[w(1710)+w(1091)+w(1537)](o[w(993)],_)},p=()=>{o.nQgPv(x),o.nQgPv(g)},_=()=>{let w=k;if(o[w(1792)](o[w(1159)],o[w(1159)]))o.cMIsh(f,r.error||new DOMException("AbortError",o[w(658)])),o.nQgPv(g);else return _0x710fdc[w(645)]||_0x20f8bf[w(879)]?("message: "+(_0x5b48b3[w(645)]||"")+w(1137)+(_0x55f18b[w(879)]||""))[w(766)]():_0x15aa5c[w(1224)+"y"](_0x1165ff)};r["addEvent"+d(1268)](d(1633),p),r["addEvent"+d(1268)](o[d(496)],_),r["addEvent"+d(1268)](d(1417),_)});pn[e(1216)](r,a)}function ux(r){_n={oHahT:function(a,x){return a(x)}}[S(1278)](r,_n)}function dx(r){let e=S,o={abTqc:function(a,x){return a(x)},ksYNB:function(a,x){return a instanceof x},vXNsG:function(a,x){return a instanceof x},KSiuO:"none_none",oEGIa:e(855),JannF:function(a,x){return a===x},BaSRf:e(650),GJBOS:"RmAGS",yQitJ:function(a,x){return a(x)},JQIkh:function(a,x){return a!=x},KWUVK:e(1908),dNDlF:function(a,x){return a instanceof x},EKQqn:function(a,x){return a!=x},yzGim:e(755)+e(1146),nnLBH:e(972),VafFx:function(a,x){return a===x},lFPDZ:"objectSt"+e(1872),FdNCX:function(a,x){return a===x},uDYrM:e(1862),vroED:function(a){return a()}};if(o.VafFx(r,IDBDatabase.prototype[e(1301)+"ion"])&&!(o.lFPDZ in IDBTransaction[e(934)+"e"])){if(o[e(787)](o[e(733)],o[e(733)]))return function(a,...x){let f=e,d=r[f(683)](o[f(1462)](Dt,this),a,...x);return ur.set(d,a.sort?a[f(380)]():[a]),o[f(1462)](Ce,d)};_0x1d2f06&&this[e(1075)+"anager"]["updateCu"+e(1458)+e(389)](_0x28f7c2)}return o.vroED(xx)[e(1241)](r)?function(...a){let x=e,f={AAOua:function(d,g){return o.ksYNB(d,g)},pcYJT:function(d,g){return o[k(1807)](d,g)},GXXac:"applicat"+x(1146)+x(1664)+x(1349),YCKRo:"string",xunpc:o[x(442)],TPBQW:o[x(488)],mzMTD:function(d,g,p,_){return d(g,p,_)}};if(o.JannF(o[x(817)],o.GJBOS))if(f[x(1426)](_0x3b7893[x(470)],_0x37c8af)){let d=f[x(883)](this._options[x(1152)+x(1746)],_0x354865)?{force:!!this[x(895)][x(1152)+x(1746)][x(419)],encoding:this[x(895)][x(1152)+x(1746)][x(835)]?this[x(895)][x(1152)+x(1746)].encoding[x(743)](/\s/g,"")[x(937)+x(475)]():""}:{force:!1,encoding:this[x(895)][x(1152)+x(1746)]?this._options[x(1152)+x(1746)][x(743)](/\s/g,"")["toLowerC"+x(475)]():""},g=_0xdd60c6[x(1152)+x(1746)]?_0x2e38d4[x(1152)+x(1746)].replace(/\s/g,"")[x(937)+x(475)]():"",p=f[x(883)](this[x(895)][x(696)+"ype"],_0x30976c)?{force:!!this[x(895)].payloadType[x(419)],type:this[x(895)][x(696)+x(1347)].type?this._options[x(696)+x(1347)].type[x(743)](/\s/g,"")["toLowerC"+x(475)]():""}:{force:!1,type:this[x(895)][x(696)+x(1347)]?this._options[x(696)+"ype"][x(743)](/\s/g,"")[x(937)+x(475)]():""},_=_0x4764fc[x(696)+x(1347)]?_0x5ea937.payloadType[x(743)](/\s/g,"")[x(937)+"ase"]():"",w=p[x(419)]?p[x(1155)]:_||p[x(1155)],y=d[x(419)]?d[x(835)]:g||d[x(835)],A=["text/pla"+x(464)+"et=utf-8","applicat"+x(1146),f.GXXac,f[x(432)]],T=[f[x(867)],f.TPBQW];this[x(895)][x(1449)+"ansformT"+x(675)+"ad"]&&A[x(1241)](w)&&(!y||T.includes(y))?_0x47e428[x(1520)+x(1482)]=f[x(968)](_0x26346d,_0x67c15e[x(470)],0,_0x58e6c9[x(470)][x(1660)+"th"]):_0x107279.textPayload=""}else _0x5ed50a[x(1520)+"oad"]="";else return r[x(1547)](o[x(1462)](Dt,this),a),o[x(529)](Ce,dr[x(964)](this))}:function(...a){let x=e;return o[x(323)](x(972),o[x(1892)])?o.abTqc(Ce,r[x(1547)](Dt(this),a)):o[x(545)](o.KWUVK,typeof _0x26fad3)&&(_0x240a28 instanceof _0x2f717d||_0x505904[x(1346)]&&o[x(1290)](_0x164347[x(1346)],_0x4bb469))||o[x(902)]("string",typeof _0x20605b)?"":(_0x4bad37[x(979)](_0x5c457a),o[x(903)])}}function lx(r){let e=S,o={ZwlSo:function(a,x){return a===x},cJjpJ:function(a,x){return a instanceof x},huRCx:function(a,x,f){return a(x,f)}};return o[e(569)](typeof r,e(1883))?dx(r):(o[e(1749)](r,IDBTransaction)&&fx(r),o[e(969)](ri,r,ax())?new Proxy(r,_n):r)}function Ce(r){let e=S,o={JoRmg:function(x,f){return x(f)},ctVGE:function(x,f){return x!==f}};if(r instanceof IDBRequest)return o.JoRmg(cx,r);if(ln[e(1163)](r))return ln[e(964)](r);let a=lx(r);return o[e(1274)](a,r)&&(ln[e(1216)](r,a),mn[e(1216)](a,r)),a}var ri,Qs,$s,dr,pn,ur,ln,mn,_n,Dt,Zs=ni({"node_modules/idb/build/wrap-idb-value.js"(){let r=S,e={kxcwC:"wss://",KQcMZ:function(o,a){return o instanceof a},RTvZY:r(909),rdDKF:function(o,a){return o===a},xaeDw:r(371)+"oreNames",ZtRZt:r(651),REvoc:function(o,a){return o(a)},wfvUz:function(o,a){return o instanceof a},lYNfJ:r(1902),mjNgO:function(o,a){return o in a}};ri=(o,a)=>a[r(921)](x=>o instanceof x),dr=new WeakMap,pn=new WeakMap,ur=new WeakMap,ln=new WeakMap,mn=new WeakMap,_n={get(o,a,x){let f=r,d={pTuUp:function(g,p){return g==p},bGCWH:f(874),zYrnZ:e[f(542)],eLRbK:f(483)};if(e.KQcMZ(o,IDBTransaction)){if(a===e[f(1702)])return pn[f(964)](o);if(e[f(1042)](a,e[f(1604)]))return o[f(371)+f(1872)]||ur[f(964)](o);if(e[f(1042)](a,"store")){if(e[f(1042)](e[f(1436)],e[f(1436)]))return x[f(371)+f(1872)][1]?void 0:x[f(371)+f(842)](x[f(371)+f(1872)][0]);_0x436d2c=_0x5b5910&&d[f(1760)](d.bGCWH,_0x11de00[f(1457)])?d[f(1177)]:d[f(1877)],_0x38b551=_0x87bcd2[f(743)](/((^ws)|(^http))((?:[s]*:\/\/))/,""),_0x18e057=/^wss(.*:\/\/)/[f(1098)](_0x53c4f9)?_0xef1b29:""+_0x1ebf03+_0x9fa158}}return e[f(1703)](Ce,o[a])},set(o,a,x){return o[a]=x,!0},has(o,a){let x=r;return e[x(1555)](o,IDBTransaction)&&(a===e[x(1702)]||a===e.lYNfJ)?!0:e[x(468)](a,o)}},Dt=o=>mn[r(964)](o)}}),si={};ox(si,{deleteDB:()=>gx,openDB:()=>hx,unwrap:()=>Dt,wrap:()=>Ce});function hx(r,e,{blocked:o,upgrade:a,blocking:x,terminated:f}={}){let d=S,g={hwKsv:function(w,y){return w(y)},ecHPd:"close",KALMi:"versionc"+d(1332),OEjhh:d(1312)+d(553),ZIzYj:d(536)},p=indexedDB[d(1305)](r,e),_=Ce(p);return a&&p[d(672)+d(1268)](g.OEjhh,w=>{let y=d;a(g.hwKsv(Ce,p[y(603)]),w[y(1321)+"on"],w[y(1755)+"on"],g[y(1754)](Ce,p["transact"+y(459)]))}),o&&p[d(672)+d(1268)](g.ZIzYj,()=>o()),_[d(985)](w=>{let y=d;f&&w[y(672)+y(1268)](g[y(1262)],()=>f()),x&&w[y(672)+y(1268)](g[y(1448)],()=>x())})[d(769)](()=>{}),_}function gx(r,{blocked:e}={}){let o=S,a=indexedDB[o(765)+o(1444)](r);return e&&a[o(672)+o(1268)](o(536),()=>e()),Ce(a)[o(985)](()=>{})}function ei(r,e){let o=S,a={MucLU:o(405),LsjNW:o(1062)+"e",CcKpQ:"readonly",iJeol:o(1908),eiVka:function(p,_){return p!==_},LRvPH:function(p,_){return p in _}};if(!(r instanceof IDBDatabase&&!(e in r)&&typeof e===a[o(364)]))return;if(hn[o(964)](e))return hn[o(964)](e);let x=e[o(743)](/FromIndex$/,""),f=a[o(955)](e,x),d=oi[o(1241)](x);if(!a[o(784)](x,(f?IDBIndex:IDBObjectStore)[o(934)+"e"])||!(d||ii[o(1241)](x)))return;let g=async function(p,..._){let w=o;if(a[w(1721)]===a[w(1721)]){let y=this[w(1301)+w(459)](p,d?a[w(1364)]:a[w(1639)]),A=y[w(1902)];return f&&(A=A.index(_.shift())),(await Promise[w(997)]([A[x](..._),d&&y.done]))[0]}else{let y=_0x3250c2[w(928)+"g"](0,4-_0x616653[_0x15f7e7][w(398)]),A=y[w(1824)](_0x4164ca[_0x329d4c]);_0xc12014[w(358)](A)}};return hn[o(1216)](e,g),g}var ii,oi,hn,px=ni({"node_modules/idb/build/index.js"(){let r=S,e={ANcup:function(o){return o()},CnhOd:function(o){return o()},bIuiD:r(964),VyQli:r(1893),clHQM:r(1779),Sushh:r(1325)};e[r(1365)](Zs),e[r(692)](Zs),ii=[e[r(818)],e.VyQli,e[r(1125)],"getAllKeys",e[r(987)]],oi=[r(1532),"add",r(1661),r(679)],hn=new Map,ux(o=>({...o,get:(a,x,f)=>ei(a,x)||o[r(964)](a,x,f),has:(a,x)=>!!ei(a,x)||o[r(1163)](a,x)}))}}),mx={idb:function(r){let e=S,o={TlcLW:function(a,x){return a&x},llRtB:function(a,x){return a+x},ylIDu:function(a,x){return a===x},MRTQS:e(1598)};r.exports=Promise[e(1692)]().then(()=>(px(),si))[e(985)](function(a){let x=e;return o[x(1022)](o[x(1748)],"QuVfH")?a:(_0x154676[x(1606)+"t8"]?_0x417f29[x(1606)+"t8"](_0xea231a,_0x298da6):_0x24e3ea[_0x1f4f95]=o[x(1570)](255,_0x1aebe6),o[x(324)](_0x217176,1))})}},ti={};function Se(r){let e=S,o={nCDqy:function(f,d){return f!==d}};var a=ti[r];if(o[e(1909)](void 0,a))return a.exports;var x=ti[r]={exports:{}};return mx[r](x,x[e(725)],Se),x[e(725)]}Se.d=(r,e)=>{let o=k;for(var a in e)Se.o(e,a)&&!Se.o(r,a)&&Object[o(1490)+o(1571)](r,a,{enumerable:!0,get:e[a]})},(()=>{let r=S;Se.o=(e,o)=>Object[r(934)+"e"][r(1791)+r(1571)].call(e,o)})(),(()=>{let r=S,e={hYvrD:r(933),nDmGe:function(o,a){return o!=a},vrbtb:r(1172)+"d",zDMbS:r(355),gZSCx:r(601)+"le"};Se.r=o=>{let a=r;a(1079)===e[a(1061)]?Y._cursorFileName=_0x41937c:(e.nDmGe(e[a(1118)],typeof Symbol)&&Symbol[a(871)+a(978)]&&Object[a(1490)+"operty"](o,Symbol[a(871)+a(978)],{value:e[a(1459)]}),Object[a(1490)+a(1571)](o,e[a(1596)],{value:!0}))}})();function k(r,e){r=r-323;let o=gn(),a=o[r];if(k.ojjJXg===void 0){var x=function(p){let _="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=",w="",y="";for(let A=0,T,N,R=0;N=p.charAt(R++);~N&&(T=A%4?T*64+N:N,A++%4)?w+=String.fromCharCode(255&T>>(-2*A&6)):0)N=_.indexOf(N);for(let A=0,T=w.length;A<T;A++)y+="%"+("00"+w.charCodeAt(A).toString(16)).slice(-2);return decodeURIComponent(y)};k.kFLLOb=x,k.aIsoIS={},k.ojjJXg=!0}let f=o[0],d=r+f,g=k.aIsoIS[d];return g?a=g:(a=k.kFLLOb(a),k.aIsoIS[d]=a),a}var V={};(()=>{let r=S,e={vCbRl:function(s,t){return s(t)},IZahF:function(s,t){return s+t},RKFwJ:function(s,t){return s+t},tDhBn:function(s,t){return s+t},fDwfz:function(s,t){return s+t},NFMNT:function(s,t){return s*t},PPOXx:function(s,t){return s*t},XsHEe:function(s,t){return s+t},GtyKp:function(s,t,n){return s(t,n)},PhZuj:function(s,t){return s===t},uLmMQ:r(808),TAJuv:function(s,t){return s(t)},MYNcR:function(s,t){return s(t)},UiaYa:function(s,t){return s+t},HYeIB:function(s,t){return s(t)},NMavs:"0000",lRQcM:r(1399),XQcmL:function(s,t){return s!==t},HnmHb:r(1035),HoMJb:function(s,t){return s(t)},KCVwL:function(s,t,n){return s(t,n)},etGju:r(1685)+"e_success",FgvIw:r(1685)+r(673)+"t",gZxsk:"NATIVE_E"+r(441),QFsvI:r(1796)+r(1193),okkhw:r(1839)+"IES_ERROR",GeeWe:"OPEN_ERROR",IhceA:r(534)+r(1295),MRUgg:"timeout",lpCfY:function(s,t){return s>t},KyIqX:function(s,t){return s<t},PshyC:function(s,t){return s!==t},zNyqh:r(1560),Surst:function(s,t){return s<t},uhNHo:function(s,t){return s-t},pEcXP:function(s,t){return s!==t},kYOqf:r(610),XmkEi:r(1896),rmvAH:function(s,t){return s-t},hxkGJ:function(s,t){return s-t},cFXFq:function(s,t){return s<t},LYoDq:function(s,t){return s===t},MtaFG:r(414),yxQcO:function(s,t){return s<t},iaMDp:function(s,t){return s!==t},XlRrT:function(s,t,n){return s(t,n)},clFLh:function(s,t){return s!==t},CoewU:function(s,t){return s>>>t},JTSku:function(s,t,n){return s(t,n)},MPZZy:function(s,t){return s(t)},PdGwK:function(s,t,n){return s(t,n)},fcNmO:function(s,t){return s(t)},YRqdF:function(s,t,n){return s(t,n)},egFEC:function(s,t){return s&t},NIzyC:function(s,t){return s===t},mFUDh:"Missing "+r(1052)+r(1369)+r(1375),pcuWV:function(s){return s()},bUTnn:function(s,t,n){return s(t,n)},FbqYH:r(1297),cUJqW:r(915),OjDGz:function(s,t){return s<<t},FYrJM:function(s,t){return s&t},KJkBy:function(s,t){return s<<t},JQavR:function(s,t,n){return s(t,n)},etqQR:r(547),QJsEB:r(1219),Ebpdg:function(s,t,n){return s(t,n)},WkHhA:function(s,t,n){return s(t,n)},hBhfg:function(s,t){return s!==t},xKADW:r(1184),FCwNp:function(s,t,n){return s(t,n)},jEFFg:function(s,t,n){return s(t,n)},JLTMl:function(s,t,n){return s(t,n)},VqMLK:function(s,t,n){return s(t,n)},FmILj:"fsHga",LxWib:function(s,t,n){return s(t,n)},LmUKm:function(s,t){return s!==t},eBZGJ:function(s,t,n){return s(t,n)},sWUxP:function(s,t){return s!==t},kfkFq:function(s,t){return s(t)},QIaVU:function(s,t){return s(t)},JdEvb:function(s,t){return s(t)},LvYEV:function(s,t){return s(t)},xcNaX:function(s,t){return s(t)},uTCNF:function(s,t){return s(t)},RbAPU:function(s,t,n){return s(t,n)},qoupM:function(s,t){return s(t)},eXKut:function(s,t,n){return s(t,n)},WNffj:"Missing "+r(1052)+r(1369)+r(999),iLWlg:function(s,t){return s===t},BcDgj:"Missing "+r(1052)+r(1369)+"LogID",yBpdC:"Missing required field: service",GvWCn:function(s,t){return s===t},PGKRo:r(1275)+"required"+r(1369)+r(720),OAWpz:function(s,t){return s>=t},FWRjc:"usCeq",nzZox:function(s,t){return s(t)},wMJQc:function(s,t){return s&t},nvPqX:function(s,t,n){return s(t,n)},bCXeu:function(s,t){return s(t)},IAVzX:function(s,t){return s+t},gshCn:r(1613)+r(716)+r(1226),SVhJh:function(s,t){return s>=t},jDsBp:r(718),ujZZf:"Skip pas"+r(456),sDUwJ:function(s,t){return s>=t},SUKtn:r(910),RAtjl:r(1825),bFNfd:function(s,t){return s+t},gDOrB:function(s,t){return s*t},aKPEq:function(s,t){return s>t},OlFtm:function(s,t){return s>t},PbLar:function(s,t){return s+t},bmWAG:r(1615)+r(456),DkSBh:function(s,t){return s+t},FYReX:function(s,t,n,i){return s(t,n,i)},xqkBx:function(s,t){return s<t},mJhgj:function(s,t){return s&t},Bwqpy:function(s,t){return s(t)},RmXEf:function(s,t){return s+t},mwsNR:function(s,t){return s!==t},ZPsJe:r(1315),ZeIfH:r(1548),XKdiR:function(s,t){return s+t},hHTrP:function(s,t){return s!==t},SuZrB:function(s,t){return s&t},OGzsa:function(s,t){return s|t},AzNsL:function(s,t){return s!==t},NmCmY:function(s,t){return s==t},NfXix:function(s,t){return s+t},HkrcZ:function(s,t){return s+t},lyMQA:function(s,t){return s+t},aqqTl:function(s,t){return s&t},Txgfz:function(s,t){return s|t},pIyij:function(s,t){return s!==t},SDWso:r(1170),mxcZY:function(s,t){return s|t},buSyb:function(s,t){return s<<t},TYFFC:function(s,t){return s<=t},ASBMm:function(s,t){return s(t)},LEpMC:function(s,t){return s+t},LRNXx:"lUtcg",hLiNC:function(s,t){return s+t},uAEQI:function(s,t){return s!==t},wFWCm:function(s,t){return s|t},tNAtu:function(s,t){return s|t},OZyzo:function(s,t){return s===t},eLwyW:r(693),Srnoz:function(s,t){return s|t},UNJIT:function(s,t){return s<<t},KIuab:function(s,t){return s&t},XcoPJ:function(s,t){return s&t},kEMtc:function(s,t){return s>t},jwMLO:function(s,t,n){return s(t,n)},ZBRIg:function(s,t){return s>>t},Dcibz:function(s,t){return s+t},RRduQ:function(s,t){return s&t},JSEPq:function(s,t){return s<t},iQkRy:function(s,t){return s+t},URFGZ:function(s,t){return s+t},jvUQn:function(s,t){return s<<t},tuijP:function(s,t){return s<t},ePPFP:function(s,t){return s<t},uDdmU:function(s,t){return s>=t},mTnfT:function(s,t){return s<=t},YplBc:function(s,t){return s+t},wUCOZ:function(s,t){return s<<t},pwLsA:function(s,t){return s<t},WQbXM:function(s,t){return s<t},JycZi:function(s,t){return s>>t},TktiC:function(s,t){return s&t},kQLfG:function(s,t){return s>>t},uYQai:function(s,t){return s|t},TkBjY:function(s,t){return s>>t},FAEdw:function(s,t){return s&t},pvpzn:function(s,t){return s>>t},zbugm:function(s,t){return s|t},znKWJ:function(s,t){return s&t},CGaal:function(s,t,n){return s(t,n)},UGkFh:function(s,t,n){return s(t,n)},XomMP:function(s,t){return s<<t},PoUJS:function(s,t){return s&t},fFCGH:r(1725),RaqOz:function(s,t){return s>=t},YrfLy:function(s,t,n){return s(t,n)},currj:r(1033),ywDbN:function(s,t){return s(t)},YqWSw:function(s,t){return s&t},aCFHe:r(1704),lnOto:r(1421),ffNFY:function(s,t){return s&t},ejMxc:function(s,t){return s&t},xjkRc:function(s,t){return s(t)},QTzZY:function(s,t){return s(t)},wvtKI:function(s,t){return s<<t},XpZPF:function(s,t){return s&t},Msnhr:function(s,t){return s&t},WqzSU:function(s,t){return s&t},HByUy:function(s,t){return s(t)},Izdwd:function(s,t){return s<<t},dQrBA:function(s,t){return s&t},tVeHc:function(s,t){return s|t},RSrXP:function(s,t){return s|t},Anrwn:function(s,t){return s>>>t},bzqPe:function(s,t){return s<<t},BldmL:function(s,t){return s>>>t},apNmq:function(s,t){return s>>>t},TMsAJ:function(s,t){return s>>>t},lDKbc:function(s,t){return s<t},JsbTZ:function(s,t){return s<t},tUGQh:function(s,t){return s<t},FvUgo:function(s,t){return s<t},GOOwA:function(s,t){return s+t},GavAx:function(s,t){return s&t},PDNMS:function(s,t){return s!==t},ViGJH:function(s,t){return s&t},SjfPd:function(s,t){return s!==t},BLjjO:function(s,t){return s|t},uDkDn:function(s,t){return s|t},FLhVq:function(s,t){return s>>>t},gDzoy:function(s,t){return s>>>t},HuMsN:function(s,t){return s|t},qNTpU:function(s,t){return s>>>t},Yrqfc:function(s,t){return s>>>t},WXIte:function(s,t){return s>>>t},EToJI:function(s,t){return s!==t},wYPsJ:function(s,t){return s|t},fjVwr:function(s,t){return s(t)},trpYA:function(s,t){return s===t},RAiVd:"ZLkiv",BwzKH:r(355),QXXXm:r(601)+"le",CmcBb:function(s,t){return s===t},XHAxa:r(649),AcYZt:r(1082),pZcIu:function(s,t){return s|t},QRzVn:function(s,t){return s<<t},xCQYE:function(s,t){return s|t},QoyXJ:function(s,t){return s<<t},ZwTVG:function(s,t){return s|t},QLRZB:function(s,t){return s<<t},zAVKO:function(s,t){return s<<t},zerNS:function(s,t){return s<<t},lDleF:function(s,t){return s<<t},FmZcV:function(s,t){return s|t},UPDiy:function(s,t){return s|t},JvdhO:function(s,t){return s|t},ZWIqv:function(s,t){return s<<t},kfevH:function(s,t){return s&t},ajCgH:function(s,t){return s&t},BYfAb:function(s,t){return s>>>t},lptEp:function(s,t){return s(t)},MjzFI:function(s,t){return s>=t},AghvL:function(s,t){return s>=t},bkKAZ:function(s,t){return s%t},Qupyz:function(s,t){return s|t},QwjKG:function(s,t){return s/t},xcblt:function(s,t){return s*t},NNjgg:function(s,t){return s&t},KJiVJ:function(s,t){return s&t},GxMzr:function(s,t){return s>>>t},FlSwf:function(s,t){return s&t},lIvYK:function(s,t){return s>>>t},TUKbr:function(s,t){return s>>>t},YVeTH:r(1302),AnTBe:r(742),FxIuL:function(s,t){return s>>>t},fDMMV:function(s,t){return s&t},LLoJV:function(s,t){return s&t},IJiqo:function(s,t){return s>>>t},NZcHG:function(s,t){return s|t},Abjcd:function(s,t){return s===t},gvwUH:function(s,t){return s===t},coDEA:function(s,t){return s+t},FEvbh:function(s,t){return s>>>t},XZrfO:function(s,t){return s&t},WaESE:function(s,t){return s>>>t},nYSdw:function(s,t){return s&t},jHmCE:function(s,t){return s&t},swVHq:function(s,t){return s>>t},DetDA:function(s,t){return s&t},gOlBF:function(s,t){return s!==t},sjvwc:"mzHwq",JxTrA:r(1528),iyEFr:r(1329)+"1",FQZwg:function(s,t,n){return s(t,n)},bTgNB:r(1166),rUoYq:r(802),MjmNt:r(1827),NjKzc:r(1718),aIHoE:r(1358),pbzyM:r(1418),DMgdl:r(625),GDqPD:r(1199),YlrOf:function(s,t,n){return s(t,n)},DIccL:r(1452),KbJsS:function(s,t){return s|t},YIUot:function(s,t){return s<<t},dYbuH:function(s,t){return s+t},UcAUp:function(s,t){return s<<t},tNLBH:function(s,t){return s+t},moZkZ:function(s,t){return s<<t},dwqjE:function(s,t){return s+t},nyFBh:function(s,t){return s+t},vQicR:function(s,t){return s<<t},aGkAe:function(s,t){return s+t},sXZlD:r(487),ONUfD:r(1228),aRjJk:r(1215),bsCUA:r(775),WubgG:function(s,t){return s===t},JemeW:function(s,t){return s!==t},qpSon:r(369),KYOfA:function(s,t){return s instanceof t},DnljO:r(935)+r(566),nreul:function(s,t){return s|t},excJi:function(s,t){return s===t},QLQpB:function(s,t){return s&t},ifFjB:function(s,t){return s&t},QTIGA:function(s,t){return s|t},AvHfv:function(s,t){return s&t},Blurq:"ejbOc",DQrkd:function(s,t){return s===t},gPzNM:r(1354),xJUFp:function(s,t){return s===t},lTezq:r(469),jtlMq:function(s,t){return s!==t},FDOQY:r(925),FDqHG:function(s,t,n){return s(t,n)},JvbVn:function(s,t,n){return s(t,n)},ApFZg:r(1397),dDLsa:r(1797),xlEja:r(1305),ZDJdb:function(s,t,n){return s(t,n)},cGeRQ:r(942),QiMSP:r(1632),XTIPm:r(1356),wwYyR:r(1372),dciOu:function(s,t){return s||t},ctSIQ:function(s,t){return s!=t},NwrNR:r(932)+r(1430)+r(1396),heGrj:function(s,t,n,i){return s(t,n,i)},CdCVe:r(512),BvLzX:r(1450)+r(989),URRTb:r(988),QKWvq:function(s,t,n,i){return s(t,n,i)},yRGtE:function(s,t,n,i){return s(t,n,i)},crnip:r(1339)+r(514),qnrWS:r(1115),LBNId:"name",anVEF:function(s,t){return s===t},yEzCf:r(1160),KFPel:r(1733)+"3",nKWro:function(s,t){return s!=t},mgBuY:r(1172)+"d",kTPdd:function(s,t){return s<=t},KIXoP:r(1707)+r(1533)+r(1554)+r(1812)+r(415),RmWwU:function(s,t){return s+t},cgyYz:function(s,t){return s(t)},mWJrH:function(s,t){return s(t)},vYbqa:function(s,t,n){return s(t,n)},xyGDI:function(s,t){return s<t},aAwOJ:function(s,t){return s<t},gDOOh:function(s,t){return s&t},SvGUK:r(767),kyFkO:function(s,t){return s<t},jzGVQ:function(s,t){return s<t},CsUTP:function(s,t){return s<=t},fqfLd:function(s,t){return s<<t},aJnCJ:function(s,t){return s&t},dEhlo:function(s,t){return s&t},XgeXX:function(s,t){return s-t},yIihi:function(s,t){return s&t},QHkuU:function(s,t){return s&t},AxRZk:function(s,t){return s+t},srhlb:r(839),zbrNH:function(s,t){return s<t},imlHJ:function(s,t){return s===t},ogAYM:"qTLba",QYfdd:function(s,t){return s>>t},jpunk:function(s,t){return s|t},qXpKc:function(s,t){return s&t},MrmSI:function(s,t){return s&t},xIJWY:function(s,t){return s+t},keUSz:r(1859)+"1|3",jCLIv:function(s,t){return s&t},GeioZ:function(s,t){return s>>t},Jrccc:function(s,t){return s|t},tAzFa:function(s,t){return s>>t},TkEyb:function(s,t){return s&t},syDOd:function(s,t){return s|t},ucRsS:function(s,t){return s>>t},YmKNK:function(s,t){return s&t},GeEff:function(s,t){return s|t},dBFSV:function(s,t){return s==t},pswwS:function(s,t){return s(t)},CYswF:function(s,t){return s||t},YPGpQ:r(392),ieLrA:r(1264),PIMHn:r(1908),rjNVM:function(s,t){return s instanceof t},lZPHC:function(s,t){return s!=t},KNNVe:r(755)+r(1146),tjIvA:function(s,t){return s>=t},YVSor:function(s,t){return s<t},aObSc:function(s,t){return s&t},Vnpnm:function(s,t){return s<t},kXKlU:function(s,t){return s<<t},KKwzw:function(s,t){return s&t},xyLkS:function(s,t){return s|t},zgUTx:function(s,t){return s<<t},DFWYJ:function(s,t){return s&t},fqpzv:function(s,t){return s<<t},HfZwh:function(s,t){return s+t},qOLQH:function(s,t){return s+t},PaJNM:r(1148),MQjHA:r(538),XqaVX:r(892),LfaNa:r(348),DLWDO:function(s,t){return s>=t},CJUAa:function(s,t){return s|t},TRdmi:"unknown "+r(793),cnHUJ:r(686),VFCis:r(391),ymWHX:function(s,t){return s+t},GvyoB:"&jscallb"+r(1891)+"tierJSONP",BfyCw:function(s,t){return s===t},JSqPz:r(1731),EPbmz:function(s,t){return s===t},mJRsN:r(618),WwXye:r(1004),MzFVk:function(s,t,n){return s(t,n)},iufrM:function(s,t){return s===t},kLLho:"ftgeo",TsZYH:function(s,t){return s||t},PNWld:function(s,t){return s!==t},CEHKQ:r(977),TblaM:function(s,t){return s!==t},XQYGZ:function(s,t){return s||t},mVCFu:function(s,t){return s(t)},pFnfH:function(s,t){return s+t},NlHJw:function(s,t){return s!==t},kCfaz:r(1697),gtZAZ:r(1858),sqCzk:function(s,t){return s||t},HwSHP:function(s,t){return s!==t},oIdKq:"tavEy",AkOHa:r(334),dmXkU:function(s,t){return s||t},OyAyS:r(1616)+"DB failed",jKzeT:r(891),sPDKT:"message_id",NdukH:function(s,t){return s&t},ZTJXc:r(347),AJbic:function(s,t){return s(t)},cJNVZ:function(s,t,n){return s(t,n)},fXMgq:function(s,t){return s===t},MiLkB:"vdAfR",uyhUQ:r(914)+"er_qos",dAvcN:function(s,t,n,i){return s(t,n,i)},fmyCw:r(914)+r(1143)+"ck",FIFmu:function(s,t,n,i){return s(t,n,i)},QdDJZ:function(s,t,n){return s(t,n)},nQEzX:"x_fronti"+r(929)+"sgid",eUPmK:"need_ack",JhLio:r(1512),dwodX:function(s,t){return s&&t},rnQUO:r(1050),IhhIX:r(609),xrADi:function(s){return s()},BBWuX:r(507)+r(351)+"e",UppCf:function(s,t,n,i){return s(t,n,i)},vCpDU:r(1335),ibaVc:function(s,t){return s(t)},BHGmm:function(s,t){return s===t},Tmjjy:r(621),QRppu:"BOXFh",QmFHD:function(s,t){return s instanceof t},sWCGH:r(1257)+r(464)+r(1116),QckQq:r(755)+r(1146)+";charset"+r(1349),dSJex:"none_none",OiHJV:r(855),mbeov:function(s){return s()},qsMLR:function(s,t){return s>t},cDNPU:function(s,t){return s(t)},nSwRT:function(s,t){return s&t},owOqi:function(s,t){return s>>>t},geVaX:function(s,t){return s===t},ahKzC:r(1774),OmceX:"ngBlS",SmytA:function(s,t){return s+t},lwNRT:function(s,t){return s+t},mUnkd:function(s,t){return s+t},GtxII:r(846)+"t of ran"+r(1063),gNkbi:" + ",EXPmy:r(1093),fgMCq:function(s,t){return s!==t},UQFtd:r(1186),qoplO:function(s,t){return s>t},AWPDI:function(s,t){return s>=t},aiqxh:function(s,t){return s&t},awmdb:function(s,t){return s+t},EIUhl:function(s,t,n,i){return s(t,n,i)},SdlyQ:function(s,t){return s<<t},YsrsG:function(s,t){return s<<t},sNyho:function(s,t){return s+t},CaIqY:function(s,t){return s|t},AhiPq:function(s,t){return s+t},zAXbz:function(s,t){return s<<t},OaVzW:function(s,t){return s+t},ctWqE:function(s,t){return s+t},tcitu:function(s,t){return s>>>t},GWMMa:function(s,t){return s>>>t},xetnz:function(s,t){return s&t},EqOrJ:function(s,t){return s>>>t},IpZIb:function(s,t){return s&t},TdoEK:function(s,t){return s+t},AxtID:function(s,t){return s>>>t},OvIPl:function(s,t){return s>>>t},LhxHW:function(s,t){return s>t},IBwtx:function(s,t){return s+t},iYJCv:function(s,t){return s||t},UEqXe:function(s,t){return s!=t},mvLaL:function(s,t){return s!==t},ZdRIq:r(726),MJXei:function(s,t){return s&t},eOUZd:function(s,t){return s===t},QxELD:function(s,t){return s>>>t},buJQw:function(s,t){return s|t},qXHJF:function(s,t){return s<<t},wnVry:function(s,t){return s|t},DnOhc:function(s,t){return s<<t},LpfiO:function(s,t){return s|t},mWnKC:function(s,t){return s<<t},JCrwa:function(s,t){return s&t},oJdyy:r(656)+r(926)+r(958)+"ct",OUYAJ:"QzNgn",RFdCt:r(1469),bbBia:function(s,t){return s<t},LXEgF:function(s,t){return s|t},axrWD:function(s,t){return s|t},bJvWX:function(s,t){return s&t},tlEve:function(s,t){return s>>>t},jwHuR:function(s,t){return s&t},eUCgI:"KHAcl",TDIOO:function(s,t,n,i){return s(t,n,i)},uSDqy:r(1187),ArOQo:function(s,t){return s<t},RvRxn:function(s,t){return s+t},VMMnn:function(s,t,n,i){return s(t,n,i)},PfTwe:function(s,t,n,i){return s(t,n,i)},fLDiA:function(s,t,n,i){return s(t,n,i)},eMHJO:"cursor_f"+r(409),CedfM:function(s,t){return s<t},najKA:function(s,t,n){return s(t,n)},lVytV:function(s,t,n){return s(t,n)},oVoba:r(1763)+r(659),oVYON:"cursor_n"+r(1743),FdWsU:r(1805)+r(1828),kiuuz:function(s,t,n,i){return s(t,n,i)},swHSO:r(1276),dmsgt:r(1846),kjDWJ:function(s){return s()},dCJEp:r(505),stgdR:r(825),grOsY:function(s,t){return s(t)},rPDzN:r(1715)+"r",olbfa:function(s,t){return s|t},zdVir:function(s,t){return s>>>t},VYEna:function(s,t){return s|t},JuHFC:function(s,t){return s>t},fhaBb:function(s,t){return s===t},sEJhU:r(627),pDXJp:function(s,t,n,i){return s(t,n,i)},AxKgC:r(914)+"er_msgid",wHcGE:r(914)+r(1002),DPrfT:r(1643)+"s",PKwPu:function(s){return s()},BNoze:function(s,t){return s>t},QRJFU:function(s,t){return s>t},AcQnN:function(s,t){return s!==t},hWLai:"CDCus",iuvbV:r(1227),xIJnm:function(s){return s()},XauYf:function(s){return s()},MZdIP:function(s,t){return s(t)},KQOaE:function(s){return s()},KADQX:function(s,t){return s!==t},HpOaa:r(1491),XLPtW:r(827),VUcOl:r(1549),qaZto:function(s){return s()},iwzXZ:function(s,t,n,i){return s(t,n,i)},nPXFu:"vUeYE",vHYDC:function(s,t,n){return s(t,n)},QRCyy:function(s,t){return s===t},dvuuc:function(s,t,n){return s(t,n)},xuYre:function(s,t,n){return s(t,n)},sMBeE:function(s,t){return s===t},QpoOC:"success",zvkIU:r(1582),xGZAV:"gNNoE",jrTWi:function(s,t){return s!==t},AXeDR:"YVzLk",mlbno:r(363),gAxMc:r(1473)+r(786),diBqY:"auto",tEpOi:function(s,t){return s==t},pYrdi:r(1486)+"rovide v"+r(1027),JZury:r(1638),SBYca:function(s,t,n){return s(t,n)},rbJzl:r(1819)+"t",zZkcw:r(589),cpUOo:r(962),ATLxo:r(1612),OIMfx:"pageshow",sOhnD:function(s,t){return s(t)},JquUF:function(s){return s()},eEXbD:"PekEK",dCUPr:r(1724),dxwXR:r(874),tQoMW:r(1569),VahbC:r(483),Gdzns:r(548),GCOQh:"please p"+r(1084)+r(1591)+r(1564)+r(1895),YdXWj:r(1883),EWdEd:"web",AGSmK:function(s,t,n){return s(t,n)},ZLsYW:function(s,t){return s>t},dBrrU:function(s,t){return s-t},Qwkct:function(s,t,n){return s(t,n)},HScjT:function(s,t,n){return s(t,n)},SiOfg:"0|2|4|1|3",NylGS:r(1740),lPbus:function(s,t){return s!==t},BWodM:r(945),sBgED:function(s,t){return s(t)},StuDh:"FRONTIER>",zuqmR:function(s,t){return s*t},mexZB:function(s,t){return s-t},JJfWQ:function(s,t){return s>t},DpAyK:function(s,t){return s===t},HTBRj:r(946),HHWcJ:r(332),guFfc:r(472)+r(1021)+r(1819)+"ting server",MpkdJ:function(s,t){return s!==t},YLPkc:function(s,t,n){return s(t,n)},rKtEq:r(668)+r(1587)+r(1594)+"g",yzUbN:function(s,t){return s===t},FphBI:r(917),HSCoy:r(866)+"1",YstUd:"0|3|1|2|4",WauWk:function(s,t){return s===t},NafBn:r(615)+"s already closed",ltNKU:"AWfhE",vGzoE:r(611),eOpNB:function(s,t,n){return s(t,n)},FeUKT:function(s,t,n){return s(t,n)},NVjFT:r(472)+r(446)+r(1784)+r(1851),RMcBa:r(1566),lCCPg:"ack",RodAE:r(1871)+r(919),HLhpa:function(s,t){return s==t},ubTvR:function(s,t){return s==t},elkFq:r(1521),aNFeQ:function(s,t){return s instanceof t},aNHhp:function(s,t){return s(t)},CTHGa:function(s,t){return s(t)},bjeuo:function(s,t){return s(t)},rOwdm:function(s,t){return s||t},diWhl:function(s,t){return s instanceof t},aPyrA:function(s,t){return s(t)},SoTEc:"sent",IegBT:function(s,t){return s<t},cnrBy:"enqueue",JvTbe:function(s,t){return s||t},GqjvA:function(s,t){return s!==t},gjyKx:"manual r"+r(1094)+r(1550),tlMrb:r(1813)+"0",vzZTC:r(1001),ymvmn:function(s,t){return s!==t},NXrsF:r(1213),xtPRT:r(1543),jFtXH:function(s,t){return s*t},VQcdK:function(s,t){return s/t},isWEh:function(s,t){return s!=t},AJofD:r(1287),dENIA:function(s,t){return s!=t},XYKBN:function(s,t){return s===t},cPcEA:r(1188),ENGZq:"Dedicate"+r(707)+r(484)+"pe",nWicD:function(s,t){return s!=t},WeIIE:function(s,t){return s==t},ickjK:function(s,t){return s!=t},TcWNA:function(s,t){return s!=t},Xspif:function(s,t){return s!=t},RkWDA:function(s,t){return s===t},UPqsI:function(s,t){return s===t},CQsGg:r(1518)+r(1204)+r(857),rXGiD:function(s,t){return s===t},adVhL:"ServiceW"+r(730)+r(1860),biDhY:function(s,t){return s!=t},WcZgd:function(s,t){return s===t}};Se.r(V),Se.d(V,{FWS:()=>N0,CustomErrorEvent:()=>es,createCloseEvent:()=>pe,ReconnectEvent:()=>Zr,createErrorEvent:()=>ue,decodedFrame:()=>Xr,createOpenEvent:()=>os,CustomCloseEvent:()=>ts,createReconnectEvent:()=>Jn,FrontierMessageEvent:()=>rs,encodeFrame:()=>Gn,createMessageEvent:()=>is,OpenEvent:()=>ss,ErrorCode:()=>ze,Event:()=>st,MessageEvent:()=>ns});let o="";function a(s=""){let t=r,n="02",i=""+Date[t(1654)](),c=o||(o=e.vCbRl(p,s)),u=Math[t(586)]()[t(871)](16)[t(749)](-6);return e[t(455)](e[t(1348)](e[t(681)](n,i),c),u)}function x(){let s=r;return e[s(1786)](e[s(1863)](1e4,Date[s(1654)]()),Math.floor(e[s(1691)](1e4,Math[s(586)]())))}function f(s){let t=r;return e[t(849)](Array(8)[t(900)]("0"),e[t(1099)](parseInt,s,10).toString(2))[t(749)](-8)}function d(s){let t=r;if(e[t(678)](t(808),e[t(385)]))return e[t(681)](e[t(916)](Array,4)[t(900)]("0"),parseInt(s,2).toString(16))[t(749)](-4);_0x43dce0.log(_0x1388b2)}function g(s){let t=r,n=s.split(/\./)[t(1019)](u=>f(u)),i=[];return i[0]=e[t(1046)](d,e[t(923)](n[0],n[1])),i[1]=e[t(372)](d,e[t(923)](n[2],n[3])),[e[t(1829)],e[t(1829)],t(448),e.NMavs,e[t(1829)],e[t(1652)],i[0],i[1]].join("")}function p(s){let t=r;if(e[t(473)]("QMBWo",e.HnmHb)){let n=/(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}/.test(s),i=/(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))/[t(1098)](s);return n?e[t(916)](g,s):i?e.HoMJb(_,s):t(1016)+"00000000"+t(1016)+"00000000"}else return this[t(1501)]?.get(_0x22a9b8)}function _(s){let t=r,n={SUTsf:function(b,v){return e[k(1886)](b,v)},tYgBX:t(648),dHHYN:t(1685)+t(1541)+"s",PPdsN:e[t(1595)],qgNJy:e[t(1145)]},i="",c=[],u=0,h=0,m=!0,l=e[t(1829)];if(e[t(495)](s.indexOf("::"),-1)){let b=s[t(804)]("::");for(let C=0;e.KyIqX(C,b[t(398)]);C++)if(e[t(790)](e[t(1294)],t(967))){let P=b[C];if(P[t(1759)](":")>0){let L=P.split(":");m&&(u=L.length),h+=L[t(398)];for(let I=0;e[t(1298)](I,L[t(398)]);I++)if(e[t(790)](4,L[I][t(398)])){let te=l[t(928)+"g"](0,e.uhNHo(4,L[I][t(398)])),ne=te.concat(L[I]);c[t(358)](ne)}else c[t(358)](L[I]);m=!1}else{if(e[t(473)](4,P[t(398)]))if(e[t(655)](e[t(436)],e[t(698)])){let L=l[t(928)+"g"](0,e[t(328)](4,P.length)),I=L[t(1824)](P);c[t(358)](I)}else return _0xa4d70a?.find(L=>L.key===_0x14563e)?.[t(1375)];else c[t(358)](P);m&&(u+=1),h+=1,m=!1}}else{this["_clearPi"+t(1072)](),this[t(1283)+"gTimeoutId"]=e[t(502)](_0x370b8a,this[t(1559)][t(490)](this),this[t(895)][t(1320)+t(1762)]);let P=()=>{let I=t;n[I(1441)](_0x14378c,n[I(1104)]),this[I(454)](n[I(1681)],P),this.off(n[I(1092)],L)},L=()=>{let I=t;_0x316b82(n.qgNJy),this.off(I(1685)+"e_success",P),this.off(I(1685)+I(673)+"t",L)};this.on(e[t(974)],P),this.on(e[t(1595)],L),this._ping()}let v="";for(let C=0;e[t(1752)](C,e.hxkGJ(8,h));C++)v=v[t(1824)](l);for(let C=0;e[t(1804)](C,c[t(398)]);C++)if(e[t(1509)](C,u))if(e[t(790)](t(1080),e[t(756)]))i=i[t(1824)](v),i=i[t(1824)](c[C]);else{let P=(t(1821)+t(1123)).split("|"),L=0;for(;;){switch(P[L++]){case"0":_0x39969c[_0x4d0bbb[e[t(1767)]]=5001]=e[t(1767)];continue;case"1":return _0x55b37e;case"2":_0x5203d3[_0x25c1bb[e.QFsvI]=5002]=e[t(998)];continue;case"3":_0x4f8da7[_0x486bca[e.okkhw]=5003]=e[t(764)];continue;case"4":_0x16b7e4[_0x243ec0[t(1720)+"OR"]=5005]=e.GeeWe;continue;case"5":_0xf6901e[_0x3ec9b8[e[t(1676)]]=5004]=e[t(1676)];continue}break}}else i=i[t(1824)](c[C]);return i}{let b=s[t(804)](":");for(let v=0;e[t(1588)](v,b[t(398)]);v++){let C=b[v];if(e[t(1506)](4,b[v].length)){let P=l.substring(0,e[t(1327)](4,b[v].length)),L=P[t(1824)](C);i=i.concat(L)}else i=i[t(1824)](C)}return i}}function w(s,t){let n=r,i=s[n(465)];i!==void 0&&(e.XlRrT(ee,t,10),ke(t,i));let c=s[n(1375)];e.clFLh(void 0,c)&&(ee(t,18),e.GtyKp(ke,t,c))}function y(s){let t=r,n={};e:for(;!ye(s);){let i=j(s);switch(e[t(1667)](i,3)){case 0:break e;case 1:n.key=e.JTSku(be,s,e[t(1711)](j,s));break;case 2:n[t(1375)]=e[t(944)](be,s,e[t(876)](j,s));break;default:e[t(1328)](ie,s,e[t(393)](7,i))}}if(e[t(678)](void 0,n[t(465)]))throw new Error("Missing "+t(1052)+t(1369)+t(465));if(e[t(518)](void 0,n.value))throw new Error(e.mFUDh);return n}function A(s){let t=r,n=e[t(417)](z);return e[t(1328)](T,s,n),e[t(916)](Oe,n)}function T(s,t){let n=r,i={oUJsr:function(ne,me){return e.KJkBy(ne,me)}},c=s[n(999)];e[n(1411)](void 0,c)&&(e[n(1197)](ee,t,8),yt(t,c));let u=s[n(1174)];e[n(655)](void 0,u)&&(ee(t,16),e[n(944)](yt,t,u));let h=s[n(512)];if(h!==void 0)if(e.NIzyC(e[n(664)],e[n(1114)])){this[n(449)+n(1586)+n(486)](e.bUTnn(_0x2f5b36,e[n(930)],{code:1e3,reason:e[n(583)]})),this[n(1815)+n(695)]?.[n(834)+n(1139)+n(782)](),this[n(959)+n(1261)]?.["resetCou"+n(1200)]();return}else e[n(1620)](ee,t,24),e[n(1650)](yt,t,xe(h));let m=s.method;e[n(790)](void 0,m)&&(e.YRqdF(ee,t,32),e.WkHhA(yt,t,e[n(1886)](xe,m)));let l=s.headers;if(e[n(590)](void 0,l))for(let ne of l)if(e[n(518)](e[n(593)],e[n(593)])){e[n(688)](ee,t,42);let me=e[n(417)](z);e.jEFFg(w,ne,me),e[n(1904)](ee,t,me[n(1497)]),e[n(1904)](Wn,t,me),e[n(1046)](G,me)}else _0x3f2d5d=e[n(1711)](_0x17cafd,_0x504dba),_0x402634|=e.OjDGz(e[n(1195)](127,_0x61f2d5),7);let b=s["payloadE"+n(1746)];e[n(590)](void 0,b)&&(e[n(1099)](ee,t,50),ke(t,b));let v=s[n(696)+n(1347)];e[n(655)](void 0,v)&&(e.PdGwK(ee,t,58),e[n(1198)](ke,t,v));let C=s[n(470)];C!==void 0&&(e[n(1197)](ee,t,66),e[n(1198)](ee,t,C[n(398)]),zt(t,C));let P=s[n(1361)];if(e[n(1506)](void 0,P))if(e[n(1506)](e[n(1539)],e.FmILj)){let{value:ne,offset:me}=_0x326879(_0x51519d,_0x1c6887);_0x46d54f=me,_0x3cf0f1=i[n(1017)](_0x48738b,8)>>>0,_0x12795a+=ne}else ee(t,74),e[n(830)](ke,t,P);let L=s[n(1244)+"ming"];L!==void 0&&(e.VqMLK(ee,t,82),e[n(1461)](ke,t,L));let I=s.msgID;e[n(1690)](void 0,I)&&(e[n(1814)](ee,t,90),e[n(924)](ke,t,I));let te=s.frameType;e.sWUxP(void 0,te)&&(ee(t,96),e[n(1197)](yt,t,e[n(372)](xe,te)))}function N(s){return e[r(1875)](R,e.QIaVU(Ae,s))}function R(s){let t=r,n={};e:for(;!ye(s);){let i=e[t(370)](j,s);switch(e[t(1667)](i,3)){case 0:break e;case 1:n[t(999)]=Jr(s,!0);break;case 2:n[t(1174)]=e[t(924)](Jr,s,!0);break;case 3:n[t(512)]=e[t(383)](j,s);break;case 4:n[t(720)]=j(s);break;case 5:{let c=e[t(1394)](K,s);(n[t(1246)]||(n[t(1246)]=[]))[t(358)](e[t(340)](y,s)),s[t(1497)]=c;break}case 6:n["payloadE"+t(1746)]=e[t(1198)](be,s,j(s));break;case 7:n[t(696)+t(1347)]=e[t(577)](be,s,e[t(1886)](j,s));break;case 8:n[t(470)]=e.JTSku(Bt,s,e[t(1394)](j,s));break;case 9:n.LogIDNew=e[t(830)](be,s,e[t(1886)](j,s));break;case 10:n[t(1244)+t(1291)]=e.jEFFg(be,s,e.LvYEV(j,s));break;case 11:n[t(462)]=be(s,e.MPZZy(j,s));break;case 12:n[t(1552)+"e"]=e[t(771)](j,s);break;default:e[t(427)](ie,s,e.FYrJM(7,i))}}if(e[t(518)](void 0,n[t(999)]))throw new Error(e[t(1359)]);if(e[t(941)](void 0,n[t(1174)]))throw new Error(e[t(1165)]);if(n[t(512)]===void 0)throw new Error(e[t(1579)]);if(e[t(1494)](void 0,n[t(720)]))throw new Error(e[t(1014)]);return n}function K(s){let t=r,n={iVueu:function(i,c){return e[k(1296)](i,c)}};if(e.sWUxP(e[t(1889)],"usCeq")){if(n.iVueu(_0x1c27ab,_0x30506c))return _0x5af506}else{let i=e[t(619)](j,s),c=s.limit;return s[t(1497)]=e[t(455)](s[t(607)],i),c}}function ie(s,t){let n=r;switch(t){case 0:for(;e[n(525)](128,e[n(372)](J,s)););break;case 2:e.nvPqX(we,s,e[n(520)](j,s));break;case 5:we(s,4);break;case 1:we(s,8);break;default:throw new Error(e.IAVzX(e[n(1884)],t))}}function xe(s){let t=r;return s|=0,{low:s,high:s>>31,unsigned:e[t(1478)](s,0)}}let D=[];function z(){let s=r,t=D[s(1303)]();return t?(t[s(607)]=t.limit=0,t):{bytes:new Uint8Array(64),offset:0,limit:0}}function G(s){let t=r;if(e[t(1544)]===t(1910))return this[t(449)+t(403)+t(521)](_0x2ea7fa),_0x191152();D[t(358)](s)}function Ae(s){return{bytes:s,offset:0,limit:s.length}}function Oe(s){let t=r,n=s[t(1663)],i=s[t(1497)];return n[t(398)]===i?n:n[t(795)](0,i)}function we(s,t){let n=r;if(e[n(495)](e[n(455)](s[n(607)],t),s[n(1497)]))throw new Error(e[n(712)]);s[n(607)]+=t}function ye(s){return e[r(1817)](s.offset,s.limit)}function ge(s,t){let n=r;if(e[n(1494)](e[n(494)],e.RAtjl))return this[n(1501)]?.[n(1722)](_0x54c057);{let i=s.bytes,c=s.offset,u=s[n(1497)],h=e[n(1191)](c,t);if(e[n(495)](h,i[n(398)])){let m=new Uint8Array(e[n(1809)](2,h));m[n(1216)](i),s.bytes=m}return s[n(607)]=h,e[n(1280)](h,u)&&(s[n(1497)]=h),c}}function et(s,t){let n=r,i=s[n(607)];if(e[n(582)](e.PbLar(i,t),s.limit))throw new Error(e[n(886)]);return s[n(607)]+=t,i}function Bt(s,t){let n=r,i=e[n(427)](et,s,t);return s[n(1663)][n(795)](i,e[n(1831)](i,t))}function zt(s,t){let n=r,i=ge(s,t[n(398)]);s.bytes[n(1216)](t,i)}function be(s,t){let n=r,i={XkkfF:function(b){return e.pcuWV(b)},ABXYF:function(b,v,C){return b(v,C)},tosCd:function(b,v,C,P){return e[k(1164)](b,v,C,P)}},c=e[n(377)](et,s,t),u=String["fromChar"+n(397)],h=s[n(1663)],m="\uFFFD",l="";for(let b=0;e[n(896)](b,t);b++){let v=h[e[n(1831)](b,c)],C,P,L,I;if(e[n(557)](128,v)===0)l+=e[n(789)](u,v);else if(e[n(941)](224&v,192))if(e[n(511)](b,1)>=t)l+=m;else if(e[n(325)](e[n(853)],e[n(1223)]))C=h[e[n(1348)](e[n(562)](b,c),1)],e[n(1524)](e.SuZrB(192,C),128)?l+=m:(I=e[n(337)](e[n(557)](31,v)<<6,63&C),e[n(1752)](I,128)?l+=m:e[n(1254)](n(1857),n(1857))?(_0x3ecac6(),bjSpdA[n(740)](_0x822e72)):(l+=e[n(771)](u,I),b++));else return new _0x260ca6(te=>{let ne=n;i[ne(734)](_0x1a0ace,te,this[ne(981)+ne(1023)+"e"](_0x5ee8b2))});else if(e[n(1231)](e[n(1195)](240,v),224))if(e.sDUwJ(e.NfXix(b,2),t))l+=m;else if(C=h[e[n(1738)](e[n(1831)](b,c),1)],P=h[e[n(515)](e[n(1831)](b,c),2)],e[n(1131)](e[n(927)](C,e[n(491)](P,8)),49344)!==32896)l+=m;else if(e.pIyij(n(1170),e.SDWso)){let te=new _0x120f3d(_0x221121(_0xb63a50));return i[n(666)](_0x3d3cc4,_0x232d97,te,0),te}else I=e.Txgfz(e[n(1235)](e.buSyb(e[n(557)](15,v),12),e[n(491)](63&C,6)),e[n(393)](63,P)),I<2048||e[n(1817)](I,55296)&&e[n(508)](I,57343)?l+=m:(l+=e[n(1788)](u,I),b+=2);else if(e.NmCmY(e[n(1128)](248,v),240))if(e.LEpMC(b,3)>=t)l+=m;else if(n(1655)!==e[n(1378)])if(C=h[e[n(455)](e[n(1070)](b,c),1)],P=h[e[n(849)](e[n(1070)](b,c),2)],L=h[e.hLiNC(b,c)+3],e[n(1179)](e[n(393)](e[n(810)](e[n(1673)](C,e[n(1013)](P,8)),e[n(1013)](L,16)),12632256),8421504))l+=m;else{if(e[n(868)](n(1641),e[n(641)]))return _0x1843b4||(_0x3b82d4=[_0x36ab96,_0x1b18eb,_0x233ba,_0x1c03fb,_0x26d0e5]);I=e[n(1235)](e.Srnoz(e[n(1195)](7,v)<<18,e[n(1898)](e[n(525)](63,C),12))|e[n(491)](e[n(1028)](63,P),6),e[n(1526)](63,L)),I<65536||e[n(1653)](I,1114111)?l+=m:(I-=65536,l+=e[n(1770)](u,e[n(604)](I,10)+55296,e.Dcibz(e[n(826)](1023,I),56320)),b+=3)}else return this[n(713)+"T"]||this[n(1475)+"X"]?this["_miniNav"+n(1563)+n(387)]:(this[n(1447)+"er"]||this[n(1446)+"r"])&&this._options[n(1646)+n(639)+n(633)]?_0x32ec01[n(326)]:!0;else l+=m}return l}function ke(s,t){let n=r,i=t[n(398)],c=0;for(let m=0;e.JSEPq(m,i);m++){let l=t[n(362)+"At"](m);e[n(1817)](l,55296)&&e[n(508)](l,56319)&&e[n(1729)](m,1)<i&&(l=e[n(328)](e[n(1625)](e[n(1270)](l,10),t[n(362)+"At"](++m)),56613888)),c+=e.tuijP(l,128)?1:e[n(1298)](l,2048)?2:e[n(776)](l,65536)?3:4}ee(s,c);let u=e.nvPqX(ge,s,c),h=s[n(1663)];for(let m=0;m<i;m++){let l=t[n(362)+"At"](m);e[n(1067)](l,55296)&&e.mTnfT(l,56319)&&e.YplBc(m,1)<i&&(l=e[n(1786)](e[n(1086)](l,10),t[n(362)+"At"](++m))-56613888),e[n(1453)](l,128)?h[u++]=l:(e.WQbXM(l,2048)?h[u++]=e.egFEC(e[n(578)](l,6),31)|192:(e.cFXFq(l,65536)?h[u++]=e.Txgfz(e.JycZi(l,12)&15,224):(h[u++]=e[n(1235)](e[n(1208)](e[n(606)](l,18),7),240),h[u++]=e[n(1538)](e[n(1128)](e[n(1345)](l,12),63),128)),h[u++]=e[n(1538)](e.FAEdw(e[n(509)](l,6),63),128)),h[u++]=e[n(1836)](e.znKWJ(63,l),128))}}function Wn(s,t){let n=r;if(e[n(868)](n(1251),n(1251))){let i=e[n(1156)](ge,s,t.limit),c=s.bytes,u=t[n(1663)];for(let h=0,m=t[n(1497)];e[n(896)](h,m);h++)c[e[n(455)](h,i)]=u[h]}else return n(1176)+"_"+this[n(824)]}function J(s){return s.bytes[et(s,1)]}function nt(s,t){let n=r,i=e[n(1492)](ge,s,1);s.bytes[i]=t}function j(s){let t=r,n=0,i=0,c;do c=e.nzZox(J,s),n<32&&(i|=e[t(1020)](127&c,n)),n+=7;while(e.PoUJS(128,c));return i}function ee(s,t){let n=r;if(e[n(655)](e.fFCGH,e[n(1405)]))e[n(1904)](_0x3b8200,_0x27b38c,18),e[n(502)](_0x34d17d,_0x20fe24,_0x555cf4);else{for(t>>>=0;e[n(381)](t,128);)e.bUTnn(nt,s,e[n(1538)](e.egFEC(127,t),128)),t>>>=7;e[n(1198)](nt,s,t)}}function Jr(s,t){let n=r,i={jkdIJ:e[n(930)],VVpQN:function(c,u,h){return e[n(1197)](c,u,h)}};if(e[n(1254)](n(719),n(561))){let c=0,u=0,h=0,m;if(m=J(s),c=127&m,e.KIuab(128,m)&&(m=e.ywDbN(J,s),c|=e[n(1086)](e[n(1511)](127,m),7),e.TktiC(128,m)&&(m=J(s),c|=e[n(1020)](e.egFEC(127,m),14),128&m&&(m=e[n(372)](J,s),c|=(127&m)<<21,e[n(1208)](128,m)))))if(e[n(1728)]===e[n(584)]){let l=e[n(859)](_0x1c8a40,e[n(984)],{message:_0x459d38[n(1740)],code:_0x114e28["MESSAGE_"+n(1295)],error:_0x389213});this["_dispatc"+n(1158)+n(486)](l)}else m=e[n(1886)](J,s),u=e[n(872)](127,m),e.ejMxc(128,m)&&(m=e[n(1394)](J,s),u|=e[n(491)](127&m,7),128&m&&(m=e[n(458)](J,s),u|=e[n(1013)](e[n(872)](127,m),14),e.TktiC(128,m)&&(m=e[n(931)](J,s),u|=e.wvtKI(e[n(367)](127,m),21),e[n(1808)](128,m)&&(m=e[n(372)](J,s),h=127&m,e[n(1371)](128,m)&&(m=e[n(887)](J,s),h|=e[n(709)](e[n(1157)](127,m),7))))));return{low:e[n(359)](c,e[n(709)](u,28)),high:e[n(1799)](e.Anrwn(u,4),e.bzqPe(h,24)),unsigned:t}}else this.emit(i.jkdIJ,i[n(1391)](_0x12e523,i[n(585)],{..._0xf07feb}))}function yt(s,t){let n=r,i=t[n(420)]>>>0,c=e.BldmL(e[n(1737)](t[n(420)],28)|e[n(1020)](t.high,4),0),u=e[n(643)](t.high,24),h=u===0?c===0?e[n(814)](i,16384)?e[n(705)](i,128)?1:2:e[n(1406)](i,2097152)?3:4:c<16384?e[n(1442)](c,128)?5:6:c<2097152?7:8:e[n(1708)](u,128)?9:10,m=ge(s,h),l=s.bytes;switch(h){case 10:l[e[n(531)](m,9)]=e.GavAx(e[n(840)](u,7),1);case 9:l[m+8]=e[n(1153)](9,h)?e.zbugm(128,u):e.ViGJH(127,u);case 8:l[e[n(923)](m,7)]=e[n(1529)](8,h)?c>>>21|128:e[n(670)](c,21)&127;case 7:l[m+6]=h!==7?e.BLjjO(e[n(670)](c,14),128):c>>>14&127;case 6:l[m+5]=h!==6?e[n(546)](e.FLhVq(c,7),128):e.gDzoy(c,7)&127;case 5:l[m+4]=h!==5?e.OGzsa(128,c):127&c;case 4:l[e[n(1901)](m,3)]=e.iaMDp(4,h)?e[n(772)](e[n(735)](i,21),128):e[n(826)](i>>>21,127);case 3:l[e[n(1768)](m,2)]=e[n(655)](3,h)?e[n(820)](i,14)|128:e[n(525)](e.CoewU(i,14),127);case 2:l[m+1]=e[n(1254)](2,h)?e[n(810)](e[n(1667)](i,7),128):e[n(954)](i,7)&127;case 1:l[m]=e.EToJI(1,h)?e[n(1065)](128,i):e.FAEdw(127,i)}}function Xr(s){return N(s)}function Gn(s){return e.fjVwr(A,s)}let Vr=65536,jo=e[r(416)],rt=e[r(905)](Vr,Vr),Yr=rt*rt,Qr=e[r(1201)](Yr,2),Be=String[r(934)+"e"][r(362)+"At"];class O{constructor(t,n,i){let c=r;this[c(528)]=!0,this[c(420)]=e[c(1323)](0,t),this.high=0|n,this.unsigned=!!i}static[r(528)](t){return t&&e[r(1389)](!0,t.isLong)}static fromBits(t,n,i){let c=r;return e[c(325)](c(1414),e[c(1826)])?this[c(1501)]?.[c(1216)]({message_id:_0x506fee,timestamp:_0x30876e}):new O(t,n,i)}static[r(1665)+"s"](t,n,i){let c=r;return i?O["fromByte"+c(522)](t,n):O[c(1665)+"sBE"](t,n)}static[r(1665)+"sLE"](t,n){let i=r,c={bCbaP:i(1172)+"d",zxTju:e[i(1135)],knxDd:e[i(629)]};if(e[i(1112)](e[i(1173)],e[i(605)]))CbOiDf[i(1610)]!=typeof _0x3c95a0&&_0x2b8719[i(871)+i(978)]&&_0x3986a7[i(1490)+i(1571)](_0xf05223,_0x39a727[i(871)+"Tag"],{value:CbOiDf[i(922)]}),_0x2f3ca2["definePr"+i(1571)](_0x38755b,CbOiDf.knxDd,{value:!0});else return new O(e[i(927)](e[i(1088)](t[0]|e.QRzVn(t[1],8),e[i(1898)](t[2],16)),t[3]<<24),e[i(1619)](e.HuMsN(t[4],e.QoyXJ(t[5],8)),t[6]<<16)|e[i(1086)](t[7],24),n)}static[r(1665)+r(1840)](t,n){let i=r;return new O(e[i(772)](e[i(1619)](e.ZwTVG(e[i(813)](t[4],24),e.UNJIT(t[5],16)),e.jvUQn(t[6],8)),t[7]),e[i(546)](e[i(927)](e[i(359)](t[0]<<24,e.QLRZB(t[1],16)),e[i(1811)](t[2],8)),t[3]),n)}static[r(750)](t){let n=r;return t===jo?$r:new O(e[n(1737)](e[n(1619)](Be.call(t,0)|e[n(1850)](Be[n(683)](t,1),8)|e[n(418)](Be[n(683)](t,2),16),e[n(913)](Be[n(683)](t,3),24)),0),e.FmZcV(e[n(1480)](e[n(694)](Be[n(683)](t,4),Be[n(683)](t,5)<<8),e.ZWIqv(Be.call(t,6),16)),e[n(418)](Be[n(683)](t,7),24))>>>0,!0)}[r(847)](){let t=r;return String[t(851)+"Code"](e.kfevH(255,this[t(420)]),this[t(420)]>>>8&255,e.Msnhr(e[t(840)](this[t(420)],16),255),e[t(1551)](this[t(420)],24),e[t(1463)](255,this[t(1504)]),e.wMJQc(e[t(1775)](this[t(1504)],8),255),e.wMJQc(e[t(840)](this.high,16),255),e[t(1775)](this.high,24))}static[r(356)+"er"](t,n=!0){let i=r;if(e[i(1107)](isNaN,t))return n?Wo:$r;if(n){if(e[i(338)](t,Yr))return Jo}else{if(t<=-Qr)return Xo;if(e[i(1350)](e[i(1070)](t,1),Qr))return Go}return O.fromBits(e[i(1255)](t,rt)|0,e.Qupyz(e[i(526)](t,rt),0),n)}[r(1687)](){let t=r;return this[t(1627)]?e[t(511)](e[t(670)](this[t(1504)],0)*rt,e[t(1775)](this[t(420)],0)):e.xcblt(this.high,rt)+e[t(670)](this[t(420)],0)}[r(1289)](){let t=r;return e.GvWCn(0,this.high)&&e[t(678)](0,this[t(420)])}[r(1911)](t){let n=r;if(e[n(1389)](e[n(474)],e[n(1713)])){let i=this[n(1504)],c=this[n(420)];return[e[n(560)](255,c),e[n(1890)](e[n(778)](c,8),255),e.TMsAJ(c,16)&255,c>>>24,255&i,e[n(477)](e[n(643)](i,8),255),e.FlSwf(e[n(1181)](i,16),255),e[n(425)](i,24)]}else{O[n(528)](t)||(t=O[n(356)+"er"](t));let i=e[n(1667)](this[n(1504)],16),c=e[n(873)](65535,this[n(1504)]),u=e[n(1693)](this.low,16),h=e[n(477)](65535,this[n(420)]),m=t[n(1504)]>>>16,l=e[n(540)](65535,t[n(1504)]),b=e[n(1737)](t[n(420)],16),v=e.LLoJV(65535,t[n(420)]),C=0,P=0,L=0,I=0;return I+=e.YplBc(h,v),L+=e[n(1181)](I,16),I&=65535,L+=u+b,P+=L>>>16,L&=65535,P+=e[n(1729)](c,l),C+=e.IJiqo(P,16),P&=65535,C+=e[n(1070)](i,m),C&=65535,O[n(596)](e.zbugm(e[n(1086)](L,16),I),e[n(722)](e.Izdwd(C,16),P),this[n(1627)])}}equals(t){let n=r;return O[n(528)](t)||(t=O.fromNumber(t)),this.unsigned!==t[n(1627)]&&e[n(1389)](e.TUKbr(this[n(1504)],31),1)&&e[n(1737)](t[n(1504)],31)===1?!1:e[n(1509)](this[n(1504)],t[n(1504)])&&e.LYoDq(this[n(420)],t.low)}[r(1832)](){let t=r;return this.low===-1&&e[t(1281)](-1,this[t(1504)])?O[t(596)](0,0,this[t(1627)]):e[t(1007)](-1,this[t(420)])?O[t(596)](0,this[t(1504)]+1,this[t(1627)]):O[t(596)](e.coDEA(this.low,1),this.high,this[t(1627)])}toBytes(t){let n=r;return t?this[n(653)+"E"]():this[n(614)+"E"]()}toBytesLE(){let t=r,n=this[t(1504)],i=this[t(420)];return[e[t(1028)](255,i),e[t(393)](e[t(820)](i,8),255),e[t(1131)](e.FEvbh(i,16),255),i>>>24,e[t(1208)](255,n),e[t(393)](e[t(1737)](n,8),255),e[t(1890)](e[t(1551)](n,16),255),e.Yrqfc(n,24)]}[r(614)+"E"](){let t=r,n=this[t(1504)],i=this[t(420)];return[e[t(820)](n,24),n>>>16&255,e[t(911)](e[t(821)](n,8),255),e[t(1581)](255,n),e[t(687)](i,24),i>>>16&255,e[t(840)](i,8)&255,e[t(1530)](255,i)]}}let $r=new O(0,0,!1),Wo=new O(0,0,!0),Go=O[r(596)](-1,2147483647,!1),Jo=O[r(596)](-1,-1,!0),Xo=O[r(596)](0,-2147483648,!1);var ze=(function(s){let t=r,n=(t(352)+t(388)).split("|"),i=0;for(;;){switch(n[i++]){case"0":s[s[e.QFsvI]=5002]=e[t(998)];continue;case"1":s[s[t(1058)+t(441)]=5001]=t(1058)+t(441);continue;case"2":s[s[e.IhceA]=5004]=e[t(1676)];continue;case"3":s[s[e[t(1553)]]=5005]=e.GeeWe;continue;case"4":return s;case"5":s[s["MAX_RETR"+t(1126)+"R"]=5003]=t(1839)+t(1126)+"R";continue}break}})({});class st{constructor(t){let n=r;this[n(1155)]=t,this.target=null}}class Zr extends st{constructor(t,n){super(t),this.message=n&&n.message||null}}class es extends st{constructor(t,n){let i=r,c="0|3|2|5|4|1|6"[i(804)]("|"),u=0;for(;;){switch(c[u++]){case"0":super(t);continue;case"1":this.message=n&&n.message||"";continue;case"2":this.colno=n&&n.colno||0;continue;case"3":this[i(1033)]=n&&n.error||null;continue;case"4":this.lineno=n&&n.lineno||0;continue;case"5":this[i(1183)]=n&&n.filename||"";continue;case"6":this.code=n&&n.code||5001;continue}break}}}class ts extends st{constructor(t,n){let i=r,c={UvuMN:function(u,h){return e[k(1793)](u,h)},AxspB:function(u,h){return e[k(1546)](u,h)}};if(e.gOlBF(e[i(1142)],e[i(912)])){let u=e[i(700)][i(804)]("|"),h=0;for(;;){switch(u[h++]){case"0":this[i(793)]=n&&n[i(793)]||"";continue;case"1":this[i(1787)+i(794)]=n&&n[i(1787)+i(794)]||!1;continue;case"2":this[i(634)]=n&&n[i(634)]||0;continue;case"3":super(t);continue;case"4":this[i(1410)]=n&&n.wasClean||!1;continue}break}}else _0xe4a9f7[_0x18dba0++]=c[i(1671)](_0xa93103,6)|192,_0x3c76ad[_0x15d682++]=c[i(1572)](63,_0x10dc76)|128}}class ns extends st{constructor(t,n){let i=r;super(t),this[i(1471)]=n&&n[i(1471)]||null}}class rs extends ns{constructor(t,n){let i=r,c={SxQPi:function(u,h,m){return e.FQZwg(u,h,m)},joOxa:function(u,h,m){return e[k(1814)](u,h,m)},WiWIT:function(u,h){return e[k(789)](u,h)}};e[i(890)]!==i(1166)?(mERsSL.SxQPi(_0x3b0cbe,_0x57faf0,24),mERsSL.joOxa(_0x156035,_0x131402,mERsSL.WiWIT(_0x2c3ee1,_0x4ab503))):(super(t),this[i(1471)]=n&&n.data||null,this[i(1740)]=n&&n.message||null)}}class ss extends st{constructor(t,n){let i=r;e[i(868)](e[i(1089)],e[i(1175)])?this["currentE"+i(1317)+i(1038)+"t"]=0:(super(t),this[i(1471)]=n&&n[i(1471)]||null)}}function ue(s,{message:t,code:n,error:i}){let c=r;return e[c(1153)](c(1718),e[c(1190)])?this[c(1501)].isReady:new es(s,{message:t,code:n,error:i})}function pe(s,{code:t,reason:n,wasClean:i,willReconnect:c}){let u=r,h={wGKgO:function(m,l){return m(l)},mlZgL:function(m,l){return e[k(776)](m,l)},kxhtr:function(m,l){return e[k(587)](m,l)},QbTlw:function(m,l){return e[k(1659)](m,l)}};if(e.gvwUH(e[u(798)],e[u(728)]))_0x2859c7=DmtErz[u(1316)](_0x41069f,_0x104be0),DmtErz[u(1413)](_0x375571,32)&&(_0x181004|=DmtErz[u(1545)](DmtErz[u(1423)](127,_0x2b1d3e),_0x4a3e51)),_0x4c14e3+=7;else return new ts(s,{code:t,reason:n,wasClean:i,willReconnect:c})}function is(s,{data:t,message:n}){return e[r(1078)]===e.GDqPD?null:new rs(s,{data:t,message:n})}function os(s,{data:t}){return new ss(s,{data:t})}function Jn(s,{message:t}){return new Zr(s,{message:t})}class as{constructor(t,n){let i=r;this.endpoints=t,this[i(1429)+"es"]=n,this[i(1245)+i(888)]=0,this[i(412)+i(1317)+"riesCount"]=0}[r(834)+r(1139)+r(782)](){let t=r;this["currentI"+t(888)]=0,this[t(412)+t(1317)+t(1038)+"t"]=0}[r(1214)+"es"](){let t=r;this[t(412)+t(1317)+t(1038)+"t"]=0}[r(1096)+r(1210)+"nt"](){let t=r;return this[t(1583)+"s"][this[t(1245)+t(888)]]}getCurrentEndpointTriesCount(){let t=r;return this[t(412)+t(1317)+t(1038)+"t"]}["checkRea"+r(471)+"es"](){let t=r;return!!(this["currentI"+t(888)]>=this[t(1583)+"s"].length||e[t(678)](this.currentIndex,this[t(1583)+"s"][t(398)]-1)&&e[t(1112)](this.currentEndpointTriesCount,this[t(1429)+"es"]))}[r(1694)+r(404)+r(1161)+"hedMaxRe"+r(1456)](){let t=r,n={BSBfQ:function(i,c,u){return e[k(333)](i,c,u)},TmAmF:"error",hJbCi:e[t(930)]};if(e.DIccL===e[t(1495)])return e.NmCmY(this[t(1245)+t(888)],this.endpoints[t(398)])?!0:e[t(1280)](this[t(412)+t(1317)+"riesCount"],this[t(1429)+"es"]);{let i=n[t(631)](_0x57d6fa,n.TmAmF,{message:this[t(439)+t(1894)+t(1834)](_0x171d73)});this[t(339)](t(1033),i);let c=_0x243e69(n[t(738)],{reason:this["_formatE"+t(1894)+t(1834)](_0x556ba7)});this.emit(n[t(738)],c)}}[r(1314)+r(752)+r(327)+r(1412)+r(1271)](){let t=r;if(e[t(1427)]!==e[t(701)])return this["currentE"+t(1317)+t(1038)+"t"]=1,this[t(1245)+t(888)]++,this[t(1583)+"s"][this[t(1245)+"ndex"]];{let n=new _0x3ce8be(e[t(1844)](e.BLjjO(e.BLjjO(e[t(1037)](_0x8a1f6c[e.dYbuH(_0x56c247,4)],24),e[t(450)](_0x4392ae[e[t(819)](_0x221396,5)],16)),e[t(684)](_0x146247[e.dwqjE(_0x5906d6,6)],8)),_0xecf430[e[t(1712)](_0x330352,7)]),e[t(772)](_0x5a0b96[e[t(1357)](_0x59d45c,0)]<<24|e[t(1438)](_0x2da5dc[e[t(901)](_0x24880e,1)],16),_0x17da48[_0x49123c+2]<<8)|_0xc8f56d[e[t(1129)](_0x593112,3)],!0);return _0x8225a7+=8,{value:n,offset:e[t(591)](_0xae4529,8)}}}[r(1096)+r(1210)+r(898)+r(781)](){let t=r,n={EmKIv:function(i,c){return i(c)}};return e[t(647)](e[t(1124)],e[t(564)])?(this[t(412)+t(1317)+t(1038)+"t"]++,this[t(1096)+t(1210)+"nt"]()):function(i,...c){let u=t,h=_0x28de2d[u(683)](qwVmSU[u(516)](_0x1995b6,this),i,...c);return _0xcb2575.set(h,i[u(380)]?i[u(380)]():[i]),qwVmSU[u(516)](_0x34f393,h)}}}let it=(e.isWEh(e.mgBuY,typeof globalThis)&&e.trpYA(e[r(1367)],globalThis[r(671)+r(382)].name)||e.dENIA(e[r(710)],typeof window)&&e[r(580)](e[r(1367)],window[r(671)+"tor"][r(514)]))&&e.mgBuY!=typeof document,We=e[r(1637)](r(1172)+"d",typeof globalThis)&&(e[r(1874)](e.cPcEA,globalThis.constructor[r(514)])||e[r(941)](e[r(1250)],globalThis[r(671)+r(382)][r(514)]))&&e[r(1105)](e[r(710)],typeof tt),bt=(e[r(1006)](r(1172)+"d",typeof globalThis)&&e[r(1404)]===globalThis[r(671)+r(382)].name||e[r(950)](e[r(710)],typeof globalThis)||e.ickjK(e[r(710)],typeof globalThis)&&!!globalThis[r(1376)+r(1120)])&&e[r(1568)](e[r(710)],typeof wx),vt=e[r(1330)](r(1172)+"d",typeof globalThis)&&(e[r(747)](e[r(1250)],globalThis[r(671)+r(382)][r(514)])||e[r(1864)](e[r(1745)],globalThis["construc"+r(382)][r(514)])||e[r(862)](e[r(336)],globalThis[r(671)+"tor"][r(514)]))&&e[r(1507)](e[r(710)],typeof self),Vo=e[r(1006)](r(1172)+"d",typeof globalThis)&&e[r(1311)](r(1188),globalThis[r(671)+r(382)][r(514)])&&r(1172)+"d"!=typeof global&&e[r(1751)](r(1188),global[r(671)+r(382)].name)&&e.mgBuY!=typeof process&&!!process[r(1800)];class Xn{constructor(){this._listeners={}}emit(t,...n){let i=r,c=this[i(1425)+"rs"][t];if(c)c[i(749)]().forEach(u=>u.fn[i(1547)](u[i(1468)],n));else if(e[i(951)](e[i(984)],t)&&!this[i(624)])if(e[i(1868)](i(760),e.qpSon)){let u=n.length&&n[0];if(e[i(533)](u,Error))throw u;let h=new Error(e[i(1293)]+(u?e[i(819)](e[i(1508)](" (",u[i(1740)]),")"):""));throw h.context=u,u}else return!!_0x450ade?.[i(1628)](u=>u[i(465)]===_0x4756eb&&u[i(1375)]===_0x497bf0);return this}[r(454)](t,n){let i=r,c={NvjET:function(u,h){return e[k(1708)](u,h)},MBStS:function(u,h){return u<h},sTHop:function(u,h){return u>>h},DWXqx:function(u,h){return e.nreul(u,h)},ZbmAG:function(u,h){return e[k(1028)](u,h)},WuulF:function(u,h){return e.excJi(u,h)},VJFpi:function(u,h){return e[k(1897)](u,h)},ctPSl:function(u,h){return e[k(1243)](u,h)},zEzVi:i(800)+i(1064),MWAXX:function(u,h){return e[i(1900)](u,h)},WMfsQ:function(u,h){return u>>h},Mrqdf:function(u,h){return e[i(694)](u,h)},NkHAE:function(u,h){return e[i(401)](u,h)},SntTN:function(u,h){return u+h},iUmpK:function(u,h){return e[i(560)](u,h)},cOtSL:function(u,h){return u&h}};if(e[i(1389)](void 0,t))this[i(1425)+"rs"]={};else if(n===void 0)this[i(1425)+"rs"][t]=null;else if(e[i(1151)]!==e[i(1151)])if(_0x2733af=_0x246963.charCodeAt(_0x597203),c.NvjET(_0x1658f2,128))_0x39bc39[_0x304d4a++]=_0x31f815;else if(c.MBStS(_0x6ab3a8,2048))_0x5e1c35[_0x24c37f++]=c[i(424)](_0x545beb,6)|192,_0x565391[_0x3cf110++]=c.DWXqx(c[i(640)](63,_0x861075),128);else if(c.WuulF(c[i(1699)](64512,_0xa2ad6b),55296)&&c.WuulF(c[i(1680)](64512,_0x18113f=_0x234616[i(362)+"At"](_0x542a85+1)),56320)){let u=c[i(1645)].split("|"),h=0;for(;;){switch(u[h++]){case"0":++_0x128652;continue;case"1":_0xbecdf3[_0x574d12++]=c.MWAXX(c[i(1680)](c[i(1057)](_0x51458b,6),63),128);continue;case"2":_0x16b7c4[_0x422467++]=c[i(1500)](c[i(863)](63,_0x3cbc59),128);continue;case"3":_0x89a4f4[_0x57ae86++]=_0x560c87>>18|240;continue;case"4":_0x3c3245=c[i(407)](65536+(c[i(699)](1023,_0xff6f9b)<<10),c[i(640)](1023,_0x522276));continue;case"5":_0x1e6102[_0x51346e++]=c[i(1719)](c[i(640)](_0x3b1591>>12,63),128);continue}break}}else _0x2b83d4[_0x353e8a++]=c[i(1881)](_0x1a7de3>>12,224),_0x324cda[_0x342aa4++]=c.cOtSL(_0x5e4ad5>>6,63)|128,_0x143581[_0x15f8f1++]=c[i(1881)](63&_0x28d383,128);else{let u=this[i(1425)+"rs"][t];if(u)for(let h=0;h<u.length;)e[i(939)](u[h].fn,n)?u[i(732)](h,1):++h}return this}on(t,n,i){let c=r;return(this[c(1425)+"rs"][t]||(this[c(1425)+"rs"][t]=[])).push({fn:n,ctx:i||this}),this}}class Yo extends Xn{["_formatE"+r(1894)+"age"](t){let n=r,i={sqquC:function(c,u,h){return e[k(1620)](c,u,h)},OGfAp:function(c,u,h){return e[k(1198)](c,u,h)}};if(e.gPzNM!==e.gPzNM)rnrXtE[n(637)](_0x389515,_0x3bc3bd,50),rnrXtE[n(1178)](_0x42a119,_0x393052,_0x45d9af);else return t[n(645)]||t[n(879)]?(n(1068)+" "+(t[n(645)]||"")+n(1137)+(t[n(879)]||""))[n(766)]():JSON[n(1224)+"y"](t)}constructor(t,n,i){let c=r;super(),this[c(489)]=null,bt&&wx["connectS"+c(636)]&&(this[c(489)]=wx[c(572)+c(636)]({url:t,protocols:n,header:i,fail:this[c(444)+c(510)+"lHandler"][c(490)](this),success:this["_createS"+c(1747)+"cessHand"+c(788)].bind(this)})),We&&tt[c(572)+c(636)]&&(this[c(489)]=tt["connectS"+c(636)]({url:t,protocols:n,header:i,fail:this[c(444)+c(510)+c(597)][c(490)](this),success:this[c(444)+c(1747)+c(940)+c(788)][c(490)](this)}))}[r(444)+r(1747)+r(940)+"ler"](){let t=r,n={VxvzL:function(i,c,u){return e[k(924)](i,c,u)},pULTK:function(i,c){return e[k(455)](i,c)}};if(e[t(343)](e.lTezq,e.lTezq))Promise.resolve().then(()=>{let i=t;this[i(1765)+i(1536)]()});else{let i=EXhLSS.VxvzL(_0xeaeec4,_0x297896,_0xff4c91);return _0x5e36fb[t(1663)].subarray(i,EXhLSS.pULTK(i,_0x5c1ac5))}}[r(444)+"ocketFai"+r(597)](t){let n=r;Promise.resolve()[n(985)](()=>{let i=n;if(e[i(1343)](e[i(594)],e[i(594)])){let c=_0x397cc1[i(1740)][i(470)];c&&_0x2675f8.setCursors(c)}else{let c=e[i(1650)](ue,e[i(984)],{message:this[i(439)+i(1894)+"age"](t)});this[i(339)](e.currj,c);let u=e.FDqHG(pe,e[i(930)],{reason:this[i(439)+"rrorMess"+i(1834)](t)});this[i(339)](e[i(930)],u)}})}["_addWsLi"+r(1536)](){let t=r,n={augJH:function(i,c){return i===c},FrGtp:e[t(1260)],aTRNd:e[t(1885)],cBtHM:e.xlEja,PrnHR:function(i,c,u){return e[t(1861)](i,c,u)},BVHap:t(1740)};this[t(489)][t(975)](i=>{let c=t,u={dYBKA:c(1297)};if(n[c(850)](n[c(1686)],n[c(571)])){let h=this[c(1815)+"tManager"]?.[c(1096)+c(1210)+"nt"]();this[c(449)+c(1586)+c(486)](_0x29bde8(u.dYBKA,{code:1006,reason:c(1322)+h+(c(991)+c(1601)+"tries re"+c(660)),wasClean:!0}))}else this[c(339)](n[c(349)],n[c(807)](os,c(1305),{...i,data:i.errMsg||""}))}),this[t(489)][t(1053)](i=>{let c=t;this.emit(c(1297),pe(c(1297),{...i}))}),this._socket[t(1498)+"e"](i=>{let c=t;this[c(339)](n[c(1029)],is("message",{...i}))}),this[t(489)][t(1168)](i=>{let c=t;this[c(339)](e[c(984)],e.JvbVn(ue,e[c(984)],{...i,message:i[c(645)]||""}))})}send(t){let n=r;if(e.KYOfA(t,Uint8Array)){let i=t[n(1346)][n(749)](t[n(1083)+"et"],e[n(1901)](t.byteLength,t[n(1083)+"et"]));this[n(489)]&&this._socket.send({data:i,fail:c=>{let u=n;this[u(339)](u(1033),e[u(1393)](ue,e[u(984)],{message:this[u(439)+u(1894)+u(1834)](c)}))}})}else this._socket&&this[n(489)][n(1790)]({data:t,fail:i=>{let c=n;this[c(339)](e[c(984)],e[c(944)](ue,"error",{message:this[c(439)+c(1894)+c(1834)](i)}))}})}close(t,n){this[r(489)]&&this._socket.close({code:t,reason:n})}[r(672)+r(1268)](t,n){let i=r;i(550)!==i(899)?this.on(t,n):(_0x1f421c(this[i(1626)+i(1e3)+i(410)]),this[i(1626)+i(1e3)+i(410)]=null)}["removeEv"+r(1091)+r(1537)](t,n){let i=r;e[i(1494)](e[i(1073)],e[i(353)])?(_0x19f412(_0x452f0a,16),_0x1e3d64(_0xd9ba4f,_0x3d57f5)):this[i(454)](t,n)}get readyState(){let t=r;return this[t(489)][t(792)+"te"]}get[r(652)+"pe"](){return this[r(489)].binaryType}set[r(652)+"pe"](t){}get[r(1036)](){let t=r,n={jRJYR:function(i,c,u){return e[k(1197)](i,c,u)}};if(e[t(1682)]===e[t(1674)]){let i=jkMSuG.jRJYR(_0x1556d6,_0x334b7f,_0x257a6c[t(398)]);_0x4dd803[t(1663)][t(1216)](_0x13f08b,i)}else return this[t(489)].url}get protocol(){let t=r;return this._socket[t(1457)]}get[r(440)+"ns"](){return this[r(489)].extensions}get[r(1232)+r(744)](){return 0}}function Qo(s,t){let n=r;if(t)return new t(s[n(1036)],s[n(1457)]);if(e[n(1386)](bt,We))return new Yo(s[n(1036)],s.protocol,s[n(1246)]);if((it||vt)&&e[n(1637)](n(1172)+"d",typeof WebSocket)&&WebSocket)return new WebSocket(s[n(1036)],s[n(1457)+"s"])}function $o(s){let t=r;if(e.anVEF(e[t(1913)],t(1838))){let n=e[t(1769)][t(804)]("|"),i=0;for(;;){switch(n[i++]){case"0":_0x501b9e=e[t(497)](_0x37056f,0,_0x1b04db,_0x3a08f7);continue;case"1":_0x328ff4.log(e[t(1433)],_0xc26876);continue;case"2":_0x30536e[t(1087)](e[t(1644)],_0x264840,_0x400ac4[t(512)]);continue;case"3":_0x74417b.log(e[t(443)],_0x1d2494);continue;case"4":_0x30175d=_0x15b241(_0x47878c["cursor_n"+t(1743)],_0xfe2464,_0x2f206a);continue;case"5":_0x3d304e=e.QKWvq(_0xfbe8d9,_0x50426.fromNumber(_0x4c3874[t(498)]||_0x7bfd7a),_0x4606fc,_0x90374d);continue;case"6":_0x79abec=e[t(1103)](_0x117b9c,_0x4835be,_0x23ab84,_0x54dc21.service||0);continue;case"7":_0x3583=e.QKWvq(_0x39f3dd,_0x3ce0cd[_0x37162d["cursor_n"+t(1743)]],_0x240b9f,_0x7a6ad8);continue;case"8":_0x357248.log(e[t(447)],_0x3f2839);continue;case"9":_0x359926[t(1087)](e.qnrWS,_0x31bb11);continue;case"10":_0x1a6cb8[t(1087)](e[t(628)],_0x1b9707);continue}break}}else{let n=e[t(1106)][t(804)]("|"),i=0;for(;;){switch(n[i++]){case"0":if(We&&tt[t(572)+t(636)])return!0;continue;case"1":if((it||vt)&&e.nKWro(e[t(710)],typeof WebSocket)&&WebSocket)return!0;continue;case"2":if(s)return!0;continue;case"3":return!1;case"4":if(bt&&wx[t(572)+t(636)])return!0;continue}break}}}function xs(s,t,n){let i=-1;async function c(u){let h=k;return e.kTPdd(u,i)?Promise[h(845)](new Error(e[h(1634)])):(i=u,e[h(1509)](u,n[h(398)])?Promise[h(1692)]():n[u].bind(s)(t,c[h(490)](null,e.RmWwU(u,1))))}e.cgyYz(c,0)}function cs(s){let t=r,n=0,i=0;for(let c=0;e[t(1353)](c,s[t(398)]);++c)if(i=s[t(362)+"At"](c),e[t(1194)](i,128))n+=1;else if(i<2048)n+=2;else if((64512&i)===55296&&e[t(868)](e[t(1341)](64512,s.charCodeAt(e[t(1070)](c,1))),56320))if(e[t(1489)]==="vVTKt")++c,n+=4;else return(e[t(1134)](_0x332d4a,4)[t(900)]("0")+e[t(1095)](_0x56bff7,_0x7c1ba,2)[t(871)](16))[t(749)](-4);else n+=3;return n}function fs(s,t,n){let i=r;if(e[i(1483)](n-t,1))return"";let c="";for(let u=t;e[i(1773)](u,n);){let h=s[u++];if(e[i(563)](h,127))c+=String.fromCharCode(h);else if(e[i(1296)](h,192)&&e.cFXFq(h,224))c+=String.fromCharCode(e[i(546)](e.fqfLd(e[i(1400)](31,h),6),e[i(770)](63,s[u++])));else if(h>=224&&h<240)c+=String[i(851)+i(397)](e[i(1480)](e[i(1157)](15,h)<<12,(63&s[u++])<<6)|e.mJhgj(63,s[u++]));else if(e[i(1350)](h,240)){let m=e.XgeXX(e[i(359)](e[i(1435)](e[i(1371)](7,h)<<18|e[i(1239)](63,s[u++])<<12,e[i(813)](e[i(367)](63,s[u++]),6)),e[i(1845)](63,s[u++])),65536);c+=String[i(851)+i(397)](e.AxRZk(55296,e[i(578)](m,10))),c+=String[i(851)+"Code"](e[i(531)](56320,1023&m))}}return c}function Vn(s,t,n){let i=r;if(e[i(408)]!==e[i(408)])return _0x419b16[i(607)]>=_0x54d7f2[i(1497)];{let c=n,u,h;for(let m=0;e[i(1683)](m,s[i(398)]);++m){if(e[i(1288)](i(1140),e[i(1600)]))return i(1176)+"_"+this[i(824)];if(u=s[i(362)+"At"](m),e[i(559)](u,128))t[n++]=u;else if(u<2048)t[n++]=e.nreul(e[i(1849)](u,6),192),t[n++]=e[i(1015)](e[i(560)](63,u),128);else if(e[i(941)](e[i(1273)](64512,u),55296)&&e[i(1211)](64512,h=s.charCodeAt(e.xIJWY(m,1)))===56320){let l=e[i(384)][i(804)]("|"),b=0;for(;;){switch(l[b++]){case"0":u=e[i(1786)](65536,e[i(1474)](e[i(1481)](1023,u),10))+(1023&h);continue;case"1":t[n++]=e[i(393)](e[i(889)](u,6),63)|128;continue;case"2":t[n++]=e[i(1402)](e[i(1808)](e[i(1810)](u,12),63),128);continue;case"3":t[n++]=e.TkEyb(63,u)|128;continue;case"4":++m;continue;case"5":t[n++]=e[i(777)](e[i(1285)](u,18),240);continue}break}}else t[n++]=u>>12|224,t[n++]=e[i(777)](e[i(1735)](e[i(509)](u,6),63),128),t[n++]=e[i(1189)](e[i(1526)](63,u),128)}return n-c}}async function us(s){let t=r;if(e[t(1527)](t(1908),typeof s)){let n=new Uint8Array(e[t(828)](cs,s));return Vn(s,n,0),n}return s instanceof ArrayBuffer?new Uint8Array(s):new Uint8Array(s[t(1346)],s.byteOffset,s[t(1660)+"th"])}function Zo(s){let t=r;if(e.DQrkd(e.YPGpQ,e[t(1344)])){let n=this._qosDB[t(344)+t(1337)](this[t(897)]),i=_0x78094e[t(979)](e[t(644)](n,"{}"));return i[_0x249fa7||_0x319fdb[this[t(1300)]]]=_0x37ca54,this[t(1501)]["setStora"+t(1337)](this[t(897)],_0x127280[t(1224)+"y"](i)),_0x231779||_0x488b4f[this._pathKey]}else try{return e.PIMHn!=typeof s&&(e[t(1739)](s,ArrayBuffer)||s.buffer&&e.rjNVM(s[t(1346)],ArrayBuffer))||e.lZPHC(e[t(479)],typeof s)?"":(JSON[t(979)](s),e[t(422)])}catch{return e[t(1527)](e.PIMHn,typeof s)?t(1257)+t(464)+t(1116):""}}let e0=(s,t)=>{let n=r;if(e[n(736)]===e[n(1757)]){let i=_0xc35d5a[_0x160e1c++];if(e[n(563)](i,127))_0x293b30+=_0x560e3f[n(851)+n(397)](i);else if(e[n(1185)](i,192)&&e[n(1741)](i,224))_0x29ff41+=_0x551126["fromChar"+n(397)](e[n(1065)](e[n(1850)](e.aqqTl(31,i),6),e[n(1319)](63,_0x4044ae[_0x28725d++])));else if(e[n(1067)](i,224)&&e[n(341)](i,240))_0x1994b4+=_0x285c87[n(851)+"Code"](e[n(359)](e[n(1086)](e[n(1511)](15,i),12),e[n(852)](e[n(598)](63,_0x50e2f9[_0x276656++]),6))|e[n(1211)](63,_0x317d21[_0x1b204++]));else if(e[n(1350)](i,240)){let c=e[n(1015)](e[n(722)](e[n(1574)](e[n(706)](7&i,18),e[n(491)](e.DFWYJ(63,_0x129b23[_0xc0be63++]),12)),e.fqpzv(e[n(477)](63,_0x4a164e[_0x52be30++]),6)),63&_0x559d0a[_0x5a81b5++])-65536;_0x27a201+=_0x147803[n(851)+n(397)](e[n(630)](55296,e.tAzFa(c,10))),_0x30f2f5+=_0x29c9af["fromChar"+n(397)](e.qOLQH(56320,1023&c))}}else switch(s){case e.XqaVX:case n(1513):return{[n(721)+s]:1,"x-tt-env":t};default:return{}}};class t0{constructor(t){let n=r;this[n(574)+n(753)]=t,this.count=0}[r(870)](){let t=r;if(e[t(1524)](e[t(1905)],e[t(1905)]))return _0x52029d||(_0x296d25=_0x36f989[t(1692)]()[t(985)](_0x2f01f3[t(490)](_0x2aa29b,t(1004)))),_0x33216a;this[t(1325)]++}[r(1149)+r(379)+"nt"](){let t=r;return e[t(620)](this[t(1325)],this[t(574)+t(753)])}[r(963)+r(1200)](t=0){let n=r;this[n(574)+n(753)]=t,this.count=0}}async function n0(s){let t=r,n={qFQxa:function(i,c){return i||c},BiwCq:function(i,c){return e[k(854)](i,c)},tMKLr:function(i,c){return e[k(1511)](i,c)},Bmtwt:function(i,c){return i|c},MMdWz:e[t(423)],CKiZa:function(i,c){return i!==c},WFJAh:e[t(1307)],IAuAL:"WdXMT",yQupd:e[t(1855)],QlWQv:"text/javascript",vppYt:function(i,c){return e[t(858)](i,c)},VqRIV:e.GvyoB,irUyk:function(i,c){return e[t(357)](i,c)},bAOTL:e[t(799)],abrlQ:function(i,c){return e[t(1788)](i,c)}};return new Promise(i=>{let c=t,u={GACdm:n[c(1045)]};if(!it)return i(n[c(1045)]);try{if(n[c(1761)](n[c(467)],n[c(865)])){let h=document[c(971)+c(482)](n[c(943)]);window["frontier"+c(1642)]=m=>{let l=c;document[l(1717)]["removeCh"+l(1230)](h),window[l(1176)+l(1642)]=void 0,i(m&&m[l(948)]||u[l(995)])},h[c(1155)]=n[c(823)],h[c(774)]=n[c(785)](s.replace(/^ws/,c(1370)),n[c(1649)]);try{document.body[c(1334)+c(1230)](h)}catch{if(n[c(1630)](n[c(331)],"ZVWsL"))document.body[c(1242)+c(1230)](h);else{let m=this[c(1501)][c(344)+c(1337)](this[c(897)]),l=_0x15f515[c(979)](n[c(920)](m,"{}"));return l[_0x5d9b7d]=void 0,this[c(1501)].setStorageSync(this[c(897)],_0x20c6d2[c(1224)+"y"](l))}}}else _0x205173[_0x3f0f8e++]=_0x585906>>12|224,_0x3f7284[_0x512320++]=IKWvTB.BiwCq(IKWvTB[c(1590)](_0x5485e3>>6,63),128),_0x14f1db[_0x1d1d9d++]=IKWvTB[c(1465)](IKWvTB[c(1590)](63,_0x5c89df),128)}catch{window[c(1176)+c(1642)]=void 0,n[c(411)](i,c(1060)+c(793))}})}function qe(s,t,n){let i=r;return!!s?.find(c=>c[i(465)]===t&&c[i(1375)]===n)}function ot(s,t){let n=r;if(e[n(1281)](e[n(1110)],e[n(1110)]))return s?.[n(1628)](i=>i[n(465)]===t)?.[n(1375)];if(this[n(527)]&&e[n(1311)](this._ws[n(792)+"te"],this[n(1796)+"NG"])){this["_clearPi"+n(1072)](),this[n(1283)+n(1662)+"Id"]=_0x54e43d(this[n(1559)].bind(this),this[n(895)][n(1320)+"rval"]);return}if(!this[n(527)]||this[n(527)][n(792)+"te"]!==this[n(1233)])return void this[n(1714)+n(1094)]();this[n(527)]&&this[n(527)].send("hi"),this[n(1830)+n(1622)+n(524)]=e[n(1492)](_0x18a267,this[n(1714)+n(1094)+"Timeout"][n(490)](this),this._options[n(365)+n(1081)+n(780)])}let Yn=null;async function r0(){let s=r;return Yn||(Yn=Promise[s(1692)]()[s(985)](Se.bind(Se,e[s(1269)]))),Yn}class s0 extends Xn{constructor(t,n){let i=r;super(),this[i(801)]=t,this._keyPath=n,this[i(1501)]=void 0,this["_initPro"+i(976)]=null}async[r(1109)](){await this[r(860)]()}async[r(860)](){let t=r,n={TPSOn:function(i,c,u,h){return e.yRGtE(i,c,u,h)}};if(!this[t(1501)]){if(this._initPromise)return this[t(1771)+"mise"];try{let i=this[t(801)],c=this[t(1304)];this[t(1771)+"mise"]=(async()=>{let u=t,{openDB:h}=await r0();this[u(1501)]=await n[u(960)](h,u(1176)+"_"+i,1,{upgrade(m){m[u(1127)+"jectStore"](i,{keyPath:c})}})})(),await this["_initPro"+t(976)]}catch(i){console[t(1087)](i)}finally{this[t(1771)+t(976)]=null}}}async[r(964)](t){let n=r;try{return await this[n(860)](),this[n(1501)]?.[n(964)](this[n(801)],t)}catch(i){console[n(1087)](i)}}async[r(1216)](t,n){let i=r;return await this._init(),this[i(1501)]?.[i(1532)](this._dbName,t)}async del(t){let n=r;try{if(e[n(1912)](e[n(880)],n(329)))return await this[n(860)](),this[n(1501)]?.delete(this[n(801)],t);e.MzFVk(_0x34a296,_0x2ff6ac,8),_0x1b492c(_0xe22110,_0x4ad8aa)}catch(i){console[n(1087)](i)}}async clear(){let t=r,n={iyBXV:function(i,c){return e.TsZYH(i,c)}};try{return await this._init(),this[t(1501)]?.clear(this[t(801)])}catch(i){if(e.PNWld(e[t(1593)],t(977))){let c=this[t(1501)]["getStora"+t(882)+"nc"](this[t(897)]),u=_0x5998be[t(979)](n[t(452)](c,"{}"));return _0xe80ade[t(757)](u)}else console[t(1087)](i)}}async keys(){let t=r;return await this[t(860)](),this[t(1501)]?.[t(399)+"ys"](this[t(801)])}async[r(1779)](){let t=r;return await this[t(860)](),this._qosDB?.[t(1779)](this[t(801)])}async[r(1395)](){let t=r;if(e[t(378)]("ulWfC",t(803)))this.emit(e.currj,_0x341170),this.onerror&&this[t(624)](_0x2cb432);else try{this[t(1501)]?.[t(1297)](),this._qosDB=void 0}catch(n){console[t(1087)](n)}}get isReady(){let t=r;try{return!!this._qosDB}catch(n){return console[t(1087)](n),!1}}}class i0{constructor(t,n){let i=r;this[i(824)]=t,this[i(1300)]=n,this[i(1501)]=localStorage}async[r(1109)](){}get _prefix(){let t=r;return t(1176)+"_"+this[t(824)]}async get(t){let n=r,i=this[n(1501)][n(843)](this._prefix);return JSON[n(979)](e.XQYGZ(i,"{}"))[t]}async[r(1216)](t,n){let i=r,c=this._qosDB[i(843)](this[i(897)]),u=JSON[i(979)](e[i(665)](c,"{}"));return u[n||t[this._pathKey]]=t,this[i(1501)][i(1647)](this[i(897)],JSON[i(1224)+"y"](u)),n||t[this[i(1300)]]}async del(t){let n=r,i=this._qosDB[n(843)](this._prefix),c=JSON[n(979)](e[n(665)](i,"{}"));return c[t]=void 0,this[n(1501)].setItem(this[n(897)],JSON.stringify(c))}async[r(679)](){let t=r,n={bCHPw:function(i,c){return e[k(602)](i,c)},Xazbs:function(i,c){return e[k(361)](i,c)},RNwvx:e.NMavs,wMKdj:e[t(1652)]};if(e[t(1144)](e[t(669)],e[t(1873)]))return this[t(1501)].clear();{let i=_0x3de718[t(804)](/\./)[t(1019)](h=>_0x1ceca2(h)),c=[];return c[0]=rjTMnO[t(1781)](_0x3d1e7e,rjTMnO.Xazbs(i[0],i[1])),c[1]=_0x19941f(rjTMnO[t(906)](i[2],i[3])),[rjTMnO[t(832)],rjTMnO[t(832)],rjTMnO[t(832)],t(448),rjTMnO[t(832)],rjTMnO.wMKdj,c[0],c[1]].join("")}}async[r(757)](){let t=r,n=this._qosDB[t(843)](this[t(897)]),i=JSON[t(979)](n||"{}");return Object[t(757)](i)}async[r(1779)](){let t=r,n=this[t(1501)][t(843)](this[t(897)]),i=JSON.parse(n||"{}");return Object[t(556)](i)}[r(1395)](){return Promise[r(1692)]()}get[r(1240)](){return!!this._qosDB}}class o0{constructor(t,n){let i=r;this._DBName=t,this[i(1300)]=n,this[i(1501)]=We?tt:bt?wx:null}async openDB(){}get[r(897)](){let t=r;return t(1176)+"_"+this[t(824)]}async[r(964)](t){let n=r,i=this._qosDB[n(344)+n(1337)](this._prefix);return JSON.parse(e[n(861)](i,"{}"))[t]}async set(t,n){let i=r,c=this[i(1501)]["getStora"+i(1337)](this._prefix),u=JSON[i(979)](e.sqCzk(c,"{}"));return u[n||t[this[i(1300)]]]=t,this[i(1501)][i(1522)+i(1337)](this[i(897)],JSON[i(1224)+"y"](u)),n||t[this[i(1300)]]}async del(t){let n=r,i=this[n(1501)][n(344)+n(1337)](this[n(897)]),c=JSON[n(979)](e[n(665)](i,"{}"));return c[t]=void 0,this[n(1501)]["setStora"+n(1337)](this[n(897)],JSON[n(1224)+"y"](c))}async[r(679)](){let t=r;return this[t(1501)][t(1742)+t(1496)]()}async keys(){let t=r,n=this[t(1501)][t(344)+t(882)+"nc"](this[t(897)]),i=JSON[t(979)](e[t(1386)](n,"{}"));return Object.keys(i)}async[r(1779)](){let t=r;if(e[t(1253)](t(374),e[t(535)]))return this[t(489)][t(652)+"pe"];{let n=this._qosDB["getStora"+t(882)+"nc"](this[t(897)]),i=JSON[t(979)](n||"{}");return Object[t(556)](i)}}[r(1395)](){let t=r,n={hGHrJ:function(i,c){return i instanceof c}};if(e[t(517)]!==e[t(517)])RXlmAF.hGHrJ(_0x1f6040,_0x187505)&&_0x5df500[t(1216)](_0x321e22,_0x231239);else return Promise[t(1692)]()}get isReady(){return!!this[r(1501)]}}function ds(s,t){let n=r;if(e[n(665)](We,We))return new o0(s,t);if(e.dciOu(it,vt)&&e[n(710)]!=typeof indexedDB)return new s0(s,t);if(e.dmXkU(it,vt)&&e[n(1637)](e[n(710)],typeof localStorage))return new i0(s,t);throw new Error(e[n(805)])}class a0{constructor(){let t=r;this["_interva"+t(657)+"Id"]=null,this._interval=36e5,this[t(1501)]=e[t(377)](ds,e[t(1008)],e[t(1794)])}async[r(1085)+r(1407)](){let t=r,n={ldqNR:function(i,c,u){return e[k(1620)](i,c,u)},aoWbh:function(i,c){return e[k(1119)](i,c)}};e.Abjcd(e.ZTJXc,e.ZTJXc)?(e[t(1629)](clearInterval,this[t(1085)+"lTimeoutId"]),this[t(1085)+t(657)+"Id"]=e[t(481)](setInterval,()=>{this["flushExp"+t(573)]()},this[t(1085)+"l"])):(_0x39ca7d-=65536,_0x144b1c+=jSnKGd[t(1324)](_0x53c8e9,(_0x2fe5ed>>10)+55296,jSnKGd[t(1424)](1023,_0x3a09c4)+56320),_0x7c5da8+=3)}async[r(1109)](){let t=r,n={zCPDQ:function(i,c){return e[k(1488)](i,c)},dvAfO:e.MiLkB};await this[t(1501)][t(1109)]()[t(985)](()=>{let i=t;if(n[i(1477)](n.dvAfO,n[i(1009)]))this[i(1085)+i(1407)]();else return new _0x14c1d5(_0x148e82,{message:_0x12e671,code:_0xfb0b79,error:_0x2ef426})})}async[r(1003)+r(573)](){let t=r;(await this[t(1501)]?.[t(1779)]()||[])[t(689)](({timestamp:c})=>c<Date[t(1654)]())[t(1041)](c=>{let u=t;this[u(1501)]?.[u(1722)](c[u(395)+"id"])})}async[r(1722)](t){let n=r;return this[n(1501)]?.[n(1722)](t)}async[r(1216)](t,n){let i=r;return this[i(1501)]?.[i(1216)]({message_id:t,timestamp:n})}async[r(964)](t){let n=r;return this._qosDB?.[n(964)](t)}async[r(1395)](){let t=r;e[t(1056)](clearInterval,this[t(1085)+t(657)+"Id"]),await this._qosDB?.[t(1395)]()}get[r(1240)](){let t=r;return this[t(1501)]?.[t(1240)]}}function Qn(s){let t=r,n=!!this[t(895)].enableQoS;if(!n)return{enabled:n,isQoSMessage:!1,isQoSAck:!1,isAckCleanupMessage:!1,ackMsgIds:[]};let i=qe(s[t(1740)][t(1246)],e[t(1558)],"2"),c=i&&e[t(504)](qe,s[t(1740)][t(1246)],e[t(1635)],"1"),u=i&&e.FIFmu(qe,s[t(1740)].headers,t(914)+t(1575)+"k","1"),h=u?e[t(1299)](ot,s[t(1740)][t(1246)],e[t(1777)])?.split(",")[t(689)](Boolean)||[]:[];return{enabled:n,isQoSMessage:i,isQoSAck:c,isAckCleanupMessage:u,ackMsgIds:h}}async function ls(){let s=r;return this[s(1732)+"ger"]||(this[s(1732)+s(1853)]=new a0),this["_QoSMana"+s(1853)][s(1240)]||await this._QoSManager[s(1109)](),this["_QoSMana"+s(1853)]}async function x0(s,t){let n=r,{enableAutoAck:i}=this[n(895)],c=qe(s.message[n(1246)],e[n(1306)],"1"),u=qe(s[n(1740)][n(1246)],e[n(1734)],"1"),h=Qn[n(683)](this,s);if(e[n(837)](i,c)){let{SeqID:m,LogID:l,service:b,LogIDNew:v,method:C}=s.message;this._sendAck({SeqID:m,LogID:l,LogIDNew:v,service:b,method:C,headers:[{key:e[n(1734)],value:"1"},{key:e[n(1623)],value:e[n(644)](v,"")},{key:n(1209),value:"0"}]})}u&&!h[n(1384)]&&this[n(449)+n(1561)+n(1222)](s),e.pcuWV(t)}async function c0(s,t){let n=r;this[n(537)](e[n(748)],s[n(1740)]),e[n(1054)](t)}async function f0(s,t){let n=r;if(e.vCpDU!==e[n(1440)]){if(e[n(582)](_0x52470a,_0x1d4b17))throw new _0x4af684(e[n(1267)]);let i=3;for(;e[n(1817)](i,0);){let c=e[n(1581)](255,_0x47c636);e[n(1515)](_0x345615,c,_0x4ca297,e.RKFwJ(_0x13eea7,i)),_0x9c4aa8>>>=8,i--}return _0x5846ce+4}else{let i=e[n(619)](Xr,await e[n(1206)](us,s[n(1471)]));try{if(e[n(1739)](i[n(470)],Uint8Array))if(e[n(884)](e[n(1025)],e[n(1138)])){let c=this[n(1815)+n(695)]?.[n(1096)+n(1210)+"nt"]();this[n(537)](n(1467)+c),_0x1a1d17()}else{let c=e[n(1510)](this[n(895)]["payloadE"+n(1746)],Object)?{force:!!this[n(895)][n(1152)+n(1746)].force,encoding:this[n(895)][n(1152)+n(1746)][n(835)]?this[n(895)][n(1152)+n(1746)][n(835)][n(743)](/\s/g,"")[n(937)+n(475)]():""}:{force:!1,encoding:this._options[n(1152)+n(1746)]?this._options[n(1152)+n(1746)][n(743)](/\s/g,"")[n(937)+n(475)]():""},u=i[n(1152)+n(1746)]?i[n(1152)+n(1746)][n(743)](/\s/g,"")[n(937)+n(475)]():"",h=this[n(895)][n(696)+"ype"]instanceof Object?{force:!!this._options["payloadT"+n(1347)][n(419)],type:this[n(895)][n(696)+n(1347)][n(1155)]?this[n(895)][n(696)+n(1347)].type[n(743)](/\s/g,"")[n(937)+n(475)]():""}:{force:!1,type:this._options[n(696)+"ype"]?this[n(895)][n(696)+n(1347)].replace(/\s/g,"")[n(937)+"ase"]():""},m=i.payloadType?i[n(696)+n(1347)][n(743)](/\s/g,"")[n(937)+n(475)]():"",l=h[n(419)]?h[n(1155)]:m||h[n(1155)],b=c[n(419)]?c[n(835)]:u||c[n(835)],v=[e[n(841)],e[n(422)],e[n(844)],n(1908)],C=[e.dSJex,e[n(1675)]];this[n(895)][n(1449)+n(451)+"extPayload"]&&v.includes(l)&&(!b||C[n(1241)](b))?i[n(1520)+n(1482)]=fs(i[n(470)],0,i[n(470)][n(1660)+"th"]):i[n(1520)+n(1482)]=""}else i["textPayl"+n(1482)]=""}catch(c){i["textPayl"+n(1482)]="",console[n(1087)](c)}s.message=i,e[n(1750)](t)}}function u0(s,t,n){let i=r,c=e.CYswF(n,8192),u=e[i(1716)](c,1),h=null,m=c;return function(l){let b=i;if(l<1||e.qsMLR(l,u))return s(l);m+l>c&&(h=e.cDNPU(s,c),m=0);let v=t[b(683)](h,m,m+=l);return e[b(617)](7,m)&&(m=e.RSrXP(7,m)+1),v}}let d0=4294967295;function l0(s,t,n){let i=r;return e[i(1039)](e.ahKzC,e[i(346)])?this[i(527)]?this._ws[i(652)+"pe"]:this[i(816)+i(1347)]:RangeError(e[i(812)](e[i(1090)](e[i(1729)](e.mUnkd(e[i(455)](e[i(685)],s),e[i(1205)]),e[i(1386)](t,1)),e[i(1899)]),n))}function h0(s,t,n){let i=r;if(e[i(881)](e.UQFtd,e[i(1609)]))this[i(449)+"hMessage"+i(521)](_0x46a56e),_0x59b847[i(1216)](_0xf5a3b5,_0x26c823,_0x1b90ab[i(1740)][i(512)]);else{if(e.qoplO(n,d0))throw new Error(e[i(1267)]);let c=3;for(;e[i(1212)](c,0);){let u=e.aiqxh(255,n);e[i(1326)](Zn,u,s,e.NfXix(t,c)),n>>>=8,c--}return t+4}}function g0(s,t){let n=r,i=0,c=t,u=e.nyFBh(t,4);for(;c<u;){let{value:h,offset:m}=$n(s,c);c=m,i=e[n(1551)](e[n(813)](i,8),0),i+=h}return{value:i,offset:u}}function p0(s,t,n){let i=r,c=(i(1700)+"1")[i(804)]("|"),u=0;for(;;){switch(c[u++]){case"0":if(t[i(485)])return e[i(1363)](t[i(485)](s,n),n);continue;case"1":return Vn(s,t,n)+n;case"2":if(!s)return n;continue;case"3":if(t[i(632)+"e"])return e[i(966)](t.utf8Write(s,n),n);continue;case"4":if(e[i(896)](s[i(398)],40))return e.NfXix(e.EIUhl(Vn,s,t,n),n);continue}break}}function m0(s,t){let n=r,i=new O(e[n(927)](e[n(1706)](s[t+4],24)|e[n(1542)](s[e[n(1313)](t,5)],16)|e[n(1474)](s[t+6],8),s[t+7]),e[n(1435)](e[n(815)](e[n(1538)](e[n(813)](s[e[n(1196)](t,0)],24),e[n(682)](s[t+1],16)),s[t+2]<<8),s[e[n(1842)](t,3)]),!0);return t+=8,{value:i,offset:e[n(1259)](t,8)}}function _0(s,t,n){let i=r,c=s[i(420)],u=s[i(1504)];return t[n]=e[i(1249)](u,24),t[e[i(1416)](n,1)]=e.GWMMa(u,16)&255,t[e[i(681)](n,2)]=e[i(1048)](e.EqOrJ(u,8),255),t[n+3]=e.IpZIb(255,u),t[e[i(947)](n,4)]=c>>>24,t[n+5]=e[i(703)](e.AxtID(c,16),255),t[n+6]=e.nYSdw(e[i(797)](c,8),255),t[e[i(455)](n,7)]=255&c,n+=8,n}function $n(s,t){let n=r;if(e.fgMCq("JtizL",n(1580)))return s[n(1668)+"8"]?{value:s.readUInt8(t),offset:t+1}:{value:e[n(770)](255,s[t]),offset:e[n(1519)](t,1)};if(e[n(626)](e[n(1705)](_0x696a93[n(607)],_0x2db2bb),_0xd4b97c[n(1497)]))throw new _0x49b9bf(e[n(712)]);_0x336289[n(607)]+=_0xbc52bf}function Zn(s,t,n){let i=r,c={VunGu:function(u,h){return e.iYJCv(u,h)},EzHlQ:function(u,h){return e[k(1192)](u,h)},Kkbgy:e.mgBuY,MScIb:i(1616)+i(1229)+"d"};if(e[i(661)](e[i(570)],i(726))){if(DadpQy[i(1666)](_0x46b9bb,_0x5aaa30))return new _0x2efc1b(_0x647f96,_0x5e9078);if(DadpQy[i(1666)](_0x10c789,_0x46c630)&&DadpQy.EzHlQ(DadpQy.Kkbgy,typeof _0x4d9124))return new _0x22bd1a(_0x12fffb,_0x259c28);if(DadpQy[i(1666)](_0x598f4e,_0x54dbb5)&&DadpQy[i(1066)](DadpQy[i(1701)],typeof _0x28b566))return new _0x535f56(_0x3bda34,_0x43d04e);throw new _0x1ac747(DadpQy.MScIb)}else return t[i(1606)+"t8"]?t[i(1606)+"t8"](s,n):t[n]=e.MJXei(255,s),n+1}let w0=function(s){return new Uint8Array(s)},y0=e[r(1568)](e[r(710)],typeof Buffer)?Buffer[r(1866)+"afe"]:e[r(577)](u0,w0,Uint8Array[r(934)+"e"][r(795)]);(()=>{let s=r,t={UXtHF:function(n,i){return n|i},gsGhj:function(n,i){return e[k(1778)](n,i)},WnlYe:function(n,i){return e[k(758)](n,i)},dwLdp:function(n,i){return e[k(1822)](n,i)},UzZpK:function(n,i){return e[k(350)](n,i)},HoSYu:function(n,i){return e.WQbXM(n,i)},CNcma:function(n,i){return e[k(495)](n,i)},mMJxl:function(n,i,c){return n(i,c)},sQVsA:function(n,i){return n+i},bvKNt:function(n,i){return e.RmXEf(n,i)},bcBGD:function(n,i){return e.ajCgH(n,i)},bFDgk:e[s(445)],XgdHO:e[s(737)],qAkPV:e[s(992)],JhjYm:function(n,i){return e[s(840)](n,i)},SUVYe:function(n,i){return e[s(1581)](n,i)},BVAcU:function(n,i){return e[s(1818)](n,i)},yEoQW:function(n,i){return e[s(1419)](n,i)},rhtxL:function(n,i){return e[s(1133)](n,i)},TKIBa:function(n,i){return n<<i},NabVm:function(n,i){return e[s(1150)](n,i)},PyBcn:function(n,i){return e[s(1408)](n,i)},MPGSk:function(n,i){return e.zbugm(n,i)},rvWIE:function(n,i){return e[s(1474)](n,i)},hvrQF:function(n,i){return e[s(1780)](n,i)},ElYbm:function(n,i){return e.zbrNH(n,i)},rnPrx:function(n,i){return n&i},jjfyL:function(n,i){return n<<i},zLnRJ:function(n,i){return n!==i},rNnWu:e[s(1658)],Osyoc:function(n,i,c,u){return e[s(426)](n,i,c,u)}};if(e[s(1912)](e[s(1531)],e[s(1531)])){let n=4294967295;return function(i,c,u=!0){let h=s,m={DTAKD:function(l,b,v){return l(b,v)},zcURF:t[h(1599)]};if(t[h(904)]!==t.qAkPV){if(n=t.JhjYm(t[h(1854)](127,i[c]),0),t[h(1336)](i[c++],128))return{value:u?n:t.yEoQW(0,n),offset:c};if(n=t[h(1464)](t[h(342)](n,t.TKIBa(t[h(1439)](127,i[c]),7)),0),t.BVAcU(i[c++],128))return{value:u?n:t[h(956)](0,n),offset:c};if(n=t[h(1047)](t.MPGSk(n,t[h(1451)](t[h(894)](127,i[c]),14)),0),t.ElYbm(i[c++],128))return{value:u?n:0|n,offset:c};if(n=t.PyBcn(t[h(342)](n,t[h(608)](127,i[c])<<21),0),t[h(1392)](i[c++],128))return{value:u?n:t[h(1505)](0,n),offset:c};if(n=t[h(1047)](n|t.jjfyL(15&i[c],28),0),t[h(1336)](i[c++],128))return{value:u?n:t[h(1603)](0,n),offset:c};if(t[h(1479)](c+=5,i[h(398)])){if(t[h(1618)](t[h(836)],h(1678)))throw c=i[h(398)],t[h(1180)](l0,c,10,i[h(398)]);{this[h(1388)+h(907)+"t"]();let l=m[h(366)](_0x1f1d85,h(1819)+"t",{message:m[h(1523)]});this[h(711)+h(1753)+h(731)+"ct"]&&this[h(711)+"mediatel"+h(731)+"ct"](l)}}return{value:u?n:t.UXtHF(0,n),offset:c}}else _0x584fda=kiJCaM[h(1802)](kiJCaM[h(1603)](kiJCaM[h(994)](7&_0x581d4f,18)|kiJCaM.WnlYe(63&_0x488300,12),kiJCaM.WnlYe(kiJCaM[h(1360)](63,_0x3567b0),6)),kiJCaM[h(1220)](63,_0xb2690d)),kiJCaM[h(1392)](_0x183831,65536)||kiJCaM.CNcma(_0x4be5b5,1114111)?_0x21f436+=_0x54015:(_0x5c1df6-=65536,_0x938ae6+=kiJCaM[h(500)](_0x292730,kiJCaM.sQVsA(_0x276256>>10,55296),kiJCaM[h(1333)](kiJCaM[h(476)](1023,_0x58f5a2),56320)),_0x5e949d+=3)}}else return e.eOUZd(_0x1ab3bc,_0x18b350)?_0x565016:new _0x222eaf(e[s(501)](e[s(463)](e.xyLkS(_0xf9a693[s(683)](_0x2ee8f4,0),_0x3ba135[s(683)](_0x60962b,1)<<8),_0x3d225c[s(683)](_0x20e8e4,2)<<16)|e[s(1516)](_0x4f416e[s(683)](_0x18b845,3),24),0),e.OvIPl(e[s(1574)](e[s(400)](_0x40de26[s(683)](_0x534c31,4)|e[s(1037)](_0x41732a[s(683)](_0x6d5925,5),8),_0x23db42[s(683)](_0x4e3b57,6)<<16),e.DnOhc(_0x5daa20[s(683)](_0x1d7c3a,7),24)),0),!0)})();let b0=16,er=32;function v0(s){let t=r,n=0,i={};for(let c=0;e[t(519)](c,s.length);c++)i[s[c]["cursor_n"+t(1743)]]=cs(s[c][t(762)+"ame"]),n+=e.RvRxn(14,i[s[c][t(762)+t(1743)]]);return[n,i]}function hs(s,t,n){let i=r,c={etuCI:function(b,v){return e[k(325)](b,v)},bUeEX:i(373)+i(986)+i(1843),gPvQO:e[i(1433)],BZSuY:function(b,v,C,P){return e[i(1823)](b,v,C,P)},ZMEnt:function(b,v,C,P){return e.PfTwe(b,v,C,P)},racir:e.crnip,NPcNb:"name",ToLiJ:"header",ZyjIo:function(b,v,C,P){return e[i(1108)](b,v,C,P)}},[u,h]=e.QTzZY(v0,s),m=y0(u),l=0;return s[i(1041)](b=>{let v=i;if(c.etuCI(v(1835),v(1835))){let C=_0x1eea5d.pop();return C?(C.offset=C[v(1497)]=0,C):{bytes:new _0x1bdfda(64),offset:0,limit:0}}else{let C=c[v(938)][v(804)]("|"),P=0;for(;;){switch(C[P++]){case"0":console[v(1087)](c[v(612)],l);continue;case"1":l=c[v(595)](_0,O[v(356)+"er"](b[v(498)]||t),m,l);continue;case"2":l=c[v(635)](Zn,0,m,l);continue;case"3":console[v(1087)](c.racir,l);continue;case"4":console[v(1087)](c[v(663)],l);continue;case"5":l=h0(m,l,b.service||0);continue;case"6":l=c.ZMEnt(p0,b[v(762)+v(1743)],m,l);continue;case"7":console[v(1087)](v(1115),l);continue;case"8":console.log(v(1450)+"ervice",b,b[v(512)]);continue;case"9":console[v(1087)](c[v(1833)],l);continue;case"10":l=c[v(723)](Zn,h[b[v(762)+v(1743)]],m,l);continue}break}}}),{frameType:er,headers:[{key:e.eMHJO,value:n}],payload:m}}function S0(s){let t=r,n=0,i=[];for(;e[t(1217)](n,s[t(1660)+"th"]);){let{offset:c}=e[t(1252)]($n,s,n);n=c;let u={cursor_name:"",cursor:0,service:0},{value:h,offset:m}=e[t(1770)](g0,s,n);u[t(512)]=h,n=m;let{value:l,offset:b}=e[t(1602)]($n,s,n);n=b,u[t(762)+t(1743)]=e[t(460)](fs,s,n,n+l),n+=l;let{value:v,offset:C}=e[t(577)](m0,s,n);u[t(498)]=v[t(1687)](),n=C,i[t(358)](u)}return i}function C0(){let s=r;return{frameType:er,headers:[{key:s(1247)+s(409),value:e[s(1730)]}],payload:void 0}}class E0{constructor(t,n,i){let c=r;this[c(1484)+c(961)]=t,this["_cursorF"+c(1848)]=n,this[c(1688)+"Strategy"]=i,this[c(1501)]=e.UGkFh(ds,this[c(1484)+"ameSpace"],e[c(543)])}async[r(1109)](){let t=r;await this[t(1501)][t(1109)]()}async[r(1514)+"rs"](){let t=r;if(!this[t(1501)].isReady)return;let n=this[t(1688)+t(717)],i=await this._qosDB[t(1779)]();switch(console.log(e.FdWsU,i),n){case"ALL":return i&&i.length?e[t(1403)](hs,i,0,this._cursorFileName):void 0;case e[t(1865)]:return;case e[t(1055)]:return i&&i[t(398)]?hs(i,0,this[t(1589)+t(1848)]):e[t(1026)](C0)}}async[r(1216)](t,n,i){let c=r;if(e[c(1011)]!==c(1878))return console[c(1087)](e.stgdR,t,n,i),this[c(1501)].set({cursor_name:t,cursor:n,service:i});_0x1ba726.log(_0x4e2dbb)}async setCursors(t){let n=r,i=e[n(638)](S0,t);for(let c of i)console.log(e.rPDzN,i),await this[n(1501)][n(1216)](c)}async[r(964)](t){let n=r;return(await this[n(1501)][n(964)](t))?.[n(498)]}async[r(1395)](){let t=r;await this[t(1501)][t(1395)]()}[r(691)+r(1458)+"Name"](t){let n=r;this[n(1589)+"ileName"]=t}get isReady(){let t=r;return this[t(1501)][t(1240)]}}let A0=r(1611)+"qos__";async function gs(s){let t=r;if(!this[t(895)][t(1338)+"S"])return null;let{aID:n,fpID:i,messageStrategy:c}=this[t(895)],u=e[t(644)](s,A0);try{return this[t(1075)+t(1776)]?s&&this[t(1075)+"anager"][t(691)+t(1458)+t(389)](s):this[t(1075)+t(1776)]=new E0(i+"_"+n+"_"+u,u,c),this["_cursorM"+t(1776)].isReady||await this[t(1075)+"anager"][t(1109)](),this[t(1075)+"anager"]}catch{return null}}async function k0(s,t){let n=r,i={yTqNk:n(335)+"0|1|5|10|8|11|9|2",kWQWP:function(c,u){return c|u},kPfnR:function(c,u){return c<<u},yWkJo:function(c,u){return c&u},irJUC:function(c,u){return e.OGzsa(c,u)},adwCw:function(c,u){return e.olbfa(c,u)},sTGLf:function(c,u){return c<u},rFxPT:function(c,u){return e[n(1119)](c,u)},ggQbn:function(c,u){return e[n(568)](c,u)},ZsENS:function(c,u){return c&u},jxQFo:function(c,u){return e[n(1169)](c,u)},VaWIt:function(c,u){return e[n(1556)](c,u)},ELfry:function(c,u){return e[n(1480)](c,u)},HAgcK:function(c,u){return e.axrWD(c,u)}};if(e[n(1689)](e[n(702)],e.sEJhU)){let c=e[n(1331)](qe,s[n(1740)][n(1246)],n(634),"-1"),u=qe(s[n(1740)][n(1246)],e[n(1734)],"1"),h=ot(s[n(1740)][n(1246)],e.AxKgC),m=Number(ot(s[n(1740)].headers,e[n(616)]))||0,l=Qn[n(683)](this,s),b=e[n(1331)](qe,s[n(1740)][n(1246)],e.DPrfT,"2"),v=ot(s[n(1740)][n(1246)],n(433)+n(754)+"e"),C=e[n(520)](Number,e.JvbVn(ot,s[n(1740)][n(1246)],n(433)+n(1470)+"ue"));if(l.isQoSAck)return e[n(345)](t);let P=l[n(1030)+"sage"]?await ls[n(683)](this):null;if(e[n(878)](s[n(1740)][n(512)],0)&&u&&!c||e[n(1820)](s[n(1740)][n(512)],0)){if(h&&l[n(1030)+"sage"]&&P)return!!!await P[n(964)](h)&&(this["_dispatchMessage"+n(521)](s),await P[n(1216)](h,e[n(1729)](Date[n(1654)](),m))),e[n(417)](t);if(b){let L=await gs[n(683)](this);if(!L)return this[n(449)+n(403)+"Event"](s),e[n(1026)](t);let I=await L.get(v)??-1;if(e.Surst(I,C))if(e[n(796)](e[n(437)],e[n(1351)]))this[n(449)+n(403)+n(521)](s),L[n(1216)](v,C,s[n(1740)][n(512)]);else return n(1908)==typeof _0x22d4cc?e[n(841)]:"";else throw new Error(n(354)+" message cursor "+C+(" larger "+n(1409)+n(746)+"r ")+I);return e[n(1608)](t)}return this["_dispatc"+n(403)+"Event"](s),e[n(417)](t)}}else{let c=i[n(1101)][n(804)]("|"),u=0;for(;;){switch(c[u++]){case"0":_0x3c6d26=kjFrSn.kWQWP(_0x3da201,kjFrSn.kPfnR(kjFrSn.yWkJo(127,_0x3599b4[_0x9f8342]),14))>>>0;continue;case"1":if(_0x5cc679[_0xc08a8++]<128)return{value:_0x5c5053?_0x22db94:kjFrSn.irJUC(0,_0x1dd228),offset:_0x3b01c5};continue;case"2":return{value:_0x1efc68?_0x34ed06:kjFrSn.adwCw(0,_0x1645c6),offset:_0x56ea0d};case"3":if(kjFrSn[n(1517)](_0x157559[_0x1846e2++],128))return{value:_0x112659?_0x232536:kjFrSn[n(1727)](0,_0x4271c8),offset:_0x1677d3};continue;case"4":if(_0x320107[_0x5f5872++]<128)return{value:_0x16c09d?_0x4ab232:kjFrSn[n(376)](0,_0x544731),offset:_0x267672};continue;case"5":_0x1b67f5=kjFrSn.irJUC(_0x2ddf7c,kjFrSn[n(1460)](127,_0x3bf366[_0xb43fbb])<<21)>>>0;continue;case"6":_0x3b6e34=kjFrSn[n(1605)](kjFrSn[n(431)](127,_0xf898c5[_0x3dd2e0]),0);continue;case"7":_0x4fa17b=kjFrSn.ggQbn(kjFrSn[n(1727)](_0x177c74,kjFrSn[n(1340)](kjFrSn[n(1059)](127,_0x7ae1a2[_0x15edf1]),7)),0);continue;case"8":_0x35db24=kjFrSn[n(1031)](_0x4b8d0e,(15&_0x404244[_0x249bd8])<<28)>>>0;continue;case"9":if(kjFrSn.VaWIt(_0x1f9a68+=5,_0x56e72f[n(398)]))throw _0x4652b3=_0x3c30a4[n(398)],_0xe28c51(_0x30561c,10,_0x354c65[n(398)]);continue;case"10":if(_0xbbc297[_0x113539++]<128)return{value:_0x45c669?_0x1e4086:kjFrSn[n(952)](0,_0x3dc5e2),offset:_0x5b6071};continue;case"11":if(_0x4b51f4[_0x4448ae++]<128)return{value:_0x5e2263?_0x59f536:kjFrSn[n(893)](0,_0x50a2dd),offset:_0x24b73f};continue}break}}}async function D0(s,t){let n=r,i=Qn[n(683)](this,s);if(!i["isQoSMes"+n(1607)])return t();let c=await ls[n(683)](this);if(i["isAckCle"+n(429)+n(1834)]&&i[n(1368)+"s"][n(398)])for(let u of i[n(1368)+"s"])await c.del(u);e[n(1723)](t)}async function P0(s,t){let n=r,i=e.anVEF(s[n(1740)].frameType,b0),c=e.imlHJ(s[n(1740)][n(1552)+"e"],er);if(e[n(837)](!i,!c))return e[n(1723)](t);let u=ot(s.message[n(1246)],e[n(396)]);if(!u)return t();let h=await gs.call(this,u);if(!h)return e[n(1054)](t);if(i){let m=await h[n(1514)+"rs"](),l={frameType:m?.[n(1552)+"e"],SeqID:O[n(356)+"er"](this._seqId++),LogID:O[n(356)+"er"](this[n(895)][n(864)+n(1069)]()),service:9e3,method:5,headers:m?.[n(1246)],payload:m?.[n(470)]},b=e[n(885)](A,l);this._ws&&this[n(527)][n(792)+"te"]&&this._ws.send(b)}if(c){let m=s[n(1740)][n(470)];m&&h.setCursors(m)}}let I0=async function(s,t){let n=r;this[n(1373)]=!1,clearTimeout(this[n(1626)+n(1e3)+n(410)]),t()},T0=async function(s,t){let n=r;if(!this[n(527)]||e.iaMDp(this._ws.readyState,this[n(1233)]))return e[n(551)](t);let{pingInterval:i}=this[n(895)];this[n(1815)+n(695)]?.[n(834)+"pointCon"+n(782)]();for(let u=0;u<this._messageQueue[n(398)];u++){let h=this[n(1688)+"Queue"][u];if(this[n(527)][n(792)+"te"]===this[n(1233)]&&e.PDNMS(null,h))e.KADQX("PHNxU",e[n(1454)])?this.count++:(this._ws&&this[n(527)][n(1790)](h),this[n(1688)+n(330)][u]=null);else break}this["_message"+n(330)]=this[n(1688)+"Queue"][n(689)](u=>!!u),this[n(1283)+"gTimeoutId"]=e[n(1904)](setTimeout,()=>this._ping(),i),this[n(449)+n(360)+"nt"](s),this[n(1447)+"er"]&&this[n(527)]&&(this._ws.binaryType=this[n(816)+n(1347)]);let c=this["_endpoin"+n(695)]?.[n(1096)+n(1210)+"nt"]();this[n(537)](n(1467)+c+n(957)),e.kjDWJ(t)},L0=async function(s,t){let n=r;if(e[n(1153)](e[n(402)],e[n(493)])){let i=this["_endpoin"+n(695)]?.[n(1096)+n(1210)+"nt"]();this[n(537)](n(1467)+i),e.qaZto(t)}else _0x23b03b=_0x354ac7[n(1824)](_0x3152d0),_0x1c8ef6=_0x51a53e.concat(_0x12efce[_0x430de2])};class N0 extends Xn{constructor(t){let n=r,i={DPLTH:function(c,u,h){return c(u,h)},ClCBd:function(c,u){return c===u},nOvYe:function(c,u){return e[k(1311)](c,u)},WwQxC:function(c,u){return e[k(676)](c,u)},AeEEb:e.etGju,qcLqj:e[n(1385)],TGPpS:function(c,u){return e[n(1007)](c,u)},ETqdu:e[n(1525)],bwEPA:function(c,u,h,m){return e.QKWvq(c,u,h,m)},NSMif:e[n(667)],jGLTQ:function(c,u){return c!==u},AmxQi:function(c,u,h){return e[n(1102)](c,u,h)},vfHwB:e[n(930)],XQnbp:function(c,u){return c(u)},SYJFW:e.currj,CVAwR:function(c,u,h){return e[n(1602)](c,u,h)}};if(e[n(1573)](e[n(1097)],e[n(394)])){super(),this[n(1420)+n(1563)+n(387)]=!0,this[n(1447)+"er"]=it,this._isNode=Vo,this._isMiniTT=We,this[n(1475)+"X"]=bt,this[n(1446)+"r"]=vt,this["_message"+n(330)]=[],this["_endpoin"+n(695)]=null,this[n(741)+n(438)]=!1,this[n(816)+n(1347)]=e[n(1362)],this[n(1626)+n(1614)]=!1,this[n(1626)+"ionTimeo"+n(410)]=null,this[n(1830)+n(1622)+n(524)]=null,this["_pingPon"+n(1662)+"Id"]=null,this._seqId=0,this._isInit=!1,this[n(690)]="",this[n(1732)+n(1853)]=null,this["_cursorM"+n(1776)]=null,this[n(959)+n(1261)]=null,this._protocols=n(1801),this[n(478)]=3,this[n(1796)+"NG"]=0,this[n(1233)]=1,this[n(1782)]=2,this._onOpen=m=>{let l=n;try{e[l(1071)](xs,this,m,[I0,T0,L0])}catch(b){if(e[l(1343)](l(1455),e[l(1565)])){let v=ue(e[l(984)],{message:b[l(1740)],code:ze[l(1720)+"OR"],error:b});this[l(449)+"hErrorEv"+l(486)](v)}else this[l(1688)+l(330)].shift(),this[l(1688)+"Queue"].push(_0x5de35c)}},this[n(480)+"ge"]=async m=>{let l=n,{pingInterval:b,pingFrequency:v}=this[l(895)];if((i[l(1803)]("hi",m.data)&&i.nOvYe(l(1640),v)||i[l(1310)](l(1856),v))&&(this["_clearPi"+l(1072)](),this.emit(i[l(1879)],i[l(877)]),this[l(1283)+"gTimeoutId"]=i.DPLTH(setTimeout,this[l(1559)][l(490)](this),b)),!i[l(1310)]("hi",m[l(1471)]))try{i[l(1535)](i[l(1171)],"XAQXw")?this.emit(l(1740),LFrXZN[l(806)](_0x1e5b85,"message",{..._0x3933fc})):i.bwEPA(xs,this,m,[f0,x0,D0,P0,k0,c0])}catch(C){if(i[l(1803)](i[l(1122)],i[l(1122)])){let P=ue(l(1033),{message:C.message,code:ze[l(534)+l(1295)],error:C});this[l(449)+l(1158)+l(486)](P)}else this.on(_0x57fb12,_0x3bd496)}},this[n(1744)]=m=>{let l=n,b=this[l(1815)+l(695)]?.[l(1149)+l(471)+"es"](),v=this[l(1815)+"tManager"]?.[l(1096)+"ntEndpoint"]();if(b&&!m[l(1740)]){let C=l(1322)+v+(l(1005)+"ax retri"+l(1422)+"ed");this[l(449)+l(1158)+l(486)](e.vHYDC(ue,e.currj,{message:C,code:ze.MAX_RETRIES_ERROR,error:m}));return}this._ws&&e[l(580)](this[l(527)].readyState,this.OPEN)&&this._disconnect(),this[l(449)+l(1158)+"ent"](e.dvuuc(ue,e[l(984)],{message:m.message,code:ze[l(1058)+l(441)],error:m}))},this[n(1698)]=async m=>{let l=n;this[l(1221)+l(1390)](),this[l(704)+l(1072)](),this[l(1111)+l(1577)+"rs"](),this[l(527)]=null,this["_connect"+l(1614)]=!1;let b=this[l(1815)+"tManager"]?.[l(1149)+"chMaxTries"]();if(!b&&this[l(1398)+l(530)]()&&!this[l(741)+l(438)]){let v=this[l(1815)+l(695)]?.["getCurre"+l(1210)+"nt"](),C=this._options["reconnec"+l(1684)+l(1888)](m[l(634)],m[l(793)]);this[l(449)+l(1586)+"ent"](i.DPLTH(pe,"close",{code:1006,reason:m[l(793)]||l(552)+l(761)+"d, unkno"+l(1648)+l(1709)+l(1272)+v,willReconnect:C})),C&&this[l(1626)]();return}if(i.jGLTQ(1e3,m[l(634)])&&this[l(741)+l(438)]){this["_dispatc"+l(1586)+l(486)](i.AmxQi(pe,i[l(1476)],{code:1e3,reason:l(915)})),this[l(1815)+"tManager"]?.[l(834)+l(1139)+l(782)](),this["_pingLos"+l(1261)]?.[l(963)+"nter"]();return}if(i.jGLTQ(1e3,m[l(634)])&&b){let v=this[l(1815)+l(695)]?.[l(1096)+l(1210)+"nt"](),C=m[l(793)];C||(C=await i[l(1383)](n0,this[l(690)])),C=l(552)+l(761)+l(386)+C+(", hostna"+l(869))+v+(l(1601)+"tries re"+l(660)),this["_dispatc"+l(1586)+l(486)](i.AmxQi(pe,i.vfHwB,{code:m[l(634)],reason:C}));let P="connect "+v+(l(1005)+l(949)+"es reached");this[l(449)+l(1158)+"ent"](ue(i[l(1284)],{message:P,code:ze[l(1839)+l(1126)+"R"]})),this[l(1815)+l(695)]?.[l(834)+l(1139)+l(782)](),this[l(959)+l(1261)]?.[l(963)+l(1200)]();return}if(m[l(634)]!==1e3&&!m[l(793)]){let v=this[l(1815)+l(695)]?.[l(1096)+l(1210)+"nt"]();this[l(449)+l(1586)+l(486)](i[l(1010)](pe,i[l(1476)],{code:m[l(634)],reason:l(552)+"ng faile"+l(1597)+"wn reaso"+l(1709)+l(1272)+v})),this["_endpoin"+l(695)]?.[l(834)+l(1139)+"fig"](),this[l(959)+l(1261)]?.[l(963)+l(1200)]();return}this[l(449)+"hCloseEv"+l(486)](m),this[l(1815)+l(695)]?.[l(834)+l(1139)+l(782)](),this[l(959)+"sCounter"]?.[l(963)+l(1200)]()},this[n(592)]=null,this[n(624)]=null,this[n(1415)+"e"]=null,this[n(1401)]=null,this[n(466)+n(1094)]=null,this[n(677)+"eAck"]=null,this[n(711)+n(1753)+"yReconnect"]=null,this[n(1136)+n(1540)]=this[n(1136)+n(1540)].bind(this),this["_handleO"+n(1292)]=this[n(1136)+n(1292)][n(490)](this),this[n(1380)+"ageHide"]=this[n(1380)+"ageHide"][n(490)](this),this[n(1380)+"ageShow"]=this[n(1380)+"ageShow"].bind(this),this._options={url:"",automaticOpen:!0,initReconnectInterval:1e3,maxReconnectInterval:1e4,reconnectIntervalGrowFactor:2,timeoutInterval:5e3,maxRetries:5,debug:!1,maxMessageQueueLength:1/0,service:0,logIDGenerator:x,headers:void 0,payloadEncoding:"",payloadType:"",fpID:"",deviceID:"",accessKey:"",ttwID:"",bddID:"",aID:"",disableAutoReconnect:!1,customParams:{},pingInterval:15e3,pingTimeoutInterval:4e3,pingFrequency:e[n(708)],pingLossCount:2,enableTransformTextPayload:!1,logIDNewConfig:{enableAutoGenerateLogIDNew:!1,userIp:""},miniProgramParams:{customHttpHeader:{}},enableAutoAck:!1,reconnectInterceptor:()=>!0,enableQoS:!1,QoSLevel:2,messageStrategy:n(1846),env:{xTTEnv:"",xUseEnv:""},listenNetworkChanged:!0};let{url:c,ws:u}=t,h=Array[n(1499)](c)?c:e.tEpOi(e[n(479)],typeof c)?[c]:[];if(!h||e[n(1389)](0,h.length))throw new Error(e.pYrdi);if(!$o(u))throw new Error(n(1486)+n(1726)+n(983)+", WebSoc"+n(1585)+"tructor "+n(715)+n(1443));if(Object[n(996)](this[n(895)],t),this["_endpoin"+n(695)]=new as(h,this._options[n(1429)+"es"]),this["_pingLos"+n(1261)]=new t0(this[n(895)][n(1907)+n(599)]),this[n(895)]["automati"+n(990)]&&(this._isInit=!0,this[n(1626)]()),this[n(895)][n(1646)+"tworkCha"+n(633)])if(e.pEcXP(e.JZury,e[n(1584)])){let m=this[n(1501)][n(843)](this._prefix),l=_0x1a9a15[n(979)](e[n(1795)](m,"{}"));return l[_0x52760e]=void 0,this[n(1501)].setItem(this._prefix,_0x59ad99.stringify(l))}else this[n(713)+"T"]||this[n(1475)+"X"]?this[n(1617)+n(1841)+n(1382)]():this[n(1447)+"er"]&&this[n(973)+n(714)+n(1268)]()}else try{_0x3e5c50(this,_0x1dfc66,[_0x374e4b,_0xfd5288,_0x19a006])}catch(c){let u=e[n(413)](_0xa2fe70,e[n(984)],{message:c[n(1740)],code:_0x196c44.OPEN_ERROR,error:c});this[n(449)+n(1158)+"ent"](u)}}[r(1136)+"nLine"](){let t=r;this[t(895)][t(549)+t(970)+"nect"]||this[t(741)+t(438)]||this[t(1714)+"econnect"]()}[r(1136)+r(1292)](){let t=r;this["_destroy"+t(907)+"t"]();let n=e[t(1567)](Jn,e[t(848)],{message:e.oJdyy});this[t(711)+"mediatelyReconnect"]&&this[t(711)+"mediatelyReconnect"](n)}[r(973)+r(714)+r(1268)](){let t=r;this[t(1447)+"er"]&&window[t(672)+t(1268)](t(1612),this._handleOnLine),this[t(1447)+"er"]&&window[t(672)+t(1268)](e[t(1887)],this[t(1136)+t(1292)]),this[t(1447)+"er"]&&window[t(672)+t(1268)](e[t(503)],this[t(1380)+t(1309)]),this._isBrowser&&window[t(672)+t(1268)](t(579),this[t(1380)+"ageShow"])}[r(1503)+r(714)+r(1268)](){let t=r;this._isBrowser&&window[t(1710)+t(1091)+t(1537)](e[t(1428)],this[t(1136)+t(1540)]),this[t(1447)+"er"]&&window[t(1710)+t(1091)+"ner"](t(589),this[t(1136)+"ffLine"]),this[t(1447)+"er"]&&window[t(1710)+t(1091)+t(1537)](e.cpUOo,this[t(1380)+"ageHide"]),this[t(1447)+"er"]&&window[t(1710)+t(1091)+t(1537)](e[t(1785)],this[t(1380)+t(1657)])}[r(1380)+r(1309)](t){let n=r;!t[n(1374)+"d"]&&(this[n(1447)+"er"]&&window["removeEv"+n(1091)+"ner"](n(962),this[n(1380)+"ageHide"]),this[n(1447)+"er"]&&window[n(1710)+"entListener"](e[n(1785)],this[n(1380)+n(1657)]),this.close()),this[n(1447)+"er"]&&window[n(1710)+"entListe"+n(1537)](e[n(1428)],this["_handleO"+n(1540)]),this[n(1447)+"er"]&&window["removeEv"+n(1091)+n(1537)](e[n(1887)],this[n(1136)+"ffLine"])}[r(1380)+r(1657)](t){let n=r,i={ewtgO:function(c,u){return e[k(1394)](c,u)},xhIzE:function(c){return e[k(1750)](c)},WjOiy:function(c,u){return e[k(1434)](c,u)},XunxQ:function(c){return e[k(1867)](c)},LTwri:e[n(1385)],UIfcE:e[n(984)]};if(e[n(773)]!==e[n(1238)])t[n(1374)+"d"]&&(this._navigatorOnline()&&(!this._ws||e[n(647)](this[n(527)][n(792)+"te"],this[n(1233)])||e[n(1263)](this[n(527)][n(792)+"te"],this[n(1796)+"NG"]))&&this["_handleO"+n(1540)](),this[n(1447)+"er"]&&window[n(672)+"Listener"](e[n(1428)],this[n(1136)+n(1540)]),this[n(1447)+"er"]&&window["addEvent"+n(1268)](e[n(1887)],this[n(1136)+n(1292)]));else{let c={zdIpN:gftDCn.LTwri,yFKpa:gftDCn.UIfcE},u=()=>{let l=n;_0x669336["removeEv"+l(1091)+"ner"](c[l(1154)],h),_0xb3f230[l(1710)+l(1091)+l(1537)](c[l(1816)],m)},h=()=>{let l=n;gftDCn[l(430)](_0x4439fc,_0x22d5b9(_0x23d4b7.result)),gftDCn.xhIzE(u)},m=()=>{let l=n;gftDCn[l(739)](_0xb2fe8c,_0x170c27[l(1033)]),gftDCn.XunxQ(u)};_0x521b61["addEvent"+n(1268)](gftDCn.LTwri,h),_0x3c3512[n(672)+n(1268)](gftDCn[n(1756)],m)}}async["_generat"+r(1783)](t){let n=r,{fpID:i,deviceID:c,bddID:u,ttwID:h,accessKey:m,aID:l,customParams:b={},enableAutoAck:v,enableQoS:C,QoSLevel:P,env:L}=this[n(895)],I,te,ne;this[n(1447)+"er"]||this[n(1475)+"X"]||this[n(713)+"T"]?(I=location&&e.dBFSV(e.dxwXR,location.protocol)?e[n(1677)]:e[n(1182)],te=t[n(743)](/((^ws)|(^http))((?:[s]*:\/\/))/,""),ne=/^wss(.*:\/\/)/[n(1098)](t)?t:""+I+te):(I=e[n(1677)],te=t[n(743)](/(^http)((?:[s]*:\/\/))/,""),ne=/(^ws)((?:[s]*:\/\/))/.test(te)?te:""+I+te);let me=u?n(1032):h?e[n(724)]:"device_id",ps=u||h||c;if(!ps||!me)throw new Error(e[n(1279)]);let M0=e[n(1231)](e[n(751)],typeof b)?await e[n(345)](b):b,R0=L?e0(L[n(1736)],L[n(918)]):{},tr=Object.assign({device_platform:e[n(453)],version_code:n(1624)+"0",access_key:m,fpid:i,aid:l,[me]:ps,xsack:v?1:0,xaack:v?1:0,xsqos:C?1:0,qos_level:C?P:void 0,qos_sdk_version:2,...R0},M0),O0=Object[n(757)](tr)[n(1876)]((nr,rr)=>tr[rr]!==void 0?""+nr+(nr?"&":"?")+rr+"="+tr[rr]:nr,"");return ne+n(1286)+O0}async[r(1626)](){let t=r;if(!(this[t(1626)+t(1614)]||this[t(741)+"osed"])){this[t(1626)+t(1614)]=!0;try{let n=this[t(1815)+t(695)]?.["checkCur"+t(404)+"ointReac"+t(779)+t(1456)](),{timeoutInterval:i}=this[t(895)];if(n){let u=this[t(1815)+t(695)]?.["getCurre"+t(1210)+"nt"](),h=this[t(1815)+t(695)]?.["replaceB"+t(752)+t(327)+"UpdateCo"+t(1271)](),m=this[t(1815)+t(695)]?.[t(1096)+t(1210)+t(1117)+t(753)]();if(h){let l=t(1322)+u+(t(991)+t(1601)+t(662)+t(936)+t(532)+"backup endpoint ")+h+(t(1437)+"y"),b=e[t(1882)](ue,t(1033),{message:l,code:ze[t(1839)+t(1126)+"R"]});this[t(537)](l),this[t(449)+t(1158)+t(486)](b),this._url=await this[t(1265)+t(1783)](h),this._debug(t(1322)+h+" "+m+t(434)),this["_removeW"+t(1577)+"rs"]()}else{let l=t(1322)+u+(t(991)+t(1601)+t(662)+"ached");this[t(537)](l),this["_dispatc"+t(1158)+"ent"](e[t(413)](ue,e[t(984)],{message:l,code:ze[t(1839)+t(1126)+"R"]}));return}}else{let u=this._endpointManager?.[t(1096)+t(1210)+t(898)+t(781)](),h=this[t(1815)+t(695)]?.["getCurre"+t(1210)+t(1117)+t(753)]();this[t(690)]=await this["_generat"+t(1783)](u||""),this[t(537)]("connect "+u+" "+h+t(434)),this[t(1111)+t(1577)+"rs"]()}if(this[t(1373)])this._isInit=!1;else{let u=e[t(1882)](Jn,e[t(848)],{message:"start"});this[t(466)+t(1094)]&&this["onStartR"+t(1094)](u)}let c=this[t(1815)+t(695)]?.[t(1096)+"ntEndpoi"+t(1117)+"ount"]()||0;e[t(1225)](c,1)&&await this._wait(e[t(1631)](c,1)),this._debug(t(552)+t(745)+this[t(690)]+(" protoco"+t(1132))+this._protocols),this[t(527)]=e[t(1266)](Qo,{url:this[t(690)],protocols:[this._protocols],headers:this._options["miniProg"+t(1237)+"s"][t(1207)+t(1656)]},this[t(895)].ws),(this[t(1447)+"er"]||this[t(1446)+"r"])&&this[t(527)]&&(this[t(527)][t(652)+"pe"]=this[t(816)+t(1347)]),this["_addWsLi"+t(1536)](),this["_connect"+t(1e3)+"utId"]=e.HScjT(setTimeout,this._onTimeout[t(490)](this),i)}catch(n){throw this[t(1626)+t(1614)]=!1,n}}}[r(1221)+"mer"](){let t=r;if(e[t(1798)](e[t(565)],e[t(565)])){let n=e[t(875)].split("|"),i=0;for(;;){switch(n[i++]){case"0":if(!this._ws)return;continue;case"1":this[t(527)][t(1710)+t(1091)+"ner"](e[t(1772)],this[t(480)+"ge"]);continue;case"2":this[t(527)][t(1710)+"entListener"](e[t(1018)],this[t(1880)]);continue;case"3":this[t(527)]["removeEv"+t(1091)+t(1537)](e[t(984)],this._onError);continue;case"4":this._ws[t(1710)+t(1091)+"ner"](e[t(930)],this._onClose);continue}break}}else clearTimeout(this[t(1626)+t(1e3)+t(410)]),this[t(1626)+t(1e3)+t(410)]=null}[r(704)+r(1072)](){let t=r;e.sBgED(clearTimeout,this[t(1283)+t(1662)+"Id"]),clearTimeout(this[t(1830)+"ctTimeoutId"]),this[t(1283)+t(1662)+"Id"]=null,this[t(1830)+t(1622)+t(524)]=null}[r(537)](...t){let n=r;this._options[n(1903)]&&console.log[n(1547)](console,[e.StuDh,...t])}[r(981)+r(1023)+"e"](t){let n=r,{initReconnectInterval:i,maxReconnectInterval:c,reconnectIntervalGrowFactor:u}=this[n(895)],h=e[n(1669)](i,Math[n(831)](u,e[n(1100)](t,1)));return e[n(1113)](h,c)?c:h}[r(1559)](){let t=r;if(this._ws&&e[t(1379)](this[t(527)][t(792)+"te"],this[t(1796)+"NG"])){this["_clearPi"+t(1072)](),this[t(1283)+"gTimeoutId"]=e[t(1121)](setTimeout,this[t(1559)][t(490)](this),this[t(895)]["pingInte"+t(1762)]);return}if(!this[t(527)]||e[t(378)](this[t(527)][t(792)+"te"],this.OPEN))return void this._handleReconnect();this[t(527)]&&this._ws[t(1790)]("hi"),this[t(1830)+"ctTimeou"+t(524)]=setTimeout(this[t(1714)+t(1094)+t(1837)][t(490)](this),this[t(895)]["pingTime"+t(1081)+t(780)])}[r(1714)+r(1094)+r(1837)](){let t=r,n={kTobE:e[t(984)],PnClE:function(i,c,u){return e[t(859)](i,c,u)}};e[t(1509)](e[t(1789)],e.HHWcJ)?this[t(339)](TLbTnj[t(763)],TLbTnj[t(435)](_0x49dee3,TLbTnj[t(763)],{message:this["_formatErrorMess"+t(1834)](_0x4cdffe)})):(this[t(959)+t(1261)]?.[t(870)](),this[t(339)](e[t(1595)],e[t(1145)]),this[t(959)+t(1261)]?.[t(1149)+t(379)+"nt"]()?this[t(1714)+t(1094)]():this._ping())}[r(1398)+r(530)](){let t=r;return this[t(713)+"T"]||this._isMiniWX?this[t(1420)+t(1563)+t(387)]:(this._isBrowser||this._isWorker)&&this[t(895)][t(1646)+t(639)+t(633)]?navigator[t(326)]:!0}[r(1714)+r(1094)](){let t=r;!this[t(1398)+t(530)]()||this["_readyCl"+t(438)]||(this[t(1815)+t(695)]?.resetEndpointConfig(),this[t(959)+t(1261)]?.["resetCou"+t(1200)](),this._ws?this[t(613)+t(680)](1001,e[t(1051)],!0):this[t(1626)]())}[r(1617)+"etWorkCh"+r(1382)](){let t=r,n={IuExF:function(i,c){return e.aKPEq(i,c)},HbGLH:e[t(886)]};this._isMiniTT?tt[t(1076)+t(1847)+"hange"](({isConnected:i})=>{let c=t;if(e[c(1493)](c(1576),c(1576))){let u=_0x5ec8e6[c(607)];if(LdtMzh.IuExF(u+_0x47435d,_0x17b9e0.limit))throw new _0x475fbd(LdtMzh.HbGLH);return _0x4cf530[c(607)]+=_0x30b6ce,u}else this[c(1420)+c(1563)+"line"]=i,i?this[c(1136)+c(1540)]():this[c(1136)+"ffLine"]()}):this._isMiniWX&&wx["onNetwor"+t(1847)+t(1332)](({isConnected:i})=>{let c=t;this[c(1420)+c(1563)+"line"]=i,i?this[c(1136)+c(1540)]():this["_handleO"+c(1292)]()})}_wait(t){return new Promise(n=>{let i=k;e.YLPkc(setTimeout,n,this["_getInte"+i(1023)+"e"](t))})}[r(613)+r(680)](t=1e3,n="",i=!1){let c=r;this[c(527)]&&this[c(1388)+c(907)+"t"](t,n,i)}[r(457)+"ut"](){let t=r,n=this[t(1815)+t(695)]?.[t(1096)+t(1210)+"nt"]();this[t(537)]("connect "+n+t(991)),this["_disconn"+t(680)](1001,e[t(1869)],!0)}[r(1487)](t){let n=r,i=e[n(887)](Gn,t);this._ws&&e[n(1485)](this[n(527)][n(792)+"te"],this[n(1233)])&&(this._ws&&this[n(527)].send(i),this[n(537)](e[n(1077)],t))}[r(1111)+"sListeners"](){let t=r,n=e[t(642)].split("|"),i=0;for(;;){switch(n[i++]){case"0":this[t(527)][t(1710)+"entListener"](e.xlEja,this[t(1880)]);continue;case"1":this._ws.removeEventListener("error",this[t(1744)]);continue;case"2":this[t(527)]["removeEventListe"+t(1537)](t(1740),this[t(480)+"ge"]);continue;case"3":if(!this[t(527)])return;continue;case"4":this[t(527)][t(1710)+"entListe"+t(1537)](e[t(930)],this[t(1698)]);continue}break}}_addWsListeners(){let t=r,n=e.YstUd[t(804)]("|"),i=0;for(;;){switch(n[i++]){case"0":if(!this[t(527)])return;continue;case"1":this._ws[t(672)+"Listener"]("close",this[t(1698)]);continue;case"2":this[t(527)]["addEvent"+t(1268)](e[t(1772)],this[t(480)+"ge"]);continue;case"3":this._ws["addEvent"+t(1268)](e.xlEja,this[t(1880)]);continue;case"4":this[t(527)]["addEvent"+t(1268)](e[t(984)],this._onError);continue}break}}[r(1012)+r(1766)](t=1e3,n=""){let i=r;if(e[i(1253)](e[i(1672)],e[i(1870)]))try{this[i(527)]&&this[i(527)][i(1297)](t,n)}catch{}else{let c=(i(1282)+"4|7|2|3").split("|"),u=0;for(;;){switch(c[u++]){case"0":this["_clearTi"+i(1390)]();continue;case"1":this[i(1503)+i(714)+"Listener"]();continue;case"2":if(this[i(527)].readyState===this[i(478)]||e.WauWk(this._ws[i(792)+"te"],this[i(1782)]))return void this[i(537)](e[i(421)]);continue;case"3":this[i(1388)+"WebSocket"](_0x40550,_0x1cbbd2);continue;case"4":this[i(1732)+i(1853)]?.closeDB();continue;case"5":this[i(704)+"ngTimer"]();continue;case"6":this[i(741)+i(438)]=!0;continue;case"7":if(!this._ws)return void this[i(537)]("close, w"+i(1366)+i(1277)+"nitialized");continue}break}}}[r(1388)+r(907)+"t"](t=1e3,n="",i=!1){let c=r;if(this[c(704)+c(1072)](),this["_clearTi"+c(1390)](),this[c(1111)+"sListeners"](),this["_wsInsta"+c(1766)](1e3,n),this["_connect"+c(1614)]=!1,i&&this[c(1398)+c(530)]()&&!this["_readyCl"+c(438)]){if(this["_endpoin"+c(695)]?.[c(1149)+"chMaxTries"]()){let h=this["_endpoin"+c(695)]?.[c(1096)+"ntEndpoint"]();this["_dispatc"+c(1586)+c(486)](e[c(406)](pe,c(1297),{code:1006,reason:c(1322)+h+(c(991)+c(1601)+c(662)+c(660)),wasClean:!0}))}else{let h=this[c(895)][c(1819)+c(1684)+c(1888)](t,n);this[c(449)+c(1586)+c(486)](e[c(1074)](pe,e[c(930)],{code:t,reason:n,wasClean:!0,willReconnect:h})),h&&this._connect()}return}this[c(1398)+c(530)]()||this[c(741)+c(438)]?this["_dispatc"+c(1586)+c(486)](e[c(830)](pe,c(1297),{code:t,reason:e[c(583)]})):this[c(449)+c(1586)+c(486)](e[c(1043)](pe,e[c(930)],{code:1006,reason:e.NVjFT})),this[c(527)]=null,this[c(1815)+"tManager"]?.[c(834)+c(1139)+c(782)](),this[c(959)+"sCounter"]?.["resetCou"+c(1200)]()}[r(449)+r(360)+"nt"](t){let n=r;this[n(339)](e[n(1018)],t),this.onopen&&this[n(1401)](t)}[r(449)+r(403)+"Event"](t){let n=r;this[n(339)]("message",t),this.onmessage&&this[n(1415)+"e"](t)}[r(449)+r(1561)+r(1222)](t){let n=r;if(e.iufrM(e[n(965)],e[n(965)]))this[n(339)](e.lCCPg,t),this[n(677)+n(499)]&&this[n(677)+n(499)](t);else return(this[n(1425)+"rs"][_0x3affe8]||(this[n(1425)+"rs"][_0x644339]=[]))[n(358)]({fn:_0x3e1787,ctx:_0x12b6a8||this}),this}["_dispatc"+r(1158)+r(486)](t){let n=r;this[n(339)](e.currj,t),this[n(624)]&&this[n(624)](t)}["_dispatchCloseEv"+r(486)](t){let n=r;this.emit(n(1297),t),this[n(592)]&&this[n(592)](t)}get[r(652)+"pe"](){let t=r;return this[t(527)]?this._ws.binaryType:this[t(816)+t(1347)]}set[r(652)+"pe"](t){let n=r;this["_binaryT"+n(1347)]=t,this[n(527)]&&(this[n(527)][n(652)+"pe"]=t)}get retryCount(){let t=r;return this["_endpoin"+t(695)]?.[t(1096)+"ntEndpoi"+t(1117)+"ount"]()||0}get[r(1232)+r(744)](){let t=r;return this._messageQueue.reduce((i,c)=>(i+=c&&c[k(1660)+"th"]||0,i),0)+(this[t(527)]?this[t(527)][t(1232)+t(744)]:0)}get extensions(){let t=r;return this[t(527)]?this._ws[t(440)+"ns"]:""}get[r(1457)](){let t=r;return this[t(527)]?this[t(527)].protocol:""}get[r(792)+"te"](){let t=r;return this[t(527)]?this._ws.readyState:this[t(895)][t(600)+t(990)]?this[t(1796)+"NG"]:this[t(478)]}get[r(1036)](){let t=r;return this._ws?this[t(527)][t(1036)]:this._url}[r(1297)](t=1e3,n){let i=r,c=e[i(1342)][i(804)]("|"),u=0;for(;;){switch(c[u++]){case"0":if(this._ws[i(792)+"te"]===this[i(478)]||this._ws.readyState===this[i(1782)])return void this[i(537)]("close, w"+i(1578)+i(1432));continue;case"1":this[i(1221)+i(1390)]();continue;case"2":this[i(1732)+"ger"]?.[i(1395)]();continue;case"3":this[i(741)+i(438)]=!0;continue;case"4":this._destroyWebSocket(t,n);continue;case"5":this[i(704)+"ngTimer"]();continue;case"6":if(!this[i(527)])return void this[i(537)](i(615)+"s instan"+i(1277)+"nitialized");continue;case"7":this[i(1503)+i(714)+"Listener"]();continue}break}}async[r(1790)](t,n){let i=r;if(e[i(1044)](null,t))throw new Error(i(1486)+"rovide a"+i(1758)+i(822)+"a must be a stri"+i(1352)+i(1167)+i(791));e.ubTvR(e[i(809)],typeof t)&&(t=JSON.stringify(t)),e[i(479)]!=typeof t&&!(t instanceof ArrayBuffer)&&!(t[i(1346)]&&e[i(558)](t[i(1346)],ArrayBuffer))&&(t=JSON[i(1224)+"y"](t));let c=await e[i(623)](us,t),u=e[i(697)](Zo,t),{method:h=0,service:m=this[i(895)][i(512)],logID:l=this[i(895)][i(864)+"erator"](),headers:b=this[i(895)].headers,payloadEncoding:v=this[i(895)][i(1152)+i(1746)],payloadType:C=this._options[i(696)+i(1347)],logIDNew:P=this[i(895)][i(1040)+"Config"]["enableAutoGenera"+i(1636)+"ew"]?e[i(1557)](a,this[i(895)][i(1040)+i(1218)].userIp):""}=e[i(1256)](n,{});if(!m)throw new Error(i(1486)+i(1381)+i(1162)+i(989));let L={SeqID:O[i(356)+"er"](this[i(1248)]++),LogID:O[i(356)+"er"](l),service:m,method:h,headers:b,payloadEncoding:e[i(558)](v,Object)?v.encoding?v[i(835)]:"":v,payloadType:e[i(1130)](C,Object)?C[i(1155)]?C[i(1155)]:u:C||u,payload:c,LogIDNew:P},I=e[i(1236)](Gn,L);return this[i(527)]&&e.BfyCw(this[i(527)][i(792)+"te"],this[i(1233)])?(this[i(527)]&&this[i(527)][i(1790)](I),this[i(537)](e[i(555)],L)):e[i(1852)](this["_message"+i(330)][i(398)],this[i(895)][i(1534)+i(674)+"ength"])?(this[i(1688)+i(330)][i(358)](I),this._debug(e[i(856)],L)):(this[i(1688)+i(330)][i(576)](),this[i(1688)+i(330)][i(358)](I)),{seqID:this[i(1248)],logID:l,logIDNew:P}}async reconnect(t){let n=r,{url:i}=e[n(1592)](t,{}),c=Array[n(1499)](i)?i:e[n(1527)](e.PIMHn,typeof i)?[i]:[];t&&Object[n(996)](this[n(895)],t),c&&c.length?this[n(1815)+"tManager"]=new as(c,this[n(895)][n(1429)+"es"]):this[n(1815)+"tManager"]?.[n(834)+n(1139)+n(782)](),this._pingLossCounter?.["resetCou"+n(1200)](this[n(895)]["pingLoss"+n(599)]),this[n(741)+n(438)]=!1,this[n(527)]&&e[n(759)](this[n(527)][n(792)+"te"],this[n(478)])?this[n(613)+"ect"](1e3,e[n(1670)],!0):(this[n(1373)]=!0,this[n(1626)]())}async[r(368)](){let t=r;if(!this[t(1626)+"Lock"]){let n=e[t(1387)][t(804)]("|"),i=0;for(;;){switch(n[i++]){case"0":this[t(1626)]();continue;case"1":this[t(959)+t(1261)]?.[t(963)+t(1200)]();continue;case"2":this[t(1373)]=!0;continue;case"3":this[t(741)+t(438)]=!1;continue;case"4":this[t(1815)+t(695)]?.[t(834)+t(1139)+t(782)]();continue}break}}}["addEvent"+r(1268)](t,n){this.on(t,n)}[r(541)+"Event"](t){let n=r;if(e[n(1281)](e.vzZTC,n(1024)))_0x10622c.d=(i,c)=>{let u=n;for(var h in c)_0x356137.o(c,h)&&!_0x56f52e.o(i,h)&&_0xf1911f[u(1490)+u(1571)](i,h,{enumerable:!0,get:c[h]})};else{let{type:i}=t;this.emit(i,t)}}[r(1710)+r(1091)+r(1537)](t,n){this[r(454)](t,n)}[r(1203)](){let t=r,n={UNnbV:e[t(1385)],uwiIK:e[t(1595)],NHxRe:e.MRUgg,qDUBb:e[t(974)],GoHvn:function(i,c){return e[t(1472)](i,c)},DTrNT:e.NXrsF,tICZW:function(i,c,u){return i(c,u)}};return new Promise((i,c)=>{let u=t,h={sBZBS:n.UNnbV,Fxipt:n[u(390)],HKVwC:n[u(833)],JvxGe:n[u(1049)]};if(n[u(1651)]("qMCcb",n[u(1621)])){this[u(704)+u(1072)](),this._pingPongTimeoutId=n[u(1502)](setTimeout,this[u(1559)][u(490)](this),this[u(895)][u(1320)+u(1762)]);let m=()=>{let b=u;i(h[b(829)]),this.off("ping_onc"+b(1541)+"s",m),this[b(454)](h[b(375)],l)},l=()=>{let b=u;c(h[b(428)]),this[b(454)](h[b(1034)],m),this.off(b(1685)+b(673)+"t",l)};this.on("ping_once_success",m),this.on(n[u(390)],l),this[u(1559)]()}else this.emit(u(1297),_0x287fc4),this[u(592)]&&this[u(592)](_0x4ae1fa)})}}})(),Y.CustomCloseEvent=V[S(1377)+S(768)],Y[S(908)+S(727)]=V[S(908)+"rorEvent"],Y[S(980)+"e"]=V.ErrorCode,Y[S(521)]=V[S(521)],Y.FWS=V[S(1806)],Y[S(1234)+"MessageE"+S(1445)]=V["Frontier"+S(1258)+S(1445)],Y[S(1258)+S(1445)]=V[S(1258)+S(1445)],Y[S(539)+"t"]=V.OpenEvent,Y["Reconnec"+S(1679)]=V[S(567)+S(1679)],Y["createCl"+S(768)]=V["createCl"+S(768)],Y[S(575)+S(727)]=V["createEr"+S(727)],Y[S(513)+S(1147)+"nt"]=V[S(513)+S(1147)+"nt"],Y[S(982)+S(581)]=V[S(982)+S(581)],Y[S(588)+S(1696)+S(1445)]=V["createRe"+S(1696)+S(1445)],Y[S(492)+"rame"]=V[S(492)+S(544)],Y[S(622)+S(1743)]=V[S(622)+S(1743)];for(dn in V)[S(1377)+"oseEvent",S(908)+"rorEvent","ErrorCode",S(521),S(1806),S(1234)+S(1258)+S(1445),S(1258)+S(1445),"OpenEvent","ReconnectEvent",S(1318)+"oseEvent",S(575)+S(727),"createMe"+S(1147)+"nt",S(982)+S(581),S(588)+S(1696)+S(1445),S(492)+S(544),S(622)+"ame"].indexOf(dn)===-1&&(Y[dn]=V[dn]);var dn;Object[S(1490)+"operty"](Y,S(601)+"le",{value:!0})});var Le=oe((Zd,fi)=>{"use strict";var xi=["nodebuffer","arraybuffer","fragments"],ci=typeof Blob<"u";ci&&xi.push("blob");fi.exports={BINARY_TYPES:xi,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:ci,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var Pt=oe((el,wn)=>{"use strict";var{EMPTY_BUFFER:_x}=Le(),lr=Buffer[Symbol.species];function yx(r,e){if(r.length===0)return _x;if(r.length===1)return r[0];let o=Buffer.allocUnsafe(e),a=0;for(let x=0;x<r.length;x++){let f=r[x];o.set(f,a),a+=f.length}return a<e?new lr(o.buffer,o.byteOffset,a):o}function ui(r,e,o,a,x){for(let f=0;f<x;f++)o[a+f]=r[f]^e[f&3]}function di(r,e){for(let o=0;o<r.length;o++)r[o]^=e[o&3]}function bx(r){return r.length===r.buffer.byteLength?r.buffer:r.buffer.slice(r.byteOffset,r.byteOffset+r.length)}function hr(r){if(hr.readOnly=!0,Buffer.isBuffer(r))return r;let e;return r instanceof ArrayBuffer?e=new lr(r):ArrayBuffer.isView(r)?e=new lr(r.buffer,r.byteOffset,r.byteLength):(e=Buffer.from(r),hr.readOnly=!1),e}wn.exports={concat:yx,mask:ui,toArrayBuffer:bx,toBuffer:hr,unmask:di};if(!process.env.WS_NO_BUFFER_UTIL)try{let r=X("bufferutil");wn.exports.mask=function(e,o,a,x,f){f<48?ui(e,o,a,x,f):r.mask(e,o,a,x,f)},wn.exports.unmask=function(e,o){e.length<32?di(e,o):r.unmask(e,o)}}catch{}});var gi=oe((tl,hi)=>{"use strict";var li=Symbol("kDone"),gr=Symbol("kRun"),pr=class{constructor(e){this[li]=()=>{this.pending--,this[gr]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[gr]()}[gr](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[li])}}};hi.exports=pr});var lt=oe((nl,wi)=>{"use strict";var It=X("zlib"),pi=Pt(),vx=gi(),{kStatusCode:mi}=Le(),Sx=Buffer[Symbol.species],Cx=Buffer.from([0,0,255,255]),bn=Symbol("permessage-deflate"),Ne=Symbol("total-length"),ut=Symbol("callback"),He=Symbol("buffers"),dt=Symbol("error"),yn,mr=class{constructor(e){if(this._options=e||{},this._threshold=this._options.threshold!==void 0?this._options.threshold:1024,this._maxPayload=this._options.maxPayload|0,this._isServer=!!this._options.isServer,this._deflate=null,this._inflate=null,this.params=null,!yn){let o=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;yn=new vx(o)}}static get extensionName(){return"permessage-deflate"}offer(){let e={};return this._options.serverNoContextTakeover&&(e.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(e.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(e.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?e.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits==null&&(e.client_max_window_bits=!0),e}accept(e){return e=this.normalizeParams(e),this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){let e=this._deflate[ut];this._deflate.close(),this._deflate=null,e&&e(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(e){let o=this._options,a=e.find(x=>!(o.serverNoContextTakeover===!1&&x.server_no_context_takeover||x.server_max_window_bits&&(o.serverMaxWindowBits===!1||typeof o.serverMaxWindowBits=="number"&&o.serverMaxWindowBits>x.server_max_window_bits)||typeof o.clientMaxWindowBits=="number"&&!x.client_max_window_bits));if(!a)throw new Error("None of the extension offers can be accepted");return o.serverNoContextTakeover&&(a.server_no_context_takeover=!0),o.clientNoContextTakeover&&(a.client_no_context_takeover=!0),typeof o.serverMaxWindowBits=="number"&&(a.server_max_window_bits=o.serverMaxWindowBits),typeof o.clientMaxWindowBits=="number"?a.client_max_window_bits=o.clientMaxWindowBits:(a.client_max_window_bits===!0||o.clientMaxWindowBits===!1)&&delete a.client_max_window_bits,a}acceptAsClient(e){let o=e[0];if(this._options.clientNoContextTakeover===!1&&o.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(!o.client_max_window_bits)typeof this._options.clientMaxWindowBits=="number"&&(o.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits=="number"&&o.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"');return o}normalizeParams(e){return e.forEach(o=>{Object.keys(o).forEach(a=>{let x=o[a];if(x.length>1)throw new Error(`Parameter "${a}" must have only a single value`);if(x=x[0],a==="client_max_window_bits"){if(x!==!0){let f=+x;if(!Number.isInteger(f)||f<8||f>15)throw new TypeError(`Invalid value for parameter "${a}": ${x}`);x=f}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${a}": ${x}`)}else if(a==="server_max_window_bits"){let f=+x;if(!Number.isInteger(f)||f<8||f>15)throw new TypeError(`Invalid value for parameter "${a}": ${x}`);x=f}else if(a==="client_no_context_takeover"||a==="server_no_context_takeover"){if(x!==!0)throw new TypeError(`Invalid value for parameter "${a}": ${x}`)}else throw new Error(`Unknown parameter "${a}"`);o[a]=x})}),e}decompress(e,o,a){yn.add(x=>{this._decompress(e,o,(f,d)=>{x(),a(f,d)})})}compress(e,o,a){yn.add(x=>{this._compress(e,o,(f,d)=>{x(),a(f,d)})})}_decompress(e,o,a){let x=this._isServer?"client":"server";if(!this._inflate){let f=`${x}_max_window_bits`,d=typeof this.params[f]!="number"?It.Z_DEFAULT_WINDOWBITS:this.params[f];this._inflate=It.createInflateRaw({...this._options.zlibInflateOptions,windowBits:d}),this._inflate[bn]=this,this._inflate[Ne]=0,this._inflate[He]=[],this._inflate.on("error",Ax),this._inflate.on("data",_i)}this._inflate[ut]=a,this._inflate.write(e),o&&this._inflate.write(Cx),this._inflate.flush(()=>{let f=this._inflate[dt];if(f){this._inflate.close(),this._inflate=null,a(f);return}let d=pi.concat(this._inflate[He],this._inflate[Ne]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[Ne]=0,this._inflate[He]=[],o&&this.params[`${x}_no_context_takeover`]&&this._inflate.reset()),a(null,d)})}_compress(e,o,a){let x=this._isServer?"server":"client";if(!this._deflate){let f=`${x}_max_window_bits`,d=typeof this.params[f]!="number"?It.Z_DEFAULT_WINDOWBITS:this.params[f];this._deflate=It.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:d}),this._deflate[Ne]=0,this._deflate[He]=[],this._deflate.on("data",Ex)}this._deflate[ut]=a,this._deflate.write(e),this._deflate.flush(It.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let f=pi.concat(this._deflate[He],this._deflate[Ne]);o&&(f=new Sx(f.buffer,f.byteOffset,f.length-4)),this._deflate[ut]=null,this._deflate[Ne]=0,this._deflate[He]=[],o&&this.params[`${x}_no_context_takeover`]&&this._deflate.reset(),a(null,f)})}};wi.exports=mr;function Ex(r){this[He].push(r),this[Ne]+=r.length}function _i(r){if(this[Ne]+=r.length,this[bn]._maxPayload<1||this[Ne]<=this[bn]._maxPayload){this[He].push(r);return}this[dt]=new RangeError("Max payload size exceeded"),this[dt].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[dt][mi]=1009,this.removeListener("data",_i),this.reset()}function Ax(r){if(this[bn]._inflate=null,this[dt]){this[ut](this[dt]);return}r[mi]=1007,this[ut](r)}});var ht=oe((rl,vn)=>{"use strict";var{isUtf8:yi}=X("buffer"),{hasBlob:kx}=Le(),Dx=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function Px(r){return r>=1e3&&r<=1014&&r!==1004&&r!==1005&&r!==1006||r>=3e3&&r<=4999}function _r(r){let e=r.length,o=0;for(;o<e;)if((r[o]&128)===0)o++;else if((r[o]&224)===192){if(o+1===e||(r[o+1]&192)!==128||(r[o]&254)===192)return!1;o+=2}else if((r[o]&240)===224){if(o+2>=e||(r[o+1]&192)!==128||(r[o+2]&192)!==128||r[o]===224&&(r[o+1]&224)===128||r[o]===237&&(r[o+1]&224)===160)return!1;o+=3}else if((r[o]&248)===240){if(o+3>=e||(r[o+1]&192)!==128||(r[o+2]&192)!==128||(r[o+3]&192)!==128||r[o]===240&&(r[o+1]&240)===128||r[o]===244&&r[o+1]>143||r[o]>244)return!1;o+=4}else return!1;return!0}function Ix(r){return kx&&typeof r=="object"&&typeof r.arrayBuffer=="function"&&typeof r.type=="string"&&typeof r.stream=="function"&&(r[Symbol.toStringTag]==="Blob"||r[Symbol.toStringTag]==="File")}vn.exports={isBlob:Ix,isValidStatusCode:Px,isValidUTF8:_r,tokenChars:Dx};if(yi)vn.exports.isValidUTF8=function(r){return r.length<24?_r(r):yi(r)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let r=X("utf-8-validate");vn.exports.isValidUTF8=function(e){return e.length<32?_r(e):r(e)}}catch{}});var Sr=oe((sl,ki)=>{"use strict";var{Writable:Tx}=X("stream"),bi=lt(),{BINARY_TYPES:Lx,EMPTY_BUFFER:vi,kStatusCode:Nx,kWebSocket:Mx}=Le(),{concat:wr,toArrayBuffer:Rx,unmask:Ox}=Pt(),{isValidStatusCode:Bx,isValidUTF8:Si}=ht(),Sn=Buffer[Symbol.species],le=0,Ci=1,Ei=2,Ai=3,yr=4,br=5,Cn=6,vr=class extends Tx{constructor(e={}){super(),this._allowSynchronousEvents=e.allowSynchronousEvents!==void 0?e.allowSynchronousEvents:!0,this._binaryType=e.binaryType||Lx[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxPayload=e.maxPayload|0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[Mx]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=le}_write(e,o,a){if(this._opcode===8&&this._state==le)return a();this._bufferedBytes+=e.length,this._buffers.push(e),this.startLoop(a)}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){let a=this._buffers[0];return this._buffers[0]=new Sn(a.buffer,a.byteOffset+e,a.length-e),new Sn(a.buffer,a.byteOffset,e)}let o=Buffer.allocUnsafe(e);do{let a=this._buffers[0],x=o.length-e;e>=a.length?o.set(this._buffers.shift(),x):(o.set(new Uint8Array(a.buffer,a.byteOffset,e),x),this._buffers[0]=new Sn(a.buffer,a.byteOffset+e,a.length-e)),e-=a.length}while(e>0);return o}startLoop(e){this._loop=!0;do switch(this._state){case le:this.getInfo(e);break;case Ci:this.getPayloadLength16(e);break;case Ei:this.getPayloadLength64(e);break;case Ai:this.getMask();break;case yr:this.getData(e);break;case br:case Cn:this._loop=!1;return}while(this._loop);this._errored||e()}getInfo(e){if(this._bufferedBytes<2){this._loop=!1;return}let o=this.consume(2);if((o[0]&48)!==0){let x=this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");e(x);return}let a=(o[0]&64)===64;if(a&&!this._extensions[bi.extensionName]){let x=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(x);return}if(this._fin=(o[0]&128)===128,this._opcode=o[0]&15,this._payloadLength=o[1]&127,this._opcode===0){if(a){let x=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(x);return}if(!this._fragmented){let x=this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");e(x);return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){let x=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");e(x);return}this._compressed=a}else if(this._opcode>7&&this._opcode<11){if(!this._fin){let x=this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");e(x);return}if(a){let x=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(x);return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){let x=this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");e(x);return}}else{let x=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");e(x);return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(o[1]&128)===128,this._isServer){if(!this._masked){let x=this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK");e(x);return}}else if(this._masked){let x=this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");e(x);return}this._payloadLength===126?this._state=Ci:this._payloadLength===127?this._state=Ei:this.haveLength(e)}getPayloadLength16(e){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(e)}getPayloadLength64(e){if(this._bufferedBytes<8){this._loop=!1;return}let o=this.consume(8),a=o.readUInt32BE(0);if(a>Math.pow(2,21)-1){let x=this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");e(x);return}this._payloadLength=a*Math.pow(2,32)+o.readUInt32BE(4),this.haveLength(e)}haveLength(e){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)){let o=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");e(o);return}this._masked?this._state=Ai:this._state=yr}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=yr}getData(e){let o=vi;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}o=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0&&Ox(o,this._mask)}if(this._opcode>7){this.controlMessage(o,e);return}if(this._compressed){this._state=br,this.decompress(o,e);return}o.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(o)),this.dataMessage(e)}decompress(e,o){this._extensions[bi.extensionName].decompress(e,this._fin,(x,f)=>{if(x)return o(x);if(f.length){if(this._messageLength+=f.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let d=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");o(d);return}this._fragments.push(f)}this.dataMessage(o),this._state===le&&this.startLoop(o)})}dataMessage(e){if(!this._fin){this._state=le;return}let o=this._messageLength,a=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let x;this._binaryType==="nodebuffer"?x=wr(a,o):this._binaryType==="arraybuffer"?x=Rx(wr(a,o)):this._binaryType==="blob"?x=new Blob(a):x=a,this._allowSynchronousEvents?(this.emit("message",x,!0),this._state=le):(this._state=Cn,setImmediate(()=>{this.emit("message",x,!0),this._state=le,this.startLoop(e)}))}else{let x=wr(a,o);if(!this._skipUTF8Validation&&!Si(x)){let f=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");e(f);return}this._state===br||this._allowSynchronousEvents?(this.emit("message",x,!1),this._state=le):(this._state=Cn,setImmediate(()=>{this.emit("message",x,!1),this._state=le,this.startLoop(e)}))}}controlMessage(e,o){if(this._opcode===8){if(e.length===0)this._loop=!1,this.emit("conclude",1005,vi),this.end();else{let a=e.readUInt16BE(0);if(!Bx(a)){let f=this.createError(RangeError,`invalid status code ${a}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");o(f);return}let x=new Sn(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!Si(x)){let f=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");o(f);return}this._loop=!1,this.emit("conclude",a,x),this.end()}this._state=le;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?"ping":"pong",e),this._state=le):(this._state=Cn,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",e),this._state=le,this.startLoop(o)}))}createError(e,o,a,x,f){this._loop=!1,this._errored=!0;let d=new e(a?`Invalid WebSocket frame: ${o}`:o);return Error.captureStackTrace(d,this.createError),d.code=f,d[Nx]=x,d}};ki.exports=vr});var Ar=oe((ol,Ii)=>{"use strict";var{Duplex:il}=X("stream"),{randomFillSync:zx}=X("crypto"),Di=lt(),{EMPTY_BUFFER:qx,kWebSocket:Fx,NOOP:Ux}=Le(),{isBlob:gt,isValidStatusCode:Hx}=ht(),{mask:Pi,toBuffer:Ve}=Pt(),he=Symbol("kByteLength"),Kx=Buffer.alloc(4),En=8*1024,Ye,pt=En,_e=0,jx=1,Wx=2,Cr=class r{constructor(e,o,a){this._extensions=o||{},a&&(this._generateMask=a,this._maskBuffer=Buffer.alloc(4)),this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=_e,this.onerror=Ux,this[Fx]=void 0}static frame(e,o){let a,x=!1,f=2,d=!1;o.mask&&(a=o.maskBuffer||Kx,o.generateMask?o.generateMask(a):(pt===En&&(Ye===void 0&&(Ye=Buffer.alloc(En)),zx(Ye,0,En),pt=0),a[0]=Ye[pt++],a[1]=Ye[pt++],a[2]=Ye[pt++],a[3]=Ye[pt++]),d=(a[0]|a[1]|a[2]|a[3])===0,f=6);let g;typeof e=="string"?(!o.mask||d)&&o[he]!==void 0?g=o[he]:(e=Buffer.from(e),g=e.length):(g=e.length,x=o.mask&&o.readOnly&&!d);let p=g;g>=65536?(f+=8,p=127):g>125&&(f+=2,p=126);let _=Buffer.allocUnsafe(x?g+f:f);return _[0]=o.fin?o.opcode|128:o.opcode,o.rsv1&&(_[0]|=64),_[1]=p,p===126?_.writeUInt16BE(g,2):p===127&&(_[2]=_[3]=0,_.writeUIntBE(g,4,6)),o.mask?(_[1]|=128,_[f-4]=a[0],_[f-3]=a[1],_[f-2]=a[2],_[f-1]=a[3],d?[_,e]:x?(Pi(e,a,_,f,g),[_]):(Pi(e,a,e,0,g),[_,e])):[_,e]}close(e,o,a,x){let f;if(e===void 0)f=qx;else{if(typeof e!="number"||!Hx(e))throw new TypeError("First argument must be a valid error code number");if(o===void 0||!o.length)f=Buffer.allocUnsafe(2),f.writeUInt16BE(e,0);else{let g=Buffer.byteLength(o);if(g>123)throw new RangeError("The message must not be greater than 123 bytes");f=Buffer.allocUnsafe(2+g),f.writeUInt16BE(e,0),typeof o=="string"?f.write(o,2):f.set(o,2)}}let d={[he]:f.length,fin:!0,generateMask:this._generateMask,mask:a,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state!==_e?this.enqueue([this.dispatch,f,!1,d,x]):this.sendFrame(r.frame(f,d),x)}ping(e,o,a){let x,f;if(typeof e=="string"?(x=Buffer.byteLength(e),f=!1):gt(e)?(x=e.size,f=!1):(e=Ve(e),x=e.length,f=Ve.readOnly),x>125)throw new RangeError("The data size must not be greater than 125 bytes");let d={[he]:x,fin:!0,generateMask:this._generateMask,mask:o,maskBuffer:this._maskBuffer,opcode:9,readOnly:f,rsv1:!1};gt(e)?this._state!==_e?this.enqueue([this.getBlobData,e,!1,d,a]):this.getBlobData(e,!1,d,a):this._state!==_e?this.enqueue([this.dispatch,e,!1,d,a]):this.sendFrame(r.frame(e,d),a)}pong(e,o,a){let x,f;if(typeof e=="string"?(x=Buffer.byteLength(e),f=!1):gt(e)?(x=e.size,f=!1):(e=Ve(e),x=e.length,f=Ve.readOnly),x>125)throw new RangeError("The data size must not be greater than 125 bytes");let d={[he]:x,fin:!0,generateMask:this._generateMask,mask:o,maskBuffer:this._maskBuffer,opcode:10,readOnly:f,rsv1:!1};gt(e)?this._state!==_e?this.enqueue([this.getBlobData,e,!1,d,a]):this.getBlobData(e,!1,d,a):this._state!==_e?this.enqueue([this.dispatch,e,!1,d,a]):this.sendFrame(r.frame(e,d),a)}send(e,o,a){let x=this._extensions[Di.extensionName],f=o.binary?2:1,d=o.compress,g,p;typeof e=="string"?(g=Buffer.byteLength(e),p=!1):gt(e)?(g=e.size,p=!1):(e=Ve(e),g=e.length,p=Ve.readOnly),this._firstFragment?(this._firstFragment=!1,d&&x&&x.params[x._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(d=g>=x._threshold),this._compress=d):(d=!1,f=0),o.fin&&(this._firstFragment=!0);let _={[he]:g,fin:o.fin,generateMask:this._generateMask,mask:o.mask,maskBuffer:this._maskBuffer,opcode:f,readOnly:p,rsv1:d};gt(e)?this._state!==_e?this.enqueue([this.getBlobData,e,this._compress,_,a]):this.getBlobData(e,this._compress,_,a):this._state!==_e?this.enqueue([this.dispatch,e,this._compress,_,a]):this.dispatch(e,this._compress,_,a)}getBlobData(e,o,a,x){this._bufferedBytes+=a[he],this._state=Wx,e.arrayBuffer().then(f=>{if(this._socket.destroyed){let g=new Error("The socket was closed while the blob was being read");process.nextTick(Er,this,g,x);return}this._bufferedBytes-=a[he];let d=Ve(f);o?this.dispatch(d,o,a,x):(this._state=_e,this.sendFrame(r.frame(d,a),x),this.dequeue())}).catch(f=>{process.nextTick(Gx,this,f,x)})}dispatch(e,o,a,x){if(!o){this.sendFrame(r.frame(e,a),x);return}let f=this._extensions[Di.extensionName];this._bufferedBytes+=a[he],this._state=jx,f.compress(e,a.fin,(d,g)=>{if(this._socket.destroyed){let p=new Error("The socket was closed while data was being compressed");Er(this,p,x);return}this._bufferedBytes-=a[he],this._state=_e,a.readOnly=!1,this.sendFrame(r.frame(g,a),x),this.dequeue()})}dequeue(){for(;this._state===_e&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[3][he],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][he],this._queue.push(e)}sendFrame(e,o){e.length===2?(this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],o),this._socket.uncork()):this._socket.write(e[0],o)}};Ii.exports=Cr;function Er(r,e,o){typeof o=="function"&&o(e);for(let a=0;a<r._queue.length;a++){let x=r._queue[a],f=x[x.length-1];typeof f=="function"&&f(e)}}function Gx(r,e,o){Er(r,e,o),r.onerror(e)}});var qi=oe((al,zi)=>{"use strict";var{kForOnEventAttribute:Tt,kListener:kr}=Le(),Ti=Symbol("kCode"),Li=Symbol("kData"),Ni=Symbol("kError"),Mi=Symbol("kMessage"),Ri=Symbol("kReason"),mt=Symbol("kTarget"),Oi=Symbol("kType"),Bi=Symbol("kWasClean"),Me=class{constructor(e){this[mt]=null,this[Oi]=e}get target(){return this[mt]}get type(){return this[Oi]}};Object.defineProperty(Me.prototype,"target",{enumerable:!0});Object.defineProperty(Me.prototype,"type",{enumerable:!0});var Qe=class extends Me{constructor(e,o={}){super(e),this[Ti]=o.code===void 0?0:o.code,this[Ri]=o.reason===void 0?"":o.reason,this[Bi]=o.wasClean===void 0?!1:o.wasClean}get code(){return this[Ti]}get reason(){return this[Ri]}get wasClean(){return this[Bi]}};Object.defineProperty(Qe.prototype,"code",{enumerable:!0});Object.defineProperty(Qe.prototype,"reason",{enumerable:!0});Object.defineProperty(Qe.prototype,"wasClean",{enumerable:!0});var _t=class extends Me{constructor(e,o={}){super(e),this[Ni]=o.error===void 0?null:o.error,this[Mi]=o.message===void 0?"":o.message}get error(){return this[Ni]}get message(){return this[Mi]}};Object.defineProperty(_t.prototype,"error",{enumerable:!0});Object.defineProperty(_t.prototype,"message",{enumerable:!0});var Lt=class extends Me{constructor(e,o={}){super(e),this[Li]=o.data===void 0?null:o.data}get data(){return this[Li]}};Object.defineProperty(Lt.prototype,"data",{enumerable:!0});var Jx={addEventListener(r,e,o={}){for(let x of this.listeners(r))if(!o[Tt]&&x[kr]===e&&!x[Tt])return;let a;if(r==="message")a=function(f,d){let g=new Lt("message",{data:d?f:f.toString()});g[mt]=this,An(e,this,g)};else if(r==="close")a=function(f,d){let g=new Qe("close",{code:f,reason:d.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});g[mt]=this,An(e,this,g)};else if(r==="error")a=function(f){let d=new _t("error",{error:f,message:f.message});d[mt]=this,An(e,this,d)};else if(r==="open")a=function(){let f=new Me("open");f[mt]=this,An(e,this,f)};else return;a[Tt]=!!o[Tt],a[kr]=e,o.once?this.once(r,a):this.on(r,a)},removeEventListener(r,e){for(let o of this.listeners(r))if(o[kr]===e&&!o[Tt]){this.removeListener(r,o);break}}};zi.exports={CloseEvent:Qe,ErrorEvent:_t,Event:Me,EventTarget:Jx,MessageEvent:Lt};function An(r,e,o){typeof r=="object"&&r.handleEvent?r.handleEvent.call(r,o):r.call(e,o)}});var kn=oe((xl,Fi)=>{"use strict";var{tokenChars:Nt}=ht();function Ee(r,e,o){r[e]===void 0?r[e]=[o]:r[e].push(o)}function Xx(r){let e=Object.create(null),o=Object.create(null),a=!1,x=!1,f=!1,d,g,p=-1,_=-1,w=-1,y=0;for(;y<r.length;y++)if(_=r.charCodeAt(y),d===void 0)if(w===-1&&Nt[_]===1)p===-1&&(p=y);else if(y!==0&&(_===32||_===9))w===-1&&p!==-1&&(w=y);else if(_===59||_===44){if(p===-1)throw new SyntaxError(`Unexpected character at index ${y}`);w===-1&&(w=y);let T=r.slice(p,w);_===44?(Ee(e,T,o),o=Object.create(null)):d=T,p=w=-1}else throw new SyntaxError(`Unexpected character at index ${y}`);else if(g===void 0)if(w===-1&&Nt[_]===1)p===-1&&(p=y);else if(_===32||_===9)w===-1&&p!==-1&&(w=y);else if(_===59||_===44){if(p===-1)throw new SyntaxError(`Unexpected character at index ${y}`);w===-1&&(w=y),Ee(o,r.slice(p,w),!0),_===44&&(Ee(e,d,o),o=Object.create(null),d=void 0),p=w=-1}else if(_===61&&p!==-1&&w===-1)g=r.slice(p,y),p=w=-1;else throw new SyntaxError(`Unexpected character at index ${y}`);else if(x){if(Nt[_]!==1)throw new SyntaxError(`Unexpected character at index ${y}`);p===-1?p=y:a||(a=!0),x=!1}else if(f)if(Nt[_]===1)p===-1&&(p=y);else if(_===34&&p!==-1)f=!1,w=y;else if(_===92)x=!0;else throw new SyntaxError(`Unexpected character at index ${y}`);else if(_===34&&r.charCodeAt(y-1)===61)f=!0;else if(w===-1&&Nt[_]===1)p===-1&&(p=y);else if(p!==-1&&(_===32||_===9))w===-1&&(w=y);else if(_===59||_===44){if(p===-1)throw new SyntaxError(`Unexpected character at index ${y}`);w===-1&&(w=y);let T=r.slice(p,w);a&&(T=T.replace(/\\/g,""),a=!1),Ee(o,g,T),_===44&&(Ee(e,d,o),o=Object.create(null),d=void 0),g=void 0,p=w=-1}else throw new SyntaxError(`Unexpected character at index ${y}`);if(p===-1||f||_===32||_===9)throw new SyntaxError("Unexpected end of input");w===-1&&(w=y);let A=r.slice(p,w);return d===void 0?Ee(e,A,o):(g===void 0?Ee(o,A,!0):a?Ee(o,g,A.replace(/\\/g,"")):Ee(o,g,A),Ee(e,d,o)),e}function Vx(r){return Object.keys(r).map(e=>{let o=r[e];return Array.isArray(o)||(o=[o]),o.map(a=>[e].concat(Object.keys(a).map(x=>{let f=a[x];return Array.isArray(f)||(f=[f]),f.map(d=>d===!0?x:`${x}=${d}`).join("; ")})).join("; ")).join(", ")}).join(", ")}Fi.exports={format:Vx,parse:Xx}});var Tn=oe((ul,$i)=>{"use strict";var Yx=X("events"),Qx=X("https"),$x=X("http"),Ki=X("net"),Zx=X("tls"),{randomBytes:ec,createHash:tc}=X("crypto"),{Duplex:cl,Readable:fl}=X("stream"),{URL:Dr}=X("url"),Ke=lt(),nc=Sr(),rc=Ar(),{isBlob:sc}=ht(),{BINARY_TYPES:Ui,CLOSE_TIMEOUT:ic,EMPTY_BUFFER:Dn,GUID:oc,kForOnEventAttribute:Pr,kListener:ac,kStatusCode:xc,kWebSocket:Z,NOOP:ji}=Le(),{EventTarget:{addEventListener:cc,removeEventListener:fc}}=qi(),{format:uc,parse:dc}=kn(),{toBuffer:lc}=Pt(),Wi=Symbol("kAborted"),Ir=[8,13],Re=["CONNECTING","OPEN","CLOSING","CLOSED"],hc=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,q=class r extends Yx{constructor(e,o,a){super(),this._binaryType=Ui[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=Dn,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol="",this._readyState=r.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,e!==null?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,o===void 0?o=[]:Array.isArray(o)||(typeof o=="object"&&o!==null?(a=o,o=[]):o=[o]),Gi(this,e,o,a)):(this._autoPong=a.autoPong,this._closeTimeout=a.closeTimeout,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(e){Ui.includes(e)&&(this._binaryType=e,this._receiver&&(this._receiver._binaryType=e))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(e,o,a){let x=new nc({allowSynchronousEvents:a.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:a.maxPayload,skipUTF8Validation:a.skipUTF8Validation}),f=new rc(e,this._extensions,a.generateMask);this._receiver=x,this._sender=f,this._socket=e,x[Z]=this,f[Z]=this,e[Z]=this,x.on("conclude",mc),x.on("drain",_c),x.on("error",wc),x.on("message",yc),x.on("ping",bc),x.on("pong",vc),f.onerror=Sc,e.setTimeout&&e.setTimeout(0),e.setNoDelay&&e.setNoDelay(),o.length>0&&e.unshift(o),e.on("close",Vi),e.on("data",In),e.on("end",Yi),e.on("error",Qi),this._readyState=r.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=r.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[Ke.extensionName]&&this._extensions[Ke.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=r.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(e,o){if(this.readyState!==r.CLOSED){if(this.readyState===r.CONNECTING){fe(this,this._req,"WebSocket was closed before the connection was established");return}if(this.readyState===r.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=r.CLOSING,this._sender.close(e,o,!this._isServer,a=>{a||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),Xi(this)}}pause(){this.readyState===r.CONNECTING||this.readyState===r.CLOSED||(this._paused=!0,this._socket.pause())}ping(e,o,a){if(this.readyState===r.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(a=e,e=o=void 0):typeof o=="function"&&(a=o,o=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==r.OPEN){Tr(this,e,a);return}o===void 0&&(o=!this._isServer),this._sender.ping(e||Dn,o,a)}pong(e,o,a){if(this.readyState===r.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(a=e,e=o=void 0):typeof o=="function"&&(a=o,o=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==r.OPEN){Tr(this,e,a);return}o===void 0&&(o=!this._isServer),this._sender.pong(e||Dn,o,a)}resume(){this.readyState===r.CONNECTING||this.readyState===r.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(e,o,a){if(this.readyState===r.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof o=="function"&&(a=o,o={}),typeof e=="number"&&(e=e.toString()),this.readyState!==r.OPEN){Tr(this,e,a);return}let x={binary:typeof e!="string",mask:!this._isServer,compress:!0,fin:!0,...o};this._extensions[Ke.extensionName]||(x.compress=!1),this._sender.send(e||Dn,x,a)}terminate(){if(this.readyState!==r.CLOSED){if(this.readyState===r.CONNECTING){fe(this,this._req,"WebSocket was closed before the connection was established");return}this._socket&&(this._readyState=r.CLOSING,this._socket.destroy())}}};Object.defineProperty(q,"CONNECTING",{enumerable:!0,value:Re.indexOf("CONNECTING")});Object.defineProperty(q.prototype,"CONNECTING",{enumerable:!0,value:Re.indexOf("CONNECTING")});Object.defineProperty(q,"OPEN",{enumerable:!0,value:Re.indexOf("OPEN")});Object.defineProperty(q.prototype,"OPEN",{enumerable:!0,value:Re.indexOf("OPEN")});Object.defineProperty(q,"CLOSING",{enumerable:!0,value:Re.indexOf("CLOSING")});Object.defineProperty(q.prototype,"CLOSING",{enumerable:!0,value:Re.indexOf("CLOSING")});Object.defineProperty(q,"CLOSED",{enumerable:!0,value:Re.indexOf("CLOSED")});Object.defineProperty(q.prototype,"CLOSED",{enumerable:!0,value:Re.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(r=>{Object.defineProperty(q.prototype,r,{enumerable:!0})});["open","error","close","message"].forEach(r=>{Object.defineProperty(q.prototype,`on${r}`,{enumerable:!0,get(){for(let e of this.listeners(r))if(e[Pr])return e[ac];return null},set(e){for(let o of this.listeners(r))if(o[Pr]){this.removeListener(r,o);break}typeof e=="function"&&this.addEventListener(r,e,{[Pr]:!0})}})});q.prototype.addEventListener=cc;q.prototype.removeEventListener=fc;$i.exports=q;function Gi(r,e,o,a){let x={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:ic,protocolVersion:Ir[1],maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...a,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(r._autoPong=x.autoPong,r._closeTimeout=x.closeTimeout,!Ir.includes(x.protocolVersion))throw new RangeError(`Unsupported protocol version: ${x.protocolVersion} (supported versions: ${Ir.join(", ")})`);let f;if(e instanceof Dr)f=e;else try{f=new Dr(e)}catch{throw new SyntaxError(`Invalid URL: ${e}`)}f.protocol==="http:"?f.protocol="ws:":f.protocol==="https:"&&(f.protocol="wss:"),r._url=f.href;let d=f.protocol==="wss:",g=f.protocol==="ws+unix:",p;if(f.protocol!=="ws:"&&!d&&!g?p=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:g&&!f.pathname?p="The URL's pathname is empty":f.hash&&(p="The URL contains a fragment identifier"),p){let R=new SyntaxError(p);if(r._redirects===0)throw R;Pn(r,R);return}let _=d?443:80,w=ec(16).toString("base64"),y=d?Qx.request:$x.request,A=new Set,T;if(x.createConnection=x.createConnection||(d?pc:gc),x.defaultPort=x.defaultPort||_,x.port=f.port||_,x.host=f.hostname.startsWith("[")?f.hostname.slice(1,-1):f.hostname,x.headers={...x.headers,"Sec-WebSocket-Version":x.protocolVersion,"Sec-WebSocket-Key":w,Connection:"Upgrade",Upgrade:"websocket"},x.path=f.pathname+f.search,x.timeout=x.handshakeTimeout,x.perMessageDeflate&&(T=new Ke({...x.perMessageDeflate,isServer:!1,maxPayload:x.maxPayload}),x.headers["Sec-WebSocket-Extensions"]=uc({[Ke.extensionName]:T.offer()})),o.length){for(let R of o){if(typeof R!="string"||!hc.test(R)||A.has(R))throw new SyntaxError("An invalid or duplicated subprotocol was specified");A.add(R)}x.headers["Sec-WebSocket-Protocol"]=o.join(",")}if(x.origin&&(x.protocolVersion<13?x.headers["Sec-WebSocket-Origin"]=x.origin:x.headers.Origin=x.origin),(f.username||f.password)&&(x.auth=`${f.username}:${f.password}`),g){let R=x.path.split(":");x.socketPath=R[0],x.path=R[1]}let N;if(x.followRedirects){if(r._redirects===0){r._originalIpc=g,r._originalSecure=d,r._originalHostOrSocketPath=g?x.socketPath:f.host;let R=a&&a.headers;if(a={...a,headers:{}},R)for(let[K,ie]of Object.entries(R))a.headers[K.toLowerCase()]=ie}else if(r.listenerCount("redirect")===0){let R=g?r._originalIpc?x.socketPath===r._originalHostOrSocketPath:!1:r._originalIpc?!1:f.host===r._originalHostOrSocketPath;(!R||r._originalSecure&&!d)&&(delete x.headers.authorization,delete x.headers.cookie,R||delete x.headers.host,x.auth=void 0)}x.auth&&!a.headers.authorization&&(a.headers.authorization="Basic "+Buffer.from(x.auth).toString("base64")),N=r._req=y(x),r._redirects&&r.emit("redirect",r.url,N)}else N=r._req=y(x);x.timeout&&N.on("timeout",()=>{fe(r,N,"Opening handshake has timed out")}),N.on("error",R=>{N===null||N[Wi]||(N=r._req=null,Pn(r,R))}),N.on("response",R=>{let K=R.headers.location,ie=R.statusCode;if(K&&x.followRedirects&&ie>=300&&ie<400){if(++r._redirects>x.maxRedirects){fe(r,N,"Maximum redirects exceeded");return}N.abort();let xe;try{xe=new Dr(K,e)}catch{let z=new SyntaxError(`Invalid URL: ${K}`);Pn(r,z);return}Gi(r,xe,o,a)}else r.emit("unexpected-response",N,R)||fe(r,N,`Unexpected server response: ${R.statusCode}`)}),N.on("upgrade",(R,K,ie)=>{if(r.emit("upgrade",R),r.readyState!==q.CONNECTING)return;N=r._req=null;let xe=R.headers.upgrade;if(xe===void 0||xe.toLowerCase()!=="websocket"){fe(r,K,"Invalid Upgrade header");return}let D=tc("sha1").update(w+oc).digest("base64");if(R.headers["sec-websocket-accept"]!==D){fe(r,K,"Invalid Sec-WebSocket-Accept header");return}let z=R.headers["sec-websocket-protocol"],G;if(z!==void 0?A.size?A.has(z)||(G="Server sent an invalid subprotocol"):G="Server sent a subprotocol but none was requested":A.size&&(G="Server sent no subprotocol"),G){fe(r,K,G);return}z&&(r._protocol=z);let Ae=R.headers["sec-websocket-extensions"];if(Ae!==void 0){if(!T){fe(r,K,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let Oe;try{Oe=dc(Ae)}catch{fe(r,K,"Invalid Sec-WebSocket-Extensions header");return}let we=Object.keys(Oe);if(we.length!==1||we[0]!==Ke.extensionName){fe(r,K,"Server indicated an extension that was not requested");return}try{T.accept(Oe[Ke.extensionName])}catch{fe(r,K,"Invalid Sec-WebSocket-Extensions header");return}r._extensions[Ke.extensionName]=T}r.setSocket(K,ie,{allowSynchronousEvents:x.allowSynchronousEvents,generateMask:x.generateMask,maxPayload:x.maxPayload,skipUTF8Validation:x.skipUTF8Validation})}),x.finishRequest?x.finishRequest(N,r):N.end()}function Pn(r,e){r._readyState=q.CLOSING,r._errorEmitted=!0,r.emit("error",e),r.emitClose()}function gc(r){return r.path=r.socketPath,Ki.connect(r)}function pc(r){return r.path=void 0,!r.servername&&r.servername!==""&&(r.servername=Ki.isIP(r.host)?"":r.host),Zx.connect(r)}function fe(r,e,o){r._readyState=q.CLOSING;let a=new Error(o);Error.captureStackTrace(a,fe),e.setHeader?(e[Wi]=!0,e.abort(),e.socket&&!e.socket.destroyed&&e.socket.destroy(),process.nextTick(Pn,r,a)):(e.destroy(a),e.once("error",r.emit.bind(r,"error")),e.once("close",r.emitClose.bind(r)))}function Tr(r,e,o){if(e){let a=sc(e)?e.size:lc(e).length;r._socket?r._sender._bufferedBytes+=a:r._bufferedAmount+=a}if(o){let a=new Error(`WebSocket is not open: readyState ${r.readyState} (${Re[r.readyState]})`);process.nextTick(o,a)}}function mc(r,e){let o=this[Z];o._closeFrameReceived=!0,o._closeMessage=e,o._closeCode=r,o._socket[Z]!==void 0&&(o._socket.removeListener("data",In),process.nextTick(Ji,o._socket),r===1005?o.close():o.close(r,e))}function _c(){let r=this[Z];r.isPaused||r._socket.resume()}function wc(r){let e=this[Z];e._socket[Z]!==void 0&&(e._socket.removeListener("data",In),process.nextTick(Ji,e._socket),e.close(r[xc])),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",r))}function Hi(){this[Z].emitClose()}function yc(r,e){this[Z].emit("message",r,e)}function bc(r){let e=this[Z];e._autoPong&&e.pong(r,!this._isServer,ji),e.emit("ping",r)}function vc(r){this[Z].emit("pong",r)}function Ji(r){r.resume()}function Sc(r){let e=this[Z];e.readyState!==q.CLOSED&&(e.readyState===q.OPEN&&(e._readyState=q.CLOSING,Xi(e)),this._socket.end(),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",r)))}function Xi(r){r._closeTimer=setTimeout(r._socket.destroy.bind(r._socket),r._closeTimeout)}function Vi(){let r=this[Z];if(this.removeListener("close",Vi),this.removeListener("data",In),this.removeListener("end",Yi),r._readyState=q.CLOSING,!this._readableState.endEmitted&&!r._closeFrameReceived&&!r._receiver._writableState.errorEmitted&&this._readableState.length!==0){let e=this.read(this._readableState.length);r._receiver.write(e)}r._receiver.end(),this[Z]=void 0,clearTimeout(r._closeTimer),r._receiver._writableState.finished||r._receiver._writableState.errorEmitted?r.emitClose():(r._receiver.on("error",Hi),r._receiver.on("finish",Hi))}function In(r){this[Z]._receiver.write(r)||this.pause()}function Yi(){let r=this[Z];r._readyState=q.CLOSING,r._receiver.end(),this.end()}function Qi(){let r=this[Z];this.removeListener("error",Qi),this.on("error",ji),r&&(r._readyState=q.CLOSING,this.destroy())}});var no=oe((ll,to)=>{"use strict";var dl=Tn(),{Duplex:Cc}=X("stream");function Zi(r){r.emit("close")}function Ec(){!this.destroyed&&this._writableState.finished&&this.destroy()}function eo(r){this.removeListener("error",eo),this.destroy(),this.listenerCount("error")===0&&this.emit("error",r)}function Ac(r,e){let o=!0,a=new Cc({...e,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return r.on("message",function(f,d){let g=!d&&a._readableState.objectMode?f.toString():f;a.push(g)||r.pause()}),r.once("error",function(f){a.destroyed||(o=!1,a.destroy(f))}),r.once("close",function(){a.destroyed||a.push(null)}),a._destroy=function(x,f){if(r.readyState===r.CLOSED){f(x),process.nextTick(Zi,a);return}let d=!1;r.once("error",function(p){d=!0,f(p)}),r.once("close",function(){d||f(x),process.nextTick(Zi,a)}),o&&r.terminate()},a._final=function(x){if(r.readyState===r.CONNECTING){r.once("open",function(){a._final(x)});return}r._socket!==null&&(r._socket._writableState.finished?(x(),a._readableState.endEmitted&&a.destroy()):(r._socket.once("finish",function(){x()}),r.close()))},a._read=function(){r.isPaused&&r.resume()},a._write=function(x,f,d){if(r.readyState===r.CONNECTING){r.once("open",function(){a._write(x,f,d)});return}r.send(x,d)},a.on("end",Ec),a.on("error",eo),a}to.exports=Ac});var Lr=oe((hl,ro)=>{"use strict";var{tokenChars:kc}=ht();function Dc(r){let e=new Set,o=-1,a=-1,x=0;for(x;x<r.length;x++){let d=r.charCodeAt(x);if(a===-1&&kc[d]===1)o===-1&&(o=x);else if(x!==0&&(d===32||d===9))a===-1&&o!==-1&&(a=x);else if(d===44){if(o===-1)throw new SyntaxError(`Unexpected character at index ${x}`);a===-1&&(a=x);let g=r.slice(o,a);if(e.has(g))throw new SyntaxError(`The "${g}" subprotocol is duplicated`);e.add(g),o=a=-1}else throw new SyntaxError(`Unexpected character at index ${x}`)}if(o===-1||a!==-1)throw new SyntaxError("Unexpected end of input");let f=r.slice(o,x);if(e.has(f))throw new SyntaxError(`The "${f}" subprotocol is duplicated`);return e.add(f),e}ro.exports={parse:Dc}});var fo=oe((pl,co)=>{"use strict";var Pc=X("events"),Ln=X("http"),{Duplex:gl}=X("stream"),{createHash:Ic}=X("crypto"),so=kn(),$e=lt(),Tc=Lr(),Lc=Tn(),{CLOSE_TIMEOUT:Nc,GUID:Mc,kWebSocket:Rc}=Le(),Oc=/^[+/0-9A-Za-z]{22}==$/,io=0,oo=1,xo=2,Nr=class extends Pc{constructor(e,o){if(super(),e={allowSynchronousEvents:!0,autoPong:!0,maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:Nc,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:Lc,...e},e.port==null&&!e.server&&!e.noServer||e.port!=null&&(e.server||e.noServer)||e.server&&e.noServer)throw new TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(e.port!=null?(this._server=Ln.createServer((a,x)=>{let f=Ln.STATUS_CODES[426];x.writeHead(426,{"Content-Length":f.length,"Content-Type":"text/plain"}),x.end(f)}),this._server.listen(e.port,e.host,e.backlog,o)):e.server&&(this._server=e.server),this._server){let a=this.emit.bind(this,"connection");this._removeListeners=Bc(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(x,f,d)=>{this.handleUpgrade(x,f,d,a)}})}e.perMessageDeflate===!0&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=io}address(){if(this.options.noServer)throw new Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(e){if(this._state===xo){e&&this.once("close",()=>{e(new Error("The server is not running"))}),process.nextTick(Mt,this);return}if(e&&this.once("close",e),this._state!==oo)if(this._state=oo,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients?this.clients.size?this._shouldEmitClose=!0:process.nextTick(Mt,this):process.nextTick(Mt,this);else{let o=this._server;this._removeListeners(),this._removeListeners=this._server=null,o.close(()=>{Mt(this)})}}shouldHandle(e){if(this.options.path){let o=e.url.indexOf("?");if((o!==-1?e.url.slice(0,o):e.url)!==this.options.path)return!1}return!0}handleUpgrade(e,o,a,x){o.on("error",ao);let f=e.headers["sec-websocket-key"],d=e.headers.upgrade,g=+e.headers["sec-websocket-version"];if(e.method!=="GET"){Ze(this,e,o,405,"Invalid HTTP method");return}if(d===void 0||d.toLowerCase()!=="websocket"){Ze(this,e,o,400,"Invalid Upgrade header");return}if(f===void 0||!Oc.test(f)){Ze(this,e,o,400,"Missing or invalid Sec-WebSocket-Key header");return}if(g!==13&&g!==8){Ze(this,e,o,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});return}if(!this.shouldHandle(e)){Rt(o,400);return}let p=e.headers["sec-websocket-protocol"],_=new Set;if(p!==void 0)try{_=Tc.parse(p)}catch{Ze(this,e,o,400,"Invalid Sec-WebSocket-Protocol header");return}let w=e.headers["sec-websocket-extensions"],y={};if(this.options.perMessageDeflate&&w!==void 0){let A=new $e({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let T=so.parse(w);T[$e.extensionName]&&(A.accept(T[$e.extensionName]),y[$e.extensionName]=A)}catch{Ze(this,e,o,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let A={origin:e.headers[`${g===8?"sec-websocket-origin":"origin"}`],secure:!!(e.socket.authorized||e.socket.encrypted),req:e};if(this.options.verifyClient.length===2){this.options.verifyClient(A,(T,N,R,K)=>{if(!T)return Rt(o,N||401,R,K);this.completeUpgrade(y,f,_,e,o,a,x)});return}if(!this.options.verifyClient(A))return Rt(o,401)}this.completeUpgrade(y,f,_,e,o,a,x)}completeUpgrade(e,o,a,x,f,d,g){if(!f.readable||!f.writable)return f.destroy();if(f[Rc])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>io)return Rt(f,503);let _=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${Ic("sha1").update(o+Mc).digest("base64")}`],w=new this.options.WebSocket(null,void 0,this.options);if(a.size){let y=this.options.handleProtocols?this.options.handleProtocols(a,x):a.values().next().value;y&&(_.push(`Sec-WebSocket-Protocol: ${y}`),w._protocol=y)}if(e[$e.extensionName]){let y=e[$e.extensionName].params,A=so.format({[$e.extensionName]:[y]});_.push(`Sec-WebSocket-Extensions: ${A}`),w._extensions=e}this.emit("headers",_,x),f.write(_.concat(`\r
8
+ var F0=Object.create;var sr=Object.defineProperty;var U0=Object.getOwnPropertyDescriptor;var K0=Object.getOwnPropertyNames;var H0=Object.getPrototypeOf,G0=Object.prototype.hasOwnProperty;var W=(r=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(r,{get:(e,o)=>(typeof require<"u"?require:e)[o]}):r)(function(r){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+r+'" is not supported')});var De=(r,e)=>()=>(r&&(e=r(r=0)),e);var re=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),_s=(r,e)=>{for(var o in e)sr(r,o,{get:e[o],enumerable:!0})},j0=(r,e,o,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let x of K0(e))!G0.call(r,x)&&x!==o&&sr(r,x,{get:()=>e[x],enumerable:!(a=U0(e,x))||a.enumerable});return r};var Pe=(r,e,o)=>(o=r!=null?F0(H0(r)):{},j0(e||!r||!r.__esModule?sr(o,"default",{value:r,enumerable:!0}):o,r));import{chmod as W0,mkdir as J0,readFile as V0,rename as ws,writeFile as ys}from"node:fs/promises";import{dirname as X0}from"node:path";async function Ft(r){try{let e=await V0(r,"utf8");return JSON.parse(e)}catch(e){if(e.code==="ENOENT")return null;throw e}}async function Ut(r,e,o){await J0(X0(r),{recursive:!0});let a=`${JSON.stringify(e,null,2)}
9
+ `,x=`${r}.tmp-${process.pid}-${Math.random().toString(36).slice(2,10)}`;try{o?.mode!==void 0?await ys(x,a,{encoding:"utf8",mode:o.mode}):await ys(x,a,"utf8"),await ws(x,r),o?.mode!==void 0&&await W0(r,o.mode)}catch(f){await ws(x,x).catch(()=>{});let{rm:d}=await import("node:fs/promises");throw await d(x,{force:!0}).catch(()=>{}),f}}var ir=De(()=>{"use strict"});function Ss(r){return Ht[vs]<=Ht[r]}function or(r){bs={...r}}function Kt(r,e,o,a){if(Ht[r]<Ht[vs])return;let x=JSON.stringify({ts:new Date().toISOString(),level:r,module:e,msg:o,...bs,...a});r==="error"||r==="warn"?Z0.write(`${x}
10
+ `):Y0.write(`${x}
11
+ `)}function B(r){return{debug:(e,o)=>Kt("debug",r,e,o),info:(e,o)=>Kt("info",r,e,o),warn:(e,o)=>Kt("warn",r,e,o),error:(e,o)=>Kt("error",r,e,o),child:e=>B(`${r}.${e}`)}}var Ht,vs,Y0,Z0,bs,K=De(()=>{"use strict";Ht={debug:10,info:20,warn:30,error:40},vs=(()=>{let r=process.env.COZE_BRIDGE_LOG_LEVEL;return r==="debug"||r==="info"||r==="warn"||r==="error"?r:"info"})(),Y0=process.stdout,Z0=process.stderr,bs={}});import{homedir as $0}from"node:os";import{join as Q}from"node:path";function H(r){let e=r??$0(),o=Q(e,".coze"),a=Q(o,"bridge"),x=Q(a,"lib");return{cozeRoot:o,bridgeRoot:a,libDir:x,libEntry:Q(x,"index.js"),pidFile:Q(a,"bridge.pid"),portFile:Q(a,"bridge.port"),tokenFile:Q(a,"bridge.token"),logFile:Q(a,"bridge.log"),installLock:Q(a,"install.lock"),configFile:Q(a,"config.json"),agentsRoot:Q(o,"agents")}}function Le(r,e=H()){let o=Q(e.agentsRoot,r);return{root:o,config:Q(o,"config.json"),workspace:Q(o,"workspace"),logs:Q(o,"logs")}}var se=De(()=>{"use strict"});var Wt={};_s(Wt,{AGENT_CONFIG_FILE_MODE:()=>Gt,enforceAgentConfigMode:()=>ta,loadAgentConfig:()=>xe,persistAgentSessions:()=>ar,persistAgentSkills:()=>jt,saveAgentConfig:()=>he});import{chmod as Q0,stat as ea}from"node:fs/promises";function xe(r,e){return Ft(Le(r,e).config)}function he(r,e){return Ut(Le(r.agentId,e).config,r,{mode:Gt})}async function ta(r,e){if(process.platform==="win32")return;let o=Le(r,e).config;try{let a=await ea(o);if(!a.isFile())return;let x=a.mode&511;x!==Gt&&(await Q0(o,Gt),Es.warn("agent config mode auto-corrected to 0600",{path:o,from:x.toString(8)}))}catch(a){if(a.code==="ENOENT")return;Es.warn("enforceAgentConfigMode: chmod failed (ignored)",{path:o,err:String(a)})}}async function ar(r,e,o){let a=await xe(r,o);a&&(a.sessions=Object.fromEntries(e),await he(a,o))}async function jt(r,e,o){let a=await xe(r,o);a&&(a.skills=e,await he(a,o))}var Es,Gt,qe=De(()=>{"use strict";ir();K();se();Es=B("agent-config"),Gt=384});var ci=re(X=>{"use strict";var E=k;(function(r,e){let o=k,a=r();for(;;)try{if(parseInt(o(654))/1*(-parseInt(o(1166))/2)+-parseInt(o(1050))/3*(-parseInt(o(1729))/4)+parseInt(o(1687))/5*(-parseInt(o(1346))/6)+parseInt(o(1216))/7+-parseInt(o(521))/8+parseInt(o(1190))/9*(-parseInt(o(556))/10)+-parseInt(o(304))/11*(-parseInt(o(1598))/12)===e)break;a.push(a.shift())}catch{a.push(a.shift())}})(gn,689747);function gn(){let r=["wen4tg0","tgTzAgy","vLjTA1G","DxvuBM0","rfbewK4","zxjFCw9Z","Aw9UvgLTzw8","BMfMCNy","igzHAwWSig0","rwX3Bvu","Aw5Lza","Berkt2y","BwvKAwf0zwW","zwXTC3m","AKXLCvq","r0HYzLy","x29UtwvZC2e","ywzL","x2nVBM5Ly3q","zg9Uzq","yM9KEq","zuXbzeK","y29UDgv4Da","uK5ZwwS","CKLhAvu","BfHcBKm","BM93","EKXfvgq","CLDPs20","CeTnBxa","EvrvCeq","y1LQAKm","zgrkv08","uKzXDe8","zfDVCMTLCKC","z3Lwwfy","nti3mdq4u0jSzLLj","D2fszxe","swfSr2i","C2HPzNq","zNjVBuHHC2G","r2nhwgi","B25SAw5L","vMHnqMm","CMvJB25Uzwm","q0XZAwm","D3jPDgu","vLjxq0i","vgfN","CMfUzg9T","EgTkve0","DLjzBNq","uhnzA1G","swPQs1i","DM1AshO","t0zYwKy","A0fwtee","zMzmAw5L","qKH6zKG","wwTAwue","zgvJB2rLzey","yxbWBgLJyxq","sxLgCxu","q0TKrgC","EK5yu3O","x2LUDgvYDMe","BMDuAw1LCG","B2LUDfjLywm","ChjVDg9JB2W","ywnRtxnNswq","ywnOzwq","zxjFDhrS","qurwsM0","yxjYyxLIDwy","ANHRtwG","qKLvzfe","CMvJzwL2zwq","t1HbDhG","igfYCMf5yNu","y3DVrwK","rwHKsxu","DfDJuMe","zgTZrhi","wKjlvuC","tMrwvgi","CMfNzvn5BMm","rhbpqM4","z0v2uLe","BMzQwwu","y01pDMu","B0TQshe","Dg9cExrLCW","A3DnDgG","qxjqyNe","vuzhvey","rxzUDvK","AxnmB25N","uxHjtLi","v3vYqvO","wMTnsgu","C3Hnrxi","CMvHC29U","wMzvDu4","Bg9Nsurhzw4","A0Huwxm","qNjbvKy","yLnssgS","rK9nz2y","wfPbrhq","shfOEhK","renXzwq","AunAq0K","Ahr0Chm6","A0HTqve","s21Quxe","D2zjzva","Bw5Vwxa","yMfSrxzLBNq","shnHq2m","z2v0qwXS","v0XJB2e","y2f0y2G","zw5JB2rLrNi","DhLWzq","thfSy2G","t1Lnweu","t1bftL9fuLi","v0XTr2C","BNrfBMrWB2K","zxq9DxrMltG","tMfTzq","x2LUAxrqCM8","s0LztuW","ywrKt25L","x2n1CNnVCKy","r1nNwfK","B2zMC2v0","AezqAu4","icSG","D2vI","rfHZswK","yvH2tKy","v1frv3m","mZe0ntKZng9rrgLVuG","v3Dzzwm","rLHnANe","q1LMrhe","zw50zwqGDhK","y2uGBM90igK","CgLUz19VBMm","yM9L","v1PPveK","ChrryuW","x2HHBMrSzu8","shrAyNC","BMv4DcGPigm","x3bYzwzPEa","x2LZqNjVD3m","sff1q28","ywjVCNq","B3bLCNr5tMe","B25dBg9Zzq","wNLMtxK","uxbKDuq","rfPywha","Cg9PBNrbBMq","wgDYEey","y2T6tvG","sNPzBvO","igzPzwXKoIa","CMvKDwnL","BNruCMLLC0m","D3bTtNC","C3jJ","x3bHDgHlzxK","EfLds1m","Dev2zw50","y2T0wg8","zNbPBgS","A3HQu2G","D1HUq0C","zv90Aw1LB3u","zNjVBuj5Dgu","wM1QtfO","zM9Yy2u","r1PXwvC","s1jhBwG","B25szwnLAxy","zw5HyMXLuw8","yNvMzMvY","q0r0sxO","Aw5JBhvKzxm","CMvZzxruCMK","zhPWuum","A1jJA3m","zw5KCg9PBNq","yMLUyxj5vhK","ywnRx2nVzgu","AuDSCfi","B3DZENy","DKHRsxu","A1rYt2S","zgvMAw5Luhi","CMvZDwX0","A3zvs3q","q29Kzq","ugzUqNy","wvrNs3u","tufyx1jfvfi","ywnRx2LK","y2XLyxjtDg8","ChbL","CKnmyKW","B3bLBG","BezSDxnO","u1LLqxm","ExbVzhq","Bwf4uMv0CMK","rMvhDMu","vurgt2K","rvjst1i","tu9eCue","B3nLrxzLBNq","yxKSihrYEsa","CM9YrxzLBNq","AenSrMq","BwrVtLO","DgvmB2Djre4","zNjVBu51Bwi","zNnPDva","wLL1B0u","whztr0W","C2vUza","CMvWBgfJzq","yw5ZzM9YBvq","Dg9oDw1Izxi","ELHnv1i","Ae1LC3nHz2u","uNbWvuq","zgTPzLu","Ae5xv2e","s0T6vhm","DxrMofDYAxq","q2LuB0S","B2rwChC","z2v0u3rVCMe","sgzAuLy","AwXSihvZzsa","C1jYq0S","DMrNEvy","CgjICdi","uxPVBK4","EwDlzxG","rgz2Dwi","sunnt24","zND0t2C","zunLuNK","Cu5HDwi","t3vVq1e","BeDtsfO","rKD1BKm","tKvNt0S","rfPlA3C","B3nLza","BM5Ly3q","CNnVCL9Uyw0","EfvZzuvUDG","DfjjCKy","z2v0t3DUuhi","DMrhAxO","ENDLuLe","yM50sue","AgrjD0e","rxjYB3jdB2q","Bxz2v3G","yxv0BW","uwn6r0m","zLHMBuC","y29SBM8","r0roCu4","qu5cCuS","Eu5Lq1q","zNbYAMi","BfzquwC","zv9ZDwnJzxm","B2fK","qufmv2W","vKLSzKG","qxD2DLq","zwrLBLi","rfDpwuG","wMDkrfG","Cg9W","ywXSq3vYC28","zw50tgLZDgu","DgvZDa","DuXqzvi","vgLTzw91Da","CeDfAhy","BgvY","qKPPAMy","q3rIBNa","weforgS","BwvZC2fNztO","q0Xpu0ve","uLjpuG","vNL6CNK","yNL0zuXLBMC","zcbLCNjVCI4","ywWGy3vYC28","Dg9iyxnO","y29UDgLUDwu","qxPNreW","CMLwDLO","C2v0y3vYC28","yNvMzMvYzwq","BMvY","BLflzu0","ExD5zMW","wwXrA1e","DhftBMK","ue1rsw4","q3vXrLa","se9Qt1e","ALPxvfa","rvLZwMS","zNjHBwvuExa","tg9Nsuq","CKjyy2K","zxjFBxnNAwq","qvDpA2y","ANbAALy","AKPwt2q","y3jLyxrLt3a","sMn6yLG","zgf0yq","ywXty29Wzq","qKDVANu","DhjHBNnHy3q","C3rYAw5N","uu9XvM4","sLDSzwi","zu15rKO","CMvHzhLtDge","wNvxy1e","suDHEwq","CeT1sLC","sfHzwKi","EuH0s1C","u3rYyxrLz3K","Cfvhv0y","v3DdyKK","Au1VBhK","C2fNzq","wwDVChq","wLfivNm","y291BNq","vg5ZDwS","yw5Hz2vY","Dhj1y3rVCIa","oti3oteZnNnJvK5jyW","zw9guK0","Aw5KzxGGB3u","Cwvlsw8","DgfIyxnL","CMTHq2i","BevpsuO","vM1ktLa","s1Pquwi","A2fXtKm","CwHswuC","rufbAxO","wwHqu2u","BwTqDfG","sxjcANe","zw5JB2rPBMC","quLvwgG","rg5fyMq","BvbsuLi","wKPdD1m","C29YDa","rhbSzha","sLnkBLO","Aw55rwq","EK5mr08","zMLN","suvtx0vsuK8","wM11qNq","z2v0s2v5","zwnVBM5Ly3q","Dgv4Dc9WBge","AxnbCNjHEq","r3vPy2K","zMzMzG","ihrPBwvVDxq","mti3nJe4mfvwAKHXsG","uuvpwu4","zxj2AwnL","z1Pdtu8","EwLRCNu","Cgf5Bg9Hzeu","zLrrwMm","zvDUy2S","uMvJB25Uzwm","reTQvem","C3vJy2vZCW","zePnvKy","id4G","AK1NDwe","zNjVBunOyxi","ywDL","v0jpCvm","x2rYB3bhBg8","nNWZFdv8nhW","y29UBMvJDeu","sLnuBxu","mdaWmdaWmda","shvxDgW","y3vYC29Y","zw1LBNq","y3r4","AgfUz2u","tuD0t2W","rKTYvwO","x2n1CNnVCK4","zMX1C2HfEha","B2HJBxq","vLjwz0C","D2jWwKe","sNfzze0","r1bwyuC","Ew9KB1m","DwzNtfu","ueHPsu4","wfj0qKC","uK5bB3q","AgfZ","veTJv0C","Bwf4tg9ZC0m","q2j0CNm","wfbXDvK","twDREgK","CKPKA24","B3jL","CM92AwrLihy","sfrLvuO","t2jQzwn0","u0vrtum","CfLnCvq","v3nSvui","u2TPCcbWyxm","r0TTCgy","Bg1ZALq","CNjVCK1LC3m","yw5Nzq","BMrWB2LUDfq","CePmqKu","Axnby2TdBgu","CMvZzxrfBMq","y2HLy2TdDxi","zNjVBNrPzxi","BfrPBwvVDxq","x2XPC3rLBMu","C2vYDMvYvgK","r2ntEgO","Bhrjtwe","vLnOvKe","yxGGCMv0CMK","s2rKCfC","zfHUBhG","vMvSsxe","vhrmsKm","DMvY","vMrftei","y2jRz3a","C2v0u3rVCMe","DxfSDKG","zMLSzw5HBwu","Dgv4DfbHEwW","DwHmr0G","ALHjAMe","sLfIqMK","B1n3ueW","EhvuyLC","uxvLDwu","EKr5A2i","zgvIDwC","DNfvzgS","DK5fsgm","Eu1RB1y","yKTsywq","sfj4uxe","DMjrtw8","oufutxHjzq","yxbWBhK","ywnRDxbfBMq","q1v1Cwi","thvdzvy","yKzyDNO","zxjFCw9Zx2e","wNLWqLy","rwngrvi","DxDOCNa","y0D3vhG","AwXK","rND2yui","ChrVCG","Eur1EKm","yuvetgO","wNbVv08","Aw5KzxG","ihjLy29UBMu","y2XVC2u","D2fZq2XLyw4","whfeChu","C29Tzq","AwD2u0W","x3jLywr5q2W","zK5NAhe","CMvUDevUzha","B3bLBIa","Dg9hzw5LCMe","C3rYAw5NAwy","vNrlAe4","BxnWrgu","Aw9Ul2PZB24","DvjmzLi","shjgAfq","zufJAW","Bg1muMK","C1byDeO","z0fHzMm","uu10Dw8","CgLUz0LUDgu","verkzxG","CfjNExq","vfzvEvK","CeH6s0W","CgXIEhy","tLbMsNu","EurZsLe","y3jLyxrLuMu","z2vtEw5J","B0TfwvC","y2HnyxHdB3u","zfnlsNa","zLjHBvq","x2DLDeLUDgu","q0Xpu0LorW","wfnzt00","vM1xEKK","v2Dhu0e","CuDssNO","x2LZsw5PDa","x2DLBMvYyxq","DxjS","A2zMsMm","v29HENe","y29UBMvJDfm","DeXyqwW","DxP5rw0","DvPfu3y","BgDIA3K","zMvY","t216r1u","EvnVD2C","BKzfB0e","svHvsuW","zxrxB3jRq2G","D0rMyuS","DvLmtuq","A09NtwS","AevoB3q","vLzTAva","tKH0ALq","D0znBLe","Cw9HsK4","AMX1z1C","vMHuqLu","DMHYtfy","Bwv0Ag9K","BgncALq","uMLdyui","uu9bue0","yxv0B21HDgK","rfjOtNm","B0jUueW","A1fdvxa","Cg93","A1HNz0e","BwrfsMK","x0rctMfTzq","DM1HDLi","y2LKvwW","DLnltNm","wfnHC0O","y3vYCMvUDeK","Auzgv1K","tMvWv0q","y2HnyxHuCMK","ysbTDxn0igi","zgnRANq","qxjnz0i","v1LNwKi","y09Wzw4","CNDNv00","u2vXsuq","zejxuNi","ELH4qw0","zg9yrxu","Cw9Z","zw5HyMXLqxu","BgLTAxq","A2LUu3m","mdaWma","zMLUza","x2rLC3rYB3K","txzxqxq","o2nOyxjZzxq","vxj4v0e","C2vYDMLJzq","AevYCM9Yrxy","uhD3v0i","CxbSELe","t1zkv2i","v2vmv1K","C3bSAwnL","tKLtv1y","zKvtCKO","tfPXt1a","x2TLEvbHDgG","zNjVBujPDhm","C2vYDMLJzs0","BMCGzMfPBgu","qwLAzfu","yMLzyKW","AvjZENe","shvPruO","tg9NsurozxC","veLdugm","BgLZDgvUtMu","wvLVwvG","zgLZCgf0y2G","A2XyDey","BxnN","u0nAAui","q0Hzu2u","CMfuyMu","yLH0t2C","AKfjuvy","r1viCwu","qvvIrKW","y2XLyxi","zgjoqNu","tvvpB2q","Dg9mB3DLCKm","AwDHDg9Yt24","ExLABKO","u1HSvKC","BwvY","vg9bu3C","vNHjt0e","BMPltKG","ihrVihjLDhi","y2HHCKnVzgu","zxH0zw5ZAw8","yLH1uMm","C3vIyxjYyxK","CM92AwrLigi","r3vZAuq","B2jQzwn0u3q","DxLUDwG","zw50","qND1CLe","whjYsK8","x3vYBa","EeTRqM0","uvrfzLi","B3vUDa","pxv0zI04","Aw5L","t3bLBKv2zw4","DKX5sMi","AxLJugy","BufTDvi","Bw5oq20","AMPete4","DMvUDa","B2XKvMvYC2K","wgvbvLq","C2v0","CgvYC2LZDgu","CgXLyxnLiha","sNbfAvm","uMzTEKW","q09oveLovuu","v3r3uMe","C2v0sxrLBq","we1WBgu","DuroAha","CYbPBNn0yw4","C3bSAxq","sgL5wK0","C3rVCcbPBw0","C0XPC3rLBMu","Dg9cExrLC0W","t3L0D20","AM9PBG","C3rHCNq","B2zM","BMrLEa","tg9JAW","DMnJCgq","r1jVtvG","B3PUy2O","v0zfDgy","B3bLCNr5","vw5Oyw5KBgu","zwn0","wLrZuM4","DKrwyNq","rK91z0C","ign1CNnVCIa","ALnvuhG","yLP6u28","x2LUAxq","ENf0wgO","AwXLx25HBwu","v0TLvg4","ENPXz2y","zxHWB3j0CW","CfjPAMe","zhzgz2W","uu1hz1y","z1Dnr0G","x3bPBMDmB3m","DvnPwfi","rM1iC2i","CufPzNi","zeHRDwe","r2XYB3O","ihzHBgLKigq","C2v0q3vYC28","x2rItMfTzq","y1n6BMi","CMvTB3zLrxy","wg9eBMW","DhDVCMTdAge","vhrdsLa","x2rPC3bHDgm","DhroAMu","u1bny1e","tffeqLu","seHvBNK","ruvdBuS","q291BNq","rLjptLrjrvi","Cgf5Bg9Hza","BLLvDee","yMrFzgLK","CgLUz0XVC3m","ELjfqxm","AeT1Aw4","q01rDNq","tw9KDwXL","zw1PDa","CMvQzwn0","B1rSzhi","x21LC3nHz2u","q0XuwLm","zeXqswe","BeHHBMrSzxi","vxjwyK8","rvPfs1i","CMfTzq","DeDMsMK","v3biB3e","reDJD0S","C21XDue","uxLXvMm","v21Jveu","vMPzvvq","x2rLyNvN","yw51Ce1LC3m","ywXPzcb1CMW","B1zYyNi","CM92AwrLige","vwPMtwi","C2XPy2u","zMLSDgvY","y3vZDg9Tshq","jMPZy2fSBgi","vMvsrLy","x2zVCM1HDeu","C1DjD3q","C2vUzf9Hy2S","u2HHCMvKv28","survtMi","vhrNugK","uLnVzMu","v2fvDfO","mNW0Fdn8mhW","tgTtDxO","AfHxvge","CvbUzvm","AefJA01LC3m","zNvUy3rPB24","A2v0ignVBNm","zM9YrwfJAa","tKfusvzfx0u","r1bUwhK","u0veuLu","ywDLu2HVDW","z1P5t2e","tNLIrfC","y3ruAw1LB3u","y3vYC29Yx24","Dg9tDhjPBMC","s0j5AKO","wg5Os1G","uNfAq0e","ug5RCLm","svLTD3u","C0nVDw50zxi","zKH2yvG","q3DYAM4","Dg9Y","zhfUAvy","yMXABgy","AhL1C3i","y2XVC2uSihC","ywrKq291BNq","BwvZC2fNzv8","B25tDg9Wsw0","lcbTyxGGCMu","Cgf5Bg9Hzfq","DeLUDgvYy2u","AMvQEu0","zxjFywnRx20","shPHyxi","rNjVBNrPzxi","D3jPDgvvAw4","t3fQsfO","C3DvwhG","CNvhtMS","zxH0ugf5Bg8","AgvKtwf4uMu","Dw5ZAwDUzwq","rLHevxO","BM1ltgq","x2rPC2nVBM4","AK90svu","Dw50","u21Uzhq","CMLLC0nVDw4","rLDt","sLLXs2C","D1POCwu","BKHmrey","x2nSzwfYugK","DMfSDwvZ","B25VCgvU","uejtDuC","zvLjveO","BKXPBMu","Dxrjza","zgn2B3a","DhjPzxm","x3bPBMDqB24","CKfis1K","wefLs2m","rxLvqLe","BerOCeG","rxzLBNq","x29Ut3bLBG","Ae9Wzw5fDMu","yxnJCMLWDa","wgX3z0O","yw1LoIa","AxjLza","y29UBMvJDca","BxvuBxO","DgD4EhK","CvHbzNK","BMnLq2XVC2u","ihrPBwvZ","Bg93","vvzvuwW","BwLZzq","m3nyv3LPBq","tuvtu0fhrv8","zerLvuG","vgvgt0G","z2v0","A1HXru4","q2r3D0W","vMnJELi","vMf3qNG","sKXbzNy","rM9Yt08","BhrPCgXLihq","s3f2uw0","yM1AExq","BgLhA0y","x2n1CNnVCK0","B2zMBgLUzq","CvD5CK4","s2PPwuS","EsbJBg9Zzwq","C1jRB3y","t1PZB28","r1j4v2W","yKjXt1O","x2LZtwLUAvC","CvjACeC","uLvhtwK","AKPYAwK","qwfSqNC","ELnLDKC","BgvUz3rO","Aw5KzxHpzG","t2Hxug8","AurqEKC","yw1L","te1eq0W","r3jcu1q","tgLZDgvUzxi","tLroyKK","x2LZtwLUAvq","y3vYDMfSDwu","vwL3zKu","y2fSBa","vLnNrKS","DKPLAfm","EM92CMW","ywXSzwqGBxu","rNPAr2O","A1nTEMC","zfnJqNO","zvfAwNm","Aw50zwDLCIa","B2nRzxq","CvDOsfy","Aw1LCYbPBIa","ALjNrhq","DNb3yuy","x29WDgLVBNm","CNnVCL92ywW","AhrZuuW","D1rqs3C","wM1gzhG","CwPcAhG","uwXZsw8","r0Pnwem","u0PlwhC","CMvJzxzPzwq","x1fVu01HBMe","sxLXuem","A2v5","sg5wweW","z0HWC2G","CNnVCKzPBgu","s09vrva","ywDLsgLKzq","qwHptK0","r3DwDe8","CMvHzhDYAxq","zMzLCG","tvHSrLG","D2jkAee","EK5byM0","v0vmAfG","B0XqqNi","wKj3qvu","zxmGCMvHy2G","B3bLBKrc","A0PNve8","rgDjt0K","A0jpr2S","zLPeqNm","CM9XqMK","tKrhwhO","EM1Vt1G","DLD4CwK","zgvSzxrL","uKz0zvu","BgLUzq","A1nuEgi","CMvTB3zLq2G","CgTrv2K","DK1zDge","x2LZv29YA2u","A0Lcv1q","Bhm6ia","A1n0yxr1C0m","zhvruwu","DhfmueC","ywrK","DePOy2S","BvzTweC","C3bZDxO","zg1vrK4","zM5LsgK","ywzTENq","y3vYC29Yx2y","ndy4mdzwue1nqxe","t1LVBhi","zw5HyMXLvhi","q3vZDg9Trxi","y2v4AKG","x29UrxjYB3i","zxjYB3i","yMflt1a","zKfTu0W","BMnVzgLUzW","z3DQuwq","sxvfANO","C2vUDa","quPqrfu","CuHzA3G","ChjVDg90Exa","z2v0sxrLBq","CMvZB2X2zq","D3m6lY8","CuztzKq","C3nHz2vfDMu","v2vPEgLUsLm","BgLUzw5V","B25JBg9Zzq","ntrgu2HOzhe","AgLNAa","ihrYEsbYzwm","twLZC2LUzYa","AxnszwfKEq","wLrYqKi","s2vXt2W","x2LUAxrhBg8","v2Xis2y","B2fVreK","x2fKzfDZtgK","x194x21Zz18","D09iqxi","AwXLtMfTzq","AxnrB1nby2S","y0X6yKK","mxW2Fdn8ohW","vhjdy04","BeHMqwS","wvDzyvy","yLbeuKi","C25ou2i","swPQuLC","qKnStgS","AgvHzgvY","yKzUuNC","mJuYntmWnNDTzxfKra","y053vLy","DgfYz2v0","vNr0Ce0","EKfWCw4","BeHiDKK","rLDvy3C","DMXOBKC","yKD6A2y","ENzxwuS","DhPPq2K","yxrLq291BNq","yvHJAhm","q2D3zMW","rwzitem","DuL1B2y","zgvSzxrLrge","zMXVB3i","uKHmsMq","x21PBMLoyxy","Dw5KzwzPBMu","tgDAwfa","uNfpC1C","B3P3rgm","ENL6v3u","y2vZC0HHBMq","AgD0zuC","BgrQuwS","AxHJq0O","sgP0veq","DeDjyNq","DxHbDhe","t3jwExq","x3bYB3rVy28","yNnqAfm","DejkqxK","tevUA1G","v1nhtwW","qM9Pzxi","uMjgCw0","uKn4t1u","x2nSzwfYvgK","zNDZxZeUmc4","D24GCMvHC28","AgvHzgvYCW","ELfpzfe","q1zos24","uuDHzfu","rM1Jtxu","x3jLy29UBMu","DxbKyxrLq3u","x29UvgLTzw8","s2LMwKm","EfvTt1O","seXIufy","C0Xf","AxnFywnR","wgLht04","AhvqsK0","Dg9cExrLC0i","yKXVqKm","uxzfCxO","B25fCNjVCG","DwrsDxy","vu9pAfm","ignVzgu6ia","vefrtKi","ELb6wuq","tvzXzwK","ELrqrMC","twvZC2fNzuu","y3vYCMvUDeu","yNL0zxm","rMnfA1q","ChvZAa","rMHmtKW","Exruwuy","z2vjBMzVu3K","Ce5zueK","v01iDNq","wfn5Ewu","CYbHBhjLywq","B25TzxnZywC","aaaaaaaaaaa","rgXAuMS","B3jRig9MzMW","swXivKG","thrtteC","rMzswKO","s1Dnugm","ANHPC0e","DNLeAwK","ywXS","zxjYtM8","DxnLCKLW","q0Pcs3u","BMvLzf9Hy2S","vLjNy3C","rfvgz24","ELjkA2K","vxbKyxrLq28","zxjHDg9Y","DezVzwS","u0Pwq0W","rhPZEM4","sMXNEwm","y3jLyxrLtwu","tePlqxO","BM9etKO","B25LCNjVCG","DKvOAfy","END3Ahu","yMLUyxj5","B25tDgfYDfi","ELHjrgW","x2nYzwf0zvm","ywr2yw5Jzq","y29UBMvJDgK","x3nLCuLK","B25mAw5L","Dhr3Awq","BwfKsuG","txznEMu","vfrfruq","rKT6AKW","y29UC3rYDwm","l3DZl3yY","zwrPyxrLBhK","AxjfDfa","ugnqwM0","oda0CwvQvKvW","CMTLCKDSB2i","DfLZBu0","BwfW","r29pufi","BKroDwe","t1bftG","wgvADwS","x19LC01Vzhu","y3jLyxrLq2W","DNzJD1K","q3blChy","r0nvtMy","x2LZtM9Kzq","y0n1Cfu","CgfYC2u","CLLbt3G","reiGzMfPBgu","vgHKywe","y29Uy2f0","B2nRzxrtDwm","DNDwrMq","ueruCw8","q2Dxwu8","yxrHlcbKyxq","y01lBLa","x29Uq2XVC2u","z1zkEMm","sg5zyKK","Dhjnrei","v1bPALG","s1rAuee","EvjLy29UBMu","v2nWyK8","DMfwD0m","yNvprfy","BKLxzgK","yMLOzMK","rgjbwMi","D0XJu20","uuTYsNC","vfvWwxK","seveq1G","zg5qzxm","x2HHBMrSzva","AhnuBve","DLPMz0u","A05jy0q","y29Kzq","Exv1s3a","v1zfy0y","x3bPBMC","yxbeEe8","yMfSu2nVCgu","BNrLCG","EK1Zu2q","sxjkzgC","yw1Lu3bHy2u","u0rgt1y","quv3ufy","zgPsuwS","Cg9PBNrdB24","CxbjDLG","C3vIC3rYAw4","ALHeuNq","r0fiEee","DMLJzuLeig8","r0foB2y","Ef9MCM9UDgK","B0rWs0K","B2nRzxrgywK","AxnAzxjV","sff4uuu","ugznrNG","AxnrB1nnzxm","vLfTvhO","qMrmzu4","zgvS","y0DeuNC","A2jVwvK","BhL1tvC","rgPtEg0","zNjJC1C","z2vrDwv1zuW","nhWYFdb8mxW","Du9rq3m","v2vIu29JA2u","y29TCgXLDgu","su5tvefova","Cgu6ia","DgHHBIbSB2m","svPtsum","DgLTzw91Da","wufSAMq","s0PWrLa","qw1VDw50","Chv0","te9SDxC","AuThs1a","rNj1tw0","EMH5uhm","yxHjzfC","z2v0q3vYC28","BgP3Bvm","BwLUzW","Cxnzwgy","thHlvhC","DKzuAee","A1HABxq","q0TQCMK","x2HHBMrSzvi","q29UzMLN","z29PBMCGyxC","zMzMsum","DhbizwfKzxi","A3jZwxq","vNb4A1K","D3nZoI8V","C2v0zgi","txHxy0e","DcbSAw1PDa","wK5dr28","zvzbr2S","BMDLza","BMvJDa","DgHLBG","uvH0veK","zvvYBa","u2T2s3C","sfzJEwC","Efrurw52","DxrVuMvJB24","CLzHBhvLCW","wLLXtha","x3jLBw92zvC","ENrIrfm","zgLZywjSzue","zxjYtxnN","BMv3vMvYC2K","uvHgquC","CNzHBfzHBhu","yNjZwLK","BufQzeu","y2HLy2Tszwe","q3vZDg9Tq2W","rvzxC08","CMvXDwLYzwq","De1HBMfNzxi","BMfTzq","x3DZsw5ZDge","tNbwt1m","y2XVC2veqG","ywrKrxzLBNq","y3jLyxrLrwW","zgv2AwnLx2K","BMH5yM0","wKzSy1y","sez2qKq","EgPcwKm","x2vUzhbVAw4","uK9Js0e","AgDOBfe","x3DZ","wvjfr28","yxnZAwDU","ugLJrhi","s0z0ufy","Cuz0rxa","ELr1yKi","oxW3Fdb8mta","yMXVy2TLza","CMvZzxrdB3u","ExbL","vuPHrve","vKrQDNi","qwDADeS","A3j1DM0","zLvXDhq","ugjJzNm","DKHvzM4","rKjXwuO","zKnHC2e","ENrnqwu","zNDguuq","y3Lmte8","vw5zq3i","uhjPBwfYEuS","v2v5sKi","DMjkCge","Aw9U","ywrnAum","nhWZFdf8nxW","yMLUza","u2jcrLy","Aw5N","BMCGB3iGyw4","AMvJDfn0B3i","zLvWrge","z2v0q3vYCMu","vw5PBxbSzw0","CMvHzfvjBNq","rxnQr0G","yvLcyw4","C3rVCMu","u0rIywS","C0jf","Bg9IywXty28","tKDFrvjst1i","CM92AwrLihC","zw5fDMvUDa","yw9dwgm","t1nIDg8","x3DHAxq","wxjor0e","DM9yENy","x2jPBMfYEvq","mhWY","yLP1z1m","yuLwvKO","BKnIC3q","Ce1quK8","Dgv4Dc9Qyxy","zcWG","B3PnqLy","vevNufO","q0vqEwy","r25RthK","D2LSBfjLy28","yxnL","ufHfr0W","BwvZC2fNzq","svDJz2y","uufZz3G","tgPzAvK","qLPmCeu","qNfOAfm","D2DUwhu","EhL0ree","r0ntAey","txH3sg4","DgLUzYbZzxi","t015DMO","u2vYDMLJzvC","B3jLtMfTzxm","zKTcA3m","x25HDMLNyxq","AgD4yMO","CgfNzxnOB3C","CNzHBa","yNLL","txjhvgu","B3jpBMXPBMu","mtiWCerdqwj4","qu5pAve","mxWWFdi","uxLiEgC","qKD6thm","A2v5CW","zhLSq1m","BxnNsuq","B093s1C","B21QDhC","Dw5RBM93BIa","CwLbEMG","AeLLq3C","z1rPBwvVDxq","vKrHDwG","wvPjwe8","A3bAveu","sLnptLa","BMrWB2LUDca","CvHjAKO","CYbWyxjHBxm","zgrlz1a","mxWZFdb8nhW","zhzouxO","tMLoAKK","B25ozxr3B3i","vvbpC2i","DLv2sMS","BNL2CNu","Bg9N","EM1Wzgu","yK1kBKC","rwzhrg8","z2vY","wM5vEKu","D3bMCw0","qwjVCNrfCNi","rMnhzLy","D29Hu3q","BIWGAg9ZDg4","CgfNzwHPzgu","BeHluxi","zw5NDgG","AuL6u20","rgPnyNG","weHqq3i","AvDXEha","tNzJwuC","tgvoyvi","z2vJsxi","ugLABNm","AwLTsxe","y0jbAMm","rMrWEge","BfrAzM0","uuHzruW","BLrbtxu","v2LUzg93","BNrbBMrvCgq","D2LWBxG","EMzSBgi","rvL6yLC","C3rLBMvYCW","x3nVy2TLDa","B2rnuKu","DMfSDwu","yNL0zu9MzNm","y3jLyxrLrxi","CgLluuC","sunHsum","q09otKvdveK","DhjPzxmGCMu","DeLK","yw9lBeC","y3vszM8","z3vUEeG","wKXIAum","yxrKBxy","CgLUz09Uy2u","txLmtxG","z2v0qwXSs2u","Bg9NsurozxC","sefru0m","tMXYreq","x3fVC0rc","t2f4D2K","EMr0z2G","x29UugfNzu4","zcWGDw5RBM8","mtK2ndvXA0zyzNO","sNfqveq","C2DPza","AenSB3nLrxy","uxnrt3a","uwTfAKu"];return gn=function(){return r},gn()}var ux=Object[E(363)+E(877)],dx=Object[E(429)+E(321)+"mes"],si=(r,e)=>function(){return r&&(e=(0,r[{iimIq:function(f,d){return f(d)}}[E(1649)](dx,r)[0]])(r=0)),e},lx=(r,e)=>{let o=E,a={kBOGk:function(f,d,h,_){return f(d,h,_)}};for(var x in e)a[o(1139)](ux,r,x,{get:e[x],enumerable:!0})};function hx(){return Qs||(Qs=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function gx(){let r=E;return ei||(ei=[IDBCursor.prototype[r(1332)],IDBCursor[r(1181)+"e"][r(472)],IDBCursor[r(1181)+"e"][r(472)+"PrimaryKey"]])}function px(r){let e=E,o={RfmzL:function(x,f){return x(f)},WPijX:function(x){return x()},iMoly:function(x,f,d){return x(f,d)},ZnUzE:e(1595),Blskd:function(x,f){return x===f},kHTYs:e(1314),lcBjT:"rrJeA",DRhNs:"success",xkJTM:e(1172),jyKth:function(x,f){return x instanceof f}},a=new Promise((x,f)=>{let d=e,h={lEOIJ:function(y,A,L){return o[k(513)](y,A,L)},AiZdU:o[d(1632)],pkQWi:function(y,A){return o.Blskd(y,A)},UrVbO:o[d(265)],FsyHw:o[d(742)],QczGC:o[d(746)],kinSs:o[d(1743)]},_=()=>{let y=d;if(h[y(1150)](h[y(933)],h.FsyHw)){this[y(910)+y(1690)+y(833)](h[y(527)](_0x357676,y(673),{code:1e3,reason:h[y(795)]})),this[y(1505)+y(1493)]?.[y(619)+"pointConfig"](),this[y(896)+y(984)]?.[y(1517)+y(1400)]();return}else r[y(906)+y(455)+y(477)](h[y(437)],v),r[y(906)+y(455)+y(477)](h[y(774)],b)},v=()=>{let y=d;o.RfmzL(x,o[y(855)](Ee,r[y(364)])),o[y(1376)](_)},b=()=>{f(r[d(1172)]),_()};r[d(1498)+d(1087)](o[d(746)],v),r[d(1498)+d(1087)](o[d(1743)],b)});return a[e(1471)](x=>{let f=e;o.jyKth(x,IDBCursor)&&dr[f(851)](x,r)})[e(282)](()=>{}),mn[e(851)](a,r),a}function mx(r){let e=E,o={GnkLy:function(x,f){return x!==f},KeqOl:e(606),tGfJi:e(1634)+"or",KFtPV:function(x){return x()},BZLpE:e(1433),AalBw:e(320),owszv:e(1628)};if(pn[e(597)](r))return;let a=new Promise((x,f)=>{let d=e,h={LOluw:o[d(1580)],brsZY:o[d(1078)],tWcRa:function(y,A){return y!==A},YWYaV:o[d(360)],gecIr:function(y){return o[d(1512)](y)}},_=()=>{let y=d;r[y(906)+"entListe"+y(477)](h[y(1443)],v),r["removeEv"+y(455)+y(477)](y(1172),b),r["removeEv"+y(455)+"ner"](h[y(1487)],b)},v=()=>{let y=d;if(h[y(1774)](h[y(1209)],h.YWYaV))return this[y(910)+y(398)+y(1034)](_0xa97d72),_0x572d1e();h[y(1647)](x),h[y(1647)](_)},b=()=>{let y=d;o[y(1572)](y(989),o[y(1196)])?(f(r[y(1172)]||new DOMException(o[y(936)],o[y(936)])),o[y(1512)](_)):(_0x59d465(_0x37a550,82),_0x37508d(_0x34d7c4,_0x38178a))};r[d(1498)+d(1087)]("complete",v),r[d(1498)+"Listener"](d(1172),b),r[d(1498)+"Listener"](o.AalBw,b)});pn[e(851)](r,a)}function _x(r){_n={IvwPe:function(o,a){return o(a)}}.IvwPe(r,_n)}function yx(r){let e=E,o={KZPQb:function(a,x){return a(x)},eldII:function(a,x){return a(x)},gunxH:"00000000"+e(577)+"0000000000000000",pKuJW:function(a,x){return a(x)},tRIrF:function(a,x){return a(x)},MHifW:function(a,x){return a in x},qplzQ:e(831)+e(1589),nIWdi:function(a){return a()},dScBz:function(a,x){return a!==x},QyHxg:e(796)};if(r===IDBDatabase[e(1181)+"e"][e(499)+e(1535)]&&!o.MHifW(o[e(784)],IDBTransaction[e(1181)+"e"]))return function(a,...x){let f=e,d=r.call(Pt(this),a,...x);return ur[f(851)](d,a.sort?a[f(541)]():[a]),o[f(529)](Ee,d)};if(o[e(1382)](gx).includes(r))if(o[e(1099)](o.QyHxg,o[e(1601)])){let a=/(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}/[e(456)](_0x4f7987),x=/(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))/[e(456)](_0x344095);return a?o.eldII(_0x36cf73,_0x2266b7):x?_0x2a750d(_0x193598):o[e(1673)]}else return function(...a){let x=e;return r[x(655)](Pt(this),a),o[x(507)](Ee,dr[x(1054)](this))};return function(...a){let x=e;return Ee(r[x(655)](o[x(428)](Pt,this),a))}}function vx(r){let e=E,o={IDUNb:function(a,x){return a===x},MrGTe:e(967),ZmuBt:function(a,x){return a(x)},MOAKZ:function(a,x){return a(x)},EhdIu:function(a,x,f){return a(x,f)},wDfaK:function(a){return a()}};return o[e(958)](typeof r,o[e(1596)])?o[e(548)](yx,r):(r instanceof IDBTransaction&&o.MOAKZ(mx,r),o[e(1773)](ii,r,o[e(730)](hx))?new Proxy(r,_n):r)}function Ee(r){let e=E,o={KRGmh:function(x,f){return x instanceof f},qoaJN:function(x,f){return x(f)}};if(o[e(347)](r,IDBRequest))return o[e(737)](px,r);if(ln[e(597)](r))return ln[e(1054)](r);let a=o[e(737)](vx,r);return a!==r&&(ln.set(r,a),mn[e(851)](a,r)),a}function k(r,e){r=r-265;let o=gn(),a=o[r];if(k.ayQsIC===void 0){var x=function(_){let v="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=",b="",y="";for(let A=0,L,T,R=0;T=_.charAt(R++);~T&&(L=A%4?L*64+T:T,A++%4)?b+=String.fromCharCode(255&L>>(-2*A&6)):0)T=v.indexOf(T);for(let A=0,L=b.length;A<L;A++)y+="%"+("00"+b.charCodeAt(A).toString(16)).slice(-2);return decodeURIComponent(y)};k.iNiVbf=x,k.EmKXqU={},k.ayQsIC=!0}let f=o[0],d=r+f,h=k.EmKXqU[d];return h?a=h:(a=k.iNiVbf(a),k.EmKXqU[d]=a),a}var ii,Qs,ei,dr,pn,ur,ln,mn,_n,Pt,ti=si({"node_modules/idb/build/wrap-idb-value.js"(){let r=E,e={psmTI:function(o,a){return o instanceof a},HXYZB:function(o,a){return o===a},ZJCwS:r(1683),BgPoa:r(482),krsYt:function(o,a){return o===a},lHHvI:r(1549),bZzSo:function(o,a){return o(a)},bmZyt:function(o,a){return o instanceof a},GcSxj:r(1712),zTPFg:function(o,a){return o===a},VShVA:function(o,a){return o in a}};ii=(o,a)=>a[r(676)](x=>o instanceof x),dr=new WeakMap,pn=new WeakMap,ur=new WeakMap,ln=new WeakMap,mn=new WeakMap,_n={get(o,a,x){let f=r,d={plnSq:function(h,_,v){return h(_,v)}};if(e.psmTI(o,IDBTransaction)){if(e.HXYZB(a,f(1712)))return pn[f(1054)](o);if(e.HXYZB(a,f(831)+"oreNames"))if(e[f(508)](e[f(540)],e.BgPoa)){let h=d.plnSq(_0x33adff,_0x381274,_0x50e92f[f(1080)]);_0x1e2185[f(1288)][f(851)](_0x55d653,h)}else return o[f(831)+f(1589)]||ur.get(o);if(e[f(1461)](a,e.lHHvI))return x[f(831)+"oreNames"][1]?void 0:x[f(831)+f(604)](x[f(831)+f(1589)][0])}return e[f(885)](Ee,o[a])},set(o,a,x){return o[a]=x,!0},has(o,a){let x=r;return e[x(1063)](o,IDBTransaction)&&(e.krsYt(a,e[x(625)])||e[x(1285)](a,e[x(1221)]))?!0:e[x(627)](a,o)}},Pt=o=>mn[r(1054)](o)}}),oi={};lx(oi,{deleteDB:()=>Sx,openDB:()=>bx,unwrap:()=>Pt,wrap:()=>Ee});function bx(r,e,{blocked:o,upgrade:a,blocking:x,terminated:f}={}){let d=E,h={bAuXq:function(b,y,A,L,T){return b(y,A,L,T)},spsuz:function(b,y){return b(y)},EZEKR:function(b,y){return b||y},fwtOg:"close",yNeCT:"versionchange",ZYqLp:function(b,y){return b===y},vvcwY:d(1017),kvTSm:"upgradeneeded",ygKex:d(1516)},_=indexedDB[d(374)](r,e),v=h.spsuz(Ee,_);if(a)if(h[d(1479)](h[d(1356)],"JYqKg"))_[d(1498)+d(1087)](h.kvTSm,b=>{let y=d;h.bAuXq(a,h[y(1161)](Ee,_[y(364)]),b.oldVersion,b[y(1484)+"on"],h[y(1161)](Ee,_["transact"+y(1535)]))});else{let b=this[d(1682)][d(1182)](this[d(317)]);return _0x40e685[d(1361)](h[d(934)](b,"{}"))[_0x1e9ffc]}return o&&_[d(1498)+d(1087)](h[d(413)],()=>o()),v[d(1471)](b=>{let y=d;f&&b[y(1498)+y(1087)](h[y(416)],()=>f()),x&&b[y(1498)+y(1087)](h[y(442)],()=>x())})[d(282)](()=>{}),v}function Sx(r,{blocked:e}={}){let o=E,a={vqUdk:function(f,d){return f(d)}},x=indexedDB["deleteDa"+o(525)](r);return e&&x[o(1498)+"Listener"](o(1516),()=>e()),a[o(648)](Ee,x)[o(1471)](()=>{})}function ni(r,e){let o=E,a={BHzfH:o(1127)+"e",vjlLh:"readonly",TEgPZ:function(_,v){return _ instanceof v},JqPTD:function(_,v){return _ in v},ypodt:function(_,v){return _===v},xDwES:o(500),vJehS:function(_,v){return _!==v},AUbFL:function(_,v){return _ in v}};if(!(a[o(1570)](r,IDBDatabase)&&!a[o(1688)](e,r)&&a[o(377)](typeof e,a.xDwES)))return;if(hn[o(1054)](e))return hn[o(1054)](e);let x=e[o(394)](/FromIndex$/,""),f=a[o(1094)](e,x),d=xi.includes(x);if(!a[o(812)](x,(f?IDBIndex:IDBObjectStore).prototype)||!(d||ai[o(352)](x)))return;let h=async function(_,...v){let b=o,y=this[b(499)+b(1535)](_,d?a[b(1751)]:a.vjlLh),A=y[b(1549)];return f&&(A=A[b(671)](v[b(1732)]())),(await Promise[b(1308)]([A[x](...v),d&&y[b(1712)]]))[0]};return hn[o(851)](e,h),h}var ai,xi,hn,Ex=si({"node_modules/idb/build/index.js"(){let r=E,e={kXZmt:function(o){return o()},MCytJ:function(o){return o()},ZFlcV:r(549),HsaCc:r(280),PicDr:r(1678)+"ys",huPJM:r(1442),ZYuoE:"add",pkLed:r(1145),XMple:r(813),IjjKR:function(o,a){return o(a)}};e[r(1454)](ti),e.MCytJ(ti),ai=[r(1054),e[r(1502)],e[r(279)],e[r(1511)],"count"],xi=[e[r(1274)],e[r(391)],e.pkLed,e[r(859)]],hn=new Map,e[r(1746)](_x,o=>({...o,get:(a,x,f)=>ni(a,x)||o[r(1054)](a,x,f),has:(a,x)=>!!ni(a,x)||o.has(a,x)}))}}),Cx={idb:function(r){let e=E;r[e(891)]=Promise[e(1183)]().then(()=>(Ex(),oi))[e(1471)](function(o){return o})}},ri={};function Se(r){let e=E,o={Lbkst:function(f,d){return f!==d}};var a=ri[r];if(o.Lbkst(void 0,a))return a[e(891)];var x=ri[r]={exports:{}};return Cx[r](x,x[e(891)],Se),x.exports}Se.d=(r,e)=>{let o=k;for(var a in e)Se.o(e,a)&&!Se.o(r,a)&&Object["definePr"+o(877)](r,a,{enumerable:!0,get:e[a]})},(()=>{let r=E;Se.o=(e,o)=>Object.prototype["hasOwnPr"+r(877)].call(e,o)})(),(()=>{let r=E,e={oLeFK:function(o,a){return o!=a},fsRXV:r(925),cBAjc:r(1354)+"le"};Se.r=o=>{let a=r;e.oLeFK("undefined",typeof Symbol)&&Symbol[a(978)+"Tag"]&&Object["definePr"+a(877)](o,Symbol["toString"+a(1741)],{value:e.fsRXV}),Object.defineProperty(o,e[a(1650)],{value:!0})}})();var J={};(()=>{let r=E,e={HrFhT:function(s,t){return s!=t},JpEiS:r(1236)+"d",bFXvz:r(1354)+"le",kIBWT:function(s,t){return s===t},FhLNL:"JYTGF",vdGiz:function(s,t){return s(t)},CpKpv:function(s,t){return s+t},bntIA:function(s,t){return s+t},DPDZN:function(s,t){return s+t},RNsYk:function(s,t){return s+t},TtLJC:function(s,t){return s*t},Dfvub:function(s,t){return s+t},vhrLV:function(s,t){return s+t},KTZPA:r(775),ArPbq:r(554),MyLMx:function(s,t){return s(t)},fffIC:function(s,t){return s(t)},HQxQE:function(s,t){return s===t},omjtw:function(s,t){return s>>>t},tqSni:function(s,t){return s<<t},LxKTw:function(s,t){return s|t},Oytwm:function(s,t){return s|t},cwoEi:function(s,t){return s>t},zyzWu:function(s,t){return s<t},HfZRV:function(s,t){return s>t},PfpOI:r(697),GSgXY:function(s,t){return s-t},TAQNB:function(s,t){return s!==t},ckzMX:function(s,t){return s<t},zweRQ:function(s,t){return s-t},Glroz:r(1474),ICaIC:function(s,t,n){return s(t,n)},kTrOk:function(s,t){return s!==t},PDTqo:function(s,t){return s(t)},CHYSe:function(s,t,n){return s(t,n)},WVEcF:function(s,t){return s&t},Thdaa:function(s,t){return s===t},bPDRB:"Missing "+r(1492)+r(330)+r(1119),tBJAy:function(s){return s()},MxwHn:function(s,t,n){return s(t,n)},Jlgyc:function(s,t){return s!==t},IyqPC:function(s,t,n){return s(t,n)},Nurzd:function(s,t){return s!==t},ZypBV:function(s,t,n){return s(t,n)},EcFER:function(s,t){return s(t)},xYCKS:function(s,t){return s!==t},wfIeP:function(s,t,n){return s(t,n)},jpZjV:function(s){return s()},RSofe:function(s,t,n){return s(t,n)},aEDLj:function(s,t,n){return s(t,n)},EtZyH:function(s,t){return s!==t},FcEkT:function(s,t,n){return s(t,n)},EsjGH:function(s,t){return s!==t},voXzv:function(s,t,n){return s(t,n)},odMRE:function(s,t,n){return s(t,n)},qFSfD:function(s,t,n){return s(t,n)},wbJhA:function(s,t){return s!==t},rIGiU:function(s,t){return s(t)},TICPc:function(s,t){return s&t},qWhHV:function(s,t){return s!==t},EvnuY:r(948),XANDk:r(1613),sWIwt:function(s,t){return s(t)},BGzLs:function(s,t){return s>>>t},QKrJw:function(s,t,n){return s(t,n)},VQmTz:function(s,t){return s(t)},ohcmt:function(s,t){return s(t)},QvEqz:function(s,t,n){return s(t,n)},bMJnG:function(s,t){return s(t)},jSUPx:function(s,t,n){return s(t,n)},hgxbj:function(s,t){return s&t},VjYUT:function(s,t){return s===t},vpwaF:r(1193)+r(1492)+r(330)+r(767),VRmkX:r(1193)+r(1492)+" field: "+r(488),JLAfv:"Missing required"+r(330)+"method",KqvQm:function(s,t){return s+t},FfRZJ:function(s,t){return s(t)},Ledsy:function(s,t,n){return s(t,n)},BClLk:function(s,t,n){return s(t,n)},BrAVF:r(1545)+r(308)+r(1435),VAAAV:function(s,t){return s>>t},mspDe:function(s,t){return s>=t},qHYkx:function(s,t){return s>t},SCZiB:function(s,t){return s+t},nyvru:"ZPHBX",XSasJ:function(s,t){return s===t},eQZZs:r(611)+"t limit",cJPqR:function(s,t){return s>=t},DlZRk:function(s,t){return s<t},cYjjC:function(s,t){return s<<t},zmoOX:r(1058),yDsJQ:function(s,t){return s+t},ywyfl:function(s,t){return s>t},cGwTx:r(1048),nFEoA:function(s,t){return s+t},GoOPR:"Read pas"+r(1466),Cwrjn:function(s,t){return s instanceof t},pRija:function(s,t,n){return s(t,n)},sXkMc:function(s,t){return s+t},cMOve:function(s,t){return s&t},axIdW:function(s,t){return s>=t},jxisA:function(s,t){return s+t},KifZC:function(s,t){return s+t},uIuof:function(s,t){return s!==t},OSbto:function(s,t){return s&t},piKQG:function(s,t){return s<t},TDJex:function(s,t){return s(t)},hIeCw:function(s,t){return s+t},iWqxp:function(s,t){return s!==t},vDVbt:function(s,t){return s&t},zLETd:function(s,t){return s<<t},DgjQl:function(s,t){return s<<t},vyDii:function(s,t){return s&t},DbAZb:function(s,t){return s<<t},fHvaX:function(s,t){return s>=t},gWMGH:function(s,t){return s<=t},hGZpA:"ddKgP",HEDCX:function(s,t){return s+t},RUGMi:function(s,t){return s+t},WZiTI:function(s,t){return s&t},zNAbm:function(s,t){return s<<t},PXEGL:function(s,t){return s|t},oDpKI:function(s,t){return s|t},LJKAz:function(s,t){return s|t},hsTmQ:function(s,t){return s&t},qAifr:function(s,t){return s&t},VhMBc:function(s,t){return s<t},KByjJ:r(1531),QmiZK:r(617),fAmSL:function(s,t,n){return s(t,n)},VeRFV:function(s,t){return s>>t},gwjQd:function(s,t){return s+t},dvNQz:function(s,t){return s&t},xuTbW:function(s,t){return s||t},zQOdQ:function(s,t){return s+t},madIH:function(s,t){return s|t},ZgJDX:function(s,t){return s===t},yuuKp:r(677),XgrxF:function(s,t){return s>=t},eMyFJ:function(s,t){return s-t},cGDRw:function(s,t){return s+t},QpduD:function(s,t){return s<<t},GCUNf:function(s,t){return s>=t},ZRhUC:function(s,t){return s<=t},BGoju:function(s,t){return s<t},LkYhf:function(s,t){return s+t},teWDX:function(s,t){return s<t},XnhKX:function(s,t){return s|t},FXDUz:function(s,t){return s<t},KKzTs:function(s,t){return s|t},vxiJc:function(s,t){return s&t},doXEu:function(s,t){return s>>t},ANBqK:"Buiio",LMDCL:function(s,t){return s|t},dXnlx:function(s,t){return s>>t},gEvRQ:function(s,t){return s|t},cFmiJ:function(s,t){return s>>t},Dzszn:function(s,t){return s&t},OZsoo:function(s,t){return s|t},jJrii:function(s,t){return s<t},JSJnZ:function(s,t){return s+t},pMSlE:r(1269),hFPiN:function(s,t,n){return s(t,n)},kEbJS:function(s,t){return s(t)},QHYEL:function(s,t){return s<<t},EVWsO:function(s,t){return s&t},VVmiP:function(s,t){return s>=t},GwVtO:function(s,t){return s|t},Pbcfs:function(s,t,n){return s(t,n)},yodoS:function(s,t){return s&t},jAIQV:function(s,t){return s&t},PwwWB:function(s,t){return s&t},HuiEJ:function(s,t){return s<<t},QTEfR:function(s,t){return s(t)},RFqtO:function(s,t){return s&t},IOMGJ:function(s,t){return s&t},tGIbt:function(s,t){return s<<t},buODV:function(s,t){return s&t},PcPZm:function(s,t){return s&t},ZQHVs:r(1086),dnPes:function(s,t){return s|t},uSiXR:function(s,t){return s<<t},qWyrN:function(s,t){return s>>>t},vNEHc:function(s,t){return s|t},PnkrS:function(s,t){return s>>>t},JgBjX:function(s,t){return s<t},GPVaG:function(s,t){return s<t},WtwRa:function(s,t,n){return s(t,n)},AwvvT:function(s,t){return s+t},bSRHk:function(s,t){return s>>>t},mDXPN:function(s,t){return s+t},oKEYW:function(s,t){return s!==t},mAjdE:function(s,t){return s>>>t},sxtdU:function(s,t){return s!==t},hKuin:function(s,t){return s>>>t},noDNJ:function(s,t){return s&t},CDtIz:function(s,t){return s+t},waReq:function(s,t){return s>>>t},NdVTb:function(s,t){return s>>>t},FzZGj:function(s,t){return s+t},XeAVT:function(s,t){return s&t},vSKNs:function(s,t){return s!==t},bGzkf:function(s,t){return s>>>t},HtZbw:function(s,t){return s&t},Smndt:function(s,t){return s+t},nDNua:function(s,t){return s!==t},vdgyV:function(s,t){return s!==t},FcGfV:function(s,t){return s|t},cuRfo:function(s,t){return s&t},uZESv:function(s,t){return s!==t},OhWPo:function(s,t){return s|t},SeruD:function(s,t){return s|t},GlPUE:r(526),jxkMh:function(s,t){return s===t},GBCSQ:r(1712),ljwmS:function(s,t){return s===t},atdmv:"store",vZfgE:r(565),gZCMO:function(s,t){return s|t},NlrDD:function(s,t){return s|t},HOjOQ:function(s,t){return s|t},nafrv:function(s,t){return s<<t},SXlVG:function(s,t){return s|t},uuTnm:function(s,t){return s|t},vFThA:function(s,t){return s<<t},bBqOZ:function(s,t){return s>>>t},EEhAd:function(s,t){return s>>>t},KWMPc:function(s,t){return s>>>t},vHUfn:function(s,t){return s&t},ZLbiC:function(s,t){return s>>>t},qRZpG:r(975),hENot:function(s,t){return s<<t},WYgZB:function(s,t){return s|t},auagC:function(s,t){return s|t},ZkMHe:function(s,t){return s===t},BszwI:function(s,t){return s>>>t},YrNGA:function(s,t){return s|t},EECmK:function(s,t){return s|t},xjBZC:function(s,t){return s|t},cSznb:function(s,t){return s|t},LgZXP:function(s,t){return s<<t},XAWNT:"QxnPU",yMkoV:function(s,t){return s&t},CUuqb:function(s,t){return s&t},XZADt:function(s,t){return s&t},oaoDI:function(s,t){return s>>>t},wOHAr:function(s,t){return s<=t},plbxv:function(s,t){return s%t},DpOBn:function(s,t){return s+t},JQbBi:function(s,t){return s>>>t},zzqgf:function(s,t){return s*t},DZXXp:function(s,t){return s===t},FruMm:function(s,t){return s===t},WSGMl:function(s,t){return s&t},kxjSh:function(s,t){return s&t},TRgVy:function(s,t){return s>>>t},pYMqT:function(s,t){return s&t},sxMEr:function(s,t){return s+t},XrrJO:function(s,t){return s>>>t},wTPKw:function(s,t){return s|t},ZfUuN:function(s,t){return s|t},vbJpa:function(s,t){return s<<t},gVJzc:function(s,t){return s!==t},qXnug:function(s,t){return s>>>t},fUqtt:function(s,t){return s>>>t},RFteU:function(s,t){return s+t},oOwKW:function(s,t){return s===t},OQzuu:r(486),bKRad:function(s,t){return s&t},WeLWY:function(s,t){return s>>>t},MxWcA:function(s,t){return s>>>t},yHtKW:function(s,t){return s>>>t},qXAfy:function(s,t){return s&t},uLPeR:function(s,t){return s>>>t},HuWtl:function(s,t){return s&t},QXtTI:function(s,t){return s>>>t},zvWYK:function(s,t){return s>>>t},qGRJz:function(s,t){return s>>>t},wpfqm:function(s,t){return s&t},MXlFX:r(287)+"OR",TeFOH:r(369)+"IES_ERROR",ZhAUB:r(1668)+r(1553),DgIOI:r(970)+r(466),HHUny:r(1051)+"ERROR",ZmFdx:r(566),oKjHq:r(310)+"e_timeout",GRxWl:r(310)+"e_success",yyZnJ:"Zfnoc",sJtJw:r(1543),ZxaCq:r(574)+r(1600),zqtXj:function(s,t){return s&t},YREGo:function(s,t){return s&t},hghlQ:function(s,t){return s&t},ozwDc:function(s,t){return s===t},lXBnC:"iRrsA",eYITJ:r(962)+"1",xKkBm:"error",XHPCr:function(s,t){return s!==t},uRLfR:r(1462),CiToK:function(s,t){return s===t},Wdklm:r(1380),IuEjz:"zpJEQ",cSuzp:function(s,t){return s>=t},HECSW:function(s,t){return s-t},kAVLA:function(s,t){return s===t},aXchs:function(s,t){return s(t)},ZNCGo:r(382),TUpYy:"oiaJT",FwvaB:r(900),cMKnP:function(s,t){return s+t},yikru:"pZmMA",lmLRi:function(s,t){return s<t},dqniV:r(1433),KyDwT:r(1634)+"or",LeNaR:r(440),Cgwfl:function(s,t,n){return s(t,n)},ytTYF:"close",fwFQD:r(1179),XPquY:r(374),zdtgh:function(s,t,n){return s(t,n)},GAHxA:function(s,t){return s!==t},gAafc:function(s,t,n){return s(t,n)},YlQkQ:function(s,t,n){return s(t,n)},WwCbI:function(s,t){return s===t},JczbX:r(1692),kffJc:function(s,t){return s+t},ixcCJ:function(s,t){return s+t},vWxqi:function(s,t){return s+t},JzYmZ:function(s,t){return s<<t},MGtOl:function(s,t){return s|t},mnoYp:function(s,t){return s&t},jejyM:function(s,t){return s&t},VcczR:function(s,t){return s&t},KOUEP:function(s,t){return s<t},smquA:function(s,t,n){return s(t,n)},uynuh:function(s,t){return s+t},CLTZS:function(s,t){return s&t},QOAPM:function(s,t){return s===t},LlPHb:r(1752),MUOod:"cursor_name",MbDBF:function(s,t){return s===t},aoKlG:r(1318),gHpsh:function(s,t){return s||t},HLbPV:function(s,t){return s||t},dJMVF:r(1430)+"3",kwMth:function(s,t){return s||t},ZyfMy:function(s,t){return s&t},cktXo:function(s,t){return s>>>t},TTEED:function(s,t){return s&t},wZhqe:function(s,t){return s&t},QlsIo:function(s,t){return s>>>t},VZqVu:function(s,t){return s&t},PErbw:function(s,t){return s>>>t},istVX:"lRVJu",pNYPI:function(s,t){return s<t},WaUtZ:function(s,t){return s&t},KiGbf:function(s,t){return s&t},ZmjLZ:function(s,t){return s+t},rJdkn:function(s,t){return s<t},GlNTb:function(s,t){return s-t},iGlpR:function(s,t){return s<=t},ANOiQ:function(s,t){return s<t},LBwVm:function(s,t){return s|t},kboYY:function(s,t){return s<<t},lgbky:function(s,t){return s&t},KtlEF:function(s,t){return s>=t},FGunC:function(s,t){return s<<t},oTldr:function(s,t){return s&t},BqhhS:function(s,t){return s<<t},BXzZM:function(s,t){return s-t},WpHoq:function(s,t){return s<<t},uaDAp:function(s,t){return s&t},kruvm:function(s,t){return s&t},zNLGO:function(s,t){return s>>t},tYsmM:"string",Woazq:function(s,t){return s instanceof t},DXsIi:function(s,t){return s!=t},DnEbd:function(s,t){return s==t},TrCcN:r(551)+"in;chars"+r(290),DuSak:function(s,t){return s<t},kSmzg:r(1070),HQuCo:r(1426),qKMgy:function(s,t){return s===t},jJVOd:function(s,t){return s&t},BdcIW:function(s,t){return s+t},NvcYG:function(s,t){return s|t},mmSHf:function(s,t){return s>>t},dSKJp:function(s,t){return s|t},dvFgl:function(s,t){return s>>t},OYMXE:function(s,t){return s&t},IjjRW:function(s,t){return s>>t},JBaNy:function(s,t){return s|t},Cyqur:function(s,t){return s&t},dksDr:function(s,t){return s>>t},VRVgG:function(s,t){return s|t},IrJdg:function(s,t){return s-t},ySowg:function(s,t){return s(t)},FKzjL:function(s,t,n,i){return s(t,n,i)},jOtIU:function(s,t){return s instanceof t},XSYOM:function(s,t){return s instanceof t},QLRpn:r(1754)+r(686),oSFqx:function(s,t){return s==t},nCbst:r(311),hGJKr:r(372),QyqVc:function(s,t){return s>=t},cbkgp:"unknown reason",UOOhS:r(1567)+r(1037),zNXSz:"http",dylCS:r(952)+"ack=frontierJSONP",NHtjT:"NcHsu",SULLm:r(528),woaSt:"idb",HVcyg:r(1438),rYAOx:function(s,t){return s===t},WaebR:r(1088),hXWTa:function(s,t){return s+t},AWOkf:function(s,t){return s-t},KJpFP:function(s,t){return s|t},SJVCL:function(s,t){return s>>t},vEhhV:function(s,t){return s>>t},ztbDS:function(s,t){return s===t},bXuRc:r(502),hNWWa:r(515),oLPBr:function(s,t){return s||t},WFEtf:function(s,t){return s(t)},WKeTn:function(s,t){return s===t},nQKeM:function(s,t){return s||t},NEgOK:function(s,t){return s<t},qeKIo:function(s,t){return s===t},oVrbr:r(1728),BIUdQ:function(s,t){return s&t},rAHKY:function(s,t){return s&t},uwhrp:function(s,t){return s+t},nTAMu:function(s,t){return s>>t},WmcTE:r(1115),NDGXz:r(1514),vmZHz:function(s,t){return s||t},roqBi:function(s,t){return s||t},xXhXF:r(804),Hqhxy:r(821),VtKhN:function(s,t){return s||t},vSXYL:"init QoS"+r(1363)+"d",WcpbO:function(s,t){return s===t},jLeqT:r(1220),PsYkX:r(1691),PiZns:r(771),fneHi:function(s,t,n){return s(t,n)},jlugW:function(s,t){return s!==t},uqlvH:"OqjHZ",elmss:function(s,t){return s===t},dzpQC:r(1756),zSevG:function(s,t,n,i){return s(t,n,i)},VxIOA:function(s,t,n,i){return s(t,n,i)},aoOKh:r(1414)+r(660)+"ck",wbpZA:"x_frontier_is_ack",mvvWx:r(1414)+r(999)+r(1689),CEPyf:r(1791),WlHKf:r(281),tziCi:"is_ack",CdwwL:r(358),RCdoF:r(1769),yTUpD:function(s,t){return s(t)},pMPRO:function(s,t){return s instanceof t},vUvJk:"none_none",ulgte:r(1328),uxAtq:function(s,t){return s+t},fprjb:function(s,t){return s(t)},SDFOV:function(s,t){return s&t},eVAGk:function(s,t){return s+t},apDxO:function(s,t){return s|t},qhRYG:function(s,t){return s>>t},ArMgB:function(s,t){return s===t},lGSHZ:"DZKkw",lVPQg:function(s,t){return s+t},QMtuo:function(s,t){return s+t},mdoNZ:function(s,t){return s+t},VhTBU:r(523)+"t of range: ",VdELB:r(299),CZTxR:function(s,t){return s||t},OVJWb:r(568),CgWYO:r(1101)+"too large",zREAs:function(s,t){return s>=t},RqZCA:function(s,t){return s&t},IGayd:function(s,t,n,i){return s(t,n,i)},YYoYX:function(s,t){return s+t},itZfT:function(s,t){return s<t},aXRoo:function(s,t){return s<<t},XeZuk:function(s,t){return s<t},kRcks:function(s,t,n,i){return s(t,n,i)},HeYCU:function(s,t){return s+t},mdEJi:function(s,t){return s|t},lDJOf:function(s,t){return s<<t},ttNje:function(s,t){return s+t},HXwWR:function(s,t){return s+t},WLmGg:function(s,t){return s<<t},WQQWs:function(s,t){return s+t},zXMWR:function(s,t){return s+t},CLsic:r(1576),waflU:"rPvrN",ozMBV:r(1374),FeGve:function(s,t){return s+t},gHDjs:function(s,t){return s&t},dYdbg:function(s,t){return s+t},kXggA:function(s,t){return s&t},IPpDy:function(s,t){return s+t},EfHLC:function(s,t){return s&t},rwgWM:function(s,t){return s+t},VelIq:function(s,t){return s&t},FgOeV:function(s,t){return s+t},YhPSe:r(1515)+"|5|4|1|1"+r(1206)+"2",frcsW:function(s,t){return s>>>t},ptQaL:function(s,t){return s|t},DjMbx:function(s,t){return s<<t},OuoCQ:function(s,t){return s|t},dbNBu:function(s,t){return s<t},MVqei:function(s,t){return s|t},rBXci:function(s,t){return s&t},hClFd:function(s,t){return s|t},oBnPL:function(s,t){return s>>>t},VDjvr:function(s,t){return s|t},YTgKu:r(1214),EthUQ:"service",DCqed:function(s,t,n,i){return s(t,n,i)},RppUD:r(793)+"name",GcGXb:function(s,t,n,i){return s(t,n,i)},KddpW:function(s,t,n,i){return s(t,n,i)},feKro:r(1090),WwYec:function(s,t){return s(t)},BdLeN:r(1165)+r(888),XAeKc:r(1556),VLxIu:function(s,t){return s===t},XXRZI:r(1032),oSwPL:"DHlIn",Tzikt:function(s,t,n){return s(t,n)},DGcwK:function(s,t,n){return s(t,n)},jsWuF:function(s,t,n){return s(t,n)},IalGb:r(454)+r(1478),OrVyt:"ALL",nYUtA:r(856),vlhnG:function(s,t,n,i){return s(t,n,i)},uzyEm:function(s){return s()},RbFqm:function(s,t){return s(t)},WGwCI:r(475)+"r",Ctbnp:function(s,t,n){return s(t,n)},FWUcw:r(1414)+r(490),kXqEN:function(s,t,n,i){return s(t,n,i)},XHFDv:"x-msg-qos",SbBFV:function(s,t,n){return s(t,n)},LQDBU:"x-msg-cu"+r(426)+"e",CGSLV:function(s,t){return s(t)},VRgcw:"x-msg-cu"+r(1108)+"ue",UrxWA:function(s){return s()},CMQvt:function(s){return s()},iQHhB:function(s,t){return s<t},OYolr:function(s){return s()},ZBwAU:function(s){return s()},dmUFN:function(s,t){return s===t},SPMcQ:"uuKWF",FXMjq:function(s,t){return s&&t},QOqVn:function(s){return s()},FOMgf:function(s,t){return s!==t},ROpuG:function(s){return s()},qwikY:function(s,t){return s<t},vLyJb:function(s,t,n){return s(t,n)},IXUIL:function(s){return s()},zwwhu:function(s,t){return s===t},TtCJP:"always",rJfnZ:function(s,t,n,i){return s(t,n,i)},HnVXL:r(1114),pacyh:function(s,t){return s!==t},TwQEe:r(563),bZugS:r(753),ZTrBB:function(s,t){return s!==t},wgnXu:r(1766)+r(724),fsiuP:function(s,t){return s/t},LEnkX:r(436),RiCaB:function(s,t){return s==t},GRoMX:r(853)+r(605)+r(945),SIMBv:r(853)+r(1554)+r(1618)+", WebSoc"+r(968)+r(520)+"is undef"+r(1703),TKcWG:r(1737)+"t",EgLBA:r(864)+r(1343)+r(672)+"ct",kHmAQ:r(1735),udRuv:r(1066),nhybm:"pagehide",edenR:r(1593),ahYZy:function(s,t){return s!==t},ktmgy:r(273),vwVFd:r(1184),yiEhF:r(920),CYfDq:r(1336),HFvBD:r(1500)+"d",ZBKUG:function(s,t){return s||t},VttpM:r(853)+r(829)+"ddID, de"+r(1412)+"r ttwID",OMyvj:r(967),IQpBE:function(s,t,n){return s(t,n)},XTnDq:r(300),CJBKu:r(1258)+"0",IYmwu:"CfPRQ",dcvop:function(s,t,n){return s(t,n)},IrBjq:r(869),afmzt:function(s,t,n){return s(t,n)},xXDTn:function(s,t,n){return s(t,n)},qjBhx:function(s,t){return s===t},njKNH:r(590),kOgMk:function(s,t){return s(t)},OFrZF:"WtIJk",pRgyt:function(s,t){return s(t)},MEthH:function(s,t){return s(t)},iIzSm:"FRONTIER>",Lqlch:"TGTIt",PDNCf:r(698),ForOO:function(s,t){return s!==t},qFtEp:r(691),Mgkxi:r(788),XlwgJ:function(s,t,n){return s(t,n)},LjYiY:r(1458)+r(384)+r(1737)+r(1586)+r(633),ozncj:function(s,t,n){return s(t,n)},Dpldp:"timeout,"+r(1192)+"onnecting",FmcMu:r(956),adMiC:function(s,t){return s!==t},snNSb:r(965),fRamT:r(1620)+"2",iycPf:function(s,t,n){return s(t,n)},tqLPG:function(s,t){return s(t)},inyEd:function(s,t){return s===t},NFFtL:r(1273),AzgDL:"oidWh",KeoJN:function(s,t,n){return s(t,n)},IZSIC:function(s,t,n){return s(t,n)},VDauh:r(1595),XEWHY:r(1458)+"ay, netw"+r(1301)+r(841),iCZCI:r(769),EYzbW:"ack",lHKQr:function(s,t){return s&t},Vyzry:function(s,t){return s(t)},trMDB:function(s,t){return s&t},sRrCK:function(s,t){return s!==t},tgxxy:r(1091),dkifU:function(s,t){return s(t)},fKBks:function(s,t){return s+t},VRWCB:function(s,t){return s+t},cidUl:"GANof",dLPIa:function(s,t){return s+t},IyFqu:r(991)+r(861)+r(309)+"nitialized",zhyPs:function(s,t){return s===t},ufgLU:r(991)+r(1297)+r(1069),cLzbI:function(s,t){return s==t},vBGjq:function(s,t){return s instanceof t},fSMut:"please p"+r(947)+" valid s"+r(558),bpbBB:function(s,t){return s instanceof t},MvMze:function(s,t){return s instanceof t},tJhck:function(s,t){return s(t)},KjiYK:function(s,t){return s<t},XoDnl:"enqueue",TtgPi:r(1295),UJaEQ:function(s,t){return s||t},RNAot:function(s,t){return s!==t},zPzYD:"manual r"+r(550)+r(1540),fXfmG:"blocked",vRYnt:function(s,t){return s!==t},iKGKP:r(1496),YXYUg:r(1299),PfMFx:function(s,t){return s/t},LtSLG:r(1655),IPYMc:function(s,t){return s===t},NepWD:r(607),PHiIN:"Dedicate"+r(1727)+r(1552)+"pe",lHfAk:function(s,t){return s!=t},QMGgV:function(s,t){return s===t},nVKnN:r(957)+r(1347)+r(497),QAsgx:function(s,t){return s===t},ElwmU:r(1588)+"orkerGlo"+r(1399),MvWAt:function(s,t){return s!=t},kSTxb:function(s,t){return s!=t},liGkF:r(1201)+"qos__"};Se.r(J),Se.d(J,{FWS:()=>O0,CustomErrorEvent:()=>es,createCloseEvent:()=>le,ReconnectEvent:()=>Qr,createErrorEvent:()=>oe,decodedFrame:()=>Vr,createOpenEvent:()=>os,CustomCloseEvent:()=>ts,createReconnectEvent:()=>Jn,FrontierMessageEvent:()=>rs,encodeFrame:()=>Wn,createMessageEvent:()=>is,OpenEvent:()=>ss,ErrorCode:()=>Me,Event:()=>nt,MessageEvent:()=>ns});let o="";function a(s=""){let t=r,n={ltIMa:function(i,c){return e[k(688)](i,c)},CVNKn:e[t(854)],coraR:t(925),bLoBC:e[t(659)]};if(e.kIBWT(e[t(1291)],e.FhLNL)){let c=""+Date.now(),l=o||(o=e[t(430)](_,s)),g=Math.random()[t(978)](16)[t(949)](-6);return e[t(1357)](e[t(432)](e[t(1697)]("02",c),l),g)}else{let i={Tnsuk:function(c,l){let g=t;return czuNSD[g(626)](c,l)},qXIjJ:czuNSD[t(1262)],ruGNk:czuNSD.coraR,SYeAs:czuNSD[t(1276)]};_0x26a604.r=c=>{let l=t;i[l(518)](i[l(1617)],typeof _0x47fda4)&&_0x45adf3["toString"+l(1741)]&&_0x2d4121[l(363)+"operty"](c,_0x722495[l(978)+"Tag"],{value:i[l(1005)]}),_0x69a074["definePr"+l(877)](c,i[l(376)],{value:!0})}}}function x(){let s=r;return e.RNsYk(e[s(632)](1e4,Date[s(1719)]()),Math[s(1233)](e.TtLJC(1e4,Math[s(1742)]())))}function f(s){let t=r;return e[t(414)](e.vdGiz(Array,8)[t(868)]("0"),parseInt(s,10).toString(2)).slice(-8)}function d(s){let t=r;return e[t(1697)](Array(4)[t(868)]("0"),parseInt(s,2).toString(16)).slice(-4)}function h(s){let t=r,n=s.split(/\./)[t(1349)](l=>f(l)),i=[];return i[0]=e[t(430)](d,e[t(740)](n[0],n[1])),i[1]=e[t(430)](d,e.vhrLV(n[2],n[3])),[e[t(1377)],e[t(1377)],t(775),e[t(1377)],e[t(1377)],e[t(1786)],i[0],i[1]][t(868)]("")}function _(s){let t=r,n=/(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}/[t(456)](s),i=/(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))/.test(s);return n?e.MyLMx(h,s):i?e[t(1459)](v,s):t(577)+"00000000"+t(577)+t(577)}function v(s){let t=r,n={uDNhp:function(m,w){return e[k(1418)](m,w)},kJgTO:function(m,w){return e[k(1607)](m,w)},zRJki:function(m,w){return m|w},OmzGU:function(m,w){return e.tqSni(m,w)},lmsjT:function(m,w){return m>>>w},Cbtrs:function(m,w){return m|w},DjSxm:function(m,w){return e.LxKTw(m,w)},WBOqS:function(m,w){return e[k(867)](m,w)},jZWTP:function(m,w){return m<<w}},i="",c=[],l=0,g=0,p=!0,u="0000";if(e[t(1772)](s.indexOf("::"),-1)){let m=s[t(862)]("::");for(let S=0;e[t(1240)](S,m[t(1080)]);S++){let D=m[S];if(e[t(407)](D[t(1081)](":"),0)){let N=D[t(862)](":");p&&(l=N[t(1080)]),g+=N[t(1080)];for(let I=0;e[t(1240)](I,N[t(1080)]);I++)if(N[I][t(1080)]!==4)if(e[t(1418)](e.PfpOI,t(697))){let ae=u[t(1409)+"g"](0,e[t(296)](4,N[I][t(1080)])),ve=ae[t(1365)](N[I]);c[t(1290)](ve)}else return n[t(860)](_0x43ad5d,_0x1072b0)?_0x76fe71:new _0x480b4b(n[t(1137)](n[t(1315)](_0x3a8e9b[t(1092)](_0x2fa50d,0)|n[t(725)](_0x316faf[t(1092)](_0x53ed2b,1),8)|_0xfde58c.call(_0x370e22,2)<<16,_0x18a6b1[t(1092)](_0x5c2fe1,3)<<24),0),n[t(613)](n[t(600)](n[t(1427)](n[t(572)](_0x3800a0[t(1092)](_0x5c8ce1,4),n.OmzGU(_0x25652d.call(_0x1b22db,5),8)),n[t(725)](_0x4309c8[t(1092)](_0x5875d6,6),16)),n[t(485)](_0x50a397[t(1092)](_0xc753c2,7),24)),0),!0);else c[t(1290)](N[I]);p=!1}else{if(e.TAQNB(4,D[t(1080)])){let N=u[t(1409)+"g"](0,4-D[t(1080)]),I=N[t(1365)](D);c[t(1290)](I)}else c[t(1290)](D);p&&(l+=1),g+=1,p=!1}}let w="";for(let S=0;e[t(1240)](S,e[t(296)](8,g));S++)w=w[t(1365)](u);for(let S=0;e[t(1240)](S,c[t(1080)]);S++)e[t(1418)](S,l)&&(i=i.concat(w)),i=i[t(1365)](c[S]);return i}{let m=s[t(862)](":");for(let w=0;e[t(328)](w,m[t(1080)]);w++){let S=m[w];if(e[t(1282)](4,m[w].length)){let D=u[t(1409)+"g"](0,e[t(431)](4,m[w][t(1080)])),N=D[t(1365)](S);i=i[t(1365)](N)}else i=i.concat(S)}return i}}function b(s,t){let n=r;if(e[n(1418)](n(668),e[n(901)]))return this[n(1661)].protocol;{let i=s.key;e[n(1282)](void 0,i)&&(e[n(1667)](q,t,10),we(t,i));let c=s.value;e[n(362)](void 0,c)&&(e[n(1667)](q,t,18),e[n(1667)](we,t,c))}}function y(s){let t=r,n={};e:for(;!me(s);){let i=e[t(1368)](V,s);switch(e[t(1607)](i,3)){case 0:break e;case 1:n.key=e[t(1667)](_e,s,e[t(1368)](V,s));break;case 2:n.value=e.CHYSe(_e,s,e[t(1459)](V,s));break;default:e[t(807)]($,s,e.WVEcF(7,i))}}if(e[t(1364)](void 0,n[t(1119)]))throw new Error(e[t(1210)]);if(n.value===void 0)throw new Error("Missing "+t(1492)+t(330)+t(1663));return n}function A(s){let t=r,n=e[t(1251)](P);return e[t(1667)](L,s,n),pe(n)}function L(s,t){let n=r,i=s[n(767)];e.kTrOk(void 0,i)&&(e.MxwHn(q,t,8),wt(t,i));let c=s.LogID;e[n(1321)](void 0,c)&&(e[n(1667)](q,t,16),e.IyqPC(wt,t,c));let l=s.service;e.Nurzd(void 0,l)&&(e[n(661)](q,t,24),e[n(807)](wt,t,e.EcFER(te,l)));let g=s[n(741)];e[n(362)](void 0,g)&&(e[n(661)](q,t,32),e[n(661)](wt,t,te(g)));let p=s[n(1260)];if(e[n(336)](void 0,p))for(let ae of p){e.wfIeP(q,t,42);let ve=e[n(492)](P);e.RSofe(b,ae,ve),e[n(276)](q,t,ve[n(773)]),jn(t,ve),e[n(1459)](z,ve)}let u=s["payloadE"+n(1175)];e[n(1282)](void 0,u)&&(e[n(1118)](q,t,50),e[n(669)](we,t,u));let m=s[n(996)+n(1518)];e.EtZyH(void 0,m)&&(e[n(276)](q,t,58),e[n(1289)](we,t,m));let w=s.payload;e[n(1547)](void 0,w)&&(e[n(807)](q,t,66),e[n(1560)](q,t,w.length),e[n(1662)](qt,t,w));let S=s[n(799)];e[n(1547)](void 0,S)&&(q(t,74),e.qFSfD(we,t,S));let D=s[n(624)+"ming"];e[n(1130)](void 0,D)&&(e.ICaIC(q,t,82),e.ICaIC(we,t,D));let N=s[n(1605)];e.kTrOk(void 0,N)&&(e.IyqPC(q,t,90),e[n(661)](we,t,N));let I=s.frameType;I!==void 0&&(e[n(1662)](q,t,96),e[n(1289)](wt,t,e[n(1717)](te,I)))}function T(s){let t=r,n={mHvNr:function(i,c){return i<c},eLAdI:function(i,c){return e.TICPc(i,c)},AIUXh:function(i,c){return i>>c},NFHDw:function(i,c){return i|c},VmWzI:function(i,c){return i|c}};if(e[t(1103)](e[t(1788)],e[t(463)]))return e[t(662)](R,e[t(955)](Z,s));n.mHvNr(_0x4a0332,65536)?_0x14e51b[_0x4e9101++]=n[t(1714)](n[t(537)](_0x1c8ed7,12),15)|224:(_0x393839[_0x26f736++]=n.NFHDw(n.AIUXh(_0x4808a5,18)&7,240),_0x237686[_0x5e7010++]=n[t(1714)](n[t(537)](_0x1c0e2a,12),63)|128),_0x332e71[_0x28cc5b++]=n[t(711)](n[t(537)](_0x5e62a2,6)&63,128)}function R(s){let t=r,n={};e:for(;!e[t(955)](me,s);){let i=e[t(955)](V,s);switch(e[t(1602)](i,3)){case 0:break e;case 1:n.SeqID=e[t(960)](Jr,s,!0);break;case 2:n[t(488)]=e[t(1386)](Jr,s,!0);break;case 3:n[t(781)]=e.sWIwt(V,s);break;case 4:n[t(741)]=e[t(1421)](V,s);break;case 5:{let c=e[t(587)](U,s);(n[t(1260)]||(n.headers=[]))[t(1290)](e[t(955)](y,s)),s[t(773)]=c;break}case 6:n[t(561)+t(1175)]=e.odMRE(_e,s,V(s));break;case 7:n["payloadT"+t(1518)]=e[t(1277)](_e,s,e.bMJnG(V,s));break;case 8:n.payload=zt(s,V(s));break;case 9:n[t(799)]=_e(s,e[t(955)](V,s));break;case 10:n["serverTi"+t(1450)]=e[t(276)](_e,s,e.sWIwt(V,s));break;case 11:n.msgID=e.jSUPx(_e,s,e[t(1677)](V,s));break;case 12:n.frameType=e[t(1629)](V,s);break;default:e[t(1662)]($,s,e[t(1592)](7,i))}}if(e.VjYUT(void 0,n[t(767)]))throw new Error(e[t(1106)]);if(n[t(488)]===void 0)throw new Error(e[t(1695)]);if(e[t(1418)](void 0,n[t(781)]))throw new Error(t(1193)+t(1492)+t(330)+t(781));if(n[t(741)]===void 0)throw new Error(e[t(1059)]);return n}function U(s){let t=r,n=e.ohcmt(V,s),i=s[t(773)];return s[t(773)]=e[t(1062)](s[t(297)],n),i}function $(s,t){let n=r;switch(t){case 0:for(;128&e[n(1304)](ne,s););break;case 2:e[n(276)](ke,s,V(s));break;case 5:e.Ledsy(ke,s,4);break;case 1:e[n(1213)](ke,s,8);break;default:throw new Error(e[n(266)]+t)}}function te(s){let t=r;return s|=0,{low:s,high:e.VAAAV(s,31),unsigned:e[t(685)](s,0)}}let Ae=[];function P(){let s=r,t=Ae[s(453)]();return t?(t[s(297)]=t[s(773)]=0,t):{bytes:new Uint8Array(64),offset:0,limit:0}}function z(s){let t=r;if(e.VjYUT(e[t(1626)],e[t(1626)]))Ae[t(1290)](s);else{let n=_0x1783c4[t(297)];if(e[t(1180)](e[t(806)](n,_0x5e6d99),_0x590e88[t(773)]))throw new _0x393d05("Read pas"+t(1466));return _0x4c4ad6[t(297)]+=_0x40b32d,n}}function Z(s){return{bytes:s,offset:0,limit:s[r(1080)]}}function pe(s){let t=r,n=s[t(1288)],i=s[t(773)];return e.XSasJ(n[t(1080)],i)?n:n[t(828)](0,i)}function ke(s,t){let n=r;if(e[n(1772)](s.offset+t,s[n(773)]))throw new Error(e[n(1100)]);s[n(297)]+=t}function me(s){let t=r;return e.cJPqR(s[t(297)],s[t(773)])}function de(s,t){let n=r,i={IlHVH:function(c,l){return e[k(685)](c,l)},AXAoR:function(c,l){return c<=l},FBqYJ:function(c,l){return e[k(1300)](c,l)},wLcSm:function(c,l){return c-l},JSTmu:function(c,l){return e[k(1716)](c,l)},QzonN:function(c,l){return e[k(1724)](c,l)},iQFFb:function(c,l){return c<l},RHLJd:function(c,l){return c<l}};if(e[n(1153)](e[n(1143)],e[n(1143)])){let c=s[n(1288)],l=s[n(297)],g=s[n(773)],p=e[n(701)](l,t);if(e[n(479)](p,c.length)){let u=new Uint8Array(e[n(632)](2,p));u[n(851)](c),s[n(1288)]=u}return s[n(297)]=p,p>g&&(s[n(773)]=p),l}else{let c=_0x188821[n(825)+"At"](_0x3df989);i[n(1302)](c,55296)&&i.AXAoR(c,56319)&&i[n(1526)](_0x2d50d8+1,_0x404038)&&(c=i[n(1385)](i[n(576)](i[n(412)](c,10),_0x53c9c1[n(825)+"At"](++_0x1e43a6)),56613888)),_0x1ac3eb+=i.iQFFb(c,128)?1:i[n(1234)](c,2048)?2:i[n(1526)](c,65536)?3:4}}function je(s,t){let n=r;if(e[n(664)]!=="UVUQl")return _0x5700a4+=_0xb76822&&_0x26f87c[n(468)+"th"]||0,_0x100110;{let i=s[n(297)];if(e[n(1772)](e[n(727)](i,t),s[n(773)]))throw new Error(e[n(1350)]);return s[n(297)]+=t,i}}function zt(s,t){let n=r,i=e[n(1118)](je,s,t);return s[n(1288)][n(828)](i,i+t)}function qt(s,t){let n=r,i=e[n(276)](de,s,t[n(1080)]);s[n(1288)].set(t,i)}function _e(s,t){let n=r,i={kYEef:function(m,w){return e[k(756)](m,w)},EbZdh:n(967),uxmyh:function(m,w){return e[n(1421)](m,w)},iFFWY:function(m,w){return e.Cwrjn(m,w)},nfjYe:function(m,w,S){return m(w,S)}},c=e[n(892)](je,s,t),l=String[n(570)+n(366)],g=s[n(1288)],p="\uFFFD",u="";for(let m=0;e[n(1240)](m,t);m++){let w=g[e.sXkMc(m,c)],S,D,N,I;if(e.kIBWT(128&w,0))u+=l(w);else if(e[n(1782)](224,w)===192)e[n(1447)](m+1,t)?u+=p:(S=g[e[n(1306)](e[n(1268)](m,c),1)],e[n(1231)](e.OSbto(192,S),128)?u+=p:(I=e[n(1724)](e[n(1592)](31,w),6)|63&S,e[n(1666)](I,128)?u+=p:(u+=e.TDJex(l,I),m++)));else if((240&w)==224)if(e[n(685)](m+2,t))u+=p;else if(S=g[e.vhrLV(e[n(1610)](m,c),1)],D=g[e.CpKpv(m,c)+2],e[n(1644)](e[n(881)](S|e[n(1720)](D,8),49344),32896))u+=p;else if(I=e[n(1452)](e.DgjQl(e[n(1307)](15,w),12)|e.DbAZb(63&S,6),63&D),I<2048||e[n(985)](I,55296)&&e[n(895)](I,57343))u+=p;else if(e[n(1153)](e.hGZpA,n(1619)))u+=e[n(955)](l,I),m+=2;else return FHDLcJ.kYEef(typeof _0x5df94a,FHDLcJ.EbZdh)?FHDLcJ.uxmyh(_0x1a4133,_0x1c12df):(FHDLcJ[n(758)](_0x17a2db,_0x14f2ee)&&FHDLcJ.uxmyh(_0x57a189,_0x432643),FHDLcJ[n(1781)](_0x5012af,_0x5d3a16,_0x4994b3())?new _0x4be88e(_0x8f252b,_0x530576):_0x17eec8);else(248&w)==240?e[n(685)](e[n(1388)](m,3),t)?u+=p:(S=g[e[n(432)](m,c)+1],D=g[e[n(1076)](m+c,2)],N=g[e[n(727)](e.KifZC(m,c),3)],e[n(312)](S|e[n(1131)](D,8)|e[n(1384)](N,16),12632256)!==8421504?u+=p:(I=e[n(1575)](e[n(1415)](e.LJKAz(e[n(1391)](7,w)<<18,e.cYjjC(e[n(899)](63,S),12)),e.zLETd(e[n(1391)](63,D),6)),e.vyDii(63,N)),e.VhMBc(I,65536)||I>1114111?u+=p:e[n(336)](e[n(979)],e.QmiZK)?(I-=65536,u+=e[n(1174)](l,e.nFEoA(e[n(953)](I,10),55296),e[n(1176)](e[n(1621)](1023,I),56320)),m+=3):_0x2a755f[n(1713)][n(1149)+n(665)](_0x3ddd57))):u+=p}return u}function we(s,t){let n=r,i={OXAtx:function(u,m){return u<m},baKOP:function(u,m){return e[k(1629)](u,m)},kpZTE:function(u,m){return u>m},ZuWcQ:function(u,m){return e[k(1261)](u,m)},LZqOP:function(u,m){return e[k(1621)](u,m)},XRtBG:function(u,m){return e[k(1337)](u,m)}},c=t.length,l=0;for(let u=0;u<c;u++)if(e.ZgJDX(e[n(1395)],"igvSL")){let m=t[n(825)+"At"](u);e[n(327)](m,55296)&&e.gWMGH(m,56319)&&u+1<c&&(m=e[n(503)](e.cGDRw(e.QpduD(m,10),t[n(825)+"At"](++u)),56613888)),l+=e[n(1666)](m,128)?1:e.piKQG(m,2048)?2:e.zyzWu(m,65536)?3:4}else{let m=e[n(644)](_0x5ddf73,8192),w=e[n(1602)](m,1),S=null,D=m;return function(N){let I=n;if(i[I(1770)](N,1)||N>w)return i[I(1173)](_0x2ad3ee,N);i[I(1614)](i[I(505)](D,N),m)&&(S=i.baKOP(_0x2664fa,m),D=0);let ae=_0x5558f8.call(S,D,D+=N);return i[I(790)](7,D)&&(D=i[I(505)](i[I(595)](7,D),1)),ae}}q(s,l);let g=de(s,l),p=s[n(1288)];for(let u=0;e[n(1666)](u,c);u++){let m=t[n(825)+"At"](u);e[n(1358)](m,55296)&&e.ZRhUC(m,56319)&&e[n(498)](e[n(1694)](u,1),c)&&(m=e.bntIA(e[n(1724)](m,10),t[n(825)+"At"](++u))-56613888),e[n(328)](m,128)?p[g++]=m:(e.teWDX(m,2048)?p[g++]=e[n(980)](e[n(1782)](m>>6,31),192):(e[n(1009)](m,65536)?p[g++]=e[n(402)](e.vxiJc(e[n(770)](m,12),15),224):n(553)!==e[n(441)]?(p[g++]=e[n(1085)](e.vxiJc(e[n(630)](m,18),7),240),p[g++]=e[n(1780)](e[n(1396)](e.cFmiJ(m,12),63),128)):(this[n(752)]=_0x42aee7,this[n(335)]=_0x35b1df,this._qosDB=_0x2883b7),p[g++]=e[n(1320)](e[n(953)](m,6),63)|128),p[g++]=e[n(1071)](e[n(1592)](63,m),128))}}function jn(s,t){let n=r,i=e[n(892)](de,s,t[n(773)]),c=s[n(1288)],l=t[n(1288)];for(let g=0,p=t[n(773)];e[n(1077)](g,p);g++)c[e[n(543)](g,i)]=l[g]}function ne(s){let t=r;if(e.pMSlE!==t(461))return s[t(1288)][e[t(298)](je,s,1)];_0x4515a3[t(891)]=_0x55c205[t(1183)]().then(()=>(_0x2744fe(),_0x81b735))[t(1471)](function(n){return n})}function ye(s,t){let n=r,i=de(s,1);s[n(1288)][i]=t}function V(s){let t=r,n=0,i=0,c;do c=e.kEbJS(ne,s),e[t(1009)](n,32)&&(i|=e[t(1653)](127&c,n)),n+=7;while(e[t(1491)](128,c));return i}function q(s,t){let n=r;for(t>>>=0;e[n(734)](t,128);)e[n(960)](ye,s,e[n(1126)](e[n(1621)](127,t),128)),t>>>=7;e[n(1524)](ye,s,t)}function Jr(s,t){let n=r,i=0,c=0,l=0,g;if(g=e[n(1459)](ne,s),i=e[n(592)](127,g),e[n(1592)](128,g)&&(g=e[n(695)](ne,s),i|=e[n(810)](127,g)<<7,e.PwwWB(128,g)&&(g=ne(s),i|=e[n(798)](127&g,14),128&g&&(g=e.QTEfR(ne,s),i|=e[n(1724)](127&g,21),e[n(1726)](128,g)&&(g=e[n(1677)](ne,s),c=127&g,e.IOMGJ(128,g)&&(g=e.vdGiz(ne,s),c|=e[n(1246)](e[n(1320)](127,g),7),e[n(1782)](128,g)&&(g=e[n(662)](ne,s),c|=e[n(1726)](127,g)<<14,e[n(881)](128,g)&&(g=e[n(955)](ne,s),c|=e[n(1381)](127,g)<<21,e[n(783)](128,g)&&(g=e.PDTqo(ne,s),l=e[n(1345)](127,g),128&g))))))))){if(e[n(516)]==="srhdY")return"frontier_"+this[n(752)];g=e[n(1459)](ne,s),l|=(127&g)<<7}return{low:e.gEvRQ(i,e[n(324)](c,28)),high:e[n(1389)](e[n(1607)](c,4),e[n(897)](l,24)),unsigned:t}}function wt(s,t){let n=r,i=t[n(1047)]>>>0,c=e.qWyrN(e[n(649)](e[n(982)](t[n(1047)],28),e[n(481)](t.high,4)),0),l=t[n(1191)]>>>24,g=l===0?c===0?e[n(1736)](i,16384)?e.JgBjX(i,128)?1:2:e[n(328)](i,2097152)?3:4:c<16384?c<128?5:6:c<2097152?7:8:e.GPVaG(l,128)?9:10,p=e[n(857)](de,s,g),u=s[n(1288)];switch(g){case 10:u[e[n(449)](p,9)]=e[n(1307)](e[n(267)](l,7),1);case 9:u[e[n(1388)](p,8)]=g!==9?128|l:e[n(1307)](127,l);case 8:u[e.mDXPN(p,7)]=e[n(704)](8,g)?e[n(1607)](c,21)|128:e[n(1381)](e[n(1488)](c,21),127);case 7:u[e[n(1176)](p,6)]=e.sxtdU(7,g)?e[n(1452)](e[n(923)](c,14),128):e[n(1324)](e.bSRHk(c,14),127);case 6:u[e[n(351)](p,5)]=g!==6?e[n(980)](e[n(1730)](c,7),128):e[n(1777)](c,7)&127;case 5:u[e[n(1097)](p,4)]=e[n(1282)](5,g)?128|c:e.XeAVT(127,c);case 4:u[p+3]=e[n(755)](4,g)?e[n(1071)](e.bGzkf(i,21),128):e[n(315)](i>>>21,127);case 3:u[e[n(1014)](p,2)]=e[n(1351)](3,g)?e[n(1575)](e[n(1607)](i,14),128):e[n(1324)](e[n(1067)](i,14),127);case 2:u[e[n(1610)](p,1)]=e[n(410)](2,g)?e[n(1635)](e[n(267)](i,7),128):e[n(1672)](e[n(1224)](i,7),127);case 1:u[p]=e[n(722)](1,g)?e[n(1082)](128,i):e[n(800)](127,i)}}function Vr(s){let t=r;return e.Thdaa(t(1e3),t(1e3))?e.MyLMx(T,s):this[t(1089)+"T"]||this[t(1074)+"X"]?this["_miniNav"+t(817)+t(1147)]:(this._isBrowser||this[t(1152)+"r"])&&this[t(1107)][t(801)+"tworkCha"+t(1469)]?_0x47cc8e[t(1335)]:!0}function Wn(s){return e[r(838)](A,s)}let Xr=65536,Jo=e.YXYUg,et=e[r(890)](Xr,Xr),Yr=et*et,Zr=e[r(1419)](Yr,2),Oe=String.prototype[r(825)+"At"];class O{constructor(t,n,i){let c=r;this[c(1789)]=!0,this[c(1047)]=e[c(1452)](0,t),this.high=e.SeruD(0,n),this[c(1008)]=!!i}static isLong(t){let n=r;return t&&e.ZgJDX(!0,t[n(1789)])}static[r(792)](t,n,i){return new O(t,n,i)}static fromBytes(t,n,i){let c=r;if(e[c(1321)](e.GlPUE,c(526)))this[c(910)+c(398)+c(1034)](_0x4add67),_0x139400[c(851)](_0x1b69d5,_0x5428fb,_0xd8fb14.message[c(781)]);else return i?O[c(343)+c(1271)](t,n):O[c(343)+"sBE"](t,n)}static[r(343)+r(1271)](t,n){let i=r;if(i(565)===e[i(1392)])return new O(e[i(559)](e[i(1681)](e[i(484)](t[0],e[i(1384)](t[1],8)),e[i(1700)](t[2],16)),e[i(1720)](t[3],24)),e[i(819)](e[i(1323)](e[i(1696)](t[4],t[5]<<8),e[i(897)](t[6],16)),e[i(1453)](t[7],24)),n);if(YWxCjJ[i(986)](_0x329c40,_0x15fdce)){if(YWxCjJ[i(1767)](_0x1033b1,YWxCjJ.GBCSQ))return _0xa5b9ce.get(_0x139727);if(_0x43ca84===i(831)+i(1589))return _0x4551c1.objectStoreNames||_0x347d86[i(1054)](_0x2c14ee);if(YWxCjJ[i(1449)](_0x345aa6,YWxCjJ[i(1675)]))return _0x3597a0[i(831)+i(1589)][1]?void 0:_0x58fe92[i(831)+i(604)](_0x5c84af[i(831)+i(1589)][0])}return _0x59b07a(_0x5a874f[_0x3216a8])}static[r(343)+r(1551)](t,n){let i=r;if(e[i(1075)]!==i(975)){let c=this[i(1191)],l=this[i(1047)];return[e[i(1073)](c,24),e.EEhAd(c,16)&255,e[i(1305)](c,8)&255,e.noDNJ(255,c),e.mAjdE(l,24),e[i(1525)](e.ZLbiC(l,16),255),e[i(982)](l,8)&255,e[i(1345)](255,l)]}else return new O(e[i(1323)](e[i(1085)](e.uuTnm(e.cYjjC(t[4],24),e[i(733)](t[5],16)),t[6]<<8),t[7]),e[i(764)](e.auagC(t[0]<<24,e[i(481)](t[1],16)),e[i(1384)](t[2],8))|t[3],n)}static[r(1733)](t){let n=r;return e[n(1792)](t,Jo)?$r:new O(e.BszwI(e[n(1559)](e[n(559)](e[n(915)](Oe[n(1092)](t,0),Oe[n(1092)](t,1)<<8),Oe[n(1092)](t,2)<<16),e[n(1724)](Oe[n(1092)](t,3),24)),0),e[n(1504)](e[n(905)](Oe[n(1092)](t,4),Oe[n(1092)](t,5)<<8)|e[n(1453)](Oe[n(1092)](t,6),16),e[n(1237)](Oe.call(t,7),24))>>>0,!0)}[r(471)](){let t=r;return e.XSasJ("QxnPU",e.XAWNT)?String.fromCharCode(e[t(650)](255,this[t(1047)]),e[t(1621)](e[t(1607)](this[t(1047)],8),255),e[t(657)](e[t(1067)](this[t(1047)],16),255),e.EEhAd(this[t(1047)],24),e[t(269)](255,this[t(1191)]),e.bBqOZ(this[t(1191)],8)&255,e[t(1199)](this[t(1191)],16)&255,e[t(1674)](this[t(1191)],24)):this[t(1682)]?.[t(1423)](_0x29f898)}static[r(389)+"er"](t,n=!0){let i=r;if(isNaN(t))return n?Vo:$r;if(n){if(t>=Yr)return Yo}else{if(e[i(1202)](t,-Zr))return Zo;if(e[i(1716)](t,1)>=Zr)return Xo}return O.fromBits(e.vNEHc(e[i(699)](t,et),0),e.vNEHc(t/et,0),n)}[r(396)](){let t=r;return this[t(1008)]?e[t(1779)](e[t(632)](e[t(642)](this[t(1191)],0),et),e.ZLbiC(this[t(1047)],0)):e.RUGMi(e.zzqgf(this[t(1191)],et),e[t(1777)](this.low,0))}[r(1417)](){let t=r;return e[t(325)](0,this.high)&&e[t(1445)](0,this.low)}[r(1158)](t){let n=r;O[n(1789)](t)||(t=O[n(389)+"er"](t));let i=e[n(1224)](this[n(1191)],16),c=e[n(1253)](65535,this[n(1191)]),l=this[n(1047)]>>>16,g=e[n(340)](65535,this[n(1047)]),p=t[n(1191)]>>>16,u=e.TICPc(65535,t[n(1191)]),m=e.TRgVy(t[n(1047)],16),w=e[n(609)](65535,t[n(1047)]),S=0,D=0,N=0,I=0;return I+=g+w,N+=I>>>16,I&=65535,N+=e[n(1261)](l,m),D+=e[n(642)](N,16),N&=65535,D+=e[n(1793)](c,u),S+=e[n(835)](D,16),D&=65535,S+=e.CpKpv(i,p),S&=65535,O[n(792)](e[n(1110)](N<<16,I),e[n(1795)](e[n(1534)](S,16),D),this[n(1008)])}equals(t){let n=r;return O[n(1789)](t)||(t=O[n(389)+"er"](t)),e[n(1373)](this.unsigned,t[n(1008)])&&e[n(1792)](e.qXnug(this.high,31),1)&&e.fUqtt(t[n(1191)],31)===1?!1:this.high===t[n(1191)]&&this[n(1047)]===t[n(1047)]}[r(294)](){let t=r;return this[t(1047)]===-1&&this[t(1191)]===-1?O.fromBits(0,0,this[t(1008)]):this.low===-1?O.fromBits(0,e[t(1357)](this[t(1191)],1),this.unsigned):O[t(792)](e[t(1146)](this[t(1047)],1),this[t(1191)],this[t(1008)])}[r(1784)](t){let n=r,i={DWOYH:n(1608)+n(1794)};if(e[n(1606)](e.OQzuu,e.OQzuu))return t?this[n(866)+"E"]():this[n(1275)+"E"]();_0x28cf9b[n(1713)][n(1149)+n(665)](_0x39dc02),_0x194523[n(621)+n(1615)]=void 0,_0x38d9f9(_0x1c073b&&_0x11dc26[n(805)]||i[n(451)])}[r(866)+"E"](){let t=r,n=this.high,i=this[t(1047)];return[e[t(1557)](255,i),e[t(651)](e[t(786)](i,8),255),e[t(1253)](e[t(1465)](i,16),255),e[t(509)](i,24),e[t(850)](255,n),e.EVWsO(n>>>8,255),e[t(1044)](n>>>16,255),n>>>24]}toBytesBE(){let t=r,n=this[t(1191)],i=this[t(1047)];return[e[t(457)](n,24),e[t(578)](e[t(1472)](n,16),255),n>>>8&255,e[t(783)](255,n),e[t(1225)](i,24),e[t(1523)](i,16)&255,e[t(651)](e[t(713)](i,8),255),e[t(1633)](255,i)]}}let $r=new O(0,0,!1),Vo=new O(0,0,!0),Xo=O[r(792)](-1,2147483647,!1),Yo=O[r(792)](-1,-1,!0),Zo=O[r(792)](0,-2147483648,!1);var Me=(function(s){let t=r,n=(t(1537)+t(1562))[t(862)]("|"),i=0;for(;;){switch(n[i++]){case"0":s[s[e[t(1129)]]=5005]=e[t(1129)];continue;case"1":s[s[t(369)+t(547)+"R"]=5003]=e[t(1053)];continue;case"2":return s;case"3":s[s["CONNECTI"+t(1553)]=5002]=e.ZhAUB;continue;case"4":s[s[t(970)+t(466)]=5001]=e[t(1138)];continue;case"5":s[s[e[t(914)]]=5004]=e[t(914)];continue}break}})({});class nt{constructor(t){let n=r;this.type=t,this[n(1218)]=null}}class Qr extends nt{constructor(t,n){let i=r,c={RCxOU:function(l,g){return e.FfRZJ(l,g)},izZLN:e[i(1111)],Boier:e[i(1783)],mVmXG:e[i(1072)]};if(e[i(722)](e[i(818)],e[i(818)])){let l={mAmuR:function(u,m){return c[i(1256)](u,m)},dDeUH:i(1438),IVUaK:c[i(1160)],tMdib:c[i(1254)]};this[i(1020)+i(1759)](),this[i(1029)+"gTimeoutId"]=_0x3ee3e0(this._ping[i(1538)](this),this[i(1107)][i(694)+"rval"]);let g=()=>{let u=i;c[u(1256)](_0x6874fe,c.izZLN),this[u(870)](u(310)+u(445)+"s",g),this[u(870)](c[u(1254)],p)},p=()=>{let u=i;l[u(845)](_0x6e082a,l[u(1052)]),this[u(870)](l.IVUaK,g),this.off(l.tMdib,p)};this.on("ping_onc"+i(445)+"s",g),this.on(c[i(1254)],p),this[i(1397)]()}else super(t),this[i(1576)]=n&&n[i(1576)]||null}}class es extends nt{constructor(t,n){let i=r,c={gSHza:function(l,g){return l(g)}};if(e.sJtJw!=="fUpDa")_0x4ec3bc(FQmjpQ.gSHza(_0x2a2b72,_0x2cc2f6[i(364)]),_0x30c118[i(849)+"on"],_0x55ca11[i(1484)+"on"],_0x5d83ba(_0x321702[i(499)+i(1535)]));else{let l=e.ZxaCq[i(862)]("|"),g=0;for(;;){switch(l[g++]){case"0":this.message=n&&n[i(1576)]||"";continue;case"1":this[i(1188)]=n&&n[i(1188)]||0;continue;case"2":this.code=n&&n[i(1394)]||5001;continue;case"3":this[i(1172)]=n&&n[i(1172)]||null;continue;case"4":this.filename=n&&n[i(638)]||"";continue;case"5":this[i(439)]=n&&n[i(439)]||0;continue;case"6":super(t);continue}break}}}}class ts extends nt{constructor(t,n){let i=r;if(e[i(1239)](e[i(1718)],e[i(1718)])){let c=e[i(1024)][i(862)]("|"),l=0;for(;;){switch(c[l++]){case"0":this[i(674)]=n&&n[i(674)]||!1;continue;case"1":this["willReco"+i(425)]=n&&n[i(1573)+"nnect"]||!1;continue;case"2":super(t);continue;case"3":this.reason=n&&n[i(1794)]||"";continue;case"4":this.code=n&&n[i(1394)]||0;continue}break}}else return _0x325a43[i(570)+"Code"](e[i(887)](255,this[i(1047)]),this.low>>>8&255,e.hsTmQ(e[i(509)](this.low,16),255),e[i(1488)](this[i(1047)],24),e.YREGo(255,this.high),e.BGzLs(this[i(1191)],8)&255,e[i(1507)](e[i(1199)](this.high,16),255),this[i(1191)]>>>24)}}class ns extends nt{constructor(t,n){super(t),this.data=n&&n.data||null}}class rs extends ns{constructor(t,n){let i=r,c={bihfi:e[i(837)]};if(e[i(1643)](e[i(687)],e[i(687)])){let l=i(1041)+_0x583f19+(i(1701)+"ax retri"+i(1135)+"ed");this[i(910)+"hErrorEv"+i(833)](_0x5bdb79(c[i(1383)],{message:l,code:_0xffe88a[i(369)+i(547)+"R"],error:_0x5c433b}));return}else super(t),this[i(496)]=n&&n[i(496)]||null,this[i(1576)]=n&&n[i(1576)]||null}}class ss extends nt{constructor(t,n){let i=r;super(t),this[i(496)]=n&&n[i(496)]||null}}function oe(s,{message:t,code:n,error:i}){return new es(s,{message:t,code:n,error:i})}function le(s,{code:t,reason:n,wasClean:i,willReconnect:c}){return new ts(s,{code:t,reason:n,wasClean:i,willReconnect:c})}function is(s,{data:t,message:n}){return new rs(s,{data:t,message:n})}function os(s,{data:t}){return new ss(s,{data:t})}function Jn(s,{message:t}){let n=r;return e[n(404)](e.Wdklm,e[n(1177)])?this[n(1505)+"tManager"]?.[n(1544)+n(289)+n(332)+n(839)]()||0:new Qr(s,{message:t})}class as{constructor(t,n){let i=r;this.endpoints=t,this.maxRetries=n,this["currentI"+i(871)]=0,this[i(1287)+"ndpointT"+i(1015)+"t"]=0}["resetEnd"+r(1407)+"fig"](){let t=r;this[t(757)+"ndex"]=0,this["currentE"+t(616)+t(1015)+"t"]=0}[r(353)+"es"](){let t=r;this[t(1287)+"ndpointTriesCount"]=0}[r(1544)+r(289)+"nt"](){let t=r;return this.endpoints[this[t(757)+t(871)]]}[r(1544)+r(289)+"ntTriesC"+r(839)](){let t=r;return this[t(1287)+t(616)+t(1015)+"t"]}[r(1489)+"chMaxTries"](){let t=r;return!!(e.cSuzp(this[t(757)+"ndex"],this.endpoints.length)||e[t(1792)](this["currentI"+t(871)],e.HECSW(this.endpoints[t(1080)],1))&&e[t(1749)](this[t(1287)+t(616)+t(1015)+"t"],this[t(378)+"es"]))}["checkCur"+r(680)+r(1760)+r(1007)+r(1028)](){let t=r;if(e[t(1231)](e[t(1467)],e[t(1387)]))return this["currentI"+t(871)]==this[t(356)+"s"].length?!0:e.ywyfl(this[t(1287)+"ndpointT"+t(1015)+"t"],this.maxRetries);_0x556d28+=e[t(1228)](_0x35bd1a,_0x469669),_0x35ea4e+=2}["replaceB"+r(656)+r(326)+r(1316)+r(1013)](){let t=r;if(e[t(666)]!==t(275))return this[t(1287)+t(616)+t(1015)+"t"]=1,this[t(757)+"ndex"]++,this.endpoints[this[t(757)+t(871)]];{let n=_0x10aacf(_0x391c7d,_0x4075d2);return _0x170e90[t(1288)][t(828)](n,e.RNsYk(n,_0x53dc94))}}["getCurrentEndpoi"+r(1656)+r(1227)](){let t=r;return this[t(1287)+"ndpointTriesCount"]++,this["getCurre"+t(289)+"nt"]()}}let rt=(e.DXsIi(e[r(854)],typeof globalThis)&&e[r(1303)]===globalThis[r(1341)+r(987)][r(1494)]||e[r(301)](e[r(854)],typeof window)&&e.HQxQE(e.LtSLG,window[r(1341)+"tor"].name))&&e[r(854)]!=typeof document,We=e[r(854)]!=typeof globalThis&&(e.IPYMc(e[r(759)],globalThis[r(1341)+r(987)][r(1494)])||e.XSasJ(e[r(594)],globalThis["construc"+r(987)][r(1494)]))&&e.JpEiS!=typeof tt,yt=(e[r(1208)](e[r(854)],typeof globalThis)&&e.HQxQE(r(607),globalThis[r(1341)+r(987)][r(1494)])||e[r(538)](e.JpEiS,typeof globalThis)||e[r(688)](r(1236)+"d",typeof globalThis)&&!!globalThis[r(1187)+"Bridge"])&&e[r(854)]!=typeof wx,vt=e.JpEiS!=typeof globalThis&&(e[r(594)]===globalThis["construc"+r(987)][r(1494)]||e[r(894)](e.nVKnN,globalThis[r(1341)+r(987)][r(1494)])||e[r(1578)](e[r(1702)],globalThis.constructor[r(1494)]))&&e[r(854)]!=typeof self,$o=e.lHfAk(e.JpEiS,typeof globalThis)&&e[r(763)](r(607),globalThis[r(1341)+"tor"][r(1494)])&&e[r(778)](e[r(854)],typeof global)&&r(607)===global[r(1341)+r(987)].name&&e[r(688)](e[r(854)],typeof process)&&!!process.version;class Vn{constructor(){let t=r;this[t(623)+"rs"]={}}[r(926)](t,...n){let i=r,c=this._listeners[t];if(c)c[i(949)]()[i(969)](l=>l.fn[i(655)](l[i(581)],n));else if(e[i(1364)](e.xKkBm,t)&&!this[i(1325)]){let l=n.length&&n[0];if(e[i(986)](l,Error))throw l;let g=new Error(e[i(1371)](i(878)+i(469),l?e[i(1261)](" (",l[i(1576)])+")":""));throw g[i(1715)]=l,l}return this}off(t,n){let i=r;if(e[i(1153)](void 0,t))this[i(623)+"rs"]={};else if(n===void 0)this[i(623)+"rs"][t]=null;else if(e[i(1321)](e[i(560)],e[i(560)]))try{return!!this[i(1682)]}catch(c){return _0x48aa79.log(c),!1}else{let c=this[i(623)+"rs"][t];if(c)for(let l=0;e[i(690)](l,c[i(1080)]);)e[i(325)](c[l].fn,n)?c[i(787)](l,1):++l}return this}on(t,n,i){let c=r;return(this._listeners[t]||(this[c(623)+"rs"][t]=[]))[c(1290)]({fn:n,ctx:i||this}),this}}class Qo extends Vn{[r(954)+r(614)+"age"](t){let n=r;return t[n(1483)]||t[n(1309)]?(n(464)+" "+(t[n(1483)]||"")+n(1281)+(t[n(1309)]||"")).trim():JSON.stringify(t)}constructor(t,n,i){let c=r,l={UBOCX:e[c(988)],HRxQq:e.xKkBm,iRszq:function(g){return e.tBJAy(g)},AALWl:function(g,p){return e[c(1459)](g,p)},aIVVJ:e.KyDwT,jXDRt:function(g){return g()}};if(e[c(1646)]===c(1109)){let g={GZqYW:function(w){let S=c;return OrvYyL[S(797)](w)},glnZn:function(w,S){let D=c;return OrvYyL[D(447)](w,S)},kJXsI:OrvYyL[c(1564)],XSyye:function(w){let S=c;return OrvYyL[S(1410)](w)}},p=()=>{let w=c;_0x47a192[w(906)+w(455)+"ner"](OrvYyL.UBOCX,u),_0x4144c7[w(906)+"entListe"+w(477)](OrvYyL[w(652)],m),_0x681b31["removeEv"+w(455)+w(477)](w(320),m)},u=()=>{let w=c;_0x5556eb(),g[w(346)](p)},m=()=>{let w=c;g.glnZn(_0xda8e3f,_0x487ce6[w(1172)]||new _0x3b4e9a(g.kJXsI,w(1634)+"or")),g[w(1296)](p)};_0x5c22a2[c(1498)+c(1087)](c(1433),u),_0x188096[c(1498)+c(1087)](OrvYyL[c(652)],m),_0x44698a[c(1498)+c(1087)](c(320),m)}else super(),this._socket=null,yt&&wx[c(719)+"ocket"]&&(this[c(1661)]=wx.connectSocket({url:t,protocols:n,header:i,fail:this[c(1331)+c(1416)+c(932)][c(1538)](this),success:this[c(1331)+c(1366)+c(1241)+c(460)][c(1538)](this)})),We&&tt[c(719)+"ocket"]&&(this[c(1661)]=tt["connectS"+c(1102)]({url:t,protocols:n,header:i,fail:this[c(1331)+c(1416)+c(932)][c(1538)](this),success:this[c(1331)+"ocketSuc"+c(1241)+c(460)][c(1538)](this)}))}[r(1331)+r(1366)+r(1241)+"ler"](){let t=r;Promise.resolve()[t(1471)](()=>{let n=t;this[n(1200)+n(1660)]()})}["_createSocketFai"+r(932)](t){let n=r,i={zDykb:n(1172),GHrfV:function(c,l,g){return e[n(1229)](c,l,g)},UPOsb:e[n(1292)]};Promise.resolve()[n(1471)](()=>{let c=n,l=oe(i.zDykb,{message:this._formatErrorMessage(t)});this.emit(i[c(646)],l);let g=i[c(1708)](le,i.UPOsb,{reason:this[c(954)+c(614)+c(571)](t)});this[c(926)](i[c(1624)],g)})}[r(1200)+r(1660)](){let t=r,n={GKmpf:e[t(1529)],uYLMD:e[t(601)],xBBjH:function(i,c,l){return e[t(1684)](i,c,l)},kvUKt:t(917)+">",bFnRw:function(i,c){return e[t(1411)](i,c)},KIYML:t(720),wFMnQ:function(i,c,l){return i(c,l)},FKrUj:function(i,c,l){return e[t(857)](i,c,l)},gZyOa:t(1172),cCupU:function(i,c,l){return e[t(692)](i,c,l)}};this._socket.onOpen(i=>{let c=t;n[c(612)]===n.GKmpf?this[c(926)](n[c(731)],n.xBBjH(os,"open",{...i,data:i[c(1483)]||""})):this._socket&&this[c(1661)][c(673)]({code:_0x31bb39,reason:_0x1820f9})}),this[t(1661)][t(322)](i=>{let c=t,l={jXIja:n[c(365)]};n[c(1215)](c(809),n[c(293)])?this[c(926)](c(673),n[c(736)](le,"close",{...i})):this._options[c(647)]&&_0x514a8[c(1627)][c(655)](_0x47aca6,[l[c(641)],..._0x2c2816])}),this[t(1661)].onMessage(i=>{let c=t;this[c(926)](c(1576),n[c(584)](is,c(1576),{...i}))}),this[t(1661)][t(1278)](i=>{let c=t;this[c(926)](n[c(974)],n[c(1360)](oe,n[c(974)],{...i,message:i[c(1483)]||""}))})}[r(393)](t){let n=r,i={qsYXf:function(c,l,g){return e[k(480)](c,l,g)},cexjH:e.xKkBm,WslUB:n(1217)};if(e.Cwrjn(t,Uint8Array)){let c=t[n(350)].slice(t[n(1664)+"et"],t[n(468)+"th"]+t[n(1664)+"et"]);this._socket&&this[n(1661)][n(393)]({data:c,fail:l=>{let g=n;this[g(926)]("error",i[g(1451)](oe,i[g(1170)],{message:this[g(954)+g(614)+g(571)](l)}))}})}else this[n(1661)]&&this[n(1661)].send({data:t,fail:c=>{let l=n;i[l(610)]!==i[l(610)]?this.off(_0x438457,_0x32eed5):this[l(926)](l(1172),i[l(1451)](oe,l(1172),{message:this["_formatE"+l(614)+l(571)](c)}))}})}[r(673)](t,n){let i=r;this[i(1661)]&&this[i(1661)][i(673)]({code:t,reason:n})}[r(1498)+"Listener"](t,n){let i=r;if(e[i(512)](e[i(495)],e[i(495)]))this.on(t,n);else try{this[i(1508)]&&this[i(1508)][i(673)](_0x16a45b,_0x72ca6b)}catch{}}[r(906)+"entListe"+r(477)](t,n){this.off(t,n)}get[r(504)+"te"](){let t=r;return this[t(1661)][t(504)+"te"]}get[r(357)+"pe"](){let t=r;if(e[t(744)](t(1485),e.LlPHb))_0xb22e8f=_0x4f6bb5[e.kffJc(_0x5c36aa+_0x5bae39,1)],_0x5de288=_0x3b665a[e[t(1097)](e.ixcCJ(_0x209351,_0x571ea9),2)],_0x5d4b4b=_0x2f89d1[e[t(1144)](_0x362623+_0x36dbeb,3)],e[t(1782)](e[t(1071)](_0x300deb|e.HuiEJ(_0x3391c3,8),e[t(329)](_0x24b1df,16)),12632256)!==8421504?_0x178b3c+=_0x171c78:(_0x5a7a6e=e[t(1504)](e[t(583)](e[t(277)](7,_0x45d9c7)<<18,e[t(998)](63,_0x343f5a)<<12)|e.zNAbm(e[t(1057)](63,_0x58306d),6),e.PwwWB(63,_0x119328)),e[t(1123)](_0x800a4e,65536)||e.qHYkx(_0xa49c43,1114111)?_0x3c0daf+=_0x2a22dd:(_0x1cbfe2-=65536,_0x222787+=e.smquA(_0x2086aa,e[t(832)](e[t(953)](_0xbcc4d2,10),55296),e[t(432)](e.CLTZS(1023,_0x59f2d9),56320)),_0x493da2+=3));else return this[t(1661)].binaryType}set[r(357)+"pe"](t){}get url(){let t=r;if(e.MbDBF(e[t(1671)],"aSLld"))this._cursorNameSpace=_0x203a85,this._cursorFileName=_0x21d104,this[t(929)+t(510)]=_0x67d457,this[t(1682)]=e.CHYSe(_0x33a4c5,this[t(585)+t(1403)],e[t(815)]);else return this[t(1661)][t(716)]}get[r(1761)](){let t=r;return this[t(1661)][t(1761)]}get[r(826)+"ns"](){let t=r;return this[t(1661)][t(826)+"ns"]}get[r(476)+r(1441)](){return 0}}function e0(s,t){let n=r;if(t)return new t(s.url,s[n(1761)]);if(e[n(1121)](yt,We))return new Qo(s[n(716)],s[n(1761)],s.headers);if(e[n(1270)](rt,vt)&&e[n(688)](e[n(854)],typeof WebSocket)&&WebSocket)return new WebSocket(s[n(716)],s.protocols)}function t0(s){let t=r,n=e[t(567)][t(862)]("|"),i=0;for(;;){switch(n[i++]){case"0":if(We&&tt[t(719)+"ocket"])return!0;continue;case"1":if(e[t(1785)](rt,vt)&&e[t(688)](e[t(854)],typeof WebSocket)&&WebSocket)return!0;continue;case"2":if(yt&&wx["connectS"+t(1102)])return!0;continue;case"3":return!1;case"4":if(s)return!0;continue}break}}function xs(s,t,n){let i=r,c={LkSuz:function(p,u){return p<=u},KguYh:function(p,u){return p===u}},l=-1;async function g(p){let u=k;return c[u(963)](p,l)?Promise[u(927)](new Error(u(316)+u(1096)+u(1061)+u(1104)+"process")):(l=p,c.KguYh(p,n[u(1080)])?Promise[u(1183)]():n[p][u(1538)](s)(t,g[u(1538)](null,p+1)))}e[i(1717)](g,0)}function cs(s){let t=r;if(e[t(336)](t(1406),e.istVX)){let n=0,i=0;for(let c=0;c<s[t(1080)];++c)i=s[t(825)+"At"](c),i<128?n+=1:e[t(1294)](i,2048)?n+=2:e[t(961)](64512,i)===55296&&e[t(942)](e.KiGbf(64512,s[t(825)+"At"](e[t(344)](c,1))),56320)?(++c,n+=4):n+=3;return n}else{let n=this[t(1191)],i=this.low;return[255&i,e[t(323)](e[t(338)](i,8),255),e[t(1339)](e[t(267)](i,16),255),e[t(1777)](i,24),e.OSbto(255,n),e[t(1018)](e[t(1113)](n,8),255),e.VZqVu(e.PErbw(n,16),255),e[t(1224)](n,24)]}}function fs(s,t,n){let i=r;if(e[i(603)](e.GlNTb(n,t),1))return"";let c="";for(let l=t;e[i(603)](l,n);){let g=s[l++];if(e.iGlpR(g,127))c+=String[i(570)+"Code"](g);else if(e[i(1447)](g,192)&&e[i(1599)](g,224))c+=String[i(570)+i(366)](e.LBwVm(e[i(1425)](e[i(723)](31,g),6),e.yodoS(63,s[l++])));else if(e.KtlEF(g,224)&&e[i(603)](g,240))c+=String[i(570)+"Code"](e[i(819)](e[i(421)](e[i(928)](15,g),12)|e[i(1581)](e[i(800)](63,s[l++]),6),e[i(340)](63,s[l++])));else if(e[i(985)](g,240)){let p=e.BXzZM(e[i(1635)](e[i(937)](e.uaDAp(7,g),18)|e[i(1522)](63,s[l++])<<12|e[i(937)](e[i(578)](63,s[l++]),6),63&s[l++]),65536);c+=String["fromChar"+i(366)](e[i(717)](55296,e[i(545)](p,10))),c+=String[i(570)+i(366)](e.RFteU(56320,e.KiGbf(1023,p)))}}return c}function Xn(s,t,n){let i=r,c=n,l,g;for(let p=0;e[i(690)](p,s[i(1080)]);++p)if(l=s[i(825)+"At"](p),e.DuSak(l,128))t[n++]=l;else if(e[i(591)](l,2048))if(e[i(1098)]===e[i(319)])try{return e[i(688)](e[i(1348)],typeof _0x53974e)&&(e[i(986)](_0x5a8774,_0x499345)||_0x608734[i(350)]&&e[i(718)](_0x7ec60f.buffer,_0x4b93cb))||e[i(301)](i(500),typeof _0x31b627)?"":(_0x567b12.parse(_0x43ffc6),i(1754)+i(686))}catch{return e[i(538)](e[i(1348)],typeof _0x16adf1)?e[i(1207)]:""}else t[n++]=l>>6|192,t[n++]=e.SXlVG(63&l,128);else e[i(1445)](e[i(1672)](64512,l),55296)&&e.qKMgy(e[i(493)](64512,g=s[i(825)+"At"](p+1)),56320)?(l=e.BdcIW(65536+e[i(1653)](e[i(887)](1023,l),10),1023&g),++p,t[n++]=e[i(1645)](e.mmSHf(l,18),240),t[n++]=e[i(706)](e[i(1307)](e[i(893)](l,12),63),128),t[n++]=e.OYMXE(e[i(1212)](l,6),63)|128,t[n++]=e.JBaNy(e.Cyqur(63,l),128)):(t[n++]=e[i(1415)](e[i(1775)](l,12),224),t[n++]=e[i(1507)](e.dksDr(l,6),63)|128,t[n++]=e[i(588)](e[i(723)](63,l),128));return e[i(1402)](n,c)}async function us(s){let t=r;if(e[t(538)](e[t(1348)],typeof s)){let n=new Uint8Array(e[t(726)](cs,s));return e.FKzjL(Xn,s,n,0),n}return e[t(1012)](s,ArrayBuffer)?new Uint8Array(s):new Uint8Array(s[t(350)],s.byteOffset,s[t(468)+"th"])}function n0(s){let t=r;try{return e[t(1348)]!=typeof s&&(s instanceof ArrayBuffer||s[t(350)]&&e[t(710)](s[t(350)],ArrayBuffer))||e[t(1348)]!=typeof s?"":(JSON.parse(s),e.QLRpn)}catch{return e.oSFqx(e[t(1348)],typeof s)?e[t(1207)]:""}}let r0=(s,t)=>{let n=r;switch(s){case e[n(1565)]:case e.hGJKr:return{["x-use-"+s]:1,"x-tt-env":t};default:return{}}};class s0{constructor(t){let n=r;this[n(599)+n(839)]=t,this[n(517)]=0}[r(992)](){let t=r;this[t(517)]++}["checkRea"+r(705)+"nt"](){let t=r;return e[t(940)](this.count,this["maxLossC"+t(839)])}[r(1517)+r(1400)](t=0){let n=r;this["maxLossC"+n(839)]=t,this.count=0}}async function i0(s){let t=r,n={fCasa:t(1172),nmKLd:function(i,c){return i instanceof c},YAljd:function(i,c){return i+c},gNhfx:function(i,c){return e[t(336)](i,c)},EAAiz:t(653),BwurQ:e[t(635)],ZTsRn:function(i,c){return e[t(726)](i,c)}};return new Promise(i=>{let c=t;if(!rt)return e.bMJnG(i,e.cbkgp);try{let l=document[c(1499)+c(580)]("script");window[c(621)+c(1615)]=g=>{let p=c,u={mnNCm:n[p(1527)],GUHqe:function(m,w){return n[p(1010)](m,w)},QGadU:function(m,w){return n[p(1439)](m,w)}};if(n.gNhfx(n[p(532)],p(418)))document[p(1713)][p(1149)+p(665)](l),window[p(621)+p(1615)]=void 0,i(g&&g[p(805)]||n[p(834)]);else if(aCeSHg[p(811)](_0x304289,_0x20bcde)){let m=_0x23a3fb.buffer[p(949)](_0x374200[p(1664)+"et"],aCeSHg[p(1263)](_0x560a2a[p(468)+"th"],_0x1c99ae[p(1664)+"et"]));this[p(1661)]&&this[p(1661)][p(393)]({data:m,fail:w=>{let S=p;this.emit(aCeSHg[S(846)],_0x468743(S(1172),{message:this[S(954)+"rrorMess"+S(571)](w)}))}})}else this[p(1661)]&&this._socket[p(393)]({data:_0x5e380f,fail:m=>{let w=p;this.emit("error",_0xa74ad8(aCeSHg[w(846)],{message:this[w(954)+w(614)+w(571)](m)}))}})},l[c(284)]=e[c(1280)],l[c(334)]=e.RNsYk(s[c(394)](/^ws/,e[c(1757)]),e[c(1604)]);try{document[c(1713)]["appendCh"+c(665)](l)}catch{document[c(1713)][c(1149)+c(665)](l)}}catch{if(e[c(1606)](e[c(735)],"NcHsu"))window["frontier"+c(1615)]=void 0,e[c(955)](i,e[c(635)]);else{let l=_0x37add6[c(1092)](pAFdBV[c(880)](_0xe38fd,this),_0x2c8cf2,..._0x1dba5f);return _0x2e0d8e.set(l,_0x2aa0d6[c(541)]?_0x22860e.sort():[_0x40cd71]),_0x4f0c20(l)}}})}function ze(s,t,n){let i=r;if(e[i(512)](i(528),e.SULLm))return!!s?.[i(776)](l=>l.key===t&&l[i(1663)]===n);for(var c in _0x4c3046)_0x303ebc.o(_0x3c0dc7,c)&&!_0x522157.o(_0x591076,c)&&_0x56957b["definePr"+i(877)](_0x54f06c,c,{enumerable:!0,get:_0x504f57[c]})}function st(s,t){let n=r;return s?.[n(776)](i=>i[n(1119)]===t)?.[n(1663)]}let Yn=null;async function o0(){let s=r;return Yn||(Yn=Promise.resolve().then(Se.bind(Se,e[s(1636)]))),Yn}class a0 extends Vn{constructor(t,n){let i=r;super(),this[i(904)]=t,this[i(791)]=n,this._qosDB=void 0,this[i(292)+"mise"]=null}async[r(1136)](){await this[r(886)]()}async _init(){let t=r,n={AgZtK:function(i){return e[k(1251)](i)}};if(!this._qosDB){if(this[t(292)+t(1049)])return this[t(292)+"mise"];try{let i=this._dbName,c=this[t(791)];this[t(292)+"mise"]=(async()=>{let l=t,{openDB:g}=await n[l(1521)](o0);this._qosDB=await g(l(621)+"_"+i,1,{upgrade(p){p["createOb"+l(1542)+"e"](i,{keyPath:c})}})})(),await this["_initPro"+t(1049)]}catch(i){console[t(1627)](i)}finally{this[t(292)+t(1049)]=null}}}async get(t){let n=r;try{return await this[n(886)](),this[n(1682)]?.get(this[n(904)],t)}catch(i){console[n(1627)](i)}}async set(t,n){let i=r;return await this._init(),this[i(1682)]?.[i(1442)](this[i(904)],t)}async[r(1423)](t){let n=r,i={AEwPV:function(c,l){return c(l)},ApnqN:e[n(1475)],XqDpu:e.GRxWl};try{if(e[n(1362)](n(1088),e.WaebR))return await this[n(886)](),this[n(1682)]?.[n(1145)](this[n(904)],t);i[n(1405)](_0x4a25ba,i.ApnqN),this[n(870)](i[n(675)],_0x2bab6d),this[n(870)](n(310)+"e_timeout",_0xe72841)}catch(c){console[n(1627)](c)}}async clear(){let t=r;try{return await this[t(886)](),this[t(1682)]?.[t(813)](this[t(904)])}catch(n){console[t(1627)](n)}}async[r(1603)](){let t=r;return await this[t(886)](),this[t(1682)]?.getAllKeys(this._dbName)}async getAll(){let t=r;return await this._init(),this[t(1682)]?.[t(280)](this[t(904)])}async closeDB(){let t=r,n={VIlfH:function(i,c){return i<c},mouMs:function(i,c){return e[k(964)](i,c)},VSgFK:function(i,c){return e[k(491)](i,c)},saqxt:function(i,c){return i+c},EfGDo:function(i,c){return e[k(1440)](i,c)},fNghq:function(i,c){return e[k(1775)](i,c)},jjDLN:function(i,c){return i&c},ROcKA:function(i,c){return i|c},GusiD:function(i,c){return i&c},ICMOn:function(i,c){return e[k(1319)](i,c)},NfCgk:function(i,c){return e[k(1326)](i,c)},EBkxv:function(i,c){return e.dnPes(i,c)},PBSuG:function(i,c){return e[k(286)](i,c)},mkPtX:function(i,c){return e.NlrDD(i,c)}};try{if(e[t(1481)](t(502),e[t(827)]))this[t(1682)]?.[t(673)](),this._qosDB=void 0;else{let i=_0x311704[t(825)+"At"](_0x209758);i>=55296&&i<=56319&&pkkwPE[t(448)](pkkwPE.mouMs(_0x543cb8,1),_0x5e0a07)&&(i=pkkwPE[t(1093)](pkkwPE.saqxt(i<<10,_0x2fde3d[t(825)+"At"](++_0x45b5b1)),56613888)),pkkwPE[t(448)](i,128)?_0x289a8f[_0x44f1fd++]=i:(pkkwPE[t(448)](i,2048)?_0x2a7de6[_0xa5fca5++]=pkkwPE[t(1630)](pkkwPE[t(679)](i,6)&31,192):(pkkwPE[t(448)](i,65536)?_0x11fbb8[_0x1b6a26++]=pkkwPE[t(1630)](pkkwPE[t(847)](i>>12,15),224):(_0x4783a4[_0x249a4e++]=pkkwPE[t(1506)](pkkwPE[t(830)](pkkwPE[t(415)](i,18),7),240),_0x1625a6[_0x298abc++]=pkkwPE[t(847)](pkkwPE.NfCgk(i,12),63)|128),_0x40118a[_0x428367++]=pkkwPE.EBkxv(pkkwPE[t(1023)](i>>6,63),128)),_0x3f25f2[_0x4ba173++]=pkkwPE[t(534)](pkkwPE[t(830)](63,i),128))}}catch(i){console.log(i)}}get[r(1194)](){let t=r,n={pGEhv:function(i,c,l){return e[k(939)](i,c,l)}};if(e.EsjGH(e[t(401)],e[t(401)]))ZhJCPz[t(459)](_0x13fe5f,_0x310afa,16),ZhJCPz[t(459)](_0x13c32b,_0x3b79e9,_0x43fed1);else try{return!!this[t(1682)]}catch(i){return console[t(1627)](i),!1}}}class x0{constructor(t,n){let i=r;this[i(752)]=t,this[i(335)]=n,this._qosDB=localStorage}async[r(1136)](){}get[r(317)](){return"frontier_"+this._DBName}async[r(1054)](t){let n=r,i=this[n(1682)][n(1182)](this[n(317)]);return JSON[n(1361)](e[n(1121)](i,"{}"))[t]}async[r(851)](t,n){let i=r,c=this._qosDB.getItem(this[i(317)]),l=JSON[i(1361)](c||"{}");return l[n||t[this[i(335)]]]=t,this[i(1682)].setItem(this[i(317)],JSON.stringify(l)),n||t[this._pathKey]}async[r(1423)](t){let n=r,i=this._qosDB[n(1182)](this._prefix),c=JSON[n(1361)](e.oLPBr(i,"{}"));return c[t]=void 0,this[n(1682)][n(858)](this[n(317)],JSON[n(683)+"y"](c))}async clear(){let t=r;return this._qosDB[t(813)]()}async[r(1603)](){let t=r,n=this[t(1682)][t(1182)](this[t(317)]),i=JSON[t(1361)](n||"{}");return Object[t(1603)](i)}async[r(280)](){let t=r,n={qpIvX:function(i,c){return e[k(876)](i,c)},irEtP:function(i,c){return i&c},dBWRr:function(i,c){return e[k(928)](i,c)},fESrJ:function(i,c){return i(c)},HAQSC:function(i,c){return i<<c}};if(e[t(889)](t(1004),"zrzkH"))_0x20a75e=KUZgLg[t(1408)](_0x25524c,_0x290d39),_0x2b0958=KUZgLg[t(1344)](127,_0x29bfe4),KUZgLg[t(768)](128,_0x35d9ed)&&(_0x2318c4=KUZgLg[t(789)](_0x89b3fe,_0x1fe261),_0x362cea|=KUZgLg[t(1680)](KUZgLg[t(1344)](127,_0x471660),7));else{let i=this._qosDB[t(1182)](this[t(317)]),c=JSON[t(1361)](e.nQKeM(i,"{}"));return Object[t(1021)](c)}}[r(1497)](){return Promise[r(1183)]()}get isReady(){let t=r;if(e[t(524)](e[t(946)],t(1728)))return!!this[t(1682)];{let n=_0x3a982b.split(":");for(let i=0;e[t(422)](i,n.length);i++){let c=n[i];if(n[i][t(1080)]!==4){let l=_0x4e28cd[t(1409)+"g"](0,4-n[i][t(1080)]),g=l.concat(c);_0xaff981=_0x1c1c8f.concat(g)}else _0x18db43=_0x3d1188[t(1365)](c)}return _0x459f75}}}class c0{constructor(t,n){let i=r;this[i(752)]=t,this[i(335)]=n,this[i(1682)]=We?tt:yt?wx:null}async[r(1136)](){}get[r(317)](){let t=r,n={SDbak:function(i,c){return e[k(359)](i,c)},pUGWF:function(i,c){return e[k(327)](i,c)},IWcgf:function(i,c){return i|c},NiNjI:function(i,c){return e.nafrv(i,c)},WELhX:function(i,c){return e[k(1509)](i,c)},wpmNw:function(i,c){return i>=c},KDLzf:function(i,c){return e[k(1237)](i,c)},QxINR:function(i,c){return i<<c},dugXw:function(i,c){return i&c},LuCeV:function(i,c){return e[k(1768)](i,c)},mPRRR:function(i,c){return i>=c},QEOYN:function(i,c){return i|c},uhLGH:function(i,c){return i<<c},PFDpE:function(i,c){return e.Dzszn(i,c)},LTnzi:function(i,c){return e[k(1030)](i,c)},cyLLO:function(i,c){return e[k(663)](i,c)},ZpoWO:function(i,c){return e[k(1654)](i,c)}};if(e[t(1282)](e[t(941)],t(1115))){let i=_0xe77289[_0x31ede3++];if(Gavfde[t(1550)](i,127))_0x390760+=_0x133bea["fromChar"+t(366)](i);else if(Gavfde[t(511)](i,192)&&i<224)_0x55606b+=_0x6c8ca2[t(570)+t(366)](Gavfde[t(1577)](Gavfde[t(1622)](31&i,6),Gavfde[t(1132)](63,_0x8ea375[_0x22ec1d++])));else if(Gavfde[t(333)](i,224)&&i<240)_0x349a77+=_0x47f8c1[t(570)+t(366)](Gavfde[t(1577)](Gavfde[t(1577)](Gavfde.KDLzf(15&i,12),Gavfde[t(1790)](Gavfde.dugXw(63,_0x52973d[_0x5e761f++]),6)),Gavfde[t(658)](63,_0xc84951[_0x4b30d2++])));else if(Gavfde[t(539)](i,240)){let c=Gavfde[t(557)](Gavfde[t(1577)](Gavfde[t(1790)](7&i,18),Gavfde[t(640)](Gavfde.PFDpE(63,_0x2c3eb1[_0x415e02++]),12))|Gavfde[t(658)](63,_0x1660e7[_0x49285e++])<<6,Gavfde.LTnzi(63,_0x556a54[_0x1bc16e++]))-65536;_0x37e636+=_0x281d0a[t(570)+t(366)](Gavfde[t(1530)](55296,Gavfde[t(670)](c,10))),_0x344db1+=_0x4cf6c0["fromChar"+t(366)](Gavfde.cyLLO(56320,Gavfde.LuCeV(1023,c)))}}else return t(621)+"_"+this[t(752)]}async[r(1054)](t){let n=r,i=this[n(1682)]["getStora"+n(703)](this[n(317)]);return JSON[n(1361)](e[n(1133)](i,"{}"))[t]}async set(t,n){let i=r,c=this[i(1682)]["getStora"+i(703)](this[i(317)]),l=JSON.parse(e[i(1121)](c,"{}"));return l[n||t[this._pathKey]]=t,this[i(1682)][i(636)+i(703)](this[i(317)],JSON.stringify(l)),n||t[this._pathKey]}async[r(1423)](t){let n=r,i=this[n(1682)][n(406)+"geSync"](this[n(317)]),c=JSON[n(1361)](e[n(644)](i,"{}"));return c[t]=void 0,this[n(1682)][n(636)+"geSync"](this._prefix,JSON[n(683)+"y"](c))}async[r(813)](){let t=r;if(e.ozwDc(t(1514),e[t(1142)]))return this._qosDB[t(371)+t(1778)]();if(this._options[t(1482)+t(1477)+t(1470)]||this._readyClosed)return;this["_handleR"+t(550)]()}async keys(){let t=r,n=this[t(1682)][t(406)+t(1293)+"nc"](this._prefix),i=JSON.parse(e[t(1747)](n,"{}"));return Object[t(1603)](i)}async[r(280)](){let t=r,n=this._qosDB[t(406)+"geInfoSync"](this[t(317)]),i=JSON[t(1361)](e[t(1141)](n,"{}"));return Object[t(1021)](i)}[r(1497)](){let t=r;return e.kTrOk(e.xXhXF,e[t(270)])?Promise[t(1183)]():_0x1526f9(_0x4eb96f)}get isReady(){return!!this._qosDB}}function ds(s,t){let n=r;if(e[n(478)](We,We))return new c0(s,t);if(e[n(684)](rt,vt)&&e[n(301)](e[n(854)],typeof indexedDB))return new a0(s,t);if(e.vmZHz(rt,vt)&&e[n(854)]!=typeof localStorage)return new x0(s,t);throw new Error(e.vSXYL)}class f0{constructor(){let t=r;if(e[t(1379)](e[t(1707)],e[t(1745)]))return(this[t(623)+"rs"][_0x2f2d85]||(this[t(623)+"rs"][_0x1c7d32]=[]))[t(1290)]({fn:_0x1af282,ctx:_0x5d9f28||this}),this;this["_interva"+t(622)+"Id"]=null,this[t(1758)+"l"]=36e5,this[t(1682)]=e[t(1684)](ds,e[t(1648)],t(993)+"id")}async[r(1758)+r(375)](){let t=r;clearInterval(this[t(1758)+t(622)+"Id"]),this[t(1758)+t(622)+"Id"]=e[t(1163)](setInterval,()=>{this["flushExp"+t(1040)]()},this[t(1758)+"l"])}async openDB(){let t=r,n={FmHsb:function(i,c){return e[k(738)](i,c)},RhQlg:function(i,c){return e[k(362)](i,c)},Kqgdn:t(1735),zfllb:t(1066),AhONM:function(i,c){return i===c},LeEFS:e[t(637)]};await this[t(1682)][t(1136)]()[t(1471)](()=>{let i=t,c={dpsXp:function(l,g){return n[k(898)](l,g)},BYbwE:function(l,g){return n.RhQlg(l,g)},vMYta:n.Kqgdn,FOugG:n[i(1658)]};n[i(1125)](n.LeEFS,i(1003))?this[i(1758)+i(375)]():(this["_navigat"+i(1597)]()&&(!this[i(1508)]||c.dpsXp(this[i(1508)][i(504)+"te"],this[i(1352)])||c.BYbwE(this[i(1508)][i(504)+"te"],this.CONNECTING))&&this["_handleO"+i(1025)](),this[i(318)+"er"]&&_0x2fce56[i(1498)+i(1087)](c[i(1151)],this[i(314)+i(1025)]),this[i(318)+"er"]&&_0x38eafd[i(1498)+i(1087)](c[i(882)],this["_handleO"+i(1750)]))})}async[r(586)+r(1040)](){let t=r;(await this[t(1682)]?.getAll()||[]).filter(({timestamp:c})=>c<Date[t(1719)]())[t(969)](c=>{let l=t;this[l(1682)]?.[l(1423)](c.message_id)})}async[r(1423)](t){let n=r;return this[n(1682)]?.[n(1423)](t)}async set(t,n){let i=r;return this[i(1682)]?.[i(851)]({message_id:t,timestamp:n})}async get(t){return this[r(1682)]?.get(t)}async[r(1497)](){let t=r;e[t(876)](clearInterval,this[t(1758)+t(622)+"Id"]),await this._qosDB?.closeDB()}get[r(1194)](){let t=r,n={RqOsW:function(i,c){return e.HEDCX(i,c)}};return e[t(1706)](e[t(354)],e[t(354)])?this[t(1682)]?.[t(1194)]:EFQyKG[t(1238)](_0x12d422(4).join("0"),_0x560651(_0xbee03b,2).toString(16))[t(949)](-4)}}function Zn(s){let t=r,n=!!this[t(1107)][t(349)+"S"];if(!n)return{enabled:n,isQoSMessage:!1,isQoSAck:!1,isAckCleanupMessage:!1,ackMsgIds:[]};let i=e[t(1079)](ze,s[t(1576)].headers,t(1414)+t(1698),"2"),c=i&&e.VxIOA(ze,s[t(1576)][t(1260)],e.aoOKh,"1"),l=i&&e[t(1079)](ze,s.message[t(1260)],e[t(589)],"1"),g=l?st(s[t(1576)][t(1260)],e[t(435)])?.split(",").filter(Boolean)||[]:[];return{enabled:n,isQoSMessage:i,isQoSAck:c,isAckCleanupMessage:l,ackMsgIds:g}}async function ls(){let s=r;return this[s(1117)+"ger"]||(this[s(1117)+"ger"]=new f0),this[s(1117)+s(1631)][s(1194)]||await this[s(1117)+s(1631)][s(1136)](),this["_QoSMana"+s(1631)]}async function u0(s,t){let n=r,i={qiAzh:function(u,m){return e[k(1270)](u,m)}},{enableAutoAck:c}=this[n(1107)],l=e[n(822)](ze,s[n(1576)][n(1260)],n(1312),"1"),g=ze(s[n(1576)][n(1260)],n(1272),"1"),p=Zn[n(1092)](this,s);if(c&&l)if(e[n(1606)](e[n(1571)],e[n(1198)])){let u=this[n(1682)][n(406)+n(1293)+"nc"](this[n(317)]),m=_0x279afb[n(1361)](NoXDiI[n(1609)](u,"{}"));return _0x68e4fe[n(1021)](m)}else{let{SeqID:u,LogID:m,service:w,LogIDNew:S,method:D}=s[n(1576)];this._sendAck({SeqID:u,LogID:m,LogIDNew:S,service:w,method:D,headers:[{key:e[n(1226)],value:"1"},{key:n(370),value:e[n(1270)](S,"")},{key:e[n(1056)],value:"0"}]})}g&&!p[n(1204)]&&this[n(910)+n(966)+"ageEvent"](s),e[n(1251)](t)}async function d0(s,t){this._debug(e.RCdoF,s.message),t()}async function l0(s,t){let n=r,i=e[n(1723)](Vr,await e[n(1717)](us,s[n(496)]));try{if(e[n(710)](i[n(918)],Uint8Array)){let c=e[n(1566)](this[n(1107)][n(561)+n(1175)],Object)?{force:!!this[n(1107)]["payloadE"+n(1175)].force,encoding:this[n(1107)][n(561)+n(1175)].encoding?this[n(1107)][n(561)+n(1175)].encoding[n(394)](/\s/g,"").toLowerCase():""}:{force:!1,encoding:this._options[n(561)+n(1175)]?this._options[n(561)+n(1175)][n(394)](/\s/g,"")[n(816)+n(1574)]():""},l=i[n(561)+"ncoding"]?i[n(561)+n(1175)][n(394)](/\s/g,"")[n(816)+n(1574)]():"",g=this[n(1107)][n(996)+n(1518)]instanceof Object?{force:!!this[n(1107)]["payloadT"+n(1518)][n(345)],type:this[n(1107)]["payloadT"+n(1518)].type?this._options.payloadType[n(284)][n(394)](/\s/g,"")[n(816)+n(1574)]():""}:{force:!1,type:this[n(1107)][n(996)+n(1518)]?this[n(1107)]["payloadT"+n(1518)].replace(/\s/g,"")[n(816)+"ase"]():""},p=i["payloadT"+n(1518)]?i[n(996)+n(1518)][n(394)](/\s/g,"")[n(816)+n(1574)]():"",u=g[n(345)]?g[n(284)]:p||g[n(284)],m=c[n(345)]?c.encoding:l||c[n(536)],w=[n(551)+"in;charset=utf-8",e.QLRpn,n(1754)+n(686)+n(779)+n(840),e[n(1348)]],S=[e[n(1625)],e.ulgte];this[n(1107)][n(1168)+n(395)+n(1006)+"ad"]&&w.includes(u)&&(!m||S[n(352)](m))?i[n(639)+n(446)]=fs(i[n(918)],0,i[n(918)][n(468)+"th"]):i[n(639)+n(446)]=""}else i[n(639)+n(446)]=""}catch(c){i[n(639)+"oad"]="",console[n(1627)](c)}s[n(1576)]=i,t()}function h0(s,t,n){let i=r,c={fZDBs:function(m,w){return e[k(1180)](m,w)},bsPhS:function(m,w){return e[k(479)](m,w)},dckjt:function(m,w){return e[k(1247)](m,w)},UFGTF:function(m,w){return e[k(443)](m,w)},XvSGL:function(m,w){return e[k(1404)](m,w)},GQBYc:function(m,w){return e[k(1468)](m,w)},jRgDt:function(m,w){return e[k(1398)](m,w)}},l=n||8192,g=e[i(835)](l,1),p=null,u=l;return function(m){let w=i;if(m<1||c[w(1140)](m,g))return s(m);c[w(1250)](c[w(762)](u,m),l)&&(p=c[w(1787)](s,l),u=0);let S=t[w(1092)](p,u,u+=m);return c[w(392)](7,u)&&(u=c.GQBYc(c[w(1105)](7,u),1)),S}}let g0=4294967295;function p0(s,t,n){let i=r,c={GgNdB:function(l,g){return e[k(531)](l,g)},pfzBB:function(l,g){return e[k(819)](l,g)},XCxLm:function(l,g){return l&g}};if(e[i(763)](i(423),e[i(420)]))return e.MyLMx(RangeError,e[i(1371)](e[i(449)](e[i(444)](e.QMtuo(e[i(387)](e[i(739)],s),e[i(634)]),e.CZTxR(t,1)),e[i(785)]),n));_0x578d0e[_0x42dd34++]=xqOmap.GgNdB(_0x2226f2,6)|192,_0xf4d4ad[_0x2a2b8e++]=xqOmap.pfzBB(xqOmap[i(1693)](63,_0x1d0f1d),128)}function m0(s,t,n){let i=r;if(e[i(1772)](n,g0))throw new Error(e[i(1369)]);let c=3;for(;e[i(922)](c,0);){let l=e[i(981)](255,n);e[i(506)](Qn,l,s,t+c),n>>>=8,c--}return e[i(543)](t,4)}function _0(s,t){let n=r,i=0,c=t,l=e[n(802)](t,4);for(;e.itZfT(c,l);){let{value:g,offset:p}=e.qFSfD($n,s,c);c=p,i=e.qWyrN(e.aXRoo(i,8),0),i+=g}return{value:i,offset:l}}function w0(s,t,n){let i=r;return s?e[i(1353)](s.length,40)?e[i(1076)](e[i(355)](Xn,s,t,n),n):t[i(403)+"e"]?e[i(1014)](t.utf8Write(s,n),n):t[i(1739)]?e[i(693)](t[i(1739)](s,n),n):e.HeYCU(e[i(506)](Xn,s,t,n),n):n}function y0(s,t){let n=r,i=new O(e[n(583)](e[n(751)](e[n(1704)](s[e[n(1388)](t,4)],24),s[e[n(1247)](t,5)]<<16)|s[e[n(911)](t,6)]<<8,s[e[n(1268)](t,7)]),e[n(1082)](e[n(583)](s[e[n(414)](t,0)]<<24,e.JzYmZ(s[e.HXwWR(t,1)],16)),e[n(288)](s[e[n(303)](t,2)],8))|s[t+3],!0);return t+=8,{value:i,offset:e[n(397)](t,8)}}function v0(s,t,n){let i=r;if(e[i(1373)](e.waflU,e[i(1569)])){let c=s.low,l=s[i(1191)];return t[n]=e.zvWYK(l,24),t[e[i(1424)](n,1)]=e[i(651)](l>>>16,255),t[e[i(379)](n,2)]=e.gHDjs(e[i(1674)](l,8),255),t[e.dYdbg(n,3)]=e[i(750)](255,l),t[e.Smndt(n,4)]=e.QXtTI(c,24),t[e.IPpDy(n,5)]=e[i(1230)](e[i(1305)](c,16),255),t[e[i(1468)](n,6)]=e[i(315)](e[i(1488)](c,8),255),t[n+7]=255&c,n+=8,n}else this.emit(e.CLsic,_0xae5f45(i(1576),{..._0x3e9aa7}))}function $n(s,t){let n=r;return s[n(1546)+"8"]?{value:s[n(1546)+"8"](t),offset:e[n(303)](t,1)}:{value:e[n(493)](255,s[t]),offset:e[n(766)](t,1)}}function Qn(s,t,n){let i=r;return t.writeUint8?t[i(1002)+"t8"](s,n):t[n]=e[i(631)](255,s),e.FgOeV(n,1)}let b0=function(s){return new Uint8Array(s)},S0=e[r(1148)](e[r(854)],typeof Buffer)?Buffer["allocUns"+r(1710)]:e.RSofe(h0,b0,Uint8Array[r(1181)+"e"][r(828)]),E0=16,er=32;function C0(s){let t=r,n=0,i={};for(let c=0;c<s[t(1080)];c++)i[s[c][t(977)+t(1084)]]=e[t(955)](cs,s[c]["cursor_n"+t(1084)]),n+=14+i[s[c]["cursor_n"+t(1084)]];return[n,i]}function hs(s,t,n){let i=r,c={rWiKm:function(m,w,S,D){return m(w,S,D)},kaqNC:e[i(368)],kQCUp:e.EthUQ,GCShF:function(m,w,S,D){return e[i(271)](m,w,S,D)},WgGSA:e[i(399)],QZPDe:function(m,w,S,D){return e[i(1734)](m,w,S,D)},dSQYF:function(m,w,S,D){return e[i(629)](m,w,S,D)},Cdmgj:e.feKro},[l,g]=e[i(662)](C0,s),p=e[i(305)](S0,l),u=0;return s[i(969)](m=>{let w=i;console[w(1627)]("cursor.s"+w(558),m,m[w(781)]),u=c[w(1721)](Qn,0,p,u),console[w(1627)](c[w(530)],u),u=m0(p,u,m[w(781)]||0),console[w(1627)](c[w(748)],u),u=c[w(1584)](Qn,g[m[w(977)+w(1084)]],p,u),console[w(1627)](c[w(712)],u),u=c.QZPDe(w0,m[w(977)+"ame"],p,u),console[w(1627)](w(1494),u),u=c.dSQYF(v0,O[w(389)+"er"](m.cursor||t),p,u),console[w(1627)](c.Cdmgj,u)}),{frameType:er,headers:[{key:e[i(1422)],value:n}],payload:p}}function A0(s){let t=r;if(e.qeKIo(e[t(1031)],e[t(1031)])){let n=0,i=[];for(;e.DlZRk(n,s[t(468)+"th"]);){if(e.VLxIu(e.XXRZI,e[t(643)]))return _0x27bde6[t(831)+t(1589)][1]?void 0:_0x455a76[t(831)+t(604)](_0x39e4a5[t(831)+t(1589)][0]);{let{offset:c}=e[t(1585)]($n,s,n);n=c;let l={cursor_name:"",cursor:0,service:0},{value:g,offset:p}=e.Tzikt(_0,s,n);l[t(781)]=g,n=p;let{value:u,offset:m}=$n(s,n);n=m,l[t(977)+t(1084)]=fs(s,n,e[t(1244)](n,u)),n+=u;let{value:w,offset:S}=e[t(938)](y0,s,n);l.cursor=w[t(396)](),n=S,i[t(1290)](l)}}return i}else e[t(1667)](_0x3e1b29,_0x3d0390,90),_0x4bb705(_0x2a9a4f,_0x27f9ae)}function k0(){return{frameType:er,headers:[{key:e.BdLeN,value:"FILE_NOT_EXIST"}],payload:void 0}}class D0{constructor(t,n,i){let c=r;this[c(585)+c(1403)]=t,this[c(295)+c(1203)]=n,this[c(929)+c(510)]=i,this._qosDB=e.jsWuF(ds,this[c(585)+c(1403)],e.MUOod)}async[r(1136)](){let t=r;await this[t(1682)][t(1136)]()}async[r(1448)+"rs"](){let t=r;if(!this._qosDB[t(1194)])return;let n=this["_message"+t(510)],i=await this._qosDB.getAll();switch(console[t(1627)](e[t(1731)],i),n){case e[t(1248)]:return i&&i[t(1080)]?hs(i,0,this[t(295)+"ileName"]):void 0;case t(1434):return;case e[t(919)]:return i&&i[t(1080)]?e[t(1223)](hs,i,0,this[t(295)+t(1203)]):e[t(721)](k0)}}async[r(851)](t,n,i){let c=r;return console[c(1627)](c(1464),t,n,i),this[c(1682)][c(851)]({cursor_name:t,cursor:n,service:i})}async[r(903)+"rs"](t){let n=r,i=e[n(1255)](A0,t);for(let c of i)console[n(1627)](e.WGwCI,i),await this._qosDB[n(851)](c)}async get(t){let n=r;return(await this[n(1682)][n(1054)](t))?.[n(579)]}async closeDB(){let t=r;await this._qosDB[t(1497)]()}[r(1266)+r(1122)+r(291)](t){let n=r;this[n(295)+n(1203)]=t}get[r(1194)](){return this[r(1682)].isReady}}let P0=e[r(1064)];async function gs(s){let t=r;if(!this._options.enableQoS)return null;let{aID:n,fpID:i,messageStrategy:c}=this[t(1107)],l=s||P0;try{return this["_cursorM"+t(519)]?s&&this[t(1065)+"anager"][t(1266)+t(1122)+t(291)](s):this[t(1065)+"anager"]=new D0(i+"_"+n+"_"+l,l,c),this["_cursorM"+t(519)][t(1194)]||await this[t(1065)+t(519)][t(1136)](),this["_cursorM"+t(519)]}catch{return null}}async function L0(s,t){let n=r,i=e.KddpW(ze,s[n(1576)][n(1260)],"code","-1"),c=e[n(1340)](ze,s[n(1576)].headers,e[n(1226)],"1"),l=e[n(462)](st,s[n(1576)][n(1260)],e[n(1222)]),g=Number(st(s[n(1576)].headers,"x_fronti"+n(1764)))||0,p=Zn[n(1092)](this,s),u=e[n(1055)](ze,s[n(1576)][n(1260)],e.XHFDv,"2"),m=e.SbBFV(st,s.message[n(1260)],e[n(913)]),w=e.CGSLV(Number,st(s[n(1576)][n(1260)],e[n(1313)]));if(p[n(1204)])return e[n(780)](t);let S=p[n(1420)+n(514)]?await ls[n(1092)](this):null;if(s[n(1576)][n(781)]>0&&c&&!i||s[n(1576)][n(781)]>0){if(l&&p[n(1420)+n(514)]&&S)return!!!await S[n(1054)](l)&&(this[n(910)+"hMessageEvent"](s),await S[n(851)](l,e[n(303)](Date.now(),g))),t();if(u){let D=await gs[n(1092)](this);if(!D)return this[n(910)+"hMessage"+n(1034)](s),e[n(924)](t);let N=await D.get(m)??-1;if(e.iQHhB(N,w))this["_dispatc"+n(398)+"Event"](s),D[n(851)](m,w,s[n(1576)].service);else throw new Error(n(1116)+" message"+n(883)+w+(" larger "+n(1436)+n(470)+"r ")+N);return e[n(1167)](t)}return this[n(910)+n(398)+n(1034)](s),e[n(1167)](t)}}async function T0(s,t){let n=r,i=Zn[n(1092)](this,s);if(!i["isQoSMes"+n(514)])return e[n(1134)](t);let c=await ls.call(this);if(i[n(618)+n(944)+n(571)]&&i[n(1762)+"s"][n(1080)])for(let l of i.ackMsgIds)await c[n(1423)](l);e.CMQvt(t)}async function I0(s,t){let n=r;if(e[n(1162)](e[n(912)],e.SPMcQ)){let i=s[n(1576)][n(487)+"e"]===E0,c=e[n(1449)](s[n(1576)][n(487)+"e"],er);if(e[n(306)](!i,!c))return e[n(501)](t);let l=st(s[n(1576)][n(1260)],n(1165)+"ile_name");if(!l)return t();let g=await gs.call(this,l);if(!g)return e[n(1167)](t);if(i){let p=await g.getCursors(),u={frameType:p?.[n(487)+"e"],SeqID:O[n(389)+"er"](this[n(1334)]++),LogID:O.fromNumber(this[n(1107)][n(1796)+n(1317)]()),service:9e3,method:5,headers:p?.[n(1260)],payload:p?.[n(918)]},m=e.fprjb(A,u);this._ws&&this[n(1508)][n(504)+"te"]&&this[n(1508)][n(393)](m)}if(c){let p=s[n(1576)][n(918)];p&&g[n(903)+"rs"](p)}}else return this._ws?this._ws[n(826)+"ns"]:""}let N0=async function(s,t){let n=r;this[n(714)]=!1,e[n(443)](clearTimeout,this[n(1711)+n(1699)+n(1026)]),e[n(780)](t)},R0=async function(s,t){let n=r;if(!this[n(1508)]||e[n(268)](this[n(1508)][n(504)+"te"],this[n(1352)]))return e.ROpuG(t);let{pingInterval:i}=this._options;this["_endpoin"+n(1493)]?.[n(619)+n(1407)+n(546)]();for(let l=0;e.qwikY(l,this["_message"+n(645)][n(1080)]);l++){let g=this[n(929)+n(645)][l];if(e.XSasJ(this._ws[n(504)+"te"],this[n(1352)])&&e[n(1643)](null,g))this._ws&&this._ws[n(393)](g),this[n(929)+"Queue"][l]=null;else break}this._messageQueue=this._messageQueue[n(950)](l=>!!l),this[n(1029)+n(1611)+"Id"]=e[n(843)](setTimeout,()=>this._ping(),i),this["_dispatc"+n(1036)+"nt"](s),this._isBrowser&&this._ws&&(this[n(1508)].binaryType=this[n(1561)+n(1518)]);let c=this["_endpoin"+n(1493)]?.[n(1544)+n(289)+"nt"]();this[n(943)](n(681)+c+" success"),e[n(728)](t)},B0=async function(s,t){let n=r,i=this[n(1505)+n(1493)]?.[n(1544)+"ntEndpoint"]();this[n(943)](n(681)+i),e.jpZjV(t)};class O0 extends Vn{constructor(t){let n=r,i={UDFOi:function(p,u,m,w){return p(u,m,w)},hdIwA:function(p,u){return e[k(1327)](p,u)},WNJoh:"vFBhU",HjtTD:function(p,u,m){return e.Pbcfs(p,u,m)},vHkIu:e.xKkBm,raTbe:function(p,u){return p===u},lTZfm:e[n(909)],wXnCG:n(436),eCeRy:e[n(1072)],wipmx:e[n(1111)],vxdmr:function(p,u,m,w){return e.rJfnZ(p,u,m,w)},gIkfj:function(p,u){return p!==u},SZrjg:function(p,u,m){return p(u,m)},zXIDl:function(p,u){return e.QTEfR(p,u)},CbYpi:function(p,u){return p===u},muTmz:e[n(1120)],fTQZc:function(p,u){return e.pacyh(p,u)},uOQCs:e.TwQEe,eoFRM:e[n(1563)],hgteG:function(p,u,m){return e[n(1539)](p,u,m)},zMsSd:function(p,u){return p===u},ztMAe:n(673),fpilk:function(p,u){return e[n(1195)](p,u)},duQQe:function(p,u,m){return e[n(857)](p,u,m)},SEDRU:function(p,u,m){return e[n(1185)](p,u,m)}};super(),this[n(1235)+n(817)+n(1147)]=!0,this[n(318)+"er"]=rt,this[n(1359)]=$o,this[n(1089)+"T"]=We,this[n(1074)+"X"]=yt,this[n(1152)+"r"]=vt,this[n(929)+n(645)]=[],this[n(1505)+n(1493)]=null,this["_readyCl"+n(424)]=!1,this[n(1561)+n(1518)]=e[n(1582)],this._connectLock=!1,this[n(1711)+n(1699)+n(1026)]=null,this[n(1265)+"ctTimeou"+n(1670)]=null,this[n(1029)+n(1611)+"Id"]=null,this[n(1334)]=0,this._isInit=!1,this[n(836)]="",this[n(1117)+n(1631)]=null,this[n(1065)+"anager"]=null,this[n(896)+"sCounter"]=null,this[n(1249)+"ls"]=n(411),this[n(465)]=3,this[n(1668)+"NG"]=0,this[n(1352)]=1,this[n(709)]=2,this._onOpen=p=>{let u=n;try{i[u(380)](xs,this,p,[N0,R0,B0])}catch(m){if(i[u(433)](u(1243),i.WNJoh))return _0x20f8ae||(_0x860c1=[_0x3f43bb[u(1181)+"e"][u(1332)],_0x461dfa[u(1181)+"e"][u(472)],_0x5cfc12.prototype[u(472)+u(1532)+"ey"]]);{let w=i[u(1245)](oe,i.vHkIu,{message:m.message,code:Me[u(287)+"OR"],error:m});this[u(910)+"hErrorEvent"](w)}}},this[n(1709)+"ge"]=async p=>{let u=n,{pingInterval:m,pingFrequency:w}=this._options;if((i[u(808)]("hi",p[u(496)])&&i[u(808)](i[u(1652)],w)||i[u(341)]===w)&&(this[u(1020)+"ngTimer"](),this[u(926)](i[u(417)],i[u(1657)]),this[u(1029)+u(1611)+"Id"]=setTimeout(this._ping.bind(this),m)),!i[u(433)]("hi",p[u(496)]))try{i.vxdmr(xs,this,p,[l0,u0,T0,I0,L0,d0])}catch(S){if(i.gIkfj(u(700),"NPfJu"))return{bytes:_0x3ecd6a,offset:0,limit:_0x11d0b7[u(1080)]};{let D=i.SZrjg(oe,u(1172),{message:S[u(1576)],code:Me["MESSAGE_"+u(381)],error:S});this[u(910)+u(782)+u(833)](D)}}},this[n(1171)]=p=>{let u=n,m={WeyJB:function(w,S){return i[k(1330)](w,S)},koATi:function(w,S,D,N){return w(S,D,N)}};if(i.CbYpi(i.muTmz,i[u(1042)])){let w=this[u(1505)+"tManager"]?.[u(1489)+u(760)+"es"](),S=this[u(1505)+u(1493)]?.[u(1544)+u(289)+"nt"]();if(w&&!p[u(1576)])if(i[u(562)](i[u(1431)],i[u(522)])){let D="connect "+S+(u(1701)+u(628)+u(1135)+"ed");this[u(910)+u(782)+u(833)](i[u(1242)](oe,i[u(361)],{message:D,code:Me[u(369)+u(547)+"R"],error:p}));return}else return"frontier_"+this[u(752)];this[u(1508)]&&i[u(1401)](this[u(1508)][u(504)+"te"],this.OPEN)&&this[u(1011)+u(879)](),this[u(910)+u(782)+u(833)](i.hgteG(oe,i[u(361)],{message:p[u(1576)],code:Me[u(970)+u(466)],error:p}))}else{let w=new _0x24f94b(dJmrbh[u(1533)](_0x451896,_0x196bba));return dJmrbh.koATi(_0x18b60d,_0x99966a,w,0),w}},this._onClose=async p=>{let u=n;this[u(1257)+u(820)](),this[u(1020)+u(1759)](),this["_removeW"+u(865)+"rs"](),this[u(1508)]=null,this["_connect"+u(872)]=!1;let m=this[u(1505)+"tManager"]?.[u(1489)+"chMaxTries"]();if(!m&&this["_navigat"+u(1597)]()&&!this["_readyCl"+u(424)]){let w=this[u(1505)+u(1493)]?.[u(1544)+"ntEndpoint"](),S=this[u(1107)][u(1737)+u(997)+u(667)](p[u(1394)],p[u(1794)]);this[u(910)+u(1690)+u(833)](i[u(1242)](le,i.ztMAe,{code:1006,reason:p[u(1794)]||"connecti"+u(794)+u(1686)+u(1259)+u(1637)+u(1039)+w,willReconnect:S})),S&&this[u(1711)]();return}if(i[u(339)](1e3,p.code)&&this._readyClosed){if(u(1393)!==u(1393))return this[u(1682)]?.[u(851)]({message_id:_0x35b808,timestamp:_0x20f0fe});this[u(910)+u(1690)+u(833)](i[u(1242)](le,u(673),{code:1e3,reason:u(1595)})),this[u(1505)+u(1493)]?.[u(619)+"pointCon"+u(546)](),this[u(896)+u(984)]?.[u(1517)+u(1400)]();return}if(p[u(1394)]!==1e3&&m){let w=this[u(1505)+"tManager"]?.getCurrentEndpoint(),S=p[u(1794)];S||(S=await i0(this._url)),S=u(1333)+u(794)+u(1568)+S+", hostname: "+w+(u(995)+u(1669)+u(1763)),this[u(910)+"hCloseEvent"](i.duQQe(le,"close",{code:p[u(1394)],reason:S}));let D=u(1041)+w+(" fail, max retri"+u(1135)+"ed");this["_dispatc"+u(782)+"ent"](i[u(1156)](oe,i[u(361)],{message:D,code:Me[u(369)+u(547)+"R"]})),this[u(1505)+"tManager"]?.["resetEnd"+u(1407)+u(546)](),this[u(896)+"sCounter"]?.[u(1517)+u(1400)]();return}if(i[u(562)](1e3,p[u(1394)])&&!p[u(1794)]){let w=this[u(1505)+u(1493)]?.[u(1544)+u(289)+"nt"]();this["_dispatc"+u(1690)+"ent"](i[u(972)](le,i[u(1528)],{code:p[u(1394)],reason:u(1333)+u(794)+u(1686)+u(1259)+"n, hostn"+u(1039)+w})),this[u(1505)+u(1493)]?.[u(619)+"pointCon"+u(546)](),this[u(896)+"sCounter"]?.["resetCou"+u(1400)]();return}this[u(910)+"hCloseEv"+u(833)](p),this[u(1505)+"tManager"]?.["resetEnd"+u(1407)+u(546)](),this[u(896)+u(984)]?.[u(1517)+u(1400)]()},this.onclose=null,this[n(1325)]=null,this[n(1298)+"e"]=null,this[n(1022)]=null,this["onStartR"+n(550)]=null,this[n(348)+n(689)]=null,this[n(994)+n(1705)+n(1378)+"ct"]=null,this[n(314)+"nLine"]=this["_handleO"+n(1025)][n(1538)](this),this[n(314)+n(1750)]=this["_handleO"+n(1750)][n(1538)](this),this[n(1390)+n(1124)]=this[n(1390)+n(1124)].bind(this),this[n(1390)+n(973)]=this[n(1390)+n(973)].bind(this),this._options={url:"",automaticOpen:!0,initReconnectInterval:1e3,maxReconnectInterval:1e4,reconnectIntervalGrowFactor:2,timeoutInterval:5e3,maxRetries:5,debug:!1,maxMessageQueueLength:e[n(390)](1,0),service:0,logIDGenerator:x,headers:void 0,payloadEncoding:"",payloadType:"",fpID:"",deviceID:"",accessKey:"",ttwID:"",bddID:"",aID:"",disableAutoReconnect:!1,customParams:{},pingInterval:15e3,pingTimeoutInterval:4e3,pingFrequency:e[n(1252)],pingLossCount:2,enableTransformTextPayload:!1,logIDNewConfig:{enableAutoGenerateLogIDNew:!1,userIp:""},miniProgramParams:{customHttpHeader:{}},enableAutoAck:!1,reconnectInterceptor:()=>!0,enableQoS:!1,QoSLevel:2,messageStrategy:n(856),env:{xTTEnv:"",xUseEnv:""},listenNetworkChanged:!0};let{url:c,ws:l}=t,g=Array[n(552)](c)?c:e[n(743)](n(500),typeof c)?[c]:[];if(!g||g[n(1080)]===0)throw new Error(e[n(874)]);if(!e[n(430)](t0,l))throw new Error(e.SIMBv);Object[n(1510)](this._options,t),this["_endpoin"+n(1493)]=new as(g,this._options[n(378)+"es"]),this[n(896)+n(984)]=new s0(this[n(1107)]["pingLoss"+n(916)]),this[n(1107)][n(745)+n(765)]&&(this[n(714)]=!0,this[n(1711)]()),this[n(1107)][n(801)+n(908)+n(1469)]&&(this[n(1089)+"T"]||this[n(1074)+"X"]?this[n(1685)+n(729)+"ange"]():this[n(318)+"er"]&&this[n(1197)+n(278)+n(1087)]())}[r(314)+r(1025)](){let t=r;this[t(1107)]["disableA"+t(1477)+t(1470)]||this[t(678)+t(424)]||this[t(1456)+t(550)]()}[r(314)+r(1750)](){let t=r;this[t(777)+"WebSocket"]();let n=Jn(e[t(598)],{message:e.EgLBA});this[t(994)+t(1705)+t(1378)+"ct"]&&this["onStopIm"+t(1705)+t(1378)+"ct"](n)}[r(1197)+r(278)+r(1087)](){let t=r;this[t(318)+"er"]&&window[t(1498)+t(1087)](e[t(274)],this[t(314)+t(1025)]),this[t(318)+"er"]&&window[t(1498)+"Listener"](e[t(1279)],this["_handleO"+t(1750)]),this._isBrowser&&window[t(1498)+"Listener"](e[t(1501)],this[t(1390)+"ageHide"]),this[t(318)+"er"]&&window[t(1498)+t(1087)](e.edenR,this._handlePageShow)}[r(573)+r(278)+"Listener"](){let t=r;this._isBrowser&&window[t(906)+t(455)+t(477)](e.kHmAQ,this["_handleO"+t(1025)]),this._isBrowser&&window[t(906)+t(455)+t(477)](e[t(1279)],this[t(314)+t(1750)]),this[t(318)+"er"]&&window["removeEv"+t(455)+t(477)](e[t(1501)],this[t(1390)+"ageHide"]),this[t(318)+"er"]&&window[t(906)+t(455)+"ner"](e[t(450)],this[t(1390)+t(973)])}["_handleP"+r(1124)](t){let n=r;!t[n(852)+"d"]&&(this[n(318)+"er"]&&window["removeEv"+n(455)+n(477)](n(1638),this[n(1390)+n(1124)]),this[n(318)+"er"]&&window[n(906)+"entListe"+n(477)](e.edenR,this[n(1390)+n(973)]),this.close()),this[n(318)+"er"]&&window["removeEv"+n(455)+n(477)](e[n(274)],this[n(314)+n(1025)]),this[n(318)+"er"]&&window[n(906)+n(455)+n(477)](e[n(1279)],this._handleOffLine)}["_handleP"+r(973)](t){let n=r;t[n(852)+"d"]&&(this[n(1591)+"orOnline"]()&&(!this[n(1508)]||this._ws.readyState!==this[n(1352)]||e.ahYZy(this[n(1508)][n(504)+"te"],this[n(1668)+"NG"]))&&this["_handleO"+n(1025)](),this[n(318)+"er"]&&window[n(1498)+n(1087)](e.kHmAQ,this[n(314)+n(1025)]),this[n(318)+"er"]&&window[n(1498)+"Listener"](e[n(1279)],this[n(314)+n(1750)]))}async[r(715)+"eUrl"](t){let n=r,{fpID:i,deviceID:c,bddID:l,ttwID:g,accessKey:p,aID:u,customParams:m={},enableAutoAck:w,enableQoS:S,QoSLevel:D,env:N}=this[n(1107)],I,ae,ve;this[n(318)+"er"]||this[n(1074)+"X"]||this[n(1089)+"T"]?(I=location&&e[n(743)](e.ktmgy,location[n(1761)])?n(1463):e[n(1367)],ae=t[n(394)](/((^ws)|(^http))((?:[s]*:\/\/))/,""),ve=/^wss(.*:\/\/)/[n(456)](t)?t:""+I+ae):(I="wss://",ae=t[n(394)](/(^http)((?:[s]*:\/\/))/,""),ve=/(^ws)((?:[s]*:\/\/))/[n(456)](ae)?ae:""+I+ae);let ps=l?e.yiEhF:g?e[n(307)]:e[n(1503)],ms=l||g||c;if(e[n(1776)](!ms,!ps))throw new Error(e[n(1219)]);let M0=e[n(1587)]==typeof m?await m():m,z0=N?e.IQpBE(r0,N[n(427)],N[n(1476)]):{},tr=Object.assign({device_platform:e.XTnDq,version_code:e[n(1311)],access_key:p,fpid:i,aid:u,[ps]:ms,xsack:w?1:0,xaack:w?1:0,xsqos:S?1:0,qos_level:S?D:void 0,qos_sdk_version:2,...z0},M0),q0=Object[n(1603)](tr)[n(331)]((nr,rr)=>tr[rr]!==void 0?""+nr+(nr?"&":"?")+rr+"="+tr[rr]:nr,"");return ve+n(1342)+q0}async[r(1711)](){let t=r;if(e[t(404)](e[t(983)],e[t(983)])){if(this[t(1711)+t(872)]||this[t(678)+"osed"])return;this[t(1711)+t(872)]=!0;try{let n=this["_endpoin"+t(1493)]?.[t(620)+t(680)+t(1760)+t(1007)+"tries"](),{timeoutInterval:i}=this._options;if(n){let l=this["_endpoin"+t(1493)]?.[t(1544)+t(289)+"nt"](),g=this[t(1505)+t(1493)]?.["replaceB"+t(656)+"pointAndUpdateCo"+t(1013)](),p=this[t(1505)+t(1493)]?.[t(1544)+t(289)+t(332)+t(839)]();if(g){let u=t(1041)+l+(t(555)+t(995)+t(1669)+"ached, w"+t(408)+"backup e"+t(1616))+g+(t(824)+"y"),m=e[t(1027)](oe,e[t(837)],{message:u,code:Me[t(369)+t(547)+"R"]});this[t(943)](u),this["_dispatc"+t(782)+t(833)](m),this[t(836)]=await this["_generat"+t(1473)](g),this[t(943)](t(1041)+g+" "+p+t(1046)),this[t(1480)+t(865)+"rs"]()}else{let u=t(1041)+l+(" timeout, max re"+t(1669)+t(1763));this[t(943)](u),this[t(910)+"hErrorEv"+t(833)](e.FcEkT(oe,e[t(837)],{message:u,code:Me[t(369)+"IES_ERROR"]}));return}}else{let l=this._endpointManager?.[t(1544)+t(289)+t(1656)+t(1227)](),g=this._endpointManager?.[t(1544)+t(289)+"ntTriesC"+t(839)]();this._url=await this[t(715)+t(1473)](l||""),this[t(943)](t(1041)+l+" "+g+" times"),this[t(1480)+t(865)+"rs"]()}if(this[t(714)])this[t(714)]=!1;else{let l=Jn(e[t(598)],{message:e[t(535)]});this[t(1329)+"econnect"]&&this[t(1329)+t(550)](l)}let c=this["_endpoin"+t(1493)]?.[t(1544)+t(289)+t(332)+"ount"]()||0;c>1&&await this[t(1558)](c-1),this._debug(t(1333)+"ng url: "+this[t(836)]+(" protoco"+t(1154))+this[t(1249)+"ls"]),this[t(1508)]=e[t(1164)](e0,{url:this[t(836)],protocols:[this[t(1249)+"ls"]],headers:this._options.miniProgramParams[t(951)+t(1460)]},this._options.ws),(this._isBrowser||this[t(1152)+"r"])&&this[t(1508)]&&(this[t(1508)][t(357)+"pe"]=this._binaryType),this["_addWsLi"+t(1660)](),this[t(1711)+t(1699)+t(1026)]=e.xXDTn(setTimeout,this._onTimeout.bind(this),i)}catch(n){throw this[t(1711)+t(872)]=!1,n}}else return 0}[r(1257)+r(820)](){let t=r;e[t(1112)](t(1725),e[t(823)])?this[t(926)](e[t(1292)],e.IQpBE(_0x50c416,e[t(1292)],{..._0x413d04})):(e[t(732)](clearTimeout,this[t(1711)+"ionTimeo"+t(1026)]),this._connectionTimeoutId=null)}[r(1020)+r(1759)](){let t=r;if(e[t(1748)]!==e.OFrZF)return _0x412817[t(1627)](t(1464),_0x285b5a,_0x510797,_0x28747f),this._qosDB[t(851)]({cursor_name:_0x4ea9d7,cursor:_0x30845b,service:_0x4735ec});e[t(696)](clearTimeout,this[t(1029)+"gTimeoutId"]),e.MEthH(clearTimeout,this["_reconne"+t(976)+"tId"]),this[t(1029)+t(1611)+"Id"]=null,this[t(1265)+t(976)+t(1670)]=null}[r(943)](...t){let n=r;this[n(1107)].debug&&console[n(1627)][n(655)](console,[e[n(1641)],...t])}[r(708)+r(1486)+"e"](t){let n=r;if(e[n(285)]!==e.PDNCf){let{initReconnectInterval:i,maxReconnectInterval:c,reconnectIntervalGrowFactor:l}=this[n(1107)],g=i*Math[n(749)](l,e[n(491)](t,1));return e[n(479)](g,c)?c:g}else return _0x5c4f04}[r(1397)](){let t=r,n={GPnXy:t(1438)};if(e[t(1060)](e[t(1513)],e[t(602)])){if(this._ws&&e[t(452)](this[t(1508)].readyState,this[t(1668)+"NG"])){this[t(1020)+t(1759)](),this[t(1029)+t(1611)+"Id"]=e[t(1038)](setTimeout,this[t(1397)][t(1538)](this),this[t(1107)][t(694)+t(1594)]);return}if(!this[t(1508)]||e[t(1411)](this[t(1508)][t(504)+"te"],this[t(1352)]))return void this[t(1456)+"econnect"]();this[t(1508)]&&this[t(1508)].send("hi"),this[t(1265)+t(976)+t(1670)]=e[t(1560)](setTimeout,this["_handleR"+t(550)+t(458)][t(1538)](this),this._options.pingTimeoutInterval)}else this._pingLossCounter?.[t(992)](),this.emit(t(310)+t(342)+"t",n[t(971)]),this._pingLossCounter?.[t(1489)+t(705)+"nt"]()?this[t(1456)+t(550)]():this[t(1397)]()}[r(1456)+r(550)+r(458)](){let t=r;this[t(896)+t(984)]?.[t(992)](),this.emit("ping_once_timeout",t(1438)),this[t(896)+t(984)]?.checkReachMaxCount()?this[t(1456)+"econnect"]():this[t(1397)]()}[r(1591)+"orOnline"](){let t=r;return this[t(1089)+"T"]||this[t(1074)+"X"]?this[t(1235)+t(817)+t(1147)]:(this._isBrowser||this[t(1152)+"r"])&&this[t(1107)]["listenNetworkCha"+t(1469)]?navigator[t(1335)]:!0}[r(1456)+r(550)](){let t=r;!this[t(1591)+t(1597)]()||this[t(678)+"osed"]||(this["_endpoin"+t(1493)]?.[t(619)+t(1407)+t(546)](),this[t(896)+t(984)]?.[t(1517)+t(1400)](),this[t(1508)]?this["_disconn"+t(879)](1001,e[t(1579)],!0):this[t(1711)]())}[r(1685)+r(729)+r(615)](){let t=r;this[t(1089)+"T"]?tt["onNetworkStatusC"+t(582)](({isConnected:n})=>{let i=t;this[i(1235)+i(817)+"line"]=n,n?this[i(314)+i(1025)]():this["_handleO"+i(1750)]()}):this._isMiniWX&&wx[t(1623)+t(1155)+t(582)](({isConnected:n})=>{let i=t;this[i(1235)+i(817)+i(1147)]=n,n?this[i(314)+i(1025)]():this["_handleO"+i(1750)]()})}[r(1558)](t){return new Promise(n=>{let i=k;e[i(875)](setTimeout,n,this[i(708)+i(1486)+"e"](t))})}[r(1011)+r(879)](t=1e3,n="",i=!1){let c=r;this[c(1508)]&&this[c(777)+c(1432)+"t"](t,n,i)}[r(1267)+"ut"](){let t=r,n=this._endpointManager?.["getCurre"+t(289)+"nt"]();this[t(943)](t(1041)+n+t(555)),this[t(1011)+t(879)](1001,e[t(542)],!0)}_sendAck(t){let n=r,i=e[n(838)](Wn,t);this[n(1508)]&&e[n(325)](this[n(1508)][n(504)+"te"],this.OPEN)&&(this[n(1508)]&&this._ws.send(i),this[n(943)](e[n(1264)],t))}[r(1480)+r(865)+"rs"](){let t=r;this[t(1508)]&&(this[t(1508)][t(906)+t(455)+t(477)]("open",this._onOpen),this[t(1508)][t(906)+"entListe"+t(477)](t(673),this[t(1372)]),this[t(1508)][t(906)+t(455)+"ner"](e[t(1738)],this[t(1709)+"ge"]),this._ws[t(906)+t(455)+"ner"](e[t(837)],this[t(1171)]))}[r(1200)+r(1660)](){let t=r;if(e[t(1536)](e[t(1211)],t(965)))return this[t(1508)]?this[t(1508)][t(504)+"te"]:this[t(1107)][t(745)+t(765)]?this[t(1668)+"NG"]:this.CLOSED;{let n=e[t(707)][t(862)]("|"),i=0;for(;;){switch(n[i++]){case"0":this._ws[t(1498)+"Listener"]("close",this[t(1372)]);continue;case"1":if(!this[t(1508)])return;continue;case"2":this[t(1508)][t(1498)+"Listener"](e[t(837)],this[t(1171)]);continue;case"3":this[t(1508)]["addEvent"+t(1087)](e[t(601)],this[t(1035)]);continue;case"4":this[t(1508)].addEventListener(e[t(1738)],this._onMessage);continue}break}}}[r(1495)+r(1045)](t=1e3,n=""){let i=r;try{this._ws&&this[i(1508)][i(673)](t,n)}catch{}}[r(777)+r(1432)+"t"](t=1e3,n="",i=!1){let c=r,l={jMgua:function(g,p,u){return e[k(884)](g,p,u)},HLtfV:function(g,p,u){return g(p,u)},CuqFP:function(g,p,u){return e[k(844)](g,p,u)},pKMmp:function(g,p){return e[k(1157)](g,p)}};if(this["_clearPi"+c(1759)](),this._clearTimer(),this[c(1480)+"sListeners"](),this[c(1495)+c(1045)](1e3,n),this[c(1711)+c(872)]=!1,i&&this["_navigat"+c(1597)]()&&!this["_readyCl"+c(424)])if(e[c(544)](e.NFFtL,e[c(473)])){_0x33556c(_0x138d9a,42);let g=_0x1cf59c();XfhCvE[c(569)](_0x432705,_0x3face1,g),XfhCvE.HLtfV(_0x428a68,_0x28b3af,g.limit),XfhCvE[c(483)](_0x470a50,_0x4b5ee0,g),XfhCvE[c(1722)](_0x3a80f5,g)}else{if(this[c(1505)+c(1493)]?.[c(1489)+c(760)+"es"]()){let p=this["_endpoin"+c(1493)]?.[c(1544)+"ntEndpoint"]();this[c(910)+c(1690)+c(833)](le(c(673),{code:1006,reason:"connect "+p+(c(555)+c(995)+c(1669)+"ached"),wasClean:!0}))}else{let p=this._options[c(1737)+c(997)+c(667)](t,n);this[c(910)+c(1690)+"ent"](e.KeoJN(le,e[c(1292)],{code:t,reason:n,wasClean:!0,willReconnect:p})),p&&this[c(1711)]()}return}this[c(1591)+c(1597)]()||this[c(678)+c(424)]?this[c(910)+"hCloseEv"+c(833)](e[c(1437)](le,e[c(1292)],{code:t,reason:e[c(1612)]})):this[c(910)+c(1690)+c(833)](e.iycPf(le,e.ytTYF,{code:1006,reason:e.XEWHY})),this[c(1508)]=null,this._endpointManager?.[c(619)+"pointCon"+c(546)](),this[c(896)+"sCounter"]?.[c(1517)+c(1400)]()}[r(910)+"hOpenEvent"](t){let n=r;if(n(1455)!==e[n(272)])this[n(926)](e[n(601)],t),this.onopen&&this[n(1022)](t);else{let i=this[n(1682)][n(406)+n(703)](this._prefix),c=_0x48db07[n(1361)](e.ZBKUG(i,"{}"));return c[_0x5e023e||_0x46f8d8[this[n(335)]]]=_0x42961e,this[n(1682)][n(636)+n(703)](this._prefix,_0xa194d0[n(683)+"y"](c)),_0x2842c6||_0x556702[this[n(335)]]}}[r(910)+r(398)+"Event"](t){let n=r;this.emit(e[n(1738)],t),this[n(1298)+"e"]&&this[n(1298)+"e"](t)}[r(910)+"hAckMessageEvent"](t){let n=r;this[n(926)](e[n(1659)],t),this[n(348)+n(689)]&&this[n(348)+n(689)](t)}["_dispatc"+r(782)+r(833)](t){let n=r;e[n(409)](n(1083),e[n(1043)])?(this[n(926)](e[n(837)],t),this.onerror&&this[n(1325)](t)):(_0x2ae74d=e.pRgyt(_0x5b4ea8,_0x3ef648),_0x2bb026|=e[n(1639)](127,_0x2961b9)<<21,e[n(930)](128,_0x30f756)&&(_0xe6f615=e[n(467)](_0xbb6812,_0x5d5126),_0x4afde1=127&_0xbbf5f5,e[n(1375)](128,_0x12c915)&&(_0x5177cd=_0x2db20c(_0x4a8ce7),_0x18372f|=e.BqhhS(127&_0x83f344,7))))}["_dispatc"+r(1690)+r(833)](t){let n=r;this[n(926)](e.ytTYF,t),this[n(1189)]&&this[n(1189)](t)}get binaryType(){let t=r;return this[t(1508)]?this[t(1508)].binaryType:this[t(1561)+t(1518)]}set[r(357)+"pe"](t){let n=r;this[n(1561)+n(1518)]=t,this._ws&&(this[n(1508)][n(357)+"pe"]=t)}get retryCount(){let t=r,n={aXvNF:function(i,c){return e[k(400)](i,c)},zovrl:function(i,c){return e[k(1590)](i,c)},ADVJm:function(i,c){return e[k(1740)](i,c)},nHLDF:e.KTZPA,rCLbL:e.ArPbq};if(e[t(1749)](e[t(754)],t(1413)))return this[t(1505)+t(1493)]?.[t(1544)+"ntEndpoi"+t(332)+t(839)]()||0;{let i=_0x59fe5.split(/\./)[t(1349)](g=>_0x5498bd(g)),c=[];return c[0]=OnoABM[t(302)](_0x225577,OnoABM[t(1095)](i[0],i[1])),c[1]=OnoABM[t(302)](_0x3b1af1,OnoABM[t(1765)](i[2],i[3])),[OnoABM.nHLDF,t(775),OnoABM.nHLDF,OnoABM[t(1019)],OnoABM[t(1019)],OnoABM[t(373)],c[0],c[1]][t(868)]("")}}get[r(476)+r(1441)](){let t=r,n=this["_message"+t(645)][t(331)]((i,c)=>(i+=c&&c[t(468)+"th"]||0,i),0);return e[t(931)](n,this._ws?this[t(1508)]["buffered"+t(1441)]:0)}get extensions(){let t=r;return this[t(1508)]?this._ws[t(826)+"ns"]:""}get[r(1761)](){let t=r;return this[t(1508)]?this._ws[t(1761)]:""}get[r(504)+"te"](){let t=r;return this[t(1508)]?this[t(1508)].readyState:this[t(1107)][t(745)+t(765)]?this[t(1668)+"NG"]:this[t(465)]}get[r(716)](){let t=r;return this[t(1508)]?this[t(1508)].url:this[t(836)]}[r(673)](t=1e3,n){let i=r;if(this[i(678)+i(424)]=!0,this["_clearTi"+i(820)](),this[i(1020)+"ngTimer"](),this["_dropGlo"+i(278)+i(1087)](),this["_QoSMana"+i(1631)]?.[i(1497)](),!this[i(1508)])return void this[i(943)](e[i(1755)]);if(e[i(1446)](this[i(1508)][i(504)+"te"],this.CLOSED)||e[i(1481)](this[i(1508)][i(504)+"te"],this.CLOSING))return void this._debug(e[i(593)]);this._destroyWebSocket(t,n)}async[r(393)](t,n){let i=r;if(e.RiCaB(null,t))throw new Error(i(853)+i(947)+i(902)+i(1370)+i(761)+"e a stri"+i(1541)+i(1771)+i(1128));e[i(1205)]("number",typeof t)&&(t=JSON.stringify(t)),e.HrFhT(i(500),typeof t)&&!e.vBGjq(t,ArrayBuffer)&&!(t.buffer&&e.vBGjq(t[i(350)],ArrayBuffer))&&(t=JSON[i(683)+"y"](t));let c=await us(t),l=e[i(1304)](n0,t),{method:g=0,service:p=this[i(1107)][i(781)],logID:u=this[i(1107)][i(1796)+i(1317)](),headers:m=this[i(1107)][i(1260)],payloadEncoding:w=this._options[i(561)+i(1175)],payloadType:S=this[i(1107)][i(996)+i(1518)],logIDNew:D=this._options["logIDNew"+i(1457)][i(772)+i(682)+i(388)+"ew"]?a(this._options[i(1679)+i(1457)][i(1310)]):""}=e.HLbPV(n,{});if(!p)throw new Error(e.fSMut);let N={SeqID:O[i(389)+"er"](this[i(1334)]++),LogID:O[i(389)+"er"](u),service:p,method:g,headers:m,payloadEncoding:e.bpbBB(w,Object)?w[i(536)]?w[i(536)]:"":w,payloadType:e[i(1338)](S,Object)?S[i(284)]?S[i(284)]:l:S||l,payload:c,LogIDNew:D},I=e[i(1159)](Wn,N);return this[i(1508)]&&this._ws[i(504)+"te"]===this[i(1352)]?(this[i(1508)]&&this[i(1508)][i(393)](I),this[i(943)](i(1178),N)):e[i(1068)](this[i(929)+i(645)][i(1080)],this[i(1107)]["maxMessa"+i(1429)+i(1640)])?(this[i(929)+i(645)][i(1290)](I),this[i(943)](e[i(907)],N)):(this[i(929)+"Queue"][i(1732)](),this[i(929)+i(645)][i(1290)](I)),{seqID:this[i(1334)],logID:u,logIDNew:D}}async[r(1737)+"t"](t){let n=r;if(e[n(1103)](n(1548),e[n(959)])){let{url:i}=e[n(1519)](t,{}),c=Array[n(552)](i)?i:e[n(538)](e.tYsmM,typeof i)?[i]:[];t&&Object.assign(this[n(1107)],t),c&&c[n(1080)]?this[n(1505)+n(1493)]=new as(c,this[n(1107)][n(378)+"es"]):this[n(1505)+n(1493)]?.["resetEnd"+n(1407)+n(546)](),this[n(896)+"sCounter"]?.["resetCou"+n(1400)](this[n(1107)][n(921)+"Count"]),this[n(678)+n(424)]=!1,this[n(1508)]&&e[n(596)](this[n(1508)].readyState,this.CLOSED)?this["_disconn"+n(879)](1e3,e[n(1283)],!0):(this[n(714)]=!0,this._connect())}else return _0x5b0dca[n(1288)][_0x467bcb(_0x1af300,1)]}async connect(){let t=r,n={xytDA:e[t(438)],hyusr:function(i,c){return i(c)}};if(e[t(1744)](e[t(1444)],e[t(1444)])){let i=_0x43096b[t(1232)+t(525)](_0x2052a1);return _0x3bf63d&&i.addEventListener(PcGPRs[t(1583)],()=>_0x437fc4()),PcGPRs[t(990)](_0x2f5b2a,i)[t(1471)](()=>{})}else!this[t(1711)+t(872)]&&(this[t(1505)+"tManager"]?.[t(619)+t(1407)+"fig"](),this["_pingLos"+t(984)]?.resetCounter(),this[t(678)+t(424)]=!1,this[t(714)]=!0,this._connect())}[r(1498)+r(1087)](t,n){this.on(t,n)}[r(803)+r(1034)](t){let n=r,{type:i}=t;this[n(926)](i,t)}["removeEv"+r(455)+"ner"](t,n){this[r(870)](t,n)}[r(1676)](){let t=r,n={odVpw:e.ZmFdx,SEQMC:e[t(1072)],riVvZ:e[t(1783)],lDhpH:e[t(1475)]};return new Promise((i,c)=>{let l=t,g={PfnBv:n[l(405)],HiyZM:n[l(608)],vccpd:n[l(474)],Fdpxa:n[l(1033)]};this[l(1020)+l(1759)](),this[l(1029)+l(1611)+"Id"]=setTimeout(this[l(1397)][l(1538)](this),this[l(1107)][l(694)+l(1594)]);let p=()=>{let m=l;i(g[m(367)]),this.off(g[m(863)],p),this[m(870)](g[m(873)],u)},u=()=>{let m=l;c(g[m(1651)]),this.off(m(310)+m(445)+"s",p),this[m(870)](g.vccpd,u)};this.on(n[l(608)],p),this.on(n.riVvZ,u),this._ping()})}}})(),X[E(1490)+E(383)]=J[E(1490)+"oseEvent"],X[E(1169)+E(385)]=J.CustomErrorEvent,X[E(434)+"e"]=J[E(434)+"e"],X.Event=J[E(1034)],X[E(1016)]=J.FWS,X[E(1001)+E(1286)+E(848)]=J[E(1001)+E(1286)+"vent"],X[E(1286)+E(848)]=J["MessageE"+E(848)],X.OpenEvent=J[E(842)+"t"],X[E(564)+"tEvent"]=J[E(564)+E(337)],X[E(1355)+"oseEvent"]=J[E(1355)+E(383)],X[E(1665)+E(385)]=J[E(1665)+E(385)],X[E(1322)+E(1186)+"nt"]=J[E(1322)+E(1186)+"nt"],X[E(494)+E(1555)]=J[E(494)+E(1555)],X["createRe"+E(575)+E(848)]=J["createRe"+E(575)+E(848)],X[E(1753)+E(935)]=J["decodedF"+E(935)],X["encodeFr"+E(1084)]=J[E(283)+E(1084)];for(dn in J)["CustomCl"+E(383),E(1169)+"rorEvent",E(434)+"e",E(1034),E(1016),E(1001)+E(1286)+E(848),E(1286)+"vent",E(842)+"t","Reconnec"+E(337),E(1355)+"oseEvent",E(1665)+E(385),E(1322)+E(1186)+"nt","createOpenEvent",E(702)+E(575)+E(848),E(1753)+E(935),E(283)+E(1084)][E(1081)](dn)===-1&&(X[dn]=J[dn]);var dn;Object["definePr"+E(877)](X,"__esModule",{value:!0})});var Ie=re((xl,di)=>{"use strict";var fi=["nodebuffer","arraybuffer","fragments"],ui=typeof Blob<"u";ui&&fi.push("blob");di.exports={BINARY_TYPES:fi,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:ui,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var Lt=re((cl,wn)=>{"use strict";var{EMPTY_BUFFER:Ax}=Ie(),lr=Buffer[Symbol.species];function kx(r,e){if(r.length===0)return Ax;if(r.length===1)return r[0];let o=Buffer.allocUnsafe(e),a=0;for(let x=0;x<r.length;x++){let f=r[x];o.set(f,a),a+=f.length}return a<e?new lr(o.buffer,o.byteOffset,a):o}function li(r,e,o,a,x){for(let f=0;f<x;f++)o[a+f]=r[f]^e[f&3]}function hi(r,e){for(let o=0;o<r.length;o++)r[o]^=e[o&3]}function Dx(r){return r.length===r.buffer.byteLength?r.buffer:r.buffer.slice(r.byteOffset,r.byteOffset+r.length)}function hr(r){if(hr.readOnly=!0,Buffer.isBuffer(r))return r;let e;return r instanceof ArrayBuffer?e=new lr(r):ArrayBuffer.isView(r)?e=new lr(r.buffer,r.byteOffset,r.byteLength):(e=Buffer.from(r),hr.readOnly=!1),e}wn.exports={concat:kx,mask:li,toArrayBuffer:Dx,toBuffer:hr,unmask:hi};if(!process.env.WS_NO_BUFFER_UTIL)try{let r=W("bufferutil");wn.exports.mask=function(e,o,a,x,f){f<48?li(e,o,a,x,f):r.mask(e,o,a,x,f)},wn.exports.unmask=function(e,o){e.length<32?hi(e,o):r.unmask(e,o)}}catch{}});var mi=re((fl,pi)=>{"use strict";var gi=Symbol("kDone"),gr=Symbol("kRun"),pr=class{constructor(e){this[gi]=()=>{this.pending--,this[gr]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[gr]()}[gr](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[gi])}}};pi.exports=pr});var dt=re((ul,vi)=>{"use strict";var Tt=W("zlib"),_i=Lt(),Px=mi(),{kStatusCode:wi}=Ie(),Lx=Buffer[Symbol.species],Tx=Buffer.from([0,0,255,255]),vn=Symbol("permessage-deflate"),Ne=Symbol("total-length"),ft=Symbol("callback"),Ke=Symbol("buffers"),ut=Symbol("error"),yn,mr=class{constructor(e){if(this._options=e||{},this._threshold=this._options.threshold!==void 0?this._options.threshold:1024,this._maxPayload=this._options.maxPayload|0,this._isServer=!!this._options.isServer,this._deflate=null,this._inflate=null,this.params=null,!yn){let o=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;yn=new Px(o)}}static get extensionName(){return"permessage-deflate"}offer(){let e={};return this._options.serverNoContextTakeover&&(e.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(e.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(e.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?e.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits==null&&(e.client_max_window_bits=!0),e}accept(e){return e=this.normalizeParams(e),this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){let e=this._deflate[ft];this._deflate.close(),this._deflate=null,e&&e(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(e){let o=this._options,a=e.find(x=>!(o.serverNoContextTakeover===!1&&x.server_no_context_takeover||x.server_max_window_bits&&(o.serverMaxWindowBits===!1||typeof o.serverMaxWindowBits=="number"&&o.serverMaxWindowBits>x.server_max_window_bits)||typeof o.clientMaxWindowBits=="number"&&!x.client_max_window_bits));if(!a)throw new Error("None of the extension offers can be accepted");return o.serverNoContextTakeover&&(a.server_no_context_takeover=!0),o.clientNoContextTakeover&&(a.client_no_context_takeover=!0),typeof o.serverMaxWindowBits=="number"&&(a.server_max_window_bits=o.serverMaxWindowBits),typeof o.clientMaxWindowBits=="number"?a.client_max_window_bits=o.clientMaxWindowBits:(a.client_max_window_bits===!0||o.clientMaxWindowBits===!1)&&delete a.client_max_window_bits,a}acceptAsClient(e){let o=e[0];if(this._options.clientNoContextTakeover===!1&&o.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(!o.client_max_window_bits)typeof this._options.clientMaxWindowBits=="number"&&(o.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits=="number"&&o.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"');return o}normalizeParams(e){return e.forEach(o=>{Object.keys(o).forEach(a=>{let x=o[a];if(x.length>1)throw new Error(`Parameter "${a}" must have only a single value`);if(x=x[0],a==="client_max_window_bits"){if(x!==!0){let f=+x;if(!Number.isInteger(f)||f<8||f>15)throw new TypeError(`Invalid value for parameter "${a}": ${x}`);x=f}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${a}": ${x}`)}else if(a==="server_max_window_bits"){let f=+x;if(!Number.isInteger(f)||f<8||f>15)throw new TypeError(`Invalid value for parameter "${a}": ${x}`);x=f}else if(a==="client_no_context_takeover"||a==="server_no_context_takeover"){if(x!==!0)throw new TypeError(`Invalid value for parameter "${a}": ${x}`)}else throw new Error(`Unknown parameter "${a}"`);o[a]=x})}),e}decompress(e,o,a){yn.add(x=>{this._decompress(e,o,(f,d)=>{x(),a(f,d)})})}compress(e,o,a){yn.add(x=>{this._compress(e,o,(f,d)=>{x(),a(f,d)})})}_decompress(e,o,a){let x=this._isServer?"client":"server";if(!this._inflate){let f=`${x}_max_window_bits`,d=typeof this.params[f]!="number"?Tt.Z_DEFAULT_WINDOWBITS:this.params[f];this._inflate=Tt.createInflateRaw({...this._options.zlibInflateOptions,windowBits:d}),this._inflate[vn]=this,this._inflate[Ne]=0,this._inflate[Ke]=[],this._inflate.on("error",Nx),this._inflate.on("data",yi)}this._inflate[ft]=a,this._inflate.write(e),o&&this._inflate.write(Tx),this._inflate.flush(()=>{let f=this._inflate[ut];if(f){this._inflate.close(),this._inflate=null,a(f);return}let d=_i.concat(this._inflate[Ke],this._inflate[Ne]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[Ne]=0,this._inflate[Ke]=[],o&&this.params[`${x}_no_context_takeover`]&&this._inflate.reset()),a(null,d)})}_compress(e,o,a){let x=this._isServer?"server":"client";if(!this._deflate){let f=`${x}_max_window_bits`,d=typeof this.params[f]!="number"?Tt.Z_DEFAULT_WINDOWBITS:this.params[f];this._deflate=Tt.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:d}),this._deflate[Ne]=0,this._deflate[Ke]=[],this._deflate.on("data",Ix)}this._deflate[ft]=a,this._deflate.write(e),this._deflate.flush(Tt.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let f=_i.concat(this._deflate[Ke],this._deflate[Ne]);o&&(f=new Lx(f.buffer,f.byteOffset,f.length-4)),this._deflate[ft]=null,this._deflate[Ne]=0,this._deflate[Ke]=[],o&&this.params[`${x}_no_context_takeover`]&&this._deflate.reset(),a(null,f)})}};vi.exports=mr;function Ix(r){this[Ke].push(r),this[Ne]+=r.length}function yi(r){if(this[Ne]+=r.length,this[vn]._maxPayload<1||this[Ne]<=this[vn]._maxPayload){this[Ke].push(r);return}this[ut]=new RangeError("Max payload size exceeded"),this[ut].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[ut][wi]=1009,this.removeListener("data",yi),this.reset()}function Nx(r){if(this[vn]._inflate=null,this[ut]){this[ft](this[ut]);return}r[wi]=1007,this[ft](r)}});var lt=re((dl,bn)=>{"use strict";var{isUtf8:bi}=W("buffer"),{hasBlob:Rx}=Ie(),Bx=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function Ox(r){return r>=1e3&&r<=1014&&r!==1004&&r!==1005&&r!==1006||r>=3e3&&r<=4999}function _r(r){let e=r.length,o=0;for(;o<e;)if((r[o]&128)===0)o++;else if((r[o]&224)===192){if(o+1===e||(r[o+1]&192)!==128||(r[o]&254)===192)return!1;o+=2}else if((r[o]&240)===224){if(o+2>=e||(r[o+1]&192)!==128||(r[o+2]&192)!==128||r[o]===224&&(r[o+1]&224)===128||r[o]===237&&(r[o+1]&224)===160)return!1;o+=3}else if((r[o]&248)===240){if(o+3>=e||(r[o+1]&192)!==128||(r[o+2]&192)!==128||(r[o+3]&192)!==128||r[o]===240&&(r[o+1]&240)===128||r[o]===244&&r[o+1]>143||r[o]>244)return!1;o+=4}else return!1;return!0}function Mx(r){return Rx&&typeof r=="object"&&typeof r.arrayBuffer=="function"&&typeof r.type=="string"&&typeof r.stream=="function"&&(r[Symbol.toStringTag]==="Blob"||r[Symbol.toStringTag]==="File")}bn.exports={isBlob:Mx,isValidStatusCode:Ox,isValidUTF8:_r,tokenChars:Bx};if(bi)bn.exports.isValidUTF8=function(r){return r.length<24?_r(r):bi(r)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let r=W("utf-8-validate");bn.exports.isValidUTF8=function(e){return e.length<32?_r(e):r(e)}}catch{}});var Sr=re((ll,Pi)=>{"use strict";var{Writable:zx}=W("stream"),Si=dt(),{BINARY_TYPES:qx,EMPTY_BUFFER:Ei,kStatusCode:Fx,kWebSocket:Ux}=Ie(),{concat:wr,toArrayBuffer:Kx,unmask:Hx}=Lt(),{isValidStatusCode:Gx,isValidUTF8:Ci}=lt(),Sn=Buffer[Symbol.species],fe=0,Ai=1,ki=2,Di=3,yr=4,vr=5,En=6,br=class extends zx{constructor(e={}){super(),this._allowSynchronousEvents=e.allowSynchronousEvents!==void 0?e.allowSynchronousEvents:!0,this._binaryType=e.binaryType||qx[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxPayload=e.maxPayload|0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[Ux]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=fe}_write(e,o,a){if(this._opcode===8&&this._state==fe)return a();this._bufferedBytes+=e.length,this._buffers.push(e),this.startLoop(a)}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){let a=this._buffers[0];return this._buffers[0]=new Sn(a.buffer,a.byteOffset+e,a.length-e),new Sn(a.buffer,a.byteOffset,e)}let o=Buffer.allocUnsafe(e);do{let a=this._buffers[0],x=o.length-e;e>=a.length?o.set(this._buffers.shift(),x):(o.set(new Uint8Array(a.buffer,a.byteOffset,e),x),this._buffers[0]=new Sn(a.buffer,a.byteOffset+e,a.length-e)),e-=a.length}while(e>0);return o}startLoop(e){this._loop=!0;do switch(this._state){case fe:this.getInfo(e);break;case Ai:this.getPayloadLength16(e);break;case ki:this.getPayloadLength64(e);break;case Di:this.getMask();break;case yr:this.getData(e);break;case vr:case En:this._loop=!1;return}while(this._loop);this._errored||e()}getInfo(e){if(this._bufferedBytes<2){this._loop=!1;return}let o=this.consume(2);if((o[0]&48)!==0){let x=this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");e(x);return}let a=(o[0]&64)===64;if(a&&!this._extensions[Si.extensionName]){let x=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(x);return}if(this._fin=(o[0]&128)===128,this._opcode=o[0]&15,this._payloadLength=o[1]&127,this._opcode===0){if(a){let x=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(x);return}if(!this._fragmented){let x=this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");e(x);return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){let x=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");e(x);return}this._compressed=a}else if(this._opcode>7&&this._opcode<11){if(!this._fin){let x=this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");e(x);return}if(a){let x=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(x);return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){let x=this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");e(x);return}}else{let x=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");e(x);return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(o[1]&128)===128,this._isServer){if(!this._masked){let x=this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK");e(x);return}}else if(this._masked){let x=this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");e(x);return}this._payloadLength===126?this._state=Ai:this._payloadLength===127?this._state=ki:this.haveLength(e)}getPayloadLength16(e){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(e)}getPayloadLength64(e){if(this._bufferedBytes<8){this._loop=!1;return}let o=this.consume(8),a=o.readUInt32BE(0);if(a>Math.pow(2,21)-1){let x=this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");e(x);return}this._payloadLength=a*Math.pow(2,32)+o.readUInt32BE(4),this.haveLength(e)}haveLength(e){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)){let o=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");e(o);return}this._masked?this._state=Di:this._state=yr}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=yr}getData(e){let o=Ei;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}o=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0&&Hx(o,this._mask)}if(this._opcode>7){this.controlMessage(o,e);return}if(this._compressed){this._state=vr,this.decompress(o,e);return}o.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(o)),this.dataMessage(e)}decompress(e,o){this._extensions[Si.extensionName].decompress(e,this._fin,(x,f)=>{if(x)return o(x);if(f.length){if(this._messageLength+=f.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let d=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");o(d);return}this._fragments.push(f)}this.dataMessage(o),this._state===fe&&this.startLoop(o)})}dataMessage(e){if(!this._fin){this._state=fe;return}let o=this._messageLength,a=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let x;this._binaryType==="nodebuffer"?x=wr(a,o):this._binaryType==="arraybuffer"?x=Kx(wr(a,o)):this._binaryType==="blob"?x=new Blob(a):x=a,this._allowSynchronousEvents?(this.emit("message",x,!0),this._state=fe):(this._state=En,setImmediate(()=>{this.emit("message",x,!0),this._state=fe,this.startLoop(e)}))}else{let x=wr(a,o);if(!this._skipUTF8Validation&&!Ci(x)){let f=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");e(f);return}this._state===vr||this._allowSynchronousEvents?(this.emit("message",x,!1),this._state=fe):(this._state=En,setImmediate(()=>{this.emit("message",x,!1),this._state=fe,this.startLoop(e)}))}}controlMessage(e,o){if(this._opcode===8){if(e.length===0)this._loop=!1,this.emit("conclude",1005,Ei),this.end();else{let a=e.readUInt16BE(0);if(!Gx(a)){let f=this.createError(RangeError,`invalid status code ${a}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");o(f);return}let x=new Sn(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!Ci(x)){let f=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");o(f);return}this._loop=!1,this.emit("conclude",a,x),this.end()}this._state=fe;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?"ping":"pong",e),this._state=fe):(this._state=En,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",e),this._state=fe,this.startLoop(o)}))}createError(e,o,a,x,f){this._loop=!1,this._errored=!0;let d=new e(a?`Invalid WebSocket frame: ${o}`:o);return Error.captureStackTrace(d,this.createError),d.code=f,d[Fx]=x,d}};Pi.exports=br});var Ar=re((gl,Ii)=>{"use strict";var{Duplex:hl}=W("stream"),{randomFillSync:jx}=W("crypto"),Li=dt(),{EMPTY_BUFFER:Wx,kWebSocket:Jx,NOOP:Vx}=Ie(),{isBlob:ht,isValidStatusCode:Xx}=lt(),{mask:Ti,toBuffer:Xe}=Lt(),ue=Symbol("kByteLength"),Yx=Buffer.alloc(4),Cn=8*1024,Ye,gt=Cn,ge=0,Zx=1,$x=2,Er=class r{constructor(e,o,a){this._extensions=o||{},a&&(this._generateMask=a,this._maskBuffer=Buffer.alloc(4)),this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=ge,this.onerror=Vx,this[Jx]=void 0}static frame(e,o){let a,x=!1,f=2,d=!1;o.mask&&(a=o.maskBuffer||Yx,o.generateMask?o.generateMask(a):(gt===Cn&&(Ye===void 0&&(Ye=Buffer.alloc(Cn)),jx(Ye,0,Cn),gt=0),a[0]=Ye[gt++],a[1]=Ye[gt++],a[2]=Ye[gt++],a[3]=Ye[gt++]),d=(a[0]|a[1]|a[2]|a[3])===0,f=6);let h;typeof e=="string"?(!o.mask||d)&&o[ue]!==void 0?h=o[ue]:(e=Buffer.from(e),h=e.length):(h=e.length,x=o.mask&&o.readOnly&&!d);let _=h;h>=65536?(f+=8,_=127):h>125&&(f+=2,_=126);let v=Buffer.allocUnsafe(x?h+f:f);return v[0]=o.fin?o.opcode|128:o.opcode,o.rsv1&&(v[0]|=64),v[1]=_,_===126?v.writeUInt16BE(h,2):_===127&&(v[2]=v[3]=0,v.writeUIntBE(h,4,6)),o.mask?(v[1]|=128,v[f-4]=a[0],v[f-3]=a[1],v[f-2]=a[2],v[f-1]=a[3],d?[v,e]:x?(Ti(e,a,v,f,h),[v]):(Ti(e,a,e,0,h),[v,e])):[v,e]}close(e,o,a,x){let f;if(e===void 0)f=Wx;else{if(typeof e!="number"||!Xx(e))throw new TypeError("First argument must be a valid error code number");if(o===void 0||!o.length)f=Buffer.allocUnsafe(2),f.writeUInt16BE(e,0);else{let h=Buffer.byteLength(o);if(h>123)throw new RangeError("The message must not be greater than 123 bytes");f=Buffer.allocUnsafe(2+h),f.writeUInt16BE(e,0),typeof o=="string"?f.write(o,2):f.set(o,2)}}let d={[ue]:f.length,fin:!0,generateMask:this._generateMask,mask:a,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state!==ge?this.enqueue([this.dispatch,f,!1,d,x]):this.sendFrame(r.frame(f,d),x)}ping(e,o,a){let x,f;if(typeof e=="string"?(x=Buffer.byteLength(e),f=!1):ht(e)?(x=e.size,f=!1):(e=Xe(e),x=e.length,f=Xe.readOnly),x>125)throw new RangeError("The data size must not be greater than 125 bytes");let d={[ue]:x,fin:!0,generateMask:this._generateMask,mask:o,maskBuffer:this._maskBuffer,opcode:9,readOnly:f,rsv1:!1};ht(e)?this._state!==ge?this.enqueue([this.getBlobData,e,!1,d,a]):this.getBlobData(e,!1,d,a):this._state!==ge?this.enqueue([this.dispatch,e,!1,d,a]):this.sendFrame(r.frame(e,d),a)}pong(e,o,a){let x,f;if(typeof e=="string"?(x=Buffer.byteLength(e),f=!1):ht(e)?(x=e.size,f=!1):(e=Xe(e),x=e.length,f=Xe.readOnly),x>125)throw new RangeError("The data size must not be greater than 125 bytes");let d={[ue]:x,fin:!0,generateMask:this._generateMask,mask:o,maskBuffer:this._maskBuffer,opcode:10,readOnly:f,rsv1:!1};ht(e)?this._state!==ge?this.enqueue([this.getBlobData,e,!1,d,a]):this.getBlobData(e,!1,d,a):this._state!==ge?this.enqueue([this.dispatch,e,!1,d,a]):this.sendFrame(r.frame(e,d),a)}send(e,o,a){let x=this._extensions[Li.extensionName],f=o.binary?2:1,d=o.compress,h,_;typeof e=="string"?(h=Buffer.byteLength(e),_=!1):ht(e)?(h=e.size,_=!1):(e=Xe(e),h=e.length,_=Xe.readOnly),this._firstFragment?(this._firstFragment=!1,d&&x&&x.params[x._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(d=h>=x._threshold),this._compress=d):(d=!1,f=0),o.fin&&(this._firstFragment=!0);let v={[ue]:h,fin:o.fin,generateMask:this._generateMask,mask:o.mask,maskBuffer:this._maskBuffer,opcode:f,readOnly:_,rsv1:d};ht(e)?this._state!==ge?this.enqueue([this.getBlobData,e,this._compress,v,a]):this.getBlobData(e,this._compress,v,a):this._state!==ge?this.enqueue([this.dispatch,e,this._compress,v,a]):this.dispatch(e,this._compress,v,a)}getBlobData(e,o,a,x){this._bufferedBytes+=a[ue],this._state=$x,e.arrayBuffer().then(f=>{if(this._socket.destroyed){let h=new Error("The socket was closed while the blob was being read");process.nextTick(Cr,this,h,x);return}this._bufferedBytes-=a[ue];let d=Xe(f);o?this.dispatch(d,o,a,x):(this._state=ge,this.sendFrame(r.frame(d,a),x),this.dequeue())}).catch(f=>{process.nextTick(Qx,this,f,x)})}dispatch(e,o,a,x){if(!o){this.sendFrame(r.frame(e,a),x);return}let f=this._extensions[Li.extensionName];this._bufferedBytes+=a[ue],this._state=Zx,f.compress(e,a.fin,(d,h)=>{if(this._socket.destroyed){let _=new Error("The socket was closed while data was being compressed");Cr(this,_,x);return}this._bufferedBytes-=a[ue],this._state=ge,a.readOnly=!1,this.sendFrame(r.frame(h,a),x),this.dequeue()})}dequeue(){for(;this._state===ge&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[3][ue],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][ue],this._queue.push(e)}sendFrame(e,o){e.length===2?(this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],o),this._socket.uncork()):this._socket.write(e[0],o)}};Ii.exports=Er;function Cr(r,e,o){typeof o=="function"&&o(e);for(let a=0;a<r._queue.length;a++){let x=r._queue[a],f=x[x.length-1];typeof f=="function"&&f(e)}}function Qx(r,e,o){Cr(r,e,o),r.onerror(e)}});var Ui=re((pl,Fi)=>{"use strict";var{kForOnEventAttribute:It,kListener:kr}=Ie(),Ni=Symbol("kCode"),Ri=Symbol("kData"),Bi=Symbol("kError"),Oi=Symbol("kMessage"),Mi=Symbol("kReason"),pt=Symbol("kTarget"),zi=Symbol("kType"),qi=Symbol("kWasClean"),Re=class{constructor(e){this[pt]=null,this[zi]=e}get target(){return this[pt]}get type(){return this[zi]}};Object.defineProperty(Re.prototype,"target",{enumerable:!0});Object.defineProperty(Re.prototype,"type",{enumerable:!0});var Ze=class extends Re{constructor(e,o={}){super(e),this[Ni]=o.code===void 0?0:o.code,this[Mi]=o.reason===void 0?"":o.reason,this[qi]=o.wasClean===void 0?!1:o.wasClean}get code(){return this[Ni]}get reason(){return this[Mi]}get wasClean(){return this[qi]}};Object.defineProperty(Ze.prototype,"code",{enumerable:!0});Object.defineProperty(Ze.prototype,"reason",{enumerable:!0});Object.defineProperty(Ze.prototype,"wasClean",{enumerable:!0});var mt=class extends Re{constructor(e,o={}){super(e),this[Bi]=o.error===void 0?null:o.error,this[Oi]=o.message===void 0?"":o.message}get error(){return this[Bi]}get message(){return this[Oi]}};Object.defineProperty(mt.prototype,"error",{enumerable:!0});Object.defineProperty(mt.prototype,"message",{enumerable:!0});var Nt=class extends Re{constructor(e,o={}){super(e),this[Ri]=o.data===void 0?null:o.data}get data(){return this[Ri]}};Object.defineProperty(Nt.prototype,"data",{enumerable:!0});var ec={addEventListener(r,e,o={}){for(let x of this.listeners(r))if(!o[It]&&x[kr]===e&&!x[It])return;let a;if(r==="message")a=function(f,d){let h=new Nt("message",{data:d?f:f.toString()});h[pt]=this,An(e,this,h)};else if(r==="close")a=function(f,d){let h=new Ze("close",{code:f,reason:d.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});h[pt]=this,An(e,this,h)};else if(r==="error")a=function(f){let d=new mt("error",{error:f,message:f.message});d[pt]=this,An(e,this,d)};else if(r==="open")a=function(){let f=new Re("open");f[pt]=this,An(e,this,f)};else return;a[It]=!!o[It],a[kr]=e,o.once?this.once(r,a):this.on(r,a)},removeEventListener(r,e){for(let o of this.listeners(r))if(o[kr]===e&&!o[It]){this.removeListener(r,o);break}}};Fi.exports={CloseEvent:Ze,ErrorEvent:mt,Event:Re,EventTarget:ec,MessageEvent:Nt};function An(r,e,o){typeof r=="object"&&r.handleEvent?r.handleEvent.call(r,o):r.call(e,o)}});var kn=re((ml,Ki)=>{"use strict";var{tokenChars:Rt}=lt();function Ce(r,e,o){r[e]===void 0?r[e]=[o]:r[e].push(o)}function tc(r){let e=Object.create(null),o=Object.create(null),a=!1,x=!1,f=!1,d,h,_=-1,v=-1,b=-1,y=0;for(;y<r.length;y++)if(v=r.charCodeAt(y),d===void 0)if(b===-1&&Rt[v]===1)_===-1&&(_=y);else if(y!==0&&(v===32||v===9))b===-1&&_!==-1&&(b=y);else if(v===59||v===44){if(_===-1)throw new SyntaxError(`Unexpected character at index ${y}`);b===-1&&(b=y);let L=r.slice(_,b);v===44?(Ce(e,L,o),o=Object.create(null)):d=L,_=b=-1}else throw new SyntaxError(`Unexpected character at index ${y}`);else if(h===void 0)if(b===-1&&Rt[v]===1)_===-1&&(_=y);else if(v===32||v===9)b===-1&&_!==-1&&(b=y);else if(v===59||v===44){if(_===-1)throw new SyntaxError(`Unexpected character at index ${y}`);b===-1&&(b=y),Ce(o,r.slice(_,b),!0),v===44&&(Ce(e,d,o),o=Object.create(null),d=void 0),_=b=-1}else if(v===61&&_!==-1&&b===-1)h=r.slice(_,y),_=b=-1;else throw new SyntaxError(`Unexpected character at index ${y}`);else if(x){if(Rt[v]!==1)throw new SyntaxError(`Unexpected character at index ${y}`);_===-1?_=y:a||(a=!0),x=!1}else if(f)if(Rt[v]===1)_===-1&&(_=y);else if(v===34&&_!==-1)f=!1,b=y;else if(v===92)x=!0;else throw new SyntaxError(`Unexpected character at index ${y}`);else if(v===34&&r.charCodeAt(y-1)===61)f=!0;else if(b===-1&&Rt[v]===1)_===-1&&(_=y);else if(_!==-1&&(v===32||v===9))b===-1&&(b=y);else if(v===59||v===44){if(_===-1)throw new SyntaxError(`Unexpected character at index ${y}`);b===-1&&(b=y);let L=r.slice(_,b);a&&(L=L.replace(/\\/g,""),a=!1),Ce(o,h,L),v===44&&(Ce(e,d,o),o=Object.create(null),d=void 0),h=void 0,_=b=-1}else throw new SyntaxError(`Unexpected character at index ${y}`);if(_===-1||f||v===32||v===9)throw new SyntaxError("Unexpected end of input");b===-1&&(b=y);let A=r.slice(_,b);return d===void 0?Ce(e,A,o):(h===void 0?Ce(o,A,!0):a?Ce(o,h,A.replace(/\\/g,"")):Ce(o,h,A),Ce(e,d,o)),e}function nc(r){return Object.keys(r).map(e=>{let o=r[e];return Array.isArray(o)||(o=[o]),o.map(a=>[e].concat(Object.keys(a).map(x=>{let f=a[x];return Array.isArray(f)||(f=[f]),f.map(d=>d===!0?x:`${x}=${d}`).join("; ")})).join("; ")).join(", ")}).join(", ")}Ki.exports={format:nc,parse:tc}});var Tn=re((yl,eo)=>{"use strict";var rc=W("events"),sc=W("https"),ic=W("http"),ji=W("net"),oc=W("tls"),{randomBytes:ac,createHash:xc}=W("crypto"),{Duplex:_l,Readable:wl}=W("stream"),{URL:Dr}=W("url"),He=dt(),cc=Sr(),fc=Ar(),{isBlob:uc}=lt(),{BINARY_TYPES:Hi,CLOSE_TIMEOUT:dc,EMPTY_BUFFER:Dn,GUID:lc,kForOnEventAttribute:Pr,kListener:hc,kStatusCode:gc,kWebSocket:Y,NOOP:Wi}=Ie(),{EventTarget:{addEventListener:pc,removeEventListener:mc}}=Ui(),{format:_c,parse:wc}=kn(),{toBuffer:yc}=Lt(),Ji=Symbol("kAborted"),Lr=[8,13],Be=["CONNECTING","OPEN","CLOSING","CLOSED"],vc=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,F=class r extends rc{constructor(e,o,a){super(),this._binaryType=Hi[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=Dn,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol="",this._readyState=r.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,e!==null?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,o===void 0?o=[]:Array.isArray(o)||(typeof o=="object"&&o!==null?(a=o,o=[]):o=[o]),Vi(this,e,o,a)):(this._autoPong=a.autoPong,this._closeTimeout=a.closeTimeout,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(e){Hi.includes(e)&&(this._binaryType=e,this._receiver&&(this._receiver._binaryType=e))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(e,o,a){let x=new cc({allowSynchronousEvents:a.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:a.maxPayload,skipUTF8Validation:a.skipUTF8Validation}),f=new fc(e,this._extensions,a.generateMask);this._receiver=x,this._sender=f,this._socket=e,x[Y]=this,f[Y]=this,e[Y]=this,x.on("conclude",Ec),x.on("drain",Cc),x.on("error",Ac),x.on("message",kc),x.on("ping",Dc),x.on("pong",Pc),f.onerror=Lc,e.setTimeout&&e.setTimeout(0),e.setNoDelay&&e.setNoDelay(),o.length>0&&e.unshift(o),e.on("close",Zi),e.on("data",Ln),e.on("end",$i),e.on("error",Qi),this._readyState=r.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=r.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[He.extensionName]&&this._extensions[He.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=r.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(e,o){if(this.readyState!==r.CLOSED){if(this.readyState===r.CONNECTING){ie(this,this._req,"WebSocket was closed before the connection was established");return}if(this.readyState===r.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=r.CLOSING,this._sender.close(e,o,!this._isServer,a=>{a||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),Yi(this)}}pause(){this.readyState===r.CONNECTING||this.readyState===r.CLOSED||(this._paused=!0,this._socket.pause())}ping(e,o,a){if(this.readyState===r.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(a=e,e=o=void 0):typeof o=="function"&&(a=o,o=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==r.OPEN){Tr(this,e,a);return}o===void 0&&(o=!this._isServer),this._sender.ping(e||Dn,o,a)}pong(e,o,a){if(this.readyState===r.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(a=e,e=o=void 0):typeof o=="function"&&(a=o,o=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==r.OPEN){Tr(this,e,a);return}o===void 0&&(o=!this._isServer),this._sender.pong(e||Dn,o,a)}resume(){this.readyState===r.CONNECTING||this.readyState===r.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(e,o,a){if(this.readyState===r.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof o=="function"&&(a=o,o={}),typeof e=="number"&&(e=e.toString()),this.readyState!==r.OPEN){Tr(this,e,a);return}let x={binary:typeof e!="string",mask:!this._isServer,compress:!0,fin:!0,...o};this._extensions[He.extensionName]||(x.compress=!1),this._sender.send(e||Dn,x,a)}terminate(){if(this.readyState!==r.CLOSED){if(this.readyState===r.CONNECTING){ie(this,this._req,"WebSocket was closed before the connection was established");return}this._socket&&(this._readyState=r.CLOSING,this._socket.destroy())}}};Object.defineProperty(F,"CONNECTING",{enumerable:!0,value:Be.indexOf("CONNECTING")});Object.defineProperty(F.prototype,"CONNECTING",{enumerable:!0,value:Be.indexOf("CONNECTING")});Object.defineProperty(F,"OPEN",{enumerable:!0,value:Be.indexOf("OPEN")});Object.defineProperty(F.prototype,"OPEN",{enumerable:!0,value:Be.indexOf("OPEN")});Object.defineProperty(F,"CLOSING",{enumerable:!0,value:Be.indexOf("CLOSING")});Object.defineProperty(F.prototype,"CLOSING",{enumerable:!0,value:Be.indexOf("CLOSING")});Object.defineProperty(F,"CLOSED",{enumerable:!0,value:Be.indexOf("CLOSED")});Object.defineProperty(F.prototype,"CLOSED",{enumerable:!0,value:Be.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(r=>{Object.defineProperty(F.prototype,r,{enumerable:!0})});["open","error","close","message"].forEach(r=>{Object.defineProperty(F.prototype,`on${r}`,{enumerable:!0,get(){for(let e of this.listeners(r))if(e[Pr])return e[hc];return null},set(e){for(let o of this.listeners(r))if(o[Pr]){this.removeListener(r,o);break}typeof e=="function"&&this.addEventListener(r,e,{[Pr]:!0})}})});F.prototype.addEventListener=pc;F.prototype.removeEventListener=mc;eo.exports=F;function Vi(r,e,o,a){let x={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:dc,protocolVersion:Lr[1],maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...a,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(r._autoPong=x.autoPong,r._closeTimeout=x.closeTimeout,!Lr.includes(x.protocolVersion))throw new RangeError(`Unsupported protocol version: ${x.protocolVersion} (supported versions: ${Lr.join(", ")})`);let f;if(e instanceof Dr)f=e;else try{f=new Dr(e)}catch{throw new SyntaxError(`Invalid URL: ${e}`)}f.protocol==="http:"?f.protocol="ws:":f.protocol==="https:"&&(f.protocol="wss:"),r._url=f.href;let d=f.protocol==="wss:",h=f.protocol==="ws+unix:",_;if(f.protocol!=="ws:"&&!d&&!h?_=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:h&&!f.pathname?_="The URL's pathname is empty":f.hash&&(_="The URL contains a fragment identifier"),_){let R=new SyntaxError(_);if(r._redirects===0)throw R;Pn(r,R);return}let v=d?443:80,b=ac(16).toString("base64"),y=d?sc.request:ic.request,A=new Set,L;if(x.createConnection=x.createConnection||(d?Sc:bc),x.defaultPort=x.defaultPort||v,x.port=f.port||v,x.host=f.hostname.startsWith("[")?f.hostname.slice(1,-1):f.hostname,x.headers={...x.headers,"Sec-WebSocket-Version":x.protocolVersion,"Sec-WebSocket-Key":b,Connection:"Upgrade",Upgrade:"websocket"},x.path=f.pathname+f.search,x.timeout=x.handshakeTimeout,x.perMessageDeflate&&(L=new He({...x.perMessageDeflate,isServer:!1,maxPayload:x.maxPayload}),x.headers["Sec-WebSocket-Extensions"]=_c({[He.extensionName]:L.offer()})),o.length){for(let R of o){if(typeof R!="string"||!vc.test(R)||A.has(R))throw new SyntaxError("An invalid or duplicated subprotocol was specified");A.add(R)}x.headers["Sec-WebSocket-Protocol"]=o.join(",")}if(x.origin&&(x.protocolVersion<13?x.headers["Sec-WebSocket-Origin"]=x.origin:x.headers.Origin=x.origin),(f.username||f.password)&&(x.auth=`${f.username}:${f.password}`),h){let R=x.path.split(":");x.socketPath=R[0],x.path=R[1]}let T;if(x.followRedirects){if(r._redirects===0){r._originalIpc=h,r._originalSecure=d,r._originalHostOrSocketPath=h?x.socketPath:f.host;let R=a&&a.headers;if(a={...a,headers:{}},R)for(let[U,$]of Object.entries(R))a.headers[U.toLowerCase()]=$}else if(r.listenerCount("redirect")===0){let R=h?r._originalIpc?x.socketPath===r._originalHostOrSocketPath:!1:r._originalIpc?!1:f.host===r._originalHostOrSocketPath;(!R||r._originalSecure&&!d)&&(delete x.headers.authorization,delete x.headers.cookie,R||delete x.headers.host,x.auth=void 0)}x.auth&&!a.headers.authorization&&(a.headers.authorization="Basic "+Buffer.from(x.auth).toString("base64")),T=r._req=y(x),r._redirects&&r.emit("redirect",r.url,T)}else T=r._req=y(x);x.timeout&&T.on("timeout",()=>{ie(r,T,"Opening handshake has timed out")}),T.on("error",R=>{T===null||T[Ji]||(T=r._req=null,Pn(r,R))}),T.on("response",R=>{let U=R.headers.location,$=R.statusCode;if(U&&x.followRedirects&&$>=300&&$<400){if(++r._redirects>x.maxRedirects){ie(r,T,"Maximum redirects exceeded");return}T.abort();let te;try{te=new Dr(U,e)}catch{let P=new SyntaxError(`Invalid URL: ${U}`);Pn(r,P);return}Vi(r,te,o,a)}else r.emit("unexpected-response",T,R)||ie(r,T,`Unexpected server response: ${R.statusCode}`)}),T.on("upgrade",(R,U,$)=>{if(r.emit("upgrade",R),r.readyState!==F.CONNECTING)return;T=r._req=null;let te=R.headers.upgrade;if(te===void 0||te.toLowerCase()!=="websocket"){ie(r,U,"Invalid Upgrade header");return}let Ae=xc("sha1").update(b+lc).digest("base64");if(R.headers["sec-websocket-accept"]!==Ae){ie(r,U,"Invalid Sec-WebSocket-Accept header");return}let P=R.headers["sec-websocket-protocol"],z;if(P!==void 0?A.size?A.has(P)||(z="Server sent an invalid subprotocol"):z="Server sent a subprotocol but none was requested":A.size&&(z="Server sent no subprotocol"),z){ie(r,U,z);return}P&&(r._protocol=P);let Z=R.headers["sec-websocket-extensions"];if(Z!==void 0){if(!L){ie(r,U,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let pe;try{pe=wc(Z)}catch{ie(r,U,"Invalid Sec-WebSocket-Extensions header");return}let ke=Object.keys(pe);if(ke.length!==1||ke[0]!==He.extensionName){ie(r,U,"Server indicated an extension that was not requested");return}try{L.accept(pe[He.extensionName])}catch{ie(r,U,"Invalid Sec-WebSocket-Extensions header");return}r._extensions[He.extensionName]=L}r.setSocket(U,$,{allowSynchronousEvents:x.allowSynchronousEvents,generateMask:x.generateMask,maxPayload:x.maxPayload,skipUTF8Validation:x.skipUTF8Validation})}),x.finishRequest?x.finishRequest(T,r):T.end()}function Pn(r,e){r._readyState=F.CLOSING,r._errorEmitted=!0,r.emit("error",e),r.emitClose()}function bc(r){return r.path=r.socketPath,ji.connect(r)}function Sc(r){return r.path=void 0,!r.servername&&r.servername!==""&&(r.servername=ji.isIP(r.host)?"":r.host),oc.connect(r)}function ie(r,e,o){r._readyState=F.CLOSING;let a=new Error(o);Error.captureStackTrace(a,ie),e.setHeader?(e[Ji]=!0,e.abort(),e.socket&&!e.socket.destroyed&&e.socket.destroy(),process.nextTick(Pn,r,a)):(e.destroy(a),e.once("error",r.emit.bind(r,"error")),e.once("close",r.emitClose.bind(r)))}function Tr(r,e,o){if(e){let a=uc(e)?e.size:yc(e).length;r._socket?r._sender._bufferedBytes+=a:r._bufferedAmount+=a}if(o){let a=new Error(`WebSocket is not open: readyState ${r.readyState} (${Be[r.readyState]})`);process.nextTick(o,a)}}function Ec(r,e){let o=this[Y];o._closeFrameReceived=!0,o._closeMessage=e,o._closeCode=r,o._socket[Y]!==void 0&&(o._socket.removeListener("data",Ln),process.nextTick(Xi,o._socket),r===1005?o.close():o.close(r,e))}function Cc(){let r=this[Y];r.isPaused||r._socket.resume()}function Ac(r){let e=this[Y];e._socket[Y]!==void 0&&(e._socket.removeListener("data",Ln),process.nextTick(Xi,e._socket),e.close(r[gc])),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",r))}function Gi(){this[Y].emitClose()}function kc(r,e){this[Y].emit("message",r,e)}function Dc(r){let e=this[Y];e._autoPong&&e.pong(r,!this._isServer,Wi),e.emit("ping",r)}function Pc(r){this[Y].emit("pong",r)}function Xi(r){r.resume()}function Lc(r){let e=this[Y];e.readyState!==F.CLOSED&&(e.readyState===F.OPEN&&(e._readyState=F.CLOSING,Yi(e)),this._socket.end(),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",r)))}function Yi(r){r._closeTimer=setTimeout(r._socket.destroy.bind(r._socket),r._closeTimeout)}function Zi(){let r=this[Y];if(this.removeListener("close",Zi),this.removeListener("data",Ln),this.removeListener("end",$i),r._readyState=F.CLOSING,!this._readableState.endEmitted&&!r._closeFrameReceived&&!r._receiver._writableState.errorEmitted&&this._readableState.length!==0){let e=this.read(this._readableState.length);r._receiver.write(e)}r._receiver.end(),this[Y]=void 0,clearTimeout(r._closeTimer),r._receiver._writableState.finished||r._receiver._writableState.errorEmitted?r.emitClose():(r._receiver.on("error",Gi),r._receiver.on("finish",Gi))}function Ln(r){this[Y]._receiver.write(r)||this.pause()}function $i(){let r=this[Y];r._readyState=F.CLOSING,r._receiver.end(),this.end()}function Qi(){let r=this[Y];this.removeListener("error",Qi),this.on("error",Wi),r&&(r._readyState=F.CLOSING,this.destroy())}});var so=re((bl,ro)=>{"use strict";var vl=Tn(),{Duplex:Tc}=W("stream");function to(r){r.emit("close")}function Ic(){!this.destroyed&&this._writableState.finished&&this.destroy()}function no(r){this.removeListener("error",no),this.destroy(),this.listenerCount("error")===0&&this.emit("error",r)}function Nc(r,e){let o=!0,a=new Tc({...e,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return r.on("message",function(f,d){let h=!d&&a._readableState.objectMode?f.toString():f;a.push(h)||r.pause()}),r.once("error",function(f){a.destroyed||(o=!1,a.destroy(f))}),r.once("close",function(){a.destroyed||a.push(null)}),a._destroy=function(x,f){if(r.readyState===r.CLOSED){f(x),process.nextTick(to,a);return}let d=!1;r.once("error",function(_){d=!0,f(_)}),r.once("close",function(){d||f(x),process.nextTick(to,a)}),o&&r.terminate()},a._final=function(x){if(r.readyState===r.CONNECTING){r.once("open",function(){a._final(x)});return}r._socket!==null&&(r._socket._writableState.finished?(x(),a._readableState.endEmitted&&a.destroy()):(r._socket.once("finish",function(){x()}),r.close()))},a._read=function(){r.isPaused&&r.resume()},a._write=function(x,f,d){if(r.readyState===r.CONNECTING){r.once("open",function(){a._write(x,f,d)});return}r.send(x,d)},a.on("end",Ic),a.on("error",no),a}ro.exports=Nc});var Ir=re((Sl,io)=>{"use strict";var{tokenChars:Rc}=lt();function Bc(r){let e=new Set,o=-1,a=-1,x=0;for(x;x<r.length;x++){let d=r.charCodeAt(x);if(a===-1&&Rc[d]===1)o===-1&&(o=x);else if(x!==0&&(d===32||d===9))a===-1&&o!==-1&&(a=x);else if(d===44){if(o===-1)throw new SyntaxError(`Unexpected character at index ${x}`);a===-1&&(a=x);let h=r.slice(o,a);if(e.has(h))throw new SyntaxError(`The "${h}" subprotocol is duplicated`);e.add(h),o=a=-1}else throw new SyntaxError(`Unexpected character at index ${x}`)}if(o===-1||a!==-1)throw new SyntaxError("Unexpected end of input");let f=r.slice(o,x);if(e.has(f))throw new SyntaxError(`The "${f}" subprotocol is duplicated`);return e.add(f),e}io.exports={parse:Bc}});var lo=re((Cl,uo)=>{"use strict";var Oc=W("events"),In=W("http"),{Duplex:El}=W("stream"),{createHash:Mc}=W("crypto"),oo=kn(),$e=dt(),zc=Ir(),qc=Tn(),{CLOSE_TIMEOUT:Fc,GUID:Uc,kWebSocket:Kc}=Ie(),Hc=/^[+/0-9A-Za-z]{22}==$/,ao=0,xo=1,fo=2,Nr=class extends Oc{constructor(e,o){if(super(),e={allowSynchronousEvents:!0,autoPong:!0,maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:Fc,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:qc,...e},e.port==null&&!e.server&&!e.noServer||e.port!=null&&(e.server||e.noServer)||e.server&&e.noServer)throw new TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(e.port!=null?(this._server=In.createServer((a,x)=>{let f=In.STATUS_CODES[426];x.writeHead(426,{"Content-Length":f.length,"Content-Type":"text/plain"}),x.end(f)}),this._server.listen(e.port,e.host,e.backlog,o)):e.server&&(this._server=e.server),this._server){let a=this.emit.bind(this,"connection");this._removeListeners=Gc(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(x,f,d)=>{this.handleUpgrade(x,f,d,a)}})}e.perMessageDeflate===!0&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=ao}address(){if(this.options.noServer)throw new Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(e){if(this._state===fo){e&&this.once("close",()=>{e(new Error("The server is not running"))}),process.nextTick(Bt,this);return}if(e&&this.once("close",e),this._state!==xo)if(this._state=xo,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients?this.clients.size?this._shouldEmitClose=!0:process.nextTick(Bt,this):process.nextTick(Bt,this);else{let o=this._server;this._removeListeners(),this._removeListeners=this._server=null,o.close(()=>{Bt(this)})}}shouldHandle(e){if(this.options.path){let o=e.url.indexOf("?");if((o!==-1?e.url.slice(0,o):e.url)!==this.options.path)return!1}return!0}handleUpgrade(e,o,a,x){o.on("error",co);let f=e.headers["sec-websocket-key"],d=e.headers.upgrade,h=+e.headers["sec-websocket-version"];if(e.method!=="GET"){Qe(this,e,o,405,"Invalid HTTP method");return}if(d===void 0||d.toLowerCase()!=="websocket"){Qe(this,e,o,400,"Invalid Upgrade header");return}if(f===void 0||!Hc.test(f)){Qe(this,e,o,400,"Missing or invalid Sec-WebSocket-Key header");return}if(h!==13&&h!==8){Qe(this,e,o,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});return}if(!this.shouldHandle(e)){Ot(o,400);return}let _=e.headers["sec-websocket-protocol"],v=new Set;if(_!==void 0)try{v=zc.parse(_)}catch{Qe(this,e,o,400,"Invalid Sec-WebSocket-Protocol header");return}let b=e.headers["sec-websocket-extensions"],y={};if(this.options.perMessageDeflate&&b!==void 0){let A=new $e({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let L=oo.parse(b);L[$e.extensionName]&&(A.accept(L[$e.extensionName]),y[$e.extensionName]=A)}catch{Qe(this,e,o,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let A={origin:e.headers[`${h===8?"sec-websocket-origin":"origin"}`],secure:!!(e.socket.authorized||e.socket.encrypted),req:e};if(this.options.verifyClient.length===2){this.options.verifyClient(A,(L,T,R,U)=>{if(!L)return Ot(o,T||401,R,U);this.completeUpgrade(y,f,v,e,o,a,x)});return}if(!this.options.verifyClient(A))return Ot(o,401)}this.completeUpgrade(y,f,v,e,o,a,x)}completeUpgrade(e,o,a,x,f,d,h){if(!f.readable||!f.writable)return f.destroy();if(f[Kc])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>ao)return Ot(f,503);let v=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${Mc("sha1").update(o+Uc).digest("base64")}`],b=new this.options.WebSocket(null,void 0,this.options);if(a.size){let y=this.options.handleProtocols?this.options.handleProtocols(a,x):a.values().next().value;y&&(v.push(`Sec-WebSocket-Protocol: ${y}`),b._protocol=y)}if(e[$e.extensionName]){let y=e[$e.extensionName].params,A=oo.format({[$e.extensionName]:[y]});v.push(`Sec-WebSocket-Extensions: ${A}`),b._extensions=e}this.emit("headers",v,x),f.write(v.concat(`\r
12
12
  `).join(`\r
13
- `)),f.removeListener("error",ao),w.setSocket(f,d,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(w),w.on("close",()=>{this.clients.delete(w),this._shouldEmitClose&&!this.clients.size&&process.nextTick(Mt,this)})),g(w,x)}};co.exports=Nr;function Bc(r,e){for(let o of Object.keys(e))r.on(o,e[o]);return function(){for(let a of Object.keys(e))r.removeListener(a,e[a])}}function Mt(r){r._state=xo,r.emit("close")}function ao(){this.destroy()}function Rt(r,e,o,a){o=o||Ln.STATUS_CODES[e],a={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(o),...a},r.once("finish",r.destroy),r.end(`HTTP/1.1 ${e} ${Ln.STATUS_CODES[e]}\r
13
+ `)),f.removeListener("error",co),b.setSocket(f,d,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(b),b.on("close",()=>{this.clients.delete(b),this._shouldEmitClose&&!this.clients.size&&process.nextTick(Bt,this)})),h(b,x)}};uo.exports=Nr;function Gc(r,e){for(let o of Object.keys(e))r.on(o,e[o]);return function(){for(let a of Object.keys(e))r.removeListener(a,e[a])}}function Bt(r){r._state=fo,r.emit("close")}function co(){this.destroy()}function Ot(r,e,o,a){o=o||In.STATUS_CODES[e],a={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(o),...a},r.once("finish",r.destroy),r.end(`HTTP/1.1 ${e} ${In.STATUS_CODES[e]}\r
14
14
  `+Object.keys(a).map(x=>`${x}: ${a[x]}`).join(`\r
15
15
  `)+`\r
16
16
  \r
17
- `+o)}function Ze(r,e,o,a,x,f){if(r.listenerCount("wsClientError")){let d=new Error(x);Error.captureStackTrace(d,Ze),r.emit("wsClientError",d,o,e)}else Rt(o,a,x,f)}});import{spawn as xf}from"node:child_process";import{existsSync as cf,openSync as ff}from"node:fs";import{mkdir as uf}from"node:fs/promises";import{dirname as df}from"node:path";import{fileURLToPath as lf}from"node:url";function Or(r=U()){return cf(r.libEntry)?r.libEntry:lf(new URL("../index.ts",import.meta.url))}async function Lo(r={}){let e=r.paths??U(),o=r.entryOverride??Or(e);await uf(df(e.logFile),{recursive:!0});let a=ff(e.logFile,"a"),f=o.endsWith(".ts")?["--import","tsx/esm",o,"--daemon"]:[o,"--daemon"],d=xf(process.execPath,f,{detached:!0,stdio:["ignore",a,a],env:{...process.env,COZE_BRIDGE_DAEMON:"1"}});if(d.unref(),typeof d.pid!="number")throw new Error("failed to spawn daemon (no pid)");return hf.info("daemon spawned",{pid:d.pid,entry:o}),{pid:d.pid,entry:o}}var hf,Br=De(()=>{"use strict";F();ce();hf=M("spawn-daemon")});import{spawn as vf}from"node:child_process";import{mkdir as Sf,unlink as Cf,writeFile as Ef}from"node:fs/promises";import{dirname as Af,join as kf}from"node:path";function Fn(r){return r.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function Bo(r,e){return new Promise((o,a)=>{let x=vf(r,e,{stdio:["ignore","pipe","pipe"]}),f="";x.stderr?.on("data",d=>{f+=d.toString("utf8")}),x.on("error",a),x.on("close",d=>{d===0?o():a(new Error(`${r} ${e.join(" ")} exited ${d}: ${f.trim()}`))})})}var qn,Fr,Ur,zo=De(()=>{"use strict";F();qn=M("supervisor.launchd"),Fr="ai.coze.bridge",Ur={platform:"darwin",renderConfig(r){return`<?xml version="1.0" encoding="UTF-8"?>
17
+ `+o)}function Qe(r,e,o,a,x,f){if(r.listenerCount("wsClientError")){let d=new Error(x);Error.captureStackTrace(d,Qe),r.emit("wsClientError",d,o,e)}else Ot(o,a,x,f)}});import{spawn as gf}from"node:child_process";import{existsSync as pf,openSync as mf}from"node:fs";import{mkdir as _f}from"node:fs/promises";import{dirname as wf}from"node:path";import{fileURLToPath as yf}from"node:url";function Or(r=H()){return pf(r.libEntry)?r.libEntry:yf(new URL("../index.ts",import.meta.url))}async function Bo(r={}){let e=r.paths??H(),o=r.entryOverride??Or(e);await _f(wf(e.logFile),{recursive:!0});let a=mf(e.logFile,"a"),f=o.endsWith(".ts")?["--import","tsx/esm",o,"--daemon"]:[o,"--daemon"],d=gf(process.execPath,f,{detached:!0,stdio:["ignore",a,a],env:{...process.env,COZE_BRIDGE_DAEMON:"1"}});if(d.unref(),typeof d.pid!="number")throw new Error("failed to spawn daemon (no pid)");return vf.info("daemon spawned",{pid:d.pid,entry:o}),{pid:d.pid,entry:o}}var vf,Mr=De(()=>{"use strict";K();se();vf=B("spawn-daemon")});import{spawn as Pf}from"node:child_process";import{mkdir as Lf,unlink as Tf,writeFile as If}from"node:fs/promises";import{dirname as Nf,join as Rf}from"node:path";function Fn(r){return r.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function Fo(r,e){return new Promise((o,a)=>{let x=Pf(r,e,{stdio:["ignore","pipe","pipe"]}),f="";x.stderr?.on("data",d=>{f+=d.toString("utf8")}),x.on("error",a),x.on("close",d=>{d===0?o():a(new Error(`${r} ${e.join(" ")} exited ${d}: ${f.trim()}`))})})}var qn,Fr,Ur,Uo=De(()=>{"use strict";K();qn=B("supervisor.launchd"),Fr="ai.coze.bridge",Ur={platform:"darwin",renderConfig(r){return`<?xml version="1.0" encoding="UTF-8"?>
18
18
  <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
19
19
  <plist version="1.0">
20
20
  <dict>
@@ -38,7 +38,7 @@ var B0=Object.create;var sr=Object.defineProperty;var z0=Object.getOwnPropertyDe
38
38
  <string>${Fn(r.logFile)}</string>
39
39
  </dict>
40
40
  </plist>
41
- `},configPath(r){return kf(r.homeDir,"Library","LaunchAgents",`${Fr}.plist`)},async install(r){let e=this.configPath(r);await Sf(Af(e),{recursive:!0}),await Ef(e,this.renderConfig(r),"utf8"),qn.info("plist written",{plistPath:e}),await Bo("launchctl",["load","-w",e]),qn.info("launchd job loaded",{label:Fr})},async uninstall(r){let e=this.configPath(r);await Bo("launchctl",["unload","-w",e]).catch(o=>qn.warn("launchctl unload failed (ignored)",{err:String(o)})),await Cf(e).catch(o=>{if(o.code!=="ENOENT")throw o}),qn.info("launchd job removed",{plistPath:e})}}});import{spawn as Df}from"node:child_process";import{mkdir as Pf,unlink as If,writeFile as Tf}from"node:fs/promises";import{dirname as Lf,join as Nf}from"node:path";function Kn(r,e){return new Promise((o,a)=>{let x=Df(r,e,{stdio:["ignore","pipe","pipe"]}),f="";x.stderr?.on("data",d=>{f+=d.toString("utf8")}),x.on("error",a),x.on("close",d=>{d===0?o():a(new Error(`${r} ${e.join(" ")} exited ${d}: ${f.trim()}`))})})}var Un,Hn,Hr,qo=De(()=>{"use strict";F();Un=M("supervisor.systemd"),Hn="coze-bridge.service",Hr={platform:"linux",renderConfig(r){return`[Unit]
41
+ `},configPath(r){return Rf(r.homeDir,"Library","LaunchAgents",`${Fr}.plist`)},async install(r){let e=this.configPath(r);await Lf(Nf(e),{recursive:!0}),await If(e,this.renderConfig(r),"utf8"),qn.info("plist written",{plistPath:e}),await Fo("launchctl",["load","-w",e]),qn.info("launchd job loaded",{label:Fr})},async uninstall(r){let e=this.configPath(r);await Fo("launchctl",["unload","-w",e]).catch(o=>qn.warn("launchctl unload failed (ignored)",{err:String(o)})),await Tf(e).catch(o=>{if(o.code!=="ENOENT")throw o}),qn.info("launchd job removed",{plistPath:e})}}});import{spawn as Bf}from"node:child_process";import{mkdir as Of,unlink as Mf,writeFile as zf}from"node:fs/promises";import{dirname as qf,join as Ff}from"node:path";function Hn(r,e){return new Promise((o,a)=>{let x=Bf(r,e,{stdio:["ignore","pipe","pipe"]}),f="";x.stderr?.on("data",d=>{f+=d.toString("utf8")}),x.on("error",a),x.on("close",d=>{d===0?o():a(new Error(`${r} ${e.join(" ")} exited ${d}: ${f.trim()}`))})})}var Un,Kn,Kr,Ko=De(()=>{"use strict";K();Un=B("supervisor.systemd"),Kn="coze-bridge.service",Kr={platform:"linux",renderConfig(r){return`[Unit]
42
42
  Description=Coze Bridge daemon
43
43
  After=network.target
44
44
 
@@ -52,7 +52,7 @@ StandardError=append:${r.logFile}
52
52
 
53
53
  [Install]
54
54
  WantedBy=default.target
55
- `},configPath(r){return Nf(r.homeDir,".config","systemd","user",Hn)},async install(r){let e=this.configPath(r);await Pf(Lf(e),{recursive:!0}),await Tf(e,this.renderConfig(r),"utf8"),Un.info("systemd unit written",{unitPath:e}),await Kn("systemctl",["--user","daemon-reload"]),await Kn("systemctl",["--user","enable","--now",Hn]),Un.info("systemd unit enabled",{unitName:Hn})},async uninstall(r){let e=this.configPath(r);await Kn("systemctl",["--user","disable","--now",Hn]).catch(o=>Un.warn("systemctl disable failed (ignored)",{err:String(o)})),await If(e).catch(o=>{if(o.code!=="ENOENT")throw o}),await Kn("systemctl",["--user","daemon-reload"]).catch(()=>{}),Un.info("systemd unit removed",{unitPath:e})}}});import{spawn as Mf}from"node:child_process";import{join as Rf}from"node:path";function Fo(r,e){return new Promise((o,a)=>{let x=Mf(r,e,{stdio:["ignore","pipe","pipe"],shell:!1}),f="";x.stderr?.on("data",d=>{f+=d.toString("utf8")}),x.on("error",a),x.on("close",d=>{d===0?o():a(new Error(`${r} ${e.join(" ")} exited ${d}: ${f.trim()}`))})})}var Kr,jn,jr,Uo=De(()=>{"use strict";F();Kr=M("supervisor.taskscheduler"),jn="CozeBridge",jr={platform:"win32",renderConfig(r){return`<?xml version="1.0" encoding="UTF-16"?>
55
+ `},configPath(r){return Ff(r.homeDir,".config","systemd","user",Kn)},async install(r){let e=this.configPath(r);await Of(qf(e),{recursive:!0}),await zf(e,this.renderConfig(r),"utf8"),Un.info("systemd unit written",{unitPath:e}),await Hn("systemctl",["--user","daemon-reload"]),await Hn("systemctl",["--user","enable","--now",Kn]),Un.info("systemd unit enabled",{unitName:Kn})},async uninstall(r){let e=this.configPath(r);await Hn("systemctl",["--user","disable","--now",Kn]).catch(o=>Un.warn("systemctl disable failed (ignored)",{err:String(o)})),await Mf(e).catch(o=>{if(o.code!=="ENOENT")throw o}),await Hn("systemctl",["--user","daemon-reload"]).catch(()=>{}),Un.info("systemd unit removed",{unitPath:e})}}});import{spawn as Uf}from"node:child_process";import{join as Kf}from"node:path";function Ho(r,e){return new Promise((o,a)=>{let x=Uf(r,e,{stdio:["ignore","pipe","pipe"],shell:!1}),f="";x.stderr?.on("data",d=>{f+=d.toString("utf8")}),x.on("error",a),x.on("close",d=>{d===0?o():a(new Error(`${r} ${e.join(" ")} exited ${d}: ${f.trim()}`))})})}var Hr,Gn,Gr,Go=De(()=>{"use strict";K();Hr=B("supervisor.taskscheduler"),Gn="CozeBridge",Gr={platform:"win32",renderConfig(r){return`<?xml version="1.0" encoding="UTF-16"?>
56
56
  <Task version="1.2" xmlns="http://schemas.microsoft.com/windows/2004/02/mit/task">
57
57
  <RegistrationInfo>
58
58
  <Description>Coze Bridge daemon</Description>
@@ -76,7 +76,7 @@ WantedBy=default.target
76
76
  </Exec>
77
77
  </Actions>
78
78
  </Task>
79
- `},configPath(r){return Rf(r.homeDir,".coze","bridge","task.xml")},async install(r){let e=`"${r.nodeBin}" "${r.entry}" --daemon`;await Fo("schtasks",["/Create","/SC","ONLOGON","/TN",jn,"/TR",e,"/RU",r.userName,"/F"]),Kr.info("task scheduler entry created",{task:jn})},async uninstall(r){await Fo("schtasks",["/Delete","/TN",jn,"/F"]).catch(e=>Kr.warn("schtasks /Delete failed (ignored)",{err:String(e)})),Kr.info("task scheduler entry removed",{task:jn})}}});var Wr={};ms(Wr,{buildContext:()=>qf,getSupervisor:()=>zf,launchdSupervisor:()=>Ur,systemdSupervisor:()=>Hr,taskSchedulerSupervisor:()=>jr});import{homedir as Of,userInfo as Bf}from"node:os";function zf(r=process.platform){switch(r){case"darwin":return Ur;case"linux":return Hr;case"win32":return jr;default:throw new Error(`unsupported platform for OS supervisor: ${r}`)}}function qf(){let r=U();return{nodeBin:process.execPath,entry:Or(r),logFile:r.logFile,homeDir:Of(),userName:Bf().username}}var Gr=De(()=>{"use strict";ce();Br();zo();qo();Uo()});Fe();F();import{readdir as ia}from"node:fs/promises";import{mkdir as ea,writeFile as ta}from"node:fs/promises";import{join as na}from"node:path";var ra={"claude-code":"CLAUDE.md",codex:"AGENTS.md",openclaw:"SOUL.md"};async function Ge(r,e,o,a){await ea(r,{recursive:!0});let x=ra[e],f=na(r,x),d=sa(e,o,a);return await ta(f,d,"utf8"),f}function sa(r,e,o){let a=`# Coze Agent: ${e}
79
+ `},configPath(r){return Kf(r.homeDir,".coze","bridge","task.xml")},async install(r){let e=`"${r.nodeBin}" "${r.entry}" --daemon`;await Ho("schtasks",["/Create","/SC","ONLOGON","/TN",Gn,"/TR",e,"/RU",r.userName,"/F"]),Hr.info("task scheduler entry created",{task:Gn})},async uninstall(r){await Ho("schtasks",["/Delete","/TN",Gn,"/F"]).catch(e=>Hr.warn("schtasks /Delete failed (ignored)",{err:String(e)})),Hr.info("task scheduler entry removed",{task:Gn})}}});var jr={};_s(jr,{buildContext:()=>Wf,getSupervisor:()=>jf,launchdSupervisor:()=>Ur,systemdSupervisor:()=>Kr,taskSchedulerSupervisor:()=>Gr});import{homedir as Hf,userInfo as Gf}from"node:os";function jf(r=process.platform){switch(r){case"darwin":return Ur;case"linux":return Kr;case"win32":return Gr;default:throw new Error(`unsupported platform for OS supervisor: ${r}`)}}function Wf(){let r=H();return{nodeBin:process.execPath,entry:Or(r),logFile:r.logFile,homeDir:Hf(),userName:Gf().username}}var Wr=De(()=>{"use strict";se();Mr();Uo();Ko();Go()});qe();K();import{readdir as aa}from"node:fs/promises";import{mkdir as na,writeFile as ra}from"node:fs/promises";import{join as sa}from"node:path";var ia={"claude-code":"CLAUDE.md",codex:"AGENTS.md",openclaw:"SOUL.md"};async function it(r,e,o,a){await na(r,{recursive:!0});let x=ia[e],f=sa(r,x),d=oa(e,o,a);return await ra(f,d,"utf8"),f}function oa(r,e,o){let a=`# Coze Agent: ${e}
80
80
 
81
81
  > framework: \`${r}\`
82
82
 
@@ -85,10 +85,11 @@ WantedBy=default.target
85
85
  `:`_No instructions provided._
86
86
  `;return`${a}---
87
87
 
88
- ${x}`}var ve=M("agent-detail-sync"),Gt=class{constructor(e){this.opts=e}opts;async syncAll(e){let o=this.opts.paths.agentsRoot,a;try{a=await ia(o)}catch(x){ve.info("agents dir not found, skip detail sync",{root:o,err:String(x)});return}ve.info("starting detail sync",{reason:e,count:a.length});for(let x of a)try{await this.syncOne(x)}catch(f){ve.warn("detail sync failed for agent, skipping",{agentId:x,err:String(f)})}ve.info("detail sync done",{reason:e})}async syncOne(e){let o=await ae(e,this.opts.paths);if(!o){ve.info("detail sync: agent config missing, skip",{agentId:e});return}let a;try{a=await this.opts.sendDetail({_meta:{cozeAgentId:e}})}catch(d){ve.warn("detail RPC failed, using local data",{agentId:e,err:String(d)});return}if(a.agentId&&a.agentId!==e){ve.warn("detail response agentId mismatch, ignoring",{agentId:e,responseAgentId:a.agentId});return}let x=!1,f=!1;if(a.agentName&&a.agentName!==o.agentName&&(o.agentName=a.agentName,x=!0),a.description!==void 0&&a.description!==o.description&&(o.description=a.description,x=!0),a.cozeIdentity&&a.cozeIdentity!==o.cozeIdentity&&(o.cozeIdentity=a.cozeIdentity,x=!0,f=!0),a.deployType&&ve.info("detail.deployType",{agentId:e,deployType:a.deployType}),!x){ve.debug("detail sync: no diff",{agentId:e});return}await de(o,this.opts.paths),ve.info("detail sync: config updated",{agentId:e,identityChanged:f,agentName:o.agentName}),f&&(await Ge(o.workspace,o.framework,e,o.cozeIdentity),await this.opts.handlers.reloadAgentSessionsPublic(e,"detail-sync"))}};Fe();import{spawn as oa}from"node:child_process";import{mkdir as aa,readFile as Ts,readdir as xa,rm as ca,stat as Xt,writeFile as fa}from"node:fs/promises";import{join as Te,normalize as ua,relative as Ls,resolve as da,sep as Ns}from"node:path";function St(r){return r?.cozeDeployType==="cloud"?"cloud":"local"}function vs(r){let{_meta:e,...o}=r;return{stripped:o,meta:e}}function at(r){if(!r?.cozeAgentId)throw new Error("missing _meta.cozeAgentId");return r.cozeAgentId}var E=class extends Error{code;retriable;cause;constructor(e,o,a){super(o),this.name="BridgeError",this.code=e,this.retriable=a?.retriable??!1,a?.cause!==void 0&&(this.cause=a.cause)}};F();ce();function Je(r,e){if(St(r)!=="cloud")throw new E("OPERATION_NOT_ALLOWED_FOR_LOCAL",`${e} is not allowed for local agent`)}var Ss="https://llm-gateway.coze.cn",Jt="auto";function xr(r){return{model:r.model??Jt,...r.modelToken?{modelToken:r.modelToken}:{}}}function Cs(r){return!r||r===Jt}function Es(r){let e={};return r.modelToken&&(e.ANTHROPIC_BASE_URL=Ss,e.ANTHROPIC_AUTH_TOKEN=r.modelToken),Cs(r.model)||(e.ANTHROPIC_MODEL=r.model),e}function As(r){let e=[];return Cs(r.model)||e.push("-c",`model="${r.model}"`),r.modelToken&&(e.push("-c",'model_provider="openai"'),e.push("-c",`model_provider_overrides.openai.base_url="${Ss}/v1"`)),e}function ks(r){return r.modelToken?{OPENAI_API_KEY:r.modelToken}:{}}var Q=M("agent-handlers"),Ds=5*1024*1024,la=1,ha=6,ga=new Set(["node_modules",".git",".coze","dist","build",".next"]),pa=3e4,Vt=class{constructor(e){this.opts=e}opts;async listSkills(e){Je(e._meta,"_agent/listSkills");let o=at(e._meta),a=await this.loadAgentCfg(o),x=a?.workspace??Ie(o).workspace,f=a?.skills??[],d=[];for(let g of f){let p=Te(x,g.relPath,"SKILL.md");await Xt(p).then(w=>w.isFile()).catch(()=>!1)&&d.push({skillId:g.skillId,skillName:g.skillName,downloadUrl:g.downloadUrl??"",...g.description?{description:g.description}:{},...g.version?{version:g.version}:{}})}return{skills:d}}async addSkills(e){Je(e._meta,"_agent/addSkills");let o=at(e._meta),a=await this.requireAgentCfg(o),x=e.skills??[],f=[...a.skills??[]],d=new Map(f.map((p,_)=>[p.skillId,_])),g=[];for(let p of x){if(!p.skillName)throw new E("IPC_BAD_REQUEST","skill missing skillName");let _=ma(p.skillName),w=_a(a.framework),y=Te(w,_),A=Te(a.workspace,y);await aa(A,{recursive:!0});let T=await ya(p.downloadUrl);va(T)?await Sa(T,A):await fa(Te(A,"SKILL.md"),T.toString("utf8"),"utf8");let N={skillId:p.skillId,skillName:p.skillName,relPath:y,installedAt:Date.now(),...p.description?{description:p.description}:{},...p.version?{version:p.version}:{},...p.downloadUrl?{downloadUrl:p.downloadUrl}:{}},R=d.get(p.skillId);R!==void 0?f[R]=N:(d.set(p.skillId,f.length),f.push(N)),g.push(p),Q.info("skill installed",{agentId:o,skillId:p.skillId,skillName:p.skillName,relPath:y})}return await jt(o,f),await this.reloadAgentSessions(o,"skills-added"),{installedSkills:g}}async removeSkills(e){Je(e._meta,"_agent/removeSkills");let o=at(e._meta),a=await this.requireAgentCfg(o),x=new Set(e.skillIds??[]),f=a.skills??[],d=[];for(let g of f){if(!x.has(g.skillId)){d.push(g);continue}let p=Te(a.workspace,g.relPath);await ca(p,{recursive:!0,force:!0}),Q.info("skill removed",{agentId:o,skillId:g.skillId,relPath:g.relPath})}return await jt(o,d),await this.reloadAgentSessions(o,"skills-removed"),{ok:!0}}reloadAgentSessionsPublic(e,o){return this.reloadAgentSessions(e,o)}async reloadAgentSessions(e,o){let a=this.opts.agents.get(e);if(a&&a.framework!=="codex")for(let[x,f]of a.sessions)try{await a.downstream.sessionLoad({sessionId:f,cwd:a.workspace}),Q.info("session reloaded",{reason:o,agentId:e,framework:a.framework,cloudId:x,acpId:f})}catch(d){Q.warn("session reload failed",{reason:o,agentId:e,framework:a.framework,cloudId:x,acpId:f,err:String(d)})}}async updateAgent(e){if(!e.cozeIdentity?.trim())return Q.info("_agent/update: empty cozeIdentity, noop",{agentId:e.agentId}),{ok:!0};let o=e.agentId,a=await ae(o);if(!a)throw new E("AGENT_NOT_FOUND",`agent not found: ${o}`);return a.cozeIdentity===e.cozeIdentity?(Q.info("_agent/update: cozeIdentity unchanged, noop",{agentId:o}),{ok:!0}):(a.cozeIdentity=e.cozeIdentity,await de(a),await Ge(a.workspace,a.framework,o,e.cozeIdentity),Q.info("_agent/update: cozeIdentity rewritten",{agentId:o,framework:a.framework}),await this.reloadAgentSessions(o,"identity-changed"),{ok:!0})}async disconnectAgent(e){let o=e.agentId;if(!o)throw new E("IPC_BAD_REQUEST","_agent/disconnect: missing agentId");let a=await ae(o);return a?(a.disconnectedAt=Date.now(),a.disconnectReason=e.reason??"",await de(a),Q.info("agent disconnected",{agentId:o,reason:e.reason??"",force:e.force??!1}),this.opts.disposeAndMarkDisconnected&&await this.opts.disposeAndMarkDisconnected(o,e.reason??"disconnect"),{ok:!0}):(Q.warn("_agent/disconnect: agent not found, ignoring",{agentId:o}),{ok:!0})}async switchModel(e){if(Je(e._meta,"_agent/switchModel"),!e.agentId)throw new E("IPC_BAD_REQUEST","_agent/switchModel: missing agentId");let o=e.model&&e.model.trim()?e.model:Jt,a=e.modelToken?.trim()||void 0,x=await ae(e.agentId);if(!x)throw new E("AGENT_NOT_FOUND",`agent not found: ${e.agentId}`);x.model=o,a!==void 0?x.modelToken=a:delete x.modelToken,await de(x),Q.info("_agent/switchModel: model/modelToken persisted",{agentId:e.agentId,model:o,hasToken:!!a,reason:e.reason??"",force:e.force??!1});let f=this.opts.agents.get(e.agentId);if(!f)return Q.info("_agent/switchModel: agent not running, config persisted only",{agentId:e.agentId}),{ok:!0};if(f.status==="switching")return Q.info("_agent/switchModel: already switching, params updated via config",{agentId:e.agentId}),{ok:!0};if(!this.opts.executeModelSwitch)throw new E("BRIDGE_INTERNAL","_agent/switchModel: executeModelSwitch callback not wired");f.status="switching";let d=f.msgQueue.enqueue(async()=>{}),g=setTimeout(()=>{Q.warn("_agent/switchModel: 30s idle timeout, forcing downstream stop",{agentId:e.agentId}),f.downstream.stop("switchModel idle timeout").catch(p=>Q.warn("force stop failed (ignored)",{agentId:e.agentId,err:String(p)}))},pa);try{return await d.catch(p=>Q.warn("_agent/switchModel: msgQueue idle wait rejected (continuing)",{agentId:e.agentId,err:String(p)})),clearTimeout(g),await this.opts.executeModelSwitch(e.agentId),{ok:!0}}catch(p){clearTimeout(g),Q.error("_agent/switchModel: failed, marking disconnected",{agentId:e.agentId,err:String(p)});let _=await ae(e.agentId).catch(()=>null);throw _&&(_.disconnectedAt=Date.now(),_.disconnectReason=`model switch failed: ${p instanceof Error?p.message:String(p)}`,await de(_).catch(w=>Q.warn("write disconnect marker failed (ignored)",{err:String(w)}))),this.opts.disposeAndMarkDisconnected?await this.opts.disposeAndMarkDisconnected(e.agentId,`model switch failed: ${p instanceof Error?p.message:String(p)}`).catch(w=>Q.warn("disposeAndMarkDisconnected failed (ignored)",{err:String(w)})):f.status="disconnected",p instanceof E&&(p.code==="MODEL_SWITCH_FAILED"||p.code==="AGENT_NOT_FOUND")?p:new E("MODEL_SWITCH_FAILED",p instanceof Error?p.message:String(p),{cause:p})}}async getFileTree(e){Je(e._meta,"_agent/getFileTree");let o=e._meta,a=at(o),x=this.resolveWorkspace(a),f=e.filePath??"",d=this.safeJoin(x,f),g=await Xt(d).catch(()=>null);if(!g)throw new E("IPC_BAD_REQUEST",`path not found: ${f}`);let p=Ca(e.depth);return g.isDirectory()?{tree:await Ms(x,d,f,p)}:{tree:[{name:Ea(f),path:Rs(f||"."),isDir:!1,size:g.size,modifiedAt:Math.floor(g.mtimeMs)}]}}async getFileContent(e){Je(e._meta,"_agent/getFileContent");let o=at(e._meta),a=this.resolveWorkspace(o);if(!e.filePath)throw new E("IPC_BAD_REQUEST","filePath required");let x=this.safeJoin(a,e.filePath),f=await Xt(x).catch(()=>null);if(!f||!f.isFile())throw new E("IPC_BAD_REQUEST",`not a file: ${e.filePath}`);if(f.size>Ds)throw new E("IPC_BAD_REQUEST",`file too large: ${f.size} bytes (max ${Ds})`);let d=await Ts(x);return d.includes(0)?{content:d.toString("base64"),encoding:"base64",size:f.size}:{content:d.toString("utf8"),encoding:"utf-8",size:f.size}}resolveWorkspace(e){let o=this.opts.agents.get(e);return o?o.workspace:Ie(e).workspace}safeJoin(e,o){let a=da(e,o||"."),x=Ls(e,a);if(x.startsWith("..")||x===".."||x.startsWith(`..${Ns}`))throw new E("IPC_BAD_REQUEST",`path escapes workspace: ${o}`);return a}loadAgentCfg(e){return ae(e)}async requireAgentCfg(e){let o=await this.loadAgentCfg(e);if(!o)throw new E("AGENT_NOT_FOUND",`no config for agent: ${e}`);return o}};function ma(r){let e=r.trim().replace(/[^a-zA-Z0-9._-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,64);if(!e||e==="."||e==="..")throw new E("IPC_BAD_REQUEST",`invalid skill name: ${r}`);return e}function _a(r){return r==="claude-code"?Te(".claude","skills"):Te(".agents","skills")}var wa=3e4,Ps=50*1024*1024,Is=3e4;async function ya(r){if(!r)throw new E("IPC_BAD_REQUEST","skill missing downloadUrl");if(r.startsWith("data:"))return ba(r);if(r.startsWith("file:")){let e=new URL(r).pathname,o=await Ts(e);if(o.length>Ps)throw new E("IPC_BAD_REQUEST",`skill too large: ${o.length} bytes`);return o}if(r.startsWith("http://")||r.startsWith("https://")){let e=new AbortController,o=setTimeout(()=>e.abort(),wa);try{let a=await fetch(r,{signal:e.signal});if(!a.ok)throw new E("IPC_BAD_REQUEST",`fetch skill failed HTTP ${a.status} ${r}`);let x=await a.arrayBuffer();if(x.byteLength>Ps)throw new E("IPC_BAD_REQUEST",`skill too large: ${x.byteLength} bytes`);return Buffer.from(x)}finally{clearTimeout(o)}}throw new E("IPC_BAD_REQUEST",`unsupported downloadUrl scheme (\u8981 https/data/file): ${r.slice(0,80)}`)}function ba(r){let e=/^data:([^,;]*)(;base64)?,(.*)$/s.exec(r);if(!e)throw new E("IPC_BAD_REQUEST","bad data URL");let o=!!e[2],a=e[3]??"";return o?Buffer.from(a,"base64"):Buffer.from(decodeURIComponent(a),"utf8")}function va(r){return r.length>=2&&r[0]===31&&r[1]===139}async function Sa(r,e){await new Promise((o,a)=>{let x=oa("tar",["-xzf","-","-C",e,"--strip-components=1"],{stdio:["pipe","pipe","pipe"]}),f="";x.stderr?.on("data",g=>{f+=String(g)});let d=setTimeout(()=>{x.kill("SIGKILL"),a(new E("IPC_BAD_REQUEST",`tar extract timeout (${Is}ms)`))},Is);x.on("error",g=>{clearTimeout(d),a(new E("IPC_BAD_REQUEST",`tar spawn failed: ${g.message}`,{cause:g}))}),x.on("exit",g=>{clearTimeout(d),g===0?o():a(new E("IPC_BAD_REQUEST",`tar exit ${g}${f?`: ${f.trim().slice(0,200)}`:""}`))}),x.stdin?.end(r)})}async function Ms(r,e,o,a){if(a<=0)return[];let x;try{x=await xa(e,{withFileTypes:!0})}catch{return[]}let f=[];for(let d of x){if(ga.has(d.name))continue;let g=Te(e,d.name),p=ua(Te(o,d.name)),_=null;try{_=await Xt(g)}catch{continue}let w={name:d.name,path:Rs(Ls(r,g)),isDir:_.isDirectory(),size:_.size,modifiedAt:Math.floor(_.mtimeMs)};_.isDirectory()&&a>1&&(w.children=await Ms(r,g,p,a-1)),f.push(w)}return f.sort((d,g)=>d.isDir!==g.isDir?d.isDir?-1:1:d.name.localeCompare(g.name)),f}function Ca(r){return!r||r<=0?la:Math.min(r,ha)}function Ea(r){if(!r||r==="."||r==="/")return".";let e=r.split(/[/\\]/);return e[e.length-1]||"."}function Rs(r){return r.split(Ns).join("/")}F();var Ct=M("agent-health-reporter"),Aa=3e4,Yt=class{constructor(e){this.opts=e;this.intervalMs=e.intervalMs??Aa}opts;timer=null;inFlight=!1;unsubscribeRegister=null;intervalMs;start(){this.timer||(this.timer=setInterval(()=>{this.tick()},this.intervalMs),this.timer.unref?.(),this.unsubscribeRegister=this.opts.core.onAgentRegister(()=>{this.tick()}),Ct.info("heartbeat started",{intervalMs:this.intervalMs}),this.tick())}stop(){this.timer&&(clearInterval(this.timer),this.timer=null,this.unsubscribeRegister&&(this.unsubscribeRegister(),this.unsubscribeRegister=null),Ct.info("heartbeat stopped"))}async tick(){if(this.inFlight){Ct.debug("previous tick still in-flight, skip");return}let e=this.opts.getDeviceId();if(!e){Ct.debug("deviceId not available, skip tick (\u5C1A\u672A pair)");return}this.inFlight=!0;try{let o=[...this.opts.core.agents.values()];for(let a of o){let x=ka(a);if(!x)continue;let f={status:x,_meta:{cozeAgentId:a.agentId,cozeDeviceId:e}};try{await this.opts.core.sendRequest("_agent/health",f)}catch(d){Ct.warn("heartbeat send failed",{agentId:a.agentId,status:x,err:String(d)})}}}finally{this.inFlight=!1}}};function ka(r){return r.status==="error"?"error":r.activeTriggers.size>0?"busy":r.status==="ok"||r.status==="degraded"?"online":null}Fe();import{mkdir as cr,rm as Ba}from"node:fs/promises";import{spawn as La}from"node:child_process";function xt(r,e,o){return o===void 0?{jsonrpc:"2.0",id:r,method:e}:{jsonrpc:"2.0",id:r,method:e,params:o}}function Os(r,e){return e===void 0?{jsonrpc:"2.0",method:r}:{jsonrpc:"2.0",method:r,params:e}}function ct(r,e){return{jsonrpc:"2.0",id:r,result:e}}function Xe(r,e){return{jsonrpc:"2.0",id:r,error:e}}var Qt=class extends Error{code;data;constructor(e){super(`JSON-RPC error code=${e.code} ${e.message}`),this.name="RemoteRpcError",this.code=e.code,e.data!==void 0&&(this.data=e.data)}},H={PARSE_ERROR:-32700,INVALID_REQUEST:-32600,METHOD_NOT_FOUND:-32601,INVALID_PARAMS:-32602,INTERNAL_ERROR:-32603,AGENT_NOT_FOUND:-32001,AGENT_BUSY:-32002,AGENT_TIMEOUT:-32003,AGENT_SPAWN_FAILED:-32004,OPERATION_NOT_ALLOWED_FOR_LOCAL:-32005,AGENT_DISCONNECTED:-32006,MODEL_SWITCHING:-32007,MODEL_SWITCH_FAILED:-32008};function $t(r){return"method"in r&&"id"in r&&r.id!==void 0}function Bs(r){return"method"in r&&!("id"in r)}function Zt(r){return!("method"in r)&&"id"in r}var Da={AGENT_NOT_FOUND:H.AGENT_NOT_FOUND,AGENT_BUSY:H.AGENT_BUSY,AGENT_DISCONNECTED:H.AGENT_DISCONNECTED,AGENT_TIMEOUT:H.AGENT_TIMEOUT,AGENT_SPAWN_FAILED:H.AGENT_SPAWN_FAILED,AGENT_PROTOCOL_ERROR:H.INTERNAL_ERROR,BRIDGE_CONFIG_INVALID:H.INTERNAL_ERROR,BRIDGE_INTERNAL:H.INTERNAL_ERROR,IPC_AUTH_FAILED:H.INTERNAL_ERROR,IPC_BAD_REQUEST:H.INVALID_REQUEST,MODEL_SWITCHING:H.MODEL_SWITCHING,MODEL_SWITCH_FAILED:H.MODEL_SWITCH_FAILED,OPERATION_NOT_ALLOWED_FOR_LOCAL:H.OPERATION_NOT_ALLOWED_FOR_LOCAL,UPSTREAM_DISCONNECTED:H.INTERNAL_ERROR,UPSTREAM_HANDSHAKE_FAILED:H.INTERNAL_ERROR};function en(r){return r instanceof E?{code:Da[r.code]??H.INTERNAL_ERROR,message:r.message,data:{bridgeCode:r.code,retriable:r.retriable}}:{code:H.INTERNAL_ERROR,message:r instanceof Error?r.message:String(r)}}function zs(r){let e=r.data,o=e?.bridgeCode??"AGENT_PROTOCOL_ERROR";return new E(o,r.message,{retriable:e?.retriable??!1,cause:r.data})}function qs(r){return`${JSON.stringify(r)}
88
+ ${x}`}var be=B("agent-detail-sync"),Jt=class{constructor(e){this.opts=e}opts;async syncAll(e){let o=this.opts.paths.agentsRoot,a;try{a=await aa(o)}catch(x){be.info("agents dir not found, skip detail sync",{root:o,err:String(x)});return}be.info("starting detail sync",{reason:e,count:a.length});for(let x of a)try{await this.syncOne(x)}catch(f){be.warn("detail sync failed for agent, skipping",{agentId:x,err:String(f)})}be.info("detail sync done",{reason:e})}async syncOne(e){let o=await xe(e,this.opts.paths);if(!o){be.info("detail sync: agent config missing, skip",{agentId:e});return}let a;try{a=await this.opts.sendDetail({_meta:{cozeAgentId:e}})}catch(d){be.warn("detail RPC failed, using local data",{agentId:e,err:String(d)});return}if(a.agentId&&a.agentId!==e){be.warn("detail response agentId mismatch, ignoring",{agentId:e,responseAgentId:a.agentId});return}let x=!1,f=!1;if(a.agentName&&a.agentName!==o.agentName&&(o.agentName=a.agentName,x=!0),a.description!==void 0&&a.description!==o.description&&(o.description=a.description,x=!0),a.cozeIdentity&&a.cozeIdentity!==o.cozeIdentity&&(o.cozeIdentity=a.cozeIdentity,x=!0,f=!0),a.deployType&&be.info("detail.deployType",{agentId:e,deployType:a.deployType}),!x){be.debug("detail sync: no diff",{agentId:e});return}await he(o,this.opts.paths),be.info("detail sync: config updated",{agentId:e,identityChanged:f,agentName:o.agentName}),f&&(await it(o.workspace,o.framework,e,o.cozeIdentity),await this.opts.handlers.reloadAgentSessionsPublic(e,"detail-sync"))}};qe();import{spawn as Rs}from"node:child_process";import{lstat as xr,mkdir as xa,readFile as Bs,readdir as ca,rm as fa,stat as ua,writeFile as da}from"node:fs/promises";import{join as Te,normalize as la,relative as Os,resolve as ha,sep as Ms}from"node:path";function bt(r){return r?.cozeDeployType==="cloud"?"cloud":"local"}function Cs(r){let{_meta:e,...o}=r;return{stripped:o,meta:e}}function ot(r){if(!r?.cozeAgentId)throw new Error("missing _meta.cozeAgentId");return r.cozeAgentId}var C=class extends Error{code;retriable;cause;constructor(e,o,a){super(o),this.name="BridgeError",this.code=e,this.retriable=a?.retriable??!1,a?.cause!==void 0&&(this.cause=a.cause)}};K();se();function Je(r,e){if(bt(r)!=="cloud")throw new C("OPERATION_NOT_ALLOWED_FOR_LOCAL",`${e} is not allowed for local agent`)}var As="https://llm-gateway.coze.cn",at="auto";function ks(r){return{model:r.model??at,...r.modelToken?{modelToken:r.modelToken}:{}}}function Ds(r){return!r||r===at}function Ps(r){let e={};return r.modelToken&&(e.ANTHROPIC_BASE_URL=As,e.ANTHROPIC_AUTH_TOKEN=r.modelToken),Ds(r.model)||(e.ANTHROPIC_MODEL=r.model),e}function Ls(r){let e=[];return Ds(r.model)||e.push("-c",`model="${r.model}"`),r.modelToken&&(e.push("-c",'model_provider="openai"'),e.push("-c",`model_provider_overrides.openai.base_url="${As}/v1"`)),e}function Ts(r){return r.modelToken?{OPENAI_API_KEY:r.modelToken}:{}}var ce=B("agent-handlers"),Is=5*1024*1024,ga=1,pa=6,ma=new Set(["node_modules",".git",".coze","dist","build",".next"]),Vt=class{constructor(e){this.opts=e}opts;async listSkills(e){Je(e._meta,"_agent/listSkills");let o=ot(e._meta),a=await this.loadAgentCfg(o),x=a?.workspace??Le(o).workspace,f=a?.skills??[],d=[];for(let h of f){let _=Te(x,h.relPath,"SKILL.md");await ua(_).then(b=>b.isFile()).catch(()=>!1)&&d.push({skillId:h.skillId,skillName:h.skillName,downloadUrl:h.downloadUrl??"",...h.description?{description:h.description}:{},...h.version?{version:h.version}:{}})}return{skills:d}}async addSkills(e){Je(e._meta,"_agent/addSkills");let o=ot(e._meta),a=await this.requireAgentCfg(o),x=e.skills??[],f=[...a.skills??[]],d=new Map(f.map((_,v)=>[_.skillId,v])),h=[];for(let _ of x){if(!_.skillName)throw new C("IPC_BAD_REQUEST","skill missing skillName");let v=_a(_.skillName),b=wa(a.framework),y=Te(b,v),A=Te(a.workspace,y);await xa(A,{recursive:!0});let L=await va(_.downloadUrl);Sa(L)?await Ea(L,A):await da(Te(A,"SKILL.md"),L.toString("utf8"),"utf8");let T={skillId:_.skillId,skillName:_.skillName,relPath:y,installedAt:Date.now(),..._.description?{description:_.description}:{},..._.version?{version:_.version}:{},..._.downloadUrl?{downloadUrl:_.downloadUrl}:{}},R=d.get(_.skillId);R!==void 0?f[R]=T:(d.set(_.skillId,f.length),f.push(T)),h.push(_),ce.info("skill installed",{agentId:o,skillId:_.skillId,skillName:_.skillName,relPath:y})}return await jt(o,f),await this.reloadAgentSessions(o,"skills-added"),{installedSkills:h}}async removeSkills(e){Je(e._meta,"_agent/removeSkills");let o=ot(e._meta),a=await this.requireAgentCfg(o),x=new Set(e.skillIds??[]),f=a.skills??[],d=[];for(let h of f){if(!x.has(h.skillId)){d.push(h);continue}let _=Te(a.workspace,h.relPath);await fa(_,{recursive:!0,force:!0}),ce.info("skill removed",{agentId:o,skillId:h.skillId,relPath:h.relPath})}return await jt(o,d),await this.reloadAgentSessions(o,"skills-removed"),{ok:!0}}reloadAgentSessionsPublic(e,o){return this.reloadAgentSessions(e,o)}async reloadAgentSessions(e,o){let a=this.opts.agents.get(e);if(a&&a.framework!=="codex"){for(let[x,f]of a.sessions)if(!(!f.downstream||!f.acpSessionId)){f.loadingSession=!0;try{await f.downstream.sessionLoad({sessionId:f.acpSessionId,cwd:a.workspace}),ce.info("session reloaded",{reason:o,agentId:e,framework:a.framework,cloudId:x,acpId:f.acpSessionId})}catch(d){ce.warn("session reload failed",{reason:o,agentId:e,framework:a.framework,cloudId:x,acpId:f.acpSessionId,err:String(d)})}finally{f.loadingSession=!1}}}}async updateAgent(e){if(!e.cozeIdentity?.trim())return ce.info("_agent/update: empty cozeIdentity, noop",{agentId:e.agentId}),{ok:!0};let o=e.agentId,a=await xe(o);if(!a)throw new C("AGENT_NOT_FOUND",`agent not found: ${o}`);return a.cozeIdentity===e.cozeIdentity?(ce.info("_agent/update: cozeIdentity unchanged, noop",{agentId:o}),{ok:!0}):(a.cozeIdentity=e.cozeIdentity,await he(a),await it(a.workspace,a.framework,o,e.cozeIdentity),ce.info("_agent/update: cozeIdentity rewritten",{agentId:o,framework:a.framework}),await this.reloadAgentSessions(o,"identity-changed"),{ok:!0})}async disconnectAgent(e){let o=e.agentId;if(!o)throw new C("IPC_BAD_REQUEST","_agent/disconnect: missing agentId");let a=await xe(o);return a?(a.disconnectedAt=Date.now(),a.disconnectReason=e.reason??"",await he(a),ce.info("agent disconnected",{agentId:o,reason:e.reason??"",force:e.force??!1}),this.opts.disposeAndMarkDisconnected&&await this.opts.disposeAndMarkDisconnected(o,e.reason??"disconnect"),{ok:!0}):(ce.warn("_agent/disconnect: agent not found, ignoring",{agentId:o}),{ok:!0})}async switchModel(e){if(Je(e._meta,"_agent/switchModel"),!e.agentId)throw new C("IPC_BAD_REQUEST","_agent/switchModel: missing agentId");let o=e.model?.trim()?e.model:at,a=await xe(e.agentId);if(!a)throw new C("AGENT_NOT_FOUND",`agent not found: ${e.agentId}`);a.model=o,await he(a),ce.info("_agent/switchModel: model persisted",{agentId:e.agentId,model:o,reason:e.reason??""});let x=this.opts.agents.get(e.agentId);return x?(await x.msgQueue.enqueue(async()=>{x.model=o,await x.killAllRuntimes(`switchModel: ${o}`)}),ce.info("_agent/switchModel: all session runtimes killed, next prompt will respawn",{agentId:e.agentId,model:o}),{ok:!0}):(ce.info("_agent/switchModel: agent not running, config persisted only",{agentId:e.agentId}),{ok:!0})}async getFileTree(e){Je(e._meta,"_agent/getFileTree");let o=e._meta,a=ot(o),x=this.resolveWorkspace(a),f=e.filePath??"",d=this.safeJoin(x,f),h=await xr(d).catch(()=>null);if(!h)throw new C("IPC_BAD_REQUEST",`path not found: ${f}`);if(h.isSymbolicLink())throw new C("IPC_BAD_REQUEST",`symlink not allowed: ${f}`);let _=Aa(e.depth);return h.isDirectory()?{tree:await zs(x,d,f,_)}:{tree:[{name:ka(f),path:qs(f||"."),isDir:!1,size:h.size,modifiedAt:Math.floor(h.mtimeMs)}]}}async getFileContent(e){Je(e._meta,"_agent/getFileContent");let o=ot(e._meta),a=this.resolveWorkspace(o);if(!e.filePath)throw new C("IPC_BAD_REQUEST","filePath required");let x=this.safeJoin(a,e.filePath),f=await xr(x).catch(()=>null);if(!f||!f.isFile())throw new C("IPC_BAD_REQUEST",`not a file: ${e.filePath}`);if(f.isSymbolicLink())throw new C("IPC_BAD_REQUEST",`symlink not allowed: ${e.filePath}`);if(f.size>Is)throw new C("IPC_BAD_REQUEST",`file too large: ${f.size} bytes (max ${Is})`);let d=await Bs(x);return d.includes(0)?{content:d.toString("base64"),encoding:"base64",size:f.size}:{content:d.toString("utf8"),encoding:"utf-8",size:f.size}}resolveWorkspace(e){let o=this.opts.agents.get(e);return o?o.workspace:Le(e).workspace}safeJoin(e,o){let a=ha(e,o||"."),x=Os(e,a);if(x.startsWith("..")||x===".."||x.startsWith(`..${Ms}`))throw new C("IPC_BAD_REQUEST",`path escapes workspace: ${o}`);return a}loadAgentCfg(e){return xe(e)}async requireAgentCfg(e){let o=await this.loadAgentCfg(e);if(!o)throw new C("AGENT_NOT_FOUND",`no config for agent: ${e}`);return o}};function _a(r){let e=r.trim().replace(/[^a-zA-Z0-9._-]+/g,"-").replace(/^-+|-+$/g,"").slice(0,64);if(!e||e==="."||e==="..")throw new C("IPC_BAD_REQUEST",`invalid skill name: ${r}`);return e}function wa(r){return r==="claude-code"?Te(".claude","skills"):Te(".agents","skills")}var ya=3e4,Ns=50*1024*1024,Xt=3e4;async function va(r){if(!r)throw new C("IPC_BAD_REQUEST","skill missing downloadUrl");if(r.startsWith("data:"))return ba(r);if(r.startsWith("file:")){let e=new URL(r).pathname,o=await Bs(e);if(o.length>Ns)throw new C("IPC_BAD_REQUEST",`skill too large: ${o.length} bytes`);return o}if(r.startsWith("http://")||r.startsWith("https://")){let e=new AbortController,o=setTimeout(()=>e.abort(),ya);try{let a=await fetch(r,{signal:e.signal});if(!a.ok)throw new C("IPC_BAD_REQUEST",`fetch skill failed HTTP ${a.status} ${r}`);let x=await a.arrayBuffer();if(x.byteLength>Ns)throw new C("IPC_BAD_REQUEST",`skill too large: ${x.byteLength} bytes`);return Buffer.from(x)}finally{clearTimeout(o)}}throw new C("IPC_BAD_REQUEST",`unsupported downloadUrl scheme (\u8981 https/data/file): ${r.slice(0,80)}`)}function ba(r){let e=/^data:([^,;]*)(;base64)?,(.*)$/s.exec(r);if(!e)throw new C("IPC_BAD_REQUEST","bad data URL");let o=!!e[2],a=e[3]??"";return o?Buffer.from(a,"base64"):Buffer.from(decodeURIComponent(a),"utf8")}function Sa(r){return r.length>=2&&r[0]===31&&r[1]===139}async function Ea(r,e){await Ca(r),await new Promise((o,a)=>{let x=Rs("tar",["-xzf","-","-C",e,"--strip-components=1","--no-same-owner"],{stdio:["pipe","pipe","pipe"]}),f="";x.stderr?.on("data",h=>{f+=String(h)});let d=setTimeout(()=>{x.kill("SIGKILL"),a(new C("IPC_BAD_REQUEST",`tar extract timeout (${Xt}ms)`))},Xt);x.on("error",h=>{clearTimeout(d),a(new C("IPC_BAD_REQUEST",`tar spawn failed: ${h.message}`,{cause:h}))}),x.on("exit",h=>{clearTimeout(d),h===0?o():a(new C("IPC_BAD_REQUEST",`tar exit ${h}${f?`: ${f.trim().slice(0,200)}`:""}`))}),x.stdin?.end(r)})}async function Ca(r){let e=await new Promise((o,a)=>{let x=Rs("tar",["-tzvf","-"],{stdio:["pipe","pipe","pipe"]}),f="",d="";x.stdout?.on("data",_=>{f+=String(_)}),x.stderr?.on("data",_=>{d+=String(_)});let h=setTimeout(()=>{x.kill("SIGKILL"),a(new C("IPC_BAD_REQUEST",`tar list timeout (${Xt}ms)`))},Xt);x.on("error",_=>{clearTimeout(h),a(new C("IPC_BAD_REQUEST",`tar list spawn failed: ${_.message}`))}),x.on("exit",_=>{clearTimeout(h),_===0?o(f):a(new C("IPC_BAD_REQUEST",`tar list exit ${_}${d?`: ${d.trim().slice(0,200)}`:""}`))}),x.stdin?.end(r)});for(let o of e.split(`
89
+ `)){let a=o.trim();if(!a)continue;let x=a.charCodeAt(0);if(x!==45&&x!==100)throw new C("IPC_BAD_REQUEST",`tar entry kind '${a[0]}' not allowed (symlink/hardlink/special): ${a.slice(0,100)}`);let d=(a.match(/\s(\S.*)$/)?.[1]??"").split(" -> ")[0]?.trim()??"";if(!d)continue;if(d.startsWith("/"))throw new C("IPC_BAD_REQUEST",`tar entry absolute path: ${d}`);if(d.split(/[/\\]/).some(_=>_===".."))throw new C("IPC_BAD_REQUEST",`tar entry contains '..': ${d}`)}}async function zs(r,e,o,a){if(a<=0)return[];let x;try{x=await ca(e,{withFileTypes:!0})}catch{return[]}let f=[];for(let d of x){if(ma.has(d.name)||d.isSymbolicLink())continue;let h=Te(e,d.name),_=la(Te(o,d.name)),v=null;try{v=await xr(h)}catch{continue}if(v.isSymbolicLink())continue;let b={name:d.name,path:qs(Os(r,h)),isDir:v.isDirectory(),size:v.size,modifiedAt:Math.floor(v.mtimeMs)};v.isDirectory()&&a>1&&(b.children=await zs(r,h,_,a-1)),f.push(b)}return f.sort((d,h)=>d.isDir!==h.isDir?d.isDir?-1:1:d.name.localeCompare(h.name)),f}function Aa(r){return!r||r<=0?ga:Math.min(r,pa)}function ka(r){if(!r||r==="."||r==="/")return".";let e=r.split(/[/\\]/);return e[e.length-1]||"."}function qs(r){return r.split(Ms).join("/")}K();var St=B("agent-health-reporter"),Da=3e4,Yt=class{constructor(e){this.opts=e;this.intervalMs=e.intervalMs??Da}opts;timer=null;inFlight=!1;unsubscribeRegister=null;intervalMs;start(){this.timer||(this.timer=setInterval(()=>{this.tick()},this.intervalMs),this.timer.unref?.(),this.unsubscribeRegister=this.opts.core.onAgentRegister(()=>{this.tick()}),St.info("heartbeat started",{intervalMs:this.intervalMs}),this.tick())}stop(){this.timer&&(clearInterval(this.timer),this.timer=null,this.unsubscribeRegister&&(this.unsubscribeRegister(),this.unsubscribeRegister=null),St.info("heartbeat stopped"))}async tick(){if(this.inFlight){St.debug("previous tick still in-flight, skip");return}let e=this.opts.getDeviceId();if(!e){St.debug("deviceId not available, skip tick (\u5C1A\u672A pair)");return}this.inFlight=!0;try{let o=[...this.opts.core.agents.values()];for(let a of o){let x=Pa(a);if(!x)continue;let f={status:x,_meta:{cozeAgentId:a.agentId,cozeDeviceId:e}};try{await this.opts.core.sendRequest("_agent/health",f)}catch(d){St.warn("heartbeat send failed",{agentId:a.agentId,status:x,err:String(d)})}}}finally{this.inFlight=!1}}};function Pa(r){return r.status==="error"?"error":r.activeTriggers.size>0?"busy":r.status==="ok"?"online":null}qe();import{mkdir as cr,rm as qa}from"node:fs/promises";import{spawn as Ra}from"node:child_process";function Et(r,e,o){return o===void 0?{jsonrpc:"2.0",id:r,method:e}:{jsonrpc:"2.0",id:r,method:e,params:o}}function Zt(r,e){return e===void 0?{jsonrpc:"2.0",method:r}:{jsonrpc:"2.0",method:r,params:e}}function xt(r,e){return{jsonrpc:"2.0",id:r,result:e}}function Ve(r,e){return{jsonrpc:"2.0",id:r,error:e}}var $t=class extends Error{code;data;constructor(e){super(`JSON-RPC error code=${e.code} ${e.message}`),this.name="RemoteRpcError",this.code=e.code,e.data!==void 0&&(this.data=e.data)}},G={PARSE_ERROR:-32700,INVALID_REQUEST:-32600,METHOD_NOT_FOUND:-32601,INVALID_PARAMS:-32602,INTERNAL_ERROR:-32603,AGENT_NOT_FOUND:-32001,AGENT_BUSY:-32002,AGENT_TIMEOUT:-32003,AGENT_SPAWN_FAILED:-32004,OPERATION_NOT_ALLOWED_FOR_LOCAL:-32005,AGENT_DISCONNECTED:-32006,MODEL_TOKEN_GEN_FAILED:-32009};function Fs(r){return"method"in r&&"id"in r&&r.id!==void 0}function Us(r){return"method"in r&&!("id"in r)}function Qt(r){return!("method"in r)&&"id"in r}var La={AGENT_NOT_FOUND:G.AGENT_NOT_FOUND,AGENT_BUSY:G.AGENT_BUSY,AGENT_DISCONNECTED:G.AGENT_DISCONNECTED,AGENT_TIMEOUT:G.AGENT_TIMEOUT,AGENT_SPAWN_FAILED:G.AGENT_SPAWN_FAILED,AGENT_PROTOCOL_ERROR:G.INTERNAL_ERROR,BRIDGE_CONFIG_INVALID:G.INTERNAL_ERROR,BRIDGE_INTERNAL:G.INTERNAL_ERROR,IPC_AUTH_FAILED:G.INTERNAL_ERROR,IPC_BAD_REQUEST:G.INVALID_REQUEST,MODEL_TOKEN_GEN_FAILED:G.MODEL_TOKEN_GEN_FAILED,OPERATION_NOT_ALLOWED_FOR_LOCAL:G.OPERATION_NOT_ALLOWED_FOR_LOCAL,UPSTREAM_DISCONNECTED:G.INTERNAL_ERROR,UPSTREAM_HANDSHAKE_FAILED:G.INTERNAL_ERROR};function en(r){return r instanceof C?{code:La[r.code]??G.INTERNAL_ERROR,message:r.message,data:{bridgeCode:r.code,retriable:r.retriable}}:{code:G.INTERNAL_ERROR,message:r instanceof Error?r.message:String(r)}}function Ks(r){let e=r.data,o=e?.bridgeCode??"AGENT_PROTOCOL_ERROR";return new C(o,r.message,{retriable:e?.retriable??!1,cause:r.data})}function Hs(r){return`${JSON.stringify(r)}
89
90
  `}var tn=class{buffer="";onError;constructor(e={}){this.onError=e.onError}push(e){this.buffer+=typeof e=="string"?e:e.toString("utf8");let o=this.buffer.split(`
90
- `);this.buffer=o.pop()??"";let a=[];for(let x of o){let f=x.replace(/\r$/,"").trim();if(f)try{a.push(JSON.parse(f))}catch(d){this.onError?.({line:f,error:d})}}return a}flush(){if(!this.buffer)return[];let e=this.buffer.replace(/\r$/,"").trim();if(this.buffer="",!e)return[];try{return[JSON.parse(e)]}catch(o){return this.onError?.({line:e,error:o}),[]}}};var Us={"session/prompt":"session.prompt","session/cancel":"session.cancel","session/new":"session.new","session/load":"session.load","_agent/create":"agent.create","_agent/health":"agent.health","_agent/pair":"agent.pair","_agent/listSkills":"agent.listSkills","_agent/addSkills":"agent.addSkills","_agent/removeSkills":"agent.removeSkills","_agent/getFileTree":"agent.getFileTree","_agent/getFileContent":"agent.getFileContent","_agent/detail":"agent.detail","_agent/update":"agent.update","_agent/disconnect":"agent.disconnect","_agent/switchModel":"agent.switchModel",initialize:"initialize"},Ku=Object.fromEntries(Object.entries(Us).map(([r,e])=>[e,r])),Pa={"session.prompt":["agentId","triggerMsgId","sessionId"],"session.cancel":["agentId","triggerMsgId","sessionId"],"session.new":["agentId"],"session.load":["agentId"],"agent.create":["agentId"],"agent.health":["agentId"],"agent.listSkills":["agentId"],"agent.addSkills":["agentId"],"agent.removeSkills":["agentId"],"agent.getFileTree":["agentId"],"agent.getFileContent":["agentId"],"agent.detail":["agentId"],"agent.update":["agentId"],"agent.disconnect":["agentId"],"agent.switchModel":["agentId"],"agent.pair":[],initialize:[]},ft=class{seq=0;next(e,o){this.seq+=1;let a=Us[e]??Ia(e),x=Pa[a]??[],f=[a,String(this.seq)];if(x.length>0){let d=x.map(p=>Fs(o?.[p]??"")),g=Ta(d).join(":");g&&f.push(g)}else o&&Object.values(o).some(d=>d)&&f.push(Object.values(o).filter(Boolean).map(d=>Fs(String(d))).join(":"));return f.join("_")}reset(){this.seq=0}};function Ia(r){return r.replace(/[\s/]+/g,".").replace(/_+/g,"-")}function Fs(r){return r.replace(/[:_\s]+/g,"-")}function Ta(r){let e=r.length;for(;e>0&&!r[e-1];)e-=1;return r.slice(0,e)}F();var Na=3e4;function Hs(r,e){if(!(typeof r!="number"||r<=0))try{process.platform==="win32"?process.kill(r,e):process.kill(-r,e)}catch{}}var Ue=class{constructor(e){this.opts=e;this.log=M(`downstream.${this.constructor.name}`),this.decoder=new tn({onError:o=>this.log.warn("decode line failed",{line:o.line})})}opts;child;decoder;pending=new Map;idAllocator=new ft;updateHandlers=[];agentRequestHandlers=[];exitHandlers=[];log;stopped=!1;sanitizeEnv(e){return e}async start(){if(this.child)throw new E("BRIDGE_INTERNAL","Downstream already started");let e=process.platform!=="win32",o=La(this.opts.command,this.opts.args,{cwd:this.opts.cwd,env:{...this.sanitizeEnv(process.env),...this.opts.env},stdio:["pipe","pipe","pipe"],detached:e});this.child=o,o.stdout?.setEncoding("utf8"),o.stdout?.on("data",a=>{for(let x of this.decoder.push(a))this.dispatch(x)}),o.stderr?.setEncoding("utf8"),o.stderr?.on("data",a=>{this.log.debug("stderr",{text:a.trimEnd()})}),o.on("exit",(a,x)=>{this.stopped=!0,this.failAllPending(new E("AGENT_PROTOCOL_ERROR",`agent exited (${a}/${x})`));for(let f of this.exitHandlers)f(a,x)}),o.on("error",a=>{this.log.error("child error",{err:String(a)}),this.failAllPending(new E("AGENT_SPAWN_FAILED",String(a),{cause:a}))}),this.log.info("downstream started",{command:this.opts.command,pid:o.pid,cwd:this.opts.cwd})}async stop(e){if(!this.child||this.stopped)return;this.stopped=!0,this.log.info("downstream stopping",{reason:e});let o=this.child,a=new Promise(f=>o.once("exit",()=>f()));Hs(o.pid,"SIGTERM");let x=setTimeout(()=>{o.killed||Hs(o.pid,"SIGKILL")},5e3);try{await a}finally{clearTimeout(x)}}pid(){return this.child?.pid}isAlive(){return!!this.child&&!this.stopped}initialize(e){return this.call("initialize",e)}sessionNew(e){return this.call("session/new",{mcpServers:[],...e})}sessionLoad(e){return this.call("session/load",{mcpServers:[],...e})}sessionPrompt(e){return this.call("session/prompt",e,0)}async sessionCancel(e){if(!this.child||this.stopped)return;let o=this.idAllocator.next("session/cancel");this.writeFrame(xt(o,"session/cancel",e))}onUpdate(e){this.updateHandlers.push(e)}onAgentRequest(e){this.agentRequestHandlers.push(e)}respondAgentRequest(e,o){if(!(!this.child||this.stopped))try{this.writeFrame(ct(e,o))}catch(a){this.log.warn("respondAgentRequest write failed",{id:e,err:String(a)})}}respondAgentRequestError(e,o){if(!(!this.child||this.stopped))try{this.writeFrame(Xe(e,o))}catch(a){this.log.warn("respondAgentRequestError write failed",{id:e,err:String(a)})}}onExit(e){this.exitHandlers.push(e)}call(e,o,a=Na){if(!this.child||this.stopped)return Promise.reject(new E("AGENT_PROTOCOL_ERROR","downstream not started"));let x=this.idAllocator.next(e),f=xt(x,e,o),d=a>0&&Number.isFinite(a);return new Promise((g,p)=>{let _=d?setTimeout(()=>{this.pending.delete(x),p(new E("AGENT_TIMEOUT",`${e} timed out after ${a}ms`))},a):null;this.pending.set(x,{resolve:g,reject:p,timer:_,method:e});try{this.writeFrame(f)}catch(w){_&&clearTimeout(_),this.pending.delete(x),p(w)}})}writeFrame(e){if(!this.child?.stdin||this.child.stdin.destroyed)throw new E("AGENT_PROTOCOL_ERROR","downstream stdin not writable");this.child.stdin.write(qs(e))}dispatch(e){if(Zt(e)){let o=e.id!==null?this.pending.get(e.id):void 0;if(!o){this.log.warn("orphan response",{id:e.id});return}this.pending.delete(e.id),o.timer&&clearTimeout(o.timer),e.error?o.reject(zs(e.error)):o.resolve(e.result);return}if(Bs(e)){if(e.method==="session/update")for(let o of this.updateHandlers)Promise.resolve(o(e.params)).catch(a=>this.log.warn("update handler failed",{err:String(a)}));else this.log.debug("unknown notification",{method:e.method});return}if($t(e)){let o=e;this.handleAgentRequest(o).catch(a=>this.log.error("agent request handler failed",{method:o.method,err:String(a)}))}}async handleAgentRequest(e){if(this.agentRequestHandlers.length===0){this.writeFrame(Xe(e.id,{code:-32601,message:`method not handled by Bridge: ${e.method}`}));return}for(let o of this.agentRequestHandlers)try{await o(e)}catch(a){this.log.error("agentRequestHandler threw",{method:e.method,err:String(a)});try{this.writeFrame(Xe(e.id,en(a)))}catch{}}}failAllPending(e){for(let o of this.pending.values())o.timer&&clearTimeout(o.timer),o.reject(e);this.pending.clear()}};var Ma="@zed-industries/claude-code-acp@latest";function Ra(r){let e={};for(let[o,a]of Object.entries(r))a!==void 0&&(o.startsWith("CLAUDE")||o==="AI_AGENT"||o==="BAGGAGE"||(e[o]=a));return e}var nn=class extends Ue{framework="claude-code";constructor(e){let o=e.command??"npx",a=e.args??["-y",Ma],x={command:o,args:a,cwd:e.cwd,...e.env?{env:e.env}:{}};super(x)}sanitizeEnv(e){return Ra(e)}};var Oa="@zed-industries/codex-acp@latest",rn=class extends Ue{framework="codex";constructor(e){let o=e.command??"npx",a=e.args??["-y",Oa],x=e.extraArgs?[...a,...e.extraArgs]:a,f={command:o,args:x,cwd:e.cwd,...e.env?{env:e.env}:{}};super(f)}};import{spawn as Ks}from"node:child_process";F();var sn=class extends Ue{framework="openclaw";registerLog;profile;agentId;sessionName;registered=!1;constructor(e){let o=e.profile??"coze",a=e.sessionName??"default",x=["--profile",o,"acp","--session",`agent:${e.agentId}:${a}`],f={command:e.command,args:x,cwd:e.cwd,...e.env?{env:e.env}:{}};super(f),this.profile=o,this.agentId=e.agentId,this.sessionName=a,this.registerLog=M("downstream.openclaw.register")}async start(){await this.registerAgent().catch(e=>{this.registerLog.warn("openclaw agents add failed (will continue to acp anyway)",{agentId:this.agentId,err:String(e)})}),await super.start()}registerAgent(){return new Promise((e,o)=>{let a=Ks(this.opts.command,["--profile",this.profile,"agents","add",this.agentId,"--workspace",this.opts.cwd,"--non-interactive"],{stdio:["ignore","pipe","pipe"],env:{...process.env,...this.opts.env}}),x="";a.stderr?.on("data",f=>{x+=f.toString("utf8")}),a.on("error",o),a.on("close",f=>{f===0?(this.registered=!0,this.registerLog.info("agent registered",{agentId:this.agentId,profile:this.profile}),e()):o(new E("AGENT_SPAWN_FAILED",`openclaw agents add ${this.agentId} exited ${f}: ${x.trim()}`))})})}async cleanup(e){this.registered&&await new Promise(o=>{let a=Ks(this.opts.command,["--profile",this.profile,"agents","delete",this.agentId,"--force"],{stdio:["ignore","pipe","pipe"],env:{...process.env,...this.opts.env}}),x="";a.stderr?.on("data",f=>{x+=f.toString("utf8")}),a.on("error",f=>{this.registerLog.warn("openclaw agents delete failed (best-effort)",{agentId:this.agentId,err:String(f)}),o()}),a.on("close",f=>{f===0?this.registerLog.info("agent unregistered",{agentId:this.agentId}):this.registerLog.warn("openclaw agents delete non-zero exit",{agentId:this.agentId,code:f,stderr:x.trim()}),this.registered=!1,o()})})}get acpSessionName(){return this.sessionName}};F();ce();var on=class{slots=[];running=!1;closed=!1;disposed=!1;enqueue(e){return this.disposed?Promise.reject(new Error("AsyncQueue disposed")):this.closed?Promise.reject(new Error("AsyncQueue closed")):new Promise((o,a)=>{this.slots.push({task:e,resolve:o,reject:a}),this.drain()})}close(){this.closed=!0}dispose(e=new Error("AsyncQueue disposed")){for(this.disposed=!0,this.closed=!0;this.slots.length>0;)this.slots.shift()?.reject(e)}get size(){return this.slots.length}get isRunning(){return this.running}async drain(){if(!this.running){this.running=!0;try{for(;this.slots.length>0&&!this.disposed;){let e=this.slots.shift();if(!e)break;try{let o=await e.task();e.resolve(o)}catch(o){e.reject(o)}}}finally{this.running=!1}}}};var an=class{agentId;framework;workspace;deployType;msgQueue;sessions=new Map;verifiedSessions=new Set;activeTriggers=new Map;status="starting";lastActiveAt=Date.now();_downstream;constructor(e){this.agentId=e.agentId,this.framework=e.framework,this.workspace=e.workspace,this.deployType=e.deployType??"local",this._downstream=e.downstream,this.msgQueue=new on}get downstream(){return this._downstream}swap(e){this._downstream=e,this.verifiedSessions.clear(),this.activeTriggers.clear()}async dispose(e){this.status="stopped",this.msgQueue.dispose(new Error(`AgentSession disposed${e?`: ${e}`:""}`)),await this._downstream.stop(e)}};var W=M("agent-manager"),za=(r,e,o,a,x)=>{switch(r){case"claude-code":{let f=x?Es(x):void 0;return new nn({cwd:o,...f&&Object.keys(f).length>0?{env:f}:{}})}case"codex":{let f=x?As(x):[],d=x?ks(x):void 0;return new rn({cwd:o,...f.length>0?{extraArgs:f}:{},...d&&Object.keys(d).length>0?{env:d}:{}})}case"openclaw":return new sn({command:e,cwd:o,agentId:a})}};function Gs(r){return r==="claude-code"||r==="codex"}var Js={path:"",version:"cloud-deployed"};function js(r,e){let o=r.frameworksCache?.[e.framework];if(o)return o;if(e.deployType==="cloud"&&Gs(e.framework))return Js}var qa=[0,5e3,5e3],Fa=2e4,Ws={protocolVersion:1,clientCapabilities:{fs:{readTextFile:!0,writeTextFile:!0}}},xn=class{paths;config;registry;factory;restartDelaysMs;createTimeoutMs;healthReporter;constructor(e){this.paths=e.paths,this.config=e.config,this.registry=e.registry,this.factory=e.downstreamFactory??za,this.restartDelaysMs=e.restartDelaysMs??qa,this.createTimeoutMs=e.createTimeoutMs??Fa,this.healthReporter=e.healthReporter}async createAgent(e){if(!e.agentId)throw new E("IPC_BAD_REQUEST","agentId required");if(!e.framework)throw new E("IPC_BAD_REQUEST","framework required");let o=St(e._meta)==="cloud";if(o&&e.framework==="openclaw")return W.info("cloud-deployed openclaw, ack without local spawn",{agentId:e.agentId,framework:e.framework}),{ok:!0,agentId:e.agentId,framework:e.framework};this.registry.reviveIfDisconnected?.(e.agentId);let a=this.registry.get(e.agentId);if(a){if(a.framework!==e.framework)throw new E("AGENT_BUSY",`agent ${e.agentId} exists with different framework (${a.framework})`);if(a.status==="error")W.warn("existing agent in error state, rebuilding",{agentId:e.agentId}),await a.dispose("rebuild after error").catch(_=>W.warn("dispose stale agent failed (ignored)",{err:String(_)})),this.registry.unregister(e.agentId);else return W.info("agent already exists,return current",{agentId:e.agentId}),{ok:!0,agentId:a.agentId,workspace:a.workspace,pid:a.downstream.pid()??0,framework:a.framework}}let x=this.config.frameworksCache?.[e.framework];if(!x)if(o&&Gs(e.framework))x=Js;else throw new E("AGENT_SPAWN_FAILED",`framework ${e.framework} not detected on this machine; rerun daemon to refresh frameworks_cache`);let f=Ie(e.agentId,this.paths),d=e.workspace??f.workspace,g=new AbortController,p=setTimeout(()=>g.abort(new E("AGENT_TIMEOUT",`_agent/create timed out after ${this.createTimeoutMs}ms`)),this.createTimeoutMs);try{return await this.createAgentInner(e,f,d,x,g.signal)}finally{clearTimeout(p)}}async createAgentInner(e,o,a,x,f){let d=()=>{if(f.aborted)throw f.reason instanceof Error?f.reason:new E("AGENT_TIMEOUT","_agent/create aborted")},g,p,_=!1;try{await cr(o.root,{recursive:!0}),await cr(a,{recursive:!0}),await cr(o.logs,{recursive:!0}),d(),e.framework!=="openclaw"&&await Ge(a,e.framework,e.agentId,e.cozeIdentity),d();let w=await ae(e.agentId,this.paths).catch(()=>null),y=xr({model:e.model??w?.model,modelToken:e.modelToken??w?.modelToken});g=this.factory(e.framework,x.path,a,e.agentId,y),await g.start(),d(),await g.initialize(Ws),d(),e.framework==="openclaw"&&await Ge(a,"openclaw",e.agentId,e.cozeIdentity);let A=St(e._meta);if(p=new an({agentId:e.agentId,framework:e.framework,workspace:a,downstream:g,deployType:A}),p.status="ok",w?.sessions){for(let[R,K]of Object.entries(w.sessions))p.sessions.set(R,K);Object.keys(w.sessions).length>0&&W.info("restored persisted sessions for agent",{agentId:e.agentId,count:Object.keys(w.sessions).length})}this.registry.register(p),_=!0;let T={agentId:e.agentId,framework:e.framework,workspace:a,cozeIdentity:e.cozeIdentity,createdAt:w?.createdAt??Date.now(),sessions:w?.sessions??{},model:y.model};y.modelToken&&(T.modelToken=y.modelToken),A==="cloud"&&(T.deployType="cloud"),w?.skills&&(T.skills=w.skills),w?.agentName&&(T.agentName=w.agentName),w?.description&&(T.description=w.description),await de(T,this.paths);let N=g.pid()??0;return W.info("agent created",{agentId:e.agentId,framework:e.framework,pid:N}),this.installRestartHook(p),{ok:!0,agentId:e.agentId,workspace:a,pid:N,framework:e.framework}}catch(w){throw W.error("agent create failed,rolling back",{agentId:e.agentId,err:String(w)}),g?.cleanup&&await g.cleanup("rollback").catch(y=>W.warn("downstream cleanup failed (ignored)",{err:String(y)})),g&&await g.stop("rollback").catch(()=>{}),_&&p&&(await p.dispose("rollback").catch(()=>{}),this.registry.unregister(e.agentId)),await Ba(o.root,{recursive:!0,force:!0}).catch(y=>W.warn("rm agent dir failed (ignored)",{err:String(y)})),w instanceof E?w:new E("AGENT_SPAWN_FAILED",String(w),{cause:w})}}async reportHealth(e,o,a){if(!this.healthReporter){W.info("healthReporter not wired, skip _agent/health upstream",{agentId:e.agentId,status:o});return}try{await this.healthReporter({status:o,_meta:{cozeAgentId:e.agentId}}),W.info("_agent/health reported",{agentId:e.agentId,status:o,cause:a})}catch(x){W.warn("_agent/health upstream failed (ignored)",{agentId:e.agentId,status:o,err:String(x)})}}installRestartHook(e){let o=0,a=x=>{if(e.status==="stopped"||e.status==="disconnected"||e.status==="switching")return;if(o>=this.restartDelaysMs.length){W.error("agent restart exhausted",{agentId:e.agentId,attempts:o,...x}),e.status="error",this.reportHealth(e,"error",x);return}let f=this.restartDelaysMs[o]??5e3;o+=1,e.status="degraded",W.warn("agent restart scheduled",{agentId:e.agentId,attempt:o,delayMs:f,...x}),setTimeout(()=>{this.doRestart(e,o).then(d=>{d?(o=0,e.status="ok"):a(null)})},f)};e.downstream.onExit((x,f)=>a({code:x,signal:f}))}async spawnAndInitialize(e,o){let a=await ae(e.agentId,this.paths).catch(()=>null),x=a?xr(a):void 0,f=this.factory(e.framework,o,e.workspace,e.agentId,x);try{return await f.start(),await f.initialize(Ws),f}catch(d){throw await f.stop("spawnAndInitialize failed").catch(()=>{}),d}}rewireSession(e,o){e.swap(o),this.registry.attachHooks?.(e),this.installRestartHook(e)}async doRestart(e,o){let a=js(this.config,e);if(!a)return W.error("framework cache missing during restart",{agentId:e.agentId,framework:e.framework}),e.status="error",!1;W.info("agent restart attempt",{agentId:e.agentId,attempt:o});try{let x=await this.spawnAndInitialize(e,a.path);return this.rewireSession(e,x),W.info("agent restart succeeded",{agentId:e.agentId,attempt:o}),!0}catch(x){return W.warn("agent restart attempt failed",{agentId:e.agentId,attempt:o,err:String(x)}),!1}}async executeModelSwitch(e){let o=this.registry.get(e);if(!o)throw new E("AGENT_NOT_FOUND",`agent not found: ${e}`);let a=js(this.config,o);if(!a)throw new E("AGENT_SPAWN_FAILED",`framework ${o.framework} not detected; cannot respawn for switchModel`);W.info("executeModelSwitch: stopping old downstream",{agentId:e,framework:o.framework}),await o.downstream.stop("switchModel").catch(d=>{W.warn("stop old downstream failed (ignored, continuing)",{agentId:e,err:String(d)})});let x;try{x=await this.spawnAndInitialize(o,a.path)}catch(d){throw new E("MODEL_SWITCH_FAILED",`failed to spawn new downstream after switchModel: ${d instanceof Error?d.message:String(d)}`,{cause:d})}this.rewireSession(o,x);let f=[...o.sessions.entries()];for(let[d,g]of f)try{await x.sessionLoad({sessionId:g,cwd:o.workspace}),o.verifiedSessions.add(g)}catch(p){throw new E("MODEL_SWITCH_FAILED",`sessionLoad failed after switchModel for cloud session ${d} (acp=${g}): ${p instanceof Error?p.message:String(p)}`,{cause:p})}f.length>0&&W.info("executeModelSwitch: session/load reloaded",{agentId:e,count:f.length}),o.status="ok",W.info("executeModelSwitch: success",{agentId:e,framework:o.framework})}};F();import{spawn as Ua}from"node:child_process";import{constants as Xs,access as Ha}from"node:fs/promises";import{delimiter as Ka,join as ja}from"node:path";var Wa=M("framework-detector"),Vs={"claude-code":"claude",codex:"codex",openclaw:"openclaw"},Ga=[".exe",".cmd",".bat",".ps1"],Et=class{env;constructor(e={}){this.env={pathEnv:e.pathEnv??process.env.PATH??"",platform:e.platform??process.platform,spawn:e.spawn??Ua,access:e.access??Ha}}async detect(e){let o=Vs[e],a=await this.which(o);if(!a)return Wa.debug("framework binary not found",{framework:e,bin:o}),null;let x=await this.probeVersion(a);return{path:a,version:x}}async detectAll(){let e=await Promise.all(Object.keys(Vs).map(async a=>[a,await this.detect(a)])),o={};for(let[a,x]of e)x&&(o[a]=x);return o}async which(e){let o=this.env.pathEnv.split(Ka).filter(Boolean),a=this.env.platform==="win32"?["",...Ga]:[""];for(let x of o)for(let f of a){let d=ja(x,e+f);if(await this.isExecutable(d))return d}return null}async isExecutable(e){try{let o=this.env.platform==="win32"?Xs.F_OK:Xs.X_OK;return await this.env.access(e,o),!0}catch{return!1}}async probeVersion(e){return new Promise(o=>{let a="",x=!1,f,d=g=>{x||(x=!0,f&&clearTimeout(f),o(g.trim()||"unknown"))};try{let g=this.env.spawn(e,["--version"],{stdio:["ignore","pipe","pipe"]});f=setTimeout(()=>{g.kill("SIGKILL"),d("unknown")},5e3),g.stdout?.on("data",p=>{a+=p.toString("utf8")}),g.on("error",()=>d("unknown")),g.on("close",()=>{let p=Xa(a).split(/\r?\n/)[0]??"";d(p)})}catch{d("unknown")}})}},Ja=new RegExp("\x1B\\[[0-9;]*[A-Za-z]","g");function Xa(r){return r.replace(Ja,"")}ir();ce();function cn(r){return qt(r??U().configFile)}function At(r,e){return Ft(e??U().configFile,r)}Fe();F();var $=M("core"),Va=5*6e4,Ya=3e4,fn=class{upstream;agents=new Map;disconnectedAgents=new Set;extensions;paths;upstreamIds=new ft;pendingUpstream=new Map;pendingBridge=new Map;constructor(e){this.upstream=e.upstream,this.extensions=e.extensions??{},this.paths=e.paths}registerExtension(e,o){this.extensions[e]=o}async start(){this.upstream.onFrame(e=>this.handleFrame(e)),await this.upstream.start(),$.info("Core started",{extensions:Object.keys(this.extensions)})}async stop(e){$.info("Core stopping",{reason:e}),await Promise.all([...this.agents.values()].map(o=>o.dispose(e))),this.agents.clear(),await this.upstream.stop(e)}get(e){return this.agents.get(e)}register(e){this.agents.set(e.agentId,e),this.attachDownstreamHooks(e),$.info("agent registered",{agentId:e.agentId,framework:e.framework});for(let o of this.registerHandlers)try{o(e.agentId)}catch(a){$.warn("onAgentRegister handler threw (ignored)",{agentId:e.agentId,err:String(a)})}}onAgentRegister(e){return this.registerHandlers.add(e),()=>this.registerHandlers.delete(e)}registerHandlers=new Set;unregister(e){this.agents.delete(e)}reviveIfDisconnected(e){this.disconnectedAgents.delete(e)&&$.info("agent revived from disconnect",{agentId:e})}attachDownstreamHooks(e){e.downstream.onUpdate(o=>{this.forwardUpdate(e,o)}),e.downstream.onAgentRequest(o=>{this.handleAgentRequest(e,o)}),e.downstream.onExit((o,a)=>{$.warn("agent downstream exited",{agentId:e.agentId,code:o,signal:a})})}attachHooks(e){this.attachDownstreamHooks(e)}async handleFrame(e){if(Zt(e)){this.handleUpstreamResponse(e);return}if($t(e))try{if(e.method.startsWith("_agent/")){let o=this.extensions[e.method];if(!o){await this.sendError(e.id,H.METHOD_NOT_FOUND,`extension not registered: ${e.method}`);return}let a=await o(e,this);await this.upstream.send(ct(e.id,a));return}if(e.method.startsWith("session/")){let o=await this.routeSessionMethod(e);await this.upstream.send(ct(e.id,o));return}if(e.method==="initialize"){await this.upstream.send(ct(e.id,{protocolVersion:1,agentCapabilities:{loadSession:!0}}));return}await this.sendError(e.id,H.METHOD_NOT_FOUND,`method not implemented: ${e.method}`)}catch(o){$.error("handleFrame failed",{method:e.method,err:String(o)}),await this.upstream.send(Xe(e.id,en(o)))}}async routeSessionMethod(e){if(!e.params||typeof e.params!="object")throw new E("IPC_BAD_REQUEST",`${e.method} requires params`);let o=e.params,a=o._meta?.cozeAgentId;if(!a)throw new E("IPC_BAD_REQUEST",`${e.method}: missing _meta.cozeAgentId`);let x=this.agents.get(a);if(!x)throw this.disconnectedAgents.has(a)?new E("AGENT_DISCONNECTED",`agent ${a} has been disconnected; cloud must _agent/create to revive`):new E("AGENT_NOT_FOUND",`agent not found: ${a}`);if(x.status==="switching")throw new E("MODEL_SWITCHING",`agent ${a} is switching model; retry later`,{retriable:!0});let f=Date.now(),d=!1;try{let g=await x.msgQueue.enqueue(()=>this.dispatchSessionCall(x,e.method,o));return d=!0,g}finally{$.info("session call done",{agentId:x.agentId,method:e.method,durationMs:Date.now()-f,ok:d})}}async dispatchSessionCall(e,o,a){e.lastActiveAt=Date.now();let{stripped:x}=vs(a);switch(o){case"session/new":{let f=x;return await e.downstream.sessionNew({...f,cwd:f.cwd||e.workspace})}case"session/load":{let f=x,d=f.sessionId,g=e.sessions.get(d);try{let p=g??d,_=await e.downstream.sessionLoad({...f,sessionId:p,cwd:f.cwd||e.workspace});return g||e.sessions.set(d,p),_}catch(p){$.warn("session/load failed,fallback to session/new",{agentId:e.agentId,cloudId:d,err:String(p)});let _=await e.downstream.sessionNew({cwd:f.cwd||e.workspace});return e.sessions.set(d,_.sessionId),{}}}case"session/prompt":{let f=x,d=f.sessionId,g=e.sessions.get(d),p=!1;if(g&&!e.verifiedSessions.has(g))try{await e.downstream.sessionLoad({sessionId:g,cwd:e.workspace}),e.verifiedSessions.add(g),$.info("session restored via session/load",{agentId:e.agentId,cloudId:d,acpId:g})}catch(y){$.warn("session/load failed,fallback to session/new",{agentId:e.agentId,cloudId:d,acpId:g,err:String(y)}),e.sessions.delete(d),g=void 0}g||(g=(await e.downstream.sessionNew({cwd:e.workspace})).sessionId,e.sessions.set(d,g),e.verifiedSessions.add(g),p=!0);let _=a._meta?.cozeTriggerMsgId;_?e.activeTriggers.set(g,_):e.activeTriggers.delete(g);let w=await e.downstream.sessionPrompt({...f,sessionId:g});return p&&this.persistSessionMapping(e),w}case"session/cancel":{let d=x.sessionId;if(!d)throw new E("IPC_BAD_REQUEST","session/cancel: missing sessionId");let g=e.sessions.get(d);return g&&await e.downstream.sessionCancel({sessionId:g}),{ok:!0}}default:throw new E("IPC_BAD_REQUEST",`session method not supported: ${o}`)}}forwardUpdate(e,o){let a=o.sessionId,x=this.reverseSessionId(e,a);if(!x){$.debug("drop update for unknown session",{agentId:e.agentId,acpId:a});return}let f={cozeAgentId:e.agentId},d=e.activeTriggers.get(a);d&&(f.cozeTriggerMsgId=d),this.upstream.send(Os("session/update",{...o,sessionId:x,_meta:f})).catch(g=>$.warn("forward update failed",{agentId:e.agentId,err:String(g)}))}handleAgentRequest(e,o){if(o.method==="session/request_permission"){this.forwardPermissionRequest(e,o);return}$.warn("unhandled agent request,returning method_not_found",{agentId:e.agentId,method:o.method}),e.downstream.respondAgentRequestError(o.id,{code:H.METHOD_NOT_FOUND,message:`method not handled by Bridge: ${o.method}`})}forwardPermissionRequest(e,o){let a=this.upstreamIds.next("session/request_permission"),x=o.params??{},d=x.sessionId,g=d?e.activeTriggers.get(d):void 0,p={cozeAgentId:e.agentId};g&&(p.cozeTriggerMsgId=g);let _=d?this.reverseSessionId(e,d):void 0,w={...x,..._?{sessionId:_}:{},_meta:p},y=setTimeout(()=>{let A=this.pendingUpstream.get(a);A&&(this.pendingUpstream.delete(a),$.warn("upstream permission request timed out,replying cancelled to agent",{agentId:e.agentId,upstreamId:a}),e.downstream.respondAgentRequest(A.agentRequestId,{outcome:{kind:"cancelled"}}))},Va);this.pendingUpstream.set(a,{agentRequestId:o.id,session:e,method:o.method,timer:y}),this.upstream.send(xt(a,"session/request_permission",w)).catch(A=>{let T=this.pendingUpstream.get(a);T&&(clearTimeout(T.timer),this.pendingUpstream.delete(a)),$.error("forward permission request failed",{agentId:e.agentId,err:String(A)}),e.downstream.respondAgentRequestError(o.id,{code:H.INTERNAL_ERROR,message:`upstream send failed: ${String(A)}`})})}handleUpstreamResponse(e){if(e.id===null)return;let o=this.pendingUpstream.get(e.id);if(o){this.pendingUpstream.delete(e.id),clearTimeout(o.timer),e.error?o.session.downstream.respondAgentRequestError(o.agentRequestId,e.error):o.session.downstream.respondAgentRequest(o.agentRequestId,e.result);return}let a=this.pendingBridge.get(e.id);if(a){this.pendingBridge.delete(e.id),clearTimeout(a.timer),e.error?a.reject(new Qt(e.error)):a.resolve(e.result);return}$.debug("orphan upstream response (no pending)",{id:e.id})}sendRequest(e,o,a=Ya){let x=this.upstreamIds.next(e);return new Promise((f,d)=>{let g=setTimeout(()=>{this.pendingBridge.delete(x),d(new E("AGENT_TIMEOUT",`${e} timed out after ${a}ms`))},a);this.pendingBridge.set(x,{method:e,resolve:f,reject:d,timer:g}),this.upstream.send(xt(x,e,o)).catch(p=>{let _=this.pendingBridge.get(x);_&&(clearTimeout(_.timer),this.pendingBridge.delete(x)),d(p)})})}async persistSessionMapping(e){if(this.paths)try{await ar(e.agentId,e.sessions,this.paths)}catch(o){$.warn("persist session mapping failed",{agentId:e.agentId,err:String(o)})}}reverseSessionId(e,o){for(let[a,x]of e.sessions.entries())if(x===o)return a}sendError(e,o,a){return this.upstream.send(Xe(e,{code:o,message:a}))}};F();ce();import{randomBytes as Qa}from"node:crypto";import{chmod as $a,mkdir as Za,writeFile as Ys}from"node:fs/promises";import{createServer as ex}from"node:http";import{dirname as tx}from"node:path";var nx=1e6,fr=M("ipc"),un=class{server=null;port=0;token="";routes;paths;constructor(e){this.routes=new Map(e.routes.map(o=>[`${o.method} ${o.path}`,o])),this.paths=e.paths??U()}async start(){this.token=Qa(32).toString("hex");let e=ex((a,x)=>{this.dispatch(a,x)});this.server=e,await new Promise((a,x)=>{e.once("error",x),e.listen(0,"127.0.0.1",()=>a())});let o=e.address();if(!o||typeof o!="object")throw new Error("failed to obtain IPC port");return this.port=o.port,await this.persistAuthFiles(),fr.info("IPC listening",{port:this.port}),{port:this.port,token:this.token}}async stop(){let e=this.server;e&&(await new Promise((o,a)=>{e.close(x=>x?a(x):o())}),this.server=null)}async persistAuthFiles(){await Za(tx(this.paths.portFile),{recursive:!0}),await Ys(this.paths.portFile,String(this.port),"utf8"),await Ys(this.paths.tokenFile,this.token,"utf8");try{await $a(this.paths.tokenFile,384)}catch(e){fr.warn("chmod token file failed (non-POSIX?)",{err:String(e)})}}async dispatch(e,o){if(e.headers.authorization!==`Bearer ${this.token}`){kt(o,401,{error:"unauthorized"});return}let x=`${e.method} ${(e.url??"").split("?")[0]}`,f=this.routes.get(x);if(!f){kt(o,404,{error:"not found"});return}let d=null;if(e.method==="POST")try{d=await rx(e)}catch(g){kt(o,400,{error:"invalid json",detail:String(g)});return}try{let g=await f.handler(d,e);kt(o,200,g??{ok:!0})}catch(g){fr.error("IPC handler failed",{key:x,err:String(g)}),kt(o,500,{error:g instanceof Error?g.message:String(g)})}}};function kt(r,e,o){r.statusCode=e,r.setHeader("content-type","application/json"),r.end(JSON.stringify(o))}async function rx(r){let e=[],o=0;for await(let x of r){let f=x;if(o+=f.length,o>nx)throw new Error("body too large");e.push(f)}let a=Buffer.concat(e).toString("utf8");return a?JSON.parse(a):null}var So=Pe(ai(),1);var zc=Pe(no(),1),qc=Pe(kn(),1),Fc=Pe(lt(),1),Uc=Pe(Sr(),1),Hc=Pe(Ar(),1),Kc=Pe(Lr(),1),uo=Pe(Tn(),1),jc=Pe(fo(),1);var lo=uo.default;F();var Nn="1008033",ho="1289";var go="pbbp2",po="https://www.coze.cn",mo="/api/coze_claw/resource/get_frontier_key",Wc="https://www.coze.cn",Gc="wss://frontier.coze.cn";function _o(r){return r??process.env.COZE_BRIDGE_HANDSHAKE_URL??Wc}function wo(r){return r??process.env.COZE_BRIDGE_FRONTIER_URL??Gc}function Mn(r){let e={},o=r?.ttEnv??process.env.COZE_BRIDGE_TT_ENV,a=r?.usePpe??process.env.COZE_BRIDGE_USE_PPE;return o&&(e["x-tt-env"]=o),a&&(e["x-use-ppe"]=a),e}var se=M("upstream.frontier"),bo="application/json",vo="none",Rn=class{constructor(e){this.opts=e}opts;fws=null;handler=null;connectHandler=null;opened=!1;openCount=0;async start(){if(this.fws){se.warn("start called on already-started FrontierUpstream; noop");return}let e={Authorization:`Bearer ${this.opts.privatecode}`,Origin:po,...Mn(this.opts.ppeOverride)};class o extends lo{constructor(g){super(g,go,{headers:e})}send(g,...p){if(ys("debug"))try{let _;typeof g=="string"?_=Buffer.from(g,"utf8"):g instanceof Buffer?_=g:g instanceof ArrayBuffer?_=new Uint8Array(g):ArrayBuffer.isView(g)?_=new Uint8Array(g.buffer,g.byteOffset,g.byteLength):_=new Uint8Array(0);let w=Buffer.from(_.slice(0,128)).toString("hex");se.debug("WS raw frame out",{bytes:_.byteLength,headHex:w})}catch(_){se.warn("WS raw frame dump failed",{err:String(_)})}super.send(g,...p)}}let a=wo(this.opts.urlOverride),x={url:a,ws:o,fpID:ho,aID:Nn,accessKey:this.opts.handshake.accessKey,deviceID:this.opts.handshake.deviceId,payloadType:{type:bo,force:!0},payloadEncoding:{encoding:vo,force:!0},enableTransformTextPayload:!0,enableQoS:!1,enableAutoAck:!1,automaticOpen:!1,debug:this.opts.debug??!1},f=new So.FWS(x);f.onopen=()=>{this.opened=!0,this.openCount+=1;let d=this.openCount===1;se.info("frontier opened",{url:a,remoteDeviceId:this.opts.handshake.deviceId,initial:d,openCount:this.openCount}),this.connectHandler&&Promise.resolve(this.connectHandler({initial:d})).catch(g=>se.warn("onConnect handler threw (ignored)",{err:String(g)}))},f.onclose=d=>{this.opened=!1,se.info("frontier closed",{code:d.code,reason:d.reason,willReconnect:d.willReconnect})},f.onerror=d=>{se.warn("frontier error",{code:d.code,msg:d.message})},f.onmessage=d=>this.handleMessage(d),this.fws=f,await f.connect()}async stop(e){let o=this.fws;if(o){this.fws=null,this.opened=!1;try{o.close(1e3,e??"bridge shutdown")}catch(a){se.warn("frontier close threw (ignored)",{err:String(a)})}}}async send(e){let o=this.fws;if(!o)throw new E("UPSTREAM_DISCONNECTED","frontier upstream not started");let a=JSON.stringify(e),x=e;se.info("frontier frame out",{method:x.method,jsonrpcId:x.id,size:a.length});try{await o.send(a,{service:33555712,method:1,payloadType:bo,payloadEncoding:vo})}catch(f){throw new E("UPSTREAM_DISCONNECTED",`frontier send failed: ${String(f)}`,{cause:f})}}onFrame(e){this.handler=e}onConnect(e){this.connectHandler=e}isConnected(){return this.opened&&this.fws?.readyState===1}handleMessage(e){let o=e.message?.service;if(o!==33555712){se.debug("drop non-adapter frontier frame",{service:o});return}let a=Vc(e);if(!a){se.debug("frontier message without text payload, drop",{payloadType:e.message?.payloadType});return}if(!this.handler){se.debug("frame received but no onFrame handler",{size:a.length});return}let x;try{x=JSON.parse(a)}catch(f){se.warn("frontier message JSON parse failed",{err:String(f),head:a.slice(0,80)});return}se.info("frontier frame in",{logid:Xc(e.message?.LogID),logidNew:e.message?.LogIDNew,msgId:e.message?.msgID,jsonrpcId:x.id}),Promise.resolve(this.handler(x)).catch(f=>se.warn("frontier frame handler threw",{err:String(f)}))}};function Xc(r){return r?r.high===0?String(r.low>>>0):`${r.high.toString(16)}${(r.low>>>0).toString(16).padStart(8,"0")}`:""}function Vc(r){let e=r.message;if(e?.textPayload)return e.textPayload;let o=e?.payload;if(!o)return null;try{return Buffer.from(o).toString("utf8")}catch{return null}}F();function Eo(r){return r?r.startsWith("boe_")?{ttEnv:r}:{ttEnv:r,usePpe:"1"}:{}}var Co=M("handshake");async function Ao(r){let e=_o(r.endpoint),o=r.timeoutMs??1e4,a=`${Yc(e)}${mo}?aid=${encodeURIComponent(Nn)}`,x={Authorization:`Bearer ${r.privatecode}`,Accept:"application/json",...Mn(r.ppeOverride)},f=new AbortController,d=setTimeout(()=>f.abort(),o);Co.info("frontier key handshake",{base:e});try{let g=await fetch(a,{method:"GET",headers:x,signal:f.signal}),p=g.headers.get("x-tt-logid")??"",_=g.headers.get("x-tt-trace-id")??"";if(!g.ok){let T=await g.text().catch(()=>"");throw new E("UPSTREAM_HANDSHAKE_FAILED",`handshake HTTP ${g.status} logid=${p}: ${T.slice(0,200)}`)}let w=await g.json();if(w.code!==void 0&&w.code!==0)throw new E("UPSTREAM_HANDSHAKE_FAILED",`handshake code=${w.code} msg=${w.msg??"-"} logid=${p}`);let y=w.data?.access_key,A=w.data?.device_id;if(!y||!A)throw new E("UPSTREAM_HANDSHAKE_FAILED",`handshake response missing access_key/device_id logid=${p}: ${JSON.stringify(w)}`);return Co.info("handshake ok",{remoteDeviceId:A,logid:p,traceId:_}),{accessKey:y,deviceId:A}}catch(g){throw g instanceof E?g:g.name==="AbortError"?new E("UPSTREAM_HANDSHAKE_FAILED",`handshake timeout (${o}ms)`):new E("UPSTREAM_HANDSHAKE_FAILED",String(g),{cause:g})}finally{clearTimeout(d)}}function Yc(r){return r.endsWith("/")?r.slice(0,-1):r}F();var Mr=M("upstream.switchable"),On=class{inner;handler=null;connectHandler=null;constructor(e){this.inner=e}async swap(e,o){if(this.inner===e)return;Mr.info("swap upstream",{reason:o});let a=this.inner;this.inner=e,this.handler&&e.onFrame(this.handler),this.connectHandler&&e.onConnect&&e.onConnect(this.connectHandler);try{await e.start()}catch(x){throw Mr.error("swap target start failed, reverting",{err:String(x)}),this.inner=a,x}await a.stop(o??"swapped").catch(x=>Mr.warn("previous upstream stop threw (ignored)",{err:String(x)}))}current(){return this.inner}start(){return this.inner.start()}stop(e){return this.inner.stop(e)}send(e){return this.inner.send(e)}onFrame(e){this.handler=e,this.inner.onFrame(e)}onConnect(e){this.connectHandler=e,this.inner.onConnect?.(e)}isConnected(){return this.inner.isConnected()}};F();var Rr=M("upstream"),Ot=class{handler=null;async start(){Rr.info("NoopUpstream started (M1 skeleton; real Frontier wired in M4)")}async stop(e){Rr.info("NoopUpstream stopped",{reason:e})}async send(e){Rr.debug("NoopUpstream.send (dropped)",{method:"method"in e?e.method:void 0})}onFrame(e){this.handler=e}isConnected(){return!1}async injectFrame(e){this.handler&&await this.handler(e)}};F();ce();F();ce();import{readFileSync as Qc,unlinkSync as $c}from"node:fs";import{mkdir as Zc,readFile as ko,unlink as Do,writeFile as ef}from"node:fs/promises";import{dirname as tf}from"node:path";var nf=M("single-instance"),Bn=class{pidFile;acquired=!1;constructor(e={}){this.pidFile=e.pidFile??U().pidFile,e.processTitle&&(process.title=e.processTitle)}async acquire(){let e=await this.readExistingPid();return e!==null&&this.isAlive(e)?{kind:"already-running",pid:e}:(e!==null&&(nf.warn("removing stale pid file",{stalePid:e}),await Do(this.pidFile).catch(()=>{})),await Zc(tf(this.pidFile),{recursive:!0}),await ef(this.pidFile,String(process.pid),"utf8"),this.acquired=!0,this.installCleanupHooks(),{kind:"acquired"})}async release(){if(this.acquired){try{(await ko(this.pidFile,"utf8")).trim()===String(process.pid)&&await Do(this.pidFile)}catch{}this.acquired=!1}}async readExistingPid(){try{let e=await ko(this.pidFile,"utf8"),o=Number.parseInt(e.trim(),10);return Number.isFinite(o)&&o>0?o:null}catch(e){if(e.code==="ENOENT")return null;throw e}}isAlive(e){try{return process.kill(e,0),!0}catch(o){return o.code==="EPERM"}}installCleanupHooks(){process.once("exit",()=>{if(this.acquired)try{Qc(this.pidFile,"utf8").trim()===String(process.pid)&&$c(this.pidFile)}catch{}})}};var B=M("daemon"),rf="coze-bridge-daemon";async function To(){let r=new Bn({processTitle:rf}),e=await r.acquire();if(e.kind==="already-running")throw new Error(`coze-bridge daemon already running (pid=${e.pid})`);let o=await cn(),a=o??{};or({pid:process.pid}),B.info(o?"loaded bridge config":"initialized bridge config");try{let D=new Et;a.frameworksCache=await D.detectAll(),B.info("refreshed frameworks_cache",{detected:Object.keys(a.frameworksCache)})}catch(D){B.warn("framework detection failed",{err:String(D)})}await At(a);let x=new On(new Ot),f=U(),d=new fn({upstream:x,paths:f});await of(f,d);let g=new xn({paths:f,config:a,registry:d,healthReporter:async D=>{await d.sendRequest("_agent/health",D)}}),p,_,w=null,y=null;d.registerExtension("_agent/create",async D=>g.createAgent(D.params)),d.registerExtension("_agent/health",async()=>({ok:!0}));let A=new Vt({agents:d.agents,disposeAndMarkDisconnected:async(D,z)=>{let G=d.agents.get(D);G&&(await G.dispose(`disconnect: ${z}`).catch(Ae=>B.warn("dispose during disconnect failed (ignored)",{agentId:D,err:String(Ae)})),G.status="disconnected",d.unregister(D)),d.disconnectedAgents.add(D)},executeModelSwitch:D=>g.executeModelSwitch(D)});d.registerExtension("_agent/listSkills",D=>A.listSkills(D.params)),d.registerExtension("_agent/addSkills",D=>A.addSkills(D.params)),d.registerExtension("_agent/removeSkills",D=>A.removeSkills(D.params)),d.registerExtension("_agent/getFileTree",D=>A.getFileTree(D.params)),d.registerExtension("_agent/getFileContent",D=>A.getFileContent(D.params)),d.registerExtension("_agent/update",D=>A.updateAgent(D.params)),d.registerExtension("_agent/disconnect",D=>A.disconnectAgent(D.params)),d.registerExtension("_agent/switchModel",D=>A.switchModel(D.params));let T=new Gt({paths:f,handlers:A,sendDetail:D=>d.sendRequest("_agent/detail",D)});x.onConnect(({initial:D})=>{B.info("frontier upstream connected, triggering detail sync",{initial:D}),T.syncAll(D?"initial-connect":"reconnect").catch(z=>B.warn("detail sync top-level error (ignored)",{err:String(z)}))});let N=new un({paths:f,routes:[{method:"GET",path:"/status",handler:async()=>({running:!0,pid:process.pid,agents:[...d.agents.keys()],deviceId:w??"",frameworksCache:a.frameworksCache??{}})},{method:"POST",path:"/pair",handler:async D=>{let z=D,G=z?.privatecode,Ae=z?.pairing_code;if(!G||!Ae)throw new E("IPC_BAD_REQUEST","/pair requires privatecode + pairing_code");let Oe=Eo(z.env),we=z.handshake_url,ye=z.frontier_url,ge=sf(z.env,we,ye),et=!!p&&p!==G,Bt=_!==void 0&&_!==ge,zt=et||Bt;if(zt){B.warn("pair config switched, resetting agents",{pcChanged:et,envChanged:Bt,previousPc:p?Po(p):"",nextPc:Po(G),previousEnvKey:_??"",nextEnvKey:ge});for(let J of[...d.agents.values()])await J.dispose("pair config switch").catch(()=>{}),d.agents.delete(J.agentId);await x.swap(new Ot,"pair switch").catch(()=>{})}let be=await Ao({privatecode:G,...we?{endpoint:we}:{},ppeOverride:Oe});w=be.deviceId,or({deviceId:w,pid:process.pid});let ke=new Rn({handshake:be,privatecode:G,...ye?{urlOverride:ye}:{},ppeOverride:Oe});await x.swap(ke,"pair"),p=G,_=ge;let Wn=Object.keys(a.frameworksCache??{});try{let J=await d.sendRequest("_agent/pair",{pairCode:Ae,patToken:G,frameworks:Wn,_meta:{cozeDeviceId:w}});B.info("_agent/pair ok",{pairResult:J}),y||(y=new Yt({core:d,getDeviceId:()=>w??""})),y.start(),zt&&Io(f,g).catch(j=>B.warn("post-pair-switch auto-revive error (ignored)",{err:String(j)}));let nt;return z.agent_id&&(nt=await af(z.agent_id,f,g,j=>d.sendRequest("_agent/detail",j)).catch(j=>(B.error("--agent-id ensureAgent failed",{agentId:z.agent_id,err:String(j)}),{ok:!1,agentId:z.agent_id??"",note:String(j)}))),{ok:!0,note:"paired with cloud",...nt?{agent:nt}:{}}}catch(J){return B.error("_agent/pair failed",{err:String(J)}),{ok:!1,note:`pair failed: ${String(J)}`}}}},{method:"POST",path:"/_agent/create",handler:async D=>{let z=D;return{ok:!0,result:await g.createAgent(z)}}},{method:"POST",path:"/refresh",handler:async()=>{B.info("IPC /refresh: re-detecting frameworks");let D=new Et;return a.frameworksCache=await D.detectAll(),await At(a),{ok:!0,frameworks:a.frameworksCache}}},{method:"POST",path:"/shutdown",handler:async()=>(B.info("IPC /shutdown received"),setImmediate(()=>{xe.shutdown("ipc /shutdown")}),{ok:!0})}]}),{port:R,token:K}=await N.start();await d.start(),Io(f,g).catch(D=>B.warn("auto-revive top-level error (ignored)",{err:String(D)}));let ie=null,xe={port:R,token:K,core:d,ipc:N,shutdown(D){return ie||(B.info("daemon shutdown",{reason:D}),ie=(async()=>{y?.stop(),await d.stop(D),await N.stop(),await r.release()})(),ie)}};for(let D of["SIGTERM","SIGINT"])process.on(D,()=>{xe.shutdown(D).then(()=>process.exit(0))});return B.info("daemon ready",{port:R,pid:process.pid,nodeVersion:process.version,platform:process.platform,frameworks:Object.keys(a.frameworksCache??{}),libVersion:a.libVersion??"dev"}),xe}function Po(r){return r.length<=8?"***":`${r.slice(0,4)}***${r.slice(-4)}`}function sf(r,e,o){return`${r??""}|${e??""}|${o??""}`}async function of(r,e){let{readdir:o}=await import("node:fs/promises"),a;try{a=await o(r.agentsRoot)}catch{return}let{loadAgentConfig:x,enforceAgentConfigMode:f}=await Promise.resolve().then(()=>(Fe(),Wt));for(let d of a){await f(d,r).catch(g=>B.warn("enforceAgentConfigMode failed (ignored)",{agentId:d,err:String(g)}));try{let g=await x(d,r);g?.disconnectedAt&&(e.disconnectedAgents.add(d),B.info("agent marked disconnected on startup",{agentId:d,disconnectedAt:g.disconnectedAt,reason:g.disconnectReason??""}))}catch(g){B.warn("failed to load agent config on startup, skipping",{agentId:d,err:String(g)})}}}async function af(r,e,o,a){let{loadAgentConfig:x}=await Promise.resolve().then(()=>(Fe(),Wt)),f=await x(r,e);if(f){B.info("--agent-id: local config found, reconnecting",{agentId:r,framework:f.framework,hadDisconnect:!!f.disconnectedAt});let _={agentId:f.agentId,framework:f.framework,...f.cozeIdentity?{cozeIdentity:f.cozeIdentity}:{},...f.model?{model:f.model}:{},...f.modelToken?{modelToken:f.modelToken}:{}};return await o.createAgent(_),{ok:!0,agentId:r,note:f.disconnectedAt?"revived from local config":"connected from local config"}}B.info("--agent-id: local config missing, pulling _agent/detail from cloud",{agentId:r});let d=await a({_meta:{cozeAgentId:r}});if(!d.framework)throw new E("AGENT_NOT_FOUND",`agent ${r} \u4E0D\u5728\u672C\u5730; \u4E91\u7AEF _agent/detail \u54CD\u5E94\u7F3A framework \u5B57\u6BB5 (D36 \u534F\u8BAE\u6269\u5C55\u672A\u751F\u6548), \u65E0\u6CD5\u5728\u672C\u673A\u65B0\u5EFA`);let g={agentId:d.agentId,framework:d.framework,...d.cozeIdentity?{cozeIdentity:d.cozeIdentity}:{},...d.model?{model:d.model}:{},...d.modelToken?{modelToken:d.modelToken}:{},...d.deployType?{_meta:{cozeDeployType:d.deployType}}:{}};await o.createAgent(g);let p=d.deployType==="cloud"&&d.framework==="openclaw";return{ok:!0,agentId:r,note:p?"cloud agent acknowledged":"created from cloud detail"}}async function Io(r,e){let{readdir:o}=await import("node:fs/promises"),a;try{a=await o(r.agentsRoot)}catch{return{revived:0,skipped:0,total:0}}if(a.length===0)return{revived:0,skipped:0,total:0};let{loadAgentConfig:x}=await Promise.resolve().then(()=>(Fe(),Wt));B.info("auto-revive: scanning local agents on startup",{count:a.length});let f=0,d=0;for(let g of a){let p;try{p=await x(g,r)}catch(_){B.warn("auto-revive: load config failed (skipping)",{agentId:g,err:String(_)}),d+=1;continue}if(!p){d+=1;continue}if(p.disconnectedAt){B.info("auto-revive: skip disconnected agent",{agentId:g,disconnectedAt:p.disconnectedAt}),d+=1;continue}try{B.info("auto-revive: spawning",{agentId:g,framework:p.framework}),await e.createAgent({agentId:p.agentId,framework:p.framework,...p.cozeIdentity?{cozeIdentity:p.cozeIdentity}:{},...p.model?{model:p.model}:{},...p.modelToken?{modelToken:p.modelToken}:{},...p.deployType?{_meta:{cozeDeployType:p.deployType}}:{}}),f+=1}catch(_){B.warn("auto-revive: createAgent failed (skipping)",{agentId:g,framework:p.framework,err:String(_)}),d+=1}}return B.info("auto-revive: done",{revived:f,skipped:d,total:a.length}),{revived:f,skipped:d,total:a.length}}Br();ce();import{readFile as No}from"node:fs/promises";var je=class{paths;constructor(e){this.paths=e??U()}async probe(e=1e3){let o=await this.readAuth();if(!o)return{kind:"not-running"};try{let a=await this.fetch(o,{method:"GET",path:"/status",timeoutMs:e});return a.status===200?{kind:"connected",...o}:{kind:"stale",reason:`unexpected status ${a.status}`}}catch(a){return{kind:"stale",reason:pf(a)}}}async request(e){let o=await this.readAuth();if(!o)throw new Error("coze-bridge daemon not running (no port/token files)");return this.fetch(o,e)}async readAuth(){try{let[e,o]=await Promise.all([No(this.paths.portFile,"utf8"),No(this.paths.tokenFile,"utf8")]),a=Number.parseInt(e.trim(),10),x=o.trim();return!Number.isFinite(a)||a<=0||!x?null:{port:a,token:x}}catch(e){if(e.code==="ENOENT")return null;throw e}}async fetch(e,o){let a=o.body!==void 0,x={Authorization:`Bearer ${e.token}`};a&&(x["content-type"]="application/json");let f=new AbortController,d=setTimeout(()=>f.abort(),o.timeoutMs??5e3);try{let g=await fetch(`http://127.0.0.1:${e.port}${o.path}`,{method:o.method,headers:x,body:a?JSON.stringify(o.body):void 0,signal:f.signal}),p=await g.text();return{status:g.status,body:gf(p)}}finally{clearTimeout(d)}}};function gf(r){if(!r)return null;try{return JSON.parse(r)}catch{return r}}function pf(r){return r instanceof Error?r.message:String(r)}F();ce();import{copyFile as Mo,mkdir as mf,readFile as zr,writeFile as _f}from"node:fs/promises";import{dirname as wf,resolve as qr,sep as zn}from"node:path";import{fileURLToPath as yf}from"node:url";F();ce();var Ro=M("dist-install");function bf(r){let e=yf(r),o=wf(e),a=`${zn}src${zn}`;if(o.includes(a)||o.endsWith(`${zn}src${zn}cli`))return null;let x=qr(o,"index.js"),f=qr(o,"..","package.json");return{dist:x,pkgJson:f}}async function Oo(r={}){let e=r.paths??U(),o=bf(import.meta.url),a=r.sourceDist??o?.dist,x=r.sourcePackageJson??o?.pkgJson;if(!a||!x)return{kind:"dev-mode-skip",reason:"running from src/(tsx loader);no dist/ to install"};let f;try{f=JSON.parse(await zr(x,"utf8")).version??"unknown"}catch(y){return Ro.warn("cannot read source package.json,skip dist install",{err:String(y)}),{kind:"dev-mode-skip",reason:`package.json read failed: ${String(y)}`}}let d=await cn(e.configFile)??{},g=d.libVersion;if(g===f)try{return await zr(e.libEntry),{kind:"already-current",libVersion:f}}catch{}await mf(e.libDir,{recursive:!0}),await Mo(a,e.libEntry),await Mo(`${a}.map`,`${e.libEntry}.map`).catch(()=>{});let p=qr(e.libDir,"package.json"),_=`${JSON.stringify({type:"module"},null,2)}
91
- `;return await zr(p,"utf8").catch(()=>null)!==_&&await _f(p,_),d.libVersion=f,await At(d,e.configFile),Ro.info("dist installed",{libEntry:e.libEntry,fromVersion:g,toVersion:f}),g?{kind:"version-changed",fromVersion:g,toVersion:f,libEntry:e.libEntry}:{kind:"first-install",libVersion:f,libEntry:e.libEntry}}var Ff=M("cli");function wt(r,e){let o=[],a;for(let x=0;x<r.length;x++){let f=r[x];if(f===e){a=r[x+1],x+=1;continue}if(f.startsWith(`${e}=`)){a=f.slice(e.length+1);continue}o.push(f)}return{value:a,rest:o}}function Uf(r){let e=r.slice(2);if(e.includes("--daemon"))return{mode:"daemon"};if(e.includes("--status"))return{mode:"status"};if(e.includes("--stop"))return{mode:"stop"};if(e.includes("--refresh"))return{mode:"refresh"};if(e.includes("--uninstall"))return{mode:"uninstall"};if(e.includes("--install-service"))return{mode:"install-service"};if(e.includes("--help")||e.includes("-h")||e.length===0)return{mode:"help"};let o=e,{value:a,rest:x}=wt(o,"--pat-token");o=x;let{value:f,rest:d}=wt(o,"--pair-code");o=d;let{value:g,rest:p}=wt(o,"--env");o=p;let{value:_,rest:w}=wt(o,"--handshake-url");o=w;let{value:y,rest:A}=wt(o,"--frontier-url");o=A;let{value:T}=wt(o,"--agent-id");if(!a||!f)return{mode:"help"};let N={mode:"pair",privatecode:a,pairingCode:f};return g&&(N.env=g),_&&(N.handshakeUrl=_),y&&(N.frontierUrl=y),T&&(N.agentId=T),N}var Hf=`
91
+ `);this.buffer=o.pop()??"";let a=[];for(let x of o){let f=x.replace(/\r$/,"").trim();if(f)try{a.push(JSON.parse(f))}catch(d){this.onError?.({line:f,error:d})}}return a}flush(){if(!this.buffer)return[];let e=this.buffer.replace(/\r$/,"").trim();if(this.buffer="",!e)return[];try{return[JSON.parse(e)]}catch(o){return this.onError?.({line:e,error:o}),[]}}};var js={"session/prompt":"session.prompt","session/cancel":"session.cancel","session/new":"session.new","session/load":"session.load","_agent/create":"agent.create","_agent/health":"agent.health","_agent/pair":"agent.pair","_agent/listSkills":"agent.listSkills","_agent/addSkills":"agent.addSkills","_agent/removeSkills":"agent.removeSkills","_agent/getFileTree":"agent.getFileTree","_agent/getFileContent":"agent.getFileContent","_agent/detail":"agent.detail","_agent/update":"agent.update","_agent/disconnect":"agent.disconnect","_agent/switchModel":"agent.switchModel","_agent/genModelToken":"agent.genModelToken","session/request_permission":"session.requestPermission",initialize:"initialize"},Yu=Object.fromEntries(Object.entries(js).map(([r,e])=>[e,r])),Ta={"session.prompt":["agentId","triggerMsgId","sessionId"],"session.cancel":["agentId","triggerMsgId","sessionId"],"session.new":["agentId"],"session.load":["agentId"],"agent.create":["agentId"],"agent.health":["agentId"],"agent.listSkills":["agentId"],"agent.addSkills":["agentId"],"agent.removeSkills":["agentId"],"agent.getFileTree":["agentId"],"agent.getFileContent":["agentId"],"agent.detail":["agentId"],"agent.update":["agentId"],"agent.disconnect":["agentId"],"agent.switchModel":["agentId"],"agent.genModelToken":["agentId","sessionId"],"session.requestPermission":["agentId","sessionId"],"agent.pair":[],initialize:[]},ct=class{seq=0;next(e,o){this.seq+=1;let a=js[e]??Ia(e),x=Ta[a]??[],f=[a,String(this.seq)];if(x.length>0){let d=x.map(_=>Gs(o?.[_]??"")),h=Na(d).join(":");h&&f.push(h)}else o&&Object.values(o).some(d=>d)&&f.push(Object.values(o).filter(Boolean).map(d=>Gs(String(d))).join(":"));return f.join("_")}reset(){this.seq=0}};function Ia(r){return r.replace(/[\s/]+/g,".").replace(/_+/g,"-")}function Gs(r){return r.replace(/[:_\s]+/g,"-")}function Na(r){let e=r.length;for(;e>0&&!r[e-1];)e-=1;return r.slice(0,e)}K();var Ba=3e4;function Ws(r,e){if(!(typeof r!="number"||r<=0))try{process.platform==="win32"?process.kill(r,e):process.kill(-r,e)}catch{}}var Fe=class{constructor(e){this.opts=e;this.log=B(`downstream.${this.constructor.name}`),this.decoder=new tn({onError:o=>this.log.warn("decode line failed",{line:o.line})})}opts;child;decoder;pending=new Map;idAllocator=new ct;updateHandlers=[];agentRequestHandlers=[];exitHandlers=[];log;stopped=!1;sanitizeEnv(e){return e}async start(){if(this.child)throw new C("BRIDGE_INTERNAL","Downstream already started");let e=process.platform!=="win32",o=Ra(this.opts.command,this.opts.args,{cwd:this.opts.cwd,env:{...this.sanitizeEnv(process.env),...this.opts.env},stdio:["pipe","pipe","pipe"],detached:e});this.child=o,o.stdout?.setEncoding("utf8"),o.stdout?.on("data",a=>{for(let x of this.decoder.push(a))this.dispatch(x)}),o.stderr?.setEncoding("utf8"),o.stderr?.on("data",a=>{this.log.debug("stderr",{text:a.trimEnd()})}),o.on("exit",(a,x)=>{this.stopped=!0,this.failAllPending(new C("AGENT_PROTOCOL_ERROR",`agent exited (${a}/${x})`));for(let f of this.exitHandlers)f(a,x)}),o.on("error",a=>{this.log.error("child error",{err:String(a)}),this.failAllPending(new C("AGENT_SPAWN_FAILED",String(a),{cause:a}))}),this.log.info("downstream started",{command:this.opts.command,pid:o.pid,cwd:this.opts.cwd})}async stop(e){if(!this.child||this.stopped)return;this.stopped=!0,this.log.info("downstream stopping",{reason:e});let o=this.child,a=new Promise(f=>o.once("exit",()=>f()));Ws(o.pid,"SIGTERM");let x=setTimeout(()=>{o.killed||Ws(o.pid,"SIGKILL")},5e3);try{await a}finally{clearTimeout(x)}}pid(){return this.child?.pid}isAlive(){return!!this.child&&!this.stopped}initialize(e){return this.call("initialize",e)}sessionNew(e){return this.call("session/new",{mcpServers:[],...e})}sessionLoad(e){return this.call("session/load",{mcpServers:[],...e})}sessionPrompt(e){return this.call("session/prompt",e,0)}async sessionCancel(e){!this.child||this.stopped||this.writeFrame(Zt("session/cancel",e))}onUpdate(e){this.updateHandlers.push(e)}onAgentRequest(e){this.agentRequestHandlers.push(e)}respondAgentRequest(e,o){if(!(!this.child||this.stopped))try{this.writeFrame(xt(e,o))}catch(a){this.log.warn("respondAgentRequest write failed",{id:e,err:String(a)})}}respondAgentRequestError(e,o){if(!(!this.child||this.stopped))try{this.writeFrame(Ve(e,o))}catch(a){this.log.warn("respondAgentRequestError write failed",{id:e,err:String(a)})}}onExit(e){this.exitHandlers.push(e)}call(e,o,a=Ba){if(!this.child||this.stopped)return Promise.reject(new C("AGENT_PROTOCOL_ERROR","downstream not started"));let x=this.idAllocator.next(e),f=Et(x,e,o),d=a>0&&Number.isFinite(a);return new Promise((h,_)=>{let v=d?setTimeout(()=>{this.pending.delete(x),_(new C("AGENT_TIMEOUT",`${e} timed out after ${a}ms`))},a):null;this.pending.set(x,{resolve:h,reject:_,timer:v,method:e});try{this.writeFrame(f)}catch(b){v&&clearTimeout(v),this.pending.delete(x),_(b)}})}writeFrame(e){if(!this.child?.stdin||this.child.stdin.destroyed)throw new C("AGENT_PROTOCOL_ERROR","downstream stdin not writable");this.child.stdin.write(Hs(e))}dispatch(e){if(Qt(e)){let o=e.id!==null?this.pending.get(e.id):void 0;if(!o){this.log.warn("orphan response",{id:e.id});return}this.pending.delete(e.id),o.timer&&clearTimeout(o.timer),e.error?o.reject(Ks(e.error)):o.resolve(e.result);return}if(Us(e)){if(e.method==="session/update")for(let o of this.updateHandlers)Promise.resolve(o(e.params)).catch(a=>this.log.warn("update handler failed",{err:String(a)}));else this.log.debug("unknown notification",{method:e.method});return}if(Fs(e)){let o=e;this.handleAgentRequest(o).catch(a=>this.log.error("agent request handler failed",{method:o.method,err:String(a)}))}}async handleAgentRequest(e){if(this.agentRequestHandlers.length===0){this.writeFrame(Ve(e.id,{code:-32601,message:`method not handled by Bridge: ${e.method}`}));return}for(let o of this.agentRequestHandlers)try{await o(e)}catch(a){this.log.error("agentRequestHandler threw",{method:e.method,err:String(a)});try{this.writeFrame(Ve(e.id,en(a)))}catch{}}}failAllPending(e){for(let o of this.pending.values())o.timer&&clearTimeout(o.timer),o.reject(e);this.pending.clear()}};var Oa="@zed-industries/claude-code-acp@latest";function Ma(r){let e={};for(let[o,a]of Object.entries(r))a!==void 0&&(o.startsWith("CLAUDE")||o==="AI_AGENT"||o==="BAGGAGE"||(e[o]=a));return e}var nn=class extends Fe{framework="claude-code";constructor(e){let o=e.command??"npx",a=e.args??["-y",Oa],x={command:o,args:a,cwd:e.cwd,...e.env?{env:e.env}:{}};super(x)}sanitizeEnv(e){return Ma(e)}};var za="@zed-industries/codex-acp@latest",rn=class extends Fe{framework="codex";constructor(e){let o=e.command??"npx",a=e.args??["-y",za],x=e.extraArgs?[...a,...e.extraArgs]:a,f={command:o,args:x,cwd:e.cwd,...e.env?{env:e.env}:{}};super(f)}};import{spawn as Js}from"node:child_process";K();var sn=class extends Fe{framework="openclaw";registerLog;profile;agentId;sessionName;registered=!1;constructor(e){let o=e.profile??"coze",a=e.sessionName??"default",x=["--profile",o,"acp","--session",`agent:${e.agentId}:${a}`],f={command:e.command,args:x,cwd:e.cwd,...e.env?{env:e.env}:{}};super(f),this.profile=o,this.agentId=e.agentId,this.sessionName=a,this.registerLog=B("downstream.openclaw.register")}async start(){await this.registerAgent().catch(e=>{this.registerLog.warn("openclaw agents add failed (will continue to acp anyway)",{agentId:this.agentId,err:String(e)})}),await super.start()}registerAgent(){return new Promise((e,o)=>{let a=Js(this.opts.command,["--profile",this.profile,"agents","add",this.agentId,"--workspace",this.opts.cwd,"--non-interactive"],{stdio:["ignore","pipe","pipe"],env:{...process.env,...this.opts.env}}),x="";a.stderr?.on("data",f=>{x+=f.toString("utf8")}),a.on("error",o),a.on("close",f=>{f===0?(this.registered=!0,this.registerLog.info("agent registered",{agentId:this.agentId,profile:this.profile}),e()):o(new C("AGENT_SPAWN_FAILED",`openclaw agents add ${this.agentId} exited ${f}: ${x.trim()}`))})})}async cleanup(e){this.registered&&await new Promise(o=>{let a=Js(this.opts.command,["--profile",this.profile,"agents","delete",this.agentId,"--force"],{stdio:["ignore","pipe","pipe"],env:{...process.env,...this.opts.env}}),x="";a.stderr?.on("data",f=>{x+=f.toString("utf8")}),a.on("error",f=>{this.registerLog.warn("openclaw agents delete failed (best-effort)",{agentId:this.agentId,err:String(f)}),o()}),a.on("close",f=>{f===0?this.registerLog.info("agent unregistered",{agentId:this.agentId}):this.registerLog.warn("openclaw agents delete non-zero exit",{agentId:this.agentId,code:f,stderr:x.trim()}),this.registered=!1,o()})})}get acpSessionName(){return this.sessionName}};K();se();var on=class{slots=[];running=!1;closed=!1;disposed=!1;enqueue(e){return this.disposed?Promise.reject(new Error("AsyncQueue disposed")):this.closed?Promise.reject(new Error("AsyncQueue closed")):new Promise((o,a)=>{this.slots.push({task:e,resolve:o,reject:a}),this.drain()})}close(){this.closed=!0}dispose(e=new Error("AsyncQueue disposed")){for(this.disposed=!0,this.closed=!0;this.slots.length>0;)this.slots.shift()?.reject(e)}get size(){return this.slots.length}get isRunning(){return this.running}async drain(){if(!this.running){this.running=!0;try{for(;this.slots.length>0&&!this.disposed;){let e=this.slots.shift();if(!e)break;try{let o=await e.task();e.resolve(o)}catch(o){e.reject(o)}}}finally{this.running=!1}}}};var an=class{agentId;framework;workspace;deployType;msgQueue;sessions=new Map;activeTriggers=new Map;status="ok";model;lastActiveAt=Date.now();constructor(e){this.agentId=e.agentId,this.framework=e.framework,this.workspace=e.workspace,this.model=e.model,this.deployType=e.deployType??"local",this.msgQueue=new on}async dispose(e){this.status="stopped",this.msgQueue.dispose(new Error(`AgentSession disposed${e?`: ${e}`:""}`)),await this.killAllRuntimes(e??"dispose")}async killAllRuntimes(e){let o=[];for(let[,a]of this.sessions)Ct(a),a.downstream&&(o.push(a.downstream.stop(e).catch(()=>{})),a.downstream=void 0);await Promise.all(o),this.activeTriggers.clear()}};function Ct(r){r.idleTimer&&(clearTimeout(r.idleTimer),r.idleTimer=void 0)}var Ue=B("agent-manager"),Fa=(r,e,o,a,x)=>{switch(r){case"claude-code":{let f=x?Ps(x):void 0;return new nn({cwd:o,...f&&Object.keys(f).length>0?{env:f}:{}})}case"codex":{let f=x?Ls(x):[],d=x?Ts(x):void 0;return new rn({cwd:o,...f.length>0?{extraArgs:f}:{},...d&&Object.keys(d).length>0?{env:d}:{}})}case"openclaw":return new sn({command:e,cwd:o,agentId:a})}};function Ua(r){return r==="claude-code"||r==="codex"}var Ka={path:"",version:"cloud-deployed"},Ha={protocolVersion:1,clientCapabilities:{fs:{readTextFile:!0,writeTextFile:!0}}},Ga=2e4,xn=class{paths;config;registry;factory;createTimeoutMs;constructor(e){this.paths=e.paths,this.config=e.config,this.registry=e.registry,this.factory=e.downstreamFactory??Fa,this.createTimeoutMs=e.createTimeoutMs??Ga}async createAgent(e){if(!e.agentId)throw new C("IPC_BAD_REQUEST","agentId required");if(!e.framework)throw new C("IPC_BAD_REQUEST","framework required");let o=bt(e._meta)==="cloud";if(o&&e.framework==="openclaw")return Ue.info("cloud-deployed openclaw, ack without local spawn",{agentId:e.agentId,framework:e.framework}),{ok:!0,agentId:e.agentId,framework:e.framework};this.registry.reviveIfDisconnected?.(e.agentId);let a=this.registry.get(e.agentId);if(a){if(a.framework!==e.framework)throw new C("AGENT_BUSY",`agent ${e.agentId} exists with different framework (${a.framework})`);if(a.status==="error")Ue.warn("existing agent in error state, rebuilding",{agentId:e.agentId}),await a.dispose("rebuild after error").catch(y=>Ue.warn("dispose stale agent failed (ignored)",{err:String(y)})),this.registry.unregister(e.agentId);else return Ue.info("agent already exists, return current",{agentId:e.agentId}),{ok:!0,agentId:a.agentId,workspace:a.workspace,framework:a.framework}}if(!o&&!this.config.frameworksCache?.[e.framework])throw new C("AGENT_SPAWN_FAILED",`framework ${e.framework} not detected on this machine; rerun daemon to refresh frameworks_cache`);let x=Le(e.agentId,this.paths),f=e.workspace??x.workspace,d=bt(e._meta),h=new AbortController,_=setTimeout(()=>h.abort(new C("AGENT_TIMEOUT",`_agent/create timed out after ${this.createTimeoutMs}ms`)),this.createTimeoutMs),v,b=!1;try{let y=()=>{if(h.signal.aborted)throw h.signal.reason instanceof Error?h.signal.reason:new C("AGENT_TIMEOUT","_agent/create aborted")};await cr(x.root,{recursive:!0}),await cr(f,{recursive:!0}),await cr(x.logs,{recursive:!0}),y(),await it(f,e.framework,e.agentId,e.cozeIdentity),y();let A=await xe(e.agentId,this.paths).catch(()=>null),L=ks({model:e.model??A?.model});if(v=new an({agentId:e.agentId,framework:e.framework,workspace:f,model:L.model??at,deployType:d}),v.status="ok",A?.sessions){for(let[U,$]of Object.entries(A.sessions))v.sessions.set(U,{acpSessionId:$.acpSessionId,modelToken:$.modelToken,tokenGeneratedAt:$.tokenGeneratedAt,lastActiveAt:Date.now(),loadingSession:!1});let R=Object.keys(A.sessions).length;R>0&&Ue.info("restored persisted session records (no spawn)",{agentId:e.agentId,count:R})}this.registry.register(v),b=!0;let T={agentId:e.agentId,framework:e.framework,workspace:f,cozeIdentity:e.cozeIdentity,createdAt:A?.createdAt??Date.now(),sessions:A?.sessions??{},model:L.model};return d==="cloud"&&(T.deployType="cloud"),A?.skills&&(T.skills=A.skills),A?.agentName&&(T.agentName=A.agentName),A?.description&&(T.description=A.description),await he(T,this.paths),Ue.info("agent created (no spawn, lazy on first prompt)",{agentId:e.agentId,framework:e.framework,deployType:d}),{ok:!0,agentId:e.agentId,workspace:f,framework:e.framework}}catch(y){throw Ue.error("agent create failed, rolling back",{agentId:e.agentId,err:String(y)}),b&&v&&(await v.dispose("rollback").catch(()=>{}),this.registry.unregister(e.agentId)),await qa(x.root,{recursive:!0,force:!0}).catch(A=>Ue.warn("rm agent dir failed (ignored)",{err:String(A)})),y instanceof C?y:new C("AGENT_SPAWN_FAILED",String(y),{cause:y})}finally{clearTimeout(_)}}async spawnSessionDownstream(e,o){let x=this.config.frameworksCache?.[e.framework];if(!x)if(e.deployType==="cloud"&&Ua(e.framework))x=Ka;else throw new C("AGENT_SPAWN_FAILED",`framework ${e.framework} not detected on this machine`);let f={model:e.model,modelToken:o},d=this.factory(e.framework,x.path,e.workspace,e.agentId,f);try{return await d.start(),await d.initialize(Ha),d}catch(h){throw await d.stop("spawnSessionDownstream failed").catch(()=>{}),h instanceof C?h:new C("AGENT_SPAWN_FAILED",h instanceof Error?h.message:String(h),{cause:h})}}};K();import{spawn as ja}from"node:child_process";import{constants as Vs,access as Wa}from"node:fs/promises";import{delimiter as Ja,join as Va}from"node:path";var Xa=B("framework-detector"),Xs={"claude-code":"claude",codex:"codex",openclaw:"openclaw"},Ya=[".exe",".cmd",".bat",".ps1"],At=class{env;constructor(e={}){this.env={pathEnv:e.pathEnv??process.env.PATH??"",platform:e.platform??process.platform,spawn:e.spawn??ja,access:e.access??Wa}}async detect(e){let o=Xs[e],a=await this.which(o);if(!a)return Xa.debug("framework binary not found",{framework:e,bin:o}),null;let x=await this.probeVersion(a);return{path:a,version:x}}async detectAll(){let e=await Promise.all(Object.keys(Xs).map(async a=>[a,await this.detect(a)])),o={};for(let[a,x]of e)x&&(o[a]=x);return o}async which(e){let o=this.env.pathEnv.split(Ja).filter(Boolean),a=this.env.platform==="win32"?["",...Ya]:[""];for(let x of o)for(let f of a){let d=Va(x,e+f);if(await this.isExecutable(d))return d}return null}async isExecutable(e){try{let o=this.env.platform==="win32"?Vs.F_OK:Vs.X_OK;return await this.env.access(e,o),!0}catch{return!1}}async probeVersion(e){return new Promise(o=>{let a="",x=!1,f,d=h=>{x||(x=!0,f&&clearTimeout(f),o(h.trim()||"unknown"))};try{let h=this.env.spawn(e,["--version"],{stdio:["ignore","pipe","pipe"]});f=setTimeout(()=>{h.kill("SIGKILL"),d("unknown")},5e3),h.stdout?.on("data",_=>{a+=_.toString("utf8")}),h.on("error",()=>d("unknown")),h.on("close",()=>{let _=$a(a).split(/\r?\n/)[0]??"";d(_)})}catch{d("unknown")}})}},Za=new RegExp("\x1B\\[[0-9;]*[A-Za-z]","g");function $a(r){return r.replace(Za,"")}ir();se();var Qa=10*6e4;function Ys(r){let e=r?.sessionIdleTimeoutMs;return typeof e!="number"||!Number.isFinite(e)||e<=0?Qa:e}function cn(r){return Ft(r??H().configFile)}function kt(r,e){return Ut(e??H().configFile,r)}import{randomBytes as ex}from"node:crypto";qe();var Zs={PAIR:"_agent/pair",CREATE:"_agent/create",HEALTH:"_agent/health",LIST_SKILLS:"_agent/listSkills",ADD_SKILLS:"_agent/addSkills",REMOVE_SKILLS:"_agent/removeSkills",GET_FILE_TREE:"_agent/getFileTree",GET_FILE_CONTENT:"_agent/getFileContent",DETAIL:"_agent/detail",UPDATE:"_agent/update",DISCONNECT:"_agent/disconnect",SWITCH_MODEL:"_agent/switchModel",GEN_MODEL_TOKEN:"_agent/genModelToken",DELETE:"_agent/delete"};K();var j=B("core"),tx=3e4,nx=3e4,fn=class{upstream;agents=new Map;disconnectedAgents=new Set;extensions;paths;sessionSpawner;sessionIdleTimeoutMs;upstreamIds=new ct;pendingUpstream=new Map;pendingBridge=new Map;constructor(e){this.upstream=e.upstream,this.extensions=e.extensions??{},this.paths=e.paths,this.sessionSpawner=e.sessionSpawner,this.sessionIdleTimeoutMs=Ys(e.bridgeConfig)}registerExtension(e,o){this.extensions[e]=o}async start(){this.upstream.onFrame(e=>this.handleFrame(e)),await this.upstream.start(),j.info("Core started",{extensions:Object.keys(this.extensions)})}async stop(e){j.info("Core stopping",{reason:e}),await Promise.all([...this.agents.values()].map(o=>o.dispose(e))),this.agents.clear(),await this.upstream.stop(e)}get(e){return this.agents.get(e)}register(e){this.agents.set(e.agentId,e),j.info("agent registered",{agentId:e.agentId,framework:e.framework});for(let o of this.registerHandlers)try{o(e.agentId)}catch(a){j.warn("onAgentRegister handler threw (ignored)",{agentId:e.agentId,err:String(a)})}}onAgentRegister(e){return this.registerHandlers.add(e),()=>this.registerHandlers.delete(e)}registerHandlers=new Set;unregister(e){this.agents.delete(e)}reviveIfDisconnected(e){this.disconnectedAgents.delete(e)&&j.info("agent revived from disconnect",{agentId:e})}attachRuntimeHooks(e,o,a){let x=a.downstream;x&&(x.onUpdate(f=>{a.loadingSession||this.forwardUpdate(e,f)}),x.onAgentRequest(f=>{this.handleAgentRequest(e,x,f)}),x.onExit((f,d)=>{j.info("session runtime exited",{agentId:e.agentId,cloudId:o,code:f,signal:d}),Ct(a),a.downstream=void 0,a.acpSessionId&&e.activeTriggers.delete(a.acpSessionId)}))}async handleFrame(e){if(Qt(e)){this.handleUpstreamResponse(e);return}if(!("method"in e)||typeof e.method!="string")return;let o="id"in e&&e.id!==void 0?e.id:null;try{if(e.method.startsWith("_agent/")){let a=this.extensions[e.method];if(!a){o!==null?await this.sendError(o,G.METHOD_NOT_FOUND,`extension not registered: ${e.method}`):j.warn("drop notification: extension not registered",{method:e.method});return}let x=await a(e,this);o!==null&&await this.upstream.send(xt(o,x));return}if(e.method.startsWith("session/")){let a=await this.routeSessionMethod(e);o!==null&&await this.upstream.send(xt(o,a));return}if(e.method==="initialize"){o!==null&&await this.upstream.send(xt(o,{protocolVersion:1,agentCapabilities:{loadSession:!0}}));return}o!==null?await this.sendError(o,G.METHOD_NOT_FOUND,`method not implemented: ${e.method}`):j.warn("drop unknown notification",{method:e.method})}catch(a){j.error("handleFrame failed",{method:e.method,err:String(a)}),o!==null&&await this.upstream.send(Ve(o,en(a)))}}async routeSessionMethod(e){if(!e.params||typeof e.params!="object")throw new C("IPC_BAD_REQUEST",`${e.method} requires params`);let o=e.params,a=o._meta?.cozeAgentId;if(!a)throw new C("IPC_BAD_REQUEST",`${e.method}: missing _meta.cozeAgentId`);let x=this.agents.get(a);if(!x)throw this.disconnectedAgents.has(a)?new C("AGENT_DISCONNECTED",`agent ${a} has been disconnected; cloud must _agent/create to revive`):new C("AGENT_NOT_FOUND",`agent not found: ${a}`);if(e.method==="session/cancel")return this.dispatchSessionCall(x,e.method,o);let f=Date.now(),d=!1;try{let h=await x.msgQueue.enqueue(()=>this.dispatchSessionCall(x,e.method,o));return d=!0,h}finally{j.info("session call done",{agentId:x.agentId,method:e.method,durationMs:Date.now()-f,ok:d})}}async dispatchSessionCall(e,o,a){e.lastActiveAt=Date.now();let{stripped:x}=Cs(a);switch(o){case"session/new":{let f=rx();return j.info("session/new ack (lazy spawn)",{agentId:e.agentId,cloudId:f}),{sessionId:f}}case"session/load":{let f=x;return j.info("session/load ack (lazy spawn)",{agentId:e.agentId,cloudId:f.sessionId}),{}}case"session/prompt":{let f=x,d=f.sessionId;if(!d)throw new C("IPC_BAD_REQUEST","session/prompt: missing sessionId");let h=await this.ensureRuntime(e,d);if(await this.ensureDownstream(e,d,h),!h.downstream||!h.acpSessionId)throw new C("BRIDGE_INTERNAL","session runtime not ready after ensureDownstream");let _=a._meta?.cozeTriggerMsgId;_?e.activeTriggers.set(h.acpSessionId,_):e.activeTriggers.delete(h.acpSessionId);try{let v=await h.downstream.sessionPrompt({...f,sessionId:h.acpSessionId});return h.lastActiveAt=Date.now(),v}finally{h.downstream?.isAlive()&&this.armIdleTimer(e,d,h)}}case"session/cancel":{let d=x.sessionId;if(!d)throw new C("IPC_BAD_REQUEST","session/cancel: missing sessionId");let h=e.sessions.get(d);return h?.downstream?.isAlive()&&h.acpSessionId&&await h.downstream.sessionCancel({sessionId:h.acpSessionId}),{ok:!0}}default:throw new C("IPC_BAD_REQUEST",`session method not supported: ${o}`)}}async ensureRuntime(e,o){let a=e.sessions.get(o);if(a)return a;let f={modelToken:await this.requestSessionToken(e.agentId,o),tokenGeneratedAt:Date.now(),lastActiveAt:Date.now(),loadingSession:!1};return e.sessions.set(o,f),await this.persistSessionMapping(e),f}async requestSessionToken(e,o){let a={sessionId:o,_meta:{cozeAgentId:e}};try{let x=await this.sendRequest(Zs.GEN_MODEL_TOKEN,a,nx);if(!x?.modelToken)throw new C("MODEL_TOKEN_GEN_FAILED",`cloud returned empty modelToken (agentId=${e}, cloudSessionId=${o})`);return x.modelToken}catch(x){throw x instanceof C&&x.code==="MODEL_TOKEN_GEN_FAILED"?x:new C("MODEL_TOKEN_GEN_FAILED",x instanceof Error?x.message:String(x),{cause:x})}}async ensureDownstream(e,o,a){if(Ct(a),a.downstream?.isAlive())return;if(!this.sessionSpawner)throw new C("AGENT_SPAWN_FAILED","sessionSpawner not wired (cannot spawn per-session downstream)");let x=await this.sessionSpawner(e,a.modelToken);if(a.downstream=x,this.attachRuntimeHooks(e,o,a),a.acpSessionId){a.loadingSession=!0;try{await x.sessionLoad({sessionId:a.acpSessionId,cwd:e.workspace}),j.info("session restored via session/load",{agentId:e.agentId,cloudId:o,acpId:a.acpSessionId})}catch(f){j.warn("session/load failed, fallback to session/new",{agentId:e.agentId,cloudId:o,acpId:a.acpSessionId,err:String(f)}),a.acpSessionId=void 0;let d=await x.sessionNew({cwd:e.workspace});a.acpSessionId=d.sessionId,await this.persistSessionMapping(e)}finally{a.loadingSession=!1}}else{let f=await x.sessionNew({cwd:e.workspace});a.acpSessionId=f.sessionId,await this.persistSessionMapping(e)}}armIdleTimer(e,o,a){Ct(a),a.idleTimer=setTimeout(()=>{j.info("session runtime idle timeout, killing downstream",{agentId:e.agentId,cloudId:o});let x=a.downstream;a.downstream=void 0,a.idleTimer=void 0,a.acpSessionId&&e.activeTriggers.delete(a.acpSessionId),x&&x.stop("idle timeout").catch(f=>j.warn("idle stop failed (ignored)",{agentId:e.agentId,cloudId:o,err:String(f)}))},this.sessionIdleTimeoutMs),a.idleTimer.unref?.()}forwardUpdate(e,o){let a=o.sessionId,x=this.reverseSessionId(e,a);if(!x){j.debug("drop update for unknown session",{agentId:e.agentId,acpId:a});return}let f={cozeAgentId:e.agentId},d=e.activeTriggers.get(a);d&&(f.cozeTriggerMsgId=d),this.upstream.send(Zt("session/update",{...o,sessionId:x,_meta:f})).catch(h=>j.warn("forward update failed",{agentId:e.agentId,err:String(h)}))}handleAgentRequest(e,o,a){if(a.method==="session/request_permission"){this.forwardPermissionRequest(e,o,a);return}j.warn("unhandled agent request,returning method_not_found",{agentId:e.agentId,method:a.method}),o.respondAgentRequestError(a.id,{code:G.METHOD_NOT_FOUND,message:`method not handled by Bridge: ${a.method}`})}forwardPermissionRequest(e,o,a){let x=this.upstreamIds.next("session/request_permission"),f=a.params??{},h=f.sessionId,_=h?e.activeTriggers.get(h):void 0,v={cozeAgentId:e.agentId};_&&(v.cozeTriggerMsgId=_);let b=h?this.reverseSessionId(e,h):void 0,y={...f,...b?{sessionId:b}:{},_meta:v};this.pendingUpstream.set(x,{agentRequestId:a.id,agentId:e.agentId,downstream:o,method:a.method}),this.upstream.send(Et(x,"session/request_permission",y)).catch(A=>{this.pendingUpstream.delete(x),j.error("forward permission request failed",{agentId:e.agentId,err:String(A)}),o.respondAgentRequestError(a.id,{code:G.INTERNAL_ERROR,message:`upstream send failed: ${String(A)}`})})}handleUpstreamResponse(e){if(e.id===null)return;let o=this.pendingUpstream.get(e.id);if(o){this.pendingUpstream.delete(e.id),e.error?o.downstream.respondAgentRequestError(o.agentRequestId,e.error):o.downstream.respondAgentRequest(o.agentRequestId,e.result);return}let a=this.pendingBridge.get(e.id);if(a){this.pendingBridge.delete(e.id),clearTimeout(a.timer),e.error?a.reject(new $t(e.error)):a.resolve(e.result);return}j.debug("orphan upstream response (no pending)",{id:e.id})}sendRequest(e,o,a=tx){let x=this.upstreamIds.next(e);return new Promise((f,d)=>{let h=setTimeout(()=>{this.pendingBridge.delete(x),d(new C("AGENT_TIMEOUT",`${e} timed out after ${a}ms`))},a);this.pendingBridge.set(x,{method:e,resolve:f,reject:d,timer:h}),this.upstream.send(Et(x,e,o)).catch(_=>{let v=this.pendingBridge.get(x);v&&(clearTimeout(v.timer),this.pendingBridge.delete(x)),d(_)})})}async persistSessionMapping(e){if(this.paths)try{let o=new Map;for(let[a,x]of e.sessions){let f={modelToken:x.modelToken,tokenGeneratedAt:x.tokenGeneratedAt};x.acpSessionId&&(f.acpSessionId=x.acpSessionId),o.set(a,f)}await ar(e.agentId,o,this.paths)}catch(o){j.warn("persist session mapping failed",{agentId:e.agentId,err:String(o)})}}reverseSessionId(e,o){for(let[a,x]of e.sessions.entries())if(x.acpSessionId===o)return a}sendError(e,o,a){return this.upstream.send(Ve(e,{code:o,message:a}))}};function rx(){return ex(16).toString("hex")}K();se();import{randomBytes as sx}from"node:crypto";import{chmod as ix,mkdir as ox,writeFile as $s}from"node:fs/promises";import{createServer as ax}from"node:http";import{dirname as xx}from"node:path";var cx=1e6,fr=B("ipc"),un=class{server=null;port=0;token="";routes;paths;constructor(e){this.routes=new Map(e.routes.map(o=>[`${o.method} ${o.path}`,o])),this.paths=e.paths??H()}async start(){this.token=sx(32).toString("hex");let e=ax((a,x)=>{this.dispatch(a,x)});this.server=e,await new Promise((a,x)=>{e.once("error",x),e.listen(0,"127.0.0.1",()=>a())});let o=e.address();if(!o||typeof o!="object")throw new Error("failed to obtain IPC port");return this.port=o.port,await this.persistAuthFiles(),fr.info("IPC listening",{port:this.port}),{port:this.port,token:this.token}}async stop(){let e=this.server;e&&(await new Promise((o,a)=>{e.close(x=>x?a(x):o())}),this.server=null)}async persistAuthFiles(){await ox(xx(this.paths.portFile),{recursive:!0}),await $s(this.paths.portFile,String(this.port),"utf8"),await $s(this.paths.tokenFile,this.token,{encoding:"utf8",mode:384});try{await ix(this.paths.tokenFile,384)}catch(e){fr.warn("chmod token file failed (non-POSIX?)",{err:String(e)})}}async dispatch(e,o){if(e.headers.authorization!==`Bearer ${this.token}`){Dt(o,401,{error:"unauthorized"});return}let x=`${e.method} ${(e.url??"").split("?")[0]}`,f=this.routes.get(x);if(!f){Dt(o,404,{error:"not found"});return}let d=null;if(e.method==="POST")try{d=await fx(e)}catch(h){Dt(o,400,{error:"invalid json",detail:String(h)});return}try{let h=await f.handler(d,e);Dt(o,200,h??{ok:!0})}catch(h){fr.error("IPC handler failed",{key:x,err:String(h)}),Dt(o,500,{error:h instanceof Error?h.message:String(h)})}}};function Dt(r,e,o){r.statusCode=e,r.setHeader("content-type","application/json"),r.end(JSON.stringify(o))}async function fx(r){let e=[],o=0;for await(let x of r){let f=x;if(o+=f.length,o>cx)throw new Error("body too large");e.push(f)}let a=Buffer.concat(e).toString("utf8");return a?JSON.parse(a):null}var Co=Pe(ci(),1);var jc=Pe(so(),1),Wc=Pe(kn(),1),Jc=Pe(dt(),1),Vc=Pe(Sr(),1),Xc=Pe(Ar(),1),Yc=Pe(Ir(),1),ho=Pe(Tn(),1),Zc=Pe(lo(),1);var go=ho.default;K();var Nn="1008033",po="1289";var mo="pbbp2",_o="https://www.coze.cn",wo="/api/coze_claw/resource/get_frontier_key",$c="https://www.coze.cn",Qc="wss://frontier.coze.cn";function yo(r){return r??process.env.COZE_BRIDGE_HANDSHAKE_URL??$c}function vo(r){return r??process.env.COZE_BRIDGE_FRONTIER_URL??Qc}function Rn(r){let e={},o=r?.ttEnv??process.env.COZE_BRIDGE_TT_ENV,a=r?.usePpe??process.env.COZE_BRIDGE_USE_PPE;return o&&(e["x-tt-env"]=o),a&&(e["x-use-ppe"]=a),e}var ee=B("upstream.frontier"),So="application/json",Eo="none",Bn=class{constructor(e){this.opts=e}opts;fws=null;handler=null;connectHandler=null;opened=!1;openCount=0;async start(){if(this.fws){ee.warn("start called on already-started FrontierUpstream; noop");return}let e={Authorization:`Bearer ${this.opts.privatecode}`,Origin:_o,...Rn(this.opts.ppeOverride)};class o extends go{constructor(h){super(h,mo,{headers:e})}send(h,..._){if(Ss("debug"))try{let v;typeof h=="string"?v=Buffer.from(h,"utf8"):h instanceof Buffer?v=h:h instanceof ArrayBuffer?v=new Uint8Array(h):ArrayBuffer.isView(h)?v=new Uint8Array(h.buffer,h.byteOffset,h.byteLength):v=new Uint8Array(0);let b=Buffer.from(v.slice(0,128)).toString("hex");ee.debug("WS raw frame out",{bytes:v.byteLength,headHex:b})}catch(v){ee.warn("WS raw frame dump failed",{err:String(v)})}super.send(h,..._)}}let a=vo(this.opts.urlOverride),x={url:a,ws:o,fpID:po,aID:Nn,accessKey:this.opts.handshake.accessKey,deviceID:this.opts.handshake.deviceId,payloadType:{type:So,force:!0},payloadEncoding:{encoding:Eo,force:!0},enableTransformTextPayload:!0,enableQoS:!1,enableAutoAck:!1,automaticOpen:!1,debug:this.opts.debug??!1},f=new Co.FWS(x);f.onopen=()=>{this.opened=!0,this.openCount+=1;let d=this.openCount===1;ee.info("frontier opened",{url:a,remoteDeviceId:this.opts.handshake.deviceId,initial:d,openCount:this.openCount}),this.connectHandler&&Promise.resolve(this.connectHandler({initial:d})).catch(h=>ee.warn("onConnect handler threw (ignored)",{err:String(h)}))},f.onclose=d=>{this.opened=!1,ee.info("frontier closed",{code:d.code,reason:d.reason,willReconnect:d.willReconnect})},f.onerror=d=>{ee.warn("frontier error",{code:d.code,msg:d.message})},f.onmessage=d=>this.handleMessage(d),this.fws=f,await f.connect()}async stop(e){let o=this.fws;if(o){this.fws=null,this.opened=!1;try{o.close(1e3,e??"bridge shutdown")}catch(a){ee.warn("frontier close threw (ignored)",{err:String(a)})}}}async send(e){let o=this.fws;if(!o)throw new C("UPSTREAM_DISCONNECTED","frontier upstream not started");let a=JSON.stringify(e),x=e;ee.info("frontier frame out",{method:x.method,jsonrpcId:x.id,size:a.length});try{await o.send(a,{service:33555712,method:1,payloadType:So,payloadEncoding:Eo})}catch(f){throw new C("UPSTREAM_DISCONNECTED",`frontier send failed: ${String(f)}`,{cause:f})}}onFrame(e){this.handler=e}onConnect(e){this.connectHandler=e}isConnected(){return this.opened&&this.fws?.readyState===1}handleMessage(e){let o=e.message?.service;if(o!==33555712){ee.debug("drop non-adapter frontier frame",{service:o});return}let a=nf(e);if(!a){ee.debug("frontier message without text payload, drop",{payloadType:e.message?.payloadType});return}if(!this.handler){ee.debug("frame received but no onFrame handler",{size:a.length});return}let x;try{x=JSON.parse(a)}catch(f){ee.warn("frontier message JSON parse failed",{err:String(f),head:a.slice(0,80)});return}ee.info("frontier frame in",{logid:tf(e.message?.LogID),logidNew:e.message?.LogIDNew,msgId:e.message?.msgID,jsonrpcId:x.id}),Promise.resolve(this.handler(x)).catch(f=>ee.warn("frontier frame handler threw",{err:String(f)}))}};function tf(r){return r?r.high===0?String(r.low>>>0):`${r.high.toString(16)}${(r.low>>>0).toString(16).padStart(8,"0")}`:""}function nf(r){let e=r.message;if(e?.textPayload)return e.textPayload;let o=e?.payload;if(!o)return null;try{return Buffer.from(o).toString("utf8")}catch{return null}}K();function ko(r){return r?r.startsWith("boe_")?{ttEnv:r}:{ttEnv:r,usePpe:"1"}:{}}var Ao=B("handshake");async function Do(r){let e=yo(r.endpoint),o=r.timeoutMs??1e4,a=`${rf(e)}${wo}?aid=${encodeURIComponent(Nn)}`,x={Authorization:`Bearer ${r.privatecode}`,Accept:"application/json",...Rn(r.ppeOverride)},f=new AbortController,d=setTimeout(()=>f.abort(),o);Ao.info("frontier key handshake",{base:e});try{let h=await fetch(a,{method:"GET",headers:x,signal:f.signal}),_=h.headers.get("x-tt-logid")??"",v=h.headers.get("x-tt-trace-id")??"";if(!h.ok){let L=await h.text().catch(()=>"");throw new C("UPSTREAM_HANDSHAKE_FAILED",`handshake HTTP ${h.status} logid=${_}: ${L.slice(0,200)}`)}let b=await h.json();if(b.code!==void 0&&b.code!==0)throw new C("UPSTREAM_HANDSHAKE_FAILED",`handshake code=${b.code} msg=${b.msg??"-"} logid=${_}`);let y=b.data?.access_key,A=b.data?.device_id;if(!y||!A)throw new C("UPSTREAM_HANDSHAKE_FAILED",`handshake response missing access_key/device_id logid=${_}: ${JSON.stringify(b)}`);return Ao.info("handshake ok",{remoteDeviceId:A,logid:_,traceId:v}),{accessKey:y,deviceId:A}}catch(h){throw h instanceof C?h:h.name==="AbortError"?new C("UPSTREAM_HANDSHAKE_FAILED",`handshake timeout (${o}ms)`):new C("UPSTREAM_HANDSHAKE_FAILED",String(h),{cause:h})}finally{clearTimeout(d)}}function rf(r){return r.endsWith("/")?r.slice(0,-1):r}K();var Rr=B("upstream.switchable"),On=class{inner;handler=null;connectHandler=null;constructor(e){this.inner=e}async swap(e,o){if(this.inner===e)return;Rr.info("swap upstream",{reason:o});let a=this.inner;this.inner=e,this.handler&&e.onFrame(this.handler),this.connectHandler&&e.onConnect&&e.onConnect(this.connectHandler);try{await e.start()}catch(x){throw Rr.error("swap target start failed, reverting",{err:String(x)}),this.inner=a,x}await a.stop(o??"swapped").catch(x=>Rr.warn("previous upstream stop threw (ignored)",{err:String(x)}))}current(){return this.inner}start(){return this.inner.start()}stop(e){return this.inner.stop(e)}send(e){return this.inner.send(e)}onFrame(e){this.handler=e,this.inner.onFrame(e)}onConnect(e){this.connectHandler=e,this.inner.onConnect?.(e)}isConnected(){return this.inner.isConnected()}};K();var Br=B("upstream"),Mt=class{handler=null;async start(){Br.info("NoopUpstream started (M1 skeleton; real Frontier wired in M4)")}async stop(e){Br.info("NoopUpstream stopped",{reason:e})}async send(e){Br.debug("NoopUpstream.send (dropped)",{method:"method"in e?e.method:void 0})}onFrame(e){this.handler=e}isConnected(){return!1}async injectFrame(e){this.handler&&await this.handler(e)}};K();se();K();se();import{execSync as sf}from"node:child_process";import{readFileSync as Po,unlinkSync as of}from"node:fs";import{mkdir as af,readFile as Lo,unlink as To,writeFile as xf}from"node:fs/promises";import{dirname as cf}from"node:path";var ff=B("single-instance"),Mn=class{pidFile;acquired=!1;constructor(e={}){this.pidFile=e.pidFile??H().pidFile,e.processTitle&&(process.title=e.processTitle)}async acquire(){let e=await this.readExistingPid();return e!==null&&this.isAlive(e)?{kind:"already-running",pid:e}:(e!==null&&(ff.warn("removing stale pid file",{stalePid:e}),await To(this.pidFile).catch(()=>{})),await af(cf(this.pidFile),{recursive:!0}),await xf(this.pidFile,String(process.pid),"utf8"),this.acquired=!0,this.installCleanupHooks(),{kind:"acquired"})}async release(){if(this.acquired){try{(await Lo(this.pidFile,"utf8")).trim()===String(process.pid)&&await To(this.pidFile)}catch{}this.acquired=!1}}async readExistingPid(){try{let e=await Lo(this.pidFile,"utf8"),o=Number.parseInt(e.trim(),10);return Number.isFinite(o)&&o>0?o:null}catch(e){if(e.code==="ENOENT")return null;throw e}}isAlive(e){try{process.kill(e,0)}catch(o){return o.code==="EPERM"}return this.matchesDaemonTitle(e)}matchesDaemonTitle(e){try{let o=Po(`/proc/${e}/cmdline`,"utf8").replace(/\0/g," ");return!!(o.includes("coze-bridge-daemon")||o.includes("lib/index.js"))}catch{}try{let o=sf(`ps -o command= -p ${e}`,{stdio:["ignore","pipe","ignore"],timeout:1e3}).toString();return o.trim()?o.includes("coze-bridge-daemon")||o.includes("lib/index.js"):!1}catch{return!0}}installCleanupHooks(){process.once("exit",()=>{if(this.acquired)try{Po(this.pidFile,"utf8").trim()===String(process.pid)&&of(this.pidFile)}catch{}})}};var M=B("daemon"),uf="coze-bridge-daemon";async function Ro(){let r=new Mn({processTitle:uf}),e=await r.acquire();if(e.kind==="already-running")throw new Error(`coze-bridge daemon already running (pid=${e.pid})`);let o=await cn(),a=o??{};or({pid:process.pid}),M.info(o?"loaded bridge config":"initialized bridge config");try{let P=new At;a.frameworksCache=await P.detectAll(),M.info("refreshed frameworks_cache",{detected:Object.keys(a.frameworksCache)})}catch(P){M.warn("framework detection failed",{err:String(P)})}await kt(a);let x=new On(new Mt),f=H(),d=null,h=new fn({upstream:x,paths:f,bridgeConfig:a,sessionSpawner:async(P,z)=>{if(!d)throw new Error("agentManager not ready");return d.spawnSessionDownstream(P,z)}});await lf(f,h);let _=new xn({paths:f,config:a,registry:h});d=_;let v,b,y=null,A=null;h.registerExtension("_agent/create",async P=>_.createAgent(P.params)),h.registerExtension("_agent/health",async()=>({ok:!0}));let L=new Vt({agents:h.agents,disposeAndMarkDisconnected:async(P,z)=>{let Z=h.agents.get(P);Z&&(await Z.dispose(`disconnect: ${z}`).catch(pe=>M.warn("dispose during disconnect failed (ignored)",{agentId:P,err:String(pe)})),Z.status="disconnected",h.unregister(P)),h.disconnectedAgents.add(P)}});h.registerExtension("_agent/listSkills",P=>L.listSkills(P.params)),h.registerExtension("_agent/addSkills",P=>L.addSkills(P.params)),h.registerExtension("_agent/removeSkills",P=>L.removeSkills(P.params)),h.registerExtension("_agent/getFileTree",P=>L.getFileTree(P.params)),h.registerExtension("_agent/getFileContent",P=>L.getFileContent(P.params)),h.registerExtension("_agent/update",P=>L.updateAgent(P.params)),h.registerExtension("_agent/disconnect",P=>L.disconnectAgent(P.params)),h.registerExtension("_agent/switchModel",P=>L.switchModel(P.params));let T=new Jt({paths:f,handlers:L,sendDetail:P=>h.sendRequest("_agent/detail",P)});x.onConnect(({initial:P})=>{M.info("frontier upstream connected, triggering detail sync",{initial:P}),T.syncAll(P?"initial-connect":"reconnect").catch(z=>M.warn("detail sync top-level error (ignored)",{err:String(z)}))});let R=new un({paths:f,routes:[{method:"GET",path:"/status",handler:async()=>({running:!0,pid:process.pid,agents:[...h.agents.keys()],deviceId:y??"",frameworksCache:a.frameworksCache??{}})},{method:"POST",path:"/pair",handler:async P=>{let z=P,Z=z?.privatecode,pe=z?.pairing_code;if(!Z||!pe)throw new C("IPC_BAD_REQUEST","/pair requires privatecode + pairing_code");let ke=ko(z.env),me=z.handshake_url,de=z.frontier_url,je=df(z.env,me,de),zt=!!v&&v!==Z,qt=b!==void 0&&b!==je,_e=zt||qt;if(_e){M.warn("pair config switched, resetting agents",{pcChanged:zt,envChanged:qt,previousPc:v?Io(v):"",nextPc:Io(Z),previousEnvKey:b??"",nextEnvKey:je});for(let ye of[...h.agents.values()])await ye.dispose("pair config switch").catch(()=>{}),h.agents.delete(ye.agentId);await x.swap(new Mt,"pair switch").catch(()=>{})}let we=await Do({privatecode:Z,...me?{endpoint:me}:{},ppeOverride:ke});y=we.deviceId,or({deviceId:y,pid:process.pid});let jn=new Bn({handshake:we,privatecode:Z,...de?{urlOverride:de}:{},ppeOverride:ke});await x.swap(jn,"pair");let ne=Object.keys(a.frameworksCache??{});try{let ye=await h.sendRequest("_agent/pair",{pairCode:pe,patToken:Z,frameworks:ne,_meta:{cozeDeviceId:y}});M.info("_agent/pair ok",{pairResult:ye}),v=Z,b=je,A||(A=new Yt({core:h,getDeviceId:()=>y??""})),A.start(),_e&&No(f,_).catch(q=>M.warn("post-pair-switch auto-revive error (ignored)",{err:String(q)}));let V;return z.agent_id&&(V=await hf(z.agent_id,f,_,q=>h.sendRequest("_agent/detail",q)).catch(q=>(M.error("--agent-id ensureAgent failed",{agentId:z.agent_id,err:String(q)}),{ok:!1,agentId:z.agent_id??"",note:String(q)}))),{ok:!0,note:"paired with cloud",...V?{agent:V}:{}}}catch(ye){return M.error("_agent/pair failed",{err:String(ye)}),{ok:!1,note:`pair failed: ${String(ye)}`}}}},{method:"POST",path:"/_agent/create",handler:async P=>{let z=P;return{ok:!0,result:await _.createAgent(z)}}},{method:"POST",path:"/refresh",handler:async()=>{M.info("IPC /refresh: re-detecting frameworks");let P=new At;return a.frameworksCache=await P.detectAll(),await kt(a),{ok:!0,frameworks:a.frameworksCache}}},{method:"POST",path:"/shutdown",handler:async()=>(M.info("IPC /shutdown received"),setImmediate(()=>{Ae.shutdown("ipc /shutdown")}),{ok:!0})}]}),{port:U,token:$}=await R.start();await h.start(),No(f,_).catch(P=>M.warn("auto-revive top-level error (ignored)",{err:String(P)}));let te=null,Ae={port:U,token:$,core:h,ipc:R,shutdown(P){return te||(M.info("daemon shutdown",{reason:P}),te=(async()=>{A?.stop(),await h.stop(P),await R.stop(),await r.release()})(),te)}};for(let P of["SIGTERM","SIGINT"])process.on(P,()=>{Ae.shutdown(P).then(()=>process.exit(0))});return M.info("daemon ready",{port:U,pid:process.pid,nodeVersion:process.version,platform:process.platform,frameworks:Object.keys(a.frameworksCache??{}),libVersion:a.libVersion??"dev"}),Ae}function Io(r){return r.length<=8?"***":`${r.slice(0,4)}***${r.slice(-4)}`}function df(r,e,o){return`${r??""}|${e??""}|${o??""}`}async function lf(r,e){let{readdir:o}=await import("node:fs/promises"),a;try{a=await o(r.agentsRoot)}catch{return}let{loadAgentConfig:x,enforceAgentConfigMode:f}=await Promise.resolve().then(()=>(qe(),Wt));for(let d of a){await f(d,r).catch(h=>M.warn("enforceAgentConfigMode failed (ignored)",{agentId:d,err:String(h)}));try{let h=await x(d,r);h?.disconnectedAt&&(e.disconnectedAgents.add(d),M.info("agent marked disconnected on startup",{agentId:d,disconnectedAt:h.disconnectedAt,reason:h.disconnectReason??""}))}catch(h){M.warn("failed to load agent config on startup, skipping",{agentId:d,err:String(h)})}}}async function hf(r,e,o,a){let{loadAgentConfig:x}=await Promise.resolve().then(()=>(qe(),Wt)),f=await x(r,e);if(f){M.info("--agent-id: local config found, reconnecting",{agentId:r,framework:f.framework,hadDisconnect:!!f.disconnectedAt});let v={agentId:f.agentId,framework:f.framework,...f.cozeIdentity?{cozeIdentity:f.cozeIdentity}:{},...f.model?{model:f.model}:{}};return await o.createAgent(v),{ok:!0,agentId:r,note:f.disconnectedAt?"revived from local config":"connected from local config"}}M.info("--agent-id: local config missing, pulling _agent/detail from cloud",{agentId:r});let d=await a({_meta:{cozeAgentId:r}});if(!d.framework)throw new C("AGENT_NOT_FOUND",`agent ${r} \u4E0D\u5728\u672C\u5730; \u4E91\u7AEF _agent/detail \u54CD\u5E94\u7F3A framework \u5B57\u6BB5 (D36 \u534F\u8BAE\u6269\u5C55\u672A\u751F\u6548), \u65E0\u6CD5\u5728\u672C\u673A\u65B0\u5EFA`);let h={agentId:d.agentId,framework:d.framework,...d.cozeIdentity?{cozeIdentity:d.cozeIdentity}:{},...d.model?{model:d.model}:{},...d.deployType?{_meta:{cozeDeployType:d.deployType}}:{}};await o.createAgent(h);let _=d.deployType==="cloud"&&d.framework==="openclaw";return{ok:!0,agentId:r,note:_?"cloud agent acknowledged":"created from cloud detail"}}async function No(r,e){let{readdir:o}=await import("node:fs/promises"),a;try{a=await o(r.agentsRoot)}catch{return{revived:0,skipped:0,total:0}}if(a.length===0)return{revived:0,skipped:0,total:0};let{loadAgentConfig:x}=await Promise.resolve().then(()=>(qe(),Wt));M.info("auto-revive: scanning local agents on startup",{count:a.length});let f=0,d=0;for(let h of a){let _;try{_=await x(h,r)}catch(v){M.warn("auto-revive: load config failed (skipping)",{agentId:h,err:String(v)}),d+=1;continue}if(!_){d+=1;continue}if(_.disconnectedAt){M.info("auto-revive: skip disconnected agent",{agentId:h,disconnectedAt:_.disconnectedAt}),d+=1;continue}try{M.info("auto-revive: re-registering agent (D44 no spawn)",{agentId:h,framework:_.framework}),await e.createAgent({agentId:_.agentId,framework:_.framework,..._.cozeIdentity?{cozeIdentity:_.cozeIdentity}:{},..._.model?{model:_.model}:{},..._.deployType?{_meta:{cozeDeployType:_.deployType}}:{}}),f+=1}catch(v){M.warn("auto-revive: createAgent failed (skipping)",{agentId:h,framework:_.framework,err:String(v)}),d+=1}}return M.info("auto-revive: done",{revived:f,skipped:d,total:a.length}),{revived:f,skipped:d,total:a.length}}Mr();se();import{readFile as Oo}from"node:fs/promises";var Ge=class{paths;constructor(e){this.paths=e??H()}async probe(e=1e3){let o=await this.readAuth();if(!o)return{kind:"not-running"};try{let a=await this.fetch(o,{method:"GET",path:"/status",timeoutMs:e});return a.status===200?{kind:"connected",...o}:{kind:"stale",reason:`unexpected status ${a.status}`}}catch(a){return{kind:"stale",reason:Sf(a)}}}async request(e){let o=await this.readAuth();if(!o)throw new Error("coze-bridge daemon not running (no port/token files)");return this.fetch(o,e)}async readAuth(){try{let[e,o]=await Promise.all([Oo(this.paths.portFile,"utf8"),Oo(this.paths.tokenFile,"utf8")]),a=Number.parseInt(e.trim(),10),x=o.trim();return!Number.isFinite(a)||a<=0||!x?null:{port:a,token:x}}catch(e){if(e.code==="ENOENT")return null;throw e}}async fetch(e,o){let a=o.body!==void 0,x={Authorization:`Bearer ${e.token}`};a&&(x["content-type"]="application/json");let f=new AbortController,d=setTimeout(()=>f.abort(),o.timeoutMs??5e3);try{let h=await fetch(`http://127.0.0.1:${e.port}${o.path}`,{method:o.method,headers:x,body:a?JSON.stringify(o.body):void 0,signal:f.signal}),_=await h.text();return{status:h.status,body:bf(_)}}finally{clearTimeout(d)}}};function bf(r){if(!r)return null;try{return JSON.parse(r)}catch{return r}}function Sf(r){return r instanceof Error?r.message:String(r)}K();se();import{copyFile as Mo,mkdir as Ef,readFile as zr,writeFile as Cf}from"node:fs/promises";import{dirname as Af,resolve as qr,sep as zn}from"node:path";import{fileURLToPath as kf}from"node:url";K();se();var zo=B("dist-install");function Df(r){let e=kf(r),o=Af(e),a=`${zn}src${zn}`;if(o.includes(a)||o.endsWith(`${zn}src${zn}cli`))return null;let x=qr(o,"index.js"),f=qr(o,"..","package.json");return{dist:x,pkgJson:f}}async function qo(r={}){let e=r.paths??H(),o=Df(import.meta.url),a=r.sourceDist??o?.dist,x=r.sourcePackageJson??o?.pkgJson;if(!a||!x)return{kind:"dev-mode-skip",reason:"running from src/(tsx loader);no dist/ to install"};let f;try{f=JSON.parse(await zr(x,"utf8")).version??"unknown"}catch(y){return zo.warn("cannot read source package.json,skip dist install",{err:String(y)}),{kind:"dev-mode-skip",reason:`package.json read failed: ${String(y)}`}}let d=await cn(e.configFile)??{},h=d.libVersion;if(h===f)try{return await zr(e.libEntry),{kind:"already-current",libVersion:f}}catch{}await Ef(e.libDir,{recursive:!0}),await Mo(a,e.libEntry),await Mo(`${a}.map`,`${e.libEntry}.map`).catch(()=>{});let _=qr(e.libDir,"package.json"),v=`${JSON.stringify({type:"module"},null,2)}
92
+ `;return await zr(_,"utf8").catch(()=>null)!==v&&await Cf(_,v),d.libVersion=f,await kt(d,e.configFile),zo.info("dist installed",{libEntry:e.libEntry,fromVersion:h,toVersion:f}),h?{kind:"version-changed",fromVersion:h,toVersion:f,libEntry:e.libEntry}:{kind:"first-install",libVersion:f,libEntry:e.libEntry}}var Jf=B("cli");function _t(r,e){let o=[],a;for(let x=0;x<r.length;x++){let f=r[x];if(f===e){a=r[x+1],x+=1;continue}if(f.startsWith(`${e}=`)){a=f.slice(e.length+1);continue}o.push(f)}return{value:a,rest:o}}function Vf(r){let e=r.slice(2);if(e.includes("--daemon"))return{mode:"daemon"};if(e.includes("--status"))return{mode:"status"};if(e.includes("--stop"))return{mode:"stop"};if(e.includes("--refresh"))return{mode:"refresh"};if(e.includes("--uninstall"))return{mode:"uninstall"};if(e.includes("--install-service"))return{mode:"install-service"};if(e.includes("--help")||e.includes("-h")||e.length===0)return{mode:"help"};let o=e,{value:a,rest:x}=_t(o,"--pat-token");o=x;let{value:f,rest:d}=_t(o,"--pair-code");o=d;let{value:h,rest:_}=_t(o,"--env");o=_;let{value:v,rest:b}=_t(o,"--handshake-url");o=b;let{value:y,rest:A}=_t(o,"--frontier-url");o=A;let{value:L}=_t(o,"--agent-id");if(!a||!f)return{mode:"help"};let T={mode:"pair",privatecode:a,pairingCode:f};return h&&(T.env=h),v&&(T.handshakeUrl=v),y&&(T.frontierUrl=y),L&&(T.agentId=L),T}var Xf=`
92
93
  coze-bridge - local bridge daemon for cloud Agent Service
93
94
 
94
95
  Usage:
@@ -115,35 +116,35 @@ Auto-connect agent (optional):
115
116
 
116
117
  Internal:
117
118
  <node> <entry> --daemon daemon mode (OS supervisor only)
118
- `.trimStart();async function Ho(r=process.argv,e={}){let o=Uf(r);switch(o.mode){case"help":return process.stdout.write(Hf),0;case"daemon":{try{await To()}catch(a){return Ff.error("daemon start failed",{err:String(a)}),1}return new Promise(()=>{})}case"status":return Kf(e);case"stop":return jf(e);case"refresh":return Wf(e);case"uninstall":return Gf(e);case"install-service":return Jf();case"pair":{let a={};return o.env&&(a.env=o.env),o.handshakeUrl&&(a.handshakeUrl=o.handshakeUrl),o.frontierUrl&&(a.frontierUrl=o.frontierUrl),Xf(o.privatecode,o.pairingCode,e,a,o.agentId)}}}async function Ko(r){let{unlink:e}=await import("node:fs/promises");await Promise.all([e(r.pidFile).catch(()=>{}),e(r.portFile).catch(()=>{}),e(r.tokenFile).catch(()=>{})])}async function Kf(r){let e=r.paths??U(),o=new je(e),a=await o.probe();if(a.kind==="not-running")return process.stdout.write(`coze-bridge: not running
119
- `),1;if(a.kind==="stale")return await Ko(e),process.stdout.write(`coze-bridge: not running (cleaned stale state)
119
+ `.trimStart();async function jo(r=process.argv,e={}){let o=Vf(r);switch(o.mode){case"help":return process.stdout.write(Xf),0;case"daemon":{try{await Ro()}catch(a){return Jf.error("daemon start failed",{err:String(a)}),1}return new Promise(()=>{})}case"status":return Yf(e);case"stop":return Zf(e);case"refresh":return $f(e);case"uninstall":return Qf(e);case"install-service":return eu();case"pair":{let a={};return o.env&&(a.env=o.env),o.handshakeUrl&&(a.handshakeUrl=o.handshakeUrl),o.frontierUrl&&(a.frontierUrl=o.frontierUrl),tu(o.privatecode,o.pairingCode,e,a,o.agentId)}}}async function Wo(r){let{unlink:e}=await import("node:fs/promises");await Promise.all([e(r.pidFile).catch(()=>{}),e(r.portFile).catch(()=>{}),e(r.tokenFile).catch(()=>{})])}async function Yf(r){let e=r.paths??H(),o=new Ge(e),a=await o.probe();if(a.kind==="not-running")return process.stdout.write(`coze-bridge: not running
120
+ `),1;if(a.kind==="stale")return await Wo(e),process.stdout.write(`coze-bridge: not running (cleaned stale state)
120
121
  `),1;let x=await o.request({method:"GET",path:"/status"});return process.stdout.write(`coze-bridge: running
121
122
  ${JSON.stringify(x.body,null,2)}
122
- `),0}async function jf(r){let e=r.paths??U(),o=new je(e),a=await o.probe();if(a.kind==="not-running")return process.stdout.write(`coze-bridge: not running
123
- `),0;if(a.kind==="stale")return await Ko(e),process.stdout.write(`coze-bridge: not running (cleaned stale state)
123
+ `),0}async function Zf(r){let e=r.paths??H(),o=new Ge(e),a=await o.probe();if(a.kind==="not-running")return process.stdout.write(`coze-bridge: not running
124
+ `),0;if(a.kind==="stale")return await Wo(e),process.stdout.write(`coze-bridge: not running (cleaned stale state)
124
125
  `),0;try{return await o.request({method:"POST",path:"/shutdown"}),process.stdout.write(`coze-bridge: stopped
125
126
  `),0}catch(x){return process.stdout.write(`coze-bridge: stop failed: ${String(x)}
126
- `),1}}async function Wf(r){let e=new je(r.paths);if((await e.probe()).kind==="not-running")return process.stdout.write(`coze-bridge: not running (start daemon first)
127
+ `),1}}async function $f(r){let e=new Ge(r.paths);if((await e.probe()).kind==="not-running")return process.stdout.write(`coze-bridge: not running (start daemon first)
127
128
  `),1;try{let a=await e.request({method:"POST",path:"/refresh"});return a.status===200?(process.stdout.write(`coze-bridge: refreshed
128
129
  ${JSON.stringify(a.body,null,2)}
129
130
  `),0):(process.stderr.write(`coze-bridge: refresh failed: ${JSON.stringify(a.body)}
130
131
  `),1)}catch(a){return process.stderr.write(`coze-bridge: refresh failed: ${String(a)}
131
- `),1}}async function Gf(r){let e=new je(r.paths);if((await e.probe()).kind==="connected"){process.stdout.write(`coze-bridge: stopping daemon...
132
+ `),1}}async function Qf(r){let e=new Ge(r.paths);if((await e.probe()).kind==="connected"){process.stdout.write(`coze-bridge: stopping daemon...
132
133
  `);try{await e.request({method:"POST",path:"/shutdown"})}catch(f){process.stderr.write(`coze-bridge: stop failed (continuing): ${String(f)}
133
- `)}await new Promise(f=>setTimeout(f,500))}if(!r.skipSupervisor)try{let{getSupervisor:f,buildContext:d}=await Promise.resolve().then(()=>(Gr(),Wr)),g=f();await g.uninstall(d()),process.stdout.write(`coze-bridge: ${g.platform} supervisor unregistered
134
+ `)}await new Promise(f=>setTimeout(f,500))}if(!r.skipSupervisor)try{let{getSupervisor:f,buildContext:d}=await Promise.resolve().then(()=>(Wr(),jr)),h=f();await h.uninstall(d()),process.stdout.write(`coze-bridge: ${h.platform} supervisor unregistered
134
135
  `)}catch(f){process.stderr.write(`coze-bridge: supervisor uninstall failed (continuing): ${String(f)}
135
- `)}let a=r.paths??U(),{rm:x}=await import("node:fs/promises");try{await x(a.cozeRoot,{recursive:!0,force:!0}),process.stdout.write(`coze-bridge: removed ${a.cozeRoot}
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}
136
137
  `)}catch(f){return process.stderr.write(`coze-bridge: remove failed: ${String(f)}
137
138
  `),1}return process.stdout.write(`coze-bridge: uninstalled
138
- `),0}async function Jf(){try{let{getSupervisor:r,buildContext:e}=await Promise.resolve().then(()=>(Gr(),Wr)),o=r(),a=e();return process.stdout.write(`coze-bridge: installing ${o.platform} supervisor...
139
+ `),0}async function eu(){try{let{getSupervisor:r,buildContext:e}=await Promise.resolve().then(()=>(Wr(),jr)),o=r(),a=e();return process.stdout.write(`coze-bridge: installing ${o.platform} supervisor...
139
140
  `),await o.install(a),process.stdout.write(`coze-bridge: supervisor installed (daemon will auto-start on login)
140
141
  `),0}catch(r){return process.stderr.write(`coze-bridge: --install-service failed: ${String(r)}
141
- `),1}}async function Xf(r,e,o,a={},x){let f=new je(o.paths),d=o.spawnDaemon??Lo;if(!o.skipDistInstall){let _=await Oo({paths:o.paths});_.kind==="version-changed"?(process.stdout.write(`coze-bridge: upgraded ${_.fromVersion} \u2192 ${_.toVersion}
142
- `),(await f.probe()).kind==="connected"&&(await f.request({method:"POST",path:"/shutdown"}).catch(()=>{}),await new Promise(y=>setTimeout(y,500)))):_.kind==="first-install"&&process.stdout.write(`coze-bridge: installed ${_.libVersion}
143
- `)}let g=await f.probe();if(g.kind!=="connected"&&(process.stdout.write(`coze-bridge: starting daemon...
144
- `),await d({paths:o.paths}),g=await Vf(f,o.waitTimeoutMs??1e4,o.sleep??Yf),g.kind!=="connected"))return process.stderr.write(`coze-bridge: daemon did not come up: ${g.kind}
145
- `),1;let p={privatecode:r,pairing_code:e};a.env&&(p.env=a.env),a.handshakeUrl&&(p.handshake_url=a.handshakeUrl),a.frontierUrl&&(p.frontier_url=a.frontierUrl),x&&(p.agent_id=x);try{let _=await f.request({method:"POST",path:"/pair",body:p});return _.status===200&&_.body?.ok?(process.stdout.write(`coze-bridge: paired (${_.body.note??"ok"})
146
- `),0):(process.stderr.write(`coze-bridge: pair failed: ${JSON.stringify(_.body)}
147
- `),1)}catch(_){return process.stderr.write(`coze-bridge: pair failed: ${String(_)}
148
- `),1}}async function Vf(r,e,o){let a=Date.now()+e;for(;Date.now()<a;){let x=await r.probe(500);if(x.kind==="connected")return x;await o(200)}return r.probe(500)}function Yf(r){return new Promise(e=>setTimeout(e,r))}Ho(process.argv).then(r=>process.exit(r),r=>{process.stderr.write(`fatal: ${r instanceof Error?r.stack??r.message:String(r)}
142
+ `),1}}async function tu(r,e,o,a={},x){let f=new Ge(o.paths),d=o.spawnDaemon??Bo;if(!o.skipDistInstall){let v=await qo({paths:o.paths});v.kind==="version-changed"?(process.stdout.write(`coze-bridge: upgraded ${v.fromVersion} \u2192 ${v.toVersion}
143
+ `),(await f.probe()).kind==="connected"&&(await f.request({method:"POST",path:"/shutdown"}).catch(()=>{}),await new Promise(y=>setTimeout(y,500)))):v.kind==="first-install"&&process.stdout.write(`coze-bridge: installed ${v.libVersion}
144
+ `)}let h=await f.probe();if(h.kind!=="connected"&&(process.stdout.write(`coze-bridge: starting daemon...
145
+ `),await d({paths:o.paths}),h=await nu(f,o.waitTimeoutMs??1e4,o.sleep??ru),h.kind!=="connected"))return process.stderr.write(`coze-bridge: daemon did not come up: ${h.kind}
146
+ `),1;let _={privatecode:r,pairing_code:e};a.env&&(_.env=a.env),a.handshakeUrl&&(_.handshake_url=a.handshakeUrl),a.frontierUrl&&(_.frontier_url=a.frontierUrl),x&&(_.agent_id=x);try{let v=await f.request({method:"POST",path:"/pair",body:_,timeoutMs:35e3});return v.status===200&&v.body?.ok?(process.stdout.write(`coze-bridge: paired (${v.body.note??"ok"})
147
+ `),0):(process.stderr.write(`coze-bridge: pair failed: ${JSON.stringify(v.body)}
148
+ `),1)}catch(v){return process.stderr.write(`coze-bridge: pair failed: ${String(v)}
149
+ `),1}}async function nu(r,e,o){let a=Date.now()+e;for(;Date.now()<a;){let x=await r.probe(500);if(x.kind==="connected")return x;await o(200)}return r.probe(500)}function ru(r){return new Promise(e=>setTimeout(e,r))}jo(process.argv).then(r=>process.exit(r),r=>{process.stderr.write(`fatal: ${r instanceof Error?r.stack??r.message:String(r)}
149
150
  `),process.exit(1)});