coze-bridge 0.1.35 → 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 +78 -46
  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 R0=Object.create;var yr=Object.defineProperty;var N0=Object.getOwnPropertyDescriptor;var L0=Object.getOwnPropertyNames;var O0=Object.getPrototypeOf,B0=Object.prototype.hasOwnProperty;var $=(n=>typeof require<"u"?require:typeof Proxy<"u"?new Proxy(n,{get:(e,i)=>(typeof require<"u"?require:e)[i]}):n)(function(n){if(typeof require<"u")return require.apply(this,arguments);throw Error('Dynamic require of "'+n+'" is not supported')});var Le=(n,e)=>()=>(n&&(e=n(n=0)),e);var ce=(n,e)=>()=>(e||n((e={exports:{}}).exports,e),e.exports),Hs=(n,e)=>{for(var i in e)yr(n,i,{get:e[i],enumerable:!0})},M0=(n,e,i,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let c of L0(e))!B0.call(n,c)&&c!==i&&yr(n,c,{get:()=>e[c],enumerable:!(a=N0(e,c))||a.enumerable});return n};var Oe=(n,e,i)=>(i=n!=null?R0(O0(n)):{},M0(e||!n||!n.__esModule?yr(i,"default",{value:n,enumerable:!0}):i,n));import{chmod as z0,mkdir as q0,readFile as F0,rename as Gs,writeFile as js}from"node:fs/promises";import{dirname as U0}from"node:path";async function ut(n){try{let e=await F0(n,"utf8");return JSON.parse(e)}catch(e){if(e.code==="ENOENT")return null;throw e}}async function Qt(n,e,i){await q0(U0(n),{recursive:!0});let a=`${JSON.stringify(e,null,2)}
9
- `,c=`${n}.tmp-${process.pid}-${Math.random().toString(36).slice(2,10)}`;try{i?.mode!==void 0?await js(c,a,{encoding:"utf8",mode:i.mode}):await js(c,a,"utf8"),await Gs(c,n),i?.mode!==void 0&&await z0(n,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 en=Le(()=>{"use strict"});function Js(n){return nn[Ks]<=nn[n]}function br(n){Ws={...n}}function tn(n,e,i,a){if(nn[n]<nn[Ks])return;let c=JSON.stringify({ts:new Date().toISOString(),level:n,module:e,msg:i,...Ws,...a});n==="error"||n==="warn"?G0.write(`${c}
10
- `):H0.write(`${c}
11
- `)}function T(n){return{debug:(e,i)=>tn("debug",n,e,i),info:(e,i)=>tn("info",n,e,i),warn:(e,i)=>tn("warn",n,e,i),error:(e,i)=>tn("error",n,e,i),child:e=>T(`${n}.${e}`)}}var nn,Ks,H0,G0,Ws,F=Le(()=>{"use strict";nn={debug:10,info:20,warn:30,error:40},Ks=(()=>{let n=process.env.COZE_BRIDGE_LOG_LEVEL;return n==="debug"||n==="info"||n==="warn"||n==="error"?n:"info"})(),H0=process.stdout,G0=process.stderr,Ws={}});import{homedir as j0}from"node:os";import{join as ie}from"node:path";function K(n){let e=n??j0(),i=ie(e,".coze"),a=ie(i,"bridge"),c=ie(a,"lib");return{cozeRoot:i,bridgeRoot:a,libDir:c,libEntry:ie(c,"index.js"),pidFile:ie(a,"bridge.pid"),portFile:ie(a,"bridge.port"),tokenFile:ie(a,"bridge.token"),logFile:ie(a,"bridge.log"),installLock:ie(a,"install.lock"),configFile:ie(a,"config.json"),agentsRoot:ie(i,"agents")}}function Be(n,e=K()){let i=ie(e.agentsRoot,n);return{root:i,config:ie(i,"config.json"),workspace:ie(i,"workspace"),logs:ie(i,"logs")}}var xe=Le(()=>{"use strict"});var on={};Hs(on,{AGENT_CONFIG_FILE_MODE:()=>rn,enforceAgentConfigMode:()=>J0,loadAgentConfig:()=>ue,persistAgentSessions:()=>vr,persistAgentSkills:()=>sn,saveAgentConfig:()=>we});import{chmod as K0,stat as W0}from"node:fs/promises";function ue(n,e){return ut(Be(n,e).config)}function we(n,e){return Qt(Be(n.agentId,e).config,n,{mode:rn})}async function J0(n,e){if(process.platform==="win32")return;let i=Be(n,e).config;try{let a=await W0(i);if(!a.isFile())return;let c=a.mode&511;c!==rn&&(await K0(i,rn),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 vr(n,e,i){let a=await ue(n,i);a&&(a.sessions=Object.fromEntries(e),await we(a,i))}async function sn(n,e,i){let a=await ue(n,i);a&&(a.skills=e,await we(a,i))}var Vs,rn,Ke=Le(()=>{"use strict";en();F();xe();Vs=T("agent-config"),rn=384});var co=ce(Q=>{"use strict";var A=D;(function(n,e){let i=D,a=n();for(;;)try{if(-parseInt(i(814))/1+parseInt(i(1674))/2+-parseInt(i(1288))/3+parseInt(i(1535))/4+-parseInt(i(917))/5*(parseInt(i(730))/6)+parseInt(i(665))/7*(-parseInt(i(1644))/8)+parseInt(i(1624))/9*(parseInt(i(1192))/10)===e)break;a.push(a.shift())}catch{a.push(a.shift())}})(zn,873656);var Kx=Object[A(1608)+A(1727)],Wx=Object["getOwnPropertyNa"+A(1259)],ro=(n,e)=>function(){return n&&(e=(0,n[Wx(n)[0]])(n=0)),e},Jx=(n,e)=>{let i={uRgNp:function(c,u,f,l){return c(u,f,l)}};for(var a in e)i.uRgNp(Kx,n,a,{get:e[a],enumerable:!0})};function Vx(){return Zi||(Zi=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function $x(){let n=A;return Qi||(Qi=[IDBCursor.prototype[n(919)],IDBCursor[n(408)+"e"][n(949)],IDBCursor[n(408)+"e"][n(949)+"PrimaryKey"]])}function Xx(n){let e=A,i={qXVnP:"success",hRSIC:e(421),WvPic:function(c,u){return c(u)},VHkHS:function(c){return c()},HEXli:e(513),zuapa:"vjkGR"},a=new Promise((c,u)=>{let f=e,l={NlFud:function(_,C){return _(C)},WTUEE:function(_,C){return i[D(732)](_,C)},pQrri:function(_){return _()},kqnCz:function(_){return i[D(735)](_)}},p=()=>{let _=D;n[_(611)+_(1121)+_(647)](i[_(1493)],w),n[_(611)+_(1121)+_(647)](i[_(620)],y)},w=()=>{let _=D;l.NlFud(c,l[_(933)](Pe,n[_(1275)])),l[_(577)](p)},y=()=>{let _=D;u(n[_(421)]),l[_(530)](p)};n[f(1257)+f(1682)](i[f(1493)],w),n["addEvent"+f(1682)](f(421),y)});return a[e(415)](c=>{let u=e;if(i.HEXli===i[u(817)])return _0x25fa4f.resolve();c instanceof IDBCursor&&Br[u(1043)](c,n)}).catch(()=>{}),Bn.set(a,n),a}function Yx(n){let e=A,i={zPdgv:function(c,u){return c!==u},fTvIT:function(c){return c()},hUIJZ:e(626),lVhRm:e(421),UMqNu:e(1783)};if(On[e(1771)](n))return;let a=new Promise((c,u)=>{let f=e,l={Xvbjg:i[f(1397)],LLrBH:i[f(1546)],NaIAA:i[f(830)],pyXrC:f(1754)+"or"},p=()=>{let _=f;n[_(611)+_(1121)+_(647)](l[_(1609)],w),n[_(611)+_(1121)+"ner"](l.LLrBH,y),n[_(611)+_(1121)+_(647)](l[_(725)],y)},w=()=>{let _=f;if(i.zPdgv(_(499),_(499)))return this[_(673)].clear();c(),i[_(1523)](p)},y=()=>{u(n[f(421)]||new DOMException(l.pyXrC,"AbortError")),p()};n[f(1257)+f(1682)](i[f(1397)],w),n["addEvent"+f(1682)](i[f(1546)],y),n[f(1257)+"Listener"](f(1783),y)});On[e(1043)](n,a)}function Zx(n){Mn=n(Mn)}function Qx(n){let e=A,i={pLAVh:function(a,c){return a(c)},nKcQc:e(421),vqHfA:function(a,c,u){return a(c,u)},pAFYK:function(a,c){return a(c)},DkOKx:function(a,c){return a===c},jGTms:"XURhq",AFSMU:function(a,c){return a===c},yXJhH:e(1730)+e(1587),JrmOM:function(a,c){return a!==c},cCbwC:e(992),SZLuN:e(1170),Lxhbi:function(a){return a()}};if(i[e(1286)](n,IDBDatabase.prototype[e(1055)+e(754)])&&!(i[e(1064)]in IDBTransaction[e(408)+"e"])){if(i.JrmOM(i[e(1569)],i[e(1148)]))return function(a,...c){let u=e,f=n[u(491)](Ut(this),a,...c);return Or.set(f,a[u(1595)]?a[u(1595)]():[a]),i[u(1739)](Pe,f)};this.emit(i[e(1311)],i[e(1488)](_0x4aaf6d,"error",{message:this[e(430)+"rrorMessage"](_0x470ab1)}))}return i[e(442)]($x)[e(1062)](n)?function(...a){let c=e;return n[c(1222)](i[c(1750)](Ut,this),a),i[c(1739)](Pe,Br[c(843)](this))}:function(...a){let c=e;return i[c(1794)]("XURhq",i.jGTms)?Pe(n[c(1222)](i[c(1739)](Ut,this),a)):this[c(638)][c(763)]}}function eu(n){let e=A,i={SmOtb:function(a,c){return a===c},geJjg:function(a,c){return a(c)},sfeyZ:function(a,c){return a instanceof c},NNvBU:function(a){return a()}};return i.SmOtb(typeof n,e(1405))?i[e(1240)](Qx,n):(i[e(1382)](n,IDBTransaction)&&Yx(n),so(n,i[e(1505)](Vx))?new Proxy(n,Mn):n)}function Pe(n){let e=A,i={grNQm:function(c,u){return c instanceof u},mxqmA:function(c,u){return c(u)},cmxnS:function(c,u){return c!==u}};if(i[e(1526)](n,IDBRequest))return i[e(872)](Xx,n);if(Nn[e(1771)](n))return Nn[e(843)](n);let a=eu(n);return i[e(957)](a,n)&&(Nn[e(1043)](n,a),Bn[e(1043)](a,n)),a}var so,Zi,Qi,Br,On,Or,Nn,Bn,Mn,Ut,eo=ro({"node_modules/idb/build/wrap-idb-value.js"(){let n=A,e={vtHGF:function(i,a){return i instanceof a},mfAhB:function(i,a){return i===a},CHMBt:n(1781),kqQQL:n(1730)+n(1587),FVnrF:"store",qtJlq:function(i,a){return i(a)},xeNSd:function(i,a){return i in a}};so=(i,a)=>a[n(1636)](c=>i instanceof c),Br=new WeakMap,On=new WeakMap,Or=new WeakMap,Nn=new WeakMap,Bn=new WeakMap,Mn={get(i,a,c){let u=n;if(e[u(584)](i,IDBTransaction)){if(e.mfAhB(a,e[u(907)]))return On[u(843)](i);if(a===e[u(608)])return i[u(1730)+u(1587)]||Or.get(i);if(a===e.FVnrF)return c[u(1730)+u(1587)][1]?void 0:c[u(1730)+u(743)](c[u(1730)+"oreNames"][0])}return e[u(1714)](Pe,i[a])},set(i,a,c){return i[a]=c,!0},has(i,a){let c=n;return e.vtHGF(i,IDBTransaction)&&(a===e[c(907)]||a===e.FVnrF)?!0:e[c(1139)](a,i)}},Ut=i=>Bn[n(843)](i)}}),io={};Jx(io,{deleteDB:()=>nu,openDB:()=>tu,unwrap:()=>Ut,wrap:()=>Pe});function tu(n,e,{blocked:i,upgrade:a,blocking:c,terminated:u}={}){let f=A,l={IvfnZ:function(y,_){return y(_)},unaHD:function(y,_){return y===_},oiBsK:f(462),bkIIN:"versionc"+f(1759),SsnUD:f(404)+f(939),SVlNe:f(1735)},p=indexedDB[f(1577)](n,e),w=l[f(1756)](Pe,p);return a&&p.addEventListener(l.SsnUD,y=>{let _=f;a(l[_(1756)](Pe,p[_(1275)]),y[_(1556)+"on"],y[_(809)+"on"],l[_(1756)](Pe,p.transaction))}),i&&p["addEvent"+f(1682)](l.SVlNe,()=>i()),w[f(415)](y=>{let _=f;l.unaHD("lgQVt",l[_(858)])?_0x32b8c2[_(1043)](_0x186f8d,_0x5b820c):(u&&y[_(1257)+_(1682)](_(1529),()=>u()),c&&y.addEventListener(l[_(1641)],()=>c()))})[f(1312)](()=>{}),w}function nu(n,{blocked:e}={}){let i=A,a={MoDBf:"blocked"},c=indexedDB[i(1702)+"tabase"](n);return e&&c[i(1257)+"Listener"](a.MoDBf,()=>e()),Pe(c)[i(415)](()=>{})}function to(n,e){let i=A,a={DAOJa:i(1516),HJRiX:"add",zJCjK:i(1346),LhHML:function(p){return p()},WRkOn:i(1235),cxFxb:i(1137),OJkiF:i(1555)+"ys",ykJhp:i(694),teVxa:function(p,w){return p(w)},zFwpW:function(p,w){return p(w)},MDEuP:function(p,w){return p!==w},vMNBN:i(1623),ZYiDV:i(658),ooRpE:i(1199)+"e",BEbsL:function(p,w){return p instanceof w},JNriN:function(p,w){return p in w},mBtjD:function(p,w){return p===w},tPLgI:i(1561),WCdsG:"qtwtM"};if(!(a[i(792)](n,IDBDatabase)&&!a.JNriN(e,n)&&a[i(562)](typeof e,a[i(1461)])))if(a[i(1166)](a.WCdsG,i(803))){let p=(i(1122)+i(1590)).split("|"),w=0;for(;;){switch(p[w++]){case"0":_0x13e501();continue;case"1":_0x5b8a2a=[a[i(701)],a[i(433)],i(518),a[i(1665)]];continue;case"2":a[i(1602)](_0x22765d);continue;case"3":_0x5d4408=[i(843),a[i(1458)],a.cxFxb,a[i(854)],a[i(566)]];continue;case"4":a[i(1468)](_0x3ecdb9,y=>({...y,get:(_,C,P)=>_0x5b678e(_,C)||y[i(843)](_,C,P),has:(_,C)=>!!_0x4198e9(_,C)||y[i(1771)](_,C)}));continue;case"5":_0x2db1bf=new _0x4c0ea2;continue}break}}else return;if(Ln[i(843)](e))return Ln[i(843)](e);let c=e[i(1042)](/FromIndex$/,""),u=a[i(1166)](e,c),f=ao[i(1062)](c);if(!(c in(u?IDBIndex:IDBObjectStore)[i(408)+"e"])||!(f||oo[i(1062)](c)))return;let l=async function(p,...w){let y=i,_={FoUTh:function(C,P){return a[D(1683)](C,P)}};if(a[y(1166)](a[y(533)],a[y(482)])){let C=this[y(1055)+y(754)](p,f?a[y(607)]:y(1076)),P=C[y(1431)];return u&&(P=P[y(1536)](w[y(784)]())),(await Promise[y(441)]([P[c](...w),f&&C.done]))[0]}else return _0x2fd5a8[y(1222)](OdVJpz.FoUTh(_0x55e227,this),_0x37b4c1),OdVJpz[y(1787)](_0x2cfd34,_0x1ca128[y(843)](this))};return Ln[i(1043)](e,l),l}var oo,ao,Ln,ru=ro({"node_modules/idb/build/index.js"(){let n=A,e={CDEhn:"1|4|0|5|"+n(585),NTRvj:"get",qagLp:n(1235),YuZRq:n(1137),WGAjU:n(1555)+"ys",tloud:n(694),EXuKl:function(c){return c()},BNaHO:function(c){return c()},daPeG:"put",iYKdx:"add",wpLlp:n(518),XqoAw:"clear"},i=e[n(1296)][n(542)]("|"),a=0;for(;;){switch(i[a++]){case"0":oo=[e.NTRvj,e.qagLp,e.YuZRq,e[n(1638)],e[n(600)]];continue;case"1":e[n(1262)](eo);continue;case"2":Zx(c=>({...c,get:(u,f,l)=>to(u,f)||c[n(843)](u,f,l),has:(u,f)=>!!to(u,f)||c[n(1771)](u,f)}));continue;case"3":Ln=new Map;continue;case"4":e[n(394)](eo);continue;case"5":ao=[e.daPeG,e[n(868)],e[n(796)],e[n(1081)]];continue}break}}}),su={idb:function(n){let e=A;n[e(1016)]=Promise[e(1129)]()[e(415)](()=>(ru(),io))[e(415)](function(i){return i})}},no={};function ke(n){let e=A,i={NEAEW:e(1732)+"4"},a=i[e(802)].split("|"),c=0;for(;;){switch(a[c++]){case"0":su[n](u,u.exports,ke);continue;case"1":var u=no[n]={exports:{}};continue;case"2":var f=no[n];continue;case"3":if(f!==void 0)return f[e(1016)];continue;case"4":return u[e(1016)]}break}}(()=>{let n={knufq:"SRZsZ"};ke.d=(e,i)=>{let a=D;if(n[a(447)]!==n[a(447)]){let u=_0x51b6c9[a(1460)].payload;u&&_0xf470b6[a(567)+"rs"](u)}else for(var c in i)ke.o(i,c)&&!ke.o(e,c)&&Object[a(1608)+a(1727)](e,c,{enumerable:!0,get:i[c]})}})(),(()=>{let n=A;ke.o=(e,i)=>Object[n(408)+"e"][n(1206)+n(1727)][n(491)](e,i)})(),(()=>{let n=A,e={JBxjn:function(i,a){return i!=a},TTaIE:n(1662)+"d",VqwqM:n(753),cQVDx:"__esModule"};ke.r=i=>{let a=n;e[a(1325)](e.TTaIE,typeof Symbol)&&Symbol[a(1398)+"Tag"]&&Object[a(1608)+a(1727)](i,Symbol["toString"+a(1747)],{value:e[a(769)]}),Object[a(1608)+a(1727)](i,e[a(1258)],{value:!0})}})();var X={};(()=>{let n=A,e={BDNvS:function(s,t){return s(t)},rJxLI:function(s,t){return s+t},HMYFY:function(s,t){return s+t},iWNrp:function(s,t){return s*t},XOPkJ:function(s,t){return s+t},szZvX:function(s,t){return s(t)},kenGQ:function(s,t){return s+t},xhPmz:function(s,t,r){return s(t,r)},czVNz:function(s,t){return s(t)},HNUtz:function(s,t){return s(t)},wsrjt:"0000",MzhFN:n(1718),MdwIJ:function(s,t){return s(t)},nWwLF:"00000000"+n(1220)+n(1220)+n(1220),vJVLR:function(s,t){return s(t)},blTTI:function(s,t){return s>t},jItIg:function(s,t){return s===t},GfmGL:n(1365),gMWSc:function(s,t){return s<t},WYTCn:function(s,t){return s<t},Hzylu:function(s,t){return s!==t},jliVQ:function(s,t){return s-t},sInvq:function(s,t){return s<t},XGtqM:function(s,t){return s!==t},ucnYk:function(s,t){return s-t},HeqFH:n(670),Jjlrg:n(1113),ywJKE:function(s,t,r){return s(t,r)},kBuYj:n(536),CTfwh:function(s,t){return s(t)},nHFSF:function(s,t){return s>>>t},WdCef:function(s,t,r){return s(t,r)},bQppb:function(s,t){return s(t)},qHLjj:function(s,t){return s(t)},gXTCl:function(s,t){return s&t},hfNxj:n(1726)+n(556)+n(1126)+n(1080),FNPSu:function(s,t){return s===t},UHKGp:n(1726)+"required"+n(1126)+"value",FwqtL:function(s){return s()},sEyys:function(s,t,r){return s(t,r)},xOzPb:function(s,t,r){return s(t,r)},oagiL:function(s,t,r){return s(t,r)},OgqsL:function(s,t){return s(t)},qRLFF:function(s,t,r){return s(t,r)},dwqJo:function(s,t,r){return s(t,r)},okhcn:function(s,t,r){return s(t,r)},PpUlh:function(s,t,r){return s(t,r)},qiJnj:function(s,t,r){return s(t,r)},yKywI:function(s,t){return s!==t},cnOxV:function(s,t){return s!==t},ZRSze:function(s,t,r){return s(t,r)},QlbVb:function(s,t,r){return s(t,r)},vjRee:function(s,t,r){return s(t,r)},Zrkfn:function(s,t){return s!==t},ZCJJz:"kDzFa",thGwE:function(s,t){return s>>>t},xqMCx:function(s,t,r){return s(t,r)},NJwpg:function(s,t,r){return s(t,r)},mTcHf:function(s,t){return s(t)},NoDif:function(s,t){return s(t)},dwEGf:function(s,t){return s(t)},TsJUV:function(s,t){return s===t},NmEVp:n(1726)+"required"+n(1126)+n(457),zqCBm:function(s,t){return s(t)},EshMr:n(421),FUMNq:n(1263),tTBIH:n(531),ZoQCx:function(s,t){return s&t},vdtvq:n(583)+n(806)+n(781),awfyP:n(438)+n(1760),VuYEa:function(s,t){return s===t},FKQuX:function(s,t){return s>>t},RjSLM:function(s,t){return s>=t},fWAxV:function(s,t){return s==t},SJyHR:n(1561),XjRUQ:function(s,t,r,o){return s(t,r,o)},ELase:function(s,t){return s!==t},yVVYV:function(s,t){return s+t},jMPdx:function(s,t){return s>=t},ktzNQ:function(s,t){return s+t},hdksA:function(s,t){return s*t},kvXCM:function(s,t){return s>t},hYIxH:n(572)+n(1178),jRqdu:function(s,t){return s+t},MdhBG:n(1662)+"d",zXenh:n(753),RRGtV:n(1517)+"le",NmKmj:function(s,t,r){return s(t,r)},nHNjn:function(s,t){return s+t},auXOf:function(s,t){return s&t},rmVtt:function(s,t){return s+t},bvgyn:function(s,t){return s===t},opoSe:n(841),HPFWO:n(496),hOuJt:function(s,t){return s|t},qPHRQ:function(s,t){return s<<t},ZUlgU:function(s,t){return s&t},lwYOi:n(1123),xkdSF:function(s,t){return s(t)},pZnKa:function(s,t){return s&t},wMAak:function(s,t){return s+t},ilZAX:function(s,t){return s+t},cotqg:function(s,t){return s+t},aXXnC:function(s,t){return s+t},TObCV:function(s,t){return s!==t},LzEWx:function(s,t){return s<<t},NfCVD:function(s,t){return s===t},lzwMR:"KQIJg",EkCov:function(s,t){return s&t},xMJKa:function(s,t){return s<t},AvDHH:function(s,t){return s<=t},kfehf:function(s,t){return s==t},BEcLD:function(s,t){return s>=t},hHjfV:function(s,t){return s+t},wDByM:function(s,t){return s+t},uEkoC:function(s,t){return s|t},NEVvS:function(s,t){return s<<t},MLdVa:function(s,t){return s|t},CngdK:function(s,t){return s<<t},SqKhY:function(s,t){return s&t},ducCV:function(s,t){return s&t},RThtp:function(s,t){return s&t},LBvDV:function(s,t){return s<t},ETkje:function(s,t){return s>>t},XwwCb:function(s,t){return s&t},NbBAO:function(s,t){return s<t},RPONd:function(s,t){return s<t},WdLcB:function(s,t){return s+t},sjCEr:function(s,t){return s-t},ENUhU:function(s,t){return s+t},Qvuzd:function(s,t){return s<t},vESEw:function(s,t){return s<t},gHtJb:function(s,t,r){return s(t,r)},BFowm:function(s,t){return s<t},PhbGV:function(s,t){return s!==t},gOoji:"NBsWg",rjjdy:function(s,t){return s<t},pNgNP:function(s,t){return s+t},OklqS:function(s,t){return s|t},FLDxT:function(s,t){return s&t},TIJGi:function(s,t){return s|t},mVPOc:function(s,t){return s|t},CKpjg:function(s,t){return s|t},FfoNc:function(s,t){return s&t},Syqsj:function(s,t){return s<t},RZhqi:function(s,t){return s+t},rzDsZ:function(s,t,r){return s(t,r)},wnPIU:function(s,t){return s(t)},IimCg:function(s,t){return s<t},IREtk:function(s,t){return s<<t},cbxME:function(s,t){return s&t},CKGJo:function(s,t){return s|t},UErtm:n(804)+n(1509)+"t",KLbls:"vHbDU",IXGHE:function(s,t){return s(t)},XAUQV:function(s,t){return s<<t},rKjBu:function(s,t){return s(t)},VMnRm:function(s,t){return s<<t},Qziza:function(s,t){return s===t},mHGhH:n(731),rAbTs:function(s,t){return s&t},ozaqm:function(s,t){return s(t)},BiuXS:function(s,t){return s&t},pFhmB:function(s,t){return s<<t},BjyzZ:function(s,t){return s&t},KKHao:function(s,t){return s&t},wdcPn:function(s,t){return s&t},ymNAV:function(s,t){return s<<t},zHLfd:function(s,t){return s<<t},dIuvs:"upgraden"+n(939),MxHMP:function(s,t,r,o,x){return s(t,r,o,x)},ljbmr:function(s,t){return s(t)},PwJOT:function(s,t){return s!==t},zlTcT:n(822),wLYYS:n(1410),OgFtG:function(s,t){return s>>>t},JwaOi:function(s,t){return s|t},GhqZz:function(s,t){return s<t},oPXTX:function(s,t){return s<t},TdhWQ:function(s,t){return s<t},ctmEG:function(s,t,r){return s(t,r)},SChCa:function(s,t){return s+t},CbTaw:function(s,t){return s&t},NNUet:function(s,t){return s+t},lmYtM:function(s,t){return s|t},KRXRz:function(s,t){return s&t},iuBTV:function(s,t){return s+t},WPDqt:function(s,t){return s|t},AkJse:function(s,t){return s&t},kKaVX:function(s,t){return s>>>t},EBbGy:function(s,t){return s+t},ddPep:function(s,t){return s>>>t},FYygo:function(s,t){return s|t},ReDfj:function(s,t){return s>>>t},Fltgv:function(s,t){return s&t},OJDAg:function(s,t){return s+t},VOibV:function(s,t){return s&t},iTFrK:function(s,t){return s|t},ALDRE:function(s,t){return s&t},DjumR:function(s,t){return s+t},aWDOC:function(s,t){return s!==t},vDfje:function(s,t){return s>>>t},NcOOv:function(s,t){return s>>>t},KSeos:function(s,t){return s&t},oQlaG:"GSFrG",EjCLZ:n(1363),TZfEx:function(s,t){return s(t)},FETVm:function(s,t){return s(t)},XBAvF:function(s,t){return s|t},VxzIV:function(s,t){return s<<t},gJuJf:function(s,t){return s<<t},NDeFM:function(s,t){return s|t},iAnJP:function(s,t){return s<<t},RLKTY:function(s,t){return s|t},IXJFr:function(s,t){return s<<t},AdfoP:function(s,t){return s<<t},jAszQ:function(s,t){return s|t},dbFOe:function(s,t){return s|t},DfHxK:function(s,t){return s<<t},FTRHO:function(s,t){return s===t},VOVCV:function(s,t){return s<<t},wguaj:function(s,t){return s<<t},wdqCu:function(s,t){return s&t},yyFGd:function(s,t){return s>>>t},eyKGf:function(s,t){return s&t},iHLSx:function(s,t){return s>>>t},AKqox:function(s,t,r){return s(t,r)},rpOUm:function(s,t){return s>=t},jQHlJ:function(s,t){return s+t},USXrC:function(s,t){return s|t},rPfuJ:function(s,t){return s%t},qlbjl:function(s,t){return s/t},OIJpU:function(s,t){return s>>>t},ZPNNC:function(s,t){return s(t)},OigdD:function(s,t){return s>=t},SQJTI:function(s,t){return s<=t},iCKpg:function(s,t){return s>=t},lryiN:function(s,t){return s|t},AqFyD:function(s,t){return s!==t},WzccU:n(1281),NQVqc:function(s,t){return s===t},qEYZR:function(s,t){return s>>>t},WmLpU:function(s,t){return s&t},nMBXl:function(s,t){return s>>>t},LRVhg:function(s,t){return s+t},nQZXi:function(s,t){return s>>>t},eUuWx:function(s,t){return s+t},qhzWT:function(s,t){return s|t},wqQud:function(s,t){return s<<t},jQnzu:function(s,t){return s<<t},SKjQa:function(s,t){return s===t},KgclX:function(s,t){return s===t},veWaF:function(s,t){return s===t},NQdit:function(s,t){return s===t},fJyTt:function(s,t,r){return s(t,r)},mvNUN:n(1231),iirmv:n(463),AMcfU:function(s,t){return s&t},pDfYF:function(s,t){return s&t},KFsbh:function(s,t){return s>>>t},qIxvM:function(s,t){return s>>>t},NFfRW:function(s,t){return s&t},SZzsj:function(s,t){return s&t},YhdNW:function(s,t){return s>>>t},FsuHm:function(s,t){return s&t},QOpoE:function(s,t){return s&t},gVNYM:function(s,t){return s&t},hFUwR:n(1550)+n(1703),HQkXh:n(624)+n(1319),JFcEZ:n(419)+n(862)+"R",eeLJr:n(889)+"OR",jqMyw:n(1542)+n(436),ZbZAf:n(597)+"RROR",vhZQm:n(1212)+n(1116),upZkh:function(s,t){return s!==t},hpplf:"NeaTn",nRQVQ:n(986),RkJRs:n(1358),Urkzu:"OIUON",ZssjQ:function(s,t){return s===t},GXYdN:n(1607),xDKUh:function(s,t){return s||t},ptcrz:n(847),ClBLA:"omTIg",MhwIh:function(s,t){return s==t},kjKAl:function(s,t){return s>t},VrsGR:"ZEOvF",Yyiqf:function(s,t){return s===t},FtgzH:n(1185)+n(1681),FDDlS:function(s,t){return s+t},BhBnw:function(s,t){return s+t},uzfYy:function(s,t){return s===t},NftMx:function(s,t){return s===t},JMRsu:function(s,t){return s+t},wbxwP:function(s,t){return s>>>t},YzGfu:function(s,t){return s===t},pZQHG:n(1529),oeAhp:function(s,t,r){return s(t,r)},KWVlj:n(1460),JWMIt:function(s,t){return s!==t},KoUtC:n(865),arXFZ:function(s,t){return s===t},FFAjp:function(s,t){return s===t},evpGf:function(s,t){return s+t},QOnkd:function(s,t,r){return s(t,r)},PhTjk:function(s,t){return s instanceof t},sGVvq:n(1049),rpxCE:n(1152),TkPFi:n(633),vEvhp:n(1604),mgadO:"eBNrt",XUUZZ:function(s,t,r,o){return s(t,r,o)},GerJI:"IqKQB",FQhUh:function(s,t){return s!=t},oLxEM:n(444)+"4",fnNbY:function(s,t){return s<=t},PcOgu:function(s,t){return s<t},vRNhy:function(s,t){return s&t},ryHBg:function(s,t){return s instanceof t},ohDDh:n(1466)+"in;chars"+n(826),oLZjP:"applicat"+n(1648),pYBnu:n(1743)+n(1648)+";charset=utf-8",qDgaC:n(527)+"e",zJBEU:n(1163),ogShs:function(s,t){return s===t},lzbEK:n(709),UiZAM:n(416),kRzEk:function(s,t){return s<t},UHTDU:function(s,t){return s-t},gvvCt:"RLWDn",pzcwW:function(s,t){return s<=t},yQBMq:function(s,t){return s>=t},ZTVOR:function(s,t){return s&t},SzXzG:function(s,t){return s&t},tyWEs:function(s,t){return s&t},ZsmPh:function(s,t){return s<<t},QvdRu:function(s,t){return s-t},PpAKe:function(s,t){return s|t},vQrgR:function(s,t){return s<<t},KaRlz:function(s,t){return s&t},BDVfH:function(s,t){return s&t},jlLUs:function(s,t){return s+t},jucHB:function(s,t){return s+t},kScrN:function(s,t){return s<t},RXttS:function(s,t){return s|t},vZlQM:function(s,t){return s===t},iiZBy:function(s,t){return s===t},CrzuC:function(s,t){return s+t},smfZZ:function(s,t){return s+t},pKcGk:function(s,t){return s<<t},zUOwJ:function(s,t){return s&t},wazjQ:function(s,t){return s|t},FgwOR:function(s,t){return s>>t},bUgKo:function(s,t){return s&t},MqprC:function(s,t){return s&t},kaLaG:function(s,t){return s|t},RurpD:function(s,t){return s|t},kRZim:function(s,t){return s<<t},SLglc:function(s,t){return s==t},EfaRb:n(1003),BXsUI:"JJaUV",RIXjh:function(s,t){return s instanceof t},VMYOQ:function(s,t){return s instanceof t},hVXcR:function(s,t){return s!=t},ZAaot:n(1660),tSNAB:"boe",xCUNH:n(975),SkSge:function(s,t){return s>=t},oHTnb:function(s,t){return s!==t},LqNvk:"DWypi",vaKlf:n(1538),WuzWV:n(982),KsZta:n(435),xSCnF:n(923),gojmr:function(s,t){return s(t)},bGZXI:n(1125),IyIdp:function(s){return s()},mVtgo:n(1056),fSzrG:n(515),FujtT:n(1202),lAfvb:"PMxZn",byDVl:function(s,t){return s||t},QiPTo:function(s,t){return s||t},RncHq:function(s,t){return s||t},MchlK:n(1735),bJFjb:function(s,t){return s(t)},bjjRZ:function(s,t){return s===t},nXgUi:n(993),WWhwN:function(s,t){return s|t},gQPqT:function(s,t){return s&t},CTGGZ:function(s,t){return s|t},lsNiM:function(s,t){return s|t},bmigf:function(s,t){return s|t},vHBGP:n(1157),IVVlq:function(s,t){return s===t},IlZui:n(965),MeWLD:function(s,t){return s||t},wyghl:n(1689)+n(1077)+"d",tSGuy:n(490),DYuOd:n(1406)+"id",gRtqE:function(s,t,r){return s(t,r)},wGAUY:"IVrNK",pkCld:function(s,t){return s(t)},EmfAH:function(s,t,r,o){return s(t,r,o)},lwsni:n(1287)+"er_qos_ack",musMi:function(s,t,r,o){return s(t,r,o)},iGJMJ:n(610),oBGVL:n(379),SBBWz:function(s,t){return s&&t},TAIxb:n(642),tcgrJ:n(1210),fMmjF:function(s){return s()},SmuKx:"received",jibGN:function(s){return s()},EZeaV:function(s,t){return s(t)},PCvVp:function(s,t){return s instanceof t},Hqimn:function(s,t,r,o){return s(t,r,o)},tould:function(s){return s()},sLYRs:function(s,t){return s(t)},acxuC:function(s,t){return s&t},PNDGs:function(s,t){return s+t},KrYHw:function(s,t){return s===t},okDcK:n(1710),lpqVo:"QmwnL",qvFdX:function(s,t){return s>>>t},ygDOh:function(s,t){return s+t},lQqAZ:function(s,t){return s+t},FIPzm:function(s,t){return s+t},YteMY:n(682),WZXjd:function(s,t){return s+t},teSCo:function(s,t){return s>>>t},JHJrc:n(1359)+"3",XfNaD:function(s,t){return s+t},uwPsK:function(s,t){return s|t},OAplw:function(s,t){return s<<t},KWxZf:function(s,t){return s+t},swqpe:function(s,t){return s|t},JaokL:function(s,t){return s+t},eqGKd:function(s,t){return s+t},uYmrp:function(s,t){return s===t},krehw:"xOBRw",QVKGH:function(s,t){return s+t},vfRhj:function(s,t){return s>>>t},oOkaS:function(s,t){return s&t},usRsY:function(s,t){return s>>>t},okMJL:function(s,t){return s&t},YNrST:function(s,t){return s>>>t},LzLBW:function(s,t){return s+t},EmiFN:function(s,t){return s+t},HLKUv:function(s,t){return s&t},QOWrl:n(460)+n(1764)+"|1|4|11|0",SWkCt:function(s,t){return s>>>t},oFfSQ:function(s,t){return s|t},AwbOK:function(s,t){return s|t},cVSXj:function(s,t){return s<<t},xJXSp:function(s,t){return s<t},rxyRg:function(s,t){return s>>>t},wQbqZ:function(s,t){return s|t},KNOKX:function(s,t){return s<<t},lrEzA:function(s,t){return s&t},FWjHj:function(s,t){return s&t},jAJPP:function(s,t){return s&t},GKskB:function(s,t){return s<t},wwhIX:function(s,t){return s|t},sLUfV:function(s,t){return s>t},xWfah:function(s,t,r){return s(t,r)},RrDSO:n(1242),eexqd:n(1377),MKpKn:"4|5|1|3|"+n(464)+n(1261),pzlpN:n(1706),vLiSk:n(798),vBaRh:function(s,t,r,o){return s(t,r,o)},bxZlL:function(s,t,r,o){return s(t,r,o)},BmXRb:n(1047),Phuri:n(974),tLBLy:function(s,t){return s(t)},EePWc:n(635)+"ile_name",GOJdO:function(s){return s()},Gwtep:n(880),yxnVe:function(s,t,r){return s(t,r)},DntpC:function(s,t,r){return s(t,r)},ttGHA:function(s,t){return s+t},Kixiu:n(1720),qokVf:"FILE_NOT"+n(492),oQSyQ:n(1796)+n(1112),jJBea:n(1622)+"rValues",KaWqv:n(564),EiZZY:n(554),YWawt:n(1725),knYzb:function(s){return s()},bOTQy:function(s,t){return s===t},HScbu:n(1001),JJjXL:n(1694),WpDaU:function(s,t){return s(t)},mhxex:"setcursor",NIufC:n(1356),ttjiP:n(1783),cbXQZ:function(s,t){return s(t)},FhHCk:n(1754)+"or",bdlen:n(626),tyTWX:function(s,t){return s||t},Szstw:function(s,t){return s!==t},aLuog:n(708),XHGrG:n(951),USCyC:function(s,t,r,o){return s(t,r,o)},JbAcn:n(1330),ElhgN:function(s,t,r,o){return s(t,r,o)},wlPNa:function(s,t,r){return s(t,r)},Ldxwo:"x_fronti"+n(410),snFpN:n(1287)+n(1236),VDRle:function(s,t,r){return s(t,r)},glzNl:"x-msg-cursor_value",bTRcl:function(s,t){return s===t},nRnEW:n(1084),XQWqN:function(s,t){return s!==t},EPNoV:n(1145),COAwM:n(1224),PfXqL:function(s){return s()},SIksO:function(s){return s()},RbTwa:function(s,t){return s===t},YCBwT:function(s,t){return s===t},xggdL:function(s){return s()},llATk:function(s,t,r){return s(t,r)},xnIYN:n(641),ZgIuz:function(s,t){return s<t},exglI:function(s,t){return s===t},TbRfw:function(s,t){return s===t},AKaCZ:n(1341),ynXvX:"IoLKw",SYrrZ:function(s,t,r){return s(t,r)},HLbDF:"bye",Xanlu:function(s,t){return s!==t},aNdrG:function(s,t){return s===t},TsCag:n(522),xzHGS:"always",ZfsXs:n(904),eFrIa:"ping_once_success",EcOaj:function(s,t){return s===t},PIapV:function(s,t,r){return s(t,r)},GnOpS:"arraybuf"+n(1530),GrXad:function(s,t){return s(t)},pxDtA:n(1456)+"rovide ws params, WebSoc"+n(493)+n(1513)+n(615)+n(1656),PFHtJ:n(1337)+"t",kNZqj:n(801)+n(1229)+n(875)+"ct",JpdnM:"pageshow",mEPcG:function(s,t){return s<<t},YBnmS:n(925),ctWTX:function(s,t){return s!==t},ONidC:"urnjV",dBJHO:n(885),kGVFK:n(1585),rTUoY:n(1343),aftnG:n(1672),MxUVf:n(943),iNmlL:function(s,t){return s||t},iRRId:n(1456)+n(787)+n(1138)+n(1322)+n(1009),zSqok:function(s,t){return s==t},mqjid:n(1405),zvJSL:function(s,t,r){return s(t,r)},RjhsE:n(676),wjWVR:function(s,t,r){return s(t,r)},LkXOE:function(s,t){return s!==t},CUyXU:n(1233),cOhbm:n(1621),faesx:function(s,t,r){return s(t,r)},NeUWX:function(s,t,r){return s(t,r)},KCXFE:function(s,t){return s||t},WoLFK:n(544),yqdup:function(s,t){return s>t},ZrmFt:function(s,t){return s<<t},oIzto:n(403),eQsDu:function(s,t,r){return s(t,r)},XRSsI:function(s,t,r){return s(t,r)},SMVjx:function(s,t){return s===t},ACcxY:n(963),zAxnN:n(1492),qfuyc:function(s,t){return s(t)},ByczE:function(s,t){return s(t)},Xiuzt:n(519)+">",YinYV:"going away, try reconnec"+n(805)+n(886),jbCuu:n(1445)+n(906)+"onnecting",sgAtm:n(1277),vNqIE:n(1577),PhkgP:function(s,t){return s>t},NydcM:function(s,t){return s!==t},qQtEq:n(1037),Teior:n(751),MYoXa:function(s,t,r){return s(t,r)},FbakX:function(s,t,r){return s(t,r)},QHRXZ:function(s,t,r){return s(t,r)},nXYye:n(1413)+n(511)+n(582)+n(985),hAiPW:"ack",Eolvk:n(1132),gMWyA:function(s,t){return s+t},AyLPz:n(1673)+n(1402)+n(779)+n(1317)+"ed",DDYZk:n(1673)+n(570)+n(1696),ueiKt:function(s,t){return s==t},sdnQc:"please p"+n(767)+n(465)+n(1225)+n(852)+n(853)+n(1309)+n(837)+n(1575),pJobB:function(s,t){return s instanceof t},jyeCR:function(s,t){return s(t)},ozLrL:function(s,t){return s||t},GmCId:function(s,t){return s instanceof t},CDyft:function(s,t){return s(t)},HsTop:"sent",JZAss:n(1030),sxJoh:function(s,t){return s||t},pImEd:n(721)+"econnect"+n(828),mgQbl:function(s,t,r){return s(t,r)},XaSeK:function(s,t){return s(t)},QXMAx:n(1548),SPRnq:function(s,t){return s(t)},RyZbX:n(1437),PhyvH:n(1308),FzTIe:function(s,t){return s!=t},vfHkw:function(s,t){return s===t},onJWl:n(575),KoDQY:function(s,t){return s!=t},Gzsjj:function(s,t){return s!=t},uHBmR:"Object",UBVWA:function(s,t){return s===t},eJcmP:n(977)+n(1396)+n(1183)+"pe",GKBYt:function(s,t){return s===t},XrWXn:function(s,t){return s===t},WNwHc:function(s,t){return s===t},POffE:"ServiceW"+n(397)+n(1531),TJgZS:function(s,t){return s!=t},aNQPx:function(s,t){return s===t},WmGmA:function(s,t){return s!=t},sMVSk:function(s,t){return s===t},RsGyu:function(s,t){return s!=t},qLowm:function(s,t){return s!=t},Bakeo:n(1065)+"qos__"};ke.r(X),ke.d(X,{FWS:()=>P0,CustomErrorEvent:()=>Ss,createCloseEvent:()=>pe,ReconnectEvent:()=>vs,createErrorEvent:()=>de,decodedFrame:()=>ms,createOpenEvent:()=>Is,CustomCloseEvent:()=>Es,createReconnectEvent:()=>ur,FrontierMessageEvent:()=>As,encodeFrame:()=>xr,createMessageEvent:()=>Ps,OpenEvent:()=>ks,ErrorCode:()=>Ge,Event:()=>at,MessageEvent:()=>Cs});let i="";function a(s=""){let t=n,r="02",o=""+Date.now(),x=i||(i=e[t(649)](p,s)),h=Math[t(1089)]().toString(16)[t(1733)](-6);return e.rJxLI(e.HMYFY(r,o),x)+h}function c(){let s=n;return e[s(691)](1e4,Date[s(1549)]())+Math[s(1773)](e[s(691)](1e4,Math[s(1089)]()))}function u(s){let t=n;return e[t(772)](e[t(1303)](Array,8)[t(874)]("0"),parseInt(s,10)[t(1398)](2))[t(1733)](-8)}function f(s){let t=n;return e[t(893)](e[t(1303)](Array,4)[t(874)]("0"),e[t(1269)](parseInt,s,2).toString(16)).slice(-4)}function l(s){let t=n,r=s[t(542)](/\./)[t(1360)](h=>u(h)),o=[];return o[0]=e.czVNz(f,r[0]+r[1]),o[1]=e[t(1093)](f,e[t(772)](r[2],r[3])),[e[t(981)],"0000",e[t(981)],e[t(981)],t(1448),e[t(1339)],o[0],o[1]][t(874)]("")}function p(s){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(541)](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(541)](s);return r?e[t(1768)](l,s):o?e.MdwIJ(w,s):e[t(950)]}function w(s){let t=n,r={NqUUO:function(b,E){return e[D(1159)](b,E)},bfyFd:e.nWwLF},o="",x=[],h=0,m=0,g=!0,d=e[t(981)];if(e[t(1565)](s[t(1528)]("::"),-1))if(e[t(425)](e.GfmGL,t(1365))){let b=s.split("::");for(let v=0;e[t(818)](v,b[t(1131)]);v++){let L=b[v];if(L[t(1528)](":")>0){let N=L[t(542)](":");g&&(h=N.length),m+=N[t(1131)];for(let z=0;e[t(455)](z,N[t(1131)]);z++)if(N[z][t(1131)]!==4){let me=d[t(1271)+"g"](0,4-N[z].length),j=me[t(741)](N[z]);x[t(1381)](j)}else x[t(1381)](N[z]);g=!1}else{if(e.Hzylu(4,L[t(1131)])){let N=d[t(1271)+"g"](0,e[t(539)](4,L[t(1131)])),z=N[t(741)](L);x.push(z)}else x[t(1381)](L);g&&(h+=1),m+=1,g=!1}}let E="";for(let v=0;e[t(818)](v,8-m);v++)E=E.concat(d);for(let v=0;v<x[t(1131)];v++)e[t(425)](v,h)?(o=o.concat(E),o=o.concat(x[v])):o=o[t(741)](x[v]);return o}else{let b=/(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(541)](_0x2c1a98),E=/(([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(_0x50f12b);return b?_0x3b4460(_0x555e5e):E?whEqOY[t(1652)](_0x2645a3,_0x15c8b4):whEqOY.bfyFd}{let b=s[t(542)](":");for(let E=0;e[t(736)](E,b[t(1131)]);E++){let v=b[E];if(e[t(786)](4,b[E][t(1131)])){let L=d[t(1271)+"g"](0,e[t(1226)](4,b[E][t(1131)])),N=L[t(741)](v);o=o[t(741)](N)}else o=o[t(741)](v)}return o}}function y(s,t){let r=n,o={ecTKl:r(633),fyGeU:e[r(700)],UbRgw:e.Jjlrg},x=s.key;e[r(699)](void 0,x)&&(e.xhPmz(V,t,10),e[r(1327)](be,t,x));let h=s[r(752)];h!==void 0&&(e.kBuYj!==r(1370)?(V(t,18),be(t,h)):(this[r(526)+"er"]&&_0x389449[r(1257)+"Listener"](o[r(1605)],this[r(971)+"nLine"]),this[r(526)+"er"]&&_0x1f3683[r(1257)+r(1682)](o[r(947)],this[r(971)+r(839)]),this[r(526)+"er"]&&_0x1edf1e.addEventListener(o.UbRgw,this[r(876)+r(856)]),this._isBrowser&&_0x192e6e[r(1257)+r(1682)](r(793),this[r(876)+r(650)])))}function _(s){let t=n,r={};e:for(;!e[t(467)](De,s);){let o=M(s);switch(e[t(1172)](o,3)){case 0:break e;case 1:r[t(1080)]=e[t(1426)](ye,s,e[t(1175)](M,s));break;case 2:r[t(752)]=e.WdCef(ye,s,e[t(761)](M,s));break;default:e[t(1426)](Y,s,e[t(671)](7,o))}}if(r[t(1080)]===void 0)throw new Error(e[t(944)]);if(e[t(1329)](void 0,r.value))throw new Error(e[t(961)]);return r}function C(s){let t=n,r=e[t(929)](Z);return e.xhPmz(P,s,r),e[t(1159)](W,r)}function P(s,t){let r=n,o=s[r(457)];e[r(699)](void 0,o)&&(e[r(545)](V,t,8),Pt(t,o));let x=s[r(916)];e[r(699)](void 0,x)&&(e.xOzPb(V,t,16),e[r(1562)](Pt,t,x));let h=s.service;e[r(786)](void 0,h)&&(e[r(1426)](V,t,24),Pt(t,e[r(667)](re,h)));let m=s.method;m!==void 0&&(e[r(473)](V,t,32),e.WdCef(Pt,t,e.qHLjj(re,m)));let g=s[r(1313)];if(g!==void 0)for(let me of g){e[r(747)](V,t,42);let j=e[r(929)](Z);y(me,j),e[r(1707)](V,t,j[r(478)]),e.okhcn(Yt,t,j),e[r(1159)](k,j)}let d=s["payloadE"+r(922)];e[r(786)](void 0,d)&&(e[r(747)](V,t,50),e[r(1510)](be,t,d));let b=s[r(1004)+r(972)];if(e[r(699)](void 0,b)){if(e.XGtqM(r(855),r(855)))return _0x3a0902||(_0x1350b0=[_0x4318ab,_0x4089b9,_0x23120d,_0x475b51,_0x574c33]);V(t,58),e[r(840)](be,t,b)}let E=s[r(687)];e[r(699)](void 0,E)&&(e[r(766)](V,t,66),e[r(1562)](V,t,E[r(1131)]),Xt(t,E));let v=s.LogIDNew;e.yKywI(void 0,v)&&(e[r(747)](V,t,74),e[r(1426)](be,t,v));let L=s["serverTi"+r(1207)];e[r(399)](void 0,L)&&(e[r(747)](V,t,82),e[r(766)](be,t,L));let N=s.msgID;e[r(786)](void 0,N)&&(e[r(888)](V,t,90),e[r(888)](be,t,N));let z=s[r(1054)+"e"];z!==void 0&&(e.QlbVb(V,t,96),e[r(1378)](Pt,t,e[r(1175)](re,z)))}function I(s){let t=n,r={LpVVA:function(o,x){return e.OgqsL(o,x)}};return e[t(1537)](e.ZCJJz,e[t(1355)])?r.LpVVA(_0x5d35f0,_0x235428):e[t(1159)](R,e[t(1175)](H,s))}function R(s){let t=n,r={};e:for(;!De(s);){let o=e[t(761)](M,s);switch(e[t(1772)](o,3)){case 0:break e;case 1:r[t(457)]=e.xqMCx(Te,s,!0);break;case 2:r[t(916)]=e.NJwpg(Te,s,!0);break;case 3:r.service=e.mTcHf(M,s);break;case 4:r[t(1479)]=e.szZvX(M,s);break;case 5:{let x=e.czVNz(U,s);(r.headers||(r.headers=[]))[t(1381)](e.NoDif(_,s)),s.limit=x;break}case 6:r[t(619)+"ncoding"]=e[t(1510)](ye,s,e[t(1303)](M,s));break;case 7:r[t(1004)+t(972)]=ye(s,e.qHLjj(M,s));break;case 8:r.payload=e[t(766)](kt,s,e[t(1159)](M,s));break;case 9:r[t(703)]=e[t(1104)](ye,s,e[t(749)](M,s));break;case 10:r[t(1649)+t(1207)]=e[t(1378)](ye,s,e[t(1159)](M,s));break;case 11:r.msgID=e[t(1104)](ye,s,e[t(1175)](M,s));break;case 12:r.frameType=M(s);break;default:Y(s,e[t(671)](7,o))}}if(e[t(1048)](void 0,r[t(457)]))throw new Error(e.NmEVp);if(e[t(1329)](void 0,r[t(916)]))throw new Error("Missing "+t(556)+t(1126)+t(916));if(e.TsJUV(void 0,r[t(974)]))throw new Error(t(1726)+t(556)+t(1126)+t(974));if(e[t(1048)](void 0,r[t(1479)]))throw new Error("Missing "+t(556)+t(1126)+t(1479));return r}function U(s){let t=n,r=e[t(1354)](M,s),o=s.limit;return s[t(478)]=s[t(1775)]+r,o}function Y(s,t){let r=n,o={ssDxV:e.EshMr};if(e.FUMNq!==e.tTBIH)switch(t){case 0:for(;e[r(1769)](128,e.mTcHf(ae,s)););break;case 2:se(s,M(s));break;case 5:e[r(1327)](se,s,4);break;case 1:e[r(1e3)](se,s,8);break;default:throw new Error(e[r(1353)]+t)}else this.emit(o[r(1167)],_0x3afe6c),this[r(905)]&&this[r(905)](_0x3414b8)}function re(s){let t=n;if(e[t(549)]("QrHpR","QrHpR"))return s|=0,{low:s,high:e[t(432)](s,31),unsigned:e[t(1267)](s,0)};_0x38c9a4[t(634)+t(920)]=void 0,_0x5c1d24(e[t(1518)])}let ee=[];function Z(){let s=n,t={FRveU:function(r,o){return e.fWAxV(r,o)},wsFdA:e[s(776)],uFOjB:function(r,o){return e[s(1586)](r,o)},aWvTr:function(r,o,x,h){return e.XjRUQ(r,o,x,h)},KmUcz:function(r,o){return r instanceof o}};if(e[s(1133)](s(616),s(616))){if(t[s(1052)](t[s(629)],typeof _0x31f615)){let r=new _0x304fb3(t[s(1606)](_0x93a05,_0x2f5b9e));return t[s(1215)](_0x36d5b4,_0x4a8c6b,r,0),r}return t[s(1284)](_0x229049,_0x3dddc1)?new _0x44e653(_0x26e193):new _0x5b534a(_0xd854ac.buffer,_0x817199[s(1700)+"et"],_0x22cbd6[s(1685)+"th"])}else{let r=ee[s(1521)]();return r?(r.offset=r[s(478)]=0,r):{bytes:new Uint8Array(64),offset:0,limit:0}}}function k(s){ee[n(1381)](s)}function H(s){return{bytes:s,offset:0,limit:s.length}}function W(s){let t=n,r=s[t(1038)],o=s[t(478)];return r.length===o?r:r[t(983)](0,o)}function se(s,t){let r=n;if(e.blTTI(e.yVVYV(s.offset,t),s.limit))throw new Error(r(1249)+"t limit");s.offset+=t}function De(s){let t=n;return e[t(685)](s[t(1775)],s.limit)}function ge(s,t){let r=n,o=s.bytes,x=s[r(1775)],h=s[r(478)],m=e[r(661)](x,t);if(e[r(1565)](m,o[r(1131)])){let g=new Uint8Array(e[r(483)](2,m));g[r(1043)](o),s[r(1038)]=g}return s[r(1775)]=m,e[r(1053)](m,h)&&(s[r(478)]=m),x}function Ye(s,t){let r=n,o=s[r(1775)];if(e[r(1565)](e.yVVYV(o,t),s[r(478)]))throw new Error(e.hYIxH);return s[r(1775)]+=t,o}function kt(s,t){let r=n,o=Ye(s,t);return s[r(1038)][r(983)](o,e[r(1348)](o,t))}function Xt(s,t){let r=n,o=e[r(1378)](ge,s,t[r(1131)]);s[r(1038)][r(1043)](t,o)}function ye(s,t){let r=n,o=e[r(383)](Ye,s,t),x=String[r(1075)+r(935)],h=s[r(1038)],m="\uFFFD",g="";for(let d=0;e[r(736)](d,t);d++){let b=h[e.nHNjn(d,o)],E,v,L,N;if(e[r(549)](e.ZoQCx(128,b),0))g+=e[r(1795)](x,b);else if(e[r(1272)](224,b)===192)if(e.rmVtt(d,1)>=t)g+=m;else if(e.bvgyn(e[r(669)],e.HPFWO))_0x2c727e=_0x542490.concat(_0x27e9e9),_0x254723=_0x475677[r(741)](_0x27b1fa[_0x13f8cd]);else if(E=h[e[r(1705)](e.jRqdu(d,o),1)],e[r(699)](e[r(1272)](192,E),128))g+=m;else if(N=e[r(1449)](e[r(937)](e[r(1769)](31,b),6),e[r(1181)](63,E)),N<128)g+=m;else if(e.FNPSu(r(1123),e[r(479)]))g+=e[r(1424)](x,N),d++;else{let z={cGGXh:QPEWYD[r(1611)],NMVtN:QPEWYD.zXenh,PpdcU:QPEWYD[r(1788)]};_0x1a0ef9.r=me=>{let j=r;z[j(1451)]!=typeof _0x1142dc&&_0x1441bb[j(1398)+j(1747)]&&_0x2c7fc5[j(1608)+j(1727)](me,_0x51024c[j(1398)+j(1747)],{value:z[j(603)]}),_0x295aec[j(1608)+"operty"](me,z.PpdcU,{value:!0})}}else if(e[r(1205)](e[r(1091)](240,b),224))if(e[r(685)](e[r(1383)](d,2),t))g+=m;else if(E=h[e.ilZAX(e.cotqg(d,o),1)],v=h[e.aXXnC(d,o)+2],e[r(1792)](e[r(1272)](E|e.LzEWx(v,8),49344),32896))g+=m;else if(e[r(812)](e.lzwMR,r(1247)))N=e[r(1449)](e[r(1449)](e.qPHRQ(15&b,12),e[r(679)](e[r(1769)](63,E),6)),e[r(471)](63,v)),e[r(1096)](N,2048)||e.jMPdx(N,55296)&&e.AvDHH(N,57343)?g+=m:(g+=x(N),d+=2);else return _0x5ba2bb?this[r(780)+"E"]():this.toBytesBE();else e[r(901)](248&b,240)?e[r(1514)](e[r(661)](d,3),t)?g+=m:(E=h[e[r(1171)](d,o)+1],v=h[e[r(1086)](e[r(1502)](d,o),2)],L=h[d+o+3],e.cnOxV(e[r(1021)](e[r(1449)](E,e[r(686)](v,8)),e.NEVvS(L,16))&12632256,8421504)?g+=m:(N=e[r(909)](e[r(1519)](e[r(715)](7,b),18)|e[r(686)](e[r(903)](63,E),12)|e[r(1769)](63,v)<<6,e[r(599)](63,L)),e[r(1404)](N,65536)||e[r(1053)](N,1114111)?g+=m:(N-=65536,g+=x(e[r(772)](e.ETkje(N,10),55296),e[r(1218)](1023,N)+56320),d+=3))):g+=m}return g}function be(s,t){let r=n,o=t[r(1131)],x=0;for(let g=0;e.NbBAO(g,o);g++){let d=t[r(960)+"At"](g);e[r(1267)](d,55296)&&d<=56319&&e[r(824)](e[r(898)](g,1),o)&&(d=e[r(1617)](e[r(990)](d<<10,t[r(960)+"At"](++g)),56613888)),x+=e[r(740)](d,128)?1:e[r(740)](d,2048)?2:e[r(1301)](d,65536)?3:4}e[r(1767)](V,s,x);let h=ge(s,x),m=s[r(1038)];for(let g=0;e[r(831)](g,o);g++)if(e.PhbGV(e[r(1082)],r(1326))){let d=t[r(960)+"At"](g);e[r(685)](d,55296)&&d<=56319&&e[r(1195)](e[r(1155)](g,1),o)&&(d=e[r(990)](e[r(937)](d,10),t[r(960)+"At"](++g))-56613888),e[r(1195)](d,128)?m[h++]=d:(e[r(1404)](d,2048)?m[h++]=e.OklqS(e[r(1391)](e[r(432)](d,6),31),192):(d<65536?m[h++]=e[r(1412)](e[r(903)](e[r(432)](d,12),15),224):(m[h++]=e[r(1736)](e[r(599)](d>>18,7),240),m[h++]=e[r(832)](e[r(967)](d,12)&63,128)),m[h++]=e[r(1088)](e.FfoNc(e[r(967)](d,6),63),128)),m[h++]=e.ducCV(63,d)|128)}else this[r(1120)]&&this._ws[r(1529)](_0x12bebf,_0x4f37a9)}function Yt(s,t){let r=n,o=ge(s,t[r(478)]),x=s[r(1038)],h=t.bytes;for(let m=0,g=t[r(478)];e[r(1723)](m,g);m++)x[e.RZhqi(m,o)]=h[m]}function ae(s){return s[n(1038)][Ye(s,1)]}function Zt(s,t){let r=n,o=e.rzDsZ(ge,s,1);s[r(1038)][o]=t}function M(s){let t=n,r=0,o=0,x;do x=e[t(797)](ae,s),e[t(1078)](r,32)&&(o|=e[t(1176)](e[t(927)](127,x),r)),r+=7;while(128&x);return o}function V(s,t){let r=n;for(t>>>=0;e[r(1267)](t,128);)e[r(747)](Zt,s,e[r(677)](e[r(1699)](127,t),128)),t>>>=7;Zt(s,t)}function Te(s,t){let r=n,o={kDPeO:e[r(771)],XqeDa:r(1437)};if(e[r(1408)]===e[r(1408)]){let x=0,h=0,m=0,g;if(g=e[r(1768)](ae,s),x=127&g,128&g&&(g=e[r(1159)](ae,s),x|=e.IREtk(e[r(1272)](127,g),7),e.ducCV(128,g)&&(g=e.IXGHE(ae,s),x|=e[r(398)](e[r(471)](127,g),14),e[r(1699)](128,g)&&(g=e[r(1392)](ae,s),x|=e[r(1008)](127&g,21),e.XwwCb(128,g))))){if(e[r(396)](r(606),e[r(1011)]))return this[r(638)][r(897)+"pe"];g=e[r(1768)](ae,s),h=e[r(671)](127,g),e[r(1570)](128,g)&&(g=e[r(1375)](ae,s),h|=e[r(1008)](127&g,7),e[r(1324)](128,g)&&(g=e.HNUtz(ae,s),h|=e[r(869)](e.BjyzZ(127,g),14),128&g&&(g=e[r(1159)](ae,s),h|=e[r(398)](127&g,21),e.XwwCb(128,g)&&(g=ae(s),m=e.KKHao(127,g),128&g&&(g=ae(s),m|=e.wdcPn(127,g)<<7)))))}return{low:e[r(909)](x,e.ymNAV(h,28)),high:e[r(1088)](e[r(1172)](h,4),e[r(1128)](m,24)),unsigned:t}}else this["_pingLos"+r(696)]?.[r(1802)](),this[r(863)](o[r(887)],o[r(870)]),this[r(469)+r(696)]?.[r(1095)+"chMaxCount"]()?this[r(1294)+"econnect"]():this[r(1102)]()}function Pt(s,t){let r=n,o={gRKVD:function(x,h,m,g,d){return e[D(698)](x,h,m,g,d)},OLsRl:function(x,h){return e[D(458)](x,h)}};if(e[r(695)](e[r(449)],e[r(1777)])){let x=e[r(1772)](t.low,0),h=e[r(914)](e[r(1160)](e[r(914)](t[r(1299)],28),e[r(679)](t[r(1069)],4)),0),m=e[r(914)](t.high,24),g=e[r(1329)](0,m)?e[r(549)](0,h)?e[r(666)](x,16384)?e[r(1096)](x,128)?1:2:e[r(831)](x,2097152)?3:4:e.oPXTX(h,16384)?h<128?5:6:e[r(1301)](h,2097152)?7:8:e.TdhWQ(m,128)?9:10,d=e[r(710)](ge,s,g),b=s.bytes;switch(g){case 10:b[e[r(1589)](d,9)]=e[r(1184)](m>>>7,1);case 9:b[e[r(1480)](d,8)]=e[r(1792)](9,g)?e[r(1558)](128,m):e.KRXRz(127,m);case 8:b[e.iuBTV(d,7)]=e[r(699)](8,g)?e[r(1455)](h>>>21,128):e[r(1219)](e[r(1243)](h,21),127);case 7:b[e[r(1388)](d,6)]=g!==7?h>>>14|128:e[r(1391)](e[r(1278)](h,14),127);case 6:b[e.hHjfV(d,5)]=g!==6?e[r(968)](e[r(1640)](h,7),128):e[r(999)](e[r(1278)](h,7),127);case 5:b[e[r(1501)](d,4)]=e[r(1537)](5,g)?e[r(968)](128,h):e[r(1150)](127,h);case 4:b[e[r(772)](d,3)]=g!==4?e[r(1282)](e[r(914)](x,21),128):e[r(1755)](x>>>21,127);case 3:b[e.DjumR(d,2)]=e.aWDOC(3,g)?e[r(500)](x,14)|128:e.thGwE(x,14)&127;case 2:b[d+1]=g!==2?e[r(1455)](e[r(954)](x,7),128):e[r(1755)](x>>>7,127);case 1:b[d]=g!==1?128|x:e.KSeos(127,x)}}else _0x23ee53[r(1257)+r(1682)](QPEWYD.dIuvs,x=>{let h=r;wOTQfJ[h(890)](_0x249b74,_0x189262(_0x29b97b[h(1275)]),x[h(1556)+"on"],x[h(809)+"on"],wOTQfJ.OLsRl(_0x59db8c,_0x47a30c[h(1055)+"ion"]))})}function ms(s){let t=n,r={PDRfm:function(o,x){return e[D(1221)](o,x)},AKLLI:function(o,x){return e[D(918)](o,x)},lfRBD:function(o,x){return e[D(458)](o,x)},nOehB:function(o,x){return o<<x}};if(e[t(812)](e[t(555)],e.EjCLZ))_0x35a70e=_0x57c0f0(_0x5743fe),_0x1baeaf=BXWhJO.PDRfm(127,_0x10edc7),BXWhJO[t(1295)](128,_0x4142b7)&&(_0x2c80fc=BXWhJO[t(979)](_0x428aa9,_0x503f58),_0x157098|=BXWhJO[t(558)](127&_0x143c0e,7));else return e[t(571)](I,s)}function xr(s){return e[n(1140)](C,s)}let ws=65536,qa=e[n(690)],ot=e[n(483)](ws,ws),_s=e[n(691)](ot,ot),ys=_s/2,He=String[n(408)+"e"][n(960)+"At"];class q{constructor(t,r,o){let x=n;this[x(1574)]=!0,this[x(1299)]=e[x(1412)](0,t),this.high=e[x(677)](0,r),this[x(1046)]=!!o}static[n(1574)](t){let r=n;return t&&e[r(549)](!0,t[r(1574)])}static fromBits(t,r,o){return new q(t,r,o)}static[n(1687)+"s"](t,r,o){let x=n;return o?q[x(1687)+x(819)](t,r):q[x(1687)+x(1763)](t,r)}static fromBytesLE(t,r){let o=n;return new q(e[o(1088)](e[o(535)](t[0]|t[1]<<8,e[o(424)](t[2],16)),e[o(1618)](t[3],24)),e[o(535)](e[o(1246)](e.FYygo(t[4],e[o(424)](t[5],8)),e[o(587)](t[6],16)),t[7]<<24),r)}static[n(1687)+n(1763)](t,r){let o=n;return new q(e[o(1282)](e[o(504)](e[o(1650)](t[4],24)|t[5]<<16,e[o(476)](t[6],8)),t[7]),e[o(505)](e.dbFOe(e.dbFOe(e[o(1599)](t[0],24),e[o(686)](t[1],16)),t[2]<<8),t[3]),r)}static[n(1713)](t){let r=n;return e[r(1427)](t,qa)?bs:new q(e.vDfje(e[r(1736)](He[r(491)](t,0),e[r(476)](He[r(491)](t,1),8))|e[r(1400)](He.call(t,2),16)|He[r(491)](t,3)<<24,0),(He[r(491)](t,4)|e[r(941)](He.call(t,5),8)|e[r(1650)](He[r(491)](t,6),16)|e[r(476)](He.call(t,7),24))>>>0,!0)}[n(1423)](){let t=n;return String[t(1075)+"Code"](255&this[t(1299)],e[t(1200)](this.low>>>8,255),e[t(918)](e[t(1772)](this[t(1299)],16),255),e[t(498)](this[t(1299)],24),e[t(1272)](255,this[t(1069)]),e[t(509)](e.kKaVX(this.high,8),255),this.high>>>16&255,e[t(1729)](this.high,24))}static[n(1584)+"er"](t,r=!0){let o=n,x={ojbqT:function(h,m,g,d){return e[D(376)](h,m,g,d)},Cvycx:function(h,m,g){return e[D(768)](h,m,g)},bZszF:o(421)};if(e[o(749)](isNaN,t))return r?Fa:bs;if(r){if(t>=_s)return Ha}else if(e[o(786)]("VVgHq",o(722)))try{x[o(374)](_0x463110,this,_0xc7778c,[_0x2c9781,_0x14c241,_0x395ff9])}catch(h){let m=x[o(1012)](_0x1e2d23,x.bZszF,{message:h[o(1460)],code:_0x56abef[o(889)+"OR"],error:h});this[o(1028)+o(674)+o(604)](m)}else{if(t<=-ys)return Ga;if(e[o(573)](e[o(521)](t,1),ys))return Ua}return q[o(1386)](e.USXrC(e[o(1101)](t,ot),0),e[o(909)](e[o(1717)](t,ot),0),r)}[n(1270)](){let t=n;return this[t(1046)]?e.EBbGy(e[t(691)](e.ddPep(this.high,0),ot),e[t(1243)](this[t(1299)],0)):e[t(1085)](this[t(1069)]*ot,e[t(1551)](this[t(1299)],0))}[n(385)](){let t=n;if(e.AqFyD(e[t(878)],e[t(878)])){if(e[t(833)](_0x257796,_0x2720f6))return _0x4f4e57?_0x20a2d7:_0x3dc945;if(_0x207ee2){if(e.OigdD(_0x120aa7,_0x2510c8))return _0x4eb473}else{if(e[t(1248)](_0x4e9a8c,-_0x36e333))return _0x2ea4d3;if(e[t(1800)](_0x539b27+1,_0x5f49d6))return _0x20b906}return _0x4d59da.fromBits(e.jAszQ(e.rPfuJ(_0x4198a5,_0x45bbc9),0),e[t(1245)](_0x19d124/_0x248ab5,0),_0x57f211)}else return e.NQVqc(0,this[t(1069)])&&e[t(812)](0,this[t(1299)])}[n(529)](t){let r=n;q[r(1574)](t)||(t=q[r(1584)+"er"](t));let o=e[r(1695)](this[r(1069)],16),x=e[r(599)](65535,this[r(1069)]),h=this[r(1299)]>>>16,m=e.WmLpU(65535,this[r(1299)]),g=e[r(727)](t[r(1069)],16),d=65535&t[r(1069)],b=t[r(1299)]>>>16,E=e[r(999)](65535,t[r(1299)]),v=0,L=0,N=0,z=0;return z+=e[r(915)](m,E),N+=e.OgFtG(z,16),z&=65535,N+=h+b,L+=e[r(498)](N,16),N&=65535,L+=e[r(1217)](x,d),v+=e.nQZXi(L,16),L&=65535,v+=e.eUuWx(o,g),v&=65535,q[r(1386)](e[r(1108)](e[r(996)](N,16),z),e[r(1160)](e.jQnzu(v,16),L),this[r(1046)])}equals(t){let r=n;return q[r(1574)](t)||(t=q[r(1584)+"er"](t)),this[r(1046)]!==t[r(1046)]&&e[r(549)](e[r(914)](this.high,31),1)&&e[r(1352)](t[r(1069)]>>>31,1)?!1:e[r(1352)](this[r(1069)],t[r(1069)])&&e[r(1497)](this[r(1299)],t[r(1299)])}addOne(){let t=n;if(e[t(1352)](t(1060),"chJYr"))this._isMiniTT?_0x45e1ec[t(475)+t(481)+t(1759)](({isConnected:r})=>{let o=t;this[o(1633)+"igatorOnline"]=r,r?this["_handleO"+o(1149)]():this[o(971)+o(839)]()}):this[t(1731)+"X"]&&_0x2a3325[t(475)+t(481)+t(1759)](({isConnected:r})=>{let o=t;this["_miniNavigatorOn"+o(1014)]=r,r?this["_handleO"+o(1149)]():this[o(971)+o(839)]()});else return e[t(1657)](-1,this[t(1299)])&&e.NQdit(-1,this.high)?q[t(1386)](0,0,this[t(1046)]):e[t(1657)](-1,this.low)?q[t(1386)](0,e[t(1752)](this[t(1069)],1),this[t(1046)]):q[t(1386)](this[t(1299)]+1,this[t(1069)],this.unsigned)}[n(1411)](t){let r=n;if(e[r(1792)](e[r(1534)],e[r(734)]))return t?this[r(780)+"E"]():this.toBytesBE();{let o=e[r(1462)](_0x2a204e,_0x25c703,_0x147b47[r(1131)]);_0x454633[r(1038)].set(_0x2c9b36,o)}}[n(780)+"E"](){let t=n,r=this[t(1069)],o=this[t(1299)];return[e[t(1487)](255,o),e[t(794)](e[t(1285)](o,8),255),e[t(1772)](o,16)&255,e[t(1331)](o,24),e.NFfRW(255,r),e[t(1688)](r>>>8,255),e[t(1239)](r>>>16,255),e[t(727)](r,24)]}[n(1019)+"E"](){let t=n,r=this[t(1069)],o=this[t(1299)];return[e[t(1774)](r,24),e.pZnKa(r>>>16,255),e[t(395)](e.qEYZR(r,8),255),e[t(1372)](255,r),o>>>24,e[t(931)](o>>>16,255),e.YhdNW(o,8)&255,e[t(927)](255,o)]}}let bs=new q(0,0,!1),Fa=new q(0,0,!0),Ua=q[n(1386)](-1,2147483647,!1),Ha=q.fromBits(-1,-1,!0),Ga=q.fromBits(0,-2147483648,!1);var Ge=(function(s){let t=n,r=e.hFUwR[t(542)]("|"),o=0;for(;;){switch(r[o++]){case"0":return s;case"1":s[s[e[t(1444)]]=5004]=e[t(1444)];continue;case"2":s[s[e[t(622)]]=5003]=e[t(622)];continue;case"3":s[s.OPEN_ERROR=5005]=e.eeLJr;continue;case"4":s[s[e[t(1144)]]=5002]=e[t(1144)];continue;case"5":s[s[e.ZbZAf]=5001]=e[t(448)];continue}break}})({});class at{constructor(t){let r=n;this[r(1432)]=t,this[r(417)]=null}}class vs extends at{constructor(t,r){let o=n;super(t),this[o(1460)]=r&&r.message||null}}class Ss extends at{constructor(t,r){let o=n,x=e[o(1291)][o(542)]("|"),h=0;for(;;){switch(x[h++]){case"0":this[o(1330)]=r&&r[o(1330)]||5001;continue;case"1":this[o(1476)]=r&&r[o(1476)]||"";continue;case"2":this[o(1477)]=r&&r[o(1477)]||0;continue;case"3":super(t);continue;case"4":this[o(998)]=r&&r[o(998)]||0;continue;case"5":this[o(421)]=r&&r[o(421)]||null;continue;case"6":this.message=r&&r[o(1460)]||"";continue}break}}}class Es extends at{constructor(t,r){let o=n;super(t),this[o(1330)]=r&&r[o(1330)]||0,this[o(1760)]=r&&r[o(1760)]||"",this.wasClean=r&&r.wasClean||!1,this[o(1336)+o(636)]=r&&r.willReconnect||!1}}class Cs extends at{constructor(t,r){let o=n;super(t),this.data=r&&r[o(1347)]||null}}class As extends Cs{constructor(t,r){let o=n;super(t),this.data=r&&r.data||null,this.message=r&&r[o(1460)]||null}}class ks extends at{constructor(t,r){let o=n;super(t),this[o(1347)]=r&&r[o(1347)]||null}}function de(s,{message:t,code:r,error:o}){return new Ss(s,{message:t,code:r,error:o})}function pe(s,{code:t,reason:r,wasClean:o,willReconnect:x}){let h=n,m={pvRoq:function(g,d,b){return e[D(1462)](g,d,b)}};if(e[h(1642)]("QTWBI",e[h(1474)]))return new Es(s,{code:t,reason:r,wasClean:o,willReconnect:x});m.pvRoq(_0x3c55be,_0x16f478,this["_getInte"+h(1632)+"e"](_0x2154f6))}function Ps(s,{data:t,message:r}){return new As(s,{data:t,message:r})}function Is(s,{data:t}){return new ks(s,{data:t})}function ur(s,{message:t}){return e.nRQVQ!==e.RkJRs?new vs(s,{message:t}):(_0x497adc[_0x11f07e]=_0x2d28ad,!0)}class Ds{constructor(t,r){let o=n;e[o(1751)](e[o(402)],o(864))?(this[o(440)+"s"]=t,this[o(1211)+"es"]=r,this["currentI"+o(1304)]=0,this[o(871)+o(1628)+o(1389)+"t"]=0):(this[o(1173)]=!0,this[o(1274)]())}[n(591)+n(550)+n(1721)](){let t=n;if(e[t(807)](e.GXYdN,e[t(978)]))this[t(1442)+t(1304)]=0,this[t(871)+"ndpointT"+t(1389)+"t"]=0;else return!!this[t(673)]}[n(1151)+"es"](){let t=n;this[t(871)+"ndpointT"+t(1389)+"t"]=0}["getCurre"+n(1124)+"nt"](){let t=n;return this[t(440)+"s"][this[t(1442)+t(1304)]]}["getCurrentEndpointTriesC"+n(429)](){let t=n;return this[t(871)+t(1628)+t(1389)+"t"]}[n(1095)+n(1188)+"es"](){let t=n;if(e[t(1399)]!==e.ClBLA)return!!(this["currentI"+t(1304)]>=this[t(440)+"s"].length||e[t(1657)](this.currentIndex,this[t(440)+"s"][t(1131)]-1)&&e[t(1048)](this[t(871)+t(1628)+t(1389)+"t"],this[t(1211)+"es"]));{let r=this[t(673)].getItem(this._prefix);return _0x4761b7[t(516)](e[t(512)](r,"{}"))[_0x2074cf]}}[n(810)+n(970)+n(1320)+n(1213)+"tries"](){let t=n;return e.MhwIh(this[t(1442)+t(1304)],this[t(440)+"s"].length)?!0:e[t(692)](this[t(871)+"ndpointT"+t(1389)+"t"],this[t(1211)+"es"])}["replaceB"+n(720)+n(1090)+n(1098)+n(409)](){let t=n;return this[t(871)+t(1628)+"riesCount"]=1,this[t(1442)+t(1304)]++,this.endpoints[this[t(1442)+"ndex"]]}["getCurre"+n(1124)+n(1187)+n(910)](){let t=n;return this[t(871)+"ndpointT"+t(1389)+"t"]++,this[t(1471)+"ntEndpoint"]()}}let ct=(e.FzTIe(n(1662)+"d",typeof globalThis)&&e[n(873)]("Window",globalThis[n(534)+n(502)].name)||e[n(1611)]!=typeof window&&e[n(895)](e[n(697)],window[n(534)+n(502)].name))&&e.KoDQY("undefined",typeof document),Ze=e[n(1439)]("undefined",typeof globalThis)&&(e.uHBmR===globalThis["construc"+n(502)][n(798)]||e[n(1552)](e[n(1576)],globalThis[n(534)+n(502)][n(798)]))&&e[n(1635)](n(1662)+"d",typeof tt),It=(typeof globalThis<"u"&&e.GKBYt(e[n(991)],globalThis["construc"+n(502)].name)||e[n(1578)](e.MdhBG,typeof globalThis)||e[n(644)](e[n(1611)],typeof globalThis)&&!!globalThis["WeixinJS"+n(627)])&&e[n(1611)]!=typeof wx,Dt=e.MdhBG!=typeof globalThis&&(e[n(537)](e[n(1576)],globalThis[n(534)+n(502)][n(798)])||e[n(760)](n(1338)+n(1403)+n(704),globalThis[n(534)+n(502)].name)||e[n(495)](e.POffE,globalThis[n(534)+n(502)][n(798)]))&&e[n(581)](e[n(1611)],typeof self),ja=e[n(1611)]!=typeof globalThis&&e[n(1401)](e[n(991)],globalThis[n(534)+n(502)][n(798)])&&e[n(377)]("undefined",typeof global)&&e[n(659)](e[n(991)],global[n(534)+n(502)][n(798)])&&e[n(1146)](n(1662)+"d",typeof process)&&!!process[n(1457)];class fr{constructor(){let t=n,r={ztfsO:function(o,x){return e[D(549)](o,x)}};if(e[t(396)](t(1655),e[t(1740)]))this[t(1191)+"rs"]={};else return ljGlps.ztfsO(0,this[t(1069)])&&ljGlps[t(1568)](0,this[t(1299)])}emit(t,...r){let o=n,x=this._listeners[t];if(x)x.slice().forEach(h=>h.fn[o(1222)](h.ctx,r));else if(e[o(1582)]("error",t)&&!this[o(905)]){let h=r[o(1131)]&&r[0];if(h instanceof Error)throw h;let m=new Error(e[o(1171)](e.FtgzH,h?e[o(1786)](e[o(1250)](" (",h.message),")"):""));throw m.context=h,h}return this}[n(1130)](t,r){let o=n;if(e.uzfYy(void 0,t))this[o(1191)+"rs"]={};else if(e.FNPSu(void 0,r))this[o(1191)+"rs"][t]=null;else{let x=this._listeners[t];if(x)for(let h=0;e[o(455)](h,x[o(1131)]);)e.NftMx(x[h].fn,r)?x[o(660)](h,1):++h}return this}on(t,r,o){let x=n;return(this._listeners[t]||(this[x(1191)+"rs"][t]=[]))[x(1381)]({fn:r,ctx:o||this}),this}}class Ka extends fr{[n(430)+n(789)+n(1627)](t){let r=n;return t.errMsg||t[r(388)]?("message: "+(t.errMsg||"")+r(1252)+(t[r(388)]||""))[r(588)]():JSON[r(1342)+"y"](t)}constructor(t,r,o){let x=n;super(),this[x(638)]=null,It&&wx[x(1643)+"ocket"]&&(this[x(638)]=wx[x(1643)+"ocket"]({url:t,protocols:r,header:o,fail:this[x(1395)+x(613)+x(1686)][x(1545)](this),success:this[x(1395)+x(1600)+x(777)+"ler"][x(1545)](this)})),Ze&&tt[x(1643)+x(484)]&&(this[x(638)]=tt[x(1643)+"ocket"]({url:t,protocols:r,header:o,fail:this[x(1395)+x(613)+x(1686)][x(1545)](this),success:this[x(1395)+x(1600)+x(777)+x(656)][x(1545)](this)}))}[n(1395)+"ocketSuc"+n(777)+n(656)](){let t=n;Promise[t(1129)]()[t(415)](()=>{this[t(1790)+"steners"]()})}[n(1395)+n(613)+n(1686)](t){let r=n;Promise[r(1129)]()[r(415)](()=>{let o=r,x=de(e.EshMr,{message:this[o(430)+o(789)+o(1627)](t)});this[o(863)](e[o(598)],x);let h=pe(o(1529),{reason:this[o(430)+o(789)+o(1627)](t)});this.emit("close",h)})}[n(1790)+"steners"](){let t=n,r={UBllP:function(o,x,h){return e[D(1269)](o,x,h)},OTDGe:e[t(598)]};if(e[t(426)](e[t(757)],e[t(757)]))return this[t(1046)]?e[t(772)](e[t(691)](e.kKaVX(this[t(1069)],0),_0x160b7b),e.yyFGd(this[t(1299)],0)):e[t(1059)](e.iWNrp(this[t(1069)],_0x497b1c),e[t(1715)](this[t(1299)],0));this[t(638)][t(962)](o=>{let x=t;this[x(863)](x(1577),e[x(1767)](Is,x(1577),{...o,data:o[x(487)]||""}))}),this._socket[t(1654)](o=>{let x=t;if(e[x(532)](x(494),x(1136)))return this._ws?this[x(1120)][x(897)+"pe"]:this[x(1280)+x(972)];this[x(863)](e[x(719)],e[x(1193)](pe,e[x(719)],{...o}))}),this[t(638)].onMessage(o=>{let x=t;this[x(863)](x(1460),e[x(768)](Ps,e[x(994)],{...o}))}),this._socket[t(1340)](o=>{let x=t;this[x(863)](x(421),r[x(1384)](de,r[x(654)],{...o,message:o.errMsg||""}))})}[n(1639)](t){let r=n,o={ONIfO:e[r(598)]};if(e[r(1416)](t,Uint8Array)){if(e.XGtqM(e.sGVvq,e.sGVvq))return this[r(1299)]===-1&&e[r(756)](-1,this.high)?_0x1d08f2[r(1386)](0,0,this.unsigned):e[r(1421)](-1,this[r(1299)])?_0x26bf35[r(1386)](0,e[r(1022)](this.high,1),this[r(1046)]):_0x433692[r(1386)](e[r(1217)](this[r(1299)],1),this[r(1069)],this[r(1046)]);{let x=t[r(400)][r(1733)](t.byteOffset,e.kenGQ(t.byteLength,t[r(1700)+"et"]));this[r(638)]&&this[r(638)][r(1639)]({data:x,fail:h=>{let m=r;this.emit(e[m(598)],e[m(466)](de,e.EshMr,{message:this[m(430)+m(789)+"age"](h)}))}})}}else this[r(638)]&&this[r(638)][r(1639)]({data:t,fail:x=>{let h=r;this[h(863)](o[h(924)],de(o[h(924)],{message:this[h(430)+h(789)+"age"](x)}))}})}[n(1529)](t,r){let o=n;if(e[o(786)](e[o(1141)],e.rpxCE))return _0xa4b1c9[o(1730)+"oreNames"][1]?void 0:_0x5ecfaf[o(1730)+o(743)](_0x392870.objectStoreNames[0]);this[o(638)]&&this[o(638)].close({code:t,reason:r})}[n(1257)+n(1682)](t,r){this.on(t,r)}[n(611)+n(1121)+n(647)](t,r){let o=n,x={vGWJW:function(h,m){return e[D(399)](h,m)},Ijyzz:e[o(1478)],yImMk:e[o(700)]};e[o(532)](e[o(1620)],e[o(1470)])?(this[o(861)+o(664)]()&&(!this._ws||x[o(958)](this._ws[o(1625)+"te"],this[o(1074)])||this._ws.readyState!==this.CONNECTING)&&this[o(971)+o(1149)](),this[o(526)+"er"]&&_0x27554d[o(1257)+"Listener"](x[o(942)],this[o(971)+o(1149)]),this[o(526)+"er"]&&_0x5514e7[o(1257)+o(1682)](x[o(892)],this[o(971)+"ffLine"])):this.off(t,r)}get[n(1625)+"te"](){return this[n(638)].readyState}get binaryType(){let t=n,r={bEkKl:function(o,x){return e[D(1272)](o,x)},qpSku:function(o,x,h,m){return e[D(1507)](o,x,h,m)}};if(e[t(812)]("WLOBz",e.GerJI)){let o=r[t(1593)](255,_0x32860f);r[t(1253)](_0x2971c6,o,_0x306d12,_0x3b25e0+_0x27132c),_0x4e31a5>>>=8,_0xe68d11--}else return this._socket.binaryType}set[n(897)+"pe"](t){}get[n(1450)](){let t=n,r={KPwpP:function(o,x){return e[D(1248)](o,x)},crKle:t(565)+"alled mu"+t(1186)+t(877)+"process",TeTXU:function(o,x){return o+x}};return e[t(1515)]("NcZKz",t(1334))?r.KPwpP(_0x5ebf35,_0x5ed6c5)?_0x3d7eca[t(1114)](new _0x31da90(r[t(1801)])):(_0x47e6eb=_0x459368,_0x2bfd7f===_0x41fa88.length?_0x544410[t(1129)]():_0x51638c[_0x4ef17e][t(1545)](_0x26b1db)(_0x4a0609,_0x4e2ab4[t(1545)](null,r[t(1581)](_0x4e0b6e,1)))):this[t(638)].url}get protocol(){return this[n(638)].protocol}get[n(1265)+"ns"](){return this[n(638)].extensions}get bufferedAmount(){return 0}}function Wa(s,t){let r=n;if(t)return new t(s[r(1450)],s.protocol);if(It||Ze)return new Ka(s.url,s[r(763)],s[r(1313)]);if((ct||Dt)&&e[r(1051)](e[r(1611)],typeof WebSocket)&&WebSocket)return new WebSocket(s[r(1450)],s[r(763)+"s"])}function Ja(s){let t=n,r=e[t(1527)][t(542)]("|"),o=0;for(;;){switch(r[o++]){case"0":if(e[t(512)](ct,Dt)&&e[t(1051)](e.MdhBG,typeof WebSocket)&&WebSocket)return!0;continue;case"1":if(s)return!0;continue;case"2":if(Ze&&tt[t(1643)+t(484)])return!0;continue;case"3":if(It&&wx[t(1643)+t(484)])return!0;continue;case"4":return!1}break}}function Ts(s,t,r){let o=-1;async function x(h){let m=D;return e[m(1293)](h,o)?Promise.reject(new Error("next() c"+m(1780)+"ltiple t"+m(877)+m(758))):(o=h,e[m(812)](h,r[m(1131)])?Promise[m(1129)]():r[h].bind(s)(t,x[m(1545)](null,h+1)))}e.HNUtz(x,0)}function Rs(s){let t=n,r=0,o=0;for(let x=0;e.PcOgu(x,s[t(1131)]);++x)o=s.charCodeAt(x),e.xMJKa(o,128)?r+=1:e.sInvq(o,2048)?r+=2:e[t(1515)](e[t(1362)](64512,o),55296)&&(64512&s[t(960)+"At"](x+1))===56320?(++x,r+=4):r+=3;return r}function Ns(s,t,r){let o=n;if(e[o(1368)](e[o(1418)],e[o(391)])){let x=e[o(1237)](this._options[o(619)+o(922)],_0x3e1a65)?{force:!!this[o(1805)][o(619)+o(922)][o(590)],encoding:this[o(1805)][o(619)+o(922)][o(561)]?this[o(1805)][o(619)+o(922)][o(561)].replace(/\s/g,"")[o(1669)+o(640)]():""}:{force:!1,encoding:this[o(1805)][o(619)+o(922)]?this[o(1805)][o(619)+o(922)][o(1042)](/\s/g,"")[o(1669)+o(640)]():""},h=_0x689e0e.payloadEncoding?_0x5c0bca[o(619)+o(922)][o(1042)](/\s/g,"")[o(1669)+o(640)]():"",m=this[o(1805)][o(1004)+o(972)]instanceof _0x77f4c4?{force:!!this[o(1805)][o(1004)+o(972)].force,type:this[o(1805)][o(1004)+o(972)][o(1432)]?this[o(1805)][o(1004)+o(972)].type[o(1042)](/\s/g,"")[o(1669)+o(640)]():""}:{force:!1,type:this._options[o(1004)+"ype"]?this[o(1805)]["payloadT"+o(972)][o(1042)](/\s/g,"")[o(1669)+o(640)]():""},g=_0x56fe2b.payloadType?_0x1ba845[o(1004)+o(972)][o(1042)](/\s/g,"")[o(1669)+o(640)]():"",d=m[o(590)]?m[o(1432)]:g||m.type,b=x.force?x[o(561)]:h||x[o(561)],E=[e[o(1430)],e.oLZjP,e[o(1307)],e[o(776)]],v=[e[o(1661)],e[o(1027)]];this._options[o(594)+o(431)+"extPayload"]&&E[o(1062)](d)&&(!b||v.includes(b))?_0x1a614d[o(1415)+"oad"]=e.XUUZZ(_0x581b0b,_0x2c0e85[o(687)],0,_0x2b3442[o(687)][o(1685)+"th"]):_0x13e6da[o(1415)+o(683)]=""}else{if(e.kRzEk(e[o(1335)](r,t),1))return"";let x="";for(let h=t;h<r;)if(e[o(1459)]==="RLWDn"){let m=s[h++];if(e.pzcwW(m,127))x+=String["fromChar"+o(935)](m);else if(e[o(1499)](m,192)&&m<224)x+=String[o(1075)+"Code"](e[o(1614)](e[o(574)](31,m)<<6,e[o(477)](63,s[h++])));else if(e.RjSLM(m,224)&&m<240)x+=String[o(1075)+"Code"](e[o(1455)](e.tyWEs(15,m)<<12,e[o(934)](e[o(1071)](63,s[h++]),6))|63&s[h++]);else if(m>=240){let g=e[o(1244)](e[o(1245)](e[o(1449)](e[o(1143)](e[o(476)](7&m,18),e[o(1440)](e.tyWEs(63,s[h++]),12)),e[o(1127)](e[o(639)](63,s[h++]),6)),e.BDVfH(63,s[h++])),65536);x+=String[o(1075)+o(935)](e.jlLUs(55296,e[o(967)](g,10))),x+=String[o(1075)+o(935)](e[o(1567)](56320,e[o(1570)](1023,g)))}}else _0x4407ac.o=(m,g)=>_0x5510be.prototype[o(1206)+o(1727)].call(m,g);return x}}function dr(s,t,r){let o=n,x=r,h,m;for(let g=0;e[o(392)](g,s.length);++g)h=s[o(960)+"At"](g),h<128?t[r++]=h:e.Qvuzd(h,2048)?(t[r++]=e.RXttS(e[o(432)](h,6),192),t[r++]=e[o(930)](63,h)|128):e.vZlQM(e[o(1221)](64512,h),55296)&&e[o(1067)](e[o(1184)](64512,m=s.charCodeAt(e[o(1473)](g,1))),56320)?(h=e.ilZAX(e[o(1678)](65536,e.pKcGk(e[o(1119)](1023,h),10)),e[o(678)](1023,m)),++g,t[r++]=e[o(1143)](e[o(967)](h,18),240),t[r++]=e[o(1407)](e[o(1588)](h,12)&63,128),t[r++]=e[o(860)](e[o(432)](h,6),63)|128,t[r++]=e[o(930)](63,h)|128):(t[r++]=e[o(1558)](e.ETkje(h,12),224),t[r++]=e[o(1088)](e[o(1570)](e.ETkje(h,6),63),128),t[r++]=e[o(964)](63,h)|128);return e.ucnYk(r,x)}async function Ls(s){let t=n,r={sgDih:function(o,x){return e[D(1467)](o,x)},aolkL:function(o,x){return e[D(401)](o,x)},YOilI:function(o,x){return e[D(1127)](o,x)},FcRgc:function(o,x){return e.kRZim(o,x)},rwNbY:function(o,x){return e[D(968)](o,x)},iOqQb:function(o,x){return o|x},fgyef:function(o,x){return e[D(398)](o,x)}};if(e[t(1578)](e[t(776)],typeof s))if(e.EfaRb!==e[t(1778)]){let o=new Uint8Array(e.ZPNNC(Rs,s));return e[t(1507)](dr,s,o,0),o}else return new _0x246436(NwZfCF.sgDih(NwZfCF[t(952)](_0xd57a76[0]|NwZfCF[t(894)](_0x410282[1],8),NwZfCF[t(1453)](_0x18cde4[2],16)),NwZfCF[t(894)](_0x5f3d15[3],24)),NwZfCF[t(387)](NwZfCF[t(1693)](NwZfCF[t(528)](_0x2a4651[4],NwZfCF[t(1039)](_0x46f832[5],8)),_0x3573c7[6]<<16),_0x39091e[7]<<24),_0x320501);return e[t(1237)](s,ArrayBuffer)?new Uint8Array(s):new Uint8Array(s.buffer,s.byteOffset,s[t(1685)+"th"])}function Va(s){let t=n;try{return e[t(776)]!=typeof s&&(e[t(849)](s,ArrayBuffer)||s[t(400)]&&e[t(1475)](s.buffer,ArrayBuffer))||e[t(644)](t(1561),typeof s)?"":(JSON.parse(s),t(1743)+t(1648))}catch{if(e[t(1162)]!==e[t(1162)]){if(e[t(685)](_0x3ffbf0,_0x450241))return _0x21537f}else return e[t(776)]==typeof s?e[t(1430)]:""}}let $a=(s,t)=>{let r=n;switch(s){case e[r(1465)]:case e[r(589)]:return{[r(651)+s]:1,"x-tt-env":t};default:return{}}};class Xa{constructor(t){let r=n;this[r(811)+"ount"]=t,this[r(694)]=0}[n(1802)](){let t=n;this[t(694)]++}[n(1095)+n(953)+"nt"](){let t=n;return e[t(764)](this[t(694)],this[t(811)+t(429)])}[n(1793)+n(1540)](t=0){let r=n;this[r(811)+r(429)]=t,this[r(694)]=0}}async function Ya(s){let t=n,r={MSIJJ:function(o,x){return o(x)},tqzUd:e.awfyP,XhMKK:function(o,x){return e[D(1226)](o,x)},BSxER:function(o,x){return e[D(1741)](o,x)},sRtBq:e[t(443)],fOzdS:e[t(1680)],qYTLs:function(o,x){return e[t(1022)](o,x)},gUtAp:e[t(1099)],OJFzU:e[t(1495)]};return new Promise(o=>{let x=t,h={OJBgG:function(m,g){return r.XhMKK(m,g)}};if(!ct)return r.MSIJJ(o,x(438)+x(1760));try{if(r[x(1328)](x(1547),r[x(560)])){let m=document.createElement(r[x(420)]);window[x(634)+x(920)]=g=>{let d=x;document[d(1709)][d(829)+d(488)](m),window[d(634)+d(920)]=void 0,r[d(1158)](o,g&&g[d(1472)]||r[d(1161)])},m.type=x(1770)+x(959),m[x(423)]=r[x(1002)](s[x(1042)](/^ws/,r[x(1168)]),x(1708)+x(1737)+"tierJSONP");try{x(1541)!==x(1180)?document[x(1709)][x(1109)+x(488)](m):!this[x(1274)+x(1273)]&&(this[x(987)+x(454)]?.[x(591)+"pointCon"+x(1721)](),this[x(469)+x(696)]?.[x(1793)+x(1540)](),this[x(827)+"osed"]=!1,this._isInit=!0,this[x(1274)]())}catch{if(r[x(995)]===r[x(995)])document[x(1709)][x(829)+"ild"](m);else{let g=_0x1b4a95[_0x272ea9];if(_0x3e5168[_0x11de59][x(1131)]!==4){let d=_0x4c99c2[x(1271)+"g"](0,PnnrNu[x(1666)](4,_0x1bb80f[_0x5d2258][x(1131)])),b=d.concat(g);_0x2855a6=_0x17cd0a[x(741)](b)}else _0x1ac6a9=_0x3289a9[x(741)](g)}}}else _0x7b1f61[x(681)](_0x5d5846)}catch{window[x(634)+x(920)]=void 0,r.MSIJJ(o,r.tqzUd)}})}function je(s,t,r){let o=n;return!!s?.find(x=>x[o(1080)]===t&&x.value===r)}function xt(s,t){let r=n;return s?.[r(1198)](o=>o.key===t)?.[r(752)]}let lr=null;async function Za(){let s=n;return lr||(lr=Promise[s(1129)]()[s(415)](ke[s(1545)](ke,e.xSCnF))),lr}class Qa extends fr{constructor(t,r){let o=n;super(),this._dbName=t,this._keyPath=r,this[o(673)]=void 0,this._initPromise=null}async[n(437)](){let t=n;if(e.oHTnb(e[t(778)],e[t(778)])){let r={paXgR:function(o,x){return QPEWYD.gojmr(o,x)}};return function(...o){let x=t;return _0x5b60bb[x(1222)](r.paXgR(_0xa492a4,this),o),r[x(791)](_0x5ada97,_0x24e799[x(843)](this))}}else await this[t(1748)]()}async[n(1748)](){let t=n,r={SVVhh:function(o,x,h){return o(x,h)}};if(e[t(1537)](e.mVtgo,e.fSzrG)){if(this[t(673)])return;if(this[t(1504)+t(1583)])return this[t(1504)+t(1583)];try{let o=this[t(618)],x=this._keyPath;this._initPromise=(async()=>{let h=t,{openDB:m}=await e[h(1394)](Za);this[h(673)]=await e[h(376)](m,"frontier_"+o,1,{upgrade(g){let d=h;g[d(625)+d(1266)+"e"](o,{keyPath:x})}})})(),await this[t(1504)+t(1583)]}catch(o){console[t(681)](o)}finally{this[t(1504)+t(1583)]=null}}else _0x20edfe(_0x3e5b4f,90),LjQsQN[t(834)](_0x11ec74,_0x5c8db9,_0x1ffceb)}async[n(843)](t){let r=n;try{if(e.yKywI(e[r(1044)],e.lAfvb))return await this[r(1748)](),this._qosDB?.[r(843)](this[r(618)],t);_0x748fa9[r(1709)][r(829)+r(488)](_0x2b4169)}catch(o){console.log(o)}}async[n(1043)](t,r){let o=n;return await this[o(1748)](),this[o(673)]?.[o(1516)](this._dbName,t)}async[n(823)](t){let r=n;try{return await this[r(1748)](),this._qosDB?.[r(518)](this._dbName,t)}catch(o){console.log(o)}}async clear(){let t=n;try{return await this[t(1748)](),this[t(673)]?.[t(1346)](this[t(618)])}catch(r){console[t(681)](r)}}async[n(1425)](){let t=n;return await this[t(1748)](),this[t(673)]?.[t(1555)+"ys"](this[t(618)])}async getAll(){let t=n;return await this[t(1748)](),this._qosDB?.getAll(this[t(618)])}async closeDB(){let t=n;try{this[t(673)]?.[t(1529)](),this[t(673)]=void 0}catch(r){console[t(681)](r)}}get isReady(){let t=n;try{return!!this[t(673)]}catch(r){return console[t(681)](r),!1}}}class e0{constructor(t,r){let o=n;this._DBName=t,this[o(1716)]=r,this[o(673)]=localStorage}async openDB(){}get[n(648)](){return n(634)+"_"+this._DBName}async[n(843)](t){let r=n,o=this[r(673)][r(989)](this[r(648)]);return JSON[r(516)](e[r(662)](o,"{}"))[t]}async[n(1043)](t,r){let o=n,x=this._qosDB[o(989)](this._prefix),h=JSON[o(516)](e[o(1664)](x,"{}"));return h[r||t[this[o(1716)]]]=t,this[o(673)][o(1241)](this._prefix,JSON[o(1342)+"y"](h)),r||t[this[o(1716)]]}async[n(823)](t){let r=n,o=this[r(673)][r(989)](this[r(648)]),x=JSON[r(516)](e[r(1256)](o,"{}"));return x[t]=void 0,this._qosDB[r(1241)](this[r(648)],JSON[r(1342)+"y"](x))}async[n(1346)](){let t=n;if(e[t(1670)](e.nXgUi,e[t(1454)]))return this[t(673)][t(1346)]();{let r=_0x161887[t(1702)+"tabase"](_0x3476cd);return _0x190ff7&&r.addEventListener(QPEWYD[t(1118)],()=>_0x543f4c()),QPEWYD[t(728)](_0x25ec42,r).then(()=>{})}}async[n(1425)](){let t=n,r=this[t(673)][t(989)](this[t(648)]),o=JSON[t(516)](e[t(662)](r,"{}"));return Object.keys(o)}async[n(1137)](){let t=n,r={jldmH:function(o,x){return o<x},Aajkp:function(o,x){return e[D(1758)](o,x)},HFHPO:function(o,x){return e[D(1017)](o,x)},wzjcE:function(o,x){return e.CTGGZ(o,x)},fiEdY:function(o,x){return o>>x},YgoHP:function(o,x){return e[D(911)](o,x)},QoJRt:function(o,x){return e[D(1592)](o,x)}};if(e.vHBGP==="pokNV"){let o=this._qosDB.getItem(this[t(648)]),x=JSON[t(516)](e[t(662)](o,"{}"));return Object[t(593)](x)}else iVJjqz[t(1015)](_0x1530f1,65536)?_0x338235[_0x32278d++]=iVJjqz[t(1597)](iVJjqz[t(1005)](_0x478ae3>>12,15),224):(_0x56eeff[_0x1085f7++]=iVJjqz[t(1310)](iVJjqz[t(1532)](_0x21c83c,18)&7,240),_0x45dda8[_0x3f5f5d++]=iVJjqz[t(845)](iVJjqz[t(1532)](_0x4bd101,12)&63,128)),_0x2802dd[_0x582879++]=iVJjqz[t(1630)](iVJjqz[t(1532)](_0x56d869,6)&63,128)}[n(1079)](){return Promise.resolve()}get[n(1676)](){let t=n;return e[t(485)](e.IlZui,t(1107))?_0x8294c0(_0x412d6.apply(_0x565c13(this),_0x104f7f)):!!this._qosDB}}class t0{constructor(t,r){let o=n;this[o(1018)]=t,this[o(1716)]=r,this._qosDB=Ze?tt:It?wx:null}async openDB(){}get[n(648)](){let t=n;return t(634)+"_"+this[t(1018)]}async[n(843)](t){let r=n,o=this._qosDB[r(1238)+r(1690)](this[r(648)]);return JSON[r(516)](e.QiPTo(o,"{}"))[t]}async[n(1043)](t,r){let o=n,x=this[o(673)][o(1238)+o(1690)](this[o(648)]),h=JSON[o(516)](e[o(512)](x,"{}"));return h[r||t[this._pathKey]]=t,this[o(673)][o(614)+o(1690)](this[o(648)],JSON.stringify(h)),r||t[this[o(1716)]]}async del(t){let r=n,o=this[r(673)]["getStora"+r(1690)](this[r(648)]),x=JSON.parse(e.xDKUh(o,"{}"));return x[t]=void 0,this._qosDB[r(614)+r(1690)](this._prefix,JSON[r(1342)+"y"](x))}async[n(1346)](){let t=n;return this[t(673)][t(1779)+t(799)]()}async[n(1425)](){let t=n,r=this[t(673)]["getStora"+t(946)+"nc"](this[t(648)]),o=JSON[t(516)](r||"{}");return Object[t(1425)](o)}async[n(1137)](){let t=n,r=this[t(673)][t(1238)+t(946)+"nc"](this[t(648)]),o=JSON[t(516)](e[t(512)](r,"{}"));return Object.values(o)}[n(1079)](){return Promise[n(1129)]()}get[n(1676)](){return!!this._qosDB}}function Os(s,t){let r=n;if(e[r(1664)](Ze,Ze))return new t0(s,t);if(e[r(662)](ct,Dt)&&e[r(1611)]!=typeof indexedDB)return new Qa(s,t);if(e[r(1591)](ct,Dt)&&typeof localStorage<"u")return new e0(s,t);throw new Error(e[r(746)])}class n0{constructor(){let t=n;this[t(1070)+t(838)+"Id"]=null,this[t(1070)+"l"]=36e5,this[t(673)]=Os(e[t(1525)],e[t(813)])}async[n(1070)+"lFlush"](){let t=n;e[t(1586)](clearInterval,this[t(1070)+t(838)+"Id"]),this[t(1070)+t(838)+"Id"]=e.gRtqE(setInterval,()=>{this[t(1333)+"ired"]()},this[t(1070)+"l"])}async[n(437)](){let t=n;if(e.AqFyD(t(1746),e[t(835)]))return this._ws?this[t(1120)][t(1265)+"ns"]:"";await this[t(673)][t(437)]()[t(415)](()=>{let r=t;this[r(1070)+r(1668)]()})}async[n(1333)+"ired"](){let t=n;(await this[t(673)]?.[t(1137)]()||[]).filter(({timestamp:x})=>x<Date[t(1549)]())[t(1610)](x=>{let h=t;this[h(673)]?.[h(823)](x[h(1406)+"id"])})}async[n(823)](t){let r=n;return this._qosDB?.[r(823)](t)}async set(t,r){return this[n(673)]?.set({message_id:t,timestamp:r})}async[n(843)](t){let r=n;return this[r(673)]?.[r(843)](t)}async closeDB(){let t=n;e[t(1446)](clearInterval,this[t(1070)+t(838)+"Id"]),await this[t(673)]?.[t(1079)]()}get[n(1676)](){let t=n;return this._qosDB?.[t(1676)]}}function hr(s){let t=n,r=!!this[t(1805)][t(1154)+"S"];if(!r)return{enabled:r,isQoSMessage:!1,isQoSAck:!1,isAckCleanupMessage:!1,ackMsgIds:[]};let o=e[t(1631)](je,s.message[t(1313)],"x_frontier_qos","2"),x=o&&je(s[t(1460)][t(1313)],e[t(1369)],"1"),h=o&&e.musMi(je,s.message[t(1313)],"x_frontier_is_ack","1"),m=h?e.QOnkd(xt,s[t(1460)][t(1313)],t(1287)+t(461)+t(1776))?.[t(542)](",")[t(1745)](Boolean)||[]:[];return{enabled:r,isQoSMessage:o,isQoSAck:x,isAckCleanupMessage:h,ackMsgIds:m}}async function Bs(){let s=n;return this[s(1147)+s(688)]||(this["_QoSMana"+s(688)]=new n0),this["_QoSMana"+s(688)][s(1676)]||await this._QoSManager.openDB(),this[s(1147)+s(688)]}async function r0(s,t){let r=n,{enableAutoAck:o}=this[r(1805)],x=je(s[r(1460)].headers,e[r(744)],"1"),h=e[r(1507)](je,s.message.headers,e[r(783)],"1"),m=hr.call(this,s);if(e.SBBWz(o,x)){let{SeqID:g,LogID:d,service:b,LogIDNew:E,method:v}=s[r(1460)];this._sendAck({SeqID:g,LogID:d,LogIDNew:E,service:b,method:v,headers:[{key:e[r(783)],value:"1"},{key:e.TAIxb,value:e[r(1664)](E,"")},{key:e[r(938)],value:"0"}]})}h&&!m.isQoSAck&&this[r(1028)+r(1742)+"ageEvent"](s),e[r(1553)](t)}async function s0(s,t){let r=n;this[r(729)](e.SmuKx,s[r(1460)]),e.jibGN(t)}async function i0(s,t){let r=n,o=e[r(375)](ms,await e[r(1490)](Ls,s[r(1347)]));try{if(o[r(687)]instanceof Uint8Array){let x=e.PCvVp(this[r(1805)][r(619)+r(922)],Object)?{force:!!this[r(1805)][r(619)+"ncoding"].force,encoding:this[r(1805)][r(619)+"ncoding"][r(561)]?this._options[r(619)+"ncoding"][r(561)][r(1042)](/\s/g,"")[r(1669)+r(640)]():""}:{force:!1,encoding:this[r(1805)][r(619)+r(922)]?this[r(1805)][r(619)+"ncoding"][r(1042)](/\s/g,"")[r(1669)+r(640)]():""},h=o[r(619)+r(922)]?o["payloadE"+r(922)].replace(/\s/g,"")["toLowerC"+r(640)]():"",m=e[r(559)](this[r(1805)]["payloadT"+r(972)],Object)?{force:!!this._options[r(1004)+"ype"][r(590)],type:this._options[r(1004)+r(972)][r(1432)]?this._options["payloadT"+r(972)][r(1432)][r(1042)](/\s/g,"")[r(1669)+"ase"]():""}:{force:!1,type:this[r(1805)].payloadType?this[r(1805)][r(1004)+"ype"].replace(/\s/g,"")[r(1669)+r(640)]():""},g=o[r(1004)+"ype"]?o[r(1004)+r(972)][r(1042)](/\s/g,"")[r(1669)+"ase"]():"",d=m.force?m[r(1432)]:g||m[r(1432)],b=x.force?x[r(561)]:h||x[r(561)],E=[e[r(1430)],e[r(1671)],e[r(1307)],e[r(776)]],v=[e[r(1661)],e[r(1027)]];this[r(1805)]["enableTr"+r(431)+r(1268)+"ad"]&&E[r(1062)](d)&&(!b||v[r(1062)](b))?o["textPayl"+r(683)]=e.Hqimn(Ns,o[r(687)],0,o[r(687)][r(1685)+"th"]):o["textPayl"+r(683)]=""}else o[r(1415)+"oad"]=""}catch(x){o["textPayl"+r(683)]="",console[r(681)](x)}s[r(1460)]=o,e[r(1323)](t)}function o0(s,t,r){let o=n;if(e[o(1041)](e[o(1615)],e.lpqVo))this["_message"+o(675)][o(1381)](_0x4c40a8),this._debug("enqueue",_0x86ef47);else{let x=r||8192,h=e[o(1153)](x,1),m=null,g=x;return function(d){let b=o;if(e[b(392)](d,1)||e[b(1565)](d,h))return e[b(1573)](s,d);e[b(1053)](e.pNgNP(g,d),x)&&(m=s(x),g=0);let E=t[b(491)](m,g,g+=d);return e.acxuC(7,g)&&(g=e[b(737)](e[b(1464)](7,g),1)),E}}}let a0=4294967295;function c0(s,t,r){let o=n;return RangeError(e[o(936)](e[o(1567)](e[o(1594)](e[o(893)](e[o(1679)](o(1414)+o(605)+o(1629),s),o(1057)),t||1),e.YteMY),r))}function x0(s,t,r){let o=n;if(r>a0)throw new Error(o(1753)+o(1653)+"e");let x=3;for(;e.iCKpg(x,0);){let h=e[o(931)](255,r);e[o(376)](pr,h,s,e[o(772)](t,x)),r>>>=8,x--}return e[o(382)](t,4)}function u0(s,t){let r=n,o=0,x=t,h=e.cotqg(t,4);for(;x<h;){let{value:m,offset:g}=e[r(383)](gr,s,x);x=g,o=e[r(1483)](o<<8,0),o+=m}return{value:o,offset:h}}function f0(s,t,r){let o=n,x=e[o(1658)][o(542)]("|"),h=0;for(;;){switch(x[h++]){case"0":if(t[o(1203)+"e"])return e.evpGf(t[o(1203)+"e"](s,r),r);continue;case"1":if(t[o(470)])return e[o(1349)](t[o(470)](s,r),r);continue;case"2":if(s[o(1131)]<40)return dr(s,t,r)+r;continue;case"3":return e[o(842)](dr(s,t,r),r);case"4":if(!s)return r;continue}break}}function d0(s,t){let r=n,o=new q(e[r(1245)](e[r(1503)](s[t+4]<<24|e[r(1010)](s[e[r(1276)](t,5)],16),s[t+6]<<8),s[e[r(1567)](t,7)]),e[r(1412)](e[r(1289)](s[e[r(1217)](t,0)]<<24,e[r(1127)](s[e[r(382)](t,1)],16)),e[r(1010)](s[e[r(1316)](t,2)],8))|s[e[r(1059)](t,3)],!0);return t+=8,{value:o,offset:e[r(1719)](t,8)}}function l0(s,t,r){let o=n;if(e[o(1006)](e[o(940)],e.krehw)){let x=s[o(1299)],h=s[o(1069)];return t[r]=h>>>24,t[e[o(568)](r,1)]=e[o(1164)](h,16)&255,t[r+2]=e.oOkaS(e[o(668)](h,8),255),t[r+3]=e.wdqCu(255,h),t[e[o(893)](r,4)]=e[o(1772)](x,24),t[r+5]=e[o(705)](e[o(1100)](x,16),255),t[e[o(755)](r,6)]=e[o(1219)](x>>>8,255),t[e[o(1013)](r,7)]=e[o(548)](255,x),r+=8,r}else{if(e[o(1067)](void 0,_0x6a6b95))this[o(1191)+"rs"]={};else if(e[o(1515)](void 0,_0x5df6c8))this[o(1191)+"rs"][_0x281858]=null;else{let x=this[o(1191)+"rs"][_0x4912b5];if(x)for(let h=0;e[o(859)](h,x.length);)x[h].fn===_0x553e6a?x[o(660)](h,1):++h}return this}}function gr(s,t){let r=n;return s[r(1438)+"8"]?{value:s[r(1438)+"8"](t),offset:t+1}:{value:255&s[t],offset:t+1}}function pr(s,t,r){let o=n;return t.writeUint8?t[o(1498)+"t8"](s,r):t[r]=e.acxuC(255,s),e[o(1594)](r,1)}let h0=function(s){return new Uint8Array(s)},g0=e[n(851)](e[n(1611)],typeof Buffer)?Buffer["allocUns"+n(552)]:e.PpUlh(o0,h0,Uint8Array[n(408)+"e"].subarray),p0=16,mr=32;function m0(s){let t=n,r={fCieM:function(h,m,g){return e[D(418)](h,m,g)}},o=0,x={};for(let h=0;e.RPONd(h,s[t(1131)]);h++)e[t(812)](e.RrDSO,e[t(497)])?(_0x56569a(_0xcffd1d,58),oJkMVw[t(1134)](_0x12cf0f,_0x563c92,_0xf79f39)):(x[s[h].cursor_name]=e[t(1424)](Rs,s[h][t(1796)+"ame"]),o+=e[t(1155)](14,x[s[h][t(1796)+t(1112)]]));return[o,x]}function Ms(s,t,r){let o=n,[x,h]=m0(s),m=e[o(1601)](g0,x),g=0;return s[o(1610)](d=>{let b=o,E=e[b(602)][b(542)]("|"),v=0;for(;;){switch(E[v++]){case"0":g=e[b(1507)](l0,q[b(1584)+"er"](d.cursor||t),m,g);continue;case"1":console[b(681)](e[b(1115)],g);continue;case"2":console[b(681)](e[b(714)],g);continue;case"3":g=e[b(969)](x0,m,g,d.service||0);continue;case"4":console[b(681)](b(1364)+b(1738),d,d[b(974)]);continue;case"5":g=e[b(1507)](pr,0,m,g);continue;case"6":g=e[b(1433)](pr,h[d[b(1796)+"ame"]],m,g);continue;case"7":g=e.bxZlL(f0,d["cursor_n"+b(1112)],m,g);continue;case"8":console[b(681)](e[b(1482)],g);continue;case"9":console[b(681)](b(1749)+"name",g);continue;case"10":console[b(681)](e[b(1803)],g);continue}break}}),{frameType:mr,headers:[{key:e[o(1332)],value:r}],payload:m}}function w0(s){let t=n,r={oORyg:function(h){return e[D(1506)](h)}},o=0,x=[];for(;e[t(392)](o,s[t(1685)+"th"]);){if(e[t(785)](e.Gwtep,e[t(1785)]))return this[t(1028)+t(601)+"Event"](_0x3af727),r[t(1698)](_0x5ded72);{let{offset:h}=e[t(413)](gr,s,o);o=h;let m={cursor_name:"",cursor:0,service:0},{value:g,offset:d}=e.oagiL(u0,s,o);m.service=g,o=d;let{value:b,offset:E}=e[t(1032)](gr,s,o);o=E,m[t(1796)+"ame"]=Ns(s,o,e.ttGHA(o,b)),o+=b;let{value:v,offset:L}=e[t(413)](d0,s,o);m.cursor=v[t(1270)](),o=L,x.push(m)}}return x}function _0(){let s=n;if(e[s(695)](s(1283),e[s(1040)]))return{frameType:mr,headers:[{key:e.EePWc,value:e.qokVf}],payload:void 0};_0x5aaabb&&_0x5d7691[s(1257)+s(1682)](s(1529),()=>_0x37ed8a()),_0x51d1e2&&_0x142e10[s(1257)+s(1682)]("versionc"+s(1759),()=>_0x48c4f0())}class y0{constructor(t,r,o){let x=n;this[x(1646)+x(503)]=t,this["_cursorF"+x(706)]=r,this[x(1520)+x(1234)]=o,this[x(673)]=e[x(1533)](Os,this[x(1646)+"ameSpace"],e[x(748)])}async openDB(){let t=n;await this[t(673)][t(437)]()}async getCursors(){let t=n;if(!this._qosDB[t(1676)])return;let r=this[t(1520)+t(1234)],o=await this._qosDB[t(1137)]();switch(console[t(681)](e[t(1766)],o),r){case e[t(1063)]:return o&&o[t(1131)]?Ms(o,0,this[t(821)+"ileName"]):void 0;case e.EiZZY:return;case e[t(1297)]:return o&&o[t(1131)]?e[t(765)](Ms,o,0,this[t(821)+t(706)]):e.knYzb(_0)}}async[n(1043)](t,r,o){let x=n,h={qSliW:e[x(380)]};return e[x(1441)](e[x(1616)],e.HScbu)?(console[x(681)](e[x(726)],t,r,o),this[x(673)][x(1043)]({cursor_name:t,cursor:r,service:o})):(_0x469e92||(_0x187363=_0x3a10f1[x(1129)]()[x(415)](_0x67ec99[x(1545)](_0x2bbc8a,CjHJXY[x(1264)]))),_0x354d71)}async[n(567)+"rs"](t){let r=n,o=e[r(1563)](w0,t);for(let x of o)console[r(681)](e[r(1511)],o),await this[r(673)][r(1043)](x)}async[n(843)](t){let r=n;return(await this[r(673)].get(t))?.[r(948)]}async[n(1079)](){let t=n;await this[t(673)][t(1079)]()}["updateCu"+n(411)+"Name"](t){let r=n,o={jWORc:function(x,h,m){return x(h,m)}};e.NIufC!==r(1092)?this["_cursorF"+r(706)]=t:(this[r(1646)+r(503)]=_0xea7c30,this[r(821)+"ileName"]=_0x47347a,this[r(1520)+r(1234)]=_0x334f79,this[r(673)]=Oayxek[r(808)](_0x543121,this["_cursorN"+r(503)],r(1796)+r(1112)))}get[n(1676)](){let t=n;return this._qosDB[t(1676)]}}let b0=e.Bakeo;async function zs(s){let t=n,r={OMRrp:function(g){return g()}};if(!this[t(1805)][t(1154)+"S"])return null;let{aID:o,fpID:x,messageStrategy:h}=this[t(1805)],m=e[t(790)](s,b0);try{if(e[t(1035)](e.aLuog,e.XHGrG))return this[t(1190)+t(836)]?s&&this[t(1190)+t(836)][t(1613)+"rsorFile"+t(1559)](s):this["_cursorM"+t(836)]=new y0(x+"_"+o+"_"+m,m,h),this[t(1190)+t(836)][t(1676)]||await this[t(1190)+t(836)][t(437)](),this["_cursorM"+t(836)];{let g={cCJUb:t(421),vlMxt:QPEWYD.ttjiP,NyByf:function(v,L){let N=t;return QPEWYD[N(1436)](v,L)},ryNoo:QPEWYD[t(770)],ZtAqt:function(v){let L=t;return QPEWYD[L(1036)](v)}},d=()=>{let v=t;_0x370488[v(611)+v(1121)+v(647)](v(626),b),_0xa33c39[v(611)+"entListe"+v(647)](g[v(1025)],E),_0x19e2bb["removeEv"+v(1121)+v(647)](g[v(1344)],E)},b=()=>{let v=t;HSNPaD[v(1068)](_0x5784ad),HSNPaD.OMRrp(d)},E=()=>{let v=t;g.NyByf(_0x1b9d9a,_0x263838[v(421)]||new _0x3eebdb(g[v(750)],g[v(750)])),g[v(1692)](d)};_0x1e5c05[t(1257)+t(1682)](QPEWYD[t(547)],b),_0x3636b1[t(1257)+t(1682)](QPEWYD.EshMr,E),_0x260eb7.addEventListener(t(1783),E)}}catch{return null}}async function v0(s,t){let r=n,o=e[r(1094)](je,s[r(1460)][r(1313)],e[r(1697)],"-1"),x=e.ElhgN(je,s[r(1460)][r(1313)],e[r(783)],"1"),h=e[r(932)](xt,s[r(1460)].headers,e[r(655)]),m=e[r(1175)](Number,e.vjRee(xt,s[r(1460)].headers,e[r(1447)]))||0,g=hr[r(491)](this,s),d=je(s[r(1460)].headers,"x-msg-qos","2"),b=e[r(413)](xt,s[r(1460)].headers,r(1566)+r(1214)+"e"),E=Number(e.VDRle(xt,s[r(1460)][r(1313)],e[r(1007)]));if(g[r(386)])return e.IyIdp(t);let v=g[r(506)+r(563)]?await Bs[r(491)](this):null;if(e[r(692)](s[r(1460)].service,0)&&x&&!o||e.blTTI(s[r(1460)][r(974)],0)){if(h&&g[r(506)+"sage"]&&v)return!!!await v[r(843)](h)&&(this[r(1028)+r(601)+r(712)](s),await v[r(1043)](h,e[r(1752)](Date.now(),m))),t();if(d){let L=await zs.call(this);if(!L){if(e[r(1434)](e[r(848)],e[r(848)]))return this[r(1028)+r(601)+"Event"](s),t();this[r(440)+"s"]=_0x2399b9,this[r(1211)+"es"]=_0x573690,this[r(1442)+r(1304)]=0,this[r(871)+r(1628)+r(1389)+"t"]=0}let N=await L[r(843)](b)??-1;if(N<E)this["_dispatc"+r(601)+r(712)](s),L[r(1043)](b,E,s[r(1460)][r(974)]);else throw new Error(r(381)+r(653)+r(1560)+E+(" larger than loc"+r(596)+"r ")+N);return t()}return this[r(1028)+r(601)+r(712)](s),e.FwqtL(t)}}async function S0(s,t){let r=n;if(e.XQWqN(e.EPNoV,e.COAwM)){let o=hr[r(491)](this,s);if(!o[r(506)+"sage"])return e.PfXqL(t);let x=await Bs[r(491)](this);if(o.isAckCleanupMessage&&o[r(1637)+"s"][r(1131)])for(let h of o[r(1637)+"s"])await x.del(h);e.SIksO(t)}else{let o=this[r(987)+r(454)]?.[r(1471)+r(1124)+"nt"](),x=this._options[r(1337)+"tInterce"+r(1228)](_0x400af4.code,_0x4051dc[r(1760)]);this[r(1028)+"hCloseEv"+r(604)](e[r(1032)](_0x5129d5,"close",{code:1006,reason:_0x35dc5e[r(1760)]||r(1761)+r(1255)+r(578)+r(543)+"n, hostn"+r(1491)+o,willReconnect:x})),x&&this[r(1274)]();return}}async function E0(s,t){let r=n,o=e[r(508)](s[r(1460)][r(1054)+"e"],p0),x=e.YCBwT(s[r(1460)][r(1054)+"e"],mr);if(e[r(628)](!o,!x))return e[r(1512)](t);let h=e[r(551)](xt,s[r(1460)][r(1313)],"cursor_f"+r(1024));if(!h)return t();let m=await zs[r(491)](this,h);if(!m)return t();if(o){let g=await m[r(1318)+"rs"](),d={frameType:g?.[r(1054)+"e"],SeqID:q[r(1584)+"er"](this[r(1734)]++),LogID:q[r(1584)+"er"](this[r(1805)]["logIDGen"+r(623)]()),service:9e3,method:5,headers:g?.headers,payload:g?.[r(687)]},b=e[r(797)](C,d);this[r(1120)]&&this[r(1120)][r(1625)+"te"]&&this._ws.send(b)}if(x){let g=s[r(1460)][r(687)];g&&m[r(567)+"rs"](g)}}let C0=async function(s,t){let r=n;if(e[r(928)]===e.xnIYN)this[r(1173)]=!1,e[r(797)](clearTimeout,this[r(1274)+"ionTimeo"+r(773)]),t();else{let o=this[r(673)][r(989)](this._prefix),x=_0x9814c2.parse(o||"{}");return _0x37cf19[r(593)](x)}},A0=async function(s,t){let r=n;if(!this._ws||e[r(1409)](this._ws[r(1625)+"te"],this[r(1074)]))return e[r(1789)](t);let{pingInterval:o}=this._options;this[r(987)+r(454)]?.[r(591)+r(550)+r(1721)]();for(let h=0;e[r(595)](h,this[r(1520)+"Queue"][r(1131)]);h++){let m=this[r(1520)+r(675)][h];if(e.exglI(this[r(1120)][r(1625)+"te"],this[r(1074)])&&e.Szstw(null,m))this[r(1120)]&&this[r(1120)][r(1639)](m),this["_message"+r(675)][h]=null;else break}this[r(1520)+r(675)]=this[r(1520)+r(675)][r(1745)](h=>!!h),this[r(921)+r(1634)+"Id"]=e[r(1378)](setTimeout,()=>this[r(1102)](),o),this._dispatchOpenEvent(s),this._isBrowser&&this[r(1120)]&&(this[r(1120)][r(897)+"pe"]=this["_binaryT"+r(972)]);let x=this[r(987)+r(454)]?.[r(1471)+r(1124)+"nt"]();this[r(729)](r(474)+x+" success"),t()},k0=async function(s,t){let r=n;if(e[r(507)]("dpYSp",r(1522))){let o=this[r(987)+r(454)]?.[r(1471)+r(1124)+"nt"]();this[r(729)]("open "+o),t()}else{if(this[r(1805)][r(1135)+r(1799)+r(850)]||this[r(827)+r(1489)])return;this._handleReconnect()}};class P0 extends fr{constructor(t){let r=n,o={iUBbK:r(1208),mIqFf:function(g,d){return g===d},hYsXW:function(g,d){return e[r(425)](g,d)},AEVOf:e.xzHGS,uKNLh:e[r(439)],FiHUU:e[r(896)],yusop:function(g,d){return e[r(1765)](g,d)},emZLk:function(g,d,b,E){return g(d,b,E)},tnnqB:function(g,d,b){return e[r(820)](g,d,b)},CLTXH:r(421)};super(),this[r(1633)+"igatorOn"+r(1014)]=!0,this._isBrowser=ct,this[r(1103)]=ja,this[r(1797)+"T"]=Ze,this[r(1731)+"X"]=It,this[r(1345)+"r"]=Dt,this[r(1520)+r(675)]=[],this[r(987)+r(454)]=null,this[r(827)+r(1489)]=!1,this[r(1280)+r(972)]=e[r(378)],this[r(1274)+"Lock"]=!1,this[r(1274)+"ionTimeoutId"]=null,this[r(1223)+r(1315)+r(1598)]=null,this[r(921)+r(1634)+"Id"]=null,this._seqId=0,this[r(1173)]=!1,this[r(525)]="",this["_QoSMana"+r(688)]=null,this._cursorManager=null,this["_pingLos"+r(696)]=null,this[r(1227)+"ls"]=r(908),this[r(733)]=3,this.CONNECTING=0,this[r(1074)]=1,this[r(693)]=2,this[r(1626)]=g=>{let d=r;try{if(e[d(422)](e[d(1469)],e.ynXvX))Ts(this,g,[C0,A0,k0]);else return this._socket[d(1625)+"te"]}catch(b){let E=e[d(545)](de,d(421),{message:b[d(1460)],code:Ge[d(889)+"OR"],error:b});this["_dispatc"+d(674)+"ent"](E)}},this[r(1443)+"ge"]=async g=>{let d=r;if(o[d(1029)]===o.iUBbK){let{pingInterval:b,pingFrequency:E}=this[d(1805)];if((o[d(1321)]("hi",g[d(1347)])&&o.hYsXW(o[d(1393)],E)||o[d(1481)](o.uKNLh,E))&&(this[d(553)+d(1524)](),this[d(863)](o[d(672)],d(1020)),this[d(921)+d(1634)+"Id"]=setTimeout(this[d(1102)][d(1545)](this),b)),o[d(517)]("hi",g.data))return;try{o[d(1757)](Ts,this,g,[i0,r0,S0,E0,v0,s0])}catch(v){let L=o.tnnqB(de,o[d(800)],{message:v.message,code:Ge["MESSAGE_"+d(1319)],error:v});this[d(1028)+d(674)+d(604)](L)}}else{let b=this[d(673)][d(1238)+d(1690)](this._prefix);return _0x5d7817[d(516)](b||"{}")[_0x10cddf]}},this[r(630)]=g=>{let d=r,b=this._endpointManager?.[d(1095)+d(1188)+"es"](),E=this[d(987)+d(454)]?.["getCurre"+d(1124)+"nt"]();if(b&&!g.message){let v=d(689)+E+(d(1111)+"ax retri"+d(1485)+"ed");this._dispatchErrorEvent(e[d(1659)](de,d(421),{message:v,code:Ge[d(419)+d(862)+"R"],error:g}));return}this[d(1120)]&&this[d(1120)][d(1625)+"te"]===this.OPEN&&this["_disconn"+d(900)](),this[d(1028)+d(674)+"ent"](de(d(421),{message:g[d(1460)],code:Ge["NATIVE_E"+d(1156)],error:g}))},this[r(1784)]=async g=>{let d=r;this._clearTimer(),this[d(553)+d(1524)](),this["_removeW"+d(945)+"rs"](),this[d(1120)]=null,this["_connect"+d(1273)]=!1;let b=this[d(987)+d(454)]?.[d(1095)+d(1188)+"es"]();if(!b&&this[d(861)+d(664)]()&&!this[d(827)+d(1489)]){let E=this[d(987)+"tManager"]?.[d(1471)+d(1124)+"nt"](),v=this._options[d(1337)+"tInterce"+d(1228)](g[d(1330)],g[d(1760)]);this[d(1028)+d(579)+d(604)](pe(e[d(719)],{code:1006,reason:g[d(1760)]||"connecti"+d(1255)+d(578)+d(543)+d(775)+d(1491)+E,willReconnect:v})),v&&this._connect();return}if(e.PwJOT(1e3,g[d(1330)])&&this[d(827)+d(1489)]){this[d(1028)+"hCloseEv"+d(604)](pe(d(1529),{code:1e3,reason:e[d(586)]})),this[d(987)+d(454)]?.[d(591)+d(550)+d(1721)](),this[d(469)+d(696)]?.["resetCou"+d(1540)]();return}if(e[d(540)](1e3,g[d(1330)])&&b)if(e[d(446)](e[d(815)],e.TsCag)){let E=this["_endpoin"+d(454)]?.[d(1471)+d(1124)+"nt"](),v=g.reason;v||(v=await e.ozaqm(Ya,this[d(525)])),v="connecti"+d(1255)+d(1791)+v+(d(702)+d(882))+E+(", max retries re"+d(913)),this[d(1028)+d(579)+"ent"](e[d(383)](pe,d(1529),{code:g.code,reason:v}));let L="connect "+E+(" fail, m"+d(557)+"es reached");this[d(1028)+d(674)+d(604)](e[d(383)](de,"error",{message:L,code:Ge[d(419)+"IES_ERROR"]})),this[d(987)+"tManager"]?.[d(591)+d(550)+d(1721)](),this[d(469)+d(696)]?.[d(1793)+"nter"]();return}else return _0x68cc76&&_0x1dc3f0[d(1574)]===!0;if(e[d(1642)](1e3,g[d(1330)])&&!g[d(1760)])if(d(739)!==d(739))this[d(863)](d(1460),_0x500c1e),this[d(1314)+"e"]&&this[d(1314)+"e"](_0x17a44b);else{let E=this["_endpoin"+d(454)]?.getCurrentEndpoint();this[d(1028)+"hCloseEvent"](pe(e[d(719)],{code:g.code,reason:d(1761)+d(1255)+"d, unkno"+d(543)+d(775)+"ame: "+E})),this._endpointManager?.[d(591)+d(550)+d(1721)](),this[d(469)+d(696)]?.[d(1793)+d(1540)]();return}this[d(1028)+d(579)+d(604)](g),this[d(987)+"tManager"]?.[d(591)+d(550)+d(1721)](),this[d(469)+"sCounter"]?.["resetCou"+d(1540)]()},this[r(1684)]=null,this[r(905)]=null,this[r(1314)+"e"]=null,this[r(1390)]=null,this[r(1254)+r(453)]=null,this["onReceiv"+r(713)]=null,this["onStopIm"+r(645)+"yReconnect"]=null,this._handleOnLine=this[r(971)+r(1149)][r(1545)](this),this[r(971)+r(839)]=this[r(971)+r(839)][r(1545)](this),this["_handleP"+r(856)]=this["_handleP"+r(856)][r(1545)](this),this[r(876)+r(650)]=this[r(876)+r(650)][r(1545)](this),this[r(1805)]={url:"",automaticOpen:!0,initReconnectInterval:1e3,maxReconnectInterval:1e4,reconnectIntervalGrowFactor:2,timeoutInterval:5e3,maxRetries:5,debug:!1,maxMessageQueueLength:e[r(1717)](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[r(439)],pingLossCount:2,enableTransformTextPayload:!1,logIDNewConfig:{enableAutoGenerateLogIDNew:!1,userIp:""},miniProgramParams:{customHttpHeader:{}},enableAutoAck:!1,reconnectInterceptor:()=>!0,enableQoS:!1,QoSLevel:2,messageStrategy:e[r(1297)],env:{xTTEnv:"",xUseEnv:""},listenNetworkChanged:!0};let{url:x,ws:h}=t,m=Array[r(1762)](x)?x:r(1561)==typeof x?[x]:[];if(!m||e.arXFZ(0,m[r(1131)]))throw new Error("please provide v"+r(643));if(!e[r(1366)](Ja,h))throw new Error(e[r(1496)]);Object[r(412)](this[r(1805)],t),this._endpointManager=new Ds(m,this[r(1805)][r(1211)+"es"]),this[r(469)+"sCounter"]=new Xa(this[r(1805)][r(1580)+r(1572)]),this[r(1805)].automaticOpen&&(this[r(1173)]=!0,this[r(1274)]()),this[r(1805)][r(759)+r(1058)+r(428)]&&(this[r(1797)+"T"]||this[r(1731)+"X"]?this[r(1463)+r(407)+r(716)]():this[r(526)+"er"]&&this[r(1554)+r(1435)+r(1682)]())}["_handleO"+n(1149)](){let t=n;this[t(1805)]["disableA"+t(1799)+t(850)]||this[t(827)+t(1489)]||this["_handleR"+t(453)]()}[n(971)+n(839)](){let t=n;this[t(1619)+"WebSocket"]();let r=e[t(413)](ur,e[t(1302)],{message:e.kNZqj});this["onStopIm"+t(645)+t(450)+"ct"]&&this[t(1380)+"mediatel"+t(450)+"ct"](r)}[n(1554)+n(1435)+"Listener"](){let t=n;this[t(526)+"er"]&&window.addEventListener(e[t(1478)],this._handleOnLine),this[t(526)+"er"]&&window["addEvent"+t(1682)](e[t(700)],this["_handleO"+t(839)]),this[t(526)+"er"]&&window[t(1257)+t(1682)](e[t(1651)],this[t(876)+t(856)]),this[t(526)+"er"]&&window["addEvent"+t(1682)](e[t(1072)],this[t(876)+t(650)])}[n(1196)+n(1435)+n(1682)](){let t=n,r={khNBC:function(o,x){return o(x)},mtKtK:function(o,x){return e[D(723)](o,x)},HgwsE:function(o,x){return e[D(931)](o,x)}};e.exglI(e[t(1564)],e[t(1564)])?(this[t(526)+"er"]&&window[t(611)+t(1121)+"ner"](e[t(1478)],this[t(971)+t(1149)]),this[t(526)+"er"]&&window[t(611)+t(1121)+t(647)](t(670),this[t(971)+t(839)]),this[t(526)+"er"]&&window["removeEventListe"+t(647)](e.Jjlrg,this[t(876)+t(856)]),this[t(526)+"er"]&&window[t(611)+t(1121)+"ner"](e.JpdnM,this[t(876)+t(650)])):(_0x4341b2=PLUYxt[t(1486)](_0x191811,_0x4deff9),_0x4f0a03|=PLUYxt[t(523)](PLUYxt.HgwsE(127,_0x1b08ef),7))}[n(876)+n(856)](t){let r=n;!t[r(1722)+"d"]&&(this[r(526)+"er"]&&window[r(611)+r(1121)+r(647)]("pagehide",this[r(876)+"ageHide"]),this[r(526)+"er"]&&window["removeEv"+r(1121)+r(647)](e[r(1072)],this[r(876)+r(650)]),this[r(1529)]()),this[r(526)+"er"]&&window["removeEv"+r(1121)+r(647)](e.TkPFi,this["_handleO"+r(1149)]),this[r(526)+"er"]&&window[r(611)+"entListe"+r(647)](e[r(700)],this[r(971)+"ffLine"])}[n(876)+n(650)](t){let r=n;t.persisted&&(this[r(861)+r(664)]()&&(!this._ws||this[r(1120)][r(1625)+"te"]!==this[r(1074)]||e[r(1701)](this[r(1120)][r(1625)+"te"],this[r(1542)+"NG"]))&&this[r(971)+r(1149)](),this[r(526)+"er"]&&window[r(1257)+"Listener"](e.TkPFi,this[r(971)+"nLine"]),this[r(526)+"er"]&&window[r(1257)+r(1682)](r(670),this["_handleO"+r(839)]))}async[n(997)+"eUrl"](t){let r=n,o={mtVUF:function(Re,Ne,Us){return Re(Ne,Us)},lBJZH:function(Re,Ne){return e[D(405)](Re,Ne)}},{fpID:x,deviceID:h,bddID:m,ttwID:g,accessKey:d,aID:b,customParams:E={},enableAutoAck:v,enableQoS:L,QoSLevel:N,env:z}=this[r(1805)],me,j,wr;if(this[r(526)+"er"]||this[r(1731)+"X"]||this[r(1797)+"T"])if(e[r(532)](e[r(652)],e[r(414)])){let{value:Re,offset:Ne}=xADmOt[r(1603)](_0x56cfa9,_0xe9ef8c,_0x38cb2b);_0x11d94f=Ne,_0x44de01=xADmOt.lBJZH(_0x40505a<<8,0),_0x33375a+=Re}else me=location&&e[r(1205)](e[r(844)],location.protocol)?e[r(1033)]:e[r(1298)],j=t[r(1042)](/((^ws)|(^http))((?:[s]*:\/\/))/,""),wr=/^wss(.*:\/\/)/.test(t)?t:""+me+j;else me=e[r(1033)],j=t.replace(/(^http)((?:[s]*:\/\/))/,""),wr=/(^ws)((?:[s]*:\/\/))/[r(541)](j)?j:""+me+j;let qs=m?e[r(1201)]:g?r(1419):"device_id",Fs=m||g||h;if(e[r(1379)](!Fs,!qs))throw new Error(e.iRRId);let I0=e[r(881)](e[r(612)],typeof E)?await E():E,D0=z?e.zvJSL($a,z[r(980)],z[r(1374)]):{},_r=Object[r(412)]({device_platform:e[r(866)],version_code:"fws_1.0.0",access_key:d,fpid:x,aid:b,[qs]:Fs,xsack:v?1:0,xaack:v?1:0,xsqos:L?1:0,qos_level:L?N:void 0,qos_sdk_version:2,...D0},I0),T0=Object[r(1425)](_r)[r(1385)]((Re,Ne)=>_r[Ne]!==void 0?""+Re+(Re?"&":"?")+Ne+"="+_r[Ne]:Re,"");return wr+r(1500)+T0}async[n(1274)](){let t=n,r={wkwOm:function(o,x,h){return e[D(1306)](o,x,h)},REuml:e[t(1302)],KlOLD:e.kNZqj};if(e[t(718)](t(1233),e[t(637)]))return this[t(673)]["clearSto"+t(799)]();if(this[t(1274)+"Lock"]||this._readyClosed)return;this[t(1274)+t(1273)]=!0;try{let o=this[t(987)+t(454)]?.[t(810)+t(970)+t(1320)+t(1213)+"tries"](),{timeoutInterval:x}=this[t(1805)];if(o)if(t(1621)!==e.cOhbm){this[t(1619)+t(384)+"t"]();let m=kcflcC[t(1675)](_0x19e441,kcflcC[t(711)],{message:kcflcC[t(1647)]});this[t(1380)+t(645)+t(450)+"ct"]&&this["onStopIm"+t(645)+t(450)+"ct"](m)}else{let m=this[t(987)+t(454)]?.[t(1471)+t(1124)+"nt"](),g=this["_endpoin"+t(454)]?.[t(680)+t(720)+t(1090)+t(1098)+t(409)](),d=this[t(987)+t(454)]?.[t(1471)+t(1124)+t(1232)+t(429)]();if(g){let b=t(689)+m+(t(1300)+t(472)+t(1645)+"ached, w"+t(1429)+t(632)+t(788))+g+(t(1105)+"y"),E=e.faesx(de,"error",{message:b,code:Ge[t(419)+t(862)+"R"]});this._debug(b),this[t(1028)+t(674)+t(604)](E),this[t(525)]=await this[t(997)+t(1260)](g),this[t(729)](t(689)+g+" "+d+t(1367)),this[t(609)+t(945)+"rs"]()}else{let b=t(689)+m+(t(1300)+t(472)+t(1645)+t(913));this[t(729)](b),this[t(1028)+t(674)+t(604)](e[t(724)](de,e[t(598)],{message:b,code:Ge["MAX_RETR"+t(862)+"R"]}));return}}else{let m=this[t(987)+t(454)]?.[t(1471)+t(1124)+t(1187)+t(910)](),g=this[t(987)+t(454)]?.[t(1471)+t(1124)+"ntTriesC"+t(429)]();this[t(525)]=await this[t(997)+"eUrl"](e[t(1724)](m,"")),this._debug("connect "+m+" "+g+t(1367)),this["_removeW"+t(945)+"rs"]()}if(this._isInit)this[t(1173)]=!1;else{let m=e[t(932)](ur,t(1337)+"t",{message:e[t(393)]});this["onStartR"+t(453)]&&this.onStartReconnect(m)}let h=this["_endpoin"+t(454)]?.[t(1471)+"ntEndpoi"+t(1232)+t(429)]()||0;e[t(1711)](h,1)&&await this[t(1667)](e[t(1335)](h,1)),this[t(729)]("connecti"+t(1097)+this[t(525)]+(t(1596)+t(816))+this[t(1227)+"ls"]),this._ws=e[t(1707)](Wa,{url:this[t(525)],protocols:[this._protocols],headers:this[t(1805)][t(774)+t(1361)+"s"]["customHt"+t(883)]},this[t(1805)].ws),(this[t(526)+"er"]||this[t(1345)+"r"])&&this[t(1120)]&&(this[t(1120)][t(897)+"pe"]=this[t(1280)+"ype"]),this[t(1790)+t(1066)](),this[t(1274)+t(1174)+t(773)]=e.xOzPb(setTimeout,this[t(1305)+"ut"][t(1545)](this),x)}catch(o){throw this[t(1274)+t(1273)]=!1,o}}[n(1189)+n(1357)](){let t=n,r={uwIzV:function(o,x){return e[D(1768)](o,x)},rIGVt:function(o,x){return e[D(884)](o,x)}};if(e[t(1798)]===e[t(1798)])clearTimeout(this["_connect"+t(1174)+t(773)]),this[t(1274)+t(1174)+"utId"]=null;else{let o=0,x=0,h;do h=ApwiNW.uwIzV(_0x5dca98,_0x58b6b4),o<32&&(x|=ApwiNW[t(592)](127&h,o)),o+=7;while(128&h);return x}}[n(553)+n(1524)](){let t=n;if(e[t(520)](e[t(451)],e[t(1350)])){e[t(1292)](_0x5a4676,_0x126e62,42);let r=e[t(427)](_0x59430f);e[t(489)](_0x58057a,_0x376f68,r),e[t(899)](_0x2d4489,_0x261471,r.limit),_0x3b2f81(_0x462365,r),e[t(1573)](_0x239871,r)}else e[t(857)](clearTimeout,this[t(921)+t(1634)+"Id"]),e.ByczE(clearTimeout,this[t(1223)+t(1315)+t(1598)]),this["_pingPon"+t(1634)+"Id"]=null,this[t(1223)+t(1315)+t(1598)]=null}[n(729)](...t){let r=n;this[r(1805)][r(657)]&&console.log[r(1222)](console,[e[r(846)],...t])}[n(879)+n(1632)+"e"](t){let r=n,{initReconnectInterval:o,maxReconnectInterval:x,reconnectIntervalGrowFactor:h}=this[r(1805)],m=o*Math.pow(h,e[r(1226)](t,1));return m>x?x:m}[n(1102)](){let t=n;if(this[t(1120)]&&e[t(873)](this[t(1120)].readyState,this.CONNECTING)){this._clearPingTimer(),this["_pingPon"+t(1634)+"Id"]=e.NJwpg(setTimeout,this[t(1102)][t(1545)](this),this._options[t(580)+t(1579)]);return}if(!this[t(1120)]||e[t(785)](this[t(1120)].readyState,this[t(1074)]))return void this["_handleR"+t(453)]();this[t(1120)]&&this[t(1120)].send("hi"),this[t(1223)+t(1315)+t(1598)]=setTimeout(this[t(1294)+t(453)+"Timeout"][t(1545)](this),this[t(1805)][t(1371)+t(1182)+t(1544)])}[n(1294)+n(453)+n(538)](){let t=n;this[t(469)+"sCounter"]?.[t(1802)](),this.emit(t(804)+t(1509)+"t",t(1437)),this[t(469)+t(696)]?.[t(1095)+t(953)+"nt"]()?this[t(1294)+t(453)]():this[t(1102)]()}[n(861)+n(664)](){let t=n;return this[t(1797)+"T"]||this._isMiniWX?this[t(1633)+t(1177)+t(1014)]:(this[t(526)+"er"]||this[t(1345)+"r"])&&this[t(1805)][t(759)+"tworkChanged"]?navigator[t(1045)]:!0}[n(1294)+"econnect"](){let t=n;!this[t(861)+t(664)]()||this["_readyCl"+t(1489)]||(this[t(987)+t(454)]?.[t(591)+t(550)+t(1721)](),this[t(469)+t(696)]?.[t(1793)+t(1540)](),this._ws?this[t(955)+t(900)](1001,e[t(576)],!0):this[t(1274)]())}["_onPageN"+n(407)+n(716)](){let t=n;this[t(1797)+"T"]?tt["onNetwor"+t(481)+"hange"](({isConnected:r})=>{let o=t;this["_miniNav"+o(1177)+o(1014)]=r,r?this[o(971)+"nLine"]():this[o(971)+o(839)]()}):this._isMiniWX&&wx[t(475)+t(481)+"hange"](({isConnected:r})=>{let o=t;this[o(1633)+o(1177)+o(1014)]=r,r?this[o(971)+o(1149)]():this[o(971)+"ffLine"]()})}[n(1667)](t){let r={LuCAm:function(o,x,h){return e[D(1104)](o,x,h)}};return new Promise(o=>{let x=D;r.LuCAm(setTimeout,o,this[x(879)+x(1632)+"e"](t))})}[n(955)+n(900)](t=1e3,r="",o=!1){let x=n;this._ws&&this[x(1619)+x(384)+"t"](t,r,o)}[n(1305)+"ut"](){let t=n,r=this[t(987)+t(454)]?.getCurrentEndpoint();this[t(729)](t(689)+r+t(1300)),this[t(955)+"ect"](1001,e[t(1417)],!0)}_sendAck(t){let r=n,o=e[r(458)](xr,t);this[r(1120)]&&this[r(1120)][r(1625)+"te"]===this.OPEN&&(this[r(1120)]&&this._ws[r(1639)](o),this[r(729)](r(1422),t))}[n(609)+n(945)+"rs"](){let t=n;if(e[t(1427)](t(1277),e.sgAtm)){if(!this[t(1120)])return;this[t(1120)][t(611)+"entListe"+t(647)](e[t(663)],this[t(1626)]),this[t(1120)][t(611)+t(1121)+t(647)](t(1529),this[t(1784)]),this[t(1120)][t(611)+t(1121)+t(647)](t(1460),this[t(1443)+"ge"]),this[t(1120)]["removeEv"+t(1121)+t(647)](e[t(598)],this[t(630)])}else this[t(871)+t(1628)+t(1389)+"t"]=0}[n(1790)+n(1066)](){let t=n;if(e[t(1428)](e.qQtEq,t(480))){if(!this[t(1120)])return;this[t(1120)][t(1257)+"Listener"](e[t(663)],this._onOpen),this[t(1120)].addEventListener(t(1529),this[t(1784)]),this[t(1120)][t(1257)+"Listener"](t(1460),this._onMessage),this._ws[t(1257)+t(1682)](e[t(598)],this._onError)}else{let{initReconnectInterval:r,maxReconnectInterval:o,reconnectIntervalGrowFactor:x}=this[t(1805)],h=e[t(691)](r,_0x2b1528[t(459)](x,_0x4a8fe8-1));return e[t(1677)](h,o)?o:h}}[n(1106)+n(956)](t=1e3,r=""){let o=n;if(e[o(1741)](e[o(1351)],e[o(1351)]))return this[o(1120)]?this._ws.url:this._url;try{this[o(1120)]&&this[o(1120)][o(1529)](t,r)}catch{}}[n(1619)+n(384)+"t"](t=1e3,r="",o=!1){let x=n;if(this[x(553)+x(1524)](),this[x(1189)+x(1357)](),this[x(609)+x(945)+"rs"](),this[x(1106)+x(956)](1e3,r),this[x(1274)+x(1273)]=!1,o&&this[x(861)+x(664)]()&&!this[x(827)+"osed"]){if(this[x(987)+x(454)]?.checkReachMaxTries()){let m=this["_endpoin"+x(454)]?.[x(1471)+x(1124)+"nt"]();this[x(1028)+x(579)+x(604)](e[x(738)](pe,x(1529),{code:1006,reason:x(689)+m+(x(1300)+x(472)+x(1645)+x(913)),wasClean:!0}))}else{let m=this._options[x(1337)+x(1142)+"ptor"](t,r);this[x(1028)+x(579)+x(604)](e[x(820)](pe,e[x(719)],{code:t,reason:r,wasClean:!0,willReconnect:m})),m&&this[x(1274)]()}return}this[x(861)+x(664)]()||this[x(827)+x(1489)]?this[x(1028)+"hCloseEv"+x(604)](e.FbakX(pe,e.pZQHG,{code:t,reason:e[x(586)]})):this["_dispatc"+x(579)+x(604)](e[x(745)](pe,e.pZQHG,{code:1006,reason:e[x(631)]})),this[x(1120)]=null,this[x(987)+x(454)]?.["resetEnd"+x(550)+x(1721)](),this[x(469)+x(696)]?.[x(1793)+x(1540)]()}[n(1028)+"hOpenEvent"](t){let r=n;this.emit(e.vNqIE,t),this.onopen&&this[r(1390)](t)}[n(1028)+"hMessage"+n(712)](t){let r=n;this[r(863)](e[r(994)],t),this[r(1314)+"e"]&&this[r(1314)+"e"](t)}[n(1028)+n(1742)+n(1216)](t){let r=n;this.emit(e[r(621)],t),this[r(966)+"eAck"]&&this["onReceiv"+r(713)](t)}[n(1028)+n(674)+n(604)](t){let r=n;this[r(863)](e[r(598)],t),this[r(905)]&&this[r(905)](t)}[n(1028)+"hCloseEv"+n(604)](t){let r=n;this.emit(e[r(719)],t),this[r(1684)]&&this[r(1684)](t)}get binaryType(){let t=n;return this[t(1120)]?this[t(1120)].binaryType:this[t(1280)+"ype"]}set[n(897)+"pe"](t){let r=n;this._binaryType=t,this[r(1120)]&&(this._ws[r(897)+"pe"]=t)}get[n(1031)+"nt"](){let t=n;return this[t(987)+"tManager"]?.["getCurrentEndpointTriesC"+t(429)]()||0}get[n(1050)+"Amount"](){let t=n,r=this[t(1520)+"Queue"].reduce((o,x)=>{let h=t;return e[h(1035)](e.Eolvk,e[h(1663)])?(this[h(871)+h(1628)+h(1389)+"t"]++,this[h(1471)+h(1124)+"nt"]()):(o+=x&&x[h(1685)+"th"]||0,o)},0);return e[t(795)](r,this[t(1120)]?this[t(1120)][t(1050)+t(1387)]:0)}get[n(1265)+"ns"](){let t=n;return this[t(1120)]?this[t(1120)][t(1265)+"ns"]:""}get[n(763)](){let t=n;return this[t(1120)]?this[t(1120)].protocol:""}get[n(1625)+"te"](){let t=n;return this[t(1120)]?this[t(1120)][t(1625)+"te"]:this[t(1805)]["automati"+t(891)]?this.CONNECTING:this.CLOSED}get[n(1450)](){let t=n;return this[t(1120)]?this[t(1120)][t(1450)]:this[t(525)]}close(t=1e3,r){let o=n;if(this[o(827)+o(1489)]=!0,this[o(1189)+o(1357)](),this[o(553)+o(1524)](),this[o(1196)+o(1435)+o(1682)](),this[o(1147)+o(688)]?.[o(1079)](),!this[o(1120)])return void this[o(729)](e.AyLPz);if(e[o(520)](this[o(1120)].readyState,this.CLOSED)||e[o(508)](this._ws[o(1625)+"te"],this[o(693)]))return void this._debug(e[o(1557)]);this[o(1619)+o(384)+"t"](t,r)}async send(t,r){let o=n;if(e[o(1197)](null,t))throw new Error(e[o(762)]);o(389)==typeof t&&(t=JSON[o(1342)+"y"](t)),e[o(776)]!=typeof t&&!e[o(452)](t,ArrayBuffer)&&!(t[o(400)]&&t[o(400)]instanceof ArrayBuffer)&&(t=JSON[o(1342)+"y"](t));let x=await e[o(684)](Ls,t),h=e[o(684)](Va,t),{method:m=0,service:g=this._options[o(974)],logID:d=this[o(1805)][o(1782)+o(623)](),headers:b=this[o(1805)][o(1313)],payloadEncoding:E=this[o(1805)][o(619)+o(922)],payloadType:v=this[o(1805)][o(1004)+o(972)],logIDNew:L=this[o(1805)]["logIDNew"+o(1204)]["enableAu"+o(1508)+"teLogIDNew"]?e[o(667)](a,this[o(1805)][o(1571)+o(1204)].userIp):""}=e[o(1194)](r,{});if(!g)throw new Error(o(1456)+o(767)+o(1026)+"ervice");let N={SeqID:q[o(1584)+"er"](this[o(1734)]++),LogID:q[o(1584)+"er"](d),service:g,method:m,headers:b,payloadEncoding:e[o(510)](E,Object)?E.encoding?E[o(561)]:"":E,payloadType:e[o(1416)](v,Object)?v[o(1432)]?v[o(1432)]:h:v||h,payload:x,LogIDNew:L},z=e.CDyft(xr,N);return this[o(1120)]&&e[o(807)](this[o(1120)][o(1625)+"te"],this[o(1074)])?(this[o(1120)]&&this[o(1120)][o(1639)](z),this[o(729)](e[o(1484)],N)):this[o(1520)+o(675)].length<this[o(1805)]["maxMessa"+o(646)+"ength"]?(this[o(1520)+o(675)].push(z),this[o(729)](e.JZAss,N)):(this[o(1520)+o(675)][o(784)](),this[o(1520)+o(675)][o(1381)](z)),{seqID:this[o(1734)],logID:d,logIDNew:L}}async[n(1337)+"t"](t){let r=n,{url:o}=e[r(1452)](t,{}),x=Array[r(1762)](o)?o:e[r(776)]==typeof o?[o]:[];t&&Object[r(412)](this[r(1805)],t),x&&x[r(1131)]?this[r(987)+r(454)]=new Ds(x,this[r(1805)].maxRetries):this["_endpoin"+r(454)]?.[r(591)+r(550)+"fig"](),this["_pingLos"+r(696)]?.["resetCou"+r(1540)](this[r(1805)][r(1580)+"Count"]),this[r(827)+"osed"]=!1,this[r(1120)]&&e.PwJOT(this[r(1120)].readyState,this[r(733)])?this[r(955)+r(900)](1e3,e[r(501)],!0):(this[r(1173)]=!0,this[r(1274)]())}async[n(1612)](){let t=n;if(!this[t(1274)+t(1273)]){let r="2|0|1|4|3"[t(542)]("|"),o=0;for(;;){switch(r[o++]){case"0":this[t(469)+t(696)]?.resetCounter();continue;case"1":this[t(827)+t(1489)]=!1;continue;case"2":this._endpointManager?.["resetEnd"+t(550)+"fig"]();continue;case"3":this[t(1274)]();continue;case"4":this[t(1173)]=!0;continue}break}}}[n(1257)+n(1682)](t,r){this.on(t,r)}["dispatch"+n(712)](t){let r=n,{type:o}=t;this[r(863)](o,t)}[n(611)+n(1121)+"ner"](t,r){this[n(1130)](t,r)}[n(1279)](){let t=n,r={fLrRU:function(o,x){return e[D(825)](o,x)},EWpAg:function(o,x){return e[D(1085)](o,x)},UGCGk:"0000",RBveG:t(1718),RXPNr:function(o,x){return e[t(1352)](o,x)},PatYX:e.QXMAx,kRSnc:"success",vfTJX:e[t(896)],rbepU:t(804)+"e_timeout",GviBQ:function(o,x){return e[t(569)](o,x)},gjhaJ:e[t(546)]};return new Promise((o,x)=>{let h=t;this[h(553)+h(1524)](),this[h(921)+"gTimeoutId"]=e[h(1073)](setTimeout,this[h(1102)][h(1545)](this),this[h(1805)]["pingInte"+h(1579)]);let m=()=>{let d=h,b={qDvWq:function(E,v){return r[D(988)](E,v)},mleXY:function(E,v){return r.EWpAg(E,v)},Xasnf:r[d(1034)],GVGzW:r[d(1728)]};if(r[d(524)](r.PatYX,r[d(1420)]))o(r[d(782)]),this[d(1130)](r[d(1117)],m),this[d(1130)](r[d(486)],g);else{let E=_0x3b2e49[d(542)](/\./).map(N=>_0x1ecd35(N)),v=[];return v[0]=HZnkuA[d(1165)](_0x12fdbc,HZnkuA[d(1376)](E[0],E[1])),v[1]=HZnkuA[d(1165)](_0x25621a,E[2]+E[3]),[HZnkuA[d(973)],HZnkuA[d(973)],HZnkuA[d(973)],HZnkuA[d(973)],HZnkuA[d(973)],HZnkuA[d(1169)],v[0],v[1]][d(874)]("")}},g=()=>{let d=h;r.GviBQ(x,r[d(1251)]),this[d(1130)](r[d(1117)],m),this[d(1130)](r.rbepU,g)};this.on(h(804)+"e_success",m),this.on(e.UErtm,g),this[h(1102)]()})}}})(),Q[A(1230)+A(406)]=X.CustomCloseEvent,Q[A(617)+A(1061)]=X[A(617)+A(1061)],Q[A(456)+"e"]=X[A(456)+"e"],Q.Event=X[A(712)],Q[A(445)]=X[A(445)],Q[A(1804)+A(1209)+"vent"]=X[A(1804)+"MessageE"+A(707)],Q["MessageE"+A(707)]=X[A(1209)+A(707)],Q[A(1179)+"t"]=X.OpenEvent,Q["Reconnec"+A(902)]=X["Reconnec"+A(902)],Q.createCloseEvent=X[A(1704)+"oseEvent"],Q[A(1494)+A(1061)]=X["createEr"+A(1061)],Q[A(468)+A(1712)+"nt"]=X["createMe"+A(1712)+"nt"],Q.createOpenEvent=X.createOpenEvent,Q[A(1083)+"connectE"+A(707)]=X[A(1083)+"connectE"+A(707)],Q[A(1543)+"rame"]=X["decodedF"+A(717)],Q[A(912)+A(1112)]=X[A(912)+A(1112)];for(Rn in X)[A(1230)+"oseEvent",A(617)+A(1061),"ErrorCode","Event",A(445),"FrontierMessageE"+A(707),A(1209)+"vent","OpenEvent",A(1290)+A(902),A(1704)+A(406),A(1494)+A(1061),A(468)+"ssageEvent",A(867)+A(434),A(1083)+"connectE"+A(707),A(1543)+A(717),A(912)+A(1112)].indexOf(Rn)===-1&&(Q[Rn]=X[Rn]);function D(n,e){n=n-374;let i=zn(),a=i[n];if(D.gzrMot===void 0){var c=function(p){let w="abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789+/=",y="",_="";for(let C=0,P,I,R=0;I=p.charAt(R++);~I&&(P=C%4?P*64+I:I,C++%4)?y+=String.fromCharCode(255&P>>(-2*C&6)):0)I=w.indexOf(I);for(let C=0,P=y.length;C<P;C++)_+="%"+("00"+y.charCodeAt(C).toString(16)).slice(-2);return decodeURIComponent(_)};D.tYuXGq=c,D.SPNteH={},D.gzrMot=!0}let u=i[0],f=n+u,l=D.SPNteH[f];return l?a=l:(a=D.tYuXGq(a),D.SPNteH[f]=a),a}var Rn;function zn(){let n=["yK9uuxK","y3vYCMvUDeK","x29UtwvZC2e","sffRwgG","DgLTzw91DcW","CgTdBgq","C25gCe4","mdaWma","Ae91sNq","DxjS","y0DhwgG","C3HkB2G","rMnsz2m","BLHNvwK","v1beCxq","CgXLyxnLiha","DMvYC2LVBG","v1jRt24","z3z2q3q","BwvZC2fNzq","Dfbmz0K","zKP5vhq","x29UugfNzu4","q1rhr1O","Dfnoqui","Dgv4Dc9WBge","A2fmyuC","DgvwEge","quTHq1O","BwDHze8","z2v0q3vYCMu","BxnN","q3j6Dum","AhbWBgy","vK1zt1e","zMLSzw5HBwu","BgLUzw5V","vgTqrMK","Bwv0Ag9K","tK5vzxq","AfLZwfC","qM1yuMi","Dgvtq28","shnuB3a","zxmGCMvHy2G","A2HoqKm","qu1JzLu","DNfizKe","B3nLza","twr3suO","yw1LoIa","DuPhsuW","CvHwBLa","y3jLyxrLrxi","s3nADge","ChHeDee","s2DJBfG","D3jPDgvvAw4","Evfctxe","l3DZl3yY","t0PeqwC","AwXAqvG","DxDqC0S","x2LUAxrqCM8","tK52qLu","r09kze8","wfvvwLO","Dg9hzw5LCMe","zv90Aw1LB3u","Ee96ugi","BwH4zxG","EgDNzeW","Dhj1y3rVCIa","qKvJteq","yNzNEw4","Chv0","x19LC01Vzhu","yxDMEva","q25NzeS","x21LC3nHz2u","Cg9W","zhbzu3a","zLr2svq","BMDuAw1LCG","DfnhDxK","z3jouw0","B0X4ru0","Aw5KzxHpzG","y2XVC2u","zMvY","yMfSu2nVCgu","zMLfzfK","CNPeC1O","Bxzovu4","mJiWmtuYohHQwxvPzG","Aw5KzxG","wNjRzM4","C2nYAxb0","r0TZA0i","BNrLCG","AwPWDw0","q09otKvdveK","zgvJB2rLzey","DMfS","yMLUza","BfzOuM0","z05It3a","qNPMzg8","BM93","nxW0Fdj8mxW","t0LkCfu","vujwv0e","zK1TAKy","x2LUAxrhBg8","z2v0qwXSs2u","B2XKvMvYC2K","rerzwMS","Bg1zDe0","tMfTzq","ign1CNnVCIa","C3rYAw5N","B2fNAuW","v3beyvu","wujUBvm","yMXuveK","Ec1TC2CTy3u","ANvJsei","ENrMC08","y0nID0m","CKfIvhm","Bg9NsurozxC","q291BNq","C0XzuNm","AxnmB25N","zMzLCG","zuPJBva","B3bLBG","u0XNBgm","CNzHBa","CgLUz0XVC3m","vgvuwfu","wxLPCwy","BwLZzq","zNjVBu51Bwi","Ahr0Chm6","tM9eAwy","B3jLtMfTzxm","rMD3t1i","u0nOq2e","nxW0","twvxteq","yM1Pz2y","yKvRs2W","BffXqvO","C29YDa","ihbYB3rVy28","qwfQA3a","DeLK","rgziEeS","B2nRzxrtDwm","DeXcthK","tgHituW","Bxrwvuy","tg1IDgS","zwnus2W","DuzpAKi","DeHIA3y","zgvMAw5Luhi","whzIAMC","zM9YrwfJAa","twrOqKC","y29UBMvJDa","DxbKyxrLq3u","zgjgt2u","B2Tey0S","sfnJyNu","C2Pdrxi","z0P1sMy","x2rLC3rYB3K","DKv2Aha","rMjrEue","ywXSq3vYC28","CuzPC2K","mtHjAur4v0K","CMvHzhLtDge","x29Ut3bLBG","ywDL","BMrWB2LUDfq","z2u6ia","uw9kuNq","rw1MquG","CNzHBfzHBhu","x21PBMLoyxy","z1rPBwvVDxq","s29euvK","C29Tzq","ywnRtxnNswq","v0DbALu","C2vUza","uMvezMO","yMTjsu4","DxbAA2G","y29UBMvJDfm","nda5ntjYvLfuu0W","DhjPzxmGCMu","x2n1CNnVCK4","s2Xpteq","Aw9Ul2PZB24","C2vYDMvYvgK","svHkrNi","sMPSCMC","tNfvvu8","Dg9VigXHCMC","B25dBg9Zzq","wKvpDKy","Aw5Lza","DMvxyuy","sKHkCMm","u1LYCLO","vwXTCeq","CurNyum","Dw5KzwzPBMu","rw9SDMS","uwLqvg8","EKPdAKS","t0Pcz0C","x3DHAxq","BezSDxnO","Dg9mB3DLCKm","yMPQuLO","B0XAALa","D3m6lY8","y2XVC2uSihC","mJq3mZu1meDrBuLyAq","D2T3t20","AxnszwfKEq","ugHRz1a","C21MwLO","rKLqEM0","DMflBgy","zcbLCNjVCI4","tgLZDgvUzxi","EKz3CfC","B25JBg9Zzq","yNL0zuXLBMC","BeHHBMrSzxi","zNjVBuj5Dgu","tKzMuLC","Aw5PDcbrB1m","z2vtEw5J","A1j6rwS","wNrbCxq","C2DeAwG","C2v0zgi","CuvzwLi","EsbJBg9Zzwq","sMjby24","B09sEwC","rMzVtMm","yNL0zu9MzNm","y3rxvfG","zgvSzxrLrge","m3WW","y3jLyxrLq2W","se1zrLK","AgvHzgvY","B2TOy24","jMPZy2fSBgi","yM9KEq","DeHmuuG","ExfKDxa","C3nHz2vfDMu","zNjVBuHHC2G","CxrkBhe","D2j4D1a","x3bHDgHlzxK","CwXIAMW","zMzMzG","zxfhs2q","CxzTwe0","zMLN","CgvYC2LZDgu","u3LXC2O","s0nyrKu","q09oveLovuu","twLZC2LUzYa","B3bLCNr5","uKj2zuC","AuHmu3G","B2jQzwn0u3q","x2LZtwLUAvC","mNWZFdf8mhW","C2XPy2u","x3nLCuLK","yMXVy2TLza","Bvzqt2m","ywnRpwzYB24","zxj2AwnL","CeXbvMG","vNjZr1i","B0HuBMi","AefJA01LC3m","yxbWBgLJyxq","B0zMu1e","zMLSDgvY","svzYtKS","vgfN","x2LUAxq","C2vYDMLJzs0","CefgwuS","tLfwCwm","yvHyBKm","Aw50zwDLCIa","qwjVCNrfCNi","quXeuKu","sxzMBLO","zw1AtgS","v1DOD04","AgfUz2u","CMvHC29U","y29UBMvJDgK","AxnbCNjHEq","C0jf","nxWYFdD8mta","rwnpywO","AKPczwe","z0H0sMi","y3PwtNO","wM9rq3G","Dgv4Dc9Qyxy","AgfZ","DgHhD0u","zMXVB3i","wwHKtLC","B2zMC2v0","C2DPza","D0Xzwvm","qLHZvuK","y2XLyxjtDg8","ywXSzwqGBxu","zg9Uzq","Bg9Nsurhzw4","ywjVCNq","x29Uq2XVC2u","r3D0zxa","rKreBfm","rM9vvgG","uLjhDfy","u0LRC08","x2fKzfDZtgK","zcWG","ve9Iq1y","CMvZzxrdB3u","rgTps3G","BvrJsgy","y3vYC29Yx24","x2LZtwLUAvq","B0L6Dg8","DxrVuMvJB24","AunlCgC","y3jlBgu","ywrKq291BNq","ugH1CMK","rNjVBNrPzxi","x29WDgLVBNm","B2PICvq","rvPLyvy","wgPsvve","v21hBue","r25pCfm","AxnFywnR","EfndBKy","CMvJzxzPzwq","v1PyAMq","tM1lBwO","v2vIu29JA2u","AxnAzxjV","AxnrB1nby2S","CNDoyLK","zxjYtM8","BNvTyMvY","u1DRq3q","vwLAqu0","A1nJCK4","v29mrKS","qK5Hse8","rNn1sg0","uxPPEMe","B3jRzxjhBg8","wefvuvy","y25pEfy","yNvMzMvY","uNvYCeq","vxjRENu","whjZu3K","DxbNCMfKzw4","BLfAwgK","B3nLrxzLBNq","zxrxB3jRq2G","ChjVDg90Exa","Dw50","zxjFBxnNAwq","CNnVCKzPBgu","yxnZAwDU","ExHUvMu","zejkse8","DgHLBG","z2LwzM4","DgfYz2v0","EfDMywG","tufyx1jfvfi","zK96zfm","zxjYB3i","wffxCu4","C3jJ","vNH6svy","AKL0swC","sLDnsxq","AMLIr04","BMDLza","B3vUDa","x2zVCM1HDeu","yw5ZzM9YBvq","rKTrDvG","sePsAvG","zw5fDMvUDa","sezSwLO","tKDFrvjst1i","B3bLBKrc","Dw5RBM93BIa","wMzZwhm","zw5KCg9PBNq","ywXS","thHOyMK","thfoDMS","mxWZFdj8mhW","rLDt","yu5KCKC","A251zNe","wMjAqwy","EMXuy1q","EvjLy29UBMu","qunJEfK","CePVyKi","zwnVBM5Ly3q","De1HBMfNzxi","v1Luq24","rxjYB3jdB2q","u2vXsuq","BgPIBxi","Cg93","oxW2FdH8m3W","zxjFywnRx20","DLjxs3q","DNHNzwu","mtb8nNW5FdC","ihzHBgLKigq","uu9UA2q","q1rMD2G","y3jLyxrLtwu","x3bPBMDmB3m","D3jPDgu","rwTdB3y","lcbTyxGGCMu","CvjmrKy","B3bLBIa","B25ozxr3B3i","qwrMB1a","u3PyEKC","BgLTAxq","BhDzt2K","tu1suxC","A1n0yxr1C0m","wLLPrfy","AgrRC0e","B2nRzxq","svzwBhe","CMjLCfu","zxjYtxnN","AwXK","wfjtC0K","Cw9Z","y2fSBa","x0vysvnu","A2v0ignVBNm","wMnyvMG","v053sgm","sgzKsvu","zwv4Cwq","ExLgr2q","v3vAD3i","DKrMAMu","CeLTrwq","Dg9Y","yw1Lu3bHy2u","uKXlvfK","AKfZELe","AxnrB1nnzxm","vgjszNC","uMjuD2e","zxLlr2y","r21dswq","yxKSig5LDhC","EerlvwG","t2Hkvui","BhjfEKe","q3rgChK","CgfYC2u","ExvZB3a","zgvSzxrL","rLjptLrjrvi","u01wANG","ALfiBeO","qxPZrhe","BxrlDeS","uLHqtNi","x3vYBa","x2LZqNjVD3m","BM9Uzv9UB24","Au9Xuwi","ywrK","A3fUq3O","Dwv0uLO","wxPhzNu","DK1oqK4","y29UC3rYDwm","wejbDKy","tNrxANq","whjxwg4","vgLTzw91Da","AMXPvLe","wgfUBhu","DgvZDa","C3bSAxq","D24GCMvHC28","C3rHCNq","C0v5Exm","uNLAyLG","yMrSzw4","seXlvxy","vNvzrwe","Cg9PBNrdB24","BgXbvgS","ywzL","x2nSzwfYugK","su5tvefova","B1fSyuC","CMvXDwLYzwq","yxGGCMv0CMK","BK9LAei","uen2vNa","C1j0qNe","zw5JB2rPBMC","Buj0AKq","C2fNzq","quXm","BMv4DcGPigm","EwTkAha","C2v0q3vYC28","uvzlr0G","u1bsBNe","CYbHBhjLywq","vfPMrxG","uMvHzcbWyxm","CNbpvw0","wLrwt1i","v2LUzg93","wwLUwvy","CffYCMK","zcWGDw5RBM8","AenSB3nLrxy","CgLUz0LUDgu","vePNwLm","B3jRig9MzMW","vw5PBxbSzw0","DNrir0y","m3WY","seXIrey","AufUsLa","DhjPBq","EenvtKG","zM9Yy2u","CMvZzxrfBMq","CKLhvNq","DMfSDwvZ","zw5HyMXLvhi","wMDjDxO","ywWGy3vYC28","tKfusvzfx0u","rxnOtxi","uLrODha","DgXVDwq","Ae1LC3nHz2u","tuTWs24","tK1wDe4","zw50","DcbVzIbYyw4","ug9quhC","B29sCeu","A3fruuW","x3jLBw92zvC","BMvLzf9Hy2S","CMvTB3zLrxy","BxfQAwq","B2nRzxrgywK","C2v0u3rVCMe","AxmGDw5Kzwy","thHzqwG","q3vZDg9Trxi","x2rItMfTzq","Cgf5Bg9Hzeu","Afjtsum","AefPufC","sKzJrvO","zxjHDg9Y","tuvtu0fhrv8","y3jLyxrLt2i","y29TCgXLDgu","qNjPzgDL","u0jcv3O","D3ngzee","x29UrxjYB3i","BLHzEwu","yMfJA3vWigu","B25SAw5L","zNjVBNrPzxi","y3vYC29Yx2y","BM5Ly3q","q1v5wfu","x3nVy2TLDa","s2fsBhO","yxnL","sxjWAhe","ywnRx2LK","ywXPzcb1CMW","Afzyy1i","BwvKAwf0zwW","z2vrDwv1zuW","BMvY","x3bYzwzPEa","qKroDLm","ywDLu2HVDW","Ec11C2uT","t05Pzem","ig1LC3nHz2u","t1rer2u","tgr4D28","BgvY","zgvIDwC","B2P5AMm","C01wu2S","C3bSAwnL","A3r6tLe","yNLevMW","DK5Xsuu","B3jpBMXPBMu","mJaYm1vtDhPoEa","r2HXwNO","t2DXC0W","DxnsC1K","B3bVu2u","B2zMBgLUzq","z1Huq2W","rMLivvu","x3fVC0rc","AevYCM9Yrxy","uxvLDwu","D2vI","q0ThsM8","s1jyuNO","thPfv3G","CMvWBgfJzui","Bg9N","id4G","B2fK","ANLLq1i","AK1qzhG","tKvwDLm","Cgf5Bg9Hza","z2vY","y29UBMvJDca","ugH5DKG","AvDoCNa","A2PlqwW","q0Xpu0LorW","y291BNq","uhDkt1q","C0nVDw50zxi","B25kv2W","txHitva","shP5Bhu","sgvXrKG","refpsMe","lcbOB3n0BMe","tg9NsurozxC","ywXty29Wzq","B2TnsKW","AwXLtMfTzq","DMvUDa","sxzmr0e","DvLWvve","y3rTruC","uKv1BwW","rxzLBNq","zufJAW","DKXPu2S","u3flAfK","yw5Nzq","CMfTzq","tgTyt0u","CfPrseC","ywnRDxbfBMq","BwfUDwfSihi","vLzNshe","Buvqy0C","tMvvv1G","tMfjque","sKPQweW","BK1cwgW","yKPgAMi","x2rLyNvN","ndHur3DcuwS","zKPTvxC","v3zqAwm","q0Xpu0ve","AwLYBxy","vKHRsfm","C0LUDNe","ue5er3m","tvLVwge","rw5Ovue","uxz1EMq","y29Uy2f0","rLDQsgO","B3jL","AuDktuO","uuHswfO","D3LNAgW","zhDXsM8","B1ftEve","zhDfr2y","CNLoB28","q3fNv1m","DMfSDwu","tw9KDwXL","Aw9U","thPmqLC","yxjyrLO","s29vDem","ChjVy2vZCW","BgLZDgvUtMu","tMz0txG","CuHmAMO","C2rUuwm","ChjVDg9JB2W","u2Ttz2u","yNHABeW","CwLkBMO","CM92AwrLige","quTXB3G","vNf3Cu0","rMHiq2S","vuvYDg0","we9qA0O","Dxrjza","BwLUAvbYB2C","BIWGAg9ZDg4","u0P5sfi","y2vZC0HHBMq","yKDAweK","y2uGBM90igK","Dg9cExrLC0W","Cgu6ia","A1jtBMm","B0jhvKW","C2HPzNq","yvDet0m","weD0Cu0","CM92AwrLigi","BMrWB2LUDca","CNjVCK1LC3m","DhLuv1G","Cgfyz1i","qKvIC0W","CgfNzxnOB3C","CerMwuy","z01xEue","D3bmBha","D25qsvu","BMfTzq","CMfNzvn5BMm","q0XuweG","C3rVCcbPBw0","tKvbrvC","Cxr3De0","CgLUz19VBMm","DgLUzYbZzxi","zw50zwqGDhK","wNnZALe","ALDpuMm","BMv3vMvYC2K","y2HLy2TdDxi","Bwf4tg9ZC0m","tMzdvKq","rfL1t2q","oda3odqWzxjMrgn3","vhndywC","Bhm6ia","ENvHCge","z01xu2m","C0Xf","ueLHCfy","x2n1CNnVCKy","v1z2DuS","zgvS","uLbptMq","wgftzuS","zxq9DxrMltG","x3jLywr5q2W","Aw5N","CMvTB3zLq2G","vu1XtNu","qKzVD20","t2TSCvm","wLbotKm","u1zwAgG","D0DbvvK","yw5Hz2vY","igfYCMf5yNu","BfrPBwvVDxq","zMzmAw5L","uhbvBgG","sKndy28","AMXmvxm","z2v0","A0DwrKS","wwDVsfa","wgL1ENq","yxveBg0","BLjUrvC","uKLyAMG","BMvJDa","CuXVD20","ysbTDxn0igi","zsbHihn0CMK","t0PRAuy","DhL4wKG","ywDLsgLKzq","Cwz1Ewm","B2LcC0S","vgrOv1e","yLvNs28","x25HDMLNyxq","suvtx0vsuK8","zw1PDa","t0Lvt04","Axfwq1m","uMPOC0u","y3jLyxrLt3a","AvLlzhG","CezOBui","whfLrge","y3vYCMvUDeu","BxHXBue","wuncD1q","AM9PBG","ihjLy29UBMu","x2HHBMrSzva","Aw1LCYbPBIa","v3PJy1u","x2DLDeLUDgu","vhDgt1i","ELnXB2S","Bwu6ia","DhbizwfKzxi","wNjTrNq","DuHIq3a","DMvY","A0rqzu8","wLjtEMu","t1bftL9fuLi","z1jlvKq","y09Wzw4","EuLTtwS","A2vUr1e","wu9PBeK","DMziA3C","zuzYswe","yMLUyxj5vhK","v2rmy0i","ENzku0W","zwn0","A2zLAgy","Dev2zw50","zhvJq1y","yxv0BW","B25LCNjVCG","ihrYEsbYzwm","q0HnqNq","CgjICdi","tuXKvMe","yxrLq291BNq","BhnoAu0","zw5JB2rLrNi","ywnOzwq","t2DgDeC","uLPOCwK","tg9Nsuq","mJeYnZG1AvHmChb0","s0Tiyw8","ywr2yw5Jzq","sLnptLa","x3bPBMDqB24","BMnVzgLUzW","AwrI","t05jzK8","EKPiAu8","qxDIt0S","y2j4tuu","Eg5jwu4","rNDXDeW","D2rJug4","z1zowu0","D2XqtMe","v1rvruu","wNnTugG","q29Kzq","EwDet2G","CvbiuLe","DgnNCKO","zwvKzwq","A3jLAhC","D2D1ywO","swP5ENO","yMrFzgLK","AgzoEgO","C0XPC3rLBMu","z2vjBMzVu3K","zNLhzvu","y3vYC29Y","y29UDgLUDwu","BLD3tey","ywLmv3m","yw9SA0W","y2HnyxHdB3u","tMnpt3y","x2rPC2nVBM4","BMnLq2XVC2u","y214BLm","DKDxsLC","yxnJCMLWDa","y2HHCKnVzgu","vuHlr3a","B25pCgvU","C0jYtLq","txfWCKm","uu9uzLi","B25szwnLAxy","rvrRAMu","rLL5z28","BxvZtwK","CMvUDevUzha","x2HHBMrSzu8","ExbL","wgfZBMy","C2vYDMLJzq","ChbL","D1fICvO","rgvKAwnHDgu","r1Hzze4","BgzsqKq","EfvZzuvUDG","D3nYANq","Ahr0Ca","C3vIyxjYyxK","y1ztwgO","Aw5L","ruTktuq","x2vUzhbVAw4","zKXYuLu","z2v0sxrLBq","ru5vAfu","DuHcBvi","ufPQCLO","wuTTy0W","s1DwBgO","t0PgELu","D3frDwq","x2DLBMvYyxq","y29SBM8","rMX0z3y","Ehfnq3G","BgLbA3u","CvLuthm","AgDWq2C","Cgf5Bg9Hzfq","seziue8","DvLTCNa","z2X6tMW","vK1UuM0","CIb0DhDjra","t0fWBhC","BuHhAeG","q3z5y3G","rw1PrK4","BgLUzq","AMXKBuG","zxHWB3j0CW","z1fqCvq","x0rctMfTzq","Dg9cExrLC0i","C3vJy2vZCW","DuvRB0m","zxzWr2y","vvnyCKm","AwXLx25HBwu","y0nkvwi","ihzHBgLKihm","EKPcrvu","x2rPC3bHDgm","AvvcyKS","zw5XDwv1zq","CMv0CNLdB3u","rg50Cem","CLrvB1K","vuDdr2S","u3PZDhC","A25zEMi","Auz6Auq","yNL0zxm","zMD5zwy","s2L4Axu","s3jzshC","CMvWBgfJzq","C2v0","rNvQDfq","B25mAw5L","Dw5ZAwDUzwq","y3vYDMfSDwu","vhnkvvy","qMLYBKG","yNvMzMvYzwq","rLfOvwG","rLj2zvu","A3zyq00","zNjHBwvuExa","DhjHBNnHy3q","t0nsu3C","icSG","DhDVCMTdAge","sK1sC3u","wMPPDhi","CM9YrxzLBNq","Aw5JBhvKzxm","s2fxCxy","EvHkAeG","x194x21Zz18","C3rLBMvYCW","AwLAqNK","t01sCNa","AgLNAa","x2LUDgvYDMe","v21mCfu","sNbKBK0","BwDryMW","t1bftG","zNjVBunOyxi","CMvHzg9UBhK","reiGzMfPBgu","swLTq2C","y2XVC2veqG","A2v5","whfVqxC","z09VAMK","y3jLyxrLuMu","yKDWCxy","CM1wDhq","D0rcEu0","EePyu3a","q0TWAMC","CMfUzg9T","Cg9PBNrbBMq","CfPUs2e","EwvfzM4","se5vDhO","vvndEum","y2HLy2Tszwe","Ee1ks2e","BMCGDxjSoIa","vxbKyxrLq28","v3v6v1y","wu5Yu1q","CLbMDuO","x3bPBMC","x2LZtM9Kzq","tKP3CgC","ihrVihjLDhi","x3DZsw5ZDge","DxvtA2y","CwH6v1q","yxbWzw5Kq2G","s05ps1G","igzHAwWSig0","yw1L","CgfNzwHPzgu","CMvQzwn0","ChPSCe4","mNW2Fda","DMzusLG","twnOBeS","ELvpD0O","x3DZ","zw50tgLZDgu","mhWYFdn8mxW","D1DwBLu","BNrfBMrWB2K","vhHAv1e","igzPzwXKoIa","DLfYz1i","EKHmzMq","CMvZB2X2zq","B2zM","BgvUz3rO","uePwtKW","ruXHC2u","zKnPzu0","zgLZywjSzue","vgnzyKm","z2v0qwXS","zgrjrcWGzgu","Egvou2q","rKvuvM0","CNb4q0u","DeLUDgvYy2u","uhbbs2u","ANfnExC","vwTJDKC","uNnhExu","x1fVu01HBMe","u1PmDu4","BKXPBMu","vK9PyLy","CMvZzxruCMK","tuLuzue","CxzgzfG","zw5HyMXLuw8","Ce5NtLa","uLjpuG","Cg9RtLy","tvnjsKO","DKPwtfi","sNDHt2K","Dhf6vwq","wKfHB3q","yMLUyxj5","DMzsAgO","Cur2v3e","turfDva","C3neEfy","z1v0qxa","r1zhELC","DvfbvMG","AeHQzLy","BKHgu0y","x2LZsw5PDa","Aw9UvgLTzw8","yLfWCgi","svjfDgS","AwDHDg9Yt24","DcbSAw1PDa","t3bLBKv2zw4","B21Mvfy","wLvSz1u","B3v0sw50zxi","Bg9IywXty28","q2juyxC","vw5Oyw5KBgu","BhrPCgXLihq","BNrbBMrvCgq","y2HnyxHuCMK","x2nSzwfYvgK","x2n1CNnVCK0","x2XPC3rLBMu","mti4otqWmtbOvg55CLC","B2vbAha","B3PmCKW","CMPQzhK","x2rYB3bhBg8","DwvPs3q","zMLUza","CMvHzhDYAxq","D2rXq3u","txHvvMy","ue5rDvG","DxrMofDYAxq","q29UzMLN","zLDbEfy","AgfZt3DUuhi","BwLUzW","CeXzyue","twvZC2fNzuu","ywnRx2nVzgu","Bwf4uMv0CMK","m3W1Fdr8mxW","AgvKtwf4uMu","CNnVCL9Uyw0","yvD2vhi","ywDLrxzLBNq","tfjwAgC","whD3q2i","qwTkC2u","mdaWmdaWmda","s1nLB3m","yxbWBhK","x3jLy29UBMu","uNf3ve4","yxrHlcbKyxq","DwnUwwS","x3bYB3rVy28","ChrVCG","zwrPyxrLBhK","q3vZDg9Tq2W","AK1wue8","BNruCMLLC0m","AMDju1a","u3rYyxrLz3K","z2v0s2v5","zxjFDhrS","CNLiqMC","z2v0u3rVCMe","u1P6C2O","z2vkAMC","C2v0sxrLBq","twLoENC","A0THvLG","uxzKuNu","Bhj5Au4","tKrLrK0","s1fjsMC","u1fkveK","u2TPCcbWyxm","qMHcBNC","z2POyuO","ignVzgu6ia","CxbtA3u","B25tDgfYDfi","BMCGzMfPBgu","uM5Jshe","ywrKrxzLBNq","y1fwrhG","BwvZ","zvvYBa","Fdj8mhW4","rvH1s2W","rhbprhu","CvnSAvC","zxH0zw5ZAw8","AMvJDfn0B3i","uMPtte0","zxH0ugf5Bg8","EgHqBxO","Dg9oDw1Izxi","C3vIC3rYAw4","yxvyt2y","tg9JAW","x2nVBM5Ly3q","CMvZDwX0","s1D4wMy","BgPJzhm","zgrqzxa","CgLUz09Uy2u","x2jPBMfYEvq","CNbwu08","AvrgCKS","AxLxuMO","s21vy3O","s0zZyMG","quzttvu","Ef9MCM9UDgK","mJu5mZG0ohvdDwPfyq","C3DXCgu","uMvJB25Uzwm","DMHAuw0","zvfZrhu","zM5oyLK","x2HHBMrSzvi","quTmteK","q0rfAg4","wvDHD3q","ywz0BKC","Bg93","ihrPBwvVDxq","DKvtrxC","ueziDeO","C3PADLG","BMrLEa","x29UvgLTzw8","D2PxvLi","CfLcBNu","aaaaaaaaaaa","BMCGB3iGyw4","D3PQy0u","BKTJuwm","y2f0y2G","AgvHzgvYCW","B25TzxnZywC","y3ruAw1LB3u","sMfVA0W","BML0AwfSAxO","z2v0q3vYC28","rvjst1i","B2LUDfjLywm","BuLXrMy","DMLJzuLeig8","Dg91Bgq","qML1wfm","sKj4AM4","uMjcELa","ExDks0u","qLn4rvi","rK5qu3u","y29Kzq","CuL4DK0","rwvqv2m","zMX1C2HfEha","rfPfqMK","vuHurfu","D2LSBfjLy28","CMvJB25Uzwm","u2HHCMvKv28","txPOrK4","B25fCNjVCG","reHrsMi","C3rYAw5NAwy","D3nZoI8V","DMXnEhq","x2LZv29YA2u","y2XLyxi","zgf0yq","ALjXzhu","wgzoyuq","EKf4BK4","vgvPB3i","u0TQuwe","DMr0DNe","ENfdqM0","wKnksNO","sLjXtuS","BwvY","uuXQu3i","nhWYFdb8mxW","BwfW","CMfTugfYyw0","DLjoAhK","rMPjExi","y3vYC29YlNm","vg9LB2e","r3jyywq","ihrPBwvZ","B2DtAhm","BhDZBMK","zhzAv2K","CgLUz1rPBwu","uu9WB0u","CNH5uMC","Efrurw52","B3PHCw0","BwXLwfK","tvLtCgO","DMPszwu","Au5TBeW","B25tDg9Wsw0","ChvZAa","C2zLEvO","D01bywS","vujSBfa","CMvKDwnL","zNjVBujPDhm","qw1VDw50","rujIr3K","CMLLC0nVDw4","B25VCgvU","rKXeEfq","CKTQqNu","quvwt2y","sxLjzha","x2nYzwf0zvm","zfDVCMTLCKC","AfvjsLO","Dg9tDhjPBMC","ChrJCNO","vK9wq1y","yu5ruhG","CYbPBNn0yw4","CMTLCKDSB2i","tej2rfy","zNvUy3rPB24","BwvZC2fNzv8","D2f6ALe","s0XIBhm","qxfgEuq","vNPVz2m","Dg9cExrLCW","veLkr2K","z29PBMCGyxC","Aw5KzxGGB3u","Dgv4DfbHEwW","ugHuAMS","AMjdDxu","BhPIruS","Dhr3Awq","ugf0wvG","rKzbANa","C2vUzf9Hy2S","Dg9iyxnO","EgTKu0y","A2v5CW","v2rdzwy","rLrsse8","tNLKy00","AwXSihvZzsa","B2HergG","C3rVCMu","DhLWzq","DKjHuMG","yLrsy2W","yMfSrxzLBNq","y2jyuvO","DgLTzw91Da","CMvHzfvjBNq","r3PZAMO","Ew1oqvy"];return zn=function(){return n},zn()}Object[A(1608)+A(1727)](Q,A(1517)+"le",{value:!0})});var ze=ce((Bg,fo)=>{"use strict";var xo=["nodebuffer","arraybuffer","fragments"],uo=typeof Blob<"u";uo&&xo.push("blob");fo.exports={BINARY_TYPES:xo,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:uo,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:()=>{}}});var Ht=ce((Mg,qn)=>{"use strict";var{EMPTY_BUFFER:iu}=ze(),Mr=Buffer[Symbol.species];function ou(n,e){if(n.length===0)return iu;if(n.length===1)return n[0];let i=Buffer.allocUnsafe(e),a=0;for(let c=0;c<n.length;c++){let u=n[c];i.set(u,a),a+=u.length}return a<e?new Mr(i.buffer,i.byteOffset,a):i}function lo(n,e,i,a,c){for(let u=0;u<c;u++)i[a+u]=n[u]^e[u&3]}function ho(n,e){for(let i=0;i<n.length;i++)n[i]^=e[i&3]}function au(n){return n.length===n.buffer.byteLength?n.buffer:n.buffer.slice(n.byteOffset,n.byteOffset+n.length)}function zr(n){if(zr.readOnly=!0,Buffer.isBuffer(n))return n;let e;return n instanceof ArrayBuffer?e=new Mr(n):ArrayBuffer.isView(n)?e=new Mr(n.buffer,n.byteOffset,n.byteLength):(e=Buffer.from(n),zr.readOnly=!1),e}qn.exports={concat:ou,mask:lo,toArrayBuffer:au,toBuffer:zr,unmask:ho};if(!process.env.WS_NO_BUFFER_UTIL)try{let n=$("bufferutil");qn.exports.mask=function(e,i,a,c,u){u<48?lo(e,i,a,c,u):n.mask(e,i,a,c,u)},qn.exports.unmask=function(e,i){e.length<32?ho(e,i):n.unmask(e,i)}}catch{}});var mo=ce((zg,po)=>{"use strict";var go=Symbol("kDone"),qr=Symbol("kRun"),Fr=class{constructor(e){this[go]=()=>{this.pending--,this[qr]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[qr]()}[qr](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[go])}}};po.exports=Fr});var yt=ce((qg,bo)=>{"use strict";var Gt=$("zlib"),wo=Ht(),cu=mo(),{kStatusCode:_o}=ze(),xu=Buffer[Symbol.species],uu=Buffer.from([0,0,255,255]),Un=Symbol("permessage-deflate"),qe=Symbol("total-length"),wt=Symbol("callback"),Ve=Symbol("buffers"),_t=Symbol("error"),Fn,Ur=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,!Fn){let i=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;Fn=new cu(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[wt];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){Fn.add(c=>{this._decompress(e,i,(u,f)=>{c(),a(u,f)})})}compress(e,i,a){Fn.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"?Gt.Z_DEFAULT_WINDOWBITS:this.params[u];this._inflate=Gt.createInflateRaw({...this._options.zlibInflateOptions,windowBits:f}),this._inflate[Un]=this,this._inflate[qe]=0,this._inflate[Ve]=[],this._inflate.on("error",du),this._inflate.on("data",yo)}this._inflate[wt]=a,this._inflate.write(e),i&&this._inflate.write(uu),this._inflate.flush(()=>{let u=this._inflate[_t];if(u){this._inflate.close(),this._inflate=null,a(u);return}let f=wo.concat(this._inflate[Ve],this._inflate[qe]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[qe]=0,this._inflate[Ve]=[],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"?Gt.Z_DEFAULT_WINDOWBITS:this.params[u];this._deflate=Gt.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:f}),this._deflate[qe]=0,this._deflate[Ve]=[],this._deflate.on("data",fu)}this._deflate[wt]=a,this._deflate.write(e),this._deflate.flush(Gt.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let u=wo.concat(this._deflate[Ve],this._deflate[qe]);i&&(u=new xu(u.buffer,u.byteOffset,u.length-4)),this._deflate[wt]=null,this._deflate[qe]=0,this._deflate[Ve]=[],i&&this.params[`${c}_no_context_takeover`]&&this._deflate.reset(),a(null,u)})}};bo.exports=Ur;function fu(n){this[Ve].push(n),this[qe]+=n.length}function yo(n){if(this[qe]+=n.length,this[Un]._maxPayload<1||this[qe]<=this[Un]._maxPayload){this[Ve].push(n);return}this[_t]=new RangeError("Max payload size exceeded"),this[_t].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[_t][_o]=1009,this.removeListener("data",yo),this.reset()}function du(n){if(this[Un]._inflate=null,this[_t]){this[wt](this[_t]);return}n[_o]=1007,this[wt](n)}});var bt=ce((Fg,Hn)=>{"use strict";var{isUtf8:vo}=$("buffer"),{hasBlob:lu}=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 gu(n){return n>=1e3&&n<=1014&&n!==1004&&n!==1005&&n!==1006||n>=3e3&&n<=4999}function Hr(n){let e=n.length,i=0;for(;i<e;)if((n[i]&128)===0)i++;else if((n[i]&224)===192){if(i+1===e||(n[i+1]&192)!==128||(n[i]&254)===192)return!1;i+=2}else if((n[i]&240)===224){if(i+2>=e||(n[i+1]&192)!==128||(n[i+2]&192)!==128||n[i]===224&&(n[i+1]&224)===128||n[i]===237&&(n[i+1]&224)===160)return!1;i+=3}else if((n[i]&248)===240){if(i+3>=e||(n[i+1]&192)!==128||(n[i+2]&192)!==128||(n[i+3]&192)!==128||n[i]===240&&(n[i+1]&240)===128||n[i]===244&&n[i+1]>143||n[i]>244)return!1;i+=4}else return!1;return!0}function pu(n){return lu&&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:pu,isValidStatusCode:gu,isValidUTF8:Hr,tokenChars:hu};if(vo)Hn.exports.isValidUTF8=function(n){return n.length<24?Hr(n):vo(n)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let n=$("utf-8-validate");Hn.exports.isValidUTF8=function(e){return e.length<32?Hr(e):n(e)}}catch{}});var Jr=ce((Ug,Io)=>{"use strict";var{Writable:mu}=$("stream"),So=yt(),{BINARY_TYPES:wu,EMPTY_BUFFER:Eo,kStatusCode:_u,kWebSocket:yu}=ze(),{concat:Gr,toArrayBuffer:bu,unmask:vu}=Ht(),{isValidStatusCode:Su,isValidUTF8:Co}=bt(),Gn=Buffer[Symbol.species],le=0,Ao=1,ko=2,Po=3,jr=4,Kr=5,jn=6,Wr=class extends mu{constructor(e={}){super(),this._allowSynchronousEvents=e.allowSynchronousEvents!==void 0?e.allowSynchronousEvents:!0,this._binaryType=e.binaryType||wu[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=le}_write(e,i,a){if(this._opcode===8&&this._state==le)return a();this._bufferedBytes+=e.length,this._buffers.push(e),this.startLoop(a)}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){let a=this._buffers[0];return this._buffers[0]=new Gn(a.buffer,a.byteOffset+e,a.length-e),new Gn(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 Gn(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 le:this.getInfo(e);break;case Ao:this.getPayloadLength16(e);break;case ko:this.getPayloadLength64(e);break;case Po:this.getMask();break;case jr:this.getData(e);break;case Kr:case jn: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[So.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=Ao:this._payloadLength===127?this._state=ko: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=Po:this._state=jr}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=jr}getData(e){let i=Eo;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&&vu(i,this._mask)}if(this._opcode>7){this.controlMessage(i,e);return}if(this._compressed){this._state=Kr,this.decompress(i,e);return}i.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(i)),this.dataMessage(e)}decompress(e,i){this._extensions[So.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===le&&this.startLoop(i)})}dataMessage(e){if(!this._fin){this._state=le;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=Gr(a,i):this._binaryType==="arraybuffer"?c=bu(Gr(a,i)):this._binaryType==="blob"?c=new Blob(a):c=a,this._allowSynchronousEvents?(this.emit("message",c,!0),this._state=le):(this._state=jn,setImmediate(()=>{this.emit("message",c,!0),this._state=le,this.startLoop(e)}))}else{let c=Gr(a,i);if(!this._skipUTF8Validation&&!Co(c)){let u=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");e(u);return}this._state===Kr||this._allowSynchronousEvents?(this.emit("message",c,!1),this._state=le):(this._state=jn,setImmediate(()=>{this.emit("message",c,!1),this._state=le,this.startLoop(e)}))}}controlMessage(e,i){if(this._opcode===8){if(e.length===0)this._loop=!1,this.emit("conclude",1005,Eo),this.end();else{let a=e.readUInt16BE(0);if(!Su(a)){let u=this.createError(RangeError,`invalid status code ${a}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");i(u);return}let c=new Gn(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!Co(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=le;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?"ping":"pong",e),this._state=le):(this._state=jn,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",e),this._state=le,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[_u]=c,f}};Io.exports=Wr});var Xr=ce((Gg,Ro)=>{"use strict";var{Duplex:Hg}=$("stream"),{randomFillSync:Eu}=$("crypto"),Do=yt(),{EMPTY_BUFFER:Cu,kWebSocket:Au,NOOP:ku}=ze(),{isBlob:vt,isValidStatusCode:Pu}=bt(),{mask:To,toBuffer:et}=Ht(),he=Symbol("kByteLength"),Iu=Buffer.alloc(4),Kn=8*1024,nt,St=Kn,_e=0,Du=1,Tu=2,Vr=class n{constructor(e,i,a){this._extensions=i||{},a&&(this._generateMask=a,this._maskBuffer=Buffer.alloc(4)),this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=_e,this.onerror=ku,this[Au]=void 0}static frame(e,i){let a,c=!1,u=2,f=!1;i.mask&&(a=i.maskBuffer||Iu,i.generateMask?i.generateMask(a):(St===Kn&&(nt===void 0&&(nt=Buffer.alloc(Kn)),Eu(nt,0,Kn),St=0),a[0]=nt[St++],a[1]=nt[St++],a[2]=nt[St++],a[3]=nt[St++]),f=(a[0]|a[1]|a[2]|a[3])===0,u=6);let l;typeof e=="string"?(!i.mask||f)&&i[he]!==void 0?l=i[he]:(e=Buffer.from(e),l=e.length):(l=e.length,c=i.mask&&i.readOnly&&!f);let p=l;l>=65536?(u+=8,p=127):l>125&&(u+=2,p=126);let w=Buffer.allocUnsafe(c?l+u:u);return w[0]=i.fin?i.opcode|128:i.opcode,i.rsv1&&(w[0]|=64),w[1]=p,p===126?w.writeUInt16BE(l,2):p===127&&(w[2]=w[3]=0,w.writeUIntBE(l,4,6)),i.mask?(w[1]|=128,w[u-4]=a[0],w[u-3]=a[1],w[u-2]=a[2],w[u-1]=a[3],f?[w,e]:c?(To(e,a,w,u,l),[w]):(To(e,a,e,0,l),[w,e])):[w,e]}close(e,i,a,c){let u;if(e===void 0)u=Cu;else{if(typeof e!="number"||!Pu(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 l=Buffer.byteLength(i);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 i=="string"?u.write(i,2):u.set(i,2)}}let f={[he]:u.length,fin:!0,generateMask:this._generateMask,mask:a,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state!==_e?this.enqueue([this.dispatch,u,!1,f,c]):this.sendFrame(n.frame(u,f),c)}ping(e,i,a){let c,u;if(typeof e=="string"?(c=Buffer.byteLength(e),u=!1):vt(e)?(c=e.size,u=!1):(e=et(e),c=e.length,u=et.readOnly),c>125)throw new RangeError("The data size must not be greater than 125 bytes");let f={[he]:c,fin:!0,generateMask:this._generateMask,mask:i,maskBuffer:this._maskBuffer,opcode:9,readOnly:u,rsv1:!1};vt(e)?this._state!==_e?this.enqueue([this.getBlobData,e,!1,f,a]):this.getBlobData(e,!1,f,a):this._state!==_e?this.enqueue([this.dispatch,e,!1,f,a]):this.sendFrame(n.frame(e,f),a)}pong(e,i,a){let c,u;if(typeof e=="string"?(c=Buffer.byteLength(e),u=!1):vt(e)?(c=e.size,u=!1):(e=et(e),c=e.length,u=et.readOnly),c>125)throw new RangeError("The data size must not be greater than 125 bytes");let f={[he]:c,fin:!0,generateMask:this._generateMask,mask:i,maskBuffer:this._maskBuffer,opcode:10,readOnly:u,rsv1:!1};vt(e)?this._state!==_e?this.enqueue([this.getBlobData,e,!1,f,a]):this.getBlobData(e,!1,f,a):this._state!==_e?this.enqueue([this.dispatch,e,!1,f,a]):this.sendFrame(n.frame(e,f),a)}send(e,i,a){let c=this._extensions[Do.extensionName],u=i.binary?2:1,f=i.compress,l,p;typeof e=="string"?(l=Buffer.byteLength(e),p=!1):vt(e)?(l=e.size,p=!1):(e=et(e),l=e.length,p=et.readOnly),this._firstFragment?(this._firstFragment=!1,f&&c&&c.params[c._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(f=l>=c._threshold),this._compress=f):(f=!1,u=0),i.fin&&(this._firstFragment=!0);let w={[he]:l,fin:i.fin,generateMask:this._generateMask,mask:i.mask,maskBuffer:this._maskBuffer,opcode:u,readOnly:p,rsv1:f};vt(e)?this._state!==_e?this.enqueue([this.getBlobData,e,this._compress,w,a]):this.getBlobData(e,this._compress,w,a):this._state!==_e?this.enqueue([this.dispatch,e,this._compress,w,a]):this.dispatch(e,this._compress,w,a)}getBlobData(e,i,a,c){this._bufferedBytes+=a[he],this._state=Tu,e.arrayBuffer().then(u=>{if(this._socket.destroyed){let l=new Error("The socket was closed while the blob was being read");process.nextTick($r,this,l,c);return}this._bufferedBytes-=a[he];let f=et(u);i?this.dispatch(f,i,a,c):(this._state=_e,this.sendFrame(n.frame(f,a),c),this.dequeue())}).catch(u=>{process.nextTick(Ru,this,u,c)})}dispatch(e,i,a,c){if(!i){this.sendFrame(n.frame(e,a),c);return}let u=this._extensions[Do.extensionName];this._bufferedBytes+=a[he],this._state=Du,u.compress(e,a.fin,(f,l)=>{if(this._socket.destroyed){let p=new Error("The socket was closed while data was being compressed");$r(this,p,c);return}this._bufferedBytes-=a[he],this._state=_e,a.readOnly=!1,this.sendFrame(n.frame(l,a),c),this.dequeue()})}dequeue(){for(;this._state===_e&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[3][he],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][he],this._queue.push(e)}sendFrame(e,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)}};Ro.exports=Vr;function $r(n,e,i){typeof i=="function"&&i(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 Ru(n,e,i){$r(n,e,i),n.onerror(e)}});var Uo=ce((jg,Fo)=>{"use strict";var{kForOnEventAttribute:jt,kListener:Yr}=ze(),No=Symbol("kCode"),Lo=Symbol("kData"),Oo=Symbol("kError"),Bo=Symbol("kMessage"),Mo=Symbol("kReason"),Et=Symbol("kTarget"),zo=Symbol("kType"),qo=Symbol("kWasClean"),Fe=class{constructor(e){this[Et]=null,this[zo]=e}get target(){return this[Et]}get type(){return this[zo]}};Object.defineProperty(Fe.prototype,"target",{enumerable:!0});Object.defineProperty(Fe.prototype,"type",{enumerable:!0});var rt=class extends Fe{constructor(e,i={}){super(e),this[No]=i.code===void 0?0:i.code,this[Mo]=i.reason===void 0?"":i.reason,this[qo]=i.wasClean===void 0?!1:i.wasClean}get code(){return this[No]}get reason(){return this[Mo]}get wasClean(){return this[qo]}};Object.defineProperty(rt.prototype,"code",{enumerable:!0});Object.defineProperty(rt.prototype,"reason",{enumerable:!0});Object.defineProperty(rt.prototype,"wasClean",{enumerable:!0});var Ct=class extends Fe{constructor(e,i={}){super(e),this[Oo]=i.error===void 0?null:i.error,this[Bo]=i.message===void 0?"":i.message}get error(){return this[Oo]}get message(){return this[Bo]}};Object.defineProperty(Ct.prototype,"error",{enumerable:!0});Object.defineProperty(Ct.prototype,"message",{enumerable:!0});var Kt=class extends Fe{constructor(e,i={}){super(e),this[Lo]=i.data===void 0?null:i.data}get data(){return this[Lo]}};Object.defineProperty(Kt.prototype,"data",{enumerable:!0});var Nu={addEventListener(n,e,i={}){for(let c of this.listeners(n))if(!i[jt]&&c[Yr]===e&&!c[jt])return;let a;if(n==="message")a=function(u,f){let l=new Kt("message",{data:f?u:u.toString()});l[Et]=this,Wn(e,this,l)};else if(n==="close")a=function(u,f){let l=new rt("close",{code:u,reason:f.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});l[Et]=this,Wn(e,this,l)};else if(n==="error")a=function(u){let f=new Ct("error",{error:u,message:u.message});f[Et]=this,Wn(e,this,f)};else if(n==="open")a=function(){let u=new Fe("open");u[Et]=this,Wn(e,this,u)};else return;a[jt]=!!i[jt],a[Yr]=e,i.once?this.once(n,a):this.on(n,a)},removeEventListener(n,e){for(let i of this.listeners(n))if(i[Yr]===e&&!i[jt]){this.removeListener(n,i);break}}};Fo.exports={CloseEvent:rt,ErrorEvent:Ct,Event:Fe,EventTarget:Nu,MessageEvent:Kt};function Wn(n,e,i){typeof n=="object"&&n.handleEvent?n.handleEvent.call(n,i):n.call(e,i)}});var Jn=ce((Kg,Ho)=>{"use strict";var{tokenChars:Wt}=bt();function Ie(n,e,i){n[e]===void 0?n[e]=[i]:n[e].push(i)}function Lu(n){let e=Object.create(null),i=Object.create(null),a=!1,c=!1,u=!1,f,l,p=-1,w=-1,y=-1,_=0;for(;_<n.length;_++)if(w=n.charCodeAt(_),f===void 0)if(y===-1&&Wt[w]===1)p===-1&&(p=_);else if(_!==0&&(w===32||w===9))y===-1&&p!==-1&&(y=_);else if(w===59||w===44){if(p===-1)throw new SyntaxError(`Unexpected character at index ${_}`);y===-1&&(y=_);let P=n.slice(p,y);w===44?(Ie(e,P,i),i=Object.create(null)):f=P,p=y=-1}else throw new SyntaxError(`Unexpected character at index ${_}`);else if(l===void 0)if(y===-1&&Wt[w]===1)p===-1&&(p=_);else if(w===32||w===9)y===-1&&p!==-1&&(y=_);else if(w===59||w===44){if(p===-1)throw new SyntaxError(`Unexpected character at index ${_}`);y===-1&&(y=_),Ie(i,n.slice(p,y),!0),w===44&&(Ie(e,f,i),i=Object.create(null),f=void 0),p=y=-1}else if(w===61&&p!==-1&&y===-1)l=n.slice(p,_),p=y=-1;else throw new SyntaxError(`Unexpected character at index ${_}`);else if(c){if(Wt[w]!==1)throw new SyntaxError(`Unexpected character at index ${_}`);p===-1?p=_:a||(a=!0),c=!1}else if(u)if(Wt[w]===1)p===-1&&(p=_);else if(w===34&&p!==-1)u=!1,y=_;else if(w===92)c=!0;else throw new SyntaxError(`Unexpected character at index ${_}`);else if(w===34&&n.charCodeAt(_-1)===61)u=!0;else if(y===-1&&Wt[w]===1)p===-1&&(p=_);else if(p!==-1&&(w===32||w===9))y===-1&&(y=_);else if(w===59||w===44){if(p===-1)throw new SyntaxError(`Unexpected character at index ${_}`);y===-1&&(y=_);let P=n.slice(p,y);a&&(P=P.replace(/\\/g,""),a=!1),Ie(i,l,P),w===44&&(Ie(e,f,i),i=Object.create(null),f=void 0),l=void 0,p=y=-1}else throw new SyntaxError(`Unexpected character at index ${_}`);if(p===-1||u||w===32||w===9)throw new SyntaxError("Unexpected end of input");y===-1&&(y=_);let C=n.slice(p,y);return f===void 0?Ie(e,C,i):(l===void 0?Ie(i,C,!0):a?Ie(i,l,C.replace(/\\/g,"")):Ie(i,l,C),Ie(e,f,i)),e}function Ou(n){return Object.keys(n).map(e=>{let i=n[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(", ")}Ho.exports={format:Ou,parse:Lu}});var Yn=ce((Vg,ea)=>{"use strict";var Bu=$("events"),Mu=$("https"),zu=$("http"),Ko=$("net"),qu=$("tls"),{randomBytes:Fu,createHash:Uu}=$("crypto"),{Duplex:Wg,Readable:Jg}=$("stream"),{URL:Zr}=$("url"),$e=yt(),Hu=Jr(),Gu=Xr(),{isBlob:ju}=bt(),{BINARY_TYPES:Go,CLOSE_TIMEOUT:Ku,EMPTY_BUFFER:Vn,GUID:Wu,kForOnEventAttribute:Qr,kListener:Ju,kStatusCode:Vu,kWebSocket:te,NOOP:Wo}=ze(),{EventTarget:{addEventListener:$u,removeEventListener:Xu}}=Uo(),{format:Yu,parse:Zu}=Jn(),{toBuffer:Qu}=Ht(),Jo=Symbol("kAborted"),es=[8,13],Ue=["CONNECTING","OPEN","CLOSING","CLOSED"],ef=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,G=class n extends Bu{constructor(e,i,a){super(),this._binaryType=Go[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=Vn,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,i===void 0?i=[]:Array.isArray(i)||(typeof i=="object"&&i!==null?(a=i,i=[]):i=[i]),Vo(this,e,i,a)):(this._autoPong=a.autoPong,this._closeTimeout=a.closeTimeout,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(e){Go.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 Hu({allowSynchronousEvents:a.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:a.maxPayload,skipUTF8Validation:a.skipUTF8Validation}),u=new Gu(e,this._extensions,a.generateMask);this._receiver=c,this._sender=u,this._socket=e,c[te]=this,u[te]=this,e[te]=this,c.on("conclude",rf),c.on("drain",sf),c.on("error",of),c.on("message",af),c.on("ping",cf),c.on("pong",xf),u.onerror=uf,e.setTimeout&&e.setTimeout(0),e.setNoDelay&&e.setNoDelay(),i.length>0&&e.unshift(i),e.on("close",Yo),e.on("data",Xn),e.on("end",Zo),e.on("error",Qo),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[$e.extensionName]&&this._extensions[$e.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=n.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(e,i){if(this.readyState!==n.CLOSED){if(this.readyState===n.CONNECTING){fe(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,i,!this._isServer,a=>{a||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),Xo(this)}}pause(){this.readyState===n.CONNECTING||this.readyState===n.CLOSED||(this._paused=!0,this._socket.pause())}ping(e,i,a){if(this.readyState===n.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!==n.OPEN){ts(this,e,a);return}i===void 0&&(i=!this._isServer),this._sender.ping(e||Vn,i,a)}pong(e,i,a){if(this.readyState===n.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!==n.OPEN){ts(this,e,a);return}i===void 0&&(i=!this._isServer),this._sender.pong(e||Vn,i,a)}resume(){this.readyState===n.CONNECTING||this.readyState===n.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(e,i,a){if(this.readyState===n.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!==n.OPEN){ts(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||Vn,c,a)}terminate(){if(this.readyState!==n.CLOSED){if(this.readyState===n.CONNECTING){fe(this,this._req,"WebSocket was closed before the connection was established");return}this._socket&&(this._readyState=n.CLOSING,this._socket.destroy())}}};Object.defineProperty(G,"CONNECTING",{enumerable:!0,value:Ue.indexOf("CONNECTING")});Object.defineProperty(G.prototype,"CONNECTING",{enumerable:!0,value:Ue.indexOf("CONNECTING")});Object.defineProperty(G,"OPEN",{enumerable:!0,value:Ue.indexOf("OPEN")});Object.defineProperty(G.prototype,"OPEN",{enumerable:!0,value:Ue.indexOf("OPEN")});Object.defineProperty(G,"CLOSING",{enumerable:!0,value:Ue.indexOf("CLOSING")});Object.defineProperty(G.prototype,"CLOSING",{enumerable:!0,value:Ue.indexOf("CLOSING")});Object.defineProperty(G,"CLOSED",{enumerable:!0,value:Ue.indexOf("CLOSED")});Object.defineProperty(G.prototype,"CLOSED",{enumerable:!0,value:Ue.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(n=>{Object.defineProperty(G.prototype,n,{enumerable:!0})});["open","error","close","message"].forEach(n=>{Object.defineProperty(G.prototype,`on${n}`,{enumerable:!0,get(){for(let e of this.listeners(n))if(e[Qr])return e[Ju];return null},set(e){for(let i of this.listeners(n))if(i[Qr]){this.removeListener(n,i);break}typeof e=="function"&&this.addEventListener(n,e,{[Qr]:!0})}})});G.prototype.addEventListener=$u;G.prototype.removeEventListener=Xu;ea.exports=G;function Vo(n,e,i,a){let c={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:Ku,protocolVersion:es[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,!es.includes(c.protocolVersion))throw new RangeError(`Unsupported protocol version: ${c.protocolVersion} (supported versions: ${es.join(", ")})`);let u;if(e instanceof Zr)u=e;else try{u=new Zr(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 f=u.protocol==="wss:",l=u.protocol==="ws+unix:",p;if(u.protocol!=="ws:"&&!f&&!l?p=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:l&&!u.pathname?p="The URL's pathname is empty":u.hash&&(p="The URL contains a fragment identifier"),p){let R=new SyntaxError(p);if(n._redirects===0)throw R;$n(n,R);return}let w=f?443:80,y=Fu(16).toString("base64"),_=f?Mu.request:zu.request,C=new Set,P;if(c.createConnection=c.createConnection||(f?nf:tf),c.defaultPort=c.defaultPort||w,c.port=u.port||w,c.host=u.hostname.startsWith("[")?u.hostname.slice(1,-1):u.hostname,c.headers={...c.headers,"Sec-WebSocket-Version":c.protocolVersion,"Sec-WebSocket-Key":y,Connection:"Upgrade",Upgrade:"websocket"},c.path=u.pathname+u.search,c.timeout=c.handshakeTimeout,c.perMessageDeflate&&(P=new $e({...c.perMessageDeflate,isServer:!1,maxPayload:c.maxPayload}),c.headers["Sec-WebSocket-Extensions"]=Yu({[$e.extensionName]:P.offer()})),i.length){for(let R of i){if(typeof R!="string"||!ef.test(R)||C.has(R))throw new SyntaxError("An invalid or duplicated subprotocol was specified");C.add(R)}c.headers["Sec-WebSocket-Protocol"]=i.join(",")}if(c.origin&&(c.protocolVersion<13?c.headers["Sec-WebSocket-Origin"]=c.origin:c.headers.Origin=c.origin),(u.username||u.password)&&(c.auth=`${u.username}:${u.password}`),l){let R=c.path.split(":");c.socketPath=R[0],c.path=R[1]}let I;if(c.followRedirects){if(n._redirects===0){n._originalIpc=l,n._originalSecure=f,n._originalHostOrSocketPath=l?c.socketPath:u.host;let R=a&&a.headers;if(a={...a,headers:{}},R)for(let[U,Y]of Object.entries(R))a.headers[U.toLowerCase()]=Y}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&&!f)&&(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")),I=n._req=_(c),n._redirects&&n.emit("redirect",n.url,I)}else I=n._req=_(c);c.timeout&&I.on("timeout",()=>{fe(n,I,"Opening handshake has timed out")}),I.on("error",R=>{I===null||I[Jo]||(I=n._req=null,$n(n,R))}),I.on("response",R=>{let U=R.headers.location,Y=R.statusCode;if(U&&c.followRedirects&&Y>=300&&Y<400){if(++n._redirects>c.maxRedirects){fe(n,I,"Maximum redirects exceeded");return}I.abort();let re;try{re=new Zr(U,e)}catch{let Z=new SyntaxError(`Invalid URL: ${U}`);$n(n,Z);return}Vo(n,re,i,a)}else n.emit("unexpected-response",I,R)||fe(n,I,`Unexpected server response: ${R.statusCode}`)}),I.on("upgrade",(R,U,Y)=>{if(n.emit("upgrade",R),n.readyState!==G.CONNECTING)return;I=n._req=null;let re=R.headers.upgrade;if(re===void 0||re.toLowerCase()!=="websocket"){fe(n,U,"Invalid Upgrade header");return}let ee=Uu("sha1").update(y+Wu).digest("base64");if(R.headers["sec-websocket-accept"]!==ee){fe(n,U,"Invalid Sec-WebSocket-Accept header");return}let Z=R.headers["sec-websocket-protocol"],k;if(Z!==void 0?C.size?C.has(Z)||(k="Server sent an invalid subprotocol"):k="Server sent a subprotocol but none was requested":C.size&&(k="Server sent no subprotocol"),k){fe(n,U,k);return}Z&&(n._protocol=Z);let H=R.headers["sec-websocket-extensions"];if(H!==void 0){if(!P){fe(n,U,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let W;try{W=Zu(H)}catch{fe(n,U,"Invalid Sec-WebSocket-Extensions header");return}let se=Object.keys(W);if(se.length!==1||se[0]!==$e.extensionName){fe(n,U,"Server indicated an extension that was not requested");return}try{P.accept(W[$e.extensionName])}catch{fe(n,U,"Invalid Sec-WebSocket-Extensions header");return}n._extensions[$e.extensionName]=P}n.setSocket(U,Y,{allowSynchronousEvents:c.allowSynchronousEvents,generateMask:c.generateMask,maxPayload:c.maxPayload,skipUTF8Validation:c.skipUTF8Validation})}),c.finishRequest?c.finishRequest(I,n):I.end()}function $n(n,e){n._readyState=G.CLOSING,n._errorEmitted=!0,n.emit("error",e),n.emitClose()}function tf(n){return n.path=n.socketPath,Ko.connect(n)}function nf(n){return n.path=void 0,!n.servername&&n.servername!==""&&(n.servername=Ko.isIP(n.host)?"":n.host),qu.connect(n)}function fe(n,e,i){n._readyState=G.CLOSING;let a=new Error(i);Error.captureStackTrace(a,fe),e.setHeader?(e[Jo]=!0,e.abort(),e.socket&&!e.socket.destroyed&&e.socket.destroy(),process.nextTick($n,n,a)):(e.destroy(a),e.once("error",n.emit.bind(n,"error")),e.once("close",n.emitClose.bind(n)))}function ts(n,e,i){if(e){let a=ju(e)?e.size:Qu(e).length;n._socket?n._sender._bufferedBytes+=a:n._bufferedAmount+=a}if(i){let a=new Error(`WebSocket is not open: readyState ${n.readyState} (${Ue[n.readyState]})`);process.nextTick(i,a)}}function rf(n,e){let i=this[te];i._closeFrameReceived=!0,i._closeMessage=e,i._closeCode=n,i._socket[te]!==void 0&&(i._socket.removeListener("data",Xn),process.nextTick($o,i._socket),n===1005?i.close():i.close(n,e))}function sf(){let n=this[te];n.isPaused||n._socket.resume()}function of(n){let e=this[te];e._socket[te]!==void 0&&(e._socket.removeListener("data",Xn),process.nextTick($o,e._socket),e.close(n[Vu])),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",n))}function jo(){this[te].emitClose()}function af(n,e){this[te].emit("message",n,e)}function cf(n){let e=this[te];e._autoPong&&e.pong(n,!this._isServer,Wo),e.emit("ping",n)}function xf(n){this[te].emit("pong",n)}function $o(n){n.resume()}function uf(n){let e=this[te];e.readyState!==G.CLOSED&&(e.readyState===G.OPEN&&(e._readyState=G.CLOSING,Xo(e)),this._socket.end(),e._errorEmitted||(e._errorEmitted=!0,e.emit("error",n)))}function Xo(n){n._closeTimer=setTimeout(n._socket.destroy.bind(n._socket),n._closeTimeout)}function Yo(){let n=this[te];if(this.removeListener("close",Yo),this.removeListener("data",Xn),this.removeListener("end",Zo),n._readyState=G.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[te]=void 0,clearTimeout(n._closeTimer),n._receiver._writableState.finished||n._receiver._writableState.errorEmitted?n.emitClose():(n._receiver.on("error",jo),n._receiver.on("finish",jo))}function Xn(n){this[te]._receiver.write(n)||this.pause()}function Zo(){let n=this[te];n._readyState=G.CLOSING,n._receiver.end(),this.end()}function Qo(){let n=this[te];this.removeListener("error",Qo),this.on("error",Wo),n&&(n._readyState=G.CLOSING,this.destroy())}});var sa=ce((Xg,ra)=>{"use strict";var $g=Yn(),{Duplex:ff}=$("stream");function ta(n){n.emit("close")}function df(){!this.destroyed&&this._writableState.finished&&this.destroy()}function na(n){this.removeListener("error",na),this.destroy(),this.listenerCount("error")===0&&this.emit("error",n)}function lf(n,e){let i=!0,a=new ff({...e,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return n.on("message",function(u,f){let l=!f&&a._readableState.objectMode?u.toString():u;a.push(l)||n.pause()}),n.once("error",function(u){a.destroyed||(i=!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(ta,a);return}let f=!1;n.once("error",function(p){f=!0,u(p)}),n.once("close",function(){f||u(c),process.nextTick(ta,a)}),i&&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,f){if(n.readyState===n.CONNECTING){n.once("open",function(){a._write(c,u,f)});return}n.send(c,f)},a.on("end",df),a.on("error",na),a}ra.exports=lf});var ns=ce((Yg,ia)=>{"use strict";var{tokenChars:hf}=bt();function gf(n){let e=new Set,i=-1,a=-1,c=0;for(c;c<n.length;c++){let f=n.charCodeAt(c);if(a===-1&&hf[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 l=n.slice(i,a);if(e.has(l))throw new SyntaxError(`The "${l}" subprotocol is duplicated`);e.add(l),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=n.slice(i,c);if(e.has(u))throw new SyntaxError(`The "${u}" subprotocol is duplicated`);return e.add(u),e}ia.exports={parse:gf}});var da=ce((Qg,fa)=>{"use strict";var pf=$("events"),Zn=$("http"),{Duplex:Zg}=$("stream"),{createHash:mf}=$("crypto"),oa=Jn(),st=yt(),wf=ns(),_f=Yn(),{CLOSE_TIMEOUT:yf,GUID:bf,kWebSocket:vf}=ze(),Sf=/^[+/0-9A-Za-z]{22}==$/,aa=0,ca=1,ua=2,rs=class extends pf{constructor(e,i){if(super(),e={allowSynchronousEvents:!0,autoPong:!0,maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:yf,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:_f,...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=Zn.createServer((a,c)=>{let u=Zn.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=Ef(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=aa}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===ua){e&&this.once("close",()=>{e(new Error("The server is not running"))}),process.nextTick(Jt,this);return}if(e&&this.once("close",e),this._state!==ca)if(this._state=ca,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients?this.clients.size?this._shouldEmitClose=!0:process.nextTick(Jt,this):process.nextTick(Jt,this);else{let i=this._server;this._removeListeners(),this._removeListeners=this._server=null,i.close(()=>{Jt(this)})}}shouldHandle(e){if(this.options.path){let i=e.url.indexOf("?");if((i!==-1?e.url.slice(0,i):e.url)!==this.options.path)return!1}return!0}handleUpgrade(e,i,a,c){i.on("error",xa);let u=e.headers["sec-websocket-key"],f=e.headers.upgrade,l=+e.headers["sec-websocket-version"];if(e.method!=="GET"){it(this,e,i,405,"Invalid HTTP method");return}if(f===void 0||f.toLowerCase()!=="websocket"){it(this,e,i,400,"Invalid Upgrade header");return}if(u===void 0||!Sf.test(u)){it(this,e,i,400,"Missing or invalid Sec-WebSocket-Key header");return}if(l!==13&&l!==8){it(this,e,i,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});return}if(!this.shouldHandle(e)){Vt(i,400);return}let p=e.headers["sec-websocket-protocol"],w=new Set;if(p!==void 0)try{w=wf.parse(p)}catch{it(this,e,i,400,"Invalid Sec-WebSocket-Protocol header");return}let y=e.headers["sec-websocket-extensions"],_={};if(this.options.perMessageDeflate&&y!==void 0){let C=new st({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let P=oa.parse(y);P[st.extensionName]&&(C.accept(P[st.extensionName]),_[st.extensionName]=C)}catch{it(this,e,i,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let C={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(C,(P,I,R,U)=>{if(!P)return Vt(i,I||401,R,U);this.completeUpgrade(_,u,w,e,i,a,c)});return}if(!this.options.verifyClient(C))return Vt(i,401)}this.completeUpgrade(_,u,w,e,i,a,c)}completeUpgrade(e,i,a,c,u,f,l){if(!u.readable||!u.writable)return u.destroy();if(u[vf])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>aa)return Vt(u,503);let w=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${mf("sha1").update(i+bf).digest("base64")}`],y=new this.options.WebSocket(null,void 0,this.options);if(a.size){let _=this.options.handleProtocols?this.options.handleProtocols(a,c):a.values().next().value;_&&(w.push(`Sec-WebSocket-Protocol: ${_}`),y._protocol=_)}if(e[st.extensionName]){let _=e[st.extensionName].params,C=oa.format({[st.extensionName]:[_]});w.push(`Sec-WebSocket-Extensions: ${C}`),y._extensions=e}this.emit("headers",w,c),u.write(w.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",xa),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(Jt,this)})),l(y,c)}};fa.exports=rs;function Ef(n,e){for(let i of Object.keys(e))n.on(i,e[i]);return function(){for(let a of Object.keys(e))n.removeListener(a,e[a])}}function Jt(n){n._state=ua,n.emit("close")}function xa(){this.destroy()}function Vt(n,e,i,a){i=i||Zn.STATUS_CODES[e],a={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(i),...a},n.once("finish",n.destroy),n.end(`HTTP/1.1 ${e} ${Zn.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 it(n,e,i,a,c,u){if(n.listenerCount("wsClientError")){let f=new Error(c);Error.captureStackTrace(f,it),n.emit("wsClientError",f,i,e)}else Vt(i,a,c,u)}});import{spawn as Wf}from"node:child_process";import{existsSync as Jf,openSync as Vf}from"node:fs";import{mkdir as $f}from"node:fs/promises";import{dirname as Xf}from"node:path";import{fileURLToPath as Yf}from"node:url";function os(n=K()){return Jf(n.libEntry)?n.libEntry:Yf(new URL("../index.ts",import.meta.url))}async function ka(n={}){let e=n.paths??K(),i=n.entryOverride??os(e);await $f(Xf(e.logFile),{recursive:!0});let a=Vf(e.logFile,"a"),u=i.endsWith(".ts")?["--import","tsx/esm",i,"--daemon"]:[i,"--daemon"],f=Wf(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 Zf.info("daemon spawned",{pid:f.pid,entry:i}),{pid:f.pid,entry:i}}var Zf,as=Le(()=>{"use strict";F();xe();Zf=T("spawn-daemon")});import{spawn as od}from"node:child_process";import{mkdir as ad,unlink as cd,writeFile as xd}from"node:fs/promises";import{dirname as ud,join as fd}from"node:path";function sr(n){return n.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;")}function Ra(n,e){return new Promise((i,a)=>{let c=od(n,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(`${n} ${e.join(" ")} exited ${f}: ${u.trim()}`))})})}var rr,us,fs,Na=Le(()=>{"use strict";F();rr=T("supervisor.launchd"),us="ai.coze.bridge",fs={platform:"darwin",renderConfig(n){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>${us}</string>
22
+ <string>${hi}</string>
23
23
  <key>ProgramArguments</key>
24
24
  <array>
25
- <string>${sr(n.nodeBin)}</string>
26
- <string>${sr(n.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,12 +33,12 @@ var R0=Object.create;var yr=Object.defineProperty;var N0=Object.getOwnPropertyDe
33
33
  <key>ThrottleInterval</key>
34
34
  <integer>10</integer>
35
35
  <key>StandardOutPath</key>
36
- <string>${sr(n.logFile)}</string>
36
+ <string>${ar(n.logFile)}</string>
37
37
  <key>StandardErrorPath</key>
38
- <string>${sr(n.logFile)}</string>
38
+ <string>${ar(n.logFile)}</string>
39
39
  </dict>
40
40
  </plist>
41
- `},configPath(n){return fd(n.homeDir,"Library","LaunchAgents",`${us}.plist`)},async install(n){let e=this.configPath(n);await ad(ud(e),{recursive:!0}),await xd(e,this.renderConfig(n),"utf8"),rr.info("plist written",{plistPath:e}),await Ra("launchctl",["load","-w",e]),rr.info("launchd job loaded",{label:us})},async uninstall(n){let e=this.configPath(n);await Ra("launchctl",["unload","-w",e]).catch(i=>rr.warn("launchctl unload failed (ignored)",{err:String(i)})),await cd(e).catch(i=>{if(i.code!=="ENOENT")throw i}),rr.info("launchd job removed",{plistPath:e})}}});import{spawn as dd}from"node:child_process";import{mkdir as ld,unlink as hd,writeFile as gd}from"node:fs/promises";import{dirname as pd,join as md}from"node:path";function ar(n,e){return new Promise((i,a)=>{let c=dd(n,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(`${n} ${e.join(" ")} exited ${f}: ${u.trim()}`))})})}var ir,or,ds,La=Le(()=>{"use strict";F();ir=T("supervisor.systemd"),or="coze-bridge.service",ds={platform:"linux",renderConfig(n){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
 
@@ -52,7 +52,7 @@ StandardError=append:${n.logFile}
52
52
 
53
53
  [Install]
54
54
  WantedBy=default.target
55
- `},configPath(n){return md(n.homeDir,".config","systemd","user",or)},async install(n){let e=this.configPath(n);await ld(pd(e),{recursive:!0}),await gd(e,this.renderConfig(n),"utf8"),ir.info("systemd unit written",{unitPath:e}),await ar("systemctl",["--user","daemon-reload"]),await ar("systemctl",["--user","enable","--now",or]),ir.info("systemd unit enabled",{unitName:or})},async uninstall(n){let e=this.configPath(n);await ar("systemctl",["--user","disable","--now",or]).catch(i=>ir.warn("systemctl disable failed (ignored)",{err:String(i)})),await hd(e).catch(i=>{if(i.code!=="ENOENT")throw i}),await ar("systemctl",["--user","daemon-reload"]).catch(()=>{}),ir.info("systemd unit removed",{unitPath:e})}}});import{spawn as wd}from"node:child_process";import{join as _d}from"node:path";function Oa(n,e){return new Promise((i,a)=>{let c=wd(n,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(`${n} ${e.join(" ")} exited ${f}: ${u.trim()}`))})})}var ls,cr,hs,Ba=Le(()=>{"use strict";F();ls=T("supervisor.taskscheduler"),cr="CozeBridge",hs={platform:"win32",renderConfig(n){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>
@@ -76,25 +76,50 @@ WantedBy=default.target
76
76
  </Exec>
77
77
  </Actions>
78
78
  </Task>
79
- `},configPath(n){return _d(n.homeDir,".coze","bridge","task.xml")},async install(n){let e=`"${n.nodeBin}" "${n.entry}" --daemon`;await Oa("schtasks",["/Create","/SC","ONLOGON","/TN",cr,"/TR",e,"/RU",n.userName,"/F"]),ls.info("task scheduler entry created",{task:cr})},async uninstall(n){await Oa("schtasks",["/Delete","/TN",cr,"/F"]).catch(e=>ls.warn("schtasks /Delete failed (ignored)",{err:String(e)})),ls.info("task scheduler entry removed",{task:cr})}}});var gs={};Hs(gs,{buildContext:()=>Sd,getSupervisor:()=>vd,launchdSupervisor:()=>fs,systemdSupervisor:()=>ds,taskSchedulerSupervisor:()=>hs});import{homedir as yd,userInfo as bd}from"node:os";function vd(n=process.platform){switch(n){case"darwin":return fs;case"linux":return ds;case"win32":return hs;default:throw new Error(`unsupported platform for OS supervisor: ${n}`)}}function Sd(){let n=K();return{nodeBin:process.execPath,entry:os(n),logFile:n.logFile,homeDir:yd(),userName:bd().username}}var ps=Le(()=>{"use strict";xe();as();Na();La();Ba()});Ke();F();import{readdir as Q0}from"node:fs/promises";import{mkdir as V0,writeFile as $0}from"node:fs/promises";import{join as X0}from"node:path";var Y0={"claude-code":"CLAUDE.md",codex:"AGENTS.md",openclaw:"SOUL.md"};async function ft(n,e,i,a){await V0(n,{recursive:!0});let c=Y0[e],u=X0(n,c),f=Z0(e,i,a);return await $0(u,f,"utf8"),u}function Z0(n,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
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 ve=T("agent-detail-sync"),an=class{constructor(e){this.opts=e}opts;async syncAll(e){let i=this.opts.paths.agentsRoot,a;try{a=await Q0(i)}catch(c){ve.info("agents dir not found, skip detail sync",{root:i,err:String(c)});return}ve.info("starting detail sync",{reason:e,count:a.length});for(let c of a)try{await this.syncOne(c)}catch(u){ve.warn("detail sync failed for agent, skipping",{agentId:c,err:String(u)})}ve.info("detail sync done",{reason:e})}async syncOne(e){let i=await ue(e,this.opts.paths);if(!i){ve.info("detail sync: agent config missing, skip",{agentId:e});return}let a;try{a=await this.opts.sendDetail({_meta:{cozeAgentId:e}})}catch(f){ve.warn("detail RPC failed, using local data",{agentId:e,err:String(f)});return}if(a.agentId&&a.agentId!==e){ve.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&&ve.info("detail.deployType",{agentId:e,deployType:a.deployType}),!c){ve.debug("detail sync: no diff",{agentId:e});return}await we(i,this.opts.paths),ve.info("detail sync: config updated",{agentId:e,identityChanged:u,agentName:i.agentName}),u&&(await ft(i.workspace,i.framework,e,i.cozeIdentity),await this.opts.handlers.reloadAgentSessionsPublic(e,"detail-sync"))}};Ke();import{spawn as hi}from"node:child_process";import{lstat as Ar,mkdir as rc,readFile as gi,readdir as sc,rm as ic,stat as oc,writeFile as di}from"node:fs/promises";import{join as Ce,normalize as ac,relative as pi,resolve as cc,sep as mi}from"node:path";var Se={PAIR:"_agent/pair",CREATE:"_agent/create",HEALTH:"_agent/health",LIST_SKILLS:"_agent/listSkills",ADD_SKILLS:"_agent/addSkills",REMOVE_SKILLS:"_agent/removeSkills",GET_FILE_TREE:"_agent/getFileTree",GET_FILE_CONTENT:"_agent/getFileContent",DETAIL:"_agent/detail",UPDATE:"_agent/update",DISCONNECT:"_agent/disconnect",SWITCH_MODEL:"_agent/switchModel",GEN_MODEL_TOKEN:"_agent/genModelToken",RESET:"_agent/reset",REPAIR:"_agent/repair",DELETE:"_agent/delete"};function Tt(n){return n?.cozeDeployType==="cloud"?"cloud":"local"}function $s(n){let{_meta:e,...i}=n;return{stripped:i,meta:e}}function dt(n){if(!n?.cozeAgentId)throw new Error("missing _meta.cozeAgentId");return n.cozeAgentId}var S=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)}};F();xe();function cn(n){return n.startsWith("http://")||n.startsWith("https://")}function Me(n,e){if(Tt(n)!=="cloud")throw new S("OPERATION_NOT_ALLOWED_FOR_LOCAL",`${e} is not allowed for local agent`)}F();var xn="1008033",Xs="1289";var Ys="pbbp2",Zs="https://www.coze.cn",Qs="/api/coze_claw/resource/get_frontier_key",ec="https://www.coze.cn",tc="wss://frontier.coze.cn";function ei(n){return n??process.env.COZE_BRIDGE_HANDSHAKE_URL??ec}function ti(n){return n??process.env.COZE_BRIDGE_FRONTIER_URL??tc}function un(n){let e={},i=n?.ttEnv??process.env.COZE_BRIDGE_TT_ENV,a=n?.usePpe??process.env.COZE_BRIDGE_USE_PPE;return i&&(e["x-tt-env"]=i),a&&(e["x-use-ppe"]=a),e}function fn(n){return n?n.startsWith("boe_")?{ttEnv:n}:{ttEnv:n,usePpe:"1"}:{}}var ni=T("handshake");async function ri(n){let e=ei(n.endpoint),i=n.timeoutMs??1e4,a=`${nc(e)}${Qs}?aid=${encodeURIComponent(xn)}`,c={Authorization:`Bearer ${n.privatecode}`,Accept:"application/json",...un(n.ppeOverride)},u=new AbortController,f=setTimeout(()=>u.abort(),i);ni.info("frontier key handshake",{base:e});try{let l=await fetch(a,{method:"GET",headers:c,signal:u.signal}),p=l.headers.get("x-tt-logid")??"",w=l.headers.get("x-tt-trace-id")??"";if(!l.ok){let P=await l.text().catch(()=>"");throw new S("UPSTREAM_HANDSHAKE_FAILED",`handshake HTTP ${l.status} logid=${p}: ${P.slice(0,200)}`)}let y=await l.json();if(y.code!==void 0&&y.code!==0)throw new S("UPSTREAM_HANDSHAKE_FAILED",`handshake code=${y.code} msg=${y.msg??"-"} logid=${p}`);let _=y.data?.access_key,C=y.data?.device_id;if(!_||!C)throw new S("UPSTREAM_HANDSHAKE_FAILED",`handshake response missing access_key/device_id logid=${p}: ${JSON.stringify(y)}`);return ni.info("handshake ok",{remoteDeviceId:C,logid:p,traceId:w}),{accessKey:_,deviceId:C}}catch(l){throw l instanceof S?l:l.name==="AbortError"?new S("UPSTREAM_HANDSHAKE_FAILED",`handshake timeout (${i}ms)`):new S("UPSTREAM_HANDSHAKE_FAILED",String(l),{cause:l})}finally{clearTimeout(f)}}function nc(n){return n.endsWith("/")?n.slice(0,-1):n}var Sr="https://llm-gateway.coze.cn",Ee="auto";function si(n){return{model:n.model??Ee,...n.modelToken?{modelToken:n.modelToken}:{}}}function ii(n){return!n||n===Ee}function oi(n){let e={};return n.modelToken?(e.ANTHROPIC_BASE_URL=Sr,e.ANTHROPIC_AUTH_TOKEN=n.modelToken,e.ANTHROPIC_MODEL=n.model||Ee):ii(n.model)||(e.ANTHROPIC_MODEL=n.model),e}function ai(n){let e=[];return n.modelToken?e.push("-c",`model="${n.model||Ee}"`):ii(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="${Sr}/v1"`),e.push("-c",'model_providers.coze.env_key="OPENAI_API_KEY"'),e.push("-c",'model_providers.coze.wire_api="responses"'),e.push("-c","model_providers.coze.requires_openai_auth=false"),e.push("-c","model_providers.coze.supports_websockets=false"),e.push("-c",'model_provider="coze"')),e}function ci(n){return n.modelToken?{OPENAI_API_KEY:n.modelToken}:{}}function Er(n){let{ttEnv:e,usePpe:i}=fn(n),a={};return e&&(a["x-tt-env"]=e),i&&(a["x-use-ppe"]=i),a}function xi(n,e){if(!n.modelToken)return{};let i=Er(e);return Object.keys(i).length===0?{}:{ANTHROPIC_CUSTOM_HEADERS:Object.entries(i).map(([c,u])=>`${c}:${u}`).join(`
89
- `)}}function Cr(n){return`coze-session-${n.replace(/[^A-Za-z0-9_-]+/g,"-")}`}function ui(n,e){if(!n.modelToken)return null;let i=n.model||Ee,a=Er(e),c={baseUrl:`${Sr}/v1`,api:"openai-completions",apiKey:n.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(n,e){if(!n.modelToken)return[];let i=Er(e),a=[];for(let[c,u]of Object.entries(i))a.push("-c",`model_providers.coze.http_headers.${c}="${u}"`);return a}var oe=T("agent-handlers"),li=5*1024*1024,xc=1,uc=6,fc=new Set(["node_modules",".git",".coze","dist","build",".next"]),dn=class{constructor(e){this.opts=e}opts;async listSkills(e){Me(e._meta,"_agent/listSkills");let i=dt(e._meta),a=await this.loadAgentCfg(i),c=a?.workspace??Be(i).workspace,u=a?.skills??[],f=[];for(let l of u){let p=Ce(c,l.relPath,"SKILL.md");await oc(p).then(y=>y.isFile()).catch(()=>!1)&&f.push(pc(l))}return{skills:f}}async addSkills(e){Me(e._meta,"_agent/addSkills");let i=dt(e._meta),a=await this.requireAgentCfg(i),c=e.skills??[],u=[...a.skills??[]],f=new Map(u.map((p,w)=>[p.skillId,w])),l=[];for(let p of c){let w=await kr({agentId:i,workspace:a.workspace,framework:a.framework,skill:p});Pr(u,f,w),l.push(p)}return await sn(i,u),await this.reloadAgentSessions(i,"skills-added"),{installedSkills:l}}async removeSkills(e){Me(e._meta,"_agent/removeSkills");let i=dt(e._meta),a=await this.requireAgentCfg(i),c=new Set(e.skillIds??[]),u=a.skills??[],f=[];for(let l of u){if(!c.has(l.skillId)){f.push(l);continue}let p=Ce(a.workspace,l.relPath);await ic(p,{recursive:!0,force:!0}),oe.info("skill removed",{agentId:i,skillId:l.skillId,relPath:l.relPath})}return await sn(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}),oe.info("session reloaded",{reason:i,agentId:e,framework:a.framework,cloudId:c,acpId:u.acpSessionId})}catch(f){oe.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 oe.info("_agent/update: empty cozeIdentity, noop",{agentId:e.agentId}),{ok:!0};let i=e.agentId,a=await ue(i);if(!a)throw new S("AGENT_NOT_FOUND",`agent not found: ${i}`);return a.cozeIdentity===e.cozeIdentity?(oe.info("_agent/update: cozeIdentity unchanged, noop",{agentId:i}),{ok:!0}):(a.cozeIdentity=e.cozeIdentity,await we(a),await ft(a.workspace,a.framework,i,e.cozeIdentity),oe.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 S("IPC_BAD_REQUEST","_agent/disconnect: missing agentId");let a=await ue(i);return a?(a.disconnectedAt=Date.now(),a.disconnectReason=e.reason??"",await we(a),oe.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}):(oe.warn("_agent/disconnect: agent not found, ignoring",{agentId:i}),{ok:!0})}async switchModel(e){if(Me(e._meta,"_agent/switchModel"),!e.agentId)throw new S("IPC_BAD_REQUEST","_agent/switchModel: missing agentId");let i=e.model?.trim()?e.model:Ee,a=await ue(e.agentId);if(!a)throw new S("AGENT_NOT_FOUND",`agent not found: ${e.agentId}`);a.model=i,await we(a),oe.info("_agent/switchModel: model persisted",{agentId:e.agentId,model:i,reason:e.reason??""});let c=this.opts.agents.get(e.agentId);if(!c)return oe.info("_agent/switchModel: agent not running, config persisted only",{agentId:e.agentId}),{ok:!0};c.model=i;let u=[];for(let[f,l]of c.allSessionQueues())u.push(l.enqueue(async()=>{let p=c.sessions.get(f);p?.downstream&&(await p.downstream.stop(`switchModel: ${i}`).catch(()=>{}),p.downstream=void 0)}));return await Promise.all(u),oe.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(Me(e._meta,Se.RESET),!e.agentId)throw new S("IPC_BAD_REQUEST",`${Se.RESET}: missing agentId`);return await this.runDetailSync(e.agentId,Se.RESET,e.reason),{ok:!0}}async repairAgent(e){if(Me(e._meta,Se.REPAIR),!e.agentId)throw new S("IPC_BAD_REQUEST",`${Se.REPAIR}: missing agentId`);let i=await this.loadAgentCfg(e.agentId);if(i&&i.framework!=="openclaw")throw new S("IPC_BAD_REQUEST",`${Se.REPAIR} only allowed for openclaw, got ${i.framework}`);if(i&&this.opts.openclawRepair)try{await this.opts.openclawRepair(e.agentId,i.workspace)}catch(a){oe.warn("openclaw repair (delete+add) failed (ignored)",{agentId:e.agentId,reason:e.reason,err:String(a)})}return await this.runDetailSync(e.agentId,Se.REPAIR,e.reason),{ok:!0}}async runDetailSync(e,i,a){if(!this.opts.detailSyncer){oe.warn("detailSyncer not wired, skipping sync",{method:i,agentId:e});return}try{await this.opts.detailSyncer(e)}catch(c){oe.warn("detail sync failed (ignored)",{method:i,agentId:e,reason:a,err:String(c)})}}async getFileTree(e){Me(e._meta,"_agent/getFileTree");let i=e._meta,a=dt(i),c=await this.resolveWorkspace(a),u=e.filePath??"",f=this.safeJoin(c,u),l=await Ar(f).catch(()=>null);if(!l)throw new S("IPC_BAD_REQUEST",`path not found: ${u}`);if(l.isSymbolicLink())throw new S("IPC_BAD_REQUEST",`symlink not allowed: ${u}`);let p=vc(e.depth);return l.isDirectory()?{tree:await wi(c,f,u,p)}:{tree:[{name:Sc(u),path:_i(u||"."),isDir:!1,size:l.size,modifiedAt:Math.floor(l.mtimeMs)}]}}async getFileContent(e){Me(e._meta,"_agent/getFileContent");let i=dt(e._meta),a=await this.resolveWorkspace(i);if(!e.filePath)throw new S("IPC_BAD_REQUEST","filePath required");let c=this.safeJoin(a,e.filePath),u=await Ar(c).catch(()=>null);if(!u||!u.isFile())throw new S("IPC_BAD_REQUEST",`not a file: ${e.filePath}`);if(u.isSymbolicLink())throw new S("IPC_BAD_REQUEST",`symlink not allowed: ${e.filePath}`);if(u.size>li)throw new S("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 ue(e).catch(()=>null))?.workspace??Be(e).workspace}safeJoin(e,i){let a=cc(e,i||"."),c=pi(e,a);if(c.startsWith("..")||c===".."||c.startsWith(`..${mi}`))throw new S("IPC_BAD_REQUEST",`path escapes workspace: ${i}`);return a}loadAgentCfg(e){return ue(e)}async requireAgentCfg(e){let i=await this.loadAgentCfg(e);if(!i)throw new S("AGENT_NOT_FOUND",`no config for agent: ${e}`);return i}};function dc(n){let e=n.trim().replace(/[\x00-\x1f<>:"|?*/\\]+/g,"-").replace(/^[\s.-]+|[\s.-]+$/g,"").slice(0,64);if(!e||e==="."||e==="..")throw new S("IPC_BAD_REQUEST",`invalid skill name: ${n}`);if(/^(con|prn|aux|nul|com[1-9]|lpt[1-9])$/i.test(e))throw new S("IPC_BAD_REQUEST",`reserved windows filename: ${n}`);return e}function lc(n){return n==="claude-code"?Ce(".claude","skills"):Ce(".agents","skills")}var hc=3e4,gc=50*1024*1024,ln=3e4;async function kr(n){let{agentId:e,workspace:i,framework:a,skill:c}=n;if(!c.skillName)throw new S("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 S("IPC_BAD_REQUEST",`skill ${c.skillId} missing both content and downloadUrl`);let l=dc(c.skillName),p=lc(a),w=Ce(p,l),y=Ce(i,w);if(await rc(y,{recursive:!0}),u){let C=Buffer.from(c.content,"utf8");Rt(C.length),await di(Ce(y,"SKILL.md"),C,"utf8")}else{let C=await mc(c.downloadUrl);_c(C)?await yc(C,y):await di(Ce(y,"SKILL.md"),C.toString("utf8"),"utf8")}let _={skillId:c.skillId,skillName:c.skillName,relPath:w,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 oe.info("skill installed",{agentId:e,skillId:c.skillId,skillName:c.skillName,relPath:w,source:u?"content":"downloadUrl"}),_}function Pr(n,e,i){let a=e.get(i.skillId);if(a!==void 0){n[a]=i;return}e.set(i.skillId,n.length),n.push(i)}function pc(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 mc(n){if(!n)throw new S("IPC_BAD_REQUEST","skill missing downloadUrl");if(n.startsWith("data:")){let e=Math.floor(n.length*3/4);Rt(e);let i=wc(n);return Rt(i.length),i}if(n.startsWith("file:")){let e=new URL(n).pathname,i=await gi(e);return Rt(i.length),i}if(cn(n)){let e=new AbortController,i=setTimeout(()=>e.abort(),hc);try{let a=await fetch(n,{signal:e.signal});if(!a.ok)throw new S("IPC_BAD_REQUEST",`fetch skill failed HTTP ${a.status} ${n}`);let c=await a.arrayBuffer();return Rt(c.byteLength),Buffer.from(c)}finally{clearTimeout(i)}}throw new S("IPC_BAD_REQUEST",`unsupported downloadUrl scheme (\u8981 https/data/file): ${n.slice(0,80)}`)}function Rt(n){if(n>gc)throw new S("IPC_BAD_REQUEST",`skill too large: ${n} bytes`)}function wc(n){let e=/^data:([^,;]*)(;base64)?,(.*)$/s.exec(n);if(!e)throw new S("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 _c(n){return n.length>=2&&n[0]===31&&n[1]===139}async function yc(n,e){await bc(n),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",l=>{u+=String(l)});let f=setTimeout(()=>{c.kill("SIGKILL"),a(new S("IPC_BAD_REQUEST",`tar extract timeout (${ln}ms)`))},ln);c.on("error",l=>{clearTimeout(f),a(new S("IPC_BAD_REQUEST",`tar spawn failed: ${l.message}`,{cause:l}))}),c.on("exit",l=>{clearTimeout(f),l===0?i():a(new S("IPC_BAD_REQUEST",`tar exit ${l}${u?`: ${u.trim().slice(0,200)}`:""}`))}),c.stdin?.end(n)})}async function bc(n){let e=await new Promise((i,a)=>{let c=hi("tar",["-tzvf","-"],{stdio:["pipe","pipe","pipe"]}),u="",f="";c.stdout?.on("data",p=>{u+=String(p)}),c.stderr?.on("data",p=>{f+=String(p)});let l=setTimeout(()=>{c.kill("SIGKILL"),a(new S("IPC_BAD_REQUEST",`tar list timeout (${ln}ms)`))},ln);c.on("error",p=>{clearTimeout(l),a(new S("IPC_BAD_REQUEST",`tar list spawn failed: ${p.message}`))}),c.on("exit",p=>{clearTimeout(l),p===0?i(u):a(new S("IPC_BAD_REQUEST",`tar list exit ${p}${f?`: ${f.trim().slice(0,200)}`:""}`))}),c.stdin?.end(n)});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 S("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 S("IPC_BAD_REQUEST",`tar entry absolute path: ${f}`);if(f.split(/[/\\]/).some(p=>p===".."))throw new S("IPC_BAD_REQUEST",`tar entry contains '..': ${f}`)}}async function wi(n,e,i,a){if(a<=0)return[];let c;try{c=await sc(e,{withFileTypes:!0})}catch{return[]}let u=[];for(let f of c){if(fc.has(f.name)||f.isSymbolicLink())continue;let l=Ce(e,f.name),p=ac(Ce(i,f.name)),w=null;try{w=await Ar(l)}catch{continue}if(w.isSymbolicLink())continue;let y={name:f.name,path:_i(pi(n,l)),isDir:w.isDirectory(),size:w.size,modifiedAt:Math.floor(w.mtimeMs)};w.isDirectory()&&a>1&&(y.children=await wi(n,l,p,a-1)),u.push(y)}return u.sort((f,l)=>f.isDir!==l.isDir?f.isDir?-1:1:f.name.localeCompare(l.name)),u}function vc(n){return!n||n<=0?xc:Math.min(n,uc)}function Sc(n){if(!n||n==="."||n==="/")return".";let e=n.split(/[/\\]/);return e[e.length-1]||"."}function _i(n){return n.split(mi).join("/")}F();import{readFileSync as Dl}from"node:fs";import{dirname as Rl,join as Nl}from"node:path";import{fileURLToPath as Ol}from"node:url";var hn="0.1.35";var Nt=T("agent-health-reporter"),Ec=1e4,gn=class{constructor(e){this.opts=e;this.intervalMs=e.intervalMs??Ec}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()}),Nt.info("heartbeat started",{intervalMs:this.intervalMs}),this.tick())}stop(){this.timer&&(clearInterval(this.timer),this.timer=null,this.unsubscribeRegister&&(this.unsubscribeRegister(),this.unsubscribeRegister=null),Nt.info("heartbeat stopped"))}async tick(){if(this.inFlight){Nt.debug("previous tick still in-flight, skip");return}let e=this.opts.getDeviceId();if(!e){Nt.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=Cc(c);u&&i.push({agentId:c.agentId,status:u})}if(i.length===0)return;let a={agents:i,bridgeVersion:hn,_meta:{cozeDeviceId:e}};try{await this.opts.core.sendRequest("_agent/health",a)}catch(c){Nt.warn("heartbeat batch send failed",{count:i.length,err:String(c)})}}finally{this.inFlight=!1}}};function Cc(n){return n.status==="error"?"error":n.activeTriggers.size>0?"busy":n.status==="ok"?"online":null}Ke();import{mkdir as Tr,rm as Qc}from"node:fs/promises";F();import{execFile as Ac}from"node:child_process";import{promisify as kc}from"node:util";var bi=kc(Ac),Lt=T("agents.acp-installer"),Pc={"claude-code":{npmPackage:"@agentclientprotocol/claude-agent-acp",binary:"claude-agent-acp"},codex:{npmPackage:"@zed-industries/codex-acp",binary:"codex-acp"}},Ic=5e4,Dc=5e3,Tc=5*6e4,mn=new Map,pn=new Map,Ir=new Map;async function yi(n){let e=process.platform==="win32"?"where":"which";try{let{stdout:i}=await bi(e,[n],{timeout:Dc});return i.split(`
91
- `)[0]?.trim()||void 0}catch{return}}async function Rc(n){Lt.info("npm install -g start",{npmPackage:n}),await bi("npm",["install","-g",`${n}@latest`],{timeout:Ic,maxBuffer:10*1024*1024}),Lt.info("npm install -g done",{npmPackage:n})}async function vi(n){let e=Pc[n];if(!e)return;let i=mn.get(n);if(i)return i;let a=pn.get(n);if(a&&Date.now()-a<Tc)return;let c=Ir.get(n);if(c)return c;let u=(async()=>{let f=await yi(e.binary);if(f)return mn.set(n,f),Lt.info("acp wrapper found on PATH",{binary:e.binary,path:f}),f;try{await Rc(e.npmPackage)}catch(p){Lt.warn("acp wrapper install failed (will fallback to npx)",{npmPackage:e.npmPackage,err:String(p)}),pn.set(n,Date.now());return}let l=await yi(e.binary);if(!l){Lt.warn("acp wrapper installed but binary not found on PATH",{binary:e.binary}),pn.set(n,Date.now());return}return mn.set(n,l),pn.delete(n),l})().finally(()=>{Ir.delete(n)});return Ir.set(n,u),u}function wn(n){return mn.get(n)}import{spawn as Mc}from"node:child_process";function Ot(n,e,i){return i===void 0?{jsonrpc:"2.0",id:n,method:e}:{jsonrpc:"2.0",id:n,method:e,params:i}}function _n(n,e){return e===void 0?{jsonrpc:"2.0",method:n}:{jsonrpc:"2.0",method:n,params:e}}function lt(n,e){return{jsonrpc:"2.0",id:n,result:e}}function Qe(n,e){return{jsonrpc:"2.0",id:n,error:e}}var yn=class extends Error{code;data;constructor(e){super(`JSON-RPC error code=${e.code} ${e.message}`),this.name="RemoteRpcError",this.code=e.code,e.data!==void 0&&(this.data=e.data)}},J={PARSE_ERROR:-32700,INVALID_REQUEST:-32600,METHOD_NOT_FOUND:-32601,INVALID_PARAMS:-32602,INTERNAL_ERROR:-32603,AGENT_NOT_FOUND:-32001,AGENT_BUSY:-32002,AGENT_TIMEOUT:-32003,AGENT_SPAWN_FAILED:-32004,OPERATION_NOT_ALLOWED_FOR_LOCAL:-32005,AGENT_DISCONNECTED:-32006,MODEL_TOKEN_GEN_FAILED:-32009};function Si(n){return"method"in n&&"id"in n&&n.id!==void 0}function Ei(n){return"method"in n&&!("id"in n)}function bn(n){return!("method"in n)&&"id"in n}var Nc={AGENT_NOT_FOUND:J.AGENT_NOT_FOUND,AGENT_BUSY:J.AGENT_BUSY,AGENT_DISCONNECTED:J.AGENT_DISCONNECTED,AGENT_TIMEOUT:J.AGENT_TIMEOUT,AGENT_SPAWN_FAILED:J.AGENT_SPAWN_FAILED,AGENT_PROTOCOL_ERROR:J.INTERNAL_ERROR,BRIDGE_CONFIG_INVALID:J.INTERNAL_ERROR,BRIDGE_INTERNAL:J.INTERNAL_ERROR,IPC_AUTH_FAILED:J.INTERNAL_ERROR,IPC_BAD_REQUEST:J.INVALID_REQUEST,MODEL_TOKEN_GEN_FAILED:J.MODEL_TOKEN_GEN_FAILED,OPERATION_NOT_ALLOWED_FOR_LOCAL:J.OPERATION_NOT_ALLOWED_FOR_LOCAL,UPSTREAM_DISCONNECTED:J.INTERNAL_ERROR,UPSTREAM_HANDSHAKE_FAILED:J.INTERNAL_ERROR};function Bt(n){return n instanceof S?{code:Nc[n.code]??J.INTERNAL_ERROR,message:n.message,data:{bridgeCode:n.code,retriable:n.retriable}}:{code:J.INTERNAL_ERROR,message:n instanceof Error?n.message:String(n)}}function Ci(n){let e=n.data,i=e?.bridgeCode??"AGENT_PROTOCOL_ERROR";return new S(i,n.message,{retriable:e?.retriable??!1,cause:n.data})}function Ai(n){return`${JSON.stringify(n)}
92
- `}var vn=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 Pi={"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"},Xl=Object.fromEntries(Object.entries(Pi).map(([n,e])=>[e,n])),Lc={"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:[]},ht=class{seq=0;next(e,i){this.seq+=1;let a=Pi[e]??Oc(e),c=Lc[a]??[],u=[a,String(this.seq)];if(c.length>0){let f=c.map(p=>ki(i?.[p]??"")),l=Bc(f).join(":");l&&u.push(l)}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 Oc(n){return n.replace(/[\s/]+/g,".").replace(/_+/g,"-")}function ki(n){return n.replace(/[:_\s]+/g,"-")}function Bc(n){let e=n.length;for(;e>0&&!n[e-1];)e-=1;return n.slice(0,e)}F();var zc=3e4,qc=50,Fc=20,Ii=500;function Uc(n){try{let e=JSON.stringify(n);return e===void 0||e.length<=Ii?n:`${e.slice(0,Ii)}...<truncated, total ${e.length} chars>`}catch{return"<unserializable>"}}function Di(n,e){if(!(typeof n!="number"||n<=0))try{process.platform==="win32"?process.kill(n,e):process.kill(-n,e)}catch{}}var We=class{constructor(e){this.opts=e;this.log=T(`downstream.${this.constructor.name}`),this.decoder=new vn({onError:i=>this.log.warn("decode line failed",{line:i.line})})}opts;child;decoder;pending=new Map;idAllocator=new ht;updateHandlers=[];agentRequestHandlers=[];exitHandlers=[];log;stopped=!1;stderrRing=[];sanitizeEnv(e){return e}async start(){if(this.child)throw new S("BRIDGE_INTERNAL","Downstream already started");let e=process.platform!=="win32",i=Mc(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>qc&&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(-Fc)}),this.failAllPending(new S("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 S("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(_n("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(lt(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(Qe(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=zc){if(!this.child||this.stopped)return Promise.reject(new S("AGENT_PROTOCOL_ERROR","downstream not started"));let c=this.idAllocator.next(e),u=Ot(c,e,i),f=a>0&&Number.isFinite(a);return new Promise((l,p)=>{let w=f?setTimeout(()=>{this.pending.delete(c),p(new S("AGENT_TIMEOUT",`${e} timed out after ${a}ms`))},a):null;this.pending.set(c,{resolve:l,reject:p,timer:w,method:e});try{this.writeFrame(u)}catch(y){w&&clearTimeout(w),this.pending.delete(c),p(y)}})}writeFrame(e){if(!this.child?.stdin||this.child.stdin.destroyed)throw new S("AGENT_PROTOCOL_ERROR","downstream stdin not writable");this.child.stdin.write(Ai(e))}dispatch(e){if(bn(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(Ci(e.error))):(this.log.info("downstream returned result",{id:e.id,method:i.method,result:Uc(e.result)}),i.resolve(e.result));return}if(Ei(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(Qe(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(Qe(e.id,Bt(a)))}catch{}}}failAllPending(e){for(let i of this.pending.values())i.timer&&clearTimeout(i.timer),i.reject(e);this.pending.clear()}};var Hc="@agentclientprotocol/claude-agent-acp@latest";function Gc(n){let e={};for(let[i,a]of Object.entries(n))a!==void 0&&(i.startsWith("CLAUDE")||i==="AI_AGENT"||i==="BAGGAGE"||(e[i]=a));return e}var Sn=class extends We{framework="claude-code";constructor(e){let i=wn("claude-code"),[a,c]=i?[i,[]]:["npx",["-y",Hc]],u=e.command??a,f=e.args??c,l={command:u,args:f,cwd:e.cwd,...e.env?{env:e.env}:{}};super(l)}sanitizeEnv(e){return Gc(e)}};import{mkdtempSync as jc,rmSync as Kc}from"node:fs";import{tmpdir as Wc}from"node:os";import{join as Jc}from"node:path";var Vc="@zed-industries/codex-acp@latest",En=class extends We{framework="codex";authMethodId;codexHomeDir;constructor(e){let i=wn("codex"),[a,c]=i?[i,[]]:["npx",["-y",Vc]],u=e.command??a,f=e.args??c,l=e.extraArgs?[...f,...e.extraArgs]:f,p=e.isolateCodexHome?jc(Jc(Wc(),"coze-bridge-codex-home-")):void 0,w=p?{...e.env??{},CODEX_HOME:p}:e.env,y={command:u,args:l,cwd:e.cwd,...w?{env:w}:{}};super(y),this.authMethodId=e.authMethodId,this.codexHomeDir=p}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{Kc(this.codexHomeDir,{recursive:!0,force:!0})}catch{}}};var Mt=class extends We{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}};F();xe();function Dr(n){return n.replace(/[^A-Za-z0-9._-]+/g,"-")}var gt=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 Cn=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 gt,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)zt(a),a.downstream&&(i.push(a.downstream.stop(e).catch(()=>{})),a.downstream=void 0);await Promise.all(i),this.activeTriggers.clear()}};function zt(n){n.idleTimer&&(clearTimeout(n.idleTimer),n.idleTimer=void 0)}import{spawn as $c}from"node:child_process";import{homedir as Xc}from"node:os";import{join as Yc}from"node:path";en();F();async function Ni(){let n=Yc(Xc(),".openclaw/openclaw.json");return(await ut(n))?.gateway?.auth?.token??""}var Ti=T("openclaw.config"),Zc=[0,5e3,5e3],Ri="models.providers.",An="agents.defaults.models",kn=class{command;env;retryDelaysMs;queue=new gt;constructor(e){this.command=e.command,this.env=e.env??process.env,this.retryDelaysMs=e.retryDelaysMs??Zc}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 S("AGENT_SPAWN_FAILED",`openclaw cli ${e} failed after ${this.retryDelaysMs.length} attempts: ${a?.message??"unknown"}`)}runCli(e){return new Promise((i,a)=>{let c=$c(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",`${Ri}${e}`,JSON.stringify(i),"--strict-json","--merge"])))}removeProvider(e){return this.bestEffortUnset(`config unset models.providers.${e}`,`${Ri}${e}`)}addModelToAllowlist(e,i){let a={[e]:i?{alias:i}:{}};return this.queue.enqueue(()=>this.withRetry(`config set ${An}[${e}]`,()=>this.runCli(["config","set",An,JSON.stringify(a),"--strict-json","--merge"])))}removeModelFromAllowlist(e){return this.bestEffortUnset(`config unset ${An}[${e}]`,`${An}.${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 Ae=T("agent-manager"),ex=(n,e,i,a,c,u,f)=>{switch(n){case"claude-code":{let l=c?{...oi(c),...xi(c,f)}:void 0;return new Sn({cwd:i,...l&&Object.keys(l).length>0?{env:l}:{}})}case"codex":{let l=c?[...ai(c),...fi(c,f)]:[],p=c?ci(c):void 0,w=!!c;return new En({cwd:i,...l.length>0?{extraArgs:l}:{},...p&&Object.keys(p).length>0?{env:p}:{},...w?{authMethodId:"openai-api-key",isolateCodexHome:!0}:{}})}case"openclaw":return new Mt({command:e,cwd:i,agentId:a,...u?{sessionName:Dr(u)}:{}})}};function Li(n){return n==="claude-code"||n==="codex"}var tx={path:"",version:"cloud-deployed"},nx={protocolVersion:1,clientCapabilities:{fs:{readTextFile:!0,writeTextFile:!0}}},rx=6e4,Pn=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??ex,this.createTimeoutMs=e.createTimeoutMs??rx}getOpenclawConfig(){if(!this.openclawConfigCache){let e=this.config.frameworksCache?.openclaw;if(!e?.path)throw new S("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 S("IPC_BAD_REQUEST","agentId required");if(!e.framework)throw new S("IPC_BAD_REQUEST","framework required");let i=Tt(e._meta)==="cloud";this.registry.reviveIfDisconnected?.(e.agentId);let a=this.registry.get(e.agentId);if(a){if(a.framework!==e.framework)throw new S("AGENT_BUSY",`agent ${e.agentId} exists with different framework (${a.framework})`);if(a.status==="error")Ae.warn("existing agent in error state, rebuilding",{agentId:e.agentId}),await a.dispose("rebuild after error").catch(C=>Ae.warn("dispose stale agent failed (ignored)",{err:String(C)})),this.registry.unregister(e.agentId);else return Ae.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 S("AGENT_SPAWN_FAILED",`framework ${e.framework} not detected on this machine; rerun daemon to refresh frameworks_cache`);i&&Li(e.framework)&&await vi(e.framework);let u=Be(e.agentId,this.paths),f=e.workspace??u.workspace,l=Tt(e._meta),p=new AbortController,w=setTimeout(()=>p.abort(new S("AGENT_TIMEOUT",`_agent/create timed out after ${this.createTimeoutMs}ms`)),this.createTimeoutMs),y,_=!1;try{let C=()=>{if(p.signal.aborted)throw p.signal.reason instanceof Error?p.signal.reason:new S("AGENT_TIMEOUT","_agent/create aborted")};await Tr(u.root,{recursive:!0}),await Tr(f,{recursive:!0}),await Tr(u.logs,{recursive:!0}),C(),await ft(f,e.framework,e.agentId,e.cozeIdentity),C();let P=await ue(e.agentId,this.paths).catch(()=>null),I=si({model:e.model??P?.model});if(y=new Cn({agentId:e.agentId,framework:e.framework,workspace:f,model:I.model??Ee,deployType:l}),y.status="ok",P?.sessions){for(let[re,ee]of Object.entries(P.sessions))y.sessions.set(re,{acpSessionId:ee.acpSessionId,modelToken:ee.modelToken,tokenGeneratedAt:ee.tokenGeneratedAt,lastActiveAt:Date.now(),loadingSession:!1,replySeq:0});let Y=Object.keys(P.sessions).length;Y>0&&Ae.info("restored persisted session records (no spawn)",{agentId:e.agentId,count:Y})}this.registry.register(y),_=!0;let R={agentId:e.agentId,framework:e.framework,workspace:f,cozeIdentity:e.cozeIdentity,createdAt:P?.createdAt??Date.now(),sessions:P?.sessions??{},model:I.model};l==="cloud"&&(R.deployType="cloud"),P?.skills&&(R.skills=P.skills),P?.agentName&&(R.agentName=P.agentName),P?.description&&(R.description=P.description),e.framework==="openclaw"&&(this.config.frameworksCache?.openclaw?.path?await this.getOpenclawConfig().ensureAgent(e.agentId,f):Ae.warn("openclaw binary not on this machine, skip agents add (will fail at session/prompt)",{agentId:e.agentId}));let U=e.initialSkills??[];if(U.length>0){let Y=[...R.skills??[]],re=new Map(Y.map((Z,k)=>[Z.skillId,k])),ee=0;for(let Z of U)try{let k=await kr({agentId:e.agentId,workspace:f,framework:e.framework,skill:Z});Pr(Y,re,k),ee++}catch(k){Ae.warn("initialSkill install failed (skipping)",{agentId:e.agentId,skillId:Z.skillId,skillName:Z.skillName,err:String(k)})}ee>0&&(R.skills=Y,Ae.info("initialSkills installed",{agentId:e.agentId,installed:ee,requested:U.length}))}return await we(R,this.paths),Ae.info("agent created (no spawn, lazy on first prompt)",{agentId:e.agentId,framework:e.framework,deployType:l}),{ok:!0,agentId:e.agentId,workspace:f,framework:e.framework}}catch(C){throw Ae.error("agent create failed, rolling back",{agentId:e.agentId,err:String(C)}),_&&y&&(await y.dispose("rollback").catch(()=>{}),this.registry.unregister(e.agentId)),await Qc(u.root,{recursive:!0,force:!0}).catch(P=>Ae.warn("rm agent dir failed (ignored)",{err:String(P)})),C instanceof S?C:new S("AGENT_SPAWN_FAILED",String(C),{cause:C})}finally{clearTimeout(w)}}async spawnSessionDownstream(e,i,a,c){let f=this.config.frameworksCache?.[e.framework];if(!f)if(e.deployType==="cloud"&&Li(e.framework))f=tx;else throw new S("AGENT_SPAWN_FAILED",`framework ${e.framework} not detected on this machine`);let l=e.deployType==="cloud"?{model:e.model,modelToken:i}:void 0,p;e.framework==="openclaw"?p=await this.buildOpenclawDownstream({session:e,modelConfig:l,cloudSessionId:a,cozeEnv:c,command:f.path}):p=this.factory(e.framework,f.path,e.workspace,e.agentId,l,a,c);try{return await p.start(),await p.initialize(nx),p}catch(w){throw await p.stop("spawnSessionDownstream failed").catch(()=>{}),w instanceof S?w:new S("AGENT_SPAWN_FAILED",w instanceof Error?w.message:String(w),{cause:w})}}async buildOpenclawDownstream(e){let{session:i,modelConfig:a,cloudSessionId:c,cozeEnv:u,command:f}=e,l=Dr(c),p=await Ni(),w=a?ui(a,u):null,y;if(w){let _=Cr(c),P=w.models[0]?.id??Ee,I=`${_}/${P}`;if(!this.ensuredProviders.has(I)){let R=this.getOpenclawConfig();await R.ensureProvider(_,w),await R.addModelToAllowlist(I),this.ensuredProviders.add(I)}y=I}return new Mt({command:f,cwd:i.workspace,agentId:i.agentId,sessionName:l,...p?{gatewayToken:p}:{},...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=Cr(a),u=`${c}/${e.model}`;this.ensuredProviders.delete(u),await i.removeProvider(c),await i.removeModelFromAllowlist(u)}}};F();import{execFile as sx}from"node:child_process";import{promisify as ix}from"node:util";var ox=ix(sx),Je=T("coze-cli-installer"),Oi="@coze/cli@0.1.3-alpha.89c42a",Bi="https://bnpm.byted.org",ax="coze",cx=5e3,xx=9e4,Mi=1e4,qt=null,Rr=!1;async function zi(n,e={}){if(Rr)return;if(qt)return qt;let i=e.exec??ox;return qt=(async()=>{try{let a=await ux(ax,i);if(a){Je.info("coze-cli already on PATH, skip install + config + auth",{path:a}),Rr=!0;return}Je.info("coze-cli install start",{package:Oi,registry:Bi});try{await i("npm",["i","-g",Oi,"--registry",Bi],{timeout:xx,maxBuffer:10*1024*1024}),Je.info("coze-cli install ok")}catch(c){Je.warn("coze-cli install failed (skip subsequent steps)",{err:String(c)});return}if(n.env)try{await i("coze",["config","set","xTTEnv",n.env],{timeout:Mi}),Je.info("coze config set xTTEnv ok",{env:n.env})}catch(c){Je.warn("coze config set failed (continue to auth login)",{err:String(c)})}try{await i("coze",["auth","login","--token",n.patToken],{timeout:Mi}),Je.info("coze auth login ok")}catch(c){Je.warn("coze auth login failed",{err:String(c)});return}Rr=!0}finally{qt=null}})(),qt}async function ux(n,e){let i=process.platform==="win32"?"where":"which";try{let{stdout:a}=await e(i,[n],{timeout:cx});return a.split(`
94
- `)[0]?.trim()||void 0}catch{return}}F();import{spawn as fx}from"node:child_process";import{constants as qi,access as dx}from"node:fs/promises";import{delimiter as lx,join as hx}from"node:path";var gx=T("framework-detector"),Fi={"claude-code":"claude",codex:"codex",openclaw:"openclaw"},px=[".exe",".cmd",".bat",".ps1"],pt=class{env;constructor(e={}){this.env={pathEnv:e.pathEnv??process.env.PATH??"",platform:e.platform??process.platform,spawn:e.spawn??fx,access:e.access??dx}}async detect(e){let i=Fi[e],a=await this.which(i);if(!a)return gx.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(lx).filter(Boolean),a=this.env.platform==="win32"?["",...px]:[""];for(let c of i)for(let u of a){let f=hx(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=l=>{c||(c=!0,u&&clearTimeout(u),i(l.trim()||"unknown"))};try{let l=this.env.spawn(e,["--version"],{stdio:["ignore","pipe","pipe"]});u=setTimeout(()=>{l.kill("SIGKILL"),f("unknown")},5e3),l.stdout?.on("data",p=>{a+=p.toString("utf8")}),l.on("error",()=>f("unknown")),l.on("close",()=>{let p=_x(a).split(/\r?\n/)[0]??"";f(p)})}catch{f("unknown")}})}},mx=new RegExp("\x1B\\[[0-9;]*[A-Za-z]","g");function _x(n){return n.replace(mx,"")}en();xe();var yx=10*6e4;function Ui(n){let e=n?.sessionIdleTimeoutMs;return typeof e!="number"||!Number.isFinite(e)||e<=0?yx:e}function In(n){return ut(n??K().configFile)}function mt(n,e){return Qt(e??K().configFile,n)}import{randomBytes as Nx}from"node:crypto";import{mkdir as bx,readFile as vx,realpath as Sx,writeFile as Ex}from"node:fs/promises";import{basename as Cx,dirname as Nr,join as Ax,relative as kx,resolve as Hi,sep as Px}from"node:path";F();var ji=T("fs-rpc");async function Ki(n,e){let i=await Ji(n.path,e);return await bx(Nr(i),{recursive:!0}),await Ex(i,n.content,"utf8"),ji.info("fs/write_text_file ok",{path:i,size:n.content.length}),null}async function Wi(n,e){let i=await Ji(n.path,e),a=await vx(i,"utf8"),c=a;if(typeof n.line=="number"||typeof n.limit=="number"){let u=a.split(`
95
- `),f=Math.max(0,(n.line??1)-1),l=typeof n.limit=="number"?f+n.limit:void 0;c=u.slice(f,l).join(`
96
- `)}return ji.info("fs/read_text_file ok",{path:i,size:c.length}),{content:c}}async function Ji(n,e){if(typeof n!="string"||n.length===0)throw new S("IPC_BAD_REQUEST","path must be a non-empty string");let[i,a]=await Promise.all([Gi(Hi(e)),Gi(Hi(n))]),c=kx(i,a);if(c.startsWith("..")||c===".."||c.startsWith(`..${Px}`))throw new S("IPC_BAD_REQUEST",`path escapes workspace: ${n}`);return a}async function Gi(n){let e=[],i=n;for(;i!==Nr(i);)try{let a=await Sx(i);return e.length?Ax(a,...e.reverse()):a}catch{e.push(Cx(i)),i=Nr(i)}return n}F();var Vi=T("prompt-multimodal"),$i=10*1024*1024,Ix=15e3;async function Xi(n){return Promise.all(n.map(Dx))}async function Dx(n){if(n.type!=="image")return n;let e=n;if(e.data||!e.uri||!cn(e.uri))return n;try{let{buf:i,contentType:a}=await Rx(e.uri),c=e.mimeType||Tx(a)||"application/octet-stream";return Vi.info("image uri fetched and inlined",{uri:e.uri,bytes:i.length,mimeType:c}),{type:"image",data:i.toString("base64"),mimeType:c}}catch(i){return Vi.warn("image fetch failed, degrading to text block",{uri:e.uri,err:String(i)}),{type:"text",text:`[image load failed: ${e.uri}]`}}}function Tx(n){if(!n)return;let e=n.indexOf(";");return(e===-1?n:n.slice(0,e)).trim()||void 0}async function Rx(n){let e=new AbortController,i=setTimeout(()=>e.abort(),Ix);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>$i)throw new Error(`image too large: ${c.byteLength} bytes (max ${$i})`);return{buf:Buffer.from(c),contentType:a.headers.get("content-type")??void 0}}finally{clearTimeout(i)}}Ke();F();var B=T("core"),Lx=3e4,Ox=3e4,Dn=class{upstream;agents=new Map;disconnectedAgents=new Set;extensions;paths;sessionSpawner;sessionIdleTimeoutMs;upstreamIds=new ht;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(),B.info("Core started",{extensions:Object.keys(this.extensions)})}async stop(e){B.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),B.info("agent registered",{agentId:e.agentId,framework:e.framework});for(let i of this.registerHandlers)try{i(e.agentId)}catch(a){B.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)&&B.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)=>{B.info("session runtime exited",{agentId:e.agentId,cloudId:i,code:u,signal:f}),zt(a),a.downstream=void 0,a.acpSessionId&&e.activeTriggers.delete(a.acpSessionId)}))}async handleFrame(e){if(bn(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,J.METHOD_NOT_FOUND,`extension not registered: ${e.method}`):B.warn("drop notification: extension not registered",{method:e.method});return}let u=await c(e,this);i!==null&&await this.upstream.send(lt(i,u));return}if(e.method.startsWith("session/")){let c=await this.routeSessionMethod(e);i!==null&&await this.upstream.send(lt(i,c));return}if(e.method==="initialize"){i!==null&&await this.upstream.send(lt(i,{protocolVersion:1,agentCapabilities:{loadSession:!0}}));return}i!==null?await this.sendError(i,J.METHOD_NOT_FOUND,`method not implemented: ${e.method}`):B.warn("drop unknown notification",{method:e.method})}catch(c){B.error("handleFrame failed",{method:e.method,err:String(c)}),i!==null&&await this.upstream.send(Qe(i,Bt(c)))}}async routeSessionMethod(e){if(!e.params||typeof e.params!="object")throw new S("IPC_BAD_REQUEST",`${e.method} requires params`);let i=e.params,a=i._meta?.cozeAgentId;if(!a)throw new S("IPC_BAD_REQUEST",`${e.method}: missing _meta.cozeAgentId`);let c=this.agents.get(a);if(!c)throw this.disconnectedAgents.has(a)?new S("AGENT_DISCONNECTED",`agent ${a} has been disconnected; cloud must _agent/create to revive`):new S("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(),l=!1;try{let p=await c.getSessionQueue(u).enqueue(()=>this.dispatchSessionCall(c,e.method,i));return l=!0,p}finally{B.info("session call done",{agentId:c.agentId,method:e.method,durationMs:Date.now()-f,ok:l})}}async dispatchSessionCall(e,i,a){e.lastActiveAt=Date.now();let{stripped:c}=$s(a);switch(i){case"session/new":{let u=Bx();return B.info("session/new ack (lazy spawn)",{agentId:e.agentId,cloudId:u}),{sessionId:u}}case"session/load":{let u=c;return B.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 S("IPC_BAD_REQUEST","session/prompt: missing sessionId");let l=await this.ensureRuntime(e,f);if(l.replySeq=0,await this.ensureDownstream(e,f,l),!l.downstream||!l.acpSessionId)throw new S("BRIDGE_INTERNAL","session runtime not ready after ensureDownstream");let p=a._meta?.cozeTriggerMsgId;p?e.activeTriggers.set(l.acpSessionId,p):e.activeTriggers.delete(l.acpSessionId);let w=await Xi(u.prompt);try{let y=await l.downstream.sessionPrompt({...u,sessionId:l.acpSessionId,prompt:w});return l.lastActiveAt=Date.now(),y}finally{e.activeTriggers.delete(l.acpSessionId),l.downstream?.isAlive()&&this.armIdleTimer(e,f,l)}}case"session/cancel":{let f=c.sessionId;if(!f)throw new S("IPC_BAD_REQUEST","session/cancel: missing sessionId");let l=e.sessions.get(f);return l?.downstream?.isAlive()&&l.acpSessionId&&await l.downstream.sessionCancel({sessionId:l.acpSessionId}),{ok:!0}}default:throw new S("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(Se.GEN_MODEL_TOKEN,a,Ox);if(!c?.modelToken)throw new S("MODEL_TOKEN_GEN_FAILED",`cloud returned empty modelToken (agentId=${e}, cloudSessionId=${i})`);return c.modelToken}catch(c){throw c instanceof S&&c.code==="MODEL_TOKEN_GEN_FAILED"?c:new S("MODEL_TOKEN_GEN_FAILED",c instanceof Error?c.message:String(c),{cause:c})}}async ensureDownstream(e,i,a){if(zt(a),a.downstream?.isAlive())return;if(!this.sessionSpawner)throw new S("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}),B.info("session restored via session/load",{agentId:e.agentId,cloudId:i,acpId:a.acpSessionId})}catch(u){B.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(zt(a),this.isRuntimeBusy(e,a)){B.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)){B.info("idle reaper fired but runtime busy, re-arming",{agentId:e.agentId,cloudId:i}),this.armIdleTimer(e,i,a);return}B.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=>B.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){B.debug("drop update for unknown session",{agentId:e.agentId,acpId:a});return}let u=e.sessions.get(c);if(!u){B.debug("drop update: runtime gone",{agentId:e.agentId,cloudId:c});return}if(Mx(i)){B.debug("drop codex metadata-warn chunk",{agentId:e.agentId,acpId:a});return}let f={cozeAgentId:e.agentId,cozeReplySeqID:++u.replySeq},l=e.activeTriggers.get(a);l&&(f.cozeTriggerMsgId=l),this.upstream.send(_n("session/update",{...i,sessionId:c,_meta:f})).catch(p=>B.warn("forward update failed",{agentId:e.agentId,err:String(p)}))}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}B.warn("unhandled agent request,returning method_not_found",{agentId:e.agentId,method:a.method}),i.respondAgentRequestError(a.id,{code:J.METHOD_NOT_FOUND,message:`method not handled by Bridge: ${a.method}`})}async handleFsRpcRequest(e,i,a){try{let c=e.workspace;if(a.method==="fs/write_text_file"){let u=a.params??{},f=await Ki(u,c);i.respondAgentRequest(a.id,f)}else{let u=a.params??{},f=await Wi(u,c);i.respondAgentRequest(a.id,f)}}catch(c){B.warn("fs rpc handler failed",{agentId:e.agentId,method:a.method,err:String(c)}),i.respondAgentRequestError(a.id,Bt(c))}}forwardPermissionRequest(e,i,a){let c=this.upstreamIds.next("session/request_permission"),u=a.params??{},l=u.sessionId,p=l?e.activeTriggers.get(l):void 0,w={cozeAgentId:e.agentId};p&&(w.cozeTriggerMsgId=p);let y=l?this.reverseSessionId(e,l):void 0,_={...u,...y?{sessionId:y}:{},_meta:w};this.pendingUpstream.set(c,{agentRequestId:a.id,agentId:e.agentId,downstream:i,method:a.method}),B.info("forward permission_request \u2192 upstream",{agentId:e.agentId,upstreamId:c,acpSessionId:l,cloudSessionId:y,toolCallId:u.toolCall?.toolCallId,options:u.options?.map(C=>({optionId:C.optionId,kind:C.kind,name:C.name}))}),this.upstream.send(Ot(c,"session/request_permission",_)).catch(C=>{this.pendingUpstream.delete(c),B.error("forward permission request failed",{agentId:e.agentId,err:String(C)}),i.respondAgentRequestError(a.id,{code:J.INTERNAL_ERROR,message:`upstream send failed: ${String(C)}`})})}handleUpstreamResponse(e){if(e.id===null)return;let i=this.pendingUpstream.get(e.id);if(i){this.pendingUpstream.delete(e.id),e.error?(B.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)):(B.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 yn(e.error)):a.resolve(e.result);return}B.debug("orphan upstream response (no pending)",{id:e.id})}sendRequest(e,i,a=Lx){let c=this.upstreamIds.next(e);return new Promise((u,f)=>{let l=setTimeout(()=>{this.pendingBridge.delete(c),f(new S("AGENT_TIMEOUT",`${e} timed out after ${a}ms`))},a);this.pendingBridge.set(c,{method:e,resolve:u,reject:f,timer:l}),this.upstream.send(Ot(c,e,i)).catch(p=>{let w=this.pendingBridge.get(c);w&&(clearTimeout(w.timer),this.pendingBridge.delete(c)),f(p)})})}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 vr(e.agentId,i,this.paths)}catch(i){B.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(Qe(e,{code:i,message:a}))}};function Bx(){return Nx(16).toString("hex")}function Mx(n){let e=n.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 `")}F();xe();import{randomBytes as zx}from"node:crypto";import{chmod as qx,mkdir as Fx,writeFile as Yi}from"node:fs/promises";import{createServer as Ux}from"node:http";import{dirname as Hx}from"node:path";var Gx=1e6,Lr=T("ipc"),Tn=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??K()}async start(){this.token=zx(32).toString("hex");let e=Ux((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(),Lr.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 Fx(Hx(this.paths.portFile),{recursive:!0}),await Yi(this.paths.portFile,String(this.port),"utf8"),await Yi(this.paths.tokenFile,this.token,{encoding:"utf8",mode:384});try{await qx(this.paths.tokenFile,384)}catch(e){Lr.warn("chmod token file failed (non-POSIX?)",{err:String(e)})}}async dispatch(e,i){if(e.headers.authorization!==`Bearer ${this.token}`){Ft(i,401,{error:"unauthorized"});return}let c=`${e.method} ${(e.url??"").split("?")[0]}`,u=this.routes.get(c);if(!u){Ft(i,404,{error:"not found"});return}let f=null;if(e.method==="POST")try{f=await jx(e)}catch(l){Ft(i,400,{error:"invalid json",detail:String(l)});return}try{let l=await u.handler(f,e);Ft(i,200,l??{ok:!0})}catch(l){Lr.error("IPC handler failed",{key:c,err:String(l)}),Ft(i,500,{error:l instanceof Error?l.message:String(l)})}}};function Ft(n,e,i){n.statusCode=e,n.setHeader("content-type","application/json"),n.end(JSON.stringify(i))}async function jx(n){let e=[],i=0;for await(let c of n){let u=c;if(i+=u.length,i>Gx)throw new Error("body too large");e.push(u)}let a=Buffer.concat(e).toString("utf8");return a?JSON.parse(a):null}var ya=Oe(co(),1);var Cf=Oe(sa(),1),Af=Oe(Jn(),1),kf=Oe(yt(),1),Pf=Oe(Jr(),1),If=Oe(Xr(),1),Df=Oe(ns(),1),la=Oe(Yn(),1),Tf=Oe(da(),1);var ha=la.default;F();var ne=T("upstream.frontier"),pa="application/json",ma="none",Qn=class{constructor(e){this.opts=e}opts;fws=null;handler=null;connectHandler=null;opened=!1;openCount=0;async start(){if(this.fws){ne.warn("start called on already-started FrontierUpstream; noop");return}let e={Authorization:`Bearer ${this.opts.privatecode}`,Origin:Zs,...un(this.opts.ppeOverride)};class i extends ha{constructor(l){super(l,Ys,{headers:e})}send(l,...p){if(Js("debug"))try{let w;typeof l=="string"?w=Buffer.from(l,"utf8"):l instanceof Buffer?w=l:l instanceof ArrayBuffer?w=new Uint8Array(l):ArrayBuffer.isView(l)?w=new Uint8Array(l.buffer,l.byteOffset,l.byteLength):w=new Uint8Array(0);let y=Buffer.from(w.slice(0,128)).toString("hex");ne.debug("WS raw frame out",{bytes:w.byteLength,headHex:y})}catch(w){ne.warn("WS raw frame dump failed",{err:String(w)})}super.send(l,...p)}}let a=ti(this.opts.urlOverride),c={url:a,ws:i,fpID:Xs,aID:xn,accessKey:this.opts.handshake.accessKey,deviceID:this.opts.handshake.deviceId,payloadType:{type:pa,force:!0},payloadEncoding:{encoding:ma,force:!0},enableTransformTextPayload:!0,enableQoS:!1,enableAutoAck:!1,automaticOpen:!1,debug:this.opts.debug??!1},u=new ya.FWS(c);u.onopen=()=>{this.opened=!0,this.openCount+=1;let f=this.openCount===1;ne.info("frontier opened",{url:a,remoteDeviceId:this.opts.handshake.deviceId,initial:f,openCount:this.openCount}),this.connectHandler&&Promise.resolve(this.connectHandler({initial:f})).catch(l=>ne.warn("onConnect handler threw (ignored)",{err:String(l)}))},u.onclose=f=>{this.opened=!1,ne.info("frontier closed",{code:f.code,reason:f.reason,willReconnect:f.willReconnect})},u.onerror=f=>{ne.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){ne.warn("frontier close threw (ignored)",{err:String(a)})}}}async send(e){let i=this.fws;if(!i)throw new S("UPSTREAM_DISCONNECTED","frontier upstream not started");let a=JSON.stringify(e),c=e;wa(c)||ne.info("frontier frame out",{method:c.method,jsonrpcId:c.id,size:a.length});try{await i.send(a,{service:33555712,method:1,payloadType:pa,payloadEncoding:ma})}catch(f){throw ne.warn("frontier frame send failed",{method:c.method,jsonrpcId:c.id,err:String(f)}),new S("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){ne.debug("drop non-adapter frontier frame",{service:i});return}let a=Of(e);if(!a){ne.debug("frontier message without text payload, drop",{payloadType:e.message?.payloadType});return}if(!this.handler){ne.debug("frame received but no onFrame handler",{size:a.length});return}let c;try{c=JSON.parse(a)}catch(f){ne.warn("frontier message JSON parse failed",{err:String(f),head:a.slice(0,80)});return}let u=c;wa(u)||ne.info("frontier frame in",{logid:Lf(e.message?.LogID),logidNew:e.message?.LogIDNew,msgId:e.message?.msgID,jsonrpcId:u.id,method:u.method,body:Nf(a)}),Promise.resolve(this.handler(c)).catch(f=>ne.warn("frontier frame handler threw",{err:String(f)}))}};function wa(n){return n.method==="_agent/health"?!0:typeof n.id=="string"&&n.id.startsWith("agent.health_")}var _a=2e3;function Nf(n){return n.length<=_a?n:`${n.slice(0,_a)}...<truncated, total ${n.length} chars>`}function Lf(n){return n?n.high===0?String(n.low>>>0):`${n.high.toString(16)}${(n.low>>>0).toString(16).padStart(8,"0")}`:""}function Of(n){let e=n.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}}F();var ss=T("upstream.switchable"),er=class{inner;handler=null;connectHandler=null;constructor(e){this.inner=e}async swap(e,i){if(this.inner===e)return;ss.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 ss.error("swap target start failed, reverting",{err:String(c)}),this.inner=a,c}await a.stop(i??"swapped").catch(c=>ss.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()}};F();var is=T("upstream"),$t=class{handler=null;async start(){is.info("NoopUpstream started (M1 skeleton; real Frontier wired in M4)")}async stop(e){is.info("NoopUpstream stopped",{reason:e})}async send(e){is.debug("NoopUpstream.send (dropped)",{method:"method"in e?e.method:void 0})}onFrame(e){this.handler=e}isConnected(){return!1}async injectFrame(e){this.handler&&await this.handler(e)}};F();xe();F();xe();import{execSync as Bf}from"node:child_process";import{readFileSync as ba,unlinkSync as Mf}from"node:fs";import{mkdir as zf,readFile as va,unlink as Sa,writeFile as qf}from"node:fs/promises";import{dirname as Ff}from"node:path";var Uf=T("single-instance"),tr=class{pidFile;acquired=!1;constructor(e={}){this.pidFile=e.pidFile??K().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&&(Uf.warn("removing stale pid file",{stalePid:e}),await Sa(this.pidFile).catch(()=>{})),await zf(Ff(this.pidFile),{recursive:!0}),await qf(this.pidFile,String(process.pid),"utf8"),this.acquired=!0,this.installCleanupHooks(),{kind:"acquired"})}async release(){if(this.acquired){try{(await va(this.pidFile,"utf8")).trim()===String(process.pid)&&await Sa(this.pidFile)}catch{}this.acquired=!1}}async readExistingPid(){try{let e=await va(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=ba(`/proc/${e}/cmdline`,"utf8").replace(/\0/g," ");return!!(i.includes("coze-bridge-daemon")||i.includes("lib/index.js"))}catch{}try{let i=Bf(`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{ba(this.pidFile,"utf8").trim()===String(process.pid)&&Mf(this.pidFile)}catch{}})}};var O=T("daemon"),Hf="coze-bridge-daemon";async function Aa(){let n=new tr({processTitle:Hf}),e=await n.acquire();if(e.kind==="already-running")throw new Error(`coze-bridge daemon already running (pid=${e.pid})`);let i=await In(),a=i??{};br({pid:process.pid}),O.info(i?"loaded bridge config":"initialized bridge config");try{let k=new pt;a.frameworksCache=await k.detectAll(),O.info("refreshed frameworks_cache",{detected:Object.keys(a.frameworksCache)})}catch(k){O.warn("framework detection failed",{err:String(k)})}await mt(a);let c=new er(new $t),u=K(),f=null,l=new Dn({upstream:c,paths:u,bridgeConfig:a,sessionSpawner:async(k,H,W,se)=>{if(!f)throw new Error("agentManager not ready");return f.spawnSessionDownstream(k,H,W,se)}});await jf(u,l);let p=new Pn({paths:u,config:a,registry:l});f=p;let w,y,_=null,C=null;l.registerExtension("_agent/create",async k=>p.createAgent(k.params)),l.registerExtension("_agent/health",async()=>({ok:!0}));let P={},I=new dn({agents:l.agents,disposeAndMarkDisconnected:async(k,H)=>{let W=l.agents.get(k);W&&(await p.cleanupOpenclawSessionProviders(W).catch(se=>O.warn("cleanup openclaw providers failed (ignored)",{agentId:k,err:String(se)})),await W.dispose(`disconnect: ${H}`).catch(se=>O.warn("dispose during disconnect failed (ignored)",{agentId:k,err:String(se)})),W.status="disconnected",l.unregister(k)),l.disconnectedAgents.add(k)},detailSyncer:async k=>{if(!P.ref)throw new Error("agent-detail-sync not initialized yet");await P.ref.syncOne(k)},openclawRepair:async(k,H)=>{await p.openclawRepair(k,H)}});l.registerExtension("_agent/listSkills",k=>I.listSkills(k.params)),l.registerExtension("_agent/addSkills",k=>I.addSkills(k.params)),l.registerExtension("_agent/removeSkills",k=>I.removeSkills(k.params)),l.registerExtension("_agent/getFileTree",k=>I.getFileTree(k.params)),l.registerExtension("_agent/getFileContent",k=>I.getFileContent(k.params)),l.registerExtension("_agent/update",k=>I.updateAgent(k.params)),l.registerExtension("_agent/disconnect",k=>I.disconnectAgent(k.params)),l.registerExtension("_agent/switchModel",k=>I.switchModel(k.params)),l.registerExtension("_agent/reset",k=>I.resetAgent(k.params)),l.registerExtension("_agent/repair",k=>I.repairAgent(k.params));let R=new an({paths:u,handlers:I,sendDetail:k=>l.sendRequest("_agent/detail",k)});P.ref=R,c.onConnect(({initial:k})=>{O.info("frontier upstream connected, triggering detail sync",{initial:k}),R.syncAll(k?"initial-connect":"reconnect").catch(H=>O.warn("detail sync top-level error (ignored)",{err:String(H)}))});let U=new Tn({paths:u,routes:[{method:"GET",path:"/status",handler:async()=>({running:!0,pid:process.pid,agents:[...l.agents.keys()],deviceId:_??"",frameworksCache:a.frameworksCache??{}})},{method:"POST",path:"/pair",handler:async k=>{let H=k,W=H?.privatecode,se=H?.pairing_code;if(!W||!se)throw new S("IPC_BAD_REQUEST","/pair requires privatecode + pairing_code");let De=fn(H.env),ge=H.handshake_url,Ye=H.frontier_url,kt=Gf(H.env,ge,Ye),Xt=!!w&&w!==W,ye=y!==void 0&&y!==kt,be=Xt||ye;if(be){O.warn("pair config switched, resetting agents",{pcChanged:Xt,envChanged:ye,previousPc:w?Ea(w):"",nextPc:Ea(W),previousEnvKey:y??"",nextEnvKey:kt});for(let M of[...l.agents.values()])await M.dispose("pair config switch").catch(()=>{}),l.agents.delete(M.agentId);await c.swap(new $t,"pair switch").catch(()=>{})}let Yt=await ri({privatecode:W,...ge?{endpoint:ge}:{},ppeOverride:De});_=Yt.deviceId,br({deviceId:_,pid:process.pid}),zi({patToken:W,env:H.env}).catch(M=>O.warn("coze-cli setup error (ignored)",{err:String(M)}));let ae=new Qn({handshake:Yt,privatecode:W,...Ye?{urlOverride:Ye}:{},ppeOverride:De});await c.swap(ae,"pair");try{let M=new pt;a.frameworksCache=await M.detectAll(),await mt(a),O.info("frameworks_cache refreshed before pair",{detected:Object.keys(a.frameworksCache)})}catch(M){O.warn("frameworks_cache refresh failed (ignored, using cached)",{err:String(M)})}let Zt=Object.keys(a.frameworksCache??{});try{let M=await l.sendRequest("_agent/pair",{pairCode:se,patToken:W,frameworks:Zt,_meta:{cozeDeviceId:_}});O.info("_agent/pair ok",{pairResult:M}),w=W,y=kt,C||(C=new gn({core:l,getDeviceId:()=>_??""})),C.start(),be&&Ca(u,p).catch(Te=>O.warn("post-pair-switch auto-revive error (ignored)",{err:String(Te)}));let V;return H.agent_id&&(V=await Kf(H.agent_id,u,p,Te=>l.sendRequest("_agent/detail",Te)).catch(Te=>(O.error("--agent-id ensureAgent failed",{agentId:H.agent_id,err:String(Te)}),{ok:!1,agentId:H.agent_id??"",note:String(Te)}))),{ok:!0,note:"paired with cloud",...V?{agent:V}:{}}}catch(M){return O.error("_agent/pair failed",{err:String(M)}),{ok:!1,note:`pair failed: ${String(M)}`}}}},{method:"POST",path:"/_agent/create",handler:async k=>{let H=k;return{ok:!0,result:await p.createAgent(H)}}},{method:"POST",path:"/refresh",handler:async()=>{O.info("IPC /refresh: re-detecting frameworks");let k=new pt;return a.frameworksCache=await k.detectAll(),await mt(a),{ok:!0,frameworks:a.frameworksCache}}},{method:"POST",path:"/shutdown",handler:async()=>(O.info("IPC /shutdown received"),setImmediate(()=>{Z.shutdown("ipc /shutdown")}),{ok:!0})}]}),{port:Y,token:re}=await U.start();await l.start(),Ca(u,p).catch(k=>O.warn("auto-revive top-level error (ignored)",{err:String(k)}));let ee=null,Z={port:Y,token:re,core:l,ipc:U,shutdown(k){return ee||(O.info("daemon shutdown",{reason:k}),ee=(async()=>{C?.stop(),await l.stop(k),await U.stop(),await n.release()})(),ee)}};for(let k of["SIGTERM","SIGINT"])process.on(k,()=>{Z.shutdown(k).then(()=>process.exit(0))});return O.info("daemon ready",{port:Y,pid:process.pid,nodeVersion:process.version,platform:process.platform,frameworks:Object.keys(a.frameworksCache??{}),libVersion:a.libVersion??"dev"}),Z}function Ea(n){return n.length<=8?"***":`${n.slice(0,4)}***${n.slice(-4)}`}function Gf(n,e,i){return`${n??""}|${e??""}|${i??""}`}async function jf(n,e){let{readdir:i}=await import("node:fs/promises"),a;try{a=await i(n.agentsRoot)}catch{return}let{loadAgentConfig:c,enforceAgentConfigMode:u}=await Promise.resolve().then(()=>(Ke(),on));for(let f of a){await u(f,n).catch(l=>O.warn("enforceAgentConfigMode failed (ignored)",{agentId:f,err:String(l)}));try{let l=await c(f,n);l?.disconnectedAt&&(e.disconnectedAgents.add(f),O.info("agent marked disconnected on startup",{agentId:f,disconnectedAt:l.disconnectedAt,reason:l.disconnectReason??""}))}catch(l){O.warn("failed to load agent config on startup, skipping",{agentId:f,err:String(l)})}}}async function Kf(n,e,i,a){let{loadAgentConfig:c}=await Promise.resolve().then(()=>(Ke(),on)),u=await c(n,e);if(u){O.info("--agent-id: local config found, reconnecting",{agentId:n,framework:u.framework,hadDisconnect:!!u.disconnectedAt});let w={agentId:u.agentId,framework:u.framework,...u.cozeIdentity?{cozeIdentity:u.cozeIdentity}:{},...u.model?{model:u.model}:{}};return await i.createAgent(w),{ok:!0,agentId:n,note:u.disconnectedAt?"revived from local config":"connected from local config"}}O.info("--agent-id: local config missing, pulling _agent/detail from cloud",{agentId:n});let f=await a({_meta:{cozeAgentId:n}});if(!f.framework)throw new S("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:f.agentId,framework:f.framework,...f.cozeIdentity?{cozeIdentity:f.cozeIdentity}:{},...f.model?{model:f.model}:{},...f.deployType?{_meta:{cozeDeployType:f.deployType}}:{}};await i.createAgent(l);let p=f.deployType==="cloud"&&f.framework==="openclaw";return{ok:!0,agentId:n,note:p?"cloud agent acknowledged":"created from cloud detail"}}async function Ca(n,e){let{readdir:i}=await import("node:fs/promises"),a;try{a=await i(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(()=>(Ke(),on));O.info("auto-revive: scanning local agents on startup",{count:a.length});let u=0,f=0;for(let l of a){let p;try{p=await c(l,n)}catch(w){O.warn("auto-revive: load config failed (skipping)",{agentId:l,err:String(w)}),f+=1;continue}if(!p){f+=1;continue}if(p.disconnectedAt){O.info("auto-revive: skip disconnected agent",{agentId:l,disconnectedAt:p.disconnectedAt}),f+=1;continue}try{O.info("auto-revive: re-registering agent (D44 no spawn)",{agentId:l,framework:p.framework}),await e.createAgent({agentId:p.agentId,framework:p.framework,...p.cozeIdentity?{cozeIdentity:p.cozeIdentity}:{},...p.model?{model:p.model}:{},...p.deployType?{_meta:{cozeDeployType:p.deployType}}:{}}),u+=1}catch(w){O.warn("auto-revive: createAgent failed (skipping)",{agentId:l,framework:p.framework,err:String(w)}),f+=1}}return O.info("auto-revive: done",{revived:u,skipped:f,total:a.length}),{revived:u,skipped:f,total:a.length}}as();xe();import{readFile as Pa}from"node:fs/promises";var Xe=class{paths;constructor(e){this.paths=e??K()}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:ed(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([Pa(this.paths.portFile,"utf8"),Pa(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 l=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}),p=await l.text();return{status:l.status,body:Qf(p)}}finally{clearTimeout(f)}}};function Qf(n){if(!n)return null;try{return JSON.parse(n)}catch{return n}}function ed(n){return n instanceof Error?n.message:String(n)}F();xe();import{copyFile as Ia,mkdir as td,readFile as cs,writeFile as nd}from"node:fs/promises";import{dirname as rd,resolve as xs,sep as nr}from"node:path";import{fileURLToPath as sd}from"node:url";F();xe();var Da=T("dist-install");function id(n){let e=sd(n),i=rd(e),a=`${nr}src${nr}`;if(i.includes(a)||i.endsWith(`${nr}src${nr}cli`))return null;let c=xs(i,"index.js"),u=xs(i,"..","package.json");return{dist:c,pkgJson:u}}async function Ta(n={}){let e=n.paths??K(),i=id(import.meta.url),a=n.sourceDist??i?.dist,c=n.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 cs(c,"utf8")).version??"unknown"}catch(_){return Da.warn("cannot read source package.json,skip dist install",{err:String(_)}),{kind:"dev-mode-skip",reason:`package.json read failed: ${String(_)}`}}let f=await In(e.configFile)??{},l=f.libVersion;if(l===u)try{return await cs(e.libEntry),{kind:"already-current",libVersion:u}}catch{}await td(e.libDir,{recursive:!0}),await Ia(a,e.libEntry),await Ia(`${a}.map`,`${e.libEntry}.map`).catch(()=>{});let p=xs(e.libDir,"package.json"),w=`${JSON.stringify({type:"module"},null,2)}
97
- `;return await cs(p,"utf8").catch(()=>null)!==w&&await nd(p,w),f.libVersion=u,await mt(f,e.configFile),Da.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}}var Ed=T("cli");function At(n,e){let i=[],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}i.push(u)}return{value:a,rest:i}}function Cd(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.includes("--help")||e.includes("-h")||e.length===0)return{mode:"help"};let i=e,{value:a,rest:c}=At(i,"--pat-token");i=c;let{value:u,rest:f}=At(i,"--pair-code");i=f;let{value:l,rest:p}=At(i,"--env");i=p;let{value:w,rest:y}=At(i,"--handshake-url");i=y;let{value:_,rest:C}=At(i,"--frontier-url");i=C;let{value:P}=At(i,"--agent-id");if(!a||!u)return{mode:"help"};let I={mode:"pair",privatecode:a,pairingCode:u};return l&&(I.env=l),w&&(I.handshakeUrl=w),_&&(I.frontierUrl=_),P&&(I.agentId=P),I}var Ad=`
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 Ma(n=process.argv,e={}){let i=Cd(n);switch(i.mode){case"help":return process.stdout.write(Ad),0;case"version":return process.stdout.write(`${hn}
126
- `),0;case"daemon":{try{await Aa()}catch(a){return Ed.error("daemon start failed",{err:String(a)}),1}return new Promise(()=>{})}case"status":return kd(e);case"stop":return Pd(e);case"refresh":return Id(e);case"uninstall":return Dd(e);case"install-service":return Td();case"pair":{let a={};return i.env&&(a.env=i.env),i.handshakeUrl&&(a.handshakeUrl=i.handshakeUrl),i.frontierUrl&&(a.frontierUrl=i.frontierUrl),Rd(i.privatecode,i.pairingCode,e,a,i.agentId)}}}async function za(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 kd(n){let e=n.paths??K(),i=new Xe(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 za(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 Pd(n){let e=n.paths??K(),i=new Xe(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 za(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 Id(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)
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 Dd(n){let e=new Xe(n.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(!n.skipSupervisor)try{let{getSupervisor:u,buildContext:f}=await Promise.resolve().then(()=>(ps(),gs)),l=u();await l.uninstall(f()),process.stdout.write(`coze-bridge: ${l.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=n.paths??K(),{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 Td(){try{let{getSupervisor:n,buildContext:e}=await Promise.resolve().then(()=>(ps(),gs)),i=n(),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)
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)
148
180
  `),0}catch(n){return process.stderr.write(`coze-bridge: --install-service failed: ${String(n)}
149
- `),1}}async function Rd(n,e,i,a={},c){let u=new Xe(i.paths),f=i.spawnDaemon??ka;if(!i.skipDistInstall){let w=await Ta({paths:i.paths});w.kind==="version-changed"?(process.stdout.write(`coze-bridge: upgraded ${w.fromVersion} \u2192 ${w.toVersion}
150
- `),(await u.probe()).kind==="connected"&&(await u.request({method:"POST",path:"/shutdown"}).catch(()=>{}),await new Promise(_=>setTimeout(_,500)))):w.kind==="first-install"&&process.stdout.write(`coze-bridge: installed ${w.libVersion}
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}
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
183
  `)}let l=await u.probe();if(l.kind!=="connected"&&(process.stdout.write(`coze-bridge: starting daemon...
152
- `),await f({paths:i.paths}),l=await Nd(u,i.waitTimeoutMs??1e4,i.sleep??Ld),l.kind!=="connected"))return process.stderr.write(`coze-bridge: daemon did not come up: ${l.kind}
153
- `),1;let p={privatecode:n,pairing_code:e};a.env&&(p.env=a.env),a.handshakeUrl&&(p.handshake_url=a.handshakeUrl),a.frontierUrl&&(p.frontier_url=a.frontierUrl),c&&(p.agent_id=c);try{let w=await u.request({method:"POST",path:"/pair",body:p,timeoutMs:35e3});return w.status===200&&w.body?.ok?(process.stdout.write(`coze-bridge: paired (${w.body.note??"ok"})
154
- `),0):(process.stderr.write(`coze-bridge: pair failed: ${JSON.stringify(w.body)}
155
- `),1)}catch(w){return process.stderr.write(`coze-bridge: pair failed: ${String(w)}
156
- `),1}}async function Nd(n,e,i){let a=Date.now()+e;for(;Date.now()<a;){let c=await n.probe(500);if(c.kind==="connected")return c;await i(200)}return n.probe(500)}function Ld(n){return new Promise(e=>setTimeout(e,n))}Ma(process.argv).then(n=>process.exit(n),n=>{process.stderr.write(`fatal: ${n instanceof Error?n.stack??n.message:String(n)}
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"})
186
+ `),0):(process.stderr.write(`coze-bridge: pair failed: ${JSON.stringify(_.body)}
187
+ `),1)}catch(_){return process.stderr.write(`coze-bridge: pair failed: ${String(_)}
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)});