openpond 0.2.68 → 0.2.69
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app-server.js +1 -1
- package/dist/chunks/account-context-V3KLSNKS.js +12 -0
- package/dist/chunks/{acp-2OIXATRY.js → acp-ER6CUXG2.js} +1 -1
- package/dist/chunks/{acp-agent-PAGX2B47.js → acp-agent-AYJ5RPVF.js} +1 -1
- package/dist/chunks/{actions-command-2VE6YI4W.js → actions-command-BBUS3HDK.js} +1 -1
- package/dist/chunks/{app-layer-YNEUEOEP.js → app-layer-JCEWGUDH.js} +1 -1
- package/dist/chunks/{app-server-connected-apps-TZOAUOYR.js → app-server-connected-apps-ILXBFD3S.js} +1 -1
- package/dist/chunks/{app-server-runtime-GBX65JJ7.js → app-server-runtime-43MCH5SY.js} +1 -1
- package/dist/chunks/{apps-RSFEJOQN.js → apps-VNFGMQFG.js} +1 -1
- package/dist/chunks/{chunk-DWM5G7BU.js → chunk-22RLEU3Q.js} +1 -1
- package/dist/chunks/chunk-7EQLW2KM.js +12 -0
- package/dist/chunks/chunk-BDZDWHBJ.js +6 -0
- package/dist/chunks/{chunk-GEYZVOGD.js → chunk-EWDDDHJN.js} +1 -1
- package/dist/chunks/{chunk-XQAUHXL4.js → chunk-G4FRBT7G.js} +2 -2
- package/dist/chunks/{chunk-FKUWCJ73.js → chunk-LSKMALD6.js} +1 -1
- package/dist/chunks/chunk-M5X7XKXY.js +12 -0
- package/dist/chunks/{chunk-OIH2LPIT.js → chunk-NW6WGGSL.js} +1 -1
- package/dist/chunks/{chunk-JPUSTFZC.js → chunk-NZDLL6JN.js} +1 -1
- package/dist/chunks/{chunk-RBTDSI4L.js → chunk-R6I623SZ.js} +6 -6
- package/dist/chunks/{chunk-MEJLWNRS.js → chunk-RCRZXHAI.js} +1 -1
- package/dist/chunks/{chunk-BHKXPWFB.js → chunk-TB5P3FWM.js} +1 -1
- package/dist/chunks/{chunk-73TW6BKK.js → chunk-Z5CQXPIS.js} +1 -1
- package/dist/chunks/{configuration-command-CNITTZRP.js → configuration-command-C3QBDFND.js} +1 -1
- package/dist/chunks/{connected-app-executor-FGWCLOJO.js → connected-app-executor-LAEAQUJS.js} +1 -1
- package/dist/chunks/{connected-evidence-5VZBYNWN.js → connected-evidence-VKY6O2JW.js} +1 -1
- package/dist/chunks/{connected-starting-assets-KWOFEIE4.js → connected-starting-assets-5LAJ7CZY.js} +1 -1
- package/dist/chunks/{core-commands-BPYXVT7O.js → core-commands-5TNBVR72.js} +1 -1
- package/dist/chunks/{datasets-E5TXSVIY.js → datasets-BIDZJYDC.js} +1 -1
- package/dist/chunks/{desktop-test-FX7DTY4N.js → desktop-test-BY2MS3UL.js} +1 -1
- package/dist/chunks/{evaluation-coordination-KUTZEEPB.js → evaluation-coordination-FXB4DXZA.js} +1 -1
- package/dist/chunks/{experiment-improvements-PQNR5YHN.js → experiment-improvements-JPDLKZXD.js} +1 -1
- package/dist/chunks/{experiments-Z4BJWT3Y.js → experiments-IEN7RXLX.js} +1 -1
- package/dist/chunks/{experiments-signal-3GCLKUWZ.js → experiments-signal-L32D36NH.js} +1 -1
- package/dist/chunks/{help-K6YLZ3KL.js → help-PLQJOP4P.js} +1 -1
- package/dist/chunks/{hosted-app-server-composition-LA3BZ4SE.js → hosted-app-server-composition-GZES7QXJ.js} +1 -1
- package/dist/chunks/{hosted-tasksets-NXVF4AQA.js → hosted-tasksets-V24IBVJX.js} +1 -1
- package/dist/chunks/{human-review-2ZOB7CJZ.js → human-review-6V6EMNVN.js} +1 -1
- package/dist/chunks/{import-YHYKZ6JN.js → import-SI24Z7EF.js} +1 -1
- package/dist/chunks/{opchat-XXI2ZM53.js → opchat-SV67HVMX.js} +1 -1
- package/dist/chunks/{opchat-bounded-chat-3MZGCRLY.js → opchat-bounded-chat-KLMIYSZZ.js} +1 -1
- package/dist/chunks/{organizations-W7HI2JA4.js → organizations-OZZFX7RG.js} +1 -1
- package/dist/chunks/{profile-P2SJPBOJ.js → profile-TD5U3INY.js} +1 -1
- package/dist/chunks/{project-action-payload-LTIQBX77.js → project-action-payload-TK6G4VMC.js} +1 -1
- package/dist/chunks/{project-agent-XRIXMXQK.js → project-agent-FFXPNXCO.js} +1 -1
- package/dist/chunks/sandbox-command-4BCUDAED.js +2 -0
- package/dist/chunks/{sandbox-template-U536EEWY.js → sandbox-template-GOY7QQUY.js} +1 -1
- package/dist/chunks/{saved-work-KSIQPXC2.js → saved-work-M6PUHKCC.js} +1 -1
- package/dist/chunks/{src-SGQYVBNQ.js → src-MT4B43TD.js} +1 -1
- package/dist/chunks/{teams-bot-MPWL2PP4.js → teams-bot-YCUTDDDC.js} +1 -1
- package/dist/cli.js +1 -1
- package/dist/index.js +1 -1
- package/dist/sandbox/runtime-handle.d.ts +3 -5
- package/dist/sandbox/sandbox-instance-client.d.ts +11 -5
- package/dist/sandbox/types/billing.d.ts +53 -0
- package/dist/sandbox/types/responses.d.ts +11 -1
- package/dist/sandbox/types/snapshots.d.ts +52 -3
- package/dist/skills/manifest.json +1 -1
- package/docs/command-reference.md +11 -0
- package/package.json +1 -1
- package/dist/chunks/account-context-MWB6HN6I.js +0 -12
- package/dist/chunks/chunk-27JGS3KB.js +0 -12
- package/dist/chunks/chunk-DRTHKWHK.js +0 -6
- package/dist/chunks/chunk-KOC3YJEU.js +0 -12
- package/dist/chunks/sandbox-command-HVA5FJU4.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{a as Ee,o as Re}from"./chunk-DRTHKWHK.js";import{m as he}from"./chunk-OIH2LPIT.js";import{a as ce,b as le,d as me,e as ue,k as pe,m as N,n as fe,o as be,r as xe,v as g,w as ge,x as Se}from"./chunk-JPUSTFZC.js";import{c as ie}from"./chunk-RFQD6B44.js";import"./chunk-DWM5G7BU.js";import"./chunk-RBTDSI4L.js";import"./chunk-XRKFTPHD.js";import{k as de}from"./chunk-JEMECEQH.js";import"./chunk-73TW6BKK.js";import"./chunk-27JGS3KB.js";import"./chunk-BT5YNE5U.js";import{d as se}from"./chunk-RPM4FDRX.js";import"./chunk-KTIBXRWQ.js";import"./chunk-KP2MYTP5.js";import"./chunk-PNPV2LDE.js";import"./chunk-4G3GTEVS.js";import"./chunk-KU4TPDPH.js";import"./chunk-55YD4UTW.js";import"./chunk-AFYYIJ6K.js";import"./chunk-J256AEEE.js";import"./chunk-UN2LKLGV.js";import"./chunk-2LJCJOJ7.js";import"./chunk-AMC4Z7G4.js";import"./chunk-LK77GI6M.js";import"./chunk-HVM2GUM3.js";import"./chunk-I6VMRQF4.js";import"./chunk-D6L6UNUQ.js";import"./chunk-AJXWJLZA.js";import"./chunk-OKKNDQJF.js";import"./chunk-4PUOWSDE.js";import"./chunk-ZY32SZ2P.js";import"./chunk-OTDDXEQ6.js";import"./chunk-ECOH24MC.js";import"./chunk-3A7HZJNE.js";import{c as f,d as we,e as Te,h as O,k as C,q as v,r as ye,s as U,t as Pe,u as ve}from"./chunk-G7X73SBG.js";import{f as ae,h as oe}from"./chunk-BSHAIAXY.js";import"./chunk-XWPC3AN4.js";import{a as M,f as h,h as R}from"./chunk-3M53YXEI.js";import"./chunk-GLUWATL5.js";import"./chunk-JCLTFDVW.js";import"./chunk-6FA3GG5B.js";import"./chunk-SV7ZBEK2.js";import"./chunk-2MEOUS24.js";import"./chunk-HNQPEOJD.js";import"./chunk-RCT3O3HQ.js";import"./chunk-UGOK7VTC.js";import"./chunk-TBODQT4W.js";import"./chunk-5HPZGLOL.js";import"./chunk-ZFJWA4JK.js";import"./chunk-X2J2P5ZT.js";import{a as i}from"./chunk-FTQLQJQV.js";import{promises as P,existsSync as kt}from"node:fs";import b from"node:path";import{Buffer as ht}from"node:buffer";import{promises as y}from"node:fs";import w from"node:path";import{Buffer as Ve}from"node:buffer";import{promises as j}from"node:fs";import S from"node:path";async function q(e,t,n,r){let a=Ie(n,r);if(!a)return[];let o=Oe(n,r),s=typeof r.projectId=="string"&&r.projectId.trim()?r.projectId.trim():typeof r.runtimeProjectId=="string"?r.runtimeProjectId.trim():"",d=typeof r.teamId=="string"?r.teamId.trim():"",c=[];for(let l of a.schedules){let u=Ce({manifest:n,schedule:l,override:o.get(l.name),mode:a.mode,sourceSandboxId:t,teamId:d,projectId:s}),m=await e.createSchedule(u);c.push({id:m.schedule.id,name:m.schedule.name,enabled:m.schedule.enabled,scheduleType:m.schedule.scheduleType,scheduleExpression:m.schedule.scheduleExpression,syncStatus:m.schedule.syncStatus,awsScheduleArn:m.schedule.awsScheduleArn??null,target:m.schedule.target})}return c}i(q,"createSandboxTemplateStartSchedules");function Ie(e,t){let n=t.enableSchedules??t.enableSchedule,r=t.disableSchedules??t.disableSchedule;if(n!==void 0&&r!==void 0)throw new Error("pass only one of --enable-schedules or --disable-schedules");let a=null,o;if(n!==void 0)a="enabled",o=n;else if(r!==void 0)a="disabled",o=r;else if(t.schedules!==void 0){o=t.schedules;let c=typeof t.scheduleMode=="string"?t.scheduleMode.trim().toLowerCase():"disabled";if(c==="none")return null;if(c!=="enabled"&&c!=="disabled")throw new Error("--schedule-mode must be enabled, disabled, or none");a=c}if(!a)return null;if(e.schedules.length===0)return{mode:a,schedules:[]};let s=ke(o,e),d=s===null?e.schedules:e.schedules.filter(c=>s.has(c.name));return{mode:a,schedules:d}}i(Ie,"resolveSandboxTemplateStartScheduleSelection");function ke(e,t){if(e===void 0||e===!0)return null;let n=String(e).trim();if(!n||n==="true"||n.toLowerCase()==="all")return null;if(n.toLowerCase()==="none")return new Set;let r=new Set(t.schedules.map(o=>o.name)),a=new Set(n.split(",").map(o=>o.trim()).filter(Boolean));for(let o of a)if(!r.has(o))throw new Error(`manifest schedule not found: ${o}`);return a}i(ke,"parseSandboxTemplateScheduleNameSelection");function Oe(e,t){let n=typeof t.scheduleOverrides=="string"?t.scheduleOverrides:typeof t.scheduleOverride=="string"?t.scheduleOverride:"";if(!n.trim())return new Map;let r=M(n,"schedule-overrides");if(!r||typeof r!="object"||Array.isArray(r))throw new Error("schedule-overrides must be a JSON object keyed by schedule name");let a=new Set(e.schedules.map(s=>s.name)),o=new Map;for(let[s,d]of Object.entries(r)){if(!a.has(s))throw new Error(`schedule override target does not exist: ${s}`);if(!d||typeof d!="object"||Array.isArray(d))throw new Error(`schedule override for ${s} must be an object`);o.set(s,d)}return o}i(Oe,"parseSandboxTemplateScheduleOverrides");function Ce(e){let t=Me(e.schedule,e.override),n=Ne(t);return{sourceSandboxId:e.sourceSandboxId,...e.teamId?{teamId:e.teamId}:{},...e.projectId?{projectId:e.projectId}:{},name:t.name,...t.description?{description:t.description}:{},...n,...t.timezone?{timezone:t.timezone}:{},enabled:typeof e.override?.enabled=="boolean"?e.override.enabled:e.mode==="enabled",...t.startAt?{startAt:t.startAt}:{},...t.endAt?{endAt:t.endAt}:{},...t.maxRuns!==void 0?{maxRuns:t.maxRuns}:{},runtimePolicy:t.runtimePolicy,target:Ae(e.manifest,t),...t.budget?{budget:t.budget}:{},...t.resources?{resources:t.resources}:{},...t.quotas?{quotas:t.quotas}:{},...t.lifecycle?{lifecycle:t.lifecycle}:{},...t.retentionPolicy?{retentionPolicy:t.retentionPolicy}:{},...t.env?{env:t.env}:{},...t.integrationLeases?{integrationLeases:t.integrationLeases}:{},metadata:{...t.metadata??{},manifestScheduleName:t.name,source:"openpond-code-sandbox-template-start"},managementSource:"openpond.yaml",manifestPath:f}}i(Ce,"buildSandboxTemplateStartScheduleInput");function Me(e,t){return t?{...e,...t,target:e.target||t.target?{...e.target??{},...t.target??{}}:void 0,metadata:e.metadata||t.metadata?{...e.metadata??{},...t.metadata??{}}:void 0}:e}i(Me,"mergeSandboxTemplateScheduleOverride");function Ne(e){return e.scheduleExpression?{scheduleType:e.scheduleType??"cron",scheduleExpression:e.scheduleExpression}:e.rate?{scheduleType:"rate",scheduleExpression:/^rate\(/i.test(e.rate)?e.rate:`rate(${e.rate})`}:e.once?{scheduleType:"once",scheduleExpression:/^at\(/i.test(e.once)?e.once:`at(${e.once})`}:{scheduleType:"cron",scheduleExpression:e.cron??""}}i(Ne,"sandboxTemplateScheduleExpression");function Ae(e,t){let n=t.command??t.target?.command??null;if(n)return{kind:"command",command:n,requiresStart:t.requiresStart??t.target?.requiresStart??!1};let r=t.target?.kind??"action";if(r==="start")return{kind:"command",command:e.start.command,requiresStart:t.requiresStart??t.target?.requiresStart??e.start.requiresStart??!1};if(r==="service"){let s=t.target?.name??"",d=e.services.find(c=>c.name===s);if(!d)throw new Error(`schedule service target does not exist: ${s}`);return{kind:"command",command:d.command,requiresStart:t.requiresStart??t.target?.requiresStart??d.requiresStart??!1}}let a=t.actionName??t.action??t.target?.actionName??(t.target?.kind==="action"?t.target?.name:void 0),o=e.actions.find(s=>s.name===a);if(!o)throw new Error(`schedule action target does not exist: ${a??""}`);return{kind:"command",command:o.command,requiresStart:t.requiresStart??t.target?.requiresStart??o.requiresStart??!1}}i(Ae,"sandboxTemplateScheduleCommandTarget");import{existsSync as Ge}from"node:fs";import We from"node:path";import{stdin as Ke}from"node:process";async function D(e,t,n){let r=typeof t.repo=="string"?t.repo.trim():"";if(r)return A(r);await $e(n);let a=await se(),o=ae(a),s=oe(a),d=await ie(a,o),c=await Se(n,"origin");if(!c){let l=typeof t.teamId=="string"?t.teamId.trim():"",u=await de(s,d,{name:e.name,description:e.description,repoInit:"empty",...l?{teamId:l}:{}});c=ce(u);let m=await g("git",["remote","add","origin",c],{cwd:n});if(m.code!==0)throw new Error(`git remote add failed: ${m.stderr.trim()||m.stdout.trim()||"unknown error"}`)}if(ue(c),await Fe(n,t),!h(t.noPush)){let l=await je(n,t);await Be(n,c,l,d,t)}return A(c)}i(D,"resolveSandboxTemplateStartRepo");async function $e(e){let t=We.join(e,".git");if(Ge(t))return;let n=await g("git",["init"],{cwd:e});if(n.code!==0)throw new Error(`git init failed: ${n.stderr.trim()||n.stdout.trim()||"unknown error"}`)}i($e,"ensureGitRepository");async function Fe(e,t){let n=await g("git",["status","--porcelain"],{cwd:e});if(n.code!==0)throw new Error(`git status failed: ${n.stderr.trim()||n.stdout.trim()||"unknown error"}`);let a=(await g("git",["rev-parse","--verify","HEAD"],{cwd:e})).code===0,o=n.stdout.trim().length>0;if(!o&&a)return;if(!(h(t.commit)||h(t.yes)||(Ke.isTTY?await pe(a?"Commit local changes before starting the sandbox?":"Create the initial git commit before starting the sandbox?",!a):!1))){if(!a)throw new Error("local repository has no commits; pass --commit or commit before starting");o&&console.warn("warning: uncommitted local changes will not be included in the sandbox");return}let d=await g("git",["add","-A"],{cwd:e});if(d.code!==0)throw new Error(`git add failed: ${d.stderr.trim()||d.stdout.trim()||"unknown error"}`);let c=typeof t.commitMessage=="string"&&t.commitMessage.trim()?t.commitMessage.trim():`start ${f} sandbox`,l=await g("git",["commit","-m",c],{cwd:e});if(l.code!==0){let u=l.stderr.trim()||l.stdout.trim();if(u.includes("nothing to commit")&&a)return;throw new Error(`git commit failed: ${u||"unknown error"}`)}}i(Fe,"ensureGitCommitForSandboxTemplateStart");async function je(e,t){let r=(typeof t.branch=="string"?t.branch.trim():"")||await he(e);if(!r)throw new Error("unable to resolve git branch; pass --branch");return r}i(je,"resolveSandboxTemplateStartBranch");async function Be(e,t,n,r,a){let o;try{o=le(t,r)}catch{throw new Error("origin remote must be https for tokenized pushes")}let s=h(a.keepTokenRemote)||h(a.token)||h(a.setRemoteToken),d=t.includes("x-access-token:"),c=!s&&!d?t:null,l=process.env.GIT_TERMINAL_PROMPT;process.env.GIT_TERMINAL_PROMPT="0";try{if(!d){let m=await g("git",["remote","set-url","origin",o],{cwd:e});if(m.code!==0)throw new Error(`git remote set-url failed: ${me(m.stderr.trim()||m.stdout.trim()||"unknown error")}`)}if((await g("git",["push","-u","origin",n],{cwd:e,inherit:!0})).code!==0)throw new Error("git push failed")}finally{c&&await g("git",["remote","set-url","origin",c],{cwd:e}).catch(()=>null),l===void 0?delete process.env.GIT_TERMINAL_PROMPT:process.env.GIT_TERMINAL_PROMPT=l}}i(Be,"pushGitBranchForSandboxTemplateStart");function $(e){return A(e).replace(/\.git$/,"")}i($,"normalizeSandboxTemplateRepoIdentity");function A(e){let t=new URL(e);t.username="",t.password="";let n=t.toString();return n.endsWith(".git")?n:`${n.replace(/\/$/,"")}.git`}i(A,"normalizeSandboxTemplateRepoUrl");async function _e(e){let t=L(e),n=S.dirname(t),r=await j.readFile(t,"utf8"),a=O(r);if(!a.ok){console.error(C(a.diagnostics)),process.exitCode=1;return}let o=a.manifest,s=G(o,e),d=await B(o,e,n),c=await D(o,e,n),l=await N(e),u=Ye(o,e,c),m=await Qe(l,u,c);await tt(l,m.id);let p=await ut(l,m.id,o,e),x=await V(l,m.id,d.uploadRequests),T={...d.scalars,..._(x,d.uploadRequests)},I=await X(l,m.id,s,T,bt(m)),k=await St(l,m.id,s.ports),E=await q(l,m.id,o,e);console.log(JSON.stringify({ok:!0,file:t,repo:c,executable:{kind:s.kind,name:s.name,command:s.command},sandbox:Re(m),setupCommands:p,uploadedFiles:x,input:T,execution:I,previews:k,schedules:E,expectedArtifacts:s.artifactPaths},null,2))}i(_e,"runSandboxTemplateStart");function G(e,t){let n=v(e),r=typeof t.action=="string"?t.action.trim():"",a=typeof t.service=="string"?t.service.trim():"",o=typeof t.target=="string"?t.target.trim():"",s=typeof t.entrypoint=="string"?t.entrypoint.trim():"",d=r||a||o||s||"start",c=r?"action":a?"service":"",l=n.find(u=>u.name===d&&(!c||u.kind===c));if(!l)throw new Error(`manifest executable not found: ${d}. Available: ${n.map(u=>`${u.kind}:${u.name}`).join(", ")}`);return l}i(G,"resolveSandboxTemplateStartExecutable");function Ye(e,t,n){let r=typeof t.budgetUsd=="string"&&t.budgetUsd.trim()?t.budgetUsd.trim():typeof t.budget=="string"&&t.budget.trim()?t.budget.trim():"0.05",a=R(t.maxDurationSeconds,"max-duration-seconds"),o=R(t.idleTimeoutSeconds,"idle-timeout-seconds"),s=typeof t.teamId=="string"?t.teamId.trim():"",d=typeof t.projectId=="string"?t.projectId.trim():"",c=typeof t.runtimeProjectId=="string"?t.runtimeProjectId.trim():"";if(d&&c&&d!==c)throw new Error("project-id and runtime-project-id must match when both are set");let l=d||c,u=typeof t.agentId=="string"?t.agentId.trim():"",m=typeof t.runtimeAgentId=="string"?t.runtimeAgentId.trim():"";if(u&&m&&u!==m)throw new Error("agent-id and runtime-agent-id must match when both are set");let p=u||m,x=fe(t.workflowMode),T=be(t.runtimePromotionPolicy),I=typeof t.runtimeBaseBranch=="string"&&t.runtimeBaseBranch.trim()?t.runtimeBaseBranch.trim():"",k=typeof t.runtimeBaseSha=="string"&&t.runtimeBaseSha.trim()?t.runtimeBaseSha.trim():"",E=typeof t.runtimeId=="string"&&t.runtimeId.trim()?t.runtimeId.trim():"",te=!!(x||T||I||k||E||c||m),ne=xe(e,t),re=Xe(e);return{sandbox:{repo:n,...s?{teamId:s}:{},...l?{projectId:l}:{},...p?{agentId:p}:{},resources:e.resources??{},networkPolicy:{internetEgress:He(e.network.egress)},budget:{maxUsd:r},quotas:{maxSpendUsd:r,...a!==void 0?{maxDurationSeconds:a}:{},...o!==void 0?{idleTimeoutSeconds:o}:{}},...ne.length>0?{env:ne}:{},...re?{workloadSource:re}:{},volumes:e.volumes,metadata:{source:"openpond-code-sandbox-template-start",manifestFile:f,template:{name:e.name,version:e.version,useCase:e.useCase}}},...te&&E?{runtimeId:E}:{},...te&&!E?{sandboxRuntime:{...s?{teamId:s}:{},...x?{workflowMode:x}:{},...l?{projectId:l}:{},...p?{agentId:p}:{},baseBranch:I||"master",...k?{baseSha:k}:{},...T?{promotionPolicy:T}:{}}}:{}}}i(Ye,"buildSandboxTemplateStartCreateInput");function Xe(e){if(e.runtime.image)return{image:e.runtime.image};if(e.runtime.dockerfile)return{dockerfile:e.runtime.dockerfile}}i(Xe,"sandboxWorkloadSourceFromManifest");function He(e){return e==="allow"?"allow":"block"}i(He,"sandboxTemplateInternetEgressPolicy");async function Qe(e,t,n){let r=Date.now();try{return(await Ee(e,t)).sandbox}catch(a){if(!Ze(a))throw a;return console.warn("warning: sandbox create timed out; checking for the created sandbox record"),et(e,t.sandbox,n,r)}}i(Qe,"createSandboxTemplateStartSandbox");function Ze(e){return e instanceof Error&&/\b(504|timed out|timeout)\b/i.test(e.message)}i(Ze,"isLikelySandboxCreateTimeout");async function et(e,t,n,r){let s=Date.now()+72e4,d=$(n),c=t.metadata??{};for(;Date.now()<s;){let u=(await e.list({...t.teamId?{teamId:t.teamId}:{},...t.projectId?{projectId:t.projectId}:{},...t.agentId?{agentId:t.agentId}:{}})).filter(m=>{if(!m.repo||$(m.repo)!==d)return!1;let p=Date.parse(m.createdAt);return!(Number.isFinite(p)&&p<r-3e4||c.source&&m.metadata?.source!==c.source)}).sort((m,p)=>Date.parse(p.createdAt)-Date.parse(m.createdAt))[0];if(u?.state==="running"||u?.state==="stopped")return u;if(u?.state==="error")throw new Error(`sandbox create failed after timeout: ${u.id}
|
|
2
|
+
import{d as Ee,r as Re}from"./chunk-BDZDWHBJ.js";import{m as he}from"./chunk-NW6WGGSL.js";import{a as ce,b as le,d as me,e as ue,k as pe,m as N,n as fe,o as be,r as xe,v as g,w as ge,x as Se}from"./chunk-NZDLL6JN.js";import{c as ie}from"./chunk-RFQD6B44.js";import"./chunk-22RLEU3Q.js";import"./chunk-R6I623SZ.js";import"./chunk-XRKFTPHD.js";import{k as de}from"./chunk-JEMECEQH.js";import"./chunk-Z5CQXPIS.js";import"./chunk-7EQLW2KM.js";import"./chunk-BT5YNE5U.js";import{d as se}from"./chunk-RPM4FDRX.js";import"./chunk-KTIBXRWQ.js";import"./chunk-KP2MYTP5.js";import"./chunk-PNPV2LDE.js";import"./chunk-4G3GTEVS.js";import"./chunk-KU4TPDPH.js";import"./chunk-55YD4UTW.js";import"./chunk-AFYYIJ6K.js";import"./chunk-J256AEEE.js";import"./chunk-UN2LKLGV.js";import"./chunk-2LJCJOJ7.js";import"./chunk-AMC4Z7G4.js";import"./chunk-LK77GI6M.js";import"./chunk-HVM2GUM3.js";import"./chunk-I6VMRQF4.js";import"./chunk-D6L6UNUQ.js";import"./chunk-AJXWJLZA.js";import"./chunk-OKKNDQJF.js";import"./chunk-4PUOWSDE.js";import"./chunk-ZY32SZ2P.js";import"./chunk-OTDDXEQ6.js";import"./chunk-ECOH24MC.js";import"./chunk-3A7HZJNE.js";import{c as f,d as we,e as Te,h as O,k as C,q as v,r as ye,s as U,t as Pe,u as ve}from"./chunk-G7X73SBG.js";import{f as ae,h as oe}from"./chunk-BSHAIAXY.js";import"./chunk-XWPC3AN4.js";import{a as M,f as h,h as R}from"./chunk-3M53YXEI.js";import"./chunk-GLUWATL5.js";import"./chunk-JCLTFDVW.js";import"./chunk-6FA3GG5B.js";import"./chunk-SV7ZBEK2.js";import"./chunk-2MEOUS24.js";import"./chunk-HNQPEOJD.js";import"./chunk-RCT3O3HQ.js";import"./chunk-UGOK7VTC.js";import"./chunk-TBODQT4W.js";import"./chunk-5HPZGLOL.js";import"./chunk-ZFJWA4JK.js";import"./chunk-X2J2P5ZT.js";import{a as i}from"./chunk-FTQLQJQV.js";import{promises as P,existsSync as kt}from"node:fs";import b from"node:path";import{Buffer as ht}from"node:buffer";import{promises as y}from"node:fs";import w from"node:path";import{Buffer as Ve}from"node:buffer";import{promises as j}from"node:fs";import S from"node:path";async function q(e,t,n,r){let a=Ie(n,r);if(!a)return[];let o=Oe(n,r),s=typeof r.projectId=="string"&&r.projectId.trim()?r.projectId.trim():typeof r.runtimeProjectId=="string"?r.runtimeProjectId.trim():"",d=typeof r.teamId=="string"?r.teamId.trim():"",c=[];for(let l of a.schedules){let u=Ce({manifest:n,schedule:l,override:o.get(l.name),mode:a.mode,sourceSandboxId:t,teamId:d,projectId:s}),m=await e.createSchedule(u);c.push({id:m.schedule.id,name:m.schedule.name,enabled:m.schedule.enabled,scheduleType:m.schedule.scheduleType,scheduleExpression:m.schedule.scheduleExpression,syncStatus:m.schedule.syncStatus,awsScheduleArn:m.schedule.awsScheduleArn??null,target:m.schedule.target})}return c}i(q,"createSandboxTemplateStartSchedules");function Ie(e,t){let n=t.enableSchedules??t.enableSchedule,r=t.disableSchedules??t.disableSchedule;if(n!==void 0&&r!==void 0)throw new Error("pass only one of --enable-schedules or --disable-schedules");let a=null,o;if(n!==void 0)a="enabled",o=n;else if(r!==void 0)a="disabled",o=r;else if(t.schedules!==void 0){o=t.schedules;let c=typeof t.scheduleMode=="string"?t.scheduleMode.trim().toLowerCase():"disabled";if(c==="none")return null;if(c!=="enabled"&&c!=="disabled")throw new Error("--schedule-mode must be enabled, disabled, or none");a=c}if(!a)return null;if(e.schedules.length===0)return{mode:a,schedules:[]};let s=ke(o,e),d=s===null?e.schedules:e.schedules.filter(c=>s.has(c.name));return{mode:a,schedules:d}}i(Ie,"resolveSandboxTemplateStartScheduleSelection");function ke(e,t){if(e===void 0||e===!0)return null;let n=String(e).trim();if(!n||n==="true"||n.toLowerCase()==="all")return null;if(n.toLowerCase()==="none")return new Set;let r=new Set(t.schedules.map(o=>o.name)),a=new Set(n.split(",").map(o=>o.trim()).filter(Boolean));for(let o of a)if(!r.has(o))throw new Error(`manifest schedule not found: ${o}`);return a}i(ke,"parseSandboxTemplateScheduleNameSelection");function Oe(e,t){let n=typeof t.scheduleOverrides=="string"?t.scheduleOverrides:typeof t.scheduleOverride=="string"?t.scheduleOverride:"";if(!n.trim())return new Map;let r=M(n,"schedule-overrides");if(!r||typeof r!="object"||Array.isArray(r))throw new Error("schedule-overrides must be a JSON object keyed by schedule name");let a=new Set(e.schedules.map(s=>s.name)),o=new Map;for(let[s,d]of Object.entries(r)){if(!a.has(s))throw new Error(`schedule override target does not exist: ${s}`);if(!d||typeof d!="object"||Array.isArray(d))throw new Error(`schedule override for ${s} must be an object`);o.set(s,d)}return o}i(Oe,"parseSandboxTemplateScheduleOverrides");function Ce(e){let t=Me(e.schedule,e.override),n=Ne(t);return{sourceSandboxId:e.sourceSandboxId,...e.teamId?{teamId:e.teamId}:{},...e.projectId?{projectId:e.projectId}:{},name:t.name,...t.description?{description:t.description}:{},...n,...t.timezone?{timezone:t.timezone}:{},enabled:typeof e.override?.enabled=="boolean"?e.override.enabled:e.mode==="enabled",...t.startAt?{startAt:t.startAt}:{},...t.endAt?{endAt:t.endAt}:{},...t.maxRuns!==void 0?{maxRuns:t.maxRuns}:{},runtimePolicy:t.runtimePolicy,target:Ae(e.manifest,t),...t.budget?{budget:t.budget}:{},...t.resources?{resources:t.resources}:{},...t.quotas?{quotas:t.quotas}:{},...t.lifecycle?{lifecycle:t.lifecycle}:{},...t.retentionPolicy?{retentionPolicy:t.retentionPolicy}:{},...t.env?{env:t.env}:{},...t.integrationLeases?{integrationLeases:t.integrationLeases}:{},metadata:{...t.metadata??{},manifestScheduleName:t.name,source:"openpond-code-sandbox-template-start"},managementSource:"openpond.yaml",manifestPath:f}}i(Ce,"buildSandboxTemplateStartScheduleInput");function Me(e,t){return t?{...e,...t,target:e.target||t.target?{...e.target??{},...t.target??{}}:void 0,metadata:e.metadata||t.metadata?{...e.metadata??{},...t.metadata??{}}:void 0}:e}i(Me,"mergeSandboxTemplateScheduleOverride");function Ne(e){return e.scheduleExpression?{scheduleType:e.scheduleType??"cron",scheduleExpression:e.scheduleExpression}:e.rate?{scheduleType:"rate",scheduleExpression:/^rate\(/i.test(e.rate)?e.rate:`rate(${e.rate})`}:e.once?{scheduleType:"once",scheduleExpression:/^at\(/i.test(e.once)?e.once:`at(${e.once})`}:{scheduleType:"cron",scheduleExpression:e.cron??""}}i(Ne,"sandboxTemplateScheduleExpression");function Ae(e,t){let n=t.command??t.target?.command??null;if(n)return{kind:"command",command:n,requiresStart:t.requiresStart??t.target?.requiresStart??!1};let r=t.target?.kind??"action";if(r==="start")return{kind:"command",command:e.start.command,requiresStart:t.requiresStart??t.target?.requiresStart??e.start.requiresStart??!1};if(r==="service"){let s=t.target?.name??"",d=e.services.find(c=>c.name===s);if(!d)throw new Error(`schedule service target does not exist: ${s}`);return{kind:"command",command:d.command,requiresStart:t.requiresStart??t.target?.requiresStart??d.requiresStart??!1}}let a=t.actionName??t.action??t.target?.actionName??(t.target?.kind==="action"?t.target?.name:void 0),o=e.actions.find(s=>s.name===a);if(!o)throw new Error(`schedule action target does not exist: ${a??""}`);return{kind:"command",command:o.command,requiresStart:t.requiresStart??t.target?.requiresStart??o.requiresStart??!1}}i(Ae,"sandboxTemplateScheduleCommandTarget");import{existsSync as Ge}from"node:fs";import We from"node:path";import{stdin as Ke}from"node:process";async function D(e,t,n){let r=typeof t.repo=="string"?t.repo.trim():"";if(r)return A(r);await $e(n);let a=await se(),o=ae(a),s=oe(a),d=await ie(a,o),c=await Se(n,"origin");if(!c){let l=typeof t.teamId=="string"?t.teamId.trim():"",u=await de(s,d,{name:e.name,description:e.description,repoInit:"empty",...l?{teamId:l}:{}});c=ce(u);let m=await g("git",["remote","add","origin",c],{cwd:n});if(m.code!==0)throw new Error(`git remote add failed: ${m.stderr.trim()||m.stdout.trim()||"unknown error"}`)}if(ue(c),await Fe(n,t),!h(t.noPush)){let l=await je(n,t);await Be(n,c,l,d,t)}return A(c)}i(D,"resolveSandboxTemplateStartRepo");async function $e(e){let t=We.join(e,".git");if(Ge(t))return;let n=await g("git",["init"],{cwd:e});if(n.code!==0)throw new Error(`git init failed: ${n.stderr.trim()||n.stdout.trim()||"unknown error"}`)}i($e,"ensureGitRepository");async function Fe(e,t){let n=await g("git",["status","--porcelain"],{cwd:e});if(n.code!==0)throw new Error(`git status failed: ${n.stderr.trim()||n.stdout.trim()||"unknown error"}`);let a=(await g("git",["rev-parse","--verify","HEAD"],{cwd:e})).code===0,o=n.stdout.trim().length>0;if(!o&&a)return;if(!(h(t.commit)||h(t.yes)||(Ke.isTTY?await pe(a?"Commit local changes before starting the sandbox?":"Create the initial git commit before starting the sandbox?",!a):!1))){if(!a)throw new Error("local repository has no commits; pass --commit or commit before starting");o&&console.warn("warning: uncommitted local changes will not be included in the sandbox");return}let d=await g("git",["add","-A"],{cwd:e});if(d.code!==0)throw new Error(`git add failed: ${d.stderr.trim()||d.stdout.trim()||"unknown error"}`);let c=typeof t.commitMessage=="string"&&t.commitMessage.trim()?t.commitMessage.trim():`start ${f} sandbox`,l=await g("git",["commit","-m",c],{cwd:e});if(l.code!==0){let u=l.stderr.trim()||l.stdout.trim();if(u.includes("nothing to commit")&&a)return;throw new Error(`git commit failed: ${u||"unknown error"}`)}}i(Fe,"ensureGitCommitForSandboxTemplateStart");async function je(e,t){let r=(typeof t.branch=="string"?t.branch.trim():"")||await he(e);if(!r)throw new Error("unable to resolve git branch; pass --branch");return r}i(je,"resolveSandboxTemplateStartBranch");async function Be(e,t,n,r,a){let o;try{o=le(t,r)}catch{throw new Error("origin remote must be https for tokenized pushes")}let s=h(a.keepTokenRemote)||h(a.token)||h(a.setRemoteToken),d=t.includes("x-access-token:"),c=!s&&!d?t:null,l=process.env.GIT_TERMINAL_PROMPT;process.env.GIT_TERMINAL_PROMPT="0";try{if(!d){let m=await g("git",["remote","set-url","origin",o],{cwd:e});if(m.code!==0)throw new Error(`git remote set-url failed: ${me(m.stderr.trim()||m.stdout.trim()||"unknown error")}`)}if((await g("git",["push","-u","origin",n],{cwd:e,inherit:!0})).code!==0)throw new Error("git push failed")}finally{c&&await g("git",["remote","set-url","origin",c],{cwd:e}).catch(()=>null),l===void 0?delete process.env.GIT_TERMINAL_PROMPT:process.env.GIT_TERMINAL_PROMPT=l}}i(Be,"pushGitBranchForSandboxTemplateStart");function $(e){return A(e).replace(/\.git$/,"")}i($,"normalizeSandboxTemplateRepoIdentity");function A(e){let t=new URL(e);t.username="",t.password="";let n=t.toString();return n.endsWith(".git")?n:`${n.replace(/\/$/,"")}.git`}i(A,"normalizeSandboxTemplateRepoUrl");async function _e(e){let t=L(e),n=S.dirname(t),r=await j.readFile(t,"utf8"),a=O(r);if(!a.ok){console.error(C(a.diagnostics)),process.exitCode=1;return}let o=a.manifest,s=G(o,e),d=await B(o,e,n),c=await D(o,e,n),l=await N(e),u=Ye(o,e,c),m=await Qe(l,u,c);await tt(l,m.id);let p=await ut(l,m.id,o,e),x=await V(l,m.id,d.uploadRequests),T={...d.scalars,..._(x,d.uploadRequests)},I=await X(l,m.id,s,T,bt(m)),k=await St(l,m.id,s.ports),E=await q(l,m.id,o,e);console.log(JSON.stringify({ok:!0,file:t,repo:c,executable:{kind:s.kind,name:s.name,command:s.command},sandbox:Re(m),setupCommands:p,uploadedFiles:x,input:T,execution:I,previews:k,schedules:E,expectedArtifacts:s.artifactPaths},null,2))}i(_e,"runSandboxTemplateStart");function G(e,t){let n=v(e),r=typeof t.action=="string"?t.action.trim():"",a=typeof t.service=="string"?t.service.trim():"",o=typeof t.target=="string"?t.target.trim():"",s=typeof t.entrypoint=="string"?t.entrypoint.trim():"",d=r||a||o||s||"start",c=r?"action":a?"service":"",l=n.find(u=>u.name===d&&(!c||u.kind===c));if(!l)throw new Error(`manifest executable not found: ${d}. Available: ${n.map(u=>`${u.kind}:${u.name}`).join(", ")}`);return l}i(G,"resolveSandboxTemplateStartExecutable");function Ye(e,t,n){let r=typeof t.budgetUsd=="string"&&t.budgetUsd.trim()?t.budgetUsd.trim():typeof t.budget=="string"&&t.budget.trim()?t.budget.trim():"0.05",a=R(t.maxDurationSeconds,"max-duration-seconds"),o=R(t.idleTimeoutSeconds,"idle-timeout-seconds"),s=typeof t.teamId=="string"?t.teamId.trim():"",d=typeof t.projectId=="string"?t.projectId.trim():"",c=typeof t.runtimeProjectId=="string"?t.runtimeProjectId.trim():"";if(d&&c&&d!==c)throw new Error("project-id and runtime-project-id must match when both are set");let l=d||c,u=typeof t.agentId=="string"?t.agentId.trim():"",m=typeof t.runtimeAgentId=="string"?t.runtimeAgentId.trim():"";if(u&&m&&u!==m)throw new Error("agent-id and runtime-agent-id must match when both are set");let p=u||m,x=fe(t.workflowMode),T=be(t.runtimePromotionPolicy),I=typeof t.runtimeBaseBranch=="string"&&t.runtimeBaseBranch.trim()?t.runtimeBaseBranch.trim():"",k=typeof t.runtimeBaseSha=="string"&&t.runtimeBaseSha.trim()?t.runtimeBaseSha.trim():"",E=typeof t.runtimeId=="string"&&t.runtimeId.trim()?t.runtimeId.trim():"",te=!!(x||T||I||k||E||c||m),ne=xe(e,t),re=Xe(e);return{sandbox:{repo:n,...s?{teamId:s}:{},...l?{projectId:l}:{},...p?{agentId:p}:{},resources:e.resources??{},networkPolicy:{internetEgress:He(e.network.egress)},budget:{maxUsd:r},quotas:{maxSpendUsd:r,...a!==void 0?{maxDurationSeconds:a}:{},...o!==void 0?{idleTimeoutSeconds:o}:{}},...ne.length>0?{env:ne}:{},...re?{workloadSource:re}:{},volumes:e.volumes,metadata:{source:"openpond-code-sandbox-template-start",manifestFile:f,template:{name:e.name,version:e.version,useCase:e.useCase}}},...te&&E?{runtimeId:E}:{},...te&&!E?{sandboxRuntime:{...s?{teamId:s}:{},...x?{workflowMode:x}:{},...l?{projectId:l}:{},...p?{agentId:p}:{},baseBranch:I||"master",...k?{baseSha:k}:{},...T?{promotionPolicy:T}:{}}}:{}}}i(Ye,"buildSandboxTemplateStartCreateInput");function Xe(e){if(e.runtime.image)return{image:e.runtime.image};if(e.runtime.dockerfile)return{dockerfile:e.runtime.dockerfile}}i(Xe,"sandboxWorkloadSourceFromManifest");function He(e){return e==="allow"?"allow":"block"}i(He,"sandboxTemplateInternetEgressPolicy");async function Qe(e,t,n){let r=Date.now();try{return(await Ee(e,t)).sandbox}catch(a){if(!Ze(a))throw a;return console.warn("warning: sandbox create timed out; checking for the created sandbox record"),et(e,t.sandbox,n,r)}}i(Qe,"createSandboxTemplateStartSandbox");function Ze(e){return e instanceof Error&&/\b(504|timed out|timeout)\b/i.test(e.message)}i(Ze,"isLikelySandboxCreateTimeout");async function et(e,t,n,r){let s=Date.now()+72e4,d=$(n),c=t.metadata??{};for(;Date.now()<s;){let u=(await e.list({...t.teamId?{teamId:t.teamId}:{},...t.projectId?{projectId:t.projectId}:{},...t.agentId?{agentId:t.agentId}:{}})).filter(m=>{if(!m.repo||$(m.repo)!==d)return!1;let p=Date.parse(m.createdAt);return!(Number.isFinite(p)&&p<r-3e4||c.source&&m.metadata?.source!==c.source)}).sort((m,p)=>Date.parse(p.createdAt)-Date.parse(m.createdAt))[0];if(u?.state==="running"||u?.state==="stopped")return u;if(u?.state==="error")throw new Error(`sandbox create failed after timeout: ${u.id}
|
|
3
3
|
${u.logs.join(`
|
|
4
4
|
`)}`);await W(3e3)}throw new Error("sandbox create timed out and no matching created sandbox reached running state")}i(et,"recoverTimedOutSandboxCreate");async function tt(e,t){let a=Date.now()+12e4,o=null;for(;Date.now()<a;){try{let s=await e.exec(t,{command:"true",timeoutSeconds:30});if(s.command.status==="succeeded"&&s.command.exitCode===0)return;o=new Error(`readiness command ${s.command.status} with exit code ${String(s.command.exitCode)}`)}catch(s){if(o=s,!nt(s))throw s}await W(3e3)}throw new Error(`sandbox runner was not ready after create: ${rt(o)}`)}i(tt,"waitForSandboxTemplateRunnerReady");function nt(e){return e instanceof Error&&/\b(502|503|504|timed out|timeout|sandbox_not_found|sandbox_not_ready|sandbox_runner_failed)\b/i.test(e.message)}i(nt,"isRetryableSandboxRunnerReadyError");function rt(e){return e instanceof Error?e.message:typeof e=="string"?e:"unknown error"}i(rt,"formatUnknownError");function W(e){return new Promise(t=>setTimeout(t,e))}i(W,"sleep");async function B(e,t,n){let r=at(t),a=st(e),o=[],s=ot(t);for(let[c,l]of Object.entries(s)){let u=a.get(c);if(!u)throw new Error(`${c} is not declared as a file upload input in ${f}`);let m=await dt(l,n);if(!u.multiple&&m.length>1)throw new Error(`${c} accepts one file, got ${m.length}`);o.push({inputName:c,localPaths:m,spec:u})}let d=Array.isArray(e.inputs.schema.required)?e.inputs.schema.required.filter(c=>typeof c=="string"):[];for(let c of d)if(a.has(c)&&!o.some(l=>l.inputName===c))throw new Error(`${c} is required; pass --input-file ${c}=<path> or --input-files ${c}=<glob>`);return{scalars:r,uploadRequests:o}}i(B,"resolveSandboxTemplateStartInput");function at(e){let t=typeof e.inputs=="string"?e.inputs:typeof e.inputJson=="string"?e.inputJson:typeof e.params=="string"?e.params:"",n=t?M(t,"inputs"):{};if(!n||typeof n!="object"||Array.isArray(n))throw new Error("inputs must be a JSON object");let r=typeof e.input=="string"?e.input.trim():"";if(r){let[a,o]=J(r,"input");n[a]=o}return n}i(at,"parseSandboxTemplateScalarInputs");function ot(e){let t={},n=typeof e.inputFile=="string"?e.inputFile.trim():"";if(n){let[a,o]=J(n,"input-file");t[a]=o}let r=typeof e.inputFiles=="string"?e.inputFiles.trim():"";if(r){let[a,o]=J(r,"input-files");t[a]=o}return t}i(ot,"parseSandboxTemplateFileInputOptions");function J(e,t){let n=e.indexOf("=");if(n<=0)throw new Error(`${t} must be formatted as name=value`);let r=e.slice(0,n).trim(),a=e.slice(n+1).trim();if(!r||!a)throw new Error(`${t} must be formatted as name=value`);return[r,a]}i(J,"parseKeyValueOption");function st(e){let t=F(e.inputs.schema.properties)??{},n=new Map;for(let[r,a]of Object.entries(t)){let o=F(a);if(!o)continue;let s=F(o["x-openpond-upload"]??o.xOpenPondUpload);if(!s)continue;let d=typeof s.targetPath=="string"&&s.targetPath.trim()?it(s.targetPath):"";if(!d)throw new Error(`${r} upload metadata is missing targetPath`);let c=s.multiple===!0||o.type==="array"||F(o.items)?.format==="file";n.set(r,{inputName:r,multiple:c,targetPath:d})}return n}i(st,"collectSandboxTemplateUploadSpecs");function F(e){return!e||typeof e!="object"||Array.isArray(e)?null:e}i(F,"asPlainRecord");function it(e){let t=e.trim().replace(/\\/g,"/").replace(/^\/workspace\//,"").replace(/^\.\//,"").replace(/^\/+/,"");if(!t||t.split("/").some(n=>n===".."||n===""))throw new Error(`invalid upload target path: ${e}`);if(t.split("/").some(K))throw new Error("sandbox template uploads cannot target .env* files; create sandbox secrets and pass refs with --env-ref");return t}i(it,"normalizeSandboxUploadTargetPath");async function dt(e,t){let n=e.split(",").map(a=>a.trim()).filter(Boolean),r=(await Promise.all(n.map(a=>ct(a,t)))).flat();if(r.length===0)throw new Error(`no files matched ${e}`);return r}i(dt,"expandSandboxTemplateUploadPaths");async function ct(e,t){let n=S.resolve(t,e);if(!e.includes("*")){if(lt(n),!(await j.stat(n)).isFile())throw new Error(`upload path is not a file: ${n}`);return[n]}let r=S.dirname(n),a=S.basename(n),o=mt(a),d=(await j.readdir(r,{withFileTypes:!0})).filter(l=>l.isFile()&&o.test(l.name)).sort((l,u)=>l.name.localeCompare(u.name));if(d.find(l=>K(l.name)))throw new Error("sandbox template uploads cannot include .env* files; create sandbox secrets and pass refs with --env-ref");return d.map(l=>S.join(r,l.name)).sort((l,u)=>l.localeCompare(u))}i(ct,"expandSandboxTemplateUploadPath");function lt(e){if(K(S.basename(e)))throw new Error("sandbox template uploads cannot include .env* files; create sandbox secrets and pass refs with --env-ref")}i(lt,"assertSandboxTemplateUploadPathAllowed");function K(e){return e===".env"||e.startsWith(".env.")}i(K,"isSandboxEnvFileName");function mt(e){let t=e.split("*").map(n=>n.replace(/[.+?^${}()|[\]\\]/g,"\\$&")).join(".*");return new RegExp(`^${t}$`)}i(mt,"globBasenameToRegExp");async function ut(e,t,n,r){let a=R(r.setupTimeoutSeconds,"setup-timeout-seconds")??900,o=[];for(let s of n.setup.commands){let d=await pt(e,t,s,a);if(o.push({command:s,status:d.status,exitCode:d.exitCode}),d.status!=="succeeded"||d.exitCode!==0)throw new Error(`setup command failed: ${s}
|
|
5
5
|
${d.output}`)}return o}i(ut,"runSandboxTemplateSetupCommands");async function V(e,t,n){let r=[];for(let a of n)for(let o of a.localPaths){let s=await j.readFile(o),d=Y(a.spec.targetPath,S.basename(o));await e.uploadFileBase64(t,d,s.toString("base64")),r.push({inputName:a.inputName,localPath:o,sandboxPath:d,sizeBytes:s.byteLength})}return r}i(V,"uploadSandboxTemplateStartFiles");function Y(e,t){return`${e.replace(/\/+$/,"")}/${t.replace(/^\/+/,"")}`}i(Y,"joinSandboxUploadPath");function _(e,t){let n={};for(let r of t){let a=e.filter(o=>o.inputName===r.inputName).map(o=>o.sandboxPath);n[r.inputName]=r.spec.multiple?a:a[0]??""}return n}i(_,"formatUploadedFileParams");async function X(e,t,n,r,a={}){await ft(e,t,r);let o=xt(n,a),s=n.timeoutSeconds;if(n.kind==="service")return{kind:"service",process:(await e.startProcess(t,{command:o,...s!==void 0?{timeoutSeconds:s}:{}})).process};let d=await Le(e,t,o,s??900);if(d.status!=="succeeded"||d.exitCode!==0)throw new Error(`template command failed: ${n.name}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{a,b,c,d,e,f}from"./chunk-
|
|
2
|
+
import{a,b,c,d,e,f}from"./chunk-RCRZXHAI.js";import"./chunk-M5X7XKXY.js";import"./chunk-65FJWWXG.js";import"./chunk-SYUKES6H.js";import"./chunk-N5EAVX4G.js";import"./chunk-U7X5ZLAL.js";import"./chunk-RY46UPBO.js";import"./chunk-HG2YFMVU.js";import"./chunk-OQPJ7FJF.js";import"./chunk-BL3CZWWD.js";import"./chunk-FYWQWKVS.js";import"./chunk-GD3RCUDH.js";import"./chunk-7OKZCJHS.js";import"./chunk-UTIELP6F.js";import"./chunk-7NCM6GBN.js";import"./chunk-4V73I4OL.js";import"./chunk-LE75SVEL.js";import"./chunk-6ESBAHWK.js";import"./chunk-7J2NMUTK.js";import"./chunk-VEBW7NKD.js";import"./chunk-W45RKGM6.js";import"./chunk-AUO5DCEU.js";import"./chunk-Y4I6CFZJ.js";import"./chunk-UGFSAG4U.js";import"./chunk-EDYCSW22.js";import"./chunk-JT5YQ52I.js";import"./chunk-XGY4OQLC.js";import"./chunk-PAYFJHPO.js";import"./chunk-WD4KAKEX.js";import"./chunk-2PXKSAG6.js";import"./chunk-ULTV6INR.js";import"./chunk-WGQ3FMRF.js";import"./chunk-JXLDEYRW.js";import"./chunk-JVMSN7LH.js";import"./chunk-YI6ME6PU.js";import"./chunk-DRLP7GIU.js";import"./chunk-BU6MW65V.js";import"./chunk-LVXL7T5O.js";import"./chunk-HIQPGYVH.js";import"./chunk-DXJC3QW7.js";import"./chunk-P4QM63L3.js";import"./chunk-MTP3B2SU.js";import"./chunk-UN2LKLGV.js";import"./chunk-2LJCJOJ7.js";import"./chunk-AMC4Z7G4.js";import"./chunk-LK77GI6M.js";import"./chunk-HVM2GUM3.js";import"./chunk-I6VMRQF4.js";import"./chunk-D6L6UNUQ.js";import"./chunk-AJXWJLZA.js";import"./chunk-OKKNDQJF.js";import"./chunk-4PUOWSDE.js";import"./chunk-ZY32SZ2P.js";import"./chunk-OTDDXEQ6.js";import"./chunk-ECOH24MC.js";import"./chunk-4N4EH3RJ.js";import"./chunk-GY7YSD6J.js";import"./chunk-KUE46HTH.js";import"./chunk-JCLTFDVW.js";import"./chunk-6FA3GG5B.js";import"./chunk-SV7ZBEK2.js";import"./chunk-2MEOUS24.js";import"./chunk-HNQPEOJD.js";import"./chunk-RCT3O3HQ.js";import"./chunk-UGOK7VTC.js";import"./chunk-ZFJWA4JK.js";import"./chunk-X2J2P5ZT.js";import"./chunk-FTQLQJQV.js";export{b as createHostedSavedWork,d as deleteHostedSavedWork,f as hostedWebBaseUrl,a as listHostedSavedWork,e as runHostedSavedWork,c as updateHostedSavedWork};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
3
|
-
import{a as Lq,b as Bq,c as $q}from"./chunk-YXMYK5P7.js";import"./chunk-S4WILIRA.js";import{c as bq}from"./chunk-QUNQM2E3.js";import{a as kq,b as Sq,c as Pq,d as Rq,e as xq,f as _q,g as Eq,h as Tq,i as Cq,j as Aq}from"./chunk-UMAVVMXL.js";import{a as or,b as Op,c as xa,d as iy,e as sy,f as Ei}from"./chunk-ZDEIVUUI.js";import{a as Mq,b as jq,c as Oq,d as M,e as Hq,f as Ti,g as z,h as cy,j as Dq}from"./chunk-7RSQOC5M.js";import{a as ay,b as vq}from"./chunk-5JVJQA5H.js";import{a as HU,b as FU,c as hR,d as zU,e as WU,f as VU,g as GU,h as JU,j as KU}from"./chunk-2TGHZXJE.js";import{A as fR,a as MU,c as jU,g as OU,k as ey,l as Fo,m as DU,n as Pa,o as ty,p as LU,q as Ri,r as ry,s as BU,t as Ra,u as ny,v as xi,w as $U,x as NU,y as UU,z as qU}from"./chunk-IIT66347.js";import{a as YU,b as XU,c as oy,d as QU,e as _i,f as Je,g as ZU,h as Pe,i as eq,j as tq,k as rq,l as nq,m as oq,n as aq,o as iq,p as sq,q as cq,r as dq,s as lq,t as $r,u as Pr,v as pe,w as uq}from"./chunk-BHKXPWFB.js";import{a as pq,b as mq}from"./chunk-Q7P34B2O.js";import{a as fq,b as hq}from"./chunk-ESYPMD7Q.js";import{c as mR}from"./chunk-CO23RRN7.js";import{a as gq,b as wq,c as yq}from"./chunk-KCLMA2IH.js";import"./chunk-FNGZ4UDZ.js";import{a as Yw,b as yU,c as vU,d as IU,e as bU}from"./chunk-VWWKWYSQ.js";import{a as Sa,c as Ww,d as Ud,e as pU,f as mU,g as kr,h as fU,i as Gw,j as hU,k as Sr,l as Jw,m as gU,n as Yr,o as Kw,p as wU,r as PU}from"./chunk-OUJ63LMU.js";import{a as Xw,b as kU,c as pR}from"./chunk-EFP75UEX.js";import{b as SU,c as Qw}from"./chunk-PACLKDTN.js";import{a as un}from"./chunk-ZIQJDTQB.js";import"./chunk-S7A2OGL2.js";import{a as lU,e as Vw}from"./chunk-3Z4VM2LF.js";import{a as xS,b as WM}from"./chunk-EICS777E.js";import{a as RU}from"./chunk-MIFVX5PK.js";import"./chunk-WLQEONBF.js";import"./chunk-3A2Y7UK3.js";import{b as xU}from"./chunk-WNXUSELC.js";import{a as _U,b as Zw,c as EU,d as TU,e as CU}from"./chunk-MEJLWNRS.js";import{b as AU}from"./chunk-4KNPCJR4.js";import{a as rU,b as nU,c as Uw,d as qw}from"./chunk-XVDFJ3ZF.js";import{b as dU}from"./chunk-M4A7G4S5.js";import{b as cU,c as lR}from"./chunk-Q3WXB465.js";import"./chunk-JQOVC35K.js";import{a as sU}from"./chunk-FEAKTSRS.js";import"./chunk-Q73RKX7I.js";import{a as oo,b as zw,c as uR,d as uU}from"./chunk-TPOAAJKA.js";import"./chunk-ZYLLPRPU.js";import{a as Z2,b as eU,c as tU}from"./chunk-XYZV3FKD.js";import{h as oe}from"./chunk-RCQYEHHD.js";import"./chunk-SDO4FC4Q.js";import"./chunk-IR3YJWPW.js";import{a as J2,b as $w}from"./chunk-SDHG6CKU.js";import{a as Ns,b as Nw,c as X2,d as Q2}from"./chunk-XHACK2KR.js";import"./chunk-W45RKGM6.js";import"./chunk-GYYJ47GX.js";import{a as Lw,d as Bw,f as K2,g as Y2}from"./chunk-WCNPGKST.js";import{a as G2}from"./chunk-DWF3FCY4.js";import{b as W2,c as V2,d as Nd,f as Dw,g as Mp}from"./chunk-YDZBX4XQ.js";import{b as jp,c as ka}from"./chunk-AFH462DO.js";import"./chunk-UANH7U3Y.js";import{a as no,b as F2,c as z2}from"./chunk-MWS2NAHJ.js";import{a as H2,d as D2,f as L2,g as B2,h as $2,i as ba,j as N2,k as Hw,n as Ap}from"./chunk-CCZ276IA.js";import{a as U2,b as q2}from"./chunk-K7KBFM2T.js";import{c as N$,d as uw,i as U$}from"./chunk-AQUZCWM3.js";import{b as jw,d as $d,l as _2,n as Ow}from"./chunk-E2JB5OCO.js";import"./chunk-DRMOHADV.js";import{A as dg,c as sg,d as tH,e as rH,f as nH,h as oH,i as aH,j as iH,p as sH,u as wi,v as cH,x as dH,z as cg}from"./chunk-OTXGAKFH.js";import{a as yH,d as vH,g as EH}from"./chunk-CIZI6Z7D.js";import{a as o$,b as c$,c as d$,d as j$,e as lw,f as L$,g as B$,h as $$,i as q$,j as EN,k as j2,m as Iq}from"./chunk-XQAUHXL4.js";import{a as oU}from"./chunk-PSY6IRJE.js";import{a as pt,b as a$,c as i$,d as JP,e as eN,f as mw,g as fw,h as tN}from"./chunk-PKJHN666.js";import{a as aU,b as Fw,c as iU}from"./chunk-Z33RVGP6.js";import{b as Ad,c as Md,d as VP}from"./chunk-7PKDJHT6.js";import{b as dw}from"./chunk-65WRWLUD.js";import{$ as b2,A as AN,B as Kr,C as MN,D as jN,E as $N,F as NN,G as UN,H as qN,I as FN,J as e2,K as t2,L as aR,M as r2,N as d2,O as l2,P as u2,Q as m2,R as iR,S as g2,T as Cw,U as Ls,V as qo,W as to,X as v2,Y as Tp,Z as I2,_ as ro,aa as Aw,b as l$,ba as k2,c as x$,ca as S2,d as _$,da as br,e as T$,ea as Bs,f as V$,fa as P2,g as Od,ga as Ia,h as G$,ha as sR,i as Y$,ia as cR,j as X$,ja as Cp,k as rN,ka as dR,l as yN,la as Mw,m as vN,ma as x2,n as IN,na as E2,o as bN,oa as O2,p as kN,q as QP,r as SN,s as PN,t as RN,u as xN,x as _N,y as TN,z as ZP}from"./chunk-FKUWCJ73.js";import{g as T2,h as C2,i as A2,j as M2}from"./chunk-B66QCXH2.js";import{a as E$}from"./chunk-PYNW5OFA.js";import{A as eR,B as tR,F as zN,M as w2,a as z$,b as W$,c as GP,m as wN,q as yw}from"./chunk-MOXIGLN2.js";import{b as $s,c as R2,d as Br}from"./chunk-RHMULF56.js";import"./chunk-VFH5C6D2.js";import{a as h2}from"./chunk-UOFDKMRU.js";import{a as gN}from"./chunk-AN525SPP.js";import{a as F$}from"./chunk-IZ6DLEVY.js";import{a as Hs,b as UP,c as Sp,d as Pp,e as Td,f as aw,g as qP,h as Rp,i as Cn,j as P$,k as fe,l as R$,m as zP}from"./chunk-KOC3YJEU.js";import{b as f$}from"./chunk-65FJWWXG.js";import"./chunk-SYUKES6H.js";import{a as O$,b as H$,c as D$,d as cw}from"./chunk-EYTTZ5H4.js";import"./chunk-XY7HFXLH.js";import{B as p2,J as y2,b as VM,z as CN}from"./chunk-6I5AUTVO.js";import{b as C$,i as A$,j as M$,m as Cd,n as WP}from"./chunk-DKOVZ6R2.js";import{a as kp,b as bi}from"./chunk-N5EAVX4G.js";import{a as NP,g as u$,h as p$,j as m$}from"./chunk-U7X5ZLAL.js";import"./chunk-7PXZ4X4P.js";import"./chunk-N73MU2C3.js";import"./chunk-SO4GMSNP.js";import"./chunk-NMMHXYDJ.js";import"./chunk-QLGP2OAQ.js";import{A as Pi,B as oR,C as Sw,D as YN,E as Pw,F as XN,G as _p,J as Rw,K as QN,L as xw,M as ZN,N as Bd,d as ON,f as HN,g as DN,h as LN,i as BN,m as vw,n as Iw,o as WN,p as VN,q as Ld,r as GN,s as rR,t as JN,u as bw,v as kw,w as Uo,x as Ds,y as nR,z as KN}from"./chunk-WZ35ICTE.js";import"./chunk-VS2LOUCT.js";import"./chunk-DMFUEUAZ.js";import"./chunk-AFKFN25T.js";import"./chunk-G4747MOW.js";import{a as $o,b as No,c as Wt}from"./chunk-GF55VEMR.js";import"./chunk-FAKDGLZQ.js";import"./chunk-KCJVFLBB.js";import{a as Q$,b as Z$}from"./chunk-GW766ZSO.js";import{a as i2,b as s2,c as c2,d as Tw,f as f2}from"./chunk-VJYOKU3C.js";import{a as n2,b as Ep,c as o2,d as _w,e as a2,f as Ew}from"./chunk-SSJV3VX7.js";import{a as jd}from"./chunk-7KWD2I6W.js";import{a as Dr,b as h$,c as Lr,d as g$,e as iw,f as sw,g as FP,h as w$,i as ki,k as y$,l as v$,m as I$,n as b$,o as k$,p as S$}from"./chunk-RY46UPBO.js";import{A as NM,C as UM,D as qM,E as Qn,d as RM,e as xM,f as _M,g as EM,h as SS,i as TM,j as CM,k as AM,l as MM,m as jM,n as xh,o as OM,p as PS,q as HM,r as DM,s as rr,t as LM,u as ut,v as St,w as BM,x as $M,y as Du,z as _h}from"./chunk-OFJPOTES.js";import{c as dN,d as KP,e as lN,f as uN,g as pN,h as mN,i as Dd,j as ww,k as Bo,l as fN,m as YP,n as hN,o as XP}from"./chunk-PLROXHG2.js";import{A as cN,C as gw,b as pw,d as J$,e as K$,h as nN,k as oN,l as aN,m as Hd,n as iN,p as hw,q as sN,s as xp}from"./chunk-YU3C6U5V.js";import"./chunk-PHZZBXDO.js";import{a as Si}from"./chunk-KVTBX2UP.js";import{a as ye,b as zt,c as Ed,d as ce,f as s$}from"./chunk-U7D6Q744.js";import{$ as rL,$a as AL,$b as cp,$c as $P,A as CD,Aa as mL,Ac as JB,Ba as fL,Ca as hL,Cb as Zg,Cc as KB,Db as CB,Dc as YB,E as AD,Ea as Pd,Eb as AB,Ec as Os,F as MD,Fa as gL,Fb as Lo,Fc as XB,G as Lg,Gb as MB,H as jD,Ha as tp,Hb as js,I as UD,Ia as Fg,Ib as jB,Ic as st,J as qD,Ja as wL,Jc as HP,K as Oo,Ka as SP,Kc as up,La as yL,Lc as pp,M as FD,Ma as vL,Mc as QB,N as zD,Na as PP,Nc as DP,O as WD,Oa as IL,Oc as mp,P as VD,Pa as bL,Pc as fp,Q as GD,Qa as kL,Qc as ZB,Ra as SL,Rc as LP,S as JD,Sa as PL,Sc as hp,T as Bg,Ta as RL,Tc as gp,U as KD,Ua as xL,Uc as e$,V as YD,Va as RP,Vb as OB,Vc as wp,W as XD,Wa as _L,Wc as t$,X as QD,Xa as EL,Xb as HB,Xc as BP,Y as ZD,Ya as TL,Yb as ip,Yc as yp,Z as eL,Za as CL,Zb as DB,Zc as vp,_ as tL,_a as xP,_b as sp,_c as r$,aa as nL,ab as ML,ac as MP,ad as Ip,b as bd,ba as oL,bb as jL,bc as LB,bd as bp,ca as aL,cb as OL,cc as dp,cd as n$,da as iL,db as HL,dc as BB,e as wD,ea as sL,eb as DL,ec as ew,fb as LL,fc as $B,g as vP,ga as $g,gb as BL,gc as NB,h as yD,ha as cL,hb as $L,hc as UB,i as Hr,ia as Zn,ic as qB,j as Qu,ja as Ng,jc as tw,k as Ts,ka as kP,kb as NL,kc as rw,l as IP,la as Ug,lb as UL,m as vD,mb as qL,n as ID,na as qg,nb as FL,nc as FB,o as bD,oa as Zu,ob as zL,p as kD,pb as rp,pc as Ii,q as SD,qa as dL,r as PD,rb as zg,rc as nw,s as Dg,sb as WL,sc as zB,ta as Sd,tb as VL,tc as lp,ua as Ho,ub as GL,uc as ow,v as va,va as lL,vb as Cs,vc as WB,w as kd,wa as ep,wb as JL,wc as VB,x as ED,xc as jP,y as TD,ya as uL,yb as TB,yc as GB,za as pL,zc as OP}from"./chunk-HG2YFMVU.js";import{d as SM}from"./chunk-OQPJ7FJF.js";import"./chunk-BL3CZWWD.js";import{b as OD,c as HD,d as DD,e as LD,f as BD,g as $D,h as ND}from"./chunk-FYWQWKVS.js";import{b as RD,c as Hg}from"./chunk-GD3RCUDH.js";import{$ as Ms,A as Ir,C as dB,D as lB,E as uB,F as AP,G as pB,H as mB,I as fB,K as Jg,L as hB,a as Wg,aa as gB,b as KL,ba as eo,c as _P,ca as wB,d as Do,da as yB,e as YL,ea as vB,f as XL,fa as yi,g as QL,ga as xd,h as EP,ha as Kg,i as As,ia as IB,j as ZL,ja as bB,k as eB,ka as kB,l as tB,la as op,m as TP,ma as _d,n as np,na as Yg,o as rB,oa as SB,p as Vg,pa as Xg,q as nB,qa as vi,r as oB,ra as PB,s as Rd,sa as RB,t as aB,ta as xB,u as Gg,ua as Qg,v as iB,va as _B,w as sB,wa as ap,x as CP,xa as EB,z as cB}from"./chunk-7OKZCJHS.js";import"./chunk-UTIELP6F.js";import{g as TH,j as CH,l as yd,m as AH,o as pg,s as mg}from"./chunk-7NCM6GBN.js";import"./chunk-4V73I4OL.js";import"./chunk-LE75SVEL.js";import{e as xD,g as _D,h as bP,j as wt}from"./chunk-6ESBAHWK.js";import{a as Mne,b as JM,c as _S,d as ES}from"./chunk-LZPCA6DH.js";import{b as dd,c as PM}from"./chunk-L3KS6MOV.js";import"./chunk-7J2NMUTK.js";import{$b as zu,$f as pP,$i as M1,Ad as zH,Ag as mP,Ah as hP,Bd as WH,Be as YH,Cf as uP,Cj as D1,Dj as L1,Gi as Xu,Gj as B1,Hi as P1,Hj as $1,Ii as R1,Ij as N1,Kj as U1,Mj as q1,Nh as m1,Od as VH,Oe as XH,Ok as X1,Pd as GH,Ph as f1,Qf as a1,Re as QH,Rg as d1,Rh as h1,Ri as x1,Rk as Q1,Sd as Wu,Sh as g1,Ta as BH,Td as Vu,Tf as Ig,Ub as $H,Uf as bg,Ug as xg,Uh as Ku,Ui as _1,Uk as Z1,Vf as kg,Vg as _g,Vh as w1,Vi as E1,Vj as F1,Vk as eD,Wf as i1,Wg as Eg,Wh as y1,Wi as T1,Wk as tD,Xe as ZH,Xg as l1,Xj as Mg,Xk as rD,Y as Fu,Ye as gg,Yi as C1,Yk as nD,Zi as A1,Zk as oD,_b as NH,a as MH,af as e1,ah as fP,ak as z1,b as Ge,bk as W1,cf as Ju,ck as jg,di as v1,dk as V1,ek as G1,fa as fg,gl as Id,hf as vd,hi as Yu,if as t1,ii as I1,ja as jH,je as Gu,ji as b1,jl as aD,ka as OH,kf as r1,la as hg,ld as UH,lk as J1,ma as HH,na as DH,nj as gP,nl as iD,pd as Tn,pf as n1,pg as s1,ph as u1,pj as wP,pk as K1,pl as sD,ql as cD,rk as Y1,rl as Se,sg as Sg,sh as Tg,si as k1,tg as Pg,th as Cg,ue as JH,ug as Rg,uh as Ag,uj as j1,vg as c1,vh as p1,wa as LH,wf as wg,wj as O1,xe as KH,xf as yg,xi as S1,xj as yP,yd as qH,yf as vg,yj as H1,zd as FH,zf as o1}from"./chunk-VEBW7NKD.js";import"./chunk-W45RKGM6.js";import{a as dD,b as lD,c as uD,d as pD,e as mD,f as fD,g as Jr,h as hD,j as Og,k as gD}from"./chunk-AUO5DCEU.js";import{a as qu}from"./chunk-Y4I6CFZJ.js";import{t as pO}from"./chunk-4BUM6JEC.js";import{b as iO,c as sO,f as cO,g as dO,h as lO}from"./chunk-UGFSAG4U.js";import{a as aO,b as Fh}from"./chunk-SSHE6B7Z.js";import{a as jne}from"./chunk-JFXINDOQ.js";import"./chunk-EDYCSW22.js";import{b as ug,c as PH,e as RH,f as Uu,g as dP,k as lP,l as xH,m as _H}from"./chunk-JT5YQ52I.js";import"./chunk-XGY4OQLC.js";import{d as hH,h as gH,i as wH}from"./chunk-PAYFJHPO.js";import{d as hd,e as Nu,f as QO,g as ZO,h as eH,j as sP,l as cP}from"./chunk-WD4KAKEX.js";import{$ as SO,G as yO,H as vO,J as GS,L as IO,R as bO,S as fi,U as kO,Y as Wh,Z as Vh,_ as Gh,aa as JS,ba as XS,ca as QS,da as eg,ea as ZS,fa as eP,ga as tP,ia as rP,ja as nP,ka as oP,la as aP,u as wO}from"./chunk-2PXKSAG6.js";import"./chunk-ULTV6INR.js";import{A as Xh,C as Qh,D as Zh,E as ya,a as PO,b as RO,c as Jh,f as Kh,h as KS,i as YS,k as $u,m as xO,o as _O,p as EO,r as Yh,s as TO,u as CO}from"./chunk-WGQ3FMRF.js";import"./chunk-JXLDEYRW.js";import{i as kH,m as SH}from"./chunk-JVMSN7LH.js";import{a as lH,f as uH,g as nr,r as gd,t as pH,u as mH,v as lg,w as fH,z as wd}from"./chunk-YI6ME6PU.js";import{b as Es,d as IH,f as bH}from"./chunk-DRLP7GIU.js";import{Ba as ag,C as NO,Ca as ln,Da as XO,F as fd,Fa as ig,H as UO,Ia as gi,J as qO,L as FO,N as zO,O as WO,W as VO,aa as hi,ba as GO,c as AO,ga as JO,ha as KO,i as MO,ja as mt,l as jO,m as OO,n as HO,o as DO,oa as ng,p as LO,q as tg,r as iP,s as BO,t as $O,u as rg,wa as jo,xa as YO,za as og}from"./chunk-BU6MW65V.js";import"./chunk-LVXL7T5O.js";import{f as zS,m as md}from"./chunk-HIQPGYVH.js";import{E as fO,K as Bu,M as hO,N as zh,Q as gO,U as VS,V as Et,b as Lu,c as WS,i as uO,j as me,l as Xe,x as dn,y as mO}from"./chunk-DXJC3QW7.js";import"./chunk-P4QM63L3.js";import"./chunk-MTP3B2SU.js";import"./chunk-27JGS3KB.js";import{a as tO,b as nO}from"./chunk-UN2LKLGV.js";import"./chunk-2LJCJOJ7.js";import"./chunk-AMC4Z7G4.js";import{b as rO,e as oO}from"./chunk-LK77GI6M.js";import{k as RS}from"./chunk-HVM2GUM3.js";import"./chunk-I6VMRQF4.js";import{Ba as Wj,Ua as Vj,Wa as Uh,ba as jj,bb as NS,d as Tj,db as Gj,f as $h,fb as Jj,gb as qh,hb as Kj,l as Cj,lb as Yj,m as Aj,ob as Xj,pa as Oj,sb as US,ub as qS,va as zj,wb as Qj,x as Mj,xb as Zj,yb as eO,zb as FS}from"./chunk-D6L6UNUQ.js";import"./chunk-AJXWJLZA.js";import{A as Lj,E as Bj,F as $j,G as Nh,H as Nj,I as Uj,J as qj,N as Fj,h as Hj,z as Dj}from"./chunk-OKKNDQJF.js";import{Cb as ud,Db as wa,Eb as pd,F as wj,Jb as Rj,L as Ve,Lb as xj,M as _t,O as yj,Q as vj,Qb as _j,S as Mo,Ta as Bh,Xb as Ej,ba as Ij,d as mj,da as bj,g as fj,i as hj,j as gj,ob as kj,pb as mi,qb as It,rb as Sj,ub as Pj}from"./chunk-4PUOWSDE.js";import{$a as Dh,A as Oh,Aa as He,B as TS,C as xs,Cb as lj,D as _s,Db as uj,Eb as pj,F as YM,Fb as Lh,H as XM,I as QM,Ja as tj,La as rj,M as CS,N as AS,O as MS,Oa as nj,P as jS,Q as OS,R as HS,Ra as oj,S as DS,Sa as aj,T as LS,Wa as ij,a as GM,bb as $S,fb as sj,ga as ZM,hb as cj,kb as dj,n as KM,o as Ch,p as Ah,q as Mh,qa as Hh,r as jh,ra as ej,v as pi,va as BS}from"./chunk-ZY32SZ2P.js";import{q as zM,r as ld,s as Th}from"./chunk-OTDDXEQ6.js";import"./chunk-ECOH24MC.js";import{c as F0}from"./chunk-4N4EH3RJ.js";import"./chunk-GY7YSD6J.js";import{a as IM,b as bM,c as En,d as Ph,e as Rs,f as Hu,g as kS,h as Rh,i as kM,k as Eh,n as FM}from"./chunk-KUE46HTH.js";import{d as U0,e as q0,g as vM}from"./chunk-JCLTFDVW.js";import{a as Ou}from"./chunk-6FA3GG5B.js";import{C as sM,D as cM,I as uM,K as yS,L as vS,M as pM,S as IS,U as mM,V as bS,Z as fM,_ as hM,ca as gM,da as wM,f as Mu,fa as Ps,ga as yM,ha as Sh,v as cd,x as ju}from"./chunk-SV7ZBEK2.js";import{M as sd,O as nM,Q as oM,R as aM,S as iM,a as Ss,b as J0,c as Gr,d as _n,e as K0,f as yh,g as Y0,h as X0,i as vh,j as Ih,l as Q0,m as Z0,n as eM,o as tM,p as rM,z as wS}from"./chunk-2MEOUS24.js";import{b as G0,d as wh,e as Xn,f as Ft}from"./chunk-HNQPEOJD.js";import{g as hh,h as gS,i as V0,l as ot,m as Ee,n as T,o as gh}from"./chunk-RCT3O3HQ.js";import{a as z0,c as ks,f as fh,h as Au,i as W0,m as bh,p as dM,r as ha,s as lM,t as ga,u as kh}from"./chunk-UGOK7VTC.js";import"./chunk-ZFJWA4JK.js";import{A as v,d as Re}from"./chunk-X2J2P5ZT.js";import{a as i,b as qe,c as Be,e as xn}from"./chunk-FTQLQJQV.js";var _a=Be((L0e,VF)=>{"use strict";var zF=["nodebuffer","arraybuffer","fragments"],WF=typeof Blob<"u";WF&&zF.push("blob");VF.exports={BINARY_TYPES:zF,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:WF,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:i(()=>{},"NOOP")}});var qp=Be(($0e,wy)=>{"use strict";var{EMPTY_BUFFER:Uoe}=_a(),BR=Buffer[Symbol.species];function qoe(e,t){if(e.length===0)return Uoe;if(e.length===1)return e[0];let r=Buffer.allocUnsafe(t),n=0;for(let o=0;o<e.length;o++){let a=e[o];r.set(a,n),n+=a.length}return n<t?new BR(r.buffer,r.byteOffset,n):r}i(qoe,"concat");function GF(e,t,r,n,o){for(let a=0;a<o;a++)r[n+a]=e[a]^t[a&3]}i(GF,"_mask");function JF(e,t){for(let r=0;r<e.length;r++)e[r]^=t[r&3]}i(JF,"_unmask");function Foe(e){return e.length===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.length)}i(Foe,"toArrayBuffer");function $R(e){if($R.readOnly=!0,Buffer.isBuffer(e))return e;let t;return e instanceof ArrayBuffer?t=new BR(e):ArrayBuffer.isView(e)?t=new BR(e.buffer,e.byteOffset,e.byteLength):(t=Buffer.from(e),$R.readOnly=!1),t}i($R,"toBuffer");wy.exports={concat:qoe,mask:GF,toArrayBuffer:Foe,toBuffer:$R,unmask:JF};if(!process.env.WS_NO_BUFFER_UTIL)try{let e=qe("bufferutil");wy.exports.mask=function(t,r,n,o,a){a<48?GF(t,r,n,o,a):e.mask(t,r,n,o,a)},wy.exports.unmask=function(t,r){t.length<32?JF(t,r):e.unmask(t,r)}}catch{}});var XF=Be((U0e,YF)=>{"use strict";var KF=Symbol("kDone"),NR=Symbol("kRun"),UR=class{static{i(this,"Limiter")}constructor(t){this[KF]=()=>{this.pending--,this[NR]()},this.concurrency=t||1/0,this.jobs=[],this.pending=0}add(t){this.jobs.push(t),this[NR]()}[NR](){if(this.pending!==this.concurrency&&this.jobs.length){let t=this.jobs.shift();this.pending++,t(this[KF])}}};YF.exports=UR});var Kd=Be((F0e,tz)=>{"use strict";var Fp=qe("zlib"),QF=qp(),zoe=XF(),{kStatusCode:ZF}=_a(),Woe=Buffer[Symbol.species],Voe=Buffer.from([0,0,255,255]),vy=Symbol("permessage-deflate"),Ea=Symbol("total-length"),Gd=Symbol("callback"),ji=Symbol("buffers"),Jd=Symbol("error"),yy,qR=class{static{i(this,"PerMessageDeflate")}constructor(t){if(this._options=t||{},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,!yy){let r=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;yy=new zoe(r)}}static get extensionName(){return"permessage-deflate"}offer(){let t={};return this._options.serverNoContextTakeover&&(t.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(t.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(t.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?t.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits==null&&(t.client_max_window_bits=!0),t}accept(t){return t=this.normalizeParams(t),this.params=this._isServer?this.acceptAsServer(t):this.acceptAsClient(t),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){let t=this._deflate[Gd];this._deflate.close(),this._deflate=null,t&&t(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(t){let r=this._options,n=t.find(o=>!(r.serverNoContextTakeover===!1&&o.server_no_context_takeover||o.server_max_window_bits&&(r.serverMaxWindowBits===!1||typeof r.serverMaxWindowBits=="number"&&r.serverMaxWindowBits>o.server_max_window_bits)||typeof r.clientMaxWindowBits=="number"&&!o.client_max_window_bits));if(!n)throw new Error("None of the extension offers can be accepted");return r.serverNoContextTakeover&&(n.server_no_context_takeover=!0),r.clientNoContextTakeover&&(n.client_no_context_takeover=!0),typeof r.serverMaxWindowBits=="number"&&(n.server_max_window_bits=r.serverMaxWindowBits),typeof r.clientMaxWindowBits=="number"?n.client_max_window_bits=r.clientMaxWindowBits:(n.client_max_window_bits===!0||r.clientMaxWindowBits===!1)&&delete n.client_max_window_bits,n}acceptAsClient(t){let r=t[0];if(this._options.clientNoContextTakeover===!1&&r.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(!r.client_max_window_bits)typeof this._options.clientMaxWindowBits=="number"&&(r.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits=="number"&&r.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"');return r}normalizeParams(t){return t.forEach(r=>{Object.keys(r).forEach(n=>{let o=r[n];if(o.length>1)throw new Error(`Parameter "${n}" must have only a single value`);if(o=o[0],n==="client_max_window_bits"){if(o!==!0){let a=+o;if(!Number.isInteger(a)||a<8||a>15)throw new TypeError(`Invalid value for parameter "${n}": ${o}`);o=a}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${n}": ${o}`)}else if(n==="server_max_window_bits"){let a=+o;if(!Number.isInteger(a)||a<8||a>15)throw new TypeError(`Invalid value for parameter "${n}": ${o}`);o=a}else if(n==="client_no_context_takeover"||n==="server_no_context_takeover"){if(o!==!0)throw new TypeError(`Invalid value for parameter "${n}": ${o}`)}else throw new Error(`Unknown parameter "${n}"`);r[n]=o})}),t}decompress(t,r,n){yy.add(o=>{this._decompress(t,r,(a,s)=>{o(),n(a,s)})})}compress(t,r,n){yy.add(o=>{this._compress(t,r,(a,s)=>{o(),n(a,s)})})}_decompress(t,r,n){let o=this._isServer?"client":"server";if(!this._inflate){let a=`${o}_max_window_bits`,s=typeof this.params[a]!="number"?Fp.Z_DEFAULT_WINDOWBITS:this.params[a];this._inflate=Fp.createInflateRaw({...this._options.zlibInflateOptions,windowBits:s}),this._inflate[vy]=this,this._inflate[Ea]=0,this._inflate[ji]=[],this._inflate.on("error",Joe),this._inflate.on("data",ez)}this._inflate[Gd]=n,this._inflate.write(t),r&&this._inflate.write(Voe),this._inflate.flush(()=>{let a=this._inflate[Jd];if(a){this._inflate.close(),this._inflate=null,n(a);return}let s=QF.concat(this._inflate[ji],this._inflate[Ea]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[Ea]=0,this._inflate[ji]=[],r&&this.params[`${o}_no_context_takeover`]&&this._inflate.reset()),n(null,s)})}_compress(t,r,n){let o=this._isServer?"server":"client";if(!this._deflate){let a=`${o}_max_window_bits`,s=typeof this.params[a]!="number"?Fp.Z_DEFAULT_WINDOWBITS:this.params[a];this._deflate=Fp.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:s}),this._deflate[Ea]=0,this._deflate[ji]=[],this._deflate.on("data",Goe)}this._deflate[Gd]=n,this._deflate.write(t),this._deflate.flush(Fp.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let a=QF.concat(this._deflate[ji],this._deflate[Ea]);r&&(a=new Woe(a.buffer,a.byteOffset,a.length-4)),this._deflate[Gd]=null,this._deflate[Ea]=0,this._deflate[ji]=[],r&&this.params[`${o}_no_context_takeover`]&&this._deflate.reset(),n(null,a)})}};tz.exports=qR;function Goe(e){this[ji].push(e),this[Ea]+=e.length}i(Goe,"deflateOnData");function ez(e){if(this[Ea]+=e.length,this[vy]._maxPayload<1||this[Ea]<=this[vy]._maxPayload){this[ji].push(e);return}this[Jd]=new RangeError("Max payload size exceeded"),this[Jd].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[Jd][ZF]=1009,this.removeListener("data",ez),this.reset()}i(ez,"inflateOnData");function Joe(e){if(this[vy]._inflate=null,this[Jd]){this[Gd](this[Jd]);return}e[ZF]=1007,this[Gd](e)}i(Joe,"inflateOnError")});var Yd=Be((W0e,Iy)=>{"use strict";var{isUtf8:rz}=qe("buffer"),{hasBlob:Koe}=_a(),Yoe=[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 Xoe(e){return e>=1e3&&e<=1014&&e!==1004&&e!==1005&&e!==1006||e>=3e3&&e<=4999}i(Xoe,"isValidStatusCode");function FR(e){let t=e.length,r=0;for(;r<t;)if((e[r]&128)===0)r++;else if((e[r]&224)===192){if(r+1===t||(e[r+1]&192)!==128||(e[r]&254)===192)return!1;r+=2}else if((e[r]&240)===224){if(r+2>=t||(e[r+1]&192)!==128||(e[r+2]&192)!==128||e[r]===224&&(e[r+1]&224)===128||e[r]===237&&(e[r+1]&224)===160)return!1;r+=3}else if((e[r]&248)===240){if(r+3>=t||(e[r+1]&192)!==128||(e[r+2]&192)!==128||(e[r+3]&192)!==128||e[r]===240&&(e[r+1]&240)===128||e[r]===244&&e[r+1]>143||e[r]>244)return!1;r+=4}else return!1;return!0}i(FR,"_isValidUTF8");function Qoe(e){return Koe&&typeof e=="object"&&typeof e.arrayBuffer=="function"&&typeof e.type=="string"&&typeof e.stream=="function"&&(e[Symbol.toStringTag]==="Blob"||e[Symbol.toStringTag]==="File")}i(Qoe,"isBlob");Iy.exports={isBlob:Qoe,isValidStatusCode:Xoe,isValidUTF8:FR,tokenChars:Yoe};if(rz)Iy.exports.isValidUTF8=function(e){return e.length<24?FR(e):rz(e)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let e=qe("utf-8-validate");Iy.exports.isValidUTF8=function(t){return t.length<32?FR(t):e(t)}}catch{}});var JR=Be((G0e,dz)=>{"use strict";var{Writable:Zoe}=qe("stream"),nz=Kd(),{BINARY_TYPES:eae,EMPTY_BUFFER:oz,kStatusCode:tae,kWebSocket:rae}=_a(),{concat:zR,toArrayBuffer:nae,unmask:oae}=qp(),{isValidStatusCode:aae,isValidUTF8:az}=Yd(),by=Buffer[Symbol.species],Mn=0,iz=1,sz=2,cz=3,WR=4,VR=5,ky=6,GR=class extends Zoe{static{i(this,"Receiver")}constructor(t={}){super(),this._allowSynchronousEvents=t.allowSynchronousEvents!==void 0?t.allowSynchronousEvents:!0,this._binaryType=t.binaryType||eae[0],this._extensions=t.extensions||{},this._isServer=!!t.isServer,this._maxBufferedChunks=t.maxBufferedChunks|0,this._maxFragments=t.maxFragments|0,this._maxPayload=t.maxPayload|0,this._skipUTF8Validation=!!t.skipUTF8Validation,this[rae]=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._numFragments=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=Mn}_write(t,r,n){if(this._opcode===8&&this._state==Mn)return n();if(this._maxBufferedChunks>0&&this._buffers.length>=this._maxBufferedChunks){n(this.createError(RangeError,"Too many buffered chunks",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS"));return}this._bufferedBytes+=t.length,this._buffers.push(t),this.startLoop(n)}consume(t){if(this._bufferedBytes-=t,t===this._buffers[0].length)return this._buffers.shift();if(t<this._buffers[0].length){let n=this._buffers[0];return this._buffers[0]=new by(n.buffer,n.byteOffset+t,n.length-t),new by(n.buffer,n.byteOffset,t)}let r=Buffer.allocUnsafe(t);do{let n=this._buffers[0],o=r.length-t;t>=n.length?r.set(this._buffers.shift(),o):(r.set(new Uint8Array(n.buffer,n.byteOffset,t),o),this._buffers[0]=new by(n.buffer,n.byteOffset+t,n.length-t)),t-=n.length}while(t>0);return r}startLoop(t){this._loop=!0;do switch(this._state){case Mn:this.getInfo(t);break;case iz:this.getPayloadLength16(t);break;case sz:this.getPayloadLength64(t);break;case cz:this.getMask();break;case WR:this.getData(t);break;case VR:case ky:this._loop=!1;return}while(this._loop);this._errored||t()}getInfo(t){if(this._bufferedBytes<2){this._loop=!1;return}let r=this.consume(2);if((r[0]&48)!==0){let o=this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");t(o);return}let n=(r[0]&64)===64;if(n&&!this._extensions[nz.extensionName]){let o=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");t(o);return}if(this._fin=(r[0]&128)===128,this._opcode=r[0]&15,this._payloadLength=r[1]&127,this._opcode===0){if(n){let o=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");t(o);return}if(!this._fragmented){let o=this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");t(o);return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){let o=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");t(o);return}this._compressed=n}else if(this._opcode>7&&this._opcode<11){if(!this._fin){let o=this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");t(o);return}if(n){let o=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");t(o);return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){let o=this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");t(o);return}}else{let o=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");t(o);return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(r[1]&128)===128,this._isServer){if(!this._masked){let o=this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK");t(o);return}}else if(this._masked){let o=this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");t(o);return}this._payloadLength===126?this._state=iz:this._payloadLength===127?this._state=sz:this.haveLength(t)}getPayloadLength16(t){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(t)}getPayloadLength64(t){if(this._bufferedBytes<8){this._loop=!1;return}let r=this.consume(8),n=r.readUInt32BE(0);if(n>Math.pow(2,21)-1){let o=this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");t(o);return}this._payloadLength=n*Math.pow(2,32)+r.readUInt32BE(4),this.haveLength(t)}haveLength(t){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)){let r=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");t(r);return}this._masked?this._state=cz:this._state=WR}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=WR}getData(t){let r=oz;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}r=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0&&oae(r,this._mask)}if(this._opcode>7){this.controlMessage(r,t);return}if(this._maxFragments>0&&++this._numFragments>this._maxFragments){let n=this.createError(RangeError,"Too many message fragments",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS");t(n);return}if(this._compressed){this._state=VR,this.decompress(r,t);return}r.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(r)),this.dataMessage(t)}decompress(t,r){this._extensions[nz.extensionName].decompress(t,this._fin,(o,a)=>{if(o)return r(o);if(a.length){if(this._messageLength+=a.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let s=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");r(s);return}this._fragments.push(a)}this.dataMessage(r),this._state===Mn&&this.startLoop(r)})}dataMessage(t){if(!this._fin){this._state=Mn;return}let r=this._messageLength,n=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._numFragments=0,this._fragments=[],this._opcode===2){let o;this._binaryType==="nodebuffer"?o=zR(n,r):this._binaryType==="arraybuffer"?o=nae(zR(n,r)):this._binaryType==="blob"?o=new Blob(n):o=n,this._allowSynchronousEvents?(this.emit("message",o,!0),this._state=Mn):(this._state=ky,setImmediate(()=>{this.emit("message",o,!0),this._state=Mn,this.startLoop(t)}))}else{let o=zR(n,r);if(!this._skipUTF8Validation&&!az(o)){let a=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");t(a);return}this._state===VR||this._allowSynchronousEvents?(this.emit("message",o,!1),this._state=Mn):(this._state=ky,setImmediate(()=>{this.emit("message",o,!1),this._state=Mn,this.startLoop(t)}))}}controlMessage(t,r){if(this._opcode===8){if(t.length===0)this._loop=!1,this.emit("conclude",1005,oz),this.end();else{let n=t.readUInt16BE(0);if(!aae(n)){let a=this.createError(RangeError,`invalid status code ${n}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");r(a);return}let o=new by(t.buffer,t.byteOffset+2,t.length-2);if(!this._skipUTF8Validation&&!az(o)){let a=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");r(a);return}this._loop=!1,this.emit("conclude",n,o),this.end()}this._state=Mn;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?"ping":"pong",t),this._state=Mn):(this._state=ky,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",t),this._state=Mn,this.startLoop(r)}))}createError(t,r,n,o,a){this._loop=!1,this._errored=!0;let s=new t(n?`Invalid WebSocket frame: ${r}`:r);return Error.captureStackTrace(s,this.createError),s.code=a,s[tae]=o,s}};dz.exports=GR});var XR=Be((Y0e,pz)=>{"use strict";var{Duplex:K0e}=qe("stream"),{randomFillSync:iae}=qe("crypto"),{types:{isUint8Array:sae}}=qe("util"),lz=Kd(),{EMPTY_BUFFER:cae,kWebSocket:dae,NOOP:lae}=_a(),{isBlob:Xd,isValidStatusCode:uae}=Yd(),{mask:uz,toBuffer:zs}=qp(),jn=Symbol("kByteLength"),pae=Buffer.alloc(4),Sy=8*1024,Ws,Qd=Sy,ao=0,mae=1,fae=2,KR=class e{static{i(this,"Sender")}constructor(t,r,n){this._extensions=r||{},n&&(this._generateMask=n,this._maskBuffer=Buffer.alloc(4)),this._socket=t,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=ao,this.onerror=lae,this[dae]=void 0}static frame(t,r){let n,o=!1,a=2,s=!1;r.mask&&(n=r.maskBuffer||pae,r.generateMask?r.generateMask(n):(Qd===Sy&&(Ws===void 0&&(Ws=Buffer.alloc(Sy)),iae(Ws,0,Sy),Qd=0),n[0]=Ws[Qd++],n[1]=Ws[Qd++],n[2]=Ws[Qd++],n[3]=Ws[Qd++]),s=(n[0]|n[1]|n[2]|n[3])===0,a=6);let c;typeof t=="string"?(!r.mask||s)&&r[jn]!==void 0?c=r[jn]:(t=Buffer.from(t),c=t.length):(c=t.length,o=r.mask&&r.readOnly&&!s);let d=c;c>=65536?(a+=8,d=127):c>125&&(a+=2,d=126);let l=Buffer.allocUnsafe(o?c+a:a);return l[0]=r.fin?r.opcode|128:r.opcode,r.rsv1&&(l[0]|=64),l[1]=d,d===126?l.writeUInt16BE(c,2):d===127&&(l[2]=l[3]=0,l.writeUIntBE(c,4,6)),r.mask?(l[1]|=128,l[a-4]=n[0],l[a-3]=n[1],l[a-2]=n[2],l[a-1]=n[3],s?[l,t]:o?(uz(t,n,l,a,c),[l]):(uz(t,n,t,0,c),[l,t])):[l,t]}close(t,r,n,o){let a;if(t===void 0)a=cae;else{if(typeof t!="number"||!uae(t))throw new TypeError("First argument must be a valid error code number");if(r===void 0||!r.length)a=Buffer.allocUnsafe(2),a.writeUInt16BE(t,0);else{let c=Buffer.byteLength(r);if(c>123)throw new RangeError("The message must not be greater than 123 bytes");if(a=Buffer.allocUnsafe(2+c),a.writeUInt16BE(t,0),typeof r=="string")a.write(r,2);else if(sae(r))a.set(r,2);else throw new TypeError("Second argument must be a string or a Uint8Array")}}let s={[jn]:a.length,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state!==ao?this.enqueue([this.dispatch,a,!1,s,o]):this.sendFrame(e.frame(a,s),o)}ping(t,r,n){let o,a;if(typeof t=="string"?(o=Buffer.byteLength(t),a=!1):Xd(t)?(o=t.size,a=!1):(t=zs(t),o=t.length,a=zs.readOnly),o>125)throw new RangeError("The data size must not be greater than 125 bytes");let s={[jn]:o,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:9,readOnly:a,rsv1:!1};Xd(t)?this._state!==ao?this.enqueue([this.getBlobData,t,!1,s,n]):this.getBlobData(t,!1,s,n):this._state!==ao?this.enqueue([this.dispatch,t,!1,s,n]):this.sendFrame(e.frame(t,s),n)}pong(t,r,n){let o,a;if(typeof t=="string"?(o=Buffer.byteLength(t),a=!1):Xd(t)?(o=t.size,a=!1):(t=zs(t),o=t.length,a=zs.readOnly),o>125)throw new RangeError("The data size must not be greater than 125 bytes");let s={[jn]:o,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:10,readOnly:a,rsv1:!1};Xd(t)?this._state!==ao?this.enqueue([this.getBlobData,t,!1,s,n]):this.getBlobData(t,!1,s,n):this._state!==ao?this.enqueue([this.dispatch,t,!1,s,n]):this.sendFrame(e.frame(t,s),n)}send(t,r,n){let o=this._extensions[lz.extensionName],a=r.binary?2:1,s=r.compress,c,d;typeof t=="string"?(c=Buffer.byteLength(t),d=!1):Xd(t)?(c=t.size,d=!1):(t=zs(t),c=t.length,d=zs.readOnly),this._firstFragment?(this._firstFragment=!1,s&&o&&o.params[o._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(s=c>=o._threshold),this._compress=s):(s=!1,a=0),r.fin&&(this._firstFragment=!0);let l={[jn]:c,fin:r.fin,generateMask:this._generateMask,mask:r.mask,maskBuffer:this._maskBuffer,opcode:a,readOnly:d,rsv1:s};Xd(t)?this._state!==ao?this.enqueue([this.getBlobData,t,this._compress,l,n]):this.getBlobData(t,this._compress,l,n):this._state!==ao?this.enqueue([this.dispatch,t,this._compress,l,n]):this.dispatch(t,this._compress,l,n)}getBlobData(t,r,n,o){this._bufferedBytes+=n[jn],this._state=fae,t.arrayBuffer().then(a=>{if(this._socket.destroyed){let c=new Error("The socket was closed while the blob was being read");process.nextTick(YR,this,c,o);return}this._bufferedBytes-=n[jn];let s=zs(a);r?this.dispatch(s,r,n,o):(this._state=ao,this.sendFrame(e.frame(s,n),o),this.dequeue())}).catch(a=>{process.nextTick(hae,this,a,o)})}dispatch(t,r,n,o){if(!r){this.sendFrame(e.frame(t,n),o);return}let a=this._extensions[lz.extensionName];this._bufferedBytes+=n[jn],this._state=mae,a.compress(t,n.fin,(s,c)=>{if(this._socket.destroyed){let d=new Error("The socket was closed while data was being compressed");YR(this,d,o);return}this._bufferedBytes-=n[jn],this._state=ao,n.readOnly=!1,this.sendFrame(e.frame(c,n),o),this.dequeue()})}dequeue(){for(;this._state===ao&&this._queue.length;){let t=this._queue.shift();this._bufferedBytes-=t[3][jn],Reflect.apply(t[0],this,t.slice(1))}}enqueue(t){this._bufferedBytes+=t[3][jn],this._queue.push(t)}sendFrame(t,r){t.length===2?(this._socket.cork(),this._socket.write(t[0]),this._socket.write(t[1],r),this._socket.uncork()):this._socket.write(t[0],r)}};pz.exports=KR;function YR(e,t,r){typeof r=="function"&&r(t);for(let n=0;n<e._queue.length;n++){let o=e._queue[n],a=o[o.length-1];typeof a=="function"&&a(t)}}i(YR,"callCallbacks");function hae(e,t,r){YR(e,t,r),e.onerror(t)}i(hae,"onError")});var bz=Be((Q0e,Iz)=>{"use strict";var{kForOnEventAttribute:zp,kListener:QR}=_a(),mz=Symbol("kCode"),fz=Symbol("kData"),hz=Symbol("kError"),gz=Symbol("kMessage"),wz=Symbol("kReason"),Zd=Symbol("kTarget"),yz=Symbol("kType"),vz=Symbol("kWasClean"),Ta=class{static{i(this,"Event")}constructor(t){this[Zd]=null,this[yz]=t}get target(){return this[Zd]}get type(){return this[yz]}};Object.defineProperty(Ta.prototype,"target",{enumerable:!0});Object.defineProperty(Ta.prototype,"type",{enumerable:!0});var Vs=class extends Ta{static{i(this,"CloseEvent")}constructor(t,r={}){super(t),this[mz]=r.code===void 0?0:r.code,this[wz]=r.reason===void 0?"":r.reason,this[vz]=r.wasClean===void 0?!1:r.wasClean}get code(){return this[mz]}get reason(){return this[wz]}get wasClean(){return this[vz]}};Object.defineProperty(Vs.prototype,"code",{enumerable:!0});Object.defineProperty(Vs.prototype,"reason",{enumerable:!0});Object.defineProperty(Vs.prototype,"wasClean",{enumerable:!0});var el=class extends Ta{static{i(this,"ErrorEvent")}constructor(t,r={}){super(t),this[hz]=r.error===void 0?null:r.error,this[gz]=r.message===void 0?"":r.message}get error(){return this[hz]}get message(){return this[gz]}};Object.defineProperty(el.prototype,"error",{enumerable:!0});Object.defineProperty(el.prototype,"message",{enumerable:!0});var Wp=class extends Ta{static{i(this,"MessageEvent")}constructor(t,r={}){super(t),this[fz]=r.data===void 0?null:r.data}get data(){return this[fz]}};Object.defineProperty(Wp.prototype,"data",{enumerable:!0});var gae={addEventListener(e,t,r={}){for(let o of this.listeners(e))if(!r[zp]&&o[QR]===t&&!o[zp])return;let n;if(e==="message")n=i(function(a,s){let c=new Wp("message",{data:s?a:a.toString()});c[Zd]=this,Py(t,this,c)},"onMessage");else if(e==="close")n=i(function(a,s){let c=new Vs("close",{code:a,reason:s.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});c[Zd]=this,Py(t,this,c)},"onClose");else if(e==="error")n=i(function(a){let s=new el("error",{error:a,message:a.message});s[Zd]=this,Py(t,this,s)},"onError");else if(e==="open")n=i(function(){let a=new Ta("open");a[Zd]=this,Py(t,this,a)},"onOpen");else return;n[zp]=!!r[zp],n[QR]=t,r.once?this.once(e,n):this.on(e,n)},removeEventListener(e,t){for(let r of this.listeners(e))if(r[QR]===t&&!r[zp]){this.removeListener(e,r);break}}};Iz.exports={CloseEvent:Vs,ErrorEvent:el,Event:Ta,EventTarget:gae,MessageEvent:Wp};function Py(e,t,r){typeof e=="object"&&e.handleEvent?e.handleEvent.call(e,r):e.call(t,r)}i(Py,"callListener")});var Ry=Be((eMe,kz)=>{"use strict";var{tokenChars:Vp}=Yd();function zo(e,t,r){e[t]===void 0?e[t]=[r]:e[t].push(r)}i(zo,"push");function wae(e){let t=Object.create(null),r=Object.create(null),n=!1,o=!1,a=!1,s,c,d=-1,l=-1,u=-1,p=0;for(;p<e.length;p++)if(l=e.charCodeAt(p),s===void 0)if(u===-1&&Vp[l]===1)d===-1&&(d=p);else if(p!==0&&(l===32||l===9))u===-1&&d!==-1&&(u=p);else if(l===59||l===44){if(d===-1)throw new SyntaxError(`Unexpected character at index ${p}`);u===-1&&(u=p);let g=e.slice(d,u);l===44?(zo(t,g,r),r=Object.create(null)):s=g,d=u=-1}else throw new SyntaxError(`Unexpected character at index ${p}`);else if(c===void 0)if(u===-1&&Vp[l]===1)d===-1&&(d=p);else if(l===32||l===9)u===-1&&d!==-1&&(u=p);else if(l===59||l===44){if(d===-1)throw new SyntaxError(`Unexpected character at index ${p}`);u===-1&&(u=p),zo(r,e.slice(d,u),!0),l===44&&(zo(t,s,r),r=Object.create(null),s=void 0),d=u=-1}else if(l===61&&d!==-1&&u===-1)c=e.slice(d,p),d=u=-1;else throw new SyntaxError(`Unexpected character at index ${p}`);else if(o){if(Vp[l]!==1)throw new SyntaxError(`Unexpected character at index ${p}`);d===-1?d=p:n||(n=!0),o=!1}else if(a)if(Vp[l]===1)d===-1&&(d=p);else if(l===34&&d!==-1)a=!1,u=p;else if(l===92)o=!0;else throw new SyntaxError(`Unexpected character at index ${p}`);else if(l===34&&e.charCodeAt(p-1)===61)a=!0;else if(u===-1&&Vp[l]===1)d===-1&&(d=p);else if(d!==-1&&(l===32||l===9))u===-1&&(u=p);else if(l===59||l===44){if(d===-1)throw new SyntaxError(`Unexpected character at index ${p}`);u===-1&&(u=p);let g=e.slice(d,u);n&&(g=g.replace(/\\/g,""),n=!1),zo(r,c,g),l===44&&(zo(t,s,r),r=Object.create(null),s=void 0),c=void 0,d=u=-1}else throw new SyntaxError(`Unexpected character at index ${p}`);if(d===-1||a||l===32||l===9)throw new SyntaxError("Unexpected end of input");u===-1&&(u=p);let m=e.slice(d,u);return s===void 0?zo(t,m,r):(c===void 0?zo(r,m,!0):n?zo(r,c,m.replace(/\\/g,"")):zo(r,c,m),zo(t,s,r)),t}i(wae,"parse");function yae(e){return Object.keys(e).map(t=>{let r=e[t];return Array.isArray(r)||(r=[r]),r.map(n=>[t].concat(Object.keys(n).map(o=>{let a=n[o];return Array.isArray(a)||(a=[a]),a.map(s=>s===!0?o:`${o}=${s}`).join("; ")})).join("; ")).join(", ")}).join(", ")}i(yae,"format");kz.exports={format:yae,parse:wae}});var Ty=Be((oMe,Oz)=>{"use strict";var vae=qe("events"),Iae=qe("https"),bae=qe("http"),Rz=qe("net"),kae=qe("tls"),{randomBytes:Sae,createHash:Pae}=qe("crypto"),{Duplex:rMe,Readable:nMe}=qe("stream"),{URL:ZR}=qe("url"),Oi=Kd(),Rae=JR(),xae=XR(),{isBlob:_ae}=Yd(),{BINARY_TYPES:Sz,CLOSE_TIMEOUT:Eae,EMPTY_BUFFER:xy,GUID:Tae,kForOnEventAttribute:ex,kListener:Cae,kStatusCode:Aae,kWebSocket:Vt,NOOP:xz}=_a(),{EventTarget:{addEventListener:Mae,removeEventListener:jae}}=bz(),{format:Oae,parse:Hae}=Ry(),{toBuffer:Dae}=qp(),_z=Symbol("kAborted"),tx=[8,13],Ca=["CONNECTING","OPEN","CLOSING","CLOSED"],Lae=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,yt=class e extends vae{static{i(this,"WebSocket")}constructor(t,r,n){super(),this._binaryType=Sz[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=xy,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol="",this._readyState=e.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,t!==null?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,r===void 0?r=[]:Array.isArray(r)||(typeof r=="object"&&r!==null?(n=r,r=[]):r=[r]),Ez(this,t,r,n)):(this._autoPong=n.autoPong,this._closeTimeout=n.closeTimeout,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(t){Sz.includes(t)&&(this._binaryType=t,this._receiver&&(this._receiver._binaryType=t))}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(t,r,n){let o=new Rae({allowSynchronousEvents:n.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxBufferedChunks:n.maxBufferedChunks,maxFragments:n.maxFragments,maxPayload:n.maxPayload,skipUTF8Validation:n.skipUTF8Validation}),a=new xae(t,this._extensions,n.generateMask);this._receiver=o,this._sender=a,this._socket=t,o[Vt]=this,a[Vt]=this,t[Vt]=this,o.on("conclude",Nae),o.on("drain",Uae),o.on("error",qae),o.on("message",Fae),o.on("ping",zae),o.on("pong",Wae),a.onerror=Vae,t.setTimeout&&t.setTimeout(0),t.setNoDelay&&t.setNoDelay(),r.length>0&&t.unshift(r),t.on("close",Az),t.on("data",Ey),t.on("end",Mz),t.on("error",jz),this._readyState=e.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=e.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[Oi.extensionName]&&this._extensions[Oi.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=e.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(t,r){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){pn(this,this._req,"WebSocket was closed before the connection was established");return}if(this.readyState===e.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=e.CLOSING,this._sender.close(t,r,!this._isServer,n=>{n||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),Cz(this)}}pause(){this.readyState===e.CONNECTING||this.readyState===e.CLOSED||(this._paused=!0,this._socket.pause())}ping(t,r,n){if(this.readyState===e.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof t=="function"?(n=t,t=r=void 0):typeof r=="function"&&(n=r,r=void 0),typeof t=="number"&&(t=t.toString()),this.readyState!==e.OPEN){rx(this,t,n);return}r===void 0&&(r=!this._isServer),this._sender.ping(t||xy,r,n)}pong(t,r,n){if(this.readyState===e.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof t=="function"?(n=t,t=r=void 0):typeof r=="function"&&(n=r,r=void 0),typeof t=="number"&&(t=t.toString()),this.readyState!==e.OPEN){rx(this,t,n);return}r===void 0&&(r=!this._isServer),this._sender.pong(t||xy,r,n)}resume(){this.readyState===e.CONNECTING||this.readyState===e.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(t,r,n){if(this.readyState===e.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof r=="function"&&(n=r,r={}),typeof t=="number"&&(t=t.toString()),this.readyState!==e.OPEN){rx(this,t,n);return}let o={binary:typeof t!="string",mask:!this._isServer,compress:!0,fin:!0,...r};this._extensions[Oi.extensionName]||(o.compress=!1),this._sender.send(t||xy,o,n)}terminate(){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){pn(this,this._req,"WebSocket was closed before the connection was established");return}this._socket&&(this._readyState=e.CLOSING,this._socket.destroy())}}};Object.defineProperty(yt,"CONNECTING",{enumerable:!0,value:Ca.indexOf("CONNECTING")});Object.defineProperty(yt.prototype,"CONNECTING",{enumerable:!0,value:Ca.indexOf("CONNECTING")});Object.defineProperty(yt,"OPEN",{enumerable:!0,value:Ca.indexOf("OPEN")});Object.defineProperty(yt.prototype,"OPEN",{enumerable:!0,value:Ca.indexOf("OPEN")});Object.defineProperty(yt,"CLOSING",{enumerable:!0,value:Ca.indexOf("CLOSING")});Object.defineProperty(yt.prototype,"CLOSING",{enumerable:!0,value:Ca.indexOf("CLOSING")});Object.defineProperty(yt,"CLOSED",{enumerable:!0,value:Ca.indexOf("CLOSED")});Object.defineProperty(yt.prototype,"CLOSED",{enumerable:!0,value:Ca.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(e=>{Object.defineProperty(yt.prototype,e,{enumerable:!0})});["open","error","close","message"].forEach(e=>{Object.defineProperty(yt.prototype,`on${e}`,{enumerable:!0,get(){for(let t of this.listeners(e))if(t[ex])return t[Cae];return null},set(t){for(let r of this.listeners(e))if(r[ex]){this.removeListener(e,r);break}typeof t=="function"&&this.addEventListener(e,t,{[ex]:!0})}})});yt.prototype.addEventListener=Mae;yt.prototype.removeEventListener=jae;Oz.exports=yt;function Ez(e,t,r,n){let o={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:Eae,protocolVersion:tx[1],maxBufferedChunks:262144,maxFragments:16384,maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...n,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(e._autoPong=o.autoPong,e._closeTimeout=o.closeTimeout,!tx.includes(o.protocolVersion))throw new RangeError(`Unsupported protocol version: ${o.protocolVersion} (supported versions: ${tx.join(", ")})`);let a;if(t instanceof ZR)a=t;else try{a=new ZR(t)}catch{throw new SyntaxError(`Invalid URL: ${t}`)}a.protocol==="http:"?a.protocol="ws:":a.protocol==="https:"&&(a.protocol="wss:"),e._url=a.href;let s=a.protocol==="wss:",c=a.protocol==="ws+unix:",d;if(a.protocol!=="ws:"&&!s&&!c?d=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:c&&!a.pathname?d="The URL's pathname is empty":a.hash&&(d="The URL contains a fragment identifier"),d){let h=new SyntaxError(d);if(e._redirects===0)throw h;_y(e,h);return}let l=s?443:80,u=Sae(16).toString("base64"),p=s?Iae.request:bae.request,m=new Set,g;if(o.createConnection=o.createConnection||(s?$ae:Bae),o.defaultPort=o.defaultPort||l,o.port=a.port||l,o.host=a.hostname.startsWith("[")?a.hostname.slice(1,-1):a.hostname,o.headers={...o.headers,"Sec-WebSocket-Version":o.protocolVersion,"Sec-WebSocket-Key":u,Connection:"Upgrade",Upgrade:"websocket"},o.path=a.pathname+a.search,o.timeout=o.handshakeTimeout,o.perMessageDeflate&&(g=new Oi({...o.perMessageDeflate,isServer:!1,maxPayload:o.maxPayload}),o.headers["Sec-WebSocket-Extensions"]=Oae({[Oi.extensionName]:g.offer()})),r.length){for(let h of r){if(typeof h!="string"||!Lae.test(h)||m.has(h))throw new SyntaxError("An invalid or duplicated subprotocol was specified");m.add(h)}o.headers["Sec-WebSocket-Protocol"]=r.join(",")}if(o.origin&&(o.protocolVersion<13?o.headers["Sec-WebSocket-Origin"]=o.origin:o.headers.Origin=o.origin),(a.username||a.password)&&(o.auth=`${a.username}:${a.password}`),c){let h=o.path.split(":");o.socketPath=h[0],o.path=h[1]}let w;if(o.followRedirects){if(e._redirects===0){e._originalIpc=c,e._originalSecure=s,e._originalHostOrSocketPath=c?o.socketPath:a.host;let h=n&&n.headers;if(n={...n,headers:{}},h)for(let[y,f]of Object.entries(h))n.headers[y.toLowerCase()]=f}else if(e.listenerCount("redirect")===0){let h=c?e._originalIpc?o.socketPath===e._originalHostOrSocketPath:!1:e._originalIpc?!1:a.host===e._originalHostOrSocketPath;(!h||e._originalSecure&&!s)&&(delete o.headers.authorization,delete o.headers.cookie,h||delete o.headers.host,o.auth=void 0)}o.auth&&!n.headers.authorization&&(n.headers.authorization="Basic "+Buffer.from(o.auth).toString("base64")),w=e._req=p(o),e._redirects&&e.emit("redirect",e.url,w)}else w=e._req=p(o);o.timeout&&w.on("timeout",()=>{pn(e,w,"Opening handshake has timed out")}),w.on("error",h=>{w===null||w[_z]||(w=e._req=null,_y(e,h))}),w.on("response",h=>{let y=h.headers.location,f=h.statusCode;if(y&&o.followRedirects&&f>=300&&f<400){if(++e._redirects>o.maxRedirects){pn(e,w,"Maximum redirects exceeded");return}w.abort();let S;try{S=new ZR(y,t)}catch{let I=new SyntaxError(`Invalid URL: ${y}`);_y(e,I);return}Ez(e,S,r,n)}else e.emit("unexpected-response",w,h)||pn(e,w,`Unexpected server response: ${h.statusCode}`)}),w.on("upgrade",(h,y,f)=>{if(e.emit("upgrade",h),e.readyState!==yt.CONNECTING)return;w=e._req=null;let S=h.headers.upgrade;if(S===void 0||S.toLowerCase()!=="websocket"){pn(e,y,"Invalid Upgrade header");return}let k=Pae("sha1").update(u+Tae).digest("base64");if(h.headers["sec-websocket-accept"]!==k){pn(e,y,"Invalid Sec-WebSocket-Accept header");return}let I=h.headers["sec-websocket-protocol"],b;if(I!==void 0?m.size?m.has(I)||(b="Server sent an invalid subprotocol"):b="Server sent a subprotocol but none was requested":m.size&&(b="Server sent no subprotocol"),b){pn(e,y,b);return}I&&(e._protocol=I);let R=h.headers["sec-websocket-extensions"];if(R!==void 0){if(!g){pn(e,y,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let _;try{_=Hae(R)}catch{pn(e,y,"Invalid Sec-WebSocket-Extensions header");return}let P=Object.keys(_);if(P.length!==1||P[0]!==Oi.extensionName){pn(e,y,"Server indicated an extension that was not requested");return}try{g.accept(_[Oi.extensionName])}catch{pn(e,y,"Invalid Sec-WebSocket-Extensions header");return}e._extensions[Oi.extensionName]=g}e.setSocket(y,f,{allowSynchronousEvents:o.allowSynchronousEvents,generateMask:o.generateMask,maxBufferedChunks:o.maxBufferedChunks,maxFragments:o.maxFragments,maxPayload:o.maxPayload,skipUTF8Validation:o.skipUTF8Validation})}),o.finishRequest?o.finishRequest(w,e):w.end()}i(Ez,"initAsClient");function _y(e,t){e._readyState=yt.CLOSING,e._errorEmitted=!0,e.emit("error",t),e.emitClose()}i(_y,"emitErrorAndClose");function Bae(e){return e.path=e.socketPath,Rz.connect(e)}i(Bae,"netConnect");function $ae(e){return e.path=void 0,!e.servername&&e.servername!==""&&(e.servername=Rz.isIP(e.host)?"":e.host),kae.connect(e)}i($ae,"tlsConnect");function pn(e,t,r){e._readyState=yt.CLOSING;let n=new Error(r);Error.captureStackTrace(n,pn),t.setHeader?(t[_z]=!0,t.abort(),t.socket&&!t.socket.destroyed&&t.socket.destroy(),process.nextTick(_y,e,n)):(t.destroy(n),t.once("error",e.emit.bind(e,"error")),t.once("close",e.emitClose.bind(e)))}i(pn,"abortHandshake");function rx(e,t,r){if(t){let n=_ae(t)?t.size:Dae(t).length;e._socket?e._sender._bufferedBytes+=n:e._bufferedAmount+=n}if(r){let n=new Error(`WebSocket is not open: readyState ${e.readyState} (${Ca[e.readyState]})`);process.nextTick(r,n)}}i(rx,"sendAfterClose");function Nae(e,t){let r=this[Vt];r._closeFrameReceived=!0,r._closeMessage=t,r._closeCode=e,r._socket[Vt]!==void 0&&(r._socket.removeListener("data",Ey),process.nextTick(Tz,r._socket),e===1005?r.close():r.close(e,t))}i(Nae,"receiverOnConclude");function Uae(){let e=this[Vt];e.isPaused||e._socket.resume()}i(Uae,"receiverOnDrain");function qae(e){let t=this[Vt];t._socket[Vt]!==void 0&&(t._socket.removeListener("data",Ey),process.nextTick(Tz,t._socket),t.close(e[Aae])),t._errorEmitted||(t._errorEmitted=!0,t.emit("error",e))}i(qae,"receiverOnError");function Pz(){this[Vt].emitClose()}i(Pz,"receiverOnFinish");function Fae(e,t){this[Vt].emit("message",e,t)}i(Fae,"receiverOnMessage");function zae(e){let t=this[Vt];t._autoPong&&t.pong(e,!this._isServer,xz),t.emit("ping",e)}i(zae,"receiverOnPing");function Wae(e){this[Vt].emit("pong",e)}i(Wae,"receiverOnPong");function Tz(e){e.resume()}i(Tz,"resume");function Vae(e){let t=this[Vt];t.readyState!==yt.CLOSED&&(t.readyState===yt.OPEN&&(t._readyState=yt.CLOSING,Cz(t)),this._socket.end(),t._errorEmitted||(t._errorEmitted=!0,t.emit("error",e)))}i(Vae,"senderOnError");function Cz(e){e._closeTimer=setTimeout(e._socket.destroy.bind(e._socket),e._closeTimeout)}i(Cz,"setCloseTimer");function Az(){let e=this[Vt];if(this.removeListener("close",Az),this.removeListener("data",Ey),this.removeListener("end",Mz),e._readyState=yt.CLOSING,!this._readableState.endEmitted&&!e._closeFrameReceived&&!e._receiver._writableState.errorEmitted&&this._readableState.length!==0){let t=this.read(this._readableState.length);e._receiver.write(t)}e._receiver.end(),this[Vt]=void 0,clearTimeout(e._closeTimer),e._receiver._writableState.finished||e._receiver._writableState.errorEmitted?e.emitClose():(e._receiver.on("error",Pz),e._receiver.on("finish",Pz))}i(Az,"socketOnClose");function Ey(e){this[Vt]._receiver.write(e)||this.pause()}i(Ey,"socketOnData");function Mz(){let e=this[Vt];e._readyState=yt.CLOSING,e._receiver.end(),this.end()}i(Mz,"socketOnEnd");function jz(){let e=this[Vt];this.removeListener("error",jz),this.on("error",xz),e&&(e._readyState=yt.CLOSING,this.destroy())}i(jz,"socketOnError")});var Bz=Be((sMe,Lz)=>{"use strict";var iMe=Ty(),{Duplex:Gae}=qe("stream");function Hz(e){e.emit("close")}i(Hz,"emitClose");function Jae(){!this.destroyed&&this._writableState.finished&&this.destroy()}i(Jae,"duplexOnEnd");function Dz(e){this.removeListener("error",Dz),this.destroy(),this.listenerCount("error")===0&&this.emit("error",e)}i(Dz,"duplexOnError");function Kae(e,t){let r=!0,n=new Gae({...t,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return e.on("message",i(function(a,s){let c=!s&&n._readableState.objectMode?a.toString():a;n.push(c)||e.pause()},"message")),e.once("error",i(function(a){n.destroyed||(r=!1,n.destroy(a))},"error")),e.once("close",i(function(){n.destroyed||n.push(null)},"close")),n._destroy=function(o,a){if(e.readyState===e.CLOSED){a(o),process.nextTick(Hz,n);return}let s=!1;e.once("error",i(function(d){s=!0,a(d)},"error")),e.once("close",i(function(){s||a(o),process.nextTick(Hz,n)},"close")),r&&e.terminate()},n._final=function(o){if(e.readyState===e.CONNECTING){e.once("open",i(function(){n._final(o)},"open"));return}e._socket!==null&&(e._socket._writableState.finished?(o(),n._readableState.endEmitted&&n.destroy()):(e._socket.once("finish",i(function(){o()},"finish")),e.close()))},n._read=function(){e.isPaused&&e.resume()},n._write=function(o,a,s){if(e.readyState===e.CONNECTING){e.once("open",i(function(){n._write(o,a,s)},"open"));return}e.send(o,s)},n.on("end",Jae),n.on("error",Dz),n}i(Kae,"createWebSocketStream");Lz.exports=Kae});var nx=Be((dMe,$z)=>{"use strict";var{tokenChars:Yae}=Yd();function Xae(e){let t=new Set,r=-1,n=-1,o=0;for(o;o<e.length;o++){let s=e.charCodeAt(o);if(n===-1&&Yae[s]===1)r===-1&&(r=o);else if(o!==0&&(s===32||s===9))n===-1&&r!==-1&&(n=o);else if(s===44){if(r===-1)throw new SyntaxError(`Unexpected character at index ${o}`);n===-1&&(n=o);let c=e.slice(r,n);if(t.has(c))throw new SyntaxError(`The "${c}" subprotocol is duplicated`);t.add(c),r=n=-1}else throw new SyntaxError(`Unexpected character at index ${o}`)}if(r===-1||n!==-1)throw new SyntaxError("Unexpected end of input");let a=e.slice(r,o);if(t.has(a))throw new SyntaxError(`The "${a}" subprotocol is duplicated`);return t.add(a),t}i(Xae,"parse");$z.exports={parse:Xae}});var Vz=Be((pMe,Wz)=>{"use strict";var Qae=qe("events"),Cy=qe("http"),{Duplex:uMe}=qe("stream"),{createHash:Zae}=qe("crypto"),Nz=Ry(),Gs=Kd(),eie=nx(),tie=Ty(),{CLOSE_TIMEOUT:rie,GUID:nie,kWebSocket:oie}=_a(),aie=/^[+/0-9A-Za-z]{22}==$/,Uz=0,qz=1,zz=2,ox=class extends Qae{static{i(this,"WebSocketServer")}constructor(t,r){if(super(),t={allowSynchronousEvents:!0,autoPong:!0,maxBufferedChunks:256*1024,maxFragments:16*1024,maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:rie,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:tie,...t},t.port==null&&!t.server&&!t.noServer||t.port!=null&&(t.server||t.noServer)||t.server&&t.noServer)throw new TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(t.port!=null?(this._server=Cy.createServer((n,o)=>{let a=Cy.STATUS_CODES[426];o.writeHead(426,{"Content-Length":a.length,"Content-Type":"text/plain"}),o.end(a)}),this._server.listen(t.port,t.host,t.backlog,r)):t.server&&(this._server=t.server),this._server){let n=this.emit.bind(this,"connection");this._removeListeners=iie(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:i((o,a,s)=>{this.handleUpgrade(o,a,s,n)},"upgrade")})}t.perMessageDeflate===!0&&(t.perMessageDeflate={}),t.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=t,this._state=Uz}address(){if(this.options.noServer)throw new Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(t){if(this._state===zz){t&&this.once("close",()=>{t(new Error("The server is not running"))}),process.nextTick(Gp,this);return}if(t&&this.once("close",t),this._state!==qz)if(this._state=qz,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(Gp,this):process.nextTick(Gp,this);else{let r=this._server;this._removeListeners(),this._removeListeners=this._server=null,r.close(()=>{Gp(this)})}}shouldHandle(t){if(this.options.path){let r=t.url.indexOf("?");if((r!==-1?t.url.slice(0,r):t.url)!==this.options.path)return!1}return!0}handleUpgrade(t,r,n,o){r.on("error",Fz);let a=t.headers["sec-websocket-key"],s=t.headers.upgrade,c=+t.headers["sec-websocket-version"];if(t.method!=="GET"){Js(this,t,r,405,"Invalid HTTP method");return}if(s===void 0||s.toLowerCase()!=="websocket"){Js(this,t,r,400,"Invalid Upgrade header");return}if(a===void 0||!aie.test(a)){Js(this,t,r,400,"Missing or invalid Sec-WebSocket-Key header");return}if(c!==13&&c!==8){Js(this,t,r,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});return}if(!this.shouldHandle(t)){Jp(r,400);return}let d=t.headers["sec-websocket-protocol"],l=new Set;if(d!==void 0)try{l=eie.parse(d)}catch{Js(this,t,r,400,"Invalid Sec-WebSocket-Protocol header");return}let u=t.headers["sec-websocket-extensions"],p={};if(this.options.perMessageDeflate&&u!==void 0){let m=new Gs({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let g=Nz.parse(u);g[Gs.extensionName]&&(m.accept(g[Gs.extensionName]),p[Gs.extensionName]=m)}catch{Js(this,t,r,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let m={origin:t.headers[`${c===8?"sec-websocket-origin":"origin"}`],secure:!!(t.socket.authorized||t.socket.encrypted),req:t};if(this.options.verifyClient.length===2){this.options.verifyClient(m,(g,w,h,y)=>{if(!g)return Jp(r,w||401,h,y);this.completeUpgrade(p,a,l,t,r,n,o)});return}if(!this.options.verifyClient(m))return Jp(r,401)}this.completeUpgrade(p,a,l,t,r,n,o)}completeUpgrade(t,r,n,o,a,s,c){if(!a.readable||!a.writable)return a.destroy();if(a[oie])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>Uz)return Jp(a,503);let l=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${Zae("sha1").update(r+nie).digest("base64")}`],u=new this.options.WebSocket(null,void 0,this.options);if(n.size){let p=this.options.handleProtocols?this.options.handleProtocols(n,o):n.values().next().value;p&&(l.push(`Sec-WebSocket-Protocol: ${p}`),u._protocol=p)}if(t[Gs.extensionName]){let p=t[Gs.extensionName].params,m=Nz.format({[Gs.extensionName]:[p]});l.push(`Sec-WebSocket-Extensions: ${m}`),u._extensions=t}this.emit("headers",l,o),a.write(l.concat(`\r
|
|
3
|
+
import{a as Lq,b as Bq,c as $q}from"./chunk-YXMYK5P7.js";import"./chunk-S4WILIRA.js";import{c as bq}from"./chunk-QUNQM2E3.js";import{a as kq,b as Sq,c as Pq,d as Rq,e as xq,f as _q,g as Eq,h as Tq,i as Cq,j as Aq}from"./chunk-UMAVVMXL.js";import{a as or,b as Op,c as xa,d as iy,e as sy,f as Ei}from"./chunk-ZDEIVUUI.js";import{a as Mq,b as jq,c as Oq,d as M,e as Hq,f as Ti,g as z,h as cy,j as Dq}from"./chunk-7RSQOC5M.js";import{a as ay,b as vq}from"./chunk-5JVJQA5H.js";import{a as HU,b as FU,c as hR,d as zU,e as WU,f as VU,g as GU,h as JU,j as KU}from"./chunk-2TGHZXJE.js";import{A as fR,a as MU,c as jU,g as OU,k as ey,l as Fo,m as DU,n as Pa,o as ty,p as LU,q as Ri,r as ry,s as BU,t as Ra,u as ny,v as xi,w as $U,x as NU,y as UU,z as qU}from"./chunk-IIT66347.js";import{a as YU,b as XU,c as oy,d as QU,e as _i,f as Je,g as ZU,h as Pe,i as eq,j as tq,k as rq,l as nq,m as oq,n as aq,o as iq,p as sq,q as cq,r as dq,s as lq,t as $r,u as Pr,v as pe,w as uq}from"./chunk-TB5P3FWM.js";import{a as pq,b as mq}from"./chunk-Q7P34B2O.js";import{a as fq,b as hq}from"./chunk-ESYPMD7Q.js";import{c as mR}from"./chunk-CO23RRN7.js";import{a as gq,b as wq,c as yq}from"./chunk-KCLMA2IH.js";import"./chunk-FNGZ4UDZ.js";import{a as Yw,b as yU,c as vU,d as IU,e as bU}from"./chunk-VWWKWYSQ.js";import{a as Sa,c as Ww,d as Ud,e as pU,f as mU,g as kr,h as fU,i as Gw,j as hU,k as Sr,l as Jw,m as gU,n as Yr,o as Kw,p as wU,r as PU}from"./chunk-OUJ63LMU.js";import{a as Xw,b as kU,c as pR}from"./chunk-EFP75UEX.js";import{b as SU,c as Qw}from"./chunk-PACLKDTN.js";import{a as un}from"./chunk-ZIQJDTQB.js";import"./chunk-S7A2OGL2.js";import{a as lU,e as Vw}from"./chunk-3Z4VM2LF.js";import{a as xS,b as WM}from"./chunk-EICS777E.js";import{a as RU}from"./chunk-MIFVX5PK.js";import"./chunk-WLQEONBF.js";import"./chunk-3A2Y7UK3.js";import{b as xU}from"./chunk-WNXUSELC.js";import{a as _U,b as Zw,c as EU,d as TU,e as CU}from"./chunk-RCRZXHAI.js";import{b as AU}from"./chunk-4KNPCJR4.js";import{a as rU,b as nU,c as Uw,d as qw}from"./chunk-XVDFJ3ZF.js";import{b as dU}from"./chunk-M4A7G4S5.js";import{b as cU,c as lR}from"./chunk-Q3WXB465.js";import"./chunk-JQOVC35K.js";import{a as sU}from"./chunk-FEAKTSRS.js";import"./chunk-Q73RKX7I.js";import{a as oo,b as zw,c as uR,d as uU}from"./chunk-TPOAAJKA.js";import"./chunk-ZYLLPRPU.js";import{a as Z2,b as eU,c as tU}from"./chunk-XYZV3FKD.js";import{h as oe}from"./chunk-RCQYEHHD.js";import"./chunk-SDO4FC4Q.js";import"./chunk-IR3YJWPW.js";import{a as J2,b as $w}from"./chunk-SDHG6CKU.js";import{a as Ns,b as Nw,c as X2,d as Q2}from"./chunk-XHACK2KR.js";import"./chunk-W45RKGM6.js";import"./chunk-GYYJ47GX.js";import{a as Lw,d as Bw,f as K2,g as Y2}from"./chunk-WCNPGKST.js";import{a as G2}from"./chunk-DWF3FCY4.js";import{b as W2,c as V2,d as Nd,f as Dw,g as Mp}from"./chunk-YDZBX4XQ.js";import{b as jp,c as ka}from"./chunk-AFH462DO.js";import"./chunk-UANH7U3Y.js";import{a as no,b as F2,c as z2}from"./chunk-MWS2NAHJ.js";import{a as H2,d as D2,f as L2,g as B2,h as $2,i as ba,j as N2,k as Hw,n as Ap}from"./chunk-CCZ276IA.js";import{a as U2,b as q2}from"./chunk-K7KBFM2T.js";import{c as N$,d as uw,i as U$}from"./chunk-AQUZCWM3.js";import{b as jw,d as $d,l as _2,n as Ow}from"./chunk-E2JB5OCO.js";import"./chunk-DRMOHADV.js";import{A as dg,c as sg,d as tH,e as rH,f as nH,h as oH,i as aH,j as iH,p as sH,u as wi,v as cH,x as dH,z as cg}from"./chunk-OTXGAKFH.js";import{a as yH,d as vH,g as EH}from"./chunk-CIZI6Z7D.js";import{a as o$,b as c$,c as d$,d as j$,e as lw,f as L$,g as B$,h as $$,i as q$,j as EN,k as j2,m as Iq}from"./chunk-G4FRBT7G.js";import{a as oU}from"./chunk-PSY6IRJE.js";import{a as pt,b as a$,c as i$,d as JP,e as eN,f as mw,g as fw,h as tN}from"./chunk-PKJHN666.js";import{a as aU,b as Fw,c as iU}from"./chunk-Z33RVGP6.js";import{b as Ad,c as Md,d as VP}from"./chunk-7PKDJHT6.js";import{b as dw}from"./chunk-65WRWLUD.js";import{$ as b2,A as AN,B as Kr,C as MN,D as jN,E as $N,F as NN,G as UN,H as qN,I as FN,J as e2,K as t2,L as aR,M as r2,N as d2,O as l2,P as u2,Q as m2,R as iR,S as g2,T as Cw,U as Ls,V as qo,W as to,X as v2,Y as Tp,Z as I2,_ as ro,aa as Aw,b as l$,ba as k2,c as x$,ca as S2,d as _$,da as br,e as T$,ea as Bs,f as V$,fa as P2,g as Od,ga as Ia,h as G$,ha as sR,i as Y$,ia as cR,j as X$,ja as Cp,k as rN,ka as dR,l as yN,la as Mw,m as vN,ma as x2,n as IN,na as E2,o as bN,oa as O2,p as kN,q as QP,r as SN,s as PN,t as RN,u as xN,x as _N,y as TN,z as ZP}from"./chunk-LSKMALD6.js";import{g as T2,h as C2,i as A2,j as M2}from"./chunk-B66QCXH2.js";import{a as E$}from"./chunk-PYNW5OFA.js";import{A as eR,B as tR,F as zN,M as w2,a as z$,b as W$,c as GP,m as wN,q as yw}from"./chunk-MOXIGLN2.js";import{b as $s,c as R2,d as Br}from"./chunk-RHMULF56.js";import"./chunk-VFH5C6D2.js";import{a as h2}from"./chunk-UOFDKMRU.js";import{a as gN}from"./chunk-AN525SPP.js";import{a as F$}from"./chunk-IZ6DLEVY.js";import{a as Hs,b as UP,c as Sp,d as Pp,e as Td,f as aw,g as qP,h as Rp,i as Cn,j as P$,k as fe,l as R$,m as zP}from"./chunk-M5X7XKXY.js";import{b as f$}from"./chunk-65FJWWXG.js";import"./chunk-SYUKES6H.js";import{a as O$,b as H$,c as D$,d as cw}from"./chunk-EYTTZ5H4.js";import"./chunk-XY7HFXLH.js";import{B as p2,J as y2,b as VM,z as CN}from"./chunk-6I5AUTVO.js";import{b as C$,i as A$,j as M$,m as Cd,n as WP}from"./chunk-DKOVZ6R2.js";import{a as kp,b as bi}from"./chunk-N5EAVX4G.js";import{a as NP,g as u$,h as p$,j as m$}from"./chunk-U7X5ZLAL.js";import"./chunk-7PXZ4X4P.js";import"./chunk-N73MU2C3.js";import"./chunk-SO4GMSNP.js";import"./chunk-NMMHXYDJ.js";import"./chunk-QLGP2OAQ.js";import{A as Pi,B as oR,C as Sw,D as YN,E as Pw,F as XN,G as _p,J as Rw,K as QN,L as xw,M as ZN,N as Bd,d as ON,f as HN,g as DN,h as LN,i as BN,m as vw,n as Iw,o as WN,p as VN,q as Ld,r as GN,s as rR,t as JN,u as bw,v as kw,w as Uo,x as Ds,y as nR,z as KN}from"./chunk-WZ35ICTE.js";import"./chunk-VS2LOUCT.js";import"./chunk-DMFUEUAZ.js";import"./chunk-AFKFN25T.js";import"./chunk-G4747MOW.js";import{a as $o,b as No,c as Wt}from"./chunk-GF55VEMR.js";import"./chunk-FAKDGLZQ.js";import"./chunk-KCJVFLBB.js";import{a as Q$,b as Z$}from"./chunk-GW766ZSO.js";import{a as i2,b as s2,c as c2,d as Tw,f as f2}from"./chunk-VJYOKU3C.js";import{a as n2,b as Ep,c as o2,d as _w,e as a2,f as Ew}from"./chunk-SSJV3VX7.js";import{a as jd}from"./chunk-7KWD2I6W.js";import{a as Dr,b as h$,c as Lr,d as g$,e as iw,f as sw,g as FP,h as w$,i as ki,k as y$,l as v$,m as I$,n as b$,o as k$,p as S$}from"./chunk-RY46UPBO.js";import{A as NM,C as UM,D as qM,E as Qn,d as RM,e as xM,f as _M,g as EM,h as SS,i as TM,j as CM,k as AM,l as MM,m as jM,n as xh,o as OM,p as PS,q as HM,r as DM,s as rr,t as LM,u as ut,v as St,w as BM,x as $M,y as Du,z as _h}from"./chunk-OFJPOTES.js";import{c as dN,d as KP,e as lN,f as uN,g as pN,h as mN,i as Dd,j as ww,k as Bo,l as fN,m as YP,n as hN,o as XP}from"./chunk-PLROXHG2.js";import{A as cN,C as gw,b as pw,d as J$,e as K$,h as nN,k as oN,l as aN,m as Hd,n as iN,p as hw,q as sN,s as xp}from"./chunk-YU3C6U5V.js";import"./chunk-PHZZBXDO.js";import{a as Si}from"./chunk-KVTBX2UP.js";import{a as ye,b as zt,c as Ed,d as ce,f as s$}from"./chunk-U7D6Q744.js";import{$ as rL,$a as AL,$b as cp,$c as $P,A as CD,Aa as mL,Ac as JB,Ba as fL,Ca as hL,Cb as Zg,Cc as KB,Db as CB,Dc as YB,E as AD,Ea as Pd,Eb as AB,Ec as Os,F as MD,Fa as gL,Fb as Lo,Fc as XB,G as Lg,Gb as MB,H as jD,Ha as tp,Hb as js,I as UD,Ia as Fg,Ib as jB,Ic as st,J as qD,Ja as wL,Jc as HP,K as Oo,Ka as SP,Kc as up,La as yL,Lc as pp,M as FD,Ma as vL,Mc as QB,N as zD,Na as PP,Nc as DP,O as WD,Oa as IL,Oc as mp,P as VD,Pa as bL,Pc as fp,Q as GD,Qa as kL,Qc as ZB,Ra as SL,Rc as LP,S as JD,Sa as PL,Sc as hp,T as Bg,Ta as RL,Tc as gp,U as KD,Ua as xL,Uc as e$,V as YD,Va as RP,Vb as OB,Vc as wp,W as XD,Wa as _L,Wc as t$,X as QD,Xa as EL,Xb as HB,Xc as BP,Y as ZD,Ya as TL,Yb as ip,Yc as yp,Z as eL,Za as CL,Zb as DB,Zc as vp,_ as tL,_a as xP,_b as sp,_c as r$,aa as nL,ab as ML,ac as MP,ad as Ip,b as bd,ba as oL,bb as jL,bc as LB,bd as bp,ca as aL,cb as OL,cc as dp,cd as n$,da as iL,db as HL,dc as BB,e as wD,ea as sL,eb as DL,ec as ew,fb as LL,fc as $B,g as vP,ga as $g,gb as BL,gc as NB,h as yD,ha as cL,hb as $L,hc as UB,i as Hr,ia as Zn,ic as qB,j as Qu,ja as Ng,jc as tw,k as Ts,ka as kP,kb as NL,kc as rw,l as IP,la as Ug,lb as UL,m as vD,mb as qL,n as ID,na as qg,nb as FL,nc as FB,o as bD,oa as Zu,ob as zL,p as kD,pb as rp,pc as Ii,q as SD,qa as dL,r as PD,rb as zg,rc as nw,s as Dg,sb as WL,sc as zB,ta as Sd,tb as VL,tc as lp,ua as Ho,ub as GL,uc as ow,v as va,va as lL,vb as Cs,vc as WB,w as kd,wa as ep,wb as JL,wc as VB,x as ED,xc as jP,y as TD,ya as uL,yb as TB,yc as GB,za as pL,zc as OP}from"./chunk-HG2YFMVU.js";import{d as SM}from"./chunk-OQPJ7FJF.js";import"./chunk-BL3CZWWD.js";import{b as OD,c as HD,d as DD,e as LD,f as BD,g as $D,h as ND}from"./chunk-FYWQWKVS.js";import{b as RD,c as Hg}from"./chunk-GD3RCUDH.js";import{$ as Ms,A as Ir,C as dB,D as lB,E as uB,F as AP,G as pB,H as mB,I as fB,K as Jg,L as hB,a as Wg,aa as gB,b as KL,ba as eo,c as _P,ca as wB,d as Do,da as yB,e as YL,ea as vB,f as XL,fa as yi,g as QL,ga as xd,h as EP,ha as Kg,i as As,ia as IB,j as ZL,ja as bB,k as eB,ka as kB,l as tB,la as op,m as TP,ma as _d,n as np,na as Yg,o as rB,oa as SB,p as Vg,pa as Xg,q as nB,qa as vi,r as oB,ra as PB,s as Rd,sa as RB,t as aB,ta as xB,u as Gg,ua as Qg,v as iB,va as _B,w as sB,wa as ap,x as CP,xa as EB,z as cB}from"./chunk-7OKZCJHS.js";import"./chunk-UTIELP6F.js";import{g as TH,j as CH,l as yd,m as AH,o as pg,s as mg}from"./chunk-7NCM6GBN.js";import"./chunk-4V73I4OL.js";import"./chunk-LE75SVEL.js";import{e as xD,g as _D,h as bP,j as wt}from"./chunk-6ESBAHWK.js";import{a as Mne,b as JM,c as _S,d as ES}from"./chunk-LZPCA6DH.js";import{b as dd,c as PM}from"./chunk-L3KS6MOV.js";import"./chunk-7J2NMUTK.js";import{$b as zu,$f as pP,$i as M1,Ad as zH,Ag as mP,Ah as hP,Bd as WH,Be as YH,Cf as uP,Cj as D1,Dj as L1,Gi as Xu,Gj as B1,Hi as P1,Hj as $1,Ii as R1,Ij as N1,Kj as U1,Mj as q1,Nh as m1,Od as VH,Oe as XH,Ok as X1,Pd as GH,Ph as f1,Qf as a1,Re as QH,Rg as d1,Rh as h1,Ri as x1,Rk as Q1,Sd as Wu,Sh as g1,Ta as BH,Td as Vu,Tf as Ig,Ub as $H,Uf as bg,Ug as xg,Uh as Ku,Ui as _1,Uk as Z1,Vf as kg,Vg as _g,Vh as w1,Vi as E1,Vj as F1,Vk as eD,Wf as i1,Wg as Eg,Wh as y1,Wi as T1,Wk as tD,Xe as ZH,Xg as l1,Xj as Mg,Xk as rD,Y as Fu,Ye as gg,Yi as C1,Yk as nD,Zi as A1,Zk as oD,_b as NH,a as MH,af as e1,ah as fP,ak as z1,b as Ge,bk as W1,cf as Ju,ck as jg,di as v1,dk as V1,ek as G1,fa as fg,gl as Id,hf as vd,hi as Yu,if as t1,ii as I1,ja as jH,je as Gu,ji as b1,jl as aD,ka as OH,kf as r1,la as hg,ld as UH,lk as J1,ma as HH,na as DH,nj as gP,nl as iD,pd as Tn,pf as n1,pg as s1,ph as u1,pj as wP,pk as K1,pl as sD,ql as cD,rk as Y1,rl as Se,sg as Sg,sh as Tg,si as k1,tg as Pg,th as Cg,ue as JH,ug as Rg,uh as Ag,uj as j1,vg as c1,vh as p1,wa as LH,wf as wg,wj as O1,xe as KH,xf as yg,xi as S1,xj as yP,yd as qH,yf as vg,yj as H1,zd as FH,zf as o1}from"./chunk-VEBW7NKD.js";import"./chunk-W45RKGM6.js";import{a as dD,b as lD,c as uD,d as pD,e as mD,f as fD,g as Jr,h as hD,j as Og,k as gD}from"./chunk-AUO5DCEU.js";import{a as qu}from"./chunk-Y4I6CFZJ.js";import{t as pO}from"./chunk-4BUM6JEC.js";import{b as iO,c as sO,f as cO,g as dO,h as lO}from"./chunk-UGFSAG4U.js";import{a as aO,b as Fh}from"./chunk-SSHE6B7Z.js";import{a as jne}from"./chunk-JFXINDOQ.js";import"./chunk-EDYCSW22.js";import{b as ug,c as PH,e as RH,f as Uu,g as dP,k as lP,l as xH,m as _H}from"./chunk-JT5YQ52I.js";import"./chunk-XGY4OQLC.js";import{d as hH,h as gH,i as wH}from"./chunk-PAYFJHPO.js";import{d as hd,e as Nu,f as QO,g as ZO,h as eH,j as sP,l as cP}from"./chunk-WD4KAKEX.js";import{$ as SO,G as yO,H as vO,J as GS,L as IO,R as bO,S as fi,U as kO,Y as Wh,Z as Vh,_ as Gh,aa as JS,ba as XS,ca as QS,da as eg,ea as ZS,fa as eP,ga as tP,ia as rP,ja as nP,ka as oP,la as aP,u as wO}from"./chunk-2PXKSAG6.js";import"./chunk-ULTV6INR.js";import{A as Xh,C as Qh,D as Zh,E as ya,a as PO,b as RO,c as Jh,f as Kh,h as KS,i as YS,k as $u,m as xO,o as _O,p as EO,r as Yh,s as TO,u as CO}from"./chunk-WGQ3FMRF.js";import"./chunk-JXLDEYRW.js";import{i as kH,m as SH}from"./chunk-JVMSN7LH.js";import{a as lH,f as uH,g as nr,r as gd,t as pH,u as mH,v as lg,w as fH,z as wd}from"./chunk-YI6ME6PU.js";import{b as Es,d as IH,f as bH}from"./chunk-DRLP7GIU.js";import{Ba as ag,C as NO,Ca as ln,Da as XO,F as fd,Fa as ig,H as UO,Ia as gi,J as qO,L as FO,N as zO,O as WO,W as VO,aa as hi,ba as GO,c as AO,ga as JO,ha as KO,i as MO,ja as mt,l as jO,m as OO,n as HO,o as DO,oa as ng,p as LO,q as tg,r as iP,s as BO,t as $O,u as rg,wa as jo,xa as YO,za as og}from"./chunk-BU6MW65V.js";import"./chunk-LVXL7T5O.js";import{f as zS,m as md}from"./chunk-HIQPGYVH.js";import{E as fO,K as Bu,M as hO,N as zh,Q as gO,U as VS,V as Et,b as Lu,c as WS,i as uO,j as me,l as Xe,x as dn,y as mO}from"./chunk-DXJC3QW7.js";import"./chunk-P4QM63L3.js";import"./chunk-MTP3B2SU.js";import"./chunk-7EQLW2KM.js";import{a as tO,b as nO}from"./chunk-UN2LKLGV.js";import"./chunk-2LJCJOJ7.js";import"./chunk-AMC4Z7G4.js";import{b as rO,e as oO}from"./chunk-LK77GI6M.js";import{k as RS}from"./chunk-HVM2GUM3.js";import"./chunk-I6VMRQF4.js";import{Ba as Wj,Ua as Vj,Wa as Uh,ba as jj,bb as NS,d as Tj,db as Gj,f as $h,fb as Jj,gb as qh,hb as Kj,l as Cj,lb as Yj,m as Aj,ob as Xj,pa as Oj,sb as US,ub as qS,va as zj,wb as Qj,x as Mj,xb as Zj,yb as eO,zb as FS}from"./chunk-D6L6UNUQ.js";import"./chunk-AJXWJLZA.js";import{A as Lj,E as Bj,F as $j,G as Nh,H as Nj,I as Uj,J as qj,N as Fj,h as Hj,z as Dj}from"./chunk-OKKNDQJF.js";import{Cb as ud,Db as wa,Eb as pd,F as wj,Jb as Rj,L as Ve,Lb as xj,M as _t,O as yj,Q as vj,Qb as _j,S as Mo,Ta as Bh,Xb as Ej,ba as Ij,d as mj,da as bj,g as fj,i as hj,j as gj,ob as kj,pb as mi,qb as It,rb as Sj,ub as Pj}from"./chunk-4PUOWSDE.js";import{$a as Dh,A as Oh,Aa as He,B as TS,C as xs,Cb as lj,D as _s,Db as uj,Eb as pj,F as YM,Fb as Lh,H as XM,I as QM,Ja as tj,La as rj,M as CS,N as AS,O as MS,Oa as nj,P as jS,Q as OS,R as HS,Ra as oj,S as DS,Sa as aj,T as LS,Wa as ij,a as GM,bb as $S,fb as sj,ga as ZM,hb as cj,kb as dj,n as KM,o as Ch,p as Ah,q as Mh,qa as Hh,r as jh,ra as ej,v as pi,va as BS}from"./chunk-ZY32SZ2P.js";import{q as zM,r as ld,s as Th}from"./chunk-OTDDXEQ6.js";import"./chunk-ECOH24MC.js";import{c as F0}from"./chunk-4N4EH3RJ.js";import"./chunk-GY7YSD6J.js";import{a as IM,b as bM,c as En,d as Ph,e as Rs,f as Hu,g as kS,h as Rh,i as kM,k as Eh,n as FM}from"./chunk-KUE46HTH.js";import{d as U0,e as q0,g as vM}from"./chunk-JCLTFDVW.js";import{a as Ou}from"./chunk-6FA3GG5B.js";import{C as sM,D as cM,I as uM,K as yS,L as vS,M as pM,S as IS,U as mM,V as bS,Z as fM,_ as hM,ca as gM,da as wM,f as Mu,fa as Ps,ga as yM,ha as Sh,v as cd,x as ju}from"./chunk-SV7ZBEK2.js";import{M as sd,O as nM,Q as oM,R as aM,S as iM,a as Ss,b as J0,c as Gr,d as _n,e as K0,f as yh,g as Y0,h as X0,i as vh,j as Ih,l as Q0,m as Z0,n as eM,o as tM,p as rM,z as wS}from"./chunk-2MEOUS24.js";import{b as G0,d as wh,e as Xn,f as Ft}from"./chunk-HNQPEOJD.js";import{g as hh,h as gS,i as V0,l as ot,m as Ee,n as T,o as gh}from"./chunk-RCT3O3HQ.js";import{a as z0,c as ks,f as fh,h as Au,i as W0,m as bh,p as dM,r as ha,s as lM,t as ga,u as kh}from"./chunk-UGOK7VTC.js";import"./chunk-ZFJWA4JK.js";import{A as v,d as Re}from"./chunk-X2J2P5ZT.js";import{a as i,b as qe,c as Be,e as xn}from"./chunk-FTQLQJQV.js";var _a=Be((L0e,VF)=>{"use strict";var zF=["nodebuffer","arraybuffer","fragments"],WF=typeof Blob<"u";WF&&zF.push("blob");VF.exports={BINARY_TYPES:zF,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:WF,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:i(()=>{},"NOOP")}});var qp=Be(($0e,wy)=>{"use strict";var{EMPTY_BUFFER:Uoe}=_a(),BR=Buffer[Symbol.species];function qoe(e,t){if(e.length===0)return Uoe;if(e.length===1)return e[0];let r=Buffer.allocUnsafe(t),n=0;for(let o=0;o<e.length;o++){let a=e[o];r.set(a,n),n+=a.length}return n<t?new BR(r.buffer,r.byteOffset,n):r}i(qoe,"concat");function GF(e,t,r,n,o){for(let a=0;a<o;a++)r[n+a]=e[a]^t[a&3]}i(GF,"_mask");function JF(e,t){for(let r=0;r<e.length;r++)e[r]^=t[r&3]}i(JF,"_unmask");function Foe(e){return e.length===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.length)}i(Foe,"toArrayBuffer");function $R(e){if($R.readOnly=!0,Buffer.isBuffer(e))return e;let t;return e instanceof ArrayBuffer?t=new BR(e):ArrayBuffer.isView(e)?t=new BR(e.buffer,e.byteOffset,e.byteLength):(t=Buffer.from(e),$R.readOnly=!1),t}i($R,"toBuffer");wy.exports={concat:qoe,mask:GF,toArrayBuffer:Foe,toBuffer:$R,unmask:JF};if(!process.env.WS_NO_BUFFER_UTIL)try{let e=qe("bufferutil");wy.exports.mask=function(t,r,n,o,a){a<48?GF(t,r,n,o,a):e.mask(t,r,n,o,a)},wy.exports.unmask=function(t,r){t.length<32?JF(t,r):e.unmask(t,r)}}catch{}});var XF=Be((U0e,YF)=>{"use strict";var KF=Symbol("kDone"),NR=Symbol("kRun"),UR=class{static{i(this,"Limiter")}constructor(t){this[KF]=()=>{this.pending--,this[NR]()},this.concurrency=t||1/0,this.jobs=[],this.pending=0}add(t){this.jobs.push(t),this[NR]()}[NR](){if(this.pending!==this.concurrency&&this.jobs.length){let t=this.jobs.shift();this.pending++,t(this[KF])}}};YF.exports=UR});var Kd=Be((F0e,tz)=>{"use strict";var Fp=qe("zlib"),QF=qp(),zoe=XF(),{kStatusCode:ZF}=_a(),Woe=Buffer[Symbol.species],Voe=Buffer.from([0,0,255,255]),vy=Symbol("permessage-deflate"),Ea=Symbol("total-length"),Gd=Symbol("callback"),ji=Symbol("buffers"),Jd=Symbol("error"),yy,qR=class{static{i(this,"PerMessageDeflate")}constructor(t){if(this._options=t||{},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,!yy){let r=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;yy=new zoe(r)}}static get extensionName(){return"permessage-deflate"}offer(){let t={};return this._options.serverNoContextTakeover&&(t.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(t.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(t.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?t.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits==null&&(t.client_max_window_bits=!0),t}accept(t){return t=this.normalizeParams(t),this.params=this._isServer?this.acceptAsServer(t):this.acceptAsClient(t),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){let t=this._deflate[Gd];this._deflate.close(),this._deflate=null,t&&t(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(t){let r=this._options,n=t.find(o=>!(r.serverNoContextTakeover===!1&&o.server_no_context_takeover||o.server_max_window_bits&&(r.serverMaxWindowBits===!1||typeof r.serverMaxWindowBits=="number"&&r.serverMaxWindowBits>o.server_max_window_bits)||typeof r.clientMaxWindowBits=="number"&&!o.client_max_window_bits));if(!n)throw new Error("None of the extension offers can be accepted");return r.serverNoContextTakeover&&(n.server_no_context_takeover=!0),r.clientNoContextTakeover&&(n.client_no_context_takeover=!0),typeof r.serverMaxWindowBits=="number"&&(n.server_max_window_bits=r.serverMaxWindowBits),typeof r.clientMaxWindowBits=="number"?n.client_max_window_bits=r.clientMaxWindowBits:(n.client_max_window_bits===!0||r.clientMaxWindowBits===!1)&&delete n.client_max_window_bits,n}acceptAsClient(t){let r=t[0];if(this._options.clientNoContextTakeover===!1&&r.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(!r.client_max_window_bits)typeof this._options.clientMaxWindowBits=="number"&&(r.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits=="number"&&r.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"');return r}normalizeParams(t){return t.forEach(r=>{Object.keys(r).forEach(n=>{let o=r[n];if(o.length>1)throw new Error(`Parameter "${n}" must have only a single value`);if(o=o[0],n==="client_max_window_bits"){if(o!==!0){let a=+o;if(!Number.isInteger(a)||a<8||a>15)throw new TypeError(`Invalid value for parameter "${n}": ${o}`);o=a}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${n}": ${o}`)}else if(n==="server_max_window_bits"){let a=+o;if(!Number.isInteger(a)||a<8||a>15)throw new TypeError(`Invalid value for parameter "${n}": ${o}`);o=a}else if(n==="client_no_context_takeover"||n==="server_no_context_takeover"){if(o!==!0)throw new TypeError(`Invalid value for parameter "${n}": ${o}`)}else throw new Error(`Unknown parameter "${n}"`);r[n]=o})}),t}decompress(t,r,n){yy.add(o=>{this._decompress(t,r,(a,s)=>{o(),n(a,s)})})}compress(t,r,n){yy.add(o=>{this._compress(t,r,(a,s)=>{o(),n(a,s)})})}_decompress(t,r,n){let o=this._isServer?"client":"server";if(!this._inflate){let a=`${o}_max_window_bits`,s=typeof this.params[a]!="number"?Fp.Z_DEFAULT_WINDOWBITS:this.params[a];this._inflate=Fp.createInflateRaw({...this._options.zlibInflateOptions,windowBits:s}),this._inflate[vy]=this,this._inflate[Ea]=0,this._inflate[ji]=[],this._inflate.on("error",Joe),this._inflate.on("data",ez)}this._inflate[Gd]=n,this._inflate.write(t),r&&this._inflate.write(Voe),this._inflate.flush(()=>{let a=this._inflate[Jd];if(a){this._inflate.close(),this._inflate=null,n(a);return}let s=QF.concat(this._inflate[ji],this._inflate[Ea]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[Ea]=0,this._inflate[ji]=[],r&&this.params[`${o}_no_context_takeover`]&&this._inflate.reset()),n(null,s)})}_compress(t,r,n){let o=this._isServer?"server":"client";if(!this._deflate){let a=`${o}_max_window_bits`,s=typeof this.params[a]!="number"?Fp.Z_DEFAULT_WINDOWBITS:this.params[a];this._deflate=Fp.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:s}),this._deflate[Ea]=0,this._deflate[ji]=[],this._deflate.on("data",Goe)}this._deflate[Gd]=n,this._deflate.write(t),this._deflate.flush(Fp.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let a=QF.concat(this._deflate[ji],this._deflate[Ea]);r&&(a=new Woe(a.buffer,a.byteOffset,a.length-4)),this._deflate[Gd]=null,this._deflate[Ea]=0,this._deflate[ji]=[],r&&this.params[`${o}_no_context_takeover`]&&this._deflate.reset(),n(null,a)})}};tz.exports=qR;function Goe(e){this[ji].push(e),this[Ea]+=e.length}i(Goe,"deflateOnData");function ez(e){if(this[Ea]+=e.length,this[vy]._maxPayload<1||this[Ea]<=this[vy]._maxPayload){this[ji].push(e);return}this[Jd]=new RangeError("Max payload size exceeded"),this[Jd].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[Jd][ZF]=1009,this.removeListener("data",ez),this.reset()}i(ez,"inflateOnData");function Joe(e){if(this[vy]._inflate=null,this[Jd]){this[Gd](this[Jd]);return}e[ZF]=1007,this[Gd](e)}i(Joe,"inflateOnError")});var Yd=Be((W0e,Iy)=>{"use strict";var{isUtf8:rz}=qe("buffer"),{hasBlob:Koe}=_a(),Yoe=[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 Xoe(e){return e>=1e3&&e<=1014&&e!==1004&&e!==1005&&e!==1006||e>=3e3&&e<=4999}i(Xoe,"isValidStatusCode");function FR(e){let t=e.length,r=0;for(;r<t;)if((e[r]&128)===0)r++;else if((e[r]&224)===192){if(r+1===t||(e[r+1]&192)!==128||(e[r]&254)===192)return!1;r+=2}else if((e[r]&240)===224){if(r+2>=t||(e[r+1]&192)!==128||(e[r+2]&192)!==128||e[r]===224&&(e[r+1]&224)===128||e[r]===237&&(e[r+1]&224)===160)return!1;r+=3}else if((e[r]&248)===240){if(r+3>=t||(e[r+1]&192)!==128||(e[r+2]&192)!==128||(e[r+3]&192)!==128||e[r]===240&&(e[r+1]&240)===128||e[r]===244&&e[r+1]>143||e[r]>244)return!1;r+=4}else return!1;return!0}i(FR,"_isValidUTF8");function Qoe(e){return Koe&&typeof e=="object"&&typeof e.arrayBuffer=="function"&&typeof e.type=="string"&&typeof e.stream=="function"&&(e[Symbol.toStringTag]==="Blob"||e[Symbol.toStringTag]==="File")}i(Qoe,"isBlob");Iy.exports={isBlob:Qoe,isValidStatusCode:Xoe,isValidUTF8:FR,tokenChars:Yoe};if(rz)Iy.exports.isValidUTF8=function(e){return e.length<24?FR(e):rz(e)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let e=qe("utf-8-validate");Iy.exports.isValidUTF8=function(t){return t.length<32?FR(t):e(t)}}catch{}});var JR=Be((G0e,dz)=>{"use strict";var{Writable:Zoe}=qe("stream"),nz=Kd(),{BINARY_TYPES:eae,EMPTY_BUFFER:oz,kStatusCode:tae,kWebSocket:rae}=_a(),{concat:zR,toArrayBuffer:nae,unmask:oae}=qp(),{isValidStatusCode:aae,isValidUTF8:az}=Yd(),by=Buffer[Symbol.species],Mn=0,iz=1,sz=2,cz=3,WR=4,VR=5,ky=6,GR=class extends Zoe{static{i(this,"Receiver")}constructor(t={}){super(),this._allowSynchronousEvents=t.allowSynchronousEvents!==void 0?t.allowSynchronousEvents:!0,this._binaryType=t.binaryType||eae[0],this._extensions=t.extensions||{},this._isServer=!!t.isServer,this._maxBufferedChunks=t.maxBufferedChunks|0,this._maxFragments=t.maxFragments|0,this._maxPayload=t.maxPayload|0,this._skipUTF8Validation=!!t.skipUTF8Validation,this[rae]=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._numFragments=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=Mn}_write(t,r,n){if(this._opcode===8&&this._state==Mn)return n();if(this._maxBufferedChunks>0&&this._buffers.length>=this._maxBufferedChunks){n(this.createError(RangeError,"Too many buffered chunks",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS"));return}this._bufferedBytes+=t.length,this._buffers.push(t),this.startLoop(n)}consume(t){if(this._bufferedBytes-=t,t===this._buffers[0].length)return this._buffers.shift();if(t<this._buffers[0].length){let n=this._buffers[0];return this._buffers[0]=new by(n.buffer,n.byteOffset+t,n.length-t),new by(n.buffer,n.byteOffset,t)}let r=Buffer.allocUnsafe(t);do{let n=this._buffers[0],o=r.length-t;t>=n.length?r.set(this._buffers.shift(),o):(r.set(new Uint8Array(n.buffer,n.byteOffset,t),o),this._buffers[0]=new by(n.buffer,n.byteOffset+t,n.length-t)),t-=n.length}while(t>0);return r}startLoop(t){this._loop=!0;do switch(this._state){case Mn:this.getInfo(t);break;case iz:this.getPayloadLength16(t);break;case sz:this.getPayloadLength64(t);break;case cz:this.getMask();break;case WR:this.getData(t);break;case VR:case ky:this._loop=!1;return}while(this._loop);this._errored||t()}getInfo(t){if(this._bufferedBytes<2){this._loop=!1;return}let r=this.consume(2);if((r[0]&48)!==0){let o=this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");t(o);return}let n=(r[0]&64)===64;if(n&&!this._extensions[nz.extensionName]){let o=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");t(o);return}if(this._fin=(r[0]&128)===128,this._opcode=r[0]&15,this._payloadLength=r[1]&127,this._opcode===0){if(n){let o=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");t(o);return}if(!this._fragmented){let o=this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");t(o);return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){let o=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");t(o);return}this._compressed=n}else if(this._opcode>7&&this._opcode<11){if(!this._fin){let o=this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");t(o);return}if(n){let o=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");t(o);return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){let o=this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");t(o);return}}else{let o=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");t(o);return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(r[1]&128)===128,this._isServer){if(!this._masked){let o=this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK");t(o);return}}else if(this._masked){let o=this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");t(o);return}this._payloadLength===126?this._state=iz:this._payloadLength===127?this._state=sz:this.haveLength(t)}getPayloadLength16(t){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(t)}getPayloadLength64(t){if(this._bufferedBytes<8){this._loop=!1;return}let r=this.consume(8),n=r.readUInt32BE(0);if(n>Math.pow(2,21)-1){let o=this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");t(o);return}this._payloadLength=n*Math.pow(2,32)+r.readUInt32BE(4),this.haveLength(t)}haveLength(t){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)){let r=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");t(r);return}this._masked?this._state=cz:this._state=WR}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=WR}getData(t){let r=oz;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}r=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0&&oae(r,this._mask)}if(this._opcode>7){this.controlMessage(r,t);return}if(this._maxFragments>0&&++this._numFragments>this._maxFragments){let n=this.createError(RangeError,"Too many message fragments",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS");t(n);return}if(this._compressed){this._state=VR,this.decompress(r,t);return}r.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(r)),this.dataMessage(t)}decompress(t,r){this._extensions[nz.extensionName].decompress(t,this._fin,(o,a)=>{if(o)return r(o);if(a.length){if(this._messageLength+=a.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let s=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");r(s);return}this._fragments.push(a)}this.dataMessage(r),this._state===Mn&&this.startLoop(r)})}dataMessage(t){if(!this._fin){this._state=Mn;return}let r=this._messageLength,n=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._numFragments=0,this._fragments=[],this._opcode===2){let o;this._binaryType==="nodebuffer"?o=zR(n,r):this._binaryType==="arraybuffer"?o=nae(zR(n,r)):this._binaryType==="blob"?o=new Blob(n):o=n,this._allowSynchronousEvents?(this.emit("message",o,!0),this._state=Mn):(this._state=ky,setImmediate(()=>{this.emit("message",o,!0),this._state=Mn,this.startLoop(t)}))}else{let o=zR(n,r);if(!this._skipUTF8Validation&&!az(o)){let a=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");t(a);return}this._state===VR||this._allowSynchronousEvents?(this.emit("message",o,!1),this._state=Mn):(this._state=ky,setImmediate(()=>{this.emit("message",o,!1),this._state=Mn,this.startLoop(t)}))}}controlMessage(t,r){if(this._opcode===8){if(t.length===0)this._loop=!1,this.emit("conclude",1005,oz),this.end();else{let n=t.readUInt16BE(0);if(!aae(n)){let a=this.createError(RangeError,`invalid status code ${n}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");r(a);return}let o=new by(t.buffer,t.byteOffset+2,t.length-2);if(!this._skipUTF8Validation&&!az(o)){let a=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");r(a);return}this._loop=!1,this.emit("conclude",n,o),this.end()}this._state=Mn;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?"ping":"pong",t),this._state=Mn):(this._state=ky,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",t),this._state=Mn,this.startLoop(r)}))}createError(t,r,n,o,a){this._loop=!1,this._errored=!0;let s=new t(n?`Invalid WebSocket frame: ${r}`:r);return Error.captureStackTrace(s,this.createError),s.code=a,s[tae]=o,s}};dz.exports=GR});var XR=Be((Y0e,pz)=>{"use strict";var{Duplex:K0e}=qe("stream"),{randomFillSync:iae}=qe("crypto"),{types:{isUint8Array:sae}}=qe("util"),lz=Kd(),{EMPTY_BUFFER:cae,kWebSocket:dae,NOOP:lae}=_a(),{isBlob:Xd,isValidStatusCode:uae}=Yd(),{mask:uz,toBuffer:zs}=qp(),jn=Symbol("kByteLength"),pae=Buffer.alloc(4),Sy=8*1024,Ws,Qd=Sy,ao=0,mae=1,fae=2,KR=class e{static{i(this,"Sender")}constructor(t,r,n){this._extensions=r||{},n&&(this._generateMask=n,this._maskBuffer=Buffer.alloc(4)),this._socket=t,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=ao,this.onerror=lae,this[dae]=void 0}static frame(t,r){let n,o=!1,a=2,s=!1;r.mask&&(n=r.maskBuffer||pae,r.generateMask?r.generateMask(n):(Qd===Sy&&(Ws===void 0&&(Ws=Buffer.alloc(Sy)),iae(Ws,0,Sy),Qd=0),n[0]=Ws[Qd++],n[1]=Ws[Qd++],n[2]=Ws[Qd++],n[3]=Ws[Qd++]),s=(n[0]|n[1]|n[2]|n[3])===0,a=6);let c;typeof t=="string"?(!r.mask||s)&&r[jn]!==void 0?c=r[jn]:(t=Buffer.from(t),c=t.length):(c=t.length,o=r.mask&&r.readOnly&&!s);let d=c;c>=65536?(a+=8,d=127):c>125&&(a+=2,d=126);let l=Buffer.allocUnsafe(o?c+a:a);return l[0]=r.fin?r.opcode|128:r.opcode,r.rsv1&&(l[0]|=64),l[1]=d,d===126?l.writeUInt16BE(c,2):d===127&&(l[2]=l[3]=0,l.writeUIntBE(c,4,6)),r.mask?(l[1]|=128,l[a-4]=n[0],l[a-3]=n[1],l[a-2]=n[2],l[a-1]=n[3],s?[l,t]:o?(uz(t,n,l,a,c),[l]):(uz(t,n,t,0,c),[l,t])):[l,t]}close(t,r,n,o){let a;if(t===void 0)a=cae;else{if(typeof t!="number"||!uae(t))throw new TypeError("First argument must be a valid error code number");if(r===void 0||!r.length)a=Buffer.allocUnsafe(2),a.writeUInt16BE(t,0);else{let c=Buffer.byteLength(r);if(c>123)throw new RangeError("The message must not be greater than 123 bytes");if(a=Buffer.allocUnsafe(2+c),a.writeUInt16BE(t,0),typeof r=="string")a.write(r,2);else if(sae(r))a.set(r,2);else throw new TypeError("Second argument must be a string or a Uint8Array")}}let s={[jn]:a.length,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state!==ao?this.enqueue([this.dispatch,a,!1,s,o]):this.sendFrame(e.frame(a,s),o)}ping(t,r,n){let o,a;if(typeof t=="string"?(o=Buffer.byteLength(t),a=!1):Xd(t)?(o=t.size,a=!1):(t=zs(t),o=t.length,a=zs.readOnly),o>125)throw new RangeError("The data size must not be greater than 125 bytes");let s={[jn]:o,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:9,readOnly:a,rsv1:!1};Xd(t)?this._state!==ao?this.enqueue([this.getBlobData,t,!1,s,n]):this.getBlobData(t,!1,s,n):this._state!==ao?this.enqueue([this.dispatch,t,!1,s,n]):this.sendFrame(e.frame(t,s),n)}pong(t,r,n){let o,a;if(typeof t=="string"?(o=Buffer.byteLength(t),a=!1):Xd(t)?(o=t.size,a=!1):(t=zs(t),o=t.length,a=zs.readOnly),o>125)throw new RangeError("The data size must not be greater than 125 bytes");let s={[jn]:o,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:10,readOnly:a,rsv1:!1};Xd(t)?this._state!==ao?this.enqueue([this.getBlobData,t,!1,s,n]):this.getBlobData(t,!1,s,n):this._state!==ao?this.enqueue([this.dispatch,t,!1,s,n]):this.sendFrame(e.frame(t,s),n)}send(t,r,n){let o=this._extensions[lz.extensionName],a=r.binary?2:1,s=r.compress,c,d;typeof t=="string"?(c=Buffer.byteLength(t),d=!1):Xd(t)?(c=t.size,d=!1):(t=zs(t),c=t.length,d=zs.readOnly),this._firstFragment?(this._firstFragment=!1,s&&o&&o.params[o._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(s=c>=o._threshold),this._compress=s):(s=!1,a=0),r.fin&&(this._firstFragment=!0);let l={[jn]:c,fin:r.fin,generateMask:this._generateMask,mask:r.mask,maskBuffer:this._maskBuffer,opcode:a,readOnly:d,rsv1:s};Xd(t)?this._state!==ao?this.enqueue([this.getBlobData,t,this._compress,l,n]):this.getBlobData(t,this._compress,l,n):this._state!==ao?this.enqueue([this.dispatch,t,this._compress,l,n]):this.dispatch(t,this._compress,l,n)}getBlobData(t,r,n,o){this._bufferedBytes+=n[jn],this._state=fae,t.arrayBuffer().then(a=>{if(this._socket.destroyed){let c=new Error("The socket was closed while the blob was being read");process.nextTick(YR,this,c,o);return}this._bufferedBytes-=n[jn];let s=zs(a);r?this.dispatch(s,r,n,o):(this._state=ao,this.sendFrame(e.frame(s,n),o),this.dequeue())}).catch(a=>{process.nextTick(hae,this,a,o)})}dispatch(t,r,n,o){if(!r){this.sendFrame(e.frame(t,n),o);return}let a=this._extensions[lz.extensionName];this._bufferedBytes+=n[jn],this._state=mae,a.compress(t,n.fin,(s,c)=>{if(this._socket.destroyed){let d=new Error("The socket was closed while data was being compressed");YR(this,d,o);return}this._bufferedBytes-=n[jn],this._state=ao,n.readOnly=!1,this.sendFrame(e.frame(c,n),o),this.dequeue()})}dequeue(){for(;this._state===ao&&this._queue.length;){let t=this._queue.shift();this._bufferedBytes-=t[3][jn],Reflect.apply(t[0],this,t.slice(1))}}enqueue(t){this._bufferedBytes+=t[3][jn],this._queue.push(t)}sendFrame(t,r){t.length===2?(this._socket.cork(),this._socket.write(t[0]),this._socket.write(t[1],r),this._socket.uncork()):this._socket.write(t[0],r)}};pz.exports=KR;function YR(e,t,r){typeof r=="function"&&r(t);for(let n=0;n<e._queue.length;n++){let o=e._queue[n],a=o[o.length-1];typeof a=="function"&&a(t)}}i(YR,"callCallbacks");function hae(e,t,r){YR(e,t,r),e.onerror(t)}i(hae,"onError")});var bz=Be((Q0e,Iz)=>{"use strict";var{kForOnEventAttribute:zp,kListener:QR}=_a(),mz=Symbol("kCode"),fz=Symbol("kData"),hz=Symbol("kError"),gz=Symbol("kMessage"),wz=Symbol("kReason"),Zd=Symbol("kTarget"),yz=Symbol("kType"),vz=Symbol("kWasClean"),Ta=class{static{i(this,"Event")}constructor(t){this[Zd]=null,this[yz]=t}get target(){return this[Zd]}get type(){return this[yz]}};Object.defineProperty(Ta.prototype,"target",{enumerable:!0});Object.defineProperty(Ta.prototype,"type",{enumerable:!0});var Vs=class extends Ta{static{i(this,"CloseEvent")}constructor(t,r={}){super(t),this[mz]=r.code===void 0?0:r.code,this[wz]=r.reason===void 0?"":r.reason,this[vz]=r.wasClean===void 0?!1:r.wasClean}get code(){return this[mz]}get reason(){return this[wz]}get wasClean(){return this[vz]}};Object.defineProperty(Vs.prototype,"code",{enumerable:!0});Object.defineProperty(Vs.prototype,"reason",{enumerable:!0});Object.defineProperty(Vs.prototype,"wasClean",{enumerable:!0});var el=class extends Ta{static{i(this,"ErrorEvent")}constructor(t,r={}){super(t),this[hz]=r.error===void 0?null:r.error,this[gz]=r.message===void 0?"":r.message}get error(){return this[hz]}get message(){return this[gz]}};Object.defineProperty(el.prototype,"error",{enumerable:!0});Object.defineProperty(el.prototype,"message",{enumerable:!0});var Wp=class extends Ta{static{i(this,"MessageEvent")}constructor(t,r={}){super(t),this[fz]=r.data===void 0?null:r.data}get data(){return this[fz]}};Object.defineProperty(Wp.prototype,"data",{enumerable:!0});var gae={addEventListener(e,t,r={}){for(let o of this.listeners(e))if(!r[zp]&&o[QR]===t&&!o[zp])return;let n;if(e==="message")n=i(function(a,s){let c=new Wp("message",{data:s?a:a.toString()});c[Zd]=this,Py(t,this,c)},"onMessage");else if(e==="close")n=i(function(a,s){let c=new Vs("close",{code:a,reason:s.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});c[Zd]=this,Py(t,this,c)},"onClose");else if(e==="error")n=i(function(a){let s=new el("error",{error:a,message:a.message});s[Zd]=this,Py(t,this,s)},"onError");else if(e==="open")n=i(function(){let a=new Ta("open");a[Zd]=this,Py(t,this,a)},"onOpen");else return;n[zp]=!!r[zp],n[QR]=t,r.once?this.once(e,n):this.on(e,n)},removeEventListener(e,t){for(let r of this.listeners(e))if(r[QR]===t&&!r[zp]){this.removeListener(e,r);break}}};Iz.exports={CloseEvent:Vs,ErrorEvent:el,Event:Ta,EventTarget:gae,MessageEvent:Wp};function Py(e,t,r){typeof e=="object"&&e.handleEvent?e.handleEvent.call(e,r):e.call(t,r)}i(Py,"callListener")});var Ry=Be((eMe,kz)=>{"use strict";var{tokenChars:Vp}=Yd();function zo(e,t,r){e[t]===void 0?e[t]=[r]:e[t].push(r)}i(zo,"push");function wae(e){let t=Object.create(null),r=Object.create(null),n=!1,o=!1,a=!1,s,c,d=-1,l=-1,u=-1,p=0;for(;p<e.length;p++)if(l=e.charCodeAt(p),s===void 0)if(u===-1&&Vp[l]===1)d===-1&&(d=p);else if(p!==0&&(l===32||l===9))u===-1&&d!==-1&&(u=p);else if(l===59||l===44){if(d===-1)throw new SyntaxError(`Unexpected character at index ${p}`);u===-1&&(u=p);let g=e.slice(d,u);l===44?(zo(t,g,r),r=Object.create(null)):s=g,d=u=-1}else throw new SyntaxError(`Unexpected character at index ${p}`);else if(c===void 0)if(u===-1&&Vp[l]===1)d===-1&&(d=p);else if(l===32||l===9)u===-1&&d!==-1&&(u=p);else if(l===59||l===44){if(d===-1)throw new SyntaxError(`Unexpected character at index ${p}`);u===-1&&(u=p),zo(r,e.slice(d,u),!0),l===44&&(zo(t,s,r),r=Object.create(null),s=void 0),d=u=-1}else if(l===61&&d!==-1&&u===-1)c=e.slice(d,p),d=u=-1;else throw new SyntaxError(`Unexpected character at index ${p}`);else if(o){if(Vp[l]!==1)throw new SyntaxError(`Unexpected character at index ${p}`);d===-1?d=p:n||(n=!0),o=!1}else if(a)if(Vp[l]===1)d===-1&&(d=p);else if(l===34&&d!==-1)a=!1,u=p;else if(l===92)o=!0;else throw new SyntaxError(`Unexpected character at index ${p}`);else if(l===34&&e.charCodeAt(p-1)===61)a=!0;else if(u===-1&&Vp[l]===1)d===-1&&(d=p);else if(d!==-1&&(l===32||l===9))u===-1&&(u=p);else if(l===59||l===44){if(d===-1)throw new SyntaxError(`Unexpected character at index ${p}`);u===-1&&(u=p);let g=e.slice(d,u);n&&(g=g.replace(/\\/g,""),n=!1),zo(r,c,g),l===44&&(zo(t,s,r),r=Object.create(null),s=void 0),c=void 0,d=u=-1}else throw new SyntaxError(`Unexpected character at index ${p}`);if(d===-1||a||l===32||l===9)throw new SyntaxError("Unexpected end of input");u===-1&&(u=p);let m=e.slice(d,u);return s===void 0?zo(t,m,r):(c===void 0?zo(r,m,!0):n?zo(r,c,m.replace(/\\/g,"")):zo(r,c,m),zo(t,s,r)),t}i(wae,"parse");function yae(e){return Object.keys(e).map(t=>{let r=e[t];return Array.isArray(r)||(r=[r]),r.map(n=>[t].concat(Object.keys(n).map(o=>{let a=n[o];return Array.isArray(a)||(a=[a]),a.map(s=>s===!0?o:`${o}=${s}`).join("; ")})).join("; ")).join(", ")}).join(", ")}i(yae,"format");kz.exports={format:yae,parse:wae}});var Ty=Be((oMe,Oz)=>{"use strict";var vae=qe("events"),Iae=qe("https"),bae=qe("http"),Rz=qe("net"),kae=qe("tls"),{randomBytes:Sae,createHash:Pae}=qe("crypto"),{Duplex:rMe,Readable:nMe}=qe("stream"),{URL:ZR}=qe("url"),Oi=Kd(),Rae=JR(),xae=XR(),{isBlob:_ae}=Yd(),{BINARY_TYPES:Sz,CLOSE_TIMEOUT:Eae,EMPTY_BUFFER:xy,GUID:Tae,kForOnEventAttribute:ex,kListener:Cae,kStatusCode:Aae,kWebSocket:Vt,NOOP:xz}=_a(),{EventTarget:{addEventListener:Mae,removeEventListener:jae}}=bz(),{format:Oae,parse:Hae}=Ry(),{toBuffer:Dae}=qp(),_z=Symbol("kAborted"),tx=[8,13],Ca=["CONNECTING","OPEN","CLOSING","CLOSED"],Lae=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,yt=class e extends vae{static{i(this,"WebSocket")}constructor(t,r,n){super(),this._binaryType=Sz[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=xy,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol="",this._readyState=e.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,t!==null?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,r===void 0?r=[]:Array.isArray(r)||(typeof r=="object"&&r!==null?(n=r,r=[]):r=[r]),Ez(this,t,r,n)):(this._autoPong=n.autoPong,this._closeTimeout=n.closeTimeout,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(t){Sz.includes(t)&&(this._binaryType=t,this._receiver&&(this._receiver._binaryType=t))}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(t,r,n){let o=new Rae({allowSynchronousEvents:n.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxBufferedChunks:n.maxBufferedChunks,maxFragments:n.maxFragments,maxPayload:n.maxPayload,skipUTF8Validation:n.skipUTF8Validation}),a=new xae(t,this._extensions,n.generateMask);this._receiver=o,this._sender=a,this._socket=t,o[Vt]=this,a[Vt]=this,t[Vt]=this,o.on("conclude",Nae),o.on("drain",Uae),o.on("error",qae),o.on("message",Fae),o.on("ping",zae),o.on("pong",Wae),a.onerror=Vae,t.setTimeout&&t.setTimeout(0),t.setNoDelay&&t.setNoDelay(),r.length>0&&t.unshift(r),t.on("close",Az),t.on("data",Ey),t.on("end",Mz),t.on("error",jz),this._readyState=e.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=e.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[Oi.extensionName]&&this._extensions[Oi.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=e.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(t,r){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){pn(this,this._req,"WebSocket was closed before the connection was established");return}if(this.readyState===e.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=e.CLOSING,this._sender.close(t,r,!this._isServer,n=>{n||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),Cz(this)}}pause(){this.readyState===e.CONNECTING||this.readyState===e.CLOSED||(this._paused=!0,this._socket.pause())}ping(t,r,n){if(this.readyState===e.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof t=="function"?(n=t,t=r=void 0):typeof r=="function"&&(n=r,r=void 0),typeof t=="number"&&(t=t.toString()),this.readyState!==e.OPEN){rx(this,t,n);return}r===void 0&&(r=!this._isServer),this._sender.ping(t||xy,r,n)}pong(t,r,n){if(this.readyState===e.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof t=="function"?(n=t,t=r=void 0):typeof r=="function"&&(n=r,r=void 0),typeof t=="number"&&(t=t.toString()),this.readyState!==e.OPEN){rx(this,t,n);return}r===void 0&&(r=!this._isServer),this._sender.pong(t||xy,r,n)}resume(){this.readyState===e.CONNECTING||this.readyState===e.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(t,r,n){if(this.readyState===e.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof r=="function"&&(n=r,r={}),typeof t=="number"&&(t=t.toString()),this.readyState!==e.OPEN){rx(this,t,n);return}let o={binary:typeof t!="string",mask:!this._isServer,compress:!0,fin:!0,...r};this._extensions[Oi.extensionName]||(o.compress=!1),this._sender.send(t||xy,o,n)}terminate(){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){pn(this,this._req,"WebSocket was closed before the connection was established");return}this._socket&&(this._readyState=e.CLOSING,this._socket.destroy())}}};Object.defineProperty(yt,"CONNECTING",{enumerable:!0,value:Ca.indexOf("CONNECTING")});Object.defineProperty(yt.prototype,"CONNECTING",{enumerable:!0,value:Ca.indexOf("CONNECTING")});Object.defineProperty(yt,"OPEN",{enumerable:!0,value:Ca.indexOf("OPEN")});Object.defineProperty(yt.prototype,"OPEN",{enumerable:!0,value:Ca.indexOf("OPEN")});Object.defineProperty(yt,"CLOSING",{enumerable:!0,value:Ca.indexOf("CLOSING")});Object.defineProperty(yt.prototype,"CLOSING",{enumerable:!0,value:Ca.indexOf("CLOSING")});Object.defineProperty(yt,"CLOSED",{enumerable:!0,value:Ca.indexOf("CLOSED")});Object.defineProperty(yt.prototype,"CLOSED",{enumerable:!0,value:Ca.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(e=>{Object.defineProperty(yt.prototype,e,{enumerable:!0})});["open","error","close","message"].forEach(e=>{Object.defineProperty(yt.prototype,`on${e}`,{enumerable:!0,get(){for(let t of this.listeners(e))if(t[ex])return t[Cae];return null},set(t){for(let r of this.listeners(e))if(r[ex]){this.removeListener(e,r);break}typeof t=="function"&&this.addEventListener(e,t,{[ex]:!0})}})});yt.prototype.addEventListener=Mae;yt.prototype.removeEventListener=jae;Oz.exports=yt;function Ez(e,t,r,n){let o={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:Eae,protocolVersion:tx[1],maxBufferedChunks:262144,maxFragments:16384,maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...n,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(e._autoPong=o.autoPong,e._closeTimeout=o.closeTimeout,!tx.includes(o.protocolVersion))throw new RangeError(`Unsupported protocol version: ${o.protocolVersion} (supported versions: ${tx.join(", ")})`);let a;if(t instanceof ZR)a=t;else try{a=new ZR(t)}catch{throw new SyntaxError(`Invalid URL: ${t}`)}a.protocol==="http:"?a.protocol="ws:":a.protocol==="https:"&&(a.protocol="wss:"),e._url=a.href;let s=a.protocol==="wss:",c=a.protocol==="ws+unix:",d;if(a.protocol!=="ws:"&&!s&&!c?d=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:c&&!a.pathname?d="The URL's pathname is empty":a.hash&&(d="The URL contains a fragment identifier"),d){let h=new SyntaxError(d);if(e._redirects===0)throw h;_y(e,h);return}let l=s?443:80,u=Sae(16).toString("base64"),p=s?Iae.request:bae.request,m=new Set,g;if(o.createConnection=o.createConnection||(s?$ae:Bae),o.defaultPort=o.defaultPort||l,o.port=a.port||l,o.host=a.hostname.startsWith("[")?a.hostname.slice(1,-1):a.hostname,o.headers={...o.headers,"Sec-WebSocket-Version":o.protocolVersion,"Sec-WebSocket-Key":u,Connection:"Upgrade",Upgrade:"websocket"},o.path=a.pathname+a.search,o.timeout=o.handshakeTimeout,o.perMessageDeflate&&(g=new Oi({...o.perMessageDeflate,isServer:!1,maxPayload:o.maxPayload}),o.headers["Sec-WebSocket-Extensions"]=Oae({[Oi.extensionName]:g.offer()})),r.length){for(let h of r){if(typeof h!="string"||!Lae.test(h)||m.has(h))throw new SyntaxError("An invalid or duplicated subprotocol was specified");m.add(h)}o.headers["Sec-WebSocket-Protocol"]=r.join(",")}if(o.origin&&(o.protocolVersion<13?o.headers["Sec-WebSocket-Origin"]=o.origin:o.headers.Origin=o.origin),(a.username||a.password)&&(o.auth=`${a.username}:${a.password}`),c){let h=o.path.split(":");o.socketPath=h[0],o.path=h[1]}let w;if(o.followRedirects){if(e._redirects===0){e._originalIpc=c,e._originalSecure=s,e._originalHostOrSocketPath=c?o.socketPath:a.host;let h=n&&n.headers;if(n={...n,headers:{}},h)for(let[y,f]of Object.entries(h))n.headers[y.toLowerCase()]=f}else if(e.listenerCount("redirect")===0){let h=c?e._originalIpc?o.socketPath===e._originalHostOrSocketPath:!1:e._originalIpc?!1:a.host===e._originalHostOrSocketPath;(!h||e._originalSecure&&!s)&&(delete o.headers.authorization,delete o.headers.cookie,h||delete o.headers.host,o.auth=void 0)}o.auth&&!n.headers.authorization&&(n.headers.authorization="Basic "+Buffer.from(o.auth).toString("base64")),w=e._req=p(o),e._redirects&&e.emit("redirect",e.url,w)}else w=e._req=p(o);o.timeout&&w.on("timeout",()=>{pn(e,w,"Opening handshake has timed out")}),w.on("error",h=>{w===null||w[_z]||(w=e._req=null,_y(e,h))}),w.on("response",h=>{let y=h.headers.location,f=h.statusCode;if(y&&o.followRedirects&&f>=300&&f<400){if(++e._redirects>o.maxRedirects){pn(e,w,"Maximum redirects exceeded");return}w.abort();let S;try{S=new ZR(y,t)}catch{let I=new SyntaxError(`Invalid URL: ${y}`);_y(e,I);return}Ez(e,S,r,n)}else e.emit("unexpected-response",w,h)||pn(e,w,`Unexpected server response: ${h.statusCode}`)}),w.on("upgrade",(h,y,f)=>{if(e.emit("upgrade",h),e.readyState!==yt.CONNECTING)return;w=e._req=null;let S=h.headers.upgrade;if(S===void 0||S.toLowerCase()!=="websocket"){pn(e,y,"Invalid Upgrade header");return}let k=Pae("sha1").update(u+Tae).digest("base64");if(h.headers["sec-websocket-accept"]!==k){pn(e,y,"Invalid Sec-WebSocket-Accept header");return}let I=h.headers["sec-websocket-protocol"],b;if(I!==void 0?m.size?m.has(I)||(b="Server sent an invalid subprotocol"):b="Server sent a subprotocol but none was requested":m.size&&(b="Server sent no subprotocol"),b){pn(e,y,b);return}I&&(e._protocol=I);let R=h.headers["sec-websocket-extensions"];if(R!==void 0){if(!g){pn(e,y,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let _;try{_=Hae(R)}catch{pn(e,y,"Invalid Sec-WebSocket-Extensions header");return}let P=Object.keys(_);if(P.length!==1||P[0]!==Oi.extensionName){pn(e,y,"Server indicated an extension that was not requested");return}try{g.accept(_[Oi.extensionName])}catch{pn(e,y,"Invalid Sec-WebSocket-Extensions header");return}e._extensions[Oi.extensionName]=g}e.setSocket(y,f,{allowSynchronousEvents:o.allowSynchronousEvents,generateMask:o.generateMask,maxBufferedChunks:o.maxBufferedChunks,maxFragments:o.maxFragments,maxPayload:o.maxPayload,skipUTF8Validation:o.skipUTF8Validation})}),o.finishRequest?o.finishRequest(w,e):w.end()}i(Ez,"initAsClient");function _y(e,t){e._readyState=yt.CLOSING,e._errorEmitted=!0,e.emit("error",t),e.emitClose()}i(_y,"emitErrorAndClose");function Bae(e){return e.path=e.socketPath,Rz.connect(e)}i(Bae,"netConnect");function $ae(e){return e.path=void 0,!e.servername&&e.servername!==""&&(e.servername=Rz.isIP(e.host)?"":e.host),kae.connect(e)}i($ae,"tlsConnect");function pn(e,t,r){e._readyState=yt.CLOSING;let n=new Error(r);Error.captureStackTrace(n,pn),t.setHeader?(t[_z]=!0,t.abort(),t.socket&&!t.socket.destroyed&&t.socket.destroy(),process.nextTick(_y,e,n)):(t.destroy(n),t.once("error",e.emit.bind(e,"error")),t.once("close",e.emitClose.bind(e)))}i(pn,"abortHandshake");function rx(e,t,r){if(t){let n=_ae(t)?t.size:Dae(t).length;e._socket?e._sender._bufferedBytes+=n:e._bufferedAmount+=n}if(r){let n=new Error(`WebSocket is not open: readyState ${e.readyState} (${Ca[e.readyState]})`);process.nextTick(r,n)}}i(rx,"sendAfterClose");function Nae(e,t){let r=this[Vt];r._closeFrameReceived=!0,r._closeMessage=t,r._closeCode=e,r._socket[Vt]!==void 0&&(r._socket.removeListener("data",Ey),process.nextTick(Tz,r._socket),e===1005?r.close():r.close(e,t))}i(Nae,"receiverOnConclude");function Uae(){let e=this[Vt];e.isPaused||e._socket.resume()}i(Uae,"receiverOnDrain");function qae(e){let t=this[Vt];t._socket[Vt]!==void 0&&(t._socket.removeListener("data",Ey),process.nextTick(Tz,t._socket),t.close(e[Aae])),t._errorEmitted||(t._errorEmitted=!0,t.emit("error",e))}i(qae,"receiverOnError");function Pz(){this[Vt].emitClose()}i(Pz,"receiverOnFinish");function Fae(e,t){this[Vt].emit("message",e,t)}i(Fae,"receiverOnMessage");function zae(e){let t=this[Vt];t._autoPong&&t.pong(e,!this._isServer,xz),t.emit("ping",e)}i(zae,"receiverOnPing");function Wae(e){this[Vt].emit("pong",e)}i(Wae,"receiverOnPong");function Tz(e){e.resume()}i(Tz,"resume");function Vae(e){let t=this[Vt];t.readyState!==yt.CLOSED&&(t.readyState===yt.OPEN&&(t._readyState=yt.CLOSING,Cz(t)),this._socket.end(),t._errorEmitted||(t._errorEmitted=!0,t.emit("error",e)))}i(Vae,"senderOnError");function Cz(e){e._closeTimer=setTimeout(e._socket.destroy.bind(e._socket),e._closeTimeout)}i(Cz,"setCloseTimer");function Az(){let e=this[Vt];if(this.removeListener("close",Az),this.removeListener("data",Ey),this.removeListener("end",Mz),e._readyState=yt.CLOSING,!this._readableState.endEmitted&&!e._closeFrameReceived&&!e._receiver._writableState.errorEmitted&&this._readableState.length!==0){let t=this.read(this._readableState.length);e._receiver.write(t)}e._receiver.end(),this[Vt]=void 0,clearTimeout(e._closeTimer),e._receiver._writableState.finished||e._receiver._writableState.errorEmitted?e.emitClose():(e._receiver.on("error",Pz),e._receiver.on("finish",Pz))}i(Az,"socketOnClose");function Ey(e){this[Vt]._receiver.write(e)||this.pause()}i(Ey,"socketOnData");function Mz(){let e=this[Vt];e._readyState=yt.CLOSING,e._receiver.end(),this.end()}i(Mz,"socketOnEnd");function jz(){let e=this[Vt];this.removeListener("error",jz),this.on("error",xz),e&&(e._readyState=yt.CLOSING,this.destroy())}i(jz,"socketOnError")});var Bz=Be((sMe,Lz)=>{"use strict";var iMe=Ty(),{Duplex:Gae}=qe("stream");function Hz(e){e.emit("close")}i(Hz,"emitClose");function Jae(){!this.destroyed&&this._writableState.finished&&this.destroy()}i(Jae,"duplexOnEnd");function Dz(e){this.removeListener("error",Dz),this.destroy(),this.listenerCount("error")===0&&this.emit("error",e)}i(Dz,"duplexOnError");function Kae(e,t){let r=!0,n=new Gae({...t,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return e.on("message",i(function(a,s){let c=!s&&n._readableState.objectMode?a.toString():a;n.push(c)||e.pause()},"message")),e.once("error",i(function(a){n.destroyed||(r=!1,n.destroy(a))},"error")),e.once("close",i(function(){n.destroyed||n.push(null)},"close")),n._destroy=function(o,a){if(e.readyState===e.CLOSED){a(o),process.nextTick(Hz,n);return}let s=!1;e.once("error",i(function(d){s=!0,a(d)},"error")),e.once("close",i(function(){s||a(o),process.nextTick(Hz,n)},"close")),r&&e.terminate()},n._final=function(o){if(e.readyState===e.CONNECTING){e.once("open",i(function(){n._final(o)},"open"));return}e._socket!==null&&(e._socket._writableState.finished?(o(),n._readableState.endEmitted&&n.destroy()):(e._socket.once("finish",i(function(){o()},"finish")),e.close()))},n._read=function(){e.isPaused&&e.resume()},n._write=function(o,a,s){if(e.readyState===e.CONNECTING){e.once("open",i(function(){n._write(o,a,s)},"open"));return}e.send(o,s)},n.on("end",Jae),n.on("error",Dz),n}i(Kae,"createWebSocketStream");Lz.exports=Kae});var nx=Be((dMe,$z)=>{"use strict";var{tokenChars:Yae}=Yd();function Xae(e){let t=new Set,r=-1,n=-1,o=0;for(o;o<e.length;o++){let s=e.charCodeAt(o);if(n===-1&&Yae[s]===1)r===-1&&(r=o);else if(o!==0&&(s===32||s===9))n===-1&&r!==-1&&(n=o);else if(s===44){if(r===-1)throw new SyntaxError(`Unexpected character at index ${o}`);n===-1&&(n=o);let c=e.slice(r,n);if(t.has(c))throw new SyntaxError(`The "${c}" subprotocol is duplicated`);t.add(c),r=n=-1}else throw new SyntaxError(`Unexpected character at index ${o}`)}if(r===-1||n!==-1)throw new SyntaxError("Unexpected end of input");let a=e.slice(r,o);if(t.has(a))throw new SyntaxError(`The "${a}" subprotocol is duplicated`);return t.add(a),t}i(Xae,"parse");$z.exports={parse:Xae}});var Vz=Be((pMe,Wz)=>{"use strict";var Qae=qe("events"),Cy=qe("http"),{Duplex:uMe}=qe("stream"),{createHash:Zae}=qe("crypto"),Nz=Ry(),Gs=Kd(),eie=nx(),tie=Ty(),{CLOSE_TIMEOUT:rie,GUID:nie,kWebSocket:oie}=_a(),aie=/^[+/0-9A-Za-z]{22}==$/,Uz=0,qz=1,zz=2,ox=class extends Qae{static{i(this,"WebSocketServer")}constructor(t,r){if(super(),t={allowSynchronousEvents:!0,autoPong:!0,maxBufferedChunks:256*1024,maxFragments:16*1024,maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:rie,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:tie,...t},t.port==null&&!t.server&&!t.noServer||t.port!=null&&(t.server||t.noServer)||t.server&&t.noServer)throw new TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(t.port!=null?(this._server=Cy.createServer((n,o)=>{let a=Cy.STATUS_CODES[426];o.writeHead(426,{"Content-Length":a.length,"Content-Type":"text/plain"}),o.end(a)}),this._server.listen(t.port,t.host,t.backlog,r)):t.server&&(this._server=t.server),this._server){let n=this.emit.bind(this,"connection");this._removeListeners=iie(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:i((o,a,s)=>{this.handleUpgrade(o,a,s,n)},"upgrade")})}t.perMessageDeflate===!0&&(t.perMessageDeflate={}),t.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=t,this._state=Uz}address(){if(this.options.noServer)throw new Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(t){if(this._state===zz){t&&this.once("close",()=>{t(new Error("The server is not running"))}),process.nextTick(Gp,this);return}if(t&&this.once("close",t),this._state!==qz)if(this._state=qz,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(Gp,this):process.nextTick(Gp,this);else{let r=this._server;this._removeListeners(),this._removeListeners=this._server=null,r.close(()=>{Gp(this)})}}shouldHandle(t){if(this.options.path){let r=t.url.indexOf("?");if((r!==-1?t.url.slice(0,r):t.url)!==this.options.path)return!1}return!0}handleUpgrade(t,r,n,o){r.on("error",Fz);let a=t.headers["sec-websocket-key"],s=t.headers.upgrade,c=+t.headers["sec-websocket-version"];if(t.method!=="GET"){Js(this,t,r,405,"Invalid HTTP method");return}if(s===void 0||s.toLowerCase()!=="websocket"){Js(this,t,r,400,"Invalid Upgrade header");return}if(a===void 0||!aie.test(a)){Js(this,t,r,400,"Missing or invalid Sec-WebSocket-Key header");return}if(c!==13&&c!==8){Js(this,t,r,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});return}if(!this.shouldHandle(t)){Jp(r,400);return}let d=t.headers["sec-websocket-protocol"],l=new Set;if(d!==void 0)try{l=eie.parse(d)}catch{Js(this,t,r,400,"Invalid Sec-WebSocket-Protocol header");return}let u=t.headers["sec-websocket-extensions"],p={};if(this.options.perMessageDeflate&&u!==void 0){let m=new Gs({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let g=Nz.parse(u);g[Gs.extensionName]&&(m.accept(g[Gs.extensionName]),p[Gs.extensionName]=m)}catch{Js(this,t,r,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let m={origin:t.headers[`${c===8?"sec-websocket-origin":"origin"}`],secure:!!(t.socket.authorized||t.socket.encrypted),req:t};if(this.options.verifyClient.length===2){this.options.verifyClient(m,(g,w,h,y)=>{if(!g)return Jp(r,w||401,h,y);this.completeUpgrade(p,a,l,t,r,n,o)});return}if(!this.options.verifyClient(m))return Jp(r,401)}this.completeUpgrade(p,a,l,t,r,n,o)}completeUpgrade(t,r,n,o,a,s,c){if(!a.readable||!a.writable)return a.destroy();if(a[oie])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>Uz)return Jp(a,503);let l=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${Zae("sha1").update(r+nie).digest("base64")}`],u=new this.options.WebSocket(null,void 0,this.options);if(n.size){let p=this.options.handleProtocols?this.options.handleProtocols(n,o):n.values().next().value;p&&(l.push(`Sec-WebSocket-Protocol: ${p}`),u._protocol=p)}if(t[Gs.extensionName]){let p=t[Gs.extensionName].params,m=Nz.format({[Gs.extensionName]:[p]});l.push(`Sec-WebSocket-Extensions: ${m}`),u._extensions=t}this.emit("headers",l,o),a.write(l.concat(`\r
|
|
4
4
|
`).join(`\r
|
|
5
5
|
`)),a.removeListener("error",Fz),u.setSocket(a,s,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxBufferedChunks:this.options.maxBufferedChunks,maxFragments:this.options.maxFragments,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(u),u.on("close",()=>{this.clients.delete(u),this._shouldEmitClose&&!this.clients.size&&process.nextTick(Gp,this)})),c(u,o)}};Wz.exports=ox;function iie(e,t){for(let r of Object.keys(t))e.on(r,t[r]);return i(function(){for(let n of Object.keys(t))e.removeListener(n,t[n])},"removeListeners")}i(iie,"addListeners");function Gp(e){e._state=zz,e.emit("close")}i(Gp,"emitClose");function Fz(){this.destroy()}i(Fz,"socketOnError");function Jp(e,t,r,n){r=r||Cy.STATUS_CODES[t],n={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(r),...n},e.once("finish",e.destroy),e.end(`HTTP/1.1 ${t} ${Cy.STATUS_CODES[t]}\r
|
|
6
6
|
`+Object.keys(n).map(o=>`${o}: ${n[o]}`).join(`\r
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{m as f}from"./chunk-
|
|
2
|
+
import{m as f}from"./chunk-NZDLL6JN.js";import"./chunk-RFQD6B44.js";import"./chunk-22RLEU3Q.js";import"./chunk-R6I623SZ.js";import"./chunk-XRKFTPHD.js";import"./chunk-JEMECEQH.js";import"./chunk-Z5CQXPIS.js";import"./chunk-7EQLW2KM.js";import"./chunk-BT5YNE5U.js";import"./chunk-RPM4FDRX.js";import"./chunk-KTIBXRWQ.js";import"./chunk-KP2MYTP5.js";import"./chunk-PNPV2LDE.js";import"./chunk-4G3GTEVS.js";import"./chunk-KU4TPDPH.js";import"./chunk-55YD4UTW.js";import"./chunk-AFYYIJ6K.js";import"./chunk-J256AEEE.js";import"./chunk-UN2LKLGV.js";import"./chunk-2LJCJOJ7.js";import"./chunk-AMC4Z7G4.js";import"./chunk-LK77GI6M.js";import"./chunk-HVM2GUM3.js";import"./chunk-I6VMRQF4.js";import"./chunk-D6L6UNUQ.js";import"./chunk-AJXWJLZA.js";import"./chunk-OKKNDQJF.js";import"./chunk-4PUOWSDE.js";import"./chunk-ZY32SZ2P.js";import"./chunk-OTDDXEQ6.js";import"./chunk-ECOH24MC.js";import"./chunk-BSHAIAXY.js";import"./chunk-XWPC3AN4.js";import{a as g,c as a,d}from"./chunk-3M53YXEI.js";import"./chunk-GLUWATL5.js";import"./chunk-JCLTFDVW.js";import"./chunk-SV7ZBEK2.js";import"./chunk-2MEOUS24.js";import"./chunk-HNQPEOJD.js";import"./chunk-RCT3O3HQ.js";import"./chunk-UGOK7VTC.js";import"./chunk-TBODQT4W.js";import"./chunk-5HPZGLOL.js";import"./chunk-ZFJWA4JK.js";import"./chunk-X2J2P5ZT.js";import{a as s}from"./chunk-FTQLQJQV.js";function c(){return["usage: teams-bot <overview|bind|rebind|diagnostics|diagnostic-run>"," teams-bot overview --team-id <id>"," teams-bot bind --team-id <id> --token <token> [--project-id <id>] [--agent-id <id>] [--microsoft-connection-id <id>]"," teams-bot rebind <bindingId> --team-id <id> [--project-id <id>] [--agent-id <id>] [--microsoft-connection-id <id>]"," teams-bot diagnostics <bindingId> --team-id <id>"," teams-bot diagnostic-run <bindingId> --team-id <id> --prompt <text> [--attachments-json <json-array>] [--action-input-json <json-object>]"].join(`
|
|
3
3
|
`)}s(c,"usage");function u(n,o){if(!(o in n))return;let t=a(n,o);return!t||t==="null"||t==="none"?null:t}s(u,"nullableOption");function b(n){let o=d(n,"usage: teams-bot rebind <bindingId>"),t=u(n,"sandboxId"),r=u(n,"projectId"),i=u(n,"agentId"),e=u(n,"microsoftConnectionId");return{teamId:o,...t!==void 0?{sandboxId:t}:{},...r!==void 0?{projectId:r}:{},...i!==void 0?{agentId:i}:{},...e!==void 0?{microsoftConnectionId:e}:{}}}s(b,"bindingTargetInput");function l(n){let o=a(n,"attachmentsJson");if(!o)return;let t=g(o,"attachments-json");if(!Array.isArray(t))throw new Error("attachments-json must be a JSON array");for(let r of t)if(!r||typeof r!="object"||Array.isArray(r))throw new Error("attachments-json entries must be JSON objects");return t}s(l,"attachmentsInput");function w(n){let o=a(n,"actionInputJson");if(!o)return;let t=g(o,"action-input-json");if(!t||typeof t!="object"||Array.isArray(t))throw new Error("action-input-json must be a JSON object");return t}s(w,"actionInput");async function j(n,o){let t=o[0]||"overview",r=await f(n);if(t==="overview"){let i=d(n,"usage: teams-bot overview");console.log(JSON.stringify(await r.getMicrosoftTeamsBotOverview({teamId:i}),null,2));return}if(t==="bind"){let i=a(n,"token");if(!i)throw new Error(c());let e=await r.bindMicrosoftTeamsBotConversation({...b(n),token:i});console.log(JSON.stringify(e,null,2));return}if(t==="rebind"){let i=o[1]?.trim();if(!i)throw new Error(c());let e=await r.rebindMicrosoftTeamsBotConversation(i,b(n));console.log(JSON.stringify(e,null,2));return}if(t==="diagnostics"){let i=o[1]?.trim(),e=d(n,"usage: teams-bot diagnostics <bindingId>");if(!i)throw new Error(c());console.log(JSON.stringify(await r.sendMicrosoftTeamsBotDiagnostic({teamId:e,bindingId:i}),null,2));return}if(t==="diagnostic-run"){let i=o[1]?.trim(),e=d(n,"usage: teams-bot diagnostic-run <bindingId>"),m=a(n,"prompt");if(!i||!m)throw new Error(c());console.log(JSON.stringify(await r.sendMicrosoftTeamsBotDiagnosticRun({teamId:e,bindingId:i,prompt:m,attachments:l(n),actionInput:w(n)}),null,2));return}throw new Error(c())}s(j,"runTeamsBotCommand");export{j as runTeamsBotCommand};
|
package/dist/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
3
|
-
import{a as d}from"./chunks/chunk-AZ7BL5FL.js";import{b as f}from"./chunks/chunk-
|
|
3
|
+
import{a as d}from"./chunks/chunk-AZ7BL5FL.js";import{b as f}from"./chunks/chunk-22RLEU3Q.js";import{g as u}from"./chunks/chunk-R6I623SZ.js";import{a as l}from"./chunks/chunk-XRKFTPHD.js";import{a as c,b as m}from"./chunks/chunk-BSHAIAXY.js";import"./chunks/chunk-XWPC3AN4.js";import{f as a}from"./chunks/chunk-3M53YXEI.js";import"./chunks/chunk-GLUWATL5.js";import{a as s}from"./chunks/chunk-FTQLQJQV.js";function C(e){return!e.command&&a(e.options.version)?"version":a(e.options.checkUpdate)?"check-update":!e.command&&a(e.options.help)?"help":!e.command&&a(e.options.tui)?"tui":e.command?"command":"ui"}s(C,"resolveCliTopLevelAction");async function w(e=process.argv.slice(2)){if(await P(e))return;let{command:i,options:o,rest:t}=f(e);typeof o.home=="string"&&(process.env.OPENPOND_HOME=(await import("./chunks/dist-DKE7RJZN.js")).resolveOpenPondHome({home:o.home}));let r=C({command:i,options:o});if(r==="version"){console.log(l());return}if(r==="check-update"){await(await import("./chunks/core-commands-5TNBVR72.js")).runCheckUpdate();return}if(r==="help"){(await import("./chunks/help-PLQJOP4P.js")).printHelp();return}let n=c(o),p=m(o);if(n&&(process.env.OPENPOND_ACCOUNT=n),p&&(process.env.OPENPOND_BASE_URL=p),r==="tui"){await(await import("./chunks/app-layer-JCEWGUDH.js")).runOpenPondTerminalCommand(o,t);return}if(r==="ui"){await(await import("./chunks/app-layer-JCEWGUDH.js")).runOpenPondServerCommand("web",o,t);return}await u({command:i,options:o,rest:t})||((await import("./chunks/help-PLQJOP4P.js")).printHelp(),process.exit(1))}s(w,"runOpenPondCli");async function P(e){if(e[0]==="__dataset-preparation-authoring")return await(await import("./chunks/dataset-preparation-authoring-UUYFWWCT.js")).runDatasetPreparationAuthoringCli(e.slice(1)),!0;if(e[0]==="__inspect-hosted-profile-evaluation")return await(await import("./chunks/hosted-profile-compiler-FS5R6CHJ.js")).runHostedProfileInspectionCli(e.slice(1)),!0;if(e[0]==="__prepare-hosted-profile-evaluation")return await(await import("./chunks/hosted-profile-compiler-FS5R6CHJ.js")).runHostedProfileEvaluationCli(e.slice(1)),!0;if(e[0]==="__hosted-experiment-improvement")return await(await import("./chunks/hosted-experiment-improvement-VG2WE7XZ.js")).runHostedExperimentImprovementCli(e.slice(1)),!0;if(e[0]==="__compile-hosted-profile-candidate")return await(await import("./chunks/hosted-profile-candidate-PTGQLPZO.js")).runHostedProfileCandidateCli(e.slice(1)),!0;if(e[0]==="__compile-hosted-profile")return await(await import("./chunks/hosted-profile-compiler-FS5R6CHJ.js")).runHostedProfileCompilerCli(e.slice(1)),!0;if(e[0]==="__app-server"){process.argv=[process.execPath,"openpond-app-server",...e.slice(1)];let[{createOpenPondAppServer:i},{runOpenPondAppServerCli:o}]=await Promise.all([import("./chunks/app-server-runtime-43MCH5SY.js"),import("./chunks/cli-R7TAP6Z2.js")]);return await o(i),!0}if(e[0]==="__server"){process.argv=[process.execPath,"openpond-server",...e.slice(1)];let[{createOpenPondServer:i},{runOpenPondServerCli:o}]=await Promise.all([import("./chunks/src-MT4B43TD.js"),import("./chunks/cli-R7TAP6Z2.js")]),{createOpenPondAppServer:t}=await import("./chunks/app-server-runtime-43MCH5SY.js");return await o({createOpenPondServer:i,createOpenPondAppServer:t}),!0}return e[0]==="__terminal"?(await(await import("./chunks/src-C3ZUESMK.js")).runOpenPondTerminalCli(e.slice(1)),!0):!1}s(P,"runEmbeddedCompanion");w().catch(async e=>{if(e instanceof d){process.exitCode=e.exitCode;return}let i=e instanceof Error?e.message:String(e),o=e.issue,t=(await import("./chunks/training-error-WF463UNZ.js")).trainingCliError(e);if(process.argv.includes("--json")&&!(e instanceof Error&&e.name==="OpenPondChildProcessExitError"))console.log(JSON.stringify({error:o??t??{code:"CLI_ERROR",message:i}}));else if(o&&typeof o=="object"){let n=o;console.error(`${n.code}: ${n.message}
|
|
4
4
|
${n.path}
|
|
5
5
|
${n.action}`)}else console.error(t?`${t.code}: ${i}`:i);let r=typeof e.exitCode=="number"?e.exitCode:1;process.exit(r)});export{w as runOpenPondCli};
|