openpond 0.2.65 → 0.2.66
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/{acp-PHMBLRCV.js → acp-YYZ3ZO3Q.js} +1 -1
- package/dist/chunks/{acp-agent-A7GK2VSH.js → acp-agent-T26S7TU2.js} +1 -1
- package/dist/chunks/{app-layer-J66CQ2QN.js → app-layer-5XUMNHDO.js} +1 -1
- package/dist/chunks/{app-server-runtime-OMR2VE6L.js → app-server-runtime-TH56EG2Z.js} +1 -1
- package/dist/chunks/{apps-IHUFERZO.js → apps-MNT3KXIY.js} +1 -1
- package/dist/chunks/chunk-2ZNW6GUU.js +2 -0
- package/dist/chunks/{chunk-E2S2EMYQ.js → chunk-BQVB2SPF.js} +5 -5
- package/dist/chunks/{chunk-UM6EQOT2.js → chunk-JKI53ED7.js} +1 -1
- package/dist/chunks/{chunk-FGOTSCSE.js → chunk-NABPZ7AK.js} +1 -1
- package/dist/chunks/{chunk-KGUPAPGR.js → chunk-PLVWARB7.js} +1 -1
- package/dist/chunks/chunk-SBQ6KLXB.js +33 -0
- package/dist/chunks/{chunk-N2AV7PHV.js → chunk-UXPO3ZV7.js} +2 -2
- package/dist/chunks/{command-NDHFZAKA.js → command-NW6BGKOM.js} +3 -3
- package/dist/chunks/{configuration-command-465ODYTC.js → configuration-command-4WTS2MZS.js} +1 -1
- package/dist/chunks/{connected-evidence-XPAZQRFQ.js → connected-evidence-D7C45HYD.js} +1 -1
- package/dist/chunks/{connected-starting-assets-2YX3QVDB.js → connected-starting-assets-4LDXQVLN.js} +1 -1
- package/dist/chunks/{core-commands-PJOGRBHJ.js → core-commands-RXPXOYOP.js} +1 -1
- package/dist/chunks/{datasets-OTE2I4VT.js → datasets-LBLEKLCS.js} +1 -1
- package/dist/chunks/{desktop-test-Q6REQJ7K.js → desktop-test-INJPZ5VP.js} +1 -1
- package/dist/chunks/{evaluation-coordination-KRCY2H4C.js → evaluation-coordination-3ARLJAFH.js} +1 -1
- package/dist/chunks/{experiment-improvements-7MI2VYBR.js → experiment-improvements-UB4C5CSP.js} +1 -1
- package/dist/chunks/{experiments-CNUQKJZE.js → experiments-AHHKFJD6.js} +1 -1
- package/dist/chunks/{experiments-signal-4N344D4Y.js → experiments-signal-MTR475QV.js} +1 -1
- package/dist/chunks/{help-ZUKVY6RO.js → help-JQA3YMCX.js} +1 -1
- package/dist/chunks/{hosted-app-server-composition-DWSU6ASL.js → hosted-app-server-composition-GPXH3BOG.js} +1 -1
- package/dist/chunks/{human-review-HOBGC6RC.js → human-review-DVHVJXBA.js} +1 -1
- package/dist/chunks/{import-Q3YRFVY7.js → import-CLWTKDG6.js} +1 -1
- package/dist/chunks/{opchat-2LLDIWEJ.js → opchat-LMKH3OWR.js} +1 -1
- package/dist/chunks/{opchat-bounded-chat-FLDS36LU.js → opchat-bounded-chat-PPOWO7H4.js} +1 -1
- package/dist/chunks/{organizations-VIFSOY6P.js → organizations-T6ZUSHNJ.js} +1 -1
- package/dist/chunks/{profile-KIHMW2WB.js → profile-RIDNU2I5.js} +1 -1
- package/dist/chunks/{project-agent-TJLQNMLA.js → project-agent-GBMVDJY3.js} +1 -1
- package/dist/chunks/{sandbox-command-CQO6BEMQ.js → sandbox-command-L5VQ2T6C.js} +1 -1
- package/dist/chunks/{sandbox-template-MU33IILL.js → sandbox-template-NN3XQI7M.js} +1 -1
- package/dist/chunks/{setup-HSRCZ3WR.js → setup-TXEM2QSG.js} +1 -1
- package/dist/chunks/{src-CHQVWHV7.js → src-HJHIBDFX.js} +1 -1
- package/dist/chunks/{teams-bot-D3LWA4S5.js → teams-bot-FXMCOCPP.js} +1 -1
- package/dist/chunks/{tool-learning-NGO7QHYK.js → tool-learning-O7QTTEDB.js} +1 -1
- package/dist/cli.js +1 -1
- package/dist/skills/manifest.json +1 -1
- package/dist/web/assets/{App-BZuSv1XM.js → App-CNQi3RlI.js} +4 -4
- package/dist/web/assets/{AppDialog-BILEK4np.js → AppDialog-DuSd0wk6.js} +1 -1
- package/dist/web/assets/{AppTerminalPanel-BvxZ8bwD.js → AppTerminalPanel-DLz34eSs.js} +2 -2
- package/dist/web/assets/{AppToastContext-C-FsCKXW.js → AppToastContext-Dklk6CaG.js} +1 -1
- package/dist/web/assets/{AppsView-BMaq5oxx.js → AppsView-DkCMr67-.js} +1 -1
- package/dist/web/assets/{AttachmentTypeIcon-Bh7Ft_UL.js → AttachmentTypeIcon-DipNT6Tj.js} +1 -1
- package/dist/web/assets/{BrowserSidebar-BG2MLJ9I.js → BrowserSidebar-BBaaanMS.js} +1 -1
- package/dist/web/assets/{CartesianChart-CS6ES_XT.js → CartesianChart-UU1sdoUO.js} +1 -1
- package/dist/web/assets/{ChatTimelineEntry-Dr5X_XyN.js → ChatTimelineEntry-Ct59FKw1.js} +1 -1
- package/dist/web/assets/{CollaborationTabs-CPJ2w67F.js → CollaborationTabs-BWYRQ1PE.js} +1 -1
- package/dist/web/assets/{CommandMenu-Fe1V7NJd.js → CommandMenu-B08F9x5g.js} +1 -1
- package/dist/web/assets/{CommunityView-DHTcmOnI.js → CommunityView-BLTlSxyb.js} +1 -1
- package/dist/web/assets/{ComposerAttachments-Ck9VWD6o.js → ComposerAttachments-srWBKvCv.js} +1 -1
- package/dist/web/assets/{ComposerCreateImproveStrip-yiXO7cf8.js → ComposerCreateImproveStrip-DqTpU5cO.js} +1 -1
- package/dist/web/assets/{ConversationImportsSettings-_VLzUnHQ.js → ConversationImportsSettings-2KC-KQvu.js} +1 -1
- package/dist/web/assets/{FilePagePreview-BpcM1DfE.js → FilePagePreview-B-iUVPhh.js} +2 -2
- package/dist/web/assets/{GetStartedView-BH-WJ-rW.js → GetStartedView-5v0vBWXy.js} +1 -1
- package/dist/web/assets/{GettingStartedDialog-CdQfj7RA.js → GettingStartedDialog-Bn4072K-.js} +1 -1
- package/dist/web/assets/{HostedModelLearningReview-C3GsOlu9.js → HostedModelLearningReview-DWF6WPao.js} +1 -1
- package/dist/web/assets/{HostedModelLearningSettings-SSMst6dl.js → HostedModelLearningSettings-BYl-2j7B.js} +1 -1
- package/dist/web/assets/{HtmlVisual-CH0tb3fv.js → HtmlVisual-C2WsMj90.js} +1 -1
- package/dist/web/assets/{LabModelVersionDetailPage-J2t9yILv.js → LabModelVersionDetailPage-CQz29DwD.js} +1 -1
- package/dist/web/assets/{LabSkillSidebar-DdDYvfj2.js → LabSkillSidebar-C50P74LI.js} +1 -1
- package/dist/web/assets/{LabsRoute-MJwIjSKg.js → LabsRoute-DJRgF1kQ.js} +6 -6
- package/dist/web/assets/{MainChatThread-BcwtaTDZ.js → MainChatThread-gwmhe1Nw.js} +2 -2
- package/dist/web/assets/{MainPane-DDO6diPt.js → MainPane-CqtgV9rU.js} +5 -5
- package/dist/web/assets/{NativeSetupTerminal-BPSUFpRm.js → NativeSetupTerminal-DrQldDsG.js} +2 -2
- package/dist/web/assets/{NativeSkillSidebar-DPYavzau.js → NativeSkillSidebar-Clv0IWyn.js} +1 -1
- package/dist/web/assets/{NewProjectDialog-BtmvE9Sp.js → NewProjectDialog-Cw_F5Eaa.js} +1 -1
- package/dist/web/assets/{OutputsPage-BMRY7RK2.js → OutputsPage-Btyiie4B.js} +1 -1
- package/dist/web/assets/{PageChrome-5VRxH6Rp.js → PageChrome-BLLw_cEA.js} +1 -1
- package/dist/web/assets/{ProjectsPage-1LHqxOMo.js → ProjectsPage-BpSHWQgj.js} +1 -1
- package/dist/web/assets/{RightChatPanelStack-D_7KgExz.js → RightChatPanelStack-xW5rKbp0.js} +1 -1
- package/dist/web/assets/RightSidebarHomePanel-BDmIxvIm.js +1 -0
- package/dist/web/assets/{ScheduledWorkPage-Dtz4zJ0T.js → ScheduledWorkPage-WytWGQgw.js} +1 -1
- package/dist/web/assets/{SettingsView-BeDYNPcD.js → SettingsView-BJq5zNkv.js} +3 -3
- package/dist/web/assets/{TasksetDraftEditorPrimitives-CcvKO3YA.js → TasksetDraftEditorPrimitives-BxFEWI9W.js} +1 -1
- package/dist/web/assets/{TeamChatView-DaXxOkTe.js → TeamChatView-BisSMAXy.js} +1 -1
- package/dist/web/assets/{TerminalOverlay-CF8uB4qA.js → TerminalOverlay-C7OM2F0-.js} +1 -1
- package/dist/web/assets/{TrainingCreationPanel-DmMO7x5T.js → TrainingCreationPanel-KH5GFacT.js} +1 -1
- package/dist/web/assets/{TrainingDraftPanel-DCHbXjSx.js → TrainingDraftPanel-DzOw13Md.js} +1 -1
- package/dist/web/assets/{TrainingRunLineage-CwisTWs_.js → TrainingRunLineage-B2WBOchk.js} +1 -1
- package/dist/web/assets/{UsageSettingsSection-Drt7gwRb.js → UsageSettingsSection-nZHno_4P.js} +1 -1
- package/dist/web/assets/WorkSidebarPanel-D3Ub_jVj.js +1 -0
- package/dist/web/assets/{WorkspaceDiffPanel-Dmbrg0-y.js → WorkspaceDiffPanel-CyTa8Cjs.js} +3 -3
- package/dist/web/assets/{WorkspaceEnvironmentMenu-KEZm1gdb.js → WorkspaceEnvironmentMenu-CtZzxQ1e.js} +1 -1
- package/dist/web/assets/{WorkspaceFileLocation-ChbOKrPO.js → WorkspaceFileLocation-1U8DDj1J.js} +1 -1
- package/dist/web/assets/{WorkspaceGitDialogs-BS2JQKNQ.js → WorkspaceGitDialogs-BO1EUA3G.js} +1 -1
- package/dist/web/assets/{WorkspaceMonacoEditor-CN1hE_C4.js → WorkspaceMonacoEditor-Rqq_sKW_.js} +3 -3
- package/dist/web/assets/{WorkspacePdfPreview-Clb4m0le.js → WorkspacePdfPreview-zmmMp09R.js} +2 -2
- package/dist/web/assets/{WorkspacePresentationPreview-CwQsdvAR.js → WorkspacePresentationPreview-DNbhGjkE.js} +1 -1
- package/dist/web/assets/{bot-BNFltD5O.js → bot-D-eTQib6.js} +1 -1
- package/dist/web/assets/{chevron-down-BnnT0tnM.js → chevron-down-75im8nFF.js} +1 -1
- package/dist/web/assets/chevron-right-CpbCIUFo.js +1 -0
- package/dist/web/assets/{chevron-up-BAnwJJN3.js → chevron-up-BD8jg0bQ.js} +1 -1
- package/dist/web/assets/{client-choice-storage-Iuzoszas.js → client-choice-storage-CXlWJW5g.js} +1 -1
- package/dist/web/assets/{cloud-upload-CdSXJ7ms.js → cloud-upload-4lP-5zmp.js} +1 -1
- package/dist/web/assets/{copy-CBFg6m0d.js → copy-DRnATDDY.js} +1 -1
- package/dist/web/assets/{createLucideIcon-DF2VR6WA.js → createLucideIcon-CmkSm39S.js} +1 -1
- package/dist/web/assets/{cssMode-BSQUZhUO.js → cssMode-Cps-05f3.js} +1 -1
- package/dist/web/assets/{external-link-Cql9bKdv.js → external-link-D_nBEDFO.js} +1 -1
- package/dist/web/assets/{folder-open-BXdVB5J1.js → folder-open-tD5Lle1M.js} +1 -1
- package/dist/web/assets/{folder-plus-Cma2HulC.js → folder-plus-DlZ4hM48.js} +1 -1
- package/dist/web/assets/{git-commit-horizontal-eF--16ps.js → git-commit-horizontal-g8KBhvfr.js} +1 -1
- package/dist/web/assets/{htmlMode-aLPlQtyU.js → htmlMode-Do72TyNy.js} +1 -1
- package/dist/web/assets/icons-B8_Rkg-l.js +1 -0
- package/dist/web/assets/{image-CqKPwnBn.js → image-CUZMnZYi.js} +1 -1
- package/dist/web/assets/{index-CM0IRu1U.js → index-D7igQSAg.js} +2 -2
- package/dist/web/assets/{info-CqeYEqG0.js → info-SmuBZiE5.js} +1 -1
- package/dist/web/assets/{jsonMode-fu7bEcHB.js → jsonMode-B2N7W15Y.js} +1 -1
- package/dist/web/assets/loader-circle-D_KVxLLz.js +1 -0
- package/dist/web/assets/{lspLanguageFeatures-DraXQA4w.js → lspLanguageFeatures-DPmyOFVA.js} +1 -1
- package/dist/web/assets/{maximize-2-yMp8X9ts.js → maximize-2-B8HN3jsA.js} +1 -1
- package/dist/web/assets/{message-square-DbIMQqfj.js → message-square-CrDvzn66.js} +1 -1
- package/dist/web/assets/{monaco.contribution-Bd8EqYGR.js → monaco.contribution-BfOxF9PJ.js} +2 -2
- package/dist/web/assets/{monaco.contribution-BQhp1CJs.js → monaco.contribution-CRdTg0FH.js} +2 -2
- package/dist/web/assets/{monaco.contribution-CYWKnVxQ.js → monaco.contribution-DNONXznc.js} +2 -2
- package/dist/web/assets/{monaco.contribution-CmbWO0tB.js → monaco.contribution-DqqJBDzF.js} +2 -2
- package/dist/web/assets/{monitor-DFE2fTkT.js → monitor-CW-M_aaj.js} +1 -1
- package/dist/web/assets/{paperclip-D_qsKbVs.js → paperclip-DL449Io5.js} +1 -1
- package/dist/web/assets/{pdf-DkQRsi4n.js → pdf-BCq2Oosd.js} +1 -1
- package/dist/web/assets/play-DYLqBrwg.js +1 -0
- package/dist/web/assets/plus-DXZIpQuY.js +1 -0
- package/dist/web/assets/{presentation-BN_kIBPL.js → presentation-CupIXaYv.js} +1 -1
- package/dist/web/assets/{python-DB9pj5Hr.js → python-DuGMr666.js} +1 -1
- package/dist/web/assets/{refresh-cw-B27ohHfn.js → refresh-cw-CzVf5_oo.js} +1 -1
- package/dist/web/assets/{save-D-rwjKop.js → save-DatjrYPV.js} +1 -1
- package/dist/web/assets/{settings-lists-DgSaJQA4.js → settings-lists-D2ol3uNK.js} +1 -1
- package/dist/web/assets/square-BWB1nbZF.js +1 -0
- package/dist/web/assets/{square-terminal-CeoK51wH.js → square-terminal-Buj-s-fz.js} +1 -1
- package/dist/web/assets/{submit-issue-command-DZNW7Evj.js → submit-issue-command-wfngGS6Y.js} +1 -1
- package/dist/web/assets/{toggleHighContrast-Bs8L1gx0.js → toggleHighContrast-cl0cw2QK.js} +1 -1
- package/dist/web/assets/{training-model-data-wHvE7xL1.js → training-model-data-CWnu1bz9.js} +1 -1
- package/dist/web/assets/{tsMode-C7EqshxC.js → tsMode-DLEc0PYL.js} +1 -1
- package/dist/web/assets/{upload-BWgjC2Jf.js → upload-DaFVH6R1.js} +1 -1
- package/dist/web/assets/{useAccountSettings-Dva1MpsJ.js → useAccountSettings-ByxjI9BG.js} +1 -1
- package/dist/web/assets/{useAgentInventory-CrjIOmvb.js → useAgentInventory-Df64T07n.js} +1 -1
- package/dist/web/assets/{useLocalAgentSchedules-P-UaUKMb.js → useLocalAgentSchedules-DNh_x9gQ.js} +1 -1
- package/dist/web/assets/{useQuery-Bn3KqR4r.js → useQuery-yUz7Ui8g.js} +1 -1
- package/dist/web/assets/{wifi-off--mKrSPFc.js → wifi-off-CtNwnIJc.js} +1 -1
- package/dist/web/assets/{workers-p0Kn2KMK.js → workers-CnqrOtic.js} +1 -1
- package/dist/web/assets/x-Bhl-4Zlt.js +1 -0
- package/dist/web/assets/{yaml-BeIdC4tu.js → yaml-C9vtYV4w.js} +1 -1
- package/dist/web/index.html +1 -1
- package/package.json +1 -1
- package/dist/chunks/chunk-LOIYNRBC.js +0 -33
- package/dist/chunks/chunk-MMJU6PZV.js +0 -2
- package/dist/web/assets/RightSidebarHomePanel-iznJwDMf.js +0 -1
- package/dist/web/assets/WorkSidebarPanel-BrIIRtGW.js +0 -1
- package/dist/web/assets/chevron-right-C8K5PZj7.js +0 -1
- package/dist/web/assets/icons-c3vt7y6n.js +0 -1
- package/dist/web/assets/loader-circle-pxp89T5x.js +0 -1
- package/dist/web/assets/play-BtlX2stU.js +0 -1
- package/dist/web/assets/plus-DbASL_gy.js +0 -1
- package/dist/web/assets/square-C2caJ3NG.js +0 -1
- package/dist/web/assets/x-D9GTV9ke.js +0 -1
|
@@ -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-DAEUVT2I.js";import{m as he}from"./chunk-2W22IXHB.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-7P5SH3CI.js";import{c as ie}from"./chunk-TGULVWPV.js";import"./chunk-FGOTSCSE.js";import"./chunk-E2S2EMYQ.js";import"./chunk-XRKFTPHD.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{k as de}from"./chunk-CRDKBFRN.js";import"./chunk-DMO3UIS7.js";import"./chunk-27JGS3KB.js";import"./chunk-BT5YNE5U.js";import{d as se}from"./chunk-3WJQ4IGK.js";import"./chunk-KTIBXRWQ.js";import"./chunk-L4EJ5R3B.js";import"./chunk-6ZTP6CUJ.js";import"./chunk-TBODQT4W.js";import"./chunk-YRDPVTEI.js";import"./chunk-JRGECNP3.js";import"./chunk-RRWL5BHZ.js";import"./chunk-NXN7GJOH.js";import"./chunk-5WPMI6QX.js";import"./chunk-W7NXFRHN.js";import"./chunk-5HPZGLOL.js";import"./chunk-GLUWATL5.js";import"./chunk-UN2LKLGV.js";import"./chunk-2LJCJOJ7.js";import"./chunk-AMC4Z7G4.js";import"./chunk-LK77GI6M.js";import"./chunk-HVM2GUM3.js";import"./chunk-JCLTFDVW.js";import"./chunk-I6VMRQF4.js";import"./chunk-QAFXQHHG.js";import"./chunk-OKKNDQJF.js";import"./chunk-AJXWJLZA.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-JFZ6USNQ.js";import"./chunk-6FA3GG5B.js";import"./chunk-G4E3WGLM.js";import"./chunk-ZY32SZ2P.js";import"./chunk-OTDDXEQ6.js";import"./chunk-ECOH24MC.js";import"./chunk-SH7POUVX.js";import"./chunk-2MEOUS24.js";import"./chunk-HNQPEOJD.js";import"./chunk-RCT3O3HQ.js";import"./chunk-ZFJWA4JK.js";import"./chunk-X2J2P5ZT.js";import"./chunk-UGOK7VTC.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{a as Ee,o as Re}from"./chunk-DAEUVT2I.js";import{m as he}from"./chunk-2W22IXHB.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-7P5SH3CI.js";import{c as ie}from"./chunk-TGULVWPV.js";import"./chunk-NABPZ7AK.js";import"./chunk-BQVB2SPF.js";import"./chunk-XRKFTPHD.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{k as de}from"./chunk-CRDKBFRN.js";import"./chunk-DMO3UIS7.js";import"./chunk-27JGS3KB.js";import"./chunk-BT5YNE5U.js";import{d as se}from"./chunk-3WJQ4IGK.js";import"./chunk-KTIBXRWQ.js";import"./chunk-L4EJ5R3B.js";import"./chunk-6ZTP6CUJ.js";import"./chunk-TBODQT4W.js";import"./chunk-YRDPVTEI.js";import"./chunk-JRGECNP3.js";import"./chunk-RRWL5BHZ.js";import"./chunk-NXN7GJOH.js";import"./chunk-5WPMI6QX.js";import"./chunk-W7NXFRHN.js";import"./chunk-5HPZGLOL.js";import"./chunk-GLUWATL5.js";import"./chunk-UN2LKLGV.js";import"./chunk-2LJCJOJ7.js";import"./chunk-AMC4Z7G4.js";import"./chunk-LK77GI6M.js";import"./chunk-HVM2GUM3.js";import"./chunk-JCLTFDVW.js";import"./chunk-I6VMRQF4.js";import"./chunk-QAFXQHHG.js";import"./chunk-OKKNDQJF.js";import"./chunk-AJXWJLZA.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-JFZ6USNQ.js";import"./chunk-6FA3GG5B.js";import"./chunk-G4E3WGLM.js";import"./chunk-ZY32SZ2P.js";import"./chunk-OTDDXEQ6.js";import"./chunk-ECOH24MC.js";import"./chunk-SH7POUVX.js";import"./chunk-2MEOUS24.js";import"./chunk-HNQPEOJD.js";import"./chunk-RCT3O3HQ.js";import"./chunk-ZFJWA4JK.js";import"./chunk-X2J2P5ZT.js";import"./chunk-UGOK7VTC.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"./chunk-
|
|
2
|
+
import"./chunk-2ZNW6GUU.js";import{a as d}from"./chunk-IOSBGCRT.js";import"./chunk-V3KEG6MI.js";import"./chunk-PLVWARB7.js";import"./chunk-4DYWVGVS.js";import"./chunk-4TO743HO.js";import"./chunk-A77DLBR4.js";import"./chunk-BSHAIAXY.js";import"./chunk-XWPC3AN4.js";import{c as t,f as c}from"./chunk-3M53YXEI.js";import"./chunk-4N4EH3RJ.js";import"./chunk-ULJZ7NUF.js";import"./chunk-WJSJXK2N.js";import{j as u,s as h,u as s}from"./chunk-SBQ6KLXB.js";import"./chunk-CYQLXS2U.js";import"./chunk-O6ZYDHEJ.js";import"./chunk-OKEC2EIE.js";import"./chunk-WLZJOCLA.js";import"./chunk-HIQPGYVH.js";import"./chunk-ZWW227M3.js";import"./chunk-DXA2UHBE.js";import"./chunk-MTP3B2SU.js";import"./chunk-W7NXFRHN.js";import"./chunk-5HPZGLOL.js";import"./chunk-GLUWATL5.js";import"./chunk-JCLTFDVW.js";import"./chunk-I6VMRQF4.js";import"./chunk-QAFXQHHG.js";import"./chunk-OKKNDQJF.js";import"./chunk-AJXWJLZA.js";import"./chunk-6FA3GG5B.js";import"./chunk-G4E3WGLM.js";import"./chunk-ZY32SZ2P.js";import"./chunk-OTDDXEQ6.js";import"./chunk-ECOH24MC.js";import"./chunk-SH7POUVX.js";import"./chunk-2MEOUS24.js";import"./chunk-HNQPEOJD.js";import{n as r}from"./chunk-RCT3O3HQ.js";import"./chunk-ZFJWA4JK.js";import"./chunk-X2J2P5ZT.js";import"./chunk-UGOK7VTC.js";import{a as m}from"./chunk-FTQLQJQV.js";import{execFile as v}from"node:child_process";import{promisify as x}from"node:util";import{realpath as y}from"node:fs/promises";import{resolve as E}from"node:path";async function O(e){if(!c(e.allowUpload))throw new Error("Tool capture uploads bounded private tool events. Pass --allow-upload to opt in.");let o=t(e,"client");if(o!=="claude_code"&&o!=="openpond")throw new Error("Choose --client claude_code or --client openpond.");if(!t(e,"environmentFile"))throw new Error("Provide --environment-file with the actual application, version, and bounded state.");let i=t(e,"tools").split(",").map(g=>g.trim()).filter(Boolean);if(!i.length||new Set(i).size!==i.length)throw new Error("Choose the exact permitted tool names with --tools <comma-separated-names>.");let a=t(e,"projectId");if(!a)throw new Error("Choose an existing private Model with --project-id.");let l=await y(E(t(e,"workspace")||process.cwd())),n=o==="claude_code"?(await x(v)("claude",["--version"],{timeout:1e4,maxBuffer:65536})).stdout.trim().split(" ")[0]:h();if(o==="claude_code"&&n!=="2.1.292")throw new Error("This release supports Claude Code 2.1.292. Qualify a changed hook protocol before installation.");if(n==="unknown")throw new Error("Cannot identify this OpenPond release.");let{baseUrl:w,teamId:f}=await d(e),p=`tool-${r({home:s(e),api:new URL(w).origin,teamId:f,projectId:a,workspace:l,client:o,clientVersion:n}).slice(0,40)}`;return u.parse({schemaVersion:"openpond.toolLearningRegistration.v1",operationId:`${p}:register`,installationId:p,projectId:a,machineSourceId:`machine-${r(s(e)).slice(0,40)}`,client:o,clientVersion:n,adapterRelease:{id:"openpond-tool-learning-v1",contentHash:r({protocol:"openpond-tool-learning-v1",client:o,clientVersion:n})},collectionPolicy:{revision:1,permittedTools:i,workspaceRootHashes:[r(l)],permittedFields:["action","intent","state","result_excerpt"],unchangedControls:{numerator:1,denominator:10},maximumEventBytes:65536,maximumEpisodeBytes:2097152,maximumEpisodeEvents:256,maximumQueueBytes:1048576,maximumQueueEvents:256,maximumQueueAgeSeconds:86400,rawRetentionDays:1,purposes:["capture","consultation"],modelUpdates:"requires_separate_review",variantGeneration:"disabled"}})}m(O,"prepareToolLearningSetup");export{O as prepareToolLearningSetup};
|
|
@@ -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 q$,b as z$,c as W$}from"./chunk-H42UW6IF.js";import{a as T$,b as E$,c as C$,d as A$,e as M$,f as j$,g as O$,h as H$,i as D$,j as L$}from"./chunk-FHLSLOKH.js";import{a as Vt,b as qu,c as da,d as Vg,e as Gg,f as si}from"./chunk-B32CW3NT.js";import{a as B$,b as $$,c as N$,d as O,e as U$,f as ci,g as J,h as Jg,j as F$}from"./chunk-SAZTOGX6.js";import"./chunk-S4WILIRA.js";import{c as _$}from"./chunk-GIU3Z45P.js";import{a as UB,b as KB,c as BS,d as YB,e as XB,f as QB,g as ZB,h as e$,j as t$}from"./chunk-GRLQHYAU.js";import{A as LS,a as BB,c as $B,g as NB,k as Ng,l as _o,m as FB,n as sa,o as Ug,p as qB,q as oi,r as Fg,s as zB,t as ca,u as qg,v as ai,w as WB,x as VB,y as GB,z as JB}from"./chunk-LI3FTPAH.js";import{a as r$,b as n$,c as zg,d as o$,e as ii,f as qe,g as a$,h as ke,i as i$,j as s$,k as c$,l as d$,m as l$,n as u$,o as p$,p as m$,q as f$,r as h$,s as g$,t as Or,u as Hr,v as Re,w as w$}from"./chunk-S6UCVXBC.js";import{a as y$,b as v$}from"./chunk-QAEZNFAM.js";import{a as b$,b as k$}from"./chunk-M5QPL5NO.js";import{c as DS}from"./chunk-4D3CICBG.js";import{a as I$,b as S$,c as P$}from"./chunk-FS2VKOT7.js";import{a as Wg,b as R$}from"./chunk-5JVJQA5H.js";import"./chunk-U2BD545L.js";import{a as Dg,b as PB,c as RB,d as xB,e as _B}from"./chunk-5Z3AU5CL.js";import{a as ia,c as Ag,d as wd,e as yB,f as vB,g as ur,h as bB,i as jg,j as kB,k as pr,l as Og,m as IB,n as jr,o as Hg,p as SB,r as CB}from"./chunk-MHPCVQOE.js";import{a as Lg,b as TB,c as HS}from"./chunk-4JYTFEND.js";import{b as EB,c as Bg}from"./chunk-55Q64WWF.js";import{a as Kr}from"./chunk-IEVJLG3V.js";import"./chunk-S7A2OGL2.js";import{a as gB,e as Mg}from"./chunk-OW3EOC5Q.js";import{a as rI,b as LC}from"./chunk-EICS777E.js";import{b as MB}from"./chunk-6C3CXME7.js";import{a as jB,b as $g,c as OB,d as HB,e as DB}from"./chunk-HX6GXMDK.js";import{b as LB}from"./chunk-FUFI4THX.js";import{b as hB}from"./chunk-5KWKSR4P.js";import{b as fB,c as jS}from"./chunk-Q3WXB465.js";import"./chunk-5AU5Y6KS.js";import{a as mB}from"./chunk-FEAKTSRS.js";import"./chunk-UK5LGSGT.js";import{a as Fn,b as Cg,c as OS,d as wB}from"./chunk-TPOAAJKA.js";import"./chunk-GDJ4X2ZN.js";import{a as AB}from"./chunk-B666Z2NS.js";import"./chunk-WLQEONBF.js";import"./chunk-YU4JYWCA.js";import{a as aB,b as iB,c as sB}from"./chunk-ZUT4EM64.js";import{a as cB,b as dB,c as _g,d as Tg}from"./chunk-XVDFJ3ZF.js";import{h as oe}from"./chunk-3MVKXAH7.js";import"./chunk-SDO4FC4Q.js";import"./chunk-IR3YJWPW.js";import{a as gs,b as MS,c as nB,d as oB}from"./chunk-3BJ7LPE3.js";import"./chunk-W45RKGM6.js";import"./chunk-LARJARMS.js";import{a as Un,b as KL,c as YL}from"./chunk-MWS2NAHJ.js";import{a as eB,b as xg}from"./chunk-67HXM6AL.js";import"./chunk-JLW5BQVO.js";import{a as Pg,d as Rg,f as tB,g as rB}from"./chunk-ANG2YMMD.js";import{a as ZL}from"./chunk-W22KWKF6.js";import{b as XL,c as QL,d as gd,f as Sg,g as Uu}from"./chunk-YBKDEEEH.js";import{b as Fu,c as aa}from"./chunk-6TRVEA3T.js";import{a as GL,b as JL}from"./chunk-OTUS7NTQ.js";import{b as bg,d as hd,l as jL,n as kg}from"./chunk-V3S2B6WU.js";import{a as UL,d as FL,f as qL,g as zL,h as WL,i as oa,j as VL,k as Ig,n as Nu}from"./chunk-C5B3FMV3.js";import"./chunk-DRMOHADV.js";import{c as VH,d as Qh,i as GH}from"./chunk-FEQ7HNJR.js";import{a as mj,d as fj,g as kj}from"./chunk-LYVHYT3L.js";import{A as hh,c as mh,d as YM,e as XM,f as QM,h as ZM,i as ej,j as tj,p as rj,u as Ya,v as nj,x as oj,z as fh}from"./chunk-OTXGAKFH.js";import{a as uH,b as hH,c as gH,d as $H,e as Xh,f as qH,g as zH,h as WH,i as JH,j as OD,k as $L,m as x$}from"./chunk-N2AV7PHV.js";import{a as lB}from"./chunk-DSJZS77R.js";import{a as at,b as pH,c as mH,d as gS,e as iD,f as eg,g as tg,h as sD}from"./chunk-HPTEJBP4.js";import{a as uB,b as Eg,c as pB}from"./chunk-D7R2AAX2.js";import{b as sd,c as cd,d as fS}from"./chunk-NTM3KQ25.js";import{b as Yh}from"./chunk-2GJD23CM.js";import{$ as _L,A as LD,B as Io,C as BD,D as $D,E as WD,F as VD,G as GD,H as JD,I as KD,J as iL,K as sL,L as _S,M as cL,N as hL,O as gL,P as wL,Q as vL,R as TS,S as IL,T as wg,U as ms,V as xo,W as $n,X as RL,Y as Bu,Z as xL,_ as Nn,aa as yg,b as wH,ba as TL,c as MH,ca as EL,d as jH,da as lr,e as HH,ea as fs,f as QH,fa as CL,g as ld,ga as na,h as ZH,ha as ES,i as rD,ia as CS,j as nD,ja as $u,k as cD,ka as AS,l as PD,la as vg,m as RD,ma as ML,n as xD,na as OL,o as _D,oa as NL,p as TD,q as bS,r as ED,s as CD,t as AD,u as MD,x as jD,y as HD,z as kS}from"./chunk-UM6EQOT2.js";import{g as HL,h as DL,i as LL,j as BL}from"./chunk-EVQISX7M.js";import{a as OH}from"./chunk-PYNW5OFA.js";import{A as IS,B as SS,F as YD,M as SL,a as YH,b as XH,c as hS,m as SD,q as ag}from"./chunk-66HFW4OU.js";import{b as hs,c as AL,d as Pr}from"./chunk-RHMULF56.js";import"./chunk-VFH5C6D2.js";import{a as ID}from"./chunk-AN525SPP.js";import{a as us,b as dS,c as Mu,d as ju,e as ad,f as Vh,g as lS,h as Ou,i as fn,j as CH,k as pe,l as AH,m as pS}from"./chunk-WBO6FQHR.js";import{b as bH}from"./chunk-H5ML7735.js";import"./chunk-SYUKES6H.js";import{a as kL}from"./chunk-UOFDKMRU.js";import{a as NH,b as UH,c as FH,d as Kh}from"./chunk-XHBMK6LC.js";import{B as yL,J as PL,b as BC,z as DD}from"./chunk-6I5AUTVO.js";import{a as KH}from"./chunk-IZ6DLEVY.js";import"./chunk-QJJNHKLT.js";import{b as DH,i as LH,j as BH,m as id,n as mS}from"./chunk-ZU3YBRXS.js";import{a as Au,b as ei}from"./chunk-7XOUM6RK.js";import{a as cS,h as yH,j as vH}from"./chunk-VD2TQCMH.js";import"./chunk-N73MU2C3.js";import"./chunk-DIDQHTAX.js";import"./chunk-Z2TOBS3P.js";import"./chunk-7PXZ4X4P.js";import"./chunk-FAKDGLZQ.js";import{a as oD,b as aD}from"./chunk-GW766ZSO.js";import{a as Sr,b as kH,c as Jr,d as IH,e as Gh,f as Jh,g as uS,h as SH,i as ti,k as PH,l as RH,m as xH,n as _H,o as TH,p as EH}from"./chunk-MCBRB5D6.js";import{a as pL,b as mL,c as fL,d as gg,f as bL}from"./chunk-JD76ANPN.js";import{a as dL,b as Lu,c as lL,d as fg,e as uL,f as hg}from"./chunk-SSJV3VX7.js";import{a as dd}from"./chunk-7KWD2I6W.js";import{A as y0,C as v0,D as b0,E as Dn,d as n0,e as o0,f as a0,g as i0,h as II,i as s0,j as c0,k as d0,l as l0,m as u0,n as Ff,o as p0,p as SI,q as m0,r as f0,s as Wt,t as h0,u as ot,v as wt,w as g0,x as w0,y as pu,z as qf}from"./chunk-4TTXNVCE.js";import{c as hD,d as wS,e as gD,f as wD,g as yD,h as vD,i as pd,j as og,k as ko,l as bD,m as yS,n as kD,o as vS}from"./chunk-HNDAGZCF.js";import{A as fD,C as ng,b as Zh,d as eD,e as tD,h as dD,k as lD,l as uD,m as ud,n as pD,p as rg,q as mD,s as Hu}from"./chunk-YU3C6U5V.js";import"./chunk-OPTJYDZN.js";import{a as ri}from"./chunk-KVTBX2UP.js";import{a as ge,b as Ot,c as od,d as ce,f as fH}from"./chunk-BJXPQIVD.js";import"./chunk-QYQZQVVN.js";import{A as ni,B as xS,C as lg,D as rL,E as ug,F as nL,G as Du,J as pg,K as oL,L as mg,M as aL,N as fd,d as ND,f as UD,g as FD,h as qD,i as zD,m as ig,n as sg,o as XD,p as QD,q as md,r as ZD,s as PS,t as eL,u as cg,v as dg,w as Ro,x as ps,y as RS,z as tL}from"./chunk-GFAI2MCJ.js";import"./chunk-VS2LOUCT.js";import"./chunk-DMFUEUAZ.js";import{a as So,b as Po,c as Ht}from"./chunk-GF55VEMR.js";import{a as YQ,b as NC,c as nI,d as oI}from"./chunk-LZPCA6DH.js";import{b as qc,c as r0}from"./chunk-L3KS6MOV.js";import"./chunk-GUG2SWRZ.js";import"./chunk-G4747MOW.js";import"./chunk-KCJVFLBB.js";import{$ as yO,$a as GO,$b as Tu,A as Vj,Aa as EO,Ac as Wh,Ba as CO,Ca as AO,Cb as $h,Db as V1,E as Gj,Ea as ed,Eb as G1,F as Jj,Fa as MO,Fb as bo,G as Sh,Gb as J1,H as Kj,Ha as ku,Hb as ls,I as nO,Ia as Eh,Ib as K1,J as oO,Ja as jO,K as wo,Ka as QI,La as OO,M as aO,Ma as HO,N as iO,Na as ZI,O as sO,Oa as DO,P as cO,Pa as LO,Q as dO,Qa as BO,Ra as $O,S as lO,Sa as NO,T as Ph,Ta as UO,U as uO,Ua as FO,V as pO,Va as eS,Vb as Y1,W as mO,Wa as qO,X as fO,Xa as zO,Xb as X1,Y as hO,Ya as WO,Yb as xu,Z as gO,Za as VO,Zb as Q1,_ as wO,_a as tS,_b as _u,aa as vO,ab as JO,ac as sS,b as Xc,ba as bO,bb as KO,bc as Z1,ca as kO,cb as YO,cc as Eu,da as IO,db as XO,dc as eH,e as jj,ea as SO,eb as QO,ec as Nh,fb as ZO,fc as tH,g as JI,ga as Rh,gb as e1,gc as rH,h as Oj,ha as PO,hb as t1,hc as nH,i as Ir,ia as Ln,ic as oH,j as yu,ja as xh,jc as Uh,k as is,ka as XI,kb as r1,kc as Fh,l as KI,la as _h,lb as n1,m as Hj,mb as o1,n as Dj,na as Th,nb as a1,nc as aH,o as Lj,oa as vu,ob as i1,p as Bj,pb as Iu,pc as Za,q as $j,qa as RO,r as Nj,rb as Ch,rc as qh,s as Ih,sb as s1,sc as iH,ta as Zc,tb as c1,tc as Cu,ua as yo,ub as d1,uc as zh,v as ra,va as xO,vb as ss,vc as sH,w as Qc,wa as bu,wb as l1,wc as cH,x as zj,y as Wj,ya as _O,yb as W1,yc as dH,za as TO,zc as lH}from"./chunk-MVPKU72J.js";import{d as t0}from"./chunk-OQPJ7FJF.js";import"./chunk-BL3CZWWD.js";import{b as Uj,c as kh}from"./chunk-GD3RCUDH.js";import{$ as ds,A as dr,C as R1,D as x1,E as _1,F as iS,G as T1,H as E1,I as C1,K as Oh,L as A1,a as Ah,aa as M1,b as u1,ba as Bn,c as rS,ca as j1,d as vo,da as O1,e as p1,ea as H1,f as m1,fa as Xa,g as f1,ga as rd,h as nS,ha as Hh,i as cs,ia as D1,j as h1,ja as L1,k as g1,ka as B1,l as w1,la as Pu,m as oS,ma as nd,n as Su,na as Dh,o as y1,oa as $1,p as Mh,pa as Lh,q as v1,qa as Qa,r as b1,ra as N1,s as td,sa as U1,t as k1,ta as F1,u as jh,ua as Bh,v as I1,va as q1,w as S1,wa as Ru,x as aS,xa as z1,z as P1}from"./chunk-QCJY6FTC.js";import"./chunk-UTIELP6F.js";import{g as Ij,j as Sj,l as Yc,m as Pj,o as yh,s as vh}from"./chunk-6S2MWJVD.js";import{b as Yj,c as Xj,d as Qj,e as Zj,f as eO,g as tO,h as rO}from"./chunk-FYWQWKVS.js";import{e as Fj,g as qj,h as YI,j as lt}from"./chunk-6ESBAHWK.js";import"./chunk-4V73I4OL.js";import"./chunk-LE75SVEL.js";import"./chunk-7J2NMUTK.js";import"./chunk-W45RKGM6.js";import"./chunk-W45RKGM6.js";import{a as Rj,b as xj,c as _j,d as Tj,e as Ej,f as Cj,g as Mr,h as Aj,j as bh,k as Mj}from"./chunk-7PKTCMZ6.js";import{a as wu}from"./chunk-LXZLLTYQ.js";import"./chunk-GI7LTJV3.js";import{b as wh,c as wj,e as yj,f as gu,g as VI,k as GI,l as vj,m as bj}from"./chunk-VS3AMJEK.js";import"./chunk-XGY4OQLC.js";import{d as lj,h as uj,i as pj}from"./chunk-AF3AVDPP.js";import{a as XQ}from"./chunk-JFXINDOQ.js";import"./chunk-SFR32TMJ.js";import{b as hj,l as gj}from"./chunk-5KJMFK65.js";import{B as Kc,b as as,c as aj,h as ij,i as kr,t as Jc,v as sj,w as cj,x as gh,y as dj}from"./chunk-Y3B6ZUE6.js";import{c as SA}from"./chunk-4N4EH3RJ.js";import"./chunk-ULJZ7NUF.js";import{a as QA,b as ZA,c as mn,d as Nf,e as ns,f as uu,g as kI,h as Uf,i as e0,k as zf,n as k0}from"./chunk-WJSJXK2N.js";import"./chunk-LOIYNRBC.js";import{b as Z0,c as eM,f as tM,g as rM,h as nM}from"./chunk-CYQLXS2U.js";import{a as Q0,b as Kf}from"./chunk-O6ZYDHEJ.js";import{d as Gc,e as hu,f as GM,g as JM,h as KM,j as zI,l as WI}from"./chunk-OKEC2EIE.js";import{$a as fu,Ab as UI,Ba as th,C as gM,Ca as Gr,Da as _M,Eb as DM,F as Wc,Fa as rh,Fb as LM,Gb as Vc,H as wM,Hb as BM,Ib as $M,J as yM,Jb as lh,Kb as uh,L as vM,Lb as ph,Mb as NM,N as bM,Nb as FI,O as kM,Oa as Ja,Ob as UM,Qb as FM,Rb as qM,Sb as qI,Ta as TM,Tb as zM,Ua as EM,Ub as WM,Va as CM,Vb as Ka,W as IM,Wa as nh,Wb as VM,Xa as oh,Xb as It,Ya as MI,Za as jI,aa as Ga,ab as AM,ba as SM,c as oM,cb as MM,db as jM,fb as ah,ga as PM,gb as OM,ha as RM,i as aM,ib as HM,ja as it,l as dM,m as lM,n as uM,nb as ih,o as pM,oa as Zf,p as mM,pb as sh,q as Xf,qb as ch,r as AI,rb as ta,s as fM,sb as OI,t as hM,tb as HI,u as Qf,ub as dh,vb as DI,wa as go,wb as LI,xa as xM,xb as BI,yb as $I,za as eh,zb as NI}from"./chunk-WLZJOCLA.js";import{f as TI,m as zc}from"./chunk-HIQPGYVH.js";import{D as mu,F as sM,G as Yf,J as cM,N as CI,O as Va,b as EI,i as cr,j as os,q as Vr,x as iM}from"./chunk-ZWW227M3.js";import"./chunk-DXA2UHBE.js";import"./chunk-MTP3B2SU.js";import"./chunk-27JGS3KB.js";import{a as J0,b as Y0}from"./chunk-UN2LKLGV.js";import"./chunk-2LJCJOJ7.js";import"./chunk-AMC4Z7G4.js";import{b as K0,e as X0}from"./chunk-LK77GI6M.js";import{k as tI}from"./chunk-HVM2GUM3.js";import{d as kA,e as IA,g as XA}from"./chunk-JCLTFDVW.js";import"./chunk-I6VMRQF4.js";import{Ga as B0,Ia as Gf,P as R0,Pa as PI,Ra as $0,Ta as N0,Ua as Jf,Va as U0,Za as F0,ab as q0,ba as x0,d as I0,eb as RI,f as Wf,gb as xI,ha as D0,ib as z0,jb as W0,kb as V0,l as S0,lb as _I,m as P0,na as L0,sb as G0}from"./chunk-QAFXQHHG.js";import{A as E0,E as C0,F as A0,G as Vf,H as M0,I as j0,J as O0,N as H0,h as _0,z as T0}from"./chunk-OKKNDQJF.js";import"./chunk-AJXWJLZA.js";import{a as lu}from"./chunk-6FA3GG5B.js";import{Ab as Qo,Bb as Nc,E as dA,Gb as wA,Ib as yA,K as We,L as kt,N as lA,Nb as vA,P as uA,R as ho,Sa as Mf,Ub as bA,aa as pA,ca as mA,d as aA,g as iA,i as sA,j as cA,lb as fA,mb as za,nb as ft,ob as hA,rb as gA,zb as $c}from"./chunk-G4E3WGLM.js";import{$a as Cf,A as Tf,Aa as Me,B as aI,C as Qi,Cb as rA,D as Zi,Db as nA,Eb as oA,F as FC,Fb as Af,H as qC,I as zC,Ja as GC,La as JC,M as iI,N as sI,O as cI,Oa as KC,P as dI,Q as lI,R as uI,Ra as YC,S as pI,Sa as XC,T as mI,Wa as QC,a as $C,bb as hI,fb as ZC,ga as WC,hb as eA,kb as tA,n as UC,o as Pf,p as Rf,q as xf,qa as Ef,r as _f,ra as VC,v as qa,va as fI}from"./chunk-ZY32SZ2P.js";import{q as DC,r as Bc,s as Sf}from"./chunk-OTDDXEQ6.js";import"./chunk-ECOH24MC.js";import{C as $A,D as NA,I as qA,K as wI,L as yI,M as zA,S as vI,U as WA,V as bI,Z as VA,_ as GA,ca as JA,da as KA,f as cu,fa as rs,ga as YA,ha as $f,v as Fc,x as du}from"./chunk-SH7POUVX.js";import{M as Uc,O as HA,Q as DA,R as LA,S as BA,a as ts,b as xA,c as Wa,d as pn,e as _A,f as Of,g as TA,h as EA,i as Hf,j as Df,l as CA,m as AA,n as MA,o as jA,p as OA,z as gI}from"./chunk-2MEOUS24.js";import{b as HC,d as If,e as Hn,f as jt}from"./chunk-HNQPEOJD.js";import{g as bf,h as eI,i as OC,l as Qe,m as Ee,n as C,o as kf}from"./chunk-RCT3O3HQ.js";import"./chunk-ZFJWA4JK.js";import{A as v,d as pt}from"./chunk-X2J2P5ZT.js";import{a as PA,c as es,f as jf,h as su,i as RA,m as Lf,p as UA,r as Zo,s as FA,t as ea,u as Bf}from"./chunk-UGOK7VTC.js";import{a as i,b as $e,c as He,e as un}from"./chunk-FTQLQJQV.js";var la=He((Z_e,QN)=>{"use strict";var YN=["nodebuffer","arraybuffer","fragments"],XN=typeof Blob<"u";XN&&YN.push("blob");QN.exports={BINARY_TYPES:YN,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:XN,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:i(()=>{},"NOOP")}});var Xu=He((tTe,nw)=>{"use strict";var{EMPTY_BUFFER:aee}=la(),sP=Buffer[Symbol.species];function iee(e,t){if(e.length===0)return aee;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 sP(r.buffer,r.byteOffset,n):r}i(iee,"concat");function ZN(e,t,r,n,o){for(let a=0;a<o;a++)r[n+a]=e[a]^t[a&3]}i(ZN,"_mask");function e2(e,t){for(let r=0;r<e.length;r++)e[r]^=t[r&3]}i(e2,"_unmask");function see(e){return e.length===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.length)}i(see,"toArrayBuffer");function cP(e){if(cP.readOnly=!0,Buffer.isBuffer(e))return e;let t;return e instanceof ArrayBuffer?t=new sP(e):ArrayBuffer.isView(e)?t=new sP(e.buffer,e.byteOffset,e.byteLength):(t=Buffer.from(e),cP.readOnly=!1),t}i(cP,"toBuffer");nw.exports={concat:iee,mask:ZN,toArrayBuffer:see,toBuffer:cP,unmask:e2};if(!process.env.WS_NO_BUFFER_UTIL)try{let e=$e("bufferutil");nw.exports.mask=function(t,r,n,o,a){a<48?ZN(t,r,n,o,a):e.mask(t,r,n,o,a)},nw.exports.unmask=function(t,r){t.length<32?e2(t,r):e.unmask(t,r)}}catch{}});var n2=He((nTe,r2)=>{"use strict";var t2=Symbol("kDone"),dP=Symbol("kRun"),lP=class{static{i(this,"Limiter")}constructor(t){this[t2]=()=>{this.pending--,this[dP]()},this.concurrency=t||1/0,this.jobs=[],this.pending=0}add(t){this.jobs.push(t),this[dP]()}[dP](){if(this.pending!==this.concurrency&&this.jobs.length){let t=this.jobs.shift();this.pending++,t(this[t2])}}};r2.exports=lP});var Rd=He((aTe,s2)=>{"use strict";var Qu=$e("zlib"),o2=Xu(),cee=n2(),{kStatusCode:a2}=la(),dee=Buffer[Symbol.species],lee=Buffer.from([0,0,255,255]),aw=Symbol("permessage-deflate"),ua=Symbol("total-length"),Sd=Symbol("callback"),pi=Symbol("buffers"),Pd=Symbol("error"),ow,uP=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,!ow){let r=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;ow=new cee(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[Sd];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){ow.add(o=>{this._decompress(t,r,(a,s)=>{o(),n(a,s)})})}compress(t,r,n){ow.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"?Qu.Z_DEFAULT_WINDOWBITS:this.params[a];this._inflate=Qu.createInflateRaw({...this._options.zlibInflateOptions,windowBits:s}),this._inflate[aw]=this,this._inflate[ua]=0,this._inflate[pi]=[],this._inflate.on("error",pee),this._inflate.on("data",i2)}this._inflate[Sd]=n,this._inflate.write(t),r&&this._inflate.write(lee),this._inflate.flush(()=>{let a=this._inflate[Pd];if(a){this._inflate.close(),this._inflate=null,n(a);return}let s=o2.concat(this._inflate[pi],this._inflate[ua]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[ua]=0,this._inflate[pi]=[],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"?Qu.Z_DEFAULT_WINDOWBITS:this.params[a];this._deflate=Qu.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:s}),this._deflate[ua]=0,this._deflate[pi]=[],this._deflate.on("data",uee)}this._deflate[Sd]=n,this._deflate.write(t),this._deflate.flush(Qu.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let a=o2.concat(this._deflate[pi],this._deflate[ua]);r&&(a=new dee(a.buffer,a.byteOffset,a.length-4)),this._deflate[Sd]=null,this._deflate[ua]=0,this._deflate[pi]=[],r&&this.params[`${o}_no_context_takeover`]&&this._deflate.reset(),n(null,a)})}};s2.exports=uP;function uee(e){this[pi].push(e),this[ua]+=e.length}i(uee,"deflateOnData");function i2(e){if(this[ua]+=e.length,this[aw]._maxPayload<1||this[ua]<=this[aw]._maxPayload){this[pi].push(e);return}this[Pd]=new RangeError("Max payload size exceeded"),this[Pd].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[Pd][a2]=1009,this.removeListener("data",i2),this.reset()}i(i2,"inflateOnData");function pee(e){if(this[aw]._inflate=null,this[Pd]){this[Sd](this[Pd]);return}e[a2]=1007,this[Sd](e)}i(pee,"inflateOnError")});var xd=He((sTe,iw)=>{"use strict";var{isUtf8:c2}=$e("buffer"),{hasBlob:mee}=la(),fee=[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 hee(e){return e>=1e3&&e<=1014&&e!==1004&&e!==1005&&e!==1006||e>=3e3&&e<=4999}i(hee,"isValidStatusCode");function pP(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(pP,"_isValidUTF8");function gee(e){return mee&&typeof e=="object"&&typeof e.arrayBuffer=="function"&&typeof e.type=="string"&&typeof e.stream=="function"&&(e[Symbol.toStringTag]==="Blob"||e[Symbol.toStringTag]==="File")}i(gee,"isBlob");iw.exports={isBlob:gee,isValidStatusCode:hee,isValidUTF8:pP,tokenChars:fee};if(c2)iw.exports.isValidUTF8=function(e){return e.length<24?pP(e):c2(e)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let e=$e("utf-8-validate");iw.exports.isValidUTF8=function(t){return t.length<32?pP(t):e(t)}}catch{}});var wP=He((dTe,h2)=>{"use strict";var{Writable:wee}=$e("stream"),d2=Rd(),{BINARY_TYPES:yee,EMPTY_BUFFER:l2,kStatusCode:vee,kWebSocket:bee}=la(),{concat:mP,toArrayBuffer:kee,unmask:Iee}=Xu(),{isValidStatusCode:See,isValidUTF8:u2}=xd(),sw=Buffer[Symbol.species],gn=0,p2=1,m2=2,f2=3,fP=4,hP=5,cw=6,gP=class extends wee{static{i(this,"Receiver")}constructor(t={}){super(),this._allowSynchronousEvents=t.allowSynchronousEvents!==void 0?t.allowSynchronousEvents:!0,this._binaryType=t.binaryType||yee[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[bee]=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=gn}_write(t,r,n){if(this._opcode===8&&this._state==gn)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 sw(n.buffer,n.byteOffset+t,n.length-t),new sw(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 sw(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 gn:this.getInfo(t);break;case p2:this.getPayloadLength16(t);break;case m2:this.getPayloadLength64(t);break;case f2:this.getMask();break;case fP:this.getData(t);break;case hP:case cw: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[d2.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=p2:this._payloadLength===127?this._state=m2: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=f2:this._state=fP}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=fP}getData(t){let r=l2;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&&Iee(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=hP,this.decompress(r,t);return}r.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(r)),this.dataMessage(t)}decompress(t,r){this._extensions[d2.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===gn&&this.startLoop(r)})}dataMessage(t){if(!this._fin){this._state=gn;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=mP(n,r):this._binaryType==="arraybuffer"?o=kee(mP(n,r)):this._binaryType==="blob"?o=new Blob(n):o=n,this._allowSynchronousEvents?(this.emit("message",o,!0),this._state=gn):(this._state=cw,setImmediate(()=>{this.emit("message",o,!0),this._state=gn,this.startLoop(t)}))}else{let o=mP(n,r);if(!this._skipUTF8Validation&&!u2(o)){let a=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");t(a);return}this._state===hP||this._allowSynchronousEvents?(this.emit("message",o,!1),this._state=gn):(this._state=cw,setImmediate(()=>{this.emit("message",o,!1),this._state=gn,this.startLoop(t)}))}}controlMessage(t,r){if(this._opcode===8){if(t.length===0)this._loop=!1,this.emit("conclude",1005,l2),this.end();else{let n=t.readUInt16BE(0);if(!See(n)){let a=this.createError(RangeError,`invalid status code ${n}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");r(a);return}let o=new sw(t.buffer,t.byteOffset+2,t.length-2);if(!this._skipUTF8Validation&&!u2(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=gn;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?"ping":"pong",t),this._state=gn):(this._state=cw,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",t),this._state=gn,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[vee]=o,s}};h2.exports=gP});var bP=He((pTe,y2)=>{"use strict";var{Duplex:uTe}=$e("stream"),{randomFillSync:Pee}=$e("crypto"),{types:{isUint8Array:Ree}}=$e("util"),g2=Rd(),{EMPTY_BUFFER:xee,kWebSocket:_ee,NOOP:Tee}=la(),{isBlob:_d,isValidStatusCode:Eee}=xd(),{mask:w2,toBuffer:bs}=Xu(),wn=Symbol("kByteLength"),Cee=Buffer.alloc(4),dw=8*1024,ks,Td=dw,qn=0,Aee=1,Mee=2,yP=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=qn,this.onerror=Tee,this[_ee]=void 0}static frame(t,r){let n,o=!1,a=2,s=!1;r.mask&&(n=r.maskBuffer||Cee,r.generateMask?r.generateMask(n):(Td===dw&&(ks===void 0&&(ks=Buffer.alloc(dw)),Pee(ks,0,dw),Td=0),n[0]=ks[Td++],n[1]=ks[Td++],n[2]=ks[Td++],n[3]=ks[Td++]),s=(n[0]|n[1]|n[2]|n[3])===0,a=6);let c;typeof t=="string"?(!r.mask||s)&&r[wn]!==void 0?c=r[wn]:(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?(w2(t,n,l,a,c),[l]):(w2(t,n,t,0,c),[l,t])):[l,t]}close(t,r,n,o){let a;if(t===void 0)a=xee;else{if(typeof t!="number"||!Eee(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(Ree(r))a.set(r,2);else throw new TypeError("Second argument must be a string or a Uint8Array")}}let s={[wn]:a.length,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state!==qn?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):_d(t)?(o=t.size,a=!1):(t=bs(t),o=t.length,a=bs.readOnly),o>125)throw new RangeError("The data size must not be greater than 125 bytes");let s={[wn]:o,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:9,readOnly:a,rsv1:!1};_d(t)?this._state!==qn?this.enqueue([this.getBlobData,t,!1,s,n]):this.getBlobData(t,!1,s,n):this._state!==qn?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):_d(t)?(o=t.size,a=!1):(t=bs(t),o=t.length,a=bs.readOnly),o>125)throw new RangeError("The data size must not be greater than 125 bytes");let s={[wn]:o,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:10,readOnly:a,rsv1:!1};_d(t)?this._state!==qn?this.enqueue([this.getBlobData,t,!1,s,n]):this.getBlobData(t,!1,s,n):this._state!==qn?this.enqueue([this.dispatch,t,!1,s,n]):this.sendFrame(e.frame(t,s),n)}send(t,r,n){let o=this._extensions[g2.extensionName],a=r.binary?2:1,s=r.compress,c,d;typeof t=="string"?(c=Buffer.byteLength(t),d=!1):_d(t)?(c=t.size,d=!1):(t=bs(t),c=t.length,d=bs.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={[wn]:c,fin:r.fin,generateMask:this._generateMask,mask:r.mask,maskBuffer:this._maskBuffer,opcode:a,readOnly:d,rsv1:s};_d(t)?this._state!==qn?this.enqueue([this.getBlobData,t,this._compress,l,n]):this.getBlobData(t,this._compress,l,n):this._state!==qn?this.enqueue([this.dispatch,t,this._compress,l,n]):this.dispatch(t,this._compress,l,n)}getBlobData(t,r,n,o){this._bufferedBytes+=n[wn],this._state=Mee,t.arrayBuffer().then(a=>{if(this._socket.destroyed){let c=new Error("The socket was closed while the blob was being read");process.nextTick(vP,this,c,o);return}this._bufferedBytes-=n[wn];let s=bs(a);r?this.dispatch(s,r,n,o):(this._state=qn,this.sendFrame(e.frame(s,n),o),this.dequeue())}).catch(a=>{process.nextTick(jee,this,a,o)})}dispatch(t,r,n,o){if(!r){this.sendFrame(e.frame(t,n),o);return}let a=this._extensions[g2.extensionName];this._bufferedBytes+=n[wn],this._state=Aee,a.compress(t,n.fin,(s,c)=>{if(this._socket.destroyed){let d=new Error("The socket was closed while data was being compressed");vP(this,d,o);return}this._bufferedBytes-=n[wn],this._state=qn,n.readOnly=!1,this.sendFrame(e.frame(c,n),o),this.dequeue()})}dequeue(){for(;this._state===qn&&this._queue.length;){let t=this._queue.shift();this._bufferedBytes-=t[3][wn],Reflect.apply(t[0],this,t.slice(1))}}enqueue(t){this._bufferedBytes+=t[3][wn],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)}};y2.exports=yP;function vP(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(vP,"callCallbacks");function jee(e,t,r){vP(e,t,r),e.onerror(t)}i(jee,"onError")});var _2=He((fTe,x2)=>{"use strict";var{kForOnEventAttribute:Zu,kListener:kP}=la(),v2=Symbol("kCode"),b2=Symbol("kData"),k2=Symbol("kError"),I2=Symbol("kMessage"),S2=Symbol("kReason"),Ed=Symbol("kTarget"),P2=Symbol("kType"),R2=Symbol("kWasClean"),pa=class{static{i(this,"Event")}constructor(t){this[Ed]=null,this[P2]=t}get target(){return this[Ed]}get type(){return this[P2]}};Object.defineProperty(pa.prototype,"target",{enumerable:!0});Object.defineProperty(pa.prototype,"type",{enumerable:!0});var Is=class extends pa{static{i(this,"CloseEvent")}constructor(t,r={}){super(t),this[v2]=r.code===void 0?0:r.code,this[S2]=r.reason===void 0?"":r.reason,this[R2]=r.wasClean===void 0?!1:r.wasClean}get code(){return this[v2]}get reason(){return this[S2]}get wasClean(){return this[R2]}};Object.defineProperty(Is.prototype,"code",{enumerable:!0});Object.defineProperty(Is.prototype,"reason",{enumerable:!0});Object.defineProperty(Is.prototype,"wasClean",{enumerable:!0});var Cd=class extends pa{static{i(this,"ErrorEvent")}constructor(t,r={}){super(t),this[k2]=r.error===void 0?null:r.error,this[I2]=r.message===void 0?"":r.message}get error(){return this[k2]}get message(){return this[I2]}};Object.defineProperty(Cd.prototype,"error",{enumerable:!0});Object.defineProperty(Cd.prototype,"message",{enumerable:!0});var ep=class extends pa{static{i(this,"MessageEvent")}constructor(t,r={}){super(t),this[b2]=r.data===void 0?null:r.data}get data(){return this[b2]}};Object.defineProperty(ep.prototype,"data",{enumerable:!0});var Oee={addEventListener(e,t,r={}){for(let o of this.listeners(e))if(!r[Zu]&&o[kP]===t&&!o[Zu])return;let n;if(e==="message")n=i(function(a,s){let c=new ep("message",{data:s?a:a.toString()});c[Ed]=this,lw(t,this,c)},"onMessage");else if(e==="close")n=i(function(a,s){let c=new Is("close",{code:a,reason:s.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});c[Ed]=this,lw(t,this,c)},"onClose");else if(e==="error")n=i(function(a){let s=new Cd("error",{error:a,message:a.message});s[Ed]=this,lw(t,this,s)},"onError");else if(e==="open")n=i(function(){let a=new pa("open");a[Ed]=this,lw(t,this,a)},"onOpen");else return;n[Zu]=!!r[Zu],n[kP]=t,r.once?this.once(e,n):this.on(e,n)},removeEventListener(e,t){for(let r of this.listeners(e))if(r[kP]===t&&!r[Zu]){this.removeListener(e,r);break}}};x2.exports={CloseEvent:Is,ErrorEvent:Cd,Event:pa,EventTarget:Oee,MessageEvent:ep};function lw(e,t,r){typeof e=="object"&&e.handleEvent?e.handleEvent.call(e,r):e.call(t,r)}i(lw,"callListener")});var uw=He((gTe,T2)=>{"use strict";var{tokenChars:tp}=xd();function To(e,t,r){e[t]===void 0?e[t]=[r]:e[t].push(r)}i(To,"push");function Hee(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&&tp[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 w=e.slice(d,u);l===44?(To(t,w,r),r=Object.create(null)):s=w,d=u=-1}else throw new SyntaxError(`Unexpected character at index ${p}`);else if(c===void 0)if(u===-1&&tp[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),To(r,e.slice(d,u),!0),l===44&&(To(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(tp[l]!==1)throw new SyntaxError(`Unexpected character at index ${p}`);d===-1?d=p:n||(n=!0),o=!1}else if(a)if(tp[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&&tp[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 w=e.slice(d,u);n&&(w=w.replace(/\\/g,""),n=!1),To(r,c,w),l===44&&(To(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 f=e.slice(d,u);return s===void 0?To(t,f,r):(c===void 0?To(r,f,!0):n?To(r,c,f.replace(/\\/g,"")):To(r,c,f),To(t,s,r)),t}i(Hee,"parse");function Dee(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(Dee,"format");T2.exports={format:Dee,parse:Hee}});var hw=He((bTe,N2)=>{"use strict";var Lee=$e("events"),Bee=$e("https"),$ee=$e("http"),A2=$e("net"),Nee=$e("tls"),{randomBytes:Uee,createHash:Fee}=$e("crypto"),{Duplex:yTe,Readable:vTe}=$e("stream"),{URL:IP}=$e("url"),mi=Rd(),qee=wP(),zee=bP(),{isBlob:Wee}=xd(),{BINARY_TYPES:E2,CLOSE_TIMEOUT:Vee,EMPTY_BUFFER:pw,GUID:Gee,kForOnEventAttribute:SP,kListener:Jee,kStatusCode:Kee,kWebSocket:Dt,NOOP:M2}=la(),{EventTarget:{addEventListener:Yee,removeEventListener:Xee}}=_2(),{format:Qee,parse:Zee}=uw(),{toBuffer:ete}=Xu(),j2=Symbol("kAborted"),PP=[8,13],ma=["CONNECTING","OPEN","CLOSING","CLOSED"],tte=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,ut=class e extends Lee{static{i(this,"WebSocket")}constructor(t,r,n){super(),this._binaryType=E2[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=pw,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]),O2(this,t,r,n)):(this._autoPong=n.autoPong,this._closeTimeout=n.closeTimeout,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(t){E2.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 qee({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 zee(t,this._extensions,n.generateMask);this._receiver=o,this._sender=a,this._socket=t,o[Dt]=this,a[Dt]=this,t[Dt]=this,o.on("conclude",ote),o.on("drain",ate),o.on("error",ite),o.on("message",ste),o.on("ping",cte),o.on("pong",dte),a.onerror=lte,t.setTimeout&&t.setTimeout(0),t.setNoDelay&&t.setNoDelay(),r.length>0&&t.unshift(r),t.on("close",L2),t.on("data",fw),t.on("end",B2),t.on("error",$2),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[mi.extensionName]&&this._extensions[mi.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){Yr(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())}),D2(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){RP(this,t,n);return}r===void 0&&(r=!this._isServer),this._sender.ping(t||pw,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){RP(this,t,n);return}r===void 0&&(r=!this._isServer),this._sender.pong(t||pw,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){RP(this,t,n);return}let o={binary:typeof t!="string",mask:!this._isServer,compress:!0,fin:!0,...r};this._extensions[mi.extensionName]||(o.compress=!1),this._sender.send(t||pw,o,n)}terminate(){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){Yr(this,this._req,"WebSocket was closed before the connection was established");return}this._socket&&(this._readyState=e.CLOSING,this._socket.destroy())}}};Object.defineProperty(ut,"CONNECTING",{enumerable:!0,value:ma.indexOf("CONNECTING")});Object.defineProperty(ut.prototype,"CONNECTING",{enumerable:!0,value:ma.indexOf("CONNECTING")});Object.defineProperty(ut,"OPEN",{enumerable:!0,value:ma.indexOf("OPEN")});Object.defineProperty(ut.prototype,"OPEN",{enumerable:!0,value:ma.indexOf("OPEN")});Object.defineProperty(ut,"CLOSING",{enumerable:!0,value:ma.indexOf("CLOSING")});Object.defineProperty(ut.prototype,"CLOSING",{enumerable:!0,value:ma.indexOf("CLOSING")});Object.defineProperty(ut,"CLOSED",{enumerable:!0,value:ma.indexOf("CLOSED")});Object.defineProperty(ut.prototype,"CLOSED",{enumerable:!0,value:ma.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(e=>{Object.defineProperty(ut.prototype,e,{enumerable:!0})});["open","error","close","message"].forEach(e=>{Object.defineProperty(ut.prototype,`on${e}`,{enumerable:!0,get(){for(let t of this.listeners(e))if(t[SP])return t[Jee];return null},set(t){for(let r of this.listeners(e))if(r[SP]){this.removeListener(e,r);break}typeof t=="function"&&this.addEventListener(e,t,{[SP]:!0})}})});ut.prototype.addEventListener=Yee;ut.prototype.removeEventListener=Xee;N2.exports=ut;function O2(e,t,r,n){let o={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:Vee,protocolVersion:PP[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,!PP.includes(o.protocolVersion))throw new RangeError(`Unsupported protocol version: ${o.protocolVersion} (supported versions: ${PP.join(", ")})`);let a;if(t instanceof IP)a=t;else try{a=new IP(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;mw(e,h);return}let l=s?443:80,u=Uee(16).toString("base64"),p=s?Bee.request:$ee.request,f=new Set,w;if(o.createConnection=o.createConnection||(s?nte:rte),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&&(w=new mi({...o.perMessageDeflate,isServer:!1,maxPayload:o.maxPayload}),o.headers["Sec-WebSocket-Extensions"]=Qee({[mi.extensionName]:w.offer()})),r.length){for(let h of r){if(typeof h!="string"||!tte.test(h)||f.has(h))throw new SyntaxError("An invalid or duplicated subprotocol was specified");f.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 g;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,m]of Object.entries(h))n.headers[y.toLowerCase()]=m}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")),g=e._req=p(o),e._redirects&&e.emit("redirect",e.url,g)}else g=e._req=p(o);o.timeout&&g.on("timeout",()=>{Yr(e,g,"Opening handshake has timed out")}),g.on("error",h=>{g===null||g[j2]||(g=e._req=null,mw(e,h))}),g.on("response",h=>{let y=h.headers.location,m=h.statusCode;if(y&&o.followRedirects&&m>=300&&m<400){if(++e._redirects>o.maxRedirects){Yr(e,g,"Maximum redirects exceeded");return}g.abort();let I;try{I=new IP(y,t)}catch{let k=new SyntaxError(`Invalid URL: ${y}`);mw(e,k);return}O2(e,I,r,n)}else e.emit("unexpected-response",g,h)||Yr(e,g,`Unexpected server response: ${h.statusCode}`)}),g.on("upgrade",(h,y,m)=>{if(e.emit("upgrade",h),e.readyState!==ut.CONNECTING)return;g=e._req=null;let I=h.headers.upgrade;if(I===void 0||I.toLowerCase()!=="websocket"){Yr(e,y,"Invalid Upgrade header");return}let S=Fee("sha1").update(u+Gee).digest("base64");if(h.headers["sec-websocket-accept"]!==S){Yr(e,y,"Invalid Sec-WebSocket-Accept header");return}let k=h.headers["sec-websocket-protocol"],b;if(k!==void 0?f.size?f.has(k)||(b="Server sent an invalid subprotocol"):b="Server sent a subprotocol but none was requested":f.size&&(b="Server sent no subprotocol"),b){Yr(e,y,b);return}k&&(e._protocol=k);let R=h.headers["sec-websocket-extensions"];if(R!==void 0){if(!w){Yr(e,y,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let _;try{_=Zee(R)}catch{Yr(e,y,"Invalid Sec-WebSocket-Extensions header");return}let P=Object.keys(_);if(P.length!==1||P[0]!==mi.extensionName){Yr(e,y,"Server indicated an extension that was not requested");return}try{w.accept(_[mi.extensionName])}catch{Yr(e,y,"Invalid Sec-WebSocket-Extensions header");return}e._extensions[mi.extensionName]=w}e.setSocket(y,m,{allowSynchronousEvents:o.allowSynchronousEvents,generateMask:o.generateMask,maxBufferedChunks:o.maxBufferedChunks,maxFragments:o.maxFragments,maxPayload:o.maxPayload,skipUTF8Validation:o.skipUTF8Validation})}),o.finishRequest?o.finishRequest(g,e):g.end()}i(O2,"initAsClient");function mw(e,t){e._readyState=ut.CLOSING,e._errorEmitted=!0,e.emit("error",t),e.emitClose()}i(mw,"emitErrorAndClose");function rte(e){return e.path=e.socketPath,A2.connect(e)}i(rte,"netConnect");function nte(e){return e.path=void 0,!e.servername&&e.servername!==""&&(e.servername=A2.isIP(e.host)?"":e.host),Nee.connect(e)}i(nte,"tlsConnect");function Yr(e,t,r){e._readyState=ut.CLOSING;let n=new Error(r);Error.captureStackTrace(n,Yr),t.setHeader?(t[j2]=!0,t.abort(),t.socket&&!t.socket.destroyed&&t.socket.destroy(),process.nextTick(mw,e,n)):(t.destroy(n),t.once("error",e.emit.bind(e,"error")),t.once("close",e.emitClose.bind(e)))}i(Yr,"abortHandshake");function RP(e,t,r){if(t){let n=Wee(t)?t.size:ete(t).length;e._socket?e._sender._bufferedBytes+=n:e._bufferedAmount+=n}if(r){let n=new Error(`WebSocket is not open: readyState ${e.readyState} (${ma[e.readyState]})`);process.nextTick(r,n)}}i(RP,"sendAfterClose");function ote(e,t){let r=this[Dt];r._closeFrameReceived=!0,r._closeMessage=t,r._closeCode=e,r._socket[Dt]!==void 0&&(r._socket.removeListener("data",fw),process.nextTick(H2,r._socket),e===1005?r.close():r.close(e,t))}i(ote,"receiverOnConclude");function ate(){let e=this[Dt];e.isPaused||e._socket.resume()}i(ate,"receiverOnDrain");function ite(e){let t=this[Dt];t._socket[Dt]!==void 0&&(t._socket.removeListener("data",fw),process.nextTick(H2,t._socket),t.close(e[Kee])),t._errorEmitted||(t._errorEmitted=!0,t.emit("error",e))}i(ite,"receiverOnError");function C2(){this[Dt].emitClose()}i(C2,"receiverOnFinish");function ste(e,t){this[Dt].emit("message",e,t)}i(ste,"receiverOnMessage");function cte(e){let t=this[Dt];t._autoPong&&t.pong(e,!this._isServer,M2),t.emit("ping",e)}i(cte,"receiverOnPing");function dte(e){this[Dt].emit("pong",e)}i(dte,"receiverOnPong");function H2(e){e.resume()}i(H2,"resume");function lte(e){let t=this[Dt];t.readyState!==ut.CLOSED&&(t.readyState===ut.OPEN&&(t._readyState=ut.CLOSING,D2(t)),this._socket.end(),t._errorEmitted||(t._errorEmitted=!0,t.emit("error",e)))}i(lte,"senderOnError");function D2(e){e._closeTimer=setTimeout(e._socket.destroy.bind(e._socket),e._closeTimeout)}i(D2,"setCloseTimer");function L2(){let e=this[Dt];if(this.removeListener("close",L2),this.removeListener("data",fw),this.removeListener("end",B2),e._readyState=ut.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[Dt]=void 0,clearTimeout(e._closeTimer),e._receiver._writableState.finished||e._receiver._writableState.errorEmitted?e.emitClose():(e._receiver.on("error",C2),e._receiver.on("finish",C2))}i(L2,"socketOnClose");function fw(e){this[Dt]._receiver.write(e)||this.pause()}i(fw,"socketOnData");function B2(){let e=this[Dt];e._readyState=ut.CLOSING,e._receiver.end(),this.end()}i(B2,"socketOnEnd");function $2(){let e=this[Dt];this.removeListener("error",$2),this.on("error",M2),e&&(e._readyState=ut.CLOSING,this.destroy())}i($2,"socketOnError")});var z2=He((STe,q2)=>{"use strict";var ITe=hw(),{Duplex:ute}=$e("stream");function U2(e){e.emit("close")}i(U2,"emitClose");function pte(){!this.destroyed&&this._writableState.finished&&this.destroy()}i(pte,"duplexOnEnd");function F2(e){this.removeListener("error",F2),this.destroy(),this.listenerCount("error")===0&&this.emit("error",e)}i(F2,"duplexOnError");function mte(e,t){let r=!0,n=new ute({...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(U2,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(U2,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",pte),n.on("error",F2),n}i(mte,"createWebSocketStream");q2.exports=mte});var xP=He((RTe,W2)=>{"use strict";var{tokenChars:fte}=xd();function hte(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&&fte[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(hte,"parse");W2.exports={parse:hte}});var Q2=He((TTe,X2)=>{"use strict";var gte=$e("events"),gw=$e("http"),{Duplex:_Te}=$e("stream"),{createHash:wte}=$e("crypto"),V2=uw(),Ss=Rd(),yte=xP(),vte=hw(),{CLOSE_TIMEOUT:bte,GUID:kte,kWebSocket:Ite}=la(),Ste=/^[+/0-9A-Za-z]{22}==$/,G2=0,J2=1,Y2=2,_P=class extends gte{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:bte,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:vte,...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=gw.createServer((n,o)=>{let a=gw.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=Pte(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=G2}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===Y2){t&&this.once("close",()=>{t(new Error("The server is not running"))}),process.nextTick(rp,this);return}if(t&&this.once("close",t),this._state!==J2)if(this._state=J2,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(rp,this):process.nextTick(rp,this);else{let r=this._server;this._removeListeners(),this._removeListeners=this._server=null,r.close(()=>{rp(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",K2);let a=t.headers["sec-websocket-key"],s=t.headers.upgrade,c=+t.headers["sec-websocket-version"];if(t.method!=="GET"){Ps(this,t,r,405,"Invalid HTTP method");return}if(s===void 0||s.toLowerCase()!=="websocket"){Ps(this,t,r,400,"Invalid Upgrade header");return}if(a===void 0||!Ste.test(a)){Ps(this,t,r,400,"Missing or invalid Sec-WebSocket-Key header");return}if(c!==13&&c!==8){Ps(this,t,r,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});return}if(!this.shouldHandle(t)){np(r,400);return}let d=t.headers["sec-websocket-protocol"],l=new Set;if(d!==void 0)try{l=yte.parse(d)}catch{Ps(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 f=new Ss({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let w=V2.parse(u);w[Ss.extensionName]&&(f.accept(w[Ss.extensionName]),p[Ss.extensionName]=f)}catch{Ps(this,t,r,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let f={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(f,(w,g,h,y)=>{if(!w)return np(r,g||401,h,y);this.completeUpgrade(p,a,l,t,r,n,o)});return}if(!this.options.verifyClient(f))return np(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[Ite])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>G2)return np(a,503);let l=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${wte("sha1").update(r+kte).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[Ss.extensionName]){let p=t[Ss.extensionName].params,f=V2.format({[Ss.extensionName]:[p]});l.push(`Sec-WebSocket-Extensions: ${f}`),u._extensions=t}this.emit("headers",l,o),a.write(l.concat(`\r
|
|
3
|
+
import{a as q$,b as z$,c as W$}from"./chunk-H42UW6IF.js";import{a as T$,b as E$,c as C$,d as A$,e as M$,f as j$,g as O$,h as H$,i as D$,j as L$}from"./chunk-FHLSLOKH.js";import{a as Vt,b as qu,c as da,d as Vg,e as Gg,f as si}from"./chunk-B32CW3NT.js";import{a as B$,b as $$,c as N$,d as O,e as U$,f as ci,g as J,h as Jg,j as F$}from"./chunk-SAZTOGX6.js";import"./chunk-S4WILIRA.js";import{c as _$}from"./chunk-GIU3Z45P.js";import{a as UB,b as KB,c as BS,d as YB,e as XB,f as QB,g as ZB,h as e$,j as t$}from"./chunk-GRLQHYAU.js";import{A as LS,a as BB,c as $B,g as NB,k as Ng,l as _o,m as FB,n as sa,o as Ug,p as qB,q as oi,r as Fg,s as zB,t as ca,u as qg,v as ai,w as WB,x as VB,y as GB,z as JB}from"./chunk-LI3FTPAH.js";import{a as r$,b as n$,c as zg,d as o$,e as ii,f as qe,g as a$,h as ke,i as i$,j as s$,k as c$,l as d$,m as l$,n as u$,o as p$,p as m$,q as f$,r as h$,s as g$,t as Or,u as Hr,v as Re,w as w$}from"./chunk-S6UCVXBC.js";import{a as y$,b as v$}from"./chunk-QAEZNFAM.js";import{a as b$,b as k$}from"./chunk-M5QPL5NO.js";import{c as DS}from"./chunk-4D3CICBG.js";import{a as I$,b as S$,c as P$}from"./chunk-FS2VKOT7.js";import{a as Wg,b as R$}from"./chunk-5JVJQA5H.js";import"./chunk-U2BD545L.js";import{a as Dg,b as PB,c as RB,d as xB,e as _B}from"./chunk-5Z3AU5CL.js";import{a as ia,c as Ag,d as wd,e as yB,f as vB,g as ur,h as bB,i as jg,j as kB,k as pr,l as Og,m as IB,n as jr,o as Hg,p as SB,r as CB}from"./chunk-MHPCVQOE.js";import{a as Lg,b as TB,c as HS}from"./chunk-4JYTFEND.js";import{b as EB,c as Bg}from"./chunk-55Q64WWF.js";import{a as Kr}from"./chunk-IEVJLG3V.js";import"./chunk-S7A2OGL2.js";import{a as gB,e as Mg}from"./chunk-OW3EOC5Q.js";import{a as rI,b as LC}from"./chunk-EICS777E.js";import{b as MB}from"./chunk-6C3CXME7.js";import{a as jB,b as $g,c as OB,d as HB,e as DB}from"./chunk-HX6GXMDK.js";import{b as LB}from"./chunk-FUFI4THX.js";import{b as hB}from"./chunk-5KWKSR4P.js";import{b as fB,c as jS}from"./chunk-Q3WXB465.js";import"./chunk-5AU5Y6KS.js";import{a as mB}from"./chunk-FEAKTSRS.js";import"./chunk-UK5LGSGT.js";import{a as Fn,b as Cg,c as OS,d as wB}from"./chunk-TPOAAJKA.js";import"./chunk-GDJ4X2ZN.js";import{a as AB}from"./chunk-B666Z2NS.js";import"./chunk-WLQEONBF.js";import"./chunk-YU4JYWCA.js";import{a as aB,b as iB,c as sB}from"./chunk-ZUT4EM64.js";import{a as cB,b as dB,c as _g,d as Tg}from"./chunk-XVDFJ3ZF.js";import{h as oe}from"./chunk-3MVKXAH7.js";import"./chunk-SDO4FC4Q.js";import"./chunk-IR3YJWPW.js";import{a as gs,b as MS,c as nB,d as oB}from"./chunk-3BJ7LPE3.js";import"./chunk-W45RKGM6.js";import"./chunk-LARJARMS.js";import{a as Un,b as KL,c as YL}from"./chunk-MWS2NAHJ.js";import{a as eB,b as xg}from"./chunk-67HXM6AL.js";import"./chunk-JLW5BQVO.js";import{a as Pg,d as Rg,f as tB,g as rB}from"./chunk-ANG2YMMD.js";import{a as ZL}from"./chunk-W22KWKF6.js";import{b as XL,c as QL,d as gd,f as Sg,g as Uu}from"./chunk-YBKDEEEH.js";import{b as Fu,c as aa}from"./chunk-6TRVEA3T.js";import{a as GL,b as JL}from"./chunk-OTUS7NTQ.js";import{b as bg,d as hd,l as jL,n as kg}from"./chunk-V3S2B6WU.js";import{a as UL,d as FL,f as qL,g as zL,h as WL,i as oa,j as VL,k as Ig,n as Nu}from"./chunk-C5B3FMV3.js";import"./chunk-DRMOHADV.js";import{c as VH,d as Qh,i as GH}from"./chunk-FEQ7HNJR.js";import{a as mj,d as fj,g as kj}from"./chunk-LYVHYT3L.js";import{A as hh,c as mh,d as YM,e as XM,f as QM,h as ZM,i as ej,j as tj,p as rj,u as Ya,v as nj,x as oj,z as fh}from"./chunk-OTXGAKFH.js";import{a as uH,b as hH,c as gH,d as $H,e as Xh,f as qH,g as zH,h as WH,i as JH,j as OD,k as $L,m as x$}from"./chunk-UXPO3ZV7.js";import{a as lB}from"./chunk-DSJZS77R.js";import{a as at,b as pH,c as mH,d as gS,e as iD,f as eg,g as tg,h as sD}from"./chunk-HPTEJBP4.js";import{a as uB,b as Eg,c as pB}from"./chunk-D7R2AAX2.js";import{b as sd,c as cd,d as fS}from"./chunk-NTM3KQ25.js";import{b as Yh}from"./chunk-2GJD23CM.js";import{$ as _L,A as LD,B as Io,C as BD,D as $D,E as WD,F as VD,G as GD,H as JD,I as KD,J as iL,K as sL,L as _S,M as cL,N as hL,O as gL,P as wL,Q as vL,R as TS,S as IL,T as wg,U as ms,V as xo,W as $n,X as RL,Y as Bu,Z as xL,_ as Nn,aa as yg,b as wH,ba as TL,c as MH,ca as EL,d as jH,da as lr,e as HH,ea as fs,f as QH,fa as CL,g as ld,ga as na,h as ZH,ha as ES,i as rD,ia as CS,j as nD,ja as $u,k as cD,ka as AS,l as PD,la as vg,m as RD,ma as ML,n as xD,na as OL,o as _D,oa as NL,p as TD,q as bS,r as ED,s as CD,t as AD,u as MD,x as jD,y as HD,z as kS}from"./chunk-JKI53ED7.js";import{g as HL,h as DL,i as LL,j as BL}from"./chunk-EVQISX7M.js";import{a as OH}from"./chunk-PYNW5OFA.js";import{A as IS,B as SS,F as YD,M as SL,a as YH,b as XH,c as hS,m as SD,q as ag}from"./chunk-66HFW4OU.js";import{b as hs,c as AL,d as Pr}from"./chunk-RHMULF56.js";import"./chunk-VFH5C6D2.js";import{a as ID}from"./chunk-AN525SPP.js";import{a as us,b as dS,c as Mu,d as ju,e as ad,f as Vh,g as lS,h as Ou,i as fn,j as CH,k as pe,l as AH,m as pS}from"./chunk-WBO6FQHR.js";import{b as bH}from"./chunk-H5ML7735.js";import"./chunk-SYUKES6H.js";import{a as kL}from"./chunk-UOFDKMRU.js";import{a as NH,b as UH,c as FH,d as Kh}from"./chunk-XHBMK6LC.js";import{B as yL,J as PL,b as BC,z as DD}from"./chunk-6I5AUTVO.js";import{a as KH}from"./chunk-IZ6DLEVY.js";import"./chunk-QJJNHKLT.js";import{b as DH,i as LH,j as BH,m as id,n as mS}from"./chunk-ZU3YBRXS.js";import{a as Au,b as ei}from"./chunk-7XOUM6RK.js";import{a as cS,h as yH,j as vH}from"./chunk-VD2TQCMH.js";import"./chunk-N73MU2C3.js";import"./chunk-DIDQHTAX.js";import"./chunk-Z2TOBS3P.js";import"./chunk-7PXZ4X4P.js";import"./chunk-FAKDGLZQ.js";import{a as oD,b as aD}from"./chunk-GW766ZSO.js";import{a as Sr,b as kH,c as Jr,d as IH,e as Gh,f as Jh,g as uS,h as SH,i as ti,k as PH,l as RH,m as xH,n as _H,o as TH,p as EH}from"./chunk-MCBRB5D6.js";import{a as pL,b as mL,c as fL,d as gg,f as bL}from"./chunk-JD76ANPN.js";import{a as dL,b as Lu,c as lL,d as fg,e as uL,f as hg}from"./chunk-SSJV3VX7.js";import{a as dd}from"./chunk-7KWD2I6W.js";import{A as y0,C as v0,D as b0,E as Dn,d as n0,e as o0,f as a0,g as i0,h as II,i as s0,j as c0,k as d0,l as l0,m as u0,n as Ff,o as p0,p as SI,q as m0,r as f0,s as Wt,t as h0,u as ot,v as wt,w as g0,x as w0,y as pu,z as qf}from"./chunk-4TTXNVCE.js";import{c as hD,d as wS,e as gD,f as wD,g as yD,h as vD,i as pd,j as og,k as ko,l as bD,m as yS,n as kD,o as vS}from"./chunk-HNDAGZCF.js";import{A as fD,C as ng,b as Zh,d as eD,e as tD,h as dD,k as lD,l as uD,m as ud,n as pD,p as rg,q as mD,s as Hu}from"./chunk-YU3C6U5V.js";import"./chunk-OPTJYDZN.js";import{a as ri}from"./chunk-KVTBX2UP.js";import{a as ge,b as Ot,c as od,d as ce,f as fH}from"./chunk-BJXPQIVD.js";import"./chunk-QYQZQVVN.js";import{A as ni,B as xS,C as lg,D as rL,E as ug,F as nL,G as Du,J as pg,K as oL,L as mg,M as aL,N as fd,d as ND,f as UD,g as FD,h as qD,i as zD,m as ig,n as sg,o as XD,p as QD,q as md,r as ZD,s as PS,t as eL,u as cg,v as dg,w as Ro,x as ps,y as RS,z as tL}from"./chunk-GFAI2MCJ.js";import"./chunk-VS2LOUCT.js";import"./chunk-DMFUEUAZ.js";import{a as So,b as Po,c as Ht}from"./chunk-GF55VEMR.js";import{a as YQ,b as NC,c as nI,d as oI}from"./chunk-LZPCA6DH.js";import{b as qc,c as r0}from"./chunk-L3KS6MOV.js";import"./chunk-GUG2SWRZ.js";import"./chunk-G4747MOW.js";import"./chunk-KCJVFLBB.js";import{$ as yO,$a as GO,$b as Tu,A as Vj,Aa as EO,Ac as Wh,Ba as CO,Ca as AO,Cb as $h,Db as V1,E as Gj,Ea as ed,Eb as G1,F as Jj,Fa as MO,Fb as bo,G as Sh,Gb as J1,H as Kj,Ha as ku,Hb as ls,I as nO,Ia as Eh,Ib as K1,J as oO,Ja as jO,K as wo,Ka as QI,La as OO,M as aO,Ma as HO,N as iO,Na as ZI,O as sO,Oa as DO,P as cO,Pa as LO,Q as dO,Qa as BO,Ra as $O,S as lO,Sa as NO,T as Ph,Ta as UO,U as uO,Ua as FO,V as pO,Va as eS,Vb as Y1,W as mO,Wa as qO,X as fO,Xa as zO,Xb as X1,Y as hO,Ya as WO,Yb as xu,Z as gO,Za as VO,Zb as Q1,_ as wO,_a as tS,_b as _u,aa as vO,ab as JO,ac as sS,b as Xc,ba as bO,bb as KO,bc as Z1,ca as kO,cb as YO,cc as Eu,da as IO,db as XO,dc as eH,e as jj,ea as SO,eb as QO,ec as Nh,fb as ZO,fc as tH,g as JI,ga as Rh,gb as e1,gc as rH,h as Oj,ha as PO,hb as t1,hc as nH,i as Ir,ia as Ln,ic as oH,j as yu,ja as xh,jc as Uh,k as is,ka as XI,kb as r1,kc as Fh,l as KI,la as _h,lb as n1,m as Hj,mb as o1,n as Dj,na as Th,nb as a1,nc as aH,o as Lj,oa as vu,ob as i1,p as Bj,pb as Iu,pc as Za,q as $j,qa as RO,r as Nj,rb as Ch,rc as qh,s as Ih,sb as s1,sc as iH,ta as Zc,tb as c1,tc as Cu,ua as yo,ub as d1,uc as zh,v as ra,va as xO,vb as ss,vc as sH,w as Qc,wa as bu,wb as l1,wc as cH,x as zj,y as Wj,ya as _O,yb as W1,yc as dH,za as TO,zc as lH}from"./chunk-MVPKU72J.js";import{d as t0}from"./chunk-OQPJ7FJF.js";import"./chunk-BL3CZWWD.js";import{b as Uj,c as kh}from"./chunk-GD3RCUDH.js";import{$ as ds,A as dr,C as R1,D as x1,E as _1,F as iS,G as T1,H as E1,I as C1,K as Oh,L as A1,a as Ah,aa as M1,b as u1,ba as Bn,c as rS,ca as j1,d as vo,da as O1,e as p1,ea as H1,f as m1,fa as Xa,g as f1,ga as rd,h as nS,ha as Hh,i as cs,ia as D1,j as h1,ja as L1,k as g1,ka as B1,l as w1,la as Pu,m as oS,ma as nd,n as Su,na as Dh,o as y1,oa as $1,p as Mh,pa as Lh,q as v1,qa as Qa,r as b1,ra as N1,s as td,sa as U1,t as k1,ta as F1,u as jh,ua as Bh,v as I1,va as q1,w as S1,wa as Ru,x as aS,xa as z1,z as P1}from"./chunk-QCJY6FTC.js";import"./chunk-UTIELP6F.js";import{g as Ij,j as Sj,l as Yc,m as Pj,o as yh,s as vh}from"./chunk-6S2MWJVD.js";import{b as Yj,c as Xj,d as Qj,e as Zj,f as eO,g as tO,h as rO}from"./chunk-FYWQWKVS.js";import{e as Fj,g as qj,h as YI,j as lt}from"./chunk-6ESBAHWK.js";import"./chunk-4V73I4OL.js";import"./chunk-LE75SVEL.js";import"./chunk-7J2NMUTK.js";import"./chunk-W45RKGM6.js";import"./chunk-W45RKGM6.js";import{a as Rj,b as xj,c as _j,d as Tj,e as Ej,f as Cj,g as Mr,h as Aj,j as bh,k as Mj}from"./chunk-7PKTCMZ6.js";import{a as wu}from"./chunk-LXZLLTYQ.js";import"./chunk-GI7LTJV3.js";import{b as wh,c as wj,e as yj,f as gu,g as VI,k as GI,l as vj,m as bj}from"./chunk-VS3AMJEK.js";import"./chunk-XGY4OQLC.js";import{d as lj,h as uj,i as pj}from"./chunk-AF3AVDPP.js";import{a as XQ}from"./chunk-JFXINDOQ.js";import"./chunk-SFR32TMJ.js";import{b as hj,l as gj}from"./chunk-5KJMFK65.js";import{B as Kc,b as as,c as aj,h as ij,i as kr,t as Jc,v as sj,w as cj,x as gh,y as dj}from"./chunk-Y3B6ZUE6.js";import{c as SA}from"./chunk-4N4EH3RJ.js";import"./chunk-ULJZ7NUF.js";import{a as QA,b as ZA,c as mn,d as Nf,e as ns,f as uu,g as kI,h as Uf,i as e0,k as zf,n as k0}from"./chunk-WJSJXK2N.js";import"./chunk-SBQ6KLXB.js";import{b as Z0,c as eM,f as tM,g as rM,h as nM}from"./chunk-CYQLXS2U.js";import{a as Q0,b as Kf}from"./chunk-O6ZYDHEJ.js";import{d as Gc,e as hu,f as GM,g as JM,h as KM,j as zI,l as WI}from"./chunk-OKEC2EIE.js";import{$a as fu,Ab as UI,Ba as th,C as gM,Ca as Gr,Da as _M,Eb as DM,F as Wc,Fa as rh,Fb as LM,Gb as Vc,H as wM,Hb as BM,Ib as $M,J as yM,Jb as lh,Kb as uh,L as vM,Lb as ph,Mb as NM,N as bM,Nb as FI,O as kM,Oa as Ja,Ob as UM,Qb as FM,Rb as qM,Sb as qI,Ta as TM,Tb as zM,Ua as EM,Ub as WM,Va as CM,Vb as Ka,W as IM,Wa as nh,Wb as VM,Xa as oh,Xb as It,Ya as MI,Za as jI,aa as Ga,ab as AM,ba as SM,c as oM,cb as MM,db as jM,fb as ah,ga as PM,gb as OM,ha as RM,i as aM,ib as HM,ja as it,l as dM,m as lM,n as uM,nb as ih,o as pM,oa as Zf,p as mM,pb as sh,q as Xf,qb as ch,r as AI,rb as ta,s as fM,sb as OI,t as hM,tb as HI,u as Qf,ub as dh,vb as DI,wa as go,wb as LI,xa as xM,xb as BI,yb as $I,za as eh,zb as NI}from"./chunk-WLZJOCLA.js";import{f as TI,m as zc}from"./chunk-HIQPGYVH.js";import{D as mu,F as sM,G as Yf,J as cM,N as CI,O as Va,b as EI,i as cr,j as os,q as Vr,x as iM}from"./chunk-ZWW227M3.js";import"./chunk-DXA2UHBE.js";import"./chunk-MTP3B2SU.js";import"./chunk-27JGS3KB.js";import{a as J0,b as Y0}from"./chunk-UN2LKLGV.js";import"./chunk-2LJCJOJ7.js";import"./chunk-AMC4Z7G4.js";import{b as K0,e as X0}from"./chunk-LK77GI6M.js";import{k as tI}from"./chunk-HVM2GUM3.js";import{d as kA,e as IA,g as XA}from"./chunk-JCLTFDVW.js";import"./chunk-I6VMRQF4.js";import{Ga as B0,Ia as Gf,P as R0,Pa as PI,Ra as $0,Ta as N0,Ua as Jf,Va as U0,Za as F0,ab as q0,ba as x0,d as I0,eb as RI,f as Wf,gb as xI,ha as D0,ib as z0,jb as W0,kb as V0,l as S0,lb as _I,m as P0,na as L0,sb as G0}from"./chunk-QAFXQHHG.js";import{A as E0,E as C0,F as A0,G as Vf,H as M0,I as j0,J as O0,N as H0,h as _0,z as T0}from"./chunk-OKKNDQJF.js";import"./chunk-AJXWJLZA.js";import{a as lu}from"./chunk-6FA3GG5B.js";import{Ab as Qo,Bb as Nc,E as dA,Gb as wA,Ib as yA,K as We,L as kt,N as lA,Nb as vA,P as uA,R as ho,Sa as Mf,Ub as bA,aa as pA,ca as mA,d as aA,g as iA,i as sA,j as cA,lb as fA,mb as za,nb as ft,ob as hA,rb as gA,zb as $c}from"./chunk-G4E3WGLM.js";import{$a as Cf,A as Tf,Aa as Me,B as aI,C as Qi,Cb as rA,D as Zi,Db as nA,Eb as oA,F as FC,Fb as Af,H as qC,I as zC,Ja as GC,La as JC,M as iI,N as sI,O as cI,Oa as KC,P as dI,Q as lI,R as uI,Ra as YC,S as pI,Sa as XC,T as mI,Wa as QC,a as $C,bb as hI,fb as ZC,ga as WC,hb as eA,kb as tA,n as UC,o as Pf,p as Rf,q as xf,qa as Ef,r as _f,ra as VC,v as qa,va as fI}from"./chunk-ZY32SZ2P.js";import{q as DC,r as Bc,s as Sf}from"./chunk-OTDDXEQ6.js";import"./chunk-ECOH24MC.js";import{C as $A,D as NA,I as qA,K as wI,L as yI,M as zA,S as vI,U as WA,V as bI,Z as VA,_ as GA,ca as JA,da as KA,f as cu,fa as rs,ga as YA,ha as $f,v as Fc,x as du}from"./chunk-SH7POUVX.js";import{M as Uc,O as HA,Q as DA,R as LA,S as BA,a as ts,b as xA,c as Wa,d as pn,e as _A,f as Of,g as TA,h as EA,i as Hf,j as Df,l as CA,m as AA,n as MA,o as jA,p as OA,z as gI}from"./chunk-2MEOUS24.js";import{b as HC,d as If,e as Hn,f as jt}from"./chunk-HNQPEOJD.js";import{g as bf,h as eI,i as OC,l as Qe,m as Ee,n as C,o as kf}from"./chunk-RCT3O3HQ.js";import"./chunk-ZFJWA4JK.js";import{A as v,d as pt}from"./chunk-X2J2P5ZT.js";import{a as PA,c as es,f as jf,h as su,i as RA,m as Lf,p as UA,r as Zo,s as FA,t as ea,u as Bf}from"./chunk-UGOK7VTC.js";import{a as i,b as $e,c as He,e as un}from"./chunk-FTQLQJQV.js";var la=He((Z_e,QN)=>{"use strict";var YN=["nodebuffer","arraybuffer","fragments"],XN=typeof Blob<"u";XN&&YN.push("blob");QN.exports={BINARY_TYPES:YN,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:XN,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:i(()=>{},"NOOP")}});var Xu=He((tTe,nw)=>{"use strict";var{EMPTY_BUFFER:aee}=la(),sP=Buffer[Symbol.species];function iee(e,t){if(e.length===0)return aee;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 sP(r.buffer,r.byteOffset,n):r}i(iee,"concat");function ZN(e,t,r,n,o){for(let a=0;a<o;a++)r[n+a]=e[a]^t[a&3]}i(ZN,"_mask");function e2(e,t){for(let r=0;r<e.length;r++)e[r]^=t[r&3]}i(e2,"_unmask");function see(e){return e.length===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.length)}i(see,"toArrayBuffer");function cP(e){if(cP.readOnly=!0,Buffer.isBuffer(e))return e;let t;return e instanceof ArrayBuffer?t=new sP(e):ArrayBuffer.isView(e)?t=new sP(e.buffer,e.byteOffset,e.byteLength):(t=Buffer.from(e),cP.readOnly=!1),t}i(cP,"toBuffer");nw.exports={concat:iee,mask:ZN,toArrayBuffer:see,toBuffer:cP,unmask:e2};if(!process.env.WS_NO_BUFFER_UTIL)try{let e=$e("bufferutil");nw.exports.mask=function(t,r,n,o,a){a<48?ZN(t,r,n,o,a):e.mask(t,r,n,o,a)},nw.exports.unmask=function(t,r){t.length<32?e2(t,r):e.unmask(t,r)}}catch{}});var n2=He((nTe,r2)=>{"use strict";var t2=Symbol("kDone"),dP=Symbol("kRun"),lP=class{static{i(this,"Limiter")}constructor(t){this[t2]=()=>{this.pending--,this[dP]()},this.concurrency=t||1/0,this.jobs=[],this.pending=0}add(t){this.jobs.push(t),this[dP]()}[dP](){if(this.pending!==this.concurrency&&this.jobs.length){let t=this.jobs.shift();this.pending++,t(this[t2])}}};r2.exports=lP});var Rd=He((aTe,s2)=>{"use strict";var Qu=$e("zlib"),o2=Xu(),cee=n2(),{kStatusCode:a2}=la(),dee=Buffer[Symbol.species],lee=Buffer.from([0,0,255,255]),aw=Symbol("permessage-deflate"),ua=Symbol("total-length"),Sd=Symbol("callback"),pi=Symbol("buffers"),Pd=Symbol("error"),ow,uP=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,!ow){let r=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;ow=new cee(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[Sd];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){ow.add(o=>{this._decompress(t,r,(a,s)=>{o(),n(a,s)})})}compress(t,r,n){ow.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"?Qu.Z_DEFAULT_WINDOWBITS:this.params[a];this._inflate=Qu.createInflateRaw({...this._options.zlibInflateOptions,windowBits:s}),this._inflate[aw]=this,this._inflate[ua]=0,this._inflate[pi]=[],this._inflate.on("error",pee),this._inflate.on("data",i2)}this._inflate[Sd]=n,this._inflate.write(t),r&&this._inflate.write(lee),this._inflate.flush(()=>{let a=this._inflate[Pd];if(a){this._inflate.close(),this._inflate=null,n(a);return}let s=o2.concat(this._inflate[pi],this._inflate[ua]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[ua]=0,this._inflate[pi]=[],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"?Qu.Z_DEFAULT_WINDOWBITS:this.params[a];this._deflate=Qu.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:s}),this._deflate[ua]=0,this._deflate[pi]=[],this._deflate.on("data",uee)}this._deflate[Sd]=n,this._deflate.write(t),this._deflate.flush(Qu.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let a=o2.concat(this._deflate[pi],this._deflate[ua]);r&&(a=new dee(a.buffer,a.byteOffset,a.length-4)),this._deflate[Sd]=null,this._deflate[ua]=0,this._deflate[pi]=[],r&&this.params[`${o}_no_context_takeover`]&&this._deflate.reset(),n(null,a)})}};s2.exports=uP;function uee(e){this[pi].push(e),this[ua]+=e.length}i(uee,"deflateOnData");function i2(e){if(this[ua]+=e.length,this[aw]._maxPayload<1||this[ua]<=this[aw]._maxPayload){this[pi].push(e);return}this[Pd]=new RangeError("Max payload size exceeded"),this[Pd].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[Pd][a2]=1009,this.removeListener("data",i2),this.reset()}i(i2,"inflateOnData");function pee(e){if(this[aw]._inflate=null,this[Pd]){this[Sd](this[Pd]);return}e[a2]=1007,this[Sd](e)}i(pee,"inflateOnError")});var xd=He((sTe,iw)=>{"use strict";var{isUtf8:c2}=$e("buffer"),{hasBlob:mee}=la(),fee=[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 hee(e){return e>=1e3&&e<=1014&&e!==1004&&e!==1005&&e!==1006||e>=3e3&&e<=4999}i(hee,"isValidStatusCode");function pP(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(pP,"_isValidUTF8");function gee(e){return mee&&typeof e=="object"&&typeof e.arrayBuffer=="function"&&typeof e.type=="string"&&typeof e.stream=="function"&&(e[Symbol.toStringTag]==="Blob"||e[Symbol.toStringTag]==="File")}i(gee,"isBlob");iw.exports={isBlob:gee,isValidStatusCode:hee,isValidUTF8:pP,tokenChars:fee};if(c2)iw.exports.isValidUTF8=function(e){return e.length<24?pP(e):c2(e)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let e=$e("utf-8-validate");iw.exports.isValidUTF8=function(t){return t.length<32?pP(t):e(t)}}catch{}});var wP=He((dTe,h2)=>{"use strict";var{Writable:wee}=$e("stream"),d2=Rd(),{BINARY_TYPES:yee,EMPTY_BUFFER:l2,kStatusCode:vee,kWebSocket:bee}=la(),{concat:mP,toArrayBuffer:kee,unmask:Iee}=Xu(),{isValidStatusCode:See,isValidUTF8:u2}=xd(),sw=Buffer[Symbol.species],gn=0,p2=1,m2=2,f2=3,fP=4,hP=5,cw=6,gP=class extends wee{static{i(this,"Receiver")}constructor(t={}){super(),this._allowSynchronousEvents=t.allowSynchronousEvents!==void 0?t.allowSynchronousEvents:!0,this._binaryType=t.binaryType||yee[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[bee]=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=gn}_write(t,r,n){if(this._opcode===8&&this._state==gn)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 sw(n.buffer,n.byteOffset+t,n.length-t),new sw(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 sw(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 gn:this.getInfo(t);break;case p2:this.getPayloadLength16(t);break;case m2:this.getPayloadLength64(t);break;case f2:this.getMask();break;case fP:this.getData(t);break;case hP:case cw: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[d2.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=p2:this._payloadLength===127?this._state=m2: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=f2:this._state=fP}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=fP}getData(t){let r=l2;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&&Iee(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=hP,this.decompress(r,t);return}r.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(r)),this.dataMessage(t)}decompress(t,r){this._extensions[d2.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===gn&&this.startLoop(r)})}dataMessage(t){if(!this._fin){this._state=gn;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=mP(n,r):this._binaryType==="arraybuffer"?o=kee(mP(n,r)):this._binaryType==="blob"?o=new Blob(n):o=n,this._allowSynchronousEvents?(this.emit("message",o,!0),this._state=gn):(this._state=cw,setImmediate(()=>{this.emit("message",o,!0),this._state=gn,this.startLoop(t)}))}else{let o=mP(n,r);if(!this._skipUTF8Validation&&!u2(o)){let a=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");t(a);return}this._state===hP||this._allowSynchronousEvents?(this.emit("message",o,!1),this._state=gn):(this._state=cw,setImmediate(()=>{this.emit("message",o,!1),this._state=gn,this.startLoop(t)}))}}controlMessage(t,r){if(this._opcode===8){if(t.length===0)this._loop=!1,this.emit("conclude",1005,l2),this.end();else{let n=t.readUInt16BE(0);if(!See(n)){let a=this.createError(RangeError,`invalid status code ${n}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");r(a);return}let o=new sw(t.buffer,t.byteOffset+2,t.length-2);if(!this._skipUTF8Validation&&!u2(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=gn;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?"ping":"pong",t),this._state=gn):(this._state=cw,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",t),this._state=gn,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[vee]=o,s}};h2.exports=gP});var bP=He((pTe,y2)=>{"use strict";var{Duplex:uTe}=$e("stream"),{randomFillSync:Pee}=$e("crypto"),{types:{isUint8Array:Ree}}=$e("util"),g2=Rd(),{EMPTY_BUFFER:xee,kWebSocket:_ee,NOOP:Tee}=la(),{isBlob:_d,isValidStatusCode:Eee}=xd(),{mask:w2,toBuffer:bs}=Xu(),wn=Symbol("kByteLength"),Cee=Buffer.alloc(4),dw=8*1024,ks,Td=dw,qn=0,Aee=1,Mee=2,yP=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=qn,this.onerror=Tee,this[_ee]=void 0}static frame(t,r){let n,o=!1,a=2,s=!1;r.mask&&(n=r.maskBuffer||Cee,r.generateMask?r.generateMask(n):(Td===dw&&(ks===void 0&&(ks=Buffer.alloc(dw)),Pee(ks,0,dw),Td=0),n[0]=ks[Td++],n[1]=ks[Td++],n[2]=ks[Td++],n[3]=ks[Td++]),s=(n[0]|n[1]|n[2]|n[3])===0,a=6);let c;typeof t=="string"?(!r.mask||s)&&r[wn]!==void 0?c=r[wn]:(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?(w2(t,n,l,a,c),[l]):(w2(t,n,t,0,c),[l,t])):[l,t]}close(t,r,n,o){let a;if(t===void 0)a=xee;else{if(typeof t!="number"||!Eee(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(Ree(r))a.set(r,2);else throw new TypeError("Second argument must be a string or a Uint8Array")}}let s={[wn]:a.length,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state!==qn?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):_d(t)?(o=t.size,a=!1):(t=bs(t),o=t.length,a=bs.readOnly),o>125)throw new RangeError("The data size must not be greater than 125 bytes");let s={[wn]:o,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:9,readOnly:a,rsv1:!1};_d(t)?this._state!==qn?this.enqueue([this.getBlobData,t,!1,s,n]):this.getBlobData(t,!1,s,n):this._state!==qn?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):_d(t)?(o=t.size,a=!1):(t=bs(t),o=t.length,a=bs.readOnly),o>125)throw new RangeError("The data size must not be greater than 125 bytes");let s={[wn]:o,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:10,readOnly:a,rsv1:!1};_d(t)?this._state!==qn?this.enqueue([this.getBlobData,t,!1,s,n]):this.getBlobData(t,!1,s,n):this._state!==qn?this.enqueue([this.dispatch,t,!1,s,n]):this.sendFrame(e.frame(t,s),n)}send(t,r,n){let o=this._extensions[g2.extensionName],a=r.binary?2:1,s=r.compress,c,d;typeof t=="string"?(c=Buffer.byteLength(t),d=!1):_d(t)?(c=t.size,d=!1):(t=bs(t),c=t.length,d=bs.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={[wn]:c,fin:r.fin,generateMask:this._generateMask,mask:r.mask,maskBuffer:this._maskBuffer,opcode:a,readOnly:d,rsv1:s};_d(t)?this._state!==qn?this.enqueue([this.getBlobData,t,this._compress,l,n]):this.getBlobData(t,this._compress,l,n):this._state!==qn?this.enqueue([this.dispatch,t,this._compress,l,n]):this.dispatch(t,this._compress,l,n)}getBlobData(t,r,n,o){this._bufferedBytes+=n[wn],this._state=Mee,t.arrayBuffer().then(a=>{if(this._socket.destroyed){let c=new Error("The socket was closed while the blob was being read");process.nextTick(vP,this,c,o);return}this._bufferedBytes-=n[wn];let s=bs(a);r?this.dispatch(s,r,n,o):(this._state=qn,this.sendFrame(e.frame(s,n),o),this.dequeue())}).catch(a=>{process.nextTick(jee,this,a,o)})}dispatch(t,r,n,o){if(!r){this.sendFrame(e.frame(t,n),o);return}let a=this._extensions[g2.extensionName];this._bufferedBytes+=n[wn],this._state=Aee,a.compress(t,n.fin,(s,c)=>{if(this._socket.destroyed){let d=new Error("The socket was closed while data was being compressed");vP(this,d,o);return}this._bufferedBytes-=n[wn],this._state=qn,n.readOnly=!1,this.sendFrame(e.frame(c,n),o),this.dequeue()})}dequeue(){for(;this._state===qn&&this._queue.length;){let t=this._queue.shift();this._bufferedBytes-=t[3][wn],Reflect.apply(t[0],this,t.slice(1))}}enqueue(t){this._bufferedBytes+=t[3][wn],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)}};y2.exports=yP;function vP(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(vP,"callCallbacks");function jee(e,t,r){vP(e,t,r),e.onerror(t)}i(jee,"onError")});var _2=He((fTe,x2)=>{"use strict";var{kForOnEventAttribute:Zu,kListener:kP}=la(),v2=Symbol("kCode"),b2=Symbol("kData"),k2=Symbol("kError"),I2=Symbol("kMessage"),S2=Symbol("kReason"),Ed=Symbol("kTarget"),P2=Symbol("kType"),R2=Symbol("kWasClean"),pa=class{static{i(this,"Event")}constructor(t){this[Ed]=null,this[P2]=t}get target(){return this[Ed]}get type(){return this[P2]}};Object.defineProperty(pa.prototype,"target",{enumerable:!0});Object.defineProperty(pa.prototype,"type",{enumerable:!0});var Is=class extends pa{static{i(this,"CloseEvent")}constructor(t,r={}){super(t),this[v2]=r.code===void 0?0:r.code,this[S2]=r.reason===void 0?"":r.reason,this[R2]=r.wasClean===void 0?!1:r.wasClean}get code(){return this[v2]}get reason(){return this[S2]}get wasClean(){return this[R2]}};Object.defineProperty(Is.prototype,"code",{enumerable:!0});Object.defineProperty(Is.prototype,"reason",{enumerable:!0});Object.defineProperty(Is.prototype,"wasClean",{enumerable:!0});var Cd=class extends pa{static{i(this,"ErrorEvent")}constructor(t,r={}){super(t),this[k2]=r.error===void 0?null:r.error,this[I2]=r.message===void 0?"":r.message}get error(){return this[k2]}get message(){return this[I2]}};Object.defineProperty(Cd.prototype,"error",{enumerable:!0});Object.defineProperty(Cd.prototype,"message",{enumerable:!0});var ep=class extends pa{static{i(this,"MessageEvent")}constructor(t,r={}){super(t),this[b2]=r.data===void 0?null:r.data}get data(){return this[b2]}};Object.defineProperty(ep.prototype,"data",{enumerable:!0});var Oee={addEventListener(e,t,r={}){for(let o of this.listeners(e))if(!r[Zu]&&o[kP]===t&&!o[Zu])return;let n;if(e==="message")n=i(function(a,s){let c=new ep("message",{data:s?a:a.toString()});c[Ed]=this,lw(t,this,c)},"onMessage");else if(e==="close")n=i(function(a,s){let c=new Is("close",{code:a,reason:s.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});c[Ed]=this,lw(t,this,c)},"onClose");else if(e==="error")n=i(function(a){let s=new Cd("error",{error:a,message:a.message});s[Ed]=this,lw(t,this,s)},"onError");else if(e==="open")n=i(function(){let a=new pa("open");a[Ed]=this,lw(t,this,a)},"onOpen");else return;n[Zu]=!!r[Zu],n[kP]=t,r.once?this.once(e,n):this.on(e,n)},removeEventListener(e,t){for(let r of this.listeners(e))if(r[kP]===t&&!r[Zu]){this.removeListener(e,r);break}}};x2.exports={CloseEvent:Is,ErrorEvent:Cd,Event:pa,EventTarget:Oee,MessageEvent:ep};function lw(e,t,r){typeof e=="object"&&e.handleEvent?e.handleEvent.call(e,r):e.call(t,r)}i(lw,"callListener")});var uw=He((gTe,T2)=>{"use strict";var{tokenChars:tp}=xd();function To(e,t,r){e[t]===void 0?e[t]=[r]:e[t].push(r)}i(To,"push");function Hee(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&&tp[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 w=e.slice(d,u);l===44?(To(t,w,r),r=Object.create(null)):s=w,d=u=-1}else throw new SyntaxError(`Unexpected character at index ${p}`);else if(c===void 0)if(u===-1&&tp[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),To(r,e.slice(d,u),!0),l===44&&(To(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(tp[l]!==1)throw new SyntaxError(`Unexpected character at index ${p}`);d===-1?d=p:n||(n=!0),o=!1}else if(a)if(tp[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&&tp[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 w=e.slice(d,u);n&&(w=w.replace(/\\/g,""),n=!1),To(r,c,w),l===44&&(To(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 f=e.slice(d,u);return s===void 0?To(t,f,r):(c===void 0?To(r,f,!0):n?To(r,c,f.replace(/\\/g,"")):To(r,c,f),To(t,s,r)),t}i(Hee,"parse");function Dee(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(Dee,"format");T2.exports={format:Dee,parse:Hee}});var hw=He((bTe,N2)=>{"use strict";var Lee=$e("events"),Bee=$e("https"),$ee=$e("http"),A2=$e("net"),Nee=$e("tls"),{randomBytes:Uee,createHash:Fee}=$e("crypto"),{Duplex:yTe,Readable:vTe}=$e("stream"),{URL:IP}=$e("url"),mi=Rd(),qee=wP(),zee=bP(),{isBlob:Wee}=xd(),{BINARY_TYPES:E2,CLOSE_TIMEOUT:Vee,EMPTY_BUFFER:pw,GUID:Gee,kForOnEventAttribute:SP,kListener:Jee,kStatusCode:Kee,kWebSocket:Dt,NOOP:M2}=la(),{EventTarget:{addEventListener:Yee,removeEventListener:Xee}}=_2(),{format:Qee,parse:Zee}=uw(),{toBuffer:ete}=Xu(),j2=Symbol("kAborted"),PP=[8,13],ma=["CONNECTING","OPEN","CLOSING","CLOSED"],tte=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,ut=class e extends Lee{static{i(this,"WebSocket")}constructor(t,r,n){super(),this._binaryType=E2[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=pw,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]),O2(this,t,r,n)):(this._autoPong=n.autoPong,this._closeTimeout=n.closeTimeout,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(t){E2.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 qee({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 zee(t,this._extensions,n.generateMask);this._receiver=o,this._sender=a,this._socket=t,o[Dt]=this,a[Dt]=this,t[Dt]=this,o.on("conclude",ote),o.on("drain",ate),o.on("error",ite),o.on("message",ste),o.on("ping",cte),o.on("pong",dte),a.onerror=lte,t.setTimeout&&t.setTimeout(0),t.setNoDelay&&t.setNoDelay(),r.length>0&&t.unshift(r),t.on("close",L2),t.on("data",fw),t.on("end",B2),t.on("error",$2),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[mi.extensionName]&&this._extensions[mi.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){Yr(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())}),D2(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){RP(this,t,n);return}r===void 0&&(r=!this._isServer),this._sender.ping(t||pw,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){RP(this,t,n);return}r===void 0&&(r=!this._isServer),this._sender.pong(t||pw,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){RP(this,t,n);return}let o={binary:typeof t!="string",mask:!this._isServer,compress:!0,fin:!0,...r};this._extensions[mi.extensionName]||(o.compress=!1),this._sender.send(t||pw,o,n)}terminate(){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){Yr(this,this._req,"WebSocket was closed before the connection was established");return}this._socket&&(this._readyState=e.CLOSING,this._socket.destroy())}}};Object.defineProperty(ut,"CONNECTING",{enumerable:!0,value:ma.indexOf("CONNECTING")});Object.defineProperty(ut.prototype,"CONNECTING",{enumerable:!0,value:ma.indexOf("CONNECTING")});Object.defineProperty(ut,"OPEN",{enumerable:!0,value:ma.indexOf("OPEN")});Object.defineProperty(ut.prototype,"OPEN",{enumerable:!0,value:ma.indexOf("OPEN")});Object.defineProperty(ut,"CLOSING",{enumerable:!0,value:ma.indexOf("CLOSING")});Object.defineProperty(ut.prototype,"CLOSING",{enumerable:!0,value:ma.indexOf("CLOSING")});Object.defineProperty(ut,"CLOSED",{enumerable:!0,value:ma.indexOf("CLOSED")});Object.defineProperty(ut.prototype,"CLOSED",{enumerable:!0,value:ma.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(e=>{Object.defineProperty(ut.prototype,e,{enumerable:!0})});["open","error","close","message"].forEach(e=>{Object.defineProperty(ut.prototype,`on${e}`,{enumerable:!0,get(){for(let t of this.listeners(e))if(t[SP])return t[Jee];return null},set(t){for(let r of this.listeners(e))if(r[SP]){this.removeListener(e,r);break}typeof t=="function"&&this.addEventListener(e,t,{[SP]:!0})}})});ut.prototype.addEventListener=Yee;ut.prototype.removeEventListener=Xee;N2.exports=ut;function O2(e,t,r,n){let o={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:Vee,protocolVersion:PP[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,!PP.includes(o.protocolVersion))throw new RangeError(`Unsupported protocol version: ${o.protocolVersion} (supported versions: ${PP.join(", ")})`);let a;if(t instanceof IP)a=t;else try{a=new IP(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;mw(e,h);return}let l=s?443:80,u=Uee(16).toString("base64"),p=s?Bee.request:$ee.request,f=new Set,w;if(o.createConnection=o.createConnection||(s?nte:rte),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&&(w=new mi({...o.perMessageDeflate,isServer:!1,maxPayload:o.maxPayload}),o.headers["Sec-WebSocket-Extensions"]=Qee({[mi.extensionName]:w.offer()})),r.length){for(let h of r){if(typeof h!="string"||!tte.test(h)||f.has(h))throw new SyntaxError("An invalid or duplicated subprotocol was specified");f.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 g;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,m]of Object.entries(h))n.headers[y.toLowerCase()]=m}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")),g=e._req=p(o),e._redirects&&e.emit("redirect",e.url,g)}else g=e._req=p(o);o.timeout&&g.on("timeout",()=>{Yr(e,g,"Opening handshake has timed out")}),g.on("error",h=>{g===null||g[j2]||(g=e._req=null,mw(e,h))}),g.on("response",h=>{let y=h.headers.location,m=h.statusCode;if(y&&o.followRedirects&&m>=300&&m<400){if(++e._redirects>o.maxRedirects){Yr(e,g,"Maximum redirects exceeded");return}g.abort();let I;try{I=new IP(y,t)}catch{let k=new SyntaxError(`Invalid URL: ${y}`);mw(e,k);return}O2(e,I,r,n)}else e.emit("unexpected-response",g,h)||Yr(e,g,`Unexpected server response: ${h.statusCode}`)}),g.on("upgrade",(h,y,m)=>{if(e.emit("upgrade",h),e.readyState!==ut.CONNECTING)return;g=e._req=null;let I=h.headers.upgrade;if(I===void 0||I.toLowerCase()!=="websocket"){Yr(e,y,"Invalid Upgrade header");return}let S=Fee("sha1").update(u+Gee).digest("base64");if(h.headers["sec-websocket-accept"]!==S){Yr(e,y,"Invalid Sec-WebSocket-Accept header");return}let k=h.headers["sec-websocket-protocol"],b;if(k!==void 0?f.size?f.has(k)||(b="Server sent an invalid subprotocol"):b="Server sent a subprotocol but none was requested":f.size&&(b="Server sent no subprotocol"),b){Yr(e,y,b);return}k&&(e._protocol=k);let R=h.headers["sec-websocket-extensions"];if(R!==void 0){if(!w){Yr(e,y,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let _;try{_=Zee(R)}catch{Yr(e,y,"Invalid Sec-WebSocket-Extensions header");return}let P=Object.keys(_);if(P.length!==1||P[0]!==mi.extensionName){Yr(e,y,"Server indicated an extension that was not requested");return}try{w.accept(_[mi.extensionName])}catch{Yr(e,y,"Invalid Sec-WebSocket-Extensions header");return}e._extensions[mi.extensionName]=w}e.setSocket(y,m,{allowSynchronousEvents:o.allowSynchronousEvents,generateMask:o.generateMask,maxBufferedChunks:o.maxBufferedChunks,maxFragments:o.maxFragments,maxPayload:o.maxPayload,skipUTF8Validation:o.skipUTF8Validation})}),o.finishRequest?o.finishRequest(g,e):g.end()}i(O2,"initAsClient");function mw(e,t){e._readyState=ut.CLOSING,e._errorEmitted=!0,e.emit("error",t),e.emitClose()}i(mw,"emitErrorAndClose");function rte(e){return e.path=e.socketPath,A2.connect(e)}i(rte,"netConnect");function nte(e){return e.path=void 0,!e.servername&&e.servername!==""&&(e.servername=A2.isIP(e.host)?"":e.host),Nee.connect(e)}i(nte,"tlsConnect");function Yr(e,t,r){e._readyState=ut.CLOSING;let n=new Error(r);Error.captureStackTrace(n,Yr),t.setHeader?(t[j2]=!0,t.abort(),t.socket&&!t.socket.destroyed&&t.socket.destroy(),process.nextTick(mw,e,n)):(t.destroy(n),t.once("error",e.emit.bind(e,"error")),t.once("close",e.emitClose.bind(e)))}i(Yr,"abortHandshake");function RP(e,t,r){if(t){let n=Wee(t)?t.size:ete(t).length;e._socket?e._sender._bufferedBytes+=n:e._bufferedAmount+=n}if(r){let n=new Error(`WebSocket is not open: readyState ${e.readyState} (${ma[e.readyState]})`);process.nextTick(r,n)}}i(RP,"sendAfterClose");function ote(e,t){let r=this[Dt];r._closeFrameReceived=!0,r._closeMessage=t,r._closeCode=e,r._socket[Dt]!==void 0&&(r._socket.removeListener("data",fw),process.nextTick(H2,r._socket),e===1005?r.close():r.close(e,t))}i(ote,"receiverOnConclude");function ate(){let e=this[Dt];e.isPaused||e._socket.resume()}i(ate,"receiverOnDrain");function ite(e){let t=this[Dt];t._socket[Dt]!==void 0&&(t._socket.removeListener("data",fw),process.nextTick(H2,t._socket),t.close(e[Kee])),t._errorEmitted||(t._errorEmitted=!0,t.emit("error",e))}i(ite,"receiverOnError");function C2(){this[Dt].emitClose()}i(C2,"receiverOnFinish");function ste(e,t){this[Dt].emit("message",e,t)}i(ste,"receiverOnMessage");function cte(e){let t=this[Dt];t._autoPong&&t.pong(e,!this._isServer,M2),t.emit("ping",e)}i(cte,"receiverOnPing");function dte(e){this[Dt].emit("pong",e)}i(dte,"receiverOnPong");function H2(e){e.resume()}i(H2,"resume");function lte(e){let t=this[Dt];t.readyState!==ut.CLOSED&&(t.readyState===ut.OPEN&&(t._readyState=ut.CLOSING,D2(t)),this._socket.end(),t._errorEmitted||(t._errorEmitted=!0,t.emit("error",e)))}i(lte,"senderOnError");function D2(e){e._closeTimer=setTimeout(e._socket.destroy.bind(e._socket),e._closeTimeout)}i(D2,"setCloseTimer");function L2(){let e=this[Dt];if(this.removeListener("close",L2),this.removeListener("data",fw),this.removeListener("end",B2),e._readyState=ut.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[Dt]=void 0,clearTimeout(e._closeTimer),e._receiver._writableState.finished||e._receiver._writableState.errorEmitted?e.emitClose():(e._receiver.on("error",C2),e._receiver.on("finish",C2))}i(L2,"socketOnClose");function fw(e){this[Dt]._receiver.write(e)||this.pause()}i(fw,"socketOnData");function B2(){let e=this[Dt];e._readyState=ut.CLOSING,e._receiver.end(),this.end()}i(B2,"socketOnEnd");function $2(){let e=this[Dt];this.removeListener("error",$2),this.on("error",M2),e&&(e._readyState=ut.CLOSING,this.destroy())}i($2,"socketOnError")});var z2=He((STe,q2)=>{"use strict";var ITe=hw(),{Duplex:ute}=$e("stream");function U2(e){e.emit("close")}i(U2,"emitClose");function pte(){!this.destroyed&&this._writableState.finished&&this.destroy()}i(pte,"duplexOnEnd");function F2(e){this.removeListener("error",F2),this.destroy(),this.listenerCount("error")===0&&this.emit("error",e)}i(F2,"duplexOnError");function mte(e,t){let r=!0,n=new ute({...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(U2,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(U2,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",pte),n.on("error",F2),n}i(mte,"createWebSocketStream");q2.exports=mte});var xP=He((RTe,W2)=>{"use strict";var{tokenChars:fte}=xd();function hte(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&&fte[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(hte,"parse");W2.exports={parse:hte}});var Q2=He((TTe,X2)=>{"use strict";var gte=$e("events"),gw=$e("http"),{Duplex:_Te}=$e("stream"),{createHash:wte}=$e("crypto"),V2=uw(),Ss=Rd(),yte=xP(),vte=hw(),{CLOSE_TIMEOUT:bte,GUID:kte,kWebSocket:Ite}=la(),Ste=/^[+/0-9A-Za-z]{22}==$/,G2=0,J2=1,Y2=2,_P=class extends gte{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:bte,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:vte,...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=gw.createServer((n,o)=>{let a=gw.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=Pte(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=G2}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===Y2){t&&this.once("close",()=>{t(new Error("The server is not running"))}),process.nextTick(rp,this);return}if(t&&this.once("close",t),this._state!==J2)if(this._state=J2,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(rp,this):process.nextTick(rp,this);else{let r=this._server;this._removeListeners(),this._removeListeners=this._server=null,r.close(()=>{rp(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",K2);let a=t.headers["sec-websocket-key"],s=t.headers.upgrade,c=+t.headers["sec-websocket-version"];if(t.method!=="GET"){Ps(this,t,r,405,"Invalid HTTP method");return}if(s===void 0||s.toLowerCase()!=="websocket"){Ps(this,t,r,400,"Invalid Upgrade header");return}if(a===void 0||!Ste.test(a)){Ps(this,t,r,400,"Missing or invalid Sec-WebSocket-Key header");return}if(c!==13&&c!==8){Ps(this,t,r,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});return}if(!this.shouldHandle(t)){np(r,400);return}let d=t.headers["sec-websocket-protocol"],l=new Set;if(d!==void 0)try{l=yte.parse(d)}catch{Ps(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 f=new Ss({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let w=V2.parse(u);w[Ss.extensionName]&&(f.accept(w[Ss.extensionName]),p[Ss.extensionName]=f)}catch{Ps(this,t,r,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let f={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(f,(w,g,h,y)=>{if(!w)return np(r,g||401,h,y);this.completeUpgrade(p,a,l,t,r,n,o)});return}if(!this.options.verifyClient(f))return np(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[Ite])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>G2)return np(a,503);let l=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${wte("sha1").update(r+kte).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[Ss.extensionName]){let p=t[Ss.extensionName].params,f=V2.format({[Ss.extensionName]:[p]});l.push(`Sec-WebSocket-Extensions: ${f}`),u._extensions=t}this.emit("headers",l,o),a.write(l.concat(`\r
|
|
4
4
|
`).join(`\r
|
|
5
5
|
`)),a.removeListener("error",K2),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(rp,this)})),c(u,o)}};X2.exports=_P;function Pte(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(Pte,"addListeners");function rp(e){e._state=Y2,e.emit("close")}i(rp,"emitClose");function K2(){this.destroy()}i(K2,"socketOnError");function np(e,t,r,n){r=r||gw.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} ${gw.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-7P5SH3CI.js";import"./chunk-TGULVWPV.js";import"./chunk-
|
|
2
|
+
import{m as f}from"./chunk-7P5SH3CI.js";import"./chunk-TGULVWPV.js";import"./chunk-NABPZ7AK.js";import"./chunk-BQVB2SPF.js";import"./chunk-XRKFTPHD.js";import"./chunk-BSHAIAXY.js";import"./chunk-XWPC3AN4.js";import{a as g,c as a,d}from"./chunk-3M53YXEI.js";import"./chunk-CRDKBFRN.js";import"./chunk-DMO3UIS7.js";import"./chunk-27JGS3KB.js";import"./chunk-BT5YNE5U.js";import"./chunk-3WJQ4IGK.js";import"./chunk-KTIBXRWQ.js";import"./chunk-L4EJ5R3B.js";import"./chunk-6ZTP6CUJ.js";import"./chunk-TBODQT4W.js";import"./chunk-YRDPVTEI.js";import"./chunk-JRGECNP3.js";import"./chunk-RRWL5BHZ.js";import"./chunk-NXN7GJOH.js";import"./chunk-5WPMI6QX.js";import"./chunk-W7NXFRHN.js";import"./chunk-5HPZGLOL.js";import"./chunk-GLUWATL5.js";import"./chunk-UN2LKLGV.js";import"./chunk-2LJCJOJ7.js";import"./chunk-AMC4Z7G4.js";import"./chunk-LK77GI6M.js";import"./chunk-HVM2GUM3.js";import"./chunk-JCLTFDVW.js";import"./chunk-I6VMRQF4.js";import"./chunk-QAFXQHHG.js";import"./chunk-OKKNDQJF.js";import"./chunk-AJXWJLZA.js";import"./chunk-G4E3WGLM.js";import"./chunk-ZY32SZ2P.js";import"./chunk-OTDDXEQ6.js";import"./chunk-ECOH24MC.js";import"./chunk-SH7POUVX.js";import"./chunk-2MEOUS24.js";import"./chunk-HNQPEOJD.js";import"./chunk-RCT3O3HQ.js";import"./chunk-ZFJWA4JK.js";import"./chunk-X2J2P5ZT.js";import"./chunk-UGOK7VTC.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};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
|
|
2
|
-
import{a as n,b as o}from"./chunk-
|
|
2
|
+
import{a as n,b as o}from"./chunk-PLVWARB7.js";import"./chunk-4DYWVGVS.js";import"./chunk-4TO743HO.js";import"./chunk-A77DLBR4.js";import{A as i,B as j,C as k,D as l,E as m,s as a,t as b,u as c,v as d,w as e,x as f,y as g,z as h}from"./chunk-SBQ6KLXB.js";import"./chunk-CYQLXS2U.js";import"./chunk-O6ZYDHEJ.js";import"./chunk-OKEC2EIE.js";import"./chunk-WLZJOCLA.js";import"./chunk-HIQPGYVH.js";import"./chunk-ZWW227M3.js";import"./chunk-DXA2UHBE.js";import"./chunk-MTP3B2SU.js";import"./chunk-I6VMRQF4.js";import"./chunk-QAFXQHHG.js";import"./chunk-OKKNDQJF.js";import"./chunk-AJXWJLZA.js";import"./chunk-G4E3WGLM.js";import"./chunk-ZY32SZ2P.js";import"./chunk-OTDDXEQ6.js";import"./chunk-ECOH24MC.js";import"./chunk-SH7POUVX.js";import"./chunk-2MEOUS24.js";import"./chunk-HNQPEOJD.js";import"./chunk-RCT3O3HQ.js";import"./chunk-ZFJWA4JK.js";import"./chunk-X2J2P5ZT.js";import"./chunk-UGOK7VTC.js";import"./chunk-FTQLQJQV.js";export{k as LocalToolConsultInput,b as ToolLearningCredentialRecordSchema,j as captureLocalToolBoundary,h as configureLocalToolLearning,l as consultLocalToolLearning,i as flushToolLearning,e as loadToolLearningCredential,a as nativeToolLearningClientVersion,o as probeToolLearningMcp,m as readLocalToolConsultation,n as runToolLearningMcp,f as saveToolLearningCredential,d as toolLearningCredentialId,c as toolLearningHome,g as toolLearningProducer};
|
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-NABPZ7AK.js";import{g as u}from"./chunks/chunk-BQVB2SPF.js";import{a as c}from"./chunks/chunk-XRKFTPHD.js";import{a as m,b as l}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-GR56E3QK.js")).resolveOpenPondHome({home:o.home}));let r=C({command:i,options:o});if(r==="version"){console.log(c());return}if(r==="check-update"){await(await import("./chunks/core-commands-RXPXOYOP.js")).runCheckUpdate();return}if(r==="help"){(await import("./chunks/help-JQA3YMCX.js")).printHelp();return}let n=m(o),p=l(o);if(n&&(process.env.OPENPOND_ACCOUNT=n),p&&(process.env.OPENPOND_BASE_URL=p),r==="tui"){await(await import("./chunks/app-layer-5XUMNHDO.js")).runOpenPondTerminalCommand(o,t);return}if(r==="ui"){await(await import("./chunks/app-layer-5XUMNHDO.js")).runOpenPondServerCommand("web",o,t);return}await u({command:i,options:o,rest:t})||((await import("./chunks/help-JQA3YMCX.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-KWRTMKN6.js")).runDatasetPreparationAuthoringCli(e.slice(1)),!0;if(e[0]==="__inspect-hosted-profile-evaluation")return await(await import("./chunks/hosted-profile-compiler-RXU626Q6.js")).runHostedProfileInspectionCli(e.slice(1)),!0;if(e[0]==="__prepare-hosted-profile-evaluation")return await(await import("./chunks/hosted-profile-compiler-RXU626Q6.js")).runHostedProfileEvaluationCli(e.slice(1)),!0;if(e[0]==="__hosted-experiment-improvement")return await(await import("./chunks/hosted-experiment-improvement-NZTPZTDH.js")).runHostedExperimentImprovementCli(e.slice(1)),!0;if(e[0]==="__compile-hosted-profile-candidate")return await(await import("./chunks/hosted-profile-candidate-3CAT3XBI.js")).runHostedProfileCandidateCli(e.slice(1)),!0;if(e[0]==="__compile-hosted-profile")return await(await import("./chunks/hosted-profile-compiler-RXU626Q6.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-TH56EG2Z.js"),import("./chunks/cli-TE7RP5H7.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-HJHIBDFX.js"),import("./chunks/cli-TE7RP5H7.js")]),{createOpenPondAppServer:t}=await import("./chunks/app-server-runtime-TH56EG2Z.js");return await o({createOpenPondServer:i,createOpenPondAppServer:t}),!0}return e[0]==="__terminal"?(await(await import("./chunks/src-662QOKNP.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-LQKCOQDJ.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};
|