coze-bridge 0.1.34 → 0.1.37

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 +85 -53
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -5,25 +5,25 @@ import { dirname as __coze_dirname } from 'node:path';
5
5
  const require = __coze_createRequire(import.meta.url);
6
6
  const __filename = __coze_fileURLToPath(import.meta.url);
7
7
  const __dirname = __coze_dirname(__filename);
8
- var k0=Object.create;var Sr=Object.defineProperty;var I0=Object.getOwnPropertyDescriptor;var P0=Object.getOwnPropertyNames;var D0=Object.getPrototypeOf,T0=Object.prototype.hasOwnProperty;var X=(r=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(r,{get:(e,i)=>(typeof require<"u"?require:e)[i]}):r)(function(r){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+r+'" is not supported')});var Me=(r,e)=>()=>(r&&(e=r(r=0)),e);var de=(r,e)=>()=>(e||r((e={exports:{}}).exports,e),e.exports),Ks=(r,e)=>{for(var i in e)Sr(r,i,{get:e[i],enumerable:!0})},N0=(r,e,i,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let c of P0(e))!T0.call(r,c)&&c!==i&&Sr(r,c,{get:()=>e[c],enumerable:!(a=I0(e,c))||a.enumerable});return r};var Oe=(r,e,i)=>(i=r!=null?k0(D0(r)):{},N0(e||!r||!r.__esModule?Sr(i,"default",{value:r,enumerable:!0}):i,r));import{chmod as L0,mkdir as R0,readFile as B0,rename as Gs,writeFile as Hs}from"node:fs/promises";import{dirname as M0}from"node:path";async function gt(r){try{let e=await B0(r,"utf8");return JSON.parse(e)}catch(e){if(e.code==="ENOENT")return null;throw e}}async function on(r,e,i){await R0(M0(r),{recursive:!0});let a=`${JSON.stringify(e,null,2)}
9
- `,c=`${r}.tmp-${process.pid}-${Math.random().toString(36).slice(2,10)}`;try{i?.mode!==void 0?await Hs(c,a,{encoding:"utf8",mode:i.mode}):await Hs(c,a,"utf8"),await Gs(c,r),i?.mode!==void 0&&await L0(r,i.mode)}catch(u){await Gs(c,c).catch(()=>{});let{rm:f}=await import("node:fs/promises");throw await f(c,{force:!0}).catch(()=>{}),u}}var an=Me(()=>{"use strict"});function Js(r){return xn[js]<=xn[r]}function Cr(r){Ws={...r}}function cn(r,e,i,a){if(xn[r]<xn[js])return;let c=JSON.stringify({ts:new Date().toISOString(),level:r,module:e,msg:i,...Ws,...a});r==="error"||r==="warn"?z0.write(`${c}
10
- `):O0.write(`${c}
11
- `)}function N(r){return{debug:(e,i)=>cn("debug",r,e,i),info:(e,i)=>cn("info",r,e,i),warn:(e,i)=>cn("warn",r,e,i),error:(e,i)=>cn("error",r,e,i),child:e=>N(`${r}.${e}`)}}var xn,js,O0,z0,Ws,K=Me(()=>{"use strict";xn={debug:10,info:20,warn:30,error:40},js=(()=>{let r=process.env.COZE_BRIDGE_LOG_LEVEL;return r==="debug"||r==="info"||r==="warn"||r==="error"?r:"info"})(),O0=process.stdout,z0=process.stderr,Ws={}});import{homedir as q0}from"node:os";import{join as xe}from"node:path";function H(r){let e=r??q0(),i=xe(e,".coze"),a=xe(i,"bridge"),c=xe(a,"lib");return{cozeRoot:i,bridgeRoot:a,libDir:c,libEntry:xe(c,"index.js"),pidFile:xe(a,"bridge.pid"),portFile:xe(a,"bridge.port"),tokenFile:xe(a,"bridge.token"),logFile:xe(a,"bridge.log"),installLock:xe(a,"install.lock"),configFile:xe(a,"config.json"),agentsRoot:xe(i,"agents")}}function ze(r,e=H()){let i=xe(e.agentsRoot,r);return{root:i,config:xe(i,"config.json"),workspace:xe(i,"workspace"),logs:xe(i,"logs")}}var le=Me(()=>{"use strict"});var dn={};Ks(dn,{AGENT_CONFIG_FILE_MODE:()=>un,enforceAgentConfigMode:()=>K0,loadAgentConfig:()=>he,persistAgentSessions:()=>Er,persistAgentSkills:()=>fn,saveAgentConfig:()=>be});import{chmod as F0,stat as U0}from"node:fs/promises";function he(r,e){return gt(ze(r,e).config)}function be(r,e){return on(ze(r.agentId,e).config,r,{mode:un})}async function K0(r,e){if(process.platform==="win32")return;let i=ze(r,e).config;try{let a=await U0(i);if(!a.isFile())return;let c=a.mode&511;c!==un&&(await F0(i,un),Vs.warn("agent config mode auto-corrected to 0600",{path:i,from:c.toString(8)}))}catch(a){if(a.code==="ENOENT")return;Vs.warn("enforceAgentConfigMode: chmod failed (ignored)",{path:i,err:String(a)})}}async function Er(r,e,i){let a=await he(r,i);a&&(a.sessions=Object.fromEntries(e),await be(a,i))}async function fn(r,e,i){let a=await he(r,i);a&&(a.skills=e,await be(a,i))}var Vs,un,Je=Me(()=>{"use strict";an();K();le();Vs=N("agent-config"),un=384});var io=de(Q=>{"use strict";var E=I;(function(r,e){let i=I,a=r();for(;;)try{if(-parseInt(i(1080))/1*(-parseInt(i(1722))/2)+parseInt(i(1401))/3*(-parseInt(i(1808))/4)+parseInt(i(1771))/5+-parseInt(i(1613))/6+-parseInt(i(645))/7*(-parseInt(i(996))/8)+-parseInt(i(1315))/9*(parseInt(i(738))/10)+parseInt(i(1100))/11*(-parseInt(i(624))/12)===e)break;a.push(a.shift())}catch{a.push(a.shift())}})(Gn,925396);var Mx=Object[E(1383)+E(1417)],Ox=Object[E(546)+E(1200)+E(1935)],eo=(r,e)=>function(){return r&&(e=(0,r[{FKEyF:function(u,f){return u(f)}}[E(543)](Ox,r)[0]])(r=0)),e},zx=(r,e)=>{for(var i in e)Mx(r,i,{get:e[i],enumerable:!0})};function qx(){return Xi||(Xi=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function Fx(){let r=E;return Yi||(Yi=[IDBCursor[r(939)+"e"][r(1482)],IDBCursor[r(939)+"e"].continue,IDBCursor.prototype[r(1102)+r(1177)+"ey"]])}function Ux(r){let e=E,i={zghAW:e(554),AUwRE:function(c){return c()},cZtOa:function(c,u){return c(u)},HpNKb:function(c){return c()},JRLGL:"ZNjYJ",qMSLM:e(609),Xoeic:function(c,u){return c instanceof u}},a=new Promise((c,u)=>{let f=e,h={YRwPV:function(m,_){return i[I(1975)](m,_)},YBBZl:function(m){return i[I(1907)](m)}};if(i[f(1291)]!==i[f(962)]){let m=()=>{let v=f;r[v(1174)+v(1192)+v(1864)](i[v(735)],_),r[v(1174)+v(1192)+"ner"]("error",y)},_=()=>{let v=f;h[v(863)](c,Ne(r[v(573)])),m()},y=()=>{u(r[f(1063)]),i.AUwRE(m)};r[f(771)+"Listener"](i.zghAW,_),r[f(771)+f(1244)](f(1063),y)}else this._debug(f(1552),_0x3bef9a[f(1905)]),h[f(1362)](_0x934db2)});return a[e(1128)](c=>{let u=e;i[u(504)](c,IDBCursor)&&qr[u(1928)](c,r)})[e(1262)](()=>{}),Un[e(1928)](a,r),a}function Kx(r){let e=E,i={sbGAl:function(c,u){return c<=u},zkWhH:function(c,u){return c<u},sIzLF:function(c,u){return c+u},cIyPo:function(c,u){return c&u},qKcwz:function(c,u){return c>>u},LmTlK:function(c,u){return c|u},ShRCX:function(c,u){return c!==u},PkwfL:e(1350),NktAr:"qZSau",UELKL:"complete",lTKHz:"error",szynp:function(c){return c()},fQdhJ:function(c,u){return c(u)},BQwan:e(1707)+"or"};if(Fn[e(2023)](r))return;let a=new Promise((c,u)=>{let f=e,h=()=>{let y=I,v={SlFwm:function(S,A){return S>=A},jqDOY:function(S,A){return i[I(1246)](S,A)},VHNbx:function(S,A){return i[I(1896)](S,A)},aNWYI:function(S,A){return i.sIzLF(S,A)},gipjr:function(S,A){return S<A},Wegvp:function(S,A){return S|A},qMfxO:function(S,A){return i[I(1038)](S,A)},qiwSu:function(S,A){return i[I(647)](S,A)},CpJyF:function(S,A){return S|A},lGOjl:function(S,A){return S>>A},mPUYb:function(S,A){return i[I(1598)](S,A)}};if(i[y(1117)](i[y(1558)],i[y(788)]))r["removeEv"+y(1192)+y(1864)](i[y(620)],m),r["removeEventListe"+y(1864)](i[y(792)],_),r[y(1174)+y(1192)+y(1864)]("abort",_);else{let S=_0x2ff5d2[y(1344)+"At"](_0x533e5e);v.SlFwm(S,55296)&&v.jqDOY(S,56319)&&v[y(1623)](v[y(550)](_0x464d48,1),_0x2a8e62)&&(S=(S<<10)+_0x340ed8.charCodeAt(++_0x5c116b)-56613888),v[y(828)](S,128)?_0xd92972[_0x34d719++]=S:(v.VHNbx(S,2048)?_0x18cd10[_0x492001++]=v[y(1043)](v.qMfxO(v.qiwSu(S,6),31),192):(S<65536?_0x562391[_0x54d2cd++]=v.qMfxO(v[y(534)](S,12),15)|224:(_0x44d85b[_0x7dfb69++]=v.CpJyF(v[y(1829)](S>>18,7),240),_0x399673[_0x399bc9++]=v[y(1043)](v[y(534)](S,12)&63,128)),_0x45218a[_0x81e26a++]=v[y(1873)](S,6)&63|128),_0x5a6f69[_0x3aed07++]=v.mPUYb(v[y(1829)](63,S),128))}},m=()=>{i[I(480)](c),h()},_=()=>{let y=I;i.fQdhJ(u,r[y(1063)]||new DOMException(i[y(862)],i[y(862)])),i.szynp(h)};r[f(771)+f(1244)](i[f(620)],m),r[f(771)+f(1244)](i[f(792)],_),r["addEvent"+f(1244)](f(832),_)});Fn[e(1928)](r,a)}function Gx(r){Kn={HkuTg:function(i,a){return i(a)}}.HkuTg(r,Kn)}function Hx(r){let e=E,i={AqYyR:function(a,c){return a(c)},sZWXm:function(a,c){return a(c)},PiCdD:function(a,c){return a===c},CMXmR:function(a,c){return a in c},ZBznQ:function(a){return a()}};return i.PiCdD(r,IDBDatabase[e(939)+"e"][e(967)+"ion"])&&!i[e(1524)](e(1580)+"oreNames",IDBTransaction[e(939)+"e"])?function(a,...c){let u=e,f=r[u(1255)](Jt(this),a,...c);return zr[u(1928)](f,a[u(850)]?a.sort():[a]),Ne(f)}:i.ZBznQ(Fx)[e(1916)](r)?function(...a){let c=e;return r[c(1440)](i[c(1521)](Jt,this),a),i[c(1413)](Ne,qr[c(692)](this))}:function(...a){return Ne(r[e(1440)](Jt(this),a))}}function jx(r){let e=E,i={wvAgY:function(a,c){return a===c},hlDNb:e(1175),EHmUe:function(a,c){return a(c)},zkbJk:function(a,c){return a instanceof c},BaogW:function(a,c,u){return a(c,u)},Sryvw:function(a){return a()}};return i[e(938)](typeof r,i.hlDNb)?i[e(1591)](Hx,r):(i.zkbJk(r,IDBTransaction)&&Kx(r),i[e(1701)](to,r,i[e(1167)](qx))?new Proxy(r,Kn):r)}function Ne(r){let e=E,i={tVlgo:function(c,u){return c instanceof u},FRUXZ:function(c,u){return c(u)},WjPcm:function(c,u){return c(u)},LolIt:function(c,u){return c!==u}};if(i[e(1008)](r,IDBRequest))return i[e(816)](Ux,r);if(zn[e(2023)](r))return zn.get(r);let a=i[e(2030)](jx,r);return i[e(1741)](a,r)&&(zn[e(1928)](r,a),Un.set(a,r)),a}var to,Xi,Yi,qr,Fn,zr,zn,Un,Kn,Jt,$i=eo({"node_modules/idb/build/wrap-idb-value.js"(){let r=E,e={OZcGX:function(i,a,c){return i(a,c)},GFIIn:function(i,a,c){return i(a,c)},WdKMf:r(761),mfNAc:function(i,a){return i instanceof a},HwsqR:function(i,a){return i===a},rjLrq:r(1702),NcjrR:function(i,a){return i===a},aDcaq:r(759),qzsEw:r(1225),tLXpZ:function(i,a){return i===a},uQUWD:r(734),Lqrhu:"dwdGQ",VvfvW:function(i,a){return i(a)},SGJJq:function(i,a){return i<=a},mpfuf:function(i,a){return i>=a},LtPJM:function(i,a){return i<a},nbPJC:function(i,a){return i|a},dHOtg:function(i,a){return i<<a},YtWln:function(i,a){return i&a},yJgpn:function(i,a){return i<<a},sIjog:function(i,a){return i&a},pfCRB:function(i,a){return i-a},uXIKp:function(i,a){return i&a},vokIU:function(i,a){return i+a},FYbdw:function(i,a){return i>>a},xQXhF:function(i,a){return i===a},cGTqc:"Pinyg"};to=(i,a)=>a.some(c=>i instanceof c),qr=new WeakMap,Fn=new WeakMap,zr=new WeakMap,zn=new WeakMap,Un=new WeakMap,Kn={get(i,a,c){let u=r,f={hmwcc:function(h,m,_){return e.OZcGX(h,m,_)},DAECn:function(h,m,_){return e[I(551)](h,m,_)}};if(e[u(1359)]===u(1888))this[u(1737)]++;else{if(e[u(1380)](i,IDBTransaction)){if(e[u(708)](a,e[u(1784)]))return Fn.get(i);if(e.HwsqR(a,u(1580)+u(1806)))if(e[u(1714)](e[u(1987)],e[u(846)]))f[u(998)](_0x127d0d,_0x42eecf,66),f[u(1939)](_0x15c969,_0x4c4f8b,_0x5b05d9[u(805)]),f[u(1939)](_0x15b0dd,_0xa4c7a8,_0x508996);else return i[u(1580)+u(1806)]||zr[u(692)](i);if(e.tLXpZ(a,e.uQUWD)){if(e[u(1052)](e[u(1159)],u(1216)))return c[u(1580)+"oreNames"][1]?void 0:c["objectSt"+u(1382)](c.objectStoreNames[0]);_0x5b94c1[u(1209)]=_0x2f8113[u(1665)]().then(()=>(_0x25b432(),_0x5504fc)).then(function(h){return h})}}return e[u(1735)](Ne,i[a])}},set(i,a,c){return i[a]=c,!0},has(i,a){let c=r,u={WyllG:function(f,h){return e.SGJJq(f,h)},orCFz:function(f,h){return e[I(1047)](f,h)},bmDPO:function(f,h){return e[I(1631)](f,h)},moIje:function(f,h){return e[I(1639)](f,h)},RYeMY:function(f,h){return e[I(1890)](f,h)},PXnsu:function(f,h){return e[I(922)](f,h)},JDWbw:function(f,h){return e.LtPJM(f,h)},uPVVa:function(f,h){return f|h},HeImM:function(f,h){return e[I(1890)](f,h)},ngfkj:function(f,h){return e[I(807)](f,h)},KmHfB:function(f,h){return e.sIjog(f,h)},UgZoP:function(f,h){return e[I(1855)](f,h)},EzxDl:function(f,h){return e[I(1639)](f,h)},cROwr:function(f,h){return e[I(1330)](f,h)},ONgcg:function(f,h){return e[I(1890)](f,h)},ZeEoO:function(f,h){return e[I(1142)](f,h)},OZvvf:function(f,h){return f<<h},DGFni:function(f,h){return e[I(1583)](f,h)},ENQkx:function(f,h){return e[I(557)](f,h)}};if(i instanceof IDBTransaction&&(a===e[c(1784)]||e[c(1733)](a,e.uQUWD))){if(c(1014)!==e[c(857)])return!0;{let f=_0x525c68[_0x17b087++];if(u[c(1908)](f,127))_0x343084+=_0x173efc[c(1140)+"Code"](f);else if(u.orCFz(f,192)&&u[c(772)](f,224))_0x59554c+=_0x4bc67d[c(1140)+c(732)](u[c(1528)](u[c(1471)](u.PXnsu(31,f),6),63&_0x35c5d4[_0x389d67++]));else if(u[c(1630)](f,224)&&u.JDWbw(f,240))_0x4d67e4+=_0x3dbf65[c(1140)+c(732)](u[c(1455)](u[c(937)](u.PXnsu(15,f),12),u[c(545)](u.KmHfB(63,_0x4cf681[_0x3672bd++]),6))|u[c(689)](63,_0x40e3ac[_0x513374++]));else if(f>=240){let h=u[c(758)](u[c(1455)](u[c(1965)](u[c(1965)](u[c(1471)](u[c(721)](7,f),18),u[c(1376)](u[c(918)](63,_0x4e3bce[_0x5dff2++]),12)),u[c(1213)](63&_0x14e2c1[_0x35b601++],6)),u[c(851)](63,_0x44198f[_0x162f7b++])),65536);_0x2b2144+=_0x1da6a1[c(1140)+c(732)](u[c(1240)](55296,u[c(871)](h,10))),_0x5443f4+=_0x55ee16[c(1140)+c(732)](u[c(1240)](56320,u[c(721)](1023,h)))}}}return a in i}},Jt=i=>Un[r(692)](i)}}),no={};zx(no,{deleteDB:()=>Jx,openDB:()=>Wx,unwrap:()=>Jt,wrap:()=>Ne});function Wx(r,e,{blocked:i,upgrade:a,blocking:c,terminated:u}={}){let f=E,h={OxVns:function(y,v,S,A,D){return y(v,S,A,D)},hiIql:function(y,v){return y(v)},RjfAa:function(y,v){return y(v)},gBWEo:f(760),WrhZR:f(1309)+f(608),IDRbA:f(1910)+f(1201)},m=indexedDB[f(791)](r,e),_=h[f(2031)](Ne,m);return a&&m[f(771)+f(1244)](h[f(638)],y=>{let v=f;h[v(1745)](a,h[v(2031)](Ne,m.result),y[v(1815)+"on"],y.newVersion,h.RjfAa(Ne,m[v(967)+"ion"]))}),i&&m["addEvent"+f(1244)](f(1743),()=>i()),_.then(y=>{let v=f;u&&y[v(771)+v(1244)](h[v(1476)],()=>u()),c&&y[v(771)+v(1244)](h[v(948)],()=>c())}).catch(()=>{}),_}function Jx(r,{blocked:e}={}){let i=E,a={nVfoU:"blocked"},c=indexedDB[i(1800)+i(1676)](r);return e&&c[i(771)+"Listener"](a.nVfoU,()=>e()),Ne(c).then(()=>{})}function Zi(r,e){let i=E,a={GVgCv:function(m,_){return m<=_},daZba:i(1121)+"alled multiple times in "+i(978),ZbiLB:function(m,_){return m===_},QBvMr:function(m,_){return m+_},cibWB:i(586)+"e",DMLba:i(1658),vcKAW:function(m,_){return m instanceof _},sYTAr:function(m,_){return m in _},bbGlE:function(m,_){return m!==_},cGGYi:function(m,_){return m!==_},xEiJh:function(m,_){return m in _}};if(!(a[i(616)](r,IDBDatabase)&&!a[i(1813)](e,r)&&a[i(1243)](typeof e,"string")))return a[i(714)](i(1441),"BuUNM")?a.GVgCv(_0x292987,_0x306527)?_0x3cf342.reject(new _0x515be8(a.daZba)):(_0x10d648=_0x49feba,a.ZbiLB(_0x5542cf,_0x5e63d3[i(805)])?_0x282c52[i(1665)]():_0x31bd3b[_0x52e2b0][i(459)](_0x3907d7)(_0x390454,_0x3b7fbf[i(459)](null,a[i(1474)](_0x321a6e,1)))):void 0;if(qn[i(692)](e))return qn.get(e);let c=e.replace(/FromIndex$/,""),u=a.cGGYi(e,c),f=so.includes(c);if(!a.xEiJh(c,(u?IDBIndex:IDBObjectStore)[i(939)+"e"])||!(f||ro[i(1916)](c)))return;let h=async function(m,..._){let y=i,v=this[y(967)+"ion"](m,f?a[y(1019)]:a[y(640)]),S=v[y(734)];return u&&(S=S[y(585)](_.shift())),(await Promise.all([S[c](..._),f&&v[y(1702)]]))[0]};return qn[i(1928)](e,h),h}var ro,so,qn,Vx=eo({"node_modules/idb/build/index.js"(){let r=E,e={Sihwy:function(i){return i()},UzZGp:"get",ydnbE:r(1571),VkkCs:r(1254),PCEmK:r(1942)+"ys",VQLFn:r(1737),fpDNX:"put",fuyaB:r(1769),yjCmf:r(450),PFapU:"clear",EPhNB:function(i,a){return i(a)}};e[r(1593)]($i),$i(),ro=[e[r(1439)],e[r(1589)],e[r(1577)],e[r(1001)],e[r(1056)]],so=[e[r(1165)],e[r(1671)],e[r(1841)],e[r(700)]],qn=new Map,e[r(1242)](Gx,i=>({...i,get:(a,c,u)=>Zi(a,c)||i[r(692)](a,c,u),has:(a,c)=>!!Zi(a,c)||i[r(2023)](a,c)}))}}),Xx={idb:function(r){let e=E;r[e(1209)]=Promise.resolve()[e(1128)](()=>(Vx(),no))[e(1128)](function(i){return i})}},Qi={};function I(r,e){r=r-439;let i=Gn(),a=i[r];if(I.kTzjdV===void 0){var c=function(m){let _="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=",y="",v="";for(let S=0,A,D,L=0;D=m.charAt(L++);~D&&(A=S%4?A*64+D:D,S++%4)?y+=String.fromCharCode(255&A>>(-2*S&6)):0)D=_.indexOf(D);for(let S=0,A=y.length;S<A;S++)v+="%"+("00"+y.charCodeAt(S).toString(16)).slice(-2);return decodeURIComponent(v)};I.KxniYW=c,I.UKunGh={},I.kTzjdV=!0}let u=i[0],f=r+u,h=I.UKunGh[f];return h?a=h:(a=I.KxniYW(a),I.UKunGh[f]=a),a}function Te(r){let e=E,i={dtkby:e(929)+"4",VGXxB:function(h,m){return h!==m}},a=i.dtkby[e(1821)]("|"),c=0;for(;;){switch(a[c++]){case"0":var u=Qi[r];continue;case"1":if(i.VGXxB(void 0,u))return u[e(1209)];continue;case"2":Xx[r](f,f.exports,Te);continue;case"3":var f=Qi[r]={exports:{}};continue;case"4":return f[e(1209)]}break}}Te.d=(r,e)=>{let i=I;for(var a in e)Te.o(e,a)&&!Te.o(r,a)&&Object["definePr"+i(1417)](r,a,{enumerable:!0,get:e[a]})},(()=>{let r=E;Te.o=(e,i)=>Object[r(939)+"e"][r(1412)+r(1417)][r(1255)](e,i)})(),(()=>{let r={tXwnM:function(e,i){return e!=i},uMPFK:"undefined",UytxG:"Module"};Te.r=e=>{let i=I;r[i(1360)](r.uMPFK,typeof Symbol)&&Symbol[i(1654)+i(1504)]&&Object[i(1383)+"operty"](e,Symbol[i(1654)+i(1504)],{value:r[i(686)]}),Object[i(1383)+"operty"](e,"__esModule",{value:!0})}})();var Y={};function Gn(){let r=["ugT3zKW","Aw9Ul2PZB24","vePSCLm","CNnVCKzPBgu","tujHtM4","rKDSvKK","rxzLBNq","sg5oBvq","CwL2DfC","lcbTyxGGCMu","B25tDgfYDfi","Cxj5Axu","y2XVC2uSihC","z2v0s2v5","refcANe","mdaWmdaWmda","qxn4BKm","ugTzt2m","veLNrhG","vMTRq3m","tgf0Cw0","CufhsKC","B2jQzwn0u3q","BhrpDeS","wfzyu2m","DM9Rsvu","su1uA0y","DwPYsva","B0LuEuy","seDvBxG","ywnRtxnNswq","EwrUyKu","BwDJwhe","ruHTvwu","Effez0m","u2LOD3K","AKLLDNq","DMXStu0","D0jMBuS","q0foA2q","tg1uBeS","txjIwxu","z3nWA0W","B25nzxnZywC","AgLcr2i","uvHHrui","u2HlANK","D2PSyK8","AvPUvKK","tuzrzMK","wMv1u0u","ruPfrw8","ihrPBwvVDxq","rfzlrLi","yw5Hz2vY","ndmWmda4zwzqwMLX","Bez4s28","y2HLy2Tszwe","Dg9VigXHCMC","x3bYB3rVy28","A1n0yxr1C0m","B2znr0G","yNLL","ChrVCG","rgvjBxK","vKHoyNG","B3PSBKK","wLfhrvm","zwjsAhi","CgfNzxnOB3C","CgvYC2LZDgu","y3vYC29Yx2y","B3jdrNO","thrqsK0","x2LZtwLUAvq","CxPwDe8","EKvYzfu","rxjYB3jdB2q","teTtz2u","q0Xpu0ve","DwHxEhu","BMjqsKm","q3vZDg9Tq2W","yvnZzMC","B25VCgvU","ru5st3G","x2LZtwLUAvC","BIWGAg9ZDg4","CenVq1y","suH1wKy","BM93","zfvvDKC","yxv0B21HDgK","Bg9NsurozxC","x3DHAxq","x3jLy29UBMu","Dg9tDhjPBMC","x2LZv29YA2u","AenqsMC","r2r0z1G","CMvHzg9UBhK","EgDWuLu","swflt2q","ChbL","DvPoyKu","ENnOtKG","x2LUAxrqCM8","CMvZB2X2zq","yw51Ce1LC3m","x29Ut3bLBG","qwj4tNy","DNbMEgy","Ag9dDKy","zNv5yui","yM9KEq","sLHKuvi","n3W2Fdb8nhW","z3HdzK8","DgfIyxnL","s0PMBxC","qMHKAMi","zhvivuK","y1DyDhm","whfkvgG","v1DSAui","DhDgEwS","q0H2Cwm","sxv0BLK","zw5HyMXLuw8","BM5Ly3q","uhfnCNG","vuvlqvK","ugjrr00","zw1PDa","zw5NDgG","BMfTzq","veD3Efq","tentDMq","t2DiEhe","rwzWsuW","yxGGCMv0CMK","yvbwt3K","mNWW","qMfVz1C","zg9Uzq","Dw50","DwDNsgq","sM9UwgG","teDQvK4","qwjVCNrfCNi","qw1VDw50","twvfy0y","x2TLEvbHDgG","ELvNvNu","CMnryMW","y29UBMvJDgK","tMnQCLi","qKXPv20","zxnrt0u","vLrPqLy","DfDotw8","tvPpAK0","y2vZC0HHBMq","Aencz3a","mLjwBu51wq","CK9NB2S","zgvS","rfzzCK0","mxW0","B3jpBMXPBMu","C2v0u3rVCMe","uLjpuG","tLLMsNe","ywLVzwW","CgXAy0i","EffyAey","z2u6ia","vNzMDLC","D2L2qLi","y291BNq","zgrjrcWGzgu","C0nVDw50zxi","A2j5yNG","tg9Ssxq","BwvZC2fNzv8","yMXVy2TLza","u3P3suG","t3HwBNm","C3Dqvuq","C1PcEfa","z3vYy2O","tufxsM4","qNncr2m","wezTCxa","DfPOsvu","x194x21Zz18","zuz5ufi","x3bHDgHlzxK","qLzuA1G","qvPfr3i","vvHoEvO","EffVueG","vMDjy2C","AMLvs1u","ihzHBgLKihm","Cxr2Exe","B2HzrLa","rwnmtuK","DMLJzuLeig8","Bg9IywXty28","CM9YrxzLBNq","ywrK","CxPSA2y","ntC2nJuYnvnWuLjyAG","AxnAzxjV","vKXgzfu","AgvHzgvY","CgfYC2u","yw1LoIa","Dg9cExrLC0i","weLkr1C","zw5KCg9PBNq","wxrZBMe","DuTwEeW","rwvmvu8","uvfcseW","CMPmCNe","C3vIC3rYAw4","BgLTAxq","BezSDxnO","ve1wuKq","AxnszwfKEq","BMrWB2LUDca","qLH6s1C","zgv2AwnLx2K","C2v0y3vYC28","yMvjEvG","BvDzD04","u3rYyxrLz3K","CNrSzLC","zgf0yq","x3nLBMrby2S","zgvSzxrLrge","y3HUtNK","wwLnvgu","seXcwvq","CgLUz09Uy2u","tgP6AhK","B3jLtMfTzxm","q1bkvxG","mtqZmtGWBwPKwujV","x3nVy2TLDa","q2nZDNm","B2zMC2v0","rvDKweO","C1Luqxi","BeX2vhG","B2XKvMvYC2K","z0jzALO","DwPSBvK","ywDLu2HVDW","BwvKAwf0zwW","qLDgAeS","C3bSAxq","zfjuB3q","B25mAw5L","ywX3yxLZ","uxvLDwu","y3jLyxrLtwu","y29UBMvJDfm","u2vYDMLJzvC","Cu1MEe8","t2vLDMy","tNDpsKq","twXrDvy","Dg9oDw1Izxi","C0XPC3rLBMu","ENP4AxG","qNHAD3C","ugjvCLi","CgXLyxnLiha","DeLK","Bwf4twvZC2e","EwPdBwy","BeHHBMrSzxi","y2XLyxi","CKHWv1C","ChjVDg9JB2W","Ahrbq2C","DMfSDwvZ","BM9Uzv9UB24","zhv2EfO","sMDWwgG","vxnxC20","DMvUDa","y29UBMvJDca","uLvxAxK","CgzduKi","z2vY","ihrYEsbYzwm","x2LUAxrhBg8","ufbqq1C","AM9PBG","tLzVsfi","wxH5rKC","s01nBMi","BMvY","suXxqwi","x2rItMfTzq","x3jLywr5q2W","Cg9PBNrdB24","mxW0Fdb8m3W","v0zLDLC","Bxrwq0u","C0XSExu","BeDpAMW","Dw5KzwzPBMu","x2DLBMvYyxq","v3jmEKO","BwvZC2fNztO","wNnVrgq","qufsAfa","ExbL","CgLUz0XVC3m","y3vYC29Yx24","CMXLu2O","CMvJzxzPzwq","wNbbrve","DvvIrLO","y3ruAw1LB3u","yxrLz3C","ywWGy3vYC28","zeHpDgC","qvjetKm","Bg9N","x2n1CNnVCK4","Aw5N","u2DIqwS","EMTxAeG","rLDt","Bwu6ia","z2v0q3vYC28","rNrdrwS","CwTRyxm","sfnTD2C","EsbJBg9Zzwq","AfPvD3a","BwvZC2fNzq","r0Dvq3m","shbos2i","v3LSBeC","EKD0A3O","DxbNCMfKzw4","v01Yugu","t2LZAvG","r3n3s1O","s3vuqwi","C3nHz2vfDMu","Aw5JBhvKzxm","ignVzgu6ia","igzHAwWSig0","D0TXuNm","AxnmB25N","qNPXrhC","sxPjs2u","DMfSDwu","EKnArvG","yNvMzMvYzwq","Bwf4tg9ZC0m","wvvzwwe","C2v0","rhPhrK8","wgP1ELy","s21lALu","BMnhrhu","rLLQEhy","y3jzB2G","BwvZ","CMvTB3zLq2G","zNjVBuHHC2G","C3rYAw5N","reffq24","vMnRzhe","ruDks0i","z2v0qwXSs2u","x25HDMLNyxq","qw90zxi","thzktxa","t0XqAMi","AhjStwm","wKjVExC","BNzMq2e","s1zJs2W","wvfZq0G","BMDuAw1LCG","se9hqu4","D24GCMvHC28","Ew5pAeu","twfiwMW","y29Uy2f0","CMvXDwLYzwq","CNjVCK1LC3m","zMLUza","CgLUz0LUDgu","DxjS","yMzXuM0","BfrPBwvVDxq","rxP4rgW","Cw9isK0","y29UC3rYDwm","s0vgzK0","yK5QquK","ywXSB2nvBNm","zxnSBuW","yu5IAgu","DgvZDa","Dhj1y3rVCIa","y1P0t2e","uNHWDuG","u1bJA0S","y3jLyxrLrwW","tevcrK4","Eu5hue0","Dxj3vMe","C3rVCcbPBw0","aaaaaaaaaaa","x2HHBMrSzva","DKrREum","zxjFCw9Z","yurJyxe","zw50zwqGDhK","x21LC3nHz2u","D0ztwey","u2vXsuq","y3jLyxrLuMu","vMzbvhy","C3jJ","Bgz2vfq","CgLUz19VBMm","CNzHBfzHBhu","zwzfyuO","teDyy0G","sKrrsu0","y3vYCMvUDeK","DMvY","AKP5q3a","zxjFBxnNAwq","AKvvy3e","zxj2AwnL","DKHPquu","x2HHBMrSzu8","EvjLy29UBMu","ALzwC28","BfjzDxy","x29UugfNzu4","qNLLwuW","BhrPCgXLihq","DwztA20","DhnwBei","DK9tyuq","t2jQzwn0","icSG","twvZC2fNzuu","vxfhDvi","D3nZoI8V","AgfZ","C2vUzf9Hy2S","Aw1LCYbPBIa","tfLdrKy","CNnVCL9Uyw0","Cg9W","mNW0Fdf8mhW","v2Pqy20","AgLjCwW","z2DYDva","AxnrB1nnzxm","yKn0zNi","Bhv2rwK","sg1rr3e","wu1quu4","s29XDKq","t3nyqve","ywDLsgLKzq","shLAre4","tKvVvfO","z1rPBwvVDxq","y3jLyxrLq2W","zxmGCMvHy2G","zgvSzxrL","igzPzwXKoIa","s0jfrxe","AwXSihvZzsa","nxW0Fdf8m3W","yxbWzw5Kq2G","q0Xpu0LorW","CK5UBvO","C3rYAw5NAwy","yMLUza","zhjQz2y","x3jLBw92zvC","yK1ty08","Bg93","zgvIDwC","r3nUvKK","CK5kCg0","vuHIswW","zfHKv3u","vwz5Afa","tKDFrvjst1i","vg1LANO","B1HsDxq","svvuvfu","tKjvB0m","ENjQCKK","BgvY","yw1L","whvHuvC","ywv5AK0","C3P5BNa","zufJAW","DK9vDgy","B2nRzxrgywK","D1zoEhK","vxbKyxrLq28","B2zM","uNvmuNm","rgP0qu8","rKfcugm","tNrXwxy","vwL6AMS","zcbLCNjVCI4","Bwv0Ag9K","qvv6tNO","BwLXvuC","DxrVuMvJB24","uvPNBgS","r0L1vLm","D3b5AK4","wLnrBKW","CYbHBhjLywq","tuvtu0fhrv8","BMDRweq","wg9LAwm","Cwn0D2O","qMfcwha","tfvvz28","zxP4wuK","rhvXvM4","wNjXsw8","BgvKEwu","y0Pgugq","qMDev08","Dw5ZAwDUzwq","B2fK","EMHMzgC","ueLvuhm","z2v0u3rVCMe","qKz6y1K","x2LZtM9Kzq","surhA2S","wK9bDgq","rMHbBhC","y2HLy2TdDxi","wg53uvi","CNnVCL92ywW","ANnZD3u","vwn3Exi","y2XLyxjtDg8","tMvwrfe","sMHMwNK","D09ID0G","ueXeq1C","CwL3u3u","CMvZzxrfBMq","x29UrxjYB3i","BfLovwm","CgLgv0W","s0vjuxK","r1rNCLu","uNn0u2y","rejVyMS","rKTfEuy","r0jHreO","BMDMA2O","z2v0t3DUuhi","zhvdveW","rhHsy0e","ihbYB3rVy28","yu5xwuK","r0zjsw4","ANvKwxG","BM5kBLG","C3vJy2vZCW","yNL0zu9MzNm","zvvYBa","rLLIzhC","v3bvAKi","m3WYFdf8mhW","uvfVz2q","thzxru0","quXm","yxbbvve","vgDYsve","Dvfyruy","A2riq00","yNvYB2W","B3nLrxzLBNq","rK1qzxO","B2zMBgLUzq","ugPpyMG","qMPPwNm","CMvZDwX0","BfvUz1m","twH3AK0","Dg9iyxnO","ChvZAa","mxWWFdr8m3W","CNzHBa","BvblDeO","uxD3vMq","vxj2wM8","DxnLCKLW","v0jgy08","Aw5KzxG","CMvHzhDYAxq","CLzHBhvLCW","ihzHBgLKigq","quDms0i","DKfAq3e","rxfZsNe","AenSB3nLrxy","x2rLyNvN","yM9L","Aw50zwDLCIa","EgvxDfq","BMnVzgLUzW","ve1Xy3i","zwn0","D2fZq2XLyw4","tvPIq28","CMvUDevUzha","yNvMzMvY","CwvkDfK","DwfAquq","D09HC20","rLjHs2O","AgfUz2u","vK5Ouem","ugTJA2u","sxvLywm","r0DwEgq","tMHly0u","x2LUDgvYDMe","z0Tls3K","DMnlqvC","qMjoBw4","rNHRz3O","zw5fDMvUDa","vuvms0W","CMvWBgfJzq","rvLlDMy","y1Pnsxi","mty4Eg1QzMnv","vwvOvLa","x2LZqNjVD3m","Cg93","zgLZywjSzue","tufyx1jfvfi","wunqvvG","zxrxB3jRq2G","vuzoC0e","C2XPy2u","x2rPC2nVBM4","AKnfueO","vxHTBgW","sKHyBuO","sursyKe","C3P2qvO","re1myMe","yxKSig5LDhC","EM5srhC","q291BNq","ywnOzwqSihC","n1brzeXKDa","tKHnD0C","CuTJD3O","DgvTugC","BxnNsuq","AfPjsxK","x2fKzfDZtgK","AhDPAwO","CMXmBxa","rMrvrK0","CMvQzwn0","x29Uq2XVC2u","D05QDhG","Dfn6EKW","twnUqvO","B2nRzxrtDwm","zw9dC0G","AgvKtwf4uMu","r2TlB3i","tfD6s3e","uNPZt0q","yKn4vuO","ywXSzwqGBxu","z29PBMCGyxC","DwPhqxq","yLrMAxy","ELfdANy","x2vUzhbVAw4","wNDbC0S","C2DPza","ihrPBwvZ","zxjFAxnFywm","BKnJA2C","Dgv4Dc9WBge","zxjFCw9Zx2e","yM1MAhq","y2vvv3u","tfPfqvG","D3jPDgu","wvHYrNi","zw5JB2rPBMC","vxL0EeC","t1bftG","wM1lAvq","s21izKi","Eeztwgq","wNLntMC","z2v0","s1PHwLm","yNzNDhq","BNrbBMrvCgq","zMDeu0K","sefgqK4","B1zczuK","ugnYrMS","uezHCfu","z0n6wNq","yxv0BW","DhjPBq","EMn3qwq","zNjVBujPDhm","mhWZFdr8mxW","igXHCMDLCIa","shDZCvi","svnbDLy","AxnbCNjHEq","y29UBMvJDeu","wNz1Bfm","wMXUDMC","yMjhBeu","AgLuvfm","zvnZBfe","AwrI","qwHgwwu","zgjkDeW","zxjYtxnN","y1jpD3i","mNWXFdb8m3W","uMDIyLi","rK55BwC","DxLxr2u","EuzmEuq","wMHzzLa","EK9vCvm","ywXPzcb1CMW","DxPwwvy","sef0weq","q29Kzq","wNvrzeu","C3rVCMu","EMDOqvC","wMXpBvy","y2jZwNO","mZbgBNvktKO","rufytvG","DeLuu1m","zMLN","B25Uzwn0Aw4","Eezytxu","vwLAv0u","qvvlquW","ueHkBuO","zxq9DxrMltG","wezoCLm","mdaWma","zMLSDgvY","zgL3tNi","y011CMe","qNjPzgDL","yxrLq291BNq","AuXdDfG","zw50","BNL0tKe","vwDAB1a","BwPkEgy","y2XVC2u","ueLxwvu","whHYwMG","x3bPBMC","y0DMtue","rNjVBNrPzxi","D3HcCuC","BwL5uhK","quf1tvC","zNjVBNrPzxi","o2nOyxjZzxq","ywrKrxzLBNq","yM1eue8","rxLcyMW","C2vUza","tKDozeO","zMvY","zxjHDg9Y","yMLUyxj5","yLbYs1C","ExbfBwO","CMv0CNLdB3u","yxvYseS","ywnRpwzYB24","DgHyC0W","Cw9Zx18","AfbRvNm","rLbZCNe","tMT0qxi","BgXxEgy","x3vYBa","B3bLBG","BfrlshO","vMfAugy","uKXwveK","sLPmsuW","vwj2r20","v3zhDMu","vfb3Bhe","sxDStLK","AK9wyu0","zNjVBuj5Dgu","qKjtvem","whPewxi","uuTqzeW","BgvUz3rO","yw5Nzq","EuPNCg4","vgLTzw91Da","y3zsALy","zNDZxZeUmc4","DMzIuxu","rgLlwLm","B25fCNjVCG","tLLfwxq","DgfYz2v0","rLjvwfO","Dg9Y","EfzlzNO","AxnrB1nby2S","txfKqwe","wwrfr0O","BMCGzMfPBgu","Cgf5Bg9Hzeu","qwXXs3u","uvjVu3G","swfSD2K","y0rUs1m","z2LWANi","rfPAqNa","t1b4C20","y01gCvy","ywjVCNq","tNPRz3m","Aw9UvgLTzw8","Dw5RBM93BIa","x3bPBMDqB24","DxbKyxrLq3u","tg9NsurozxC","D3DQtLG","svLtrhG","zwnhzgK","Dvvhuvu","sgDAEMm","yvPOEuG","C2v0q3vYC28","CxPZrxC","zLjlr3C","EwjJCgi","AgvHzgvYCW","C29YDa","ufHUC3u","tM1nrxG","BxzgtLe","zxHTzgW","Euvvwg4","uejnCMG","y0DuCwm","zNP6DxO","BMrWB2LUDfq","sK9qEey","vfvkEMK","qLf3yw4","wvj3ufy","x2rLC3rYB3K","zxfYsgK","yw5ZzM9YBvq","Aw47y2HHCNm","svzwz1u","B255Axu","EMngBhe","ru5rA3G","vMDWtgW","yxbWBgLJyxq","AwXLtMfTzq","txHUB3y","CuPeEKy","vuHgvhm","uvfQuuC","weTMq04","yxnJCMLWDa","t1HdvMe","ywzL","zuXTC1u","yw5iruS","yMfSu2nVCgu","nxWY","BLnOwhG","t2nREKC","uNzhCe4","D21Qr1G","C2v0sxrLBq","B3rLDee","yxnZAwDU","C09JuMm","C1LjDgq","yxnL","B25dBg9Zzq","B25SAw5L","mNWZFdb8mxW","x2jPBMfYEvq","s0vIChe","x3bPBMDmB3m","q2rstvi","C2PYt1K","C0Lmwu4","zwnVBM5Ly3q","suvtx0vsuK8","uhHuu2q","Dhzkvuq","BwDovNa","B2LUDfjLywm","AMTzshO","s0XLwvG","BwfUDwfSihi","txrHAfG","s0Lmy3i","Ae1kBMO","wMvfB08","quTjs2W","qKHiBhK","swXjq0W","wxrxBg4","CMvHC29U","sKHOyxa","y09Wzw4","x2rYB3bhBg8","v0zvzLK","t1zAtxq","mhWXFdn8mNW","Cgf5Bg9Hza","x2nSzwfYugK","BMv3vMvYC2K","zuTXzNa","q1z4vLi","Ec1TC2CTy3u","wKXKEwG","sgvjBu0","D3zbz1K","ChjVDg90Exa","nxWXFdn8mG","vgzYrKu","v25YzxK","quznAw0","Cw5pthm","z2vtEw5J","BNrLCG","CePrz28","v3jOwLi","zNPZrNa","zM9YrwfJAa","x3DZ","AxLAwNa","wgXUwMS","zxf1ywXZ","CgfNzwHPzgu","t2fAsKm","ChLTrxi","BNDqu1y","C25Ivhm","qNv0Ceq","yxKSihrYEsa","Cu1tte0","v0rJBwK","EKLTqwK","CfzJrgC","De1HBMfNzxi","DhjHBNnHy3q","B3bLBIa","y1jLEMC","v3Pju0m","DhjPzxmGCMu","Cg9PBNrbBMq","AMvJDfn0B3i","seDNtha","vxDQBNy","ChrHBNK","t0DVC1a","ChjVy2vZCW","x2XPC3rLBMu","DgvmB2Djre4","C0Xf","ENLQA1y","DMrmzuW","yvfuCwq","zxjFywnRx20","v2vIu29JA2u","BwvY","x2LZsw5PDa","q1rzqw8","BNrfBMrWB2K","CgLUz1rPBwu","v0XYEfa","vgXvzMq","tgLrrxi","su5tvefova","mtm4mdG5ndrYuw9Qq3O","uhjtwLu","Ag13y2m","x2n1CNnVCKy","CwjTv2m","uenfBuS","Ee9oBxm","sKvgr0W","s0Tys2C","ywnRx2nVzgu","tK5jC2C","s0rLsM8","DfzSz28","CuDTALu","yxrHlcbKyxq","ywrKq291BNq","ywnRx2LK","Ewr0Auq","wMvywKG","rujHt1C","Bvz4AeK","y3jLyxrLrxi","CYbPBNn0yw4","y2LIv0i","ihn1y2nLC3m","EezdB08","rhHvuum","BwLUzW","z3bnuMK","z2v0q3vYCMu","AKLPufK","A2v0ignVBNm","C1nHvve","x21PBMLoyxy","EuzfzhC","r29izgC","x0rctMfTzq","uw9QA0e","D2LSBfjLy28","D29bt1K","v1vAsKS","ywDL","y0L5ug8","AfHouLm","yw1Lu3bHy2u","AwXK","Bwnby2u","v2vNDNa","qxPUDwC","uK9Rzw8","BgLZDgvUtMu","BxbMDwy","Bg9Nsurhzw4","z3f4seO","v0fiC1m","qLjzC0u","DeXyCfO","D0DsBvq","ser5u00","BgDVugW","vLfmrM4","uxHhqvK","s09tuvu","sevhsKm","vu9Zyue","zMPmB0G","t3HLsKm","zxjYB3i","CNj1t0u","EMXSs3e","CMvKDwnL","t1bftL9fuLi","DMTRww8","svzyB3a","t3vksuG","Ae9Wzw5fDMu","t3DWqwG","zMrrD0C","s1ftAwy","tvDWDLi","A1DdD2C","q3vZDg9Trxi","vK9Ty0u","Cu1Xvgq","mtm0mdKYouzZEvPcva","A1LPsgK","DxrMofDYAxq","y2X5CgW","uMvHzcbWyxm","svvPDuG","AefJA01LC3m","DxfVwLu","ANrzqM8","BMCGDxjSoIa","vuXiCui","B25szwnLAxy","wNrJBuC","BNvTyMvY","z2v0sxrLBq","wxfLA1G","ywLHDMq","s2npufa","DhzqDvu","DK1bvxK","mtC0otK3oxfmsej5rG","C3bSAwnL","y29UDgLUDwu","t0nsDK4","wMjyvMe","twDhBhm","uM1IAxq","zgLZCgf0y2G","DMvYC2LVBG","DwrLwwm","zcWGDw5RBM8","r05btuu","ELDyq3O","u0LhsMq","sLL5uwe","x3bYzwzPEa","EgvKt1G","u2Hsq1G","Dg9cExrLC0W","BLzxu08","vMzRr20","BMv4DcGPigm","CMTLCKDSB2i","y29Kzq","CMvWBgfJzui","yNL0zuXLBMC","CMvJB25Uzwm","CMvHzfvjBNq","DgHLBG","y21csfK","B3v0sw50zxi","qxnNz0m","Efrurw52","x3fVC0rc","y2HnyxHuCMK","x29WDgLVBNm","CMvZzxrdB3u","vMnNBwi","BgLUzw5V","tMPAEKm","zNjVBunOyxi","q2XJy1O","DvHjs3a","zw5HyMXLvhi","z2vjBMzVu3K","zMzLCG","ywnR","BLLxDMy","y2XVC2veqG","tg9JAW","z2fWy20","tePSC2G","DuznzgC","mhWZFdj8nxW","Dg9cExrLCW","s2rRwvK","uwDXDvK","B2nRzxq","rePWz1i","thfYAhu","DuXbwue","rvvjCfa","tvrjthq","Efzfr24","CMfTugfYyw0","zNbetLG","zMX1C2HfEha","u3j5DNC","zxLZru8","zM1WveO","vM5wBhG","DcbVzIbYyw4","t3bLBKv2zw4","DeLUDgvYy2u","CMvTB3zLrxy","zNvUy3rPB24","C3r0tui","uhjPBwfYEuS","CgXQq1m","rg5gqvO","Aw9U","tMfTzq","tg9Nsuq","wKr2Cgy","CMfUzg9T","D3jPDgvvAw4","BuHtswi","Aw5KzxHpzG","DvfxDwy","y3vYC29Y","swX5quC","v1f4BuO","zw50tgLZDgu","re9tEfK","zxH0zw5ZAw8","C2Pmvfu","AevYCM9Yrxy","y3jLyxrLt3a","v3jUreO","x3nLCuLK","B3bLCNr5tMe","zwvKzwq","BgLRDMS","zNjhzMq","ALDeAKe","vgfxCLy","B25tDg9Wsw0","AxjLza","rLjptLrjrvi","zxHWB3j0CW","qxfjEfm","wNrRquq","AgLNAa","t1P2DMy","x2rPC3bHDgm","wvLcC0y","zhDKr1e","EhztCu8","vMP0zxO","s1rrChi","B3vqs0m","A2v5","uMnIwNq","zv90Aw1LB3u","t3H4y3q","tfvmwuG","s1bTt0C","q2Dhs0K","DwvHvNu","ywnRDxbfBMq","DLDIt24","BenozxG","DfPfsey","t3Pvu3O","uMLJvu8","zw1LBNq","zsbHihn0CMK","CMfTzq","vu5Hs00","DwDkq0W","reDgBMK","sLvQC0u","rvbOtKi","wMjPtei","tgLZDgvUzxi","zMncAeK","C2jhqwW","C3vIyxjYyxK","B25LCNjVCG","y3vZDg9Tshq","DhjPzxm","vvrJAxa","y2PYyK0","vfjkr0G","z2v0qwXS","y2fSBa","re5LBu4","CIb0DhDjra","x1fVu01HBMe","rwPqD2i","r2zdD3q","zw5XDwv1zq","y2f0y2G","rMnoEw8","B01ZuvG","DhLWzq","jMPZy2fSBgi","AK9ftLq","B3jRig9MzMW","ChfqCK8","yKjuyu0","B3vUDa","vwXJDfy","rNrWr2i","rNvVDMy","x3DZsw5ZDge","rLrzq0y","r2DtvgC","y2HnyxHdB3u","qKnyAu0","s0nWtMK","tu1yC2S","wuLJwuK","tgHhtNm","s3HSEMK","BMnLq2XVC2u","rvjst1i","Aw5PDcbrB1m","Dhr3Awq","ugfgvKy","B25JBg9Zzq","sLjmr0W","AwXLx25HBwu","BwTTDKq","whnvshu","s21JEgW","uw9ntvm","DxLrq0u","rwTKt1a","x2zVCM1HDeu","sKv0ExC","y3vYCMvUDeu","EKjHAMm","AwDHDg9Yt24","C3rLBMvYCW","ywHvsMy","C2nYAxb0","zxH0ugf5Bg8","BKXUwKm","DMvYC2LVBMm","DgLTzw91DcW","BNPbzNO","vw5PBxbSzw0","mxW5Fdv8m3W","y0D6rK4","mJaYmty2muneyxztBG","suDQve4","zw5JB2rLrNi","ign1CNnVCIa","veffDeK","swDzA0O","B3LTDMi","AhfkBwK","EMzxzK8","zNjVBu51Bwi","ALPku1e","BwPMshe","ywrKt25L","yw5wuNy","Dxrjza","C0LQB2C","vgrxq1i","vKzfrfu","AvrlBxO","zhfirKC","lcbxzwjtB2m","vvjVs3i","Dev2zw50","EMjmq2C","y29UBMvJDa","tKfusvzfx0u","C0jf","uvHXzhC","FdH8mxW0Fdu","y2HHCKnVzgu","DNnIAgK","q29UzMLN","Ahr0Ca","DhDVCMTdAge","y3vYC29YlNm","r3LxyNa","Chv0","l3DZl3yY","vuHOAuq","y2LZBhe","zwL3yuK","uMjVDwy","C2fNzq","vMnHDey","v2rltwy","DfH3BK0","rLDRthO","wujcwMW","Cfjctuq","CM92AwrLige","zuvUsfq","Aw5KzxGGB3u","DK1AsM4","CvPrq3m","BLjhD3e","sLnptLa","B25ozxr3B3i","BwLZzq","wMPZu3m","Aufsywi","x2HHBMrSzvi","t05Ny2C","tej3Che","zhr0DNG","Bhm6ia","Bwzoqwm","wLbXBw4","B3jL","zgvMAw5Luhi","CfbLtMW","uw55t0y","DejUrNO","C2HPzNq","BgLRwei","ug9Hq3i","ihrVihjLDhi","ru1ywfG","uhzbEui","DcbSAw1PDa","rK1wExC","qNnrwgO","BgLUzq","DLLhuhC","Duzzy3K","Cwnlr0i","t2jKA24","mJDUtM1ysKC","DwL5EhG","Bfvjwgm","ANLjueq","zfDVCMTLCKC","zNjHBwvuExa","DgHHBIbSB2m","s1PyA00","zeTbvLm","sNr0r2i","Dg9mB3DLCKm","AgfZt3DUuhi","C1Pxwg0","Cgf5Bg9Hzfq","ANrXEuW","Aw5Iu0y","B3bLCNr5","x2nVBM5Ly3q","y0jPq1a","zMLSzw5HBwu","Dg9hzw5LCMe","CM92AwrLihy","vNvHvg8","thH4rNC","rNvZC3y","igfYCMf5yNu","Dgv4DfbHEwW","qMTwsfC","CMLLC0nVDw4","wLzdwKu","yvPIseW","yMLUyxj5vhK","rLHqsNa","BMPrAuK","DK93qM0","rKLmrv9ot1q","v1zUCMC","qK1Lzxy","vxPAr3a","yxbWBhK","qNvvtK0","uhj6Bxy","BLDXtum","u1nvq2W","C2vYuLO","y29SBM8","wKrAAM8","ywXty29Wzq","B3nLza","qwjmBve","wNjszMi","x29UtwvZC2e","CwD2veu","x2LUAxq","DvbwvMe","v1DruNi","B3bLBKrc","z2fwthe","AwzgzKC","B25TzxnZywC","Cgu6ia","u3PMwfi","CMvRCwe","rxDxzhG","rgvRy1u","uMvJB25Uzwm","C2v0zgi","vK1QqKG","re5HsgS","Ae1LC3nHz2u","uLLLtvK","ELPzr3G","ywDLrxzLBNq","uuj2txi","DwDKEhq","z0jxrw8","B25pCgvU","EhbRweq","Ef9MCM9UDgK","yxjYyxLIDwy","v2vPEgLUsLm","ywr2yw5Jzq","BMDLza","z2vrDwv1zuW","DLH6Bxi","BKXPBMu","r2nvEeq","DgLTzw91Da","C29wBNa","ALfjDuC","x2nSzwfYvgK","r2Hhrge","zvDnzvy","Axnby2TdBgu","BMrLEa","rK1VrNy","txfHueO","wM15rgK","zM9Yy2u","uNLrsui","rezovvO","tMrry0e","u2z0zeO","vgfN","EwHgzxi","x2nYzwf0zvm","Ec11C2uT","v2jou2K","zMzmAw5L","vunXB1C","qwXUDNq","CNfzAMq","B3nVy0S","DevKu0C","Eeffwve","twLZC2LUzYa","s0X3rMe","wKLqDuG","x2DLDeLUDgu","Bwf4uMv0CMK","qxfzEvi","yMrFzgLK","yNL0zxm","q01yBvi","A2v5CW","zu5os3a","C2vYDMvYvgK","Bw9jAMu","q09otKvdveK","u21jz2q","CMvHzhLtDge","AKvPwwG","x29UvgLTzw8","zv9ZDwnJzxm","ExzTrem","zgvJB2rLzey","Cvf2z1q","wefsvKK","yvrXB0u","u2TPCcbWyxm","BwLUAvbYB2C","z0zwqMS","z0rIs0m","BNruCMLLC0m","C2vYDMLJzq","x2n1CNnVCK0","ChDOu0q","Dufsz1a","B3jRzxjhBg8","DvPOrge","BwrIqKO","CMvJzwL2zwq","Aw5Lza","s21xA1C","yMfSrxzLBNq","ywnOzwq","sKTIt1K"];return Gn=function(){return r},Gn()}(()=>{let r=E,e={AhFYe:function(s,t){return s===t},LEBFN:r(1770),ahUJf:function(s,t){return s(t)},AFMim:function(s,t){return s+t},lUngS:function(s,t){return s*t},PLDCW:function(s,t){return s+t},SPckK:function(s,t,n){return s(t,n)},eiwaI:function(s,t){return s===t},Lmjjq:r(506),MaHZl:function(s,t){return s(t)},ybcpb:function(s,t){return s+t},fgDSI:r(749),UYhAa:"ffff",tCrhq:r(1573)+r(1573)+"0000000000000000",Uxmll:r(760),qeJtY:function(s,t){return s&t},bPrKW:function(s,t){return s(t)},aioel:function(s,t){return s&t},Iueac:function(s,t){return s<t},OgHxq:function(s,t){return s!==t},qivtW:function(s,t){return s-t},xQDgC:r(1234),TAEtI:function(s,t){return s-t},TMqcr:function(s,t){return s===t},ydtiD:function(s,t){return s<t},ZDZjo:r(538),cMura:function(s,t){return s!==t},ISAvV:function(s,t,n){return s(t,n)},ClccZ:function(s,t,n){return s(t,n)},DjtAO:function(s,t){return s(t)},UTcip:"uozaN",AsggC:function(s,t){return s>>>t},QXaEB:function(s,t,n){return s(t,n)},Vcgmb:function(s,t){return s(t)},HgZzc:function(s,t,n){return s(t,n)},ltOtK:r(1516)+r(1958)+r(451)+r(1221),ngkXD:r(1516)+r(1958)+r(451)+r(1923),URoKr:function(s,t,n){return s(t,n)},dRTot:function(s,t){return s(t)},sLlyu:r(1996)+r(1223)+"t",NmMEx:function(s,t,n){return s(t,n)},zrjrI:"ping_onc"+r(1534)+"s",SSUCl:r(554),zcwAd:function(s,t,n){return s(t,n)},fRKGw:function(s,t,n){return s(t,n)},qZQCs:function(s,t,n){return s(t,n)},AARhP:function(s,t){return s!==t},AGLKB:function(s,t){return s!==t},bCtfr:r(1087),RyQIB:function(s,t,n){return s(t,n)},AbLmQ:function(s){return s()},LGjVN:function(s,t){return s(t)},tZhIU:function(s,t){return s!==t},NjZzC:function(s,t,n){return s(t,n)},vHiAE:function(s,t){return s!==t},LUUgo:function(s,t,n){return s(t,n)},bNjAI:function(s,t,n){return s(t,n)},IYSDx:function(s,t,n){return s(t,n)},EjgLs:r(1308),Fussv:r(1718),JttGb:function(s,t){return s(t)},CqYOz:function(s,t){return s(t)},eWMeV:"QSggv",cBiCP:function(s,t){return s(t)},XzDYr:function(s,t){return s(t)},KPmOG:function(s,t){return s(t)},duCTL:function(s,t,n){return s(t,n)},WvGve:function(s,t){return s(t)},oITyF:function(s,t,n){return s(t,n)},rekqa:function(s,t){return s(t)},OCRvN:function(s,t,n){return s(t,n)},eEnHT:function(s,t,n){return s(t,n)},YIcYI:function(s,t){return s(t)},YdEGJ:r(1516)+"required"+r(451)+r(1991),ptany:function(s,t){return s===t},VnVlx:r(1516)+r(1958)+" field: "+r(1545),sjLTU:"Missing "+r(1958)+" field: "+r(493),UbvGm:function(s,t){return s(t)},JhfZy:function(s,t){return s+t},likvk:function(s,t){return s&t},UsWsm:function(s,t){return s(t)},PBMrh:function(s,t){return s+t},bBTaM:r(1312)+r(1988)+r(1461),ZhYfP:function(s,t){return s instanceof t},IcLLH:function(s,t){return s!==t},LKSge:function(s,t){return s===t},DOSxY:r(1394),ZeuSE:function(s,t){return s>>t},gCzZt:function(s,t){return s===t},CTYAo:function(s,t,n){return s(t,n)},BjiZs:r(495),YUqFb:r(827),RxpuH:function(s,t){return s>t},wFSXF:r(1540)+"t limit",JDQIM:function(s,t){return s>=t},luvEi:function(s,t){return s+t},JBVEf:r(1922),inbSF:function(s,t){return s>t},TJlrS:r(1084)+r(1393),qbmWc:function(s,t){return s+t},KuTAb:function(s,t){return s===t},KoqvD:function(s,t){return s===t},hCBgp:r(2021),Bhdjb:"MCHqP",BvicH:function(s,t,n){return s(t,n)},AKIKl:r(898),EfpIL:r(955),zfWfO:r(1627),EGJKB:function(s,t){return s>>t},ZPqmn:function(s,t){return s|t},Fxkgz:function(s,t){return s<t},Uwjnv:function(s,t){return s-t},GBaDJ:function(s,t){return s!==t},KdkYY:r(992),dttvx:r(1024),IbxUN:function(s,t){return s>=t},lLvTx:function(s,t){return s+t},hXNRS:function(s,t){return s<<t},KCpNi:function(s,t){return s&t},gFVBk:function(s,t){return s==t},jOVaM:function(s,t){return s>=t},uZhDa:function(s,t){return s+t},bMScO:function(s,t){return s+t},mjfHq:function(s,t){return s&t},rOgok:function(s,t){return s===t},vdLeL:"LxVjs",pwhSD:function(s,t){return s|t},DNemN:function(s,t){return s<<t},serRZ:function(s,t){return s&t},YxyFG:function(s,t){return s<<t},UEKAY:function(s,t){return s&t},gurcj:function(s,t){return s<t},NHMwG:function(s,t){return s<=t},oMsQX:function(s,t){return s===t},gDbKC:r(552),KmKjU:r(1846),VlqmA:function(s,t){return s==t},AbxNv:function(s,t){return s>=t},MMXsk:"HcVHx",burol:function(s,t){return s+t},KLwFa:function(s,t){return s+t},Alnvt:function(s,t){return s+t},BkVHW:function(s,t){return s!==t},aTqoE:function(s,t){return s&t},SIGJd:function(s,t){return s|t},xvSqO:function(s,t){return s|t},OXCVa:function(s,t){return s&t},eSslQ:function(s,t){return s<<t},jIevt:function(s,t){return s&t},sSaUQ:function(s,t){return s>t},FYjxv:function(s,t){return s+t},UHbIl:function(s,t){return s>>t},ZtcmG:function(s,t){return s<t},BXzKW:function(s,t){return s<t},OckzG:function(s,t){return s<<t},fzzuz:function(s,t){return s>>t},QwwVd:function(s,t){return s&t},fmpTJ:function(s,t){return s>>t},GkKor:function(s,t){return s|t},wwjNX:function(s,t){return s>>t},VaZPf:function(s,t){return s|t},CmNdE:function(s,t){return s&t},dqHFG:function(s,t){return s|t},VfATv:function(s,t,n){return s(t,n)},LCSvd:function(s,t,n){return s(t,n)},LQWdt:function(s,t){return s>>>t},QojkA:function(s,t){return s&t},FVaUT:function(s,t){return s>>>t},QKPdL:function(s,t){return s+t},LrHeB:function(s,t){return s&t},xedOX:r(1532),IutnY:r(1904),qMqTd:function(s,t){return s&t},ynOhE:function(s,t){return s&t},MBaNn:function(s,t){return s|t},Ytsna:function(s,t){return s&t},fdQwG:function(s,t){return s<t},AUzNz:function(s,t){return s>>>t},VOmcE:"2|10|6|1"+r(1313)+"4|7|0|1|8",EAXMX:function(s,t){return s<t},KEbpq:function(s,t){return s|t},VgpLl:function(s,t,n,o){return s(t,n,o)},pRBMD:function(s,t){return s&t},OVZMt:function(s,t){return s<<t},GNAME:function(s,t){return s|t},temPg:function(s,t){return s(t)},uFYcy:function(s,t){return s&t},KZXkM:function(s,t){return s<<t},uhWxu:function(s,t){return s===t},GoHdg:r(1276),nvfCa:function(s,t){return s(t)},pqPrO:function(s,t){return s&t},roDZc:function(s,t){return s&t},beIyX:function(s,t){return s(t)},VLFdU:function(s,t){return s&t},BFzcY:function(s,t){return s(t)},ncGDu:function(s,t){return s<<t},Ccsvs:function(s,t){return s&t},ZmKiT:function(s,t){return s&t},DxRcA:function(s,t){return s(t)},RgbbR:function(s,t){return s&t},SgbAk:function(s,t){return s(t)},Latqm:function(s,t){return s<<t},jmpUr:function(s,t){return s&t},Mxnov:function(s,t){return s>>>t},qgvTE:function(s,t){return s>>>t},ecGdi:function(s,t){return s>>>t},MAWJn:function(s,t){return s===t},Fuovf:function(s,t){return s<t},yNGPM:function(s,t){return s<t},jOENT:function(s,t){return s+t},KZaZS:function(s,t){return s!==t},lRYuv:function(s,t){return s|t},mcAce:function(s,t){return s|t},IPBmA:function(s,t){return s>>>t},IDGkk:function(s,t){return s|t},ZrqIo:function(s,t){return s&t},OuJIH:function(s,t){return s>>>t},PbQGM:function(s,t){return s!==t},OGosP:function(s,t){return s>>>t},njQiI:function(s,t){return s>>>t},UNaKM:function(s,t){return s>>>t},tBnFz:function(s,t){return s>>>t},LcUQV:function(s,t){return s!==t},SmIgd:function(s,t){return s|t},XKfCN:function(s,t){return s>>>t},dXdWu:function(s,t){return s+t},xyOTr:function(s,t){return s&t},NeVDQ:function(s,t){return s|t},UDEcN:"tHsLg",dKAVS:function(s,t){return s(t)},xVEGn:function(s,t){return s|t},JHXmJ:function(s,t){return s===t},aQTqd:function(s,t){return s===t},bSFOA:function(s,t){return s!==t},XxrZh:r(1109),hoCvF:r(1595),bCxUJ:function(s,t){return s|t},EaCpt:function(s,t){return s<<t},TGwxT:function(s,t){return s|t},zCZEX:function(s,t){return s<<t},tvJUD:function(s,t){return s<<t},aSsfg:function(s,t){return s<<t},zriqY:function(s,t){return s<<t},OisiX:function(s,t){return s<<t},vMZJn:function(s,t){return s|t},COrTt:function(s,t){return s<<t},cGfMA:function(s,t){return s|t},EWdXJ:function(s,t){return s<<t},QXqdw:function(s,t){return s>>>t},Jlztb:function(s,t){return s|t},anHEK:function(s,t){return s>>>t},EwWdx:function(s,t){return s>>>t},FWkLz:function(s,t){return s>>>t},snbTs:function(s,t){return s>=t},ZVCZE:function(s,t){return s<=t},WQxmJ:function(s,t){return s%t},vZzmU:function(s,t){return s/t},bvgtt:r(1478),ZuQdE:function(s,t){return s+t},UHFTs:function(s,t){return s>>>t},ZsoDd:function(s,t){return s>>>t},DzGFO:function(s,t){return s&t},JEtyw:function(s,t){return s&t},LvWEM:function(s,t){return s>>>t},Oxxct:function(s,t){return s>>>t},BbNmn:function(s,t){return s+t},QnyOF:function(s,t){return s+t},hCPJg:function(s,t){return s|t},xVKfz:function(s,t){return s<<t},xAEYQ:function(s,t){return s===t},JZLIL:function(s,t){return s===t},eNNKp:function(s,t){return s===t},EOhgE:function(s,t){return s+t},iARab:function(s,t){return s&t},wKqRs:function(s,t){return s>>>t},vIROr:function(s,t){return s>>>t},hZIIy:function(s,t){return s&t},KDeJo:function(s,t){return s&t},UHhiD:function(s,t){return s>>>t},cRezg:function(s,t){return s>>>t},OsXAQ:function(s,t){return s&t},OSAJQ:function(s,t){return s>>>t},UCqoW:function(s,t){return s>>>t},yFEdw:function(s,t){return s>>>t},DekcU:function(s,t){return s>>>t},ggruP:function(s,t){return s&t},TaWrV:r(1153)+r(1726),sYItd:"NATIVE_E"+r(1729),yFLyD:r(1067)+"OR",vOUtf:r(629)+r(907)+"R",FNymg:"CONNECTI"+r(470),ohYFP:r(502)+r(1286),jsswu:r(1498),hiBGb:r(1633),QRoSx:function(s,t){return s===t},VoQQP:"JNQUG",ecUZu:r(1995),aurHK:function(s,t){return s instanceof t},sdYKm:function(s,t){return s===t},YYBsF:r(1702),vWbOn:r(734),HLBYT:function(s,t){return s in t},VuaTo:function(s,t){return s!==t},YmGMk:r(1946),esQOE:r(1272),MZOjM:function(s,t){return s!==t},RLYOh:r(1186),NhKcE:"KVpDZ",YvpET:"CrTeo",zhfdg:r(1805),xQoPH:function(s,t){return s===t},ezxYI:function(s,t){return s==t},hPkVs:function(s,t){return s>t},QQjQG:function(s,t,n){return s(t,n)},eslmL:function(s,t,n){return s(t,n)},cGzFN:r(1620),LQoih:"going aw"+r(641)+r(1268)+"ine",thXsL:"btHfj",XlnZk:"LPRbG",IgYkJ:function(s,t){return s instanceof t},BWFhK:function(s,t){return s+t},xeWtT:"Unhandle"+r(492),sILYN:function(s,t){return s===t},TPwlq:function(s,t){return s===t},Lpeuy:r(1497),bgIyf:"BiCvk",LhGNs:r(1063),SftdJ:function(s,t){return s===t},AfhOp:r(1233),uARgP:function(s,t,n){return s(t,n)},urwVa:r(791),Rbouf:function(s,t,n){return s(t,n)},JgpXh:function(s,t,n){return s(t,n)},ROkeo:r(1596),OxeJC:function(s,t){return s===t},tsVlB:r(1176),TUJzi:r(1175),mgcXq:function(s){return s()},ZwAsK:r(1496),jCEPJ:r(1294),onyiu:function(s,t){return s||t},MFQfi:function(s,t){return s||t},IGjTN:function(s,t){return s!=t},lFxKo:r(1874)+"d",pJQgo:function(s,t){return s<=t},aZbHL:function(s,t){return s===t},NyxZa:function(s,t){return s&t},WrLzJ:function(s,t){return s+t},GsnVI:r(578)+r(886),WAHsS:function(s,t){return s+t},mPKtJ:function(s,t){return s+t},mtVCE:function(s,t){return s<<t},KEFfM:function(s,t){return s&t},AsxnC:function(s,t){return s&t},pljCS:function(s,t){return s|t},RsKme:function(s,t){return s&t},kJANx:function(s,t){return s|t},cjrbM:function(s,t){return s>>t},ZpAEQ:function(s,t){return s<t},OAefp:function(s,t){return s-t},EkdOP:function(s,t){return s>=t},WWQRr:function(s,t){return s<t},Ewkze:function(s,t){return s<<t},wGaze:function(s,t){return s&t},yHuAH:r(1302),XuaQW:r(1218),VcatF:function(s,t){return s-t},frGfd:function(s,t){return s|t},sZBxP:function(s,t){return s|t},IJBel:function(s,t){return s|t},ZvulS:function(s,t){return s<<t},DBobk:function(s,t){return s&t},rNnmZ:function(s,t){return s<<t},bTfiv:function(s,t){return s&t},UXNyZ:function(s,t){return s&t},Pkcke:function(s,t){return s>>t},PIUPs:function(s,t){return s|t},Wnrey:function(s,t){return s&t},QLyaQ:function(s,t){return s===t},FtCEk:r(454)+r(1700),JKbOY:function(s,t){return s|t},eoCsH:function(s,t){return s&t},YXrFr:function(s,t){return s&t},qJDzF:function(s,t){return s>>t},BBWOw:function(s,t){return s&t},PrSZU:function(s,t){return s>>t},lYNUc:function(s,t){return s+t},wmjGX:function(s,t){return s<<t},ZOAtd:function(s,t){return s>>t},sbtbE:function(s,t){return s|t},NYEYt:function(s,t){return s&t},FhAlw:function(s,t){return s-t},ZlOmV:function(s,t,n,o){return s(t,n,o)},uiyxx:r(1938),diwNr:function(s,t){return s instanceof t},ILWAb:r(873)+"ion/json",ledye:r(678)+r(867)+"et=utf-8",LJlsh:r(594),LBwpq:r(1661),HAFBN:r(1095),RcbZt:r(1902),kuadT:r(835)+r(923),eLmsU:function(s,t){return s+t},IHuZF:r(1306),aBbFR:r(1266)+r(783)+"tierJSONP",WBFcO:r(513),ebRhr:function(s,t){return s!==t},xFSXd:r(1905),CVxVR:function(s,t){return s!==t},PaALQ:"TUiKB",cZMIr:"gVZRJ",crYoh:r(717),PaFVF:function(s,t,n,o){return s(t,n,o)},znRDw:"WLWBU",McnAZ:function(s,t){return s>t},BLiWm:function(s,t){return s>t},XjuzV:r(1227),LvJMp:r(1744),aAluk:r(1802),pNqBD:r(571),aeyjM:r(1119),dbJtL:"tiwiO",KBEEq:"jaEVJ",Kmcxl:"ydKIo",mWYwN:r(1901),FcNyo:function(s,t){return s||t},vOwBm:function(s,t){return s||t},ZSQnL:function(s,t){return s||t},exmdl:function(s,t){return s>>t},KMMnb:function(s,t){return s>=t},rNSXk:r(1609),uUGQU:function(s,t){return s||t},fcBhI:function(s,t){return s||t},EjPwb:function(s,t,n){return s(t,n)},jJyCp:r(1659),WrnDJ:function(s,t){return s!=t},eKqfp:function(s,t){return s!=t},IwlNY:r(1287)+"DB failed",otetA:r(1742)+"id",jWDjA:function(s,t){return s(t)},tZEHF:"qNigg",vpfxf:r(1514),fzsFp:function(s,t){return s(t)},qtvyq:"GNhdt",rleSj:r(702),uKVxL:function(s,t){return s===t},ujGAt:r(490),vXzmr:r(1479)+r(679)+"ck",mgNVp:function(s,t,n,o){return s(t,n,o)},nShXx:r(1479)+r(676)+"k",lUIXc:r(1479)+r(985)+r(674),DVYrM:function(s,t){return s(t)},ByeYL:"SytpC",kbybx:function(s,t,n,o){return s(t,n,o)},WMrPe:"need_ack",Ucwyr:function(s,t,n,o){return s(t,n,o)},BMeev:"is_ack",KKXKg:function(s,t){return s!==t},wpyjN:r(1909),Nzkgs:r(1012),FRaKj:r(1005),MhwjM:function(s){return s()},qjluv:r(1552),kxfrL:function(s){return s()},wVNxy:function(s,t){return s(t)},qrlFr:r(873)+r(1559)+r(770)+"=utf-8",JOPxF:function(s,t,n,o){return s(t,n,o)},rNJpm:function(s){return s()},uduQh:function(s,t){return s+t},PoTrO:function(s,t){return s>>>t},BzqDw:function(s,t){return s+t},nnJnX:function(s,t){return s||t},yopLn:" > ",cmBHY:r(595)+r(1616)+"e",EyBbl:function(s,t){return s>=t},UOsaA:function(s,t){return s+t},tITSS:function(s,t){return s+t},IVVgU:function(s,t){return s>=t},DQkJZ:function(s,t){return s+t},zbLCg:function(s,t){return s&t},jEUcq:function(s,t){return s!==t},RLVTI:r(1760),duHUI:function(s,t){return s+t},JYyQa:function(s,t){return s<t},sjrOY:function(s,t){return s===t},Kxlzi:function(s,t){return s>>>t},ATavo:r(1869)+"2",aiavd:function(s,t,n,o){return s(t,n,o)},TIgDx:function(s,t){return s|t},HyZDN:function(s,t){return s<<t},miyPy:function(s,t){return s+t},HGUmx:function(s,t){return s+t},uFMdg:function(s,t){return s|t},rOoVd:function(s,t){return s|t},clypl:function(s,t){return s|t},FXPJp:function(s,t){return s<<t},hrlMc:function(s,t){return s(t)},ceUWu:r(657),cxnNy:r(755),twFyk:function(s,t){return s+t},uQXEF:function(s,t){return s&t},WFUfY:function(s,t){return s+t},MZbCo:function(s,t){return s&t},mhEPM:function(s,t){return s+t},apAUQ:function(s,t){return s&t},wGRmT:function(s,t){return s>>>t},rvfcb:function(s,t){return s&t},PHJmJ:function(s,t){return s+t},uZNbE:"sVfSc",PqMrx:"0|3|10|9"+r(1343)+"|6|7|2|11",CPJUx:function(s,t){return s>t},KLeYX:function(s,t,n,o){return s(t,n,o)},BFJap:function(s,t){return s>>>t},XFmqp:function(s,t){return s<t},JqYbS:function(s,t){return s<<t},IqsLg:function(s,t){return s||t},yvmDC:r(914)+r(906)+r(1894),zzTdq:function(s,t){return s(t)},qctwj:function(s,t){return s+t},TxyVK:function(s,t,n,o){return s(t,n,o)},zImAi:"service-name",KJLXl:r(1693),QgquY:function(s,t){return s(t)},bmfht:function(s,t){return s<t},NwOJD:function(s,t,n){return s(t,n)},gBYjZ:r(1436)+"_EXIST",wOasm:r(1882)+"ame",EqsJq:"allCurso"+r(587),oymvb:r(562),LaNkI:r(995),BRYsE:"CONTINUE",uaZAD:r(1605),MTILt:"bplWA",ShKjy:function(s,t){return s(t)},UFNsA:r(1793)+"r",BxZww:function(s,t){return s instanceof t},PPPCW:function(s,t){return s!=t},qcKGB:r(1069),iTKmz:function(s,t){return s===t},UrvZo:r(917),XXuQa:r(1161),BVUWV:r(1123),UfyhP:function(s,t,n,o){return s(t,n,o)},RstSf:r(1479)+r(2004),rtlfW:r(1479)+"er_ttl",IUiuH:"x-msg-qos",AlqKu:"x-msg-cu"+r(2027)+"e",QCyBX:function(s,t){return s(t)},GGUCs:function(s,t){return s>t},WUZJK:function(s){return s()},vYGPw:r(993),GswKZ:"BpcYv",jVVso:function(s){return s()},ButpD:function(s,t){return s===t},GcUxD:function(s,t){return s&&t},IlICL:function(s){return s()},DxUQC:function(s,t,n){return s(t,n)},rBYZt:function(s,t){return s!==t},Obdkn:function(s){return s()},qAGJG:function(s,t){return s<t},zGBBE:function(s,t){return s===t},OaZJC:function(s,t){return s!==t},NEoTZ:function(s,t){return s===t},KJfmw:r(1554),kdHCM:function(s){return s()},XIJGW:function(s){return s()},kbAqi:function(s,t,n){return s(t,n)},Tmejz:function(s,t){return s|t},cvRjV:function(s,t){return s<<t},ZyMNg:function(s,t){return s<<t},vKOTW:function(s,t){return s<<t},BsQXj:function(s,t){return s<<t},tvPuU:function(s,t){return s<<t},ujrIP:function(s,t){return s===t},uQWuf:r(1369),cMFqV:"always",BsBGc:function(s,t){return s!==t},NVoHR:r(1072),cCXhN:r(1150),gspkL:"NNFIB",fjLoH:function(s,t,n){return s(t,n)},Rmbit:function(s,t){return s!==t},wivBR:r(570),zOUqS:"pEoCy",vOSaD:function(s,t){return s!==t},lCNex:function(s,t,n){return s(t,n)},HAtXD:r(1468),KOSQU:"pbbp2",RMRQG:function(s,t){return s/t},ULHqB:function(s,t){return s==t},RvGpN:r(1838)+r(1422)+r(729),tSzzL:function(s,t){return s(t)},GWXaM:"please provide ws params"+r(1335)+r(1027)+r(1974)+"is undef"+r(1553),OPxsm:function(s,t){return s!==t},ZrRfb:r(1844),jZJSQ:r(1064),hiTTS:function(s,t,n){return s(t,n)},nCckg:r(1126)+"t",CCAxf:r(1982)+"ediately reconnect",rqYjd:function(s,t){return s!==t},sOcRc:function(s,t){return s!==t},uYIJh:function(s,t){return s(t)},mkmvD:function(s,t){return s(t)},YQsCH:r(1681),qQvgT:r(963),AZEGr:function(s,t){return s==t},NNIsg:"https:",zWXCz:"wss://",nzAfz:"ws://",ImUeg:r(1522),DZZBp:function(s,t){return s||t},TRJGH:r(1838)+"rovide b"+r(1738)+r(1766)+r(1257),DiKZS:function(s,t){return s==t},HOGAN:"web",ZtkAD:function(s,t){return s!==t},CANkd:r(1015),PXQzk:function(s,t){return s||t},RzsOD:function(s,t,n){return s(t,n)},xFCoO:function(s,t,n){return s(t,n)},JHhap:function(s,t){return s(t)},HoGaq:function(s,t){return s(t)},PatEG:r(994),IUTTU:r(1699),HwVau:r(1488),QoMMS:r(668)+r(961)+r(1126)+"ting ser"+r(2002),uzVYV:r(1310)+r(1857)+r(742)+"g",PkYOc:r(2024),FdUFM:r(2029)+"3",NGNdJ:r(899)+"4",nwPSV:function(s,t,n){return s(t,n)},osocK:r(1146),CHvqc:function(s,t){return s<t},HGgLp:r(653),yfSfE:r(1404),mdbBJ:function(s,t){return s+t},MeEcF:r(1674)+r(940),HmQGq:"close, w"+r(1018)+"ce not initialized",PvAyB:function(s,t){return s===t},MlQuV:r(1570)+r(501)+r(1903),KILcr:r(1093),iZnVI:function(s,t){return s instanceof t},NBUoC:function(s,t){return s(t)},PoaCr:function(s,t){return s||t},WpUjB:r(1838)+r(1364)+r(1762)+r(2006),ugJCL:function(s,t){return s(t)},uyQCE:r(525),TgrIQ:r(1849),RuLRs:"sent",vAZCq:function(s,t){return s<t},ZQGES:r(1261),OKgtd:function(s,t){return s!==t},QTeAC:r(929)+"4",dsWzC:function(s,t){return s|t},drjgf:function(s,t){return s|t},qryiu:function(s,t){return s<<t},GhGDa:function(s,t){return s<<t},nYWvf:function(s,t){return s!==t},FGlVI:r(965),mVxhI:function(s,t,n){return s(t,n)},KcOPP:r(1983),XFNrS:function(s,t){return s/t},BBSTC:function(s,t){return s!=t},ARDNC:"Window",gKKKy:function(s,t){return s===t},IaKOd:r(2018),EHHcm:function(s,t){return s!=t},VfkGm:function(s,t){return s===t},soVnp:"Dedicate"+r(1405)+r(1767)+"pe",zllKq:function(s,t){return s===t},llWxf:"SharedWo"+r(1122)+r(1448),vMAUy:r(1828)+r(1549)+r(885),WzISC:function(s,t){return s!=t},lfVaI:function(s,t){return s===t},MlsWG:r(1753)+r(785)};Te.r(Y),Te.d(Y,{FWS:()=>E0,CustomErrorEvent:()=>As,createCloseEvent:()=>ye,ReconnectEvent:()=>Es,createErrorEvent:()=>pe,decodedFrame:()=>ys,createOpenEvent:()=>Ns,CustomCloseEvent:()=>ks,createReconnectEvent:()=>gr,FrontierMessageEvent:()=>Ps,encodeFrame:()=>hr,createMessageEvent:()=>Ts,OpenEvent:()=>Ds,ErrorCode:()=>je,Event:()=>ut,MessageEvent:()=>Is});let i="";function a(s=""){let t=r;if(e.AhFYe(e[t(1979)],t(1081)))this[t(988)]=!0,this[t(1418)]();else{let o=""+Date[t(1648)](),x=i||(i=e.ahUJf(m,s)),l=Math[t(1184)]()[t(1654)](16)[t(633)](-6);return e[t(943)](e.AFMim(e.AFMim("02",o),x),l)}}function c(){let s=r;return e[s(943)](e[s(574)](1e4,Date.now()),Math.floor(1e4*Math.random()))}function u(s){let t=r;return e.PLDCW(e[t(1305)](Array,8).join("0"),e.SPckK(parseInt,s,10).toString(2))[t(633)](-8)}function f(s){let t=r;if(e[t(1355)](e.Lmjjq,"WKmTX"))this[t(1989)+t(1825)][t(1387)](),this[t(1989)+"Queue"].push(_0x1ba017);else return(e[t(1305)](Array,4)[t(1860)]("0")+e.SPckK(parseInt,s,2)[t(1654)](16))[t(633)](-4)}function h(s){let t=r,n=s[t(1821)](/\./).map(l=>u(l)),o=[];return o[0]=f(e[t(533)](n[0],n[1])),o[1]=e.MaHZl(f,e.ybcpb(n[2],n[3])),[e[t(696)],e[t(696)],"0000",e.fgDSI,e[t(696)],e.UYhAa,o[0],o[1]][t(1860)]("")}function m(s){let t=r,n=/(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}/[t(1973)](s),o=/(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))/[t(1973)](s);return n?h(s):o?e[t(1305)](_,s):e.tCrhq}function _(s){let t=r,n="",o=[],x=0,l=0,g=!0,p=e[t(696)];if(s[t(1187)]("::")>-1){let d=s[t(1821)]("::");for(let b=0;e.Iueac(b,d[t(805)]);b++){let k=d[b];if(k[t(1187)](":")>0){let T=k.split(":");g&&(x=T[t(805)]),l+=T.length;for(let R=0;e.Iueac(R,T.length);R++)if(e.OgHxq(4,T[R][t(805)])){let B=p[t(1785)+"g"](0,e[t(1566)](4,T[R][t(805)])),V=B[t(1957)](T[R]);o.push(V)}else o[t(577)](T[R]);g=!1}else if(e[t(1592)]!=="RicUO"){let T=this[t(1135)][t(1126)+t(1173)+t(1621)](_0x1c2302,_0x1b198a);this[t(1214)+t(592)+t(756)](e[t(1977)](_0x51c5c7,e[t(636)],{code:_0x1afb1d,reason:_0x22f5a3,wasClean:!0,willReconnect:T})),T&&this[t(1418)]()}else{if(e[t(1696)](4,k.length)){let T=p.substring(0,e[t(1566)](4,k.length)),R=T[t(1957)](k);o.push(R)}else o[t(577)](k);g&&(x+=1),l+=1,g=!1}}let w="";for(let b=0;e[t(611)](b,e[t(1319)](8,l));b++)w=w[t(1957)](p);for(let b=0;b<o.length;b++)e[t(598)](b,x)&&(n=n[t(1957)](w)),n=n[t(1957)](o[b]);return n}{let d=s[t(1821)](":");for(let w=0;e[t(1013)](w,d[t(805)]);w++)if(e[t(1447)]!==e[t(1447)])_0x3e7d47=e[t(1305)](_0x2b43fb,_0x436457),_0x2beaeb=e[t(604)](127,_0x650668),e[t(604)](128,_0x1f9271)&&(_0x419851=e[t(779)](_0x214c1b,_0x1c7cc1),_0x51aeb5|=e[t(1731)](127,_0x4d2a4b)<<7);else{let b=d[w];if(e[t(1696)](4,d[w][t(805)])){let k=p.substring(0,e.TAEtI(4,d[w][t(805)])),T=k[t(1957)](b);n=n[t(1957)](T)}else n=n[t(1957)](b)}return n}}function y(s,t){let n=r,o=s[n(1221)];e[n(752)](void 0,o)&&(e.ISAvV(J,t,10),e[n(1141)](Ce,t,o));let x=s[n(1923)];e.OgHxq(void 0,x)&&(J(t,18),Ce(t,x))}function v(s){let t=r,n={};e:for(;!e[t(488)](Re,s);)if(e[t(1251)]===e.UTcip){let o=z(s);switch(e[t(1131)](o,3)){case 0:break e;case 1:n.key=Se(s,e.bPrKW(z,s));break;case 2:n.value=e[t(1603)](Se,s,e[t(1137)](z,s));break;default:e[t(843)]($,s,e[t(604)](7,o))}}else this["maxLossC"+t(1271)]=_0x20809a,this[t(1737)]=0;if(e[t(1355)](void 0,n[t(1221)]))throw new Error(e[t(1581)]);if(n[t(1923)]===void 0)throw new Error(e[t(503)]);return n}function S(s){let t=r,n=Z();return e[t(1336)](A,s,n),e[t(1822)](j,n)}function A(s,t){let n=r,o={KEIQy:function(se,re){return se(re)},UehVP:e[n(1872)],GTgrU:function(se,re,Ee){return e[n(852)](se,re,Ee)},cJFPd:e[n(475)],nCtIX:e[n(1444)]},x=s[n(1991)];x!==void 0&&(e[n(852)](J,t,8),e[n(704)](Lt,t,x));let l=s[n(1182)];e.OgHxq(void 0,l)&&(J(t,16),e[n(847)](Lt,t,l));let g=s[n(1545)];g!==void 0&&(e[n(1368)](J,t,24),Lt(t,e[n(779)](oe,g)));let p=s[n(493)];p!==void 0&&(J(t,32),Lt(t,oe(p)));let d=s[n(849)];if(e[n(1879)](void 0,d))for(let se of d)if(e[n(589)](n(957),e[n(2034)])){e[n(1500)](J,t,42);let re=e[n(1450)](Z);y(se,re),e[n(852)](J,t,re.limit),e[n(709)](rn,t,re),e[n(1706)](P,re)}else{let re={uUbFZ:function(Ee,lt){return Ee(lt)},zUgVu:o.nCtIX,VTiBV:o[n(625)]};return new _0x4f4e98((Ee,lt)=>{let ce=n,ht={ouPKC:function(te,A0){return o[I(539)](te,A0)},KQSif:o[ce(625)]};this[ce(931)+"ngTimer"](),this[ce(836)+ce(447)+"Id"]=o[ce(540)](_0x30bf26,this[ce(763)][ce(459)](this),this._options[ce(1961)+"rval"]);let Mt=()=>{let te=ce;re[te(1886)](Ee,re[te(1711)]),this[te(486)]("ping_onc"+te(1534)+"s",Mt),this.off(re[te(1717)],nt)},nt=()=>{let te=ce;ht[te(1220)](lt,te(1488)),this.off(te(1996)+te(1534)+"s",Mt),this[te(486)](ht[te(1074)],nt)};this.on(o[ce(512)],Mt),this.on(o[ce(625)],nt),this[ce(763)]()})}let w=s[n(823)+n(597)];e[n(1752)](void 0,w)&&(J(t,50),e[n(1139)](Ce,t,w));let b=s[n(1414)+n(1880)];e[n(2007)](void 0,b)&&(e[n(507)](J,t,58),e.QXaEB(Ce,t,b));let k=s[n(930)];k!==void 0&&(e[n(1969)](J,t,66),J(t,k[n(805)]),e[n(847)](nn,t,k));let T=s.LogIDNew;e[n(2007)](void 0,T)&&(J(t,74),e[n(704)](Ce,t,T));let R=s["serverTi"+n(1023)];e.OgHxq(void 0,R)&&(e[n(840)](J,t,82),Ce(t,R));let B=s[n(649)];e.AARhP(void 0,B)&&(e[n(507)](J,t,90),Ce(t,B));let V=s[n(1406)+"e"];if(V!==void 0)if(e.EjgLs!==e[n(1425)])e[n(1368)](J,t,96),e.RyQIB(Lt,t,e[n(1410)](oe,V));else try{this[n(951)]&&this[n(951)][n(760)](_0x1774e6,_0x487fc3)}catch{}}function D(s){return e[r(1956)](L,e.CqYOz(U,s))}function L(s){let t=r;if(e[t(1493)]!==t(1673)){let n={};e:for(;!e[t(1419)](Re,s);){let o=z(s);switch(e[t(1131)](o,3)){case 0:break e;case 1:n[t(1991)]=e[t(847)](Be,s,!0);break;case 2:n[t(1182)]=e[t(852)](Be,s,!0);break;case 3:n[t(1545)]=e[t(803)](z,s);break;case 4:n[t(493)]=z(s);break;case 5:{let x=e[t(1410)](F,s);(n[t(849)]||(n[t(849)]=[]))[t(577)](e[t(1226)](v,s)),s.limit=x;break}case 6:n[t(823)+t(597)]=Se(s,e[t(1956)](z,s));break;case 7:n[t(1414)+"ype"]=e[t(547)](Se,s,e[t(797)](z,s));break;case 8:n[t(930)]=e[t(1586)](Nt,s,e[t(1463)](z,s));break;case 9:n[t(838)]=e[t(1103)](Se,s,e[t(488)](z,s));break;case 10:n[t(1527)+t(1023)]=e[t(1365)](Se,s,e[t(1226)](z,s));break;case 11:n.msgID=Se(s,e[t(779)](z,s));break;case 12:n[t(1406)+"e"]=e[t(1282)](z,s);break;default:e[t(843)]($,s,e[t(604)](7,o))}}if(e[t(598)](void 0,n[t(1991)]))throw new Error(e[t(821)]);if(e.ptany(void 0,n[t(1182)]))throw new Error(t(1516)+"required"+t(451)+t(1182));if(n[t(1545)]===void 0)throw new Error(e[t(1170)]);if(e[t(598)](void 0,n.method))throw new Error(e[t(1195)]);return n}else _0x27c7db(e[t(1444)]),this[t(486)](e[t(475)],_0x4b63f8),this[t(486)](e[t(1872)],_0x3afe26)}function F(s){let t=r,n=e[t(796)](z,s),o=s.limit;return s[t(1786)]=e[t(531)](s[t(1811)],n),o}function $(s,t){let n=r;switch(t){case 0:for(;e[n(1202)](128,e[n(1851)](fe,s)););break;case 2:e[n(1977)](ae,s,z(s));break;case 5:e.OCRvN(ae,s,4);break;case 1:e[n(840)](ae,s,8);break;default:throw new Error(e[n(856)](e[n(1270)],t))}}function oe(s){let t=r,n={slltM:function(o,x){return e[I(727)](o,x)},DNaHk:function(o,x){return o(x)},LxxFw:function(o,x){return e.IcLLH(o,x)}};if(e[t(1636)](e[t(1193)],e[t(1193)]))return s|=0,{low:s,high:e[t(1608)](s,31),unsigned:s>=0};{if(jwMFCB.slltM(_0x52769e,_0x19da11))return jwMFCB.DNaHk(_0x5e25ce,_0x53ec9a);if(_0x2fd5b4[t(2023)](_0xac5530))return _0x3790d0[t(692)](_0xf1f3ac);let o=jwMFCB[t(1469)](_0xdc3a2a,_0x359faa);return jwMFCB[t(1424)](o,_0x357619)&&(_0x5cf4b3[t(1928)](_0x25ee2b,o),_0x293ed3[t(1928)](o,_0x1db8cd)),o}}let ee=[];function Z(){let s=r,t=ee[s(2028)]();return t?(t[s(1811)]=t[s(1786)]=0,t):{bytes:new Uint8Array(64),offset:0,limit:0}}function P(s){ee.push(s)}function U(s){return{bytes:s,offset:0,limit:s.length}}function j(s){let t=r,n=s.bytes,o=s[t(1786)];return e.gCzZt(n[t(805)],o)?n:n[t(1247)](0,o)}function ae(s,t){let n=r;if(e.TMqcr(e[n(572)],e.YUqFb)){if(this["_endpoin"+n(966)]?.[n(1615)+n(1134)+"es"]()){let x=this[n(672)+n(966)]?.[n(1025)+n(990)+"nt"]();this[n(1214)+n(592)+n(756)](e[n(709)](_0x34ba02,e[n(636)],{code:1006,reason:"connect "+x+(n(1610)+n(1567)+n(971)+n(1556)),wasClean:!0}))}else{let x=this[n(1135)][n(1126)+"tInterce"+n(1621)](_0x1df255,_0x5da055);this[n(1214)+n(592)+n(756)](e[n(989)](_0x3d4e5b,e.Uxmll,{code:_0x10cfcf,reason:_0x50f5e0,wasClean:!0,willReconnect:x})),x&&this[n(1418)]()}return}else{if(e[n(1976)](s.offset+t,s[n(1786)]))throw new Error(e[n(1990)]);s[n(1811)]+=t}}function Re(s){let t=r;return e[t(2e3)](s[t(1811)],s[t(1786)])}function we(s,t){let n=r,o=s[n(1523)],x=s[n(1811)],l=s[n(1786)],g=e[n(439)](x,t);if(e[n(1976)](g,o[n(805)]))if(e[n(701)](e.JBVEf,e.JBVEf)){let p=new Uint8Array(e[n(574)](2,g));p[n(1928)](o),s[n(1523)]=p}else return this._socket[n(1531)+"te"];return s.offset=g,e[n(1416)](g,l)&&(s[n(1786)]=g),x}function Qe(s,t){let n=r,o=s[n(1811)];if(e[n(439)](o,t)>s.limit)throw new Error(e[n(1560)]);return s[n(1811)]+=t,o}function Nt(s,t){let n=r,o=Qe(s,t);return s[n(1523)][n(1247)](o,e[n(1e3)](o,t))}function nn(s,t){let n=r,o={EeLUO:function(x,l){return x<l},YCPUX:function(x,l){return e[I(1914)](x,l)},TQius:function(x,l){return e[I(442)](x,l)}};if(e[n(718)](e[n(1721)],e[n(1678)])){let x=0,l=0;for(let g=0;o[n(1782)](g,_0x2b9733[n(805)]);++g)l=_0x3bb7b1[n(1344)+"At"](g),o[n(1782)](l,128)?x+=1:l<2048?x+=2:o[n(630)](64512&l,55296)&&o.TQius(64512&_0x5294f4.charCodeAt(g+1),56320)?(++g,x+=4):x+=3;return x}else{let x=e.BvicH(we,s,t[n(805)]);s.bytes[n(1928)](t,x)}}function Se(s,t){let n=r,o={ENROx:e[n(919)],dUUvG:e.EfpIL,KTQpr:e[n(1323)],kWCwg:function(w,b){return w|b},Zlnvg:function(w,b){return e[n(1941)](w,b)},IgJSv:function(w,b){return w&b},BVTkX:function(w,b){return e[n(1381)](w,b)},zzxix:function(w,b){return e[n(1202)](w,b)},WWliB:function(w,b){return e.Fxkgz(w,b)},BCXiM:function(w,b){return e.AARhP(w,b)},uLAYA:function(w,b){return e[n(975)](w,b)}},x=e.bNjAI(Qe,s,t),l=String[n(1140)+n(732)],g=s.bytes,p="\uFFFD",d="";for(let w=0;w<t;w++)if(e[n(544)](e[n(1155)],e[n(1378)])){let b=g[e[n(943)](w,x)],k,T,R,B;if(e[n(718)](e[n(1731)](128,b),0))d+=l(b);else if((224&b)===192)e.IbxUN(e[n(531)](w,1),t)?d+=p:(k=g[e[n(1814)](w,x)+1],e[n(1202)](192,k)!==128?d+=p:(B=e[n(1039)](e[n(1280)](31,b),6)|e.aioel(63,k),B<128?d+=p:(d+=e.Vcgmb(l,B),w++)));else if(e[n(1542)](240&b,224))e[n(800)](e[n(1550)](w,2),t)?d+=p:(k=g[e[n(462)](w+x,1)],T=g[e[n(462)](w,x)+2],e.OgHxq(e[n(1326)](k|T<<8,49344),32896)?d+=p:e.rOgok(e[n(983)],"JDvGA")?(this[n(626)+"er"]&&_0x1e2305["removeEv"+n(1192)+n(1864)](o[n(1643)],this["_handleO"+n(1486)]),this._isBrowser&&_0x17b5aa[n(1174)+"entListe"+n(1864)](n(570),this["_handleO"+n(1509)]),this[n(626)+"er"]&&_0x15178e[n(1174)+n(1192)+n(1864)](o[n(1649)],this._handlePageHide),this[n(626)+"er"]&&_0x44b983["removeEv"+n(1192)+n(1864)](o[n(1219)],this[n(1984)+"ageShow"])):(B=e[n(1547)](e[n(1256)](e[n(1445)](15,b),12),e.YxyFG(e[n(1689)](63,k),6))|63&T,e[n(1748)](B,2048)||e[n(800)](B,55296)&&e[n(646)](B,57343)?d+=p:e[n(1264)](e[n(1543)],e[n(1931)])?(_0x1a1714[_0x3adf7f++]=o[n(1076)](o[n(713)](_0x644869,12),224),_0x4e1f92[_0x38b7cf++]=o.kWCwg(o.IgJSv(o[n(713)](_0x214be9,6),63),128),_0x480188[_0x22a304++]=o[n(1756)](o[n(1835)](63,_0x3b003a),128)):(d+=e[n(1282)](l,B),w+=2)));else if(e.VlqmA(e[n(604)](248,b),240))if(e[n(1668)](e.PBMrh(w,3),t))d+=p;else if(e[n(701)](n(1966),e[n(1281)])){let V=_0x283209[n(1821)](":");_0x2ed17f&&(_0x50ebc6=V.length),_0x3da1ec+=V.length;for(let se=0;eAFzqK[n(1682)](se,V[n(805)]);se++)if(eAFzqK[n(1279)](4,V[se][n(805)])){let re=_0x1fde96[n(1785)+"g"](0,eAFzqK[n(1160)](4,V[se].length)),Ee=re[n(1957)](V[se]);_0x33dacd[n(577)](Ee)}else _0x37118f[n(577)](V[se]);_0x5163ae=!1}else k=g[e[n(567)](e[n(1517)](w,x),1)],T=g[e[n(1511)](e.ybcpb(w,x),2)],R=g[e[n(848)](w+x,3)],e[n(1428)](e[n(1539)](e.SIGJd(e[n(1217)](k,T<<8),R<<16),12632256),8421504)?d+=p:(B=e[n(1217)](e.pwhSD(e[n(1547)](e[n(1862)](e[n(881)](7,b),18),e.aioel(63,k)<<12),e[n(716)](e[n(1594)](63,T),6)),e.likvk(63,R)),e[n(1013)](B,65536)||e[n(1028)](B,1114111)?d+=p:(B-=65536,d+=l(e[n(1933)](e[n(467)](B,10),55296),(1023&B)+56320),w+=3));else d+=p}else this.off(_0x1e698c,_0x46abb0);return d}function Ce(s,t){let n=r,o=t[n(805)],x=0;for(let p=0;p<o;p++){let d=t[n(1344)+"At"](p);e[n(1668)](d,55296)&&e.NHMwG(d,56319)&&e.Fxkgz(p+1,o)&&(d=e[n(1566)](e[n(1256)](d,10)+t.charCodeAt(++p),56613888)),x+=e[n(1013)](d,128)?1:e[n(618)](d,2048)?2:d<65536?3:4}J(s,x);let l=e.IYSDx(we,s,x),g=s[n(1523)];for(let p=0;e[n(1092)](p,o);p++){let d=t[n(1344)+"At"](p);e.IbxUN(d,55296)&&e[n(646)](d,56319)&&e[n(1791)](e[n(1550)](p,1),o)&&(d=e[n(888)](d,10)+t[n(1344)+"At"](++p)-56613888),e.ydtiD(d,128)?g[l++]=d:(e[n(1748)](d,2048)?g[l++]=e[n(1381)](e[n(858)](d,6)&31,192):(e[n(1013)](d,65536)?g[l++]=e[n(581)](e[n(1169)](d,12),15)|224:(g[l++]=e[n(1547)](e[n(1326)](e[n(858)](d,18),7),240),g[l++]=e[n(663)](e.OXCVa(e.wwjNX(d,12),63),128)),g[l++]=e[n(793)](e.CmNdE(e[n(467)](d,6),63),128)),g[l++]=e[n(1334)](e[n(1539)](63,d),128))}}function rn(s,t){let n=r,o=e.VfATv(we,s,t[n(1786)]),x=s.bytes,l=t[n(1523)];for(let g=0,p=t[n(1786)];e[n(1748)](g,p);g++)x[g+o]=l[g]}function fe(s){return s[r(1523)][e.LCSvd(Qe,s,1)]}function sn(s,t){let n=r,o={UiZWE:function(x,l){return e.LQWdt(x,l)},MgGls:function(x,l){return x+l},aNbhe:function(x,l){return e[I(1445)](x,l)},XVXSc:function(x,l){return x&l},hwiij:function(x,l){return e[I(1033)](x,l)},IlyAG:function(x,l){return e[I(943)](x,l)},TdWCR:function(x,l){return e.FVaUT(x,l)},vsbhi:function(x,l){return e[I(804)](x,l)},qnOLs:function(x,l){return e.LrHeB(x,l)}};if(e[n(1116)]!==e[n(1685)]){let x=e[n(1500)](we,s,1);s.bytes[x]=t}else{let x=_0x4513c7.low,l=_0x217061.high;return _0x4adc33[_0xf9027]=o[n(744)](l,24),_0x536dd3[o[n(1105)](_0x3060d9,1)]=o[n(1972)](l>>>16,255),_0x2f56c6[o.MgGls(_0x3f8d90,2)]=o[n(1582)](l>>>8,255),_0x1f7918[_0x3c20c4+3]=o[n(652)](255,l),_0x183089[o[n(1105)](_0x3dfae3,4)]=x>>>24,_0x635e70[o[n(1190)](_0x130932,5)]=o[n(1582)](o[n(1331)](x,16),255),_0x355ac0[o[n(1345)](_0x3079ac,6)]=o[n(1972)](o.UiZWE(x,8),255),_0x471025[o[n(1105)](_0x6e7670,7)]=o[n(944)](255,x),_0x80912d+=8,_0xb026a2}}function z(s){let t=r,n=0,o=0,x;do x=e[t(1410)](fe,s),e[t(1748)](n,32)&&(o|=e[t(1079)](127,x)<<n),n+=7;while(e[t(1955)](128,x));return o}function J(s,t){let n=r;for(t>>>=0;e[n(800)](t,128);)sn(s,e[n(1562)](e[n(1780)](127,t),128)),t>>>=7;e[n(1695)](sn,s,t)}function Be(s,t){let n=r,o={XKlPW:e[n(1078)],QxGAY:function(d,w){return e[n(739)](d,w)},TMVRD:function(d,w){return e[n(901)](d,w)},gaVLq:function(d,w){return e[n(1028)](d,w)},DABjq:function(d,w,b,k){return e[n(872)](d,w,b,k)},KVcKl:function(d,w){return d>>>w},GGVxd:function(d,w){return e[n(581)](d,w)},eysEO:function(d,w){return e.SIGJd(d,w)},jkYHz:function(d,w){return e[n(1363)](d,w)},gxCfO:function(d,w){return e[n(1547)](d,w)},yEUXn:function(d,w){return e[n(618)](d,w)},cislq:function(d,w){return e[n(928)](d,w)},jIiPY:function(d,w){return e[n(581)](d,w)},BxdeA:function(d,w){return e.FVaUT(d,w)},ZDvpf:function(d,w){return d|w},CdRMR:function(d,w){return d|w},IwhWD:function(d,w){return e[n(1111)](d,w)}},x=0,l=0,g=0,p;if(p=e[n(648)](fe,s),x=e[n(1689)](127,p),e.uFYcy(128,p)&&(p=fe(s),x|=e[n(1408)](127&p,7),128&p))if(e.ptany(n(1088),n(1088))){if(p=e[n(1137)](fe,s),x|=e[n(1256)](e[n(581)](127,p),14),128&p)if(e[n(1638)](n(1276),e[n(1031)]))p=e[n(1949)](fe,s),x|=e.QwwVd(127,p)<<21,e[n(1269)](128,p)&&(p=e[n(1226)](fe,s),l=e.roDZc(127,p),128&p&&(p=e.beIyX(fe,s),l|=e[n(1862)](e[n(581)](127,p),7),e[n(1773)](128,p)&&(p=e[n(1851)](fe,s),l|=(127&p)<<14,e[n(1539)](128,p)&&(p=e[n(519)](fe,s),l|=e[n(1932)](e[n(1810)](127,p),21),e[n(688)](128,p)&&(p=e[n(548)](fe,s),g=127&p,e[n(723)](128,p)&&(p=e[n(1895)](fe,s),g|=e[n(1578)](e.jmpUr(127,p),7)))))));else{let d=0,w=_0x51d385,b=e[n(1933)](_0x6cb86,4);for(;e[n(1073)](w,b);){let{value:k,offset:T}=_0x436e5e(_0x2c5f76,w);w=T,d=e[n(494)](e[n(716)](d,8),0),d+=k}return{value:d,offset:b}}}else{let d=o.XKlPW[n(1821)]("|"),w=0;for(;;){switch(d[w++]){case"0":if(o[n(1057)](_0x45010d[_0x4dc774++],128))return{value:_0x48f308?_0x5c1255:o[n(1788)](0,_0x4aeb76),offset:_0x7bce97};continue;case"1":if(o[n(1458)](_0x4cbd24+=5,_0x1b30fd[n(805)]))throw _0x1c4d57=_0x40c7dc.length,o[n(1572)](_0x288fab,_0x4b2998,10,_0x50b625[n(805)]);continue;case"2":_0xdddb57=o[n(1950)](o[n(612)](127,_0x33d22f[_0x5ecbe9]),0);continue;case"3":_0x2d0cde=o[n(1168)](_0x22ef17,o[n(912)](127,_0x57187c[_0x3b62f3])<<21)>>>0;continue;case"4":if(_0x45a860[_0x2d994a++]<128)return{value:_0x3fa501?_0x14de6c:o[n(1675)](0,_0x242b9f),offset:_0x20752e};continue;case"5":if(o[n(855)](_0x5ba032[_0x2090c9++],128))return{value:_0x2ecf36?_0x3d9c42:0|_0x57d540,offset:_0x136591};continue;case"6":_0x491ecb=o[n(1168)](_0x7adcea,o.cislq(o[n(1026)](127,_0x1484f4[_0x293f14]),7))>>>0;continue;case"7":_0x313e60=o.BxdeA(o[n(1183)](_0x2d7802,o[n(1354)](o.jkYHz(15,_0x3af09c[_0x32a05e]),28)),0);continue;case"8":return{value:_0x46d4a9?_0x23cc45:o[n(903)](0,_0x272d1a),offset:_0x19c181};case"9":_0x1d2105=o[n(1950)](o.IwhWD(_0x5a532f,(127&_0x24c993[_0x59addd])<<14),0);continue;case"10":if(o[n(1057)](_0x117785[_0x291074++],128))return{value:_0x599333?_0x2a0493:o[n(1183)](0,_0x3096a5),offset:_0x1bcadf};continue;case"11":if(o.yEUXn(_0x43d0a3[_0x14fc7f++],128))return{value:_0x5410bb?_0x4ffc04:o.ZDvpf(0,_0x3d8cc2),offset:_0x22cfa4};continue}break}}return{low:x|l<<28,high:l>>>4|g<<24,unsigned:t}}function Lt(s,t){let n=r,o=e[n(875)](t[n(463)],0),x=e.pwhSD(e[n(1453)](t[n(463)],28),e[n(1039)](t[n(1212)],4))>>>0,l=e[n(841)](t[n(1212)],24),g=e.KoqvD(0,l)?e[n(1749)](0,x)?e[n(1274)](o,16384)?o<128?1:2:o<2097152?3:4:e.yNGPM(x,16384)?e[n(1748)](x,128)?5:6:e.Fuovf(x,2097152)?7:8:e[n(611)](l,128)?9:10,p=e[n(1139)](we,s,g),d=s.bytes;switch(g){case 10:d[e[n(1267)](p,9)]=e.Ytsna(l>>>7,1);case 9:d[p+8]=e.KZaZS(9,g)?e[n(2011)](128,l):e.CmNdE(127,l);case 8:d[p+7]=e[n(2007)](8,g)?e[n(1042)](e[n(841)](x,21),128):e.IPBmA(x,21)&127;case 7:d[e[n(531)](p,6)]=g!==7?e[n(521)](e[n(494)](x,14),128):e[n(510)](e[n(1070)](x,14),127);case 6:d[p+5]=e[n(1690)](6,g)?e[n(977)](x,7)|128:e[n(1434)](x,7)&127;case 5:d[e.qbmWc(p,4)]=g!==5?128|x:e.Ccsvs(127,x);case 4:d[e[n(533)](p,3)]=g!==4?e.VaZPf(e[n(1238)](o,21),128):e[n(1386)](o,21)&127;case 3:d[e[n(804)](p,2)]=e.LcUQV(3,g)?e[n(1530)](o>>>14,128):e[n(879)](o,14)&127;case 2:d[e[n(468)](p,1)]=e[n(693)](2,g)?e[n(1042)](o>>>7,128):e.xyOTr(e[n(494)](o,7),127);case 1:d[p]=e.LcUQV(1,g)?e[n(530)](128,o):127&o}}function ys(s){return D(s)}function hr(s){let t=r,n={opfSR:function(o,x,l){return o(x,l)}};if(e[t(1690)](e.UDEcN,"tHsLg"))n.opfSR(_0x3ff1af,_0x940c4a,this["_getInte"+t(1997)+"e"](_0x194363));else return e[t(1409)](S,s)}let bs=65536,Ma=e[r(1097)],xt=e[r(574)](bs,bs),vs=e[r(574)](xt,xt),Ss=e[r(748)](vs,2),He=String.prototype[r(1344)+"At"];class q{constructor(t,n,o){let x=r;this[x(1920)]=!0,this[x(463)]=e.xVEGn(0,t),this[x(1212)]=e[x(530)](0,n),this[x(514)]=!!o}static[r(1920)](t){let n=r,o={idHWp:n(1208)+">"};if(e[n(637)](n(1501),"DFNUZ"))return t&&e[n(984)](!0,t[n(1920)]);this[n(1135)].debug&&_0x30ba08[n(1892)][n(1440)](_0x2dcef5,[o.idHWp,..._0x9bf3ac])}static[r(705)](t,n,o){let x=r,l={jtqyL:function(g,p,d){return e[I(709)](g,p,d)},swPUD:function(g,p){return e.temPg(g,p)}};if(e.bSFOA(e[x(762)],e[x(1670)]))return new q(t,n,o);ybvkIz[x(1415)](_0x3eb33e,_0x55b925,96),ybvkIz[x(1415)](_0x3e4e68,_0x462123,ybvkIz[x(1746)](_0x5d6763,_0x36e409))}static fromBytes(t,n,o){let x=r;return o?q[x(801)+x(981)](t,n):q[x(801)+x(1341)](t,n)}static[r(801)+r(981)](t,n){let o=r;return new q(e[o(666)](e[o(1163)](t[0],t[1]<<8),e.EaCpt(t[2],16))|t[3]<<24,e.xVEGn(e[o(1694)](t[4]|e[o(1924)](t[5],8),e[o(909)](t[6],16)),e.aSsfg(t[7],24)),n)}static[r(801)+r(1341)](t,n){let o=r;return new q(e.KEbpq(e[o(1924)](t[4],24)|e.zriqY(t[5],16)|e.OisiX(t[6],8),t[7]),e[o(1694)](e[o(1367)](e[o(1530)](e[o(1641)](t[0],24),t[1]<<16),e.COrTt(t[2],8)),t[3]),n)}static[r(1937)](t){let n=r;return e[n(976)](t,Ma)?Cs:new q((e.pwhSD(e.cGfMA(He.call(t,0),He.call(t,1)<<8),e[n(1812)](He[n(1255)](t,2),16))|He[n(1255)](t,3)<<24)>>>0,e.QXqdw(e[n(1217)](e.Jlztb(He[n(1255)](t,4),He[n(1255)](t,5)<<8)|e.Latqm(He[n(1255)](t,6),16),He[n(1255)](t,7)<<24),0),!0)}[r(576)](){let t=r;return String["fromChar"+t(732)](e[t(1398)](255,this.low),e.ZrqIo(e[t(884)](this[t(463)],8),255),this[t(463)]>>>16&255,this.low>>>24,e[t(1033)](255,this[t(1212)]),e.QojkA(e[t(1464)](this[t(1212)],8),255),e[t(1361)](this[t(1212)],16)&255,e[t(1361)](this[t(1212)],24))}static[r(1324)+"er"](t,n=!0){let o=r;if(isNaN(t))return n?Oa:Cs;if(n){if(e[o(959)](t,vs))return qa}else{if(e[o(1430)](t,-Ss))return Fa;if(e[o(800)](e[o(856)](t,1),Ss))return za}return q[o(705)](e[o(1191)](t,xt)|0,e[o(1113)](e.vZzmU(t,xt),0),n)}[r(1833)](){let t=r;if(e[t(1879)](e[t(694)],e[t(694)]))_0x4bfab1[t(1672)][t(1936)+t(1041)](_0x4f250d);else return this[t(514)]?e[t(733)](e[t(574)](this[t(1212)]>>>0,xt),this[t(463)]>>>0):e.bMScO(e[t(574)](this[t(1212)],xt),e[t(877)](this[t(463)],0))}[r(1772)](){let t=r;return e[t(598)](0,this.high)&&this[t(463)]===0}add(t){let n=r;q[n(1920)](t)||(t=q[n(1324)+"er"](t));let o=e.ZsoDd(this.high,16),x=e.DzGFO(65535,this[n(1212)]),l=e[n(875)](this[n(463)],16),g=e[n(1300)](65535,this[n(463)]),p=e[n(561)](t[n(1212)],16),d=65535&t[n(1212)],w=e[n(1224)](t[n(463)],16),b=e[n(1955)](65535,t.low),k=0,T=0,R=0,B=0;return B+=e[n(617)](g,b),R+=e[n(1224)](B,16),B&=65535,R+=e[n(1385)](l,w),T+=e[n(1238)](R,16),R&=65535,T+=x+d,k+=e.ecGdi(T,16),T&=65535,k+=e[n(1e3)](o,p),k&=65535,q[n(705)](e[n(1042)](R<<16,B),e[n(1656)](e[n(818)](k,16),T),this[n(514)])}[r(954)](t){let n=r;return q[n(1920)](t)||(t=q.fromNumber(t)),this[n(514)]!==t.unsigned&&e.TMqcr(this[n(1212)]>>>31,1)&&e[n(1264)](e[n(879)](t[n(1212)],31),1)?!1:e[n(1515)](this[n(1212)],t[n(1212)])&&e[n(701)](this[n(463)],t[n(463)])}[r(1327)](){let t=r;return e[t(795)](-1,this[t(463)])&&e[t(976)](-1,this.high)?q[t(705)](0,0,this[t(514)]):e[t(1526)](-1,this[t(463)])?q[t(705)](0,e.EOhgE(this[t(1212)],1),this[t(514)]):q[t(705)](e[t(943)](this[t(463)],1),this[t(1212)],this[t(514)])}[r(1154)](t){return t?this[r(1118)+"E"]():this.toBytesBE()}toBytesLE(){let t=r,n=this.high,o=this[t(463)];return[e[t(1445)](255,o),e[t(1374)](e[t(1919)](o,8),255),e.vIROr(o,16)&255,o>>>24,e[t(650)](255,n),e[t(1007)](e[t(1342)](n,8),255),e[t(581)](e[t(1353)](n,16),255),e[t(969)](n,24)]}[r(1777)+"E"](){let t=r,n=this[t(1212)],o=this[t(463)];return[e[t(875)](n,24),e[t(443)](e.OSAJQ(n,16),255),e[t(1510)](n,8)&255,255&n,e[t(1238)](o,24),e[t(1030)](o,16)&255,e[t(1465)](o,8)&255,e[t(2032)](255,o)]}}let Cs=new q(0,0,!1),Oa=new q(0,0,!0),za=q[r(705)](-1,2147483647,!1),qa=q[r(705)](-1,-1,!0),Fa=q[r(705)](0,-2147483648,!1);var je=(function(s){let t=r,n=e[t(1205)][t(1821)]("|"),o=0;for(;;){switch(n[o++]){case"0":s[s[e[t(895)]]=5001]=t(1340)+t(1729);continue;case"1":s[s[e[t(726)]]=5005]=e[t(726)];continue;case"2":s[s[e[t(482)]]=5003]=t(629)+t(907)+"R";continue;case"3":s[s[e[t(724)]]=5002]="CONNECTI"+t(470);continue;case"4":return s;case"5":s[s[e[t(1764)]]=5004]=e[t(1764)];continue}break}})({});class ut{constructor(t){let n=r;this[n(1265)]=t,this[n(815)]=null}}class Es extends ut{constructor(t,n){let o=r;if(e[o(527)]!==e[o(1602)])super(t),this.message=n&&n[o(1905)]||null;else{let x=_0x1f5b71.substring(0,4-_0x43dade[_0x4d20fc][o(805)]),l=x.concat(_0x5ef7c0[_0x45209a]);_0x529d9c[o(577)](l)}}}class As extends ut{constructor(t,n){let o=r,x=(o(722)+"4|5|6").split("|"),l=0;for(;;){switch(x[l++]){case"0":this[o(1446)]=n&&n.colno||0;continue;case"1":this[o(1063)]=n&&n[o(1063)]||null;continue;case"2":super(t);continue;case"3":this[o(1420)]=n&&n[o(1420)]||"";continue;case"4":this.lineno=n&&n[o(1138)]||0;continue;case"5":this[o(1905)]=n&&n[o(1905)]||"";continue;case"6":this[o(1123)]=n&&n[o(1123)]||5001;continue}break}}}class ks extends ut{constructor(t,n){let o=r,x=(o(706)+"2")[o(1821)]("|"),l=0;for(;;){switch(x[l++]){case"0":super(t);continue;case"1":this[o(600)]=n&&n.wasClean||!1;continue;case"2":this[o(1034)+o(1687)]=n&&n[o(1034)+o(1687)]||!1;continue;case"3":this[o(1123)]=n&&n[o(1123)]||0;continue;case"4":this[o(923)]=n&&n[o(923)]||"";continue}break}}}class Is extends ut{constructor(t,n){let o=r;super(t),this[o(1798)]=n&&n[o(1798)]||null}}class Ps extends Is{constructor(t,n){let o=r;super(t),this[o(1798)]=n&&n.data||null,this[o(1905)]=n&&n.message||null}}class Ds extends ut{constructor(t,n){let o=r;super(t),this[o(1798)]=n&&n.data||null}}function pe(s,{message:t,code:n,error:o}){return new As(s,{message:t,code:n,error:o})}function ye(s,{code:t,reason:n,wasClean:o,willReconnect:x}){let l=r;return e[l(825)](e.VoQQP,e.ecUZu)?_0x242b81?this[l(1118)+"E"]():this[l(1777)+"E"]():new ks(s,{code:t,reason:n,wasClean:o,willReconnect:x})}function Ts(s,{data:t,message:n}){return new Ps(s,{data:t,message:n})}function Ns(s,{data:t}){return new Ds(s,{data:t})}function gr(s,{message:t}){let n=r;return e[n(1423)](e.YmGMk,e[n(1716)])?new Es(s,{message:t}):Ngmsny[n(782)](_0x5415ee,_0x5cbe65)&&(Ngmsny.sdYKm(_0x363b97,Ngmsny[n(1215)])||_0xe31fda===Ngmsny[n(1230)])?!0:Ngmsny[n(1803)](_0x462b3c,_0x17e517)}class Ls{constructor(t,n){let o=r;this[o(1779)+"s"]=t,this[o(1520)+"es"]=n,this[o(2001)+o(1495)]=0,this[o(1301)+o(859)+o(1429)+"t"]=0}[r(535)+r(1868)+r(741)](){let t=r;e[t(1719)](e.RLYOh,e[t(613)])?(this[t(2001)+"ndex"]=0,this[t(1301)+t(859)+t(1429)+"t"]=0):_0x5c6a9f[t(771)+t(1244)]("upgradeneeded",n=>{let o=t;_0x263f42(_0x2797ae(_0x515e17[o(573)]),n.oldVersion,n[o(932)+"on"],_0xe5f000(_0x35032c[o(967)+o(1180)]))})}resetTries(){let t=r;this[t(1301)+t(859)+t(1429)+"t"]=0}["getCurre"+r(990)+"nt"](){let t=r;return this[t(1779)+"s"][this[t(2001)+t(1495)]]}[r(1025)+r(990)+r(1544)+r(1271)](){let t=r;return this["currentE"+t(859)+t(1429)+"t"]}["checkRea"+r(1134)+"es"](){let t=r;return e.YvpET!==e[t(516)]?!!(this[t(2001)+t(1495)]>=this[t(1779)+"s"][t(805)]||e.eNNKp(this[t(2001)+"ndex"],e.Uwjnv(this[t(1779)+"s"][t(805)],1))&&e[t(1759)](this[t(1301)+t(859)+"riesCount"],this[t(1520)+"es"])):this[t(1133)]?.del(_0x2a8f8c)}[r(524)+r(602)+r(911)+r(662)+"tries"](){let t=r;return e[t(508)](this[t(2001)+"ndex"],this[t(1779)+"s"][t(805)])?!0:e[t(786)](this[t(1301)+"ndpointT"+t(1429)+"t"],this[t(1520)+"es"])}[r(1124)+"ackupEnd"+r(972)+r(485)+r(1703)](){let t=r;return this[t(1301)+t(859)+t(1429)+"t"]=1,this[t(2001)+t(1495)]++,this[t(1779)+"s"][this["currentI"+t(1495)]]}[r(1025)+r(990)+"ntAndUpd"+r(754)](){let t=r;return this[t(1301)+t(859)+"riesCount"]++,this.getCurrentEndpoint()}}let ft=(e.BBSTC(e.lFxKo,typeof globalThis)&&e.ButpD(e[r(1891)],globalThis[r(1967)+r(817)].name)||typeof window<"u"&&e[r(615)](e.ARDNC,window[r(1967)+r(817)][r(1693)]))&&e[r(1316)](e[r(1614)],typeof document),et=e.PPPCW(r(1874)+"d",typeof globalThis)&&(e[r(1431)](e[r(1660)],globalThis[r(1967)+"tor"][r(1693)])||e[r(637)]("Dedicate"+r(1405)+r(1767)+"pe",globalThis[r(1967)+"tor"][r(1693)]))&&e.lFxKo!=typeof tt,Rt=(e[r(1859)](e[r(1614)],typeof globalThis)&&e[r(1660)]===globalThis[r(1967)+r(817)][r(1693)]||e[r(1542)](e.lFxKo,typeof globalThis)||e[r(802)](e[r(1614)],typeof globalThis)&&!!globalThis[r(1481)+r(753)])&&e[r(802)](e[r(1614)],typeof wx),Bt=e.EHHcm(e.lFxKo,typeof globalThis)&&(e[r(1120)](e[r(1489)],globalThis[r(1967)+r(817)][r(1693)])||e[r(1065)](e[r(789)],globalThis[r(1967)+r(817)][r(1693)])||e[r(798)](e[r(1099)],globalThis["construc"+r(817)][r(1693)]))&&e[r(970)](e[r(1614)],typeof self),Ua=e[r(933)](e[r(1614)],typeof globalThis)&&e[r(1392)](e[r(1660)],globalThis["construc"+r(817)][r(1693)])&&r(1874)+"d"!=typeof global&&e.lfVaI(e[r(1660)],global[r(1967)+r(817)].name)&&e[r(970)](r(1874)+"d",typeof process)&&!!process[r(1108)];class pr{constructor(){let t=r;this[t(979)+"rs"]={}}emit(t,...n){let o=r,x={oXRut:function(l,g,p){return e[I(878)](l,g,p)},oVBeI:e.Uxmll,TfrFE:function(l,g,p){return e[I(1971)](l,g,p)},HnNmT:e[o(1314)],EYKvf:e.LQoih};if(e[o(784)]===e[o(953)]){if(this[o(931)+o(1952)](),this[o(1491)+o(987)](),this._removeWsListeners(),this[o(1275)+"nceClose"](1e3,_0x17e434),this._connectLock=!1,_0x1735f8&&this["_navigat"+o(1727)]()&&!this[o(1867)+o(1449)]){if(this["_endpoin"+o(966)]?.[o(1615)+o(1134)+"es"]()){let g=this[o(672)+o(966)]?.[o(1025)+o(990)+"nt"]();this["_dispatc"+o(592)+o(756)](x[o(472)](_0x1fede1,x.oVBeI,{code:1006,reason:"connect "+g+(o(1610)+o(1567)+o(971)+o(1556)),wasClean:!0}))}else{let g=this[o(1135)][o(1126)+"tInterce"+o(1621)](_0x10b174,_0x51115f);this[o(1214)+o(592)+o(756)](x[o(472)](_0x1c4c43,x[o(698)],{code:_0x4abee5,reason:_0x8d76f2,wasClean:!0,willReconnect:g})),g&&this[o(1418)]()}return}this["_navigat"+o(1727)]()||this[o(1867)+o(1449)]?this[o(1214)+o(592)+"ent"](x[o(941)](_0x341e29,x[o(698)],{code:_0x39524b,reason:x[o(1565)]})):this[o(1214)+o(592)+o(756)](x.oXRut(_0x194a1c,x[o(698)],{code:1006,reason:x[o(622)]})),this._ws=null,this[o(672)+o(966)]?.[o(535)+o(1868)+o(741)](),this[o(902)+o(1739)]?.[o(1136)+o(946)]()}else{let l=this[o(979)+"rs"][t];if(l)l[o(633)]()[o(950)](g=>g.fn[o(1440)](g.ctx,n));else if(e[o(1723)]("error",t)&&!this[o(1248)]){let g=n[o(805)]&&n[0];if(e[o(1320)](g,Error))throw g;let p=new Error(e[o(1820)](e[o(596)],g?e[o(1511)](" ("+g[o(1905)],")"):""));throw p.context=g,g}return this}}[r(486)](t,n){let o=r;if(e[o(905)](void 0,t))this[o(979)+"rs"]={};else if(e[o(798)](void 0,n))this[o(979)+"rs"][t]=null;else{let x=this._listeners[t];if(x)for(let l=0;e[o(1013)](l,x[o(805)]);)x[l].fn===n?x[o(1101)](l,1):++l}return this}on(t,n,o){let x=r;return(this[x(979)+"rs"][t]||(this[x(979)+"rs"][t]=[]))[x(577)]({fn:n,ctx:o||this}),this}}class Ka extends pr{[r(1299)+"rrorMess"+r(1037)](t){let n=r;return t.errMsg||t.errNo?(n(1877)+" "+(t[n(720)]||"")+n(1917)+(t.errNo||""))[n(703)]():JSON.stringify(t)}constructor(t,n,o){let x=r;super(),this[x(1809)]=null,Rt&&wx[x(1827)+x(1157)]&&(this._socket=wx["connectS"+x(1157)]({url:t,protocols:n,header:o,fail:this[x(1506)+"ocketFailHandler"][x(459)](this),success:this[x(1506)+"ocketSuc"+x(1720)+x(476)][x(459)](this)})),et&&tt[x(1827)+x(1157)]&&(this[x(1809)]=tt[x(1827)+x(1157)]({url:t,protocols:n,header:o,fail:this["_createS"+x(483)+x(1842)][x(459)](this),success:this["_createSocketSuc"+x(1720)+x(476)][x(459)](this)}))}["_createS"+r(660)+r(1720)+r(476)](){let t=r;if(e.Lpeuy===e.bgIyf)for(var n in _0x10012f)_0x365773.o(_0x159806,n)&&!_0x4b6a73.o(_0x1b0530,n)&&_0x49aeb8[t(1383)+t(1417)](_0x544b65,n,{enumerable:!0,get:_0x4b2079[n]});else Promise[t(1665)]()[t(1128)](()=>{let o=t;this[o(651)+o(1304)]()})}["_createS"+r(483)+"lHandler"](t){let n=r,o={anVRv:function(x,l){return x+l},GIuVS:e[n(1283)],HDySM:n(1459),DJxpx:function(x,l,g){return x(l,g)},AAuMW:function(x,l,g){return e[n(507)](x,l,g)},eqrHi:e.Uxmll};if(e.SftdJ(e.AfhOp,n(1233)))Promise.resolve()[n(1128)](()=>{let x=n,l={pLCkP:o[x(498)]};if(o[x(1054)]===x(1459)){let g=o.DJxpx(pe,x(1063),{message:this["_formatE"+x(1959)+x(1037)](t)});this[x(1691)](o[x(498)],g);let p=o[x(768)](ye,o[x(865)],{reason:this["_formatE"+x(1959)+"age"](t)});this[x(1691)](o[x(865)],p)}else{let g=_0x4848c4[x(603)].slice(_0x5ac8fb[x(555)+"et"],o[x(1328)](_0x2c4275[x(1125)+"th"],_0x1888b5[x(555)+"et"]));this[x(1809)]&&this[x(1809)][x(774)]({data:g,fail:p=>{let d=x;this[d(1691)](d(1063),_0x242175(l.pLCkP,{message:this["_formatE"+d(1959)+d(1037)](p)}))}})}});else return(this[n(979)+"rs"][_0x5bd3e0]||(this[n(979)+"rs"][_0x4472a5]=[]))[n(577)]({fn:_0x233325,ctx:_0x3f460b||this}),this}[r(651)+r(1304)](){let t=r;this._socket[t(1477)](n=>{let o=t;this[o(1691)](o(791),e[o(1548)](Ns,e[o(1981)],{...n,data:n.errMsg||""}))}),this[t(1809)][t(897)](n=>{let o=t;this[o(1691)](o(760),e[o(1356)](ye,e[o(636)],{...n}))}),this[t(1809)][t(1601)+"e"](n=>{this[t(1691)]("message",Ts("message",{...n}))}),this._socket[t(813)](n=>{let o=t;this[o(1691)](e.LhGNs,e[o(1850)](pe,o(1063),{...n,message:n[o(720)]||""}))})}[r(774)](t){let n=r,o={QZglk:function(x,l,g,p){return x(l,g,p)},Uizjk:e[n(1045)],cbsZz:e.LhGNs,xFXMu:function(x,l,g){return e[n(1971)](x,l,g)}};if(e[n(727)](t,Uint8Array)){let x=t[n(603)][n(633)](t.byteOffset,e[n(1e3)](t[n(1125)+"th"],t[n(555)+"et"]));this[n(1809)]&&this._socket[n(774)]({data:x,fail:l=>{let g=n,p={eFyPR:function(d,w,b,k){return o[I(497)](d,w,b,k)}};if(g(1596)!==o[g(491)])try{p[g(1754)](_0x4581c2,this,_0x3455fc,[_0x621a1f,_0x2f2d91,_0xf68488])}catch(d){let w=_0x546fcf(g(1063),{message:d[g(1905)],code:_0x1eadcd[g(1067)+"OR"],error:d});this[g(1214)+g(1196)+"ent"](w)}else this[g(1691)](o[g(737)],o[g(743)](pe,"error",{message:this[g(1299)+g(1959)+g(1037)](l)}))}})}else this[n(1809)]&&this[n(1809)][n(774)]({data:t,fail:x=>{let l=n;this[l(1691)](o[l(737)],pe(o[l(737)],{message:this[l(1299)+"rrorMessage"](x)}))}})}close(t,n){let o=r,x={JonXh:function(l,g){return e[I(804)](l,g)}};if(e[o(1062)](e[o(2016)],"MTJEn"))return _0x90e731[o(1185)+"t8"]?_0x70ff39[o(1185)+"t8"](_0x29238d,_0x4fd967):_0x17bd9a[_0x34a60b]=255&_0x4e8845,x[o(1705)](_0x47ce2e,1);this[o(1809)]&&this[o(1809)][o(760)]({code:t,reason:n})}[r(771)+r(1244)](t,n){this.on(t,n)}[r(1174)+r(1192)+r(1864)](t,n){this[r(486)](t,n)}get[r(1531)+"te"](){return this[r(1809)].readyState}get[r(1432)+"pe"](){return this[r(1809)].binaryType}set binaryType(t){}get[r(1962)](){let t=r;return e.gCzZt(e[t(673)],e[t(635)])?typeof _0x2b802c===Ngmsny[t(861)]?_0x4cdba8(_0x34b1bd):(Ngmsny[t(782)](_0x5ed5cd,_0xdc012d)&&_0x582ab2(_0x5344a5),_0x425d92(_0xb615f,Ngmsny[t(1590)](_0x574681))?new _0x1a412d(_0x3744dc,_0x221914):_0x406e13):this._socket.url}get[r(1845)](){let t=r;return this._socket[t(1845)]}get[r(1194)+"ns"](){let t=r;return this[t(1809)][t(1194)+"ns"]}get[r(1925)+r(1708)](){return 0}}function Ga(s,t){let n=r;if(t)return new t(s.url,s[n(1845)]);if(e[n(869)](Rt,et))return new Ka(s.url,s[n(1845)],s.headers);if(e[n(1607)](ft,Bt)&&e[n(1316)](e[n(1614)],typeof WebSocket)&&WebSocket)return new WebSocket(s[n(1962)],s.protocols)}function Ha(s){let t=r;return!!(s||Rt&&wx[t(1827)+t(1157)]||et&&tt.connectSocket||(ft||Bt)&&e[t(1614)]!=typeof WebSocket&&WebSocket)}function Rs(s,t,n){let o=r,x=-1;async function l(g){let p=I;return e[p(947)](g,x)?Promise[p(655)](new Error(p(1121)+p(667)+p(2014)+p(2025)+"process")):(x=g,e[p(1431)](g,n[p(805)])?Promise.resolve():n[g][p(459)](s)(t,l.bind(null,e.qbmWc(g,1))))}e[o(648)](l,0)}function Bs(s){let t=r,n=0,o=0;for(let x=0;e[t(618)](x,s[t(805)]);++x)o=s.charCodeAt(x),o<128?n+=1:e.ydtiD(o,2048)?n+=2:e[t(1723)](e.NyxZa(64512,o),55296)&&e[t(905)](e[t(1929)](64512,s[t(1344)+"At"](e[t(1876)](x,1))),56320)?(++x,n+=4):n+=3;return n}function Ms(s,t,n){let o=r;if(e.ZpAEQ(e.OAefp(n,t),1))return"";let x="";for(let l=t;e[o(611)](l,n);){let g=s[l++];if(g<=127)x+=String[o(1140)+"Code"](g);else if(e[o(1298)](g,192)&&e[o(1980)](g,224))x+=String[o(1140)+"Code"](e[o(1217)](e[o(1594)](31,g)<<6,63&s[l++]));else if(e[o(1668)](g,224)&&e[o(1456)](g,240))x+=String[o(1140)+o(732)](e.Ewkze(e.wGaze(15,g),12)|(63&s[l++])<<6|63&s[l++]);else if(e.AbxNv(g,240))if(e[o(1515)](e.yHuAH,e[o(478)])){let p=e[o(465)][o(1821)]("|"),d=0;for(;;){switch(p[d++]){case"0":++_0x3ce983;continue;case"1":_0x5837fd=e[o(1050)](e[o(580)](65536,e[o(1871)](e[o(1968)](1023,_0xc7b3fa),10)),e[o(1574)](1023,_0x3071ab));continue;case"2":_0x3a1960[_0x1e4b52++]=e[o(1689)](63,_0x586cee)|128;continue;case"3":_0xa7359a[_0x16f84f++]=e[o(1178)](e.RsKme(e[o(839)](_0x5cc7d4,12),63),128);continue;case"4":_0x58e023[_0x1077b4++]=e.kJANx(e.UHbIl(_0x43b9df,18),240);continue;case"5":_0x192743[_0x11aaad++]=e[o(1367)](e[o(1252)](_0x30086d,6)&63,128);continue}break}}else{let p=e[o(1358)](e[o(1203)](e[o(1747)](e.IJBel(e[o(712)](e[o(542)](7,g),18),e[o(457)](e[o(670)](63,s[l++]),12)),e[o(1812)](e[o(1758)](63,s[l++]),6)),e[o(1033)](63,s[l++])),65536);x+=String[o(1140)+o(732)](e.QKPdL(55296,e[o(610)](p,10))),x+=String[o(1140)+o(732)](e[o(943)](56320,1023&p))}}return x}function mr(s,t,n){let o=r,x=n,l,g;for(let p=0;p<s[o(805)];++p)if(l=s[o(1344)+"At"](p),e[o(1748)](l,128))t[n++]=l;else if(l<2048)t[n++]=e[o(517)](l>>6,192),t[n++]=e[o(1445)](63,l)|128;else if(e[o(825)](e[o(942)](64512,l),55296)&&e.QLyaQ(e[o(443)](64512,g=s.charCodeAt(e.jOENT(p,1))),56320)){let d=e[o(1900)][o(1821)]("|"),w=0;for(;;){switch(d[w++]){case"0":t[n++]=e[o(1557)](e[o(661)](63,l),128);continue;case"1":t[n++]=e[o(1547)](l>>18,240);continue;case"2":t[n++]=e[o(1656)](e[o(684)](e[o(876)](l,6),63),128);continue;case"3":t[n++]=e.frGfd(e.BBWOw(e[o(997)](l,12),63),128);continue;case"4":++p;continue;case"5":l=e[o(537)](e[o(1876)](65536,e[o(890)](e[o(1810)](1023,l),10)),1023&g);continue}break}}else t[n++]=e[o(793)](e[o(467)](l,12),224),t[n++]=e[o(521)](e.pqPrO(e[o(522)](l,6),63),128),t[n++]=e.sbtbE(e[o(814)](63,l),128);return e[o(523)](n,x)}async function Os(s){let t=r;if(t(1938)==typeof s){let n=new Uint8Array(e[t(1137)](Bs,s));return e[t(736)](mr,s,n,0),n}return e.IgYkJ(s,ArrayBuffer)?new Uint8Array(s):new Uint8Array(s[t(603)],s.byteOffset,s[t(1125)+"th"])}function ja(s){let t=r;try{return e[t(1402)]!=typeof s&&(e.aurHK(s,ArrayBuffer)||s[t(603)]&&e[t(751)](s[t(603)],ArrayBuffer))||e[t(1402)]!=typeof s?"":(JSON[t(1775)](s),e[t(1865)])}catch{return e[t(1542)](t(1938),typeof s)?e[t(511)]:""}}let Wa=(s,t)=>{let n=r;switch(s){case e[n(1151)]:case e[n(1377)]:return{[n(1507)+s]:1,"x-tt-env":t};default:return{}}};class Ja{constructor(t){let n=r;this[n(1926)+"ount"]=t,this[n(1737)]=0}[r(1011)](){let t=r;this[t(1737)]++}["checkRea"+r(1278)+"nt"](){let t=r;return this.count>=this["maxLossC"+t(1271)]}[r(1136)+r(946)](t=0){let n=r;this["maxLossC"+n(1271)]=t,this[n(1737)]=0}}async function Va(s){let t=r,n={GfCwt:e[t(697)],jAQfh:e[t(1222)],SzfXR:function(o,x){return e[t(1895)](o,x)},ZjsSs:e.kuadT,ypEmj:function(o,x){return e[t(883)](o,x)},DeImy:e[t(1647)],ofMGH:e.aBbFR,zcFlq:function(o,x){return e[t(693)](o,x)},hqJmi:e[t(584)],zshNH:function(o,x){return e[t(1062)](o,x)},qGmjU:t(745)};return new Promise(o=>{let x=t,l={xONms:n[x(1260)],baUqB:n.jAQfh,SsqSv:function(g,p){return n[x(1462)](g,p)},ntnBD:n[x(1373)],plZcB:function(g,p){return g(p)},uyWGe:function(g,p){return n[x(780)](g,p)},wObwH:function(g,p){return n[x(780)](g,p)}};if(!ft)return n[x(1462)](o,n[x(1373)]);try{let g=document[x(1978)+x(1235)](n[x(1622)]);window[x(769)+x(1370)]=p=>{let d=x;l[d(1002)]!==l.baUqB?(document[d(1672)][d(1936)+"ild"](g),window[d(769)+d(1370)]=void 0,l.SsqSv(o,p&&p.msg||l.ntnBD)):(this._isInit=!0,this._connect())},g.type="text/jav"+x(880),g[x(1994)]=n[x(780)](s[x(621)](/^ws/,x(1347)),n[x(1619)]);try{document.body[x(455)+x(1041)](g)}catch{if(n[x(870)](n[x(1322)],x(513)))return this[x(951)]?this[x(951)].readyState:this._options.automaticOpen?this[x(1529)+"NG"]:this[x(1637)];document[x(1672)][x(1936)+x(1041)](g)}}catch{if(n[x(1663)](n[x(1009)],n.qGmjU))window[x(769)+"JSONP"]=void 0,n[x(1462)](o,n.ZjsSs);else{let p=""+_0x27ce1a[x(1648)](),d=_0x21b93d||(_0x361eb8=rTkIek[x(1732)](_0x2ae3fd,_0xa7036a)),w=_0x1a5609[x(1184)]().toString(16)[x(633)](-6);return rTkIek[x(725)](rTkIek[x(532)](rTkIek.uyWGe("02",p),d),w)}}})}function We(s,t,n){let o=r;return!!s?.[o(1960)](x=>x[o(1221)]===t&&x[o(1923)]===n)}function dt(s,t){let n=r;if(e[n(1626)](n(811),"YINkz"))return s?.[n(1960)](o=>o[n(1221)]===t)?.[n(1923)];this[n(900)+n(1880)]=_0x965fe3,this[n(951)]&&(this[n(951)][n(1432)+"pe"]=_0x569c12)}let _r=null;async function Xa(){let s=r,t={BHHly:e[s(690)]};if(e[s(934)](e.PaALQ,e[s(623)]))return _r||(_r=Promise[s(1665)]()[s(1128)](Te.bind(Te,e[s(1934)]))),_r;this.emit(jwTTFv[s(920)],_0x2be358(s(1905),{..._0x13a231}))}class Ya extends pr{constructor(t,n){let o=r;super(),this[o(1866)]=t,this[o(1710)]=n,this[o(1133)]=void 0,this[o(1664)+o(1372)]=null}async[r(1457)](){await this._init()}async[r(1454)](){let t=r,n={PxTSd:function(o){return e[I(1590)](o)},Aznug:function(o,x,l,g){return e.PaFVF(o,x,l,g)}};if(e[t(642)]!==t(1388)){if(this[t(1133)])return;if(this[t(1664)+t(1372)])return this[t(1664)+t(1372)];try{let o=this._dbName,x=this[t(1710)];this[t(1664)+t(1372)]=(async()=>{let l=t,{openDB:g}=await n[l(908)](Xa);this._qosDB=await n[l(1044)](g,l(769)+"_"+o,1,{upgrade(p){p["createOb"+l(973)+"e"](o,{keyPath:x})}})})(),await this[t(1664)+t(1372)]}catch(o){console[t(1892)](o)}finally{this[t(1664)+t(1372)]=null}}else _0x5e424b[t(1665)]().then(()=>{this["_addWsLi"+t(1304)]()})}async get(t){let n=r;try{return await this[n(1454)](),this[n(1133)]?.[n(692)](this._dbName,t)}catch(o){if(e.OgHxq(e[n(1930)],n(1227))){let x=_0x22d4d9.bytes,l=_0x468d6c[n(1811)],g=_0x509c97.limit,p=l+_0x347428;if(e.McnAZ(p,x.length)){let d=new _0x378f02(2*p);d[n(1928)](x),_0x52b30f.bytes=d}return _0x24bd7a[n(1811)]=p,e[n(1715)](p,g)&&(_0x11da1f[n(1786)]=p),l}else console[n(1892)](o)}}async[r(1928)](t,n){let o=r;if(e[o(1696)](e[o(1945)],e.aAluk))return await this._init(),this[o(1133)]?.[o(1351)](this._dbName,t);{let x=e[o(1463)](_0x95ca25,_0x1161b7),l=_0x47153b.limit;return _0xfdba45[o(1786)]=e[o(1517)](_0x3bc7ec[o(1811)],x),l}}async[r(1724)](t){let n=r;if(e.pNqBD===e[n(479)])Ngmsny[n(1226)](_0x3be134,_0x161ef9.error),Ngmsny[n(1450)](_0x3e1859);else try{return await this._init(),this[n(1133)]?.[n(450)](this[n(1866)],t)}catch(o){console.log(o)}}async clear(){let t=r;try{return await this._init(),this[t(1133)]?.[t(1843)](this[t(1866)])}catch(n){console[t(1892)](n)}}async keys(){let t=r;if(e[t(1355)](e[t(719)],e[t(452)]))this[t(1133)]?.[t(760)](),this[t(1133)]=void 0;else return await this._init(),this[t(1133)]?.[t(1942)+"ys"](this[t(1866)])}async[r(1254)](){let t=r;return await this[t(1454)](),this._qosDB?.[t(1254)](this[t(1866)])}async[r(1148)](){let t=r;if(e[t(1295)]===e[t(1795)])return this[t(1133)][t(1843)]();try{this._qosDB?.[t(760)](),this[t(1133)]=void 0}catch(n){console[t(1892)](n)}}get[r(1789)](){let t=r;try{return!!this[t(1133)]}catch(n){return console[t(1892)](n),!1}}}class $a{constructor(t,n){let o=r;this[o(1032)]=t,this._pathKey=n,this[o(1133)]=localStorage}async openDB(){}get _prefix(){let t=r;return t(769)+"_"+this[t(1032)]}async get(t){let n=r,o=this[n(1133)].getItem(this[n(1115)]);return JSON.parse(e[n(1263)](o,"{}"))[t]}async set(t,n){let o=r,x=this[o(1133)][o(1094)](this[o(1115)]),l=JSON[o(1775)](e[o(1435)](x,"{}"));return l[n||t[this._pathKey]]=t,this._qosDB[o(891)](this[o(1115)],JSON[o(458)+"y"](l)),n||t[this._pathKey]}async del(t){let n=r,o=this[n(1133)][n(1094)](this[n(1115)]),x=JSON[n(1775)](e.ZSQnL(o,"{}"));return x[t]=void 0,this._qosDB.setItem(this[n(1115)],JSON[n(458)+"y"](x))}async[r(1843)](){let t=r;return e[t(1879)](t(441),e.rNSXk)?this[t(1133)].clear():(_0x36421d|=0,{low:_0x42ef82,high:e[t(854)](_0x368205,31),unsigned:e[t(1863)](_0x3dba83,0)})}async[r(1525)](){let t=r,n=this[t(1133)].getItem(this[t(1115)]),o=JSON.parse(e[t(842)](n,"{}"));return Object[t(1525)](o)}async[r(1254)](){let t=r,n=this[t(1133)][t(1094)](this[t(1115)]),o=JSON[t(1775)](n||"{}");return Object[t(1847)](o)}closeDB(){return Promise[r(1665)]()}get[r(1789)](){return!!this[r(1133)]}}class Za{constructor(t,n){let o=r;this[o(1032)]=t,this[o(1755)]=n,this._qosDB=et?tt:Rt?wx:null}async openDB(){}get[r(1115)](){let t=r;return t(769)+"_"+this[t(1032)]}async[r(692)](t){let n=r,o=this[n(1133)].getStorageSync(this[n(1115)]);return JSON[n(1775)](o||"{}")[t]}async[r(1928)](t,n){let o=r,x=this[o(1133)][o(518)+"geSync"](this[o(1115)]),l=JSON[o(1775)](e[o(1263)](x,"{}"));return l[n||t[this[o(1755)]]]=t,this[o(1133)][o(1728)+"geSync"](this._prefix,JSON[o(458)+"y"](l)),n||t[this[o(1755)]]}async del(t){let n=r,o=this._qosDB[n(518)+n(945)](this._prefix),x=JSON.parse(o||"{}");return x[t]=void 0,this[n(1133)]["setStora"+n(945)](this[n(1115)],JSON[n(458)+"y"](x))}async[r(1843)](){let t=r;return this._qosDB[t(529)+"rageSync"]()}async[r(1525)](){let t=r,n=this[t(1133)][t(518)+"geInfoSync"](this[t(1115)]),o=JSON[t(1775)](e.fcBhI(n,"{}"));return Object[t(1525)](o)}async[r(1254)](){let t=r,n=this._qosDB[t(518)+t(1144)+"nc"](this[t(1115)]),o=JSON[t(1775)](e[t(1263)](n,"{}"));return Object[t(1847)](o)}[r(1148)](){return Promise[r(1665)]()}get[r(1789)](){let t=r;if(e[t(589)](e[t(2003)],t(1659))){let n=_0x33ded4[t(1221)];e.ebRhr(void 0,n)&&(_0x3d5c55(_0x11116f,10),e[t(1969)](_0x2497de,_0x5a783a,n));let o=_0x1119fc.value;o!==void 0&&(e.EjPwb(_0x3f8038,_0x208d98,18),e[t(1993)](_0x2d4463,_0x10796c,o))}else return!!this._qosDB}}function zs(s,t){let n=r;if(e[n(869)](et,et))return new Za(s,t);if(e[n(500)](ft,Bt)&&e[n(1198)](e[n(1614)],typeof indexedDB))return new Ya(s,t);if((ft||Bt)&&e[n(933)](e[n(1614)],typeof localStorage))return new $a(s,t);throw new Error(e[n(799)])}class Qa{constructor(){let t=r;this[t(614)+t(1964)+"Id"]=null,this._interval=36e5,this._qosDB=e[t(1141)](zs,"qos",e[t(892)])}async[r(614)+r(1787)](){let t=r;e[t(1204)](clearInterval,this[t(614)+t(1964)+"Id"]),this[t(614)+t(1964)+"Id"]=setInterval(()=>{this["flushExp"+t(1207)]()},this[t(614)+"l"])}async[r(1457)](){let t=r,n={NYfJq:function(o,x){return e[I(1416)](o,x)}};if(e[t(1232)]!==e[t(1669)])await this[t(1133)][t(1457)]().then(()=>{this[t(614)+"lFlush"]()});else return this[t(2001)+t(1495)]==this[t(1779)+"s"][t(805)]?!0:QEWUHx[t(1730)](this[t(1301)+"ndpointT"+t(1429)+"t"],this[t(1520)+"es"])}async[r(1166)+r(1207)](){let t=r;(await this[t(1133)]?.[t(1254)]()||[])[t(750)](({timestamp:x})=>x<Date[t(1648)]()).forEach(x=>{let l=t;this[l(1133)]?.[l(1724)](x[l(1742)+"id"])})}async[r(1724)](t){let n=r;return this[n(1133)]?.[n(1724)](t)}async[r(1928)](t,n){let o=r;return this._qosDB?.[o(1928)]({message_id:t,timestamp:n})}async[r(692)](t){return this[r(1133)]?.get(t)}async[r(1148)](){let t=r;e[t(949)](clearInterval,this[t(614)+t(1964)+"Id"]),await this[t(1133)]?.closeDB()}get[r(1789)](){let t=r;if(e[t(1914)](e.qtvyq,e[t(1763)]))return this._qosDB?.[t(1789)];switch(_0x3e96af){case e[t(1151)]:case e[t(1377)]:return{[t(1507)+_0x390586]:1,"x-tt-env":_0x424aeb};default:return{}}}}function wr(s){let t=r,n={uggHd:function(o,x){return e[I(1749)](o,x)},LGXcH:function(o,x){return e[I(1914)](o,x)},saYaS:e[t(1883)],zErdU:t(1996)+t(1534)+"s",MqdAa:e[t(1444)],EMXXX:function(o,x,l){return o(x,l)},szvAZ:function(o,x){return e[t(1781)](o,x)},gllTp:e.LhGNs};if(e[t(669)]!==t(2026)){let o=!!this[t(1135)][t(1686)+"S"];if(!o)return{enabled:o,isQoSMessage:!1,isQoSAck:!1,isAckCleanupMessage:!1,ackMsgIds:[]};let x=e[t(1289)](We,s.message[t(849)],"x_fronti"+t(1986),"2"),l=x&&e[t(1289)](We,s[t(1905)][t(849)],e[t(1485)],"1"),g=x&&e[t(910)](We,s[t(1905)].headers,e[t(887)],"1"),p=g?e[t(704)](dt,s.message.headers,e[t(1403)])?.[t(1821)](",")[t(750)](Boolean)||[]:[];return{enabled:o,isQoSMessage:x,isQoSAck:l,isAckCleanupMessage:g,ackMsgIds:p}}else{let{pingInterval:o,pingFrequency:x}=this._options;if((n[t(1704)]("hi",_0x59560b[t(1798)])&&n[t(1999)](t(1824),x)||n[t(1999)](n.saYaS,x))&&(this[t(931)+"ngTimer"](),this[t(1691)](n[t(1634)],n[t(820)]),this[t(836)+t(447)+"Id"]=n[t(1391)](_0x41fdb9,this._ping[t(459)](this),o)),n[t(639)]("hi",_0x465800[t(1798)]))return;try{_0x284696(this,_0x432cb8,[_0x3ac586,_0x3bc0a2,_0x360ab1,_0x56ec0d,_0x36cac9,_0x4d8caa])}catch(l){let g=n[t(1391)](_0x57b5ab,n.gllTp,{message:l[t(1905)],code:_0x2992f0[t(502)+t(1286)],error:l});this[t(1214)+t(1196)+t(756)](g)}}}async function qs(){let s=r;return this._QoSManager||(this[s(1258)+s(1856)]=new Qa),this[s(1258)+s(1856)][s(1789)]||await this["_QoSMana"+s(1856)][s(1457)](),this[s(1258)+"ger"]}async function e0(s,t){let n=r;if(e[n(718)](e[n(2013)],e[n(2013)])){let{enableAutoAck:o}=this._options,x=e[n(1740)](We,s[n(1905)].headers,e[n(1911)],"1"),l=e.Ucwyr(We,s[n(1905)][n(849)],e.BMeev,"1"),g=wr[n(1255)](this,s);if(o&&x)if(e[n(1004)](e[n(499)],e[n(499)]))Ngmsny[n(1725)](_0x52fc59,_0x173564(_0x24068f[n(573)])),Ngmsny[n(1590)](_0x21363b);else{let{SeqID:p,LogID:d,service:w,LogIDNew:b,method:k}=s[n(1905)];this[n(1799)]({SeqID:p,LogID:d,LogIDNew:b,service:w,method:k,headers:[{key:e[n(1438)],value:"1"},{key:e[n(833)],value:e[n(1245)](b,"")},{key:e[n(607)],value:"0"}]})}l&&!g.isQoSAck&&this["_dispatc"+n(1086)+n(1473)](s),e.MhwjM(t)}else return!0}async function t0(s,t){let n=r;this[n(593)](e.qjluv,s[n(1905)]),e.kxfrL(t)}async function n0(s,t){let n=r,o=e.DxRcA(ys,await e[n(484)](Os,s[n(1798)]));try{if(o[n(930)]instanceof Uint8Array){let x=this._options[n(823)+n(597)]instanceof Object?{force:!!this[n(1135)][n(823)+n(597)][n(1499)],encoding:this[n(1135)][n(823)+n(597)][n(685)]?this[n(1135)][n(823)+n(597)][n(685)].replace(/\s/g,"")[n(1411)+"ase"]():""}:{force:!1,encoding:this[n(1135)][n(823)+n(597)]?this[n(1135)]["payloadE"+n(597)].replace(/\s/g,"")["toLowerC"+n(896)]():""},l=o["payloadE"+n(597)]?o.payloadEncoding.replace(/\s/g,"")[n(1411)+"ase"]():"",g=e.ZhYfP(this._options["payloadT"+n(1880)],Object)?{force:!!this._options[n(1414)+n(1880)][n(1499)],type:this[n(1135)][n(1414)+"ype"].type?this._options["payloadT"+n(1880)][n(1265)][n(621)](/\s/g,"")["toLowerC"+n(896)]():""}:{force:!1,type:this[n(1135)]["payloadT"+n(1880)]?this[n(1135)][n(1414)+n(1880)][n(621)](/\s/g,"")[n(1411)+n(896)]():""},p=o[n(1414)+n(1880)]?o[n(1414)+n(1880)][n(621)](/\s/g,"")[n(1411)+n(896)]():"",d=g[n(1499)]?g[n(1265)]:p||g[n(1265)],w=x[n(1499)]?x[n(685)]:l||x.encoding,b=["text/pla"+n(867)+n(747),e[n(1865)],e.qrlFr,"string"],k=[n(1848)+"e",n(778)];this[n(1135)][n(1143)+n(866)+n(1307)+"ad"]&&b[n(1916)](d)&&(!w||k[n(1916)](w))?o[n(1427)+n(515)]=e[n(860)](Ms,o[n(930)],0,o[n(930)][n(1125)+"th"]):o[n(1427)+n(515)]=""}else o[n(1427)+n(515)]=""}catch(x){o[n(1427)+n(515)]="",console[n(1892)](x)}s[n(1905)]=o,e[n(466)](t)}function r0(s,t,n){let o={Przmv:function(d,w){return d>w},QbpER:function(d,w){return e.uduQh(d,w)},vDkyC:function(d,w){return e[I(531)](d,w)},woAOY:function(d,w){return e.mcAce(d,w)}},x=n||8192,l=e.PoTrO(x,1),g=null,p=x;return function(d){let w=I;if(d<1||o[w(1442)](d,l))return s(d);o.QbpER(p,d)>x&&(g=s(x),p=0);let b=t[w(1255)](g,p,p+=d);return 7&p&&(p=o[w(1985)](o[w(1035)](7,p),1)),b}}let s0=4294967295;function i0(s,t,n){let o=r;return e[o(1282)](RangeError,e[o(883)](e[o(1921)](o(1366)+o(1171)+o(1734),s)+o(2019)+e[o(553)](t,1),e.yopLn)+n)}function o0(s,t,n){let o=r;if(n>s0)throw new Error(e.cmBHY);let x=3;for(;e[o(773)](x,0);){let l=255&n;e[o(1289)](br,l,s,e[o(1060)](t,x)),n>>>=8,x--}return e[o(740)](t,4)}function a0(s,t){let n=r,o={WFevW:function(x,l){return x|l},YUYYa:function(x,l){return x<<l},RUWiy:function(x,l){return e[I(1968)](x,l)},jZKqo:function(x,l){return x&l},ujlmY:function(x,l){return e[I(1871)](x,l)},EcLMI:function(x,l){return e[I(1338)](x,l)},nKFHU:function(x,l){return e[I(739)](x,l)},nytNA:function(x,l){return e.KLwFa(x,l)}};if(e[n(2005)](n(1273),e[n(794)])){let x=0,l=t,g=e[n(1679)](t,4);for(;e[n(1114)](l,g);)if(e[n(904)](n(1158),n(1158))){let{value:p,offset:d}=yr(s,l);l=d,x=e[n(1284)](e[n(909)](x,8),0),x+=p}else{if(e[n(659)](_0x5d9685,_0xe183e6))throw new _0x5957f2(e[n(1129)]);let p=3;for(;e[n(868)](p,0);){let d=e[n(1758)](255,_0x1792a8);e[n(736)](_0x4dde5e,d,_0x10c872,_0x20e6ba+p),_0xcae2fd>>>=8,p--}return e.DQkJZ(_0x295365,4)}return{value:x,offset:g}}else _0x1d22ca=khXCyG[n(1870)](khXCyG[n(1870)](khXCyG[n(1870)](khXCyG[n(1927)](khXCyG[n(1854)](7,_0x36cfc6),18),khXCyG.YUYYa(khXCyG.jZKqo(63,_0x8b5f25),12)),khXCyG[n(1817)](63&_0x163e06,6)),khXCyG[n(1765)](63,_0x58cdfb)),khXCyG.nKFHU(_0x3d33fe,65536)||_0x509ef7>1114111?_0x3bdf2e+=_0x83b50c:(_0x444826-=65536,_0x4100ab+=_0x1083e9(khXCyG[n(757)](_0x412932>>10,55296),khXCyG.nytNA(khXCyG[n(1765)](1023,_0x52efff),56320)),_0x4314c5+=3)}function c0(s,t,n){let o=r,x=e.ATavo[o(1821)]("|"),l=0;for(;;){switch(x[l++]){case"0":if(t[o(1082)+"e"])return e[o(1679)](t[o(1082)+"e"](s,n),n);continue;case"1":if(!s)return n;continue;case"2":return e[o(531)](e[o(1096)](mr,s,t,n),n);case"3":if(t[o(683)])return t[o(683)](s,n)+n;continue;case"4":if(e[o(739)](s.length,40))return e[o(1267)](mr(s,t,n),n);continue}break}}function x0(s,t){let n=r,o=new q(e[n(1576)](e[n(901)](e[n(1812)](s[e.QKPdL(t,4)],24),e[n(445)](s[e[n(767)](t,5)],16))|e.tvJUD(s[t+6],8),s[e[n(1587)](t,7)]),e[n(1152)](e.rOoVd(e[n(1083)](s[e[n(462)](t,0)]<<24,e[n(1433)](s[t+1],16)),e[n(928)](s[e[n(567)](t,2)],8)),s[e.EOhgE(t,3)]),!0);return t+=8,{value:o,offset:e[n(856)](t,8)}}function u0(s,t,n){let o=r;if(e[o(1428)](e[o(681)],e[o(1801)])){let x=s[o(463)],l=s[o(1212)];return t[n]=l>>>24,t[e[o(1683)](n,1)]=e[o(565)](e[o(494)](l,16),255),t[e[o(927)](n,2)]=e[o(601)](l>>>8,255),t[e.mhEPM(n,3)]=e[o(563)](255,l),t[e[o(580)](n,4)]=e[o(1053)](x,24),t[n+5]=e[o(1224)](x,16)&255,t[e[o(462)](n,6)]=e[o(1202)](e[o(1386)](x,8),255),t[n+7]=255&x,n+=8,n}else _0x2e943a+=e[o(1947)](_0xc07568,_0x26982d),_0x2476e9+=2}function yr(s,t){let n=r;return s[n(1127)+"8"]?{value:s[n(1127)+"8"](t),offset:e.PBMrh(t,1)}:{value:e.rvfcb(255,s[t]),offset:e[n(746)](t,1)}}function br(s,t,n){let o=r;return t.writeUint8?t[o(1185)+"t8"](s,n):t[n]=255&s,e[o(1876)](n,1)}let f0=function(s){return new Uint8Array(s)},d0=typeof Buffer<"u"?Buffer[r(1970)+r(882)]:e[r(847)](r0,f0,Uint8Array.prototype.subarray);(()=>{let s=r,t={Juhdi:function(o,x){return e.IqsLg(o,x)},zZYGx:function(o,x){return e[I(1542)](o,x)},efEaJ:e[s(1402)],jiUKU:e[s(1535)]},n=4294967295;return function(o,x,l=!0){let g=s;if(e[g(1355)](e[g(1662)],"efZwW")){let{url:p}=t.Juhdi(_0xceed86,{}),d=_0x1f6fbc[g(710)](p)?p:t[g(1472)](t[g(1998)],typeof p)?[p]:[];_0x333b3c&&_0x3a6d66[g(893)](this[g(1135)],_0x599cad),d&&d[g(805)]?this[g(672)+g(966)]=new _0x2bc374(d,this[g(1135)][g(1520)+"es"]):this[g(672)+g(966)]?.[g(535)+g(1868)+g(741)](),this._pingLossCounter?.[g(1136)+g(946)](this[g(1135)]["pingLoss"+g(643)]),this[g(1867)+"osed"]=!1,this[g(951)]&&this[g(951)][g(1531)+"te"]!==this[g(1637)]?this["_disconn"+g(599)](1e3,t[g(1761)],!0):(this[g(988)]=!0,this._connect())}else{let p=e[g(1688)].split("|"),d=0;for(;;){switch(p[d++]){case"0":n=(127&o[x])>>>0;continue;case"1":if(e[g(1885)](o[x++],128))return{value:l?n:0|n,offset:x};continue;case"2":if(e[g(1807)](x+=5,o.length))throw x=o[g(805)],e[g(913)](i0,x,10,o[g(805)]);continue;case"3":if(e[g(1791)](o[x++],128))return{value:l?n:0|n,offset:x};continue;case"4":n=e.BFJap(e[g(1334)](n,e[g(1408)](e[g(565)](127,o[x]),21)),0);continue;case"5":if(e.XFmqp(o[x++],128))return{value:l?n:e[g(1334)](0,n),offset:x};continue;case"6":n=e[g(1878)](n|e.JqYbS(15&o[x],28),0);continue;case"7":if(e[g(1748)](o[x++],128))return{value:l?n:e[g(901)](0,n),offset:x};continue;case"8":n=e[g(877)](e[g(1083)](n,(127&o[x])<<14),0);continue;case"9":if(e[g(1013)](o[x++],128))return{value:l?n:e[g(901)](0,n),offset:x};continue;case"10":n=e.ZPqmn(n,e[g(1912)](127&o[x],7))>>>0;continue;case"11":return{value:l?n:0|n,offset:x}}break}}}})();let l0=16,vr=32;function h0(s){let t=r,n=0,o={};for(let x=0;e[t(1751)](x,s[t(805)]);x++)o[s[x][t(1882)+t(477)]]=e.zzTdq(Bs,s[x][t(1882)+t(477)]),n+=e[t(505)](14,o[s[x][t(1882)+t(477)]]);return[n,o]}function Fs(s,t,n){let o=r,x={yhFer:o(1349)+"ervice",QQogd:function(w,b,k,T){return e.TxyVK(w,b,k,T)},Oeevf:o(1774),PMABZ:o(1545),WbNSi:function(w,b,k,T){return e[o(1289)](w,b,k,T)},vaPQY:e[o(964)],rUevW:e.KJLXl,FMPez:"curvalue"},[l,g]=h0(s),p=e[o(1156)](d0,l),d=0;return s[o(950)](w=>{let b=o;console[b(1892)](x[b(1505)],w,w[b(1545)]),d=x[b(560)](br,0,p,d),console.log(x[b(1830)],d),d=x[b(560)](o0,p,d,w[b(1545)]||0),console.log(x.PMABZ,d),d=x[b(1508)](br,g[w[b(1882)+b(477)]],p,d),console[b(1892)](x.vaPQY,d),d=x[b(560)](c0,w.cursor_name,p,d),console[b(1892)](x.rUevW,d),d=x[b(560)](u0,q.fromNumber(w.cursor||t),p,d),console[b(1892)](x[b(569)],d)}),{frameType:vr,headers:[{key:o(1629)+o(1292),value:n}],payload:p}}function g0(s){let t=r,n=0,o=[];for(;e[t(680)](n,s[t(1125)+"th"]);){let{offset:x}=yr(s,n);n=x;let l={cursor_name:"",cursor:0,service:0},{value:g,offset:p}=a0(s,n);l.service=g,n=p;let{value:d,offset:w}=e[t(847)](yr,s,n);n=w,l[t(1882)+t(477)]=e[t(910)](Ms,s,n,n+d),n+=d;let{value:b,offset:k}=e[t(1831)](x0,s,n);l[t(1189)]=b[t(1833)](),n=k,o.push(l)}return o}function p0(){let s=r;return{frameType:vr,headers:[{key:s(1629)+s(1292),value:e[s(1816)]}],payload:void 0}}class m0{constructor(t,n,o){let x=r;this[x(1893)+x(1040)]=t,this[x(999)+"ileName"]=n,this["_message"+x(1796)]=o,this[x(1133)]=e[x(1500)](zs,this["_cursorN"+x(1040)],e[x(606)])}async openDB(){let t=r;await this[t(1133)][t(1457)]()}async[r(1899)+"rs"](){let t=r;if(!this[t(1133)][t(1789)])return;let n=this[t(1989)+"Strategy"],o=await this._qosDB[t(1254)]();switch(console[t(1892)](e[t(591)],o),n){case e[t(1321)]:return o&&o.length?Fs(o,0,this[t(999)+t(874)]):void 0;case e.LaNkI:return;case e[t(1051)]:return o&&o[t(805)]?e[t(910)](Fs,o,0,this._cursorFileName):p0()}}async[r(1928)](t,n,o){let x=r;if(e[x(605)]!==e[x(1162)])return console.log(x(1467),t,n,o),this[x(1133)][x(1928)]({cursor_name:t,cursor:n,service:o});this[x(1214)+x(1470)+x(1564)](_0x57ab37),_0x2c39d5[x(1928)](_0x1023f9,_0x208aae,_0x5cdaf1[x(1905)][x(1545)])}async[r(845)+"rs"](t){let n=r,o=e[n(1604)](g0,t);for(let x of o)console.log(e[n(632)],o),await this[n(1133)][n(1928)](x)}async[r(692)](t){let n=r;return(await this[n(1133)][n(692)](t))?.cursor}async[r(1148)](){let t=r;await this[t(1133)][t(1148)]()}[r(837)+r(1561)+"Name"](t){let n=r;this["_cursorF"+n(874)]=t}get isReady(){let t=r,n={wxBqG:function(o,x){return o!=x},rcQbl:t(1938),QkVea:function(o,x){return e[t(1836)](o,x)},WVnrg:function(o,x){return e.PPPCW(o,x)},AqIxS:e.ILWAb};return e[t(1399)]==="BrcuA"?XXXPfo[t(766)](XXXPfo[t(1712)],typeof _0x116412)&&(_0x3b3af3 instanceof _0x2720e2||_0x2a2773[t(603)]&&XXXPfo.QkVea(_0x5180d8.buffer,_0x46f0b5))||XXXPfo[t(1437)](XXXPfo.rcQbl,typeof _0x5aa2fe)?"":(_0x14f990.parse(_0x42dd61),XXXPfo[t(1210)]):this[t(1133)][t(1789)]}}let _0=e.MlsWG;async function Us(s){let t=r;if(!this[t(1135)][t(1686)+"S"])return null;let{aID:n,fpID:o,messageStrategy:x}=this[t(1135)],l=s||_0;try{return this[t(1546)+t(1612)]?s&&this["_cursorM"+t(1612)][t(837)+t(1561)+t(1181)](s):this["_cursorM"+t(1612)]=new m0(o+"_"+n+"_"+l,l,x),this[t(1546)+t(1612)][t(1789)]||await this[t(1546)+t(1612)][t(1457)](),this[t(1546)+t(1612)]}catch{return e[t(1333)](e[t(582)],e.XXuQa)?!!_0x3069b9?.[t(1960)](g=>g[t(1221)]===_0x562be4&&g.value===_0x4c6bd6):null}}async function w0(s,t){let n=r,o=We(s[n(1905)][n(849)],e.BVUWV,"-1"),x=e[n(469)](We,s.message[n(849)],"is_ack","1"),l=dt(s[n(1905)][n(849)],e[n(541)]),g=Number(dt(s[n(1905)][n(849)],e[n(1797)]))||0,p=wr[n(1255)](this,s),d=e[n(528)](We,s[n(1905)][n(849)],e[n(1085)],"2"),w=dt(s[n(1905)].headers,e[n(824)]),b=e.QCyBX(Number,e[n(1831)](dt,s[n(1905)][n(849)],n(935)+n(526)+"ue"));if(p[n(819)])return e[n(575)](t);let k=p[n(2033)+n(1357)]?await qs.call(this):null;if(e[n(1906)](s[n(1905)].service,0)&&x&&!o||e[n(786)](s[n(1905)][n(1545)],0)){if(l&&p["isQoSMes"+n(1357)]&&k)return!!!await k[n(692)](l)&&(this[n(1214)+n(1470)+n(1564)](s),await k[n(1928)](l,e.PBMrh(Date[n(1648)](),g))),e[n(1036)](t);if(d){let T=await Us[n(1255)](this);if(!T)return this[n(1214)+n(1470)+n(1564)](s),e[n(1036)](t);let R=await T[n(692)](w)??-1;if(R<b)e[n(1397)]===e[n(1913)]?(++_0x17fd12,_0x8dc285+=4):(this[n(1214)+n(1470)+n(1564)](s),T.set(w,b,s[n(1905)][n(1545)]));else throw new Error(n(1884)+" message"+n(1318)+b+(n(707)+n(1407)+n(1889)+"r ")+R);return e.kxfrL(t)}return this[n(1214)+n(1470)+n(1564)](s),e[n(2010)](t)}}async function y0(s,t){let n=r,o=wr[n(1255)](this,s);if(!o["isQoSMes"+n(1357)])return e.jVVso(t);let x=await qs[n(1255)](this);if(o[n(1494)+n(1666)+"age"]&&o[n(1588)+"s"][n(805)])for(let l of o[n(1588)+"s"])await x[n(1724)](l);e[n(2010)](t)}async function b0(s,t){let n=r,o=e[n(1503)](s[n(1905)].frameType,l0),x=e[n(960)](s.message[n(1406)+"e"],vr);if(e[n(1487)](!o,!x))return e[n(921)](t);let l=e[n(1022)](dt,s[n(1905)][n(849)],n(1629)+n(1292));if(!l)return t();let g=await Us[n(1255)](this,l);if(!g)return t();if(o){let p=await g[n(1899)+"rs"](),d={frameType:p?.[n(1406)+"e"],SeqID:q.fromNumber(this[n(1199)]++),LogID:q[n(1324)+"er"](this[n(1135)][n(1048)+n(777)]()),service:9e3,method:5,headers:p?.[n(849)],payload:p?.[n(930)]},w=e[n(1851)](S,d);this[n(951)]&&this._ws[n(1531)+"te"]&&this[n(951)][n(774)](w)}if(x){let p=s[n(1905)][n(930)];p&&g[n(845)+"rs"](p)}}let v0=async function(s,t){let n=r;this[n(988)]=!1,e[n(1409)](clearTimeout,this[n(1418)+n(834)+n(1329)]),e[n(1590)](t)},S0=async function(s,t){let n=r;if(!this[n(951)]||e.rBYZt(this._ws[n(1531)+"te"],this[n(687)]))return e[n(1400)](t);let{pingInterval:o}=this[n(1135)];this["_endpoin"+n(966)]?.["resetEnd"+n(1868)+n(741)]();for(let l=0;e[n(1579)](l,this["_message"+n(1825)][n(805)]);l++){let g=this[n(1989)+n(1825)][l];if(e.zGBBE(this[n(951)].readyState,this[n(687)])&&e[n(956)](null,g))if(e[n(446)](e.KJfmw,e[n(1677)]))this._ws&&this[n(951)][n(774)](g),this._messageQueue[l]=null;else{let p=this[n(1133)][n(1094)](this[n(1115)]),d=_0x4803eb.parse(e[n(1435)](p,"{}"));return _0x2c9588.values(d)}else break}this["_message"+n(1825)]=this["_message"+n(1825)][n(750)](l=>!!l),this[n(836)+n(447)+"Id"]=e[n(1586)](setTimeout,()=>this._ping(),o),this[n(1214)+"hOpenEvent"](s),this[n(626)+"er"]&&this[n(951)]&&(this._ws.binaryType=this[n(900)+n(1880)]);let x=this["_endpoin"+n(966)]?.[n(1025)+"ntEndpoint"]();this[n(593)](n(968)+x+n(1020)),e[n(566)](t)},C0=async function(s,t){let n=r,o=this["_endpoin"+n(966)]?.[n(1025)+"ntEndpoint"]();this._debug(n(968)+o),e[n(1778)](t)};class E0 extends pr{constructor(t){let n=r,o={GdtgX:function(x,l){return e[I(1585)](x,l)},JEFGL:e[n(1188)],gqxHJ:function(x,l,g,p){return e[n(528)](x,l,g,p)},ozlnI:function(x,l,g){return e.fRKGw(x,l,g)},Vckdq:e[n(1283)],Aoter:function(x,l,g){return e[n(1695)](x,l,g)},MWpvR:e[n(831)],lgoPl:e[n(1883)],USxQx:n(1996)+n(1534)+"s",nWqMC:function(x,l){return e[n(1750)](x,l)},ufSkm:e[n(1861)],ZbXVa:e.cCXhN,VatTe:function(x,l){return x===l},cWXts:e[n(1600)],jQIuG:function(x,l,g){return e[n(1061)](x,l,g)},zQCjv:function(x,l){return e[n(1106)](x,l)},ZIPuH:function(x,l){return e[n(1750)](x,l)},HEGJC:e[n(1736)],ZLdyh:e[n(636)],zyjkV:function(x,l){return e[n(1719)](x,l)},qkKly:e[n(728)],pPeNl:n(1783),fOAIx:n(1620),IMTkF:function(x,l){return e[n(2017)](x,l)},FABPc:function(x,l){return x(l)},pCoCV:function(x,l,g){return e[n(1231)](x,l,g)}};if(e[n(731)]===e[n(731)]){super(),this[n(1029)+"igatorOnline"]=!0,this[n(626)+"er"]=ft,this[n(520)]=Ua,this[n(1632)+"T"]=et,this[n(1644)+"X"]=Rt,this[n(1655)+"r"]=Bt,this[n(1989)+n(1825)]=[],this[n(672)+n(966)]=null,this[n(1867)+n(1449)]=!1,this["_binaryT"+n(1880)]=n(1480)+n(776),this[n(1418)+n(1149)]=!1,this["_connectionTimeo"+n(1329)]=null,this[n(1653)+n(1887)+"tId"]=null,this[n(836)+n(447)+"Id"]=null,this[n(1199)]=0,this[n(988)]=!1,this[n(790)]="",this[n(1258)+"ger"]=null,this[n(1546)+n(1612)]=null,this[n(902)+n(1739)]=null,this[n(1617)+"ls"]=e[n(1058)],this.CLOSED=3,this[n(1529)+"NG"]=0,this[n(687)]=1,this.CLOSING=2,this[n(1667)]=p=>{let d=n;try{if(o[d(1657)](o[d(1003)],o[d(1003)]))o[d(1049)](Rs,this,p,[v0,S0,C0]);else{let w=this[d(1133)][d(1094)](this[d(1115)]),b=_0x3cb3a4[d(1775)](w||"{}");return _0x1e0149.keys(b)}}catch(w){let b=o[d(1624)](pe,o[d(1940)],{message:w[d(1905)],code:je[d(1067)+"OR"],error:w});this["_dispatchErrorEv"+d(756)](b)}},this[n(1452)+"ge"]=async p=>{let d=n,w={GgSTg:function(T,R,B){return o[I(1944)](T,R,B)}},{pingInterval:b,pingFrequency:k}=this[d(1135)];if((p[d(1798)]==="hi"&&o.GdtgX(o[d(1075)],k)||o.GdtgX(o[d(1055)],k))&&(this[d(931)+d(1952)](),this[d(1691)](o.USxQx,d(554)),this[d(836)+"gTimeoutId"]=setTimeout(this[d(763)][d(459)](this),b)),!o[d(1657)]("hi",p[d(1798)]))try{if(o[d(1443)](o[d(2015)],o[d(1104)]))Rs(this,p,[n0,e0,y0,b0,w0,t0]);else{let T=w[d(1277)](_0x5c1a72,d(1063),{message:_0x11eb70.message,code:_0x2a3fca["MESSAGE_"+d(1286)],error:_0x131da9});this[d(1214)+d(1196)+"ent"](T)}}catch(T){if(o.VatTe(o[d(1680)],"NNFIB")){let R=o[d(1490)](pe,o[d(1940)],{message:T[d(1905)],code:je.MESSAGE_ERROR,error:T});this["_dispatc"+d(1196)+d(756)](R)}else _0x5b4c1d=d(2022),_0x55b7ef=_0x1fe72b[d(621)](/(^http)((?:[s]*:\/\/))/,""),_0x28d304=/(^ws)((?:[s]*:\/\/))/[d(1973)](_0x35e781)?_0x640622:""+_0x440281+_0x261af9}},this[n(536)]=p=>{let d=n,w=this[d(672)+d(966)]?.["checkRea"+d(1134)+"es"](),b=this[d(672)+d(966)]?.[d(1025)+d(990)+"nt"]();if(w&&!p[d(1905)]){let k=d(1853)+b+(d(1918)+d(1698)+d(449)+"ed");this[d(1214)+"hErrorEvent"](e.NjZzC(pe,e.LhGNs,{message:k,code:je[d(629)+"IES_ERROR"],error:p}));return}this._ws&&this[d(951)][d(1531)+"te"]===this[d(687)]&&this[d(634)+"ect"](),this[d(1214)+d(1196)+d(756)](e.kbAqi(pe,e[d(1283)],{message:p[d(1905)],code:je[d(1340)+d(1729)],error:p}))},this[n(656)]=async p=>{let d=n;this._clearTimer(),this["_clearPi"+d(1952)](),this[d(461)+"sListeners"](),this[d(951)]=null,this["_connect"+d(1149)]=!1;let w=this[d(672)+"tManager"]?.[d(1615)+"chMaxTries"]();if(!w&&this[d(1943)+d(1727)]()&&!this[d(1867)+d(1449)]){let b=this[d(672)+"tManager"]?.["getCurre"+d(990)+"nt"](),k=this[d(1135)][d(1126)+d(1173)+"ptor"](p.code,p.reason);this[d(1214)+"hCloseEvent"](o.Aoter(ye,o.ZLdyh,{code:1006,reason:p[d(923)]||"connecti"+d(822)+d(1110)+d(1954)+d(1645)+"ame: "+b,willReconnect:k})),k&&this[d(1418)]();return}if(o[d(982)](1e3,p[d(1123)])&&this[d(1867)+d(1449)])if(o.qkKly===o[d(1384)])this[d(1943)+d(1727)]()&&(!this[d(951)]||o[d(671)](this[d(951)].readyState,this[d(687)])||o[d(1518)](this._ws[d(1531)+"te"],this[d(1529)+"NG"]))&&this[d(2008)+"nLine"](),this[d(626)+"er"]&&_0x251614[d(771)+d(1244)](d(898),this["_handleO"+d(1486)]),this._isBrowser&&_0x3d04c4[d(771)+d(1244)](o[d(1059)],this[d(2008)+d(1509)]);else{this[d(1214)+d(592)+d(756)](o.jQIuG(ye,o[d(936)],{code:1e3,reason:o.fOAIx})),this[d(672)+"tManager"]?.[d(535)+"pointConfig"](),this[d(902)+d(1739)]?.[d(1136)+d(946)]();return}if(o[d(1584)](1e3,p[d(1123)])&&w){let b=this[d(672)+d(966)]?.["getCurre"+d(990)+"nt"](),k=p[d(923)];k||(k=await o[d(489)](Va,this[d(790)])),k=d(1713)+d(822)+"d, "+k+(", hostna"+d(1898))+b+(d(1567)+"tries re"+d(1556)),this["_dispatc"+d(592)+"ent"](o[d(1944)](ye,o[d(936)],{code:p.code,reason:k}));let T=d(1853)+b+(" fail, m"+d(1698)+"es reached");this[d(1214)+"hErrorEv"+d(756)](o[d(1646)](pe,d(1063),{message:T,code:je[d(629)+d(907)+"R"]})),this[d(672)+d(966)]?.["resetEnd"+d(1868)+d(741)](),this[d(902)+d(1739)]?.[d(1136)+"nter"]();return}if(p[d(1123)]!==1e3&&!p[d(923)]){let b=this[d(672)+d(966)]?.["getCurre"+d(990)+"nt"]();this[d(1214)+d(592)+d(756)](o[d(1944)](ye,o[d(936)],{code:p.code,reason:d(1713)+d(822)+"d, unkno"+d(1954)+d(1645)+d(1776)+b})),this._endpointManager?.[d(535)+d(1868)+d(741)](),this["_pingLos"+d(1739)]?.[d(1136)+d(946)]();return}this[d(1214)+d(592)+d(756)](p),this[d(672)+"tManager"]?.[d(535)+d(1868)+d(741)](),this["_pingLos"+d(1739)]?.[d(1136)+d(946)]()},this[n(1290)]=null,this[n(1248)]=null,this.onmessage=null,this.onopen=null,this[n(1568)+"econnect"]=null,this[n(1091)+n(481)]=null,this[n(1206)+n(1819)+"yReconnect"]=null,this[n(2008)+"nLine"]=this[n(2008)+"nLine"][n(459)](this),this[n(2008)+"ffLine"]=this[n(2008)+n(1509)][n(459)](this),this[n(1984)+"ageHide"]=this[n(1984)+n(444)][n(459)](this),this[n(1984)+"ageShow"]=this["_handleP"+n(1818)][n(459)](this),this._options={url:"",automaticOpen:!0,initReconnectInterval:1e3,maxReconnectInterval:1e4,reconnectIntervalGrowFactor:2,timeoutInterval:5e3,maxRetries:5,debug:!1,maxMessageQueueLength:e.RMRQG(1,0),service:0,logIDGenerator:c,headers:void 0,payloadEncoding:"",payloadType:"",fpID:"",deviceID:"",accessKey:"",ttwID:"",bddID:"",aID:"",disableAutoReconnect:!1,customParams:{},pingInterval:15e3,pingTimeoutInterval:4e3,pingFrequency:e[n(1883)],pingLossCount:2,enableTransformTextPayload:!1,logIDNewConfig:{enableAutoGenerateLogIDNew:!1,userIp:""},miniProgramParams:{customHttpHeader:{}},enableAutoAck:!1,reconnectInterceptor:()=>!0,enableQoS:!1,QoSLevel:2,messageStrategy:e.BRYsE,env:{xTTEnv:"",xUseEnv:""},listenNetworkChanged:!0};let{url:x,ws:l}=t,g=Array[n(710)](x)?x:e[n(1090)](e.uiyxx,typeof x)?[x]:[];if(!g||g[n(805)]===0)throw new Error(e[n(889)]);if(!e[n(658)](Ha,l))throw new Error(e.GWXaM);if(Object[n(893)](this[n(1135)],t),this[n(672)+"tManager"]=new Ls(g,this[n(1135)].maxRetries),this[n(902)+n(1739)]=new Ja(this[n(1135)][n(1881)+n(643)]),this[n(1135)][n(1650)+n(925)])if(e[n(830)](e.ZrRfb,e[n(1451)])){let{SeqID:p,LogID:d,service:w,LogIDNew:b,method:k}=_0x748ae6.message;this[n(1799)]({SeqID:p,LogID:d,LogIDNew:b,service:w,method:k,headers:[{key:e[n(1438)],value:"1"},{key:e.Nzkgs,value:e[n(1245)](b,"")},{key:e[n(607)],value:"0"}]})}else this[n(988)]=!0,this[n(1418)]();if(this[n(1135)][n(1046)+"tworkChanged"]){if(e[n(934)](e[n(1325)],e[n(1325)]))return new _0x474ee2(e[n(471)](e[n(764)](e[n(1547)](_0xd5290d[0],e[n(809)](_0xc2477b[1],8)),_0xfe220f[2]<<16),e[n(691)](_0x227aa7[3],24)),e[n(663)](e[n(1111)](_0x56375f[4]|e.vKOTW(_0x506d4d[5],8),e[n(1395)](_0x5144a3[6],16)),e[n(1098)](_0x7db492[7],24)),_0xb15d20);this[n(1632)+"T"]||this[n(1644)+"X"]?this[n(2012)+n(631)+"ange"]():this._isBrowser&&this[n(1858)+n(1555)+n(1244)]()}}else this[n(1691)](n(760),_0x2743d4),this.onclose&&this[n(1290)](_0x3e6d5e)}[r(2008)+r(1486)](){let t=r;this[t(1135)][t(628)+t(496)+"nect"]||this[t(1867)+t(1449)]||this[t(1375)+t(906)]()}[r(2008)+r(1509)](){let t=r;this[t(864)+t(986)+"t"]();let n=e.hiTTS(gr,e[t(677)],{message:e.CCAxf});this[t(1206)+t(1819)+"yReconnect"]&&this[t(1206)+"mediatel"+t(2009)+"ct"](n)}[r(1858)+r(1555)+"Listener"](){let t=r;this._isBrowser&&window[t(771)+t(1244)](e.AKIKl,this["_handleO"+t(1486)]),this[t(626)+"er"]&&window[t(771)+t(1244)](e[t(1736)],this[t(2008)+t(1509)]),this[t(626)+"er"]&&window[t(771)+t(1244)](e[t(1697)],this["_handleP"+t(444)]),this._isBrowser&&window[t(771)+"Listener"](e[t(1323)],this[t(1984)+"ageShow"])}[r(926)+r(1555)+r(1244)](){let t=r;this[t(626)+"er"]&&window[t(1174)+t(1192)+"ner"]("online",this[t(2008)+t(1486)]),this[t(626)+"er"]&&window[t(1174)+t(1192)+"ner"](e.wivBR,this[t(2008)+"ffLine"]),this._isBrowser&&window["removeEv"+t(1192)+t(1864)](e[t(1697)],this["_handleP"+t(444)]),this._isBrowser&&window.removeEventListener(e[t(1323)],this[t(1984)+t(1818)])}["_handleP"+r(444)](t){let n=r;!t.persisted&&(this[n(626)+"er"]&&window.removeEventListener(e[n(1697)],this[n(1984)+"ageHide"]),this[n(626)+"er"]&&window[n(1174)+n(1192)+n(1864)](e[n(1323)],this[n(1984)+n(1818)]),this[n(760)]()),this[n(626)+"er"]&&window["removeEv"+n(1192)+n(1864)](e[n(919)],this[n(2008)+n(1486)]),this[n(626)+"er"]&&window[n(1174)+n(1192)+"ner"](e.wivBR,this["_handleO"+n(1509)])}[r(1984)+r(1818)](t){let n=r;t[n(1628)+"d"]&&(this[n(1943)+n(1727)]()&&(!this[n(951)]||e[n(1512)](this[n(951)].readyState,this[n(687)])||e[n(894)](this[n(951)][n(1531)+"te"],this[n(1529)+"NG"]))&&this[n(2008)+n(1486)](),this._isBrowser&&window[n(771)+n(1244)](e[n(919)],this[n(2008)+n(1486)]),this[n(626)+"er"]&&window["addEvent"+n(1244)](e[n(1736)],this["_handleO"+n(1509)]))}async[r(1875)+r(556)](t){let n=r,{fpID:o,deviceID:x,bddID:l,ttwID:g,accessKey:p,aID:d,customParams:w={},enableAutoAck:b,enableQoS:k,QoSLevel:T,env:R}=this[n(1135)],B,V,se;if(this[n(626)+"er"]||this[n(1644)+"X"]||this._isMiniTT){if(e[n(1951)]===e[n(1537)])return _0x33a5d1[n(1440)](Ngmsny.uYIJh(_0x3850ae,this),_0x5c0303),Ngmsny[n(1293)](_0x1afee6,_0x1ae7ec[n(692)](this));B=location&&e[n(1757)](e[n(1006)],location.protocol)?e[n(1112)]:e[n(1311)],V=t.replace(/((^ws)|(^http))((?:[s]*:\/\/))/,""),se=/^wss(.*:\/\/)/[n(1973)](t)?t:""+B+V}else B=n(2022),V=t[n(621)](/(^http)((?:[s]*:\/\/))/,""),se=/(^ws)((?:[s]*:\/\/))/[n(1973)](V)?V:""+B+V;let re=l?e.ImUeg:g?n(1288):n(1792)+"d",Ee=l||g||x;if(e[n(829)](!Ee,!re))throw new Error(e[n(1253)]);let lt=e[n(812)](e.TUJzi,typeof w)?await e.AbLmQ(w):w,ce=R?Wa(R.xUseEnv,R[n(1132)]):{},ht=Object[n(893)]({device_platform:e[n(1953)],version_code:n(810)+"0",access_key:p,fpid:o,aid:d,[re]:Ee,xsack:b?1:0,xaack:b?1:0,xsqos:k?1:0,qos_level:k?T:void 0,qos_sdk_version:2,...ce},lt),Mt=Object.keys(ht)[n(1066)]((nt,te)=>ht[te]!==void 0?""+nt+(nt?"&":"?")+te+"="+ht[te]:nt,"");return se+n(1352)+Mt}async _connect(){let t=r;if(!(this[t(1418)+t(1149)]||this[t(1867)+t(1449)])){this["_connect"+t(1149)]=!0;try{let n=this["_endpoin"+t(966)]?.[t(524)+t(602)+t(911)+t(662)+t(1250)](),{timeoutInterval:o}=this[t(1135)];if(n){let l=this[t(672)+t(966)]?.[t(1025)+"ntEndpoint"](),g=this[t(672)+t(966)]?.[t(1124)+t(1229)+t(972)+"UpdateCo"+t(1703)](),p=this[t(672)+"tManager"]?.[t(1025)+t(990)+t(1544)+t(1271)]();if(g){let d=t(1853)+l+(t(1610)+", max re"+t(971)+t(644)+t(453)+"backup e"+t(1790))+g+(t(1390)+"y"),w=e[t(1141)](pe,e[t(1283)],{message:d,code:je[t(629)+t(907)+"R"]});this._debug(d),this[t(1214)+"hErrorEv"+t(756)](w),this[t(790)]=await this[t(1875)+t(556)](g),this[t(593)]("connect "+g+" "+p+t(675)),this[t(461)+t(1834)+"rs"]()}else{let d="connect "+l+(t(1610)+t(1567)+t(971)+t(1556));this[t(593)](d),this[t(1214)+t(1196)+"ent"](e[t(1548)](pe,e.LhGNs,{message:d,code:je[t(629)+t(907)+"R"]}));return}}else if(e[t(1211)](e[t(1597)],e.CANkd))this[t(1029)+t(1303)+t(1396)]=_0x1b75c3,_0x3796e1?this[t(2008)+t(1486)]():this[t(2008)+t(1509)]();else{let l=this["_endpoin"+t(966)]?.[t(1025)+t(990)+t(695)+t(754)](),g=this[t(672)+t(966)]?.[t(1025)+t(990)+"ntTriesC"+t(1271)]();this[t(790)]=await this[t(1875)+t(556)](e.PXQzk(l,"")),this[t(593)](t(1853)+l+" "+g+" times"),this._removeWsListeners()}if(this[t(988)])this[t(988)]=!1;else{let l=e[t(665)](gr,e.nCckg,{message:"start"});this["onStartR"+t(906)]&&this[t(1568)+t(906)](l)}let x=this[t(672)+t(966)]?.[t(1025)+t(990)+t(1544)+t(1271)]()||0;e[t(1416)](x,1)&&await this[t(1652)](e.Uwjnv(x,1)),this[t(593)]("connecti"+t(1089)+this[t(790)]+(t(549)+t(1379))+this._protocols),this[t(951)]=e[t(1141)](Ga,{url:this[t(790)],protocols:[this[t(1617)+"ls"]],headers:this[t(1135)][t(1541)+t(1164)+"s"][t(1249)+"tpHeader"]},this[t(1135)].ws),(this[t(626)+"er"]||this[t(1655)+"r"])&&this._ws&&(this[t(951)][t(1432)+"pe"]=this[t(900)+"ype"]),this[t(651)+t(1304)](),this[t(1418)+t(834)+"utId"]=e[t(1021)](setTimeout,this[t(1533)+"ut"].bind(this),o)}catch(n){throw this[t(1418)+t(1149)]=!1,n}}}["_clearTi"+r(987)](){let t=r;e[t(924)](clearTimeout,this["_connect"+t(834)+"utId"]),this["_connect"+t(834)+t(1329)]=null}[r(931)+r(1952)](){let t=r;e[t(1949)](clearTimeout,this[t(836)+t(447)+"Id"]),e.HoGaq(clearTimeout,this[t(1653)+t(1887)+t(1839)]),this[t(836)+t(447)+"Id"]=null,this[t(1653)+t(1887)+t(1839)]=null}_debug(...t){let n=r;e.cMura(e.PatEG,e.PatEG)?(e[n(1977)](_0x1f3f96,_0x572028,50),e[n(847)](_0x20a81f,_0x27e1b1,_0x1190a9)):this[n(1135)][n(464)]&&console[n(1892)][n(1440)](console,[n(1208)+">",...t])}[r(1519)+r(1997)+"e"](t){let n=r;if(e.ZtkAD(e[n(473)],e[n(473)]))return _0x3d73eb+=_0x429f51&&_0x24cdab[n(1125)+"th"]||0,_0x3cad61;{let{initReconnectInterval:o,maxReconnectInterval:x,reconnectIntervalGrowFactor:l}=this[n(1135)],g=e[n(574)](o,Math[n(627)](l,e[n(523)](t,1)));return g>x?x:g}}[r(763)](){let t=r;if(this[t(951)]&&e[t(701)](this[t(951)].readyState,this[t(1529)+"NG"])){this[t(931)+t(1952)](),this[t(836)+t(447)+"Id"]=e[t(715)](setTimeout,this[t(763)][t(459)](this),this._options[t(1961)+t(579)]);return}if(!this[t(951)]||e[t(1211)](this[t(951)].readyState,this[t(687)]))return void this[t(1375)+t(906)]();this[t(951)]&&this[t(951)][t(774)]("hi"),this["_reconnectTimeou"+t(1839)]=setTimeout(this[t(1375)+t(906)+t(808)][t(459)](this),this._options[t(991)+t(1130)+"val"])}[r(1375)+r(906)+"Timeout"](){let t=r;this._pingLossCounter?.addCount(),this[t(1691)](e[t(1872)],e.HwVau),this["_pingLos"+t(1739)]?.[t(1615)+"chMaxCount"]()?this[t(1375)+t(906)]():this[t(763)]()}[r(1943)+r(1727)](){let t=r;return this[t(1632)+"T"]||this[t(1644)+"X"]?this[t(1029)+t(1303)+t(1396)]:(this[t(626)+"er"]||this[t(1655)+"r"])&&this._options[t(1046)+t(1348)+t(1483)]?navigator[t(1823)]:!0}["_handleR"+r(906)](){let t=r;!this[t(1943)+t(1727)]()||this["_readyCl"+t(1449)]||(this[t(672)+t(966)]?.[t(535)+"pointCon"+t(741)](),this["_pingLos"+t(1739)]?.[t(1136)+t(946)](),this[t(951)]?this[t(634)+t(599)](1001,e[t(1296)],!0):this[t(1418)]())}[r(2012)+r(631)+r(806)](){let t=r,n={ZSUrv:function(o,x){return e[I(488)](o,x)},iyZZp:function(o,x){return e.tZhIU(o,x)}};this[t(1632)+"T"]?tt[t(1371)+"kStatusC"+t(608)](({isConnected:o})=>{let x=t;if(n[x(952)]("VujcL","VujcL")){let l={LWzKq:function(g,p){return OLHDYy.ZSUrv(g,p)}};return function(g,...p){let d=x,w=_0x4d27bb[d(1255)](l[d(664)](_0x5bbb5d,this),g,...p);return _0x1109f4[d(1928)](w,g.sort?g[d(850)]():[g]),l[d(664)](_0x32f367,w)}}else this["_miniNav"+x(1303)+x(1396)]=o,o?this["_handleO"+x(1486)]():this._handleOffLine()}):this[t(1644)+"X"]&&wx[t(1371)+t(1618)+"hange"](({isConnected:o})=>{let x=t;this[x(1029)+"igatorOn"+x(1396)]=o,o?this[x(2008)+"nLine"]():this["_handleO"+x(1509)]()})}[r(1652)](t){return new Promise(n=>{let o=I;e.kbAqi(setTimeout,n,this[o(1519)+o(1997)+"e"](t))})}[r(634)+"ect"](t=1e3,n="",o=!1){let x=r;this._ws&&this[x(864)+x(986)+"t"](t,n,o)}[r(1533)+"ut"](){let t=r,n=this[t(672)+t(966)]?.["getCurre"+t(990)+"nt"]();this[t(593)](t(1853)+n+t(1610)),this[t(634)+t(599)](1001,e[t(730)],!0)}[r(1799)](t){let n=r,o=e[n(1725)](hr,t);this[n(951)]&&e.JHXmJ(this[n(951)][n(1531)+"te"],this.OPEN)&&(this[n(951)]&&this[n(951)][n(774)](o),this[n(593)](e[n(1575)],t))}["_removeW"+r(1834)+"rs"](){let t=r,n=e[t(654)][t(1821)]("|"),o=0;for(;;){switch(n[o++]){case"0":this[t(951)]["removeEv"+t(1192)+t(1864)](e[t(690)],this._onMessage);continue;case"1":this[t(951)][t(1174)+"entListener"](e[t(636)],this._onClose);continue;case"2":if(!this._ws)return;continue;case"3":this._ws[t(1174)+t(1192)+t(1864)](e[t(1283)],this[t(536)]);continue;case"4":this._ws[t(1174)+t(1192)+t(1864)](e[t(1981)],this[t(1667)]);continue}break}}[r(651)+r(1304)](){let t=r,n=e[t(775)][t(1821)]("|"),o=0;for(;;){switch(n[o++]){case"0":this[t(951)][t(771)+t(1244)](e[t(636)],this._onClose);continue;case"1":this[t(951)][t(771)+t(1244)](e[t(690)],this[t(1452)+"ge"]);continue;case"2":if(!this[t(951)])return;continue;case"3":this._ws[t(771)+t(1244)](t(791),this[t(1667)]);continue;case"4":this[t(951)][t(771)+t(1244)](t(1063),this[t(536)]);continue}break}}[r(1275)+r(1285)](t=1e3,n=""){let o=r;try{this._ws&&this[o(951)][o(760)](t,n)}catch{}}[r(864)+r(986)+"t"](t=1e3,n="",o=!1){let x=r;if(this[x(931)+x(1952)](),this[x(1491)+x(987)](),this[x(461)+x(1834)+"rs"](),this[x(1275)+x(1285)](1e3,n),this._connectLock=!1,o&&this[x(1943)+x(1727)]()&&!this["_readyCl"+x(1449)]){if(this["_endpoin"+x(966)]?.[x(1615)+x(1134)+"es"]()){let g=this["_endpoin"+x(966)]?.[x(1025)+"ntEndpoint"]();this["_dispatchCloseEv"+x(756)](e[x(958)](ye,"close",{code:1006,reason:x(1853)+g+(x(1610)+x(1567)+x(971)+x(1556)),wasClean:!0}))}else{let g=this[x(1135)][x(1126)+x(1173)+"ptor"](t,n);this[x(1214)+x(592)+x(756)](e[x(1695)](ye,x(760),{code:t,reason:n,wasClean:!0,willReconnect:g})),g&&this[x(1418)]()}return}this[x(1943)+x(1727)]()||this[x(1867)+x(1449)]?this[x(1214)+x(592)+"ent"](e[x(1022)](ye,x(760),{code:t,reason:e.cGzFN})):this[x(1214)+"hCloseEv"+x(756)](e[x(1259)](ye,e[x(636)],{code:1006,reason:e.LQoih})),this[x(951)]=null,this[x(672)+x(966)]?.[x(535)+x(1868)+x(741)](),this[x(902)+"sCounter"]?.[x(1136)+x(946)]()}["_dispatc"+r(1071)+"nt"](t){let n=r;this[n(1691)](e[n(1981)],t),this.onopen&&this[n(1642)](t)}[r(1214)+"hMessage"+r(1564)](t){let n=r;this[n(1691)](e[n(690)],t),this[n(1460)+"e"]&&this[n(1460)+"e"](t)}["_dispatc"+r(1086)+r(1473)](t){let n=r;this[n(1691)](e[n(1513)],t),this[n(1091)+"eAck"]&&this[n(1091)+n(481)](t)}["_dispatc"+r(1196)+r(756)](t){let n=r;this[n(1691)](n(1063),t),this[n(1248)]&&this[n(1248)](t)}["_dispatc"+r(592)+r(756)](t){let n=r;this[n(1691)](e[n(636)],t),this[n(1290)]&&this[n(1290)](t)}get binaryType(){let t=r,n={Ialwi:t(559)+"4",ugdxt:function(o,x){return o+x},LZEAX:function(o,x){return e[t(1684)](o,x)},PHBMx:function(o,x,l,g){return e[t(910)](o,x,l,g)},VFEDU:function(o,x){return o+x}};if(e[t(1004)](t(1599),e[t(974)]))return this[t(951)]?this[t(951)].binaryType:this["_binaryT"+t(1880)];{let o=n[t(826)].split("|"),x=0;for(;;){switch(o[x++]){case"0":if(_0x568f7a.write)return fzrMAJ[t(1475)](_0x486963[t(683)](_0x2bf2e3,_0x5b05f8),_0xd7fe8a);continue;case"1":if(_0x1cff51[t(1082)+"e"])return fzrMAJ[t(1475)](_0x5cbedc[t(1082)+"e"](_0x2a8d7b,_0x114c0e),_0x7ccc61);continue;case"2":if(fzrMAJ[t(682)](_0x1ba2f2[t(805)],40))return fzrMAJ.ugdxt(fzrMAJ.PHBMx(_0x41aa4b,_0x26bc6a,_0xfc712c,_0x795699),_0x164f98);continue;case"3":if(!_0x438868)return _0x165d52;continue;case"4":return fzrMAJ[t(1332)](_0x578d5e(_0x3ee8da,_0x155938,_0x4e13a2),_0x498608)}break}}}set[r(1432)+"pe"](t){let n=r;this[n(900)+n(1880)]=t,this[n(951)]&&(this._ws[n(1432)+"pe"]=t)}get[r(781)+"nt"](){let t=r;return this["_endpoin"+t(966)]?.[t(1025)+t(990)+t(1544)+t(1271)]()||0}get[r(1925)+r(1708)](){let t=r,n={MtahX:function(x,l){return e[I(1551)](x,l)}},o=this[t(1989)+t(1825)][t(1066)]((x,l)=>{let g=t;if(e[g(1585)](g(1404),e.yfSfE))return x+=l&&l[g(1125)+"th"]||0,x;{let p=this[g(1989)+"Queue"][g(1066)]((d,w)=>(d+=w&&w.byteLength||0,d),0);return n[g(915)](p,this[g(951)]?this._ws[g(1925)+"Amount"]:0)}},0);return e[t(733)](o,this[t(951)]?this[t(951)][t(1925)+"Amount"]:0)}get[r(1194)+"ns"](){let t=r;return this[t(951)]?this[t(951)][t(1194)+"ns"]:""}get[r(1845)](){let t=r;return this[t(951)]?this[t(951)][t(1845)]:""}get[r(1531)+"te"](){let t=r;return t(844)==="ZpYyY"?this[t(1809)][t(1962)]:this[t(951)]?this[t(951)].readyState:this[t(1135)][t(1650)+t(925)]?this[t(1529)+"NG"]:this[t(1637)]}get[r(1962)](){let t=r;return this[t(951)]?this[t(951)][t(1962)]:this._url}[r(760)](t=1e3,n){let o=r,x=e[o(1709)][o(1821)]("|"),l=0;for(;;){switch(x[l++]){case"0":this[o(931)+"ngTimer"]();continue;case"1":if(!this[o(951)])return void this[o(593)](e[o(440)]);continue;case"2":this[o(864)+"WebSocket"](t,n);continue;case"3":if(e[o(1781)](this[o(951)][o(1531)+"te"],this[o(1637)])||e.PvAyB(this[o(951)][o(1531)+"te"],this[o(456)]))return void this[o(593)](e[o(1832)]);continue;case"4":this["_dropGlo"+o(1555)+o(1244)]();continue;case"5":this["_QoSMana"+o(1856)]?.[o(1148)]();continue;case"6":this[o(1491)+o(987)]();continue;case"7":this[o(1867)+o(1449)]=!0;continue}break}}async[r(774)](t,n){let o=r;if(e[o(1090)](null,t))throw new Error(o(1838)+o(1364)+o(588)+o(1010)+"a must b"+o(1236)+"ng or an"+o(1426)+o(1145));e[o(916)]==typeof t&&(t=JSON.stringify(t)),e[o(1198)](e[o(1402)],typeof t)&&!e[o(1606)](t,ArrayBuffer)&&!(t[o(603)]&&t[o(603)]instanceof ArrayBuffer)&&(t=JSON[o(458)+"y"](t));let x=await e[o(474)](Os,t),l=e[o(1794)](ja,t),{method:g=0,service:p=this[o(1135)][o(1545)],logID:d=this._options["logIDGen"+o(777)](),headers:w=this._options[o(849)],payloadEncoding:b=this[o(1135)][o(823)+o(597)],payloadType:k=this[o(1135)][o(1414)+o(1880)],logIDNew:T=this._options[o(1651)+o(1346)]["enableAu"+o(1421)+o(980)+"ew"]?a(this[o(1135)][o(1651)+o(1346)][o(583)]):""}=e[o(1389)](n,{});if(!p)throw new Error(e[o(558)]);let R={SeqID:q[o(1324)+"er"](this._seqId++),LogID:q[o(1324)+"er"](d),service:p,method:g,headers:w,payloadEncoding:e[o(782)](b,Object)?b[o(685)]?b.encoding:"":b,payloadType:e[o(1606)](k,Object)?k[o(1265)]?k[o(1265)]:l:k||l,payload:x,LogIDNew:T},B=e[o(1239)](hr,R);return this[o(951)]&&this._ws[o(1531)+"te"]===this[o(687)]?e[o(2005)](e[o(1297)],e[o(564)])?(this[o(951)]&&this._ws[o(774)](B),this[o(593)](e[o(487)],R)):this[o(1133)]?.[o(1724)](_0x51f63a[o(1742)+"id"]):e[o(590)](this["_message"+o(1825)][o(805)],this[o(1135)][o(1840)+o(1484)+o(1692)])?(this[o(1989)+"Queue"].push(B),this[o(593)](e[o(1625)],R)):(this[o(1989)+o(1825)][o(1387)](),this["_message"+o(1825)][o(577)](B)),{seqID:this[o(1199)],logID:d,logIDNew:T}}async[r(1126)+"t"](t){let n=r,{url:o}=e.FcNyo(t,{}),x=Array.isArray(o)?o:e[n(1757)](e[n(1402)],typeof o)?[o]:[];t&&Object[n(893)](this[n(1135)],t),x&&x[n(805)]?this[n(672)+n(966)]=new Ls(x,this[n(1135)].maxRetries):this[n(672)+n(966)]?.[n(535)+n(1868)+n(741)](),this[n(902)+n(1739)]?.resetCounter(this[n(1135)][n(1881)+n(643)]),this[n(1867)+"osed"]=!1,this[n(951)]&&e.OKgtd(this[n(951)][n(1531)+"te"],this.CLOSED)?this[n(634)+n(599)](1e3,e[n(1535)],!0):(this[n(988)]=!0,this[n(1418)]())}async[r(1339)](){let t=r;if(!this[t(1418)+t(1149)]){let n=e.QTeAC[t(1821)]("|"),o=0;for(;;){switch(n[o++]){case"0":this._endpointManager?.[t(535)+t(1868)+t(741)]();continue;case"1":this["_pingLos"+t(1739)]?.[t(1136)+"nter"]();continue;case"2":this[t(988)]=!0;continue;case"3":this["_readyCl"+t(1449)]=!1;continue;case"4":this._connect();continue}break}}}[r(771)+r(1244)](t,n){this.on(t,n)}[r(1107)+r(1564)](t){let n=r,{type:o}=t;this[n(1691)](o,t)}[r(1174)+r(1192)+r(1864)](t,n){let o=r,x={mvFNQ:function(l,g){return e[I(530)](l,g)},XkjQM:function(l,g){return l|g},bfqRm:function(l,g){return e[I(1433)](l,g)},DnFAZ:function(l,g){return e.dsWzC(l,g)},ZBoyw:function(l,g){return e[I(460)](l,g)},JUjsE:function(l,g){return l<<g},PcrFk:function(l,g){return e[I(1569)](l,g)},vkkYo:function(l,g){return e[I(1492)](l,g)}};if(e[o(1147)](e[o(1563)],o(965)))return new _0x3315d7(QSwHAW[o(853)](QSwHAW.XkjQM(QSwHAW[o(853)](QSwHAW[o(1963)](_0x4ac589[4],24),_0x96ae3[5]<<16),QSwHAW.bfqRm(_0x1bb430[6],8)),_0x24f9a8[7]),QSwHAW[o(853)](QSwHAW[o(1179)](QSwHAW[o(1948)](QSwHAW[o(1241)](_0x816b91[0],24),QSwHAW[o(699)](_0xb3874[1],16)),QSwHAW[o(1068)](_0x3c39d8[2],8)),_0x1df12d[3]),_0x55cc30);this[o(486)](t,n)}[r(1804)](){let t=r,n={ueaVu:function(o,x){return o(x)},XARVI:t(1488),NdQcA:e[t(475)],DuqVn:e.sLlyu,FPsrq:function(o,x){return e[t(519)](o,x)},ummEo:e.SSUCl,NrAqM:function(o,x,l){return e[t(1016)](o,x,l)}};return new Promise((o,x)=>{let l=t,g={IzdJF:function(w,b){return n[I(787)](w,b)},DVKFR:n.ummEo,eVuQF:l(1996)+"e_success",PbUrR:n[l(509)]};this[l(931)+l(1952)](),this[l(836)+l(447)+"Id"]=n.NrAqM(setTimeout,this[l(763)][l(459)](this),this[l(1135)][l(1961)+l(579)]);let p=()=>{let w=l;g.IzdJF(o,g[w(1611)]),this[w(486)](g.eVuQF,p),this[w(486)](g[w(1837)],d)},d=()=>{let w=l;n[w(1228)](x,n[w(1538)]),this[w(486)](n.NdQcA,p),this.off(n[w(509)],d)};this.on(n[l(1502)],p),this.on(n[l(509)],d),this._ping()})}}})(),Q[E(1640)+E(568)]=Y.CustomCloseEvent,Q[E(1077)+E(1768)]=Y["CustomEr"+E(1768)],Q[E(1635)+"e"]=Y[E(1635)+"e"],Q[E(1564)]=Y.Event,Q[E(1897)]=Y[E(1897)],Q[E(765)+E(2020)+E(1852)]=Y[E(765)+E(2020)+E(1852)],Q[E(2020)+"vent"]=Y[E(2020)+"vent"],Q[E(1172)+"t"]=Y[E(1172)+"t"],Q[E(1466)+E(1337)]=Y["Reconnec"+E(1337)],Q[E(448)+E(568)]=Y[E(448)+"oseEvent"],Q[E(1017)+E(1768)]=Y["createEr"+E(1768)],Q[E(1826)+E(1915)+"nt"]=Y[E(1826)+E(1915)+"nt"],Q[E(1197)+E(619)]=Y[E(1197)+E(619)],Q["createRe"+E(711)+E(1852)]=Y.createReconnectEvent,Q[E(1536)+"rame"]=Y["decodedF"+E(1237)],Q[E(1317)+E(477)]=Y[E(1317)+"ame"];for(On in Y)["CustomCl"+E(568),E(1077)+E(1768),E(1635)+"e","Event",E(1897),"Frontier"+E(2020)+E(1852),E(2020)+E(1852),"OpenEvent","Reconnec"+E(1337),E(448)+E(568),E(1017)+E(1768),E(1826)+E(1915)+"nt",E(1197)+"enEvent",E(1992)+"connectE"+E(1852),E(1536)+E(1237),E(1317)+E(477)][E(1187)](On)===-1&&(Q[On]=Y[On]);var On;Object[E(1383)+E(1417)](Q,"__esModule",{value:!0})});var Fe=de((vg,co)=>{"use strict";var oo=["nodebuffer","arraybuffer","fragments"],ao=typeof Blob<"u";ao&&oo.push("blob");co.exports={BINARY_TYPES:oo,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:ao,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var Vt=de((Sg,Hn)=>{"use strict";var{EMPTY_BUFFER:Yx}=Fe(),Fr=Buffer[Symbol.species];function $x(r,e){if(r.length===0)return Yx;if(r.length===1)return r[0];let i=Buffer.allocUnsafe(e),a=0;for(let c=0;c<r.length;c++){let u=r[c];i.set(u,a),a+=u.length}return a<e?new Fr(i.buffer,i.byteOffset,a):i}function xo(r,e,i,a,c){for(let u=0;u<c;u++)i[a+u]=r[u]^e[u&3]}function uo(r,e){for(let i=0;i<r.length;i++)r[i]^=e[i&3]}function Zx(r){return r.length===r.buffer.byteLength?r.buffer:r.buffer.slice(r.byteOffset,r.byteOffset+r.length)}function Ur(r){if(Ur.readOnly=!0,Buffer.isBuffer(r))return r;let e;return r instanceof ArrayBuffer?e=new Fr(r):ArrayBuffer.isView(r)?e=new Fr(r.buffer,r.byteOffset,r.byteLength):(e=Buffer.from(r),Ur.readOnly=!1),e}Hn.exports={concat:$x,mask:xo,toArrayBuffer:Zx,toBuffer:Ur,unmask:uo};if(!process.env.WS_NO_BUFFER_UTIL)try{let r=X("bufferutil");Hn.exports.mask=function(e,i,a,c,u){u<48?xo(e,i,a,c,u):r.mask(e,i,a,c,u)},Hn.exports.unmask=function(e,i){e.length<32?uo(e,i):r.unmask(e,i)}}catch{}});var ho=de((Cg,lo)=>{"use strict";var fo=Symbol("kDone"),Kr=Symbol("kRun"),Gr=class{constructor(e){this[fo]=()=>{this.pending--,this[Kr]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[Kr]()}[Kr](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[fo])}}};lo.exports=Gr});var Et=de((Eg,_o)=>{"use strict";var Xt=X("zlib"),go=Vt(),Qx=ho(),{kStatusCode:po}=Fe(),eu=Buffer[Symbol.species],tu=Buffer.from([0,0,255,255]),Wn=Symbol("permessage-deflate"),Ue=Symbol("total-length"),St=Symbol("callback"),Ye=Symbol("buffers"),Ct=Symbol("error"),jn,Hr=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,!jn){let i=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;jn=new Qx(i)}}static get extensionName(){return"permessage-deflate"}offer(){let e={};return this._options.serverNoContextTakeover&&(e.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(e.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(e.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?e.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits==null&&(e.client_max_window_bits=!0),e}accept(e){return e=this.normalizeParams(e),this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){let e=this._deflate[St];this._deflate.close(),this._deflate=null,e&&e(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(e){let i=this._options,a=e.find(c=>!(i.serverNoContextTakeover===!1&&c.server_no_context_takeover||c.server_max_window_bits&&(i.serverMaxWindowBits===!1||typeof i.serverMaxWindowBits=="number"&&i.serverMaxWindowBits>c.server_max_window_bits)||typeof i.clientMaxWindowBits=="number"&&!c.client_max_window_bits));if(!a)throw new Error("None of the extension offers can be accepted");return i.serverNoContextTakeover&&(a.server_no_context_takeover=!0),i.clientNoContextTakeover&&(a.client_no_context_takeover=!0),typeof i.serverMaxWindowBits=="number"&&(a.server_max_window_bits=i.serverMaxWindowBits),typeof i.clientMaxWindowBits=="number"?a.client_max_window_bits=i.clientMaxWindowBits:(a.client_max_window_bits===!0||i.clientMaxWindowBits===!1)&&delete a.client_max_window_bits,a}acceptAsClient(e){let i=e[0];if(this._options.clientNoContextTakeover===!1&&i.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(!i.client_max_window_bits)typeof this._options.clientMaxWindowBits=="number"&&(i.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits=="number"&&i.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"');return i}normalizeParams(e){return e.forEach(i=>{Object.keys(i).forEach(a=>{let c=i[a];if(c.length>1)throw new Error(`Parameter "${a}" must have only a single value`);if(c=c[0],a==="client_max_window_bits"){if(c!==!0){let u=+c;if(!Number.isInteger(u)||u<8||u>15)throw new TypeError(`Invalid value for parameter "${a}": ${c}`);c=u}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${a}": ${c}`)}else if(a==="server_max_window_bits"){let u=+c;if(!Number.isInteger(u)||u<8||u>15)throw new TypeError(`Invalid value for parameter "${a}": ${c}`);c=u}else if(a==="client_no_context_takeover"||a==="server_no_context_takeover"){if(c!==!0)throw new TypeError(`Invalid value for parameter "${a}": ${c}`)}else throw new Error(`Unknown parameter "${a}"`);i[a]=c})}),e}decompress(e,i,a){jn.add(c=>{this._decompress(e,i,(u,f)=>{c(),a(u,f)})})}compress(e,i,a){jn.add(c=>{this._compress(e,i,(u,f)=>{c(),a(u,f)})})}_decompress(e,i,a){let c=this._isServer?"client":"server";if(!this._inflate){let u=`${c}_max_window_bits`,f=typeof this.params[u]!="number"?Xt.Z_DEFAULT_WINDOWBITS:this.params[u];this._inflate=Xt.createInflateRaw({...this._options.zlibInflateOptions,windowBits:f}),this._inflate[Wn]=this,this._inflate[Ue]=0,this._inflate[Ye]=[],this._inflate.on("error",ru),this._inflate.on("data",mo)}this._inflate[St]=a,this._inflate.write(e),i&&this._inflate.write(tu),this._inflate.flush(()=>{let u=this._inflate[Ct];if(u){this._inflate.close(),this._inflate=null,a(u);return}let f=go.concat(this._inflate[Ye],this._inflate[Ue]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[Ue]=0,this._inflate[Ye]=[],i&&this.params[`${c}_no_context_takeover`]&&this._inflate.reset()),a(null,f)})}_compress(e,i,a){let c=this._isServer?"server":"client";if(!this._deflate){let u=`${c}_max_window_bits`,f=typeof this.params[u]!="number"?Xt.Z_DEFAULT_WINDOWBITS:this.params[u];this._deflate=Xt.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:f}),this._deflate[Ue]=0,this._deflate[Ye]=[],this._deflate.on("data",nu)}this._deflate[St]=a,this._deflate.write(e),this._deflate.flush(Xt.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let u=go.concat(this._deflate[Ye],this._deflate[Ue]);i&&(u=new eu(u.buffer,u.byteOffset,u.length-4)),this._deflate[St]=null,this._deflate[Ue]=0,this._deflate[Ye]=[],i&&this.params[`${c}_no_context_takeover`]&&this._deflate.reset(),a(null,u)})}};_o.exports=Hr;function nu(r){this[Ye].push(r),this[Ue]+=r.length}function mo(r){if(this[Ue]+=r.length,this[Wn]._maxPayload<1||this[Ue]<=this[Wn]._maxPayload){this[Ye].push(r);return}this[Ct]=new RangeError("Max payload size exceeded"),this[Ct].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[Ct][po]=1009,this.removeListener("data",mo),this.reset()}function ru(r){if(this[Wn]._inflate=null,this[Ct]){this[St](this[Ct]);return}r[po]=1007,this[St](r)}});var At=de((Ag,Jn)=>{"use strict";var{isUtf8:wo}=X("buffer"),{hasBlob:su}=Fe(),iu=[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 ou(r){return r>=1e3&&r<=1014&&r!==1004&&r!==1005&&r!==1006||r>=3e3&&r<=4999}function jr(r){let e=r.length,i=0;for(;i<e;)if((r[i]&128)===0)i++;else if((r[i]&224)===192){if(i+1===e||(r[i+1]&192)!==128||(r[i]&254)===192)return!1;i+=2}else if((r[i]&240)===224){if(i+2>=e||(r[i+1]&192)!==128||(r[i+2]&192)!==128||r[i]===224&&(r[i+1]&224)===128||r[i]===237&&(r[i+1]&224)===160)return!1;i+=3}else if((r[i]&248)===240){if(i+3>=e||(r[i+1]&192)!==128||(r[i+2]&192)!==128||(r[i+3]&192)!==128||r[i]===240&&(r[i+1]&240)===128||r[i]===244&&r[i+1]>143||r[i]>244)return!1;i+=4}else return!1;return!0}function au(r){return su&&typeof r=="object"&&typeof r.arrayBuffer=="function"&&typeof r.type=="string"&&typeof r.stream=="function"&&(r[Symbol.toStringTag]==="Blob"||r[Symbol.toStringTag]==="File")}Jn.exports={isBlob:au,isValidStatusCode:ou,isValidUTF8:jr,tokenChars:iu};if(wo)Jn.exports.isValidUTF8=function(r){return r.length<24?jr(r):wo(r)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let r=X("utf-8-validate");Jn.exports.isValidUTF8=function(e){return e.length<32?jr(e):r(e)}}catch{}});var Yr=de((kg,Ao)=>{"use strict";var{Writable:cu}=X("stream"),yo=Et(),{BINARY_TYPES:xu,EMPTY_BUFFER:bo,kStatusCode:uu,kWebSocket:fu}=Fe(),{concat:Wr,toArrayBuffer:du,unmask:lu}=Vt(),{isValidStatusCode:hu,isValidUTF8:vo}=At(),Vn=Buffer[Symbol.species],me=0,So=1,Co=2,Eo=3,Jr=4,Vr=5,Xn=6,Xr=class extends cu{constructor(e={}){super(),this._allowSynchronousEvents=e.allowSynchronousEvents!==void 0?e.allowSynchronousEvents:!0,this._binaryType=e.binaryType||xu[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxPayload=e.maxPayload|0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[fu]=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=me}_write(e,i,a){if(this._opcode===8&&this._state==me)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 Vn(a.buffer,a.byteOffset+e,a.length-e),new Vn(a.buffer,a.byteOffset,e)}let i=Buffer.allocUnsafe(e);do{let a=this._buffers[0],c=i.length-e;e>=a.length?i.set(this._buffers.shift(),c):(i.set(new Uint8Array(a.buffer,a.byteOffset,e),c),this._buffers[0]=new Vn(a.buffer,a.byteOffset+e,a.length-e)),e-=a.length}while(e>0);return i}startLoop(e){this._loop=!0;do switch(this._state){case me:this.getInfo(e);break;case So:this.getPayloadLength16(e);break;case Co:this.getPayloadLength64(e);break;case Eo:this.getMask();break;case Jr:this.getData(e);break;case Vr:case Xn:this._loop=!1;return}while(this._loop);this._errored||e()}getInfo(e){if(this._bufferedBytes<2){this._loop=!1;return}let i=this.consume(2);if((i[0]&48)!==0){let c=this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");e(c);return}let a=(i[0]&64)===64;if(a&&!this._extensions[yo.extensionName]){let c=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(c);return}if(this._fin=(i[0]&128)===128,this._opcode=i[0]&15,this._payloadLength=i[1]&127,this._opcode===0){if(a){let c=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(c);return}if(!this._fragmented){let c=this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");e(c);return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){let c=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");e(c);return}this._compressed=a}else if(this._opcode>7&&this._opcode<11){if(!this._fin){let c=this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");e(c);return}if(a){let c=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(c);return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){let c=this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");e(c);return}}else{let c=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");e(c);return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(i[1]&128)===128,this._isServer){if(!this._masked){let c=this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK");e(c);return}}else if(this._masked){let c=this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");e(c);return}this._payloadLength===126?this._state=So:this._payloadLength===127?this._state=Co:this.haveLength(e)}getPayloadLength16(e){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(e)}getPayloadLength64(e){if(this._bufferedBytes<8){this._loop=!1;return}let i=this.consume(8),a=i.readUInt32BE(0);if(a>Math.pow(2,21)-1){let c=this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");e(c);return}this._payloadLength=a*Math.pow(2,32)+i.readUInt32BE(4),this.haveLength(e)}haveLength(e){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)){let i=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");e(i);return}this._masked?this._state=Eo:this._state=Jr}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=Jr}getData(e){let i=bo;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}i=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0&&lu(i,this._mask)}if(this._opcode>7){this.controlMessage(i,e);return}if(this._compressed){this._state=Vr,this.decompress(i,e);return}i.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(i)),this.dataMessage(e)}decompress(e,i){this._extensions[yo.extensionName].decompress(e,this._fin,(c,u)=>{if(c)return i(c);if(u.length){if(this._messageLength+=u.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let f=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");i(f);return}this._fragments.push(u)}this.dataMessage(i),this._state===me&&this.startLoop(i)})}dataMessage(e){if(!this._fin){this._state=me;return}let i=this._messageLength,a=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let c;this._binaryType==="nodebuffer"?c=Wr(a,i):this._binaryType==="arraybuffer"?c=du(Wr(a,i)):this._binaryType==="blob"?c=new Blob(a):c=a,this._allowSynchronousEvents?(this.emit("message",c,!0),this._state=me):(this._state=Xn,setImmediate(()=>{this.emit("message",c,!0),this._state=me,this.startLoop(e)}))}else{let c=Wr(a,i);if(!this._skipUTF8Validation&&!vo(c)){let u=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");e(u);return}this._state===Vr||this._allowSynchronousEvents?(this.emit("message",c,!1),this._state=me):(this._state=Xn,setImmediate(()=>{this.emit("message",c,!1),this._state=me,this.startLoop(e)}))}}controlMessage(e,i){if(this._opcode===8){if(e.length===0)this._loop=!1,this.emit("conclude",1005,bo),this.end();else{let a=e.readUInt16BE(0);if(!hu(a)){let u=this.createError(RangeError,`invalid status code ${a}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");i(u);return}let c=new Vn(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!vo(c)){let u=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");i(u);return}this._loop=!1,this.emit("conclude",a,c),this.end()}this._state=me;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?"ping":"pong",e),this._state=me):(this._state=Xn,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",e),this._state=me,this.startLoop(i)}))}createError(e,i,a,c,u){this._loop=!1,this._errored=!0;let f=new e(a?`Invalid WebSocket frame: ${i}`:i);return Error.captureStackTrace(f,this.createError),f.code=u,f[uu]=c,f}};Ao.exports=Xr});var Qr=de((Pg,Po)=>{"use strict";var{Duplex:Ig}=X("stream"),{randomFillSync:gu}=X("crypto"),ko=Et(),{EMPTY_BUFFER:pu,kWebSocket:mu,NOOP:_u}=Fe(),{isBlob:kt,isValidStatusCode:wu}=At(),{mask:Io,toBuffer:st}=Vt(),_e=Symbol("kByteLength"),yu=Buffer.alloc(4),Yn=8*1024,it,It=Yn,ve=0,bu=1,vu=2,$r=class r{constructor(e,i,a){this._extensions=i||{},a&&(this._generateMask=a,this._maskBuffer=Buffer.alloc(4)),this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=ve,this.onerror=_u,this[mu]=void 0}static frame(e,i){let a,c=!1,u=2,f=!1;i.mask&&(a=i.maskBuffer||yu,i.generateMask?i.generateMask(a):(It===Yn&&(it===void 0&&(it=Buffer.alloc(Yn)),gu(it,0,Yn),It=0),a[0]=it[It++],a[1]=it[It++],a[2]=it[It++],a[3]=it[It++]),f=(a[0]|a[1]|a[2]|a[3])===0,u=6);let h;typeof e=="string"?(!i.mask||f)&&i[_e]!==void 0?h=i[_e]:(e=Buffer.from(e),h=e.length):(h=e.length,c=i.mask&&i.readOnly&&!f);let m=h;h>=65536?(u+=8,m=127):h>125&&(u+=2,m=126);let _=Buffer.allocUnsafe(c?h+u:u);return _[0]=i.fin?i.opcode|128:i.opcode,i.rsv1&&(_[0]|=64),_[1]=m,m===126?_.writeUInt16BE(h,2):m===127&&(_[2]=_[3]=0,_.writeUIntBE(h,4,6)),i.mask?(_[1]|=128,_[u-4]=a[0],_[u-3]=a[1],_[u-2]=a[2],_[u-1]=a[3],f?[_,e]:c?(Io(e,a,_,u,h),[_]):(Io(e,a,e,0,h),[_,e])):[_,e]}close(e,i,a,c){let u;if(e===void 0)u=pu;else{if(typeof e!="number"||!wu(e))throw new TypeError("First argument must be a valid error code number");if(i===void 0||!i.length)u=Buffer.allocUnsafe(2),u.writeUInt16BE(e,0);else{let h=Buffer.byteLength(i);if(h>123)throw new RangeError("The message must not be greater than 123 bytes");u=Buffer.allocUnsafe(2+h),u.writeUInt16BE(e,0),typeof i=="string"?u.write(i,2):u.set(i,2)}}let f={[_e]:u.length,fin:!0,generateMask:this._generateMask,mask:a,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state!==ve?this.enqueue([this.dispatch,u,!1,f,c]):this.sendFrame(r.frame(u,f),c)}ping(e,i,a){let c,u;if(typeof e=="string"?(c=Buffer.byteLength(e),u=!1):kt(e)?(c=e.size,u=!1):(e=st(e),c=e.length,u=st.readOnly),c>125)throw new RangeError("The data size must not be greater than 125 bytes");let f={[_e]:c,fin:!0,generateMask:this._generateMask,mask:i,maskBuffer:this._maskBuffer,opcode:9,readOnly:u,rsv1:!1};kt(e)?this._state!==ve?this.enqueue([this.getBlobData,e,!1,f,a]):this.getBlobData(e,!1,f,a):this._state!==ve?this.enqueue([this.dispatch,e,!1,f,a]):this.sendFrame(r.frame(e,f),a)}pong(e,i,a){let c,u;if(typeof e=="string"?(c=Buffer.byteLength(e),u=!1):kt(e)?(c=e.size,u=!1):(e=st(e),c=e.length,u=st.readOnly),c>125)throw new RangeError("The data size must not be greater than 125 bytes");let f={[_e]:c,fin:!0,generateMask:this._generateMask,mask:i,maskBuffer:this._maskBuffer,opcode:10,readOnly:u,rsv1:!1};kt(e)?this._state!==ve?this.enqueue([this.getBlobData,e,!1,f,a]):this.getBlobData(e,!1,f,a):this._state!==ve?this.enqueue([this.dispatch,e,!1,f,a]):this.sendFrame(r.frame(e,f),a)}send(e,i,a){let c=this._extensions[ko.extensionName],u=i.binary?2:1,f=i.compress,h,m;typeof e=="string"?(h=Buffer.byteLength(e),m=!1):kt(e)?(h=e.size,m=!1):(e=st(e),h=e.length,m=st.readOnly),this._firstFragment?(this._firstFragment=!1,f&&c&&c.params[c._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(f=h>=c._threshold),this._compress=f):(f=!1,u=0),i.fin&&(this._firstFragment=!0);let _={[_e]:h,fin:i.fin,generateMask:this._generateMask,mask:i.mask,maskBuffer:this._maskBuffer,opcode:u,readOnly:m,rsv1:f};kt(e)?this._state!==ve?this.enqueue([this.getBlobData,e,this._compress,_,a]):this.getBlobData(e,this._compress,_,a):this._state!==ve?this.enqueue([this.dispatch,e,this._compress,_,a]):this.dispatch(e,this._compress,_,a)}getBlobData(e,i,a,c){this._bufferedBytes+=a[_e],this._state=vu,e.arrayBuffer().then(u=>{if(this._socket.destroyed){let h=new Error("The socket was closed while the blob was being read");process.nextTick(Zr,this,h,c);return}this._bufferedBytes-=a[_e];let f=st(u);i?this.dispatch(f,i,a,c):(this._state=ve,this.sendFrame(r.frame(f,a),c),this.dequeue())}).catch(u=>{process.nextTick(Su,this,u,c)})}dispatch(e,i,a,c){if(!i){this.sendFrame(r.frame(e,a),c);return}let u=this._extensions[ko.extensionName];this._bufferedBytes+=a[_e],this._state=bu,u.compress(e,a.fin,(f,h)=>{if(this._socket.destroyed){let m=new Error("The socket was closed while data was being compressed");Zr(this,m,c);return}this._bufferedBytes-=a[_e],this._state=ve,a.readOnly=!1,this.sendFrame(r.frame(h,a),c),this.dequeue()})}dequeue(){for(;this._state===ve&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[3][_e],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][_e],this._queue.push(e)}sendFrame(e,i){e.length===2?(this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],i),this._socket.uncork()):this._socket.write(e[0],i)}};Po.exports=$r;function Zr(r,e,i){typeof i=="function"&&i(e);for(let a=0;a<r._queue.length;a++){let c=r._queue[a],u=c[c.length-1];typeof u=="function"&&u(e)}}function Su(r,e,i){Zr(r,e,i),r.onerror(e)}});var zo=de((Dg,Oo)=>{"use strict";var{kForOnEventAttribute:Yt,kListener:es}=Fe(),Do=Symbol("kCode"),To=Symbol("kData"),No=Symbol("kError"),Lo=Symbol("kMessage"),Ro=Symbol("kReason"),Pt=Symbol("kTarget"),Bo=Symbol("kType"),Mo=Symbol("kWasClean"),Ke=class{constructor(e){this[Pt]=null,this[Bo]=e}get target(){return this[Pt]}get type(){return this[Bo]}};Object.defineProperty(Ke.prototype,"target",{enumerable:!0});Object.defineProperty(Ke.prototype,"type",{enumerable:!0});var ot=class extends Ke{constructor(e,i={}){super(e),this[Do]=i.code===void 0?0:i.code,this[Ro]=i.reason===void 0?"":i.reason,this[Mo]=i.wasClean===void 0?!1:i.wasClean}get code(){return this[Do]}get reason(){return this[Ro]}get wasClean(){return this[Mo]}};Object.defineProperty(ot.prototype,"code",{enumerable:!0});Object.defineProperty(ot.prototype,"reason",{enumerable:!0});Object.defineProperty(ot.prototype,"wasClean",{enumerable:!0});var Dt=class extends Ke{constructor(e,i={}){super(e),this[No]=i.error===void 0?null:i.error,this[Lo]=i.message===void 0?"":i.message}get error(){return this[No]}get message(){return this[Lo]}};Object.defineProperty(Dt.prototype,"error",{enumerable:!0});Object.defineProperty(Dt.prototype,"message",{enumerable:!0});var $t=class extends Ke{constructor(e,i={}){super(e),this[To]=i.data===void 0?null:i.data}get data(){return this[To]}};Object.defineProperty($t.prototype,"data",{enumerable:!0});var Cu={addEventListener(r,e,i={}){for(let c of this.listeners(r))if(!i[Yt]&&c[es]===e&&!c[Yt])return;let a;if(r==="message")a=function(u,f){let h=new $t("message",{data:f?u:u.toString()});h[Pt]=this,$n(e,this,h)};else if(r==="close")a=function(u,f){let h=new ot("close",{code:u,reason:f.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});h[Pt]=this,$n(e,this,h)};else if(r==="error")a=function(u){let f=new Dt("error",{error:u,message:u.message});f[Pt]=this,$n(e,this,f)};else if(r==="open")a=function(){let u=new Ke("open");u[Pt]=this,$n(e,this,u)};else return;a[Yt]=!!i[Yt],a[es]=e,i.once?this.once(r,a):this.on(r,a)},removeEventListener(r,e){for(let i of this.listeners(r))if(i[es]===e&&!i[Yt]){this.removeListener(r,i);break}}};Oo.exports={CloseEvent:ot,ErrorEvent:Dt,Event:Ke,EventTarget:Cu,MessageEvent:$t};function $n(r,e,i){typeof r=="object"&&r.handleEvent?r.handleEvent.call(r,i):r.call(e,i)}});var Zn=de((Tg,qo)=>{"use strict";var{tokenChars:Zt}=At();function Le(r,e,i){r[e]===void 0?r[e]=[i]:r[e].push(i)}function Eu(r){let e=Object.create(null),i=Object.create(null),a=!1,c=!1,u=!1,f,h,m=-1,_=-1,y=-1,v=0;for(;v<r.length;v++)if(_=r.charCodeAt(v),f===void 0)if(y===-1&&Zt[_]===1)m===-1&&(m=v);else if(v!==0&&(_===32||_===9))y===-1&&m!==-1&&(y=v);else if(_===59||_===44){if(m===-1)throw new SyntaxError(`Unexpected character at index ${v}`);y===-1&&(y=v);let A=r.slice(m,y);_===44?(Le(e,A,i),i=Object.create(null)):f=A,m=y=-1}else throw new SyntaxError(`Unexpected character at index ${v}`);else if(h===void 0)if(y===-1&&Zt[_]===1)m===-1&&(m=v);else if(_===32||_===9)y===-1&&m!==-1&&(y=v);else if(_===59||_===44){if(m===-1)throw new SyntaxError(`Unexpected character at index ${v}`);y===-1&&(y=v),Le(i,r.slice(m,y),!0),_===44&&(Le(e,f,i),i=Object.create(null),f=void 0),m=y=-1}else if(_===61&&m!==-1&&y===-1)h=r.slice(m,v),m=y=-1;else throw new SyntaxError(`Unexpected character at index ${v}`);else if(c){if(Zt[_]!==1)throw new SyntaxError(`Unexpected character at index ${v}`);m===-1?m=v:a||(a=!0),c=!1}else if(u)if(Zt[_]===1)m===-1&&(m=v);else if(_===34&&m!==-1)u=!1,y=v;else if(_===92)c=!0;else throw new SyntaxError(`Unexpected character at index ${v}`);else if(_===34&&r.charCodeAt(v-1)===61)u=!0;else if(y===-1&&Zt[_]===1)m===-1&&(m=v);else if(m!==-1&&(_===32||_===9))y===-1&&(y=v);else if(_===59||_===44){if(m===-1)throw new SyntaxError(`Unexpected character at index ${v}`);y===-1&&(y=v);let A=r.slice(m,y);a&&(A=A.replace(/\\/g,""),a=!1),Le(i,h,A),_===44&&(Le(e,f,i),i=Object.create(null),f=void 0),h=void 0,m=y=-1}else throw new SyntaxError(`Unexpected character at index ${v}`);if(m===-1||u||_===32||_===9)throw new SyntaxError("Unexpected end of input");y===-1&&(y=v);let S=r.slice(m,y);return f===void 0?Le(e,S,i):(h===void 0?Le(i,S,!0):a?Le(i,h,S.replace(/\\/g,"")):Le(i,h,S),Le(e,f,i)),e}function Au(r){return Object.keys(r).map(e=>{let i=r[e];return Array.isArray(i)||(i=[i]),i.map(a=>[e].concat(Object.keys(a).map(c=>{let u=a[c];return Array.isArray(u)||(u=[u]),u.map(f=>f===!0?c:`${c}=${f}`).join("; ")})).join("; ")).join(", ")}).join(", ")}qo.exports={format:Au,parse:Eu}});var nr=de((Rg,$o)=>{"use strict";var ku=X("events"),Iu=X("https"),Pu=X("http"),Ko=X("net"),Du=X("tls"),{randomBytes:Tu,createHash:Nu}=X("crypto"),{Duplex:Ng,Readable:Lg}=X("stream"),{URL:ts}=X("url"),$e=Et(),Lu=Yr(),Ru=Qr(),{isBlob:Bu}=At(),{BINARY_TYPES:Fo,CLOSE_TIMEOUT:Mu,EMPTY_BUFFER:Qn,GUID:Ou,kForOnEventAttribute:ns,kListener:zu,kStatusCode:qu,kWebSocket:ne,NOOP:Go}=Fe(),{EventTarget:{addEventListener:Fu,removeEventListener:Uu}}=zo(),{format:Ku,parse:Gu}=Zn(),{toBuffer:Hu}=Vt(),Ho=Symbol("kAborted"),rs=[8,13],Ge=["CONNECTING","OPEN","CLOSING","CLOSED"],ju=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,G=class r extends ku{constructor(e,i,a){super(),this._binaryType=Fo[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=Qn,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol="",this._readyState=r.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,e!==null?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,i===void 0?i=[]:Array.isArray(i)||(typeof i=="object"&&i!==null?(a=i,i=[]):i=[i]),jo(this,e,i,a)):(this._autoPong=a.autoPong,this._closeTimeout=a.closeTimeout,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(e){Fo.includes(e)&&(this._binaryType=e,this._receiver&&(this._receiver._binaryType=e))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(e,i,a){let c=new Lu({allowSynchronousEvents:a.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:a.maxPayload,skipUTF8Validation:a.skipUTF8Validation}),u=new Ru(e,this._extensions,a.generateMask);this._receiver=c,this._sender=u,this._socket=e,c[ne]=this,u[ne]=this,e[ne]=this,c.on("conclude",Vu),c.on("drain",Xu),c.on("error",Yu),c.on("message",$u),c.on("ping",Zu),c.on("pong",Qu),u.onerror=ef,e.setTimeout&&e.setTimeout(0),e.setNoDelay&&e.setNoDelay(),i.length>0&&e.unshift(i),e.on("close",Vo),e.on("data",tr),e.on("end",Xo),e.on("error",Yo),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[$e.extensionName]&&this._extensions[$e.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=r.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(e,i){if(this.readyState!==r.CLOSED){if(this.readyState===r.CONNECTING){ge(this,this._req,"WebSocket was closed before the connection was established");return}if(this.readyState===r.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=r.CLOSING,this._sender.close(e,i,!this._isServer,a=>{a||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),Jo(this)}}pause(){this.readyState===r.CONNECTING||this.readyState===r.CLOSED||(this._paused=!0,this._socket.pause())}ping(e,i,a){if(this.readyState===r.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(a=e,e=i=void 0):typeof i=="function"&&(a=i,i=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==r.OPEN){ss(this,e,a);return}i===void 0&&(i=!this._isServer),this._sender.ping(e||Qn,i,a)}pong(e,i,a){if(this.readyState===r.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(a=e,e=i=void 0):typeof i=="function"&&(a=i,i=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==r.OPEN){ss(this,e,a);return}i===void 0&&(i=!this._isServer),this._sender.pong(e||Qn,i,a)}resume(){this.readyState===r.CONNECTING||this.readyState===r.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(e,i,a){if(this.readyState===r.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof i=="function"&&(a=i,i={}),typeof e=="number"&&(e=e.toString()),this.readyState!==r.OPEN){ss(this,e,a);return}let c={binary:typeof e!="string",mask:!this._isServer,compress:!0,fin:!0,...i};this._extensions[$e.extensionName]||(c.compress=!1),this._sender.send(e||Qn,c,a)}terminate(){if(this.readyState!==r.CLOSED){if(this.readyState===r.CONNECTING){ge(this,this._req,"WebSocket was closed before the connection was established");return}this._socket&&(this._readyState=r.CLOSING,this._socket.destroy())}}};Object.defineProperty(G,"CONNECTING",{enumerable:!0,value:Ge.indexOf("CONNECTING")});Object.defineProperty(G.prototype,"CONNECTING",{enumerable:!0,value:Ge.indexOf("CONNECTING")});Object.defineProperty(G,"OPEN",{enumerable:!0,value:Ge.indexOf("OPEN")});Object.defineProperty(G.prototype,"OPEN",{enumerable:!0,value:Ge.indexOf("OPEN")});Object.defineProperty(G,"CLOSING",{enumerable:!0,value:Ge.indexOf("CLOSING")});Object.defineProperty(G.prototype,"CLOSING",{enumerable:!0,value:Ge.indexOf("CLOSING")});Object.defineProperty(G,"CLOSED",{enumerable:!0,value:Ge.indexOf("CLOSED")});Object.defineProperty(G.prototype,"CLOSED",{enumerable:!0,value:Ge.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(r=>{Object.defineProperty(G.prototype,r,{enumerable:!0})});["open","error","close","message"].forEach(r=>{Object.defineProperty(G.prototype,`on${r}`,{enumerable:!0,get(){for(let e of this.listeners(r))if(e[ns])return e[zu];return null},set(e){for(let i of this.listeners(r))if(i[ns]){this.removeListener(r,i);break}typeof e=="function"&&this.addEventListener(r,e,{[ns]:!0})}})});G.prototype.addEventListener=Fu;G.prototype.removeEventListener=Uu;$o.exports=G;function jo(r,e,i,a){let c={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:Mu,protocolVersion:rs[1],maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...a,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(r._autoPong=c.autoPong,r._closeTimeout=c.closeTimeout,!rs.includes(c.protocolVersion))throw new RangeError(`Unsupported protocol version: ${c.protocolVersion} (supported versions: ${rs.join(", ")})`);let u;if(e instanceof ts)u=e;else try{u=new ts(e)}catch{throw new SyntaxError(`Invalid URL: ${e}`)}u.protocol==="http:"?u.protocol="ws:":u.protocol==="https:"&&(u.protocol="wss:"),r._url=u.href;let f=u.protocol==="wss:",h=u.protocol==="ws+unix:",m;if(u.protocol!=="ws:"&&!f&&!h?m=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:h&&!u.pathname?m="The URL's pathname is empty":u.hash&&(m="The URL contains a fragment identifier"),m){let L=new SyntaxError(m);if(r._redirects===0)throw L;er(r,L);return}let _=f?443:80,y=Tu(16).toString("base64"),v=f?Iu.request:Pu.request,S=new Set,A;if(c.createConnection=c.createConnection||(f?Ju:Wu),c.defaultPort=c.defaultPort||_,c.port=u.port||_,c.host=u.hostname.startsWith("[")?u.hostname.slice(1,-1):u.hostname,c.headers={...c.headers,"Sec-WebSocket-Version":c.protocolVersion,"Sec-WebSocket-Key":y,Connection:"Upgrade",Upgrade:"websocket"},c.path=u.pathname+u.search,c.timeout=c.handshakeTimeout,c.perMessageDeflate&&(A=new $e({...c.perMessageDeflate,isServer:!1,maxPayload:c.maxPayload}),c.headers["Sec-WebSocket-Extensions"]=Ku({[$e.extensionName]:A.offer()})),i.length){for(let L of i){if(typeof L!="string"||!ju.test(L)||S.has(L))throw new SyntaxError("An invalid or duplicated subprotocol was specified");S.add(L)}c.headers["Sec-WebSocket-Protocol"]=i.join(",")}if(c.origin&&(c.protocolVersion<13?c.headers["Sec-WebSocket-Origin"]=c.origin:c.headers.Origin=c.origin),(u.username||u.password)&&(c.auth=`${u.username}:${u.password}`),h){let L=c.path.split(":");c.socketPath=L[0],c.path=L[1]}let D;if(c.followRedirects){if(r._redirects===0){r._originalIpc=h,r._originalSecure=f,r._originalHostOrSocketPath=h?c.socketPath:u.host;let L=a&&a.headers;if(a={...a,headers:{}},L)for(let[F,$]of Object.entries(L))a.headers[F.toLowerCase()]=$}else if(r.listenerCount("redirect")===0){let L=h?r._originalIpc?c.socketPath===r._originalHostOrSocketPath:!1:r._originalIpc?!1:u.host===r._originalHostOrSocketPath;(!L||r._originalSecure&&!f)&&(delete c.headers.authorization,delete c.headers.cookie,L||delete c.headers.host,c.auth=void 0)}c.auth&&!a.headers.authorization&&(a.headers.authorization="Basic "+Buffer.from(c.auth).toString("base64")),D=r._req=v(c),r._redirects&&r.emit("redirect",r.url,D)}else D=r._req=v(c);c.timeout&&D.on("timeout",()=>{ge(r,D,"Opening handshake has timed out")}),D.on("error",L=>{D===null||D[Ho]||(D=r._req=null,er(r,L))}),D.on("response",L=>{let F=L.headers.location,$=L.statusCode;if(F&&c.followRedirects&&$>=300&&$<400){if(++r._redirects>c.maxRedirects){ge(r,D,"Maximum redirects exceeded");return}D.abort();let oe;try{oe=new ts(F,e)}catch{let Z=new SyntaxError(`Invalid URL: ${F}`);er(r,Z);return}jo(r,oe,i,a)}else r.emit("unexpected-response",D,L)||ge(r,D,`Unexpected server response: ${L.statusCode}`)}),D.on("upgrade",(L,F,$)=>{if(r.emit("upgrade",L),r.readyState!==G.CONNECTING)return;D=r._req=null;let oe=L.headers.upgrade;if(oe===void 0||oe.toLowerCase()!=="websocket"){ge(r,F,"Invalid Upgrade header");return}let ee=Nu("sha1").update(y+Ou).digest("base64");if(L.headers["sec-websocket-accept"]!==ee){ge(r,F,"Invalid Sec-WebSocket-Accept header");return}let Z=L.headers["sec-websocket-protocol"],P;if(Z!==void 0?S.size?S.has(Z)||(P="Server sent an invalid subprotocol"):P="Server sent a subprotocol but none was requested":S.size&&(P="Server sent no subprotocol"),P){ge(r,F,P);return}Z&&(r._protocol=Z);let U=L.headers["sec-websocket-extensions"];if(U!==void 0){if(!A){ge(r,F,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let j;try{j=Gu(U)}catch{ge(r,F,"Invalid Sec-WebSocket-Extensions header");return}let ae=Object.keys(j);if(ae.length!==1||ae[0]!==$e.extensionName){ge(r,F,"Server indicated an extension that was not requested");return}try{A.accept(j[$e.extensionName])}catch{ge(r,F,"Invalid Sec-WebSocket-Extensions header");return}r._extensions[$e.extensionName]=A}r.setSocket(F,$,{allowSynchronousEvents:c.allowSynchronousEvents,generateMask:c.generateMask,maxPayload:c.maxPayload,skipUTF8Validation:c.skipUTF8Validation})}),c.finishRequest?c.finishRequest(D,r):D.end()}function er(r,e){r._readyState=G.CLOSING,r._errorEmitted=!0,r.emit("error",e),r.emitClose()}function Wu(r){return r.path=r.socketPath,Ko.connect(r)}function Ju(r){return r.path=void 0,!r.servername&&r.servername!==""&&(r.servername=Ko.isIP(r.host)?"":r.host),Du.connect(r)}function ge(r,e,i){r._readyState=G.CLOSING;let a=new Error(i);Error.captureStackTrace(a,ge),e.setHeader?(e[Ho]=!0,e.abort(),e.socket&&!e.socket.destroyed&&e.socket.destroy(),process.nextTick(er,r,a)):(e.destroy(a),e.once("error",r.emit.bind(r,"error")),e.once("close",r.emitClose.bind(r)))}function ss(r,e,i){if(e){let a=Bu(e)?e.size:Hu(e).length;r._socket?r._sender._bufferedBytes+=a:r._bufferedAmount+=a}if(i){let a=new Error(`WebSocket is not open: readyState ${r.readyState} (${Ge[r.readyState]})`);process.nextTick(i,a)}}function Vu(r,e){let i=this[ne];i._closeFrameReceived=!0,i._closeMessage=e,i._closeCode=r,i._socket[ne]!==void 0&&(i._socket.removeListener("data",tr),process.nextTick(Wo,i._socket),r===1005?i.close():i.close(r,e))}function Xu(){let r=this[ne];r.isPaused||r._socket.resume()}function Yu(r){let e=this[ne];e._socket[ne]!==void 0&&(e._socket.removeListener("data",tr),process.nextTick(Wo,e._socket),e.close(r[qu])),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",r))}function Uo(){this[ne].emitClose()}function $u(r,e){this[ne].emit("message",r,e)}function Zu(r){let e=this[ne];e._autoPong&&e.pong(r,!this._isServer,Go),e.emit("ping",r)}function Qu(r){this[ne].emit("pong",r)}function Wo(r){r.resume()}function ef(r){let e=this[ne];e.readyState!==G.CLOSED&&(e.readyState===G.OPEN&&(e._readyState=G.CLOSING,Jo(e)),this._socket.end(),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",r)))}function Jo(r){r._closeTimer=setTimeout(r._socket.destroy.bind(r._socket),r._closeTimeout)}function Vo(){let r=this[ne];if(this.removeListener("close",Vo),this.removeListener("data",tr),this.removeListener("end",Xo),r._readyState=G.CLOSING,!this._readableState.endEmitted&&!r._closeFrameReceived&&!r._receiver._writableState.errorEmitted&&this._readableState.length!==0){let e=this.read(this._readableState.length);r._receiver.write(e)}r._receiver.end(),this[ne]=void 0,clearTimeout(r._closeTimer),r._receiver._writableState.finished||r._receiver._writableState.errorEmitted?r.emitClose():(r._receiver.on("error",Uo),r._receiver.on("finish",Uo))}function tr(r){this[ne]._receiver.write(r)||this.pause()}function Xo(){let r=this[ne];r._readyState=G.CLOSING,r._receiver.end(),this.end()}function Yo(){let r=this[ne];this.removeListener("error",Yo),this.on("error",Go),r&&(r._readyState=G.CLOSING,this.destroy())}});var ta=de((Mg,ea)=>{"use strict";var Bg=nr(),{Duplex:tf}=X("stream");function Zo(r){r.emit("close")}function nf(){!this.destroyed&&this._writableState.finished&&this.destroy()}function Qo(r){this.removeListener("error",Qo),this.destroy(),this.listenerCount("error")===0&&this.emit("error",r)}function rf(r,e){let i=!0,a=new tf({...e,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return r.on("message",function(u,f){let h=!f&&a._readableState.objectMode?u.toString():u;a.push(h)||r.pause()}),r.once("error",function(u){a.destroyed||(i=!1,a.destroy(u))}),r.once("close",function(){a.destroyed||a.push(null)}),a._destroy=function(c,u){if(r.readyState===r.CLOSED){u(c),process.nextTick(Zo,a);return}let f=!1;r.once("error",function(m){f=!0,u(m)}),r.once("close",function(){f||u(c),process.nextTick(Zo,a)}),i&&r.terminate()},a._final=function(c){if(r.readyState===r.CONNECTING){r.once("open",function(){a._final(c)});return}r._socket!==null&&(r._socket._writableState.finished?(c(),a._readableState.endEmitted&&a.destroy()):(r._socket.once("finish",function(){c()}),r.close()))},a._read=function(){r.isPaused&&r.resume()},a._write=function(c,u,f){if(r.readyState===r.CONNECTING){r.once("open",function(){a._write(c,u,f)});return}r.send(c,f)},a.on("end",nf),a.on("error",Qo),a}ea.exports=rf});var is=de((Og,na)=>{"use strict";var{tokenChars:sf}=At();function of(r){let e=new Set,i=-1,a=-1,c=0;for(c;c<r.length;c++){let f=r.charCodeAt(c);if(a===-1&&sf[f]===1)i===-1&&(i=c);else if(c!==0&&(f===32||f===9))a===-1&&i!==-1&&(a=c);else if(f===44){if(i===-1)throw new SyntaxError(`Unexpected character at index ${c}`);a===-1&&(a=c);let h=r.slice(i,a);if(e.has(h))throw new SyntaxError(`The "${h}" subprotocol is duplicated`);e.add(h),i=a=-1}else throw new SyntaxError(`Unexpected character at index ${c}`)}if(i===-1||a!==-1)throw new SyntaxError("Unexpected end of input");let u=r.slice(i,c);if(e.has(u))throw new SyntaxError(`The "${u}" subprotocol is duplicated`);return e.add(u),e}na.exports={parse:of}});var xa=de((qg,ca)=>{"use strict";var af=X("events"),rr=X("http"),{Duplex:zg}=X("stream"),{createHash:cf}=X("crypto"),ra=Zn(),at=Et(),xf=is(),uf=nr(),{CLOSE_TIMEOUT:ff,GUID:df,kWebSocket:lf}=Fe(),hf=/^[+/0-9A-Za-z]{22}==$/,sa=0,ia=1,aa=2,os=class extends af{constructor(e,i){if(super(),e={allowSynchronousEvents:!0,autoPong:!0,maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:ff,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:uf,...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=rr.createServer((a,c)=>{let u=rr.STATUS_CODES[426];c.writeHead(426,{"Content-Length":u.length,"Content-Type":"text/plain"}),c.end(u)}),this._server.listen(e.port,e.host,e.backlog,i)):e.server&&(this._server=e.server),this._server){let a=this.emit.bind(this,"connection");this._removeListeners=gf(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(c,u,f)=>{this.handleUpgrade(c,u,f,a)}})}e.perMessageDeflate===!0&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=sa}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===aa){e&&this.once("close",()=>{e(new Error("The server is not running"))}),process.nextTick(Qt,this);return}if(e&&this.once("close",e),this._state!==ia)if(this._state=ia,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(Qt,this):process.nextTick(Qt,this);else{let i=this._server;this._removeListeners(),this._removeListeners=this._server=null,i.close(()=>{Qt(this)})}}shouldHandle(e){if(this.options.path){let i=e.url.indexOf("?");if((i!==-1?e.url.slice(0,i):e.url)!==this.options.path)return!1}return!0}handleUpgrade(e,i,a,c){i.on("error",oa);let u=e.headers["sec-websocket-key"],f=e.headers.upgrade,h=+e.headers["sec-websocket-version"];if(e.method!=="GET"){ct(this,e,i,405,"Invalid HTTP method");return}if(f===void 0||f.toLowerCase()!=="websocket"){ct(this,e,i,400,"Invalid Upgrade header");return}if(u===void 0||!hf.test(u)){ct(this,e,i,400,"Missing or invalid Sec-WebSocket-Key header");return}if(h!==13&&h!==8){ct(this,e,i,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});return}if(!this.shouldHandle(e)){en(i,400);return}let m=e.headers["sec-websocket-protocol"],_=new Set;if(m!==void 0)try{_=xf.parse(m)}catch{ct(this,e,i,400,"Invalid Sec-WebSocket-Protocol header");return}let y=e.headers["sec-websocket-extensions"],v={};if(this.options.perMessageDeflate&&y!==void 0){let S=new at({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let A=ra.parse(y);A[at.extensionName]&&(S.accept(A[at.extensionName]),v[at.extensionName]=S)}catch{ct(this,e,i,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let S={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(S,(A,D,L,F)=>{if(!A)return en(i,D||401,L,F);this.completeUpgrade(v,u,_,e,i,a,c)});return}if(!this.options.verifyClient(S))return en(i,401)}this.completeUpgrade(v,u,_,e,i,a,c)}completeUpgrade(e,i,a,c,u,f,h){if(!u.readable||!u.writable)return u.destroy();if(u[lf])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>sa)return en(u,503);let _=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${cf("sha1").update(i+df).digest("base64")}`],y=new this.options.WebSocket(null,void 0,this.options);if(a.size){let v=this.options.handleProtocols?this.options.handleProtocols(a,c):a.values().next().value;v&&(_.push(`Sec-WebSocket-Protocol: ${v}`),y._protocol=v)}if(e[at.extensionName]){let v=e[at.extensionName].params,S=ra.format({[at.extensionName]:[v]});_.push(`Sec-WebSocket-Extensions: ${S}`),y._extensions=e}this.emit("headers",_,c),u.write(_.concat(`\r
8
+ var j0=Object.create;var Er=Object.defineProperty;var W0=Object.getOwnPropertyDescriptor;var J0=Object.getOwnPropertyNames;var $0=Object.getPrototypeOf,V0=Object.prototype.hasOwnProperty;var W=(n=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(n,{get:(e,s)=>(typeof require<"u"?require:e)[s]}):n)(function(n){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+n+'" is not supported')});var Oe=(n,e)=>()=>(n&&(e=n(n=0)),e);var de=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),Hi=(n,e)=>{for(var s in e)Er(n,s,{get:e[s],enumerable:!0})},Y0=(n,e,s,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let c of J0(e))!V0.call(n,c)&&c!==s&&Er(n,c,{get:()=>e[c],enumerable:!(a=W0(e,c))||a.enumerable});return n};var Le=(n,e,s)=>(s=n!=null?j0($0(n)):{},Y0(e||!n||!n.__esModule?Er(s,"default",{value:n,enumerable:!0}):s,n));import{chmod as X0,mkdir as Z0,readFile as Q0,rename as ji,writeFile as Wi}from"node:fs/promises";import{dirname as ec}from"node:path";async function lt(n){try{let e=await Q0(n,"utf8");return JSON.parse(e)}catch(e){if(e.code==="ENOENT")return null;throw e}}async function tn(n,e,s){await Z0(ec(n),{recursive:!0});let a=`${JSON.stringify(e,null,2)}
9
+ `,c=`${n}.tmp-${process.pid}-${Math.random().toString(36).slice(2,10)}`;try{s?.mode!==void 0?await Wi(c,a,{encoding:"utf8",mode:s.mode}):await Wi(c,a,"utf8"),await ji(c,n),s?.mode!==void 0&&await X0(n,s.mode)}catch(u){await ji(c,c).catch(()=>{});let{rm:d}=await import("node:fs/promises");throw await d(c,{force:!0}).catch(()=>{}),u}}var nn=Oe(()=>{"use strict"});function Vi(n){return sn[Ji]<=sn[n]}function Cr(n){$i={...n}}function rn(n,e,s,a){if(sn[n]<sn[Ji])return;let c=JSON.stringify({ts:new Date().toISOString(),level:n,module:e,msg:s,...$i,...a});n==="error"||n==="warn"?nc.write(`${c}
10
+ `):tc.write(`${c}
11
+ `)}function T(n){return{debug:(e,s)=>rn("debug",n,e,s),info:(e,s)=>rn("info",n,e,s),warn:(e,s)=>rn("warn",n,e,s),error:(e,s)=>rn("error",n,e,s),child:e=>T(`${n}.${e}`)}}var sn,Ji,tc,nc,$i,U=Oe(()=>{"use strict";sn={debug:10,info:20,warn:30,error:40},Ji=(()=>{let n=process.env.COZE_BRIDGE_LOG_LEVEL;return n==="debug"||n==="info"||n==="warn"||n==="error"?n:"info"})(),tc=process.stdout,nc=process.stderr,$i={}});import{promises as Yi}from"node:fs";import{homedir as rc}from"node:os";import{sep as ic,join as oe,resolve as Xi}from"node:path";function H(n){let e=n??rc(),s=oe(e,".coze"),a=oe(s,"bridge"),c=oe(a,"lib");return{cozeRoot:s,bridgeRoot:a,libDir:c,libEntry:oe(c,"index.js"),binDir:oe(a,"bin"),pidFile:oe(a,"bridge.pid"),portFile:oe(a,"bridge.port"),tokenFile:oe(a,"bridge.token"),logFile:oe(a,"bridge.log"),installLock:oe(a,"install.lock"),configFile:oe(a,"config.json"),agentsRoot:oe(s,"agents")}}function Be(n,e=H()){let s=oe(e.agentsRoot,n);return{root:s,config:oe(s,"config.json"),workspace:oe(s,"workspace"),logs:oe(s,"logs")}}async function Zi(n,e){let s=await Yi.realpath(Xi(n)).catch(()=>null);if(!s)return!1;let a=await Yi.realpath(Xi(e)).catch(()=>null);if(!a)return!1;let c=process.platform==="win32"?s.toLowerCase():s,u=process.platform==="win32"?a.toLowerCase():a;return c===u||c.startsWith(u+ic)}var xe=Oe(()=>{"use strict"});var cn={};Hi(cn,{AGENT_CONFIG_FILE_MODE:()=>on,enforceAgentConfigMode:()=>ac,loadAgentConfig:()=>fe,persistAgentSessions:()=>Ir,persistAgentSkills:()=>an,saveAgentConfig:()=>ve});import{chmod as sc,stat as oc}from"node:fs/promises";function fe(n,e){return lt(Be(n,e).config)}function ve(n,e){return tn(Be(n.agentId,e).config,n,{mode:on})}async function ac(n,e){if(process.platform==="win32")return;let s=Be(n,e).config;try{let a=await oc(s);if(!a.isFile())return;let c=a.mode&511;c!==on&&(await sc(s,on),Qi.warn("agent config mode auto-corrected to 0600",{path:s,from:c.toString(8)}))}catch(a){if(a.code==="ENOENT")return;Qi.warn("enforceAgentConfigMode: chmod failed (ignored)",{path:s,err:String(a)})}}async function Ir(n,e,s){let a=await fe(n,s);a&&(a.sessions=Object.fromEntries(e),await ve(a,s))}async function an(n,e,s){let a=await fe(n,s);a&&(a.skills=e,await ve(a,s))}var Qi,on,We=Oe(()=>{"use strict";nn();U();xe();Qi=T("agent-config"),on=384});var _o=de(Y=>{"use strict";var S=P;(function(n,e){let s=P,a=n();for(;;)try{if(-parseInt(s(1533))/1*(-parseInt(s(796))/2)+-parseInt(s(952))/3*(-parseInt(s(660))/4)+-parseInt(s(887))/5+parseInt(s(572))/6*(parseInt(s(412))/7)+-parseInt(s(763))/8*(-parseInt(s(305))/9)+parseInt(s(934))/10*(parseInt(s(700))/11)+-parseInt(s(739))/12===e)break;a.push(a.shift())}catch{a.push(a.shift())}})(Un,551064);var vu=Object[S(969)+S(656)],bu=Object[S(1438)+S(1321)+S(1704)],lo=(n,e)=>function(){return n&&(e=(0,n[{ZueCP:function(u,d){return u(d)}}[S(1260)](bu,n)[0]])(n=0)),e},Su=(n,e)=>{let s=S,a={vdvWd:function(u,d,l,m){return u(d,l,m)}};for(var c in e)a[s(381)](vu,n,c,{get:e[c],enumerable:!0})};function Eu(){return ao||(ao=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function Cu(){let n=S;return co||(co=[IDBCursor[n(1215)+"e"].advance,IDBCursor[n(1215)+"e"][n(1008)],IDBCursor[n(1215)+"e"][n(1008)+n(886)+"ey"]])}function Iu(n){let e=S,s={RJIZx:e(1459),nwXNY:function(c,u){return c(u)},hQdSq:function(c){return c()},GPRpZ:"error",sNmkP:function(c,u){return c<u},CbqXf:function(c,u){return c===u},qxJJq:"CMjkl",lZKlQ:e(231),NZXqU:e(1390)},a=new Promise((c,u)=>{let d=e,l={TcCxD:function(v,E){return s[P(1485)](v,E)},cqRlq:function(v){return s[P(1364)](v)}},m=()=>{let v=P;n[v(936)+v(1456)+"ner"](s[v(241)],_),n[v(936)+v(1456)+v(1233)](v(1119),y)},_=()=>{let v=P;l[v(1208)](c,Te(n.result)),l[v(647)](m)},y=()=>{let v=P;s[v(1485)](u,n[v(1119)]),m()};n[d(1375)+d(942)](s[d(241)],_),n[d(1375)+d(942)](s[d(392)],y)});return a[e(983)](c=>{let u=e;if(s[u(222)](s.qxJJq,s[u(1399)])){if(c instanceof IDBCursor)if(s[u(542)]!==s.NZXqU)Ur[u(840)](c,n);else{let d=this[u(343)+"rs"][_0x45b4f4];if(d)for(let l=0;s[u(1466)](l,d.length);)s[u(222)](d[l].fn,_0x2ebbac)?d[u(1291)](l,1):++l}}else return _0x43e904?this[u(995)+"E"]():this[u(1176)+"E"]()})[e(1358)](()=>{}),zn.set(a,n),a}function Au(n){let e=S,s={mHXPn:e(1119),MXfCr:e(497),jgmIP:function(c,u){return c!==u},gzcwo:"SMFRB",JMNGR:"bCgVq",kBQaR:function(c,u){return c(u)},WqpkV:e(658)+"or",xyfvI:function(c){return c()},VehYB:"complete"};if(Mn[e(1097)](n))return;let a=new Promise((c,u)=>{let d=e,l={GMDCE:function(v){return v()}},m=()=>{let v=P;n[v(936)+v(1456)+v(1233)](v(420),_),n[v(936)+v(1456)+"ner"](s[v(1169)],y),n["removeEventListe"+v(1233)](s[v(286)],y)},_=()=>{c(),l.GMDCE(m)},y=()=>{let v=P,E={smebK:s[v(1169)]};s[v(413)](s[v(224)],s.JMNGR)?(s[v(1126)](u,n[v(1119)]||new DOMException(s[v(443)],s[v(443)])),s[v(434)](m)):this[v(944)](v(1119),_0x3f1689(E[v(1552)],{..._0x399025,message:_0x42d12b.errMsg||""}))};n[d(1375)+d(942)](s[d(1566)],_),n["addEvent"+d(942)](s[d(1169)],y),n.addEventListener(s[d(286)],y)});Mn[e(840)](n,a)}function Pu(n){Fn={KlZWR:function(a,c){return a(c)}}[S(1601)](n,Fn)}function ku(n){let e=S,s={zHVYB:function(a,c){return a(c)},aZuBV:function(a,c){return a(c)},Lzfvh:e(296)+"8|9|1|2|4|5|10",jmOOH:"header",BtHEw:"name",BBTBn:function(a,c,u,d){return a(c,u,d)},oAPhe:e(799),WHyrR:e(1425),oWXta:function(a,c){return a(c)},qkBUL:function(a,c){return a===c},qsYQL:"objectStoreNames",LlLKk:function(a,c){return a===c},Xqpzr:e(1536)};if(s[e(591)](n,IDBDatabase[e(1215)+"e"][e(1147)+"ion"])&&!(s[e(832)]in IDBTransaction[e(1215)+"e"]))return function(a,...c){let u=e,d=n.call(s[u(220)](jt,this),a,...c);return Fr[u(840)](d,a[u(857)]?a.sort():[a]),s[u(1133)](Te,d)};if(Cu()[e(973)](n)){if(s[e(538)](s.Xqpzr,s[e(1313)]))return function(...a){return n[e(970)](jt(this),a),Te(Ur.get(this))};{let a=s[e(436)][e(457)]("|"),c=0;for(;;){switch(a[c++]){case"0":_0x30b335[e(378)](e(863)+e(277),_0x11dec7,_0x1eea5a[e(799)]);continue;case"1":_0x2ef24d[e(378)](e(1061)+e(587),_0x13acb8);continue;case"2":_0x79f8e1=_0x13cbb7(_0x45dc69[e(1352)+e(638)],_0x1264be,_0x106d9b);continue;case"3":_0x37acf4.log(s[e(1039)],_0x595258);continue;case"4":_0x4fcbc1[e(378)](s[e(1381)],_0x3aaf01);continue;case"5":_0x4a21bd=s[e(892)](_0x165eaf,_0x1b9a35[e(580)+"er"](_0x165923[e(1685)]||_0x50a53f),_0x144caf,_0x2b6a54);continue;case"6":_0x15fbc9=_0x2d825f(0,_0x48c1f2,_0x100ccb);continue;case"7":_0x94dd97=s[e(892)](_0x5d6fd3,_0x3a8a4d,_0x3b8c03,_0x380823.service||0);continue;case"8":_0x15850c[e(378)](s[e(776)],_0x1dd823);continue;case"9":_0x4ce7a8=s[e(892)](_0x52d53d,_0x1b6280[_0x35d686["cursor_n"+e(638)]],_0x3b3c3b,_0x2ae193);continue;case"10":_0x115f35[e(378)](s[e(813)],_0x3c6354);continue}break}}}return function(...a){let c=e;return Te(n.apply(s[c(963)](jt,this),a))}}function Tu(n){let e=S,s={jKtpx:function(a,c){return a===c},UliOg:e(468),HiwQJ:function(a,c){return a instanceof c},BasnV:function(a,c){return a(c)},qsEPK:function(a,c,u){return a(c,u)},dzlVy:function(a){return a()}};return s.jKtpx(typeof n,s[e(1720)])?ku(n):(s[e(1274)](n,IDBTransaction)&&s[e(482)](Au,n),s[e(1582)](ho,n,s[e(1696)](Eu))?new Proxy(n,Fn):n)}function Te(n){let e=S,s={NAPOL:function(c,u){return c(u)}};if(n instanceof IDBRequest)return Iu(n);if(Ln[e(1097)](n))return Ln[e(1288)](n);let a=s.NAPOL(Tu,n);return a!==n&&(Ln.set(n,a),zn.set(a,n)),a}var ho,ao,co,Ur,Mn,Fr,Ln,zn,Fn,jt,xo=lo({"node_modules/idb/build/wrap-idb-value.js"(){let n=S,e={BeZkt:function(s,a){return s instanceof a},KyCYE:function(s,a){return s===a},PdRpS:n(798),ogwdS:n(782)+n(731),ogIJm:n(1352)+n(638),UDgON:function(s,a){return s!==a},mmSAW:n(264),vOspD:function(s,a){return s===a},UiQrX:function(s,a){return s in a}};ho=(s,a)=>a[n(1534)](c=>s instanceof c),Ur=new WeakMap,Mn=new WeakMap,Fr=new WeakMap,Ln=new WeakMap,zn=new WeakMap,Fn={get(s,a,c){let u=n;if(e[u(1303)](s,IDBTransaction)){if(e[u(1150)](a,e.PdRpS))return Mn[u(1288)](s);if(e[u(1150)](a,e.ogwdS))return s.objectStoreNames||Fr[u(1288)](s);if(e[u(1150)](a,u(1324)))return c["objectSt"+u(731)][1]?void 0:c[u(782)+u(426)](c[u(782)+u(731)][0])}return Te(s[a])},set(s,a,c){return s[a]=c,!0},has(s,a){let c=n,u={mgUaa:e[c(449)]};if(e.UDgON(c(264),e[c(893)]))this["_cursorN"+c(1020)]=_0x18bb5d,this["_cursorF"+c(332)]=_0x416d03,this[c(349)+"Strategy"]=_0x563ad1,this[c(466)]=_0x192fdf(this["_cursorN"+c(1020)],u.mgUaa);else return e[c(1303)](s,IDBTransaction)&&(a===e[c(707)]||e[c(1433)](a,c(1324)))?!0:e.UiQrX(a,s)}},jt=s=>zn[n(1288)](s)}}),go={};Su(go,{deleteDB:()=>Ru,openDB:()=>Du,unwrap:()=>jt,wrap:()=>Te});function Du(n,e,{blocked:s,upgrade:a,blocking:c,terminated:u}={}){let d=S,l={srNQF:function(y,v){return y(v)},PDqSr:function(y,v){return y(v)},ihjuB:d(743)+d(785),AfDxJ:d(1481)},m=indexedDB.open(n,e),_=l[d(1430)](Te,m);return a&&m[d(1375)+d(942)](l[d(865)],y=>{let v=d;a(l[v(980)](Te,m.result),y[v(1232)+"on"],y[v(1448)+"on"],l[v(1430)](Te,m[v(1147)+v(1262)]))}),s&&m[d(1375)+"Listener"](l[d(1021)],()=>s()),_[d(983)](y=>{let v=d;u&&y[v(1375)+v(942)](v(240),()=>u()),c&&y[v(1375)+v(942)](v(1504)+v(830),()=>c())})[d(1358)](()=>{}),_}function Ru(n,{blocked:e}={}){let s=S,a={fJiAy:"blocked"},c=indexedDB[s(607)+s(1476)](n);return e&&c[s(1375)+s(942)](a.fJiAy,()=>e()),Te(c)[s(983)](()=>{})}function uo(n,e){let s=S,a={oPDqw:s(456),GJeAC:s(1308),LywlC:"readwrite",RPsLP:s(512),VjbzA:function(m,_){return m in _},gpsWK:function(m,_){return m===_},HMZkj:"string",vpzVe:function(m,_){return m!==_}};if(!(n instanceof IDBDatabase&&!a[s(1445)](e,n)&&a.gpsWK(typeof e,a[s(1346)])))return;if(Bn.get(e))return Bn[s(1288)](e);let c=e.replace(/FromIndex$/,""),u=a[s(759)](e,c),d=mo[s(973)](c);if(!(c in(u?IDBIndex:IDBObjectStore)[s(1215)+"e"])||!(d||po[s(973)](c)))return;let l=async function(m,..._){let y=s;if(a[y(1170)]===a[y(1555)])_0x42c818.d=(v,E)=>{let k=y;for(var D in E)_0x10b401.o(E,D)&&!_0x333410.o(v,D)&&_0x1562d6[k(969)+k(656)](v,D,{enumerable:!0,get:E[D]})};else{let v=this[y(1147)+y(1262)](m,d?a[y(1107)]:a[y(521)]),E=v[y(1324)];return u&&(E=E.index(_[y(1516)]())),(await Promise[y(496)]([E[c](..._),d&&v[y(798)]]))[0]}};return Bn[s(840)](e,l),l}function Un(){let n=["BxnNsuq","uuT4Cwu","tuvtu0fhrv8","zNDZxZeUmc4","zcbLCNjVCI4","BLvPCw0","ANbNwvK","Dw1yrLu","DMvYC2LVBMm","CKv5tK4","y29UDgv4Da","wLbpuve","zMLSDgvY","r3jHsKe","ExnrDxa","yuD2r1G","EujSANK","y3r4","zw5HyMXLqxu","DwvPzuG","C2HPzNq","y3vYCMvUDeK","y29SBM8","r0PNCg4","z25Tufu","rLfisKq","wu1xB24","B25ozxr3B3i","zhbOrxy","rufKv2W","EfLutxK","AxnAzxjV","su1etw0","v2H5swu","yMfSrxzLBNq","sKD0u3e","DKDgs3a","mtq0ohjHz3rKAa","C29Tzq","BhrAEhe","whDYwva","vMP2Bg8","sLjSweq","zKjTsK0","q09oveLovuu","B25pCgvU","AxmGDw5Kzwy","DxrVuMvJB24","zwjKy0W","yMfyvwi","r2nxqLm","s0nQAM8","BKfnAuu","wfzRwNG","Bg5sC3e","tNjduKS","C21LyKS","ig1LC3nHz2u","qw5dtvK","r0PLqum","AwXK","v0PbEu4","EKDLDhu","wuPcuMm","x2rPC3bHDgm","sLLbzfy","sMTvv3G","v1HbCuS","se9Ut0G","CMfTugfYyw0","vMvOwui","qurgCvO","u29dsKK","shbUzhu","Dxrjza","s1nSEhC","yKP2q3G","z1nvu0C","DwTXu2C","A3Lxy1a","t1bftG","CMvZzxruCMK","tNPVq0G","zg9cu3G","uNHnDLy","EMPcBgm","CxnfueS","u2TPCcbWyxm","BMrLEa","C3vIC3rYAw4","zuDfyxu","s3rft1q","Cgjjwgq","Dw5ZAwDUzwq","su1nBg0","ywrK","Dg9hzw5LCMe","CxPUA2C","wwXJB3y","vfzWvMO","CLzHBhvLCW","EfvZzuvUDG","Ec1TC2CTy3u","Cw9tDe0","weTKExK","s2XAv1i","q3LSzhK","Cw9Zx18","z3rWDvu","v05qBNi","z2HqBxO","ve1dDui","y01SyuC","zuTfB1q","y0rjs24","B2fK","zMzLCG","rxLcsgu","DNHWEuW","CxvPs1i","zcWG","tvvYyNm","z2nXC2q","CNvUBeC","x3DZsw5ZDge","vgTgCeq","zxH0zw5ZAw8","y2rKzMu","AMntwwm","y0jeDKm","B3nLrxzLBNq","vKDgwKK","zhviEKK","Dgv4Dc9WBge","zePvvNK","rw5hBLG","AfbJuhe","tuL4A2e","x2zVCM1HDeu","y3jLyxrLt3a","z3DAwK4","rgzzDKm","BgLUzq","Bg5Nqw8","C2zVExO","tKfusvzfx0u","wKTlveG","Dvf5CK8","DcbVzIbYyw4","CgLUz19VBMm","uvH3C3i","x2LZtM9Kzq","t3bLBKv2zw4","tg9pCxK","BwvKAwf0zwW","AxD6Bva","CgfYC2u","ALHNEue","BuLyshK","vermDM4","zKrbvKu","s1niveu","ANPzzKm","ExvlDuK","vfrVEgi","tM9vEuC","CwD5Axu","CfjKzuC","x2rLyNvN","r0LoD20","x2DLDeLUDgu","Eef5A2C","wNfAA0y","shL3DLO","yxrHlcbKyxq","v2zTthi","D2vI","BNvkt0i","DMLJzuLeig8","tND2wxq","z2v0u3rVCMe","zhjZwKO","l3DZl3yY","zNjVBuj5Dgu","twLZC2LUzYa","vgfTv2G","rhDOruy","uxLIrKS","EvjHuu0","y3vYC29Y","uefsvei","Aw5L","t1npuwS","DMvUDa","z3LqsLm","x2LZtwLUAvC","u2LJC0q","zgv2AwnLx2K","x3bPBMC","Bgnvsg8","zhPSvNK","wM5yz0G","zv9ZDwnJzxm","y291BNq","AKfeDNe","DwLIyxi","x3bYzwzPEa","rxvZDNO","BwvZ","CgfNzwHPzgu","y0PAEK8","y2H4EMS","teTntKy","uvnsvee","wwvvC28","yw5ZzM9YBvq","C3rYAw5NAwy","sw53BKy","A3PgDLG","CMvWBgfJzq","AxnrB1nnzxm","CMf4ELi","C0jf","DMDyqK4","vwXPt2C","x21PBMLoyxy","DhDVCMTdAge","ENDky3G","D3jqAuq","EKHwwui","sw9wtwW","q2jXwgy","CMfUzg9T","z3PJD28","lcbOB3n0BMe","zM5Ps2K","vxPvAva","tuHSCKe","BwfUDwfSihi","zxrkrge","AfLXswe","uMTvtKy","B2nRzxrgywK","BgfxqMe","nxWYFdf8mhW","Ec11C2uT","Ew1iCgS","CKf4Cfe","veXlEKW","y2XVC2u","uKPjwNG","CezzrwW","z2v0q3vYCMu","yw1LoIa","yMfSu2nVCgu","DfnkrLm","v0zrwe0","ihrPBwvZ","DhjPzxmGCMu","C3rYAw5N","vxbKyxrLq28","y3zTEee","vwfNDwS","AMvorLa","AeH4teO","CKrAvKe","B1nrAha","sKjvtvC","v2vPEgLUsLm","wMLfCMG","B2zM","B3jRig9MzMW","x3jLy29UBMu","v0rMsM8","BMCGDxjSoIa","yvLXAgS","CMvJB25Uzwm","wMjsEg0","x2HHBMrSzu8","mdaWmdaWmda","zw50","u0fXAKu","wgH0sNm","CNnVCL92ywW","zuf3ufm","A252uNG","zxj2AwnL","Exv5t3e","uKL5BKO","s0Dkv3O","x2nVBM5Ly3q","x0rctMfTzq","yM9KEq","uvnlsMK","B25szwnLAxy","tvHMq3i","D3jPDgu","B25fCNjVCG","y3vYC29Yx2y","x29Ut3bLBG","ruTwueK","s09qr3G","nxWWFdeWFdC","CNnVCKzPBgu","Dg9cExrLCW","mhW2Fdn8n3W","tKrTzgy","vNn0ugW","A1npBgi","yNL0zuXLBMC","EsbJBg9Zzwq","qM1Irxq","vwXothu","CKzkuLC","ntyZmJu2C2ryvu9g","BgLTAxq","AefJA01LC3m","ELH1v0C","te9vv2K","BgXKvwm","yNf1rfq","AerJu0O","v0PdsMu","tKnXvxO","r2ryve0","BM9Uzv9UB24","DeDQAvC","DxnLCKLW","ug9zDxi","vLvzAvC","z2vY","qwTtt1y","q0LrAK4","rLDt","DMrKt3i","rvzYv0C","t0ncELC","ELrUD2G","B3vUDa","zwXZt24","ChrVCG","AwXLtMfTzq","v2LUzg93","EvzHvfy","C2vYDMvYvgK","rvrdsNy","v1rOz24","DgvmB2Djre4","C2vUza","D3D5ywK","ChjVDg9JB2W","Cu9rtNi","x2XPC3rLBMu","DNzvDfi","AgvKtwf4uMu","AwDHDg9Yt24","BMrWB2LUDfq","BezSDxnO","x21LC3nHz2u","DMfSDwvZ","ugHfDg8","Ehv6uLy","suvtx0vsuK8","AxnFywnR","BgvY","yw5Hz2vY","EMXpyKm","wxPwDNa","B25VCgvU","B3v0sw50zxi","t3jltw8","yKLrBge","mhW0Fdf8mNW","zLzRBKq","v1D1v0m","vKPdC0G","su54vg8","z2v0s2v5","tu95y0m","wKv1A3m","u2nuzeq","A2v5CW","shrQDuu","AuXOCem","rfvgAxm","vK9TCfu","x2rItMfTzq","Bg9N","zxjYtM8","wvftAK0","DMr2v2q","qLzVCNO","zwn0","vgfNu1q","AffcsLK","u1DOtKC","ywDLsgLKzq","C0HMCfC","CMvXDwLYzwq","rKLmrv9ot1q","DMvY","r1bsCfO","vMvrvMG","sgPAsKe","AxnrB1nby2S","zgf0yq","s2vut2O","r0XJD3u","vMjeu0W","mhWXFdr8mNW","BNrfBMrWB2K","Cg9PBNrbBMq","BKj2teK","z0Dmyxe","whDnB3y","A2v5","CgLUz0LUDgu","BgnQD3C","r0PRq28","wKLWzgO","B25tDgfYDfi","mtr2z29MAvy","AMDTsva","thnqrfG","yML2zfq","rvnerfe","y2HnyxHdB3u","twvZC2fNzuu","uevjBuK","y29TCgXLDgu","sfnZtwS","zuPPAfG","uunus2O","Bvn3uee","v3H5Cuq","B3jL","DfPPv0S","vhvPC1m","tujuzMG","zMvY","zNjHBwvuExa","zevUuuu","uLjpuG","EhLMDKK","CMvKDwnL","thPMDMG","AvjWqNO","vgfLtfm","r2fXrgi","A0vNuMi","yNL0zxm","DKDjruO","v3fWA1y","A0Hdvg8","txnKB1C","sKXVve0","Aw9UvgLTzw8","shHIAK8","B2DjsM0","rxzwreK","BKXPBMu","q0Xpu0LorW","D3jPDgvvAw4","zK10DgG","x3nLCuLK","vNz5vhm","C3bSAxq","vfL6Cgq","DhbizwfKzxi","ELjZyKK","yKzWCe4","zhLLteC","sM5vAue","rxzlvhy","tNzptgS","x3fVC0rc","B3bLBKrc","zNvUy3rPB24","Chv0","u0zhrNm","suL6u00","Bxnwt3O","x19LC01Vzhu","AwXLx25HBwu","q25RyNm","DufmA0e","q3PpuNG","vfHcDha","tKr6wLG","AwvIqu8","sMXKweu","qMfZBLy","BMCGB3iGyw4","zNjVBNrPzxi","ign1CNnVCIa","wvDtz3C","ruzTq2K","BMjvBgS","AgfxvKm","B3bLBIa","EwryDwC","x2LZv29YA2u","rgn3uMq","sxLpwwK","yxbWzw5Kq2G","ywXS","ywjVCNq","s0jjyw0","x3bYB3rVy28","v01Ku3q","ywDL","CMvJzxzPzwq","CMvHC29U","t3H1Dwy","D1f2BxG","zuHzue4","u2vXsuq","D29hwMy","rxjYB3jdB2q","yMrFzgLK","yw9Vs1m","CMvHzg9UBhK","B3nLza","vNPpB0C","yw51Ce1LC3m","t2XWrMK","Aw50zwDLCIa","CgLUz09Uy2u","AwrI","zfb5ueK","uLbZtfa","DvvvDhm","ExPnAfy","Aw5KzxGGB3u","uK5SEe8","tKfzDu8","zxjHDg9Y","Aw9Ul2PZB24","zg96vhm","id4G","B25TzxnZywC","AxnbCNjHEq","vgLTzw91Da","ihrYEsbYzwm","ChbL","zw5JB2rLrNi","z1jKu3u","tgXms2S","wLbXvuS","sNHUwKC","BwLUzW","BfPlBfe","wNHgBgS","BNz0qxa","q09otKvdveK","x2jPBMfYEvq","B2rXwgm","uxrcEu8","Dw5KzwzPBMu","CNjVCK1LC3m","z2vjBMzVu3K","x2LUAxq","z29PBMCGyxC","ugHxq0K","vfjTC2q","vLPfuNy","Ee5Qz0i","BMv4DcGPigm","zNjVBunOyxi","tNHqqKy","DeHzrvu","BwvZC2fNzv8","wu1HAgW","EuPvtfG","zgvS","yK1mEhq","rvjpzvy","lcbxzwjtB2m","y3rOs00","C2v0u3rVCMe","uKnKquy","mJCYodi2nKTjrK9dDa","swP5t2y","zw5fDMvUDa","C3LAzuO","CNHbA0G","yKLesvC","zxf1ywXZ","z2v0qwXS","zNjVBu51Bwi","rhzXvKC","sM5bCge","D0nMwwq","C0Xf","BMnYsNG","x2HHBMrSzvi","BMfTzq","BxDztKu","Exn4D0i","BwfW","CwTcvuW","Aw5qEhK","zKLIwgO","q2fYuLm","seX3Cxa","x3bPBMDmB3m","x29WDgLVBNm","B25SAw5L","y29UBMvJDgK","Dw9sA2e","Cg9W","C2v2yKq","y3Phv2K","Dg9oDw1Izxi","q2zXEKS","EvzIuei","zgvSzxrLrge","y29Kzq","uuvssKK","BgLUzw5V","A2Tmy1K","Fdf8oxW2Fdm","B25nzxnZywC","sM9pwe0","wMDAtwW","x29UtwvZC2e","B25LCNjVCG","Ahr0Chm6","y3jLyxrLtwu","ufLfBKm","B3bLBG","CuvYqNq","AgvHzgvY","DwXvq0G","y29UBMvJDeu","tg9NsurozxC","m3WXFdv8mhW","DgvZDa","zunlqwO","zwnVBM5Ly3q","DwjYsu0","ywnR","uuf5vMC","y3jLyxrLuMu","zxjFCw9Z","Cgf5Bg9Hza","qxfUvxm","yw1L","v2Ljs0W","Cgf5Bg9Hzfq","t0XwyNG","vw9LqKO","CMvZzxrdB3u","v2Xuv3a","tu5qCNy","x25HDMLNyxq","y3fsBhe","vMT1Dxy","wfrmBhK","wM9oCxu","vgzoq0y","yMzdCge","Efnit1G","svjnBxy","yvDyuMW","B3bLCNr5","Dw5RBM93BIa","qwjVCNrfCNi","y0nTC0K","mZu4ntjRq09AqwW","AgLNAa","uM1fEe0","Aw5Lza","sMvrvLm","zurRyNq","qw1VDw50","CMfTzq","B2nRzxq","uMvHzcbWyxm","x2HHBMrSzva","qwnNugq","BM5Ly3q","C2jHz3i","zv90Aw1LB3u","r3LTCw4","ywWGy3vYC28","AKTUtNm","C0zmD2i","CNnVCL9Uyw0","qNn5svK","u1brtMW","yNH2zNa","zMLN","AxroD1u","ruLcBLu","yMfJA3vWigu","C2XPy2u","igfYCMf5yNu","igXHCMDLCIa","BfrYAK8","qxLZtuW","t0H0DeO","CMvUDevUzha","sxb6Ee8","yuvJs1K","C2XgzwG","ueLIu24","AevYCM9Yrxy","vuzbtvu","mJaXmJK4ouH5ren4vW","zNjVBujPDhm","A2r3yMG","x2LZtwLUAvq","Ae9Wzw5fDMu","BMDLza","wfr5zNK","ugrsCfm","vg9lANe","r2zcv1C","y2XVC2uSihC","CgvYC2LZDgu","BwLZzq","Eg5oDvG","u3jvELK","uNrbEee","rfrzz1q","D0Xzv2y","sMHQEhi","rw9uweC","CM92AwrLigi","BxnN","yw5Nzq","ywnRDxbfBMq","seLivfy","wKjqDM8","C2v0sxrLBq","aaaaaaaaaaa","wNbTAeK","D2fcBMu","x2nSzwfYvgK","B3jLtMfTzxm","C3rHCNq","BfHnzuy","x3jLywr5q2W","zeT5CKq","t2jQzwn0","DfzvqLO","u0TUtfa","mJiXotmWnZzpD2r3re8","A1Hpy3G","Bg9Nsurhzw4","zxrxB3jRq2G","DxbNCMfKzw4","zuPpvLi","rNjVBNrPzxi","wKnuzfO","sxfwA1O","Dhr3Awq","BNruCMLLC0m","y0HTz0C","A1fkt0G","A2zLA0O","ywX3yxLZ","mNWXFdb8m3W","q2Tlqu0","wwz0v2G","AgvHzgvYCW","yxnL","DNb6vMu","u0Lvuwy","rxzLBNq","BvjZy1i","odHNt3zVqMi","Dg9VigXHCMC","zhzvz0y","BfnlA2y","BxL3D2u","vu9frwO","CKvuuLq","zMzMzG","rgDKzvK","yxPnB3y","x3jLBw92zvC","DxrwEfO","s2rnuMW","B0fqAgu","B3jpBMXPBMu","CuPdwhi","y29UBMvJDca","wNfhB3u","igzPzwXKoIa","B2jQzwn0u3q","A0Xxreq","uLbXsfC","zwvKzwq","x2n1CNnVCK0","ELfAvLy","vgPpuxa","tfbWweq","DunKwKO","ihjLy29UBMu","EfDdvxK","uxvLDwu","yxv0B21HDgK","y3vZDg9Tshq","mtm5ne5XD3LkvW","DMLrzey","zg9Uzq","C2vYDMLJzq","Bvvzt1G","rvnUC0C","uMTUy1e","u3rYyxrLz3K","whvNy0i","y3jLyxrLt2i","u2ruB0C","CvHgCge","EhzhwKy","CMvQzwn0","C2nYAxb0","qMXYAfu","BNrLCG","v0H5CLi","te1ksMm","wNLStxe","z0Lqy3C","sePmrge","tvfuuKC","sLnptLa","rK5Qwe0","B2nRzxrtDwm","rhvcBxK","zxH0ugf5Bg8","C0XPC3rLBMu","uwzXy1O","yxH3q2u","u2HbvMK","wxnkAve","C0nvy1q","AgfUz2u","x3bHDgHlzxK","CxnzuuW","zwPfqve","EezduK0","BMnVzgLUzW","t1L5DeG","BLbkwxu","y1zku0y","x2LUAxrhBg8","C2v0","y2XLyxjtDg8","A3jMzgC","r2rYDuO","su5tvefova","sNvNDNi","wxnSsvy","zM9Yy2u","rKDjDe8","Au9Zr0m","zxHWB3j0CW","BMDuAw1LCG","C1LwDhu","q29Kzq","zunZr3C","tg9JAW","weTMDu0","C29YDa","CMvZB2X2zq","vevUz28","ChjVy2vZCW","uu1VufC","B0n6shG","y3vYC29YlNm","DePUt0C","AwHQDui","CM92AwrLihC","AMfnwvy","DhjPBq","AMvJDfn0B3i","shD2q3O","icSG","vKLzBxe","yKHHu1G","BgvUz3rO","A01gv2O","AM9PBG","y29Uy2f0","DxrMofDYAxq","EfPys1y","ywnRtxnNswq","BgrKBfa","sM9sre4","CvHqrNK","BfjfA1m","A0TjBuO","uhjPBwfYEuS","ndK5ntq5mfPpBeDqwq","qwv1wM8","yxnZAwDU","qNjPzgDL","DMvYC2LVBG","qKjuqM4","Bw1tqvC","vK14BxK","vwzPrMm","BfDrB2u","vLf5CvC","v2vIu29JA2u","Bwf4tg9ZC0m","AvvywLK","C2v0q3vYC28","Avjgr1O","BgDgu0i","y1vOrhe","y2uGBM90igK","Dgv4DfbHEwW","C2fNzq","BwDPwem","rKHsD04","ue5mA3u","EerMBMK","wfDIDva","vKHorfG","Bwu6ia","pxv0zI04","DgHQwMW","C09LEuK","uvvIuuS","BgLZDgvUtMu","rgvKAwnHDgu","uhjmvxy","CgLUz0XVC3m","yNvMzMvY","B2zMC2v0","C3vIyxjYyxK","tg9Nsuq","CLziwvm","vgHND0W","BNvTyMvY","zw50zwqGDhK","qLrTy2G","zNzwzgq","Bu9dA1m","mtbkCNbSquC","ywnOzwq","CMvTB3zLrxy","uevsANq","Au51B0K","zxjYtxnN","u0vozfC","CgPiDfm","tgLZDgvUzxi","x2rLC3rYB3K","zw1PDa","r1HOq3i","BwLUAvbYB2C","vvfuCMW","Ag5rtuK","D0z4Bg0","zcWGDw5RBM8","tgDRz1m","mJa0uvjivgvb","vejHtMK","u2HHCMvKv28","D24GCMvHC28","wLLgweC","zujPwvO","y2fSBa","zw5XDwv1zq","EgLNtgO","vff2BMm","A0nzCwC","B1DyDge","ww1Kt1e","y2XVC2veqG","uwHUug4","EKfWqvi","x3DZ","zgvMAw5Luhi","yxbWBhK","wKzLB1u","C2vUDa","Aw5JBhvKzxm","qMXeuve","ufbOyw8","zuLSqK4","uhbeAM4","DgLTzw91DcW","BML0AwfSAxO","C3jouuy","v3vyCxe","wgzQCgK","DgHLBG","BM93","ywXSzwqGBxu","y2jsy3i","AMTOtKi","BIWGAg9ZDg4","ELH2y3u","zM5Xq1q","vuz5EvO","sNbZEhi","Ehvnu2K","q09ttfm","Dg9cExrLC0W","sNHRCuG","reiGzMfPBgu","uNjcyK8","x2n1CNnVCKy","uwnkCMu","zxjFCw9Zx2e","x2nYzwf0zvm","DhjPzxm","tMnguuO","D25OuwG","uvj6qwm","t2XYy3K","y29UDgLUDwu","v0rfuNK","qM5ds3a","AgDkA24","u0LeCeW","BMzYu2C","thrZDNu","se9NwNG","zxq9DxrMltG","y2HLy2Tszwe","sKnwCfe","B1zcBfm","yw1Lu3bHy2u","qwzeEeO","uePlwvG","zxjFywnRx20","ignVzgu6ia","q2TwuMG","v2nlEwS","q0Xpu0ve","zKzrEKq","DxbKyxrLq3u","CNzHBfzHBhu","tufyx1jfvfi","Dw50","Efrurw52","Bwnzz2u","ywXSB2nvBNm","A3n5uMS","D0Xvvvy","zvvYBa","AM1pt0G","zsbHihn0CMK","t1D5D2y","ihrPBwvVDxq","rgz4tMO","t2Lguva","AenSB3nLrxy","Aw5KzxHpzG","z2vtEw5J","zgvSzxrL","BMvJDa","EvjLy29UBMu","ywzL","t3PeB1K","EvnAt1O","EgLKr08","sKvRC1u","t2rbBgG","ExHSzxe","sKXuswu","BLDkAuO","y3vYCMvUDeu","C2vYDMLJzs0","z2v0sxrLBq","swTtDLG","ywXnwgW","C0nwCLC","x29UrxjYB3i","ywXty29Wzq","whHhuNK","B25tDg9Wsw0","x3bPBMDqB24","yKjqugy","vfPZsgm","sezIA0y","y3jLyxrLrwW","yxGGCMv0CMK","CKLOvhy","yLjYu3C","zw9fDxu","sxnytgW","rejSz3i","AwXwrNy","zfDVCMTLCKC","ChvZAa","ywXSq3vYC28","AwXSihvZzsa","x3nLBMrby2S","rujYALC","qLvKseW","B25dBg9Zzq","nhWZ","Axnby2TdBgu","zw5HyMXLvhi","DKjWteW","t0XJy0O","qvnqyvK","rersB3i","AgfZ","CMvZzxrfBMq","AMP0DLK","ywDLu2HVDW","zKDkr20","Du9HCgm","wvPJt3y","BwHVzLO","yxvmz2O","t1bftL9fuLi","thL3Bem","Dengvhy","DM5oC3q","q291BNq","BwvZC2fNzq","x194x21Zz18","txPWCuS","Dg9iyxnO","BgXryK0","q0zxuhK","yKjbwMu","z2v0qwXSs2u","zxjYB3i","Be9rr0y","x29UvgLTzw8","tg9guue","C3nHz2vfDMu","tgvlCwW","AwzlyMW","A0jryvi","B29oEgy","x2rYB3bhBg8","y2HhveS","mNWZFda","C3jJ","De1HBMfNzxi","yvP1qLy","y2XLyxi","wMziChG","y2HHCKnVzgu","z1rPBwvVDxq","ywrKq291BNq","DxjS","quXrtgO","BMCGzMfPBgu","EunZCM0","CfnjAuu","Cw9Z","ELzqEhq","sK9pC0i","DhjHBNnHy3q","DhLWzq","Cg93","s3Ldwuu","ExPlCLy","AurzBge","EhvqsNa","zgjozuC","y3ruAw1LB3u","z2v0q3vYC28","CKLqqwS","yKXRC2G","tvfVt0G","vgfN","zevQt0S","qxvouey","BKv1t1O","tM5RAfC","vuPuDuO","Ae1IzvG","s3vxuNq","uMvSquK","BuHyug4","B1beCxC","shDeBuG","lcbTyxGGCMu","x2LUDgvYDMe","zgrjrcWGzgu","CMvHzhLtDge","Dg9cExrLC0i","zgvJB2rLzey","uLDqyum","AMPvrwy","zM5oA2u","Bwf4uMv0CMK","B2LUDfjLywm","C2vUzf9Hy2S","x2LUAxrqCM8","wK1nBMK","CYbHBhjLywq","wMHsqK8","Agzqt2S","Cgf5Bg9Hzeu","zMvlrMu","DvDjC3m","CvfbteK","tKvYsfC","B3jRzxjhBg8","C3rVCcbPBw0","uMXmyue","reL2yMS","ywXPzcb1CMW","tM90Beq","C1H4uhq","y3jLyxrLq2W","ENfdq00","BMXTANC","rwvND0i","DevnAMK","yNb1Eu0","rM9zuKS","vgndEeq","uMDYze8","x1fVu01HBMe","zMLUza","zw5JB2rPBMC","x2LZsw5PDa","CfjLs2i","ChjVDg90Exa","yMLUyxj5vhK","mdaWma","wMnNuvy","x3nVy2TLDa","C3rLBMvYCW","vhLHAvG","z0XRDgu","yxv0BW","x3DHAxq","se50yM8","zKTttxK","CwjmwMS","Cg9PBNrdB24","ywDLrxzLBNq","tw9KDwXL","zMXVB3i","B2XKvMvYC2K","BMvY","DuDKrgG","B0L6EKy","x2rPC2nVBM4","tgv6ExK","Dg9mB3DLCKm","x3vYBa","Agzkruy","u0DrzLu","Dev2zw50","vKLlD00","uuDTzgO","CIb0DhDjra","s29Rrva","tw9xqLi","m3WWFdf8mNW","Dgv4Dc9Qyxy","y2DXu24","r3PQs0G","y29UBMvJDfm","u1nyu2q","x2n1CNnVCK4","qwX2AvG","zgn4DNm","CMrAyvC","CMfNzvn5BMm","CM92AwrLige","wNvLq1a","zKjnq2i","Aw9U","Bg93","C0nVDw50zxi","EurIzfa","verYteG","Aw1LCYbPBIa","y2vZC0HHBMq","CMLLC0nVDw4","zw5KCg9PBNq","te94C20","qKvbsLK","BxDmv08","sgL3uuO","ihrVihjLDhi","CMv0CNLdB3u","D0rJsxO","x0vysvnu","y0jkrKu","EKvcz3i","sLjRzuW","y29UC3rYDwm","ENjttuC","zgXmzLa","uMjfENi","tLL3vNO","x2LZqNjVD3m","z2v0","z2u6ia","D3byqMq","C3bSAwnL","Bvntuhm","Bhm6ia","CNzHBa","y096Cuu","Dhj1y3rVCIa","igzHAwWSig0","z3Hkrhu","BMnLq2XVC2u","txn3Cwe","ywnOzwqSihC","DMfS","qMvAA3q","yKX3zeC","yNvMzMvYzwq","yM9L","ywDIA08","qKLbB3a","B09fufe","BeHHBMrSzxi","wMDlD08","zMzmAw5L","whfWENi","sMDhr1u","BfrPBwvVDxq","CMvHzfvjBNq","AvfKwvm","x2vUzhbVAw4","AxnszwfKEq","nhW1Fdz8mxW","B3bLCNr5tMe","rLjbEhO","tMfTzq","C3rVCMu","zNjVBuHHC2G","zxjFAxnFywm","DKjcCwG","zgLZywjSzue","sLvLv1u","x2fKzfDZtgK","zxjFBxnNAwq","z2vrDwv1zuW","CMTLCKDSB2i","tK1Psei","rwj6BuG","EhfWA0C","DeLUDgvYy2u","CwDJvgG","D3nZoI8V","CgfNzxnOB3C","y09Wzw4","AeLPB1O","zeHez2S","zw5HyMXLuw8","qK53rMC","se1AA2O","CgXLyxnLiha","x29Uq2XVC2u","Ae1LC3nHz2u","wwPpD20","rg13rNe","y3vYC29Yx24","wvjit0O","te1oqKq","zLbxEMq","zMX1C2HfEha","D2fvtfi","y2f0y2G","rLngwvG","EhDhyva","DMTJEwK","CLzIA3i","CMvTB3zLq2G","AffKu3e","tMDgsLa","BNrbBMrvCgq","wvbesve","BM15vwy","y0Xdy3G","yxbWBgLJyxq","B0XmAei","qw5Hr2S","Dg9tDhjPBMC","yxKSig5LDhC","ywrKrxzLBNq","whvdEw4","q3b5wvy","zufJAW","yNLL","tKP4Eg4","qNrirxC","EwPsBum","yuP3CMC","yMLUza","DMfSDwu","quPLweW","CYbWyxjHBxm","CNL3Chm","ANL6rLG","rKz3qLm","y3jLyxrLrxi","qKX5rhK","DKHLrey","Ahr0Ca","yNvJA04","y2HnyxHuCMK","ExbL","ENP1v0K","CxHksNe","o2nOyxjZzxq","Dg9Y","Ef9MCM9UDgK","weLSu1e","vfPeugq","ExLWCxq","u2Duvhm","Ehj5Dxe","CYbPBNn0yw4","x2TLEvbHDgG","wvfWtMC","zM9YrwfJAa","twnwtuG","vK92zMe","DNDTzgm","AwHZwgm","BhndyNm","s2TfqMG","x2nSzwfYugK","wNPsvw8","D2fZq2XLyw4","sfnbAMm","zxmGCMvHy2G","r1vZzK4","rvjst1i","y3vYDMfSDwu","tLvoBuK","Bg9NsurozxC","BwvY","BePPzhq","uerXu3i","z2XqC1i","B2D5y3G","DK9ZCeq","Aw47y2HHCNm","mhW0Fdn8mNW","uurLyKG","s0XQBhC","z2v0t3DUuhi","DevkA3y","t1bSqMu","AxnmB25N","q29UzMLN","q3vZDg9Tq2W","zMLSzw5HBwu","vMPIEKe","Bwv0Ag9K","yxrLq291BNq","BMv3vMvYC2K","Bg9IywXty28","DeLK","vKvcy3i","quXm","u3zxALq","DgLLCKPtt04","z0LbuNi","zw50tgLZDgu","zhjiswW","y2HLy2TdDxi","C3vJy2vZCW","x29UugfNzu4","tgrqq3C","CgPfqu4","x2DLBMvYyxq","r1nRwM0","Cgu6ia","C05TA1a","svfpCwm","zvPOBwu","t1DWDxO","D3m6lY8","u1zizvq","ihbYB3rVy28","EMXZr0S","B25JBg9Zzq","Ag5Vvuq","DgfIyxnL","rvPpvLq","AuH5rwi","uMvJB25Uzwm","sM1Jtu4","yMXVy2TLza","CuPpAxm","r1jOEKe","Du1qq3y","BNDytLK","sLHqELa","q3nTBfC","CM9YrxzLBNq","y09mu3i","tMDwsxm","z3fezwq","zxfore4","DcbSAw1PDa","sKPeqxu","AgfZt3DUuhi"];return Un=function(){return n},Un()}var po,mo,Bn,Nu=lo({"node_modules/idb/build/index.js"(){let n=S,e={PPhao:function(c){return c()},krfdg:function(c,u){return c(u)},cCmsI:n(469),laWBa:n(1591),rFpdO:n(1048),TXBtp:n(1134),wLYWf:"get",XuCyn:n(368),npJFp:n(1699)},s=(n(1435)+"5|1").split("|"),a=0;for(;;){switch(s[a++]){case"0":e[n(975)](xo);continue;case"1":e[n(842)](Pu,c=>({...c,get:(u,d,l)=>uo(u,d)||c[n(1288)](u,d,l),has:(u,d)=>!!uo(u,d)||c.has(u,d)}));continue;case"2":mo=[e[n(659)],e[n(234)],e.rFpdO,e[n(478)]];continue;case"3":po=[e[n(717)],e[n(1376)],n(579),n(1118)+"ys",e.npJFp];continue;case"4":xo();continue;case"5":Bn=new Map;continue}break}}}),Ou={idb:function(n){let e=S;n[e(850)]=Promise[e(858)]()[e(983)](()=>(Nu(),go))[e(983)](function(s){return s})}},fo={};function ke(n){let e=S,s={PrLUv:function(l,m){return l!==m}},a=(e(1248)+"4")[e(457)]("|"),c=0;for(;;){switch(a[c++]){case"0":if(s[e(921)](void 0,d))return d[e(850)];continue;case"1":var u=fo[n]={exports:{}};continue;case"2":Ou[n](u,u.exports,ke);continue;case"3":var d=fo[n];continue;case"4":return u[e(850)]}break}}ke.d=(n,e)=>{let s=P;for(var a in e)ke.o(e,a)&&!ke.o(n,a)&&Object[s(969)+s(656)](n,a,{enumerable:!0,get:e[a]})},(()=>{let n=S;ke.o=(e,s)=>Object[n(1215)+"e"][n(1495)+n(656)].call(e,s)})(),(()=>{let n=S,e={rywps:function(s,a){return s!==a},nBCRD:function(s,a){return s-a},ESnsG:"RYJXB",kHCTo:function(s,a){return s!=a},ltZxq:n(549)+"d",OSOQk:n(473)+"le"};ke.r=s=>{let a=n;if(e[a(1388)](a(806),e[a(801)]))e[a(444)](e[a(1535)],typeof Symbol)&&Symbol[a(1373)+a(1160)]&&Object[a(969)+a(656)](s,Symbol[a(1373)+"Tag"],{value:a(1230)}),Object[a(969)+a(656)](s,e[a(1688)],{value:!0});else{let c=_0x4151f3[_0x45adc5];if(e[a(1388)](4,_0x32d628[_0x4f9ab9][a(874)])){let u=_0x202f26[a(1585)+"g"](0,e.nBCRD(4,_0x4619fb[_0x14d485][a(874)])),d=u[a(877)](c);_0x55f31c=_0x1b4539[a(877)](d)}else _0x59274d=_0x401f94[a(877)](c)}}})();var J={};function P(n,e){n=n-216;let s=Un(),a=s[n];if(P.lNvfrL===void 0){var c=function(m){let _="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=",y="",v="";for(let E=0,k,D,R=0;D=m.charAt(R++);~D&&(k=E%4?k*64+D:D,E++%4)?y+=String.fromCharCode(255&k>>(-2*E&6)):0)D=_.indexOf(D);for(let E=0,k=y.length;E<k;E++)v+="%"+("00"+y.charCodeAt(E).toString(16)).slice(-2);return decodeURIComponent(v)};P.iXzYAZ=c,P.tsDwrI={},P.lNvfrL=!0}let u=s[0],d=n+u,l=P.tsDwrI[d];return l?a=l:(a=P.iXzYAZ(a),P.tsDwrI[d]=a),a}(()=>{let n=S,e={HNtbo:function(i,t){return i===t},OWpuz:function(i,t){return i(t)},PEImI:function(i,t){return i+t},Mswqa:function(i,t){return i+t},pFYEl:function(i,t){return i+t},YJBRc:function(i,t){return i*t},MQTRG:function(i,t){return i*t},CFWPy:function(i,t){return i+t},gqDed:function(i,t){return i(t)},nmyUf:function(i,t,r){return i(t,r)},eBiYZ:n(1217),QFaww:n(770),ScTdD:function(i,t){return i(t)},dHDgk:function(i,t){return i(t)},pbIXd:function(i,t){return i!==t},yypqt:n(598),QSKJi:"offline",EBrjW:function(i,t){return i-t},NoUyG:function(i,t){return i|t},fMtth:function(i,t){return i|t},KSlxw:function(i,t){return i<<t},iLhpC:function(i,t){return i&t},kCYqg:function(i,t){return i<<t},BEAJY:function(i,t){return i&t},KeTOj:function(i,t){return i+t},ySZOZ:function(i,t){return i>>t},GSkZm:function(i,t){return i-t},JLTIe:function(i,t){return i(t)},ETCJv:n(239),vGFKp:function(i,t){return i>t},tfInq:function(i,t){return i===t},vysTD:n(593),zBEoP:n(1004),cbRcr:n(1624),IkSvX:function(i,t){return i<t},KtEOT:function(i,t){return i!==t},QGmdj:function(i,t){return i===t},xnNuX:function(i,t){return i===t},bajDN:n(564),TkFpD:function(i,t){return i<t},wCfYd:function(i,t){return i!==t},umXFU:function(i,t,r){return i(t,r)},SVHeT:function(i,t,r){return i(t,r)},qXFpa:function(i,t){return i(t)},QSRTA:function(i,t){return i>>>t},rETRT:function(i,t,r){return i(t,r)},FoYRK:function(i,t,r){return i(t,r)},vddOr:function(i,t){return i(t)},nPJYu:function(i,t){return i===t},MzpqK:n(1680)+n(389)+n(781)+n(406),CfqzK:function(i){return i()},UlNLu:function(i,t){return i>t},ZEuks:function(i,t){return i+t},NJxxn:function(i,t){return i!==t},dbNeG:function(i,t,r){return i(t,r)},MBTfh:function(i,t,r){return i(t,r)},uyHKi:function(i,t,r){return i(t,r)},TQvnc:function(i,t){return i(t)},duHzI:function(i,t,r){return i(t,r)},MUrbs:function(i,t,r){return i(t,r)},WhyIe:function(i){return i()},QRzAc:function(i,t,r){return i(t,r)},GUsfN:function(i,t,r){return i(t,r)},zrSMG:function(i,t){return i(t)},VZERv:function(i,t){return i!==t},mUYOX:function(i,t){return i!==t},KokEP:function(i,t,r){return i(t,r)},YbgQl:function(i,t,r){return i(t,r)},fKSMy:function(i,t,r){return i(t,r)},IpzxO:function(i,t){return i!==t},gwZZN:"oyGMQ",HCNDU:function(i,t){return i!==t},wpXBd:function(i,t,r){return i(t,r)},IjyOf:function(i,t){return i(t)},KuWRt:"timeout",Jhjxr:n(1645)+n(674)+"t",bRrSw:function(i,t){return i<<t},ghPmz:function(i,t){return i|t},LsPDX:"success",QtByO:function(i,t){return i===t},TDLvn:function(i,t,r){return i(t,r)},chxzk:function(i,t){return i(t)},bpuyM:n(1412),GJkCo:n(1659),lcUHo:function(i,t){return i(t)},VIKwM:function(i,t,r){return i(t,r)},zjBlc:function(i,t){return i(t)},jjtvY:function(i,t,r){return i(t,r)},iuYlr:function(i,t){return i(t)},JLoTM:function(i,t){return i===t},zsVNY:n(1680)+"required"+n(781)+n(507),NAYuO:function(i,t){return i===t},TuisS:n(1680)+n(389)+n(781)+n(926),czGWi:function(i,t){return i===t},VeQVh:n(1680)+n(389)+n(781)+"service",wrPiD:"pagehide",BLyDy:n(1340),JmcMN:n(675),ksyRk:"GQWrk",cOzqE:function(i,t){return i+t},YZfqt:function(i,t){return i&t},WuXqq:function(i,t,r){return i(t,r)},qznkg:"Unimplem"+n(930)+n(1465),IsXLl:function(i,t){return i>=t},ZbRxm:n(1164),SJJGV:function(i,t){return i!==t},fVknD:n(1482),QXwsr:function(i,t){return i+t},oIzzF:function(i,t){return i>t},InwnF:function(i,t){return i>t},buckN:function(i,t){return i+t},gnmPU:function(i,t){return i(t)},gyPJS:"dKyrD",mwYNE:function(i,t){return i<<t},zqCCM:n(787),NDzZX:function(i,t){return i===t},vnNst:function(i,t){return i!==t},IoVMl:function(i,t){return i&t},HSAjc:function(i,t){return i&t},rAxpQ:function(i,t){return i===t},BlDQQ:n(762),Hpndu:n(897),baXUb:function(i,t){return i(t)},hfJEF:function(i,t){return i+t},wezIG:function(i,t){return i|t},yCsrm:function(i,t){return i&t},YzVvp:function(i,t){return i<<t},TRmsd:function(i,t){return i&t},UfiFc:function(i,t){return i<=t},Ltsvu:function(i,t){return i==t},dyeLG:function(i,t){return i+t},jyzFX:function(i,t){return i!==t},iHyEb:function(i,t){return i&t},LeKql:function(i,t){return i|t},SgTTs:n(690),tFazk:function(i,t){return i|t},FSFYX:function(i,t){return i|t},ukqSg:function(i,t){return i&t},UFyyZ:function(i,t){return i&t},drsZJ:function(i,t){return i>t},RxMvV:function(i,t,r){return i(t,r)},xryuq:function(i,t){return i+t},gIARr:function(i,t){return i>>t},TBaNi:function(i,t){return i||t},Cnkbs:function(i,t){return i<t},xWCUy:function(i,t){return i+t},hHxLJ:function(i,t){return i<t},DvqVG:function(i,t,r){return i(t,r)},thjZl:function(i,t,r){return i(t,r)},HSsMk:function(i,t){return i<t},LMNBD:function(i,t){return i-t},eJihX:function(i,t){return i<<t},qXPFy:function(i,t){return i<t},aYqhk:function(i,t){return i&t},QcJre:function(i,t){return i<t},bfCpa:n(1468),YpjLz:function(i,t){return i&t},WJCJe:function(i,t){return i&t},CIQjN:function(i,t){return i|t},TToxb:function(i,t){return i&t},PNLku:function(i,t){return i&t},HmVsW:function(i,t,r){return i(t,r)},ADFqZ:function(i,t){return i+t},ANIwT:n(917),TZDPd:n(240),kKImJ:function(i,t,r){return i(t,r)},KjhbV:function(i,t){return i>=t},aWXRl:function(i,t){return i===t},utVxZ:"xwYrp",NZWSC:n(829),rHKyA:function(i,t){return i(t)},iDYla:function(i,t){return i&t},mSSPs:function(i,t){return i&t},XKdyy:function(i,t){return i&t},fVlab:function(i,t,r,o){return i(t,r,o)},wAIgW:function(i,t){return i|t},gcqsd:n(1185),gxJDu:function(i,t,r){return i(t,r)},tVyqg:function(i,t){return i(t)},zVPxt:function(i,t){return i<t},MoWBR:function(i,t){return i&t},Jpsxr:function(i,t){return i&t},rIPAk:function(i,t){return i<<t},ysQup:function(i,t){return i&t},jeNFP:function(i,t){return i&t},hQBJY:function(i,t){return i<<t},Vkuuv:function(i,t){return i(t)},OlpFi:function(i,t){return i&t},nbUlk:function(i,t){return i===t},XKfuM:n(1393),VUYiW:n(614),KGJWz:function(i,t){return i(t)},FHRwN:function(i,t){return i(t)},ZPynf:function(i,t){return i<<t},OiFQP:function(i,t){return i&t},pjEAN:function(i,t){return i<<t},JxkqH:function(i,t){return i&t},cOLSr:function(i,t){return i&t},rIhTv:function(i,t){return i(t)},LPpXD:function(i,t){return i&t},SWhNG:function(i,t){return i(t)},TVpVj:function(i,t){return i>>>t},EVrWG:function(i,t){return i>>>t},DTYgT:function(i,t){return i>>>t},TMCuB:function(i,t){return i===t},HLwqp:function(i,t){return i<t},aJwrg:function(i,t){return i<t},bxvfp:function(i,t){return i<t},FNjXM:function(i,t,r){return i(t,r)},raxzR:function(i,t){return i+t},zlObC:function(i,t){return i+t},NErHW:function(i,t){return i|t},HOgZx:function(i,t){return i>>>t},sHfpW:function(i,t){return i>>>t},WJAyN:function(i,t){return i!==t},gKNca:function(i,t){return i!==t},zzuWI:function(i,t){return i&t},tEJkv:function(i,t){return i!==t},SKnLP:function(i,t){return i|t},xidGO:function(i,t){return i&t},nUiqm:function(i,t){return i!==t},ESDDQ:function(i,t){return i<<t},VIYmq:function(i,t){return i<<t},bwpsE:function(i,t){return i<<t},eAwPS:function(i,t){return i|t},TyaiX:function(i,t){return i|t},bBAZe:function(i,t){return i|t},QUbQK:function(i,t){return i<<t},uALkA:function(i,t){return i|t},JRlXD:function(i,t){return i|t},TjOQp:function(i,t){return i|t},LOxsm:function(i,t){return i<<t},vwmdc:function(i,t){return i<<t},rbfaj:function(i,t){return i|t},nWJiJ:function(i,t){return i|t},tJUBg:n(1342),bMLxt:n(645),GdruJ:function(i,t){return i(t)},eDkbt:function(i,t){return i===t},GDRUI:n(1531),JeQVS:function(i,t){return i>=t},dEnQE:function(i,t){return i<=t},uGdDh:function(i,t){return i%t},SIUQf:function(i,t){return i/t},oOEPQ:function(i,t){return i>>>t},eGEau:function(i,t){return i<<t},SjYCj:function(i,t){return i<t},vBBqh:function(i,t){return i<t},SSXSd:function(i,t){return i<t},XWbuP:function(i,t){return i+t},yRaQM:function(i,t){return i!==t},LoFQA:function(i,t){return i&t},EvVDI:function(i,t){return i+t},bquDT:function(i,t){return i>>>t},kfekJ:function(i,t){return i>>>t},pjHtS:function(i,t){return i+t},KBIam:function(i,t){return i>>>t},lcjww:function(i,t){return i&t},GJgpn:function(i,t){return i+t},ZFeoU:function(i,t){return i&t},YMWon:function(i,t){return i>>>t},waULR:function(i,t){return i+t},RMNGv:function(i,t){return i|t},iwzmP:function(i,t){return i&t},GSXXa:function(i,t){return i!==t},TYzpd:function(i,t){return i&t},HIHTV:n(692),JYAdV:function(i,t){return i+t},uWIss:function(i,t){return i>>>t},ydvUR:function(i,t){return i===t},GzjKH:function(i,t){return i===t},rEyNN:function(i,t){return i>>>t},LwIbS:function(i,t){return i+t},qUtnR:function(i,t){return i>>>t},CpyYV:function(i,t){return i+t},gtpuU:function(i,t){return i>>>t},llQbM:function(i,t){return i|t},BlrhU:function(i,t){return i<<t},vBpLL:function(i,t){return i===t},YftWh:function(i,t){return i&t},NUNmI:function(i,t){return i&t},ZPqUK:function(i,t){return i>>>t},oLLhB:function(i,t){return i>>>t},Cyldy:function(i,t){return i>>>t},ZfHpx:function(i,t){return i&t},fDAVE:function(i,t){return i&t},UcFnZ:n(235)+n(1090),VwjqI:n(1498)+"ERROR",wFxlm:n(1031)+n(353)+"R",DUFis:"CONNECTING_ERROR",quiKR:n(1106)+"OR",NMiHB:n(1641)+n(433),uibar:n(937),sHtCd:"Iojtd",XwMov:function(i,t){return i+t},MQoOH:function(i,t){return i+t},runlG:function(i,t){return i!==t},LdPCw:function(i,t){return i|t},drHIl:function(i,t){return i<<t},OPlBe:function(i,t){return i&t},bFAEF:function(i,t){return i<t},DIvbk:n(511),yjRmC:n(1528),AkSOV:n(615),ZKKTH:function(i,t){return i===t},LoOqy:n(931),sbagr:function(i,t){return i===t},OLVbx:function(i,t){return i==t},SFGFs:n(1183),WFQXM:n(567),XVkZx:n(344),mwLWO:function(i,t){return i instanceof t},tHYEU:function(i,t){return i+t},RmExM:"Unhandle"+n(1500),lJidt:function(i,t){return i+t},rUdna:function(i,t){return i+t},FdUnQ:n(864),SIDpL:n(1119),MOycC:n(1111),itNwU:function(i,t,r){return i(t,r)},ZoNqu:n(1146),alMXl:n(1497),chGTK:function(i,t,r){return i(t,r)},YQSjM:"open",lXMeF:function(i,t,r){return i(t,r)},NgFJP:function(i,t,r){return i(t,r)},ZBPvo:function(i,t){return i===t},MHlrA:function(i,t){return i!==t},DgdeY:n(1277),PARTB:n(653),GINwm:function(i,t){return i!==t},TZsHc:function(i,t){return i!==t},zTnwh:function(i,t,r){return i(t,r)},TEngo:n(766),taQci:n(368),RCdAF:n(1699),WvECy:n(469),hnoUD:n(1048),ooNxf:function(i,t){return i===t},zGetu:n(327),rVHYS:function(i,t){return i||t},zxJzw:function(i,t){return i!=t},YMahl:"undefined",zAlZk:function(i,t){return i<=t},JnUiA:n(558)+n(985)+"ltiple t"+n(1267)+n(860),EoTXG:function(i,t){return i<t},LUyex:function(i,t){return i<t},cMlaG:function(i,t){return i===t},NDmdf:function(i,t){return i&t},JgGGU:function(i,t){return i&t},ABCXS:function(i,t){return i+t},fPWzd:function(i,t){return i<t},DfYvC:function(i,t){return i&t},RzGcN:function(i,t){return i&t},HFbkF:function(i,t){return i<<t},NxPBF:function(i,t){return i&t},qgyiu:function(i,t){return i&t},AnCMY:function(i,t){return i>=t},gSUSG:function(i,t){return i|t},RelAI:function(i,t){return i|t},DBlgr:function(i,t){return i<<t},ZuAfb:function(i,t){return i&t},UFAMU:function(i,t){return i<<t},rdZaW:function(i,t){return i&t},NrCRK:function(i,t){return i+t},mVdPG:function(i,t){return i>>t},PoYur:function(i,t){return i&t},agbkO:function(i,t){return i<t},uWlZv:function(i,t){return i<t},mywwe:function(i,t){return i>>t},firyl:function(i,t){return i&t},oCzHx:function(i,t){return i===t},CSGLU:function(i,t){return i&t},ysxwB:function(i,t){return i+t},pogGO:function(i,t){return i>>t},glPsR:function(i,t){return i+t},HywvZ:function(i,t){return i<<t},YsJiQ:function(i,t){return i|t},rVbkr:function(i,t){return i>>t},KSHTE:n(651),OdAlh:function(i,t){return i|t},syZeJ:"string",rxAkH:function(i,t){return i(t)},GfBWW:function(i,t,r,o){return i(t,r,o)},cHmgG:function(i,t){return i!=t},NELTo:function(i,t){return i instanceof t},HwDmH:function(i,t){return i!=t},bIQla:n(1370)+n(528),WWuWC:n(1629)+n(1434)+n(1016),XIlSQ:n(1306),krQCv:n(535),xNjgB:function(i,t){return i>=t},SvWjT:n(657)+n(503),eCKAj:n(810),MsdoW:n(1249)+"ascript",mSwPA:"&jscallback=fron"+n(1454)+"P",bLksh:n(519),jXgyA:function(i,t,r,o){return i(t,r,o)},JUeWU:function(i,t){return i<t},NvOLk:function(i,t){return i>t},DcwRd:function(i,t){return i+t},RkUNF:function(i,t){return i(t)},Oxuuf:function(i,t){return i&t},IXNyH:function(i,t){return i!==t},pCJBU:"ZwbaM",XTyfy:n(480),vxpyL:n(279),tSITu:n(594),VOmpU:n(267)+"t",VGFZI:function(i,t){return i===t},utxlD:n(1187),fnNke:function(i,t){return i===t},oVBlS:function(i,t){return i===t},jupWi:function(i,t){return i+t},WMdSt:function(i,t){return i!==t},sDyCP:"dirJf",eJOVR:n(637),JxnZG:function(i,t){return i!==t},eKEoT:n(1241),cVJSF:function(i,t){return i||t},XTLly:n(1645)+n(1698)+"s",ZgKwO:function(i,t){return i!==t},sAvuS:n(1200),PYEnC:function(i,t){return i||t},nlmjw:function(i,t){return i||t},GraJA:n(400)+"3",ulUCH:n(1105),rzCbg:"init QoS"+n(997)+"d",mhofZ:function(i,t,r){return i(t,r)},rdscO:n(1683),pNNPi:"fphkS",nRhPr:function(i,t,r){return i(t,r)},JpGsJ:n(802),JoRDN:n(827),tCFTv:function(i,t){return i(t)},bivdT:n(746),yjuLm:n(702),WDERy:"cSNaW",WiIKL:n(309),azMov:n(1668),AeuZo:function(i,t){return i-t},ZiErh:"iIFry",AjUnn:n(553)+"ay, try reconnecting ser"+n(391),zXuWG:"txfpe",lREkS:"gYSqF",OWywf:function(i,t,r,o){return i(t,r,o)},qJCXr:n(1402)+n(635),xuzRV:function(i,t,r,o){return i(t,r,o)},axwCe:n(1402)+n(1001)+"ck",HtjuE:n(1402)+n(1023)+"sgid",HJLDa:function(i,t){return i<<t},msVOz:function(i,t){return i|t},YPDIQ:function(i,t){return i<<t},VstPl:"sevbD",tGjiW:function(i,t,r,o){return i(t,r,o)},iNuoI:n(354),mgiXC:function(i,t){return i&&t},UOEEj:"ack_id",vGIEJ:"ack_code",WASBY:"received",QAyVg:"Module",wnhQh:"__esModule",xAykg:n(987),sFLwb:function(i,t){return i(t)},DNXaI:n(870),EZOVT:n(1370)+"ion/json"+n(1400)+n(915),uQyrO:n(316)+"e",cRvaz:"binary",iQdYS:function(i,t){return i+t},kCeYY:function(i,t){return i|t},iApOf:function(i,t){return i|t},WfmLr:function(i,t){return i|t},UZTjA:function(i,t){return i|t},waBne:function(i,t){return i<<t},bHaSX:function(i,t){return i+t},fFQzD:"QTSfh",YQpNg:n(737),SdUmT:n(524)+n(1644)+n(1289),QERJI:n(871),AuNPF:n(530),BmbEt:n(517)+n(764)+"e",kFbGi:function(i,t){return i>=t},YjOwm:n(993),inPxy:function(i,t,r){return i(t,r)},DgXLt:function(i,t){return i>>>t},SyBXp:function(i,t){return i+t},EnGnX:function(i,t){return i+t},GdXTM:function(i,t,r,o){return i(t,r,o)},slFeh:function(i,t){return i|t},KLjlw:function(i,t){return i<<t},havkO:function(i,t){return i<<t},sYVtu:function(i,t){return i+t},UzUiP:function(i,t){return i|t},uMPCv:function(i,t){return i<<t},lgFSB:function(i,t){return i<<t},KpVBr:function(i,t){return i+t},VPPht:function(i,t){return i>>>t},eIlBN:function(i,t){return i+t},aGvGX:function(i,t){return i&t},OYytH:function(i,t){return i>>>t},tEMji:function(i,t){return i&t},IRMmv:function(i,t){return i>>>t},CsmlW:function(i,t){return i+t},lldUc:function(i,t){return i&t},GEHEJ:function(i,t){return i&t},nAMiE:function(i,t){return i+t},cgqSn:function(i,t){return i&t},NwvYt:function(i,t){return i&t},fGJGm:function(i,t){return i+t},VzOoG:function(i,t){return i&t},jaMYV:function(i,t){return i>>>t},cJZzO:function(i,t){return i<t},kkLcY:function(i,t){return i|t},NCqUz:function(i,t){return i|t},sfoyz:function(i,t){return i&t},oNHzI:function(i,t){return i<t},PIbSn:function(i,t){return i|t},YeUso:function(i,t){return i<<t},kyWcP:function(i,t){return i&t},WXAqK:function(i,t){return i|t},BNwFg:function(i,t){return i<t},tJmoN:function(i,t){return i>t},PsRAd:function(i,t){return i<t},zEBgr:function(i,t){return i<t},cUhDq:"8|0|4|10"+n(612)+"|7|5|2",KdMRl:n(799),ZxFlk:n(623),jjUEf:"service-"+n(587),cvmxA:n(863)+n(277),yzMhV:"OLccJ",GcWBS:function(i,t){return i(t)},oSQhp:n(289)+n(474),feKFe:function(i,t,r){return i(t,r)},Hfarm:function(i,t,r){return i(t,r)},ogycx:n(1703),BsyIY:n(390)+n(1278),PJKYX:function(i,t,r){return i(t,r)},xqpkG:n(1352)+n(638),fnqCT:function(i,t){return i instanceof t},dGmMZ:"done",kXOcx:n(782)+"oreNames",winZo:n(1324),VJCsH:function(i,t){return i(t)},uoRka:function(i,t){return i!==t},ZJasp:n(1630),cthKM:n(423),Jugvr:n(1084)+n(1596),hMbeX:n(1452),uUUts:function(i,t,r,o){return i(t,r,o)},TagST:n(1540),kQJOH:function(i,t,r,o){return i(t,r,o)},wQvmx:function(i,t){return i instanceof t},sCVrW:function(i,t){return i==t},EIBnU:n(1279),kELST:n(1467),xvGZF:function(i,t){return i(t)},CzORx:n(1284),GXhCr:"setcursor",jIXtS:n(608),vgXBN:function(i,t,r,o){return i(t,r,o)},mIXHy:function(i,t){return i(t)},czMnb:n(1402)+"er_ttl",jmvPn:"x-msg-qos",RbEzr:function(i,t,r){return i(t,r)},TaeLS:function(i,t,r){return i(t,r)},ZcgQV:n(1598)+n(274)+"ue",AnaGk:function(i){return i()},PpDjn:function(i,t){return i<t},JEksU:function(i){return i()},RPqHW:function(i){return i()},DfxNj:function(i,t){return i===t},XNBYA:function(i,t){return i===t},zwJcx:function(i,t){return i&&t},IyOYi:function(i,t){return i(t)},kzFvX:function(i){return i()},KkEBh:function(i,t){return i<t},BUdHL:function(i,t){return i!==t},ilVFv:n(461),AlviX:function(i){return i()},AcgPd:function(i){return i()},VOvfa:n(753),ZPOQQ:function(i,t){return i===t},YZcOv:n(1223),fBMCb:function(i,t){return i===t},QDebH:function(i,t,r,o){return i(t,r,o)},kbtCt:function(i,t,r){return i(t,r)},RgrdO:function(i,t,r){return i(t,r)},LgkgS:n(804),Kxpct:"pbbp2",yBljy:n(1347)+"rovide v"+n(1198),jKnNs:"please p"+n(866)+n(1387)+n(568)+"ket cons"+n(1296)+n(1542)+n(663),iillV:n(1195)+"ediately"+n(791)+"ct",COSLS:function(i,t){return i!==t},xigLj:function(i,t){return i!==t},lGsqB:function(i,t,r){return i(t,r)},odqXc:"AwDSN",eHYPN:"MfPyW",qOQNr:function(i,t){return i==t},ZYFXG:n(618),dPyPI:n(1339),lddlP:n(510),ulIVf:n(748),lWQoe:n(1693)+"d",YslIV:function(i,t){return i||t},cddfe:n(1347)+n(720)+n(1174)+n(1674)+n(1245),yLQTh:n(468),Ylcov:function(i,t,r){return i(t,r)},drmwJ:function(i,t){return i&t},hnQMI:function(i,t){return i|t},cLAfz:function(i,t){return i&t},neksq:function(i,t){return i>>t},maAUG:"JRkeL",BnCKp:function(i,t){return i||t},Vjvlo:function(i,t){return i!==t},YvFQS:n(1521),ihsXc:function(i,t,r){return i(t,r)},ZqGou:function(i,t){return i!==t},aEcKY:"Bjaga",sZBbP:function(i,t){return i===t},eqNDN:n(1338),YWSgw:"FRONTIER>",mHzXS:function(i,t){return i*t},KCjjo:function(i,t){return i<t},RNlxO:function(i,t){return i!==t},yVaTV:n(481),NgVIs:function(i,t){return i===t},hPcPq:function(i,t,r){return i(t,r)},iSZoZ:n(978)+n(534)+"onnecting",zlsGK:function(i,t){return i===t},iOsGC:n(363)+"3",Xfjpi:function(i,t){return i>>t},SrUzY:function(i,t){return i===t},pRdeG:n(902),EvKTv:n(932),LKMNF:function(i,t,r){return i(t,r)},PhWCI:n(1379),DuBmy:function(i,t,r){return i(t,r)},eegdq:n(553)+n(1374)+n(262)+n(1687),Sujpc:n(632),ebdcL:function(i,t){return i+t},bIDIW:n(537),JhwDa:n(710)+n(1408)+n(905)+n(979)+"ed",ThgwL:n(710)+n(1186)+n(301),xYTMy:function(i,t){return i==t},poBbV:n(1347)+n(1259)+" valid d"+n(1670)+"a must b"+n(1040)+n(483)+n(688)+n(1612),VYVaU:function(i,t){return i!=t},uOapc:function(i,t){return i instanceof t},mOCkS:function(i,t){return i(t)},Lezyy:function(i,t){return i(t)},FvgRv:n(1347)+"rovide a valid s"+n(277),Uaguk:function(i,t){return i(t)},AJeXL:function(i,t){return i===t},kSOlb:n(972),PINmW:function(i,t){return i||t},dEjOK:n(229)+n(630)+"ing",fBmJM:n(606),INxTo:"gZRAp",tYAom:n(727),CkKAM:function(i,t){return i!=t},EKVPI:function(i,t){return i!=t},ZIpdj:n(333),JBUMW:function(i,t){return i!=t},RWPaC:function(i,t){return i!=t},RrBbO:function(i,t){return i===t},tZiWK:n(736),JjZXb:function(i,t){return i==t},jADvq:n(920)+n(1082)+"lobalScope",UoeBJ:function(i,t){return i===t},RoKjK:function(i,t){return i===t},cBqnp:function(i,t){return i!=t},hDcSJ:function(i,t){return i!=t},HOnOH:function(i,t){return i===t},bbfNu:function(i,t){return i!=t},nuJOB:n(1112)+n(1603)};ke.r(J),ke.d(J,{FWS:()=>q0,CustomErrorEvent:()=>Ii,createCloseEvent:()=>we,ReconnectEvent:()=>Ci,createErrorEvent:()=>he,decodedFrame:()=>Ne,createOpenEvent:()=>Ri,CustomCloseEvent:()=>Ai,createReconnectEvent:()=>lr,FrontierMessageEvent:()=>ki,encodeFrame:()=>fr,createMessageEvent:()=>Di,OpenEvent:()=>Ti,ErrorCode:()=>He,Event:()=>ut,MessageEvent:()=>Pi});let s="";function a(i=""){let t=n;if(e[t(1225)]("bqLto",t(691)))this[t(1560)+t(1349)+"Event"](_0x2a16b4),_0xe42157.set(_0x5b66b5,_0x111f7d,_0x14c477[t(1111)][t(799)]);else{let o=""+Date[t(984)](),x=s||(s=e[t(1469)](m,i)),f=Math.random().toString(16)[t(687)](-6);return e.PEImI(e[t(1300)](e[t(242)]("02",o),x),f)}}function c(){let i=n;return e[i(242)](e[i(1559)](1e4,Date.now()),Math[i(1231)](e[i(818)](1e4,Math[i(223)]())))}function u(i){let t=n;return e[t(1116)](e[t(1491)](Array,8).join("0"),e[t(1368)](parseInt,i,10)[t(1373)](2))[t(687)](-8)}function d(i){let t=n;return(e[t(1491)](Array,4).join("0")+e.nmyUf(parseInt,i,2)[t(1373)](16))[t(687)](-4)}function l(i){let t=n,r=i.split(/\./)[t(590)](f=>u(f)),o=[];return o[0]=e[t(1469)](d,r[0]+r[1]),o[1]=e[t(1491)](d,e[t(419)](r[2],r[3])),[e[t(957)],e[t(957)],e.eBiYZ,e.eBiYZ,e[t(957)],e.QFaww,o[0],o[1]][t(876)]("")}function m(i){let t=n,r=/(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(628)](i),o=/(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))/.test(i);return r?e[t(371)](l,i):o?e.dHDgk(_,i):t(270)+t(270)+t(270)+t(270)}function _(i){let t=n,r={WcKyk:function(o,x){return e[P(1588)](o,x)},qErBt:function(o,x){return e.GSkZm(o,x)},xhGOw:function(o,x){return e[P(1058)](o,x)}};if(e[t(1588)](e.ETCJv,e[t(336)])){if(r[t(1026)](4,_0x56fef1[t(874)])){let o=_0x493a79[t(1585)+"g"](0,r[t(622)](4,_0x1d150b[t(874)])),x=o[t(877)](_0x93957b);_0x4b42ec.push(x)}else _0x386cf9.push(_0x4579dd);_0x380857&&(_0x10855e+=1),_0x5cb6dd+=1,_0x4b87fd=!1}else{let o="",x=[],f=0,g=0,p=!0,h=e[t(957)];if(e[t(1532)](i[t(1046)]("::"),-1)){let w=i[t(457)]("::");for(let I=0;I<w[t(874)];I++)if(e.tfInq(t(593),e.vysTD)){let N=w[I];if(e[t(1532)](N[t(1046)](":"),0))if(e.tfInq(e.zBEoP,e[t(986)]))_0x1e8ef7[t(711)+"d"]&&(this[t(646)+"orOnline"]()&&(!this[t(968)]||e.pbIXd(this[t(968)].readyState,this[t(1576)])||e[t(1588)](this[t(968)][t(1175)+"te"],this[t(545)+"NG"]))&&this[t(269)+t(451)](),this._isBrowser&&_0x3f3033.addEventListener(e.yypqt,this[t(269)+t(451)]),this[t(1287)+"er"]&&_0x34cae7[t(1375)+t(942)](e[t(284)],this[t(269)+t(1312)]));else{let B=N[t(457)](":");p&&(f=B[t(874)]),g+=B[t(874)];for(let O=0;e.IkSvX(O,B[t(874)]);O++)if(e[t(1587)](4,B[O][t(874)])){let ye=h[t(1585)+"g"](0,4-B[O][t(874)]),se=ye[t(877)](B[O]);x[t(1083)](se)}else x[t(1083)](B[O]);p=!1}else{if(e.pbIXd(4,N[t(874)])){let B=h[t(1585)+"g"](0,4-N[t(874)]),O=B[t(877)](N);x[t(1083)](O)}else x.push(N);p&&(f+=1),g+=1,p=!1}}else{let N=e[t(1087)](e[t(1661)](e[t(454)](e[t(454)](e.KSlxw(7&_0x3b9f5e,18),e.KSlxw(e[t(374)](63,_0x356986[_0x8a4ba1++]),12)),e[t(962)](63&_0x3606bf[_0x36a231++],6)),e[t(1272)](63,_0x37498e[_0x23867f++])),65536);_0x3c29ee+=_0xda42f2[t(559)+t(853)](e.KeTOj(55296,e[t(1053)](N,10))),_0x11dcce+=_0x4b4b3c[t(559)+"Code"](56320+(1023&N))}let C="";for(let I=0;e[t(1063)](I,e[t(1464)](8,g));I++)C=C[t(877)](h);for(let I=0;I<x[t(874)];I++)e[t(1244)](I,f)&&(o=o[t(877)](C)),o=o.concat(x[I]);return o}if(e[t(713)](e.bajDN,t(564))){let w=i.split(":");for(let C=0;e[t(1621)](C,w[t(874)]);C++){let I=w[C];if(e[t(583)](4,w[C][t(874)])){let N=h[t(1585)+"g"](0,4-w[C][t(874)]),B=N[t(877)](I);o=o[t(877)](B)}else o=o[t(877)](I)}return o}else return _0x571c70(_0x4c34a9[t(970)](DXviHY.xhGOw(_0x2a4678,this),_0x57fbe2))}}function y(i,t){let r=n,o=i.key;e.KtEOT(void 0,o)&&(e[r(1368)](V,t,10),e[r(1503)](Se,t,o));let x=i[r(1385)];x!==void 0&&(e.SVHeT(V,t,18),e[r(1471)](Se,t,x))}function v(i){let t=n,r={};e:for(;!e.dHDgk(q,i);){let o=e[t(807)](ne,i);switch(e[t(1709)](o,3)){case 0:break e;case 1:r[t(406)]=e[t(769)](_e,i,e[t(1491)](ne,i));break;case 2:r[t(1385)]=e.FoYRK(_e,i,e.vddOr(ne,i));break;default:e[t(1471)]($,i,7&o)}}if(e[t(837)](void 0,r[t(406)]))throw new Error(e[t(1113)]);if(e[t(713)](void 0,r.value))throw new Error(t(1680)+"required"+t(781)+t(1385));return r}function E(i){let t=n,r=e[t(605)](X);return k(i,r),A(r)}function k(i,t){let r=n,o={hgJkn:function(se,ge){return e.UlNLu(se,ge)},DmwFq:function(se,ge){return e.ZEuks(se,ge)}},x=i[r(507)];e[r(1380)](void 0,x)&&(e.dbNeG(V,t,8),e[r(429)](Re,t,x));let f=i[r(926)];e[r(583)](void 0,f)&&(e[r(1368)](V,t,16),e[r(1503)](Re,t,f));let g=i[r(799)];g!==void 0&&(e[r(1503)](V,t,24),e.uyHKi(Re,t,e.TQvnc(ee,g)));let p=i[r(1446)];p!==void 0&&(e[r(429)](V,t,32),e[r(1628)](Re,t,e.ScTdD(ee,p)));let h=i[r(757)];if(e[r(1380)](void 0,h))for(let se of h){e[r(1617)](V,t,42);let ge=e[r(1529)](X);y(se,ge),e[r(1006)](V,t,ge.limit),e[r(1423)](en,t,ge),e[r(1283)](Z,ge)}let w=i["payloadE"+r(835)];e.VZERv(void 0,w)&&(e[r(1628)](V,t,50),e.dbNeG(Se,t,w));let C=i["payloadT"+r(1397)];e[r(1380)](void 0,C)&&(e.dbNeG(V,t,58),Se(t,C));let I=i[r(636)];e[r(800)](void 0,I)&&(e[r(1628)](V,t,66),e[r(1246)](V,t,I.length),e.YbgQl(Tt,t,I));let N=i[r(626)];e[r(583)](void 0,N)&&(V(t,74),Se(t,N));let B=i[r(335)+r(541)];e[r(556)](void 0,B)&&(e[r(1226)](V,t,82),e.fKSMy(Se,t,B));let O=i[r(1496)];if(e[r(694)](void 0,O))if(e[r(1636)]===r(1078)){if(o[r(1011)](o[r(1351)](_0xe4a939[r(924)],_0x7ef91a),_0x46a098[r(306)]))throw new _0x5bb733(r(1583)+r(1493));_0x1b21f6[r(924)]+=_0x19eb50}else V(t,90),e.nmyUf(Se,t,O);let ye=i[r(431)+"e"];e.HCNDU(void 0,ye)&&(e[r(1290)](V,t,96),Re(t,e[r(573)](ee,ye)))}function D(i){return e[n(1283)](R,Ke(i))}function R(i){let t=n,r={iRpBz:function(o,x){return e[P(837)](o,x)},qbLZk:function(o,x){return e[P(1709)](o,x)},ejEAQ:function(o,x){return e[P(1661)](o,x)},JCVpQ:function(o,x){return o|x},DDRor:function(o,x){return e[P(1077)](o,x)},SicsD:function(o,x){return e.bRrSw(o,x)},NtagQ:function(o,x){return e[P(1606)](o,x)},PiyGr:function(o,x){return o|x},woGZf:function(o,x){return e[P(1077)](o,x)},rDZVA:function(o,x){return o<<x},uCdZJ:function(o,x){return e[P(1469)](o,x)},nxSYe:e[t(414)],qoStM:t(1645)+"e_success",zXvcu:e.Jhjxr,PhEto:function(o,x,f){return o(x,f)}};if(e[t(548)](t(681),t(681))){let o={};e:for(;!e[t(371)](q,i);){let x=ne(i);switch(e[t(1709)](x,3)){case 0:break e;case 1:o[t(507)]=e.YbgQl(ie,i,!0);break;case 2:o[t(926)]=e[t(1655)](ie,i,!0);break;case 3:o[t(799)]=e[t(1707)](ne,i);break;case 4:o[t(1446)]=ne(i);break;case 5:{if(e[t(1244)](e[t(1206)],e[t(409)]))return r[t(437)](_0x34c008,_0x2e237b)?_0x6cc5c:new _0x4a0fec(r.qbLZk(r[t(833)](r[t(833)](r[t(1018)](_0x1d432e[t(958)](_0x15dd4b,0),r[t(1096)](_0x259f5e.call(_0x3a6230,1),8)),r[t(1692)](_0x582070[t(958)](_0x14a528,2),16)),r[t(1096)](_0xe06412.call(_0x5297ac,3),24)),0),r[t(1227)](r.NtagQ(r.PiyGr(_0x31ea36[t(958)](_0x1c61ee,4)|r[t(508)](_0x338293.call(_0xda9917,5),8),r[t(256)](_0x3bae79[t(958)](_0x2fa1d5,6),16)),r[t(256)](_0x1bbc7f[t(958)](_0x211425,7),24)),0),!0);{let f=e.TQvnc(L,i);(o[t(757)]||(o[t(757)]=[]))[t(1083)](v(i)),i[t(306)]=f;break}}case 6:o[t(1189)+"ncoding"]=e.uyHKi(_e,i,e.qXFpa(ne,i));break;case 7:o[t(640)+t(1397)]=_e(i,e[t(1695)](ne,i));break;case 8:o[t(636)]=e[t(1368)](ct,i,e[t(325)](ne,i));break;case 9:o[t(626)]=e[t(1154)](_e,i,e[t(807)](ne,i));break;case 10:o[t(335)+t(541)]=e[t(1243)](_e,i,e[t(1581)](ne,i));break;case 11:o[t(1496)]=e[t(1099)](_e,i,ne(i));break;case 12:o[t(431)+"e"]=e.iuYlr(ne,i);break;default:e[t(769)]($,i,e.iLhpC(7,x))}}if(e.JLoTM(void 0,o[t(507)]))throw new Error(e.zsVNY);if(e[t(526)](void 0,o[t(926)]))throw new Error(e[t(428)]);if(e[t(603)](void 0,o.service))throw new Error(e[t(393)]);if(e[t(446)](void 0,o[t(1446)]))throw new Error(t(1680)+t(389)+" field: "+t(1446));return o}else{let o={VEBcr:function(x,f){return e[t(961)](x,f)},vdyvz:e.KuWRt,WqSLu:e[t(718)]};return new _0x119dd5((x,f)=>{let g=t,p={xwqzp:function(C,I){return r[P(790)](C,I)},JRjba:r.nxSYe,BeXYc:r[g(1599)],WxyqD:r[g(989)]};this._clearPingTimer(),this["_pingPon"+g(1137)+"Id"]=r[g(351)](_0x31077f,this[g(1694)][g(1384)](this),this[g(597)][g(407)+g(1294)]);let h=()=>{let C=g;p.xwqzp(x,p.JRjba),this[C(261)](p.BeXYc,h),this.off(p[C(425)],w)},w=()=>{let C=g;o[C(1451)](f,o.vdyvz),this[C(261)](C(1645)+C(1698)+"s",h),this[C(261)](o.WqSLu,w)};this.on(r[g(1599)],h),this.on(r[g(989)],w),this[g(1694)]()})}}function L(i){let t=n,r={JJDAu:e[t(219)],YRHOJ:e[t(1392)]};if(e[t(603)](e[t(1480)],e[t(1036)]))this[t(1287)+"er"]&&_0x6011ca[t(936)+t(1456)+t(1233)](r[t(1494)],this[t(670)+t(387)]),this[t(1287)+"er"]&&_0x565068[t(936)+t(1456)+t(1233)](r[t(1353)],this._handlePageShow),this[t(240)]();else{let o=e[t(1343)](ne,i),x=i[t(306)];return i[t(306)]=e[t(1295)](i[t(924)],o),x}}function $(i,t){let r=n;switch(t){case 0:for(;e.YZfqt(128,e[r(961)](ce,i)););break;case 2:e[r(1243)](M,i,e.iuYlr(ne,i));break;case 5:e[r(981)](M,i,4);break;case 1:M(i,8);break;default:throw new Error(e[r(1300)](e[r(1593)],t))}}function ee(i){let t=n;return i|=0,{low:i,high:i>>31,unsigned:e[t(1079)](i,0)}}let te=[];function X(){let i=n;if(e.VZERv(e[i(268)],e[i(268)]))this[i(1213)]=!0,this[i(281)]();else{let t=te[i(601)]();return t?(t.offset=t[i(306)]=0,t):{bytes:new Uint8Array(64),offset:0,limit:0}}}function Z(i){te[n(1083)](i)}function Ke(i){return{bytes:i,offset:0,limit:i[n(874)]}}function A(i){let t=n,r=i[t(441)],o=i[t(306)];return r[t(874)]===o?r:r[t(925)](0,o)}function M(i,t){let r=n;if(e.SJJGV(e[r(364)],e[r(364)])){let{initReconnectInterval:o,maxReconnectInterval:x,reconnectIntervalGrowFactor:f}=this[r(597)],g=o*_0x5785a9[r(1149)](f,e[r(1087)](_0x127904,1));return e[r(303)](g,x)?x:g}else{if(e[r(1646)](i[r(924)],t)>i.limit)throw new Error(r(1583)+r(1493));i[r(924)]+=t}}function q(i){let t=n;return i[t(924)]>=i[t(306)]}function re(i,t){let r=n,o=i.bytes,x=i[r(924)],f=i.limit,g=x+t;if(e.oIzzF(g,o[r(874)])){let p=new Uint8Array(e[r(1559)](2,g));p.set(o),i[r(441)]=p}return i[r(924)]=g,g>f&&(i.limit=g),x}function Qe(i,t){let r=n,o=i.offset;if(e[r(1713)](o+t,i[r(306)]))throw new Error(r(669)+r(1493));return i[r(924)]+=t,o}function ct(i,t){let r=n,o=Qe(i,t);return i[r(441)].subarray(o,e[r(1395)](o,t))}function Tt(i,t){let r=n,o={ymHpk:function(x,f){return e.CFWPy(x,f)},PcqyU:function(x,f){return e[P(1520)](x,f)},FGItO:function(x,f,g){return e[P(429)](x,f,g)}};if(e[r(1380)](e[r(1690)],r(735)))return TvTFIw[r(237)](TvTFIw.PcqyU(_0x25f894,8)[r(876)]("0"),TvTFIw[r(848)](_0x340250,_0x296dcf,10).toString(2))[r(687)](-8);{let x=re(i,t[r(874)]);i[r(441)][r(840)](t,x)}}function _e(i,t){let r=n,o={xwGaP:function(x,f,g){return x(f,g)},zApAR:function(x,f){return e[P(588)](x,f)}};if(e[r(1587)](e[r(1202)],e[r(1202)]))this.emit(r(1111),o[r(1360)](_0x142590,"message",{..._0x1f5b69}));else{let x=Qe(i,t),f=String[r(559)+r(853)],g=i[r(441)],p="\uFFFD",h="";for(let w=0;w<t;w++){let C=g[e[r(1395)](w,x)],I,N,B,O;if((128&C)===0)h+=f(C);else if(e.NDzZX(e[r(1272)](224,C),192))if(w+1>=t)h+=p;else if(I=g[e[r(397)](e.pFYEl(w,x),1)],e[r(1109)](e[r(221)](192,I),128))h+=p;else if(O=e[r(1661)](e[r(1077)](e.HSAjc(31,C),6),63&I),e.IkSvX(O,128))h+=p;else if(e[r(238)](e[r(974)],e[r(1569)])){let{value:ye,offset:se}=o[r(1360)](_0x48d5e4,_0x4998b9,_0x24fb1f);_0x57f399=se,_0x53426e=o[r(967)](_0x147ae9,8)>>>0,_0x2a6254+=ye}else h+=e[r(1545)](f,O),w++;else if(e[r(221)](240,C)==224)e[r(1079)](e.buckN(w,2),t)?h+=p:(I=g[e.Mswqa(w+x,1)],N=g[e[r(1240)](w+x,2)],e[r(1421)](e[r(1606)](I,e[r(588)](N,8)),49344)!==32896?h+=p:(O=e.wezIG(e.ghPmz(e[r(1142)](15,C)<<12,e[r(358)](e[r(555)](63,I),6)),e.YZfqt(63,N)),e[r(1621)](O,2048)||e[r(1079)](O,55296)&&e[r(895)](O,57343)?h+=p:(h+=e[r(325)](f,O),w+=2)));else if(e.Ltsvu(e[r(374)](248,C),240))if(e[r(1079)](e[r(1395)](w,3),t))h+=p;else if(I=g[w+x+1],N=g[e[r(370)](w+x,2)],B=g[e[r(462)](e[r(370)](w,x),3)],e[r(1389)](e[r(1478)](e[r(1124)](e[r(454)](I,e[r(588)](N,8)),e.KSlxw(B,16)),12632256),8421504))h+=p;else if(e.QtByO(e[r(1406)],"lTrjO"))O=e[r(1661)](e.tFazk(e[r(1359)]((7&C)<<18,e[r(1574)](63,I)<<12),e.yCsrm(63,N)<<6),e[r(991)](63,B)),e[r(1621)](O,65536)||e[r(1677)](O,1114111)?h+=p:(O-=65536,h+=e[r(1580)](f,e[r(1407)](e.gIARr(O,10),55296),e[r(419)](1023&O,56320)),w+=3);else return this._qosDB["clearSto"+r(1258)]();else h+=p}return h}}function Se(i,t){let r=n,o={lnRsq:function(h,w){return e[P(953)](h,w)}},x=t[r(874)],f=0;for(let h=0;e.Cnkbs(h,x);h++){let w=t[r(1136)+"At"](h);w>=55296&&w<=56319&&e[r(792)](h,1)<x&&(w=e[r(962)](w,10)+t[r(1136)+"At"](++h)-56613888),f+=e[r(475)](w,128)?1:e.IkSvX(w,2048)?2:e.hHxLJ(w,65536)?3:4}e[r(581)](V,i,f);let g=e[r(916)](re,i,f),p=i[r(441)];for(let h=0;e.IkSvX(h,x);h++){let w=t[r(1136)+"At"](h);if(w>=55296&&e[r(895)](w,56319)&&e[r(421)](h+1,x)&&(w=e[r(1354)](e[r(1395)](e.eJihX(w,10),t[r(1136)+"At"](++h)),56613888)),e[r(883)](w,128))p[g++]=w;else{if(e[r(255)](w,2048))p[g++]=e[r(266)](e.gIARr(w,6),31)|192;else{if(e[r(1e3)](w,65536))p[g++]=e[r(1053)](w,12)&15|224;else if(e[r(652)]!==e.bfCpa){let C=this[r(466)][r(1676)+r(551)+"nc"](this[r(1702)]),I=_0x458e4c[r(1652)](o[r(1550)](C,"{}"));return _0x2f7cca[r(350)](I)}else p[g++]=e.NoUyG(e.YpjLz(e[r(1455)](w,18),7),240),p[g++]=e.fMtth(e[r(313)](w>>12,63),128);p[g++]=e.CIQjN(e[r(1660)](w>>6,63),128)}p[g++]=e[r(910)](63,w)|128}}}function en(i,t){let r=n,o=e.HmVsW(re,i,t[r(306)]),x=i[r(441)],f=t[r(441)];for(let g=0,p=t[r(306)];e[r(1621)](g,p);g++)x[e.ADFqZ(g,o)]=f[g]}function ce(i){let t=n;return e.KtEOT("WyfYU",e.ANIwT)?i[t(441)][e[t(1290)](Qe,i,1)]:t(484)+"_"+this[t(282)]}function Dt(i,t){let r=n,o={EbzmH:e[r(1404)]};if(e[r(446)](r(1013),"nfrSg")){let x=e[r(885)](re,i,1);i.bytes[x]=t}else _0x2fdcf4&&_0x13fb06[r(1375)+"Listener"](lNDrbZ[r(1335)],()=>_0x2ae363()),_0x2f96ec&&_0x254448[r(1375)+r(942)](r(1504)+r(830),()=>_0x7f64ea())}function ne(i){let t=n,r={knvRx:function(o,x){return e.KjhbV(o,x)}};if(e[t(655)](e[t(774)],e[t(774)])){let o=0,x=0,f;do if(e.jyzFX(t(815),e.NZWSC))f=e.rHKyA(ce,i),e.HSsMk(o,32)&&(x|=e.iDYla(127,f)<<o),o+=7;else{let g=this[t(466)][t(1062)](this[t(1702)]),p=_0x2c56da.parse(g||"{}");return p[_0x2445f3||_0x4687d2[this._pathKey]]=_0x56ccec,this[t(466)][t(726)](this[t(1702)],_0x285311[t(1712)+"y"](p)),_0x2d82a2||_0x5c75cb[this[t(831)]]}while(e[t(1292)](128,f));return x}else if(r[t(276)](_0x2b7794,_0x489993))return _0x5e5acd}function V(i,t){let r=n,o={Olrcy:r(293)+"|1|9|3|2|4|6|8|11",lOQGF:function(x,f){return e[r(454)](x,f)},gIPcw:function(x,f){return e[r(1709)](x,f)},mcYge:function(x,f){return x<<f},OzDoY:function(x,f){return e.HSsMk(x,f)},ZzRUo:function(x,f){return x|f},ASPaY:function(x,f){return x<<f},QMoPW:function(x,f){return e.iHyEb(x,f)},GaqDb:function(x,f){return e[r(1709)](x,f)},pReKb:function(x,f){return e[r(1600)](x,f)},jpgYY:function(x,f){return e[r(421)](x,f)},rFJRW:function(x,f){return e.drsZJ(x,f)},EFmCi:function(x,f,g,p){return e.fVlab(x,f,g,p)},yDbdP:function(x,f){return e.wAIgW(x,f)}};if(r(1185)!==e[r(1618)]){let x=o[r(1007)][r(457)]("|"),f=0;for(;;){switch(x[f++]){case"0":if(_0x179898[_0x526167++]<128)return{value:_0x3df15e?_0x3789b0:o.lOQGF(0,_0x1a7c50),offset:_0x9ad295};continue;case"1":_0x57ff5a=o.gIPcw(_0x523da9|o[r(1034)](127&_0x549234[_0x4789c4],14),0);continue;case"2":if(o.OzDoY(_0x134bc1[_0x453a81++],128))return{value:_0x394839?_0x2d22c0:o[r(1419)](0,_0x1a6841),offset:_0x40c878};continue;case"3":_0xf968a3=o[r(816)](o[r(1120)](_0x27e2b5,o[r(1095)](o[r(861)](127,_0x3b473b[_0x1b8207]),21)),0);continue;case"4":_0x3cf8c8=o.GaqDb(_0x40f0b5|o[r(1034)](15&_0x251946[_0x2acc90],28),0);continue;case"5":_0x295dc4=o[r(1214)](127,_0x745b28[_0xd297da])>>>0;continue;case"6":if(o[r(1052)](_0x5463b5[_0x513f99++],128))return{value:_0x1ec22a?_0x5e316c:0|_0x14026e,offset:_0x2c4bf8};continue;case"7":if(o[r(1502)](_0x347806[_0x34394d++],128))return{value:_0x367df3?_0x45ee76:o[r(1419)](0,_0x2d0db7),offset:_0x45aaec};continue;case"8":if(o[r(304)](_0x5521c5+=5,_0x1cae20[r(874)]))throw _0x423118=_0x2c330f.length,o[r(487)](_0x3d359a,_0x247036,10,_0x40398b[r(874)]);continue;case"9":if(_0x4d58bd[_0x155181++]<128)return{value:_0x6f1018?_0x22f1c3:o.yDbdP(0,_0x8f304e),offset:_0x412945};continue;case"10":_0x2b5c5d=o[r(439)](o[r(1265)](_0x53d9f6,(127&_0x1e1a44[_0x49c4a3])<<7),0);continue;case"11":return{value:_0x2a7fe5?_0x3a84b9:0|_0x12de15,offset:_0x1923bb}}break}}else{for(t>>>=0;t>=128;)e[r(1298)](Dt,i,127&t|128),t>>>=7;Dt(i,t)}}function ie(i,t){let r=n,o={xFCRM:function(h,w){return e.tVyqg(h,w)},xZXKV:function(h,w){return e[P(1145)](h,w)},dphEv:function(h,w){return e[P(422)](h,w)}},x=0,f=0,g=0,p;return p=e[r(573)](ce,i),x=e[r(1247)](127,p),e[r(992)](128,p)&&(p=e[r(1707)](ce,i),x|=e[r(1157)](e[r(1510)](127,p),7),e[r(254)](128,p)&&(p=ce(i),x|=e[r(385)](127&p,14),128&p&&(p=e[r(648)](ce,i),x|=e[r(1421)](127,p)<<21,e[r(516)](128,p)&&(e[r(488)](e[r(856)],e[r(320)])?(_0x18fb17=vqKxYY[r(834)](_0x163978,_0xa0e04e),vqKxYY[r(879)](_0x4d4837,32)&&(_0x27b93a|=vqKxYY[r(1524)](127&_0x124b21,_0x543d33)),_0x2ea156+=7):(p=e[r(280)](ce,i),f=127&p,e[r(992)](128,p)&&(p=e[r(909)](ce,i),f|=e.ZPynf(127&p,7),e[r(1044)](128,p)&&(p=e[r(1695)](ce,i),f|=e[r(1462)](e.JxkqH(127,p),14),128&p&&(p=ce(i),f|=e[r(1077)](e[r(1489)](127,p),21),e[r(1152)](128,p)&&(p=e[r(1076)](ce,i),g=e[r(789)](127,p),e[r(1247)](128,p)&&(p=e[r(386)](ce,i),g|=(127&p)<<7)))))))))),{low:x|e[r(588)](f,28),high:e[r(1124)](e[r(1595)](f,4),e.bRrSw(g,24)),unsigned:t}}function Re(i,t){let r=n,o=e[r(1595)](t[r(1263)],0),x=e[r(1595)](e[r(326)](t[r(1263)],28)|e[r(1571)](t.high,4),0),f=e[r(716)](t[r(661)],24),g=e[r(548)](0,f)?e[r(1607)](0,x)?e[r(595)](o,16384)?e[r(1383)](o,128)?1:2:e.IkSvX(o,2097152)?3:4:x<16384?e[r(682)](x,128)?5:6:e[r(1e3)](x,2097152)?7:8:f<128?9:10,p=e[r(820)](re,i,g),h=i[r(441)];switch(g){case 10:h[e[r(1717)](p,9)]=e[r(1142)](f>>>7,1);case 9:h[e[r(357)](p,8)]=e[r(1380)](9,g)?e[r(1359)](128,f):e[r(991)](127,f);case 8:h[p+7]=e[r(556)](8,g)?e.NErHW(e.EVrWG(x,21),128):e.HOgZx(x,21)&127;case 7:h[e[r(397)](p,6)]=e.NJxxn(7,g)?e[r(1661)](e.QSRTA(x,14),128):x>>>14&127;case 6:h[e[r(1116)](p,5)]=e[r(583)](6,g)?e[r(1661)](e.DTYgT(x,7),128):e[r(388)](x,7)&127;case 5:h[e[r(1240)](p,4)]=g!==5?e[r(1124)](128,x):127&x;case 4:h[p+3]=g!==4?e[r(1709)](o,21)|128:e.DTYgT(o,21)&127;case 3:h[e.PEImI(p,2)]=e[r(1557)](3,g)?o>>>14|128:e[r(996)](e[r(388)](o,14),127);case 2:h[e[r(1300)](p,1)]=e.gKNca(2,g)?e[r(1709)](o,7)|128:e[r(1398)](o>>>7,127);case 1:h[p]=e[r(1439)](1,g)?e.SKnLP(128,o):e[r(1054)](127,o)}}function Ne(i){return D(i)}function fr(i){return e[n(386)](E,i)}let vi=65536,Za=e.tYAom,xt=e[n(818)](vi,vi),bi=xt*xt,Si=e.SIUQf(bi,2),Ge=String[n(1215)+"e"][n(1136)+"At"];class K{constructor(t,r,o){let x=n;this[x(1441)]=!0,this[x(1263)]=e.ghPmz(0,t),this.high=0|r,this.unsigned=!!o}static[n(1441)](t){let r=n;return t&&e.JLoTM(!0,t[r(1441)])}static[n(701)](t,r,o){let x=n;if(e[x(1501)](x(246),"cttCr"))return new K(t,r,o);_0x32115d[x(283)][x(495)+"ild"](_0x1d2cb4)}static[n(1679)+"s"](t,r,o){let x=n;return o?K[x(1679)+x(584)](t,r):K[x(1679)+x(1718)](t,r)}static[n(1679)+n(584)](t,r){let o=n;return new K(e.LeKql(e[o(1661)](t[0],t[1]<<8),e[o(358)](t[2],16))|t[3]<<24,e[o(1359)](e[o(1661)](t[4],e[o(416)](t[5],8))|e[o(872)](t[6],16),e.bwpsE(t[7],24)),r)}static[n(1679)+n(1718)](t,r){let o=n;return new K(e[o(275)](e[o(1221)](e.bBAZe(e[o(385)](t[4],24),e[o(918)](t[5],16)),t[6]<<8),t[7]),e.eAwPS(e[o(476)](e[o(1462)](t[0],24),e[o(422)](t[1],16)),e[o(588)](t[2],8))|t[3],r)}static[n(1325)](t){let r=n;return t===Za?Ei:new K(e[r(1709)](e[r(1538)](e[r(1221)](e[r(788)](Ge[r(958)](t,0),e[r(1271)](Ge[r(958)](t,1),8)),Ge[r(958)](t,2)<<16),e[r(1414)](Ge[r(958)](t,3),24)),0),(e.rbfaj(e[r(1059)](Ge[r(958)](t,4),Ge[r(958)](t,5)<<8),e[r(1571)](Ge[r(958)](t,6),16))|Ge[r(958)](t,7)<<24)>>>0,!0)}[n(1114)](){let t=n;return String[t(559)+t(853)](e.UFyyZ(255,this[t(1263)]),e[t(388)](this[t(1263)],8)&255,e[t(374)](this[t(1263)]>>>16,255),e[t(1709)](this[t(1263)],24),e.LPpXD(255,this[t(661)]),e[t(516)](e[t(388)](this[t(661)],8),255),this[t(661)]>>>16&255,e[t(326)](this[t(661)],24))}static[n(580)+"er"](t,r=!0){let o=n,x={utpsB:e[o(284)],MbyYZ:e.BLyDy};if(e.tJUBg!==e[o(566)]){if(e[o(843)](isNaN,t))return r?Qa:Ei;if(r){if(e[o(665)](e.GDRUI,o(585)))this[o(261)](_0x2e8bf5,_0x47b3ab);else if(e[o(664)](t,bi))return t0}else{if(e[o(432)](t,-Si))return n0;if(e.IsXLl(t+1,Si))return e0}return K[o(701)](e[o(1234)](t,xt)|0,e[o(738)](e.SIUQf(t,xt),0),r)}else this[o(1287)+"er"]&&_0xeea762[o(936)+"entListener"](o(598),this._handleOnLine),this[o(1287)+"er"]&&_0x4e237f["removeEventListe"+o(1233)](x.utpsB,this[o(269)+o(1312)]),this[o(1287)+"er"]&&_0xa7dec4["removeEv"+o(1456)+o(1233)](o(1705),this["_handleP"+o(387)]),this[o(1287)+"er"]&&_0x41e8cf[o(936)+o(1456)+o(1233)](x.MbyYZ,this[o(670)+o(1100)])}[n(604)](){let t=n;if(e[t(488)](e[t(724)],t(692)))return this[t(1589)]?e[t(1561)](e[t(818)](e[t(1709)](this.high,0),xt),e[t(1191)](this[t(1263)],0)):e[t(1357)](e[t(1559)](this.high,xt),e[t(1191)](this[t(1263)],0));{let r=e[t(1709)](_0x56f4d5.low,0),o=e[t(388)](e[t(1309)](_0x955345[t(1263)],28)|e[t(1586)](_0x3f2a70[t(661)],4),0),x=e[t(388)](_0x10b3d6[t(661)],24),f=e[t(1225)](0,x)?e[t(238)](0,o)?r<16384?e.SjYCj(r,128)?1:2:e[t(1063)](r,2097152)?3:4:e[t(1327)](o,16384)?e[t(883)](o,128)?5:6:e[t(595)](o,2097152)?7:8:e[t(1253)](x,128)?9:10,g=e[t(1298)](_0x29fe2c,_0x463404,f),p=_0x1ea015.bytes;switch(f){case 10:p[e[t(912)](g,9)]=e[t(266)](x>>>7,1);case 9:p[e[t(1407)](g,8)]=e[t(1684)](9,f)?e[t(323)](128,x):e[t(991)](127,x);case 8:p[e.Mswqa(g,7)]=f!==8?o>>>21|128:e[t(1122)](e[t(716)](o,21),127);case 7:p[e[t(450)](g,6)]=e[t(583)](7,f)?e[t(311)](o,14)|128:e[t(1478)](e[t(752)](o,14),127);case 6:p[e[t(941)](g,5)]=f!==6?e[t(498)](o,7)|128:e[t(408)](o>>>7,127);case 5:p[e[t(1519)](g,4)]=e.tEJkv(5,f)?e[t(1359)](128,o):e[t(971)](127,o);case 4:p[e[t(1717)](g,3)]=f!==4?e[t(1117)](r>>>21,128):e.LPpXD(e[t(1522)](r,21),127);case 3:p[e.waULR(g,2)]=e[t(556)](3,f)?e.RMNGv(e[t(1309)](r,14),128):e[t(1651)](e[t(388)](r,14),127);case 2:p[g+1]=e.GSXXa(2,f)?e.YMWon(r,7)|128:e[t(458)](e[t(1595)](r,7),127);case 1:p[g]=e[t(1380)](1,f)?e[t(454)](128,r):e[t(1574)](127,r)}}}[n(1527)](){let t=n;return e.ydvUR(0,this.high)&&e.GzjKH(0,this[t(1263)])}add(t){let r=n;K[r(1441)](t)||(t=K.fromNumber(t));let o=e[r(1505)](this[r(661)],16),x=e.iHyEb(65535,this.high),f=e.uWIss(this[r(1263)],16),g=e.PNLku(65535,this[r(1263)]),p=e.oOEPQ(t[r(661)],16),h=e[r(555)](65535,t[r(661)]),w=e[r(1522)](t[r(1263)],16),C=e[r(374)](65535,t[r(1263)]),I=0,N=0,B=0,O=0;return O+=e[r(1567)](g,C),B+=O>>>16,O&=65535,B+=e.LwIbS(f,w),N+=e.qUtnR(B,16),B&=65535,N+=e[r(1377)](x,h),I+=e[r(1604)](N,16),N&=65535,I+=e[r(1561)](o,p),I&=65535,K[r(701)](e[r(1115)](e[r(811)](B,16),O),e[r(1059)](I<<16,N),this[r(1589)])}[n(578)](t){let r=n;return K[r(1441)](t)||(t=K[r(580)+"er"](t)),e[r(1380)](this[r(1589)],t.unsigned)&&e[r(603)](this[r(661)]>>>31,1)&&t.high>>>31===1?!1:this[r(661)]===t[r(661)]&&e[r(837)](this[r(1263)],t[r(1263)])}addOne(){let t=n;return e[t(603)](-1,this[t(1263)])&&this.high===-1?K[t(701)](0,0,this[t(1589)]):e[t(1093)](-1,this[t(1263)])?K[t(701)](0,this[t(661)]+1,this[t(1589)]):K[t(701)](this.low+1,this[t(661)],this[t(1589)])}[n(295)](t){return t?this.toBytesLE():this[n(1176)+"E"]()}toBytesLE(){let t=n,r=this[t(661)],o=this[t(1263)];return[e[t(1122)](255,o),e[t(756)](o>>>8,255),e[t(555)](e[t(1015)](o,16),255),o>>>24,e.NUNmI(255,r),e[t(1489)](e[t(1015)](r,8),255),e[t(539)](r,16)&255,e[t(1505)](r,24)]}toBytesBE(){let t=n,r=this.high,o=this.low;return[e[t(1371)](r,24),e[t(311)](r,16)&255,e[t(1602)](r,8)&255,e[t(1135)](255,r),o>>>24,e[t(1426)](o>>>16,255),e[t(1574)](o>>>8,255),e[t(1656)](255,o)]}}let Ei=new K(0,0,!1),Qa=new K(0,0,!0),e0=K.fromBits(-1,2147483647,!1),t0=K[n(701)](-1,-1,!0),n0=K[n(701)](0,-2147483648,!1);var He=(function(i){let t=n,r=e.UcFnZ[t(457)]("|"),o=0;for(;;){switch(r[o++]){case"0":i[i[e.VwjqI]=5004]=t(1498)+t(1424);continue;case"1":i[i[e[t(949)]]=5003]=e[t(949)];continue;case"2":i[i[e[t(375)]]=5002]=e[t(375)];continue;case"3":return i;case"4":i[i[e[t(1615)]]=5005]=e.quiKR;continue;case"5":i[i[e.NMiHB]=5001]=e[t(1334)];continue}break}})({});class ut{constructor(t){let r=n;this[r(1148)]=t,this.target=null}}class Ci extends ut{constructor(t,r){let o=n;if(e[o(1684)](e[o(1701)],e.sHtCd))super(t),this[o(1111)]=r&&r.message||null;else return!!_0x125055?.find(x=>x[o(406)]===_0x3d8110&&x.value===_0x2fa6bc)}}class Ii extends ut{constructor(t,r){let o=n;if(e[o(1197)]===e[o(1382)])_0x3da609=_0xd09a9d[e[o(405)](e[o(1159)](_0x14b749,_0x3cfc10),1)],e.runlG(e.PNLku(192,_0x400ead),128)?_0x37ddc0+=_0x82f2b7:(_0x1a8776=e[o(1461)](e[o(1457)](e[o(1440)](31,_0x7039a),6),63&_0x329a87),e.bFAEF(_0x539f7e,128)?_0x1bbfea+=_0x5273fd:(_0xcd59f1+=e[o(280)](_0x2f85fc,_0x5f0f83),_0x1ca412++));else{let x=(o(1320)+o(1130)).split("|"),f=0;for(;;){switch(x[f++]){case"0":this[o(608)]=r&&r[o(608)]||5001;continue;case"1":this[o(1444)]=r&&r[o(1444)]||"";continue;case"2":this[o(610)]=r&&r[o(610)]||0;continue;case"3":this.message=r&&r[o(1111)]||"";continue;case"4":super(t);continue;case"5":this.error=r&&r[o(1119)]||null;continue;case"6":this[o(1518)]=r&&r.colno||0;continue}break}}}}class Ai extends ut{constructor(t,r){let o=n;e[o(322)]===o(913)?_0x246216[o(378)](_0xcf79c0):(super(t),this[o(608)]=r&&r.code||0,this[o(503)]=r&&r[o(503)]||"",this.wasClean=r&&r[o(1420)]||!1,this["willReco"+o(672)]=r&&r["willReco"+o(672)]||!1)}}class Pi extends ut{constructor(t,r){let o=n;super(t),this[o(396)]=r&&r.data||null}}class ki extends Pi{constructor(t,r){let o=n;super(t),this[o(396)]=r&&r[o(396)]||null,this[o(1111)]=r&&r[o(1111)]||null}}class Ti extends ut{constructor(t,r){let o=n;super(t),this[o(396)]=r&&r[o(396)]||null}}function he(i,{message:t,code:r,error:o}){return new Ii(i,{message:t,code:r,error:o})}function we(i,{code:t,reason:r,wasClean:o,willReconnect:x}){return new Ai(i,{code:t,reason:r,wasClean:o,willReconnect:x})}function Di(i,{data:t,message:r}){let o=n;if(e[o(1642)](e.LoOqy,e[o(1649)]))return new ki(i,{data:t,message:r});if(this._options[o(1328)+o(1543)+o(1049)]||this[o(734)+o(513)])return;this[o(586)+o(630)]()}function Ri(i,{data:t}){return new Ti(i,{data:t})}function lr(i,{message:t}){return new Ci(i,{message:t})}class Ni{constructor(t,r){let o=n;this[o(1270)+"s"]=t,this[o(1181)+"es"]=r,this[o(1517)+o(1584)]=0,this[o(1060)+o(347)+o(1269)+"t"]=0}[n(1098)+"pointCon"+n(683)](){let t=n;this[t(1517)+t(1584)]=0,this["currentE"+t(347)+t(1269)+"t"]=0}[n(1577)+"es"](){let t=n;this[t(1060)+t(347)+t(1269)+"t"]=0}[n(243)+n(401)+"nt"](){let t=n;return this.endpoints[this[t(1517)+t(1584)]]}[n(243)+"ntEndpoi"+n(749)+n(329)](){let t=n;return this[t(1060)+t(347)+t(1269)+"t"]}[n(1017)+n(1396)+"es"](){let t=n;return!!(e.JeQVS(this[t(1517)+"ndex"],this[t(1270)+"s"][t(874)])||this[t(1517)+t(1584)]===this[t(1270)+"s"][t(874)]-1&&e[t(673)](this[t(1060)+"ndpointT"+t(1269)+"t"],this.maxRetries))}[n(1458)+"rentEndp"+n(1182)+"hedMaxRetries"](){let t=n;return e[t(641)](this["currentI"+t(1584)],this[t(1270)+"s"][t(874)])?!0:e[t(1532)](this["currentE"+t(347)+t(1269)+"t"],this[t(1181)+"es"])}["replaceB"+n(723)+n(402)+n(251)+n(1032)](){let t=n;if(e[t(1439)](e[t(247)],e[t(1549)]))return this[t(1060)+"ndpointT"+t(1269)+"t"]=1,this[t(1517)+t(1584)]++,this[t(1270)+"s"][this[t(1517)+t(1584)]];this[t(968)]&&this[t(968)][t(339)](_0x1c1d95),this[t(1664)](e[t(470)],_0x12924a)}[n(243)+n(401)+n(1366)+n(1447)](){let t=n;return this["currentE"+t(347)+"riesCount"]++,this[t(243)+t(401)+"nt"]()}}let dt=(e[n(755)](e.YMahl,typeof globalThis)&&n(333)===globalThis[n(1282)+"tor"].name||e.EKVPI(e[n(563)],typeof window)&&e[n(1507)](e[n(410)],window[n(1282)+"tor"].name))&&e[n(258)](e[n(563)],typeof document),et=e[n(1178)](n(549)+"d",typeof globalThis)&&(e[n(998)](e[n(427)],globalThis[n(1282)+n(1401)].name)||e[n(1607)](n(920)+n(1082)+n(1449)+"pe",globalThis[n(1282)+n(1401)].name))&&e[n(563)]!=typeof tt,Rt=(e.EKVPI(e[n(563)],typeof globalThis)&&e.cMlaG(e[n(427)],globalThis[n(1282)+"tor"][n(587)])||e.JjZXb(e.YMahl,typeof globalThis)||e[n(291)](e[n(563)],typeof globalThis)&&!!globalThis[n(259)+n(890)])&&e[n(1171)](e[n(563)],typeof wx),Nt=e[n(563)]!=typeof globalThis&&(e[n(1251)](e[n(1700)],globalThis[n(1282)+n(1401)][n(587)])||e[n(642)](n(954)+n(1333)+n(1067),globalThis[n(1282)+n(1401)][n(587)])||e.RoKjK("ServiceW"+n(1194)+n(245),globalThis[n(1282)+n(1401)][n(587)]))&&e.VYVaU("undefined",typeof self),r0=e.cBqnp(e[n(563)],typeof globalThis)&&e[n(1019)](e[n(427)],globalThis["construc"+n(1401)].name)&&e[n(312)](e[n(563)],typeof global)&&e[n(1564)](e.tZiWK,global[n(1282)+n(1401)][n(587)])&&e.bbfNu(e[n(563)],typeof process)&&!!process[n(891)];class hr{constructor(){let t=n;this[t(343)+"rs"]={}}[n(944)](t,...r){let o=n,x=this[o(343)+"rs"][t];if(x)x.slice()[o(1411)](f=>f.fn.apply(f[o(1513)],r));else if(e[o(673)](o(1119),t)&&!this[o(617)]){let f=r.length&&r[0];if(e[o(1273)](f,Error))throw f;let g=new Error(e[o(561)](e[o(662)],f?e[o(1429)](e.rUdna(" (",f[o(1111)]),")"):""));throw g[o(1506)]=f,f}return this}[n(261)](t,r){let o=n;if(e[o(1642)](void 0,t))this[o(343)+"rs"]={};else if(e[o(1093)](void 0,r))this._listeners[t]=null;else{let x=this[o(343)+"rs"][t];if(x)for(let f=0;e.SSXSd(f,x.length);)e.aWXRl(x[f].fn,r)?x[o(1291)](f,1):++f}return this}on(t,r,o){let x=n;return(this[x(343)+"rs"][t]||(this[x(343)+"rs"][t]=[]))[x(1083)]({fn:r,ctx:o||this}),this}}class i0 extends hr{[n(1634)+"rrorMess"+n(501)](t){let r=n;return t[r(939)]||t[r(379)]?("message: "+(t.errMsg||"")+r(1024)+(t.errNo||""))[r(868)]():JSON[r(1712)+"y"](t)}constructor(t,r,o){let x=n;super(),this[x(1219)]=null,Rt&&wx[x(1252)+"ocket"]&&(this[x(1219)]=wx["connectS"+x(668)]({url:t,protocols:r,header:o,fail:this[x(1002)+x(233)+"lHandler"][x(1384)](this),success:this[x(1002)+x(821)+"cessHand"+x(355)][x(1384)](this)})),et&&tt[x(1252)+"ocket"]&&(this[x(1219)]=tt[x(1252)+x(668)]({url:t,protocols:r,header:o,fail:this[x(1002)+x(233)+"lHandler"][x(1384)](this),success:this[x(1002)+x(821)+x(1268)+x(355)][x(1384)](this)}))}[n(1002)+n(821)+n(1268)+n(355)](){let t=n;Promise[t(858)]()[t(983)](()=>{let r=t;this[r(1330)+r(1220)]()})}[n(1002)+"ocketFai"+n(1310)](t){let r=n;Promise[r(858)]()[r(983)](()=>{let o=r;if(e.FdUnQ==="tXuKk"){let x=this[o(466)].getStorageSync(this[o(1702)]),f=_0x538442[o(1652)](x||"{}");return f[_0x11b7c9]=void 0,this[o(466)][o(570)+"geSync"](this[o(1702)],_0xbc4e3e[o(1712)+"y"](f))}else{let x=he(o(1119),{message:this[o(1634)+o(550)+o(501)](t)});this[o(944)](e[o(1012)],x);let f=we("close",{reason:this._formatErrorMessage(t)});this[o(944)](e[o(1404)],f)}})}[n(1330)+n(1220)](){let t=n,r={GLcwu:e.YQSjM,IMMlm:function(o,x,f){return e[P(429)](o,x,f)},dTWoa:e[t(1404)]};this[t(1219)][t(1541)](o=>{let x=t;this[x(944)](r[x(398)],r[x(1590)](Ri,x(621),{...o,data:o[x(939)]||""}))}),this[t(1219)][t(1089)](o=>{let x=t;this[x(944)](x(240),r[x(1590)](we,r.dTWoa,{...o}))}),this[t(1219)][t(613)+"e"](o=>{let x=t;this[x(944)](e[x(369)],e[x(684)](Di,x(1111),{...o}))}),this[t(1219)][t(288)](o=>{let x=t;e.ZKKTH(e[x(650)],e[x(1064)])?this[x(466)]?.[x(565)](_0x179b5b.message_id):this[x(944)](e[x(1012)],e[x(1129)](he,e[x(1012)],{...o,message:o.errMsg||""}))})}[n(339)](t){let r=n;if(t instanceof Uint8Array){let o=t[r(923)][r(687)](t.byteOffset,e[r(1561)](t[r(300)+"th"],t.byteOffset));this[r(1219)]&&this._socket[r(339)]({data:o,fail:x=>{let f=r;this[f(944)](e[f(1012)],e[f(733)](he,e.SIDpL,{message:this[f(1634)+"rrorMess"+f(501)](x)}))}})}else this[r(1219)]&&this[r(1219)][r(339)]({data:t,fail:o=>{let x=r;this[x(944)](e[x(1012)],he(e[x(1012)],{message:this[x(1634)+x(550)+"age"](o)}))}})}[n(240)](t,r){let o=n;this[o(1219)]&&this[o(1219)][o(240)]({code:t,reason:r})}[n(1375)+"Listener"](t,r){let o=n,x={vkcyi:function(f,g,p){return e[P(1365)](f,g,p)}};e[o(725)](o(1639),o(1192))?(baKxGa[o(1361)](_0x3e6078,_0x839890,58),baKxGa[o(1361)](_0x4fac6b,_0x70a177,_0x139538)):this.on(t,r)}["removeEv"+n(1456)+n(1233)](t,r){let o=n;e[o(228)](e[o(771)],o(1277))?this[o(1060)+o(347)+o(1269)+"t"]=0:this[o(261)](t,r)}get[n(1175)+"te"](){return this[n(1219)].readyState}get[n(1216)+"pe"](){let t=n;return this[t(1219)][t(1216)+"pe"]}set[n(1216)+"pe"](t){}get[n(1139)](){let t=n;return e[t(1686)]===e[t(1686)]?this[t(1219)][t(1139)]:this[t(466)][t(1134)]()}get protocol(){let t=n;return this[t(1219)][t(341)]}get[n(1622)+"ns"](){let t=n;return this[t(1219)][t(1622)+"ns"]}get[n(1305)+n(666)](){let t=n;if(e[t(859)]!==e[t(859)]){let r=_0x32c476[t(406)];e[t(1665)](void 0,r)&&(_0x493ec8(_0x431a67,10),e[t(1243)](_0x12c31f,_0x2fd81d,r));let o=_0x32c73e[t(1385)];e[t(1072)](void 0,o)&&(e[t(328)](_0x587640,_0x11e91d,18),_0x1ce5af(_0x4622e2,o))}else return 0}}function s0(i,t){let r=n;if(e.ooNxf(e[r(1558)],r(1204)))SaOLsu[r(605)](_0x47a7d9),SaOLsu[r(1529)](_0xe5c90f),_0xd9a453=[r(1288),SaOLsu.taQci,r(579),r(1118)+"ys",SaOLsu[r(571)]],_0x7a37a4=[SaOLsu.WvECy,r(1591),SaOLsu[r(1475)],"clear"],_0x61e348=new _0x416fab,SaOLsu[r(961)](_0x377e36,o=>({...o,get:(x,f,g)=>_0x35401b(x,f)||o.get(x,f,g),has:(x,f)=>!!_0x3de02e(x,f)||o[r(1097)](x,f)}));else{if(t)return new t(i.url,i.protocol);if(e[r(927)](Rt,et))return new i0(i[r(1139)],i.protocol,i[r(757)]);if(e[r(953)](dt,Nt)&&e.zxJzw(e[r(563)],typeof WebSocket)&&WebSocket)return new WebSocket(i[r(1139)],i.protocols)}}function o0(i){let t=n;return!!(i||Rt&&wx[t(1252)+"ocket"]||et&&tt[t(1252)+t(668)]||e[t(953)](dt,Nt)&&e.zxJzw(e.YMahl,typeof WebSocket)&&WebSocket)}function Oi(i,t,r){let o=-1;async function x(f){let g=P;return e.zAlZk(f,o)?Promise[g(809)](new Error(e[g(463)])):(o=f,f===r[g(874)]?Promise[g(858)]():r[f][g(1384)](i)(t,x[g(1384)](null,e[g(912)](f,1))))}x(0)}function Li(i){let t=n,r=0,o=0;for(let x=0;x<i[t(874)];++x)o=i[t(1136)+"At"](x),e[t(719)](o,128)?r+=1:e.LUyex(o,2048)?r+=2:e[t(1608)](e[t(297)](64512,o),55296)&&e[t(479)](e.JgGGU(64512,i[t(1136)+"At"](e.ABCXS(x,1))),56320)?(++x,r+=4):r+=3;return r}function Bi(i,t,r){let o=n;if(e[o(1355)](r-t,1))return"";let x="";for(let f=t;f<r;){let g=i[f++];if(g<=127)x+=String[o(559)+o(853)](g);else if(g>=192&&g<224)x+=String["fromChar"+o(853)](e[o(1461)](e.DfYvC(31,g)<<6,e.RzGcN(63,i[f++])));else if(g>=224&&e[o(595)](g,240))x+=String[o(559)+"Code"](e.RMNGv(e[o(1193)](e.hQBJY(15&g,12),e[o(1073)](e[o(560)](63,i[f++]),6)),e[o(1662)](63,i[f++])));else if(e[o(1554)](g,240)){let p=e[o(1354)](e[o(323)](e[o(1573)](e[o(1168)](e[o(1080)](e[o(560)](7,g),18),e.LOxsm(e.ZuAfb(63,i[f++]),12)),e[o(699)](e[o(1660)](63,i[f++]),6)),e.rdZaW(63,i[f++])),65536);x+=String["fromChar"+o(853)](e[o(1551)](55296,e.mVdPG(p,10))),x+=String["fromChar"+o(853)](56320+e[o(319)](1023,p))}}return x}function gr(i,t,r){let o=n,x=r,f,g;for(let p=0;e[o(1307)](p,i[o(874)]);++p)if(f=i[o(1136)+"At"](p),f<128)t[r++]=f;else if(e.uWlZv(f,2048))t[r++]=e[o(1538)](e.mywwe(f,6),192),t[r++]=e[o(323)](e.firyl(63,f),128);else if(e[o(713)](e[o(1257)](64512,f),55296)&&e.oCzHx(e.CSGLU(64512,g=i[o(1136)+"At"](e[o(589)](p,1))),56320)){let h=(o(627)+"2|4")[o(457)]("|"),w=0;for(;;){switch(h[w++]){case"0":t[r++]=e[o(1661)](e.TToxb(e[o(1455)](f,12),63),128);continue;case"1":++p;continue;case"2":t[r++]=e[o(1398)](e.pogGO(f,6),63)|128;continue;case"3":f=e[o(1431)](e[o(397)](65536,e[o(1669)](1023&f,10)),e[o(1660)](1023,g));continue;case"4":t[r++]=e.nWJiJ(e[o(1135)](63,f),128);continue;case"5":t[r++]=e[o(828)](e[o(1362)](f,18),240);continue}break}}else if(e[o(479)](e.KSHTE,e[o(1657)]))t[r++]=e[o(1221)](e[o(767)](f,12),224),t[r++]=e[o(788)](e.TToxb(e[o(1053)](f,6),63),128),t[r++]=e[o(1056)](e.rdZaW(63,f),128);else return this[o(968)]?this[o(968)].readyState:this._options[o(794)+o(1341)]?this.CONNECTING:this[o(1027)];return e[o(1464)](r,x)}async function Mi(i){let t=n;if(e[t(575)]==typeof i){let r=new Uint8Array(e[t(576)](Li,i));return e.GfBWW(gr,i,r,0),r}return e[t(1273)](i,ArrayBuffer)?new Uint8Array(i):new Uint8Array(i[t(923)],i.byteOffset,i[t(300)+"th"])}function a0(i){let t=n;try{return e[t(750)](t(250),typeof i)&&(i instanceof ArrayBuffer||i.buffer&&e.NELTo(i[t(923)],ArrayBuffer))||e.HwDmH(e[t(575)],typeof i)?"":(JSON[t(1652)](i),e[t(362)])}catch{return e.syZeJ==typeof i?e[t(365)]:""}}let c0=(i,t)=>{let r=n;switch(i){case e[r(1403)]:case e.krQCv:return{[r(236)+i]:1,"x-tt-env":t};default:return{}}};class x0{constructor(t){let r=n;this[r(899)+r(329)]=t,this[r(1699)]=0}[n(1138)](){this.count++}[n(1017)+n(417)+"nt"](){let t=n;return e[t(557)](this[t(1699)],this[t(899)+t(329)])}[n(643)+n(812)](t=0){let r=n;this[r(899)+r(329)]=t,this[r(1699)]=0}}async function u0(i){let t=n,r={etJDa:e[t(1453)],tsgMP:function(o,x){return o(x)},ueieH:e[t(629)],WNPnr:e[t(445)],qzBhX:t(1394),aAbRl:e[t(424)],CkVRh:function(o,x){return e[t(648)](o,x)}};return new Promise(o=>{let x=t;if(!dt)return r.tsgMP(o,r[x(230)]);try{let f=document[x(1074)+"ement"](r[x(1515)]);window[x(484)+"JSONP"]=g=>{let p=x;document.body[p(1363)+p(1556)](f),window[p(484)+"JSONP"]=void 0,o(g&&g[p(721)]||r[p(230)])},f[x(1148)]=r[x(1605)],f[x(1131)]=i[x(1715)](/^ws/,r.qzBhX)+r.aAbRl;try{document[x(283)]["appendCh"+x(1556)](f)}catch{document.body[x(1363)+x(1556)](f)}}catch{window[x(484)+x(819)]=void 0,r[x(1025)](o,r[x(230)])}})}function je(i,t,r){let o=n;return!!i?.[o(1211)](x=>x[o(406)]===t&&x[o(1385)]===r)}function ft(i,t){let r=n;return i?.[r(1211)](o=>o[r(406)]===t)?.[r(1385)]}let pr=null;async function d0(){let i=n;return pr||(pr=Promise[i(858)]()[i(983)](ke.bind(ke,e[i(1158)]))),pr}class f0 extends hr{constructor(t,r){let o=n;super(),this[o(377)]=t,this[o(1409)]=r,this[o(466)]=void 0,this[o(1184)+o(712)]=null}async[n(467)](){await this[n(552)]()}async _init(){let t=n,r={RlLaA:function(o,x,f,g){return e[P(1653)](o,x,f,g)},cDIKn:e.yypqt,kMFWj:e[t(284)],DHYHF:t(1340),HxbjO:function(o,x){return e[t(1329)](o,x)},UJTuJ:function(o,x){return e[t(465)](o,x)},SAqjE:function(o,x){return o(x)},hfPOk:function(o,x){return o>x},DwhEF:function(o,x){return e[t(493)](o,x)},ZpmhI:function(o,x){return e[t(232)](o,x)},mLODu:function(o,x){return e[t(504)](o,x)},JAaBz:function(o,x){return e[t(1461)](o,x)}};if(!this[t(466)]){if(this["_initPro"+t(712)])return this[t(1184)+t(712)];try{let o=this[t(377)],x=this[t(1409)];this[t(1184)+"mise"]=(async()=>{let f=t,{openDB:g}=await d0();this._qosDB=await r[f(1196)](g,f(484)+"_"+o,1,{upgrade(p){let h=f;p[h(805)+h(869)+"e"](o,{keyPath:x})}})})(),await this["_initPro"+t(712)]}catch(o){e.IXNyH(e.pCJBU,e.pCJBU)?(this[t(1287)+"er"]&&_0x28348c[t(1375)+t(942)](r[t(1610)],this[t(269)+t(451)]),this[t(1287)+"er"]&&_0x3098d7["addEvent"+t(942)](r[t(875)],this["_handleO"+t(1312)]),this[t(1287)+"er"]&&_0x1da277[t(1375)+t(942)](t(1705),this[t(670)+"ageHide"]),this[t(1287)+"er"]&&_0x36bb3d[t(1375)+t(942)](r.DHYHF,this[t(670)+t(1100)])):console[t(378)](o)}finally{if(e[t(1127)](t(1416),e[t(706)])){if(r[t(448)](_0x194dc2,1)||r[t(1165)](_0x596ced,_0xc040aa))return r[t(272)](_0x4f978b,_0x1eba37);r[t(1188)](r[t(1682)](_0x5217d8,_0x59d299),_0x4a2e27)&&(_0x431029=r[t(728)](_0x5ca2f0,_0x1e0002),_0x14d547=0);let o=_0x395fc1[t(958)](_0x5f4ec5,_0x142f39,_0x5ceb1e+=_0xf38a64);return r.mLODu(7,_0x7551ef)&&(_0x3bd0dc=r[t(1682)](r.JAaBz(7,_0x49b8b9),1)),o}else this[t(1184)+"mise"]=null}}}async get(t){let r=n;try{return await this._init(),this[r(466)]?.[r(1288)](this[r(377)],t)}catch(o){console[r(378)](o)}}async[n(840)](t,r){let o=n;if(e[o(1614)]==="RIynJ")return await this[o(552)](),this[o(466)]?.put(this[o(377)],t);this[o(899)+o(329)]=_0x1ad603,this.count=0}async[n(565)](t){let r=n;try{return await this[r(552)](),this[r(466)]?.delete(this[r(377)],t)}catch(o){console[r(378)](o)}}async[n(1134)](){let t=n;if(e.tSITu===e.tSITu)try{return await this[t(552)](),this[t(466)]?.clear(this[t(377)])}catch(r){console[t(378)](r)}else{let r={FRAxz:e[t(1012)],DyHAh:e.TZDPd};_0x2ab66c[t(858)]()[t(983)](()=>{let o=t,x=_0xaff0c(r[o(1322)],{message:this["_formatE"+o(550)+o(501)](_0x230e26)});this[o(944)]("error",x);let f=_0x50fb76(o(240),{reason:this[o(1634)+o(550)+o(501)](_0x53b2d9)});this[o(944)](r.DyHAh,f)})}}async[n(372)](){let t=n;return await this[t(552)](),this._qosDB?.[t(1118)+"ys"](this[t(377)])}async[n(579)](){let t=n;return await this._init(),this[t(466)]?.[t(579)](this._dbName)}async closeDB(){let t=n,r={ubrIM:function(o,x,f){return o(x,f)},LaQUW:e.VOmpU};try{if(e[t(1627)](t(1187),e.utxlD))this._qosDB?.[t(240)](),this._qosDB=void 0;else{let o=r[t(631)](_0x42354e,r.LaQUW,{message:t(732)});this[t(411)+t(630)]&&this[t(411)+t(630)](o)}}catch(o){console.log(o)}}get[n(1319)](){let t=n;if(e.WMdSt(e.sDyCP,e[t(744)]))try{return!!this._qosDB}catch(r){return e.JxnZG(e[t(1609)],e.eKEoT)?this[t(1263)]===-1&&e[t(1180)](-1,this[t(661)])?_0x2c3ef1.fromBits(0,0,this.unsigned):e[t(1019)](-1,this[t(1263)])?_0x57ed63[t(701)](0,this[t(661)]+1,this[t(1589)]):_0x3245e2[t(701)](e.jupWi(this[t(1263)],1),this.high,this[t(1589)]):(console[t(378)](r),!1)}else return this[t(1219)][t(1216)+"pe"]}}class l0{constructor(t,r){let o=n;this[o(282)]=t,this[o(831)]=r,this[o(466)]=localStorage}async[n(467)](){}get[n(1702)](){let t=n;return t(484)+"_"+this[t(282)]}async[n(1288)](t){let r=n,o=this[r(466)][r(1062)](this._prefix);return JSON[r(1652)](e.cVJSF(o,"{}"))[t]}async set(t,r){let o=n,x=this[o(466)][o(1062)](this[o(1702)]),f=JSON[o(1652)](e[o(838)](x,"{}"));return f[r||t[this[o(831)]]]=t,this[o(466)][o(726)](this[o(1702)],JSON[o(1712)+"y"](f)),r||t[this[o(831)]]}async del(t){let r=n;if(e[r(1311)](e.sAvuS,r(1151))){let o=this._qosDB[r(1062)](this[r(1702)]),x=JSON[r(1652)](e[r(838)](o,"{}"));return x[t]=void 0,this[r(466)][r(726)](this[r(1702)],JSON[r(1712)+"y"](x))}else this["_clearPi"+r(851)](),this[r(944)](e[r(649)],e[r(414)]),this[r(1070)+r(1137)+"Id"]=e.RxMvV(_0x41dce8,this[r(1694)][r(1384)](this),_0x3a1893)}async[n(1134)](){let t=n;return this[t(466)][t(1134)]()}async keys(){let t=n,r=this[t(466)][t(1062)](this[t(1702)]),o=JSON[t(1652)](e[t(838)](r,"{}"));return Object[t(372)](o)}async getAll(){let t=n,r=this._qosDB[t(1062)](this[t(1702)]),o=JSON.parse(r||"{}");return Object[t(350)](o)}[n(965)](){return Promise[n(858)]()}get isReady(){return!!this[n(466)]}}class h0{constructor(t,r){let o=n;this._DBName=t,this[o(831)]=r,this[o(466)]=et?tt:Rt?wx:null}async[n(467)](){}get[n(1702)](){let t=n;return t(484)+"_"+this[t(282)]}async[n(1288)](t){let r=n,o=this[r(466)][r(1676)+"geSync"](this[r(1702)]);return JSON.parse(e[r(620)](o,"{}"))[t]}async[n(840)](t,r){let o=n,x=this[o(466)][o(1676)+"geSync"](this[o(1702)]),f=JSON.parse(x||"{}");return f[r||t[this[o(831)]]]=t,this[o(466)][o(570)+o(1047)](this._prefix,JSON.stringify(f)),r||t[this[o(831)]]}async[n(565)](t){let r=n,o=this._qosDB.getStorageSync(this[r(1702)]),x=JSON[r(1652)](o||"{}");return x[t]=void 0,this._qosDB[r(570)+r(1047)](this[r(1702)],JSON[r(1712)+"y"](x))}async[n(1134)](){let t=n;return this._qosDB[t(841)+"rageSync"]()}async[n(372)](){let t=n,r=this[t(466)][t(1676)+t(551)+"nc"](this[t(1702)]),o=JSON[t(1652)](r||"{}");return Object[t(372)](o)}async[n(579)](){let t=n,r=this[t(466)]["getStora"+t(551)+"nc"](this[t(1702)]),o=JSON[t(1652)](e.nlmjw(r,"{}"));return Object[t(350)](o)}[n(965)](){let t=n;if(e.runlG(e.ulUCH,e[t(624)])){let r=e[t(1509)][t(457)]("|"),o=0;for(;;){switch(r[o++]){case"0":if(!this[t(968)])return;continue;case"1":this[t(968)][t(936)+t(1456)+"ner"](e[t(380)],this[t(290)]);continue;case"2":this._ws[t(936)+t(1456)+"ner"](e[t(369)],this[t(616)+"ge"]);continue;case"3":this[t(968)][t(936)+t(1456)+"ner"]("error",this[t(1066)]);continue;case"4":this[t(968)][t(936)+"entListe"+t(1233)](e[t(1404)],this[t(1348)]);continue}break}}else return Promise[t(858)]()}get[n(1319)](){return!!this[n(466)]}}function zi(i,t){let r=n;if(et||et)return new h0(i,t);if((dt||Nt)&&e[r(1171)](e[r(563)],typeof indexedDB))return new f0(i,t);if(e.TBaNi(dt,Nt)&&e.cHmgG(r(549)+"d",typeof localStorage))return new l0(i,t);throw new Error(e.rzCbg)}class g0{constructor(){let t=n;e[t(800)](e.rdscO,e.pNNPi)?(this[t(1173)+"lTimeoutId"]=null,this[t(1173)+"l"]=36e5,this[t(466)]=e.nRhPr(zi,t(1144),t(562)+"id")):(e[t(1104)](_0x27e158,_0x446c20,18),e.RxMvV(_0x215ba5,_0xdb1cc9,_0xccbb72))}async["_interva"+n(348)](){let t=n,r={BVorz:function(o,x){return e[P(1203)](o,x)},KHgwP:function(o,x){return o!==x},ifKbl:e.JpGsJ,EyBHe:e[t(882)]};e[t(1108)](clearInterval,this["_interva"+t(1315)+"Id"]),this[t(1173)+t(1315)+"Id"]=setInterval(()=>{let o=t,x={WlTWp:function(f,g){return r[P(382)](f,g)}};if(r.KHgwP(r[o(1125)],r[o(1613)]))this[o(1356)+"ired"]();else{let f=this[o(466)][o(1676)+"geInfoSync"](this[o(1702)]),g=_0x1084ae[o(1652)](cCtwiK[o(644)](f,"{}"));return _0x1ef814[o(372)](g)}},this[t(1173)+"l"])}async[n(467)](){let t=n,r={MqnpH:e[t(369)],wwyai:function(o,x){return e[t(862)](o,x)},bJvCx:e[t(415)],nEuOZ:e.yjuLm};e[t(238)](e[t(1009)],e[t(639)])?(this[t(216)+t(346)+t(1638)]=_0x8037e0,_0x485d14?this["_handleO"+t(451)]():this["_handleO"+t(1312)]()):await this[t(466)][t(467)]()[t(983)](()=>{let o=t,x={KOPGx:r.MqnpH};r[o(340)](r[o(1572)],r[o(1163)])?(this[o(944)](x[o(292)],_0x844df5),this[o(531)+"e"]&&this[o(531)+"e"](_0x47e967)):this[o(1173)+o(348)]()})}async[n(1356)+"ired"](){let t=n;(await this[t(466)]?.getAll()||[])[t(1508)](({timestamp:x})=>x<Date[t(984)]())[t(1411)](x=>{let f=t;this[f(466)]?.[f(565)](x[f(562)+"id"])})}async del(t){let r=n;return e[r(772)]===e[r(772)]?this[r(466)]?.del(t):_0x2af94e[r(858)]()}async[n(840)](t,r){let o=n;return this[o(466)]?.[o(840)]({message_id:t,timestamp:r})}async[n(1288)](t){let r=n;return this[r(466)]?.[r(1288)](t)}async closeDB(){let t=n;e[t(325)](clearInterval,this[t(1173)+t(1315)+"Id"]),await this[t(466)]?.closeDB()}get[n(1319)](){let t=n;if(e[t(1619)](t(1486),e[t(260)]))return this._qosDB?.[t(1319)];{let r=_0xfeda44.substring(0,e[t(888)](4,_0x11fc9a[t(874)])),o=r.concat(_0x3705d9);_0x146fa4[t(1083)](o)}}}function mr(i){let t=n;if(e[t(488)](e[t(308)],e[t(884)])){if(!this[t(646)+"orOnline"]()||this._readyClosed)return;this[t(1318)+t(1132)]?.["resetEndpointCon"+t(683)](),this[t(596)+"sCounter"]?.[t(643)+t(812)](),this[t(968)]?this[t(1236)+t(383)](1001,e.AjUnn,!0):this[t(281)]()}else{let r=!!this[t(597)].enableQoS;if(!r)return{enabled:r,isQoSMessage:!1,isQoSAck:!1,isAckCleanupMessage:!1,ackMsgIds:[]};let o=e[t(1041)](je,i[t(1111)][t(757)],e[t(778)],"2"),x=o&&e[t(352)](je,i[t(1111)][t(757)],e[t(826)],"1"),f=o&&e.jXgyA(je,i[t(1111)][t(757)],t(1402)+t(1326)+"k","1"),g=f?ft(i.message.headers,e[t(373)])?.[t(457)](",")[t(1508)](Boolean)||[]:[];return{enabled:r,isQoSMessage:o,isQoSAck:x,isAckCleanupMessage:f,ackMsgIds:g}}}async function Fi(){let i=n;return this[i(1210)+i(321)]||(this[i(1210)+"ger"]=new g0),this[i(1210)+i(321)][i(1319)]||await this._QoSManager[i(467)](),this[i(1210)+i(321)]}async function p0(i,t){let r=n,o={SoCJI:function(x,f){return e[P(476)](x,f)},hPcxM:function(x,f){return x|f},UQTrl:function(x,f){return e[P(817)](x,f)},zokQc:function(x,f){return e[P(472)](x,f)},LMJJc:function(x,f){return e[P(385)](x,f)},cLCcx:function(x,f){return e[P(1367)](x,f)}};if(r(602)===e[r(298)]){let{enableAutoAck:x}=this[r(597)],f=je(i[r(1111)].headers,"need_ack","1"),g=e.tGjiW(je,i[r(1111)].headers,e.iNuoI,"1"),p=mr[r(958)](this,i);if(e[r(908)](x,f)){let{SeqID:h,LogID:w,service:C,LogIDNew:I,method:N}=i[r(1111)];this[r(1086)]({SeqID:h,LogID:w,LogIDNew:I,service:C,method:N,headers:[{key:e[r(938)],value:"1"},{key:e[r(768)],value:e.TBaNi(I,"")},{key:e[r(442)],value:"0"}]})}g&&!p[r(395)]&&this[r(1560)+r(307)+"ageEvent"](i),t()}else return new _0x31171c(AQLASg[r(1568)](AQLASg.hPcxM(_0x4bd578[0],_0x399c51[1]<<8),_0x5dfe12[2]<<16)|AQLASg[r(947)](_0x516348[3],24),AQLASg[r(1568)](AQLASg.zokQc(_0x3fe92a[4]|AQLASg[r(814)](_0x3f3650[5],8),AQLASg[r(947)](_0x4a57c9[6],16)),AQLASg[r(1369)](_0x526977[7],24)),_0x31e18a)}async function m0(i,t){let r=n;this._debug(e.WASBY,i[r(1111)]),e[r(1529)](t)}async function _0(i,t){let r=n;if(e[r(1667)]===e[r(1667)]){let o=Ne(await e[r(678)](Mi,i[r(396)]));try{if(o[r(636)]instanceof Uint8Array)if(e[r(1127)](e.DNXaI,r(491)))_0x339e91[r(378)](_0x4fd32c);else{let x=e.mwLWO(this._options[r(1189)+"ncoding"],Object)?{force:!!this[r(597)][r(1189)+r(835)][r(847)],encoding:this[r(597)][r(1189)+r(835)][r(1212)]?this[r(597)][r(1189)+r(835)][r(1212)].replace(/\s/g,"")[r(1238)+r(758)]():""}:{force:!1,encoding:this[r(597)]["payloadE"+r(835)]?this[r(597)][r(1189)+"ncoding"].replace(/\s/g,"")[r(1238)+r(758)]():""},f=o[r(1189)+r(835)]?o[r(1189)+r(835)][r(1715)](/\s/g,"")[r(1238)+r(758)]():"",g=e[r(1273)](this[r(597)][r(640)+"ype"],Object)?{force:!!this[r(597)]["payloadT"+r(1397)][r(847)],type:this[r(597)][r(640)+"ype"][r(1148)]?this[r(597)][r(640)+r(1397)].type[r(1715)](/\s/g,"")[r(1238)+"ase"]():""}:{force:!1,type:this[r(597)][r(640)+r(1397)]?this[r(597)][r(640)+r(1397)].replace(/\s/g,"")[r(1238)+r(758)]():""},p=o[r(640)+r(1397)]?o["payloadT"+r(1397)].replace(/\s/g,"")[r(1238)+r(758)]():"",h=g.force?g[r(1148)]:p||g.type,w=x[r(847)]?x.encoding:f||x[r(1212)],C=[e[r(365)],e.bIQla,e[r(1477)],e.syZeJ],I=[e[r(1643)],e.cRvaz];this._options[r(1092)+r(1711)+r(823)+"ad"]&&C[r(973)](h)&&(!w||I[r(973)](w))?o[r(906)+r(1611)]=Bi(o[r(636)],0,o.payload[r(300)+"th"]):o[r(906)+r(1611)]=""}else o[r(906)+r(1611)]=""}catch(x){o[r(906)+"oad"]="",console[r(378)](x)}i[r(1111)]=o,e[r(1529)](t)}else SaOLsu.YMahl!=typeof _0x301c28&&_0x3632de["toString"+r(1160)]&&_0x1f78a[r(969)+r(656)](_0x14ae22,_0x13c96a[r(1373)+r(1160)],{value:SaOLsu[r(633)]}),_0x51d4e1[r(969)+r(656)](_0xa81576,SaOLsu[r(1005)],{value:!0})}function w0(i,t,r){let o={TDrLH:function(h,w){return h(w)},MIxka:function(h,w){return e[P(1317)](h,w)},QhnPn:function(h,w){return h(w)},ZnXgH:function(h,w){return e[P(266)](h,w)},NotlD:function(h,w){return e[P(454)](h,w)}},x=r||8192,f=x>>>1,g=null,p=x;return function(h){let w=P;if(h<1||h>f)return o[w(1266)](i,h);o[w(1633)](p,h)>x&&(g=o[w(966)](i,x),p=0);let C=t[w(958)](g,p,p+=h);return o[w(1697)](7,p)&&(p=o[w(1633)](o[w(1199)](7,p),1)),C}}let y0=4294967295;function v0(i,t,r){let o=n,x={JnApa:function(f,g){return e.kCeYY(f,g)},nBvLI:function(f,g){return e.iApOf(f,g)},HjZJA:function(f,g){return e[P(1671)](f,g)},JkUWx:function(f,g){return f<<g},NzoCH:function(f,g){return e[P(370)](f,g)},SylNd:function(f,g){return f<<g},YmdOQ:function(f,g){return f+g},nvtAp:function(f,g){return e.UZTjA(f,g)},kLWDD:function(f,g){return e[P(729)](f,g)},jzYfC:function(f,g){return e[P(873)](f,g)},fniKi:function(f,g){return e.hfJEF(f,g)}};if(e[o(655)](e[o(1028)],e[o(1410)])){let f=new _0x2bb61b(x[o(582)](x[o(403)](x[o(394)](x[o(1562)](_0x35971b[x[o(1578)](_0x10ffc9,4)],24),x.SylNd(_0x5e74e7[_0x1f3004+5],16)),x.SylNd(_0x3efa94[x[o(1578)](_0x300b36,6)],8)),_0x48e3ac[x[o(964)](_0x19fe92,7)]),x[o(544)](x.HjZJA(x[o(582)](_0x579126[x[o(1578)](_0x4852fb,0)]<<24,x[o(783)](_0x50d307[x[o(1658)](_0x20de15,1)],16)),x[o(1562)](_0x12c950[x[o(964)](_0x3ac319,2)],8)),_0x1ec4b6[x[o(226)](_0x271dc5,3)]),!0);return _0xd1f950+=8,{value:f,offset:_0x272327+8}}else return e[o(1343)](RangeError,e[o(1240)](e.ysxwB(e[o(462)](e[o(561)](e.SdUmT,i),e[o(609)]),e[o(620)](t,1)),e[o(1162)])+r)}function b0(i,t,r){let o=n,x={elsOn:o(1339)};if(r>y0)throw new Error(e[o(302)]);let f=3;for(;e.kFbGi(f,0);)if(o(1037)===e[o(1350)])_0x33595e=x[o(330)],_0x3a65d3=_0x51ef8.replace(/(^http)((?:[s]*:\/\/))/,""),_0x400f9e=/(^ws)((?:[s]*:\/\/))/[o(628)](_0x2317ef)?_0xcf2511:""+_0x2be1cb+_0x56475a;else{let g=255&r;wr(g,i,e[o(561)](t,f)),r>>>=8,f--}return e[o(1646)](t,4)}function S0(i,t){let r=n,o=0,x=t,f=e[r(450)](t,4);for(;e[r(883)](x,f);){let{value:g,offset:p}=e.inPxy(_r,i,x);x=p,o=e.DgXLt(e[r(817)](o,8),0),o+=g}return{value:o,offset:f}}function E0(i,t,r){let o=n,x=(o(754)+"4")[o(457)]("|"),f=0;for(;;){switch(x[f++]){case"0":if(t[o(878)+"e"])return e.SyBXp(t[o(878)+"e"](i,r),r);continue;case"1":if(i[o(874)]<40)return gr(i,t,r)+r;continue;case"2":if(!i)return r;continue;case"3":if(t[o(287)])return e.iQdYS(t[o(287)](i,r),r);continue;case"4":return e[o(1631)](e[o(315)](gr,i,t,r),r)}break}}function C0(i,t){let r=n,o=new K(e[r(476)](e[r(696)](e[r(476)](e[r(1437)](i[e.ADFqZ(t,4)],24),e.havkO(i[e[r(1717)](t,5)],16)),e[r(1271)](i[t+6],8)),i[e[r(852)](t,7)]),e[r(227)](e[r(1484)](i[e.NrCRK(t,0)],24)|e[r(1414)](i[e[r(1561)](t,1)],16)|e[r(903)](i[e.KpVBr(t,2)],8),i[e[r(1431)](t,3)]),!0);return t+=8,{value:o,offset:t+8}}function I0(i,t,r){let o=n,x=i[o(1263)],f=i[o(661)];return t[r]=e.VPPht(f,24),t[e[o(976)](r,1)]=e[o(1511)](e[o(836)](f,16),255),t[e[o(405)](r,2)]=e[o(1205)](e[o(654)](f,8),255),t[e[o(1487)](r,3)]=e[o(1314)](255,f),t[r+4]=e.uWIss(x,24),t[r+5]=e[o(310)](e[o(388)](x,16),255),t[e[o(450)](r,6)]=e.GEHEJ(e[o(1602)](x,8),255),t[e[o(1548)](r,7)]=e[o(1250)](255,x),r+=8,r}function _r(i,t){let r=n;return i[r(1316)+"8"]?{value:i[r(1316)+"8"](t),offset:e.NrCRK(t,1)}:{value:e[r(1675)](255,i[t]),offset:e[r(1101)](t,1)}}function wr(i,t,r){let o=n;return t[o(453)+"t8"]?t[o(453)+"t8"](i,r):t[r]=e[o(514)](255,i),r+1}let A0=function(i){return new Uint8Array(i)},P0=e.CkKAM(e[n(563)],typeof Buffer)?Buffer[n(1035)+n(1051)]:w0(A0,Uint8Array[n(1215)+"e"].subarray),k0=16,yr=32;function T0(i){let t=n,r=0,o={};for(let x=0;e[t(883)](x,i[t(874)]);x++)o[i[x][t(1352)+t(638)]]=e[t(961)](Li,i[x][t(1352)+t(638)]),r+=14+o[i[x][t(1352)+t(638)]];return[r,o]}function Ui(i,t,r){let o=n;if(o(1094)!==e[o(523)]){let x=_0x16697b.charCodeAt(_0x5df695);x>=55296&&e[o(432)](x,56319)&&e[o(1327)](e[o(1295)](_0x2d0d35,1),_0x5a0019)&&(x=e[o(1354)](e[o(1317)](x<<10,_0xb465d5.charCodeAt(++_0xc8428)),56613888)),_0x3cce80+=e.PsRAd(x,128)?1:e[o(1280)](x,2048)?2:x<65536?3:4}else{let[x,f]=e[o(1546)](T0,i),g=e[o(1491)](P0,x),p=0;return i[o(1411)](h=>{let w=o,C=e[w(904)][w(457)]("|"),I=0;for(;;){switch(C[I++]){case"0":p=wr(0,g,p);continue;case"1":console[w(378)](e[w(775)],p);continue;case"2":console.log(w(1425),p);continue;case"3":p=e[w(317)](E0,h["cursor_n"+w(638)],g,p);continue;case"4":console[w(378)](e[w(543)],p);continue;case"5":p=I0(K[w(580)+"er"](h[w(1685)]||t),g,p);continue;case"6":console[w(378)](e[w(1179)],p);continue;case"7":console[w(378)](w(587),p);continue;case"8":console[w(378)](e[w(252)],h,h[w(799)]);continue;case"9":p=wr(f[h[w(1352)+w(638)]],g,p);continue;case"10":p=b0(g,p,h[w(799)]||0);continue}break}}),{frameType:yr,headers:[{key:e[o(257)],value:r}],payload:g}}}function D0(i){let t=n,r=0,o=[];for(;e[t(475)](r,i[t(300)+"th"]);){let{offset:x}=e[t(1628)](_r,i,r);r=x;let f={cursor_name:"",cursor:0,service:0},{value:g,offset:p}=e[t(1190)](S0,i,r);f[t(799)]=g,r=p;let{value:h,offset:w}=e.Hfarm(_r,i,r);r=w,f[t(1352)+t(638)]=e[t(709)](Bi,i,r,r+h),r+=h;let{value:C,offset:I}=e[t(592)](C0,i,r);f[t(1685)]=C[t(604)](),r=I,o[t(1083)](f)}return o}function R0(){let i=n;if(e[i(540)](e[i(1432)],"GhGbC"))return{frameType:yr,headers:[{key:"cursor_file_name",value:e[i(680)]}],payload:void 0};if(!this[i(968)])return;this["_destroy"+i(898)+"t"](_0x551dd2,_0x418ee8,_0x24375a)}class N0{constructor(t,r,o){let x=n;this[x(1254)+"ameSpace"]=t,this[x(999)+x(332)]=r,this[x(349)+x(803)]=o,this[x(466)]=e[x(1022)](zi,this[x(1254)+x(1020)],e[x(1336)])}async openDB(){let t=n;if(e[t(600)](e.ZJasp,e[t(569)]))await this[t(466)][t(467)]();else{if(SaOLsu[t(990)](_0x408f15,_0x358285)){if(_0x610dd0===SaOLsu.dGmMZ)return _0x4ba9ef.get(_0x44aa06);if(SaOLsu[t(603)](_0x4c76f9,SaOLsu[t(740)]))return _0x12f13c.objectStoreNames||_0x2539aa.get(_0x41e4f1);if(SaOLsu[t(1225)](_0x3dc824,SaOLsu.winZo))return _0x37cbc4[t(782)+"oreNames"][1]?void 0:_0x272a54[t(782)+t(426)](_0x3dd74d[t(782)+"oreNames"][0])}return SaOLsu[t(366)](_0x111986,_0xe4504f[_0x4c5f11])}}async getCursors(){let t=n;if(!this._qosDB[t(1319)])return;let r=this[t(349)+t(803)],o=await this[t(466)].getAll();switch(console[t(378)](e[t(845)],o),r){case e[t(1166)]:return o&&o[t(874)]?e[t(522)](Ui,o,0,this["_cursorF"+t(332)]):void 0;case t(844):return;case e.TagST:return o&&o[t(874)]?e[t(751)](Ui,o,0,this["_cursorF"+t(332)]):e[t(1529)](R0)}}async[n(840)](t,r,o){let x=n;return console.log("setdb",t,r,o),this[x(466)].set({cursor_name:t,cursor:r,service:o})}async[n(901)+"rs"](t){let r=n;if(e[r(685)]===e.kELST)try{return e[r(1171)](e[r(575)],typeof _0x15a6d4)&&(e[r(505)](_0x2a69c5,_0x24c5c2)||_0x4aaeb0[r(923)]&&e[r(505)](_0x4db350[r(923)],_0x508b0c))||e[r(575)]!=typeof _0x21f91c?"":(_0x32d1bc.parse(_0x5a4b4b),e.bIQla)}catch{return e[r(1065)]("string",typeof _0x4f148a)?e[r(365)]:""}else{let o=e[r(808)](D0,t);for(let x of o)e.eDkbt(e[r(477)],e[r(477)])?(console[r(378)](e[r(945)],o),await this[r(466)][r(840)](x)):this[r(261)](_0x32422a,_0x396ea9)}}async[n(1288)](t){let r=n;return(await this[r(466)][r(1288)](t))?.[r(1685)]}async[n(965)](){await this[n(466)].closeDB()}[n(1029)+n(294)+n(1323)](t){let r=n;this[r(999)+r(332)]=t}get[n(1319)](){let t=n;return this[t(466)][t(1319)]}}let O0=e[n(1673)];async function qi(i){let t=n;if(!this[t(597)][t(1344)+"S"])return null;let{aID:r,fpID:o,messageStrategy:x}=this._options,f=e[t(838)](i,O0);try{return this[t(786)+t(356)]?i&&this["_cursorM"+t(356)][t(1029)+t(294)+t(1323)](i):this[t(786)+t(356)]=new N0(o+"_"+r+"_"+f,f,x),this[t(786)+t(356)][t(1319)]||await this[t(786)+"anager"][t(467)](),this[t(786)+t(356)]}catch{return null}}async function L0(i,t){let r=n,o=e[r(352)](je,i[r(1111)][r(757)],e.jIXtS,"-1"),x=e[r(1719)](je,i[r(1111)][r(757)],e.iNuoI,"1"),f=e.umXFU(ft,i.message[r(757)],r(1402)+r(1331)),g=e[r(1654)](Number,ft(i[r(1111)][r(757)],e.czMnb))||0,p=mr[r(958)](this,i),h=je(i[r(1111)][r(757)],e.jmvPn,"2"),w=e[r(1285)](ft,i[r(1111)][r(757)],r(1598)+r(679)+"e"),C=e[r(678)](Number,e[r(438)](ft,i[r(1111)][r(757)],e[r(1218)]));if(p[r(395)])return e[r(1372)](t);let I=p[r(1716)+r(907)]?await Fi[r(958)](this):null;if(e[r(1677)](i[r(1111)][r(799)],0)&&x&&!o||i[r(1111)][r(799)]>0){if(f&&p[r(1716)+"sage"]&&I)return!!!await I.get(f)&&(this[r(1560)+r(1349)+"Event"](i),await I[r(840)](f,e[r(1429)](Date.now(),g))),e[r(1372)](t);if(h){let N=await qi.call(this);if(!N)return this[r(1560)+"hMessage"+r(761)](i),t();let B=await N[r(1288)](w)??-1;if(e[r(977)](B,C))this[r(1560)+"hMessage"+r(761)](i),N.set(w,C,i[r(1111)][r(799)]);else throw new Error(r(502)+r(1553)+r(485)+C+(r(689)+"than loc"+r(676)+"r ")+B);return e[r(1055)](t)}return this["_dispatc"+r(1349)+r(761)](i),t()}}async function B0(i,t){let r=n,o=mr[r(958)](this,i);if(!o.isQoSMessage)return e[r(784)](t);let x=await Fi[r(958)](this);if(o[r(1091)+r(515)+"age"]&&o[r(880)+"s"][r(874)])for(let f of o[r(880)+"s"])await x[r(565)](f);t()}async function M0(i,t){let r=n,o=e[r(1043)](i.message[r(431)+"e"],k0),x=e.XNBYA(i[r(1111)][r(431)+"e"],yr);if(e[r(218)](!o,!x))return e[r(605)](t);let f=e.MBTfh(ft,i[r(1111)][r(757)],e[r(257)]);if(!f)return e[r(1529)](t);let g=await qi[r(958)](this,f);if(!g)return e[r(784)](t);if(o){let p=await g[r(1156)+"rs"](),h={frameType:p?.["frameType"],SeqID:K[r(580)+"er"](this[r(455)]++),LogID:K.fromNumber(this[r(597)][r(741)+r(527)]()),service:9e3,method:5,headers:p?.[r(757)],payload:p?.payload},w=e[r(494)](E,h);this[r(968)]&&this._ws.readyState&&this[r(968)][r(339)](w)}if(x){let p=i[r(1111)][r(636)];p&&g[r(901)+"rs"](p)}}let z0=async function(i,t){let r=n;this[r(1213)]=!1,e[r(1469)](clearTimeout,this[r(281)+r(447)+"utId"]),e.kzFvX(t)},F0=async function(i,t){let r=n;if(!this[r(968)]||e[r(1619)](this._ws[r(1175)+"te"],this[r(1576)]))return e[r(1714)](t);let{pingInterval:o}=this._options;this._endpointManager?.[r(1098)+r(1228)+r(683)]();for(let f=0;e[r(1417)](f,this[r(349)+"Queue"][r(874)]);f++){let g=this._messageQueue[f];if(e[r(1627)](this[r(968)][r(1175)+"te"],this[r(1576)])&&e[r(1088)](null,g))if(e[r(526)](e[r(1081)],e[r(1081)]))this[r(968)]&&this[r(968)][r(339)](g),this[r(349)+"Queue"][f]=null;else return _0x453b9a?_0x124492[r(1679)+r(584)](_0x333e89,_0x132a28):_0x3b032d[r(1679)+r(1718)](_0x80e57a,_0x2c6b97);else break}this[r(349)+r(793)]=this[r(349)+r(793)][r(1508)](f=>!!f),this[r(1070)+r(1137)+"Id"]=e[r(1099)](setTimeout,()=>this[r(1694)](),o),this[r(1560)+r(704)+"nt"](i),this[r(1287)+"er"]&&this._ws&&(this[r(968)][r(1216)+"pe"]=this[r(546)+r(1397)]);let x=this[r(1318)+r(1132)]?.[r(243)+r(401)+"nt"]();this[r(1664)](r(490)+x+" success"),e[r(1255)](t)},U0=async function(i,t){let r=n,o=this._endpointManager?.[r(243)+"ntEndpoint"]();this[r(1664)](r(490)+o),e[r(671)](t)};class q0 extends hr{constructor(t){let r=n,o={VMxmy:function(p,h,w){return e[P(1209)](p,h,w)},QfqcZ:e.SIDpL,pSIiE:function(p,h){return e[P(1507)](p,h)},dvUgF:function(p,h,w){return p(h,w)},bLwdG:e[r(1404)],kEgRb:function(p,h){return e.WMdSt(p,h)},vDkyc:function(p,h,w){return e[r(1207)](p,h,w)},ALQLj:"bye",SLtLK:function(p,h){return e[r(807)](p,h)},doBSx:function(p,h,w){return e[r(684)](p,h,w)},Eqwjb:function(p,h){return p!==h},yxleq:e[r(951)]};super(),this[r(216)+"igatorOn"+r(1638)]=!0,this[r(1287)+"er"]=dt,this[r(1647)]=r0,this._isMiniTT=et,this[r(1691)+"X"]=Rt,this[r(492)+"r"]=Nt,this["_message"+r(793)]=[],this[r(1318)+r(1132)]=null,this[r(734)+r(513)]=!1,this[r(546)+r(1397)]="arraybuf"+r(430),this[r(281)+r(855)]=!1,this[r(281)+"ionTimeoutId"]=null,this[r(263)+r(1155)+r(1450)]=null,this[r(1070)+"gTimeoutId"]=null,this._seqId=0,this[r(1213)]=!1,this._url="",this[r(1210)+"ger"]=null,this["_cursorM"+r(356)]=null,this._pingLossCounter=null,this[r(499)+"ls"]=e.Kxpct,this[r(1027)]=3,this.CONNECTING=0,this[r(1576)]=1,this[r(452)]=2,this[r(290)]=p=>{let h=r;try{e[h(1653)](Oi,this,p,[z0,F0,U0])}catch(w){let C=he("error",{message:w[h(1111)],code:He[h(1106)+"OR"],error:w});this[h(1560)+h(698)+h(271)](C)}},this._onMessage=async p=>{let h=r,{pingInterval:w,pingFrequency:C}=this[h(597)];if((p[h(396)]==="hi"&&e[h(1413)]===C||e.ZPOQQ(e[h(1103)],C))&&(this[h(1418)+h(851)](),this[h(944)](e[h(649)],e.LsPDX),this["_pingPon"+h(1137)+"Id"]=setTimeout(this._ping[h(1384)](this),w)),!e[h(1261)]("hi",p[h(396)]))try{e[h(1436)](Oi,this,p,[_0,p0,B0,M0,L0,m0])}catch(I){let N=e.kbtCt(he,e.SIDpL,{message:I.message,code:He[h(1498)+h(1424)],error:I});this["_dispatc"+h(698)+h(271)](N)}},this[r(1066)]=p=>{let h=r;if(h(900)!=="iUXZY"){let{type:w}=_0x5d0a93;this[h(944)](w,_0x3179c)}else{let w=this[h(1318)+h(1132)]?.[h(1017)+"chMaxTries"](),C=this[h(1318)+h(1132)]?.["getCurre"+h(401)+"nt"]();if(w&&!p[h(1111)]){let I=h(779)+C+(h(1297)+h(1075)+h(1422)+"ed");this[h(1560)+h(698)+h(271)](o[h(894)](he,o[h(825)],{message:I,code:He[h(1031)+h(353)+"R"],error:p}));return}this[h(968)]&&o.pSIiE(this._ws[h(1175)+"te"],this[h(1576)])&&this[h(1236)+h(383)](),this[h(1560)+h(698)+h(271)](o[h(765)](he,o[h(825)],{message:p[h(1111)],code:He[h(1641)+h(433)],error:p}))}},this[r(1348)]=async p=>{let h=r;this[h(730)+h(1428)](),this[h(1418)+"ngTimer"](),this[h(773)+h(824)+"rs"](),this._ws=null,this[h(281)+h(855)]=!1;let w=this["_endpoin"+h(1132)]?.["checkRea"+h(1396)+"es"]();if(!w&&this._navigatorOnline()&&!this[h(734)+h(513)]){let C=this[h(1318)+h(1132)]?.["getCurre"+h(401)+"nt"](),I=this._options["reconnec"+h(1337)+"ptor"](p[h(608)],p[h(503)]);this[h(1560)+h(1045)+h(271)](we(o[h(1304)],{code:1006,reason:p[h(503)]||"connecting faile"+h(950)+h(955)+"n, hostn"+h(244)+C,willReconnect:I})),I&&this._connect();return}if(o[h(440)](1e3,p.code)&&this[h(734)+h(513)]){this[h(1560)+h(1045)+"ent"](o.vDkyc(we,o.bLwdG,{code:1e3,reason:o[h(1140)]})),this[h(1318)+h(1132)]?.[h(1098)+h(1228)+h(683)](),this["_pingLos"+h(1264)]?.[h(643)+h(812)]();return}if(o[h(440)](1e3,p[h(608)])&&w){let C=this._endpointManager?.[h(243)+"ntEndpoint"](),I=p[h(503)];I||(I=await o.SLtLK(u0,this[h(1239)])),I=h(599)+h(1141)+h(1616)+I+(h(225)+h(914))+C+(h(1172)+h(249)+h(935)),this["_dispatc"+h(1045)+h(271)](o[h(1579)](we,o[h(1304)],{code:p[h(608)],reason:I}));let N="connect "+C+(h(1297)+h(1075)+"es reached");this["_dispatchErrorEv"+h(271)](o[h(1579)](he,o[h(825)],{message:N,code:He[h(1031)+h(353)+"R"]})),this[h(1318)+"tManager"]?.[h(1098)+h(1228)+h(683)](),this[h(596)+h(1264)]?.[h(643)+h(812)]();return}if(o.Eqwjb(1e3,p[h(608)])&&!p.reason)if(o[h(1143)]("rXnZD",o[h(1057)]))_0x483ccc.log(_0x3e7928);else{let C=this[h(1318)+h(1132)]?.[h(243)+"ntEndpoint"]();this[h(1560)+h(1045)+h(271)](o[h(765)](we,o.bLwdG,{code:p[h(608)],reason:h(599)+h(1141)+h(950)+h(955)+h(988)+"ame: "+C})),this[h(1318)+h(1132)]?.[h(1098)+h(1228)+h(683)](),this[h(596)+h(1264)]?.[h(643)+h(812)]();return}this[h(1560)+"hCloseEv"+h(271)](p),this[h(1318)+h(1132)]?.[h(1098)+h(1228)+h(683)](),this[h(596)+h(1264)]?.[h(643)+h(812)]()},this.onclose=null,this[r(617)]=null,this.onmessage=null,this[r(359)]=null,this[r(411)+"econnect"]=null,this[r(285)+r(1378)]=null,this["onStopIm"+r(1650)+r(1050)+"ct"]=null,this[r(269)+r(451)]=this[r(269)+r(451)][r(1384)](this),this[r(269)+"ffLine"]=this[r(269)+r(1312)][r(1384)](this),this[r(670)+r(387)]=this[r(670)+r(387)][r(1384)](this),this[r(670)+r(1100)]=this[r(670)+r(1100)][r(1384)](this),this[r(597)]={url:"",automaticOpen:!0,initReconnectInterval:1e3,maxReconnectInterval:1e4,reconnectIntervalGrowFactor:2,timeoutInterval:5e3,maxRetries:5,debug:!1,maxMessageQueueLength:e[r(760)](1,0),service:0,logIDGenerator:c,headers:void 0,payloadEncoding:"",payloadType:"",fpID:"",deviceID:"",accessKey:"",ttwID:"",bddID:"",aID:"",disableAutoReconnect:!1,customParams:{},pingInterval:15e3,pingTimeoutInterval:4e3,pingFrequency:r(1223),pingLossCount:2,enableTransformTextPayload:!1,logIDNewConfig:{enableAutoGenerateLogIDNew:!1,userIp:""},miniProgramParams:{customHttpHeader:{}},enableAutoAck:!1,reconnectInterceptor:()=>!0,enableQoS:!1,QoSLevel:2,messageStrategy:e[r(384)],env:{xTTEnv:"",xUseEnv:""},listenNetworkChanged:!0};let{url:x,ws:f}=t,g=Array[r(532)](x)?x:e[r(1014)](e[r(575)],typeof x)?[x]:[];if(!g||e[r(1608)](0,g[r(874)]))throw new Error(e[r(1512)]);if(!o0(f))throw new Error(e[r(677)]);Object[r(889)](this[r(597)],t),this[r(1318)+r(1132)]=new Ni(g,this[r(597)][r(1181)+"es"]),this[r(596)+r(1264)]=new x0(this[r(597)][r(922)+"Count"]),this._options.automaticOpen&&(this._isInit=!0,this[r(281)]()),this._options[r(919)+r(217)+"nged"]&&(this[r(703)+"T"]||this[r(1691)+"X"]?this[r(1460)+"etWorkCh"+r(722)]():this[r(1287)+"er"]&&this[r(839)+r(1530)+r(942)]())}["_handleO"+n(451)](){let t=n;this[t(597)][t(1328)+"utoRecon"+t(1049)]||this[t(734)+t(513)]||this[t(586)+t(630)]()}[n(269)+n(1312)](){let t=n;this[t(943)+t(898)+"t"]();let r=lr(e[t(376)],{message:e.iillV});this[t(1069)+"mediatelyReconnect"]&&this[t(1069)+"mediatel"+t(1050)+"ct"](r)}[n(839)+n(1530)+n(942)](){let t=n;this[t(1287)+"er"]&&window["addEvent"+t(942)]("online",this[t(269)+t(451)]),this[t(1287)+"er"]&&window[t(1375)+t(942)](e[t(284)],this[t(269)+t(1312)]),this._isBrowser&&window[t(1375)+"Listener"](e[t(219)],this[t(670)+t(387)]),this[t(1287)+"er"]&&window[t(1375)+t(942)](e.BLyDy,this["_handleP"+t(1100)])}[n(1128)+n(1530)+n(942)](){let t=n;this._isBrowser&&window["removeEventListe"+t(1233)](e[t(1405)],this._handleOnLine),this[t(1287)+"er"]&&window["removeEv"+t(1456)+t(1233)](e[t(284)],this[t(269)+t(1312)]),this[t(1287)+"er"]&&window[t(936)+t(1456)+t(1233)](t(1705),this[t(670)+t(387)]),this[t(1287)+"er"]&&window[t(936)+t(1456)+"ner"](t(1340),this[t(670)+t(1100)])}[n(670)+"ageHide"](t){let r=n;!t[r(711)+"d"]&&(this[r(1287)+"er"]&&window["removeEv"+r(1456)+r(1233)](e[r(219)],this[r(670)+"ageHide"]),this[r(1287)+"er"]&&window[r(936)+r(1456)+r(1233)](e[r(1392)],this[r(670)+r(1100)]),this.close()),this[r(1287)+"er"]&&window[r(936)+"entListe"+r(1233)](e[r(1405)],this[r(269)+r(451)]),this[r(1287)+"er"]&&window["removeEventListe"+r(1233)](e[r(284)],this["_handleO"+r(1312)])}[n(670)+n(1100)](t){let r=n;t[r(711)+"d"]&&(this[r(646)+r(777)]()&&(!this[r(968)]||e[r(994)](this[r(968)][r(1175)+"te"],this[r(1576)])||e[r(960)](this[r(968)][r(1175)+"te"],this[r(545)+"NG"]))&&this[r(269)+r(451)](),this[r(1287)+"er"]&&window[r(1375)+"Listener"](e.yypqt,this[r(269)+r(451)]),this[r(1287)+"er"]&&window["addEvent"+r(942)](e[r(284)],this[r(269)+r(1312)]))}async[n(1463)+n(1038)](t){let r=n,o={gHQlt:function(x,f){return x<f},OrKMo:function(x,f,g){return e.DvqVG(x,f,g)},SENdW:function(x,f,g){return e.lGsqB(x,f,g)},RtAxA:function(x,f,g,p){return e[P(352)](x,f,g,p)}};if(e[r(547)]===e[r(506)]){let x=0,f=[];for(;bBHDjn.gHQlt(x,_0x2bdb44[r(300)+"th"]);){let{offset:g}=bBHDjn[r(361)](_0x223aa9,_0x51dbbf,x);x=g;let p={cursor_name:"",cursor:0,service:0},{value:h,offset:w}=bBHDjn[r(940)](_0x1eb5f1,_0x236f5d,x);p[r(799)]=h,x=w;let{value:C,offset:I}=bBHDjn.SENdW(_0x431702,_0x4ce1d5,x);x=I,p[r(1352)+r(638)]=bBHDjn[r(715)](_0x2c7725,_0x33f7a7,x,x+C),x+=C;let{value:N,offset:B}=_0x202aac(_0x39b0c0,x);p[r(1685)]=N.toNumber(),x=B,f[r(1083)](p)}return f}else{let{fpID:x,deviceID:f,bddID:g,ttwID:p,accessKey:h,aID:w,customParams:C={},enableAutoAck:I,enableQoS:N,QoSLevel:B,env:O}=this[r(597)],ye,se,ge;this[r(1287)+"er"]||this[r(1691)+"X"]||this[r(703)+"T"]?(ye=location&&e[r(342)](e[r(956)],location.protocol)?e[r(520)]:r(1470),se=t[r(1715)](/((^ws)|(^http))((?:[s]*:\/\/))/,""),ge=/^wss(.*:\/\/)/[r(628)](t)?t:""+ye+se):(ye=r(1339),se=t[r(1715)](/(^http)((?:[s]*:\/\/))/,""),ge=/(^ws)((?:[s]*:\/\/))/[r(628)](se)?se:""+ye+se);let Ki=g?e[r(881)]:p?e.ulIVf:e[r(896)],Gi=g||p||f;if(e[r(846)](!Gi,!Ki))throw new Error(e[r(1623)]);let K0=e[r(342)](e.yLQTh,typeof C)?await e[r(1055)](C):C,G0=O?e[r(1594)](c0,O[r(1597)],O[r(1033)]):{},vr=Object[r(889)]({device_platform:r(1672),version_code:r(1499)+"0",access_key:h,fpid:x,aid:w,[Ki]:Gi,xsack:I?1:0,xaack:I?1:0,xsqos:N?1:0,qos_level:N?B:void 0,qos_sdk_version:2,...G0},K0),H0=Object[r(372)](vr)[r(435)]((br,Sr)=>vr[Sr]!==void 0?""+br+(br?"&":"?")+Sr+"="+vr[Sr]:br,"");return ge+r(1678)+H0}}async[n(281)](){let t=n,r={bCyeD:function(o,x){return e.YslIV(o,x)},UGmGK:function(o,x){return o<=x},GRhzA:function(o,x){return e[P(1383)](o,x)},dcxvs:function(o,x){return o<<x},yuyOq:function(o,x){return o&x},xDfni:function(o,x){return o>=x},CdeuT:function(o,x){return e.drmwJ(o,x)},eCsGw:function(o,x){return o&x},xuPJp:function(o,x){return e[P(888)](o,x)},viQdF:function(o,x){return e[P(948)](o,x)},qFOxi:function(o,x){return e[P(1538)](o,x)},NYwVz:function(o,x){return o&x},zRsbI:function(o,x){return e.eGEau(o,x)},cBDvC:function(o,x){return e.cLAfz(o,x)},haWVC:function(o,x){return o+x},XxGRy:function(o,x){return e.neksq(o,x)},IqVkZ:function(o,x){return o&x}};if(!(this[t(281)+"Lock"]||this["_readyCl"+t(513)])){this["_connect"+t(855)]=!0;try{let o=this[t(1318)+t(1132)]?.[t(1458)+t(693)+t(1182)+t(345)+t(1003)](),{timeoutInterval:x}=this._options;if(o){let g=this[t(1318)+t(1132)]?.[t(243)+t(401)+"nt"](),p=this[t(1318)+t(1132)]?.["replaceB"+t(723)+t(402)+t(251)+t(1032)](),h=this[t(1318)+t(1132)]?.[t(243)+"ntEndpointTriesC"+t(329)]();if(p)if(e[t(500)](t(1281),e.maAUG)){let w=this[t(466)].getItem(this[t(1702)]);return _0x22b8a1[t(1652)](URQcms.bCyeD(w,"{}"))[_0x4a2426]}else{let w="connect "+g+(t(1042)+t(1172)+"tries re"+t(1301)+t(1085)+t(686)+"ndpoint ")+p+(t(1275)+"y"),C=e[t(1099)](he,e[t(1012)],{message:w,code:He[t(1031)+"IES_ERROR"]});this[t(1664)](w),this[t(1560)+t(698)+t(271)](C),this[t(1239)]=await this[t(1463)+t(1038)](p),this[t(1664)]("connect "+p+" "+h+t(248)),this["_removeW"+t(824)+"rs"]()}else{let w="connect "+g+(" timeout"+t(1172)+t(249)+"ached");this[t(1664)](w),this[t(1560)+"hErrorEvent"](e[t(328)](he,e[t(1012)],{message:w,code:He[t(1031)+"IES_ERROR"]}));return}}else{let g=this["_endpoin"+t(1132)]?.[t(243)+t(401)+t(1366)+t(1447)](),p=this[t(1318)+"tManager"]?.[t(243)+"ntEndpoi"+t(749)+t(329)]();this[t(1239)]=await this[t(1463)+t(1038)](e[t(1010)](g,"")),this[t(1664)](t(779)+g+" "+p+t(248)),this[t(773)+t(824)+"rs"]()}if(this[t(1213)])this[t(1213)]=!1;else if(e[t(1537)](t(1521),e.YvFQS)){let g=_0xe60641[_0x5692f5++];if(URQcms.UGmGK(g,127))_0x421c34+=_0x45568d[t(559)+t(853)](g);else if(g>=192&&URQcms[t(1483)](g,224))_0xbc148+=_0x295318[t(559)+t(853)](URQcms[t(1256)](31&g,6)|URQcms[t(278)](63,_0x5e1bd7[_0x16c452++]));else if(URQcms[t(911)](g,224)&&URQcms[t(1483)](g,240))_0x3fbb83+=_0x34b5c9[t(559)+t(853)](URQcms[t(1256)](URQcms.CdeuT(15,g),12)|URQcms.CdeuT(63,_0x3af05c[_0x33dae1++])<<6|URQcms[t(854)](63,_0x4ae494[_0x329b0b++]));else if(g>=240){let p=URQcms[t(1153)](URQcms[t(797)](URQcms.qFOxi(URQcms[t(1256)](URQcms[t(1286)](7,g),18),URQcms[t(1256)](URQcms[t(278)](63,_0x562965[_0x1d1cb8++]),12))|URQcms[t(460)](URQcms[t(1286)](63,_0x3d2faa[_0x4d3915++]),6),URQcms[t(1625)](63,_0x31c61a[_0x26bcdc++])),65536);_0x40b2f3+=_0x4facb9[t(559)+"Code"](URQcms[t(489)](55296,URQcms[t(1068)](p,10))),_0x144bf1+=_0x3a6d80[t(559)+t(853)](URQcms[t(489)](56320,URQcms[t(747)](1023,p)))}}else{let g=lr(e.VOmpU,{message:t(732)});this[t(411)+t(630)]&&this[t(411)+t(630)](g)}let f=this[t(1318)+"tManager"]?.[t(243)+t(401)+"ntTriesC"+t(329)]()||0;f>1&&await this._wait(e.AeuZo(f,1)),this[t(1664)](t(599)+t(265)+this._url+(t(1472)+t(1293))+this[t(499)+"ls"]),this._ws=s0({url:this._url,protocols:[this[t(499)+"ls"]],headers:this._options[t(946)+t(1565)+"s"][t(795)+t(459)]},this[t(597)].ws),(this[t(1287)+"er"]||this[t(492)+"r"])&&this[t(968)]&&(this[t(968)][t(1216)+"pe"]=this[t(546)+t(1397)]),this[t(1330)+"steners"](),this["_connect"+t(447)+"utId"]=e[t(1415)](setTimeout,this[t(1121)+"ut"].bind(this),x)}catch(o){throw this[t(281)+t(855)]=!1,o}}}[n(730)+n(1428)](){let t=n;if(e[t(780)](e[t(695)],"RfCuf"))e[t(961)](clearTimeout,this[t(281)+t(447)+"utId"]),this["_connect"+t(447)+t(1570)]=null;else return _0xcf103f[t(378)](_0x4383e9),!1}["_clearPi"+n(851)](){let t=n;e.lcUHo(clearTimeout,this[t(1070)+"gTimeoutId"]),e.xvGZF(clearTimeout,this["_reconne"+t(1155)+t(1450)]),this[t(1070)+t(1137)+"Id"]=null,this[t(263)+t(1155)+"tId"]=null}[n(1664)](...t){let r=n;if(e.sZBbP(e[r(1492)],r(1338)))this[r(597)].debug&&console[r(378)][r(970)](console,[e[r(486)],...t]);else return _0x2158c5?.[r(1211)](o=>o[r(406)]===_0x1f3f87)?.[r(1385)]}[n(1666)+n(1030)+"e"](t){let r=n,{initReconnectInterval:o,maxReconnectInterval:x,reconnectIntervalGrowFactor:f}=this[r(597)],g=e.mHzXS(o,Math[r(1149)](f,t-1));return e[r(1235)](g,x)?x:g}[n(1694)](){let t=n;if(e[t(1072)](t(399),e[t(334)])){if(this[t(968)]&&e[t(1490)](this[t(968)][t(1175)+"te"],this[t(545)+"NG"])){this[t(1418)+"ngTimer"](),this[t(1070)+t(1137)+"Id"]=e.TDLvn(setTimeout,this[t(1694)][t(1384)](this),this[t(597)][t(407)+t(1294)]);return}if(!this[t(968)]||this[t(968)][t(1175)+"te"]!==this[t(1576)])return void this[t(586)+t(630)]();this[t(968)]&&this[t(968)][t(339)]("hi"),this[t(263)+t(1155)+t(1450)]=e[t(1632)](setTimeout,this[t(586)+t(630)+t(533)][t(1384)](this),this[t(597)]["pingTime"+t(360)+t(1302)])}else{let r=_0x57e1db[t(457)](":");for(let o=0;e[t(1547)](o,r[t(874)]);o++){let x=r[o];if(e[t(525)](4,r[o][t(874)])){let f=_0x4edb35[t(1585)+"g"](0,e[t(1354)](4,r[o][t(874)])),g=f[t(877)](x);_0x31c91c=_0x2c280d[t(877)](g)}else _0x8d9d12=_0x585cfd[t(877)](x)}return _0x575cbe}}_handleReconnectTimeout(){let t=n;this[t(596)+t(1264)]?.[t(1138)](),this.emit(e[t(718)],e[t(1167)]),this[t(596)+t(1264)]?.[t(1017)+t(417)+"nt"]()?this[t(586)+t(630)]():this[t(1694)]()}["_navigat"+n(777)](){let t=n;return this[t(703)+"T"]||this[t(1691)+"X"]?this[t(216)+t(346)+t(1638)]:(this[t(1287)+"er"]||this[t(492)+"r"])&&this[t(597)]["listenNe"+t(217)+t(705)]?navigator.onLine:!0}[n(586)+n(630)](){let t=n;!this[t(646)+t(777)]()||this[t(734)+"osed"]||(this[t(1318)+t(1132)]?.[t(1098)+t(1228)+t(683)](),this[t(596)+t(1264)]?.[t(643)+"nter"](),this[t(968)]?this[t(1236)+t(383)](1001,e.AjUnn,!0):this._connect())}["_onPageN"+n(742)+n(722)](){let t=n;this[t(703)+"T"]?tt[t(1523)+"kStatusChange"](({isConnected:r})=>{let o=t;this[o(216)+o(346)+o(1638)]=r,r?this["_handleO"+o(451)]():this[o(269)+o(1312)]()}):this[t(1691)+"X"]&&wx[t(1523)+"kStatusC"+t(830)](({isConnected:r})=>{let o=t;this[o(216)+o(346)+o(1638)]=r,r?this[o(269)+o(451)]():this[o(269)+o(1312)]()})}[n(1224)](t){let r={XhtJs:function(o,x,f){return e.kbtCt(o,x,f)}};return new Promise(o=>{let x=P;r[x(273)](setTimeout,o,this["_getInte"+x(1030)+"e"](t))})}[n(1236)+n(383)](t=1e3,r="",o=!1){let x=n;this[x(968)]&&this[x(943)+x(898)+"t"](t,r,o)}_onTimeout(){let t=n,r=this[t(1318)+"tManager"]?.[t(243)+t(401)+"nt"]();this._debug(t(779)+r+" timeout"),this[t(1236)+"ect"](1001,e.iSZoZ,!0)}[n(1086)](t){let r=n,o=e[r(807)](fr,t);this[r(968)]&&e[r(1473)](this[r(968)][r(1175)+"te"],this[r(1576)])&&(this[r(968)]&&this._ws.send(o),this[r(1664)](e[r(470)],t))}["_removeW"+n(824)+"rs"](){let t=n,r=e[t(849)][t(457)]("|"),o=0;for(;;){switch(r[o++]){case"0":if(!this[t(968)])return;continue;case"1":this[t(968)][t(936)+"entListe"+t(1233)](e[t(1404)],this._onClose);continue;case"2":this[t(968)][t(936)+t(1456)+"ner"](e.MOycC,this._onMessage);continue;case"3":this[t(968)]["removeEv"+t(1456)+"ner"](e.SIDpL,this[t(1066)]);continue;case"4":this[t(968)][t(936)+t(1456)+t(1233)](e.YQSjM,this._onOpen);continue}break}}["_addWsLi"+n(1220)](){let t=n;this[t(968)]&&(this[t(968)][t(1375)+t(942)](e.YQSjM,this[t(290)]),this._ws[t(1375)+t(942)](e[t(1404)],this[t(1348)]),this[t(968)].addEventListener(e.MOycC,this[t(616)+"ge"]),this._ws["addEvent"+t(942)](e.SIDpL,this._onError))}[n(1620)+"nceClose"](t=1e3,r=""){let o=n;try{this[o(968)]&&this[o(968)][o(240)](t,r)}catch{}}[n(943)+n(898)+"t"](t=1e3,r="",o=!1){let x=n;if(e[x(714)](e.pRdeG,e[x(1663)])){if(this["_clearPi"+x(851)](),this[x(730)+"mer"](),this["_removeW"+x(824)+"rs"](),this[x(1620)+x(1299)](1e3,r),this["_connect"+x(855)]=!1,o&&this[x(646)+"orOnline"]()&&!this[x(734)+x(513)]){if(this["_endpoin"+x(1132)]?.["checkRea"+x(1396)+"es"]())if(e[x(600)](e[x(464)],e[x(464)]))_0x10f7fb.push(_0x1d71ae);else{let g=this[x(1318)+x(1132)]?.["getCurre"+x(401)+"nt"]();this[x(1560)+"hCloseEvent"](we(e[x(1404)],{code:1006,reason:x(779)+g+(" timeout"+x(1172)+x(249)+"ached"),wasClean:!0}))}else{let g=this._options["reconnec"+x(1337)+x(331)](t,r);this[x(1560)+x(1045)+x(271)](e[x(1423)](we,e.TZDPd,{code:t,reason:r,wasClean:!0,willReconnect:g})),g&&this[x(281)]()}return}this._navigatorOnline()||this[x(734)+x(513)]?this[x(1560)+x(1045)+x(271)](e[x(1708)](we,"close",{code:t,reason:e[x(554)]})):this[x(1560)+"hCloseEv"+x(271)](e[x(822)](we,e.TZDPd,{code:1006,reason:e.eegdq})),this[x(968)]=null,this[x(1318)+x(1132)]?.[x(1098)+"pointCon"+x(683)](),this[x(596)+"sCounter"]?.[x(643)+x(812)]()}else return _0x25b23e|=0,{low:_0x3193fa,high:e[x(982)](_0xec82e8,31),unsigned:e[x(1554)](_0x337b44,0)}}[n(1560)+n(704)+"nt"](t){let r=n;this[r(944)](e[r(380)],t),this[r(359)]&&this[r(359)](t)}[n(1560)+n(1349)+n(761)](t){let r=n;this[r(944)](e[r(369)],t),this[r(531)+"e"]&&this[r(531)+"e"](t)}[n(1560)+n(307)+n(1229)](t){let r=n;this[r(944)](e.Sujpc,t),this[r(285)+r(1378)]&&this[r(285)+"eAck"](t)}[n(1560)+"hErrorEvent"](t){let r=n;this.emit(e[r(1012)],t),this[r(617)]&&this.onerror(t)}[n(1560)+n(1045)+"ent"](t){let r=n;this.emit(e[r(1404)],t),this[r(1474)]&&this.onclose(t)}get binaryType(){return this[n(968)]?this._ws.binaryType:this._binaryType}set[n(1216)+"pe"](t){let r=n;this[r(546)+r(1397)]=t,this._ws&&(this[r(968)].binaryType=t)}get[n(1276)+"nt"](){let t=n;return this[t(1318)+t(1132)]?.[t(243)+t(401)+t(749)+t(329)]()||0}get[n(1305)+n(666)](){let t=n,r=this[t(349)+"Queue"][t(435)]((o,x)=>(o+=x&&x[t(300)+"th"]||0,o),0);return e[t(1544)](r,this[t(968)]?this[t(968)][t(1305)+t(666)]:0)}get[n(1622)+"ns"](){let t=n;return this[t(968)]?this[t(968)][t(1622)+"ns"]:""}get[n(341)](){let t=n;return this[t(968)]?this[t(968)][t(341)]:""}get readyState(){let t=n;return this[t(968)]?this[t(968)][t(1175)+"te"]:this[t(597)][t(794)+t(1341)]?this[t(545)+"NG"]:this.CLOSED}get[n(1139)](){let t=n;if(e.xnNuX(e[t(577)],e[t(577)]))return this[t(968)]?this[t(968)][t(1139)]:this[t(1239)];this[t(1213)]=!0,this[t(281)]()}close(t=1e3,r){let o=n;if(this[o(734)+o(513)]=!0,this[o(730)+"mer"](),this[o(1418)+"ngTimer"](),this["_dropGlo"+o(1530)+o(942)](),this[o(1210)+"ger"]?.[o(965)](),!this._ws)return void this[o(1664)](e.JhwDa);if(e.QGmdj(this._ws[o(1175)+"te"],this[o(1027)])||e.NgVIs(this._ws[o(1175)+"te"],this.CLOSING))return void this._debug(e[o(928)]);this._destroyWebSocket(t,r)}async[n(339)](t,r){let o=n;if(e[o(1526)](null,t))throw new Error(e.poBbV);e[o(1014)](o(929),typeof t)&&(t=JSON[o(1712)+"y"](t)),e.VYVaU(o(250),typeof t)&&!e[o(990)](t,ArrayBuffer)&&!(t[o(923)]&&e[o(1102)](t[o(923)],ArrayBuffer))&&(t=JSON[o(1712)+"y"](t));let x=await e[o(933)](Mi,t),f=a0(t),{method:g=0,service:p=this[o(597)][o(799)],logID:h=this[o(597)][o(741)+o(527)](),headers:w=this._options.headers,payloadEncoding:C=this[o(597)][o(1189)+"ncoding"],payloadType:I=this[o(597)][o(640)+o(1397)],logIDNew:N=this[o(597)][o(1427)+o(1442)][o(1514)+o(1592)+o(338)+"ew"]?e[o(1237)](a,this[o(597)][o(1427)+o(1442)][o(318)]):""}=r||{};if(!p)throw new Error(e.FvgRv);let B={SeqID:K[o(580)+"er"](this[o(455)]++),LogID:K[o(580)+"er"](h),service:p,method:g,headers:w,payloadEncoding:e[o(505)](C,Object)?C.encoding?C[o(1212)]:"":C,payloadType:I instanceof Object?I.type?I.type:f:I||f,payload:x,LogIDNew:N},O=e[o(253)](fr,B);return this[o(968)]&&e[o(1386)](this[o(968)][o(1175)+"te"],this.OPEN)?(this._ws&&this._ws.send(O),this[o(1664)](e[o(299)],B)):e.bFAEF(this[o(349)+o(793)][o(874)],this[o(597)]["maxMessa"+o(1332)+"ength"])?(this[o(349)+o(793)][o(1083)](O),this[o(1664)](o(959),B)):(this[o(349)+o(793)][o(1516)](),this[o(349)+"Queue"].push(O)),{seqID:this[o(455)],logID:h,logIDNew:N}}async reconnect(t){let r=n,{url:o}=e.PINmW(t,{}),x=Array[r(532)](o)?o:e[r(641)](e[r(575)],typeof o)?[o]:[];t&&Object[r(889)](this._options,t),x&&x.length?this[r(1318)+r(1132)]=new Ni(x,this[r(597)][r(1181)+"es"]):this[r(1318)+"tManager"]?.[r(1098)+r(1228)+r(683)](),this[r(596)+"sCounter"]?.[r(643)+"nter"](this._options["pingLoss"+r(1110)]),this[r(734)+"osed"]=!1,this[r(968)]&&this[r(968)].readyState!==this[r(1027)]?this[r(1236)+"ect"](1e3,e[r(1161)],!0):(this[r(1213)]=!0,this[r(281)]())}async connect(){let t=n;!this[t(281)+t(855)]&&(this[t(1318)+t(1132)]?.[t(1098)+t(1228)+"fig"](),this[t(596)+t(1264)]?.[t(643)+t(812)](),this[t(734)+"osed"]=!1,this[t(1213)]=!0,this[t(281)]())}[n(1375)+n(942)](t,r){this.on(t,r)}["dispatch"+n(761)](t){let r=n,o={WThgn:r(959)};if(e[r(1539)]!==e[r(367)]){let{type:x}=t;this.emit(x,t)}else this[r(349)+r(793)].push(_0x14de80),this[r(1664)](nfpYfi[r(337)],_0x948006)}[n(936)+"entListe"+n(1233)](t,r){this.off(t,r)}[n(518)](){let t=n,r={bBPPf:function(o,x){return o(x)},EAdWl:"timeout",IIzSM:"ping_onc"+t(674)+"t",TamWh:e[t(414)],ToKjq:"ping_once_success"};return new Promise((o,x)=>{let f=t,g={gGLaq:r[f(1681)],dozTs:r.ToKjq,gLkte:r[f(471)]};this["_clearPi"+f(851)](),this[f(1070)+f(1137)+"Id"]=setTimeout(this._ping[f(1384)](this),this[f(597)][f(407)+f(1294)]);let p=()=>{let w=f;o(g[w(404)]),this[w(261)](g[w(529)],p),this[w(261)](g[w(1222)],h)},h=()=>{let w=f;r[w(1071)](x,r[w(1525)]),this[w(261)]("ping_onc"+w(1698)+"s",p),this[w(261)](r[w(471)],h)};this.on(r[f(708)],p),this.on(r.IIzSM,h),this[f(1694)]()})}}})(),Y[S(1443)+S(1626)]=J[S(1443)+S(1626)],Y["CustomEr"+S(1488)]=J["CustomEr"+S(1488)],Y[S(509)+"e"]=J[S(509)+"e"],Y[S(761)]=J[S(761)],Y[S(324)]=J[S(324)],Y[S(745)+"MessageE"+S(1689)]=J["Frontier"+S(418)+S(1689)],Y["MessageE"+S(1689)]=J[S(418)+S(1689)],Y[S(1648)+"t"]=J[S(1648)+"t"],Y[S(1479)+S(1242)]=J[S(1479)+S(1242)],Y[S(1201)+S(1626)]=J["createCl"+S(1626)],Y[S(1391)+S(1488)]=J[S(1391)+"rorEvent"],Y[S(619)+S(1123)+"nt"]=J[S(619)+S(1123)+"nt"],Y[S(1635)+S(574)]=J[S(1635)+S(574)],Y[S(634)+"connectE"+S(1689)]=J[S(634)+"connectEvent"],Y[S(1177)+S(667)]=J[S(1177)+S(667)],Y[S(536)+S(638)]=J[S(536)+S(638)];for(On in J)[S(1443)+S(1626),"CustomEr"+S(1488),"ErrorCode",S(761),S(324),S(745)+S(418)+"vent","MessageEvent",S(1648)+"t","Reconnec"+S(1242),S(1201)+"oseEvent",S(1391)+S(1488),S(619)+S(1123)+"nt","createOp"+S(574),S(634)+S(625)+"vent",S(1177)+S(667),S(536)+S(638)].indexOf(On)===-1&&(Y[On]=J[On]);var On;Object[S(969)+S(656)](Y,S(473)+"le",{value:!0})});var ze=de((Hp,vo)=>{"use strict";var wo=["nodebuffer","arraybuffer","fragments"],yo=typeof Blob<"u";yo&&wo.push("blob");vo.exports={BINARY_TYPES:wo,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:yo,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var Wt=de((jp,qn)=>{"use strict";var{EMPTY_BUFFER:Lu}=ze(),qr=Buffer[Symbol.species];function Bu(n,e){if(n.length===0)return Lu;if(n.length===1)return n[0];let s=Buffer.allocUnsafe(e),a=0;for(let c=0;c<n.length;c++){let u=n[c];s.set(u,a),a+=u.length}return a<e?new qr(s.buffer,s.byteOffset,a):s}function bo(n,e,s,a,c){for(let u=0;u<c;u++)s[a+u]=n[u]^e[u&3]}function So(n,e){for(let s=0;s<n.length;s++)n[s]^=e[s&3]}function Mu(n){return n.length===n.buffer.byteLength?n.buffer:n.buffer.slice(n.byteOffset,n.byteOffset+n.length)}function Kr(n){if(Kr.readOnly=!0,Buffer.isBuffer(n))return n;let e;return n instanceof ArrayBuffer?e=new qr(n):ArrayBuffer.isView(n)?e=new qr(n.buffer,n.byteOffset,n.byteLength):(e=Buffer.from(n),Kr.readOnly=!1),e}qn.exports={concat:Bu,mask:bo,toArrayBuffer:Mu,toBuffer:Kr,unmask:So};if(!process.env.WS_NO_BUFFER_UTIL)try{let n=W("bufferutil");qn.exports.mask=function(e,s,a,c,u){u<48?bo(e,s,a,c,u):n.mask(e,s,a,c,u)},qn.exports.unmask=function(e,s){e.length<32?So(e,s):n.unmask(e,s)}}catch{}});var Io=de((Wp,Co)=>{"use strict";var Eo=Symbol("kDone"),Gr=Symbol("kRun"),Hr=class{constructor(e){this[Eo]=()=>{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[Eo])}}};Co.exports=Hr});var Et=de((Jp,To)=>{"use strict";var Jt=W("zlib"),Ao=Wt(),zu=Io(),{kStatusCode:Po}=ze(),Fu=Buffer[Symbol.species],Uu=Buffer.from([0,0,255,255]),Gn=Symbol("permessage-deflate"),Fe=Symbol("total-length"),bt=Symbol("callback"),Ve=Symbol("buffers"),St=Symbol("error"),Kn,jr=class{constructor(e){if(this._options=e||{},this._threshold=this._options.threshold!==void 0?this._options.threshold:1024,this._maxPayload=this._options.maxPayload|0,this._isServer=!!this._options.isServer,this._deflate=null,this._inflate=null,this.params=null,!Kn){let s=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;Kn=new zu(s)}}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[bt];this._deflate.close(),this._deflate=null,e&&e(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(e){let s=this._options,a=e.find(c=>!(s.serverNoContextTakeover===!1&&c.server_no_context_takeover||c.server_max_window_bits&&(s.serverMaxWindowBits===!1||typeof s.serverMaxWindowBits=="number"&&s.serverMaxWindowBits>c.server_max_window_bits)||typeof s.clientMaxWindowBits=="number"&&!c.client_max_window_bits));if(!a)throw new Error("None of the extension offers can be accepted");return s.serverNoContextTakeover&&(a.server_no_context_takeover=!0),s.clientNoContextTakeover&&(a.client_no_context_takeover=!0),typeof s.serverMaxWindowBits=="number"&&(a.server_max_window_bits=s.serverMaxWindowBits),typeof s.clientMaxWindowBits=="number"?a.client_max_window_bits=s.clientMaxWindowBits:(a.client_max_window_bits===!0||s.clientMaxWindowBits===!1)&&delete a.client_max_window_bits,a}acceptAsClient(e){let s=e[0];if(this._options.clientNoContextTakeover===!1&&s.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(!s.client_max_window_bits)typeof this._options.clientMaxWindowBits=="number"&&(s.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits=="number"&&s.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"');return s}normalizeParams(e){return e.forEach(s=>{Object.keys(s).forEach(a=>{let c=s[a];if(c.length>1)throw new Error(`Parameter "${a}" must have only a single value`);if(c=c[0],a==="client_max_window_bits"){if(c!==!0){let u=+c;if(!Number.isInteger(u)||u<8||u>15)throw new TypeError(`Invalid value for parameter "${a}": ${c}`);c=u}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${a}": ${c}`)}else if(a==="server_max_window_bits"){let u=+c;if(!Number.isInteger(u)||u<8||u>15)throw new TypeError(`Invalid value for parameter "${a}": ${c}`);c=u}else if(a==="client_no_context_takeover"||a==="server_no_context_takeover"){if(c!==!0)throw new TypeError(`Invalid value for parameter "${a}": ${c}`)}else throw new Error(`Unknown parameter "${a}"`);s[a]=c})}),e}decompress(e,s,a){Kn.add(c=>{this._decompress(e,s,(u,d)=>{c(),a(u,d)})})}compress(e,s,a){Kn.add(c=>{this._compress(e,s,(u,d)=>{c(),a(u,d)})})}_decompress(e,s,a){let c=this._isServer?"client":"server";if(!this._inflate){let u=`${c}_max_window_bits`,d=typeof this.params[u]!="number"?Jt.Z_DEFAULT_WINDOWBITS:this.params[u];this._inflate=Jt.createInflateRaw({...this._options.zlibInflateOptions,windowBits:d}),this._inflate[Gn]=this,this._inflate[Fe]=0,this._inflate[Ve]=[],this._inflate.on("error",Ku),this._inflate.on("data",ko)}this._inflate[bt]=a,this._inflate.write(e),s&&this._inflate.write(Uu),this._inflate.flush(()=>{let u=this._inflate[St];if(u){this._inflate.close(),this._inflate=null,a(u);return}let d=Ao.concat(this._inflate[Ve],this._inflate[Fe]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[Fe]=0,this._inflate[Ve]=[],s&&this.params[`${c}_no_context_takeover`]&&this._inflate.reset()),a(null,d)})}_compress(e,s,a){let c=this._isServer?"server":"client";if(!this._deflate){let u=`${c}_max_window_bits`,d=typeof this.params[u]!="number"?Jt.Z_DEFAULT_WINDOWBITS:this.params[u];this._deflate=Jt.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:d}),this._deflate[Fe]=0,this._deflate[Ve]=[],this._deflate.on("data",qu)}this._deflate[bt]=a,this._deflate.write(e),this._deflate.flush(Jt.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let u=Ao.concat(this._deflate[Ve],this._deflate[Fe]);s&&(u=new Fu(u.buffer,u.byteOffset,u.length-4)),this._deflate[bt]=null,this._deflate[Fe]=0,this._deflate[Ve]=[],s&&this.params[`${c}_no_context_takeover`]&&this._deflate.reset(),a(null,u)})}};To.exports=jr;function qu(n){this[Ve].push(n),this[Fe]+=n.length}function ko(n){if(this[Fe]+=n.length,this[Gn]._maxPayload<1||this[Fe]<=this[Gn]._maxPayload){this[Ve].push(n);return}this[St]=new RangeError("Max payload size exceeded"),this[St].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[St][Po]=1009,this.removeListener("data",ko),this.reset()}function Ku(n){if(this[Gn]._inflate=null,this[St]){this[bt](this[St]);return}n[Po]=1007,this[bt](n)}});var Ct=de(($p,Hn)=>{"use strict";var{isUtf8:Do}=W("buffer"),{hasBlob:Gu}=ze(),Hu=[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 ju(n){return n>=1e3&&n<=1014&&n!==1004&&n!==1005&&n!==1006||n>=3e3&&n<=4999}function Wr(n){let e=n.length,s=0;for(;s<e;)if((n[s]&128)===0)s++;else if((n[s]&224)===192){if(s+1===e||(n[s+1]&192)!==128||(n[s]&254)===192)return!1;s+=2}else if((n[s]&240)===224){if(s+2>=e||(n[s+1]&192)!==128||(n[s+2]&192)!==128||n[s]===224&&(n[s+1]&224)===128||n[s]===237&&(n[s+1]&224)===160)return!1;s+=3}else if((n[s]&248)===240){if(s+3>=e||(n[s+1]&192)!==128||(n[s+2]&192)!==128||(n[s+3]&192)!==128||n[s]===240&&(n[s+1]&240)===128||n[s]===244&&n[s+1]>143||n[s]>244)return!1;s+=4}else return!1;return!0}function Wu(n){return Gu&&typeof n=="object"&&typeof n.arrayBuffer=="function"&&typeof n.type=="string"&&typeof n.stream=="function"&&(n[Symbol.toStringTag]==="Blob"||n[Symbol.toStringTag]==="File")}Hn.exports={isBlob:Wu,isValidStatusCode:ju,isValidUTF8:Wr,tokenChars:Hu};if(Do)Hn.exports.isValidUTF8=function(n){return n.length<24?Wr(n):Do(n)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let n=W("utf-8-validate");Hn.exports.isValidUTF8=function(e){return e.length<32?Wr(e):n(e)}}catch{}});var Xr=de((Vp,zo)=>{"use strict";var{Writable:Ju}=W("stream"),Ro=Et(),{BINARY_TYPES:$u,EMPTY_BUFFER:No,kStatusCode:Vu,kWebSocket:Yu}=ze(),{concat:Jr,toArrayBuffer:Xu,unmask:Zu}=Wt(),{isValidStatusCode:Qu,isValidUTF8:Oo}=Ct(),jn=Buffer[Symbol.species],pe=0,Lo=1,Bo=2,Mo=3,$r=4,Vr=5,Wn=6,Yr=class extends Ju{constructor(e={}){super(),this._allowSynchronousEvents=e.allowSynchronousEvents!==void 0?e.allowSynchronousEvents:!0,this._binaryType=e.binaryType||$u[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxPayload=e.maxPayload|0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[Yu]=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=pe}_write(e,s,a){if(this._opcode===8&&this._state==pe)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 jn(a.buffer,a.byteOffset+e,a.length-e),new jn(a.buffer,a.byteOffset,e)}let s=Buffer.allocUnsafe(e);do{let a=this._buffers[0],c=s.length-e;e>=a.length?s.set(this._buffers.shift(),c):(s.set(new Uint8Array(a.buffer,a.byteOffset,e),c),this._buffers[0]=new jn(a.buffer,a.byteOffset+e,a.length-e)),e-=a.length}while(e>0);return s}startLoop(e){this._loop=!0;do switch(this._state){case pe:this.getInfo(e);break;case Lo:this.getPayloadLength16(e);break;case Bo:this.getPayloadLength64(e);break;case Mo:this.getMask();break;case $r:this.getData(e);break;case Vr:case Wn:this._loop=!1;return}while(this._loop);this._errored||e()}getInfo(e){if(this._bufferedBytes<2){this._loop=!1;return}let s=this.consume(2);if((s[0]&48)!==0){let c=this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");e(c);return}let a=(s[0]&64)===64;if(a&&!this._extensions[Ro.extensionName]){let c=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(c);return}if(this._fin=(s[0]&128)===128,this._opcode=s[0]&15,this._payloadLength=s[1]&127,this._opcode===0){if(a){let c=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(c);return}if(!this._fragmented){let c=this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");e(c);return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){let c=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");e(c);return}this._compressed=a}else if(this._opcode>7&&this._opcode<11){if(!this._fin){let c=this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");e(c);return}if(a){let c=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");e(c);return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){let c=this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");e(c);return}}else{let c=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");e(c);return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(s[1]&128)===128,this._isServer){if(!this._masked){let c=this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK");e(c);return}}else if(this._masked){let c=this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");e(c);return}this._payloadLength===126?this._state=Lo:this._payloadLength===127?this._state=Bo: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 s=this.consume(8),a=s.readUInt32BE(0);if(a>Math.pow(2,21)-1){let c=this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");e(c);return}this._payloadLength=a*Math.pow(2,32)+s.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 s=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");e(s);return}this._masked?this._state=Mo:this._state=$r}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=$r}getData(e){let s=No;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}s=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0&&Zu(s,this._mask)}if(this._opcode>7){this.controlMessage(s,e);return}if(this._compressed){this._state=Vr,this.decompress(s,e);return}s.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(s)),this.dataMessage(e)}decompress(e,s){this._extensions[Ro.extensionName].decompress(e,this._fin,(c,u)=>{if(c)return s(c);if(u.length){if(this._messageLength+=u.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let d=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");s(d);return}this._fragments.push(u)}this.dataMessage(s),this._state===pe&&this.startLoop(s)})}dataMessage(e){if(!this._fin){this._state=pe;return}let s=this._messageLength,a=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let c;this._binaryType==="nodebuffer"?c=Jr(a,s):this._binaryType==="arraybuffer"?c=Xu(Jr(a,s)):this._binaryType==="blob"?c=new Blob(a):c=a,this._allowSynchronousEvents?(this.emit("message",c,!0),this._state=pe):(this._state=Wn,setImmediate(()=>{this.emit("message",c,!0),this._state=pe,this.startLoop(e)}))}else{let c=Jr(a,s);if(!this._skipUTF8Validation&&!Oo(c)){let u=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");e(u);return}this._state===Vr||this._allowSynchronousEvents?(this.emit("message",c,!1),this._state=pe):(this._state=Wn,setImmediate(()=>{this.emit("message",c,!1),this._state=pe,this.startLoop(e)}))}}controlMessage(e,s){if(this._opcode===8){if(e.length===0)this._loop=!1,this.emit("conclude",1005,No),this.end();else{let a=e.readUInt16BE(0);if(!Qu(a)){let u=this.createError(RangeError,`invalid status code ${a}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");s(u);return}let c=new jn(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!Oo(c)){let u=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");s(u);return}this._loop=!1,this.emit("conclude",a,c),this.end()}this._state=pe;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?"ping":"pong",e),this._state=pe):(this._state=Wn,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",e),this._state=pe,this.startLoop(s)}))}createError(e,s,a,c,u){this._loop=!1,this._errored=!0;let d=new e(a?`Invalid WebSocket frame: ${s}`:s);return Error.captureStackTrace(d,this.createError),d.code=u,d[Vu]=c,d}};zo.exports=Yr});var ei=de((Xp,qo)=>{"use strict";var{Duplex:Yp}=W("stream"),{randomFillSync:ed}=W("crypto"),Fo=Et(),{EMPTY_BUFFER:td,kWebSocket:nd,NOOP:rd}=ze(),{isBlob:It,isValidStatusCode:id}=Ct(),{mask:Uo,toBuffer:rt}=Wt(),me=Symbol("kByteLength"),sd=Buffer.alloc(4),Jn=8*1024,it,At=Jn,be=0,od=1,ad=2,Zr=class n{constructor(e,s,a){this._extensions=s||{},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=be,this.onerror=rd,this[nd]=void 0}static frame(e,s){let a,c=!1,u=2,d=!1;s.mask&&(a=s.maskBuffer||sd,s.generateMask?s.generateMask(a):(At===Jn&&(it===void 0&&(it=Buffer.alloc(Jn)),ed(it,0,Jn),At=0),a[0]=it[At++],a[1]=it[At++],a[2]=it[At++],a[3]=it[At++]),d=(a[0]|a[1]|a[2]|a[3])===0,u=6);let l;typeof e=="string"?(!s.mask||d)&&s[me]!==void 0?l=s[me]:(e=Buffer.from(e),l=e.length):(l=e.length,c=s.mask&&s.readOnly&&!d);let m=l;l>=65536?(u+=8,m=127):l>125&&(u+=2,m=126);let _=Buffer.allocUnsafe(c?l+u:u);return _[0]=s.fin?s.opcode|128:s.opcode,s.rsv1&&(_[0]|=64),_[1]=m,m===126?_.writeUInt16BE(l,2):m===127&&(_[2]=_[3]=0,_.writeUIntBE(l,4,6)),s.mask?(_[1]|=128,_[u-4]=a[0],_[u-3]=a[1],_[u-2]=a[2],_[u-1]=a[3],d?[_,e]:c?(Uo(e,a,_,u,l),[_]):(Uo(e,a,e,0,l),[_,e])):[_,e]}close(e,s,a,c){let u;if(e===void 0)u=td;else{if(typeof e!="number"||!id(e))throw new TypeError("First argument must be a valid error code number");if(s===void 0||!s.length)u=Buffer.allocUnsafe(2),u.writeUInt16BE(e,0);else{let l=Buffer.byteLength(s);if(l>123)throw new RangeError("The message must not be greater than 123 bytes");u=Buffer.allocUnsafe(2+l),u.writeUInt16BE(e,0),typeof s=="string"?u.write(s,2):u.set(s,2)}}let d={[me]:u.length,fin:!0,generateMask:this._generateMask,mask:a,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state!==be?this.enqueue([this.dispatch,u,!1,d,c]):this.sendFrame(n.frame(u,d),c)}ping(e,s,a){let c,u;if(typeof e=="string"?(c=Buffer.byteLength(e),u=!1):It(e)?(c=e.size,u=!1):(e=rt(e),c=e.length,u=rt.readOnly),c>125)throw new RangeError("The data size must not be greater than 125 bytes");let d={[me]:c,fin:!0,generateMask:this._generateMask,mask:s,maskBuffer:this._maskBuffer,opcode:9,readOnly:u,rsv1:!1};It(e)?this._state!==be?this.enqueue([this.getBlobData,e,!1,d,a]):this.getBlobData(e,!1,d,a):this._state!==be?this.enqueue([this.dispatch,e,!1,d,a]):this.sendFrame(n.frame(e,d),a)}pong(e,s,a){let c,u;if(typeof e=="string"?(c=Buffer.byteLength(e),u=!1):It(e)?(c=e.size,u=!1):(e=rt(e),c=e.length,u=rt.readOnly),c>125)throw new RangeError("The data size must not be greater than 125 bytes");let d={[me]:c,fin:!0,generateMask:this._generateMask,mask:s,maskBuffer:this._maskBuffer,opcode:10,readOnly:u,rsv1:!1};It(e)?this._state!==be?this.enqueue([this.getBlobData,e,!1,d,a]):this.getBlobData(e,!1,d,a):this._state!==be?this.enqueue([this.dispatch,e,!1,d,a]):this.sendFrame(n.frame(e,d),a)}send(e,s,a){let c=this._extensions[Fo.extensionName],u=s.binary?2:1,d=s.compress,l,m;typeof e=="string"?(l=Buffer.byteLength(e),m=!1):It(e)?(l=e.size,m=!1):(e=rt(e),l=e.length,m=rt.readOnly),this._firstFragment?(this._firstFragment=!1,d&&c&&c.params[c._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(d=l>=c._threshold),this._compress=d):(d=!1,u=0),s.fin&&(this._firstFragment=!0);let _={[me]:l,fin:s.fin,generateMask:this._generateMask,mask:s.mask,maskBuffer:this._maskBuffer,opcode:u,readOnly:m,rsv1:d};It(e)?this._state!==be?this.enqueue([this.getBlobData,e,this._compress,_,a]):this.getBlobData(e,this._compress,_,a):this._state!==be?this.enqueue([this.dispatch,e,this._compress,_,a]):this.dispatch(e,this._compress,_,a)}getBlobData(e,s,a,c){this._bufferedBytes+=a[me],this._state=ad,e.arrayBuffer().then(u=>{if(this._socket.destroyed){let l=new Error("The socket was closed while the blob was being read");process.nextTick(Qr,this,l,c);return}this._bufferedBytes-=a[me];let d=rt(u);s?this.dispatch(d,s,a,c):(this._state=be,this.sendFrame(n.frame(d,a),c),this.dequeue())}).catch(u=>{process.nextTick(cd,this,u,c)})}dispatch(e,s,a,c){if(!s){this.sendFrame(n.frame(e,a),c);return}let u=this._extensions[Fo.extensionName];this._bufferedBytes+=a[me],this._state=od,u.compress(e,a.fin,(d,l)=>{if(this._socket.destroyed){let m=new Error("The socket was closed while data was being compressed");Qr(this,m,c);return}this._bufferedBytes-=a[me],this._state=be,a.readOnly=!1,this.sendFrame(n.frame(l,a),c),this.dequeue()})}dequeue(){for(;this._state===be&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[3][me],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][me],this._queue.push(e)}sendFrame(e,s){e.length===2?(this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],s),this._socket.uncork()):this._socket.write(e[0],s)}};qo.exports=Zr;function Qr(n,e,s){typeof s=="function"&&s(e);for(let a=0;a<n._queue.length;a++){let c=n._queue[a],u=c[c.length-1];typeof u=="function"&&u(e)}}function cd(n,e,s){Qr(n,e,s),n.onerror(e)}});var Yo=de((Zp,Vo)=>{"use strict";var{kForOnEventAttribute:$t,kListener:ti}=ze(),Ko=Symbol("kCode"),Go=Symbol("kData"),Ho=Symbol("kError"),jo=Symbol("kMessage"),Wo=Symbol("kReason"),Pt=Symbol("kTarget"),Jo=Symbol("kType"),$o=Symbol("kWasClean"),Ue=class{constructor(e){this[Pt]=null,this[Jo]=e}get target(){return this[Pt]}get type(){return this[Jo]}};Object.defineProperty(Ue.prototype,"target",{enumerable:!0});Object.defineProperty(Ue.prototype,"type",{enumerable:!0});var st=class extends Ue{constructor(e,s={}){super(e),this[Ko]=s.code===void 0?0:s.code,this[Wo]=s.reason===void 0?"":s.reason,this[$o]=s.wasClean===void 0?!1:s.wasClean}get code(){return this[Ko]}get reason(){return this[Wo]}get wasClean(){return this[$o]}};Object.defineProperty(st.prototype,"code",{enumerable:!0});Object.defineProperty(st.prototype,"reason",{enumerable:!0});Object.defineProperty(st.prototype,"wasClean",{enumerable:!0});var kt=class extends Ue{constructor(e,s={}){super(e),this[Ho]=s.error===void 0?null:s.error,this[jo]=s.message===void 0?"":s.message}get error(){return this[Ho]}get message(){return this[jo]}};Object.defineProperty(kt.prototype,"error",{enumerable:!0});Object.defineProperty(kt.prototype,"message",{enumerable:!0});var Vt=class extends Ue{constructor(e,s={}){super(e),this[Go]=s.data===void 0?null:s.data}get data(){return this[Go]}};Object.defineProperty(Vt.prototype,"data",{enumerable:!0});var xd={addEventListener(n,e,s={}){for(let c of this.listeners(n))if(!s[$t]&&c[ti]===e&&!c[$t])return;let a;if(n==="message")a=function(u,d){let l=new Vt("message",{data:d?u:u.toString()});l[Pt]=this,$n(e,this,l)};else if(n==="close")a=function(u,d){let l=new st("close",{code:u,reason:d.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});l[Pt]=this,$n(e,this,l)};else if(n==="error")a=function(u){let d=new kt("error",{error:u,message:u.message});d[Pt]=this,$n(e,this,d)};else if(n==="open")a=function(){let u=new Ue("open");u[Pt]=this,$n(e,this,u)};else return;a[$t]=!!s[$t],a[ti]=e,s.once?this.once(n,a):this.on(n,a)},removeEventListener(n,e){for(let s of this.listeners(n))if(s[ti]===e&&!s[$t]){this.removeListener(n,s);break}}};Vo.exports={CloseEvent:st,ErrorEvent:kt,Event:Ue,EventTarget:xd,MessageEvent:Vt};function $n(n,e,s){typeof n=="object"&&n.handleEvent?n.handleEvent.call(n,s):n.call(e,s)}});var Vn=de((Qp,Xo)=>{"use strict";var{tokenChars:Yt}=Ct();function De(n,e,s){n[e]===void 0?n[e]=[s]:n[e].push(s)}function ud(n){let e=Object.create(null),s=Object.create(null),a=!1,c=!1,u=!1,d,l,m=-1,_=-1,y=-1,v=0;for(;v<n.length;v++)if(_=n.charCodeAt(v),d===void 0)if(y===-1&&Yt[_]===1)m===-1&&(m=v);else if(v!==0&&(_===32||_===9))y===-1&&m!==-1&&(y=v);else if(_===59||_===44){if(m===-1)throw new SyntaxError(`Unexpected character at index ${v}`);y===-1&&(y=v);let k=n.slice(m,y);_===44?(De(e,k,s),s=Object.create(null)):d=k,m=y=-1}else throw new SyntaxError(`Unexpected character at index ${v}`);else if(l===void 0)if(y===-1&&Yt[_]===1)m===-1&&(m=v);else if(_===32||_===9)y===-1&&m!==-1&&(y=v);else if(_===59||_===44){if(m===-1)throw new SyntaxError(`Unexpected character at index ${v}`);y===-1&&(y=v),De(s,n.slice(m,y),!0),_===44&&(De(e,d,s),s=Object.create(null),d=void 0),m=y=-1}else if(_===61&&m!==-1&&y===-1)l=n.slice(m,v),m=y=-1;else throw new SyntaxError(`Unexpected character at index ${v}`);else if(c){if(Yt[_]!==1)throw new SyntaxError(`Unexpected character at index ${v}`);m===-1?m=v:a||(a=!0),c=!1}else if(u)if(Yt[_]===1)m===-1&&(m=v);else if(_===34&&m!==-1)u=!1,y=v;else if(_===92)c=!0;else throw new SyntaxError(`Unexpected character at index ${v}`);else if(_===34&&n.charCodeAt(v-1)===61)u=!0;else if(y===-1&&Yt[_]===1)m===-1&&(m=v);else if(m!==-1&&(_===32||_===9))y===-1&&(y=v);else if(_===59||_===44){if(m===-1)throw new SyntaxError(`Unexpected character at index ${v}`);y===-1&&(y=v);let k=n.slice(m,y);a&&(k=k.replace(/\\/g,""),a=!1),De(s,l,k),_===44&&(De(e,d,s),s=Object.create(null),d=void 0),l=void 0,m=y=-1}else throw new SyntaxError(`Unexpected character at index ${v}`);if(m===-1||u||_===32||_===9)throw new SyntaxError("Unexpected end of input");y===-1&&(y=v);let E=n.slice(m,y);return d===void 0?De(e,E,s):(l===void 0?De(s,E,!0):a?De(s,l,E.replace(/\\/g,"")):De(s,l,E),De(e,d,s)),e}function dd(n){return Object.keys(n).map(e=>{let s=n[e];return Array.isArray(s)||(s=[s]),s.map(a=>[e].concat(Object.keys(a).map(c=>{let u=a[c];return Array.isArray(u)||(u=[u]),u.map(d=>d===!0?c:`${c}=${d}`).join("; ")})).join("; ")).join(", ")}).join(", ")}Xo.exports={format:dd,parse:ud}});var Qn=de((nm,xa)=>{"use strict";var fd=W("events"),ld=W("https"),hd=W("http"),ea=W("net"),gd=W("tls"),{randomBytes:pd,createHash:md}=W("crypto"),{Duplex:em,Readable:tm}=W("stream"),{URL:ni}=W("url"),Ye=Et(),_d=Xr(),wd=ei(),{isBlob:yd}=Ct(),{BINARY_TYPES:Zo,CLOSE_TIMEOUT:vd,EMPTY_BUFFER:Yn,GUID:bd,kForOnEventAttribute:ri,kListener:Sd,kStatusCode:Ed,kWebSocket:Q,NOOP:ta}=ze(),{EventTarget:{addEventListener:Cd,removeEventListener:Id}}=Yo(),{format:Ad,parse:Pd}=Vn(),{toBuffer:kd}=Wt(),na=Symbol("kAborted"),ii=[8,13],qe=["CONNECTING","OPEN","CLOSING","CLOSED"],Td=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,j=class n extends fd{constructor(e,s,a){super(),this._binaryType=Zo[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=Yn,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol="",this._readyState=n.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,e!==null?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,s===void 0?s=[]:Array.isArray(s)||(typeof s=="object"&&s!==null?(a=s,s=[]):s=[s]),ra(this,e,s,a)):(this._autoPong=a.autoPong,this._closeTimeout=a.closeTimeout,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(e){Zo.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,s,a){let c=new _d({allowSynchronousEvents:a.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:a.maxPayload,skipUTF8Validation:a.skipUTF8Validation}),u=new wd(e,this._extensions,a.generateMask);this._receiver=c,this._sender=u,this._socket=e,c[Q]=this,u[Q]=this,e[Q]=this,c.on("conclude",Nd),c.on("drain",Od),c.on("error",Ld),c.on("message",Bd),c.on("ping",Md),c.on("pong",zd),u.onerror=Fd,e.setTimeout&&e.setTimeout(0),e.setNoDelay&&e.setNoDelay(),s.length>0&&e.unshift(s),e.on("close",oa),e.on("data",Zn),e.on("end",aa),e.on("error",ca),this._readyState=n.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=n.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[Ye.extensionName]&&this._extensions[Ye.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=n.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(e,s){if(this.readyState!==n.CLOSED){if(this.readyState===n.CONNECTING){le(this,this._req,"WebSocket was closed before the connection was established");return}if(this.readyState===n.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=n.CLOSING,this._sender.close(e,s,!this._isServer,a=>{a||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),sa(this)}}pause(){this.readyState===n.CONNECTING||this.readyState===n.CLOSED||(this._paused=!0,this._socket.pause())}ping(e,s,a){if(this.readyState===n.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(a=e,e=s=void 0):typeof s=="function"&&(a=s,s=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==n.OPEN){si(this,e,a);return}s===void 0&&(s=!this._isServer),this._sender.ping(e||Yn,s,a)}pong(e,s,a){if(this.readyState===n.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof e=="function"?(a=e,e=s=void 0):typeof s=="function"&&(a=s,s=void 0),typeof e=="number"&&(e=e.toString()),this.readyState!==n.OPEN){si(this,e,a);return}s===void 0&&(s=!this._isServer),this._sender.pong(e||Yn,s,a)}resume(){this.readyState===n.CONNECTING||this.readyState===n.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(e,s,a){if(this.readyState===n.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof s=="function"&&(a=s,s={}),typeof e=="number"&&(e=e.toString()),this.readyState!==n.OPEN){si(this,e,a);return}let c={binary:typeof e!="string",mask:!this._isServer,compress:!0,fin:!0,...s};this._extensions[Ye.extensionName]||(c.compress=!1),this._sender.send(e||Yn,c,a)}terminate(){if(this.readyState!==n.CLOSED){if(this.readyState===n.CONNECTING){le(this,this._req,"WebSocket was closed before the connection was established");return}this._socket&&(this._readyState=n.CLOSING,this._socket.destroy())}}};Object.defineProperty(j,"CONNECTING",{enumerable:!0,value:qe.indexOf("CONNECTING")});Object.defineProperty(j.prototype,"CONNECTING",{enumerable:!0,value:qe.indexOf("CONNECTING")});Object.defineProperty(j,"OPEN",{enumerable:!0,value:qe.indexOf("OPEN")});Object.defineProperty(j.prototype,"OPEN",{enumerable:!0,value:qe.indexOf("OPEN")});Object.defineProperty(j,"CLOSING",{enumerable:!0,value:qe.indexOf("CLOSING")});Object.defineProperty(j.prototype,"CLOSING",{enumerable:!0,value:qe.indexOf("CLOSING")});Object.defineProperty(j,"CLOSED",{enumerable:!0,value:qe.indexOf("CLOSED")});Object.defineProperty(j.prototype,"CLOSED",{enumerable:!0,value:qe.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(n=>{Object.defineProperty(j.prototype,n,{enumerable:!0})});["open","error","close","message"].forEach(n=>{Object.defineProperty(j.prototype,`on${n}`,{enumerable:!0,get(){for(let e of this.listeners(n))if(e[ri])return e[Sd];return null},set(e){for(let s of this.listeners(n))if(s[ri]){this.removeListener(n,s);break}typeof e=="function"&&this.addEventListener(n,e,{[ri]:!0})}})});j.prototype.addEventListener=Cd;j.prototype.removeEventListener=Id;xa.exports=j;function ra(n,e,s,a){let c={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:vd,protocolVersion:ii[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(n._autoPong=c.autoPong,n._closeTimeout=c.closeTimeout,!ii.includes(c.protocolVersion))throw new RangeError(`Unsupported protocol version: ${c.protocolVersion} (supported versions: ${ii.join(", ")})`);let u;if(e instanceof ni)u=e;else try{u=new ni(e)}catch{throw new SyntaxError(`Invalid URL: ${e}`)}u.protocol==="http:"?u.protocol="ws:":u.protocol==="https:"&&(u.protocol="wss:"),n._url=u.href;let d=u.protocol==="wss:",l=u.protocol==="ws+unix:",m;if(u.protocol!=="ws:"&&!d&&!l?m=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:l&&!u.pathname?m="The URL's pathname is empty":u.hash&&(m="The URL contains a fragment identifier"),m){let R=new SyntaxError(m);if(n._redirects===0)throw R;Xn(n,R);return}let _=d?443:80,y=pd(16).toString("base64"),v=d?ld.request:hd.request,E=new Set,k;if(c.createConnection=c.createConnection||(d?Rd:Dd),c.defaultPort=c.defaultPort||_,c.port=u.port||_,c.host=u.hostname.startsWith("[")?u.hostname.slice(1,-1):u.hostname,c.headers={...c.headers,"Sec-WebSocket-Version":c.protocolVersion,"Sec-WebSocket-Key":y,Connection:"Upgrade",Upgrade:"websocket"},c.path=u.pathname+u.search,c.timeout=c.handshakeTimeout,c.perMessageDeflate&&(k=new Ye({...c.perMessageDeflate,isServer:!1,maxPayload:c.maxPayload}),c.headers["Sec-WebSocket-Extensions"]=Ad({[Ye.extensionName]:k.offer()})),s.length){for(let R of s){if(typeof R!="string"||!Td.test(R)||E.has(R))throw new SyntaxError("An invalid or duplicated subprotocol was specified");E.add(R)}c.headers["Sec-WebSocket-Protocol"]=s.join(",")}if(c.origin&&(c.protocolVersion<13?c.headers["Sec-WebSocket-Origin"]=c.origin:c.headers.Origin=c.origin),(u.username||u.password)&&(c.auth=`${u.username}:${u.password}`),l){let R=c.path.split(":");c.socketPath=R[0],c.path=R[1]}let D;if(c.followRedirects){if(n._redirects===0){n._originalIpc=l,n._originalSecure=d,n._originalHostOrSocketPath=l?c.socketPath:u.host;let R=a&&a.headers;if(a={...a,headers:{}},R)for(let[L,$]of Object.entries(R))a.headers[L.toLowerCase()]=$}else if(n.listenerCount("redirect")===0){let R=l?n._originalIpc?c.socketPath===n._originalHostOrSocketPath:!1:n._originalIpc?!1:u.host===n._originalHostOrSocketPath;(!R||n._originalSecure&&!d)&&(delete c.headers.authorization,delete c.headers.cookie,R||delete c.headers.host,c.auth=void 0)}c.auth&&!a.headers.authorization&&(a.headers.authorization="Basic "+Buffer.from(c.auth).toString("base64")),D=n._req=v(c),n._redirects&&n.emit("redirect",n.url,D)}else D=n._req=v(c);c.timeout&&D.on("timeout",()=>{le(n,D,"Opening handshake has timed out")}),D.on("error",R=>{D===null||D[na]||(D=n._req=null,Xn(n,R))}),D.on("response",R=>{let L=R.headers.location,$=R.statusCode;if(L&&c.followRedirects&&$>=300&&$<400){if(++n._redirects>c.maxRedirects){le(n,D,"Maximum redirects exceeded");return}D.abort();let ee;try{ee=new ni(L,e)}catch{let X=new SyntaxError(`Invalid URL: ${L}`);Xn(n,X);return}ra(n,ee,s,a)}else n.emit("unexpected-response",D,R)||le(n,D,`Unexpected server response: ${R.statusCode}`)}),D.on("upgrade",(R,L,$)=>{if(n.emit("upgrade",R),n.readyState!==j.CONNECTING)return;D=n._req=null;let ee=R.headers.upgrade;if(ee===void 0||ee.toLowerCase()!=="websocket"){le(n,L,"Invalid Upgrade header");return}let te=md("sha1").update(y+bd).digest("base64");if(R.headers["sec-websocket-accept"]!==te){le(n,L,"Invalid Sec-WebSocket-Accept header");return}let X=R.headers["sec-websocket-protocol"],Z;if(X!==void 0?E.size?E.has(X)||(Z="Server sent an invalid subprotocol"):Z="Server sent a subprotocol but none was requested":E.size&&(Z="Server sent no subprotocol"),Z){le(n,L,Z);return}X&&(n._protocol=X);let Ke=R.headers["sec-websocket-extensions"];if(Ke!==void 0){if(!k){le(n,L,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let A;try{A=Pd(Ke)}catch{le(n,L,"Invalid Sec-WebSocket-Extensions header");return}let M=Object.keys(A);if(M.length!==1||M[0]!==Ye.extensionName){le(n,L,"Server indicated an extension that was not requested");return}try{k.accept(A[Ye.extensionName])}catch{le(n,L,"Invalid Sec-WebSocket-Extensions header");return}n._extensions[Ye.extensionName]=k}n.setSocket(L,$,{allowSynchronousEvents:c.allowSynchronousEvents,generateMask:c.generateMask,maxPayload:c.maxPayload,skipUTF8Validation:c.skipUTF8Validation})}),c.finishRequest?c.finishRequest(D,n):D.end()}function Xn(n,e){n._readyState=j.CLOSING,n._errorEmitted=!0,n.emit("error",e),n.emitClose()}function Dd(n){return n.path=n.socketPath,ea.connect(n)}function Rd(n){return n.path=void 0,!n.servername&&n.servername!==""&&(n.servername=ea.isIP(n.host)?"":n.host),gd.connect(n)}function le(n,e,s){n._readyState=j.CLOSING;let a=new Error(s);Error.captureStackTrace(a,le),e.setHeader?(e[na]=!0,e.abort(),e.socket&&!e.socket.destroyed&&e.socket.destroy(),process.nextTick(Xn,n,a)):(e.destroy(a),e.once("error",n.emit.bind(n,"error")),e.once("close",n.emitClose.bind(n)))}function si(n,e,s){if(e){let a=yd(e)?e.size:kd(e).length;n._socket?n._sender._bufferedBytes+=a:n._bufferedAmount+=a}if(s){let a=new Error(`WebSocket is not open: readyState ${n.readyState} (${qe[n.readyState]})`);process.nextTick(s,a)}}function Nd(n,e){let s=this[Q];s._closeFrameReceived=!0,s._closeMessage=e,s._closeCode=n,s._socket[Q]!==void 0&&(s._socket.removeListener("data",Zn),process.nextTick(ia,s._socket),n===1005?s.close():s.close(n,e))}function Od(){let n=this[Q];n.isPaused||n._socket.resume()}function Ld(n){let e=this[Q];e._socket[Q]!==void 0&&(e._socket.removeListener("data",Zn),process.nextTick(ia,e._socket),e.close(n[Ed])),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",n))}function Qo(){this[Q].emitClose()}function Bd(n,e){this[Q].emit("message",n,e)}function Md(n){let e=this[Q];e._autoPong&&e.pong(n,!this._isServer,ta),e.emit("ping",n)}function zd(n){this[Q].emit("pong",n)}function ia(n){n.resume()}function Fd(n){let e=this[Q];e.readyState!==j.CLOSED&&(e.readyState===j.OPEN&&(e._readyState=j.CLOSING,sa(e)),this._socket.end(),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",n)))}function sa(n){n._closeTimer=setTimeout(n._socket.destroy.bind(n._socket),n._closeTimeout)}function oa(){let n=this[Q];if(this.removeListener("close",oa),this.removeListener("data",Zn),this.removeListener("end",aa),n._readyState=j.CLOSING,!this._readableState.endEmitted&&!n._closeFrameReceived&&!n._receiver._writableState.errorEmitted&&this._readableState.length!==0){let e=this.read(this._readableState.length);n._receiver.write(e)}n._receiver.end(),this[Q]=void 0,clearTimeout(n._closeTimer),n._receiver._writableState.finished||n._receiver._writableState.errorEmitted?n.emitClose():(n._receiver.on("error",Qo),n._receiver.on("finish",Qo))}function Zn(n){this[Q]._receiver.write(n)||this.pause()}function aa(){let n=this[Q];n._readyState=j.CLOSING,n._receiver.end(),this.end()}function ca(){let n=this[Q];this.removeListener("error",ca),this.on("error",ta),n&&(n._readyState=j.CLOSING,this.destroy())}});var la=de((im,fa)=>{"use strict";var rm=Qn(),{Duplex:Ud}=W("stream");function ua(n){n.emit("close")}function qd(){!this.destroyed&&this._writableState.finished&&this.destroy()}function da(n){this.removeListener("error",da),this.destroy(),this.listenerCount("error")===0&&this.emit("error",n)}function Kd(n,e){let s=!0,a=new Ud({...e,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return n.on("message",function(u,d){let l=!d&&a._readableState.objectMode?u.toString():u;a.push(l)||n.pause()}),n.once("error",function(u){a.destroyed||(s=!1,a.destroy(u))}),n.once("close",function(){a.destroyed||a.push(null)}),a._destroy=function(c,u){if(n.readyState===n.CLOSED){u(c),process.nextTick(ua,a);return}let d=!1;n.once("error",function(m){d=!0,u(m)}),n.once("close",function(){d||u(c),process.nextTick(ua,a)}),s&&n.terminate()},a._final=function(c){if(n.readyState===n.CONNECTING){n.once("open",function(){a._final(c)});return}n._socket!==null&&(n._socket._writableState.finished?(c(),a._readableState.endEmitted&&a.destroy()):(n._socket.once("finish",function(){c()}),n.close()))},a._read=function(){n.isPaused&&n.resume()},a._write=function(c,u,d){if(n.readyState===n.CONNECTING){n.once("open",function(){a._write(c,u,d)});return}n.send(c,d)},a.on("end",qd),a.on("error",da),a}fa.exports=Kd});var oi=de((sm,ha)=>{"use strict";var{tokenChars:Gd}=Ct();function Hd(n){let e=new Set,s=-1,a=-1,c=0;for(c;c<n.length;c++){let d=n.charCodeAt(c);if(a===-1&&Gd[d]===1)s===-1&&(s=c);else if(c!==0&&(d===32||d===9))a===-1&&s!==-1&&(a=c);else if(d===44){if(s===-1)throw new SyntaxError(`Unexpected character at index ${c}`);a===-1&&(a=c);let l=n.slice(s,a);if(e.has(l))throw new SyntaxError(`The "${l}" subprotocol is duplicated`);e.add(l),s=a=-1}else throw new SyntaxError(`Unexpected character at index ${c}`)}if(s===-1||a!==-1)throw new SyntaxError("Unexpected end of input");let u=n.slice(s,c);if(e.has(u))throw new SyntaxError(`The "${u}" subprotocol is duplicated`);return e.add(u),e}ha.exports={parse:Hd}});var va=de((am,ya)=>{"use strict";var jd=W("events"),er=W("http"),{Duplex:om}=W("stream"),{createHash:Wd}=W("crypto"),ga=Vn(),ot=Et(),Jd=oi(),$d=Qn(),{CLOSE_TIMEOUT:Vd,GUID:Yd,kWebSocket:Xd}=ze(),Zd=/^[+/0-9A-Za-z]{22}==$/,pa=0,ma=1,wa=2,ai=class extends jd{constructor(e,s){if(super(),e={allowSynchronousEvents:!0,autoPong:!0,maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:Vd,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:$d,...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=er.createServer((a,c)=>{let u=er.STATUS_CODES[426];c.writeHead(426,{"Content-Length":u.length,"Content-Type":"text/plain"}),c.end(u)}),this._server.listen(e.port,e.host,e.backlog,s)):e.server&&(this._server=e.server),this._server){let a=this.emit.bind(this,"connection");this._removeListeners=Qd(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:(c,u,d)=>{this.handleUpgrade(c,u,d,a)}})}e.perMessageDeflate===!0&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=pa}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===wa){e&&this.once("close",()=>{e(new Error("The server is not running"))}),process.nextTick(Xt,this);return}if(e&&this.once("close",e),this._state!==ma)if(this._state=ma,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(Xt,this):process.nextTick(Xt,this);else{let s=this._server;this._removeListeners(),this._removeListeners=this._server=null,s.close(()=>{Xt(this)})}}shouldHandle(e){if(this.options.path){let s=e.url.indexOf("?");if((s!==-1?e.url.slice(0,s):e.url)!==this.options.path)return!1}return!0}handleUpgrade(e,s,a,c){s.on("error",_a);let u=e.headers["sec-websocket-key"],d=e.headers.upgrade,l=+e.headers["sec-websocket-version"];if(e.method!=="GET"){at(this,e,s,405,"Invalid HTTP method");return}if(d===void 0||d.toLowerCase()!=="websocket"){at(this,e,s,400,"Invalid Upgrade header");return}if(u===void 0||!Zd.test(u)){at(this,e,s,400,"Missing or invalid Sec-WebSocket-Key header");return}if(l!==13&&l!==8){at(this,e,s,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});return}if(!this.shouldHandle(e)){Zt(s,400);return}let m=e.headers["sec-websocket-protocol"],_=new Set;if(m!==void 0)try{_=Jd.parse(m)}catch{at(this,e,s,400,"Invalid Sec-WebSocket-Protocol header");return}let y=e.headers["sec-websocket-extensions"],v={};if(this.options.perMessageDeflate&&y!==void 0){let E=new ot({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let k=ga.parse(y);k[ot.extensionName]&&(E.accept(k[ot.extensionName]),v[ot.extensionName]=E)}catch{at(this,e,s,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let E={origin:e.headers[`${l===8?"sec-websocket-origin":"origin"}`],secure:!!(e.socket.authorized||e.socket.encrypted),req:e};if(this.options.verifyClient.length===2){this.options.verifyClient(E,(k,D,R,L)=>{if(!k)return Zt(s,D||401,R,L);this.completeUpgrade(v,u,_,e,s,a,c)});return}if(!this.options.verifyClient(E))return Zt(s,401)}this.completeUpgrade(v,u,_,e,s,a,c)}completeUpgrade(e,s,a,c,u,d,l){if(!u.readable||!u.writable)return u.destroy();if(u[Xd])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>pa)return Zt(u,503);let _=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${Wd("sha1").update(s+Yd).digest("base64")}`],y=new this.options.WebSocket(null,void 0,this.options);if(a.size){let v=this.options.handleProtocols?this.options.handleProtocols(a,c):a.values().next().value;v&&(_.push(`Sec-WebSocket-Protocol: ${v}`),y._protocol=v)}if(e[ot.extensionName]){let v=e[ot.extensionName].params,E=ga.format({[ot.extensionName]:[v]});_.push(`Sec-WebSocket-Extensions: ${E}`),y._extensions=e}this.emit("headers",_,c),u.write(_.concat(`\r
12
12
  `).join(`\r
13
- `)),u.removeListener("error",oa),y.setSocket(u,f,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(y),y.on("close",()=>{this.clients.delete(y),this._shouldEmitClose&&!this.clients.size&&process.nextTick(Qt,this)})),h(y,c)}};ca.exports=os;function gf(r,e){for(let i of Object.keys(e))r.on(i,e[i]);return function(){for(let a of Object.keys(e))r.removeListener(a,e[a])}}function Qt(r){r._state=aa,r.emit("close")}function oa(){this.destroy()}function en(r,e,i,a){i=i||rr.STATUS_CODES[e],a={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(i),...a},r.once("finish",r.destroy),r.end(`HTTP/1.1 ${e} ${rr.STATUS_CODES[e]}\r
13
+ `)),u.removeListener("error",_a),y.setSocket(u,d,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(y),y.on("close",()=>{this.clients.delete(y),this._shouldEmitClose&&!this.clients.size&&process.nextTick(Xt,this)})),l(y,c)}};ya.exports=ai;function Qd(n,e){for(let s of Object.keys(e))n.on(s,e[s]);return function(){for(let a of Object.keys(e))n.removeListener(a,e[a])}}function Xt(n){n._state=wa,n.emit("close")}function _a(){this.destroy()}function Zt(n,e,s,a){s=s||er.STATUS_CODES[e],a={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(s),...a},n.once("finish",n.destroy),n.end(`HTTP/1.1 ${e} ${er.STATUS_CODES[e]}\r
14
14
  `+Object.keys(a).map(c=>`${c}: ${a[c]}`).join(`\r
15
15
  `)+`\r
16
16
  \r
17
- `+i)}function ct(r,e,i,a,c,u){if(r.listenerCount("wsClientError")){let f=new Error(c);Error.captureStackTrace(f,ct),r.emit("wsClientError",f,i,e)}else en(i,a,c,u)}});import{spawn as Of}from"node:child_process";import{existsSync as zf,openSync as qf}from"node:fs";import{mkdir as Ff}from"node:fs/promises";import{dirname as Uf}from"node:path";import{fileURLToPath as Kf}from"node:url";function xs(r=H()){return zf(r.libEntry)?r.libEntry:Kf(new URL("../index.ts",import.meta.url))}async function Ca(r={}){let e=r.paths??H(),i=r.entryOverride??xs(e);await Ff(Uf(e.logFile),{recursive:!0});let a=qf(e.logFile,"a"),u=i.endsWith(".ts")?["--import","tsx/esm",i,"--daemon"]:[i,"--daemon"],f=Of(process.execPath,u,{detached:!0,stdio:["ignore",a,a],env:{...process.env,COZE_BRIDGE_DAEMON:"1"}});if(f.unref(),typeof f.pid!="number")throw new Error("failed to spawn daemon (no pid)");return Gf.info("daemon spawned",{pid:f.pid,entry:i}),{pid:f.pid,entry:i}}var Gf,us=Me(()=>{"use strict";K();le();Gf=N("spawn-daemon")});import{spawn as $f}from"node:child_process";import{mkdir as Zf,unlink as Qf,writeFile as ed}from"node:fs/promises";import{dirname as td,join as nd}from"node:path";function xr(r){return r.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function Pa(r,e){return new Promise((i,a)=>{let c=$f(r,e,{stdio:["ignore","pipe","pipe"]}),u="";c.stderr?.on("data",f=>{u+=f.toString("utf8")}),c.on("error",a),c.on("close",f=>{f===0?i():a(new Error(`${r} ${e.join(" ")} exited ${f}: ${u.trim()}`))})})}var cr,ls,hs,Da=Me(()=>{"use strict";K();cr=N("supervisor.launchd"),ls="ai.coze.bridge",hs={platform:"darwin",renderConfig(r){return`<?xml version="1.0" encoding="UTF-8"?>
17
+ `+s)}function at(n,e,s,a,c,u){if(n.listenerCount("wsClientError")){let d=new Error(c);Error.captureStackTrace(d,at),n.emit("wsClientError",d,s,e)}else Zt(s,a,c,u)}});import{spawn as Ef}from"node:child_process";import{existsSync as Cf,openSync as If}from"node:fs";import{mkdir as Af}from"node:fs/promises";import{dirname as Pf}from"node:path";import{fileURLToPath as kf}from"node:url";function ui(n=H()){return Cf(n.libEntry)?n.libEntry:kf(new URL("../index.ts",import.meta.url))}async function Fa(n={}){let e=n.paths??H(),s=n.entryOverride??ui(e);await Af(Pf(e.logFile),{recursive:!0});let a=If(e.logFile,"a"),u=s.endsWith(".ts")?["--import","tsx/esm",s,"--daemon"]:[s,"--daemon"],d=Ef(process.execPath,u,{detached:!0,stdio:["ignore",a,a],env:{...process.env,COZE_BRIDGE_DAEMON:"1"}});if(d.unref(),typeof d.pid!="number")throw new Error("failed to spawn daemon (no pid)");return Tf.info("daemon spawned",{pid:d.pid,entry:s}),{pid:d.pid,entry:s}}var Tf,di=Oe(()=>{"use strict";U();xe();Tf=T("spawn-daemon")});import{spawn as Wf}from"node:child_process";import{mkdir as Jf,unlink as $f,writeFile as Vf}from"node:fs/promises";import{dirname as Yf,join as Xf}from"node:path";function ar(n){return n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function ja(n,e){return new Promise((s,a)=>{let c=Wf(n,e,{stdio:["ignore","pipe","pipe"]}),u="";c.stderr?.on("data",d=>{u+=d.toString("utf8")}),c.on("error",a),c.on("close",d=>{d===0?s():a(new Error(`${n} ${e.join(" ")} exited ${d}: ${u.trim()}`))})})}var or,hi,gi,Wa=Oe(()=>{"use strict";U();or=T("supervisor.launchd"),hi="ai.coze.bridge",gi={platform:"darwin",renderConfig(n){return`<?xml version="1.0" encoding="UTF-8"?>
18
18
  <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
19
19
  <plist version="1.0">
20
20
  <dict>
21
21
  <key>Label</key>
22
- <string>${ls}</string>
22
+ <string>${hi}</string>
23
23
  <key>ProgramArguments</key>
24
24
  <array>
25
- <string>${xr(r.nodeBin)}</string>
26
- <string>${xr(r.entry)}</string>
25
+ <string>${ar(n.nodeBin)}</string>
26
+ <string>${ar(n.entry)}</string>
27
27
  <string>--daemon</string>
28
28
  </array>
29
29
  <key>RunAtLoad</key>
@@ -33,68 +33,93 @@ var k0=Object.create;var Sr=Object.defineProperty;var I0=Object.getOwnPropertyDe
33
33
  <key>ThrottleInterval</key>
34
34
  <integer>10</integer>
35
35
  <key>StandardOutPath</key>
36
- <string>${xr(r.logFile)}</string>
36
+ <string>${ar(n.logFile)}</string>
37
37
  <key>StandardErrorPath</key>
38
- <string>${xr(r.logFile)}</string>
38
+ <string>${ar(n.logFile)}</string>
39
39
  </dict>
40
40
  </plist>
41
- `},configPath(r){return nd(r.homeDir,"Library","LaunchAgents",`${ls}.plist`)},async install(r){let e=this.configPath(r);await Zf(td(e),{recursive:!0}),await ed(e,this.renderConfig(r),"utf8"),cr.info("plist written",{plistPath:e}),await Pa("launchctl",["load","-w",e]),cr.info("launchd job loaded",{label:ls})},async uninstall(r){let e=this.configPath(r);await Pa("launchctl",["unload","-w",e]).catch(i=>cr.warn("launchctl unload failed (ignored)",{err:String(i)})),await Qf(e).catch(i=>{if(i.code!=="ENOENT")throw i}),cr.info("launchd job removed",{plistPath:e})}}});import{spawn as rd}from"node:child_process";import{mkdir as sd,unlink as id,writeFile as od}from"node:fs/promises";import{dirname as ad,join as cd}from"node:path";function dr(r,e){return new Promise((i,a)=>{let c=rd(r,e,{stdio:["ignore","pipe","pipe"]}),u="";c.stderr?.on("data",f=>{u+=f.toString("utf8")}),c.on("error",a),c.on("close",f=>{f===0?i():a(new Error(`${r} ${e.join(" ")} exited ${f}: ${u.trim()}`))})})}var ur,fr,gs,Ta=Me(()=>{"use strict";K();ur=N("supervisor.systemd"),fr="coze-bridge.service",gs={platform:"linux",renderConfig(r){return`[Unit]
41
+ `},configPath(n){return Xf(n.homeDir,"Library","LaunchAgents",`${hi}.plist`)},async install(n){let e=this.configPath(n);await Jf(Yf(e),{recursive:!0}),await Vf(e,this.renderConfig(n),"utf8"),or.info("plist written",{plistPath:e}),await ja("launchctl",["load","-w",e]),or.info("launchd job loaded",{label:hi})},async uninstall(n){let e=this.configPath(n);await ja("launchctl",["unload","-w",e]).catch(s=>or.warn("launchctl unload failed (ignored)",{err:String(s)})),await $f(e).catch(s=>{if(s.code!=="ENOENT")throw s}),or.info("launchd job removed",{plistPath:e})}}});import{spawn as Zf}from"node:child_process";import{mkdir as Qf,unlink as el,writeFile as tl}from"node:fs/promises";import{dirname as nl,join as rl}from"node:path";function ur(n,e){return new Promise((s,a)=>{let c=Zf(n,e,{stdio:["ignore","pipe","pipe"]}),u="";c.stderr?.on("data",d=>{u+=d.toString("utf8")}),c.on("error",a),c.on("close",d=>{d===0?s():a(new Error(`${n} ${e.join(" ")} exited ${d}: ${u.trim()}`))})})}var cr,xr,pi,Ja=Oe(()=>{"use strict";U();cr=T("supervisor.systemd"),xr="coze-bridge.service",pi={platform:"linux",renderConfig(n){return`[Unit]
42
42
  Description=Coze Bridge daemon
43
43
  After=network.target
44
44
 
45
45
  [Service]
46
46
  Type=simple
47
- ExecStart=${r.nodeBin} ${r.entry} --daemon
47
+ ExecStart=${n.nodeBin} ${n.entry} --daemon
48
48
  Restart=always
49
49
  RestartSec=3
50
- StandardOutput=append:${r.logFile}
51
- StandardError=append:${r.logFile}
50
+ StandardOutput=append:${n.logFile}
51
+ StandardError=append:${n.logFile}
52
52
 
53
53
  [Install]
54
54
  WantedBy=default.target
55
- `},configPath(r){return cd(r.homeDir,".config","systemd","user",fr)},async install(r){let e=this.configPath(r);await sd(ad(e),{recursive:!0}),await od(e,this.renderConfig(r),"utf8"),ur.info("systemd unit written",{unitPath:e}),await dr("systemctl",["--user","daemon-reload"]),await dr("systemctl",["--user","enable","--now",fr]),ur.info("systemd unit enabled",{unitName:fr})},async uninstall(r){let e=this.configPath(r);await dr("systemctl",["--user","disable","--now",fr]).catch(i=>ur.warn("systemctl disable failed (ignored)",{err:String(i)})),await id(e).catch(i=>{if(i.code!=="ENOENT")throw i}),await dr("systemctl",["--user","daemon-reload"]).catch(()=>{}),ur.info("systemd unit removed",{unitPath:e})}}});import{spawn as xd}from"node:child_process";import{join as ud}from"node:path";function Na(r,e){return new Promise((i,a)=>{let c=xd(r,e,{stdio:["ignore","pipe","pipe"],shell:!1}),u="";c.stderr?.on("data",f=>{u+=f.toString("utf8")}),c.on("error",a),c.on("close",f=>{f===0?i():a(new Error(`${r} ${e.join(" ")} exited ${f}: ${u.trim()}`))})})}var ps,lr,ms,La=Me(()=>{"use strict";K();ps=N("supervisor.taskscheduler"),lr="CozeBridge",ms={platform:"win32",renderConfig(r){return`<?xml version="1.0" encoding="UTF-16"?>
55
+ `},configPath(n){return rl(n.homeDir,".config","systemd","user",xr)},async install(n){let e=this.configPath(n);await Qf(nl(e),{recursive:!0}),await tl(e,this.renderConfig(n),"utf8"),cr.info("systemd unit written",{unitPath:e}),await ur("systemctl",["--user","daemon-reload"]),await ur("systemctl",["--user","enable","--now",xr]),cr.info("systemd unit enabled",{unitName:xr})},async uninstall(n){let e=this.configPath(n);await ur("systemctl",["--user","disable","--now",xr]).catch(s=>cr.warn("systemctl disable failed (ignored)",{err:String(s)})),await el(e).catch(s=>{if(s.code!=="ENOENT")throw s}),await ur("systemctl",["--user","daemon-reload"]).catch(()=>{}),cr.info("systemd unit removed",{unitPath:e})}}});import{spawn as il}from"node:child_process";import{join as sl}from"node:path";function $a(n,e){return new Promise((s,a)=>{let c=il(n,e,{stdio:["ignore","pipe","pipe"],shell:!1}),u="";c.stderr?.on("data",d=>{u+=d.toString("utf8")}),c.on("error",a),c.on("close",d=>{d===0?s():a(new Error(`${n} ${e.join(" ")} exited ${d}: ${u.trim()}`))})})}var mi,dr,_i,Va=Oe(()=>{"use strict";U();mi=T("supervisor.taskscheduler"),dr="CozeBridge",_i={platform:"win32",renderConfig(n){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>
59
59
  </RegistrationInfo>
60
60
  <Triggers>
61
61
  <LogonTrigger>
62
- <UserId>${r.userName}</UserId>
62
+ <UserId>${n.userName}</UserId>
63
63
  </LogonTrigger>
64
64
  </Triggers>
65
65
  <Principals>
66
66
  <Principal>
67
- <UserId>${r.userName}</UserId>
67
+ <UserId>${n.userName}</UserId>
68
68
  <LogonType>InteractiveToken</LogonType>
69
69
  <RunLevel>LeastPrivilege</RunLevel>
70
70
  </Principal>
71
71
  </Principals>
72
72
  <Actions>
73
73
  <Exec>
74
- <Command>${r.nodeBin}</Command>
75
- <Arguments>"${r.entry}" --daemon</Arguments>
74
+ <Command>${n.nodeBin}</Command>
75
+ <Arguments>"${n.entry}" --daemon</Arguments>
76
76
  </Exec>
77
77
  </Actions>
78
78
  </Task>
79
- `},configPath(r){return ud(r.homeDir,".coze","bridge","task.xml")},async install(r){let e=`"${r.nodeBin}" "${r.entry}" --daemon`;await Na("schtasks",["/Create","/SC","ONLOGON","/TN",lr,"/TR",e,"/RU",r.userName,"/F"]),ps.info("task scheduler entry created",{task:lr})},async uninstall(r){await Na("schtasks",["/Delete","/TN",lr,"/F"]).catch(e=>ps.warn("schtasks /Delete failed (ignored)",{err:String(e)})),ps.info("task scheduler entry removed",{task:lr})}}});var _s={};Ks(_s,{buildContext:()=>hd,getSupervisor:()=>ld,launchdSupervisor:()=>hs,systemdSupervisor:()=>gs,taskSchedulerSupervisor:()=>ms});import{homedir as fd,userInfo as dd}from"node:os";function ld(r=process.platform){switch(r){case"darwin":return hs;case"linux":return gs;case"win32":return ms;default:throw new Error(`unsupported platform for OS supervisor: ${r}`)}}function hd(){let r=H();return{nodeBin:process.execPath,entry:xs(r),logFile:r.logFile,homeDir:fd(),userName:dd().username}}var ws=Me(()=>{"use strict";le();us();Da();Ta();La()});Je();K();import{readdir as V0}from"node:fs/promises";import{mkdir as G0,writeFile as H0}from"node:fs/promises";import{join as j0}from"node:path";var W0={"claude-code":"CLAUDE.md",codex:"AGENTS.md",openclaw:"SOUL.md"};async function pt(r,e,i,a){await G0(r,{recursive:!0});let c=W0[e],u=j0(r,c),f=J0(e,i,a);return await H0(u,f,"utf8"),u}function J0(r,e,i){let a=`# Coze Agent: ${e}
79
+ `},configPath(n){return sl(n.homeDir,".coze","bridge","task.xml")},async install(n){let e=`"${n.nodeBin}" "${n.entry}" --daemon`;await $a("schtasks",["/Create","/SC","ONLOGON","/TN",dr,"/TR",e,"/RU",n.userName,"/F"]),mi.info("task scheduler entry created",{task:dr})},async uninstall(n){await $a("schtasks",["/Delete","/TN",dr,"/F"]).catch(e=>mi.warn("schtasks /Delete failed (ignored)",{err:String(e)})),mi.info("task scheduler entry removed",{task:dr})}}});var wi={};Hi(wi,{buildContext:()=>xl,getSupervisor:()=>cl,launchdSupervisor:()=>gi,systemdSupervisor:()=>pi,taskSchedulerSupervisor:()=>_i});import{homedir as ol,userInfo as al}from"node:os";function cl(n=process.platform){switch(n){case"darwin":return gi;case"linux":return pi;case"win32":return _i;default:throw new Error(`unsupported platform for OS supervisor: ${n}`)}}function xl(){let n=H();return{nodeBin:process.execPath,entry:ui(n),logFile:n.logFile,homeDir:ol(),userName:al().username}}var yi=Oe(()=>{"use strict";xe();di();Wa();Ja();Va()});We();U();import{readdir as hc}from"node:fs/promises";import{mkdir as cc,writeFile as xc}from"node:fs/promises";import{join as uc}from"node:path";var dc={"claude-code":"CLAUDE.md",codex:"AGENTS.md",openclaw:"SOUL.md"};async function ht(n,e,s,a){await cc(n,{recursive:!0});let c=dc[e],u=uc(n,c),d=fc(e,s,a);return await xc(u,d,"utf8"),u}function fc(n,e,s){let a=`# Coze Agent: ${e}
80
80
 
81
- > framework: \`${r}\`
81
+ > framework: \`${n}\`
82
82
 
83
- `,c=i?.trim()?i.endsWith(`
84
- `)?i:`${i}
83
+ `,c=s?.trim()?s.endsWith(`
84
+ `)?s:`${s}
85
85
  `:`_No instructions provided._
86
86
  `;return`${a}---
87
87
 
88
- ${c}`}var Ae=N("agent-detail-sync"),ln=class{constructor(e){this.opts=e}opts;async syncAll(e){let i=this.opts.paths.agentsRoot,a;try{a=await V0(i)}catch(c){Ae.info("agents dir not found, skip detail sync",{root:i,err:String(c)});return}Ae.info("starting detail sync",{reason:e,count:a.length});for(let c of a)try{await this.syncOne(c)}catch(u){Ae.warn("detail sync failed for agent, skipping",{agentId:c,err:String(u)})}Ae.info("detail sync done",{reason:e})}async syncOne(e){let i=await he(e,this.opts.paths);if(!i){Ae.info("detail sync: agent config missing, skip",{agentId:e});return}let a;try{a=await this.opts.sendDetail({_meta:{cozeAgentId:e}})}catch(f){Ae.warn("detail RPC failed, using local data",{agentId:e,err:String(f)});return}if(a.agentId&&a.agentId!==e){Ae.warn("detail response agentId mismatch, ignoring",{agentId:e,responseAgentId:a.agentId});return}let c=!1,u=!1;if(a.agentName&&a.agentName!==i.agentName&&(i.agentName=a.agentName,c=!0),a.description!==void 0&&a.description!==i.description&&(i.description=a.description,c=!0),a.cozeIdentity&&a.cozeIdentity!==i.cozeIdentity&&(i.cozeIdentity=a.cozeIdentity,c=!0,u=!0),a.deployType&&Ae.info("detail.deployType",{agentId:e,deployType:a.deployType}),!c){Ae.debug("detail sync: no diff",{agentId:e});return}await be(i,this.opts.paths),Ae.info("detail sync: config updated",{agentId:e,identityChanged:u,agentName:i.agentName}),u&&(await pt(i.workspace,i.framework,e,i.cozeIdentity),await this.opts.handlers.reloadAgentSessionsPublic(e,"detail-sync"))}};Je();import{spawn as hi}from"node:child_process";import{lstat as Pr,mkdir as Z0,readFile as gi,readdir as Q0,rm as ec,stat as tc,writeFile as di}from"node:fs/promises";import{join as Pe,normalize as nc,relative as pi,resolve as rc,sep as mi}from"node:path";var ke={PAIR:"_agent/pair",CREATE:"_agent/create",HEALTH:"_agent/health",LIST_SKILLS:"_agent/listSkills",ADD_SKILLS:"_agent/addSkills",REMOVE_SKILLS:"_agent/removeSkills",GET_FILE_TREE:"_agent/getFileTree",GET_FILE_CONTENT:"_agent/getFileContent",DETAIL:"_agent/detail",UPDATE:"_agent/update",DISCONNECT:"_agent/disconnect",SWITCH_MODEL:"_agent/switchModel",GEN_MODEL_TOKEN:"_agent/genModelToken",RESET:"_agent/reset",REPAIR:"_agent/repair",DELETE:"_agent/delete"};function Ot(r){return r?.cozeDeployType==="cloud"?"cloud":"local"}function Xs(r){let{_meta:e,...i}=r;return{stripped:i,meta:e}}function mt(r){if(!r?.cozeAgentId)throw new Error("missing _meta.cozeAgentId");return r.cozeAgentId}var C=class extends Error{code;retriable;cause;constructor(e,i,a){super(i),this.name="BridgeError",this.code=e,this.retriable=a?.retriable??!1,a?.cause!==void 0&&(this.cause=a.cause)}};K();le();function qe(r,e){if(Ot(r)!=="cloud")throw new C("OPERATION_NOT_ALLOWED_FOR_LOCAL",`${e} is not allowed for local agent`)}K();var hn="1008033",Ys="1289";var $s="pbbp2",Zs="https://www.coze.cn",Qs="/api/coze_claw/resource/get_frontier_key",X0="https://www.coze.cn",Y0="wss://frontier.coze.cn";function ei(r){return r??process.env.COZE_BRIDGE_HANDSHAKE_URL??X0}function ti(r){return r??process.env.COZE_BRIDGE_FRONTIER_URL??Y0}function gn(r){let e={},i=r?.ttEnv??process.env.COZE_BRIDGE_TT_ENV,a=r?.usePpe??process.env.COZE_BRIDGE_USE_PPE;return i&&(e["x-tt-env"]=i),a&&(e["x-use-ppe"]=a),e}function pn(r){return r?r.startsWith("boe_")?{ttEnv:r}:{ttEnv:r,usePpe:"1"}:{}}var ni=N("handshake");async function ri(r){let e=ei(r.endpoint),i=r.timeoutMs??1e4,a=`${$0(e)}${Qs}?aid=${encodeURIComponent(hn)}`,c={Authorization:`Bearer ${r.privatecode}`,Accept:"application/json",...gn(r.ppeOverride)},u=new AbortController,f=setTimeout(()=>u.abort(),i);ni.info("frontier key handshake",{base:e});try{let h=await fetch(a,{method:"GET",headers:c,signal:u.signal}),m=h.headers.get("x-tt-logid")??"",_=h.headers.get("x-tt-trace-id")??"";if(!h.ok){let A=await h.text().catch(()=>"");throw new C("UPSTREAM_HANDSHAKE_FAILED",`handshake HTTP ${h.status} logid=${m}: ${A.slice(0,200)}`)}let y=await h.json();if(y.code!==void 0&&y.code!==0)throw new C("UPSTREAM_HANDSHAKE_FAILED",`handshake code=${y.code} msg=${y.msg??"-"} logid=${m}`);let v=y.data?.access_key,S=y.data?.device_id;if(!v||!S)throw new C("UPSTREAM_HANDSHAKE_FAILED",`handshake response missing access_key/device_id logid=${m}: ${JSON.stringify(y)}`);return ni.info("handshake ok",{remoteDeviceId:S,logid:m,traceId:_}),{accessKey:v,deviceId:S}}catch(h){throw h instanceof C?h:h.name==="AbortError"?new C("UPSTREAM_HANDSHAKE_FAILED",`handshake timeout (${i}ms)`):new C("UPSTREAM_HANDSHAKE_FAILED",String(h),{cause:h})}finally{clearTimeout(f)}}function $0(r){return r.endsWith("/")?r.slice(0,-1):r}var Ar="https://llm-gateway.coze.cn",Ie="auto";function si(r){return{model:r.model??Ie,...r.modelToken?{modelToken:r.modelToken}:{}}}function ii(r){return!r||r===Ie}function oi(r){let e={};return r.modelToken?(e.ANTHROPIC_BASE_URL=Ar,e.ANTHROPIC_AUTH_TOKEN=r.modelToken,e.ANTHROPIC_MODEL=r.model||Ie):ii(r.model)||(e.ANTHROPIC_MODEL=r.model),e}function ai(r){let e=[];return r.modelToken?e.push("-c",`model="${r.model||Ie}"`):ii(r.model)||e.push("-c",`model="${r.model}"`),r.modelToken&&(e.push("-c",'model_providers.coze.name="coze"'),e.push("-c",`model_providers.coze.base_url="${Ar}/v1"`),e.push("-c",'model_providers.coze.env_key="OPENAI_API_KEY"'),e.push("-c",'model_providers.coze.wire_api="responses"'),e.push("-c","model_providers.coze.requires_openai_auth=false"),e.push("-c","model_providers.coze.supports_websockets=false"),e.push("-c",'model_provider="coze"')),e}function ci(r){return r.modelToken?{OPENAI_API_KEY:r.modelToken}:{}}function kr(r){let{ttEnv:e,usePpe:i}=pn(r),a={};return e&&(a["x-tt-env"]=e),i&&(a["x-use-ppe"]=i),a}function xi(r,e){if(!r.modelToken)return{};let i=kr(e);return Object.keys(i).length===0?{}:{ANTHROPIC_CUSTOM_HEADERS:Object.entries(i).map(([c,u])=>`${c}:${u}`).join(`
89
- `)}}function Ir(r){return`coze-session-${r.replace(/[^A-Za-z0-9_-]+/g,"-")}`}function ui(r,e){if(!r.modelToken)return null;let i=r.model||Ie,a=kr(e),c={baseUrl:`${Ar}/v1`,api:"openai-completions",apiKey:r.modelToken,models:[{id:i,name:i,reasoning:!1,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8192,api:"openai-completions"}]};return Object.keys(a).length>0&&(c.headers=a),c}function fi(r,e){if(!r.modelToken)return[];let i=kr(e),a=[];for(let[c,u]of Object.entries(i))a.push("-c",`model_providers.coze.http_headers.${c}="${u}"`);return a}var ue=N("agent-handlers"),li=5*1024*1024,sc=1,ic=6,oc=new Set(["node_modules",".git",".coze","dist","build",".next"]),mn=class{constructor(e){this.opts=e}opts;async listSkills(e){qe(e._meta,"_agent/listSkills");let i=mt(e._meta),a=await this.loadAgentCfg(i),c=a?.workspace??ze(i).workspace,u=a?.skills??[],f=[];for(let h of u){let m=Pe(c,h.relPath,"SKILL.md");await tc(m).then(y=>y.isFile()).catch(()=>!1)&&f.push(fc(h))}return{skills:f}}async addSkills(e){qe(e._meta,"_agent/addSkills");let i=mt(e._meta),a=await this.requireAgentCfg(i),c=e.skills??[],u=[...a.skills??[]],f=new Map(u.map((m,_)=>[m.skillId,_])),h=[];for(let m of c){let _=await Dr({agentId:i,workspace:a.workspace,framework:a.framework,skill:m});Tr(u,f,_),h.push(m)}return await fn(i,u),await this.reloadAgentSessions(i,"skills-added"),{installedSkills:h}}async removeSkills(e){qe(e._meta,"_agent/removeSkills");let i=mt(e._meta),a=await this.requireAgentCfg(i),c=new Set(e.skillIds??[]),u=a.skills??[],f=[];for(let h of u){if(!c.has(h.skillId)){f.push(h);continue}let m=Pe(a.workspace,h.relPath);await ec(m,{recursive:!0,force:!0}),ue.info("skill removed",{agentId:i,skillId:h.skillId,relPath:h.relPath})}return await fn(i,f),await this.reloadAgentSessions(i,"skills-removed"),{ok:!0}}reloadAgentSessionsPublic(e,i){return this.reloadAgentSessions(e,i)}async reloadAgentSessions(e,i){let a=this.opts.agents.get(e);if(a&&a.framework!=="codex"){for(let[c,u]of a.sessions)if(!(!u.downstream||!u.acpSessionId)){u.loadingSession=!0;try{await u.downstream.sessionLoad({sessionId:u.acpSessionId,cwd:a.workspace}),ue.info("session reloaded",{reason:i,agentId:e,framework:a.framework,cloudId:c,acpId:u.acpSessionId})}catch(f){ue.warn("session reload failed",{reason:i,agentId:e,framework:a.framework,cloudId:c,acpId:u.acpSessionId,err:String(f)})}finally{u.loadingSession=!1}}}}async updateAgent(e){if(!e.cozeIdentity?.trim())return ue.info("_agent/update: empty cozeIdentity, noop",{agentId:e.agentId}),{ok:!0};let i=e.agentId,a=await he(i);if(!a)throw new C("AGENT_NOT_FOUND",`agent not found: ${i}`);return a.cozeIdentity===e.cozeIdentity?(ue.info("_agent/update: cozeIdentity unchanged, noop",{agentId:i}),{ok:!0}):(a.cozeIdentity=e.cozeIdentity,await be(a),await pt(a.workspace,a.framework,i,e.cozeIdentity),ue.info("_agent/update: cozeIdentity rewritten",{agentId:i,framework:a.framework}),await this.reloadAgentSessions(i,"identity-changed"),{ok:!0})}async disconnectAgent(e){let i=e.agentId;if(!i)throw new C("IPC_BAD_REQUEST","_agent/disconnect: missing agentId");let a=await he(i);return a?(a.disconnectedAt=Date.now(),a.disconnectReason=e.reason??"",await be(a),ue.info("agent disconnected",{agentId:i,reason:e.reason??"",force:e.force??!1}),this.opts.disposeAndMarkDisconnected&&await this.opts.disposeAndMarkDisconnected(i,e.reason??"disconnect"),{ok:!0}):(ue.warn("_agent/disconnect: agent not found, ignoring",{agentId:i}),{ok:!0})}async switchModel(e){if(qe(e._meta,"_agent/switchModel"),!e.agentId)throw new C("IPC_BAD_REQUEST","_agent/switchModel: missing agentId");let i=e.model?.trim()?e.model:Ie,a=await he(e.agentId);if(!a)throw new C("AGENT_NOT_FOUND",`agent not found: ${e.agentId}`);a.model=i,await be(a),ue.info("_agent/switchModel: model persisted",{agentId:e.agentId,model:i,reason:e.reason??""});let c=this.opts.agents.get(e.agentId);if(!c)return ue.info("_agent/switchModel: agent not running, config persisted only",{agentId:e.agentId}),{ok:!0};c.model=i;let u=[];for(let[f,h]of c.allSessionQueues())u.push(h.enqueue(async()=>{let m=c.sessions.get(f);m?.downstream&&(await m.downstream.stop(`switchModel: ${i}`).catch(()=>{}),m.downstream=void 0)}));return await Promise.all(u),ue.info("_agent/switchModel: all session runtimes killed, next prompt will respawn",{agentId:e.agentId,model:i,cloudSessions:u.length}),{ok:!0}}async resetAgent(e){if(qe(e._meta,ke.RESET),!e.agentId)throw new C("IPC_BAD_REQUEST",`${ke.RESET}: missing agentId`);return await this.runDetailSync(e.agentId,ke.RESET,e.reason),{ok:!0}}async repairAgent(e){if(qe(e._meta,ke.REPAIR),!e.agentId)throw new C("IPC_BAD_REQUEST",`${ke.REPAIR}: missing agentId`);let i=await this.loadAgentCfg(e.agentId);if(i&&i.framework!=="openclaw")throw new C("IPC_BAD_REQUEST",`${ke.REPAIR} only allowed for openclaw, got ${i.framework}`);if(i&&this.opts.openclawRepair)try{await this.opts.openclawRepair(e.agentId,i.workspace)}catch(a){ue.warn("openclaw repair (delete+add) failed (ignored)",{agentId:e.agentId,reason:e.reason,err:String(a)})}return await this.runDetailSync(e.agentId,ke.REPAIR,e.reason),{ok:!0}}async runDetailSync(e,i,a){if(!this.opts.detailSyncer){ue.warn("detailSyncer not wired, skipping sync",{method:i,agentId:e});return}try{await this.opts.detailSyncer(e)}catch(c){ue.warn("detail sync failed (ignored)",{method:i,agentId:e,reason:a,err:String(c)})}}async getFileTree(e){qe(e._meta,"_agent/getFileTree");let i=e._meta,a=mt(i),c=await this.resolveWorkspace(a),u=e.filePath??"",f=this.safeJoin(c,u),h=await Pr(f).catch(()=>null);if(!h)throw new C("IPC_BAD_REQUEST",`path not found: ${u}`);if(h.isSymbolicLink())throw new C("IPC_BAD_REQUEST",`symlink not allowed: ${u}`);let m=mc(e.depth);return h.isDirectory()?{tree:await _i(c,f,u,m)}:{tree:[{name:_c(u),path:wi(u||"."),isDir:!1,size:h.size,modifiedAt:Math.floor(h.mtimeMs)}]}}async getFileContent(e){qe(e._meta,"_agent/getFileContent");let i=mt(e._meta),a=await this.resolveWorkspace(i);if(!e.filePath)throw new C("IPC_BAD_REQUEST","filePath required");let c=this.safeJoin(a,e.filePath),u=await Pr(c).catch(()=>null);if(!u||!u.isFile())throw new C("IPC_BAD_REQUEST",`not a file: ${e.filePath}`);if(u.isSymbolicLink())throw new C("IPC_BAD_REQUEST",`symlink not allowed: ${e.filePath}`);if(u.size>li)throw new C("IPC_BAD_REQUEST",`file too large: ${u.size} bytes (max ${li})`);let f=await gi(c);return f.includes(0)?{content:f.toString("base64"),encoding:"base64",size:u.size}:{content:f.toString("utf8"),encoding:"utf-8",size:u.size}}async resolveWorkspace(e){let i=this.opts.agents.get(e);return i?i.workspace:(await he(e).catch(()=>null))?.workspace??ze(e).workspace}safeJoin(e,i){let a=rc(e,i||"."),c=pi(e,a);if(c.startsWith("..")||c===".."||c.startsWith(`..${mi}`))throw new C("IPC_BAD_REQUEST",`path escapes workspace: ${i}`);return a}loadAgentCfg(e){return he(e)}async requireAgentCfg(e){let i=await this.loadAgentCfg(e);if(!i)throw new C("AGENT_NOT_FOUND",`no config for agent: ${e}`);return i}};function ac(r){let e=r.trim().replace(/[\x00-\x1f<>:"|?*/\\]+/g,"-").replace(/^[\s.-]+|[\s.-]+$/g,"").slice(0,64);if(!e||e==="."||e==="..")throw new C("IPC_BAD_REQUEST",`invalid skill name: ${r}`);if(/^(con|prn|aux|nul|com[1-9]|lpt[1-9])$/i.test(e))throw new C("IPC_BAD_REQUEST",`reserved windows filename: ${r}`);return e}function cc(r){return r==="claude-code"?Pe(".claude","skills"):Pe(".agents","skills")}var xc=3e4,uc=50*1024*1024,_n=3e4;async function Dr(r){let{agentId:e,workspace:i,framework:a,skill:c}=r;if(!c.skillName)throw new C("IPC_BAD_REQUEST","skill missing skillName");let u=typeof c.content=="string"&&c.content.length>0,f=typeof c.downloadUrl=="string"&&c.downloadUrl.length>0;if(!u&&!f)throw new C("IPC_BAD_REQUEST",`skill ${c.skillId} missing both content and downloadUrl`);let h=ac(c.skillName),m=cc(a),_=Pe(m,h),y=Pe(i,_);if(await Z0(y,{recursive:!0}),u){let S=Buffer.from(c.content,"utf8");zt(S.length),await di(Pe(y,"SKILL.md"),S,"utf8")}else{let S=await dc(c.downloadUrl);hc(S)?await gc(S,y):await di(Pe(y,"SKILL.md"),S.toString("utf8"),"utf8")}let v={skillId:c.skillId,skillName:c.skillName,relPath:_,installedAt:Date.now(),...c.description?{description:c.description}:{},...c.icon?{icon:c.icon}:{},...c.version?{version:c.version}:{},...c.downloadUrl?{downloadUrl:c.downloadUrl}:{},...c.config?{config:c.config}:{},...c.builtin?{builtin:c.builtin}:{}};return ue.info("skill installed",{agentId:e,skillId:c.skillId,skillName:c.skillName,relPath:_,source:u?"content":"downloadUrl"}),v}function Tr(r,e,i){let a=e.get(i.skillId);if(a!==void 0){r[a]=i;return}e.set(i.skillId,r.length),r.push(i)}function fc(r){return{skillId:r.skillId,skillName:r.skillName,...r.description?{description:r.description}:{},...r.icon?{icon:r.icon}:{},...r.version?{version:r.version}:{},...r.config?{config:r.config}:{},...r.builtin?{builtin:r.builtin}:{}}}async function dc(r){if(!r)throw new C("IPC_BAD_REQUEST","skill missing downloadUrl");if(r.startsWith("data:")){let e=Math.floor(r.length*3/4);zt(e);let i=lc(r);return zt(i.length),i}if(r.startsWith("file:")){let e=new URL(r).pathname,i=await gi(e);return zt(i.length),i}if(r.startsWith("http://")||r.startsWith("https://")){let e=new AbortController,i=setTimeout(()=>e.abort(),xc);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 c=await a.arrayBuffer();return zt(c.byteLength),Buffer.from(c)}finally{clearTimeout(i)}}throw new C("IPC_BAD_REQUEST",`unsupported downloadUrl scheme (\u8981 https/data/file): ${r.slice(0,80)}`)}function zt(r){if(r>uc)throw new C("IPC_BAD_REQUEST",`skill too large: ${r} bytes`)}function lc(r){let e=/^data:([^,;]*)(;base64)?,(.*)$/s.exec(r);if(!e)throw new C("IPC_BAD_REQUEST","bad data URL");let i=!!e[2],a=e[3]??"";return i?Buffer.from(a,"base64"):Buffer.from(decodeURIComponent(a),"utf8")}function hc(r){return r.length>=2&&r[0]===31&&r[1]===139}async function gc(r,e){await pc(r),await new Promise((i,a)=>{let c=hi("tar",["-xzf","-","-C",e,"--strip-components=1","--no-same-owner"],{stdio:["pipe","pipe","pipe"]}),u="";c.stderr?.on("data",h=>{u+=String(h)});let f=setTimeout(()=>{c.kill("SIGKILL"),a(new C("IPC_BAD_REQUEST",`tar extract timeout (${_n}ms)`))},_n);c.on("error",h=>{clearTimeout(f),a(new C("IPC_BAD_REQUEST",`tar spawn failed: ${h.message}`,{cause:h}))}),c.on("exit",h=>{clearTimeout(f),h===0?i():a(new C("IPC_BAD_REQUEST",`tar exit ${h}${u?`: ${u.trim().slice(0,200)}`:""}`))}),c.stdin?.end(r)})}async function pc(r){let e=await new Promise((i,a)=>{let c=hi("tar",["-tzvf","-"],{stdio:["pipe","pipe","pipe"]}),u="",f="";c.stdout?.on("data",m=>{u+=String(m)}),c.stderr?.on("data",m=>{f+=String(m)});let h=setTimeout(()=>{c.kill("SIGKILL"),a(new C("IPC_BAD_REQUEST",`tar list timeout (${_n}ms)`))},_n);c.on("error",m=>{clearTimeout(h),a(new C("IPC_BAD_REQUEST",`tar list spawn failed: ${m.message}`))}),c.on("exit",m=>{clearTimeout(h),m===0?i(u):a(new C("IPC_BAD_REQUEST",`tar list exit ${m}${f?`: ${f.trim().slice(0,200)}`:""}`))}),c.stdin?.end(r)});for(let i of e.split(`
90
- `)){let a=i.trim();if(!a)continue;let c=a.charCodeAt(0);if(c!==45&&c!==100)throw new C("IPC_BAD_REQUEST",`tar entry kind '${a[0]}' not allowed (symlink/hardlink/special): ${a.slice(0,100)}`);let f=(a.match(/\s(\S.*)$/)?.[1]??"").split(" -> ")[0]?.trim()??"";if(!f)continue;if(f.startsWith("/"))throw new C("IPC_BAD_REQUEST",`tar entry absolute path: ${f}`);if(f.split(/[/\\]/).some(m=>m===".."))throw new C("IPC_BAD_REQUEST",`tar entry contains '..': ${f}`)}}async function _i(r,e,i,a){if(a<=0)return[];let c;try{c=await Q0(e,{withFileTypes:!0})}catch{return[]}let u=[];for(let f of c){if(oc.has(f.name)||f.isSymbolicLink())continue;let h=Pe(e,f.name),m=nc(Pe(i,f.name)),_=null;try{_=await Pr(h)}catch{continue}if(_.isSymbolicLink())continue;let y={name:f.name,path:wi(pi(r,h)),isDir:_.isDirectory(),size:_.size,modifiedAt:Math.floor(_.mtimeMs)};_.isDirectory()&&a>1&&(y.children=await _i(r,h,m,a-1)),u.push(y)}return u.sort((f,h)=>f.isDir!==h.isDir?f.isDir?-1:1:f.name.localeCompare(h.name)),u}function mc(r){return!r||r<=0?sc:Math.min(r,ic)}function _c(r){if(!r||r==="."||r==="/")return".";let e=r.split(/[/\\]/);return e[e.length-1]||"."}function wi(r){return r.split(mi).join("/")}K();import{readFileSync as yl}from"node:fs";import{dirname as vl,join as Sl}from"node:path";import{fileURLToPath as El}from"node:url";var wn="0.1.34";var qt=N("agent-health-reporter"),wc=1e4,yn=class{constructor(e){this.opts=e;this.intervalMs=e.intervalMs??wc}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()}),qt.info("heartbeat started",{intervalMs:this.intervalMs}),this.tick())}stop(){this.timer&&(clearInterval(this.timer),this.timer=null,this.unsubscribeRegister&&(this.unsubscribeRegister(),this.unsubscribeRegister=null),qt.info("heartbeat stopped"))}async tick(){if(this.inFlight){qt.debug("previous tick still in-flight, skip");return}let e=this.opts.getDeviceId();if(!e){qt.debug("deviceId not available, skip tick (\u5C1A\u672A pair)");return}this.inFlight=!0;try{let i=[];for(let c of this.opts.core.agents.values()){let u=yc(c);u&&i.push({agentId:c.agentId,status:u})}if(i.length===0)return;let a={agents:i,bridgeVersion:wn,_meta:{cozeDeviceId:e}};try{await this.opts.core.sendRequest("_agent/health",a)}catch(c){qt.warn("heartbeat batch send failed",{count:i.length,err:String(c)})}}finally{this.inFlight=!1}}};function yc(r){return r.status==="error"?"error":r.activeTriggers.size>0?"busy":r.status==="ok"?"online":null}Je();import{mkdir as Rr,rm as Vc}from"node:fs/promises";K();import{execFile as bc}from"node:child_process";import{promisify as vc}from"node:util";var bi=vc(bc),Ft=N("agents.acp-installer"),Sc={"claude-code":{npmPackage:"@agentclientprotocol/claude-agent-acp",binary:"claude-agent-acp"},codex:{npmPackage:"@zed-industries/codex-acp",binary:"codex-acp"}},Cc=5e4,Ec=5e3,Ac=5*6e4,vn=new Map,bn=new Map,Nr=new Map;async function yi(r){let e=process.platform==="win32"?"where":"which";try{let{stdout:i}=await bi(e,[r],{timeout:Ec});return i.split(`
91
- `)[0]?.trim()||void 0}catch{return}}async function kc(r){Ft.info("npm install -g start",{npmPackage:r}),await bi("npm",["install","-g",`${r}@latest`],{timeout:Cc,maxBuffer:10*1024*1024}),Ft.info("npm install -g done",{npmPackage:r})}async function vi(r){let e=Sc[r];if(!e)return;let i=vn.get(r);if(i)return i;let a=bn.get(r);if(a&&Date.now()-a<Ac)return;let c=Nr.get(r);if(c)return c;let u=(async()=>{let f=await yi(e.binary);if(f)return vn.set(r,f),Ft.info("acp wrapper found on PATH",{binary:e.binary,path:f}),f;try{await kc(e.npmPackage)}catch(m){Ft.warn("acp wrapper install failed (will fallback to npx)",{npmPackage:e.npmPackage,err:String(m)}),bn.set(r,Date.now());return}let h=await yi(e.binary);if(!h){Ft.warn("acp wrapper installed but binary not found on PATH",{binary:e.binary}),bn.set(r,Date.now());return}return vn.set(r,h),bn.delete(r),h})().finally(()=>{Nr.delete(r)});return Nr.set(r,u),u}function Sn(r){return vn.get(r)}import{spawn as Nc}from"node:child_process";function Ut(r,e,i){return i===void 0?{jsonrpc:"2.0",id:r,method:e}:{jsonrpc:"2.0",id:r,method:e,params:i}}function Cn(r,e){return e===void 0?{jsonrpc:"2.0",method:r}:{jsonrpc:"2.0",method:r,params:e}}function _t(r,e){return{jsonrpc:"2.0",id:r,result:e}}function rt(r,e){return{jsonrpc:"2.0",id:r,error:e}}var En=class extends Error{code;data;constructor(e){super(`JSON-RPC error code=${e.code} ${e.message}`),this.name="RemoteRpcError",this.code=e.code,e.data!==void 0&&(this.data=e.data)}},W={PARSE_ERROR:-32700,INVALID_REQUEST:-32600,METHOD_NOT_FOUND:-32601,INVALID_PARAMS:-32602,INTERNAL_ERROR:-32603,AGENT_NOT_FOUND:-32001,AGENT_BUSY:-32002,AGENT_TIMEOUT:-32003,AGENT_SPAWN_FAILED:-32004,OPERATION_NOT_ALLOWED_FOR_LOCAL:-32005,AGENT_DISCONNECTED:-32006,MODEL_TOKEN_GEN_FAILED:-32009};function Si(r){return"method"in r&&"id"in r&&r.id!==void 0}function Ci(r){return"method"in r&&!("id"in r)}function An(r){return!("method"in r)&&"id"in r}var Ic={AGENT_NOT_FOUND:W.AGENT_NOT_FOUND,AGENT_BUSY:W.AGENT_BUSY,AGENT_DISCONNECTED:W.AGENT_DISCONNECTED,AGENT_TIMEOUT:W.AGENT_TIMEOUT,AGENT_SPAWN_FAILED:W.AGENT_SPAWN_FAILED,AGENT_PROTOCOL_ERROR:W.INTERNAL_ERROR,BRIDGE_CONFIG_INVALID:W.INTERNAL_ERROR,BRIDGE_INTERNAL:W.INTERNAL_ERROR,IPC_AUTH_FAILED:W.INTERNAL_ERROR,IPC_BAD_REQUEST:W.INVALID_REQUEST,MODEL_TOKEN_GEN_FAILED:W.MODEL_TOKEN_GEN_FAILED,OPERATION_NOT_ALLOWED_FOR_LOCAL:W.OPERATION_NOT_ALLOWED_FOR_LOCAL,UPSTREAM_DISCONNECTED:W.INTERNAL_ERROR,UPSTREAM_HANDSHAKE_FAILED:W.INTERNAL_ERROR};function Kt(r){return r instanceof C?{code:Ic[r.code]??W.INTERNAL_ERROR,message:r.message,data:{bridgeCode:r.code,retriable:r.retriable}}:{code:W.INTERNAL_ERROR,message:r instanceof Error?r.message:String(r)}}function Ei(r){let e=r.data,i=e?.bridgeCode??"AGENT_PROTOCOL_ERROR";return new C(i,r.message,{retriable:e?.retriable??!1,cause:r.data})}function Ai(r){return`${JSON.stringify(r)}
92
- `}var kn=class{buffer="";onError;constructor(e={}){this.onError=e.onError}push(e){this.buffer+=typeof e=="string"?e:e.toString("utf8");let i=this.buffer.split(`
93
- `);this.buffer=i.pop()??"";let a=[];for(let c of i){let u=c.replace(/\r$/,"").trim();if(u)try{a.push(JSON.parse(u))}catch(f){this.onError?.({line:u,error:f})}}return a}flush(){if(!this.buffer)return[];let e=this.buffer.replace(/\r$/,"").trim();if(this.buffer="",!e)return[];try{return[JSON.parse(e)]}catch(i){return this.onError?.({line:e,error:i}),[]}}};var Ii={"session/prompt":"session.prompt","session/cancel":"session.cancel","session/new":"session.new","session/load":"session.load","_agent/create":"agent.create","_agent/health":"agent.health","_agent/pair":"agent.pair","_agent/listSkills":"agent.listSkills","_agent/addSkills":"agent.addSkills","_agent/removeSkills":"agent.removeSkills","_agent/getFileTree":"agent.getFileTree","_agent/getFileContent":"agent.getFileContent","_agent/detail":"agent.detail","_agent/update":"agent.update","_agent/disconnect":"agent.disconnect","_agent/switchModel":"agent.switchModel","_agent/genModelToken":"agent.genModelToken","_agent/reset":"agent.reset","_agent/repair":"agent.repair","session/request_permission":"session.requestPermission",initialize:"initialize"},Fl=Object.fromEntries(Object.entries(Ii).map(([r,e])=>[e,r])),Pc={"session.prompt":["agentId","triggerMsgId","sessionId"],"session.cancel":["agentId","triggerMsgId","sessionId"],"session.new":["agentId"],"session.load":["agentId"],"agent.create":["agentId"],"agent.health":[],"agent.listSkills":["agentId"],"agent.addSkills":["agentId"],"agent.removeSkills":["agentId"],"agent.getFileTree":["agentId"],"agent.getFileContent":["agentId"],"agent.detail":["agentId"],"agent.update":["agentId"],"agent.disconnect":["agentId"],"agent.switchModel":["agentId"],"agent.genModelToken":["agentId","sessionId"],"agent.reset":["agentId"],"agent.repair":["agentId"],"session.requestPermission":["agentId","sessionId"],"agent.pair":[],initialize:[]},wt=class{seq=0;next(e,i){this.seq+=1;let a=Ii[e]??Dc(e),c=Pc[a]??[],u=[a,String(this.seq)];if(c.length>0){let f=c.map(m=>ki(i?.[m]??"")),h=Tc(f).join(":");h&&u.push(h)}else i&&Object.values(i).some(f=>f)&&u.push(Object.values(i).filter(Boolean).map(f=>ki(String(f))).join(":"));return u.join("_")}reset(){this.seq=0}};function Dc(r){return r.replace(/[\s/]+/g,".").replace(/_+/g,"-")}function ki(r){return r.replace(/[:_\s]+/g,"-")}function Tc(r){let e=r.length;for(;e>0&&!r[e-1];)e-=1;return r.slice(0,e)}K();var Lc=3e4,Rc=50,Bc=20,Pi=500;function Mc(r){try{let e=JSON.stringify(r);return e===void 0||e.length<=Pi?r:`${e.slice(0,Pi)}...<truncated, total ${e.length} chars>`}catch{return"<unserializable>"}}function Di(r,e){if(!(typeof r!="number"||r<=0))try{process.platform==="win32"?process.kill(r,e):process.kill(-r,e)}catch{}}var Ve=class{constructor(e){this.opts=e;this.log=N(`downstream.${this.constructor.name}`),this.decoder=new kn({onError:i=>this.log.warn("decode line failed",{line:i.line})})}opts;child;decoder;pending=new Map;idAllocator=new wt;updateHandlers=[];agentRequestHandlers=[];exitHandlers=[];log;stopped=!1;stderrRing=[];sanitizeEnv(e){return e}async start(){if(this.child)throw new C("BRIDGE_INTERNAL","Downstream already started");let e=process.platform!=="win32",i=Nc(this.opts.command,this.opts.args,{cwd:this.opts.cwd,env:{...this.sanitizeEnv(process.env),...this.opts.env},stdio:["pipe","pipe","pipe"],detached:e});this.child=i,i.stdout?.setEncoding("utf8"),i.stdout?.on("data",a=>{for(let c of this.decoder.push(a))this.dispatch(c)}),i.stderr?.setEncoding("utf8"),i.stderr?.on("data",a=>{let c=a.trimEnd();this.stderrRing.push(c),this.stderrRing.length>Rc&&this.stderrRing.shift(),this.log.debug("stderr",{text:c})}),i.on("exit",(a,c)=>{this.stopped=!0,(a!==0||c!==null)&&this.stderrRing.length>0&&this.log.warn("downstream exited abnormally, recent stderr",{code:a,signal:c,recentStderr:this.stderrRing.slice(-Bc)}),this.failAllPending(new C("AGENT_PROTOCOL_ERROR",`agent exited (${a}/${c})`));for(let f of this.exitHandlers)f(a,c)}),i.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:i.pid,cwd:this.opts.cwd})}async stop(e){if(!this.child||this.stopped)return;this.stopped=!0,this.log.info("downstream stopping",{reason:e});let i=this.child,a=new Promise(u=>i.once("exit",()=>u()));Di(i.pid,"SIGTERM");let c=setTimeout(()=>{i.killed||Di(i.pid,"SIGKILL")},5e3);try{await a}finally{clearTimeout(c)}}pid(){return this.child?.pid}isAlive(){return!!this.child&&!this.stopped}initialize(e){return this.call("initialize",e)}sessionNew(e){return this.call("session/new",{mcpServers:[],...e})}sessionLoad(e){return this.call("session/load",{mcpServers:[],...e})}sessionPrompt(e){return this.call("session/prompt",e,0)}async sessionCancel(e){!this.child||this.stopped||this.writeFrame(Cn("session/cancel",e))}onUpdate(e){this.updateHandlers.push(e)}onAgentRequest(e){this.agentRequestHandlers.push(e)}respondAgentRequest(e,i){if(!(!this.child||this.stopped))try{this.writeFrame(_t(e,i))}catch(a){this.log.warn("respondAgentRequest write failed",{id:e,err:String(a)})}}respondAgentRequestError(e,i){if(!(!this.child||this.stopped))try{this.writeFrame(rt(e,i))}catch(a){this.log.warn("respondAgentRequestError write failed",{id:e,err:String(a)})}}onExit(e){this.exitHandlers.push(e)}call(e,i,a=Lc){if(!this.child||this.stopped)return Promise.reject(new C("AGENT_PROTOCOL_ERROR","downstream not started"));let c=this.idAllocator.next(e),u=Ut(c,e,i),f=a>0&&Number.isFinite(a);return new Promise((h,m)=>{let _=f?setTimeout(()=>{this.pending.delete(c),m(new C("AGENT_TIMEOUT",`${e} timed out after ${a}ms`))},a):null;this.pending.set(c,{resolve:h,reject:m,timer:_,method:e});try{this.writeFrame(u)}catch(y){_&&clearTimeout(_),this.pending.delete(c),m(y)}})}writeFrame(e){if(!this.child?.stdin||this.child.stdin.destroyed)throw new C("AGENT_PROTOCOL_ERROR","downstream stdin not writable");this.child.stdin.write(Ai(e))}dispatch(e){if(An(e)){let i=e.id!==null?this.pending.get(e.id):void 0;if(!i){this.log.warn("orphan response",{id:e.id});return}this.pending.delete(e.id),i.timer&&clearTimeout(i.timer),e.error?(this.log.warn("downstream returned error frame",{id:e.id,method:i.method,code:e.error.code,message:e.error.message,data:e.error.data}),i.reject(Ei(e.error))):(this.log.info("downstream returned result",{id:e.id,method:i.method,result:Mc(e.result)}),i.resolve(e.result));return}if(Ci(e)){if(e.method==="session/update")for(let i of this.updateHandlers)Promise.resolve(i(e.params)).catch(a=>this.log.warn("update handler failed",{err:String(a)}));else this.log.debug("unknown notification",{method:e.method});return}if(Si(e)){let i=e;this.handleAgentRequest(i).catch(a=>this.log.error("agent request handler failed",{method:i.method,err:String(a)}))}}async handleAgentRequest(e){if(this.agentRequestHandlers.length===0){this.writeFrame(rt(e.id,{code:-32601,message:`method not handled by Bridge: ${e.method}`}));return}for(let i of this.agentRequestHandlers)try{await i(e)}catch(a){this.log.error("agentRequestHandler threw",{method:e.method,err:String(a)});try{this.writeFrame(rt(e.id,Kt(a)))}catch{}}}failAllPending(e){for(let i of this.pending.values())i.timer&&clearTimeout(i.timer),i.reject(e);this.pending.clear()}};var Oc="@agentclientprotocol/claude-agent-acp@latest";function zc(r){let e={};for(let[i,a]of Object.entries(r))a!==void 0&&(i.startsWith("CLAUDE")||i==="AI_AGENT"||i==="BAGGAGE"||(e[i]=a));return e}var In=class extends Ve{framework="claude-code";constructor(e){let i=Sn("claude-code"),[a,c]=i?[i,[]]:["npx",["-y",Oc]],u=e.command??a,f=e.args??c,h={command:u,args:f,cwd:e.cwd,...e.env?{env:e.env}:{}};super(h)}sanitizeEnv(e){return zc(e)}};import{mkdtempSync as qc,rmSync as Fc}from"node:fs";import{tmpdir as Uc}from"node:os";import{join as Kc}from"node:path";var Gc="@zed-industries/codex-acp@latest",Pn=class extends Ve{framework="codex";authMethodId;codexHomeDir;constructor(e){let i=Sn("codex"),[a,c]=i?[i,[]]:["npx",["-y",Gc]],u=e.command??a,f=e.args??c,h=e.extraArgs?[...f,...e.extraArgs]:f,m=e.isolateCodexHome?qc(Kc(Uc(),"coze-bridge-codex-home-")):void 0,_=m?{...e.env??{},CODEX_HOME:m}:e.env,y={command:u,args:h,cwd:e.cwd,..._?{env:_}:{}};super(y),this.authMethodId=e.authMethodId,this.codexHomeDir=m}async initialize(e){let i=await super.initialize(e);return this.authMethodId&&await this.call("authenticate",{methodId:this.authMethodId}),i}async stop(e){if(await super.stop(e),this.codexHomeDir)try{Fc(this.codexHomeDir,{recursive:!0,force:!0})}catch{}}};var Gt=class extends Ve{framework="openclaw";agentId;sessionName;slashModelOnStart;constructor(e){let i=e.sessionName??"default",a=["acp","--session",`agent:${e.agentId}:${i}`];e.gatewayToken&&a.push("--token",e.gatewayToken);let c={command:e.command,args:a,cwd:e.cwd,...e.env?{env:e.env}:{}};super(c),this.agentId=e.agentId,this.sessionName=i,this.slashModelOnStart=e.slashModelOnStart}async afterSessionEstablished(e){this.slashModelOnStart&&(this.log.info("switching session to per-session provider via /model",{agentId:this.agentId,sessionName:this.sessionName,slash:this.slashModelOnStart}),await this.sessionPrompt({sessionId:e,prompt:[{type:"text",text:`/model ${this.slashModelOnStart}`}]}))}get acpSessionName(){return this.sessionName}};K();le();function Lr(r){return r.replace(/[^A-Za-z0-9._-]+/g,"-")}var yt=class{slots=[];running=!1;closed=!1;disposed=!1;enqueue(e){return this.disposed?Promise.reject(new Error("AsyncQueue disposed")):this.closed?Promise.reject(new Error("AsyncQueue closed")):new Promise((i,a)=>{this.slots.push({task:e,resolve:i,reject:a}),this.drain()})}close(){this.closed=!0}dispose(e=new Error("AsyncQueue disposed")){for(this.disposed=!0,this.closed=!0;this.slots.length>0;)this.slots.shift()?.reject(e)}get size(){return this.slots.length}get isRunning(){return this.running}async drain(){if(!this.running){this.running=!0;try{for(;this.slots.length>0&&!this.disposed;){let e=this.slots.shift();if(!e)break;try{let i=await e.task();e.resolve(i)}catch(i){e.reject(i)}}}finally{this.running=!1}}}};var Dn=class{agentId;framework;workspace;deployType;sessions=new Map;sessionQueues=new Map;activeTriggers=new Map;status="ok";model;lastActiveAt=Date.now();constructor(e){this.agentId=e.agentId,this.framework=e.framework,this.workspace=e.workspace,this.model=e.model,this.deployType=e.deployType??"local"}getSessionQueue(e){let i=this.sessionQueues.get(e);return i||(i=new yt,this.sessionQueues.set(e,i)),i}allSessionQueues(){return this.sessionQueues.entries()}async dispose(e){this.status="stopped";let i=new Error(`AgentSession disposed${e?`: ${e}`:""}`);for(let a of this.sessionQueues.values())a.dispose(i);this.sessionQueues.clear(),await this.killAllRuntimes(e??"dispose")}async killAllRuntimes(e){let i=[];for(let[,a]of this.sessions)Ht(a),a.downstream&&(i.push(a.downstream.stop(e).catch(()=>{})),a.downstream=void 0);await Promise.all(i),this.activeTriggers.clear()}};function Ht(r){r.idleTimer&&(clearTimeout(r.idleTimer),r.idleTimer=void 0)}import{spawn as Hc}from"node:child_process";import{homedir as jc}from"node:os";import{join as Wc}from"node:path";an();K();async function Li(){let r=Wc(jc(),".openclaw/openclaw.json");return(await gt(r))?.gateway?.auth?.token??""}var Ti=N("openclaw.config"),Jc=[0,5e3,5e3],Ni="models.providers.",Tn="agents.defaults.models",Nn=class{command;env;retryDelaysMs;queue=new yt;constructor(e){this.command=e.command,this.env=e.env??process.env,this.retryDelaysMs=e.retryDelaysMs??Jc}async withRetry(e,i){let a;for(let c=0;c<this.retryDelaysMs.length;c++){let u=this.retryDelaysMs[c]??0;u>0&&await new Promise(f=>setTimeout(f,u));try{return await i()}catch(f){a=f,Ti.warn("openclaw cli failed, will retry",{label:e,attempt:c+1,err:String(f)})}}throw new C("AGENT_SPAWN_FAILED",`openclaw cli ${e} failed after ${this.retryDelaysMs.length} attempts: ${a?.message??"unknown"}`)}runCli(e){return new Promise((i,a)=>{let c=Hc(this.command,e,{stdio:["ignore","pipe","pipe"],env:this.env}),u="";c.stderr?.on("data",f=>{u+=f.toString("utf8")}),c.on("error",a),c.on("close",f=>{f===0?i():a(new Error(`exit ${f}: ${u.trim().slice(0,500)}`))})})}async runCliTolerant(e,i){try{await this.runCli(e)}catch(a){let c=String(a);if(i.some(u=>c.includes(u)))return;throw a}}async bestEffortUnset(e,i){try{await this.queue.enqueue(()=>this.withRetry(e,()=>this.runCli(["config","unset",i])))}catch(a){Ti.warn(`${e} failed (best-effort)`,{configPath:i,err:String(a)})}}ensureProvider(e,i){return this.queue.enqueue(()=>this.withRetry(`config set models.providers.${e}`,()=>this.runCli(["config","set",`${Ni}${e}`,JSON.stringify(i),"--strict-json","--merge"])))}removeProvider(e){return this.bestEffortUnset(`config unset models.providers.${e}`,`${Ni}${e}`)}addModelToAllowlist(e,i){let a={[e]:i?{alias:i}:{}};return this.queue.enqueue(()=>this.withRetry(`config set ${Tn}[${e}]`,()=>this.runCli(["config","set",Tn,JSON.stringify(a),"--strict-json","--merge"])))}removeModelFromAllowlist(e){return this.bestEffortUnset(`config unset ${Tn}[${e}]`,`${Tn}.${e}`)}ensureAgent(e,i,a){let c=["agents","add",e,"--workspace",i,"--non-interactive"];return a&&c.push("--model",a),this.queue.enqueue(()=>this.withRetry(`agents add ${e}`,()=>this.runCliTolerant(c,["already exists","already registered"])))}deleteAgent(e){return this.queue.enqueue(()=>this.withRetry(`agents delete ${e}`,()=>this.runCliTolerant(["agents","delete",e,"--force"],["not found","does not exist"])))}};var De=N("agent-manager"),Xc=(r,e,i,a,c,u,f)=>{switch(r){case"claude-code":{let h=c?{...oi(c),...xi(c,f)}:void 0;return new In({cwd:i,...h&&Object.keys(h).length>0?{env:h}:{}})}case"codex":{let h=c?[...ai(c),...fi(c,f)]:[],m=c?ci(c):void 0,_=!!c;return new Pn({cwd:i,...h.length>0?{extraArgs:h}:{},...m&&Object.keys(m).length>0?{env:m}:{},..._?{authMethodId:"openai-api-key",isolateCodexHome:!0}:{}})}case"openclaw":return new Gt({command:e,cwd:i,agentId:a,...u?{sessionName:Lr(u)}:{}})}};function Ri(r){return r==="claude-code"||r==="codex"}var Yc={path:"",version:"cloud-deployed"},$c={protocolVersion:1,clientCapabilities:{fs:{readTextFile:!0,writeTextFile:!0}}},Zc=6e4,Ln=class{paths;config;registry;factory;createTimeoutMs;openclawConfigCache;ensuredProviders=new Set;constructor(e){this.paths=e.paths,this.config=e.config,this.registry=e.registry,this.factory=e.downstreamFactory??Xc,this.createTimeoutMs=e.createTimeoutMs??Zc}getOpenclawConfig(){if(!this.openclawConfigCache){let e=this.config.frameworksCache?.openclaw;if(!e?.path)throw new C("AGENT_SPAWN_FAILED","openclaw binary not detected on this machine");this.openclawConfigCache=new Nn({command:e.path})}return this.openclawConfigCache}async createAgent(e){if(!e.agentId)throw new C("IPC_BAD_REQUEST","agentId required");if(!e.framework)throw new C("IPC_BAD_REQUEST","framework required");let i=Ot(e._meta)==="cloud";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")De.warn("existing agent in error state, rebuilding",{agentId:e.agentId}),await a.dispose("rebuild after error").catch(S=>De.warn("dispose stale agent failed (ignored)",{err:String(S)})),this.registry.unregister(e.agentId);else return De.info("agent already exists, return current",{agentId:e.agentId}),{ok:!0,agentId:a.agentId,workspace:a.workspace,framework:a.framework}}if(!i&&!this.config.frameworksCache?.[e.framework])throw new C("AGENT_SPAWN_FAILED",`framework ${e.framework} not detected on this machine; rerun daemon to refresh frameworks_cache`);i&&Ri(e.framework)&&await vi(e.framework);let u=ze(e.agentId,this.paths),f=e.workspace??u.workspace,h=Ot(e._meta),m=new AbortController,_=setTimeout(()=>m.abort(new C("AGENT_TIMEOUT",`_agent/create timed out after ${this.createTimeoutMs}ms`)),this.createTimeoutMs),y,v=!1;try{let S=()=>{if(m.signal.aborted)throw m.signal.reason instanceof Error?m.signal.reason:new C("AGENT_TIMEOUT","_agent/create aborted")};await Rr(u.root,{recursive:!0}),await Rr(f,{recursive:!0}),await Rr(u.logs,{recursive:!0}),S(),await pt(f,e.framework,e.agentId,e.cozeIdentity),S();let A=await he(e.agentId,this.paths).catch(()=>null),D=si({model:e.model??A?.model});if(y=new Dn({agentId:e.agentId,framework:e.framework,workspace:f,model:D.model??Ie,deployType:h}),y.status="ok",A?.sessions){for(let[oe,ee]of Object.entries(A.sessions))y.sessions.set(oe,{acpSessionId:ee.acpSessionId,modelToken:ee.modelToken,tokenGeneratedAt:ee.tokenGeneratedAt,lastActiveAt:Date.now(),loadingSession:!1,replySeq:0});let $=Object.keys(A.sessions).length;$>0&&De.info("restored persisted session records (no spawn)",{agentId:e.agentId,count:$})}this.registry.register(y),v=!0;let L={agentId:e.agentId,framework:e.framework,workspace:f,cozeIdentity:e.cozeIdentity,createdAt:A?.createdAt??Date.now(),sessions:A?.sessions??{},model:D.model};h==="cloud"&&(L.deployType="cloud"),A?.skills&&(L.skills=A.skills),A?.agentName&&(L.agentName=A.agentName),A?.description&&(L.description=A.description),e.framework==="openclaw"&&(this.config.frameworksCache?.openclaw?.path?await this.getOpenclawConfig().ensureAgent(e.agentId,f):De.warn("openclaw binary not on this machine, skip agents add (will fail at session/prompt)",{agentId:e.agentId}));let F=e.initialSkills??[];if(F.length>0){let $=[...L.skills??[]],oe=new Map($.map((Z,P)=>[Z.skillId,P])),ee=0;for(let Z of F)try{let P=await Dr({agentId:e.agentId,workspace:f,framework:e.framework,skill:Z});Tr($,oe,P),ee++}catch(P){De.warn("initialSkill install failed (skipping)",{agentId:e.agentId,skillId:Z.skillId,skillName:Z.skillName,err:String(P)})}ee>0&&(L.skills=$,De.info("initialSkills installed",{agentId:e.agentId,installed:ee,requested:F.length}))}return await be(L,this.paths),De.info("agent created (no spawn, lazy on first prompt)",{agentId:e.agentId,framework:e.framework,deployType:h}),{ok:!0,agentId:e.agentId,workspace:f,framework:e.framework}}catch(S){throw De.error("agent create failed, rolling back",{agentId:e.agentId,err:String(S)}),v&&y&&(await y.dispose("rollback").catch(()=>{}),this.registry.unregister(e.agentId)),await Vc(u.root,{recursive:!0,force:!0}).catch(A=>De.warn("rm agent dir failed (ignored)",{err:String(A)})),S instanceof C?S:new C("AGENT_SPAWN_FAILED",String(S),{cause:S})}finally{clearTimeout(_)}}async spawnSessionDownstream(e,i,a,c){let f=this.config.frameworksCache?.[e.framework];if(!f)if(e.deployType==="cloud"&&Ri(e.framework))f=Yc;else throw new C("AGENT_SPAWN_FAILED",`framework ${e.framework} not detected on this machine`);let h=e.deployType==="cloud"?{model:e.model,modelToken:i}:void 0,m;e.framework==="openclaw"?m=await this.buildOpenclawDownstream({session:e,modelConfig:h,cloudSessionId:a,cozeEnv:c,command:f.path}):m=this.factory(e.framework,f.path,e.workspace,e.agentId,h,a,c);try{return await m.start(),await m.initialize($c),m}catch(_){throw await m.stop("spawnSessionDownstream failed").catch(()=>{}),_ instanceof C?_:new C("AGENT_SPAWN_FAILED",_ instanceof Error?_.message:String(_),{cause:_})}}async buildOpenclawDownstream(e){let{session:i,modelConfig:a,cloudSessionId:c,cozeEnv:u,command:f}=e,h=Lr(c),m=await Li(),_=a?ui(a,u):null,y;if(_){let v=Ir(c),A=_.models[0]?.id??Ie,D=`${v}/${A}`;if(!this.ensuredProviders.has(D)){let L=this.getOpenclawConfig();await L.ensureProvider(v,_),await L.addModelToAllowlist(D),this.ensuredProviders.add(D)}y=D}return new Gt({command:f,cwd:i.workspace,agentId:i.agentId,sessionName:h,...m?{gatewayToken:m}:{},...y?{slashModelOnStart:y}:{}})}async openclawRepair(e,i){let a=this.getOpenclawConfig();await a.deleteAgent(e),await a.ensureAgent(e,i)}async cleanupOpenclawSessionProviders(e){if(e.framework!=="openclaw"||!this.openclawConfigCache)return;let i=this.openclawConfigCache;for(let a of e.sessions.keys()){let c=Ir(a),u=`${c}/${e.model}`;this.ensuredProviders.delete(u),await i.removeProvider(c),await i.removeModelFromAllowlist(u)}}};K();import{execFile as Qc}from"node:child_process";import{promisify as ex}from"node:util";var tx=ex(Qc),Xe=N("coze-cli-installer"),Bi="@coze/cli@0.1.3-alpha.89c42a",Mi="https://bnpm.byted.org",nx="coze",rx=5e3,sx=9e4,Oi=1e4,jt=null,Br=!1;async function zi(r,e={}){if(Br)return;if(jt)return jt;let i=e.exec??tx;return jt=(async()=>{try{let a=await ix(nx,i);if(a){Xe.info("coze-cli already on PATH, skip install + config + auth",{path:a}),Br=!0;return}Xe.info("coze-cli install start",{package:Bi,registry:Mi});try{await i("npm",["i","-g",Bi,"--registry",Mi],{timeout:sx,maxBuffer:10*1024*1024}),Xe.info("coze-cli install ok")}catch(c){Xe.warn("coze-cli install failed (skip subsequent steps)",{err:String(c)});return}if(r.env)try{await i("coze",["config","set","xTTEnv",r.env],{timeout:Oi}),Xe.info("coze config set xTTEnv ok",{env:r.env})}catch(c){Xe.warn("coze config set failed (continue to auth login)",{err:String(c)})}try{await i("coze",["auth","login","--token",r.patToken],{timeout:Oi}),Xe.info("coze auth login ok")}catch(c){Xe.warn("coze auth login failed",{err:String(c)});return}Br=!0}finally{jt=null}})(),jt}async function ix(r,e){let i=process.platform==="win32"?"where":"which";try{let{stdout:a}=await e(i,[r],{timeout:rx});return a.split(`
94
- `)[0]?.trim()||void 0}catch{return}}K();import{spawn as ox}from"node:child_process";import{constants as qi,access as ax}from"node:fs/promises";import{delimiter as cx,join as xx}from"node:path";var ux=N("framework-detector"),Fi={"claude-code":"claude",codex:"codex",openclaw:"openclaw"},fx=[".exe",".cmd",".bat",".ps1"],bt=class{env;constructor(e={}){this.env={pathEnv:e.pathEnv??process.env.PATH??"",platform:e.platform??process.platform,spawn:e.spawn??ox,access:e.access??ax}}async detect(e){let i=Fi[e],a=await this.which(i);if(!a)return ux.debug("framework binary not found",{framework:e,bin:i}),null;let c=await this.probeVersion(a);return{path:a,version:c}}async detectAll(){let e=await Promise.all(Object.keys(Fi).map(async a=>[a,await this.detect(a)])),i={};for(let[a,c]of e)c&&(i[a]=c);return i}async which(e){let i=this.env.pathEnv.split(cx).filter(Boolean),a=this.env.platform==="win32"?["",...fx]:[""];for(let c of i)for(let u of a){let f=xx(c,e+u);if(await this.isExecutable(f))return f}return null}async isExecutable(e){try{let i=this.env.platform==="win32"?qi.F_OK:qi.X_OK;return await this.env.access(e,i),!0}catch{return!1}}async probeVersion(e){return new Promise(i=>{let a="",c=!1,u,f=h=>{c||(c=!0,u&&clearTimeout(u),i(h.trim()||"unknown"))};try{let h=this.env.spawn(e,["--version"],{stdio:["ignore","pipe","pipe"]});u=setTimeout(()=>{h.kill("SIGKILL"),f("unknown")},5e3),h.stdout?.on("data",m=>{a+=m.toString("utf8")}),h.on("error",()=>f("unknown")),h.on("close",()=>{let m=lx(a).split(/\r?\n/)[0]??"";f(m)})}catch{f("unknown")}})}},dx=new RegExp("\x1B\\[[0-9;]*[A-Za-z]","g");function lx(r){return r.replace(dx,"")}an();le();var hx=10*6e4;function Ui(r){let e=r?.sessionIdleTimeoutMs;return typeof e!="number"||!Number.isFinite(e)||e<=0?hx:e}function Rn(r){return gt(r??H().configFile)}function vt(r,e){return on(e??H().configFile,r)}import{randomBytes as Cx}from"node:crypto";import{mkdir as gx,readFile as px,realpath as mx,writeFile as _x}from"node:fs/promises";import{basename as yx,dirname as Mr,join as bx,relative as vx,resolve as Ki,sep as Sx}from"node:path";K();var Hi=N("fs-rpc");async function ji(r,e){let i=await Ji(r.path,e);return await gx(Mr(i),{recursive:!0}),await _x(i,r.content,"utf8"),Hi.info("fs/write_text_file ok",{path:i,size:r.content.length}),null}async function Wi(r,e){let i=await Ji(r.path,e),a=await px(i,"utf8"),c=a;if(typeof r.line=="number"||typeof r.limit=="number"){let u=a.split(`
95
- `),f=Math.max(0,(r.line??1)-1),h=typeof r.limit=="number"?f+r.limit:void 0;c=u.slice(f,h).join(`
96
- `)}return Hi.info("fs/read_text_file ok",{path:i,size:c.length}),{content:c}}async function Ji(r,e){if(typeof r!="string"||r.length===0)throw new C("IPC_BAD_REQUEST","path must be a non-empty string");let[i,a]=await Promise.all([Gi(Ki(e)),Gi(Ki(r))]),c=vx(i,a);if(c.startsWith("..")||c===".."||c.startsWith(`..${Sx}`))throw new C("IPC_BAD_REQUEST",`path escapes workspace: ${r}`);return a}async function Gi(r){let e=[],i=r;for(;i!==Mr(i);)try{let a=await mx(i);return e.length?bx(a,...e.reverse()):a}catch{e.push(yx(i)),i=Mr(i)}return r}Je();K();var O=N("core"),Ex=3e4,Ax=3e4,Bn=class{upstream;agents=new Map;disconnectedAgents=new Set;extensions;paths;sessionSpawner;sessionIdleTimeoutMs;upstreamIds=new wt;pendingUpstream=new Map;pendingBridge=new Map;currentCozeEnv;constructor(e){this.upstream=e.upstream,this.extensions=e.extensions??{},this.paths=e.paths,this.sessionSpawner=e.sessionSpawner,this.sessionIdleTimeoutMs=Ui(e.bridgeConfig)}registerExtension(e,i){this.extensions[e]=i}getCozeEnv(){return this.currentCozeEnv}async start(){this.upstream.onFrame(e=>this.handleFrame(e)),await this.upstream.start(),O.info("Core started",{extensions:Object.keys(this.extensions)})}async stop(e){O.info("Core stopping",{reason:e}),await Promise.all([...this.agents.values()].map(i=>i.dispose(e))),this.agents.clear(),await this.upstream.stop(e)}get(e){return this.agents.get(e)}register(e){this.agents.set(e.agentId,e),O.info("agent registered",{agentId:e.agentId,framework:e.framework});for(let i of this.registerHandlers)try{i(e.agentId)}catch(a){O.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)&&O.info("agent revived from disconnect",{agentId:e})}attachRuntimeHooks(e,i,a){let c=a.downstream;c&&(c.onUpdate(u=>{a.loadingSession||this.forwardUpdate(e,u)}),c.onAgentRequest(u=>{this.handleAgentRequest(e,c,u)}),c.onExit((u,f)=>{O.info("session runtime exited",{agentId:e.agentId,cloudId:i,code:u,signal:f}),Ht(a),a.downstream=void 0,a.acpSessionId&&e.activeTriggers.delete(a.acpSessionId)}))}async handleFrame(e){if(An(e)){this.handleUpstreamResponse(e);return}if(!("method"in e)||typeof e.method!="string")return;let i="id"in e&&e.id!==void 0?e.id:null,a=e.params?._meta?.cozeEnv;a&&(this.currentCozeEnv=a);try{if(e.method.startsWith("_agent/")){let c=this.extensions[e.method];if(!c){i!==null?await this.sendError(i,W.METHOD_NOT_FOUND,`extension not registered: ${e.method}`):O.warn("drop notification: extension not registered",{method:e.method});return}let u=await c(e,this);i!==null&&await this.upstream.send(_t(i,u));return}if(e.method.startsWith("session/")){let c=await this.routeSessionMethod(e);i!==null&&await this.upstream.send(_t(i,c));return}if(e.method==="initialize"){i!==null&&await this.upstream.send(_t(i,{protocolVersion:1,agentCapabilities:{loadSession:!0}}));return}i!==null?await this.sendError(i,W.METHOD_NOT_FOUND,`method not implemented: ${e.method}`):O.warn("drop unknown notification",{method:e.method})}catch(c){O.error("handleFrame failed",{method:e.method,err:String(c)}),i!==null&&await this.upstream.send(rt(i,Kt(c)))}}async routeSessionMethod(e){if(!e.params||typeof e.params!="object")throw new C("IPC_BAD_REQUEST",`${e.method} requires params`);let i=e.params,a=i._meta?.cozeAgentId;if(!a)throw new C("IPC_BAD_REQUEST",`${e.method}: missing _meta.cozeAgentId`);let c=this.agents.get(a);if(!c)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}`);let u=typeof i.sessionId=="string"?i.sessionId:void 0;if(e.method==="session/cancel"||e.method==="session/new"||!u)return this.dispatchSessionCall(c,e.method,i);let f=Date.now(),h=!1;try{let m=await c.getSessionQueue(u).enqueue(()=>this.dispatchSessionCall(c,e.method,i));return h=!0,m}finally{O.info("session call done",{agentId:c.agentId,method:e.method,durationMs:Date.now()-f,ok:h})}}async dispatchSessionCall(e,i,a){e.lastActiveAt=Date.now();let{stripped:c}=Xs(a);switch(i){case"session/new":{let u=kx();return O.info("session/new ack (lazy spawn)",{agentId:e.agentId,cloudId:u}),{sessionId:u}}case"session/load":{let u=c;return O.info("session/load ack (lazy spawn)",{agentId:e.agentId,cloudId:u.sessionId}),{}}case"session/prompt":{let u=c,f=u.sessionId;if(!f)throw new C("IPC_BAD_REQUEST","session/prompt: missing sessionId");let h=await this.ensureRuntime(e,f);if(h.replySeq=0,await this.ensureDownstream(e,f,h),!h.downstream||!h.acpSessionId)throw new C("BRIDGE_INTERNAL","session runtime not ready after ensureDownstream");let m=a._meta?.cozeTriggerMsgId;m?e.activeTriggers.set(h.acpSessionId,m):e.activeTriggers.delete(h.acpSessionId);try{let _=await h.downstream.sessionPrompt({...u,sessionId:h.acpSessionId});return h.lastActiveAt=Date.now(),_}finally{e.activeTriggers.delete(h.acpSessionId),h.downstream?.isAlive()&&this.armIdleTimer(e,f,h)}}case"session/cancel":{let f=c.sessionId;if(!f)throw new C("IPC_BAD_REQUEST","session/cancel: missing sessionId");let h=e.sessions.get(f);return h?.downstream?.isAlive()&&h.acpSessionId&&await h.downstream.sessionCancel({sessionId:h.acpSessionId}),{ok:!0}}default:throw new C("IPC_BAD_REQUEST",`session method not supported: ${i}`)}}async ensureRuntime(e,i){let a=e.sessions.get(i);if(a)return a;let u={modelToken:e.deployType==="cloud"?await this.requestSessionToken(e.agentId,i):"",tokenGeneratedAt:Date.now(),lastActiveAt:Date.now(),loadingSession:!1,replySeq:0};return e.sessions.set(i,u),await this.persistSessionMapping(e),u}async requestSessionToken(e,i){let a={sessionId:i,_meta:{cozeAgentId:e}};try{let c=await this.sendRequest(ke.GEN_MODEL_TOKEN,a,Ax);if(!c?.modelToken)throw new C("MODEL_TOKEN_GEN_FAILED",`cloud returned empty modelToken (agentId=${e}, cloudSessionId=${i})`);return c.modelToken}catch(c){throw c instanceof C&&c.code==="MODEL_TOKEN_GEN_FAILED"?c:new C("MODEL_TOKEN_GEN_FAILED",c instanceof Error?c.message:String(c),{cause:c})}}async ensureDownstream(e,i,a){if(Ht(a),a.downstream?.isAlive())return;if(!this.sessionSpawner)throw new C("AGENT_SPAWN_FAILED","sessionSpawner not wired (cannot spawn per-session downstream)");let c=await this.sessionSpawner(e,a.modelToken,i,this.currentCozeEnv);if(a.downstream=c,this.attachRuntimeHooks(e,i,a),a.acpSessionId){a.loadingSession=!0;try{await c.sessionLoad({sessionId:a.acpSessionId,cwd:e.workspace}),O.info("session restored via session/load",{agentId:e.agentId,cloudId:i,acpId:a.acpSessionId})}catch(u){O.warn("session/load failed, fallback to session/new",{agentId:e.agentId,cloudId:i,acpId:a.acpSessionId,err:String(u)}),a.acpSessionId=void 0;let f=await c.sessionNew({cwd:e.workspace});a.acpSessionId=f.sessionId,await this.persistSessionMapping(e)}finally{a.loadingSession=!1}}else{let u=await c.sessionNew({cwd:e.workspace});a.acpSessionId=u.sessionId,await this.persistSessionMapping(e)}c.afterSessionEstablished&&a.acpSessionId&&await c.afterSessionEstablished(a.acpSessionId)}armIdleTimer(e,i,a){if(Ht(a),this.isRuntimeBusy(e,a)){O.debug("skip idle timer: runtime busy (in-flight turn / pending permission)",{agentId:e.agentId,cloudId:i});return}a.idleTimer=setTimeout(()=>{if(a.idleTimer=void 0,this.isRuntimeBusy(e,a)){O.info("idle reaper fired but runtime busy, re-arming",{agentId:e.agentId,cloudId:i}),this.armIdleTimer(e,i,a);return}O.info("session runtime idle timeout, killing downstream",{agentId:e.agentId,cloudId:i});let c=a.downstream;a.downstream=void 0,a.acpSessionId&&e.activeTriggers.delete(a.acpSessionId),c&&c.stop("idle timeout").catch(u=>O.warn("idle stop failed (ignored)",{agentId:e.agentId,cloudId:i,err:String(u)}))},this.sessionIdleTimeoutMs),a.idleTimer.unref?.()}isRuntimeBusy(e,i){if(i.acpSessionId&&e.activeTriggers.has(i.acpSessionId))return!0;let a=i.downstream;if(!a)return!1;for(let c of this.pendingUpstream.values())if(c.downstream===a)return!0;return!1}forwardUpdate(e,i){let a=i.sessionId,c=this.reverseSessionId(e,a);if(!c){O.debug("drop update for unknown session",{agentId:e.agentId,acpId:a});return}let u=e.sessions.get(c);if(!u){O.debug("drop update: runtime gone",{agentId:e.agentId,cloudId:c});return}if(Ix(i)){O.debug("drop codex metadata-warn chunk",{agentId:e.agentId,acpId:a});return}let f={cozeAgentId:e.agentId,cozeReplySeqID:++u.replySeq},h=e.activeTriggers.get(a);h&&(f.cozeTriggerMsgId=h),this.upstream.send(Cn("session/update",{...i,sessionId:c,_meta:f})).catch(m=>O.warn("forward update failed",{agentId:e.agentId,err:String(m)}))}handleAgentRequest(e,i,a){if(a.method==="session/request_permission"){this.forwardPermissionRequest(e,i,a);return}if(a.method==="fs/write_text_file"||a.method==="fs/read_text_file"){this.handleFsRpcRequest(e,i,a);return}O.warn("unhandled agent request,returning method_not_found",{agentId:e.agentId,method:a.method}),i.respondAgentRequestError(a.id,{code:W.METHOD_NOT_FOUND,message:`method not handled by Bridge: ${a.method}`})}async handleFsRpcRequest(e,i,a){try{let c=e.workspace;if(a.method==="fs/write_text_file"){let u=a.params??{},f=await ji(u,c);i.respondAgentRequest(a.id,f)}else{let u=a.params??{},f=await Wi(u,c);i.respondAgentRequest(a.id,f)}}catch(c){O.warn("fs rpc handler failed",{agentId:e.agentId,method:a.method,err:String(c)}),i.respondAgentRequestError(a.id,Kt(c))}}forwardPermissionRequest(e,i,a){let c=this.upstreamIds.next("session/request_permission"),u=a.params??{},h=u.sessionId,m=h?e.activeTriggers.get(h):void 0,_={cozeAgentId:e.agentId};m&&(_.cozeTriggerMsgId=m);let y=h?this.reverseSessionId(e,h):void 0,v={...u,...y?{sessionId:y}:{},_meta:_};this.pendingUpstream.set(c,{agentRequestId:a.id,agentId:e.agentId,downstream:i,method:a.method}),O.info("forward permission_request \u2192 upstream",{agentId:e.agentId,upstreamId:c,acpSessionId:h,cloudSessionId:y,toolCallId:u.toolCall?.toolCallId,options:u.options?.map(S=>({optionId:S.optionId,kind:S.kind,name:S.name}))}),this.upstream.send(Ut(c,"session/request_permission",v)).catch(S=>{this.pendingUpstream.delete(c),O.error("forward permission request failed",{agentId:e.agentId,err:String(S)}),i.respondAgentRequestError(a.id,{code:W.INTERNAL_ERROR,message:`upstream send failed: ${String(S)}`})})}handleUpstreamResponse(e){if(e.id===null)return;let i=this.pendingUpstream.get(e.id);if(i){this.pendingUpstream.delete(e.id),e.error?(O.info("upstream \u2192 permission response (error)",{agentId:i.agentId,upstreamId:e.id,method:i.method,error:e.error}),i.downstream.respondAgentRequestError(i.agentRequestId,e.error)):(O.info("upstream \u2192 permission response (result)",{agentId:i.agentId,upstreamId:e.id,method:i.method,result:e.result}),i.downstream.respondAgentRequest(i.agentRequestId,e.result));return}let a=this.pendingBridge.get(e.id);if(a){this.pendingBridge.delete(e.id),clearTimeout(a.timer),e.error?a.reject(new En(e.error)):a.resolve(e.result);return}O.debug("orphan upstream response (no pending)",{id:e.id})}sendRequest(e,i,a=Ex){let c=this.upstreamIds.next(e);return new Promise((u,f)=>{let h=setTimeout(()=>{this.pendingBridge.delete(c),f(new C("AGENT_TIMEOUT",`${e} timed out after ${a}ms`))},a);this.pendingBridge.set(c,{method:e,resolve:u,reject:f,timer:h}),this.upstream.send(Ut(c,e,i)).catch(m=>{let _=this.pendingBridge.get(c);_&&(clearTimeout(_.timer),this.pendingBridge.delete(c)),f(m)})})}async persistSessionMapping(e){if(this.paths)try{let i=new Map;for(let[a,c]of e.sessions){let u={modelToken:c.modelToken,tokenGeneratedAt:c.tokenGeneratedAt};c.acpSessionId&&(u.acpSessionId=c.acpSessionId),i.set(a,u)}await Er(e.agentId,i,this.paths)}catch(i){O.warn("persist session mapping failed",{agentId:e.agentId,err:String(i)})}}reverseSessionId(e,i){for(let[a,c]of e.sessions.entries())if(c.acpSessionId===i)return a}sendError(e,i,a){return this.upstream.send(rt(e,{code:i,message:a}))}};function kx(){return Cx(16).toString("hex")}function Ix(r){let e=r.update;if(e?.sessionUpdate!=="agent_message_chunk")return!1;let i=e.content;if(!i||typeof i!="object")return!1;let a=i;return a.type!=="text"||typeof a.text!="string"?!1:a.text.startsWith("Model metadata for `")}K();le();import{randomBytes as Px}from"node:crypto";import{chmod as Dx,mkdir as Tx,writeFile as Vi}from"node:fs/promises";import{createServer as Nx}from"node:http";import{dirname as Lx}from"node:path";var Rx=1e6,Or=N("ipc"),Mn=class{server=null;port=0;token="";routes;paths;constructor(e){this.routes=new Map(e.routes.map(i=>[`${i.method} ${i.path}`,i])),this.paths=e.paths??H()}async start(){this.token=Px(32).toString("hex");let e=Nx((a,c)=>{this.dispatch(a,c)});this.server=e,await new Promise((a,c)=>{e.once("error",c),e.listen(0,"127.0.0.1",()=>a())});let i=e.address();if(!i||typeof i!="object")throw new Error("failed to obtain IPC port");return this.port=i.port,await this.persistAuthFiles(),Or.info("IPC listening",{port:this.port}),{port:this.port,token:this.token}}async stop(){let e=this.server;e&&(await new Promise((i,a)=>{e.close(c=>c?a(c):i())}),this.server=null)}async persistAuthFiles(){await Tx(Lx(this.paths.portFile),{recursive:!0}),await Vi(this.paths.portFile,String(this.port),"utf8"),await Vi(this.paths.tokenFile,this.token,{encoding:"utf8",mode:384});try{await Dx(this.paths.tokenFile,384)}catch(e){Or.warn("chmod token file failed (non-POSIX?)",{err:String(e)})}}async dispatch(e,i){if(e.headers.authorization!==`Bearer ${this.token}`){Wt(i,401,{error:"unauthorized"});return}let c=`${e.method} ${(e.url??"").split("?")[0]}`,u=this.routes.get(c);if(!u){Wt(i,404,{error:"not found"});return}let f=null;if(e.method==="POST")try{f=await Bx(e)}catch(h){Wt(i,400,{error:"invalid json",detail:String(h)});return}try{let h=await u.handler(f,e);Wt(i,200,h??{ok:!0})}catch(h){Or.error("IPC handler failed",{key:c,err:String(h)}),Wt(i,500,{error:h instanceof Error?h.message:String(h)})}}};function Wt(r,e,i){r.statusCode=e,r.setHeader("content-type","application/json"),r.end(JSON.stringify(i))}async function Bx(r){let e=[],i=0;for await(let c of r){let u=c;if(i+=u.length,i>Rx)throw new Error("body too large");e.push(u)}let a=Buffer.concat(e).toString("utf8");return a?JSON.parse(a):null}var ma=Oe(io(),1);var pf=Oe(ta(),1),mf=Oe(Zn(),1),_f=Oe(Et(),1),wf=Oe(Yr(),1),yf=Oe(Qr(),1),bf=Oe(is(),1),ua=Oe(nr(),1),vf=Oe(xa(),1);var fa=ua.default;K();var ie=N("upstream.frontier"),la="application/json",ha="none",sr=class{constructor(e){this.opts=e}opts;fws=null;handler=null;connectHandler=null;opened=!1;openCount=0;async start(){if(this.fws){ie.warn("start called on already-started FrontierUpstream; noop");return}let e={Authorization:`Bearer ${this.opts.privatecode}`,Origin:Zs,...gn(this.opts.ppeOverride)};class i extends fa{constructor(h){super(h,$s,{headers:e})}send(h,...m){if(Js("debug"))try{let _;typeof h=="string"?_=Buffer.from(h,"utf8"):h instanceof Buffer?_=h:h instanceof ArrayBuffer?_=new Uint8Array(h):ArrayBuffer.isView(h)?_=new Uint8Array(h.buffer,h.byteOffset,h.byteLength):_=new Uint8Array(0);let y=Buffer.from(_.slice(0,128)).toString("hex");ie.debug("WS raw frame out",{bytes:_.byteLength,headHex:y})}catch(_){ie.warn("WS raw frame dump failed",{err:String(_)})}super.send(h,...m)}}let a=ti(this.opts.urlOverride),c={url:a,ws:i,fpID:Ys,aID:hn,accessKey:this.opts.handshake.accessKey,deviceID:this.opts.handshake.deviceId,payloadType:{type:la,force:!0},payloadEncoding:{encoding:ha,force:!0},enableTransformTextPayload:!0,enableQoS:!1,enableAutoAck:!1,automaticOpen:!1,debug:this.opts.debug??!1},u=new ma.FWS(c);u.onopen=()=>{this.opened=!0,this.openCount+=1;let f=this.openCount===1;ie.info("frontier opened",{url:a,remoteDeviceId:this.opts.handshake.deviceId,initial:f,openCount:this.openCount}),this.connectHandler&&Promise.resolve(this.connectHandler({initial:f})).catch(h=>ie.warn("onConnect handler threw (ignored)",{err:String(h)}))},u.onclose=f=>{this.opened=!1,ie.info("frontier closed",{code:f.code,reason:f.reason,willReconnect:f.willReconnect})},u.onerror=f=>{ie.warn("frontier error",{code:f.code,msg:f.message})},u.onmessage=f=>this.handleMessage(f),this.fws=u,await u.connect()}async stop(e){let i=this.fws;if(i){this.fws=null,this.opened=!1;try{i.close(1e3,e??"bridge shutdown")}catch(a){ie.warn("frontier close threw (ignored)",{err:String(a)})}}}async send(e){let i=this.fws;if(!i)throw new C("UPSTREAM_DISCONNECTED","frontier upstream not started");let a=JSON.stringify(e),c=e;ga(c)||ie.info("frontier frame out",{method:c.method,jsonrpcId:c.id,size:a.length});try{await i.send(a,{service:33555712,method:1,payloadType:la,payloadEncoding:ha})}catch(f){throw ie.warn("frontier frame send failed",{method:c.method,jsonrpcId:c.id,err:String(f)}),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 i=e.message?.service;if(i!==33555712){ie.debug("drop non-adapter frontier frame",{service:i});return}let a=Af(e);if(!a){ie.debug("frontier message without text payload, drop",{payloadType:e.message?.payloadType});return}if(!this.handler){ie.debug("frame received but no onFrame handler",{size:a.length});return}let c;try{c=JSON.parse(a)}catch(f){ie.warn("frontier message JSON parse failed",{err:String(f),head:a.slice(0,80)});return}let u=c;ga(u)||ie.info("frontier frame in",{logid:Ef(e.message?.LogID),logidNew:e.message?.LogIDNew,msgId:e.message?.msgID,jsonrpcId:u.id,method:u.method,body:Cf(a)}),Promise.resolve(this.handler(c)).catch(f=>ie.warn("frontier frame handler threw",{err:String(f)}))}};function ga(r){return r.method==="_agent/health"?!0:typeof r.id=="string"&&r.id.startsWith("agent.health_")}var pa=2e3;function Cf(r){return r.length<=pa?r:`${r.slice(0,pa)}...<truncated, total ${r.length} chars>`}function Ef(r){return r?r.high===0?String(r.low>>>0):`${r.high.toString(16)}${(r.low>>>0).toString(16).padStart(8,"0")}`:""}function Af(r){let e=r.message;if(e?.textPayload)return e.textPayload;let i=e?.payload;if(!i)return null;try{return Buffer.from(i).toString("utf8")}catch{return null}}K();var as=N("upstream.switchable"),ir=class{inner;handler=null;connectHandler=null;constructor(e){this.inner=e}async swap(e,i){if(this.inner===e)return;as.info("swap upstream",{reason:i});let a=this.inner;this.inner=e,this.handler&&e.onFrame(this.handler),this.connectHandler&&e.onConnect&&e.onConnect(this.connectHandler);try{await e.start()}catch(c){throw as.error("swap target start failed, reverting",{err:String(c)}),this.inner=a,c}await a.stop(i??"swapped").catch(c=>as.warn("previous upstream stop threw (ignored)",{err:String(c)}))}current(){return this.inner}start(){return this.inner.start()}stop(e){return this.inner.stop(e)}send(e){return this.inner.send(e)}onFrame(e){this.handler=e,this.inner.onFrame(e)}onConnect(e){this.connectHandler=e,this.inner.onConnect?.(e)}isConnected(){return this.inner.isConnected()}};K();var cs=N("upstream"),tn=class{handler=null;async start(){cs.info("NoopUpstream started (M1 skeleton; real Frontier wired in M4)")}async stop(e){cs.info("NoopUpstream stopped",{reason:e})}async send(e){cs.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();le();K();le();import{execSync as kf}from"node:child_process";import{readFileSync as _a,unlinkSync as If}from"node:fs";import{mkdir as Pf,readFile as wa,unlink as ya,writeFile as Df}from"node:fs/promises";import{dirname as Tf}from"node:path";var Nf=N("single-instance"),or=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&&(Nf.warn("removing stale pid file",{stalePid:e}),await ya(this.pidFile).catch(()=>{})),await Pf(Tf(this.pidFile),{recursive:!0}),await Df(this.pidFile,String(process.pid),"utf8"),this.acquired=!0,this.installCleanupHooks(),{kind:"acquired"})}async release(){if(this.acquired){try{(await wa(this.pidFile,"utf8")).trim()===String(process.pid)&&await ya(this.pidFile)}catch{}this.acquired=!1}}async readExistingPid(){try{let e=await wa(this.pidFile,"utf8"),i=Number.parseInt(e.trim(),10);return Number.isFinite(i)&&i>0?i:null}catch(e){if(e.code==="ENOENT")return null;throw e}}isAlive(e){try{process.kill(e,0)}catch(i){return i.code==="EPERM"}return this.matchesDaemonTitle(e)}matchesDaemonTitle(e){try{let i=_a(`/proc/${e}/cmdline`,"utf8").replace(/\0/g," ");return!!(i.includes("coze-bridge-daemon")||i.includes("lib/index.js"))}catch{}try{let i=kf(`ps -o command= -p ${e}`,{stdio:["ignore","pipe","ignore"],timeout:1e3}).toString();return i.trim()?i.includes("coze-bridge-daemon")||i.includes("lib/index.js"):!1}catch{return!0}}installCleanupHooks(){process.once("exit",()=>{if(this.acquired)try{_a(this.pidFile,"utf8").trim()===String(process.pid)&&If(this.pidFile)}catch{}})}};var M=N("daemon"),Lf="coze-bridge-daemon";async function Sa(){let r=new or({processTitle:Lf}),e=await r.acquire();if(e.kind==="already-running")throw new Error(`coze-bridge daemon already running (pid=${e.pid})`);let i=await Rn(),a=i??{};Cr({pid:process.pid}),M.info(i?"loaded bridge config":"initialized bridge config");try{let P=new bt;a.frameworksCache=await P.detectAll(),M.info("refreshed frameworks_cache",{detected:Object.keys(a.frameworksCache)})}catch(P){M.warn("framework detection failed",{err:String(P)})}await vt(a);let c=new ir(new tn),u=H(),f=null,h=new Bn({upstream:c,paths:u,bridgeConfig:a,sessionSpawner:async(P,U,j,ae)=>{if(!f)throw new Error("agentManager not ready");return f.spawnSessionDownstream(P,U,j,ae)}});await Bf(u,h);let m=new Ln({paths:u,config:a,registry:h});f=m;let _,y,v=null,S=null;h.registerExtension("_agent/create",async P=>m.createAgent(P.params)),h.registerExtension("_agent/health",async()=>({ok:!0}));let A={},D=new mn({agents:h.agents,disposeAndMarkDisconnected:async(P,U)=>{let j=h.agents.get(P);j&&(await m.cleanupOpenclawSessionProviders(j).catch(ae=>M.warn("cleanup openclaw providers failed (ignored)",{agentId:P,err:String(ae)})),await j.dispose(`disconnect: ${U}`).catch(ae=>M.warn("dispose during disconnect failed (ignored)",{agentId:P,err:String(ae)})),j.status="disconnected",h.unregister(P)),h.disconnectedAgents.add(P)},detailSyncer:async P=>{if(!A.ref)throw new Error("agent-detail-sync not initialized yet");await A.ref.syncOne(P)},openclawRepair:async(P,U)=>{await m.openclawRepair(P,U)}});h.registerExtension("_agent/listSkills",P=>D.listSkills(P.params)),h.registerExtension("_agent/addSkills",P=>D.addSkills(P.params)),h.registerExtension("_agent/removeSkills",P=>D.removeSkills(P.params)),h.registerExtension("_agent/getFileTree",P=>D.getFileTree(P.params)),h.registerExtension("_agent/getFileContent",P=>D.getFileContent(P.params)),h.registerExtension("_agent/update",P=>D.updateAgent(P.params)),h.registerExtension("_agent/disconnect",P=>D.disconnectAgent(P.params)),h.registerExtension("_agent/switchModel",P=>D.switchModel(P.params)),h.registerExtension("_agent/reset",P=>D.resetAgent(P.params)),h.registerExtension("_agent/repair",P=>D.repairAgent(P.params));let L=new ln({paths:u,handlers:D,sendDetail:P=>h.sendRequest("_agent/detail",P)});A.ref=L,c.onConnect(({initial:P})=>{M.info("frontier upstream connected, triggering detail sync",{initial:P}),L.syncAll(P?"initial-connect":"reconnect").catch(U=>M.warn("detail sync top-level error (ignored)",{err:String(U)}))});let F=new Mn({paths:u,routes:[{method:"GET",path:"/status",handler:async()=>({running:!0,pid:process.pid,agents:[...h.agents.keys()],deviceId:v??"",frameworksCache:a.frameworksCache??{}})},{method:"POST",path:"/pair",handler:async P=>{let U=P,j=U?.privatecode,ae=U?.pairing_code;if(!j||!ae)throw new C("IPC_BAD_REQUEST","/pair requires privatecode + pairing_code");let Re=pn(U.env),we=U.handshake_url,Qe=U.frontier_url,Nt=Rf(U.env,we,Qe),nn=!!_&&_!==j,Se=y!==void 0&&y!==Nt,Ce=nn||Se;if(Ce){M.warn("pair config switched, resetting agents",{pcChanged:nn,envChanged:Se,previousPc:_?ba(_):"",nextPc:ba(j),previousEnvKey:y??"",nextEnvKey:Nt});for(let z of[...h.agents.values()])await z.dispose("pair config switch").catch(()=>{}),h.agents.delete(z.agentId);await c.swap(new tn,"pair switch").catch(()=>{})}let rn=await ri({privatecode:j,...we?{endpoint:we}:{},ppeOverride:Re});v=rn.deviceId,Cr({deviceId:v,pid:process.pid}),zi({patToken:j,env:U.env}).catch(z=>M.warn("coze-cli setup error (ignored)",{err:String(z)}));let fe=new sr({handshake:rn,privatecode:j,...Qe?{urlOverride:Qe}:{},ppeOverride:Re});await c.swap(fe,"pair");try{let z=new bt;a.frameworksCache=await z.detectAll(),await vt(a),M.info("frameworks_cache refreshed before pair",{detected:Object.keys(a.frameworksCache)})}catch(z){M.warn("frameworks_cache refresh failed (ignored, using cached)",{err:String(z)})}let sn=Object.keys(a.frameworksCache??{});try{let z=await h.sendRequest("_agent/pair",{pairCode:ae,patToken:j,frameworks:sn,_meta:{cozeDeviceId:v}});M.info("_agent/pair ok",{pairResult:z}),_=j,y=Nt,S||(S=new yn({core:h,getDeviceId:()=>v??""})),S.start(),Ce&&va(u,m).catch(Be=>M.warn("post-pair-switch auto-revive error (ignored)",{err:String(Be)}));let J;return U.agent_id&&(J=await Mf(U.agent_id,u,m,Be=>h.sendRequest("_agent/detail",Be)).catch(Be=>(M.error("--agent-id ensureAgent failed",{agentId:U.agent_id,err:String(Be)}),{ok:!1,agentId:U.agent_id??"",note:String(Be)}))),{ok:!0,note:"paired with cloud",...J?{agent:J}:{}}}catch(z){return M.error("_agent/pair failed",{err:String(z)}),{ok:!1,note:`pair failed: ${String(z)}`}}}},{method:"POST",path:"/_agent/create",handler:async P=>{let U=P;return{ok:!0,result:await m.createAgent(U)}}},{method:"POST",path:"/refresh",handler:async()=>{M.info("IPC /refresh: re-detecting frameworks");let P=new bt;return a.frameworksCache=await P.detectAll(),await vt(a),{ok:!0,frameworks:a.frameworksCache}}},{method:"POST",path:"/shutdown",handler:async()=>(M.info("IPC /shutdown received"),setImmediate(()=>{Z.shutdown("ipc /shutdown")}),{ok:!0})}]}),{port:$,token:oe}=await F.start();await h.start(),va(u,m).catch(P=>M.warn("auto-revive top-level error (ignored)",{err:String(P)}));let ee=null,Z={port:$,token:oe,core:h,ipc:F,shutdown(P){return ee||(M.info("daemon shutdown",{reason:P}),ee=(async()=>{S?.stop(),await h.stop(P),await F.stop(),await r.release()})(),ee)}};for(let P of["SIGTERM","SIGINT"])process.on(P,()=>{Z.shutdown(P).then(()=>process.exit(0))});return M.info("daemon ready",{port:$,pid:process.pid,nodeVersion:process.version,platform:process.platform,frameworks:Object.keys(a.frameworksCache??{}),libVersion:a.libVersion??"dev"}),Z}function ba(r){return r.length<=8?"***":`${r.slice(0,4)}***${r.slice(-4)}`}function Rf(r,e,i){return`${r??""}|${e??""}|${i??""}`}async function Bf(r,e){let{readdir:i}=await import("node:fs/promises"),a;try{a=await i(r.agentsRoot)}catch{return}let{loadAgentConfig:c,enforceAgentConfigMode:u}=await Promise.resolve().then(()=>(Je(),dn));for(let f of a){await u(f,r).catch(h=>M.warn("enforceAgentConfigMode failed (ignored)",{agentId:f,err:String(h)}));try{let h=await c(f,r);h?.disconnectedAt&&(e.disconnectedAgents.add(f),M.info("agent marked disconnected on startup",{agentId:f,disconnectedAt:h.disconnectedAt,reason:h.disconnectReason??""}))}catch(h){M.warn("failed to load agent config on startup, skipping",{agentId:f,err:String(h)})}}}async function Mf(r,e,i,a){let{loadAgentConfig:c}=await Promise.resolve().then(()=>(Je(),dn)),u=await c(r,e);if(u){M.info("--agent-id: local config found, reconnecting",{agentId:r,framework:u.framework,hadDisconnect:!!u.disconnectedAt});let _={agentId:u.agentId,framework:u.framework,...u.cozeIdentity?{cozeIdentity:u.cozeIdentity}:{},...u.model?{model:u.model}:{}};return await i.createAgent(_),{ok:!0,agentId:r,note:u.disconnectedAt?"revived from local config":"connected from local config"}}M.info("--agent-id: local config missing, pulling _agent/detail from cloud",{agentId:r});let f=await a({_meta:{cozeAgentId:r}});if(!f.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:f.agentId,framework:f.framework,...f.cozeIdentity?{cozeIdentity:f.cozeIdentity}:{},...f.model?{model:f.model}:{},...f.deployType?{_meta:{cozeDeployType:f.deployType}}:{}};await i.createAgent(h);let m=f.deployType==="cloud"&&f.framework==="openclaw";return{ok:!0,agentId:r,note:m?"cloud agent acknowledged":"created from cloud detail"}}async function va(r,e){let{readdir:i}=await import("node:fs/promises"),a;try{a=await i(r.agentsRoot)}catch{return{revived:0,skipped:0,total:0}}if(a.length===0)return{revived:0,skipped:0,total:0};let{loadAgentConfig:c}=await Promise.resolve().then(()=>(Je(),dn));M.info("auto-revive: scanning local agents on startup",{count:a.length});let u=0,f=0;for(let h of a){let m;try{m=await c(h,r)}catch(_){M.warn("auto-revive: load config failed (skipping)",{agentId:h,err:String(_)}),f+=1;continue}if(!m){f+=1;continue}if(m.disconnectedAt){M.info("auto-revive: skip disconnected agent",{agentId:h,disconnectedAt:m.disconnectedAt}),f+=1;continue}try{M.info("auto-revive: re-registering agent (D44 no spawn)",{agentId:h,framework:m.framework}),await e.createAgent({agentId:m.agentId,framework:m.framework,...m.cozeIdentity?{cozeIdentity:m.cozeIdentity}:{},...m.model?{model:m.model}:{},...m.deployType?{_meta:{cozeDeployType:m.deployType}}:{}}),u+=1}catch(_){M.warn("auto-revive: createAgent failed (skipping)",{agentId:h,framework:m.framework,err:String(_)}),f+=1}}return M.info("auto-revive: done",{revived:u,skipped:f,total:a.length}),{revived:u,skipped:f,total:a.length}}us();le();import{readFile as Ea}from"node:fs/promises";var Ze=class{paths;constructor(e){this.paths=e??H()}async probe(e=1e3){let i=await this.readAuth();if(!i)return{kind:"not-running"};try{let a=await this.fetch(i,{method:"GET",path:"/status",timeoutMs:e});return a.status===200?{kind:"connected",...i}:{kind:"stale",reason:`unexpected status ${a.status}`}}catch(a){return{kind:"stale",reason:jf(a)}}}async request(e){let i=await this.readAuth();if(!i)throw new Error("coze-bridge daemon not running (no port/token files)");return this.fetch(i,e)}async readAuth(){try{let[e,i]=await Promise.all([Ea(this.paths.portFile,"utf8"),Ea(this.paths.tokenFile,"utf8")]),a=Number.parseInt(e.trim(),10),c=i.trim();return!Number.isFinite(a)||a<=0||!c?null:{port:a,token:c}}catch(e){if(e.code==="ENOENT")return null;throw e}}async fetch(e,i){let a=i.body!==void 0,c={Authorization:`Bearer ${e.token}`};a&&(c["content-type"]="application/json");let u=new AbortController,f=setTimeout(()=>u.abort(),i.timeoutMs??5e3);try{let h=await fetch(`http://127.0.0.1:${e.port}${i.path}`,{method:i.method,headers:c,body:a?JSON.stringify(i.body):void 0,signal:u.signal}),m=await h.text();return{status:h.status,body:Hf(m)}}finally{clearTimeout(f)}}};function Hf(r){if(!r)return null;try{return JSON.parse(r)}catch{return r}}function jf(r){return r instanceof Error?r.message:String(r)}K();le();import{copyFile as Aa,mkdir as Wf,readFile as fs,writeFile as Jf}from"node:fs/promises";import{dirname as Vf,resolve as ds,sep as ar}from"node:path";import{fileURLToPath as Xf}from"node:url";K();le();var ka=N("dist-install");function Yf(r){let e=Xf(r),i=Vf(e),a=`${ar}src${ar}`;if(i.includes(a)||i.endsWith(`${ar}src${ar}cli`))return null;let c=ds(i,"index.js"),u=ds(i,"..","package.json");return{dist:c,pkgJson:u}}async function Ia(r={}){let e=r.paths??H(),i=Yf(import.meta.url),a=r.sourceDist??i?.dist,c=r.sourcePackageJson??i?.pkgJson;if(!a||!c)return{kind:"dev-mode-skip",reason:"running from src/(tsx loader);no dist/ to install"};let u;try{u=JSON.parse(await fs(c,"utf8")).version??"unknown"}catch(v){return ka.warn("cannot read source package.json,skip dist install",{err:String(v)}),{kind:"dev-mode-skip",reason:`package.json read failed: ${String(v)}`}}let f=await Rn(e.configFile)??{},h=f.libVersion;if(h===u)try{return await fs(e.libEntry),{kind:"already-current",libVersion:u}}catch{}await Wf(e.libDir,{recursive:!0}),await Aa(a,e.libEntry),await Aa(`${a}.map`,`${e.libEntry}.map`).catch(()=>{});let m=ds(e.libDir,"package.json"),_=`${JSON.stringify({type:"module"},null,2)}
97
- `;return await fs(m,"utf8").catch(()=>null)!==_&&await Jf(m,_),f.libVersion=u,await vt(f,e.configFile),ka.info("dist installed",{libEntry:e.libEntry,fromVersion:h,toVersion:u}),h?{kind:"version-changed",fromVersion:h,toVersion:u,libEntry:e.libEntry}:{kind:"first-install",libVersion:u,libEntry:e.libEntry}}var gd=N("cli");function Tt(r,e){let i=[],a;for(let c=0;c<r.length;c++){let u=r[c];if(u===e){a=r[c+1],c+=1;continue}if(u.startsWith(`${e}=`)){a=u.slice(e.length+1);continue}i.push(u)}return{value:a,rest:i}}function pd(r){let e=r.slice(2);if(e.includes("--version")||e.includes("-v"))return{mode:"version"};if(e.includes("--daemon"))return{mode:"daemon"};if(e.includes("--status"))return{mode:"status"};if(e.includes("--stop"))return{mode:"stop"};if(e.includes("--refresh"))return{mode:"refresh"};if(e.includes("--uninstall"))return{mode:"uninstall"};if(e.includes("--install-service"))return{mode:"install-service"};if(e.includes("--help")||e.includes("-h")||e.length===0)return{mode:"help"};let i=e,{value:a,rest:c}=Tt(i,"--pat-token");i=c;let{value:u,rest:f}=Tt(i,"--pair-code");i=f;let{value:h,rest:m}=Tt(i,"--env");i=m;let{value:_,rest:y}=Tt(i,"--handshake-url");i=y;let{value:v,rest:S}=Tt(i,"--frontier-url");i=S;let{value:A}=Tt(i,"--agent-id");if(!a||!u)return{mode:"help"};let D={mode:"pair",privatecode:a,pairingCode:u};return h&&(D.env=h),_&&(D.handshakeUrl=_),v&&(D.frontierUrl=v),A&&(D.agentId=A),D}var md=`
88
+ ${c}
89
+ ${lc}`}var lc=`## \u53D1\u9001\u6587\u4EF6 / \u56FE\u7247\u7ED9\u7528\u6237
90
+
91
+ \u8981\u628A\u751F\u6210\u7684\u56FE\u7247 / PDF / \u6587\u4EF6\u76F4\u63A5\u53D1\u5230\u7528\u6237 IM, \u7528:
92
+
93
+ coze-bridge send image <path> [--caption "\u8BF4\u660E\u6587\u5B57"]
94
+ coze-bridge send file <path> [--caption "..."] [--name "report.pdf"]
95
+
96
+ \u7EA6\u675F:
97
+ - path \u5FC5\u987B\u5728\u5F53\u524D workspace \u5B50\u6811\u4E0B (\u7EDD\u5BF9\u6216\u76F8\u5BF9\u7686\u53EF)
98
+ - \u5355\u6587\u4EF6 \u2264 50MB
99
+ - \u652F\u6301: image/png|jpeg|webp|gif, application/pdf, text/plain|markdown
100
+ - \u547D\u4EE4\u540C\u6B65\u7B49\u8FD4\u56DE (\u4E00\u822C 1-30s \u89C6\u6587\u4EF6\u5927\u5C0F), \u9000 0 \u5373\u5DF2\u9001\u8FBE
101
+ - \u5931\u8D25\u9519\u8BEF\u4FE1\u606F\u5728 stderr, \u770B\u5B8C\u518D\u8C03\u6574\u91CD\u8BD5
102
+
103
+ \u26A0\uFE0F \u751F\u6210\u6587\u4EF6\u540E\u8BF7**\u7B49\u6587\u4EF6\u5B8C\u6574\u5199\u76D8**\u518D send (\u7528 \`&&\` \u4E32\u884C, \u4E0D\u8981 \`&\` \u540E\u53F0)\u3002
104
+ `;var Ee=T("agent-detail-sync"),xn=class{constructor(e){this.opts=e}opts;async syncAll(e){let s=this.opts.paths.agentsRoot,a;try{a=await hc(s)}catch(c){Ee.info("agents dir not found, skip detail sync",{root:s,err:String(c)});return}Ee.info("starting detail sync",{reason:e,count:a.length});for(let c of a)try{await this.syncOne(c)}catch(u){Ee.warn("detail sync failed for agent, skipping",{agentId:c,err:String(u)})}Ee.info("detail sync done",{reason:e})}async syncOne(e){let s=await fe(e,this.opts.paths);if(!s){Ee.info("detail sync: agent config missing, skip",{agentId:e});return}let a;try{a=await this.opts.sendDetail({_meta:{cozeAgentId:e}})}catch(d){Ee.warn("detail RPC failed, using local data",{agentId:e,err:String(d)});return}if(a.agentId&&a.agentId!==e){Ee.warn("detail response agentId mismatch, ignoring",{agentId:e,responseAgentId:a.agentId});return}let c=!1,u=!1;if(a.agentName&&a.agentName!==s.agentName&&(s.agentName=a.agentName,c=!0),a.description!==void 0&&a.description!==s.description&&(s.description=a.description,c=!0),a.cozeIdentity&&a.cozeIdentity!==s.cozeIdentity&&(s.cozeIdentity=a.cozeIdentity,c=!0,u=!0),a.deployType&&Ee.info("detail.deployType",{agentId:e,deployType:a.deployType}),!c){Ee.debug("detail sync: no diff",{agentId:e});return}await ve(s,this.opts.paths),Ee.info("detail sync: config updated",{agentId:e,identityChanged:u,agentName:s.agentName}),u&&(await ht(s.workspace,s.framework,e,s.cozeIdentity),await this.opts.handlers.reloadAgentSessionsPublic(e,"detail-sync"))}};We();import{spawn as _s}from"node:child_process";import{lstat as Tr,mkdir as mc,readFile as ws,readdir as _c,rm as wc,stat as yc,writeFile as ps}from"node:fs/promises";import{join as Ae,normalize as vc,relative as ys,resolve as bc,sep as vs}from"node:path";var Ce={PAIR:"_agent/pair",CREATE:"_agent/create",HEALTH:"_agent/health",LIST_SKILLS:"_agent/listSkills",ADD_SKILLS:"_agent/addSkills",REMOVE_SKILLS:"_agent/removeSkills",GET_FILE_TREE:"_agent/getFileTree",GET_FILE_CONTENT:"_agent/getFileContent",DETAIL:"_agent/detail",UPDATE:"_agent/update",DISCONNECT:"_agent/disconnect",SWITCH_MODEL:"_agent/switchModel",GEN_MODEL_TOKEN:"_agent/genModelToken",RESET:"_agent/reset",REPAIR:"_agent/repair",DELETE:"_agent/delete"};function Ot(n){return n?.cozeDeployType==="cloud"?"cloud":"local"}function es(n){let{_meta:e,...s}=n;return{stripped:s,meta:e}}function gt(n){if(!n?.cozeAgentId)throw new Error("missing _meta.cozeAgentId");return n.cozeAgentId}var b=class extends Error{code;retriable;cause;constructor(e,s,a){super(s),this.name="BridgeError",this.code=e,this.retriable=a?.retriable??!1,a?.cause!==void 0&&(this.cause=a.cause)}};U();xe();function Me(n,e){if(Ot(n)!=="cloud")throw new b("OPERATION_NOT_ALLOWED_FOR_LOCAL",`${e} is not allowed for local agent`)}function un(n){return n.startsWith("http://")||n.startsWith("https://")}function dn(n){return n.endsWith("/")?n.slice(0,-1):n}U();var fn="1008033",ts="1289";var ns="pbbp2",rs="https://www.coze.cn",is="/api/coze_claw/resource/get_frontier_key",gc="https://www.coze.cn",pc="wss://frontier.coze.cn";function ln(n){return n??process.env.COZE_BRIDGE_HANDSHAKE_URL??gc}function ss(n){return n??process.env.COZE_BRIDGE_FRONTIER_URL??pc}function pt(n){let e={},s=n?.ttEnv??process.env.COZE_BRIDGE_TT_ENV,a=n?.usePpe??process.env.COZE_BRIDGE_USE_PPE;return s&&(e["x-tt-env"]=s),a&&(e["x-use-ppe"]=a),e}function hn(n){return n?n.startsWith("boe_")?{ttEnv:n}:{ttEnv:n,usePpe:"1"}:{}}var os=T("handshake");async function as(n){let e=ln(n.endpoint),s=n.timeoutMs??1e4,a=`${dn(e)}${is}?aid=${encodeURIComponent(fn)}`,c={Authorization:`Bearer ${n.privatecode}`,Accept:"application/json",...pt(n.ppeOverride)},u=new AbortController,d=setTimeout(()=>u.abort(),s);os.info("frontier key handshake",{base:e});try{let l=await fetch(a,{method:"GET",headers:c,signal:u.signal}),m=l.headers.get("x-tt-logid")??"",_=l.headers.get("x-tt-trace-id")??"";if(!l.ok){let k=await l.text().catch(()=>"");throw new b("UPSTREAM_HANDSHAKE_FAILED",`handshake HTTP ${l.status} logid=${m}: ${k.slice(0,200)}`)}let y=await l.json();if(y.code!==void 0&&y.code!==0)throw new b("UPSTREAM_HANDSHAKE_FAILED",`handshake code=${y.code} msg=${y.msg??"-"} logid=${m}`);let v=y.data?.access_key,E=y.data?.device_id;if(!v||!E)throw new b("UPSTREAM_HANDSHAKE_FAILED",`handshake response missing access_key/device_id logid=${m}: ${JSON.stringify(y)}`);return os.info("handshake ok",{remoteDeviceId:E,logid:m,traceId:_}),{accessKey:v,deviceId:E}}catch(l){throw l instanceof b?l:l.name==="AbortError"?new b("UPSTREAM_HANDSHAKE_FAILED",`handshake timeout (${s}ms)`):new b("UPSTREAM_HANDSHAKE_FAILED",String(l),{cause:l})}finally{clearTimeout(d)}}var Ar="https://llm-gateway.coze.cn",Ie="auto";function cs(n){return{model:n.model??Ie,...n.modelToken?{modelToken:n.modelToken}:{}}}function xs(n){return!n||n===Ie}function us(n){let e={};return n.modelToken?(e.ANTHROPIC_BASE_URL=Ar,e.ANTHROPIC_AUTH_TOKEN=n.modelToken,e.ANTHROPIC_MODEL=n.model||Ie):xs(n.model)||(e.ANTHROPIC_MODEL=n.model),e}function ds(n){let e=[];return n.modelToken?e.push("-c",`model="${n.model||Ie}"`):xs(n.model)||e.push("-c",`model="${n.model}"`),n.modelToken&&(e.push("-c",'model_providers.coze.name="coze"'),e.push("-c",`model_providers.coze.base_url="${Ar}/v1"`),e.push("-c",'model_providers.coze.env_key="OPENAI_API_KEY"'),e.push("-c",'model_providers.coze.wire_api="responses"'),e.push("-c","model_providers.coze.requires_openai_auth=false"),e.push("-c","model_providers.coze.supports_websockets=false"),e.push("-c",'model_provider="coze"')),e}function fs(n){return n.modelToken?{OPENAI_API_KEY:n.modelToken}:{}}function Pr(n){let{ttEnv:e,usePpe:s}=hn(n),a={};return e&&(a["x-tt-env"]=e),s&&(a["x-use-ppe"]=s),a}function ls(n,e){if(!n.modelToken)return{};let s=Pr(e);return Object.keys(s).length===0?{}:{ANTHROPIC_CUSTOM_HEADERS:Object.entries(s).map(([c,u])=>`${c}:${u}`).join(`
105
+ `)}}function kr(n){return`coze-session-${n.replace(/[^A-Za-z0-9_-]+/g,"-")}`}function hs(n,e){if(!n.modelToken)return null;let s=n.model||Ie,a=Pr(e),c={baseUrl:`${Ar}/v1`,api:"openai-completions",apiKey:n.modelToken,models:[{id:s,name:s,reasoning:!1,input:["text"],cost:{input:0,output:0,cacheRead:0,cacheWrite:0},contextWindow:128e3,maxTokens:8192,api:"openai-completions"}]};return Object.keys(a).length>0&&(c.headers=a),c}function gs(n,e){if(!n.modelToken)return[];let s=Pr(e),a=[];for(let[c,u]of Object.entries(s))a.push("-c",`model_providers.coze.http_headers.${c}="${u}"`);return a}var ue=T("agent-handlers"),ms=5*1024*1024,Sc=1,Ec=6,Cc=new Set(["node_modules",".git",".coze","dist","build",".next"]),gn=class{constructor(e){this.opts=e}opts;async listSkills(e){Me(e._meta,"_agent/listSkills");let s=gt(e._meta),a=await this.loadAgentCfg(s),c=a?.workspace??Be(s).workspace,u=a?.skills??[],d=[];for(let l of u){let m=Ae(c,l.relPath,"SKILL.md");await yc(m).then(y=>y.isFile()).catch(()=>!1)&&d.push(Tc(l))}return{skills:d}}async addSkills(e){Me(e._meta,"_agent/addSkills");let s=gt(e._meta),a=await this.requireAgentCfg(s),c=e.skills??[],u=[...a.skills??[]],d=new Map(u.map((m,_)=>[m.skillId,_])),l=[];for(let m of c){let _=await Dr({agentId:s,workspace:a.workspace,framework:a.framework,skill:m});Rr(u,d,_),l.push(m)}return await an(s,u),await this.reloadAgentSessions(s,"skills-added"),{installedSkills:l}}async removeSkills(e){Me(e._meta,"_agent/removeSkills");let s=gt(e._meta),a=await this.requireAgentCfg(s),c=new Set(e.skillIds??[]),u=a.skills??[],d=[];for(let l of u){if(!c.has(l.skillId)){d.push(l);continue}let m=Ae(a.workspace,l.relPath);await wc(m,{recursive:!0,force:!0}),ue.info("skill removed",{agentId:s,skillId:l.skillId,relPath:l.relPath})}return await an(s,d),await this.reloadAgentSessions(s,"skills-removed"),{ok:!0}}reloadAgentSessionsPublic(e,s){return this.reloadAgentSessions(e,s)}async reloadAgentSessions(e,s){let a=this.opts.agents.get(e);if(a&&a.framework!=="codex"){for(let[c,u]of a.sessions)if(!(!u.downstream||!u.acpSessionId)){u.loadingSession=!0;try{await u.downstream.sessionLoad({sessionId:u.acpSessionId,cwd:a.workspace}),ue.info("session reloaded",{reason:s,agentId:e,framework:a.framework,cloudId:c,acpId:u.acpSessionId})}catch(d){ue.warn("session reload failed",{reason:s,agentId:e,framework:a.framework,cloudId:c,acpId:u.acpSessionId,err:String(d)})}finally{u.loadingSession=!1}}}}async updateAgent(e){if(!e.cozeIdentity?.trim())return ue.info("_agent/update: empty cozeIdentity, noop",{agentId:e.agentId}),{ok:!0};let s=e.agentId,a=await fe(s);if(!a)throw new b("AGENT_NOT_FOUND",`agent not found: ${s}`);return a.cozeIdentity===e.cozeIdentity?(ue.info("_agent/update: cozeIdentity unchanged, noop",{agentId:s}),{ok:!0}):(a.cozeIdentity=e.cozeIdentity,await ve(a),await ht(a.workspace,a.framework,s,e.cozeIdentity),ue.info("_agent/update: cozeIdentity rewritten",{agentId:s,framework:a.framework}),await this.reloadAgentSessions(s,"identity-changed"),{ok:!0})}async disconnectAgent(e){let s=e.agentId;if(!s)throw new b("IPC_BAD_REQUEST","_agent/disconnect: missing agentId");let a=await fe(s);return a?(a.disconnectedAt=Date.now(),a.disconnectReason=e.reason??"",await ve(a),ue.info("agent disconnected",{agentId:s,reason:e.reason??"",force:e.force??!1}),this.opts.disposeAndMarkDisconnected&&await this.opts.disposeAndMarkDisconnected(s,e.reason??"disconnect"),{ok:!0}):(ue.warn("_agent/disconnect: agent not found, ignoring",{agentId:s}),{ok:!0})}async switchModel(e){if(Me(e._meta,"_agent/switchModel"),!e.agentId)throw new b("IPC_BAD_REQUEST","_agent/switchModel: missing agentId");let s=e.model?.trim()?e.model:Ie,a=await fe(e.agentId);if(!a)throw new b("AGENT_NOT_FOUND",`agent not found: ${e.agentId}`);a.model=s,await ve(a),ue.info("_agent/switchModel: model persisted",{agentId:e.agentId,model:s,reason:e.reason??""});let c=this.opts.agents.get(e.agentId);if(!c)return ue.info("_agent/switchModel: agent not running, config persisted only",{agentId:e.agentId}),{ok:!0};c.model=s;let u=[];for(let[d,l]of c.allSessionQueues())u.push(l.enqueue(async()=>{let m=c.sessions.get(d);m?.downstream&&(await m.downstream.stop(`switchModel: ${s}`).catch(()=>{}),m.downstream=void 0)}));return await Promise.all(u),ue.info("_agent/switchModel: all session runtimes killed, next prompt will respawn",{agentId:e.agentId,model:s,cloudSessions:u.length}),{ok:!0}}async resetAgent(e){if(Me(e._meta,Ce.RESET),!e.agentId)throw new b("IPC_BAD_REQUEST",`${Ce.RESET}: missing agentId`);return await this.runDetailSync(e.agentId,Ce.RESET,e.reason),{ok:!0}}async repairAgent(e){if(Me(e._meta,Ce.REPAIR),!e.agentId)throw new b("IPC_BAD_REQUEST",`${Ce.REPAIR}: missing agentId`);let s=await this.loadAgentCfg(e.agentId);if(s&&s.framework!=="openclaw")throw new b("IPC_BAD_REQUEST",`${Ce.REPAIR} only allowed for openclaw, got ${s.framework}`);if(s&&this.opts.openclawRepair)try{await this.opts.openclawRepair(e.agentId,s.workspace)}catch(a){ue.warn("openclaw repair (delete+add) failed (ignored)",{agentId:e.agentId,reason:e.reason,err:String(a)})}return await this.runDetailSync(e.agentId,Ce.REPAIR,e.reason),{ok:!0}}async runDetailSync(e,s,a){if(!this.opts.detailSyncer){ue.warn("detailSyncer not wired, skipping sync",{method:s,agentId:e});return}try{await this.opts.detailSyncer(e)}catch(c){ue.warn("detail sync failed (ignored)",{method:s,agentId:e,reason:a,err:String(c)})}}async getFileTree(e){Me(e._meta,"_agent/getFileTree");let s=e._meta,a=gt(s),c=await this.resolveWorkspace(a),u=e.filePath??"",d=this.safeJoin(c,u),l=await Tr(d).catch(()=>null);if(!l)throw new b("IPC_BAD_REQUEST",`path not found: ${u}`);if(l.isSymbolicLink())throw new b("IPC_BAD_REQUEST",`symlink not allowed: ${u}`);let m=Bc(e.depth);return l.isDirectory()?{tree:await bs(c,d,u,m)}:{tree:[{name:Mc(u),path:Ss(u||"."),isDir:!1,size:l.size,modifiedAt:Math.floor(l.mtimeMs)}]}}async getFileContent(e){Me(e._meta,"_agent/getFileContent");let s=gt(e._meta),a=await this.resolveWorkspace(s);if(!e.filePath)throw new b("IPC_BAD_REQUEST","filePath required");let c=this.safeJoin(a,e.filePath),u=await Tr(c).catch(()=>null);if(!u||!u.isFile())throw new b("IPC_BAD_REQUEST",`not a file: ${e.filePath}`);if(u.isSymbolicLink())throw new b("IPC_BAD_REQUEST",`symlink not allowed: ${e.filePath}`);if(u.size>ms)throw new b("IPC_BAD_REQUEST",`file too large: ${u.size} bytes (max ${ms})`);let d=await ws(c);return d.includes(0)?{content:d.toString("base64"),encoding:"base64",size:u.size}:{content:d.toString("utf8"),encoding:"utf-8",size:u.size}}async resolveWorkspace(e){let s=this.opts.agents.get(e);return s?s.workspace:(await fe(e).catch(()=>null))?.workspace??Be(e).workspace}safeJoin(e,s){let a=bc(e,s||"."),c=ys(e,a);if(c.startsWith("..")||c===".."||c.startsWith(`..${vs}`))throw new b("IPC_BAD_REQUEST",`path escapes workspace: ${s}`);return a}loadAgentCfg(e){return fe(e)}async requireAgentCfg(e){let s=await this.loadAgentCfg(e);if(!s)throw new b("AGENT_NOT_FOUND",`no config for agent: ${e}`);return s}};function Ic(n){let e=n.trim().replace(/[\x00-\x1f<>:"|?*/\\]+/g,"-").replace(/^[\s.-]+|[\s.-]+$/g,"").slice(0,64);if(!e||e==="."||e==="..")throw new b("IPC_BAD_REQUEST",`invalid skill name: ${n}`);if(/^(con|prn|aux|nul|com[1-9]|lpt[1-9])$/i.test(e))throw new b("IPC_BAD_REQUEST",`reserved windows filename: ${n}`);return e}function Ac(n){return n==="claude-code"?Ae(".claude","skills"):Ae(".agents","skills")}var Pc=3e4,kc=50*1024*1024,pn=3e4;async function Dr(n){let{agentId:e,workspace:s,framework:a,skill:c}=n;if(!c.skillName)throw new b("IPC_BAD_REQUEST","skill missing skillName");let u=typeof c.content=="string"&&c.content.length>0,d=typeof c.downloadUrl=="string"&&c.downloadUrl.length>0;if(!u&&!d)throw new b("IPC_BAD_REQUEST",`skill ${c.skillId} missing both content and downloadUrl`);let l=Ic(c.skillName),m=Ac(a),_=Ae(m,l),y=Ae(s,_);if(await mc(y,{recursive:!0}),u){let E=Buffer.from(c.content,"utf8");Lt(E.length),await ps(Ae(y,"SKILL.md"),E,"utf8")}else{let E=await Dc(c.downloadUrl);Nc(E)?await Oc(E,y):await ps(Ae(y,"SKILL.md"),E.toString("utf8"),"utf8")}let v={skillId:c.skillId,skillName:c.skillName,relPath:_,installedAt:Date.now(),...c.description?{description:c.description}:{},...c.icon?{icon:c.icon}:{},...c.version?{version:c.version}:{},...c.downloadUrl?{downloadUrl:c.downloadUrl}:{},...c.config?{config:c.config}:{},...c.builtin?{builtin:c.builtin}:{}};return ue.info("skill installed",{agentId:e,skillId:c.skillId,skillName:c.skillName,relPath:_,source:u?"content":"downloadUrl"}),v}function Rr(n,e,s){let a=e.get(s.skillId);if(a!==void 0){n[a]=s;return}e.set(s.skillId,n.length),n.push(s)}function Tc(n){return{skillId:n.skillId,skillName:n.skillName,...n.description?{description:n.description}:{},...n.icon?{icon:n.icon}:{},...n.version?{version:n.version}:{},...n.config?{config:n.config}:{},...n.builtin?{builtin:n.builtin}:{}}}async function Dc(n){if(!n)throw new b("IPC_BAD_REQUEST","skill missing downloadUrl");if(n.startsWith("data:")){let e=Math.floor(n.length*3/4);Lt(e);let s=Rc(n);return Lt(s.length),s}if(n.startsWith("file:")){let e=new URL(n).pathname,s=await ws(e);return Lt(s.length),s}if(un(n)){let e=new AbortController,s=setTimeout(()=>e.abort(),Pc);try{let a=await fetch(n,{signal:e.signal});if(!a.ok)throw new b("IPC_BAD_REQUEST",`fetch skill failed HTTP ${a.status} ${n}`);let c=await a.arrayBuffer();return Lt(c.byteLength),Buffer.from(c)}finally{clearTimeout(s)}}throw new b("IPC_BAD_REQUEST",`unsupported downloadUrl scheme (\u8981 https/data/file): ${n.slice(0,80)}`)}function Lt(n){if(n>kc)throw new b("IPC_BAD_REQUEST",`skill too large: ${n} bytes`)}function Rc(n){let e=/^data:([^,;]*)(;base64)?,(.*)$/s.exec(n);if(!e)throw new b("IPC_BAD_REQUEST","bad data URL");let s=!!e[2],a=e[3]??"";return s?Buffer.from(a,"base64"):Buffer.from(decodeURIComponent(a),"utf8")}function Nc(n){return n.length>=2&&n[0]===31&&n[1]===139}async function Oc(n,e){await Lc(n),await new Promise((s,a)=>{let c=_s("tar",["-xzf","-","-C",e,"--strip-components=1","--no-same-owner"],{stdio:["pipe","pipe","pipe"]}),u="";c.stderr?.on("data",l=>{u+=String(l)});let d=setTimeout(()=>{c.kill("SIGKILL"),a(new b("IPC_BAD_REQUEST",`tar extract timeout (${pn}ms)`))},pn);c.on("error",l=>{clearTimeout(d),a(new b("IPC_BAD_REQUEST",`tar spawn failed: ${l.message}`,{cause:l}))}),c.on("exit",l=>{clearTimeout(d),l===0?s():a(new b("IPC_BAD_REQUEST",`tar exit ${l}${u?`: ${u.trim().slice(0,200)}`:""}`))}),c.stdin?.end(n)})}async function Lc(n){let e=await new Promise((s,a)=>{let c=_s("tar",["-tzvf","-"],{stdio:["pipe","pipe","pipe"]}),u="",d="";c.stdout?.on("data",m=>{u+=String(m)}),c.stderr?.on("data",m=>{d+=String(m)});let l=setTimeout(()=>{c.kill("SIGKILL"),a(new b("IPC_BAD_REQUEST",`tar list timeout (${pn}ms)`))},pn);c.on("error",m=>{clearTimeout(l),a(new b("IPC_BAD_REQUEST",`tar list spawn failed: ${m.message}`))}),c.on("exit",m=>{clearTimeout(l),m===0?s(u):a(new b("IPC_BAD_REQUEST",`tar list exit ${m}${d?`: ${d.trim().slice(0,200)}`:""}`))}),c.stdin?.end(n)});for(let s of e.split(`
106
+ `)){let a=s.trim();if(!a)continue;let c=a.charCodeAt(0);if(c!==45&&c!==100)throw new b("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 b("IPC_BAD_REQUEST",`tar entry absolute path: ${d}`);if(d.split(/[/\\]/).some(m=>m===".."))throw new b("IPC_BAD_REQUEST",`tar entry contains '..': ${d}`)}}async function bs(n,e,s,a){if(a<=0)return[];let c;try{c=await _c(e,{withFileTypes:!0})}catch{return[]}let u=[];for(let d of c){if(Cc.has(d.name)||d.isSymbolicLink())continue;let l=Ae(e,d.name),m=vc(Ae(s,d.name)),_=null;try{_=await Tr(l)}catch{continue}if(_.isSymbolicLink())continue;let y={name:d.name,path:Ss(ys(n,l)),isDir:_.isDirectory(),size:_.size,modifiedAt:Math.floor(_.mtimeMs)};_.isDirectory()&&a>1&&(y.children=await bs(n,l,m,a-1)),u.push(y)}return u.sort((d,l)=>d.isDir!==l.isDir?d.isDir?-1:1:d.name.localeCompare(l.name)),u}function Bc(n){return!n||n<=0?Sc:Math.min(n,Ec)}function Mc(n){if(!n||n==="."||n==="/")return".";let e=n.split(/[/\\]/);return e[e.length-1]||"."}function Ss(n){return n.split(vs).join("/")}U();import{readFileSync as wh}from"node:fs";import{dirname as vh,join as bh}from"node:path";import{fileURLToPath as Eh}from"node:url";var mn="0.1.37";var Bt=T("agent-health-reporter"),zc=1e4,_n=class{constructor(e){this.opts=e;this.intervalMs=e.intervalMs??zc}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()}),Bt.info("heartbeat started",{intervalMs:this.intervalMs}),this.tick())}stop(){this.timer&&(clearInterval(this.timer),this.timer=null,this.unsubscribeRegister&&(this.unsubscribeRegister(),this.unsubscribeRegister=null),Bt.info("heartbeat stopped"))}async tick(){if(this.inFlight){Bt.debug("previous tick still in-flight, skip");return}let e=this.opts.getDeviceId();if(!e){Bt.debug("deviceId not available, skip tick (\u5C1A\u672A pair)");return}this.inFlight=!0;try{let s=[];for(let c of this.opts.core.agents.values()){let u=Fc(c);u&&s.push({agentId:c.agentId,status:u})}if(s.length===0)return;let a={agents:s,bridgeVersion:mn,_meta:{cozeDeviceId:e}};try{await this.opts.core.sendRequest("_agent/health",a)}catch(c){Bt.warn("heartbeat batch send failed",{count:s.length,err:String(c)})}}finally{this.inFlight=!1}}};function Fc(n){return n.status==="error"?"error":n.activeTriggers.size>0?"busy":n.status==="ok"?"online":null}We();import{mkdir as Lr,rm as hx}from"node:fs/promises";U();import{execFile as Uc}from"node:child_process";import{promisify as qc}from"node:util";var Cs=qc(Uc),Mt=T("agents.acp-installer"),Kc={"claude-code":{npmPackage:"@agentclientprotocol/claude-agent-acp",binary:"claude-agent-acp"},codex:{npmPackage:"@zed-industries/codex-acp",binary:"codex-acp"}},Gc=5e4,Hc=5e3,jc=5*6e4,yn=new Map,wn=new Map,Nr=new Map;async function Es(n){let e=process.platform==="win32"?"where":"which";try{let{stdout:s}=await Cs(e,[n],{timeout:Hc});return s.split(`
107
+ `)[0]?.trim()||void 0}catch{return}}async function Wc(n){Mt.info("npm install -g start",{npmPackage:n}),await Cs("npm",["install","-g",`${n}@latest`],{timeout:Gc,maxBuffer:10*1024*1024}),Mt.info("npm install -g done",{npmPackage:n})}async function Is(n){let e=Kc[n];if(!e)return;let s=yn.get(n);if(s)return s;let a=wn.get(n);if(a&&Date.now()-a<jc)return;let c=Nr.get(n);if(c)return c;let u=(async()=>{let d=await Es(e.binary);if(d)return yn.set(n,d),Mt.info("acp wrapper found on PATH",{binary:e.binary,path:d}),d;try{await Wc(e.npmPackage)}catch(m){Mt.warn("acp wrapper install failed (will fallback to npx)",{npmPackage:e.npmPackage,err:String(m)}),wn.set(n,Date.now());return}let l=await Es(e.binary);if(!l){Mt.warn("acp wrapper installed but binary not found on PATH",{binary:e.binary}),wn.set(n,Date.now());return}return yn.set(n,l),wn.delete(n),l})().finally(()=>{Nr.delete(n)});return Nr.set(n,u),u}function vn(n){return yn.get(n)}import{spawn as Xc,spawnSync as Zc}from"node:child_process";function zt(n,e,s){return s===void 0?{jsonrpc:"2.0",id:n,method:e}:{jsonrpc:"2.0",id:n,method:e,params:s}}function Ft(n,e){return e===void 0?{jsonrpc:"2.0",method:n}:{jsonrpc:"2.0",method:n,params:e}}function mt(n,e){return{jsonrpc:"2.0",id:n,result:e}}function nt(n,e){return{jsonrpc:"2.0",id:n,error:e}}var bn=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,PATH_OUTSIDE_WORKSPACE:-32010,FILE_TOO_LARGE:-32011,UNSUPPORTED_MIME:-32012,UPLOAD_FAILED:-32013,UPSTREAM_NOT_READY:-32014};function As(n){return"method"in n&&"id"in n&&n.id!==void 0}function Ps(n){return"method"in n&&!("id"in n)}function Sn(n){return!("method"in n)&&"id"in n}var Jc={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,PATH_OUTSIDE_WORKSPACE:G.PATH_OUTSIDE_WORKSPACE,FILE_TOO_LARGE:G.FILE_TOO_LARGE,UNSUPPORTED_MIME:G.UNSUPPORTED_MIME,UPLOAD_FAILED:G.UPLOAD_FAILED,UPSTREAM_NOT_READY:G.UPSTREAM_NOT_READY};function Ut(n){return n instanceof b?{code:Jc[n.code]??G.INTERNAL_ERROR,message:n.message,data:{bridgeCode:n.code,retriable:n.retriable}}:{code:G.INTERNAL_ERROR,message:n instanceof Error?n.message:String(n)}}function ks(n){let e=n.data,s=e?.bridgeCode??"AGENT_PROTOCOL_ERROR";return new b(s,n.message,{retriable:e?.retriable??!1,cause:n.data})}function Ts(n){return`${JSON.stringify(n)}
108
+ `}var En=class{buffer="";onError;constructor(e={}){this.onError=e.onError}push(e){this.buffer+=typeof e=="string"?e:e.toString("utf8");let s=this.buffer.split(`
109
+ `);this.buffer=s.pop()??"";let a=[];for(let c of s){let u=c.replace(/\r$/,"").trim();if(u)try{a.push(JSON.parse(u))}catch(d){this.onError?.({line:u,error:d})}}return a}flush(){if(!this.buffer)return[];let e=this.buffer.replace(/\r$/,"").trim();if(this.buffer="",!e)return[];try{return[JSON.parse(e)]}catch(s){return this.onError?.({line:e,error:s}),[]}}};var Rs={"session/prompt":"session.prompt","session/cancel":"session.cancel","session/new":"session.new","session/load":"session.load","_agent/create":"agent.create","_agent/health":"agent.health","_agent/pair":"agent.pair","_agent/listSkills":"agent.listSkills","_agent/addSkills":"agent.addSkills","_agent/removeSkills":"agent.removeSkills","_agent/getFileTree":"agent.getFileTree","_agent/getFileContent":"agent.getFileContent","_agent/detail":"agent.detail","_agent/update":"agent.update","_agent/disconnect":"agent.disconnect","_agent/switchModel":"agent.switchModel","_agent/genModelToken":"agent.genModelToken","_agent/reset":"agent.reset","_agent/repair":"agent.repair","session/request_permission":"session.requestPermission",initialize:"initialize"},Fh=Object.fromEntries(Object.entries(Rs).map(([n,e])=>[e,n])),$c={"session.prompt":["agentId","triggerMsgId","sessionId"],"session.cancel":["agentId","triggerMsgId","sessionId"],"session.new":["agentId"],"session.load":["agentId"],"agent.create":["agentId"],"agent.health":[],"agent.listSkills":["agentId"],"agent.addSkills":["agentId"],"agent.removeSkills":["agentId"],"agent.getFileTree":["agentId"],"agent.getFileContent":["agentId"],"agent.detail":["agentId"],"agent.update":["agentId"],"agent.disconnect":["agentId"],"agent.switchModel":["agentId"],"agent.genModelToken":["agentId","sessionId"],"agent.reset":["agentId"],"agent.repair":["agentId"],"session.requestPermission":["agentId","sessionId"],"agent.pair":[],initialize:[]},_t=class{seq=0;next(e,s){this.seq+=1;let a=Rs[e]??Vc(e),c=$c[a]??[],u=[a,String(this.seq)];if(c.length>0){let d=c.map(m=>Ds(s?.[m]??"")),l=Yc(d).join(":");l&&u.push(l)}else s&&Object.values(s).some(d=>d)&&u.push(Object.values(s).filter(Boolean).map(d=>Ds(String(d))).join(":"));return u.join("_")}reset(){this.seq=0}};function Vc(n){return n.replace(/[\s/]+/g,".").replace(/_+/g,"-")}function Ds(n){return n.replace(/[:_\s]+/g,"-")}function Yc(n){let e=n.length;for(;e>0&&!n[e-1];)e-=1;return n.slice(0,e)}U();var Qc=3e4,ex=50,tx=20,Ns=500;function nx(n){try{let e=JSON.stringify(n);return e===void 0||e.length<=Ns?n:`${e.slice(0,Ns)}...<truncated, total ${e.length} chars>`}catch{return"<unserializable>"}}function Os(n,e){if(!(typeof n!="number"||n<=0))try{if(process.platform==="win32"){let s=["/PID",String(n),"/T"];e==="SIGKILL"&&s.push("/F"),Zc("taskkill",s,{stdio:"ignore",windowsHide:!0})}else process.kill(-n,e)}catch{}}var Je=class{constructor(e){this.opts=e;this.log=T(`downstream.${this.constructor.name}`),this.decoder=new En({onError:s=>this.log.warn("decode line failed",{line:s.line})})}opts;child;decoder;pending=new Map;idAllocator=new _t;updateHandlers=[];agentRequestHandlers=[];exitHandlers=[];log;stopped=!1;stderrRing=[];sanitizeEnv(e){return e}async start(){if(this.child)throw new b("BRIDGE_INTERNAL","Downstream already started");let e=process.platform!=="win32",s=Xc(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=s,s.stdout?.setEncoding("utf8"),s.stdout?.on("data",a=>{for(let c of this.decoder.push(a))this.dispatch(c)}),s.stderr?.setEncoding("utf8"),s.stderr?.on("data",a=>{let c=a.trimEnd();this.stderrRing.push(c),this.stderrRing.length>ex&&this.stderrRing.shift(),this.log.debug("stderr",{text:c})}),s.on("exit",(a,c)=>{this.stopped=!0,(a!==0||c!==null)&&this.stderrRing.length>0&&this.log.warn("downstream exited abnormally, recent stderr",{code:a,signal:c,recentStderr:this.stderrRing.slice(-tx)}),this.failAllPending(new b("AGENT_PROTOCOL_ERROR",`agent exited (${a}/${c})`));for(let d of this.exitHandlers)d(a,c)}),s.on("error",a=>{this.log.error("child error",{err:String(a)}),this.failAllPending(new b("AGENT_SPAWN_FAILED",String(a),{cause:a}))}),this.log.info("downstream started",{command:this.opts.command,pid:s.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 s=this.child,a=new Promise(u=>s.once("exit",()=>u()));Os(s.pid,"SIGTERM");let c=setTimeout(()=>{s.killed||Os(s.pid,"SIGKILL")},5e3);try{await a}finally{clearTimeout(c)}}pid(){return this.child?.pid}isAlive(){return!!this.child&&!this.stopped}initialize(e){return this.call("initialize",e)}sessionNew(e){return this.call("session/new",{mcpServers:[],...e})}sessionLoad(e){return this.call("session/load",{mcpServers:[],...e})}sessionPrompt(e){return this.call("session/prompt",e,0)}async sessionCancel(e){!this.child||this.stopped||this.writeFrame(Ft("session/cancel",e))}onUpdate(e){this.updateHandlers.push(e)}onAgentRequest(e){this.agentRequestHandlers.push(e)}respondAgentRequest(e,s){if(!(!this.child||this.stopped))try{this.writeFrame(mt(e,s))}catch(a){this.log.warn("respondAgentRequest write failed",{id:e,err:String(a)})}}respondAgentRequestError(e,s){if(!(!this.child||this.stopped))try{this.writeFrame(nt(e,s))}catch(a){this.log.warn("respondAgentRequestError write failed",{id:e,err:String(a)})}}onExit(e){this.exitHandlers.push(e)}call(e,s,a=Qc){if(!this.child||this.stopped)return Promise.reject(new b("AGENT_PROTOCOL_ERROR","downstream not started"));let c=this.idAllocator.next(e),u=zt(c,e,s),d=a>0&&Number.isFinite(a);return new Promise((l,m)=>{let _=d?setTimeout(()=>{this.pending.delete(c),m(new b("AGENT_TIMEOUT",`${e} timed out after ${a}ms`))},a):null;this.pending.set(c,{resolve:l,reject:m,timer:_,method:e});try{this.writeFrame(u)}catch(y){_&&clearTimeout(_),this.pending.delete(c),m(y)}})}writeFrame(e){if(!this.child?.stdin||this.child.stdin.destroyed)throw new b("AGENT_PROTOCOL_ERROR","downstream stdin not writable");this.child.stdin.write(Ts(e))}dispatch(e){if(Sn(e)){let s=e.id!==null?this.pending.get(e.id):void 0;if(!s){this.log.warn("orphan response",{id:e.id});return}this.pending.delete(e.id),s.timer&&clearTimeout(s.timer),e.error?(this.log.warn("downstream returned error frame",{id:e.id,method:s.method,code:e.error.code,message:e.error.message,data:e.error.data}),s.reject(ks(e.error))):(this.log.info("downstream returned result",{id:e.id,method:s.method,result:nx(e.result)}),s.resolve(e.result));return}if(Ps(e)){if(e.method==="session/update")for(let s of this.updateHandlers)Promise.resolve(s(e.params)).catch(a=>this.log.warn("update handler failed",{err:String(a)}));else this.log.debug("unknown notification",{method:e.method});return}if(As(e)){let s=e;this.handleAgentRequest(s).catch(a=>this.log.error("agent request handler failed",{method:s.method,err:String(a)}))}}async handleAgentRequest(e){if(this.agentRequestHandlers.length===0){this.writeFrame(nt(e.id,{code:-32601,message:`method not handled by Bridge: ${e.method}`}));return}for(let s of this.agentRequestHandlers)try{await s(e)}catch(a){this.log.error("agentRequestHandler threw",{method:e.method,err:String(a)});try{this.writeFrame(nt(e.id,Ut(a)))}catch{}}}failAllPending(e){for(let s of this.pending.values())s.timer&&clearTimeout(s.timer),s.reject(e);this.pending.clear()}};var rx="@agentclientprotocol/claude-agent-acp@latest";function ix(n){let e={};for(let[s,a]of Object.entries(n))a!==void 0&&(s.startsWith("CLAUDE")||s==="AI_AGENT"||s==="BAGGAGE"||(e[s]=a));return e}var Cn=class extends Je{framework="claude-code";constructor(e){let s=vn("claude-code"),[a,c]=s?[s,[]]:["npx",["-y",rx]],u=e.command??a,d=e.args??c,l={command:u,args:d,cwd:e.cwd,...e.env?{env:e.env}:{}};super(l)}sanitizeEnv(e){return ix(e)}};import{mkdtempSync as sx,rmSync as ox}from"node:fs";import{tmpdir as ax}from"node:os";import{join as cx}from"node:path";var xx="@zed-industries/codex-acp@latest",In=class extends Je{framework="codex";authMethodId;codexHomeDir;constructor(e){let s=vn("codex"),[a,c]=s?[s,[]]:["npx",["-y",xx]],u=e.command??a,d=e.args??c,l=e.extraArgs?[...d,...e.extraArgs]:d,m=e.isolateCodexHome?sx(cx(ax(),"coze-bridge-codex-home-")):void 0,_=m?{...e.env??{},CODEX_HOME:m}:e.env,y={command:u,args:l,cwd:e.cwd,..._?{env:_}:{}};super(y),this.authMethodId=e.authMethodId,this.codexHomeDir=m}async initialize(e){let s=await super.initialize(e);return this.authMethodId&&await this.call("authenticate",{methodId:this.authMethodId}),s}async stop(e){if(await super.stop(e),this.codexHomeDir)try{ox(this.codexHomeDir,{recursive:!0,force:!0})}catch{}}};var qt=class extends Je{framework="openclaw";agentId;sessionName;slashModelOnStart;constructor(e){let s=e.sessionName??"default",a=["acp","--session",`agent:${e.agentId}:${s}`];e.gatewayToken&&a.push("--token",e.gatewayToken);let c={command:e.command,args:a,cwd:e.cwd,...e.env?{env:e.env}:{}};super(c),this.agentId=e.agentId,this.sessionName=s,this.slashModelOnStart=e.slashModelOnStart}async afterSessionEstablished(e){this.slashModelOnStart&&(this.log.info("switching session to per-session provider via /model",{agentId:this.agentId,sessionName:this.sessionName,slash:this.slashModelOnStart}),await this.sessionPrompt({sessionId:e,prompt:[{type:"text",text:`/model ${this.slashModelOnStart}`}]}))}get acpSessionName(){return this.sessionName}};U();xe();function Or(n){return n.replace(/[^A-Za-z0-9._-]+/g,"-")}var wt=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((s,a)=>{this.slots.push({task:e,resolve:s,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 s=await e.task();e.resolve(s)}catch(s){e.reject(s)}}}finally{this.running=!1}}}};var An=class{agentId;framework;workspace;deployType;sessions=new Map;sessionQueues=new Map;activeTriggers=new Map;status="ok";model;lastActiveAt=Date.now();constructor(e){this.agentId=e.agentId,this.framework=e.framework,this.workspace=e.workspace,this.model=e.model,this.deployType=e.deployType??"local"}getSessionQueue(e){let s=this.sessionQueues.get(e);return s||(s=new wt,this.sessionQueues.set(e,s)),s}allSessionQueues(){return this.sessionQueues.entries()}async dispose(e){this.status="stopped";let s=new Error(`AgentSession disposed${e?`: ${e}`:""}`);for(let a of this.sessionQueues.values())a.dispose(s);this.sessionQueues.clear(),await this.killAllRuntimes(e??"dispose")}async killAllRuntimes(e){let s=[];for(let[,a]of this.sessions)Kt(a),a.downstream&&(s.push(a.downstream.stop(e).catch(()=>{})),a.downstream=void 0);await Promise.all(s),this.activeTriggers.clear()}};function Kt(n){n.idleTimer&&(clearTimeout(n.idleTimer),n.idleTimer=void 0)}import{spawn as ux}from"node:child_process";import{homedir as dx}from"node:os";import{join as fx}from"node:path";nn();U();async function Ms(){let n=fx(dx(),".openclaw/openclaw.json");return(await lt(n))?.gateway?.auth?.token??""}var Ls=T("openclaw.config"),lx=[0,5e3,5e3],Bs="models.providers.",Pn="agents.defaults.models",kn=class{command;env;retryDelaysMs;queue=new wt;constructor(e){this.command=e.command,this.env=e.env??process.env,this.retryDelaysMs=e.retryDelaysMs??lx}async withRetry(e,s){let a;for(let c=0;c<this.retryDelaysMs.length;c++){let u=this.retryDelaysMs[c]??0;u>0&&await new Promise(d=>setTimeout(d,u));try{return await s()}catch(d){a=d,Ls.warn("openclaw cli failed, will retry",{label:e,attempt:c+1,err:String(d)})}}throw new b("AGENT_SPAWN_FAILED",`openclaw cli ${e} failed after ${this.retryDelaysMs.length} attempts: ${a?.message??"unknown"}`)}runCli(e){return new Promise((s,a)=>{let c=ux(this.command,e,{stdio:["ignore","pipe","pipe"],env:this.env}),u="";c.stderr?.on("data",d=>{u+=d.toString("utf8")}),c.on("error",a),c.on("close",d=>{d===0?s():a(new Error(`exit ${d}: ${u.trim().slice(0,500)}`))})})}async runCliTolerant(e,s){try{await this.runCli(e)}catch(a){let c=String(a);if(s.some(u=>c.includes(u)))return;throw a}}async bestEffortUnset(e,s){try{await this.queue.enqueue(()=>this.withRetry(e,()=>this.runCli(["config","unset",s])))}catch(a){Ls.warn(`${e} failed (best-effort)`,{configPath:s,err:String(a)})}}ensureProvider(e,s){return this.queue.enqueue(()=>this.withRetry(`config set models.providers.${e}`,()=>this.runCli(["config","set",`${Bs}${e}`,JSON.stringify(s),"--strict-json","--merge"])))}removeProvider(e){return this.bestEffortUnset(`config unset models.providers.${e}`,`${Bs}${e}`)}addModelToAllowlist(e,s){let a={[e]:s?{alias:s}:{}};return this.queue.enqueue(()=>this.withRetry(`config set ${Pn}[${e}]`,()=>this.runCli(["config","set",Pn,JSON.stringify(a),"--strict-json","--merge"])))}removeModelFromAllowlist(e){return this.bestEffortUnset(`config unset ${Pn}[${e}]`,`${Pn}.${e}`)}ensureAgent(e,s,a){let c=["agents","add",e,"--workspace",s,"--non-interactive"];return a&&c.push("--model",a),this.queue.enqueue(()=>this.withRetry(`agents add ${e}`,()=>this.runCliTolerant(c,["already exists","already registered"])))}deleteAgent(e){return this.queue.enqueue(()=>this.withRetry(`agents delete ${e}`,()=>this.runCliTolerant(["agents","delete",e,"--force"],["not found","does not exist"])))}};var Pe=T("agent-manager"),gx=(n,e,s,a,c,u,d,l)=>{switch(n){case"claude-code":{let m={...c?{...us(c),...ls(c,d)}:{},...l??{}};return new Cn({cwd:s,...Object.keys(m).length>0?{env:m}:{}})}case"codex":{let m=c?[...ds(c),...gs(c,d)]:[],_={...c?fs(c):{},...l??{}},y=!!c;return new In({cwd:s,...m.length>0?{extraArgs:m}:{},...Object.keys(_).length>0?{env:_}:{},...y?{authMethodId:"openai-api-key",isolateCodexHome:!0}:{}})}case"openclaw":return new qt({command:e,cwd:s,agentId:a,...u?{sessionName:Or(u)}:{},...l&&Object.keys(l).length>0?{env:l}:{}})}};function zs(n){return n==="claude-code"||n==="codex"}var px={path:"",version:"cloud-deployed"},mx={protocolVersion:1,clientCapabilities:{fs:{readTextFile:!0,writeTextFile:!0}}},_x=6e4,Tn=class{paths;config;registry;factory;createTimeoutMs;openclawConfigCache;ensuredProviders=new Set;ipcEndpoint=null;constructor(e){this.paths=e.paths,this.config=e.config,this.registry=e.registry,this.factory=e.downstreamFactory??gx,this.createTimeoutMs=e.createTimeoutMs??_x}setIpcEndpoint(e){this.ipcEndpoint=e}buildCozeBridgeSpawnEnv(e,s){let a=process.platform==="win32"?";":":",c={PATH:`${this.paths.binDir}${a}${process.env.PATH??""}`,COZE_BRIDGE_AGENT_ID:e,COZE_BRIDGE_SESSION_ID:s};return this.ipcEndpoint&&(c.COZE_BRIDGE_IPC_PORT=String(this.ipcEndpoint.port),c.COZE_BRIDGE_IPC_TOKEN=this.ipcEndpoint.token),c}getOpenclawConfig(){if(!this.openclawConfigCache){let e=this.config.frameworksCache?.openclaw;if(!e?.path)throw new b("AGENT_SPAWN_FAILED","openclaw binary not detected on this machine");this.openclawConfigCache=new kn({command:e.path})}return this.openclawConfigCache}async createAgent(e){if(!e.agentId)throw new b("IPC_BAD_REQUEST","agentId required");if(!e.framework)throw new b("IPC_BAD_REQUEST","framework required");let s=Ot(e._meta)==="cloud";this.registry.reviveIfDisconnected?.(e.agentId);let a=this.registry.get(e.agentId);if(a){if(a.framework!==e.framework)throw new b("AGENT_BUSY",`agent ${e.agentId} exists with different framework (${a.framework})`);if(a.status==="error")Pe.warn("existing agent in error state, rebuilding",{agentId:e.agentId}),await a.dispose("rebuild after error").catch(E=>Pe.warn("dispose stale agent failed (ignored)",{err:String(E)})),this.registry.unregister(e.agentId);else return Pe.info("agent already exists, return current",{agentId:e.agentId}),{ok:!0,agentId:a.agentId,workspace:a.workspace,framework:a.framework}}if(!s&&!this.config.frameworksCache?.[e.framework])throw new b("AGENT_SPAWN_FAILED",`framework ${e.framework} not detected on this machine; rerun daemon to refresh frameworks_cache`);s&&zs(e.framework)&&await Is(e.framework);let u=Be(e.agentId,this.paths),d=e.workspace??u.workspace,l=Ot(e._meta),m=new AbortController,_=setTimeout(()=>m.abort(new b("AGENT_TIMEOUT",`_agent/create timed out after ${this.createTimeoutMs}ms`)),this.createTimeoutMs),y,v=!1;try{let E=()=>{if(m.signal.aborted)throw m.signal.reason instanceof Error?m.signal.reason:new b("AGENT_TIMEOUT","_agent/create aborted")};await Lr(u.root,{recursive:!0}),await Lr(d,{recursive:!0}),await Lr(u.logs,{recursive:!0}),E(),await ht(d,e.framework,e.agentId,e.cozeIdentity),E();let k=await fe(e.agentId,this.paths).catch(()=>null),D=cs({model:e.model??k?.model});if(y=new An({agentId:e.agentId,framework:e.framework,workspace:d,model:D.model??Ie,deployType:l}),y.status="ok",k?.sessions){for(let[ee,te]of Object.entries(k.sessions))y.sessions.set(ee,{acpSessionId:te.acpSessionId,modelToken:te.modelToken,tokenGeneratedAt:te.tokenGeneratedAt,lastActiveAt:Date.now(),loadingSession:!1,replySeq:0});let $=Object.keys(k.sessions).length;$>0&&Pe.info("restored persisted session records (no spawn)",{agentId:e.agentId,count:$})}this.registry.register(y),v=!0;let R={agentId:e.agentId,framework:e.framework,workspace:d,cozeIdentity:e.cozeIdentity,createdAt:k?.createdAt??Date.now(),sessions:k?.sessions??{},model:D.model};l==="cloud"&&(R.deployType="cloud"),k?.skills&&(R.skills=k.skills),k?.agentName&&(R.agentName=k.agentName),k?.description&&(R.description=k.description),e.framework==="openclaw"&&(this.config.frameworksCache?.openclaw?.path?await this.getOpenclawConfig().ensureAgent(e.agentId,d):Pe.warn("openclaw binary not on this machine, skip agents add (will fail at session/prompt)",{agentId:e.agentId}));let L=e.initialSkills??[];if(L.length>0){let $=[...R.skills??[]],ee=new Map($.map((X,Z)=>[X.skillId,Z])),te=0;for(let X of L)try{let Z=await Dr({agentId:e.agentId,workspace:d,framework:e.framework,skill:X});Rr($,ee,Z),te++}catch(Z){Pe.warn("initialSkill install failed (skipping)",{agentId:e.agentId,skillId:X.skillId,skillName:X.skillName,err:String(Z)})}te>0&&(R.skills=$,Pe.info("initialSkills installed",{agentId:e.agentId,installed:te,requested:L.length}))}return await ve(R,this.paths),Pe.info("agent created (no spawn, lazy on first prompt)",{agentId:e.agentId,framework:e.framework,deployType:l}),{ok:!0,agentId:e.agentId,workspace:d,framework:e.framework}}catch(E){throw Pe.error("agent create failed, rolling back",{agentId:e.agentId,err:String(E)}),v&&y&&(await y.dispose("rollback").catch(()=>{}),this.registry.unregister(e.agentId)),await hx(u.root,{recursive:!0,force:!0}).catch(k=>Pe.warn("rm agent dir failed (ignored)",{err:String(k)})),E instanceof b?E:new b("AGENT_SPAWN_FAILED",String(E),{cause:E})}finally{clearTimeout(_)}}async spawnSessionDownstream(e,s,a,c){let d=this.config.frameworksCache?.[e.framework];if(!d)if(e.deployType==="cloud"&&zs(e.framework))d=px;else throw new b("AGENT_SPAWN_FAILED",`framework ${e.framework} not detected on this machine`);let l=e.deployType==="cloud"?{model:e.model,modelToken:s}:void 0,m=this.buildCozeBridgeSpawnEnv(e.agentId,a),_;e.framework==="openclaw"?_=await this.buildOpenclawDownstream({session:e,modelConfig:l,cloudSessionId:a,cozeEnv:c,command:d.path,cozeBridgeEnv:m}):_=this.factory(e.framework,d.path,e.workspace,e.agentId,l,a,c,m);try{return await _.start(),await _.initialize(mx),_}catch(y){throw await _.stop("spawnSessionDownstream failed").catch(()=>{}),y instanceof b?y:new b("AGENT_SPAWN_FAILED",y instanceof Error?y.message:String(y),{cause:y})}}async buildOpenclawDownstream(e){let{session:s,modelConfig:a,cloudSessionId:c,cozeEnv:u,command:d,cozeBridgeEnv:l}=e,m=Or(c),_=await Ms(),y=a?hs(a,u):null,v;if(y){let E=kr(c),D=y.models[0]?.id??Ie,R=`${E}/${D}`;if(!this.ensuredProviders.has(R)){let L=this.getOpenclawConfig();await L.ensureProvider(E,y),await L.addModelToAllowlist(R),this.ensuredProviders.add(R)}v=R}return new qt({command:d,cwd:s.workspace,agentId:s.agentId,sessionName:m,..._?{gatewayToken:_}:{},...v?{slashModelOnStart:v}:{},...l&&Object.keys(l).length>0?{env:l}:{}})}async openclawRepair(e,s){let a=this.getOpenclawConfig();await a.deleteAgent(e),await a.ensureAgent(e,s)}async cleanupOpenclawSessionProviders(e){if(e.framework!=="openclaw"||!this.openclawConfigCache)return;let s=this.openclawConfigCache;for(let a of e.sessions.keys()){let c=kr(a),u=`${c}/${e.model}`;this.ensuredProviders.delete(u),await s.removeProvider(c),await s.removeModelFromAllowlist(u)}}};import{randomUUID as Tx}from"node:crypto";import{promises as Dx}from"node:fs";import{basename as Rx}from"node:path";import{promises as vx}from"node:fs";import{basename as bx}from"node:path";U();var Fs=T("file-upload"),Sx="/api/coze_claw/file/agent_upload",Ex=6e4;async function Us(n,e={}){let a=`${dn(ln(e.handshakeBase))}${Sx}`,c=e.timeoutMs??Ex,u=await vx.readFile(n.path),d=new FormData;d.append("agent_id",n.agentId),d.append("session_id",n.sessionId),d.append("file_name",n.name),d.append("file_content",new Blob([u],{type:n.mimeType}),n.name);let l={Authorization:`Bearer ${n.patToken}`,Accept:"application/json","x-coze-version":"3.0",...pt(e.ppeOverride)},m=new AbortController,_=setTimeout(()=>m.abort(),c);Fs.info("file upload start",{url:a,agentId:n.agentId,sessionId:n.sessionId,name:n.name,bytes:n.sizeBytes,mime:n.mimeType});try{let y=await fetch(a,{method:"POST",headers:l,body:d,signal:m.signal}),v=y.headers.get("x-tt-logid")??"";if(!y.ok){let R=await y.text().catch(()=>"");throw new b("UPLOAD_FAILED",`upload HTTP ${y.status} logid=${v}: ${R.slice(0,200)}`)}let E=await y.json();if(E.code!==void 0&&E.code!==0)throw new b("UPLOAD_FAILED",`upload code=${E.code} msg=${E.msg??"-"} logid=${v}`);let k=E.data?.url;if(!k)throw new b("UPLOAD_FAILED",`upload response missing data.url logid=${v}: ${JSON.stringify(E).slice(0,200)}`);let D=E.data?.file_id;return Fs.info("file upload ok",{uri:k,fileId:D,logid:v}),D!==void 0?{uri:k,fileId:D}:{uri:k}}catch(y){throw y instanceof b?y:y.name==="AbortError"?new b("UPLOAD_FAILED",`upload timeout (${c}ms) for ${bx(n.path)}`):new b("UPLOAD_FAILED",String(y),{cause:y})}finally{clearTimeout(_)}}U();import{promises as Cx}from"node:fs";import{extname as Ix}from"node:path";var Ax=[{mime:"image/png",prefix:[137,80,78,71]},{mime:"image/jpeg",prefix:[255,216,255]},{mime:"image/gif",prefix:[71,73,70,56]},{mime:"application/pdf",prefix:[37,80,68,70]}];function Px(n){return n[0]===82&&n[1]===73&&n[2]===70&&n[3]===70&&n[8]===87&&n[9]===69&&n[10]===66&&n[11]===80}var kx={".txt":"text/plain",".md":"text/markdown"};async function qs(n){let e=await Cx.open(n,"r");try{let s=Buffer.alloc(16);if(await e.read(s,0,16,0),Px(s))return"image/webp";for(let a of Ax)if(a.prefix.every((c,u)=>s[u]===c))return a.mime}finally{await e.close()}return kx[Ix(n).toLowerCase()]??"application/octet-stream"}xe();var Nx=T("agent-send"),Ks=50*1024*1024,Ox=new Set(["image/png","image/jpeg","image/webp","image/gif","application/pdf","text/plain","text/markdown"]);async function Gs(n,e){let s=e.core.get(n.agentId);if(!s)throw new b("AGENT_NOT_FOUND",`agent=${n.agentId}`);if(e.core.disconnectedAgents.has(n.agentId))throw new b("AGENT_DISCONNECTED",`agent=${n.agentId} was disconnected by cloud`);let a=s.sessions.get(n.sessionId);if(!a)throw new b("AGENT_NOT_FOUND",`session=${n.sessionId} not active in agent=${n.agentId}`);if(!await Zi(n.path,s.workspace))throw new b("PATH_OUTSIDE_WORKSPACE",`path=${n.path} not under workspace=${s.workspace}`);let c=await Dx.stat(n.path).catch(()=>null);if(!c||!c.isFile())throw new b("IPC_BAD_REQUEST",`path is not a regular file: ${n.path}`);if(c.size>Ks)throw new b("FILE_TOO_LARGE",`${c.size} bytes > limit ${Ks}`);let u=await qs(n.path);if(!Ox.has(u))throw new b("UNSUPPORTED_MIME",`mime=${u} not in whitelist`);if(n.kind==="image"&&!u.startsWith("image/"))throw new b("UNSUPPORTED_MIME",`kind=image but mime=${u}`);if(!e.core.upstream.isConnected())throw new b("UPSTREAM_NOT_READY","cloud WS not connected");let d=n.name??Rx(n.path),l=await Us({patToken:e.patToken,agentId:n.agentId,sessionId:n.sessionId,path:n.path,mimeType:u,name:d,sizeBytes:c.size},{handshakeBase:e.handshakeBase,ppeOverride:e.ppeOverride}),m={sessionUpdate:"agent_file",messageId:Tx(),content:{type:n.kind==="image"?"image":"resource",uri:l.uri,mimeType:u,name:d,sizeBytes:c.size,...l.fileId!==void 0?{fileId:l.fileId}:{},...n.caption!==void 0?{caption:n.caption}:{}}};return await e.core.sendAgentFileUpdate(s,a,n.sessionId,m),Nx.info("agent file sent",{agentId:n.agentId,sessionId:n.sessionId,kind:n.kind,name:d,bytes:c.size,mime:u,uri:l.uri}),{ok:!0,uri:l.uri,bytes:c.size,mimeType:u,...l.fileId!==void 0?{fileId:l.fileId}:{}}}U();import{execFile as Lx}from"node:child_process";import{promisify as Bx}from"node:util";var Mx=Bx(Lx),$e=T("coze-cli-installer"),Hs="@coze/cli@0.1.3-alpha.89c42a",js="https://bnpm.byted.org",zx="coze",Fx=5e3,Ux=9e4,Ws=1e4,Gt=null,Br=!1;async function Js(n,e={}){if(Br)return;if(Gt)return Gt;let s=e.exec??Mx;return Gt=(async()=>{try{let a=await qx(zx,s);if(a){$e.info("coze-cli already on PATH, skip install + config + auth",{path:a}),Br=!0;return}$e.info("coze-cli install start",{package:Hs,registry:js});try{await s("npm",["i","-g",Hs,"--registry",js],{timeout:Ux,maxBuffer:10*1024*1024}),$e.info("coze-cli install ok")}catch(c){$e.warn("coze-cli install failed (skip subsequent steps)",{err:String(c)});return}if(n.env)try{await s("coze",["config","set","xTTEnv",n.env],{timeout:Ws}),$e.info("coze config set xTTEnv ok",{env:n.env})}catch(c){$e.warn("coze config set failed (continue to auth login)",{err:String(c)})}try{await s("coze",["auth","login","--token",n.patToken],{timeout:Ws}),$e.info("coze auth login ok")}catch(c){$e.warn("coze auth login failed",{err:String(c)});return}Br=!0}finally{Gt=null}})(),Gt}async function qx(n,e){let s=process.platform==="win32"?"where":"which";try{let{stdout:a}=await e(s,[n],{timeout:Fx});return a.split(`
110
+ `)[0]?.trim()||void 0}catch{return}}U();import{spawn as Kx}from"node:child_process";import{constants as $s,access as Gx}from"node:fs/promises";import{delimiter as Hx,join as jx}from"node:path";var Wx=T("framework-detector"),Vs={"claude-code":"claude",codex:"codex",openclaw:"openclaw"},Jx=[".exe",".cmd",".bat",".ps1"],yt=class{env;constructor(e={}){this.env={pathEnv:e.pathEnv??process.env.PATH??"",platform:e.platform??process.platform,spawn:e.spawn??Kx,access:e.access??Gx}}async detect(e){let s=Vs[e],a=await this.which(s);if(!a)return Wx.debug("framework binary not found",{framework:e,bin:s}),null;let c=await this.probeVersion(a);return{path:a,version:c}}async detectAll(){let e=await Promise.all(Object.keys(Vs).map(async a=>[a,await this.detect(a)])),s={};for(let[a,c]of e)c&&(s[a]=c);return s}async which(e){let s=this.env.pathEnv.split(Hx).filter(Boolean),a=this.env.platform==="win32"?["",...Jx]:[""];for(let c of s)for(let u of a){let d=jx(c,e+u);if(await this.isExecutable(d))return d}return null}async isExecutable(e){try{let s=this.env.platform==="win32"?$s.F_OK:$s.X_OK;return await this.env.access(e,s),!0}catch{return!1}}async probeVersion(e){return new Promise(s=>{let a="",c=!1,u,d=l=>{c||(c=!0,u&&clearTimeout(u),s(l.trim()||"unknown"))};try{let l=this.env.spawn(e,["--version"],{stdio:["ignore","pipe","pipe"]});u=setTimeout(()=>{l.kill("SIGKILL"),d("unknown")},5e3),l.stdout?.on("data",m=>{a+=m.toString("utf8")}),l.on("error",()=>d("unknown")),l.on("close",()=>{let m=Vx(a).split(/\r?\n/)[0]??"";d(m)})}catch{d("unknown")}})}},$x=new RegExp("\x1B\\[[0-9;]*[A-Za-z]","g");function Vx(n){return n.replace($x,"")}nn();xe();var Yx=10*6e4;function Ys(n){let e=n?.sessionIdleTimeoutMs;return typeof e!="number"||!Number.isFinite(e)||e<=0?Yx:e}function Dn(n){return lt(n??H().configFile)}function vt(n,e){return tn(e??H().configFile,n)}import{randomBytes as xu}from"node:crypto";import{mkdir as Xx,readFile as Zx,realpath as Qx,writeFile as eu}from"node:fs/promises";import{basename as tu,dirname as Mr,join as nu,relative as ru,resolve as Xs,sep as iu}from"node:path";U();var Qs=T("fs-rpc");async function eo(n,e){let s=await no(n.path,e);return await Xx(Mr(s),{recursive:!0}),await eu(s,n.content,"utf8"),Qs.info("fs/write_text_file ok",{path:s,size:n.content.length}),null}async function to(n,e){let s=await no(n.path,e),a=await Zx(s,"utf8"),c=a;if(typeof n.line=="number"||typeof n.limit=="number"){let u=a.split(`
111
+ `),d=Math.max(0,(n.line??1)-1),l=typeof n.limit=="number"?d+n.limit:void 0;c=u.slice(d,l).join(`
112
+ `)}return Qs.info("fs/read_text_file ok",{path:s,size:c.length}),{content:c}}async function no(n,e){if(typeof n!="string"||n.length===0)throw new b("IPC_BAD_REQUEST","path must be a non-empty string");let[s,a]=await Promise.all([Zs(Xs(e)),Zs(Xs(n))]),c=ru(s,a);if(c.startsWith("..")||c===".."||c.startsWith(`..${iu}`))throw new b("IPC_BAD_REQUEST",`path escapes workspace: ${n}`);return a}async function Zs(n){let e=[],s=n;for(;s!==Mr(s);)try{let a=await Qx(s);return e.length?nu(a,...e.reverse()):a}catch{e.push(tu(s)),s=Mr(s)}return n}U();var ro=T("prompt-multimodal"),io=10*1024*1024,su=15e3;async function so(n){return Promise.all(n.map(ou))}async function ou(n){if(n.type!=="image")return n;let e=n;if(e.data||!e.uri||!un(e.uri))return n;try{let{buf:s,contentType:a}=await cu(e.uri),c=e.mimeType||au(a)||"application/octet-stream";return ro.info("image uri fetched and inlined",{uri:e.uri,bytes:s.length,mimeType:c}),{type:"image",data:s.toString("base64"),mimeType:c}}catch(s){return ro.warn("image fetch failed, degrading to text block",{uri:e.uri,err:String(s)}),{type:"text",text:`[image load failed: ${e.uri}]`}}}function au(n){if(!n)return;let e=n.indexOf(";");return(e===-1?n:n.slice(0,e)).trim()||void 0}async function cu(n){let e=new AbortController,s=setTimeout(()=>e.abort(),su);try{let a=await fetch(n,{signal:e.signal});if(!a.ok)throw new Error(`HTTP ${a.status} ${a.statusText}`);let c=await a.arrayBuffer();if(c.byteLength>io)throw new Error(`image too large: ${c.byteLength} bytes (max ${io})`);return{buf:Buffer.from(c),contentType:a.headers.get("content-type")??void 0}}finally{clearTimeout(s)}}We();U();var F=T("core"),uu=3e4,du=3e4,Rn=class{upstream;agents=new Map;disconnectedAgents=new Set;extensions;paths;sessionSpawner;sessionIdleTimeoutMs;upstreamIds=new _t;pendingUpstream=new Map;pendingBridge=new Map;currentCozeEnv;constructor(e){this.upstream=e.upstream,this.extensions=e.extensions??{},this.paths=e.paths,this.sessionSpawner=e.sessionSpawner,this.sessionIdleTimeoutMs=Ys(e.bridgeConfig)}registerExtension(e,s){this.extensions[e]=s}getCozeEnv(){return this.currentCozeEnv}async start(){this.upstream.onFrame(e=>this.handleFrame(e)),await this.upstream.start(),F.info("Core started",{extensions:Object.keys(this.extensions)})}async stop(e){F.info("Core stopping",{reason:e}),await Promise.all([...this.agents.values()].map(s=>s.dispose(e))),this.agents.clear(),await this.upstream.stop(e)}get(e){return this.agents.get(e)}register(e){this.agents.set(e.agentId,e),F.info("agent registered",{agentId:e.agentId,framework:e.framework});for(let s of this.registerHandlers)try{s(e.agentId)}catch(a){F.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)&&F.info("agent revived from disconnect",{agentId:e})}attachRuntimeHooks(e,s,a){let c=a.downstream;c&&(c.onUpdate(u=>{a.loadingSession||this.forwardUpdate(e,u)}),c.onAgentRequest(u=>{this.handleAgentRequest(e,c,u)}),c.onExit((u,d)=>{F.info("session runtime exited",{agentId:e.agentId,cloudId:s,code:u,signal:d}),Kt(a),a.downstream=void 0,a.acpSessionId&&e.activeTriggers.delete(a.acpSessionId)}))}async handleFrame(e){if(Sn(e)){this.handleUpstreamResponse(e);return}if(!("method"in e)||typeof e.method!="string")return;let s="id"in e&&e.id!==void 0?e.id:null,a=e.params?._meta?.cozeEnv;a&&(this.currentCozeEnv=a);try{if(e.method.startsWith("_agent/")){let c=this.extensions[e.method];if(!c){s!==null?await this.sendError(s,G.METHOD_NOT_FOUND,`extension not registered: ${e.method}`):F.warn("drop notification: extension not registered",{method:e.method});return}let u=await c(e,this);s!==null&&await this.upstream.send(mt(s,u));return}if(e.method.startsWith("session/")){let c=await this.routeSessionMethod(e);s!==null&&await this.upstream.send(mt(s,c));return}if(e.method==="initialize"){s!==null&&await this.upstream.send(mt(s,{protocolVersion:1,agentCapabilities:{loadSession:!0}}));return}s!==null?await this.sendError(s,G.METHOD_NOT_FOUND,`method not implemented: ${e.method}`):F.warn("drop unknown notification",{method:e.method})}catch(c){F.error("handleFrame failed",{method:e.method,err:String(c)}),s!==null&&await this.upstream.send(nt(s,Ut(c)))}}async routeSessionMethod(e){if(!e.params||typeof e.params!="object")throw new b("IPC_BAD_REQUEST",`${e.method} requires params`);let s=e.params,a=s._meta?.cozeAgentId;if(!a)throw new b("IPC_BAD_REQUEST",`${e.method}: missing _meta.cozeAgentId`);let c=this.agents.get(a);if(!c)throw this.disconnectedAgents.has(a)?new b("AGENT_DISCONNECTED",`agent ${a} has been disconnected; cloud must _agent/create to revive`):new b("AGENT_NOT_FOUND",`agent not found: ${a}`);let u=typeof s.sessionId=="string"?s.sessionId:void 0;if(e.method==="session/cancel"||e.method==="session/new"||!u)return this.dispatchSessionCall(c,e.method,s);let d=Date.now(),l=!1;try{let m=await c.getSessionQueue(u).enqueue(()=>this.dispatchSessionCall(c,e.method,s));return l=!0,m}finally{F.info("session call done",{agentId:c.agentId,method:e.method,durationMs:Date.now()-d,ok:l})}}async dispatchSessionCall(e,s,a){e.lastActiveAt=Date.now();let{stripped:c}=es(a);switch(s){case"session/new":{let u=fu();return F.info("session/new ack (lazy spawn)",{agentId:e.agentId,cloudId:u}),{sessionId:u}}case"session/load":{let u=c;return F.info("session/load ack (lazy spawn)",{agentId:e.agentId,cloudId:u.sessionId}),{}}case"session/prompt":{let u=c,d=u.sessionId;if(!d)throw new b("IPC_BAD_REQUEST","session/prompt: missing sessionId");let l=await this.ensureRuntime(e,d);if(l.replySeq=0,await this.ensureDownstream(e,d,l),!l.downstream||!l.acpSessionId)throw new b("BRIDGE_INTERNAL","session runtime not ready after ensureDownstream");let m=a._meta?.cozeTriggerMsgId;m?e.activeTriggers.set(l.acpSessionId,m):e.activeTriggers.delete(l.acpSessionId);let _=await so(u.prompt);try{let y=await l.downstream.sessionPrompt({...u,sessionId:l.acpSessionId,prompt:_});return l.lastActiveAt=Date.now(),y}finally{e.activeTriggers.delete(l.acpSessionId),l.downstream?.isAlive()&&this.armIdleTimer(e,d,l)}}case"session/cancel":{let d=c.sessionId;if(!d)throw new b("IPC_BAD_REQUEST","session/cancel: missing sessionId");let l=e.sessions.get(d);return l?.downstream?.isAlive()&&l.acpSessionId&&await l.downstream.sessionCancel({sessionId:l.acpSessionId}),{ok:!0}}default:throw new b("IPC_BAD_REQUEST",`session method not supported: ${s}`)}}async ensureRuntime(e,s){let a=e.sessions.get(s);if(a)return a;let u={modelToken:e.deployType==="cloud"?await this.requestSessionToken(e.agentId,s):"",tokenGeneratedAt:Date.now(),lastActiveAt:Date.now(),loadingSession:!1,replySeq:0};return e.sessions.set(s,u),await this.persistSessionMapping(e),u}async requestSessionToken(e,s){let a={sessionId:s,_meta:{cozeAgentId:e}};try{let c=await this.sendRequest(Ce.GEN_MODEL_TOKEN,a,du);if(!c?.modelToken)throw new b("MODEL_TOKEN_GEN_FAILED",`cloud returned empty modelToken (agentId=${e}, cloudSessionId=${s})`);return c.modelToken}catch(c){throw c instanceof b&&c.code==="MODEL_TOKEN_GEN_FAILED"?c:new b("MODEL_TOKEN_GEN_FAILED",c instanceof Error?c.message:String(c),{cause:c})}}async ensureDownstream(e,s,a){if(Kt(a),a.downstream?.isAlive())return;if(!this.sessionSpawner)throw new b("AGENT_SPAWN_FAILED","sessionSpawner not wired (cannot spawn per-session downstream)");let c=await this.sessionSpawner(e,a.modelToken,s,this.currentCozeEnv);if(a.downstream=c,this.attachRuntimeHooks(e,s,a),a.acpSessionId){a.loadingSession=!0;try{await c.sessionLoad({sessionId:a.acpSessionId,cwd:e.workspace}),F.info("session restored via session/load",{agentId:e.agentId,cloudId:s,acpId:a.acpSessionId})}catch(u){F.warn("session/load failed, fallback to session/new",{agentId:e.agentId,cloudId:s,acpId:a.acpSessionId,err:String(u)}),a.acpSessionId=void 0;let d=await c.sessionNew({cwd:e.workspace});a.acpSessionId=d.sessionId,await this.persistSessionMapping(e)}finally{a.loadingSession=!1}}else{let u=await c.sessionNew({cwd:e.workspace});a.acpSessionId=u.sessionId,await this.persistSessionMapping(e)}c.afterSessionEstablished&&a.acpSessionId&&await c.afterSessionEstablished(a.acpSessionId)}armIdleTimer(e,s,a){if(Kt(a),this.isRuntimeBusy(e,a)){F.debug("skip idle timer: runtime busy (in-flight turn / pending permission)",{agentId:e.agentId,cloudId:s});return}a.idleTimer=setTimeout(()=>{if(a.idleTimer=void 0,this.isRuntimeBusy(e,a)){F.info("idle reaper fired but runtime busy, re-arming",{agentId:e.agentId,cloudId:s}),this.armIdleTimer(e,s,a);return}F.info("session runtime idle timeout, killing downstream",{agentId:e.agentId,cloudId:s});let c=a.downstream;a.downstream=void 0,a.acpSessionId&&e.activeTriggers.delete(a.acpSessionId),c&&c.stop("idle timeout").catch(u=>F.warn("idle stop failed (ignored)",{agentId:e.agentId,cloudId:s,err:String(u)}))},this.sessionIdleTimeoutMs),a.idleTimer.unref?.()}isRuntimeBusy(e,s){if(s.acpSessionId&&e.activeTriggers.has(s.acpSessionId))return!0;let a=s.downstream;if(!a)return!1;for(let c of this.pendingUpstream.values())if(c.downstream===a)return!0;return!1}async sendAgentFileUpdate(e,s,a,c){let u={cozeAgentId:e.agentId,cozeReplySeqID:++s.replySeq};if(s.acpSessionId){let d=e.activeTriggers.get(s.acpSessionId);d&&(u.cozeTriggerMsgId=d)}await this.upstream.send(Ft("session/update",{sessionId:a,update:c,_meta:u}))}forwardUpdate(e,s){let a=s.sessionId,c=this.reverseSessionId(e,a);if(!c){F.debug("drop update for unknown session",{agentId:e.agentId,acpId:a});return}let u=e.sessions.get(c);if(!u){F.debug("drop update: runtime gone",{agentId:e.agentId,cloudId:c});return}if(lu(s)){F.debug("drop codex metadata-warn chunk",{agentId:e.agentId,acpId:a});return}let d={cozeAgentId:e.agentId,cozeReplySeqID:++u.replySeq},l=e.activeTriggers.get(a);l&&(d.cozeTriggerMsgId=l),this.upstream.send(Ft("session/update",{...s,sessionId:c,_meta:d})).catch(m=>F.warn("forward update failed",{agentId:e.agentId,err:String(m)}))}handleAgentRequest(e,s,a){if(a.method==="session/request_permission"){this.forwardPermissionRequest(e,s,a);return}if(a.method==="fs/write_text_file"||a.method==="fs/read_text_file"){this.handleFsRpcRequest(e,s,a);return}F.warn("unhandled agent request,returning method_not_found",{agentId:e.agentId,method:a.method}),s.respondAgentRequestError(a.id,{code:G.METHOD_NOT_FOUND,message:`method not handled by Bridge: ${a.method}`})}async handleFsRpcRequest(e,s,a){try{let c=e.workspace;if(a.method==="fs/write_text_file"){let u=a.params??{},d=await eo(u,c);s.respondAgentRequest(a.id,d)}else{let u=a.params??{},d=await to(u,c);s.respondAgentRequest(a.id,d)}}catch(c){F.warn("fs rpc handler failed",{agentId:e.agentId,method:a.method,err:String(c)}),s.respondAgentRequestError(a.id,Ut(c))}}forwardPermissionRequest(e,s,a){let c=this.upstreamIds.next("session/request_permission"),u=a.params??{},l=u.sessionId,m=l?e.activeTriggers.get(l):void 0,_={cozeAgentId:e.agentId};m&&(_.cozeTriggerMsgId=m);let y=l?this.reverseSessionId(e,l):void 0,v={...u,...y?{sessionId:y}:{},_meta:_};this.pendingUpstream.set(c,{agentRequestId:a.id,agentId:e.agentId,downstream:s,method:a.method}),F.info("forward permission_request \u2192 upstream",{agentId:e.agentId,upstreamId:c,acpSessionId:l,cloudSessionId:y,toolCallId:u.toolCall?.toolCallId,options:u.options?.map(E=>({optionId:E.optionId,kind:E.kind,name:E.name}))}),this.upstream.send(zt(c,"session/request_permission",v)).catch(E=>{this.pendingUpstream.delete(c),F.error("forward permission request failed",{agentId:e.agentId,err:String(E)}),s.respondAgentRequestError(a.id,{code:G.INTERNAL_ERROR,message:`upstream send failed: ${String(E)}`})})}handleUpstreamResponse(e){if(e.id===null)return;let s=this.pendingUpstream.get(e.id);if(s){this.pendingUpstream.delete(e.id),e.error?(F.info("upstream \u2192 permission response (error)",{agentId:s.agentId,upstreamId:e.id,method:s.method,error:e.error}),s.downstream.respondAgentRequestError(s.agentRequestId,e.error)):(F.info("upstream \u2192 permission response (result)",{agentId:s.agentId,upstreamId:e.id,method:s.method,result:e.result}),s.downstream.respondAgentRequest(s.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 bn(e.error)):a.resolve(e.result);return}F.debug("orphan upstream response (no pending)",{id:e.id})}sendRequest(e,s,a=uu){let c=this.upstreamIds.next(e);return new Promise((u,d)=>{let l=setTimeout(()=>{this.pendingBridge.delete(c),d(new b("AGENT_TIMEOUT",`${e} timed out after ${a}ms`))},a);this.pendingBridge.set(c,{method:e,resolve:u,reject:d,timer:l}),this.upstream.send(zt(c,e,s)).catch(m=>{let _=this.pendingBridge.get(c);_&&(clearTimeout(_.timer),this.pendingBridge.delete(c)),d(m)})})}async persistSessionMapping(e){if(this.paths)try{let s=new Map;for(let[a,c]of e.sessions){let u={modelToken:c.modelToken,tokenGeneratedAt:c.tokenGeneratedAt};c.acpSessionId&&(u.acpSessionId=c.acpSessionId),s.set(a,u)}await Ir(e.agentId,s,this.paths)}catch(s){F.warn("persist session mapping failed",{agentId:e.agentId,err:String(s)})}}reverseSessionId(e,s){for(let[a,c]of e.sessions.entries())if(c.acpSessionId===s)return a}sendError(e,s,a){return this.upstream.send(nt(e,{code:s,message:a}))}};function fu(){return xu(16).toString("hex")}function lu(n){let e=n.update;if(e?.sessionUpdate!=="agent_message_chunk")return!1;let s=e.content;if(!s||typeof s!="object")return!1;let a=s;return a.type!=="text"||typeof a.text!="string"?!1:a.text.startsWith("Model metadata for `")}U();xe();import{randomBytes as hu}from"node:crypto";import{chmod as gu,mkdir as pu,writeFile as oo}from"node:fs/promises";import{createServer as mu}from"node:http";import{dirname as _u}from"node:path";var wu=1e6,zr=T("ipc"),Nn=class{server=null;port=0;token="";routes;paths;constructor(e){this.routes=new Map(e.routes.map(s=>[`${s.method} ${s.path}`,s])),this.paths=e.paths??H()}async start(){this.token=hu(32).toString("hex");let e=mu((a,c)=>{this.dispatch(a,c)});this.server=e,await new Promise((a,c)=>{e.once("error",c),e.listen(0,"127.0.0.1",()=>a())});let s=e.address();if(!s||typeof s!="object")throw new Error("failed to obtain IPC port");return this.port=s.port,await this.persistAuthFiles(),zr.info("IPC listening",{port:this.port}),{port:this.port,token:this.token}}async stop(){let e=this.server;e&&(await new Promise((s,a)=>{e.close(c=>c?a(c):s())}),this.server=null)}async persistAuthFiles(){await pu(_u(this.paths.portFile),{recursive:!0}),await oo(this.paths.portFile,String(this.port),"utf8"),await oo(this.paths.tokenFile,this.token,{encoding:"utf8",mode:384});try{await gu(this.paths.tokenFile,384)}catch(e){zr.warn("chmod token file failed (non-POSIX?)",{err:String(e)})}}async dispatch(e,s){if(e.headers.authorization!==`Bearer ${this.token}`){Ht(s,401,{error:"unauthorized"});return}let c=`${e.method} ${(e.url??"").split("?")[0]}`,u=this.routes.get(c);if(!u){Ht(s,404,{error:"not found"});return}let d=null;if(e.method==="POST")try{d=await yu(e)}catch(l){Ht(s,400,{error:"invalid json",detail:String(l)});return}try{let l=await u.handler(d,e);Ht(s,200,l??{ok:!0})}catch(l){zr.error("IPC handler failed",{key:c,err:String(l)}),Ht(s,500,{error:l instanceof Error?l.message:String(l)})}}};function Ht(n,e,s){n.statusCode=e,n.setHeader("content-type","application/json"),n.end(JSON.stringify(s))}async function yu(n){let e=[],s=0;for await(let c of n){let u=c;if(s+=u.length,s>wu)throw new Error("body too large");e.push(u)}let a=Buffer.concat(e).toString("utf8");return a?JSON.parse(a):null}var ka=Le(_o(),1);var ef=Le(la(),1),tf=Le(Vn(),1),nf=Le(Et(),1),rf=Le(Xr(),1),sf=Le(ei(),1),of=Le(oi(),1),ba=Le(Qn(),1),af=Le(va(),1);var Sa=ba.default;U();var ae=T("upstream.frontier"),Ca="application/json",Ia="none",tr=class{constructor(e){this.opts=e}opts;fws=null;handler=null;connectHandler=null;opened=!1;openCount=0;async start(){if(this.fws){ae.warn("start called on already-started FrontierUpstream; noop");return}let e={Authorization:`Bearer ${this.opts.privatecode}`,Origin:rs,...pt(this.opts.ppeOverride)};class s extends Sa{constructor(l){super(l,ns,{headers:e})}send(l,...m){if(Vi("debug"))try{let _;typeof l=="string"?_=Buffer.from(l,"utf8"):l instanceof Buffer?_=l:l instanceof ArrayBuffer?_=new Uint8Array(l):ArrayBuffer.isView(l)?_=new Uint8Array(l.buffer,l.byteOffset,l.byteLength):_=new Uint8Array(0);let y=Buffer.from(_.slice(0,128)).toString("hex");ae.debug("WS raw frame out",{bytes:_.byteLength,headHex:y})}catch(_){ae.warn("WS raw frame dump failed",{err:String(_)})}super.send(l,...m)}}let a=ss(this.opts.urlOverride),c={url:a,ws:s,fpID:ts,aID:fn,accessKey:this.opts.handshake.accessKey,deviceID:this.opts.handshake.deviceId,payloadType:{type:Ca,force:!0},payloadEncoding:{encoding:Ia,force:!0},enableTransformTextPayload:!0,enableQoS:!1,enableAutoAck:!1,automaticOpen:!1,debug:this.opts.debug??!1},u=new ka.FWS(c);u.onopen=()=>{this.opened=!0,this.openCount+=1;let d=this.openCount===1;ae.info("frontier opened",{url:a,remoteDeviceId:this.opts.handshake.deviceId,initial:d,openCount:this.openCount}),this.connectHandler&&Promise.resolve(this.connectHandler({initial:d})).catch(l=>ae.warn("onConnect handler threw (ignored)",{err:String(l)}))},u.onclose=d=>{this.opened=!1,ae.info("frontier closed",{code:d.code,reason:d.reason,willReconnect:d.willReconnect})},u.onerror=d=>{ae.warn("frontier error",{code:d.code,msg:d.message})},u.onmessage=d=>this.handleMessage(d),this.fws=u,await u.connect()}async stop(e){let s=this.fws;if(s){this.fws=null,this.opened=!1;try{s.close(1e3,e??"bridge shutdown")}catch(a){ae.warn("frontier close threw (ignored)",{err:String(a)})}}}async send(e){let s=this.fws;if(!s)throw new b("UPSTREAM_DISCONNECTED","frontier upstream not started");let a=JSON.stringify(e),c=e;Aa(c)||ae.info("frontier frame out",{method:c.method,jsonrpcId:c.id,size:a.length});try{await s.send(a,{service:33555712,method:1,payloadType:Ca,payloadEncoding:Ia})}catch(d){throw ae.warn("frontier frame send failed",{method:c.method,jsonrpcId:c.id,err:String(d)}),new b("UPSTREAM_DISCONNECTED",`frontier send failed: ${String(d)}`,{cause:d})}}onFrame(e){this.handler=e}onConnect(e){this.connectHandler=e}isConnected(){return this.opened&&this.fws?.readyState===1}handleMessage(e){let s=e.message?.service;if(s!==33555712){ae.debug("drop non-adapter frontier frame",{service:s});return}let a=df(e);if(!a){ae.debug("frontier message without text payload, drop",{payloadType:e.message?.payloadType});return}if(!this.handler){ae.debug("frame received but no onFrame handler",{size:a.length});return}let c;try{c=JSON.parse(a)}catch(d){ae.warn("frontier message JSON parse failed",{err:String(d),head:a.slice(0,80)});return}let u=c;Aa(u)||ae.info("frontier frame in",{logid:uf(e.message?.LogID),logidNew:e.message?.LogIDNew,msgId:e.message?.msgID,jsonrpcId:u.id,method:u.method,body:xf(a)}),Promise.resolve(this.handler(c)).catch(d=>ae.warn("frontier frame handler threw",{err:String(d)}))}};function Aa(n){return n.method==="_agent/health"?!0:typeof n.id=="string"&&n.id.startsWith("agent.health_")}var Pa=2e3;function xf(n){return n.length<=Pa?n:`${n.slice(0,Pa)}...<truncated, total ${n.length} chars>`}function uf(n){return n?n.high===0?String(n.low>>>0):`${n.high.toString(16)}${(n.low>>>0).toString(16).padStart(8,"0")}`:""}function df(n){let e=n.message;if(e?.textPayload)return e.textPayload;let s=e?.payload;if(!s)return null;try{return Buffer.from(s).toString("utf8")}catch{return null}}U();var ci=T("upstream.switchable"),nr=class{inner;handler=null;connectHandler=null;constructor(e){this.inner=e}async swap(e,s){if(this.inner===e)return;ci.info("swap upstream",{reason:s});let a=this.inner;this.inner=e,this.handler&&e.onFrame(this.handler),this.connectHandler&&e.onConnect&&e.onConnect(this.connectHandler);try{await e.start()}catch(c){throw ci.error("swap target start failed, reverting",{err:String(c)}),this.inner=a,c}await a.stop(s??"swapped").catch(c=>ci.warn("previous upstream stop threw (ignored)",{err:String(c)}))}current(){return this.inner}start(){return this.inner.start()}stop(e){return this.inner.stop(e)}send(e){return this.inner.send(e)}onFrame(e){this.handler=e,this.inner.onFrame(e)}onConnect(e){this.connectHandler=e,this.inner.onConnect?.(e)}isConnected(){return this.inner.isConnected()}};U();var xi=T("upstream"),Qt=class{handler=null;async start(){xi.info("NoopUpstream started (M1 skeleton; real Frontier wired in M4)")}async stop(e){xi.info("NoopUpstream stopped",{reason:e})}async send(e){xi.debug("NoopUpstream.send (dropped)",{method:"method"in e?e.method:void 0})}onFrame(e){this.handler=e}isConnected(){return!1}async injectFrame(e){this.handler&&await this.handler(e)}};U();xe();xe();import{promises as rr}from"node:fs";import{join as ff}from"node:path";function lf(n){return`#!/bin/sh
113
+ exec node ${JSON.stringify(n)} "$@"
114
+ `}function hf(n){return`@echo off
115
+ node ${JSON.stringify(n)} %*
116
+ `}async function Ta(n,e=H()){let s=e.binDir;await rr.mkdir(s,{recursive:!0});let a=ff(s,process.platform==="win32"?"coze-bridge.cmd":"coze-bridge"),c=process.platform==="win32"?hf(n):lf(n);return await rr.readFile(a,"utf8").catch(()=>null)===c||(await rr.writeFile(a,c,"utf8"),process.platform!=="win32"&&await rr.chmod(a,493)),s}U();xe();import{execSync as Ra}from"node:child_process";import{readFileSync as Na,unlinkSync as gf}from"node:fs";import{mkdir as pf,readFile as Oa,unlink as La,writeFile as mf}from"node:fs/promises";import{dirname as _f}from"node:path";function Da(n){try{return process.kill(n,0),!0}catch(e){return e.code==="EPERM"}}var wf=T("single-instance"),ir=class{pidFile;acquired=!1;constructor(e={}){this.pidFile=e.pidFile??H().pidFile,e.processTitle&&(process.title=e.processTitle)}async acquire(){let e=await this.readExistingPid();return e!==null&&this.isAlive(e)?{kind:"already-running",pid:e}:(e!==null&&(wf.warn("removing stale pid file",{stalePid:e}),await La(this.pidFile).catch(()=>{})),await pf(_f(this.pidFile),{recursive:!0}),await mf(this.pidFile,String(process.pid),"utf8"),this.acquired=!0,this.installCleanupHooks(),{kind:"acquired"})}async release(){if(this.acquired){try{(await Oa(this.pidFile,"utf8")).trim()===String(process.pid)&&await La(this.pidFile)}catch{}this.acquired=!1}}async readExistingPid(){try{let e=await Oa(this.pidFile,"utf8"),s=Number.parseInt(e.trim(),10);return Number.isFinite(s)&&s>0?s:null}catch(e){if(e.code==="ENOENT")return null;throw e}}isAlive(e){return Da(e)?this.matchesDaemonTitle(e):!1}matchesDaemonTitle(e){if(process.platform==="win32")return this.matchesDaemonTitleWindows(e);try{let s=Na(`/proc/${e}/cmdline`,"utf8").replace(/\0/g," ");return!!(s.includes("coze-bridge-daemon")||s.includes("lib/index.js"))}catch{}try{let s=Ra(`ps -o command= -p ${e}`,{stdio:["ignore","pipe","ignore"],timeout:1e3}).toString();return s.trim()?s.includes("coze-bridge-daemon")||s.includes("lib/index.js"):!1}catch{return!0}}matchesDaemonTitleWindows(e){try{let a=Ra(`tasklist /FI "PID eq ${e}" /FO CSV /NH`,{stdio:["ignore","pipe","ignore"],timeout:2e3}).toString().trim();if(!a||a.startsWith("INFO:"))return!1;let c=a.split(",",1)[0]?.replace(/^"|"$/g,"").toLowerCase()??"";return c.includes("node")||c.includes("coze-bridge")}catch{return!0}}installCleanupHooks(){process.once("exit",()=>{if(this.acquired)try{Na(this.pidFile,"utf8").trim()===String(process.pid)&&gf(this.pidFile)}catch{}})}};var z=T("daemon"),yf="coze-bridge-daemon";async function za(){let n=new ir({processTitle:yf}),e=await n.acquire();if(e.kind==="already-running")throw new Error(`coze-bridge daemon already running (pid=${e.pid})`);let s=await Dn(),a=s??{};Cr({pid:process.pid}),z.info(s?"loaded bridge config":"initialized bridge config");try{let A=new yt;a.frameworksCache=await A.detectAll(),z.info("refreshed frameworks_cache",{detected:Object.keys(a.frameworksCache)})}catch(A){z.warn("framework detection failed",{err:String(A)})}await vt(a);let c=new nr(new Qt),u=H(),d=null,l=new Rn({upstream:c,paths:u,bridgeConfig:a,sessionSpawner:async(A,M,q,re)=>{if(!d)throw new Error("agentManager not ready");return d.spawnSessionDownstream(A,M,q,re)}});await bf(u,l);let m=new Tn({paths:u,config:a,registry:l});d=m;let _,y,v=null,E={},k,D=null;l.registerExtension("_agent/create",async A=>m.createAgent(A.params)),l.registerExtension("_agent/health",async()=>({ok:!0}));let R={},L=new gn({agents:l.agents,disposeAndMarkDisconnected:async(A,M)=>{let q=l.agents.get(A);q&&(await m.cleanupOpenclawSessionProviders(q).catch(re=>z.warn("cleanup openclaw providers failed (ignored)",{agentId:A,err:String(re)})),await q.dispose(`disconnect: ${M}`).catch(re=>z.warn("dispose during disconnect failed (ignored)",{agentId:A,err:String(re)})),q.status="disconnected",l.unregister(A)),l.disconnectedAgents.add(A)},detailSyncer:async A=>{if(!R.ref)throw new Error("agent-detail-sync not initialized yet");await R.ref.syncOne(A)},openclawRepair:async(A,M)=>{await m.openclawRepair(A,M)}});l.registerExtension("_agent/listSkills",A=>L.listSkills(A.params)),l.registerExtension("_agent/addSkills",A=>L.addSkills(A.params)),l.registerExtension("_agent/removeSkills",A=>L.removeSkills(A.params)),l.registerExtension("_agent/getFileTree",A=>L.getFileTree(A.params)),l.registerExtension("_agent/getFileContent",A=>L.getFileContent(A.params)),l.registerExtension("_agent/update",A=>L.updateAgent(A.params)),l.registerExtension("_agent/disconnect",A=>L.disconnectAgent(A.params)),l.registerExtension("_agent/switchModel",A=>L.switchModel(A.params)),l.registerExtension("_agent/reset",A=>L.resetAgent(A.params)),l.registerExtension("_agent/repair",A=>L.repairAgent(A.params));let $=new xn({paths:u,handlers:L,sendDetail:A=>l.sendRequest("_agent/detail",A)});R.ref=$,c.onConnect(({initial:A})=>{z.info("frontier upstream connected, triggering detail sync",{initial:A}),$.syncAll(A?"initial-connect":"reconnect").catch(M=>z.warn("detail sync top-level error (ignored)",{err:String(M)}))});let ee=new Nn({paths:u,routes:[{method:"GET",path:"/status",handler:async()=>({running:!0,pid:process.pid,agents:[...l.agents.keys()],deviceId:v??"",frameworksCache:a.frameworksCache??{}})},{method:"POST",path:"/pair",handler:async A=>{let M=A,q=M?.privatecode,re=M?.pairing_code;if(!q||!re)throw new b("IPC_BAD_REQUEST","/pair requires privatecode + pairing_code");let Qe=hn(M.env),ct=M.handshake_url,Tt=M.frontier_url,_e=vf(M.env,ct,Tt),Se=!!_&&_!==q,en=y!==void 0&&y!==_e,ce=Se||en;if(ce){z.warn("pair config switched, resetting agents",{pcChanged:Se,envChanged:en,previousPc:_?Ba(_):"",nextPc:Ba(q),previousEnvKey:y??"",nextEnvKey:_e});for(let ie of[...l.agents.values()])await ie.dispose("pair config switch").catch(()=>{}),l.agents.delete(ie.agentId);await c.swap(new Qt,"pair switch").catch(()=>{})}let Dt=await as({privatecode:q,...ct?{endpoint:ct}:{},ppeOverride:Qe});v=Dt.deviceId,Cr({deviceId:v,pid:process.pid}),Js({patToken:q,env:M.env}).catch(ie=>z.warn("coze-cli setup error (ignored)",{err:String(ie)}));let ne=new tr({handshake:Dt,privatecode:q,...Tt?{urlOverride:Tt}:{},ppeOverride:Qe});await c.swap(ne,"pair");try{let ie=new yt;a.frameworksCache=await ie.detectAll(),await vt(a),z.info("frameworks_cache refreshed before pair",{detected:Object.keys(a.frameworksCache)})}catch(ie){z.warn("frameworks_cache refresh failed (ignored, using cached)",{err:String(ie)})}let V=Object.keys(a.frameworksCache??{});try{let ie=await l.sendRequest("_agent/pair",{pairCode:re,patToken:q,frameworks:V,_meta:{cozeDeviceId:v}});z.info("_agent/pair ok",{pairResult:ie}),_=q,y=_e,E=Qe,k=ct,D||(D=new _n({core:l,getDeviceId:()=>v??""})),D.start(),ce&&Ma(u,m).catch(Ne=>z.warn("post-pair-switch auto-revive error (ignored)",{err:String(Ne)}));let Re;return M.agent_id&&(Re=await Sf(M.agent_id,u,m,Ne=>l.sendRequest("_agent/detail",Ne)).catch(Ne=>(z.error("--agent-id ensureAgent failed",{agentId:M.agent_id,err:String(Ne)}),{ok:!1,agentId:M.agent_id??"",note:String(Ne)}))),{ok:!0,note:"paired with cloud",...Re?{agent:Re}:{}}}catch(ie){return z.error("_agent/pair failed",{err:String(ie)}),{ok:!1,note:`pair failed: ${String(ie)}`}}}},{method:"POST",path:"/_agent/create",handler:async A=>{let M=A;return{ok:!0,result:await m.createAgent(M)}}},{method:"POST",path:"/agent/send",handler:async A=>{let M=A;if(!M?.agentId||!M?.sessionId||!M?.kind||!M?.path)throw new b("IPC_BAD_REQUEST","/agent/send requires agentId, sessionId, kind, path");if(!_)throw new b("UPSTREAM_NOT_READY","daemon not yet paired with cloud (run --pair-code first)");try{return await Gs(M,{core:l,patToken:_,handshakeBase:k,ppeOverride:E})}catch(q){if(q instanceof b)return{ok:!1,code:q.code,message:q.message};throw q}}},{method:"POST",path:"/refresh",handler:async()=>{z.info("IPC /refresh: re-detecting frameworks");let A=new yt;return a.frameworksCache=await A.detectAll(),await vt(a),{ok:!0,frameworks:a.frameworksCache}}},{method:"POST",path:"/shutdown",handler:async()=>(z.info("IPC /shutdown received"),setImmediate(()=>{Ke.shutdown("ipc /shutdown")}),{ok:!0})}]}),{port:te,token:X}=await ee.start();m.setIpcEndpoint({port:te,token:X});try{await Ta(u.libEntry,u)}catch(A){z.warn("bin shim install failed (D72 send \u547D\u4EE4\u53EF\u80FD\u4E0D\u53EF\u7528)",{err:String(A)})}await l.start(),Ma(u,m).catch(A=>z.warn("auto-revive top-level error (ignored)",{err:String(A)}));let Z=null,Ke={port:te,token:X,core:l,ipc:ee,shutdown(A){return Z||(z.info("daemon shutdown",{reason:A}),Z=(async()=>{D?.stop(),await l.stop(A),await ee.stop(),await n.release()})(),Z)}};for(let A of["SIGTERM","SIGINT"])process.on(A,()=>{Ke.shutdown(A).then(()=>process.exit(0))});return z.info("daemon ready",{port:te,pid:process.pid,nodeVersion:process.version,platform:process.platform,frameworks:Object.keys(a.frameworksCache??{}),libVersion:a.libVersion??"dev"}),Ke}function Ba(n){return n.length<=8?"***":`${n.slice(0,4)}***${n.slice(-4)}`}function vf(n,e,s){return`${n??""}|${e??""}|${s??""}`}async function bf(n,e){let{readdir:s}=await import("node:fs/promises"),a;try{a=await s(n.agentsRoot)}catch{return}let{loadAgentConfig:c,enforceAgentConfigMode:u}=await Promise.resolve().then(()=>(We(),cn));for(let d of a){await u(d,n).catch(l=>z.warn("enforceAgentConfigMode failed (ignored)",{agentId:d,err:String(l)}));try{let l=await c(d,n);l?.disconnectedAt&&(e.disconnectedAgents.add(d),z.info("agent marked disconnected on startup",{agentId:d,disconnectedAt:l.disconnectedAt,reason:l.disconnectReason??""}))}catch(l){z.warn("failed to load agent config on startup, skipping",{agentId:d,err:String(l)})}}}async function Sf(n,e,s,a){let{loadAgentConfig:c}=await Promise.resolve().then(()=>(We(),cn)),u=await c(n,e);if(u){z.info("--agent-id: local config found, reconnecting",{agentId:n,framework:u.framework,hadDisconnect:!!u.disconnectedAt});let _={agentId:u.agentId,framework:u.framework,...u.cozeIdentity?{cozeIdentity:u.cozeIdentity}:{},...u.model?{model:u.model}:{}};return await s.createAgent(_),{ok:!0,agentId:n,note:u.disconnectedAt?"revived from local config":"connected from local config"}}z.info("--agent-id: local config missing, pulling _agent/detail from cloud",{agentId:n});let d=await a({_meta:{cozeAgentId:n}});if(!d.framework)throw new b("AGENT_NOT_FOUND",`agent ${n} \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 l={agentId:d.agentId,framework:d.framework,...d.cozeIdentity?{cozeIdentity:d.cozeIdentity}:{},...d.model?{model:d.model}:{},...d.deployType?{_meta:{cozeDeployType:d.deployType}}:{}};await s.createAgent(l);let m=d.deployType==="cloud"&&d.framework==="openclaw";return{ok:!0,agentId:n,note:m?"cloud agent acknowledged":"created from cloud detail"}}async function Ma(n,e){let{readdir:s}=await import("node:fs/promises"),a;try{a=await s(n.agentsRoot)}catch{return{revived:0,skipped:0,total:0}}if(a.length===0)return{revived:0,skipped:0,total:0};let{loadAgentConfig:c}=await Promise.resolve().then(()=>(We(),cn));z.info("auto-revive: scanning local agents on startup",{count:a.length});let u=0,d=0;for(let l of a){let m;try{m=await c(l,n)}catch(_){z.warn("auto-revive: load config failed (skipping)",{agentId:l,err:String(_)}),d+=1;continue}if(!m){d+=1;continue}if(m.disconnectedAt){z.info("auto-revive: skip disconnected agent",{agentId:l,disconnectedAt:m.disconnectedAt}),d+=1;continue}try{z.info("auto-revive: re-registering agent (D44 no spawn)",{agentId:l,framework:m.framework}),await e.createAgent({agentId:m.agentId,framework:m.framework,...m.cozeIdentity?{cozeIdentity:m.cozeIdentity}:{},...m.model?{model:m.model}:{},...m.deployType?{_meta:{cozeDeployType:m.deployType}}:{}}),u+=1}catch(_){z.warn("auto-revive: createAgent failed (skipping)",{agentId:l,framework:m.framework,err:String(_)}),d+=1}}return z.info("auto-revive: done",{revived:u,skipped:d,total:a.length}),{revived:u,skipped:d,total:a.length}}di();xe();import{readFile as Ua}from"node:fs/promises";var Xe=class{paths;constructor(e){this.paths=e??H()}async probe(e=1e3){let s=await this.readAuth();if(!s)return{kind:"not-running"};try{let a=await this.fetch(s,{method:"GET",path:"/status",timeoutMs:e});return a.status===200?{kind:"connected",...s}:{kind:"stale",reason:`unexpected status ${a.status}`}}catch(a){return{kind:"stale",reason:Rf(a)}}}async request(e){let s=await this.readAuth();if(!s)throw new Error("coze-bridge daemon not running (no port/token files)");return this.fetch(s,e)}async readAuth(){try{let[e,s]=await Promise.all([Ua(this.paths.portFile,"utf8"),Ua(this.paths.tokenFile,"utf8")]),a=Number.parseInt(e.trim(),10),c=s.trim();return!Number.isFinite(a)||a<=0||!c?null:{port:a,token:c}}catch(e){if(e.code==="ENOENT")return null;throw e}}async fetch(e,s){let a=s.body!==void 0,c={Authorization:`Bearer ${e.token}`};a&&(c["content-type"]="application/json");let u=new AbortController,d=setTimeout(()=>u.abort(),s.timeoutMs??5e3);try{let l=await fetch(`http://127.0.0.1:${e.port}${s.path}`,{method:s.method,headers:c,body:a?JSON.stringify(s.body):void 0,signal:u.signal}),m=await l.text();return{status:l.status,body:Df(m)}}finally{clearTimeout(d)}}};function Df(n){if(!n)return null;try{return JSON.parse(n)}catch{return n}}function Rf(n){return n instanceof Error?n.message:String(n)}U();xe();import{copyFile as qa,mkdir as Nf,readFile as fi,writeFile as Of}from"node:fs/promises";import{dirname as Lf,resolve as li,sep as sr}from"node:path";import{fileURLToPath as Bf}from"node:url";U();xe();var Ka=T("dist-install");function Mf(n){let e=Bf(n),s=Lf(e),a=`${sr}src${sr}`;if(s.includes(a)||s.endsWith(`${sr}src${sr}cli`))return null;let c=li(s,"index.js"),u=li(s,"..","package.json");return{dist:c,pkgJson:u}}async function Ga(n={}){let e=n.paths??H(),s=Mf(import.meta.url),a=n.sourceDist??s?.dist,c=n.sourcePackageJson??s?.pkgJson;if(!a||!c)return{kind:"dev-mode-skip",reason:"running from src/(tsx loader);no dist/ to install"};let u;try{u=JSON.parse(await fi(c,"utf8")).version??"unknown"}catch(v){return Ka.warn("cannot read source package.json,skip dist install",{err:String(v)}),{kind:"dev-mode-skip",reason:`package.json read failed: ${String(v)}`}}let d=await Dn(e.configFile)??{},l=d.libVersion;if(l===u)try{return await fi(e.libEntry),{kind:"already-current",libVersion:u}}catch{}await Nf(e.libDir,{recursive:!0}),await qa(a,e.libEntry),await qa(`${a}.map`,`${e.libEntry}.map`).catch(()=>{});let m=li(e.libDir,"package.json"),_=`${JSON.stringify({type:"module"},null,2)}
117
+ `;return await fi(m,"utf8").catch(()=>null)!==_&&await Of(m,_),d.libVersion=u,await vt(d,e.configFile),Ka.info("dist installed",{libEntry:e.libEntry,fromVersion:l,toVersion:u}),l?{kind:"version-changed",fromVersion:l,toVersion:u,libEntry:e.libEntry}:{kind:"first-install",libVersion:u,libEntry:e.libEntry}}import{basename as zf,resolve as Ff}from"node:path";var Uf=9e4,qf={PATH_OUTSIDE_WORKSPACE:3,FILE_TOO_LARGE:3,UNSUPPORTED_MIME:3,IPC_BAD_REQUEST:3,AGENT_NOT_FOUND:4,IPC_AUTH_FAILED:4,AGENT_DISCONNECTED:5,UPLOAD_FAILED:5,UPSTREAM_NOT_READY:5,UPSTREAM_DISCONNECTED:5,UPSTREAM_HANDSHAKE_FAILED:5,AGENT_BUSY:1,AGENT_SPAWN_FAILED:1,AGENT_TIMEOUT:1,AGENT_PROTOCOL_ERROR:1,BRIDGE_CONFIG_INVALID:1,BRIDGE_INTERNAL:1,MODEL_TOKEN_GEN_FAILED:1,OPERATION_NOT_ALLOWED_FOR_LOCAL:1};function Kf(n){return qf[n]??1}async function Ha(n){let e=Gf();if(!e)return process.stderr.write(`Error: not running inside a coze-bridge agent process (missing COZE_BRIDGE_* env). This command is intended to be called by an LLM inside an agent session.
118
+ `),4;let s=Ff(process.cwd(),n.path),a={agentId:e.agentId,sessionId:e.sessionId,kind:n.kind,path:s,...n.caption?{caption:n.caption}:{},...n.name?{name:n.name}:{}},c;try{c=await Hf(e,"/agent/send",a,Uf)}catch(u){return process.stderr.write(`Error: daemon IPC failed: ${u instanceof Error?u.message:String(u)}
119
+ `),4}if(!c.ok)return process.stderr.write(`Error: ${c.code}: ${c.message}
120
+ `),Kf(c.code);if(n.json)process.stdout.write(`${JSON.stringify(c)}
121
+ `);else{let u=n.name??zf(s);process.stdout.write(`Sent ${n.kind} ${u} (${jf(c.bytes)})
122
+ `)}return 0}function Gf(){let n=process.env.COZE_BRIDGE_AGENT_ID,e=process.env.COZE_BRIDGE_SESSION_ID,s=process.env.COZE_BRIDGE_IPC_PORT,a=process.env.COZE_BRIDGE_IPC_TOKEN;if(!n||!e||!s||!a)return null;let c=Number.parseInt(s,10);return!Number.isFinite(c)||c<=0?null:{agentId:n,sessionId:e,port:c,token:a}}async function Hf(n,e,s,a){let c=new AbortController,u=setTimeout(()=>c.abort(),a);try{let d=await fetch(`http://127.0.0.1:${n.port}${e}`,{method:"POST",headers:{Authorization:`Bearer ${n.token}`,"content-type":"application/json"},body:JSON.stringify(s),signal:c.signal}),l=await d.text(),m=l?JSON.parse(l):null;return m&&typeof m=="object"&&"ok"in m?m:{ok:!1,code:"BRIDGE_INTERNAL",message:`unexpected daemon response (status=${d.status}): ${l.slice(0,200)}`}}finally{clearTimeout(u)}}function jf(n){return n<1024?`${n}B`:n<1024*1024?`${(n/1024).toFixed(1)}KB`:`${(n/1024/1024).toFixed(1)}MB`}var ul=T("cli");function Ze(n,e){let s=[],a;for(let c=0;c<n.length;c++){let u=n[c];if(u===e){a=n[c+1],c+=1;continue}if(u.startsWith(`${e}=`)){a=u.slice(e.length+1);continue}s.push(u)}return{value:a,rest:s}}function dl(n){let e=n.slice(2);if(e.includes("--version")||e.includes("-v"))return{mode:"version"};if(e.includes("--daemon"))return{mode:"daemon"};if(e.includes("--status"))return{mode:"status"};if(e.includes("--stop"))return{mode:"stop"};if(e.includes("--refresh"))return{mode:"refresh"};if(e.includes("--uninstall"))return{mode:"uninstall"};if(e.includes("--install-service"))return{mode:"install-service"};if(e[0]==="send")return fl(e.slice(1));if(e.includes("--help")||e.includes("-h")||e.length===0)return{mode:"help"};let s=e,{value:a,rest:c}=Ze(s,"--pat-token");s=c;let{value:u,rest:d}=Ze(s,"--pair-code");s=d;let{value:l,rest:m}=Ze(s,"--env");s=m;let{value:_,rest:y}=Ze(s,"--handshake-url");s=y;let{value:v,rest:E}=Ze(s,"--frontier-url");s=E;let{value:k}=Ze(s,"--agent-id");if(!a||!u)return{mode:"help"};let D={mode:"pair",privatecode:a,pairingCode:u};return l&&(D.env=l),_&&(D.handshakeUrl=_),v&&(D.frontierUrl=v),k&&(D.agentId=k),D}function fl(n){let e=n[0],s=n[1];if(e!=="image"&&e!=="file")return{mode:"help"};if(!s||s.startsWith("--"))return{mode:"help"};let a=n.slice(2),{value:c,rest:u}=Ze(a,"--caption");a=u;let{value:d,rest:l}=Ze(a,"--name");a=l;let m=a.includes("--json"),_={mode:"send",kind:e,path:s,json:m};return c&&(_.caption=c),d&&(_.name=d),_}var ll=`
98
123
  coze-bridge - local bridge daemon for cloud Agent Service
99
124
 
100
125
  Usage:
@@ -120,38 +145,45 @@ Auto-connect agent (optional):
120
145
 
121
146
  Example: npx -y coze-bridge --pat-token=sat_xxx --pair-code=xxx --env=ppe_xxx --agent-id=7639628097007927571
122
147
 
148
+ Send file / image (D72; intended to be called by LLM inside agent bash tool):
149
+ coze-bridge send image <path> [--caption "..."] upload image to user's IM
150
+ coze-bridge send file <path> [--caption "..."] [--name "report.pdf"]
151
+ upload file to user's IM
152
+ requires COZE_BRIDGE_* env (auto-injected
153
+ into agent subprocess by daemon)
154
+
123
155
  Internal:
124
156
  <node> <entry> --daemon daemon mode (OS supervisor only)
125
- `.trimStart();async function Ra(r=process.argv,e={}){let i=pd(r);switch(i.mode){case"help":return process.stdout.write(md),0;case"version":return process.stdout.write(`${wn}
126
- `),0;case"daemon":{try{await Sa()}catch(a){return gd.error("daemon start failed",{err:String(a)}),1}return new Promise(()=>{})}case"status":return _d(e);case"stop":return wd(e);case"refresh":return yd(e);case"uninstall":return bd(e);case"install-service":return vd();case"pair":{let a={};return i.env&&(a.env=i.env),i.handshakeUrl&&(a.handshakeUrl=i.handshakeUrl),i.frontierUrl&&(a.frontierUrl=i.frontierUrl),Sd(i.privatecode,i.pairingCode,e,a,i.agentId)}}}async function Ba(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 _d(r){let e=r.paths??H(),i=new Ze(e),a=await i.probe();if(a.kind==="not-running")return process.stdout.write(`coze-bridge: not running
127
- `),1;if(a.kind==="stale")return await Ba(e),process.stdout.write(`coze-bridge: not running (cleaned stale state)
128
- `),1;let c=await i.request({method:"GET",path:"/status"});return process.stdout.write(`coze-bridge: running
157
+ `.trimStart();async function Ya(n=process.argv,e={}){let s=dl(n);switch(s.mode){case"help":return process.stdout.write(ll),0;case"version":return process.stdout.write(`${mn}
158
+ `),0;case"daemon":{try{await za()}catch(a){return ul.error("daemon start failed",{err:String(a)}),1}return new Promise(()=>{})}case"status":return hl(e);case"stop":return gl(e);case"refresh":return pl(e);case"uninstall":return ml(e);case"install-service":return _l();case"pair":{let a={};return s.env&&(a.env=s.env),s.handshakeUrl&&(a.handshakeUrl=s.handshakeUrl),s.frontierUrl&&(a.frontierUrl=s.frontierUrl),wl(s.privatecode,s.pairingCode,e,a,s.agentId)}case"send":return Ha({kind:s.kind,path:s.path,...s.caption?{caption:s.caption}:{},...s.name?{name:s.name}:{},json:s.json})}}async function Xa(n){let{unlink:e}=await import("node:fs/promises");await Promise.all([e(n.pidFile).catch(()=>{}),e(n.portFile).catch(()=>{}),e(n.tokenFile).catch(()=>{})])}async function hl(n){let e=n.paths??H(),s=new Xe(e),a=await s.probe();if(a.kind==="not-running")return process.stdout.write(`coze-bridge: not running
159
+ `),1;if(a.kind==="stale")return await Xa(e),process.stdout.write(`coze-bridge: not running (cleaned stale state)
160
+ `),1;let c=await s.request({method:"GET",path:"/status"});return process.stdout.write(`coze-bridge: running
129
161
  ${JSON.stringify(c.body,null,2)}
130
- `),0}async function wd(r){let e=r.paths??H(),i=new Ze(e),a=await i.probe();if(a.kind==="not-running")return process.stdout.write(`coze-bridge: not running
131
- `),0;if(a.kind==="stale")return await Ba(e),process.stdout.write(`coze-bridge: not running (cleaned stale state)
132
- `),0;try{return await i.request({method:"POST",path:"/shutdown"}),process.stdout.write(`coze-bridge: stopped
162
+ `),0}async function gl(n){let e=n.paths??H(),s=new Xe(e),a=await s.probe();if(a.kind==="not-running")return process.stdout.write(`coze-bridge: not running
163
+ `),0;if(a.kind==="stale")return await Xa(e),process.stdout.write(`coze-bridge: not running (cleaned stale state)
164
+ `),0;try{return await s.request({method:"POST",path:"/shutdown"}),process.stdout.write(`coze-bridge: stopped
133
165
  `),0}catch(c){return process.stdout.write(`coze-bridge: stop failed: ${String(c)}
134
- `),1}}async function yd(r){let e=new Ze(r.paths);if((await e.probe()).kind==="not-running")return process.stdout.write(`coze-bridge: not running (start daemon first)
166
+ `),1}}async function pl(n){let e=new Xe(n.paths);if((await e.probe()).kind==="not-running")return process.stdout.write(`coze-bridge: not running (start daemon first)
135
167
  `),1;try{let a=await e.request({method:"POST",path:"/refresh"});return a.status===200?(process.stdout.write(`coze-bridge: refreshed
136
168
  ${JSON.stringify(a.body,null,2)}
137
169
  `),0):(process.stderr.write(`coze-bridge: refresh failed: ${JSON.stringify(a.body)}
138
170
  `),1)}catch(a){return process.stderr.write(`coze-bridge: refresh failed: ${String(a)}
139
- `),1}}async function bd(r){let e=new Ze(r.paths);if((await e.probe()).kind==="connected"){process.stdout.write(`coze-bridge: stopping daemon...
171
+ `),1}}async function ml(n){let e=new Xe(n.paths);if((await e.probe()).kind==="connected"){process.stdout.write(`coze-bridge: stopping daemon...
140
172
  `);try{await e.request({method:"POST",path:"/shutdown"})}catch(u){process.stderr.write(`coze-bridge: stop failed (continuing): ${String(u)}
141
- `)}await new Promise(u=>setTimeout(u,500))}if(!r.skipSupervisor)try{let{getSupervisor:u,buildContext:f}=await Promise.resolve().then(()=>(ws(),_s)),h=u();await h.uninstall(f()),process.stdout.write(`coze-bridge: ${h.platform} supervisor unregistered
173
+ `)}await new Promise(u=>setTimeout(u,500))}if(!n.skipSupervisor)try{let{getSupervisor:u,buildContext:d}=await Promise.resolve().then(()=>(yi(),wi)),l=u();await l.uninstall(d()),process.stdout.write(`coze-bridge: ${l.platform} supervisor unregistered
142
174
  `)}catch(u){process.stderr.write(`coze-bridge: supervisor uninstall failed (continuing): ${String(u)}
143
- `)}let a=r.paths??H(),{rm:c}=await import("node:fs/promises");try{await c(a.cozeRoot,{recursive:!0,force:!0}),process.stdout.write(`coze-bridge: removed ${a.cozeRoot}
175
+ `)}let a=n.paths??H(),{rm:c}=await import("node:fs/promises");try{await c(a.cozeRoot,{recursive:!0,force:!0}),process.stdout.write(`coze-bridge: removed ${a.cozeRoot}
144
176
  `)}catch(u){return process.stderr.write(`coze-bridge: remove failed: ${String(u)}
145
177
  `),1}return process.stdout.write(`coze-bridge: uninstalled
146
- `),0}async function vd(){try{let{getSupervisor:r,buildContext:e}=await Promise.resolve().then(()=>(ws(),_s)),i=r(),a=e();return process.stdout.write(`coze-bridge: installing ${i.platform} supervisor...
147
- `),await i.install(a),process.stdout.write(`coze-bridge: supervisor installed (daemon will auto-start on login)
148
- `),0}catch(r){return process.stderr.write(`coze-bridge: --install-service failed: ${String(r)}
149
- `),1}}async function Sd(r,e,i,a={},c){let u=new Ze(i.paths),f=i.spawnDaemon??Ca;if(!i.skipDistInstall){let _=await Ia({paths:i.paths});_.kind==="version-changed"?(process.stdout.write(`coze-bridge: upgraded ${_.fromVersion} \u2192 ${_.toVersion}
178
+ `),0}async function _l(){try{let{getSupervisor:n,buildContext:e}=await Promise.resolve().then(()=>(yi(),wi)),s=n(),a=e();return process.stdout.write(`coze-bridge: installing ${s.platform} supervisor...
179
+ `),await s.install(a),process.stdout.write(`coze-bridge: supervisor installed (daemon will auto-start on login)
180
+ `),0}catch(n){return process.stderr.write(`coze-bridge: --install-service failed: ${String(n)}
181
+ `),1}}async function wl(n,e,s,a={},c){let u=new Xe(s.paths),d=s.spawnDaemon??Fa;if(!s.skipDistInstall){let _=await Ga({paths:s.paths});_.kind==="version-changed"?(process.stdout.write(`coze-bridge: upgraded ${_.fromVersion} \u2192 ${_.toVersion}
150
182
  `),(await u.probe()).kind==="connected"&&(await u.request({method:"POST",path:"/shutdown"}).catch(()=>{}),await new Promise(v=>setTimeout(v,500)))):_.kind==="first-install"&&process.stdout.write(`coze-bridge: installed ${_.libVersion}
151
- `)}let h=await u.probe();if(h.kind!=="connected"&&(process.stdout.write(`coze-bridge: starting daemon...
152
- `),await f({paths:i.paths}),h=await Cd(u,i.waitTimeoutMs??1e4,i.sleep??Ed),h.kind!=="connected"))return process.stderr.write(`coze-bridge: daemon did not come up: ${h.kind}
153
- `),1;let m={privatecode:r,pairing_code:e};a.env&&(m.env=a.env),a.handshakeUrl&&(m.handshake_url=a.handshakeUrl),a.frontierUrl&&(m.frontier_url=a.frontierUrl),c&&(m.agent_id=c);try{let _=await u.request({method:"POST",path:"/pair",body:m,timeoutMs:35e3});return _.status===200&&_.body?.ok?(process.stdout.write(`coze-bridge: paired (${_.body.note??"ok"})
183
+ `)}let l=await u.probe();if(l.kind!=="connected"&&(process.stdout.write(`coze-bridge: starting daemon...
184
+ `),await d({paths:s.paths}),l=await yl(u,s.waitTimeoutMs??1e4,s.sleep??vl),l.kind!=="connected"))return process.stderr.write(`coze-bridge: daemon did not come up: ${l.kind}
185
+ `),1;let m={privatecode:n,pairing_code:e};a.env&&(m.env=a.env),a.handshakeUrl&&(m.handshake_url=a.handshakeUrl),a.frontierUrl&&(m.frontier_url=a.frontierUrl),c&&(m.agent_id=c);try{let _=await u.request({method:"POST",path:"/pair",body:m,timeoutMs:35e3});return _.status===200&&_.body?.ok?(process.stdout.write(`coze-bridge: paired (${_.body.note??"ok"})
154
186
  `),0):(process.stderr.write(`coze-bridge: pair failed: ${JSON.stringify(_.body)}
155
187
  `),1)}catch(_){return process.stderr.write(`coze-bridge: pair failed: ${String(_)}
156
- `),1}}async function Cd(r,e,i){let a=Date.now()+e;for(;Date.now()<a;){let c=await r.probe(500);if(c.kind==="connected")return c;await i(200)}return r.probe(500)}function Ed(r){return new Promise(e=>setTimeout(e,r))}Ra(process.argv).then(r=>process.exit(r),r=>{process.stderr.write(`fatal: ${r instanceof Error?r.stack??r.message:String(r)}
188
+ `),1}}async function yl(n,e,s){let a=Date.now()+e;for(;Date.now()<a;){let c=await n.probe(500);if(c.kind==="connected")return c;await s(200)}return n.probe(500)}function vl(n){return new Promise(e=>setTimeout(e,n))}Ya(process.argv).then(n=>process.exit(n),n=>{process.stderr.write(`fatal: ${n instanceof Error?n.stack??n.message:String(n)}
157
189
  `),process.exit(1)});