openpond 0.2.68 → 0.2.70

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (247) hide show
  1. package/dist/api/client-context.d.ts +4 -0
  2. package/dist/app-server.js +1 -1
  3. package/dist/chunks/account-context-LEZDNYMR.js +12 -0
  4. package/dist/chunks/{acp-2OIXATRY.js → acp-QTA6IU6W.js} +1 -1
  5. package/dist/chunks/{acp-agent-PAGX2B47.js → acp-agent-N77HPAYQ.js} +1 -1
  6. package/dist/chunks/{actions-command-2VE6YI4W.js → actions-command-BZQCUDMD.js} +1 -1
  7. package/dist/chunks/{app-layer-YNEUEOEP.js → app-layer-YQQNLIXA.js} +1 -1
  8. package/dist/chunks/{app-server-connected-apps-TZOAUOYR.js → app-server-connected-apps-NH4667QJ.js} +1 -1
  9. package/dist/chunks/{app-server-runtime-GBX65JJ7.js → app-server-runtime-B7AMBGQZ.js} +1 -1
  10. package/dist/chunks/apps-WG7WY5CB.js +2 -0
  11. package/dist/chunks/{chunk-RY46UPBO.js → chunk-2ACX7IW5.js} +1 -1
  12. package/dist/chunks/{chunk-FKUWCJ73.js → chunk-54755JYM.js} +2 -2
  13. package/dist/chunks/{chunk-HKVFU3B3.js → chunk-5FSPDSAO.js} +1 -1
  14. package/dist/chunks/{chunk-R4EEGWXB.js → chunk-67U7PAMU.js} +1 -1
  15. package/dist/chunks/{chunk-2TGHZXJE.js → chunk-6C6ZCYTL.js} +1 -1
  16. package/dist/chunks/{chunk-7RSQOC5M.js → chunk-7TM25J6S.js} +1 -1
  17. package/dist/chunks/chunk-BGMAWETL.js +12 -0
  18. package/dist/chunks/chunk-BLNEHU62.js +12 -0
  19. package/dist/chunks/{chunk-RBTDSI4L.js → chunk-CUB6PWAJ.js} +6 -6
  20. package/dist/chunks/chunk-DFZTRMTL.js +2 -0
  21. package/dist/chunks/{chunk-4N4EH3RJ.js → chunk-EJOV6Z6F.js} +1 -1
  22. package/dist/chunks/{chunk-MEJLWNRS.js → chunk-EWH64WRR.js} +1 -1
  23. package/dist/chunks/{chunk-WNXUSELC.js → chunk-EXAJ2B4I.js} +1 -1
  24. package/dist/chunks/{chunk-BHKXPWFB.js → chunk-FHDH4OUA.js} +1 -1
  25. package/dist/chunks/chunk-HES4VP3D.js +2 -0
  26. package/dist/chunks/{chunk-AYOMVI7J.js → chunk-HIMG7S5E.js} +1 -1
  27. package/dist/chunks/{chunk-2LJCJOJ7.js → chunk-HLJJAOI2.js} +1 -1
  28. package/dist/chunks/{chunk-JPUSTFZC.js → chunk-HYUTDZ3N.js} +1 -1
  29. package/dist/chunks/chunk-J7X72QUY.js +2 -0
  30. package/dist/chunks/chunk-JF7WWLNW.js +2 -0
  31. package/dist/chunks/{chunk-4KNPCJR4.js → chunk-JVNKSU27.js} +1 -1
  32. package/dist/chunks/{chunk-XT4CSKHM.js → chunk-JZKTBYNB.js} +1 -1
  33. package/dist/chunks/{chunk-JEMECEQH.js → chunk-KHDCMVEJ.js} +1 -1
  34. package/dist/chunks/chunk-KURL76NW.js +6 -0
  35. package/dist/chunks/chunk-MZKCW6CB.js +2 -0
  36. package/dist/chunks/{chunk-UMAVVMXL.js → chunk-OL3L3U36.js} +1 -1
  37. package/dist/chunks/{chunk-IIT66347.js → chunk-OXQ2WFIH.js} +1 -1
  38. package/dist/chunks/{chunk-73TW6BKK.js → chunk-PPF6EBTQ.js} +1 -1
  39. package/dist/chunks/{chunk-V24VHT76.js → chunk-REGKOCDO.js} +1 -1
  40. package/dist/chunks/{chunk-PSY6IRJE.js → chunk-TAXCMCYZ.js} +1 -1
  41. package/dist/chunks/{chunk-OIH2LPIT.js → chunk-TCTBCAI6.js} +1 -1
  42. package/dist/chunks/{chunk-GEYZVOGD.js → chunk-UZNRH6I3.js} +1 -1
  43. package/dist/chunks/{chunk-DWM5G7BU.js → chunk-Y4E5AAI7.js} +1 -1
  44. package/dist/chunks/chunk-YAA7F5LI.js +2 -0
  45. package/dist/chunks/{chunk-XQAUHXL4.js → chunk-ZK3ET5EP.js} +2 -2
  46. package/dist/chunks/{cli-R7TAP6Z2.js → cli-ALEEFAJ7.js} +1 -1
  47. package/dist/chunks/{command-LNOVZQSK.js → command-5AXJMFYC.js} +11 -11
  48. package/dist/chunks/{configuration-command-CNITTZRP.js → configuration-command-5LUNWPOL.js} +1 -1
  49. package/dist/chunks/{connected-app-executor-FGWCLOJO.js → connected-app-executor-DHXZE4X3.js} +1 -1
  50. package/dist/chunks/connected-evidence-NWMPICKJ.js +2 -0
  51. package/dist/chunks/{connected-starting-assets-KWOFEIE4.js → connected-starting-assets-NRVXIKQ2.js} +1 -1
  52. package/dist/chunks/{continual-FVOLGGOE.js → continual-UCKQ2QLH.js} +1 -1
  53. package/dist/chunks/core-commands-ZPBX35M2.js +2 -0
  54. package/dist/chunks/datasets-6K3ZANIV.js +2 -0
  55. package/dist/chunks/desktop-test-57INNJ76.js +3 -0
  56. package/dist/chunks/evaluation-coordination-B7CN4R2D.js +2 -0
  57. package/dist/chunks/experiment-improvements-G357VLDB.js +2 -0
  58. package/dist/chunks/experiments-BHQO26LJ.js +2 -0
  59. package/dist/chunks/experiments-signal-BI6NKETB.js +2 -0
  60. package/dist/chunks/{help-K6YLZ3KL.js → help-UQN5RUPA.js} +1 -1
  61. package/dist/chunks/{hosted-app-server-composition-LA3BZ4SE.js → hosted-app-server-composition-WDDO6F23.js} +1 -1
  62. package/dist/chunks/{hosted-experiment-improvement-VG2WE7XZ.js → hosted-experiment-improvement-VVYXQ65K.js} +1 -1
  63. package/dist/chunks/{hosted-tasksets-NXVF4AQA.js → hosted-tasksets-KCLNMPG5.js} +1 -1
  64. package/dist/chunks/human-review-PX6DBIFT.js +2 -0
  65. package/dist/chunks/{import-YHYKZ6JN.js → import-2HEYPHPW.js} +1 -1
  66. package/dist/chunks/learning-LSXBL5DB.js +2 -0
  67. package/dist/chunks/{local-harness-taskset-review-XQHQ6JCR.js → local-harness-taskset-review-E5GN5LTR.js} +1 -1
  68. package/dist/chunks/opchat-66BCRKEZ.js +3 -0
  69. package/dist/chunks/opchat-bounded-chat-KQWXZVFN.js +2 -0
  70. package/dist/chunks/organizations-IOYWDOCC.js +2 -0
  71. package/dist/chunks/{profile-P2SJPBOJ.js → profile-YH6G3ZTD.js} +1 -1
  72. package/dist/chunks/{project-action-payload-LTIQBX77.js → project-action-payload-53OH6WDH.js} +1 -1
  73. package/dist/chunks/project-agent-RYVMKW2F.js +2 -0
  74. package/dist/chunks/{runtime-Q7JUJO4D.js → runtime-ISLJIGWC.js} +1 -1
  75. package/dist/chunks/sandbox-command-DI45NRTV.js +2 -0
  76. package/dist/chunks/{sandbox-template-U536EEWY.js → sandbox-template-T42MDUSR.js} +1 -1
  77. package/dist/chunks/{saved-work-KSIQPXC2.js → saved-work-54I5ZJTC.js} +1 -1
  78. package/dist/chunks/setup-D6TY2GWV.js +2 -0
  79. package/dist/chunks/{src-SGQYVBNQ.js → src-7RN7BF4W.js} +1 -1
  80. package/dist/chunks/{src-C3ZUESMK.js → src-LF5X4RNQ.js} +1 -1
  81. package/dist/chunks/{store-model-configuration-6L3OYXF4.js → store-model-configuration-AYFGMC5D.js} +1 -1
  82. package/dist/chunks/{store-model-project-preparation-AAEKCF6V.js → store-model-project-preparation-5DEIS7TB.js} +1 -1
  83. package/dist/chunks/{store-taskset-drafts-FRFL6ITK.js → store-taskset-drafts-EAOOY6CR.js} +1 -1
  84. package/dist/chunks/{taskset-UDDLFYKV.js → taskset-HNDIGYQG.js} +1 -1
  85. package/dist/chunks/{teams-bot-MPWL2PP4.js → teams-bot-Z5CZLWE4.js} +1 -1
  86. package/dist/chunks/{training-5UMT45UL.js → training-JTYQA7GA.js} +1 -1
  87. package/dist/chunks/training-hardware-MR4FUC4U.js +3 -0
  88. package/dist/chunks/training-hosted-36SZFS4U.js +2 -0
  89. package/dist/chunks/{web-search-ZEKJHZW4.js → web-search-FTVNZ7PH.js} +1 -1
  90. package/dist/cli.js +2 -2
  91. package/dist/index.js +1 -1
  92. package/dist/sandbox/runtime-handle.d.ts +3 -5
  93. package/dist/sandbox/sandbox-instance-client.d.ts +11 -5
  94. package/dist/sandbox/types/billing.d.ts +53 -0
  95. package/dist/sandbox/types/responses.d.ts +11 -1
  96. package/dist/sandbox/types/snapshots.d.ts +52 -3
  97. package/dist/skills/manifest.json +1 -1
  98. package/dist/web/assets/{App-CCuh99JW.js → App-CXhxya9x.js} +4 -4
  99. package/dist/web/assets/{AppDialog-CxjDHVk9.js → AppDialog-x1HU1uLv.js} +1 -1
  100. package/dist/web/assets/{AppTerminalPanel-CKJIVpKa.js → AppTerminalPanel-CNIKmqKc.js} +2 -2
  101. package/dist/web/assets/{AppToastContext-EpiT1dHs.js → AppToastContext-DNWd43HS.js} +1 -1
  102. package/dist/web/assets/{AppsView-BsMyPX_3.js → AppsView-BvOD83Z1.js} +1 -1
  103. package/dist/web/assets/{AttachmentTypeIcon-BXvZy5gB.js → AttachmentTypeIcon-BLdDr3JZ.js} +1 -1
  104. package/dist/web/assets/{BrowserSidebar-BIIV4aq4.js → BrowserSidebar-Ar0FlFKg.js} +1 -1
  105. package/dist/web/assets/{CartesianChart-brqLBqnF.js → CartesianChart-tS7f1HZv.js} +1 -1
  106. package/dist/web/assets/{ChatTimelineEntry-CwZbn16X.js → ChatTimelineEntry-z7_kur3h.js} +1 -1
  107. package/dist/web/assets/{CollaborationTabs-BU4uc4tZ.js → CollaborationTabs-CaiFEKrv.js} +1 -1
  108. package/dist/web/assets/{CommandMenu-DkWpXR55.js → CommandMenu-BpubEqaA.js} +1 -1
  109. package/dist/web/assets/{CommunityView-CsSxJZGn.js → CommunityView-TGR4s99l.js} +1 -1
  110. package/dist/web/assets/{ComposerAttachments-BdJGCYzI.js → ComposerAttachments-DPWCjKXz.js} +1 -1
  111. package/dist/web/assets/{ComposerCreateImproveStrip-CWy0j1vv.js → ComposerCreateImproveStrip-Drji01_6.js} +1 -1
  112. package/dist/web/assets/{ConversationImportsSettings-DCmiakbZ.js → ConversationImportsSettings-B_oW0cz7.js} +1 -1
  113. package/dist/web/assets/{DatasetReviewImport-DEnF_pGu.js → DatasetReviewImport-Dr3unJSY.js} +1 -1
  114. package/dist/web/assets/{ExperimentTrainingDataWorkspace-WhwQ0QBi.js → ExperimentTrainingDataWorkspace-DObvpJAw.js} +2 -2
  115. package/dist/web/assets/{FilePagePreview-BRhhz99q.js → FilePagePreview-9kkXbARN.js} +2 -2
  116. package/dist/web/assets/{GetStartedView-CLVD-qEi.js → GetStartedView-Dv2b_SlH.js} +1 -1
  117. package/dist/web/assets/{GettingStartedDialog-CMxaAMg-.js → GettingStartedDialog-sPaPMc61.js} +1 -1
  118. package/dist/web/assets/{HostedModelLearningReview-Cn-j-rDo.js → HostedModelLearningReview-BlwhGxS6.js} +1 -1
  119. package/dist/web/assets/HostedModelLearningSettings-B5ahk3je.js +1 -0
  120. package/dist/web/assets/{HtmlVisual-D5y2WG9L.js → HtmlVisual-rGsClq0p.js} +1 -1
  121. package/dist/web/assets/{LabModelVersionDetailPage-BxRmYD6h.js → LabModelVersionDetailPage-Da7AwZWV.js} +1 -1
  122. package/dist/web/assets/{LabModelWorkspace-u2Ulm_z4.js → LabModelWorkspace-DTeYViWH.js} +1 -1
  123. package/dist/web/assets/{LabSkillSidebar-C7IceJTJ.js → LabSkillSidebar-BieHbNl6.js} +1 -1
  124. package/dist/web/assets/{LabsRoute-CbztQaEf.js → LabsRoute-D3XqPB0-.js} +4 -4
  125. package/dist/web/assets/{LearningBatchesPage-CJqgZNvM.js → LearningBatchesPage-CCBuf2u4.js} +1 -1
  126. package/dist/web/assets/{MainChatThread-DNMfrrRq.js → MainChatThread-B6BQJfcq.js} +2 -2
  127. package/dist/web/assets/{MainPane-CQQxSDPS.js → MainPane-D3fQou29.js} +6 -6
  128. package/dist/web/assets/{ModelProjectPageHeader-Dge19aE1.js → ModelProjectPageHeader-BZn9Lu_J.js} +1 -1
  129. package/dist/web/assets/{NativeSetupTerminal-D4JnbpyD.js → NativeSetupTerminal-Bglqab_g.js} +2 -2
  130. package/dist/web/assets/{NativeSkillSidebar-Jzx1BeKV.js → NativeSkillSidebar-pUGRdnV_.js} +1 -1
  131. package/dist/web/assets/{NewProjectDialog-DcnGzEd9.js → NewProjectDialog-BpHN38MA.js} +1 -1
  132. package/dist/web/assets/{OutputsPage-Cmk15Vt_.js → OutputsPage-LunDCQ6w.js} +1 -1
  133. package/dist/web/assets/{PageChrome-Cz_fCqtn.js → PageChrome-DThEcWAx.js} +1 -1
  134. package/dist/web/assets/{ProjectsPage-BZ3Eo3Mz.js → ProjectsPage-vct_TQgL.js} +1 -1
  135. package/dist/web/assets/{RightChatPanelStack-C6H2vU9N.js → RightChatPanelStack-CgFK7DY0.js} +1 -1
  136. package/dist/web/assets/RightSidebarHomePanel-BJmzUcmy.js +1 -0
  137. package/dist/web/assets/{ScheduledWorkPage-CAkSwM0T.js → ScheduledWorkPage-mmaZfybl.js} +1 -1
  138. package/dist/web/assets/{SettingsView-DvQXGw3_.js → SettingsView-CJfeRsWR.js} +3 -3
  139. package/dist/web/assets/{TasksetDraftEditorPrimitives-JuU1k8vr.js → TasksetDraftEditorPrimitives-CuimAfkv.js} +1 -1
  140. package/dist/web/assets/{TeamChatView-DmHjr8W9.js → TeamChatView-BcK0lF1b.js} +1 -1
  141. package/dist/web/assets/{TerminalOverlay-DlaM9d8F.js → TerminalOverlay-0pzEvy-C.js} +1 -1
  142. package/dist/web/assets/{TrainingCreationPanel-ClpylNsr.js → TrainingCreationPanel-CcyzFz7l.js} +1 -1
  143. package/dist/web/assets/{TrainingDraftPanel-6tH2xSDj.js → TrainingDraftPanel-DSLZXdLz.js} +1 -1
  144. package/dist/web/assets/{UsageSettingsSection-CzDqxOYM.js → UsageSettingsSection-BT9pcnCn.js} +1 -1
  145. package/dist/web/assets/WorkSidebarPanel-CP-nHAsJ.js +1 -0
  146. package/dist/web/assets/{WorkspaceDiffPanel-B4e0lyF7.js → WorkspaceDiffPanel-Bbz5qrVA.js} +3 -3
  147. package/dist/web/assets/{WorkspaceEnvironmentMenu-D01ZkZZF.js → WorkspaceEnvironmentMenu-6hXpvMTl.js} +1 -1
  148. package/dist/web/assets/{WorkspaceFileLocation-C5s_njZb.js → WorkspaceFileLocation-BijVemBl.js} +1 -1
  149. package/dist/web/assets/{WorkspaceGitDialogs-DjPZ6KIh.js → WorkspaceGitDialogs-BOO0E5i9.js} +1 -1
  150. package/dist/web/assets/{WorkspaceMonacoEditor-CC4sfOiU.js → WorkspaceMonacoEditor-B_YzK7Do.js} +3 -3
  151. package/dist/web/assets/{WorkspacePdfPreview-vszQqFa4.js → WorkspacePdfPreview-CFti1fvu.js} +2 -2
  152. package/dist/web/assets/{WorkspacePresentationPreview-DQTvhaRD.js → WorkspacePresentationPreview-DPAhNaV6.js} +1 -1
  153. package/dist/web/assets/{bot-Doyx3T4j.js → bot-BE2rL_qv.js} +1 -1
  154. package/dist/web/assets/chevron-down-Bn8yph2O.js +1 -0
  155. package/dist/web/assets/chevron-right-BU-jUmb2.js +1 -0
  156. package/dist/web/assets/chevron-up-DacwuDJZ.js +1 -0
  157. package/dist/web/assets/{chunk-C3TS766N-ppRhs95p.js → chunk-C3TS766N-j1MK0e3c.js} +1 -1
  158. package/dist/web/assets/{client-DwZ92xtu.js → client-BnJhN-14.js} +1 -1
  159. package/dist/web/assets/{client-choice-storage-DitqKiIT.js → client-choice-storage-CQ0CNkzG.js} +1 -1
  160. package/dist/web/assets/{cloud-upload-HdzNTgr2.js → cloud-upload-DFjZE4O4.js} +1 -1
  161. package/dist/web/assets/{copy-DTQhoBNg.js → copy-CGrLUtw5.js} +1 -1
  162. package/dist/web/assets/{cssMode-BRTtfXxU.js → cssMode-DvRw2fUx.js} +1 -1
  163. package/dist/web/assets/{external-link-H1629UU6.js → external-link-3ZnEFUXd.js} +1 -1
  164. package/dist/web/assets/{folder-open-CAGdWOrr.js → folder-open-i9n8450i.js} +1 -1
  165. package/dist/web/assets/{folder-plus-C14cs2mE.js → folder-plus-cu8Md_ej.js} +1 -1
  166. package/dist/web/assets/{git-commit-horizontal-DFUfuVvF.js → git-commit-horizontal-CwckmC09.js} +1 -1
  167. package/dist/web/assets/{htmlMode-BVaCcL76.js → htmlMode-8VF4Ovtw.js} +1 -1
  168. package/dist/web/assets/{icons-Bk2b68aC.js → icons-4yRSxBZj.js} +1 -1
  169. package/dist/web/assets/{image-0DPVY6Ev.js → image-D-umhyyK.js} +1 -1
  170. package/dist/web/assets/{index-B6XX_0h3.js → index-DiVhx1GM.js} +2 -2
  171. package/dist/web/assets/{info-C8b_tafZ.js → info-Dq2RsPDJ.js} +1 -1
  172. package/dist/web/assets/{jsonMode-BCKKQmmV.js → jsonMode-CvCYQHkB.js} +1 -1
  173. package/dist/web/assets/loader-circle-DBl6qqtR.js +1 -0
  174. package/dist/web/assets/{lspLanguageFeatures-DozmNUOx.js → lspLanguageFeatures-CjufNNFF.js} +1 -1
  175. package/dist/web/assets/{maximize-2-CByk9-zN.js → maximize-2-CKY8dua6.js} +1 -1
  176. package/dist/web/assets/{message-square-C889vRqm.js → message-square-CVDgKlKX.js} +1 -1
  177. package/dist/web/assets/{monaco.contribution-BITdsRbn.js → monaco.contribution-BYAgjZbj.js} +2 -2
  178. package/dist/web/assets/{monaco.contribution-DxAV1oS5.js → monaco.contribution-BYY3-y9l.js} +2 -2
  179. package/dist/web/assets/{monaco.contribution-BqA-XZ44.js → monaco.contribution-Bh0CKj9i.js} +2 -2
  180. package/dist/web/assets/{monaco.contribution-B9q6qbbo.js → monaco.contribution-PjJ1258q.js} +2 -2
  181. package/dist/web/assets/{monitor-BtxlcLuI.js → monitor-UYe42gew.js} +1 -1
  182. package/dist/web/assets/{paperclip-BeIdaspf.js → paperclip-DrlSVUoz.js} +1 -1
  183. package/dist/web/assets/{pdf-perlzwEB.js → pdf-BMhday2W.js} +1 -1
  184. package/dist/web/assets/play-DIqZnaNf.js +1 -0
  185. package/dist/web/assets/plus-CFNxAPMK.js +1 -0
  186. package/dist/web/assets/{presentation-0bzvu6_u.js → presentation-DcZKqH7w.js} +1 -1
  187. package/dist/web/assets/{python-B9hOnkOI.js → python-CiA01i07.js} +1 -1
  188. package/dist/web/assets/{refresh-cw-D61-Ozk3.js → refresh-cw-00D-GDnF.js} +1 -1
  189. package/dist/web/assets/{save-iEMNZoPe.js → save-CXe7bqR7.js} +1 -1
  190. package/dist/web/assets/{settings-lists-C84qxFmP.js → settings-lists-B5J40WM6.js} +1 -1
  191. package/dist/web/assets/square-DJEaBefe.js +1 -0
  192. package/dist/web/assets/{square-terminal-Djpzo2Qs.js → square-terminal-DxC7TTds.js} +1 -1
  193. package/dist/web/assets/{submit-issue-command-HfKzyxg5.js → submit-issue-command-Dq3TqJLV.js} +1 -1
  194. package/dist/web/assets/{toggleHighContrast-ClsXu39R.js → toggleHighContrast-BH3Jckfo.js} +1 -1
  195. package/dist/web/assets/{training-model-data-CIysl8wH.js → training-model-data-B6IZ3x-t.js} +1 -1
  196. package/dist/web/assets/{tsMode-nbmaMc-D.js → tsMode-DXkj4bqC.js} +1 -1
  197. package/dist/web/assets/{upload-C6ug8RD-.js → upload-B3KRHVHl.js} +1 -1
  198. package/dist/web/assets/{useAccountSettings-Dr9h4Qz_.js → useAccountSettings-BGRkTRrp.js} +1 -1
  199. package/dist/web/assets/{useAgentInventory-ByCk2JAv.js → useAgentInventory-D_1AlAZJ.js} +1 -1
  200. package/dist/web/assets/{useChatContextSelection-C0eMm2g6.js → useChatContextSelection-hoMSuUSE.js} +1 -1
  201. package/dist/web/assets/{useLocalAgentSchedules-Do0y_leJ.js → useLocalAgentSchedules-DxTER7Ow.js} +1 -1
  202. package/dist/web/assets/{useQuery-D2MQ7e5U.js → useQuery-DkPec_9x.js} +1 -1
  203. package/dist/web/assets/{wifi-off-Dr-CapyW.js → wifi-off-CMzpvbWl.js} +1 -1
  204. package/dist/web/assets/{workers-DKvM2NdM.js → workers-ziY_bTv2.js} +1 -1
  205. package/dist/web/assets/x-omjwMPbJ.js +1 -0
  206. package/dist/web/assets/{yaml-C02vq4ar.js → yaml-mSvqVSko.js} +1 -1
  207. package/dist/web/index.html +1 -1
  208. package/docs/command-reference.md +11 -0
  209. package/package.json +1 -1
  210. package/dist/chunks/account-context-MWB6HN6I.js +0 -12
  211. package/dist/chunks/apps-RSFEJOQN.js +0 -2
  212. package/dist/chunks/chunk-27JGS3KB.js +0 -12
  213. package/dist/chunks/chunk-APKXXAUF.js +0 -2
  214. package/dist/chunks/chunk-DRTHKWHK.js +0 -6
  215. package/dist/chunks/chunk-JCLTFDVW.js +0 -2
  216. package/dist/chunks/chunk-KOC3YJEU.js +0 -12
  217. package/dist/chunks/chunk-KTIBXRWQ.js +0 -2
  218. package/dist/chunks/chunk-YDZBX4XQ.js +0 -2
  219. package/dist/chunks/connected-evidence-5VZBYNWN.js +0 -2
  220. package/dist/chunks/core-commands-BPYXVT7O.js +0 -2
  221. package/dist/chunks/datasets-E5TXSVIY.js +0 -2
  222. package/dist/chunks/desktop-test-FX7DTY4N.js +0 -3
  223. package/dist/chunks/evaluation-coordination-KUTZEEPB.js +0 -2
  224. package/dist/chunks/experiment-improvements-PQNR5YHN.js +0 -2
  225. package/dist/chunks/experiments-Z4BJWT3Y.js +0 -2
  226. package/dist/chunks/experiments-signal-3GCLKUWZ.js +0 -2
  227. package/dist/chunks/human-review-2ZOB7CJZ.js +0 -2
  228. package/dist/chunks/learning-LAXMGWSQ.js +0 -2
  229. package/dist/chunks/opchat-XXI2ZM53.js +0 -3
  230. package/dist/chunks/opchat-bounded-chat-3MZGCRLY.js +0 -2
  231. package/dist/chunks/organizations-W7HI2JA4.js +0 -2
  232. package/dist/chunks/project-agent-XRIXMXQK.js +0 -2
  233. package/dist/chunks/sandbox-command-HVA5FJU4.js +0 -2
  234. package/dist/chunks/setup-RMZ2BHLM.js +0 -2
  235. package/dist/chunks/training-hardware-UWQCRDMV.js +0 -3
  236. package/dist/chunks/training-hosted-CKSDRVL6.js +0 -2
  237. package/dist/web/assets/HostedModelLearningSettings-VNBvf38S.js +0 -1
  238. package/dist/web/assets/RightSidebarHomePanel-BfMMVkM1.js +0 -1
  239. package/dist/web/assets/WorkSidebarPanel-CY-AHZ4-.js +0 -1
  240. package/dist/web/assets/chevron-down-DX1hzujj.js +0 -1
  241. package/dist/web/assets/chevron-right-DHN0y3KC.js +0 -1
  242. package/dist/web/assets/chevron-up-_QrW88NF.js +0 -1
  243. package/dist/web/assets/loader-circle-y-SSPwpk.js +0 -1
  244. package/dist/web/assets/play-CHXXdkuO.js +0 -1
  245. package/dist/web/assets/plus-DFFWjhPw.js +0 -1
  246. package/dist/web/assets/square-BE_4JMR3.js +0 -1
  247. package/dist/web/assets/x-Jx2jlP9u.js +0 -1
@@ -1,6 +1,6 @@
1
1
  #!/usr/bin/env node
2
2
  import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
3
- import{a as Lq,b as Bq,c as $q}from"./chunk-YXMYK5P7.js";import"./chunk-S4WILIRA.js";import{c as bq}from"./chunk-QUNQM2E3.js";import{a as kq,b as Sq,c as Pq,d as Rq,e as xq,f as _q,g as Eq,h as Tq,i as Cq,j as Aq}from"./chunk-UMAVVMXL.js";import{a as or,b as Op,c as xa,d as iy,e as sy,f as Ei}from"./chunk-ZDEIVUUI.js";import{a as Mq,b as jq,c as Oq,d as M,e as Hq,f as Ti,g as z,h as cy,j as Dq}from"./chunk-7RSQOC5M.js";import{a as ay,b as vq}from"./chunk-5JVJQA5H.js";import{a as HU,b as FU,c as hR,d as zU,e as WU,f as VU,g as GU,h as JU,j as KU}from"./chunk-2TGHZXJE.js";import{A as fR,a as MU,c as jU,g as OU,k as ey,l as Fo,m as DU,n as Pa,o as ty,p as LU,q as Ri,r as ry,s as BU,t as Ra,u as ny,v as xi,w as $U,x as NU,y as UU,z as qU}from"./chunk-IIT66347.js";import{a as YU,b as XU,c as oy,d as QU,e as _i,f as Je,g as ZU,h as Pe,i as eq,j as tq,k as rq,l as nq,m as oq,n as aq,o as iq,p as sq,q as cq,r as dq,s as lq,t as $r,u as Pr,v as pe,w as uq}from"./chunk-BHKXPWFB.js";import{a as pq,b as mq}from"./chunk-Q7P34B2O.js";import{a as fq,b as hq}from"./chunk-ESYPMD7Q.js";import{c as mR}from"./chunk-CO23RRN7.js";import{a as gq,b as wq,c as yq}from"./chunk-KCLMA2IH.js";import"./chunk-FNGZ4UDZ.js";import{a as Yw,b as yU,c as vU,d as IU,e as bU}from"./chunk-VWWKWYSQ.js";import{a as Sa,c as Ww,d as Ud,e as pU,f as mU,g as kr,h as fU,i as Gw,j as hU,k as Sr,l as Jw,m as gU,n as Yr,o as Kw,p as wU,r as PU}from"./chunk-OUJ63LMU.js";import{a as Xw,b as kU,c as pR}from"./chunk-EFP75UEX.js";import{b as SU,c as Qw}from"./chunk-PACLKDTN.js";import{a as un}from"./chunk-ZIQJDTQB.js";import"./chunk-S7A2OGL2.js";import{a as lU,e as Vw}from"./chunk-3Z4VM2LF.js";import{a as xS,b as WM}from"./chunk-EICS777E.js";import{a as RU}from"./chunk-MIFVX5PK.js";import"./chunk-WLQEONBF.js";import"./chunk-3A2Y7UK3.js";import{b as xU}from"./chunk-WNXUSELC.js";import{a as _U,b as Zw,c as EU,d as TU,e as CU}from"./chunk-MEJLWNRS.js";import{b as AU}from"./chunk-4KNPCJR4.js";import{a as rU,b as nU,c as Uw,d as qw}from"./chunk-XVDFJ3ZF.js";import{b as dU}from"./chunk-M4A7G4S5.js";import{b as cU,c as lR}from"./chunk-Q3WXB465.js";import"./chunk-JQOVC35K.js";import{a as sU}from"./chunk-FEAKTSRS.js";import"./chunk-Q73RKX7I.js";import{a as oo,b as zw,c as uR,d as uU}from"./chunk-TPOAAJKA.js";import"./chunk-ZYLLPRPU.js";import{a as Z2,b as eU,c as tU}from"./chunk-XYZV3FKD.js";import{h as oe}from"./chunk-RCQYEHHD.js";import"./chunk-SDO4FC4Q.js";import"./chunk-IR3YJWPW.js";import{a as J2,b as $w}from"./chunk-SDHG6CKU.js";import{a as Ns,b as Nw,c as X2,d as Q2}from"./chunk-XHACK2KR.js";import"./chunk-W45RKGM6.js";import"./chunk-GYYJ47GX.js";import{a as Lw,d as Bw,f as K2,g as Y2}from"./chunk-WCNPGKST.js";import{a as G2}from"./chunk-DWF3FCY4.js";import{b as W2,c as V2,d as Nd,f as Dw,g as Mp}from"./chunk-YDZBX4XQ.js";import{b as jp,c as ka}from"./chunk-AFH462DO.js";import"./chunk-UANH7U3Y.js";import{a as no,b as F2,c as z2}from"./chunk-MWS2NAHJ.js";import{a as H2,d as D2,f as L2,g as B2,h as $2,i as ba,j as N2,k as Hw,n as Ap}from"./chunk-CCZ276IA.js";import{a as U2,b as q2}from"./chunk-K7KBFM2T.js";import{c as N$,d as uw,i as U$}from"./chunk-AQUZCWM3.js";import{b as jw,d as $d,l as _2,n as Ow}from"./chunk-E2JB5OCO.js";import"./chunk-DRMOHADV.js";import{A as dg,c as sg,d as tH,e as rH,f as nH,h as oH,i as aH,j as iH,p as sH,u as wi,v as cH,x as dH,z as cg}from"./chunk-OTXGAKFH.js";import{a as yH,d as vH,g as EH}from"./chunk-CIZI6Z7D.js";import{a as o$,b as c$,c as d$,d as j$,e as lw,f as L$,g as B$,h as $$,i as q$,j as EN,k as j2,m as Iq}from"./chunk-XQAUHXL4.js";import{a as oU}from"./chunk-PSY6IRJE.js";import{a as pt,b as a$,c as i$,d as JP,e as eN,f as mw,g as fw,h as tN}from"./chunk-PKJHN666.js";import{a as aU,b as Fw,c as iU}from"./chunk-Z33RVGP6.js";import{b as Ad,c as Md,d as VP}from"./chunk-7PKDJHT6.js";import{b as dw}from"./chunk-65WRWLUD.js";import{$ as b2,A as AN,B as Kr,C as MN,D as jN,E as $N,F as NN,G as UN,H as qN,I as FN,J as e2,K as t2,L as aR,M as r2,N as d2,O as l2,P as u2,Q as m2,R as iR,S as g2,T as Cw,U as Ls,V as qo,W as to,X as v2,Y as Tp,Z as I2,_ as ro,aa as Aw,b as l$,ba as k2,c as x$,ca as S2,d as _$,da as br,e as T$,ea as Bs,f as V$,fa as P2,g as Od,ga as Ia,h as G$,ha as sR,i as Y$,ia as cR,j as X$,ja as Cp,k as rN,ka as dR,l as yN,la as Mw,m as vN,ma as x2,n as IN,na as E2,o as bN,oa as O2,p as kN,q as QP,r as SN,s as PN,t as RN,u as xN,x as _N,y as TN,z as ZP}from"./chunk-FKUWCJ73.js";import{g as T2,h as C2,i as A2,j as M2}from"./chunk-B66QCXH2.js";import{a as E$}from"./chunk-PYNW5OFA.js";import{A as eR,B as tR,F as zN,M as w2,a as z$,b as W$,c as GP,m as wN,q as yw}from"./chunk-MOXIGLN2.js";import{b as $s,c as R2,d as Br}from"./chunk-RHMULF56.js";import"./chunk-VFH5C6D2.js";import{a as h2}from"./chunk-UOFDKMRU.js";import{a as gN}from"./chunk-AN525SPP.js";import{a as F$}from"./chunk-IZ6DLEVY.js";import{a as Hs,b as UP,c as Sp,d as Pp,e as Td,f as aw,g as qP,h as Rp,i as Cn,j as P$,k as fe,l as R$,m as zP}from"./chunk-KOC3YJEU.js";import{b as f$}from"./chunk-65FJWWXG.js";import"./chunk-SYUKES6H.js";import{a as O$,b as H$,c as D$,d as cw}from"./chunk-EYTTZ5H4.js";import"./chunk-XY7HFXLH.js";import{B as p2,J as y2,b as VM,z as CN}from"./chunk-6I5AUTVO.js";import{b as C$,i as A$,j as M$,m as Cd,n as WP}from"./chunk-DKOVZ6R2.js";import{a as kp,b as bi}from"./chunk-N5EAVX4G.js";import{a as NP,g as u$,h as p$,j as m$}from"./chunk-U7X5ZLAL.js";import"./chunk-7PXZ4X4P.js";import"./chunk-N73MU2C3.js";import"./chunk-SO4GMSNP.js";import"./chunk-NMMHXYDJ.js";import"./chunk-QLGP2OAQ.js";import{A as Pi,B as oR,C as Sw,D as YN,E as Pw,F as XN,G as _p,J as Rw,K as QN,L as xw,M as ZN,N as Bd,d as ON,f as HN,g as DN,h as LN,i as BN,m as vw,n as Iw,o as WN,p as VN,q as Ld,r as GN,s as rR,t as JN,u as bw,v as kw,w as Uo,x as Ds,y as nR,z as KN}from"./chunk-WZ35ICTE.js";import"./chunk-VS2LOUCT.js";import"./chunk-DMFUEUAZ.js";import"./chunk-AFKFN25T.js";import"./chunk-G4747MOW.js";import{a as $o,b as No,c as Wt}from"./chunk-GF55VEMR.js";import"./chunk-FAKDGLZQ.js";import"./chunk-KCJVFLBB.js";import{a as Q$,b as Z$}from"./chunk-GW766ZSO.js";import{a as i2,b as s2,c as c2,d as Tw,f as f2}from"./chunk-VJYOKU3C.js";import{a as n2,b as Ep,c as o2,d as _w,e as a2,f as Ew}from"./chunk-SSJV3VX7.js";import{a as jd}from"./chunk-7KWD2I6W.js";import{a as Dr,b as h$,c as Lr,d as g$,e as iw,f as sw,g as FP,h as w$,i as ki,k as y$,l as v$,m as I$,n as b$,o as k$,p as S$}from"./chunk-RY46UPBO.js";import{A as NM,C as UM,D as qM,E as Qn,d as RM,e as xM,f as _M,g as EM,h as SS,i as TM,j as CM,k as AM,l as MM,m as jM,n as xh,o as OM,p as PS,q as HM,r as DM,s as rr,t as LM,u as ut,v as St,w as BM,x as $M,y as Du,z as _h}from"./chunk-OFJPOTES.js";import{c as dN,d as KP,e as lN,f as uN,g as pN,h as mN,i as Dd,j as ww,k as Bo,l as fN,m as YP,n as hN,o as XP}from"./chunk-PLROXHG2.js";import{A as cN,C as gw,b as pw,d as J$,e as K$,h as nN,k as oN,l as aN,m as Hd,n as iN,p as hw,q as sN,s as xp}from"./chunk-YU3C6U5V.js";import"./chunk-PHZZBXDO.js";import{a as Si}from"./chunk-KVTBX2UP.js";import{a as ye,b as zt,c as Ed,d as ce,f as s$}from"./chunk-U7D6Q744.js";import{$ as rL,$a as AL,$b as cp,$c as $P,A as CD,Aa as mL,Ac as JB,Ba as fL,Ca as hL,Cb as Zg,Cc as KB,Db as CB,Dc as YB,E as AD,Ea as Pd,Eb as AB,Ec as Os,F as MD,Fa as gL,Fb as Lo,Fc as XB,G as Lg,Gb as MB,H as jD,Ha as tp,Hb as js,I as UD,Ia as Fg,Ib as jB,Ic as st,J as qD,Ja as wL,Jc as HP,K as Oo,Ka as SP,Kc as up,La as yL,Lc as pp,M as FD,Ma as vL,Mc as QB,N as zD,Na as PP,Nc as DP,O as WD,Oa as IL,Oc as mp,P as VD,Pa as bL,Pc as fp,Q as GD,Qa as kL,Qc as ZB,Ra as SL,Rc as LP,S as JD,Sa as PL,Sc as hp,T as Bg,Ta as RL,Tc as gp,U as KD,Ua as xL,Uc as e$,V as YD,Va as RP,Vb as OB,Vc as wp,W as XD,Wa as _L,Wc as t$,X as QD,Xa as EL,Xb as HB,Xc as BP,Y as ZD,Ya as TL,Yb as ip,Yc as yp,Z as eL,Za as CL,Zb as DB,Zc as vp,_ as tL,_a as xP,_b as sp,_c as r$,aa as nL,ab as ML,ac as MP,ad as Ip,b as bd,ba as oL,bb as jL,bc as LB,bd as bp,ca as aL,cb as OL,cc as dp,cd as n$,da as iL,db as HL,dc as BB,e as wD,ea as sL,eb as DL,ec as ew,fb as LL,fc as $B,g as vP,ga as $g,gb as BL,gc as NB,h as yD,ha as cL,hb as $L,hc as UB,i as Hr,ia as Zn,ic as qB,j as Qu,ja as Ng,jc as tw,k as Ts,ka as kP,kb as NL,kc as rw,l as IP,la as Ug,lb as UL,m as vD,mb as qL,n as ID,na as qg,nb as FL,nc as FB,o as bD,oa as Zu,ob as zL,p as kD,pb as rp,pc as Ii,q as SD,qa as dL,r as PD,rb as zg,rc as nw,s as Dg,sb as WL,sc as zB,ta as Sd,tb as VL,tc as lp,ua as Ho,ub as GL,uc as ow,v as va,va as lL,vb as Cs,vc as WB,w as kd,wa as ep,wb as JL,wc as VB,x as ED,xc as jP,y as TD,ya as uL,yb as TB,yc as GB,za as pL,zc as OP}from"./chunk-HG2YFMVU.js";import{d as SM}from"./chunk-OQPJ7FJF.js";import"./chunk-BL3CZWWD.js";import{b as OD,c as HD,d as DD,e as LD,f as BD,g as $D,h as ND}from"./chunk-FYWQWKVS.js";import{b as RD,c as Hg}from"./chunk-GD3RCUDH.js";import{$ as Ms,A as Ir,C as dB,D as lB,E as uB,F as AP,G as pB,H as mB,I as fB,K as Jg,L as hB,a as Wg,aa as gB,b as KL,ba as eo,c as _P,ca as wB,d as Do,da as yB,e as YL,ea as vB,f as XL,fa as yi,g as QL,ga as xd,h as EP,ha as Kg,i as As,ia as IB,j as ZL,ja as bB,k as eB,ka as kB,l as tB,la as op,m as TP,ma as _d,n as np,na as Yg,o as rB,oa as SB,p as Vg,pa as Xg,q as nB,qa as vi,r as oB,ra as PB,s as Rd,sa as RB,t as aB,ta as xB,u as Gg,ua as Qg,v as iB,va as _B,w as sB,wa as ap,x as CP,xa as EB,z as cB}from"./chunk-7OKZCJHS.js";import"./chunk-UTIELP6F.js";import{g as TH,j as CH,l as yd,m as AH,o as pg,s as mg}from"./chunk-7NCM6GBN.js";import"./chunk-4V73I4OL.js";import"./chunk-LE75SVEL.js";import{e as xD,g as _D,h as bP,j as wt}from"./chunk-6ESBAHWK.js";import{a as Mne,b as JM,c as _S,d as ES}from"./chunk-LZPCA6DH.js";import{b as dd,c as PM}from"./chunk-L3KS6MOV.js";import"./chunk-7J2NMUTK.js";import{$b as zu,$f as pP,$i as M1,Ad as zH,Ag as mP,Ah as hP,Bd as WH,Be as YH,Cf as uP,Cj as D1,Dj as L1,Gi as Xu,Gj as B1,Hi as P1,Hj as $1,Ii as R1,Ij as N1,Kj as U1,Mj as q1,Nh as m1,Od as VH,Oe as XH,Ok as X1,Pd as GH,Ph as f1,Qf as a1,Re as QH,Rg as d1,Rh as h1,Ri as x1,Rk as Q1,Sd as Wu,Sh as g1,Ta as BH,Td as Vu,Tf as Ig,Ub as $H,Uf as bg,Ug as xg,Uh as Ku,Ui as _1,Uk as Z1,Vf as kg,Vg as _g,Vh as w1,Vi as E1,Vj as F1,Vk as eD,Wf as i1,Wg as Eg,Wh as y1,Wi as T1,Wk as tD,Xe as ZH,Xg as l1,Xj as Mg,Xk as rD,Y as Fu,Ye as gg,Yi as C1,Yk as nD,Zi as A1,Zk as oD,_b as NH,a as MH,af as e1,ah as fP,ak as z1,b as Ge,bk as W1,cf as Ju,ck as jg,di as v1,dk as V1,ek as G1,fa as fg,gl as Id,hf as vd,hi as Yu,if as t1,ii as I1,ja as jH,je as Gu,ji as b1,jl as aD,ka as OH,kf as r1,la as hg,ld as UH,lk as J1,ma as HH,na as DH,nj as gP,nl as iD,pd as Tn,pf as n1,pg as s1,ph as u1,pj as wP,pk as K1,pl as sD,ql as cD,rk as Y1,rl as Se,sg as Sg,sh as Tg,si as k1,tg as Pg,th as Cg,ue as JH,ug as Rg,uh as Ag,uj as j1,vg as c1,vh as p1,wa as LH,wf as wg,wj as O1,xe as KH,xf as yg,xi as S1,xj as yP,yd as qH,yf as vg,yj as H1,zd as FH,zf as o1}from"./chunk-VEBW7NKD.js";import"./chunk-W45RKGM6.js";import{a as dD,b as lD,c as uD,d as pD,e as mD,f as fD,g as Jr,h as hD,j as Og,k as gD}from"./chunk-AUO5DCEU.js";import{a as qu}from"./chunk-Y4I6CFZJ.js";import{t as pO}from"./chunk-4BUM6JEC.js";import{b as iO,c as sO,f as cO,g as dO,h as lO}from"./chunk-UGFSAG4U.js";import{a as aO,b as Fh}from"./chunk-SSHE6B7Z.js";import{a as jne}from"./chunk-JFXINDOQ.js";import"./chunk-EDYCSW22.js";import{b as ug,c as PH,e as RH,f as Uu,g as dP,k as lP,l as xH,m as _H}from"./chunk-JT5YQ52I.js";import"./chunk-XGY4OQLC.js";import{d as hH,h as gH,i as wH}from"./chunk-PAYFJHPO.js";import{d as hd,e as Nu,f as QO,g as ZO,h as eH,j as sP,l as cP}from"./chunk-WD4KAKEX.js";import{$ as SO,G as yO,H as vO,J as GS,L as IO,R as bO,S as fi,U as kO,Y as Wh,Z as Vh,_ as Gh,aa as JS,ba as XS,ca as QS,da as eg,ea as ZS,fa as eP,ga as tP,ia as rP,ja as nP,ka as oP,la as aP,u as wO}from"./chunk-2PXKSAG6.js";import"./chunk-ULTV6INR.js";import{A as Xh,C as Qh,D as Zh,E as ya,a as PO,b as RO,c as Jh,f as Kh,h as KS,i as YS,k as $u,m as xO,o as _O,p as EO,r as Yh,s as TO,u as CO}from"./chunk-WGQ3FMRF.js";import"./chunk-JXLDEYRW.js";import{i as kH,m as SH}from"./chunk-JVMSN7LH.js";import{a as lH,f as uH,g as nr,r as gd,t as pH,u as mH,v as lg,w as fH,z as wd}from"./chunk-YI6ME6PU.js";import{b as Es,d as IH,f as bH}from"./chunk-DRLP7GIU.js";import{Ba as ag,C as NO,Ca as ln,Da as XO,F as fd,Fa as ig,H as UO,Ia as gi,J as qO,L as FO,N as zO,O as WO,W as VO,aa as hi,ba as GO,c as AO,ga as JO,ha as KO,i as MO,ja as mt,l as jO,m as OO,n as HO,o as DO,oa as ng,p as LO,q as tg,r as iP,s as BO,t as $O,u as rg,wa as jo,xa as YO,za as og}from"./chunk-BU6MW65V.js";import"./chunk-LVXL7T5O.js";import{f as zS,m as md}from"./chunk-HIQPGYVH.js";import{E as fO,K as Bu,M as hO,N as zh,Q as gO,U as VS,V as Et,b as Lu,c as WS,i as uO,j as me,l as Xe,x as dn,y as mO}from"./chunk-DXJC3QW7.js";import"./chunk-P4QM63L3.js";import"./chunk-MTP3B2SU.js";import"./chunk-27JGS3KB.js";import{a as tO,b as nO}from"./chunk-UN2LKLGV.js";import"./chunk-2LJCJOJ7.js";import"./chunk-AMC4Z7G4.js";import{b as rO,e as oO}from"./chunk-LK77GI6M.js";import{k as RS}from"./chunk-HVM2GUM3.js";import"./chunk-I6VMRQF4.js";import{Ba as Wj,Ua as Vj,Wa as Uh,ba as jj,bb as NS,d as Tj,db as Gj,f as $h,fb as Jj,gb as qh,hb as Kj,l as Cj,lb as Yj,m as Aj,ob as Xj,pa as Oj,sb as US,ub as qS,va as zj,wb as Qj,x as Mj,xb as Zj,yb as eO,zb as FS}from"./chunk-D6L6UNUQ.js";import"./chunk-AJXWJLZA.js";import{A as Lj,E as Bj,F as $j,G as Nh,H as Nj,I as Uj,J as qj,N as Fj,h as Hj,z as Dj}from"./chunk-OKKNDQJF.js";import{Cb as ud,Db as wa,Eb as pd,F as wj,Jb as Rj,L as Ve,Lb as xj,M as _t,O as yj,Q as vj,Qb as _j,S as Mo,Ta as Bh,Xb as Ej,ba as Ij,d as mj,da as bj,g as fj,i as hj,j as gj,ob as kj,pb as mi,qb as It,rb as Sj,ub as Pj}from"./chunk-4PUOWSDE.js";import{$a as Dh,A as Oh,Aa as He,B as TS,C as xs,Cb as lj,D as _s,Db as uj,Eb as pj,F as YM,Fb as Lh,H as XM,I as QM,Ja as tj,La as rj,M as CS,N as AS,O as MS,Oa as nj,P as jS,Q as OS,R as HS,Ra as oj,S as DS,Sa as aj,T as LS,Wa as ij,a as GM,bb as $S,fb as sj,ga as ZM,hb as cj,kb as dj,n as KM,o as Ch,p as Ah,q as Mh,qa as Hh,r as jh,ra as ej,v as pi,va as BS}from"./chunk-ZY32SZ2P.js";import{q as zM,r as ld,s as Th}from"./chunk-OTDDXEQ6.js";import"./chunk-ECOH24MC.js";import{c as F0}from"./chunk-4N4EH3RJ.js";import"./chunk-GY7YSD6J.js";import{a as IM,b as bM,c as En,d as Ph,e as Rs,f as Hu,g as kS,h as Rh,i as kM,k as Eh,n as FM}from"./chunk-KUE46HTH.js";import{d as U0,e as q0,g as vM}from"./chunk-JCLTFDVW.js";import{a as Ou}from"./chunk-6FA3GG5B.js";import{C as sM,D as cM,I as uM,K as yS,L as vS,M as pM,S as IS,U as mM,V as bS,Z as fM,_ as hM,ca as gM,da as wM,f as Mu,fa as Ps,ga as yM,ha as Sh,v as cd,x as ju}from"./chunk-SV7ZBEK2.js";import{M as sd,O as nM,Q as oM,R as aM,S as iM,a as Ss,b as J0,c as Gr,d as _n,e as K0,f as yh,g as Y0,h as X0,i as vh,j as Ih,l as Q0,m as Z0,n as eM,o as tM,p as rM,z as wS}from"./chunk-2MEOUS24.js";import{b as G0,d as wh,e as Xn,f as Ft}from"./chunk-HNQPEOJD.js";import{g as hh,h as gS,i as V0,l as ot,m as Ee,n as T,o as gh}from"./chunk-RCT3O3HQ.js";import{a as z0,c as ks,f as fh,h as Au,i as W0,m as bh,p as dM,r as ha,s as lM,t as ga,u as kh}from"./chunk-UGOK7VTC.js";import"./chunk-ZFJWA4JK.js";import{A as v,d as Re}from"./chunk-X2J2P5ZT.js";import{a as i,b as qe,c as Be,e as xn}from"./chunk-FTQLQJQV.js";var _a=Be((L0e,VF)=>{"use strict";var zF=["nodebuffer","arraybuffer","fragments"],WF=typeof Blob<"u";WF&&zF.push("blob");VF.exports={BINARY_TYPES:zF,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:WF,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:i(()=>{},"NOOP")}});var qp=Be(($0e,wy)=>{"use strict";var{EMPTY_BUFFER:Uoe}=_a(),BR=Buffer[Symbol.species];function qoe(e,t){if(e.length===0)return Uoe;if(e.length===1)return e[0];let r=Buffer.allocUnsafe(t),n=0;for(let o=0;o<e.length;o++){let a=e[o];r.set(a,n),n+=a.length}return n<t?new BR(r.buffer,r.byteOffset,n):r}i(qoe,"concat");function GF(e,t,r,n,o){for(let a=0;a<o;a++)r[n+a]=e[a]^t[a&3]}i(GF,"_mask");function JF(e,t){for(let r=0;r<e.length;r++)e[r]^=t[r&3]}i(JF,"_unmask");function Foe(e){return e.length===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.length)}i(Foe,"toArrayBuffer");function $R(e){if($R.readOnly=!0,Buffer.isBuffer(e))return e;let t;return e instanceof ArrayBuffer?t=new BR(e):ArrayBuffer.isView(e)?t=new BR(e.buffer,e.byteOffset,e.byteLength):(t=Buffer.from(e),$R.readOnly=!1),t}i($R,"toBuffer");wy.exports={concat:qoe,mask:GF,toArrayBuffer:Foe,toBuffer:$R,unmask:JF};if(!process.env.WS_NO_BUFFER_UTIL)try{let e=qe("bufferutil");wy.exports.mask=function(t,r,n,o,a){a<48?GF(t,r,n,o,a):e.mask(t,r,n,o,a)},wy.exports.unmask=function(t,r){t.length<32?JF(t,r):e.unmask(t,r)}}catch{}});var XF=Be((U0e,YF)=>{"use strict";var KF=Symbol("kDone"),NR=Symbol("kRun"),UR=class{static{i(this,"Limiter")}constructor(t){this[KF]=()=>{this.pending--,this[NR]()},this.concurrency=t||1/0,this.jobs=[],this.pending=0}add(t){this.jobs.push(t),this[NR]()}[NR](){if(this.pending!==this.concurrency&&this.jobs.length){let t=this.jobs.shift();this.pending++,t(this[KF])}}};YF.exports=UR});var Kd=Be((F0e,tz)=>{"use strict";var Fp=qe("zlib"),QF=qp(),zoe=XF(),{kStatusCode:ZF}=_a(),Woe=Buffer[Symbol.species],Voe=Buffer.from([0,0,255,255]),vy=Symbol("permessage-deflate"),Ea=Symbol("total-length"),Gd=Symbol("callback"),ji=Symbol("buffers"),Jd=Symbol("error"),yy,qR=class{static{i(this,"PerMessageDeflate")}constructor(t){if(this._options=t||{},this._threshold=this._options.threshold!==void 0?this._options.threshold:1024,this._maxPayload=this._options.maxPayload|0,this._isServer=!!this._options.isServer,this._deflate=null,this._inflate=null,this.params=null,!yy){let r=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;yy=new zoe(r)}}static get extensionName(){return"permessage-deflate"}offer(){let t={};return this._options.serverNoContextTakeover&&(t.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(t.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(t.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?t.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits==null&&(t.client_max_window_bits=!0),t}accept(t){return t=this.normalizeParams(t),this.params=this._isServer?this.acceptAsServer(t):this.acceptAsClient(t),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){let t=this._deflate[Gd];this._deflate.close(),this._deflate=null,t&&t(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(t){let r=this._options,n=t.find(o=>!(r.serverNoContextTakeover===!1&&o.server_no_context_takeover||o.server_max_window_bits&&(r.serverMaxWindowBits===!1||typeof r.serverMaxWindowBits=="number"&&r.serverMaxWindowBits>o.server_max_window_bits)||typeof r.clientMaxWindowBits=="number"&&!o.client_max_window_bits));if(!n)throw new Error("None of the extension offers can be accepted");return r.serverNoContextTakeover&&(n.server_no_context_takeover=!0),r.clientNoContextTakeover&&(n.client_no_context_takeover=!0),typeof r.serverMaxWindowBits=="number"&&(n.server_max_window_bits=r.serverMaxWindowBits),typeof r.clientMaxWindowBits=="number"?n.client_max_window_bits=r.clientMaxWindowBits:(n.client_max_window_bits===!0||r.clientMaxWindowBits===!1)&&delete n.client_max_window_bits,n}acceptAsClient(t){let r=t[0];if(this._options.clientNoContextTakeover===!1&&r.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(!r.client_max_window_bits)typeof this._options.clientMaxWindowBits=="number"&&(r.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits=="number"&&r.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"');return r}normalizeParams(t){return t.forEach(r=>{Object.keys(r).forEach(n=>{let o=r[n];if(o.length>1)throw new Error(`Parameter "${n}" must have only a single value`);if(o=o[0],n==="client_max_window_bits"){if(o!==!0){let a=+o;if(!Number.isInteger(a)||a<8||a>15)throw new TypeError(`Invalid value for parameter "${n}": ${o}`);o=a}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${n}": ${o}`)}else if(n==="server_max_window_bits"){let a=+o;if(!Number.isInteger(a)||a<8||a>15)throw new TypeError(`Invalid value for parameter "${n}": ${o}`);o=a}else if(n==="client_no_context_takeover"||n==="server_no_context_takeover"){if(o!==!0)throw new TypeError(`Invalid value for parameter "${n}": ${o}`)}else throw new Error(`Unknown parameter "${n}"`);r[n]=o})}),t}decompress(t,r,n){yy.add(o=>{this._decompress(t,r,(a,s)=>{o(),n(a,s)})})}compress(t,r,n){yy.add(o=>{this._compress(t,r,(a,s)=>{o(),n(a,s)})})}_decompress(t,r,n){let o=this._isServer?"client":"server";if(!this._inflate){let a=`${o}_max_window_bits`,s=typeof this.params[a]!="number"?Fp.Z_DEFAULT_WINDOWBITS:this.params[a];this._inflate=Fp.createInflateRaw({...this._options.zlibInflateOptions,windowBits:s}),this._inflate[vy]=this,this._inflate[Ea]=0,this._inflate[ji]=[],this._inflate.on("error",Joe),this._inflate.on("data",ez)}this._inflate[Gd]=n,this._inflate.write(t),r&&this._inflate.write(Voe),this._inflate.flush(()=>{let a=this._inflate[Jd];if(a){this._inflate.close(),this._inflate=null,n(a);return}let s=QF.concat(this._inflate[ji],this._inflate[Ea]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[Ea]=0,this._inflate[ji]=[],r&&this.params[`${o}_no_context_takeover`]&&this._inflate.reset()),n(null,s)})}_compress(t,r,n){let o=this._isServer?"server":"client";if(!this._deflate){let a=`${o}_max_window_bits`,s=typeof this.params[a]!="number"?Fp.Z_DEFAULT_WINDOWBITS:this.params[a];this._deflate=Fp.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:s}),this._deflate[Ea]=0,this._deflate[ji]=[],this._deflate.on("data",Goe)}this._deflate[Gd]=n,this._deflate.write(t),this._deflate.flush(Fp.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let a=QF.concat(this._deflate[ji],this._deflate[Ea]);r&&(a=new Woe(a.buffer,a.byteOffset,a.length-4)),this._deflate[Gd]=null,this._deflate[Ea]=0,this._deflate[ji]=[],r&&this.params[`${o}_no_context_takeover`]&&this._deflate.reset(),n(null,a)})}};tz.exports=qR;function Goe(e){this[ji].push(e),this[Ea]+=e.length}i(Goe,"deflateOnData");function ez(e){if(this[Ea]+=e.length,this[vy]._maxPayload<1||this[Ea]<=this[vy]._maxPayload){this[ji].push(e);return}this[Jd]=new RangeError("Max payload size exceeded"),this[Jd].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[Jd][ZF]=1009,this.removeListener("data",ez),this.reset()}i(ez,"inflateOnData");function Joe(e){if(this[vy]._inflate=null,this[Jd]){this[Gd](this[Jd]);return}e[ZF]=1007,this[Gd](e)}i(Joe,"inflateOnError")});var Yd=Be((W0e,Iy)=>{"use strict";var{isUtf8:rz}=qe("buffer"),{hasBlob:Koe}=_a(),Yoe=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function Xoe(e){return e>=1e3&&e<=1014&&e!==1004&&e!==1005&&e!==1006||e>=3e3&&e<=4999}i(Xoe,"isValidStatusCode");function FR(e){let t=e.length,r=0;for(;r<t;)if((e[r]&128)===0)r++;else if((e[r]&224)===192){if(r+1===t||(e[r+1]&192)!==128||(e[r]&254)===192)return!1;r+=2}else if((e[r]&240)===224){if(r+2>=t||(e[r+1]&192)!==128||(e[r+2]&192)!==128||e[r]===224&&(e[r+1]&224)===128||e[r]===237&&(e[r+1]&224)===160)return!1;r+=3}else if((e[r]&248)===240){if(r+3>=t||(e[r+1]&192)!==128||(e[r+2]&192)!==128||(e[r+3]&192)!==128||e[r]===240&&(e[r+1]&240)===128||e[r]===244&&e[r+1]>143||e[r]>244)return!1;r+=4}else return!1;return!0}i(FR,"_isValidUTF8");function Qoe(e){return Koe&&typeof e=="object"&&typeof e.arrayBuffer=="function"&&typeof e.type=="string"&&typeof e.stream=="function"&&(e[Symbol.toStringTag]==="Blob"||e[Symbol.toStringTag]==="File")}i(Qoe,"isBlob");Iy.exports={isBlob:Qoe,isValidStatusCode:Xoe,isValidUTF8:FR,tokenChars:Yoe};if(rz)Iy.exports.isValidUTF8=function(e){return e.length<24?FR(e):rz(e)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let e=qe("utf-8-validate");Iy.exports.isValidUTF8=function(t){return t.length<32?FR(t):e(t)}}catch{}});var JR=Be((G0e,dz)=>{"use strict";var{Writable:Zoe}=qe("stream"),nz=Kd(),{BINARY_TYPES:eae,EMPTY_BUFFER:oz,kStatusCode:tae,kWebSocket:rae}=_a(),{concat:zR,toArrayBuffer:nae,unmask:oae}=qp(),{isValidStatusCode:aae,isValidUTF8:az}=Yd(),by=Buffer[Symbol.species],Mn=0,iz=1,sz=2,cz=3,WR=4,VR=5,ky=6,GR=class extends Zoe{static{i(this,"Receiver")}constructor(t={}){super(),this._allowSynchronousEvents=t.allowSynchronousEvents!==void 0?t.allowSynchronousEvents:!0,this._binaryType=t.binaryType||eae[0],this._extensions=t.extensions||{},this._isServer=!!t.isServer,this._maxBufferedChunks=t.maxBufferedChunks|0,this._maxFragments=t.maxFragments|0,this._maxPayload=t.maxPayload|0,this._skipUTF8Validation=!!t.skipUTF8Validation,this[rae]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._numFragments=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=Mn}_write(t,r,n){if(this._opcode===8&&this._state==Mn)return n();if(this._maxBufferedChunks>0&&this._buffers.length>=this._maxBufferedChunks){n(this.createError(RangeError,"Too many buffered chunks",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS"));return}this._bufferedBytes+=t.length,this._buffers.push(t),this.startLoop(n)}consume(t){if(this._bufferedBytes-=t,t===this._buffers[0].length)return this._buffers.shift();if(t<this._buffers[0].length){let n=this._buffers[0];return this._buffers[0]=new by(n.buffer,n.byteOffset+t,n.length-t),new by(n.buffer,n.byteOffset,t)}let r=Buffer.allocUnsafe(t);do{let n=this._buffers[0],o=r.length-t;t>=n.length?r.set(this._buffers.shift(),o):(r.set(new Uint8Array(n.buffer,n.byteOffset,t),o),this._buffers[0]=new by(n.buffer,n.byteOffset+t,n.length-t)),t-=n.length}while(t>0);return r}startLoop(t){this._loop=!0;do switch(this._state){case Mn:this.getInfo(t);break;case iz:this.getPayloadLength16(t);break;case sz:this.getPayloadLength64(t);break;case cz:this.getMask();break;case WR:this.getData(t);break;case VR:case ky:this._loop=!1;return}while(this._loop);this._errored||t()}getInfo(t){if(this._bufferedBytes<2){this._loop=!1;return}let r=this.consume(2);if((r[0]&48)!==0){let o=this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");t(o);return}let n=(r[0]&64)===64;if(n&&!this._extensions[nz.extensionName]){let o=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");t(o);return}if(this._fin=(r[0]&128)===128,this._opcode=r[0]&15,this._payloadLength=r[1]&127,this._opcode===0){if(n){let o=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");t(o);return}if(!this._fragmented){let o=this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");t(o);return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){let o=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");t(o);return}this._compressed=n}else if(this._opcode>7&&this._opcode<11){if(!this._fin){let o=this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");t(o);return}if(n){let o=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");t(o);return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){let o=this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");t(o);return}}else{let o=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");t(o);return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(r[1]&128)===128,this._isServer){if(!this._masked){let o=this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK");t(o);return}}else if(this._masked){let o=this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");t(o);return}this._payloadLength===126?this._state=iz:this._payloadLength===127?this._state=sz:this.haveLength(t)}getPayloadLength16(t){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(t)}getPayloadLength64(t){if(this._bufferedBytes<8){this._loop=!1;return}let r=this.consume(8),n=r.readUInt32BE(0);if(n>Math.pow(2,21)-1){let o=this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");t(o);return}this._payloadLength=n*Math.pow(2,32)+r.readUInt32BE(4),this.haveLength(t)}haveLength(t){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)){let r=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");t(r);return}this._masked?this._state=cz:this._state=WR}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=WR}getData(t){let r=oz;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}r=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0&&oae(r,this._mask)}if(this._opcode>7){this.controlMessage(r,t);return}if(this._maxFragments>0&&++this._numFragments>this._maxFragments){let n=this.createError(RangeError,"Too many message fragments",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS");t(n);return}if(this._compressed){this._state=VR,this.decompress(r,t);return}r.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(r)),this.dataMessage(t)}decompress(t,r){this._extensions[nz.extensionName].decompress(t,this._fin,(o,a)=>{if(o)return r(o);if(a.length){if(this._messageLength+=a.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let s=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");r(s);return}this._fragments.push(a)}this.dataMessage(r),this._state===Mn&&this.startLoop(r)})}dataMessage(t){if(!this._fin){this._state=Mn;return}let r=this._messageLength,n=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._numFragments=0,this._fragments=[],this._opcode===2){let o;this._binaryType==="nodebuffer"?o=zR(n,r):this._binaryType==="arraybuffer"?o=nae(zR(n,r)):this._binaryType==="blob"?o=new Blob(n):o=n,this._allowSynchronousEvents?(this.emit("message",o,!0),this._state=Mn):(this._state=ky,setImmediate(()=>{this.emit("message",o,!0),this._state=Mn,this.startLoop(t)}))}else{let o=zR(n,r);if(!this._skipUTF8Validation&&!az(o)){let a=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");t(a);return}this._state===VR||this._allowSynchronousEvents?(this.emit("message",o,!1),this._state=Mn):(this._state=ky,setImmediate(()=>{this.emit("message",o,!1),this._state=Mn,this.startLoop(t)}))}}controlMessage(t,r){if(this._opcode===8){if(t.length===0)this._loop=!1,this.emit("conclude",1005,oz),this.end();else{let n=t.readUInt16BE(0);if(!aae(n)){let a=this.createError(RangeError,`invalid status code ${n}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");r(a);return}let o=new by(t.buffer,t.byteOffset+2,t.length-2);if(!this._skipUTF8Validation&&!az(o)){let a=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");r(a);return}this._loop=!1,this.emit("conclude",n,o),this.end()}this._state=Mn;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?"ping":"pong",t),this._state=Mn):(this._state=ky,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",t),this._state=Mn,this.startLoop(r)}))}createError(t,r,n,o,a){this._loop=!1,this._errored=!0;let s=new t(n?`Invalid WebSocket frame: ${r}`:r);return Error.captureStackTrace(s,this.createError),s.code=a,s[tae]=o,s}};dz.exports=GR});var XR=Be((Y0e,pz)=>{"use strict";var{Duplex:K0e}=qe("stream"),{randomFillSync:iae}=qe("crypto"),{types:{isUint8Array:sae}}=qe("util"),lz=Kd(),{EMPTY_BUFFER:cae,kWebSocket:dae,NOOP:lae}=_a(),{isBlob:Xd,isValidStatusCode:uae}=Yd(),{mask:uz,toBuffer:zs}=qp(),jn=Symbol("kByteLength"),pae=Buffer.alloc(4),Sy=8*1024,Ws,Qd=Sy,ao=0,mae=1,fae=2,KR=class e{static{i(this,"Sender")}constructor(t,r,n){this._extensions=r||{},n&&(this._generateMask=n,this._maskBuffer=Buffer.alloc(4)),this._socket=t,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=ao,this.onerror=lae,this[dae]=void 0}static frame(t,r){let n,o=!1,a=2,s=!1;r.mask&&(n=r.maskBuffer||pae,r.generateMask?r.generateMask(n):(Qd===Sy&&(Ws===void 0&&(Ws=Buffer.alloc(Sy)),iae(Ws,0,Sy),Qd=0),n[0]=Ws[Qd++],n[1]=Ws[Qd++],n[2]=Ws[Qd++],n[3]=Ws[Qd++]),s=(n[0]|n[1]|n[2]|n[3])===0,a=6);let c;typeof t=="string"?(!r.mask||s)&&r[jn]!==void 0?c=r[jn]:(t=Buffer.from(t),c=t.length):(c=t.length,o=r.mask&&r.readOnly&&!s);let d=c;c>=65536?(a+=8,d=127):c>125&&(a+=2,d=126);let l=Buffer.allocUnsafe(o?c+a:a);return l[0]=r.fin?r.opcode|128:r.opcode,r.rsv1&&(l[0]|=64),l[1]=d,d===126?l.writeUInt16BE(c,2):d===127&&(l[2]=l[3]=0,l.writeUIntBE(c,4,6)),r.mask?(l[1]|=128,l[a-4]=n[0],l[a-3]=n[1],l[a-2]=n[2],l[a-1]=n[3],s?[l,t]:o?(uz(t,n,l,a,c),[l]):(uz(t,n,t,0,c),[l,t])):[l,t]}close(t,r,n,o){let a;if(t===void 0)a=cae;else{if(typeof t!="number"||!uae(t))throw new TypeError("First argument must be a valid error code number");if(r===void 0||!r.length)a=Buffer.allocUnsafe(2),a.writeUInt16BE(t,0);else{let c=Buffer.byteLength(r);if(c>123)throw new RangeError("The message must not be greater than 123 bytes");if(a=Buffer.allocUnsafe(2+c),a.writeUInt16BE(t,0),typeof r=="string")a.write(r,2);else if(sae(r))a.set(r,2);else throw new TypeError("Second argument must be a string or a Uint8Array")}}let s={[jn]:a.length,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state!==ao?this.enqueue([this.dispatch,a,!1,s,o]):this.sendFrame(e.frame(a,s),o)}ping(t,r,n){let o,a;if(typeof t=="string"?(o=Buffer.byteLength(t),a=!1):Xd(t)?(o=t.size,a=!1):(t=zs(t),o=t.length,a=zs.readOnly),o>125)throw new RangeError("The data size must not be greater than 125 bytes");let s={[jn]:o,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:9,readOnly:a,rsv1:!1};Xd(t)?this._state!==ao?this.enqueue([this.getBlobData,t,!1,s,n]):this.getBlobData(t,!1,s,n):this._state!==ao?this.enqueue([this.dispatch,t,!1,s,n]):this.sendFrame(e.frame(t,s),n)}pong(t,r,n){let o,a;if(typeof t=="string"?(o=Buffer.byteLength(t),a=!1):Xd(t)?(o=t.size,a=!1):(t=zs(t),o=t.length,a=zs.readOnly),o>125)throw new RangeError("The data size must not be greater than 125 bytes");let s={[jn]:o,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:10,readOnly:a,rsv1:!1};Xd(t)?this._state!==ao?this.enqueue([this.getBlobData,t,!1,s,n]):this.getBlobData(t,!1,s,n):this._state!==ao?this.enqueue([this.dispatch,t,!1,s,n]):this.sendFrame(e.frame(t,s),n)}send(t,r,n){let o=this._extensions[lz.extensionName],a=r.binary?2:1,s=r.compress,c,d;typeof t=="string"?(c=Buffer.byteLength(t),d=!1):Xd(t)?(c=t.size,d=!1):(t=zs(t),c=t.length,d=zs.readOnly),this._firstFragment?(this._firstFragment=!1,s&&o&&o.params[o._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(s=c>=o._threshold),this._compress=s):(s=!1,a=0),r.fin&&(this._firstFragment=!0);let l={[jn]:c,fin:r.fin,generateMask:this._generateMask,mask:r.mask,maskBuffer:this._maskBuffer,opcode:a,readOnly:d,rsv1:s};Xd(t)?this._state!==ao?this.enqueue([this.getBlobData,t,this._compress,l,n]):this.getBlobData(t,this._compress,l,n):this._state!==ao?this.enqueue([this.dispatch,t,this._compress,l,n]):this.dispatch(t,this._compress,l,n)}getBlobData(t,r,n,o){this._bufferedBytes+=n[jn],this._state=fae,t.arrayBuffer().then(a=>{if(this._socket.destroyed){let c=new Error("The socket was closed while the blob was being read");process.nextTick(YR,this,c,o);return}this._bufferedBytes-=n[jn];let s=zs(a);r?this.dispatch(s,r,n,o):(this._state=ao,this.sendFrame(e.frame(s,n),o),this.dequeue())}).catch(a=>{process.nextTick(hae,this,a,o)})}dispatch(t,r,n,o){if(!r){this.sendFrame(e.frame(t,n),o);return}let a=this._extensions[lz.extensionName];this._bufferedBytes+=n[jn],this._state=mae,a.compress(t,n.fin,(s,c)=>{if(this._socket.destroyed){let d=new Error("The socket was closed while data was being compressed");YR(this,d,o);return}this._bufferedBytes-=n[jn],this._state=ao,n.readOnly=!1,this.sendFrame(e.frame(c,n),o),this.dequeue()})}dequeue(){for(;this._state===ao&&this._queue.length;){let t=this._queue.shift();this._bufferedBytes-=t[3][jn],Reflect.apply(t[0],this,t.slice(1))}}enqueue(t){this._bufferedBytes+=t[3][jn],this._queue.push(t)}sendFrame(t,r){t.length===2?(this._socket.cork(),this._socket.write(t[0]),this._socket.write(t[1],r),this._socket.uncork()):this._socket.write(t[0],r)}};pz.exports=KR;function YR(e,t,r){typeof r=="function"&&r(t);for(let n=0;n<e._queue.length;n++){let o=e._queue[n],a=o[o.length-1];typeof a=="function"&&a(t)}}i(YR,"callCallbacks");function hae(e,t,r){YR(e,t,r),e.onerror(t)}i(hae,"onError")});var bz=Be((Q0e,Iz)=>{"use strict";var{kForOnEventAttribute:zp,kListener:QR}=_a(),mz=Symbol("kCode"),fz=Symbol("kData"),hz=Symbol("kError"),gz=Symbol("kMessage"),wz=Symbol("kReason"),Zd=Symbol("kTarget"),yz=Symbol("kType"),vz=Symbol("kWasClean"),Ta=class{static{i(this,"Event")}constructor(t){this[Zd]=null,this[yz]=t}get target(){return this[Zd]}get type(){return this[yz]}};Object.defineProperty(Ta.prototype,"target",{enumerable:!0});Object.defineProperty(Ta.prototype,"type",{enumerable:!0});var Vs=class extends Ta{static{i(this,"CloseEvent")}constructor(t,r={}){super(t),this[mz]=r.code===void 0?0:r.code,this[wz]=r.reason===void 0?"":r.reason,this[vz]=r.wasClean===void 0?!1:r.wasClean}get code(){return this[mz]}get reason(){return this[wz]}get wasClean(){return this[vz]}};Object.defineProperty(Vs.prototype,"code",{enumerable:!0});Object.defineProperty(Vs.prototype,"reason",{enumerable:!0});Object.defineProperty(Vs.prototype,"wasClean",{enumerable:!0});var el=class extends Ta{static{i(this,"ErrorEvent")}constructor(t,r={}){super(t),this[hz]=r.error===void 0?null:r.error,this[gz]=r.message===void 0?"":r.message}get error(){return this[hz]}get message(){return this[gz]}};Object.defineProperty(el.prototype,"error",{enumerable:!0});Object.defineProperty(el.prototype,"message",{enumerable:!0});var Wp=class extends Ta{static{i(this,"MessageEvent")}constructor(t,r={}){super(t),this[fz]=r.data===void 0?null:r.data}get data(){return this[fz]}};Object.defineProperty(Wp.prototype,"data",{enumerable:!0});var gae={addEventListener(e,t,r={}){for(let o of this.listeners(e))if(!r[zp]&&o[QR]===t&&!o[zp])return;let n;if(e==="message")n=i(function(a,s){let c=new Wp("message",{data:s?a:a.toString()});c[Zd]=this,Py(t,this,c)},"onMessage");else if(e==="close")n=i(function(a,s){let c=new Vs("close",{code:a,reason:s.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});c[Zd]=this,Py(t,this,c)},"onClose");else if(e==="error")n=i(function(a){let s=new el("error",{error:a,message:a.message});s[Zd]=this,Py(t,this,s)},"onError");else if(e==="open")n=i(function(){let a=new Ta("open");a[Zd]=this,Py(t,this,a)},"onOpen");else return;n[zp]=!!r[zp],n[QR]=t,r.once?this.once(e,n):this.on(e,n)},removeEventListener(e,t){for(let r of this.listeners(e))if(r[QR]===t&&!r[zp]){this.removeListener(e,r);break}}};Iz.exports={CloseEvent:Vs,ErrorEvent:el,Event:Ta,EventTarget:gae,MessageEvent:Wp};function Py(e,t,r){typeof e=="object"&&e.handleEvent?e.handleEvent.call(e,r):e.call(t,r)}i(Py,"callListener")});var Ry=Be((eMe,kz)=>{"use strict";var{tokenChars:Vp}=Yd();function zo(e,t,r){e[t]===void 0?e[t]=[r]:e[t].push(r)}i(zo,"push");function wae(e){let t=Object.create(null),r=Object.create(null),n=!1,o=!1,a=!1,s,c,d=-1,l=-1,u=-1,p=0;for(;p<e.length;p++)if(l=e.charCodeAt(p),s===void 0)if(u===-1&&Vp[l]===1)d===-1&&(d=p);else if(p!==0&&(l===32||l===9))u===-1&&d!==-1&&(u=p);else if(l===59||l===44){if(d===-1)throw new SyntaxError(`Unexpected character at index ${p}`);u===-1&&(u=p);let g=e.slice(d,u);l===44?(zo(t,g,r),r=Object.create(null)):s=g,d=u=-1}else throw new SyntaxError(`Unexpected character at index ${p}`);else if(c===void 0)if(u===-1&&Vp[l]===1)d===-1&&(d=p);else if(l===32||l===9)u===-1&&d!==-1&&(u=p);else if(l===59||l===44){if(d===-1)throw new SyntaxError(`Unexpected character at index ${p}`);u===-1&&(u=p),zo(r,e.slice(d,u),!0),l===44&&(zo(t,s,r),r=Object.create(null),s=void 0),d=u=-1}else if(l===61&&d!==-1&&u===-1)c=e.slice(d,p),d=u=-1;else throw new SyntaxError(`Unexpected character at index ${p}`);else if(o){if(Vp[l]!==1)throw new SyntaxError(`Unexpected character at index ${p}`);d===-1?d=p:n||(n=!0),o=!1}else if(a)if(Vp[l]===1)d===-1&&(d=p);else if(l===34&&d!==-1)a=!1,u=p;else if(l===92)o=!0;else throw new SyntaxError(`Unexpected character at index ${p}`);else if(l===34&&e.charCodeAt(p-1)===61)a=!0;else if(u===-1&&Vp[l]===1)d===-1&&(d=p);else if(d!==-1&&(l===32||l===9))u===-1&&(u=p);else if(l===59||l===44){if(d===-1)throw new SyntaxError(`Unexpected character at index ${p}`);u===-1&&(u=p);let g=e.slice(d,u);n&&(g=g.replace(/\\/g,""),n=!1),zo(r,c,g),l===44&&(zo(t,s,r),r=Object.create(null),s=void 0),c=void 0,d=u=-1}else throw new SyntaxError(`Unexpected character at index ${p}`);if(d===-1||a||l===32||l===9)throw new SyntaxError("Unexpected end of input");u===-1&&(u=p);let m=e.slice(d,u);return s===void 0?zo(t,m,r):(c===void 0?zo(r,m,!0):n?zo(r,c,m.replace(/\\/g,"")):zo(r,c,m),zo(t,s,r)),t}i(wae,"parse");function yae(e){return Object.keys(e).map(t=>{let r=e[t];return Array.isArray(r)||(r=[r]),r.map(n=>[t].concat(Object.keys(n).map(o=>{let a=n[o];return Array.isArray(a)||(a=[a]),a.map(s=>s===!0?o:`${o}=${s}`).join("; ")})).join("; ")).join(", ")}).join(", ")}i(yae,"format");kz.exports={format:yae,parse:wae}});var Ty=Be((oMe,Oz)=>{"use strict";var vae=qe("events"),Iae=qe("https"),bae=qe("http"),Rz=qe("net"),kae=qe("tls"),{randomBytes:Sae,createHash:Pae}=qe("crypto"),{Duplex:rMe,Readable:nMe}=qe("stream"),{URL:ZR}=qe("url"),Oi=Kd(),Rae=JR(),xae=XR(),{isBlob:_ae}=Yd(),{BINARY_TYPES:Sz,CLOSE_TIMEOUT:Eae,EMPTY_BUFFER:xy,GUID:Tae,kForOnEventAttribute:ex,kListener:Cae,kStatusCode:Aae,kWebSocket:Vt,NOOP:xz}=_a(),{EventTarget:{addEventListener:Mae,removeEventListener:jae}}=bz(),{format:Oae,parse:Hae}=Ry(),{toBuffer:Dae}=qp(),_z=Symbol("kAborted"),tx=[8,13],Ca=["CONNECTING","OPEN","CLOSING","CLOSED"],Lae=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,yt=class e extends vae{static{i(this,"WebSocket")}constructor(t,r,n){super(),this._binaryType=Sz[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=xy,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol="",this._readyState=e.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,t!==null?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,r===void 0?r=[]:Array.isArray(r)||(typeof r=="object"&&r!==null?(n=r,r=[]):r=[r]),Ez(this,t,r,n)):(this._autoPong=n.autoPong,this._closeTimeout=n.closeTimeout,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(t){Sz.includes(t)&&(this._binaryType=t,this._receiver&&(this._receiver._binaryType=t))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(t,r,n){let o=new Rae({allowSynchronousEvents:n.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxBufferedChunks:n.maxBufferedChunks,maxFragments:n.maxFragments,maxPayload:n.maxPayload,skipUTF8Validation:n.skipUTF8Validation}),a=new xae(t,this._extensions,n.generateMask);this._receiver=o,this._sender=a,this._socket=t,o[Vt]=this,a[Vt]=this,t[Vt]=this,o.on("conclude",Nae),o.on("drain",Uae),o.on("error",qae),o.on("message",Fae),o.on("ping",zae),o.on("pong",Wae),a.onerror=Vae,t.setTimeout&&t.setTimeout(0),t.setNoDelay&&t.setNoDelay(),r.length>0&&t.unshift(r),t.on("close",Az),t.on("data",Ey),t.on("end",Mz),t.on("error",jz),this._readyState=e.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=e.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[Oi.extensionName]&&this._extensions[Oi.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=e.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(t,r){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){pn(this,this._req,"WebSocket was closed before the connection was established");return}if(this.readyState===e.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=e.CLOSING,this._sender.close(t,r,!this._isServer,n=>{n||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),Cz(this)}}pause(){this.readyState===e.CONNECTING||this.readyState===e.CLOSED||(this._paused=!0,this._socket.pause())}ping(t,r,n){if(this.readyState===e.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof t=="function"?(n=t,t=r=void 0):typeof r=="function"&&(n=r,r=void 0),typeof t=="number"&&(t=t.toString()),this.readyState!==e.OPEN){rx(this,t,n);return}r===void 0&&(r=!this._isServer),this._sender.ping(t||xy,r,n)}pong(t,r,n){if(this.readyState===e.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof t=="function"?(n=t,t=r=void 0):typeof r=="function"&&(n=r,r=void 0),typeof t=="number"&&(t=t.toString()),this.readyState!==e.OPEN){rx(this,t,n);return}r===void 0&&(r=!this._isServer),this._sender.pong(t||xy,r,n)}resume(){this.readyState===e.CONNECTING||this.readyState===e.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(t,r,n){if(this.readyState===e.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof r=="function"&&(n=r,r={}),typeof t=="number"&&(t=t.toString()),this.readyState!==e.OPEN){rx(this,t,n);return}let o={binary:typeof t!="string",mask:!this._isServer,compress:!0,fin:!0,...r};this._extensions[Oi.extensionName]||(o.compress=!1),this._sender.send(t||xy,o,n)}terminate(){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){pn(this,this._req,"WebSocket was closed before the connection was established");return}this._socket&&(this._readyState=e.CLOSING,this._socket.destroy())}}};Object.defineProperty(yt,"CONNECTING",{enumerable:!0,value:Ca.indexOf("CONNECTING")});Object.defineProperty(yt.prototype,"CONNECTING",{enumerable:!0,value:Ca.indexOf("CONNECTING")});Object.defineProperty(yt,"OPEN",{enumerable:!0,value:Ca.indexOf("OPEN")});Object.defineProperty(yt.prototype,"OPEN",{enumerable:!0,value:Ca.indexOf("OPEN")});Object.defineProperty(yt,"CLOSING",{enumerable:!0,value:Ca.indexOf("CLOSING")});Object.defineProperty(yt.prototype,"CLOSING",{enumerable:!0,value:Ca.indexOf("CLOSING")});Object.defineProperty(yt,"CLOSED",{enumerable:!0,value:Ca.indexOf("CLOSED")});Object.defineProperty(yt.prototype,"CLOSED",{enumerable:!0,value:Ca.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(e=>{Object.defineProperty(yt.prototype,e,{enumerable:!0})});["open","error","close","message"].forEach(e=>{Object.defineProperty(yt.prototype,`on${e}`,{enumerable:!0,get(){for(let t of this.listeners(e))if(t[ex])return t[Cae];return null},set(t){for(let r of this.listeners(e))if(r[ex]){this.removeListener(e,r);break}typeof t=="function"&&this.addEventListener(e,t,{[ex]:!0})}})});yt.prototype.addEventListener=Mae;yt.prototype.removeEventListener=jae;Oz.exports=yt;function Ez(e,t,r,n){let o={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:Eae,protocolVersion:tx[1],maxBufferedChunks:262144,maxFragments:16384,maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...n,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(e._autoPong=o.autoPong,e._closeTimeout=o.closeTimeout,!tx.includes(o.protocolVersion))throw new RangeError(`Unsupported protocol version: ${o.protocolVersion} (supported versions: ${tx.join(", ")})`);let a;if(t instanceof ZR)a=t;else try{a=new ZR(t)}catch{throw new SyntaxError(`Invalid URL: ${t}`)}a.protocol==="http:"?a.protocol="ws:":a.protocol==="https:"&&(a.protocol="wss:"),e._url=a.href;let s=a.protocol==="wss:",c=a.protocol==="ws+unix:",d;if(a.protocol!=="ws:"&&!s&&!c?d=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:c&&!a.pathname?d="The URL's pathname is empty":a.hash&&(d="The URL contains a fragment identifier"),d){let h=new SyntaxError(d);if(e._redirects===0)throw h;_y(e,h);return}let l=s?443:80,u=Sae(16).toString("base64"),p=s?Iae.request:bae.request,m=new Set,g;if(o.createConnection=o.createConnection||(s?$ae:Bae),o.defaultPort=o.defaultPort||l,o.port=a.port||l,o.host=a.hostname.startsWith("[")?a.hostname.slice(1,-1):a.hostname,o.headers={...o.headers,"Sec-WebSocket-Version":o.protocolVersion,"Sec-WebSocket-Key":u,Connection:"Upgrade",Upgrade:"websocket"},o.path=a.pathname+a.search,o.timeout=o.handshakeTimeout,o.perMessageDeflate&&(g=new Oi({...o.perMessageDeflate,isServer:!1,maxPayload:o.maxPayload}),o.headers["Sec-WebSocket-Extensions"]=Oae({[Oi.extensionName]:g.offer()})),r.length){for(let h of r){if(typeof h!="string"||!Lae.test(h)||m.has(h))throw new SyntaxError("An invalid or duplicated subprotocol was specified");m.add(h)}o.headers["Sec-WebSocket-Protocol"]=r.join(",")}if(o.origin&&(o.protocolVersion<13?o.headers["Sec-WebSocket-Origin"]=o.origin:o.headers.Origin=o.origin),(a.username||a.password)&&(o.auth=`${a.username}:${a.password}`),c){let h=o.path.split(":");o.socketPath=h[0],o.path=h[1]}let w;if(o.followRedirects){if(e._redirects===0){e._originalIpc=c,e._originalSecure=s,e._originalHostOrSocketPath=c?o.socketPath:a.host;let h=n&&n.headers;if(n={...n,headers:{}},h)for(let[y,f]of Object.entries(h))n.headers[y.toLowerCase()]=f}else if(e.listenerCount("redirect")===0){let h=c?e._originalIpc?o.socketPath===e._originalHostOrSocketPath:!1:e._originalIpc?!1:a.host===e._originalHostOrSocketPath;(!h||e._originalSecure&&!s)&&(delete o.headers.authorization,delete o.headers.cookie,h||delete o.headers.host,o.auth=void 0)}o.auth&&!n.headers.authorization&&(n.headers.authorization="Basic "+Buffer.from(o.auth).toString("base64")),w=e._req=p(o),e._redirects&&e.emit("redirect",e.url,w)}else w=e._req=p(o);o.timeout&&w.on("timeout",()=>{pn(e,w,"Opening handshake has timed out")}),w.on("error",h=>{w===null||w[_z]||(w=e._req=null,_y(e,h))}),w.on("response",h=>{let y=h.headers.location,f=h.statusCode;if(y&&o.followRedirects&&f>=300&&f<400){if(++e._redirects>o.maxRedirects){pn(e,w,"Maximum redirects exceeded");return}w.abort();let S;try{S=new ZR(y,t)}catch{let I=new SyntaxError(`Invalid URL: ${y}`);_y(e,I);return}Ez(e,S,r,n)}else e.emit("unexpected-response",w,h)||pn(e,w,`Unexpected server response: ${h.statusCode}`)}),w.on("upgrade",(h,y,f)=>{if(e.emit("upgrade",h),e.readyState!==yt.CONNECTING)return;w=e._req=null;let S=h.headers.upgrade;if(S===void 0||S.toLowerCase()!=="websocket"){pn(e,y,"Invalid Upgrade header");return}let k=Pae("sha1").update(u+Tae).digest("base64");if(h.headers["sec-websocket-accept"]!==k){pn(e,y,"Invalid Sec-WebSocket-Accept header");return}let I=h.headers["sec-websocket-protocol"],b;if(I!==void 0?m.size?m.has(I)||(b="Server sent an invalid subprotocol"):b="Server sent a subprotocol but none was requested":m.size&&(b="Server sent no subprotocol"),b){pn(e,y,b);return}I&&(e._protocol=I);let R=h.headers["sec-websocket-extensions"];if(R!==void 0){if(!g){pn(e,y,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let _;try{_=Hae(R)}catch{pn(e,y,"Invalid Sec-WebSocket-Extensions header");return}let P=Object.keys(_);if(P.length!==1||P[0]!==Oi.extensionName){pn(e,y,"Server indicated an extension that was not requested");return}try{g.accept(_[Oi.extensionName])}catch{pn(e,y,"Invalid Sec-WebSocket-Extensions header");return}e._extensions[Oi.extensionName]=g}e.setSocket(y,f,{allowSynchronousEvents:o.allowSynchronousEvents,generateMask:o.generateMask,maxBufferedChunks:o.maxBufferedChunks,maxFragments:o.maxFragments,maxPayload:o.maxPayload,skipUTF8Validation:o.skipUTF8Validation})}),o.finishRequest?o.finishRequest(w,e):w.end()}i(Ez,"initAsClient");function _y(e,t){e._readyState=yt.CLOSING,e._errorEmitted=!0,e.emit("error",t),e.emitClose()}i(_y,"emitErrorAndClose");function Bae(e){return e.path=e.socketPath,Rz.connect(e)}i(Bae,"netConnect");function $ae(e){return e.path=void 0,!e.servername&&e.servername!==""&&(e.servername=Rz.isIP(e.host)?"":e.host),kae.connect(e)}i($ae,"tlsConnect");function pn(e,t,r){e._readyState=yt.CLOSING;let n=new Error(r);Error.captureStackTrace(n,pn),t.setHeader?(t[_z]=!0,t.abort(),t.socket&&!t.socket.destroyed&&t.socket.destroy(),process.nextTick(_y,e,n)):(t.destroy(n),t.once("error",e.emit.bind(e,"error")),t.once("close",e.emitClose.bind(e)))}i(pn,"abortHandshake");function rx(e,t,r){if(t){let n=_ae(t)?t.size:Dae(t).length;e._socket?e._sender._bufferedBytes+=n:e._bufferedAmount+=n}if(r){let n=new Error(`WebSocket is not open: readyState ${e.readyState} (${Ca[e.readyState]})`);process.nextTick(r,n)}}i(rx,"sendAfterClose");function Nae(e,t){let r=this[Vt];r._closeFrameReceived=!0,r._closeMessage=t,r._closeCode=e,r._socket[Vt]!==void 0&&(r._socket.removeListener("data",Ey),process.nextTick(Tz,r._socket),e===1005?r.close():r.close(e,t))}i(Nae,"receiverOnConclude");function Uae(){let e=this[Vt];e.isPaused||e._socket.resume()}i(Uae,"receiverOnDrain");function qae(e){let t=this[Vt];t._socket[Vt]!==void 0&&(t._socket.removeListener("data",Ey),process.nextTick(Tz,t._socket),t.close(e[Aae])),t._errorEmitted||(t._errorEmitted=!0,t.emit("error",e))}i(qae,"receiverOnError");function Pz(){this[Vt].emitClose()}i(Pz,"receiverOnFinish");function Fae(e,t){this[Vt].emit("message",e,t)}i(Fae,"receiverOnMessage");function zae(e){let t=this[Vt];t._autoPong&&t.pong(e,!this._isServer,xz),t.emit("ping",e)}i(zae,"receiverOnPing");function Wae(e){this[Vt].emit("pong",e)}i(Wae,"receiverOnPong");function Tz(e){e.resume()}i(Tz,"resume");function Vae(e){let t=this[Vt];t.readyState!==yt.CLOSED&&(t.readyState===yt.OPEN&&(t._readyState=yt.CLOSING,Cz(t)),this._socket.end(),t._errorEmitted||(t._errorEmitted=!0,t.emit("error",e)))}i(Vae,"senderOnError");function Cz(e){e._closeTimer=setTimeout(e._socket.destroy.bind(e._socket),e._closeTimeout)}i(Cz,"setCloseTimer");function Az(){let e=this[Vt];if(this.removeListener("close",Az),this.removeListener("data",Ey),this.removeListener("end",Mz),e._readyState=yt.CLOSING,!this._readableState.endEmitted&&!e._closeFrameReceived&&!e._receiver._writableState.errorEmitted&&this._readableState.length!==0){let t=this.read(this._readableState.length);e._receiver.write(t)}e._receiver.end(),this[Vt]=void 0,clearTimeout(e._closeTimer),e._receiver._writableState.finished||e._receiver._writableState.errorEmitted?e.emitClose():(e._receiver.on("error",Pz),e._receiver.on("finish",Pz))}i(Az,"socketOnClose");function Ey(e){this[Vt]._receiver.write(e)||this.pause()}i(Ey,"socketOnData");function Mz(){let e=this[Vt];e._readyState=yt.CLOSING,e._receiver.end(),this.end()}i(Mz,"socketOnEnd");function jz(){let e=this[Vt];this.removeListener("error",jz),this.on("error",xz),e&&(e._readyState=yt.CLOSING,this.destroy())}i(jz,"socketOnError")});var Bz=Be((sMe,Lz)=>{"use strict";var iMe=Ty(),{Duplex:Gae}=qe("stream");function Hz(e){e.emit("close")}i(Hz,"emitClose");function Jae(){!this.destroyed&&this._writableState.finished&&this.destroy()}i(Jae,"duplexOnEnd");function Dz(e){this.removeListener("error",Dz),this.destroy(),this.listenerCount("error")===0&&this.emit("error",e)}i(Dz,"duplexOnError");function Kae(e,t){let r=!0,n=new Gae({...t,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return e.on("message",i(function(a,s){let c=!s&&n._readableState.objectMode?a.toString():a;n.push(c)||e.pause()},"message")),e.once("error",i(function(a){n.destroyed||(r=!1,n.destroy(a))},"error")),e.once("close",i(function(){n.destroyed||n.push(null)},"close")),n._destroy=function(o,a){if(e.readyState===e.CLOSED){a(o),process.nextTick(Hz,n);return}let s=!1;e.once("error",i(function(d){s=!0,a(d)},"error")),e.once("close",i(function(){s||a(o),process.nextTick(Hz,n)},"close")),r&&e.terminate()},n._final=function(o){if(e.readyState===e.CONNECTING){e.once("open",i(function(){n._final(o)},"open"));return}e._socket!==null&&(e._socket._writableState.finished?(o(),n._readableState.endEmitted&&n.destroy()):(e._socket.once("finish",i(function(){o()},"finish")),e.close()))},n._read=function(){e.isPaused&&e.resume()},n._write=function(o,a,s){if(e.readyState===e.CONNECTING){e.once("open",i(function(){n._write(o,a,s)},"open"));return}e.send(o,s)},n.on("end",Jae),n.on("error",Dz),n}i(Kae,"createWebSocketStream");Lz.exports=Kae});var nx=Be((dMe,$z)=>{"use strict";var{tokenChars:Yae}=Yd();function Xae(e){let t=new Set,r=-1,n=-1,o=0;for(o;o<e.length;o++){let s=e.charCodeAt(o);if(n===-1&&Yae[s]===1)r===-1&&(r=o);else if(o!==0&&(s===32||s===9))n===-1&&r!==-1&&(n=o);else if(s===44){if(r===-1)throw new SyntaxError(`Unexpected character at index ${o}`);n===-1&&(n=o);let c=e.slice(r,n);if(t.has(c))throw new SyntaxError(`The "${c}" subprotocol is duplicated`);t.add(c),r=n=-1}else throw new SyntaxError(`Unexpected character at index ${o}`)}if(r===-1||n!==-1)throw new SyntaxError("Unexpected end of input");let a=e.slice(r,o);if(t.has(a))throw new SyntaxError(`The "${a}" subprotocol is duplicated`);return t.add(a),t}i(Xae,"parse");$z.exports={parse:Xae}});var Vz=Be((pMe,Wz)=>{"use strict";var Qae=qe("events"),Cy=qe("http"),{Duplex:uMe}=qe("stream"),{createHash:Zae}=qe("crypto"),Nz=Ry(),Gs=Kd(),eie=nx(),tie=Ty(),{CLOSE_TIMEOUT:rie,GUID:nie,kWebSocket:oie}=_a(),aie=/^[+/0-9A-Za-z]{22}==$/,Uz=0,qz=1,zz=2,ox=class extends Qae{static{i(this,"WebSocketServer")}constructor(t,r){if(super(),t={allowSynchronousEvents:!0,autoPong:!0,maxBufferedChunks:256*1024,maxFragments:16*1024,maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:rie,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:tie,...t},t.port==null&&!t.server&&!t.noServer||t.port!=null&&(t.server||t.noServer)||t.server&&t.noServer)throw new TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(t.port!=null?(this._server=Cy.createServer((n,o)=>{let a=Cy.STATUS_CODES[426];o.writeHead(426,{"Content-Length":a.length,"Content-Type":"text/plain"}),o.end(a)}),this._server.listen(t.port,t.host,t.backlog,r)):t.server&&(this._server=t.server),this._server){let n=this.emit.bind(this,"connection");this._removeListeners=iie(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:i((o,a,s)=>{this.handleUpgrade(o,a,s,n)},"upgrade")})}t.perMessageDeflate===!0&&(t.perMessageDeflate={}),t.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=t,this._state=Uz}address(){if(this.options.noServer)throw new Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(t){if(this._state===zz){t&&this.once("close",()=>{t(new Error("The server is not running"))}),process.nextTick(Gp,this);return}if(t&&this.once("close",t),this._state!==qz)if(this._state=qz,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients?this.clients.size?this._shouldEmitClose=!0:process.nextTick(Gp,this):process.nextTick(Gp,this);else{let r=this._server;this._removeListeners(),this._removeListeners=this._server=null,r.close(()=>{Gp(this)})}}shouldHandle(t){if(this.options.path){let r=t.url.indexOf("?");if((r!==-1?t.url.slice(0,r):t.url)!==this.options.path)return!1}return!0}handleUpgrade(t,r,n,o){r.on("error",Fz);let a=t.headers["sec-websocket-key"],s=t.headers.upgrade,c=+t.headers["sec-websocket-version"];if(t.method!=="GET"){Js(this,t,r,405,"Invalid HTTP method");return}if(s===void 0||s.toLowerCase()!=="websocket"){Js(this,t,r,400,"Invalid Upgrade header");return}if(a===void 0||!aie.test(a)){Js(this,t,r,400,"Missing or invalid Sec-WebSocket-Key header");return}if(c!==13&&c!==8){Js(this,t,r,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});return}if(!this.shouldHandle(t)){Jp(r,400);return}let d=t.headers["sec-websocket-protocol"],l=new Set;if(d!==void 0)try{l=eie.parse(d)}catch{Js(this,t,r,400,"Invalid Sec-WebSocket-Protocol header");return}let u=t.headers["sec-websocket-extensions"],p={};if(this.options.perMessageDeflate&&u!==void 0){let m=new Gs({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let g=Nz.parse(u);g[Gs.extensionName]&&(m.accept(g[Gs.extensionName]),p[Gs.extensionName]=m)}catch{Js(this,t,r,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let m={origin:t.headers[`${c===8?"sec-websocket-origin":"origin"}`],secure:!!(t.socket.authorized||t.socket.encrypted),req:t};if(this.options.verifyClient.length===2){this.options.verifyClient(m,(g,w,h,y)=>{if(!g)return Jp(r,w||401,h,y);this.completeUpgrade(p,a,l,t,r,n,o)});return}if(!this.options.verifyClient(m))return Jp(r,401)}this.completeUpgrade(p,a,l,t,r,n,o)}completeUpgrade(t,r,n,o,a,s,c){if(!a.readable||!a.writable)return a.destroy();if(a[oie])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>Uz)return Jp(a,503);let l=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${Zae("sha1").update(r+nie).digest("base64")}`],u=new this.options.WebSocket(null,void 0,this.options);if(n.size){let p=this.options.handleProtocols?this.options.handleProtocols(n,o):n.values().next().value;p&&(l.push(`Sec-WebSocket-Protocol: ${p}`),u._protocol=p)}if(t[Gs.extensionName]){let p=t[Gs.extensionName].params,m=Nz.format({[Gs.extensionName]:[p]});l.push(`Sec-WebSocket-Extensions: ${m}`),u._extensions=t}this.emit("headers",l,o),a.write(l.concat(`\r
3
+ import{a as Lq,b as Bq,c as $q}from"./chunk-YXMYK5P7.js";import"./chunk-S4WILIRA.js";import{c as bq}from"./chunk-QUNQM2E3.js";import{a as kq,b as Sq,c as Pq,d as Rq,e as xq,f as _q,g as Eq,h as Tq,i as Cq,j as Aq}from"./chunk-OL3L3U36.js";import{a as or,b as Op,c as xa,d as iy,e as sy,f as Ei}from"./chunk-ZDEIVUUI.js";import{a as Mq,b as jq,c as Oq,d as M,e as Hq,f as Ti,g as z,h as cy,j as Dq}from"./chunk-7TM25J6S.js";import{a as ay,b as vq}from"./chunk-5JVJQA5H.js";import{a as HU,b as FU,c as hR,d as zU,e as WU,f as VU,g as GU,h as JU,j as KU}from"./chunk-6C6ZCYTL.js";import{A as fR,a as MU,c as jU,g as OU,k as ey,l as Fo,m as DU,n as Pa,o as ty,p as LU,q as Ri,r as ry,s as BU,t as Ra,u as ny,v as xi,w as $U,x as NU,y as UU,z as qU}from"./chunk-OXQ2WFIH.js";import{a as YU,b as XU,c as oy,d as QU,e as _i,f as Je,g as ZU,h as Pe,i as eq,j as tq,k as rq,l as nq,m as oq,n as aq,o as iq,p as sq,q as cq,r as dq,s as lq,t as $r,u as Pr,v as pe,w as uq}from"./chunk-FHDH4OUA.js";import{a as pq,b as mq}from"./chunk-Q7P34B2O.js";import{a as fq,b as hq}from"./chunk-ESYPMD7Q.js";import{c as mR}from"./chunk-CO23RRN7.js";import{a as gq,b as wq,c as yq}from"./chunk-KCLMA2IH.js";import"./chunk-FNGZ4UDZ.js";import{a as Yw,b as yU,c as vU,d as IU,e as bU}from"./chunk-VWWKWYSQ.js";import{a as Sa,c as Ww,d as Ud,e as pU,f as mU,g as kr,h as fU,i as Gw,j as hU,k as Sr,l as Jw,m as gU,n as Yr,o as Kw,p as wU,r as PU}from"./chunk-OUJ63LMU.js";import{a as Xw,b as kU,c as pR}from"./chunk-EFP75UEX.js";import{b as SU,c as Qw}from"./chunk-PACLKDTN.js";import{a as un}from"./chunk-ZIQJDTQB.js";import"./chunk-S7A2OGL2.js";import{a as lU,e as Vw}from"./chunk-3Z4VM2LF.js";import{a as xS,b as WM}from"./chunk-EICS777E.js";import{a as RU}from"./chunk-MIFVX5PK.js";import"./chunk-WLQEONBF.js";import"./chunk-3A2Y7UK3.js";import{b as xU}from"./chunk-EXAJ2B4I.js";import{a as _U,b as Zw,c as EU,d as TU,e as CU}from"./chunk-EWH64WRR.js";import{b as AU}from"./chunk-JVNKSU27.js";import{a as rU,b as nU,c as Uw,d as qw}from"./chunk-XVDFJ3ZF.js";import{b as dU}from"./chunk-M4A7G4S5.js";import{b as cU,c as lR}from"./chunk-Q3WXB465.js";import"./chunk-JQOVC35K.js";import{a as sU}from"./chunk-FEAKTSRS.js";import"./chunk-Q73RKX7I.js";import{a as oo,b as zw,c as uR,d as uU}from"./chunk-TPOAAJKA.js";import"./chunk-ZYLLPRPU.js";import{a as Z2,b as eU,c as tU}from"./chunk-XYZV3FKD.js";import{h as oe}from"./chunk-RCQYEHHD.js";import"./chunk-SDO4FC4Q.js";import"./chunk-IR3YJWPW.js";import{a as J2,b as $w}from"./chunk-SDHG6CKU.js";import{a as Ns,b as Nw,c as X2,d as Q2}from"./chunk-XHACK2KR.js";import"./chunk-W45RKGM6.js";import"./chunk-GYYJ47GX.js";import{a as Lw,d as Bw,f as K2,g as Y2}from"./chunk-WCNPGKST.js";import{a as G2}from"./chunk-DWF3FCY4.js";import{b as W2,c as V2,d as Nd,f as Dw,g as Mp}from"./chunk-YAA7F5LI.js";import{b as jp,c as ka}from"./chunk-AFH462DO.js";import"./chunk-UANH7U3Y.js";import{a as no,b as F2,c as z2}from"./chunk-MWS2NAHJ.js";import{a as H2,d as D2,f as L2,g as B2,h as $2,i as ba,j as N2,k as Hw,n as Ap}from"./chunk-CCZ276IA.js";import{a as U2,b as q2}from"./chunk-K7KBFM2T.js";import{c as N$,d as uw,i as U$}from"./chunk-AQUZCWM3.js";import{b as jw,d as $d,l as _2,n as Ow}from"./chunk-E2JB5OCO.js";import"./chunk-DRMOHADV.js";import{A as dg,c as sg,d as tH,e as rH,f as nH,h as oH,i as aH,j as iH,p as sH,u as wi,v as cH,x as dH,z as cg}from"./chunk-OTXGAKFH.js";import{a as yH,d as vH,g as EH}from"./chunk-CIZI6Z7D.js";import{a as o$,b as c$,c as d$,d as j$,e as lw,f as L$,g as B$,h as $$,i as q$,j as EN,k as j2,m as Iq}from"./chunk-ZK3ET5EP.js";import{a as oU}from"./chunk-TAXCMCYZ.js";import{a as pt,b as a$,c as i$,d as JP,e as eN,f as mw,g as fw,h as tN}from"./chunk-PKJHN666.js";import{a as aU,b as Fw,c as iU}from"./chunk-Z33RVGP6.js";import{b as Ad,c as Md,d as VP}from"./chunk-7PKDJHT6.js";import{b as dw}from"./chunk-65WRWLUD.js";import{$ as b2,A as AN,B as Kr,C as MN,D as jN,E as $N,F as NN,G as UN,H as qN,I as FN,J as e2,K as t2,L as aR,M as r2,N as d2,O as l2,P as u2,Q as m2,R as iR,S as g2,T as Cw,U as Ls,V as qo,W as to,X as v2,Y as Tp,Z as I2,_ as ro,aa as Aw,b as l$,ba as k2,c as x$,ca as S2,d as _$,da as br,e as T$,ea as Bs,f as V$,fa as P2,g as Od,ga as Ia,h as G$,ha as sR,i as Y$,ia as cR,j as X$,ja as Cp,k as rN,ka as dR,l as yN,la as Mw,m as vN,ma as x2,n as IN,na as E2,o as bN,oa as O2,p as kN,q as QP,r as SN,s as PN,t as RN,u as xN,x as _N,y as TN,z as ZP}from"./chunk-54755JYM.js";import{g as T2,h as C2,i as A2,j as M2}from"./chunk-B66QCXH2.js";import{a as E$}from"./chunk-PYNW5OFA.js";import{A as eR,B as tR,F as zN,M as w2,a as z$,b as W$,c as GP,m as wN,q as yw}from"./chunk-MOXIGLN2.js";import{b as $s,c as R2,d as Br}from"./chunk-RHMULF56.js";import"./chunk-VFH5C6D2.js";import{a as h2}from"./chunk-UOFDKMRU.js";import{a as gN}from"./chunk-AN525SPP.js";import{a as F$}from"./chunk-IZ6DLEVY.js";import{a as Hs,b as UP,c as Sp,d as Pp,e as Td,f as aw,g as qP,h as Rp,i as Cn,j as P$,k as fe,l as R$,m as zP}from"./chunk-BGMAWETL.js";import{b as f$}from"./chunk-65FJWWXG.js";import"./chunk-SYUKES6H.js";import{a as O$,b as H$,c as D$,d as cw}from"./chunk-EYTTZ5H4.js";import"./chunk-XY7HFXLH.js";import{B as p2,J as y2,b as VM,z as CN}from"./chunk-6I5AUTVO.js";import{b as C$,i as A$,j as M$,m as Cd,n as WP}from"./chunk-DKOVZ6R2.js";import{a as kp,b as bi}from"./chunk-N5EAVX4G.js";import{a as NP,g as u$,h as p$,j as m$}from"./chunk-U7X5ZLAL.js";import"./chunk-7PXZ4X4P.js";import"./chunk-N73MU2C3.js";import"./chunk-SO4GMSNP.js";import"./chunk-NMMHXYDJ.js";import"./chunk-QLGP2OAQ.js";import{A as Pi,B as oR,C as Sw,D as YN,E as Pw,F as XN,G as _p,J as Rw,K as QN,L as xw,M as ZN,N as Bd,d as ON,f as HN,g as DN,h as LN,i as BN,m as vw,n as Iw,o as WN,p as VN,q as Ld,r as GN,s as rR,t as JN,u as bw,v as kw,w as Uo,x as Ds,y as nR,z as KN}from"./chunk-WZ35ICTE.js";import"./chunk-VS2LOUCT.js";import"./chunk-DMFUEUAZ.js";import"./chunk-AFKFN25T.js";import"./chunk-G4747MOW.js";import{a as $o,b as No,c as Wt}from"./chunk-GF55VEMR.js";import"./chunk-FAKDGLZQ.js";import"./chunk-KCJVFLBB.js";import{a as Q$,b as Z$}from"./chunk-GW766ZSO.js";import{a as i2,b as s2,c as c2,d as Tw,f as f2}from"./chunk-VJYOKU3C.js";import{a as n2,b as Ep,c as o2,d as _w,e as a2,f as Ew}from"./chunk-SSJV3VX7.js";import{a as jd}from"./chunk-7KWD2I6W.js";import{a as Dr,b as h$,c as Lr,d as g$,e as iw,f as sw,g as FP,h as w$,i as ki,k as y$,l as v$,m as I$,n as b$,o as k$,p as S$}from"./chunk-2ACX7IW5.js";import{A as NM,C as UM,D as qM,E as Qn,d as RM,e as xM,f as _M,g as EM,h as SS,i as TM,j as CM,k as AM,l as MM,m as jM,n as xh,o as OM,p as PS,q as HM,r as DM,s as rr,t as LM,u as ut,v as St,w as BM,x as $M,y as Du,z as _h}from"./chunk-OFJPOTES.js";import{c as dN,d as KP,e as lN,f as uN,g as pN,h as mN,i as Dd,j as ww,k as Bo,l as fN,m as YP,n as hN,o as XP}from"./chunk-PLROXHG2.js";import{A as cN,C as gw,b as pw,d as J$,e as K$,h as nN,k as oN,l as aN,m as Hd,n as iN,p as hw,q as sN,s as xp}from"./chunk-YU3C6U5V.js";import"./chunk-PHZZBXDO.js";import{a as Si}from"./chunk-KVTBX2UP.js";import{a as ye,b as zt,c as Ed,d as ce,f as s$}from"./chunk-U7D6Q744.js";import{$ as rL,$a as AL,$b as cp,$c as $P,A as CD,Aa as mL,Ac as JB,Ba as fL,Ca as hL,Cb as Zg,Cc as KB,Db as CB,Dc as YB,E as AD,Ea as Pd,Eb as AB,Ec as Os,F as MD,Fa as gL,Fb as Lo,Fc as XB,G as Lg,Gb as MB,H as jD,Ha as tp,Hb as js,I as UD,Ia as Fg,Ib as jB,Ic as st,J as qD,Ja as wL,Jc as HP,K as Oo,Ka as SP,Kc as up,La as yL,Lc as pp,M as FD,Ma as vL,Mc as QB,N as zD,Na as PP,Nc as DP,O as WD,Oa as IL,Oc as mp,P as VD,Pa as bL,Pc as fp,Q as GD,Qa as kL,Qc as ZB,Ra as SL,Rc as LP,S as JD,Sa as PL,Sc as hp,T as Bg,Ta as RL,Tc as gp,U as KD,Ua as xL,Uc as e$,V as YD,Va as RP,Vb as OB,Vc as wp,W as XD,Wa as _L,Wc as t$,X as QD,Xa as EL,Xb as HB,Xc as BP,Y as ZD,Ya as TL,Yb as ip,Yc as yp,Z as eL,Za as CL,Zb as DB,Zc as vp,_ as tL,_a as xP,_b as sp,_c as r$,aa as nL,ab as ML,ac as MP,ad as Ip,b as bd,ba as oL,bb as jL,bc as LB,bd as bp,ca as aL,cb as OL,cc as dp,cd as n$,da as iL,db as HL,dc as BB,e as wD,ea as sL,eb as DL,ec as ew,fb as LL,fc as $B,g as vP,ga as $g,gb as BL,gc as NB,h as yD,ha as cL,hb as $L,hc as UB,i as Hr,ia as Zn,ic as qB,j as Qu,ja as Ng,jc as tw,k as Ts,ka as kP,kb as NL,kc as rw,l as IP,la as Ug,lb as UL,m as vD,mb as qL,n as ID,na as qg,nb as FL,nc as FB,o as bD,oa as Zu,ob as zL,p as kD,pb as rp,pc as Ii,q as SD,qa as dL,r as PD,rb as zg,rc as nw,s as Dg,sb as WL,sc as zB,ta as Sd,tb as VL,tc as lp,ua as Ho,ub as GL,uc as ow,v as va,va as lL,vb as Cs,vc as WB,w as kd,wa as ep,wb as JL,wc as VB,x as ED,xc as jP,y as TD,ya as uL,yb as TB,yc as GB,za as pL,zc as OP}from"./chunk-HG2YFMVU.js";import{d as SM}from"./chunk-OQPJ7FJF.js";import"./chunk-BL3CZWWD.js";import{b as OD,c as HD,d as DD,e as LD,f as BD,g as $D,h as ND}from"./chunk-FYWQWKVS.js";import{b as RD,c as Hg}from"./chunk-GD3RCUDH.js";import{$ as Ms,A as Ir,C as dB,D as lB,E as uB,F as AP,G as pB,H as mB,I as fB,K as Jg,L as hB,a as Wg,aa as gB,b as KL,ba as eo,c as _P,ca as wB,d as Do,da as yB,e as YL,ea as vB,f as XL,fa as yi,g as QL,ga as xd,h as EP,ha as Kg,i as As,ia as IB,j as ZL,ja as bB,k as eB,ka as kB,l as tB,la as op,m as TP,ma as _d,n as np,na as Yg,o as rB,oa as SB,p as Vg,pa as Xg,q as nB,qa as vi,r as oB,ra as PB,s as Rd,sa as RB,t as aB,ta as xB,u as Gg,ua as Qg,v as iB,va as _B,w as sB,wa as ap,x as CP,xa as EB,z as cB}from"./chunk-7OKZCJHS.js";import"./chunk-UTIELP6F.js";import{g as TH,j as CH,l as yd,m as AH,o as pg,s as mg}from"./chunk-7NCM6GBN.js";import"./chunk-4V73I4OL.js";import"./chunk-LE75SVEL.js";import{e as xD,g as _D,h as bP,j as wt}from"./chunk-6ESBAHWK.js";import{a as Mne,b as JM,c as _S,d as ES}from"./chunk-LZPCA6DH.js";import{b as dd,c as PM}from"./chunk-L3KS6MOV.js";import"./chunk-7J2NMUTK.js";import{$b as zu,$f as pP,$i as M1,Ad as zH,Ag as mP,Ah as hP,Bd as WH,Be as YH,Cf as uP,Cj as D1,Dj as L1,Gi as Xu,Gj as B1,Hi as P1,Hj as $1,Ii as R1,Ij as N1,Kj as U1,Mj as q1,Nh as m1,Od as VH,Oe as XH,Ok as X1,Pd as GH,Ph as f1,Qf as a1,Re as QH,Rg as d1,Rh as h1,Ri as x1,Rk as Q1,Sd as Wu,Sh as g1,Ta as BH,Td as Vu,Tf as Ig,Ub as $H,Uf as bg,Ug as xg,Uh as Ku,Ui as _1,Uk as Z1,Vf as kg,Vg as _g,Vh as w1,Vi as E1,Vj as F1,Vk as eD,Wf as i1,Wg as Eg,Wh as y1,Wi as T1,Wk as tD,Xe as ZH,Xg as l1,Xj as Mg,Xk as rD,Y as Fu,Ye as gg,Yi as C1,Yk as nD,Zi as A1,Zk as oD,_b as NH,a as MH,af as e1,ah as fP,ak as z1,b as Ge,bk as W1,cf as Ju,ck as jg,di as v1,dk as V1,ek as G1,fa as fg,gl as Id,hf as vd,hi as Yu,if as t1,ii as I1,ja as jH,je as Gu,ji as b1,jl as aD,ka as OH,kf as r1,la as hg,ld as UH,lk as J1,ma as HH,na as DH,nj as gP,nl as iD,pd as Tn,pf as n1,pg as s1,ph as u1,pj as wP,pk as K1,pl as sD,ql as cD,rk as Y1,rl as Se,sg as Sg,sh as Tg,si as k1,tg as Pg,th as Cg,ue as JH,ug as Rg,uh as Ag,uj as j1,vg as c1,vh as p1,wa as LH,wf as wg,wj as O1,xe as KH,xf as yg,xi as S1,xj as yP,yd as qH,yf as vg,yj as H1,zd as FH,zf as o1}from"./chunk-VEBW7NKD.js";import"./chunk-W45RKGM6.js";import{a as dD,b as lD,c as uD,d as pD,e as mD,f as fD,g as Jr,h as hD,j as Og,k as gD}from"./chunk-AUO5DCEU.js";import{a as qu}from"./chunk-Y4I6CFZJ.js";import{t as pO}from"./chunk-4BUM6JEC.js";import{b as iO,c as sO,f as cO,g as dO,h as lO}from"./chunk-UGFSAG4U.js";import{a as aO,b as Fh}from"./chunk-SSHE6B7Z.js";import{a as jne}from"./chunk-JFXINDOQ.js";import"./chunk-EDYCSW22.js";import{b as ug,c as PH,e as RH,f as Uu,g as dP,k as lP,l as xH,m as _H}from"./chunk-JT5YQ52I.js";import"./chunk-XGY4OQLC.js";import{d as hH,h as gH,i as wH}from"./chunk-PAYFJHPO.js";import{d as hd,e as Nu,f as QO,g as ZO,h as eH,j as sP,l as cP}from"./chunk-WD4KAKEX.js";import{$ as SO,G as yO,H as vO,J as GS,L as IO,R as bO,S as fi,U as kO,Y as Wh,Z as Vh,_ as Gh,aa as JS,ba as XS,ca as QS,da as eg,ea as ZS,fa as eP,ga as tP,ia as rP,ja as nP,ka as oP,la as aP,u as wO}from"./chunk-2PXKSAG6.js";import"./chunk-ULTV6INR.js";import{A as Xh,C as Qh,D as Zh,E as ya,a as PO,b as RO,c as Jh,f as Kh,h as KS,i as YS,k as $u,m as xO,o as _O,p as EO,r as Yh,s as TO,u as CO}from"./chunk-WGQ3FMRF.js";import"./chunk-JXLDEYRW.js";import{i as kH,m as SH}from"./chunk-JVMSN7LH.js";import{a as lH,f as uH,g as nr,r as gd,t as pH,u as mH,v as lg,w as fH,z as wd}from"./chunk-YI6ME6PU.js";import{b as Es,d as IH,f as bH}from"./chunk-DRLP7GIU.js";import{Ba as ag,C as NO,Ca as ln,Da as XO,F as fd,Fa as ig,H as UO,Ia as gi,J as qO,L as FO,N as zO,O as WO,W as VO,aa as hi,ba as GO,c as AO,ga as JO,ha as KO,i as MO,ja as mt,l as jO,m as OO,n as HO,o as DO,oa as ng,p as LO,q as tg,r as iP,s as BO,t as $O,u as rg,wa as jo,xa as YO,za as og}from"./chunk-BU6MW65V.js";import"./chunk-LVXL7T5O.js";import{f as zS,m as md}from"./chunk-HIQPGYVH.js";import{E as fO,K as Bu,M as hO,N as zh,Q as gO,U as VS,V as Et,b as Lu,c as WS,i as uO,j as me,l as Xe,x as dn,y as mO}from"./chunk-DXJC3QW7.js";import"./chunk-P4QM63L3.js";import"./chunk-MTP3B2SU.js";import"./chunk-BLNEHU62.js";import{a as tO,b as nO}from"./chunk-UN2LKLGV.js";import"./chunk-HLJJAOI2.js";import"./chunk-AMC4Z7G4.js";import{b as rO,e as oO}from"./chunk-LK77GI6M.js";import{k as RS}from"./chunk-HVM2GUM3.js";import"./chunk-I6VMRQF4.js";import{Ba as Wj,Ua as Vj,Wa as Uh,ba as jj,bb as NS,d as Tj,db as Gj,f as $h,fb as Jj,gb as qh,hb as Kj,l as Cj,lb as Yj,m as Aj,ob as Xj,pa as Oj,sb as US,ub as qS,va as zj,wb as Qj,x as Mj,xb as Zj,yb as eO,zb as FS}from"./chunk-D6L6UNUQ.js";import"./chunk-AJXWJLZA.js";import{A as Lj,E as Bj,F as $j,G as Nh,H as Nj,I as Uj,J as qj,N as Fj,h as Hj,z as Dj}from"./chunk-OKKNDQJF.js";import{Cb as ud,Db as wa,Eb as pd,F as wj,Jb as Rj,L as Ve,Lb as xj,M as _t,O as yj,Q as vj,Qb as _j,S as Mo,Ta as Bh,Xb as Ej,ba as Ij,d as mj,da as bj,g as fj,i as hj,j as gj,ob as kj,pb as mi,qb as It,rb as Sj,ub as Pj}from"./chunk-4PUOWSDE.js";import{$a as Dh,A as Oh,Aa as He,B as TS,C as xs,Cb as lj,D as _s,Db as uj,Eb as pj,F as YM,Fb as Lh,H as XM,I as QM,Ja as tj,La as rj,M as CS,N as AS,O as MS,Oa as nj,P as jS,Q as OS,R as HS,Ra as oj,S as DS,Sa as aj,T as LS,Wa as ij,a as GM,bb as $S,fb as sj,ga as ZM,hb as cj,kb as dj,n as KM,o as Ch,p as Ah,q as Mh,qa as Hh,r as jh,ra as ej,v as pi,va as BS}from"./chunk-ZY32SZ2P.js";import{q as zM,r as ld,s as Th}from"./chunk-OTDDXEQ6.js";import"./chunk-ECOH24MC.js";import{c as F0}from"./chunk-EJOV6Z6F.js";import"./chunk-GY7YSD6J.js";import{a as IM,b as bM,c as En,d as Ph,e as Rs,f as Hu,g as kS,h as Rh,i as kM,k as Eh,n as FM}from"./chunk-KUE46HTH.js";import{d as U0,e as q0,g as vM}from"./chunk-MZKCW6CB.js";import{a as Ou}from"./chunk-6FA3GG5B.js";import{C as sM,D as cM,I as uM,K as yS,L as vS,M as pM,S as IS,U as mM,V as bS,Z as fM,_ as hM,ca as gM,da as wM,f as Mu,fa as Ps,ga as yM,ha as Sh,v as cd,x as ju}from"./chunk-SV7ZBEK2.js";import{M as sd,O as nM,Q as oM,R as aM,S as iM,a as Ss,b as J0,c as Gr,d as _n,e as K0,f as yh,g as Y0,h as X0,i as vh,j as Ih,l as Q0,m as Z0,n as eM,o as tM,p as rM,z as wS}from"./chunk-2MEOUS24.js";import{b as G0,d as wh,e as Xn,f as Ft}from"./chunk-HNQPEOJD.js";import{g as hh,h as gS,i as V0,l as ot,m as Ee,n as T,o as gh}from"./chunk-RCT3O3HQ.js";import{a as z0,c as ks,f as fh,h as Au,i as W0,m as bh,p as dM,r as ha,s as lM,t as ga,u as kh}from"./chunk-UGOK7VTC.js";import"./chunk-ZFJWA4JK.js";import{A as v,d as Re}from"./chunk-X2J2P5ZT.js";import{a as i,b as qe,c as Be,e as xn}from"./chunk-FTQLQJQV.js";var _a=Be((L0e,VF)=>{"use strict";var zF=["nodebuffer","arraybuffer","fragments"],WF=typeof Blob<"u";WF&&zF.push("blob");VF.exports={BINARY_TYPES:zF,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:"258EAFA5-E914-47DA-95CA-C5AB0DC85B11",hasBlob:WF,kForOnEventAttribute:Symbol("kIsForOnEventAttribute"),kListener:Symbol("kListener"),kStatusCode:Symbol("status-code"),kWebSocket:Symbol("websocket"),NOOP:i(()=>{},"NOOP")}});var qp=Be(($0e,wy)=>{"use strict";var{EMPTY_BUFFER:Uoe}=_a(),BR=Buffer[Symbol.species];function qoe(e,t){if(e.length===0)return Uoe;if(e.length===1)return e[0];let r=Buffer.allocUnsafe(t),n=0;for(let o=0;o<e.length;o++){let a=e[o];r.set(a,n),n+=a.length}return n<t?new BR(r.buffer,r.byteOffset,n):r}i(qoe,"concat");function GF(e,t,r,n,o){for(let a=0;a<o;a++)r[n+a]=e[a]^t[a&3]}i(GF,"_mask");function JF(e,t){for(let r=0;r<e.length;r++)e[r]^=t[r&3]}i(JF,"_unmask");function Foe(e){return e.length===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.length)}i(Foe,"toArrayBuffer");function $R(e){if($R.readOnly=!0,Buffer.isBuffer(e))return e;let t;return e instanceof ArrayBuffer?t=new BR(e):ArrayBuffer.isView(e)?t=new BR(e.buffer,e.byteOffset,e.byteLength):(t=Buffer.from(e),$R.readOnly=!1),t}i($R,"toBuffer");wy.exports={concat:qoe,mask:GF,toArrayBuffer:Foe,toBuffer:$R,unmask:JF};if(!process.env.WS_NO_BUFFER_UTIL)try{let e=qe("bufferutil");wy.exports.mask=function(t,r,n,o,a){a<48?GF(t,r,n,o,a):e.mask(t,r,n,o,a)},wy.exports.unmask=function(t,r){t.length<32?JF(t,r):e.unmask(t,r)}}catch{}});var XF=Be((U0e,YF)=>{"use strict";var KF=Symbol("kDone"),NR=Symbol("kRun"),UR=class{static{i(this,"Limiter")}constructor(t){this[KF]=()=>{this.pending--,this[NR]()},this.concurrency=t||1/0,this.jobs=[],this.pending=0}add(t){this.jobs.push(t),this[NR]()}[NR](){if(this.pending!==this.concurrency&&this.jobs.length){let t=this.jobs.shift();this.pending++,t(this[KF])}}};YF.exports=UR});var Kd=Be((F0e,tz)=>{"use strict";var Fp=qe("zlib"),QF=qp(),zoe=XF(),{kStatusCode:ZF}=_a(),Woe=Buffer[Symbol.species],Voe=Buffer.from([0,0,255,255]),vy=Symbol("permessage-deflate"),Ea=Symbol("total-length"),Gd=Symbol("callback"),ji=Symbol("buffers"),Jd=Symbol("error"),yy,qR=class{static{i(this,"PerMessageDeflate")}constructor(t){if(this._options=t||{},this._threshold=this._options.threshold!==void 0?this._options.threshold:1024,this._maxPayload=this._options.maxPayload|0,this._isServer=!!this._options.isServer,this._deflate=null,this._inflate=null,this.params=null,!yy){let r=this._options.concurrencyLimit!==void 0?this._options.concurrencyLimit:10;yy=new zoe(r)}}static get extensionName(){return"permessage-deflate"}offer(){let t={};return this._options.serverNoContextTakeover&&(t.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(t.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(t.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?t.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits==null&&(t.client_max_window_bits=!0),t}accept(t){return t=this.normalizeParams(t),this.params=this._isServer?this.acceptAsServer(t):this.acceptAsClient(t),this.params}cleanup(){if(this._inflate&&(this._inflate.close(),this._inflate=null),this._deflate){let t=this._deflate[Gd];this._deflate.close(),this._deflate=null,t&&t(new Error("The deflate stream was closed while data was being processed"))}}acceptAsServer(t){let r=this._options,n=t.find(o=>!(r.serverNoContextTakeover===!1&&o.server_no_context_takeover||o.server_max_window_bits&&(r.serverMaxWindowBits===!1||typeof r.serverMaxWindowBits=="number"&&r.serverMaxWindowBits>o.server_max_window_bits)||typeof r.clientMaxWindowBits=="number"&&!o.client_max_window_bits));if(!n)throw new Error("None of the extension offers can be accepted");return r.serverNoContextTakeover&&(n.server_no_context_takeover=!0),r.clientNoContextTakeover&&(n.client_no_context_takeover=!0),typeof r.serverMaxWindowBits=="number"&&(n.server_max_window_bits=r.serverMaxWindowBits),typeof r.clientMaxWindowBits=="number"?n.client_max_window_bits=r.clientMaxWindowBits:(n.client_max_window_bits===!0||r.clientMaxWindowBits===!1)&&delete n.client_max_window_bits,n}acceptAsClient(t){let r=t[0];if(this._options.clientNoContextTakeover===!1&&r.client_no_context_takeover)throw new Error('Unexpected parameter "client_no_context_takeover"');if(!r.client_max_window_bits)typeof this._options.clientMaxWindowBits=="number"&&(r.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits=="number"&&r.client_max_window_bits>this._options.clientMaxWindowBits)throw new Error('Unexpected or invalid parameter "client_max_window_bits"');return r}normalizeParams(t){return t.forEach(r=>{Object.keys(r).forEach(n=>{let o=r[n];if(o.length>1)throw new Error(`Parameter "${n}" must have only a single value`);if(o=o[0],n==="client_max_window_bits"){if(o!==!0){let a=+o;if(!Number.isInteger(a)||a<8||a>15)throw new TypeError(`Invalid value for parameter "${n}": ${o}`);o=a}else if(!this._isServer)throw new TypeError(`Invalid value for parameter "${n}": ${o}`)}else if(n==="server_max_window_bits"){let a=+o;if(!Number.isInteger(a)||a<8||a>15)throw new TypeError(`Invalid value for parameter "${n}": ${o}`);o=a}else if(n==="client_no_context_takeover"||n==="server_no_context_takeover"){if(o!==!0)throw new TypeError(`Invalid value for parameter "${n}": ${o}`)}else throw new Error(`Unknown parameter "${n}"`);r[n]=o})}),t}decompress(t,r,n){yy.add(o=>{this._decompress(t,r,(a,s)=>{o(),n(a,s)})})}compress(t,r,n){yy.add(o=>{this._compress(t,r,(a,s)=>{o(),n(a,s)})})}_decompress(t,r,n){let o=this._isServer?"client":"server";if(!this._inflate){let a=`${o}_max_window_bits`,s=typeof this.params[a]!="number"?Fp.Z_DEFAULT_WINDOWBITS:this.params[a];this._inflate=Fp.createInflateRaw({...this._options.zlibInflateOptions,windowBits:s}),this._inflate[vy]=this,this._inflate[Ea]=0,this._inflate[ji]=[],this._inflate.on("error",Joe),this._inflate.on("data",ez)}this._inflate[Gd]=n,this._inflate.write(t),r&&this._inflate.write(Voe),this._inflate.flush(()=>{let a=this._inflate[Jd];if(a){this._inflate.close(),this._inflate=null,n(a);return}let s=QF.concat(this._inflate[ji],this._inflate[Ea]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[Ea]=0,this._inflate[ji]=[],r&&this.params[`${o}_no_context_takeover`]&&this._inflate.reset()),n(null,s)})}_compress(t,r,n){let o=this._isServer?"server":"client";if(!this._deflate){let a=`${o}_max_window_bits`,s=typeof this.params[a]!="number"?Fp.Z_DEFAULT_WINDOWBITS:this.params[a];this._deflate=Fp.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:s}),this._deflate[Ea]=0,this._deflate[ji]=[],this._deflate.on("data",Goe)}this._deflate[Gd]=n,this._deflate.write(t),this._deflate.flush(Fp.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let a=QF.concat(this._deflate[ji],this._deflate[Ea]);r&&(a=new Woe(a.buffer,a.byteOffset,a.length-4)),this._deflate[Gd]=null,this._deflate[Ea]=0,this._deflate[ji]=[],r&&this.params[`${o}_no_context_takeover`]&&this._deflate.reset(),n(null,a)})}};tz.exports=qR;function Goe(e){this[ji].push(e),this[Ea]+=e.length}i(Goe,"deflateOnData");function ez(e){if(this[Ea]+=e.length,this[vy]._maxPayload<1||this[Ea]<=this[vy]._maxPayload){this[ji].push(e);return}this[Jd]=new RangeError("Max payload size exceeded"),this[Jd].code="WS_ERR_UNSUPPORTED_MESSAGE_LENGTH",this[Jd][ZF]=1009,this.removeListener("data",ez),this.reset()}i(ez,"inflateOnData");function Joe(e){if(this[vy]._inflate=null,this[Jd]){this[Gd](this[Jd]);return}e[ZF]=1007,this[Gd](e)}i(Joe,"inflateOnError")});var Yd=Be((W0e,Iy)=>{"use strict";var{isUtf8:rz}=qe("buffer"),{hasBlob:Koe}=_a(),Yoe=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,1,1,1,1,1,0,0,1,1,0,1,1,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,1,0,1,0];function Xoe(e){return e>=1e3&&e<=1014&&e!==1004&&e!==1005&&e!==1006||e>=3e3&&e<=4999}i(Xoe,"isValidStatusCode");function FR(e){let t=e.length,r=0;for(;r<t;)if((e[r]&128)===0)r++;else if((e[r]&224)===192){if(r+1===t||(e[r+1]&192)!==128||(e[r]&254)===192)return!1;r+=2}else if((e[r]&240)===224){if(r+2>=t||(e[r+1]&192)!==128||(e[r+2]&192)!==128||e[r]===224&&(e[r+1]&224)===128||e[r]===237&&(e[r+1]&224)===160)return!1;r+=3}else if((e[r]&248)===240){if(r+3>=t||(e[r+1]&192)!==128||(e[r+2]&192)!==128||(e[r+3]&192)!==128||e[r]===240&&(e[r+1]&240)===128||e[r]===244&&e[r+1]>143||e[r]>244)return!1;r+=4}else return!1;return!0}i(FR,"_isValidUTF8");function Qoe(e){return Koe&&typeof e=="object"&&typeof e.arrayBuffer=="function"&&typeof e.type=="string"&&typeof e.stream=="function"&&(e[Symbol.toStringTag]==="Blob"||e[Symbol.toStringTag]==="File")}i(Qoe,"isBlob");Iy.exports={isBlob:Qoe,isValidStatusCode:Xoe,isValidUTF8:FR,tokenChars:Yoe};if(rz)Iy.exports.isValidUTF8=function(e){return e.length<24?FR(e):rz(e)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let e=qe("utf-8-validate");Iy.exports.isValidUTF8=function(t){return t.length<32?FR(t):e(t)}}catch{}});var JR=Be((G0e,dz)=>{"use strict";var{Writable:Zoe}=qe("stream"),nz=Kd(),{BINARY_TYPES:eae,EMPTY_BUFFER:oz,kStatusCode:tae,kWebSocket:rae}=_a(),{concat:zR,toArrayBuffer:nae,unmask:oae}=qp(),{isValidStatusCode:aae,isValidUTF8:az}=Yd(),by=Buffer[Symbol.species],Mn=0,iz=1,sz=2,cz=3,WR=4,VR=5,ky=6,GR=class extends Zoe{static{i(this,"Receiver")}constructor(t={}){super(),this._allowSynchronousEvents=t.allowSynchronousEvents!==void 0?t.allowSynchronousEvents:!0,this._binaryType=t.binaryType||eae[0],this._extensions=t.extensions||{},this._isServer=!!t.isServer,this._maxBufferedChunks=t.maxBufferedChunks|0,this._maxFragments=t.maxFragments|0,this._maxPayload=t.maxPayload|0,this._skipUTF8Validation=!!t.skipUTF8Validation,this[rae]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._numFragments=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=Mn}_write(t,r,n){if(this._opcode===8&&this._state==Mn)return n();if(this._maxBufferedChunks>0&&this._buffers.length>=this._maxBufferedChunks){n(this.createError(RangeError,"Too many buffered chunks",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS"));return}this._bufferedBytes+=t.length,this._buffers.push(t),this.startLoop(n)}consume(t){if(this._bufferedBytes-=t,t===this._buffers[0].length)return this._buffers.shift();if(t<this._buffers[0].length){let n=this._buffers[0];return this._buffers[0]=new by(n.buffer,n.byteOffset+t,n.length-t),new by(n.buffer,n.byteOffset,t)}let r=Buffer.allocUnsafe(t);do{let n=this._buffers[0],o=r.length-t;t>=n.length?r.set(this._buffers.shift(),o):(r.set(new Uint8Array(n.buffer,n.byteOffset,t),o),this._buffers[0]=new by(n.buffer,n.byteOffset+t,n.length-t)),t-=n.length}while(t>0);return r}startLoop(t){this._loop=!0;do switch(this._state){case Mn:this.getInfo(t);break;case iz:this.getPayloadLength16(t);break;case sz:this.getPayloadLength64(t);break;case cz:this.getMask();break;case WR:this.getData(t);break;case VR:case ky:this._loop=!1;return}while(this._loop);this._errored||t()}getInfo(t){if(this._bufferedBytes<2){this._loop=!1;return}let r=this.consume(2);if((r[0]&48)!==0){let o=this.createError(RangeError,"RSV2 and RSV3 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_2_3");t(o);return}let n=(r[0]&64)===64;if(n&&!this._extensions[nz.extensionName]){let o=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");t(o);return}if(this._fin=(r[0]&128)===128,this._opcode=r[0]&15,this._payloadLength=r[1]&127,this._opcode===0){if(n){let o=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");t(o);return}if(!this._fragmented){let o=this.createError(RangeError,"invalid opcode 0",!0,1002,"WS_ERR_INVALID_OPCODE");t(o);return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){let o=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");t(o);return}this._compressed=n}else if(this._opcode>7&&this._opcode<11){if(!this._fin){let o=this.createError(RangeError,"FIN must be set",!0,1002,"WS_ERR_EXPECTED_FIN");t(o);return}if(n){let o=this.createError(RangeError,"RSV1 must be clear",!0,1002,"WS_ERR_UNEXPECTED_RSV_1");t(o);return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){let o=this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,"WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH");t(o);return}}else{let o=this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,"WS_ERR_INVALID_OPCODE");t(o);return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(r[1]&128)===128,this._isServer){if(!this._masked){let o=this.createError(RangeError,"MASK must be set",!0,1002,"WS_ERR_EXPECTED_MASK");t(o);return}}else if(this._masked){let o=this.createError(RangeError,"MASK must be clear",!0,1002,"WS_ERR_UNEXPECTED_MASK");t(o);return}this._payloadLength===126?this._state=iz:this._payloadLength===127?this._state=sz:this.haveLength(t)}getPayloadLength16(t){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(t)}getPayloadLength64(t){if(this._bufferedBytes<8){this._loop=!1;return}let r=this.consume(8),n=r.readUInt32BE(0);if(n>Math.pow(2,21)-1){let o=this.createError(RangeError,"Unsupported WebSocket frame: payload length > 2^53 - 1",!1,1009,"WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH");t(o);return}this._payloadLength=n*Math.pow(2,32)+r.readUInt32BE(4),this.haveLength(t)}haveLength(t){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)){let r=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");t(r);return}this._masked?this._state=cz:this._state=WR}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=WR}getData(t){let r=oz;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}r=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0&&oae(r,this._mask)}if(this._opcode>7){this.controlMessage(r,t);return}if(this._maxFragments>0&&++this._numFragments>this._maxFragments){let n=this.createError(RangeError,"Too many message fragments",!1,1008,"WS_ERR_TOO_MANY_BUFFERED_PARTS");t(n);return}if(this._compressed){this._state=VR,this.decompress(r,t);return}r.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(r)),this.dataMessage(t)}decompress(t,r){this._extensions[nz.extensionName].decompress(t,this._fin,(o,a)=>{if(o)return r(o);if(a.length){if(this._messageLength+=a.length,this._messageLength>this._maxPayload&&this._maxPayload>0){let s=this.createError(RangeError,"Max payload size exceeded",!1,1009,"WS_ERR_UNSUPPORTED_MESSAGE_LENGTH");r(s);return}this._fragments.push(a)}this.dataMessage(r),this._state===Mn&&this.startLoop(r)})}dataMessage(t){if(!this._fin){this._state=Mn;return}let r=this._messageLength,n=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._numFragments=0,this._fragments=[],this._opcode===2){let o;this._binaryType==="nodebuffer"?o=zR(n,r):this._binaryType==="arraybuffer"?o=nae(zR(n,r)):this._binaryType==="blob"?o=new Blob(n):o=n,this._allowSynchronousEvents?(this.emit("message",o,!0),this._state=Mn):(this._state=ky,setImmediate(()=>{this.emit("message",o,!0),this._state=Mn,this.startLoop(t)}))}else{let o=zR(n,r);if(!this._skipUTF8Validation&&!az(o)){let a=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");t(a);return}this._state===VR||this._allowSynchronousEvents?(this.emit("message",o,!1),this._state=Mn):(this._state=ky,setImmediate(()=>{this.emit("message",o,!1),this._state=Mn,this.startLoop(t)}))}}controlMessage(t,r){if(this._opcode===8){if(t.length===0)this._loop=!1,this.emit("conclude",1005,oz),this.end();else{let n=t.readUInt16BE(0);if(!aae(n)){let a=this.createError(RangeError,`invalid status code ${n}`,!0,1002,"WS_ERR_INVALID_CLOSE_CODE");r(a);return}let o=new by(t.buffer,t.byteOffset+2,t.length-2);if(!this._skipUTF8Validation&&!az(o)){let a=this.createError(Error,"invalid UTF-8 sequence",!0,1007,"WS_ERR_INVALID_UTF8");r(a);return}this._loop=!1,this.emit("conclude",n,o),this.end()}this._state=Mn;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?"ping":"pong",t),this._state=Mn):(this._state=ky,setImmediate(()=>{this.emit(this._opcode===9?"ping":"pong",t),this._state=Mn,this.startLoop(r)}))}createError(t,r,n,o,a){this._loop=!1,this._errored=!0;let s=new t(n?`Invalid WebSocket frame: ${r}`:r);return Error.captureStackTrace(s,this.createError),s.code=a,s[tae]=o,s}};dz.exports=GR});var XR=Be((Y0e,pz)=>{"use strict";var{Duplex:K0e}=qe("stream"),{randomFillSync:iae}=qe("crypto"),{types:{isUint8Array:sae}}=qe("util"),lz=Kd(),{EMPTY_BUFFER:cae,kWebSocket:dae,NOOP:lae}=_a(),{isBlob:Xd,isValidStatusCode:uae}=Yd(),{mask:uz,toBuffer:zs}=qp(),jn=Symbol("kByteLength"),pae=Buffer.alloc(4),Sy=8*1024,Ws,Qd=Sy,ao=0,mae=1,fae=2,KR=class e{static{i(this,"Sender")}constructor(t,r,n){this._extensions=r||{},n&&(this._generateMask=n,this._maskBuffer=Buffer.alloc(4)),this._socket=t,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=ao,this.onerror=lae,this[dae]=void 0}static frame(t,r){let n,o=!1,a=2,s=!1;r.mask&&(n=r.maskBuffer||pae,r.generateMask?r.generateMask(n):(Qd===Sy&&(Ws===void 0&&(Ws=Buffer.alloc(Sy)),iae(Ws,0,Sy),Qd=0),n[0]=Ws[Qd++],n[1]=Ws[Qd++],n[2]=Ws[Qd++],n[3]=Ws[Qd++]),s=(n[0]|n[1]|n[2]|n[3])===0,a=6);let c;typeof t=="string"?(!r.mask||s)&&r[jn]!==void 0?c=r[jn]:(t=Buffer.from(t),c=t.length):(c=t.length,o=r.mask&&r.readOnly&&!s);let d=c;c>=65536?(a+=8,d=127):c>125&&(a+=2,d=126);let l=Buffer.allocUnsafe(o?c+a:a);return l[0]=r.fin?r.opcode|128:r.opcode,r.rsv1&&(l[0]|=64),l[1]=d,d===126?l.writeUInt16BE(c,2):d===127&&(l[2]=l[3]=0,l.writeUIntBE(c,4,6)),r.mask?(l[1]|=128,l[a-4]=n[0],l[a-3]=n[1],l[a-2]=n[2],l[a-1]=n[3],s?[l,t]:o?(uz(t,n,l,a,c),[l]):(uz(t,n,t,0,c),[l,t])):[l,t]}close(t,r,n,o){let a;if(t===void 0)a=cae;else{if(typeof t!="number"||!uae(t))throw new TypeError("First argument must be a valid error code number");if(r===void 0||!r.length)a=Buffer.allocUnsafe(2),a.writeUInt16BE(t,0);else{let c=Buffer.byteLength(r);if(c>123)throw new RangeError("The message must not be greater than 123 bytes");if(a=Buffer.allocUnsafe(2+c),a.writeUInt16BE(t,0),typeof r=="string")a.write(r,2);else if(sae(r))a.set(r,2);else throw new TypeError("Second argument must be a string or a Uint8Array")}}let s={[jn]:a.length,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state!==ao?this.enqueue([this.dispatch,a,!1,s,o]):this.sendFrame(e.frame(a,s),o)}ping(t,r,n){let o,a;if(typeof t=="string"?(o=Buffer.byteLength(t),a=!1):Xd(t)?(o=t.size,a=!1):(t=zs(t),o=t.length,a=zs.readOnly),o>125)throw new RangeError("The data size must not be greater than 125 bytes");let s={[jn]:o,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:9,readOnly:a,rsv1:!1};Xd(t)?this._state!==ao?this.enqueue([this.getBlobData,t,!1,s,n]):this.getBlobData(t,!1,s,n):this._state!==ao?this.enqueue([this.dispatch,t,!1,s,n]):this.sendFrame(e.frame(t,s),n)}pong(t,r,n){let o,a;if(typeof t=="string"?(o=Buffer.byteLength(t),a=!1):Xd(t)?(o=t.size,a=!1):(t=zs(t),o=t.length,a=zs.readOnly),o>125)throw new RangeError("The data size must not be greater than 125 bytes");let s={[jn]:o,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:10,readOnly:a,rsv1:!1};Xd(t)?this._state!==ao?this.enqueue([this.getBlobData,t,!1,s,n]):this.getBlobData(t,!1,s,n):this._state!==ao?this.enqueue([this.dispatch,t,!1,s,n]):this.sendFrame(e.frame(t,s),n)}send(t,r,n){let o=this._extensions[lz.extensionName],a=r.binary?2:1,s=r.compress,c,d;typeof t=="string"?(c=Buffer.byteLength(t),d=!1):Xd(t)?(c=t.size,d=!1):(t=zs(t),c=t.length,d=zs.readOnly),this._firstFragment?(this._firstFragment=!1,s&&o&&o.params[o._isServer?"server_no_context_takeover":"client_no_context_takeover"]&&(s=c>=o._threshold),this._compress=s):(s=!1,a=0),r.fin&&(this._firstFragment=!0);let l={[jn]:c,fin:r.fin,generateMask:this._generateMask,mask:r.mask,maskBuffer:this._maskBuffer,opcode:a,readOnly:d,rsv1:s};Xd(t)?this._state!==ao?this.enqueue([this.getBlobData,t,this._compress,l,n]):this.getBlobData(t,this._compress,l,n):this._state!==ao?this.enqueue([this.dispatch,t,this._compress,l,n]):this.dispatch(t,this._compress,l,n)}getBlobData(t,r,n,o){this._bufferedBytes+=n[jn],this._state=fae,t.arrayBuffer().then(a=>{if(this._socket.destroyed){let c=new Error("The socket was closed while the blob was being read");process.nextTick(YR,this,c,o);return}this._bufferedBytes-=n[jn];let s=zs(a);r?this.dispatch(s,r,n,o):(this._state=ao,this.sendFrame(e.frame(s,n),o),this.dequeue())}).catch(a=>{process.nextTick(hae,this,a,o)})}dispatch(t,r,n,o){if(!r){this.sendFrame(e.frame(t,n),o);return}let a=this._extensions[lz.extensionName];this._bufferedBytes+=n[jn],this._state=mae,a.compress(t,n.fin,(s,c)=>{if(this._socket.destroyed){let d=new Error("The socket was closed while data was being compressed");YR(this,d,o);return}this._bufferedBytes-=n[jn],this._state=ao,n.readOnly=!1,this.sendFrame(e.frame(c,n),o),this.dequeue()})}dequeue(){for(;this._state===ao&&this._queue.length;){let t=this._queue.shift();this._bufferedBytes-=t[3][jn],Reflect.apply(t[0],this,t.slice(1))}}enqueue(t){this._bufferedBytes+=t[3][jn],this._queue.push(t)}sendFrame(t,r){t.length===2?(this._socket.cork(),this._socket.write(t[0]),this._socket.write(t[1],r),this._socket.uncork()):this._socket.write(t[0],r)}};pz.exports=KR;function YR(e,t,r){typeof r=="function"&&r(t);for(let n=0;n<e._queue.length;n++){let o=e._queue[n],a=o[o.length-1];typeof a=="function"&&a(t)}}i(YR,"callCallbacks");function hae(e,t,r){YR(e,t,r),e.onerror(t)}i(hae,"onError")});var bz=Be((Q0e,Iz)=>{"use strict";var{kForOnEventAttribute:zp,kListener:QR}=_a(),mz=Symbol("kCode"),fz=Symbol("kData"),hz=Symbol("kError"),gz=Symbol("kMessage"),wz=Symbol("kReason"),Zd=Symbol("kTarget"),yz=Symbol("kType"),vz=Symbol("kWasClean"),Ta=class{static{i(this,"Event")}constructor(t){this[Zd]=null,this[yz]=t}get target(){return this[Zd]}get type(){return this[yz]}};Object.defineProperty(Ta.prototype,"target",{enumerable:!0});Object.defineProperty(Ta.prototype,"type",{enumerable:!0});var Vs=class extends Ta{static{i(this,"CloseEvent")}constructor(t,r={}){super(t),this[mz]=r.code===void 0?0:r.code,this[wz]=r.reason===void 0?"":r.reason,this[vz]=r.wasClean===void 0?!1:r.wasClean}get code(){return this[mz]}get reason(){return this[wz]}get wasClean(){return this[vz]}};Object.defineProperty(Vs.prototype,"code",{enumerable:!0});Object.defineProperty(Vs.prototype,"reason",{enumerable:!0});Object.defineProperty(Vs.prototype,"wasClean",{enumerable:!0});var el=class extends Ta{static{i(this,"ErrorEvent")}constructor(t,r={}){super(t),this[hz]=r.error===void 0?null:r.error,this[gz]=r.message===void 0?"":r.message}get error(){return this[hz]}get message(){return this[gz]}};Object.defineProperty(el.prototype,"error",{enumerable:!0});Object.defineProperty(el.prototype,"message",{enumerable:!0});var Wp=class extends Ta{static{i(this,"MessageEvent")}constructor(t,r={}){super(t),this[fz]=r.data===void 0?null:r.data}get data(){return this[fz]}};Object.defineProperty(Wp.prototype,"data",{enumerable:!0});var gae={addEventListener(e,t,r={}){for(let o of this.listeners(e))if(!r[zp]&&o[QR]===t&&!o[zp])return;let n;if(e==="message")n=i(function(a,s){let c=new Wp("message",{data:s?a:a.toString()});c[Zd]=this,Py(t,this,c)},"onMessage");else if(e==="close")n=i(function(a,s){let c=new Vs("close",{code:a,reason:s.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});c[Zd]=this,Py(t,this,c)},"onClose");else if(e==="error")n=i(function(a){let s=new el("error",{error:a,message:a.message});s[Zd]=this,Py(t,this,s)},"onError");else if(e==="open")n=i(function(){let a=new Ta("open");a[Zd]=this,Py(t,this,a)},"onOpen");else return;n[zp]=!!r[zp],n[QR]=t,r.once?this.once(e,n):this.on(e,n)},removeEventListener(e,t){for(let r of this.listeners(e))if(r[QR]===t&&!r[zp]){this.removeListener(e,r);break}}};Iz.exports={CloseEvent:Vs,ErrorEvent:el,Event:Ta,EventTarget:gae,MessageEvent:Wp};function Py(e,t,r){typeof e=="object"&&e.handleEvent?e.handleEvent.call(e,r):e.call(t,r)}i(Py,"callListener")});var Ry=Be((eMe,kz)=>{"use strict";var{tokenChars:Vp}=Yd();function zo(e,t,r){e[t]===void 0?e[t]=[r]:e[t].push(r)}i(zo,"push");function wae(e){let t=Object.create(null),r=Object.create(null),n=!1,o=!1,a=!1,s,c,d=-1,l=-1,u=-1,p=0;for(;p<e.length;p++)if(l=e.charCodeAt(p),s===void 0)if(u===-1&&Vp[l]===1)d===-1&&(d=p);else if(p!==0&&(l===32||l===9))u===-1&&d!==-1&&(u=p);else if(l===59||l===44){if(d===-1)throw new SyntaxError(`Unexpected character at index ${p}`);u===-1&&(u=p);let g=e.slice(d,u);l===44?(zo(t,g,r),r=Object.create(null)):s=g,d=u=-1}else throw new SyntaxError(`Unexpected character at index ${p}`);else if(c===void 0)if(u===-1&&Vp[l]===1)d===-1&&(d=p);else if(l===32||l===9)u===-1&&d!==-1&&(u=p);else if(l===59||l===44){if(d===-1)throw new SyntaxError(`Unexpected character at index ${p}`);u===-1&&(u=p),zo(r,e.slice(d,u),!0),l===44&&(zo(t,s,r),r=Object.create(null),s=void 0),d=u=-1}else if(l===61&&d!==-1&&u===-1)c=e.slice(d,p),d=u=-1;else throw new SyntaxError(`Unexpected character at index ${p}`);else if(o){if(Vp[l]!==1)throw new SyntaxError(`Unexpected character at index ${p}`);d===-1?d=p:n||(n=!0),o=!1}else if(a)if(Vp[l]===1)d===-1&&(d=p);else if(l===34&&d!==-1)a=!1,u=p;else if(l===92)o=!0;else throw new SyntaxError(`Unexpected character at index ${p}`);else if(l===34&&e.charCodeAt(p-1)===61)a=!0;else if(u===-1&&Vp[l]===1)d===-1&&(d=p);else if(d!==-1&&(l===32||l===9))u===-1&&(u=p);else if(l===59||l===44){if(d===-1)throw new SyntaxError(`Unexpected character at index ${p}`);u===-1&&(u=p);let g=e.slice(d,u);n&&(g=g.replace(/\\/g,""),n=!1),zo(r,c,g),l===44&&(zo(t,s,r),r=Object.create(null),s=void 0),c=void 0,d=u=-1}else throw new SyntaxError(`Unexpected character at index ${p}`);if(d===-1||a||l===32||l===9)throw new SyntaxError("Unexpected end of input");u===-1&&(u=p);let m=e.slice(d,u);return s===void 0?zo(t,m,r):(c===void 0?zo(r,m,!0):n?zo(r,c,m.replace(/\\/g,"")):zo(r,c,m),zo(t,s,r)),t}i(wae,"parse");function yae(e){return Object.keys(e).map(t=>{let r=e[t];return Array.isArray(r)||(r=[r]),r.map(n=>[t].concat(Object.keys(n).map(o=>{let a=n[o];return Array.isArray(a)||(a=[a]),a.map(s=>s===!0?o:`${o}=${s}`).join("; ")})).join("; ")).join(", ")}).join(", ")}i(yae,"format");kz.exports={format:yae,parse:wae}});var Ty=Be((oMe,Oz)=>{"use strict";var vae=qe("events"),Iae=qe("https"),bae=qe("http"),Rz=qe("net"),kae=qe("tls"),{randomBytes:Sae,createHash:Pae}=qe("crypto"),{Duplex:rMe,Readable:nMe}=qe("stream"),{URL:ZR}=qe("url"),Oi=Kd(),Rae=JR(),xae=XR(),{isBlob:_ae}=Yd(),{BINARY_TYPES:Sz,CLOSE_TIMEOUT:Eae,EMPTY_BUFFER:xy,GUID:Tae,kForOnEventAttribute:ex,kListener:Cae,kStatusCode:Aae,kWebSocket:Vt,NOOP:xz}=_a(),{EventTarget:{addEventListener:Mae,removeEventListener:jae}}=bz(),{format:Oae,parse:Hae}=Ry(),{toBuffer:Dae}=qp(),_z=Symbol("kAborted"),tx=[8,13],Ca=["CONNECTING","OPEN","CLOSING","CLOSED"],Lae=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/,yt=class e extends vae{static{i(this,"WebSocket")}constructor(t,r,n){super(),this._binaryType=Sz[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=xy,this._closeTimer=null,this._errorEmitted=!1,this._extensions={},this._paused=!1,this._protocol="",this._readyState=e.CONNECTING,this._receiver=null,this._sender=null,this._socket=null,t!==null?(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,r===void 0?r=[]:Array.isArray(r)||(typeof r=="object"&&r!==null?(n=r,r=[]):r=[r]),Ez(this,t,r,n)):(this._autoPong=n.autoPong,this._closeTimeout=n.closeTimeout,this._isServer=!0)}get binaryType(){return this._binaryType}set binaryType(t){Sz.includes(t)&&(this._binaryType=t,this._receiver&&(this._receiver._binaryType=t))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(t,r,n){let o=new Rae({allowSynchronousEvents:n.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxBufferedChunks:n.maxBufferedChunks,maxFragments:n.maxFragments,maxPayload:n.maxPayload,skipUTF8Validation:n.skipUTF8Validation}),a=new xae(t,this._extensions,n.generateMask);this._receiver=o,this._sender=a,this._socket=t,o[Vt]=this,a[Vt]=this,t[Vt]=this,o.on("conclude",Nae),o.on("drain",Uae),o.on("error",qae),o.on("message",Fae),o.on("ping",zae),o.on("pong",Wae),a.onerror=Vae,t.setTimeout&&t.setTimeout(0),t.setNoDelay&&t.setNoDelay(),r.length>0&&t.unshift(r),t.on("close",Az),t.on("data",Ey),t.on("end",Mz),t.on("error",jz),this._readyState=e.OPEN,this.emit("open")}emitClose(){if(!this._socket){this._readyState=e.CLOSED,this.emit("close",this._closeCode,this._closeMessage);return}this._extensions[Oi.extensionName]&&this._extensions[Oi.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=e.CLOSED,this.emit("close",this._closeCode,this._closeMessage)}close(t,r){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){pn(this,this._req,"WebSocket was closed before the connection was established");return}if(this.readyState===e.CLOSING){this._closeFrameSent&&(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end();return}this._readyState=e.CLOSING,this._sender.close(t,r,!this._isServer,n=>{n||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),Cz(this)}}pause(){this.readyState===e.CONNECTING||this.readyState===e.CLOSED||(this._paused=!0,this._socket.pause())}ping(t,r,n){if(this.readyState===e.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof t=="function"?(n=t,t=r=void 0):typeof r=="function"&&(n=r,r=void 0),typeof t=="number"&&(t=t.toString()),this.readyState!==e.OPEN){rx(this,t,n);return}r===void 0&&(r=!this._isServer),this._sender.ping(t||xy,r,n)}pong(t,r,n){if(this.readyState===e.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof t=="function"?(n=t,t=r=void 0):typeof r=="function"&&(n=r,r=void 0),typeof t=="number"&&(t=t.toString()),this.readyState!==e.OPEN){rx(this,t,n);return}r===void 0&&(r=!this._isServer),this._sender.pong(t||xy,r,n)}resume(){this.readyState===e.CONNECTING||this.readyState===e.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(t,r,n){if(this.readyState===e.CONNECTING)throw new Error("WebSocket is not open: readyState 0 (CONNECTING)");if(typeof r=="function"&&(n=r,r={}),typeof t=="number"&&(t=t.toString()),this.readyState!==e.OPEN){rx(this,t,n);return}let o={binary:typeof t!="string",mask:!this._isServer,compress:!0,fin:!0,...r};this._extensions[Oi.extensionName]||(o.compress=!1),this._sender.send(t||xy,o,n)}terminate(){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){pn(this,this._req,"WebSocket was closed before the connection was established");return}this._socket&&(this._readyState=e.CLOSING,this._socket.destroy())}}};Object.defineProperty(yt,"CONNECTING",{enumerable:!0,value:Ca.indexOf("CONNECTING")});Object.defineProperty(yt.prototype,"CONNECTING",{enumerable:!0,value:Ca.indexOf("CONNECTING")});Object.defineProperty(yt,"OPEN",{enumerable:!0,value:Ca.indexOf("OPEN")});Object.defineProperty(yt.prototype,"OPEN",{enumerable:!0,value:Ca.indexOf("OPEN")});Object.defineProperty(yt,"CLOSING",{enumerable:!0,value:Ca.indexOf("CLOSING")});Object.defineProperty(yt.prototype,"CLOSING",{enumerable:!0,value:Ca.indexOf("CLOSING")});Object.defineProperty(yt,"CLOSED",{enumerable:!0,value:Ca.indexOf("CLOSED")});Object.defineProperty(yt.prototype,"CLOSED",{enumerable:!0,value:Ca.indexOf("CLOSED")});["binaryType","bufferedAmount","extensions","isPaused","protocol","readyState","url"].forEach(e=>{Object.defineProperty(yt.prototype,e,{enumerable:!0})});["open","error","close","message"].forEach(e=>{Object.defineProperty(yt.prototype,`on${e}`,{enumerable:!0,get(){for(let t of this.listeners(e))if(t[ex])return t[Cae];return null},set(t){for(let r of this.listeners(e))if(r[ex]){this.removeListener(e,r);break}typeof t=="function"&&this.addEventListener(e,t,{[ex]:!0})}})});yt.prototype.addEventListener=Mae;yt.prototype.removeEventListener=jae;Oz.exports=yt;function Ez(e,t,r,n){let o={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:Eae,protocolVersion:tx[1],maxBufferedChunks:262144,maxFragments:16384,maxPayload:104857600,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...n,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:"GET",host:void 0,path:void 0,port:void 0};if(e._autoPong=o.autoPong,e._closeTimeout=o.closeTimeout,!tx.includes(o.protocolVersion))throw new RangeError(`Unsupported protocol version: ${o.protocolVersion} (supported versions: ${tx.join(", ")})`);let a;if(t instanceof ZR)a=t;else try{a=new ZR(t)}catch{throw new SyntaxError(`Invalid URL: ${t}`)}a.protocol==="http:"?a.protocol="ws:":a.protocol==="https:"&&(a.protocol="wss:"),e._url=a.href;let s=a.protocol==="wss:",c=a.protocol==="ws+unix:",d;if(a.protocol!=="ws:"&&!s&&!c?d=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:c&&!a.pathname?d="The URL's pathname is empty":a.hash&&(d="The URL contains a fragment identifier"),d){let h=new SyntaxError(d);if(e._redirects===0)throw h;_y(e,h);return}let l=s?443:80,u=Sae(16).toString("base64"),p=s?Iae.request:bae.request,m=new Set,g;if(o.createConnection=o.createConnection||(s?$ae:Bae),o.defaultPort=o.defaultPort||l,o.port=a.port||l,o.host=a.hostname.startsWith("[")?a.hostname.slice(1,-1):a.hostname,o.headers={...o.headers,"Sec-WebSocket-Version":o.protocolVersion,"Sec-WebSocket-Key":u,Connection:"Upgrade",Upgrade:"websocket"},o.path=a.pathname+a.search,o.timeout=o.handshakeTimeout,o.perMessageDeflate&&(g=new Oi({...o.perMessageDeflate,isServer:!1,maxPayload:o.maxPayload}),o.headers["Sec-WebSocket-Extensions"]=Oae({[Oi.extensionName]:g.offer()})),r.length){for(let h of r){if(typeof h!="string"||!Lae.test(h)||m.has(h))throw new SyntaxError("An invalid or duplicated subprotocol was specified");m.add(h)}o.headers["Sec-WebSocket-Protocol"]=r.join(",")}if(o.origin&&(o.protocolVersion<13?o.headers["Sec-WebSocket-Origin"]=o.origin:o.headers.Origin=o.origin),(a.username||a.password)&&(o.auth=`${a.username}:${a.password}`),c){let h=o.path.split(":");o.socketPath=h[0],o.path=h[1]}let w;if(o.followRedirects){if(e._redirects===0){e._originalIpc=c,e._originalSecure=s,e._originalHostOrSocketPath=c?o.socketPath:a.host;let h=n&&n.headers;if(n={...n,headers:{}},h)for(let[y,f]of Object.entries(h))n.headers[y.toLowerCase()]=f}else if(e.listenerCount("redirect")===0){let h=c?e._originalIpc?o.socketPath===e._originalHostOrSocketPath:!1:e._originalIpc?!1:a.host===e._originalHostOrSocketPath;(!h||e._originalSecure&&!s)&&(delete o.headers.authorization,delete o.headers.cookie,h||delete o.headers.host,o.auth=void 0)}o.auth&&!n.headers.authorization&&(n.headers.authorization="Basic "+Buffer.from(o.auth).toString("base64")),w=e._req=p(o),e._redirects&&e.emit("redirect",e.url,w)}else w=e._req=p(o);o.timeout&&w.on("timeout",()=>{pn(e,w,"Opening handshake has timed out")}),w.on("error",h=>{w===null||w[_z]||(w=e._req=null,_y(e,h))}),w.on("response",h=>{let y=h.headers.location,f=h.statusCode;if(y&&o.followRedirects&&f>=300&&f<400){if(++e._redirects>o.maxRedirects){pn(e,w,"Maximum redirects exceeded");return}w.abort();let S;try{S=new ZR(y,t)}catch{let I=new SyntaxError(`Invalid URL: ${y}`);_y(e,I);return}Ez(e,S,r,n)}else e.emit("unexpected-response",w,h)||pn(e,w,`Unexpected server response: ${h.statusCode}`)}),w.on("upgrade",(h,y,f)=>{if(e.emit("upgrade",h),e.readyState!==yt.CONNECTING)return;w=e._req=null;let S=h.headers.upgrade;if(S===void 0||S.toLowerCase()!=="websocket"){pn(e,y,"Invalid Upgrade header");return}let k=Pae("sha1").update(u+Tae).digest("base64");if(h.headers["sec-websocket-accept"]!==k){pn(e,y,"Invalid Sec-WebSocket-Accept header");return}let I=h.headers["sec-websocket-protocol"],b;if(I!==void 0?m.size?m.has(I)||(b="Server sent an invalid subprotocol"):b="Server sent a subprotocol but none was requested":m.size&&(b="Server sent no subprotocol"),b){pn(e,y,b);return}I&&(e._protocol=I);let R=h.headers["sec-websocket-extensions"];if(R!==void 0){if(!g){pn(e,y,"Server sent a Sec-WebSocket-Extensions header but no extension was requested");return}let _;try{_=Hae(R)}catch{pn(e,y,"Invalid Sec-WebSocket-Extensions header");return}let P=Object.keys(_);if(P.length!==1||P[0]!==Oi.extensionName){pn(e,y,"Server indicated an extension that was not requested");return}try{g.accept(_[Oi.extensionName])}catch{pn(e,y,"Invalid Sec-WebSocket-Extensions header");return}e._extensions[Oi.extensionName]=g}e.setSocket(y,f,{allowSynchronousEvents:o.allowSynchronousEvents,generateMask:o.generateMask,maxBufferedChunks:o.maxBufferedChunks,maxFragments:o.maxFragments,maxPayload:o.maxPayload,skipUTF8Validation:o.skipUTF8Validation})}),o.finishRequest?o.finishRequest(w,e):w.end()}i(Ez,"initAsClient");function _y(e,t){e._readyState=yt.CLOSING,e._errorEmitted=!0,e.emit("error",t),e.emitClose()}i(_y,"emitErrorAndClose");function Bae(e){return e.path=e.socketPath,Rz.connect(e)}i(Bae,"netConnect");function $ae(e){return e.path=void 0,!e.servername&&e.servername!==""&&(e.servername=Rz.isIP(e.host)?"":e.host),kae.connect(e)}i($ae,"tlsConnect");function pn(e,t,r){e._readyState=yt.CLOSING;let n=new Error(r);Error.captureStackTrace(n,pn),t.setHeader?(t[_z]=!0,t.abort(),t.socket&&!t.socket.destroyed&&t.socket.destroy(),process.nextTick(_y,e,n)):(t.destroy(n),t.once("error",e.emit.bind(e,"error")),t.once("close",e.emitClose.bind(e)))}i(pn,"abortHandshake");function rx(e,t,r){if(t){let n=_ae(t)?t.size:Dae(t).length;e._socket?e._sender._bufferedBytes+=n:e._bufferedAmount+=n}if(r){let n=new Error(`WebSocket is not open: readyState ${e.readyState} (${Ca[e.readyState]})`);process.nextTick(r,n)}}i(rx,"sendAfterClose");function Nae(e,t){let r=this[Vt];r._closeFrameReceived=!0,r._closeMessage=t,r._closeCode=e,r._socket[Vt]!==void 0&&(r._socket.removeListener("data",Ey),process.nextTick(Tz,r._socket),e===1005?r.close():r.close(e,t))}i(Nae,"receiverOnConclude");function Uae(){let e=this[Vt];e.isPaused||e._socket.resume()}i(Uae,"receiverOnDrain");function qae(e){let t=this[Vt];t._socket[Vt]!==void 0&&(t._socket.removeListener("data",Ey),process.nextTick(Tz,t._socket),t.close(e[Aae])),t._errorEmitted||(t._errorEmitted=!0,t.emit("error",e))}i(qae,"receiverOnError");function Pz(){this[Vt].emitClose()}i(Pz,"receiverOnFinish");function Fae(e,t){this[Vt].emit("message",e,t)}i(Fae,"receiverOnMessage");function zae(e){let t=this[Vt];t._autoPong&&t.pong(e,!this._isServer,xz),t.emit("ping",e)}i(zae,"receiverOnPing");function Wae(e){this[Vt].emit("pong",e)}i(Wae,"receiverOnPong");function Tz(e){e.resume()}i(Tz,"resume");function Vae(e){let t=this[Vt];t.readyState!==yt.CLOSED&&(t.readyState===yt.OPEN&&(t._readyState=yt.CLOSING,Cz(t)),this._socket.end(),t._errorEmitted||(t._errorEmitted=!0,t.emit("error",e)))}i(Vae,"senderOnError");function Cz(e){e._closeTimer=setTimeout(e._socket.destroy.bind(e._socket),e._closeTimeout)}i(Cz,"setCloseTimer");function Az(){let e=this[Vt];if(this.removeListener("close",Az),this.removeListener("data",Ey),this.removeListener("end",Mz),e._readyState=yt.CLOSING,!this._readableState.endEmitted&&!e._closeFrameReceived&&!e._receiver._writableState.errorEmitted&&this._readableState.length!==0){let t=this.read(this._readableState.length);e._receiver.write(t)}e._receiver.end(),this[Vt]=void 0,clearTimeout(e._closeTimer),e._receiver._writableState.finished||e._receiver._writableState.errorEmitted?e.emitClose():(e._receiver.on("error",Pz),e._receiver.on("finish",Pz))}i(Az,"socketOnClose");function Ey(e){this[Vt]._receiver.write(e)||this.pause()}i(Ey,"socketOnData");function Mz(){let e=this[Vt];e._readyState=yt.CLOSING,e._receiver.end(),this.end()}i(Mz,"socketOnEnd");function jz(){let e=this[Vt];this.removeListener("error",jz),this.on("error",xz),e&&(e._readyState=yt.CLOSING,this.destroy())}i(jz,"socketOnError")});var Bz=Be((sMe,Lz)=>{"use strict";var iMe=Ty(),{Duplex:Gae}=qe("stream");function Hz(e){e.emit("close")}i(Hz,"emitClose");function Jae(){!this.destroyed&&this._writableState.finished&&this.destroy()}i(Jae,"duplexOnEnd");function Dz(e){this.removeListener("error",Dz),this.destroy(),this.listenerCount("error")===0&&this.emit("error",e)}i(Dz,"duplexOnError");function Kae(e,t){let r=!0,n=new Gae({...t,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return e.on("message",i(function(a,s){let c=!s&&n._readableState.objectMode?a.toString():a;n.push(c)||e.pause()},"message")),e.once("error",i(function(a){n.destroyed||(r=!1,n.destroy(a))},"error")),e.once("close",i(function(){n.destroyed||n.push(null)},"close")),n._destroy=function(o,a){if(e.readyState===e.CLOSED){a(o),process.nextTick(Hz,n);return}let s=!1;e.once("error",i(function(d){s=!0,a(d)},"error")),e.once("close",i(function(){s||a(o),process.nextTick(Hz,n)},"close")),r&&e.terminate()},n._final=function(o){if(e.readyState===e.CONNECTING){e.once("open",i(function(){n._final(o)},"open"));return}e._socket!==null&&(e._socket._writableState.finished?(o(),n._readableState.endEmitted&&n.destroy()):(e._socket.once("finish",i(function(){o()},"finish")),e.close()))},n._read=function(){e.isPaused&&e.resume()},n._write=function(o,a,s){if(e.readyState===e.CONNECTING){e.once("open",i(function(){n._write(o,a,s)},"open"));return}e.send(o,s)},n.on("end",Jae),n.on("error",Dz),n}i(Kae,"createWebSocketStream");Lz.exports=Kae});var nx=Be((dMe,$z)=>{"use strict";var{tokenChars:Yae}=Yd();function Xae(e){let t=new Set,r=-1,n=-1,o=0;for(o;o<e.length;o++){let s=e.charCodeAt(o);if(n===-1&&Yae[s]===1)r===-1&&(r=o);else if(o!==0&&(s===32||s===9))n===-1&&r!==-1&&(n=o);else if(s===44){if(r===-1)throw new SyntaxError(`Unexpected character at index ${o}`);n===-1&&(n=o);let c=e.slice(r,n);if(t.has(c))throw new SyntaxError(`The "${c}" subprotocol is duplicated`);t.add(c),r=n=-1}else throw new SyntaxError(`Unexpected character at index ${o}`)}if(r===-1||n!==-1)throw new SyntaxError("Unexpected end of input");let a=e.slice(r,o);if(t.has(a))throw new SyntaxError(`The "${a}" subprotocol is duplicated`);return t.add(a),t}i(Xae,"parse");$z.exports={parse:Xae}});var Vz=Be((pMe,Wz)=>{"use strict";var Qae=qe("events"),Cy=qe("http"),{Duplex:uMe}=qe("stream"),{createHash:Zae}=qe("crypto"),Nz=Ry(),Gs=Kd(),eie=nx(),tie=Ty(),{CLOSE_TIMEOUT:rie,GUID:nie,kWebSocket:oie}=_a(),aie=/^[+/0-9A-Za-z]{22}==$/,Uz=0,qz=1,zz=2,ox=class extends Qae{static{i(this,"WebSocketServer")}constructor(t,r){if(super(),t={allowSynchronousEvents:!0,autoPong:!0,maxBufferedChunks:256*1024,maxFragments:16*1024,maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:rie,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:tie,...t},t.port==null&&!t.server&&!t.noServer||t.port!=null&&(t.server||t.noServer)||t.server&&t.noServer)throw new TypeError('One and only one of the "port", "server", or "noServer" options must be specified');if(t.port!=null?(this._server=Cy.createServer((n,o)=>{let a=Cy.STATUS_CODES[426];o.writeHead(426,{"Content-Length":a.length,"Content-Type":"text/plain"}),o.end(a)}),this._server.listen(t.port,t.host,t.backlog,r)):t.server&&(this._server=t.server),this._server){let n=this.emit.bind(this,"connection");this._removeListeners=iie(this._server,{listening:this.emit.bind(this,"listening"),error:this.emit.bind(this,"error"),upgrade:i((o,a,s)=>{this.handleUpgrade(o,a,s,n)},"upgrade")})}t.perMessageDeflate===!0&&(t.perMessageDeflate={}),t.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=t,this._state=Uz}address(){if(this.options.noServer)throw new Error('The server is operating in "noServer" mode');return this._server?this._server.address():null}close(t){if(this._state===zz){t&&this.once("close",()=>{t(new Error("The server is not running"))}),process.nextTick(Gp,this);return}if(t&&this.once("close",t),this._state!==qz)if(this._state=qz,this.options.noServer||this.options.server)this._server&&(this._removeListeners(),this._removeListeners=this._server=null),this.clients?this.clients.size?this._shouldEmitClose=!0:process.nextTick(Gp,this):process.nextTick(Gp,this);else{let r=this._server;this._removeListeners(),this._removeListeners=this._server=null,r.close(()=>{Gp(this)})}}shouldHandle(t){if(this.options.path){let r=t.url.indexOf("?");if((r!==-1?t.url.slice(0,r):t.url)!==this.options.path)return!1}return!0}handleUpgrade(t,r,n,o){r.on("error",Fz);let a=t.headers["sec-websocket-key"],s=t.headers.upgrade,c=+t.headers["sec-websocket-version"];if(t.method!=="GET"){Js(this,t,r,405,"Invalid HTTP method");return}if(s===void 0||s.toLowerCase()!=="websocket"){Js(this,t,r,400,"Invalid Upgrade header");return}if(a===void 0||!aie.test(a)){Js(this,t,r,400,"Missing or invalid Sec-WebSocket-Key header");return}if(c!==13&&c!==8){Js(this,t,r,400,"Missing or invalid Sec-WebSocket-Version header",{"Sec-WebSocket-Version":"13, 8"});return}if(!this.shouldHandle(t)){Jp(r,400);return}let d=t.headers["sec-websocket-protocol"],l=new Set;if(d!==void 0)try{l=eie.parse(d)}catch{Js(this,t,r,400,"Invalid Sec-WebSocket-Protocol header");return}let u=t.headers["sec-websocket-extensions"],p={};if(this.options.perMessageDeflate&&u!==void 0){let m=new Gs({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let g=Nz.parse(u);g[Gs.extensionName]&&(m.accept(g[Gs.extensionName]),p[Gs.extensionName]=m)}catch{Js(this,t,r,400,"Invalid or unacceptable Sec-WebSocket-Extensions header");return}}if(this.options.verifyClient){let m={origin:t.headers[`${c===8?"sec-websocket-origin":"origin"}`],secure:!!(t.socket.authorized||t.socket.encrypted),req:t};if(this.options.verifyClient.length===2){this.options.verifyClient(m,(g,w,h,y)=>{if(!g)return Jp(r,w||401,h,y);this.completeUpgrade(p,a,l,t,r,n,o)});return}if(!this.options.verifyClient(m))return Jp(r,401)}this.completeUpgrade(p,a,l,t,r,n,o)}completeUpgrade(t,r,n,o,a,s,c){if(!a.readable||!a.writable)return a.destroy();if(a[oie])throw new Error("server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration");if(this._state>Uz)return Jp(a,503);let l=["HTTP/1.1 101 Switching Protocols","Upgrade: websocket","Connection: Upgrade",`Sec-WebSocket-Accept: ${Zae("sha1").update(r+nie).digest("base64")}`],u=new this.options.WebSocket(null,void 0,this.options);if(n.size){let p=this.options.handleProtocols?this.options.handleProtocols(n,o):n.values().next().value;p&&(l.push(`Sec-WebSocket-Protocol: ${p}`),u._protocol=p)}if(t[Gs.extensionName]){let p=t[Gs.extensionName].params,m=Nz.format({[Gs.extensionName]:[p]});l.push(`Sec-WebSocket-Extensions: ${m}`),u._extensions=t}this.emit("headers",l,o),a.write(l.concat(`\r
4
4
  `).join(`\r
5
5
  `)),a.removeListener("error",Fz),u.setSocket(a,s,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxBufferedChunks:this.options.maxBufferedChunks,maxFragments:this.options.maxFragments,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(u),u.on("close",()=>{this.clients.delete(u),this._shouldEmitClose&&!this.clients.size&&process.nextTick(Gp,this)})),c(u,o)}};Wz.exports=ox;function iie(e,t){for(let r of Object.keys(t))e.on(r,t[r]);return i(function(){for(let n of Object.keys(t))e.removeListener(n,t[n])},"removeListeners")}i(iie,"addListeners");function Gp(e){e._state=zz,e.emit("close")}i(Gp,"emitClose");function Fz(){this.destroy()}i(Fz,"socketOnError");function Jp(e,t,r,n){r=r||Cy.STATUS_CODES[t],n={Connection:"close","Content-Type":"text/html","Content-Length":Buffer.byteLength(r),...n},e.once("finish",e.destroy),e.end(`HTTP/1.1 ${t} ${Cy.STATUS_CODES[t]}\r
6
6
  `+Object.keys(n).map(o=>`${o}: ${n[o]}`).join(`\r
@@ -1,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{q as wt,s as Tt}from"./chunk-RY46UPBO.js";import{z as St}from"./chunk-HG2YFMVU.js";import{i as ge,j as vt,l as he}from"./chunk-OQPJ7FJF.js";import"./chunk-BL3CZWWD.js";import"./chunk-FYWQWKVS.js";import"./chunk-GD3RCUDH.js";import"./chunk-7OKZCJHS.js";import"./chunk-UTIELP6F.js";import"./chunk-7NCM6GBN.js";import"./chunk-4V73I4OL.js";import"./chunk-LE75SVEL.js";import"./chunk-6ESBAHWK.js";import"./chunk-7J2NMUTK.js";import"./chunk-VEBW7NKD.js";import"./chunk-W45RKGM6.js";import"./chunk-AUO5DCEU.js";import"./chunk-Y4I6CFZJ.js";import"./chunk-EDYCSW22.js";import"./chunk-JT5YQ52I.js";import"./chunk-XGY4OQLC.js";import"./chunk-PAYFJHPO.js";import"./chunk-WD4KAKEX.js";import"./chunk-2PXKSAG6.js";import"./chunk-ULTV6INR.js";import"./chunk-WGQ3FMRF.js";import"./chunk-JXLDEYRW.js";import"./chunk-JVMSN7LH.js";import"./chunk-YI6ME6PU.js";import"./chunk-DRLP7GIU.js";import"./chunk-BU6MW65V.js";import"./chunk-LVXL7T5O.js";import"./chunk-HIQPGYVH.js";import"./chunk-DXJC3QW7.js";import"./chunk-P4QM63L3.js";import"./chunk-MTP3B2SU.js";import"./chunk-LK77GI6M.js";import"./chunk-HVM2GUM3.js";import"./chunk-I6VMRQF4.js";import"./chunk-D6L6UNUQ.js";import"./chunk-AJXWJLZA.js";import"./chunk-OKKNDQJF.js";import"./chunk-4PUOWSDE.js";import"./chunk-ZY32SZ2P.js";import"./chunk-OTDDXEQ6.js";import"./chunk-ECOH24MC.js";import"./chunk-4N4EH3RJ.js";import"./chunk-GY7YSD6J.js";import"./chunk-KUE46HTH.js";import"./chunk-JCLTFDVW.js";import"./chunk-6FA3GG5B.js";import"./chunk-SV7ZBEK2.js";import{D as Je,E as re,G as ft,I as gt,L as ht,O as yt}from"./chunk-2MEOUS24.js";import"./chunk-HNQPEOJD.js";import"./chunk-RCT3O3HQ.js";import{f as pt,h as mt}from"./chunk-UGOK7VTC.js";import"./chunk-ZFJWA4JK.js";import"./chunk-X2J2P5ZT.js";import{a as i}from"./chunk-FTQLQJQV.js";import{createInterface as oo}from"node:readline/promises";import{stdin as He,stdout as R}from"node:process";import{pathToFileURL as io}from"node:url";function ve(){return{text:"",cursor:0,history:[],historyIndex:null}}i(ve,"createComposer");function bt(e,t){let r=e.text.slice(0,e.cursor),n=e.text.slice(e.cursor);return{...e,text:`${r}${t}${n}`,cursor:e.cursor+t.length,historyIndex:null}}i(bt,"insertText");function ye(e,t){return{...e,text:t,cursor:t.length}}i(ye,"replaceComposerText");function Rr(e){let t=e.text.trim();return t?{state:{text:"",cursor:0,history:[...e.history.filter(r=>r!==t),t].slice(-100),historyIndex:null},action:{type:"submit",text:t}}:{state:{...e,text:"",cursor:0,historyIndex:null},action:{type:"none"}}}i(Rr,"submitComposer");function Pt(e,t){if(t==="ctrl+c")return{state:e,action:{type:"cancel-or-exit"}};if(t==="ctrl+d")return{state:e,action:e.text?{type:"none"}:{type:"exit"}};if(t==="ctrl+l")return{state:e,action:{type:"rerender"}};if(t==="enter")return Rr(e);if(t==="alt+enter")return{state:bt(e,`
3
+ import{q as wt,s as Tt}from"./chunk-2ACX7IW5.js";import{z as St}from"./chunk-HG2YFMVU.js";import{i as ge,j as vt,l as he}from"./chunk-OQPJ7FJF.js";import"./chunk-BL3CZWWD.js";import"./chunk-FYWQWKVS.js";import"./chunk-GD3RCUDH.js";import"./chunk-7OKZCJHS.js";import"./chunk-UTIELP6F.js";import"./chunk-7NCM6GBN.js";import"./chunk-4V73I4OL.js";import"./chunk-LE75SVEL.js";import"./chunk-6ESBAHWK.js";import"./chunk-7J2NMUTK.js";import"./chunk-VEBW7NKD.js";import"./chunk-W45RKGM6.js";import"./chunk-AUO5DCEU.js";import"./chunk-Y4I6CFZJ.js";import"./chunk-EDYCSW22.js";import"./chunk-JT5YQ52I.js";import"./chunk-XGY4OQLC.js";import"./chunk-PAYFJHPO.js";import"./chunk-WD4KAKEX.js";import"./chunk-2PXKSAG6.js";import"./chunk-ULTV6INR.js";import"./chunk-WGQ3FMRF.js";import"./chunk-JXLDEYRW.js";import"./chunk-JVMSN7LH.js";import"./chunk-YI6ME6PU.js";import"./chunk-DRLP7GIU.js";import"./chunk-BU6MW65V.js";import"./chunk-LVXL7T5O.js";import"./chunk-HIQPGYVH.js";import"./chunk-DXJC3QW7.js";import"./chunk-P4QM63L3.js";import"./chunk-MTP3B2SU.js";import"./chunk-LK77GI6M.js";import"./chunk-HVM2GUM3.js";import"./chunk-I6VMRQF4.js";import"./chunk-D6L6UNUQ.js";import"./chunk-AJXWJLZA.js";import"./chunk-OKKNDQJF.js";import"./chunk-4PUOWSDE.js";import"./chunk-ZY32SZ2P.js";import"./chunk-OTDDXEQ6.js";import"./chunk-ECOH24MC.js";import"./chunk-EJOV6Z6F.js";import"./chunk-GY7YSD6J.js";import"./chunk-KUE46HTH.js";import"./chunk-MZKCW6CB.js";import"./chunk-6FA3GG5B.js";import"./chunk-SV7ZBEK2.js";import{D as Je,E as re,G as ft,I as gt,L as ht,O as yt}from"./chunk-2MEOUS24.js";import"./chunk-HNQPEOJD.js";import"./chunk-RCT3O3HQ.js";import{f as pt,h as mt}from"./chunk-UGOK7VTC.js";import"./chunk-ZFJWA4JK.js";import"./chunk-X2J2P5ZT.js";import{a as i}from"./chunk-FTQLQJQV.js";import{createInterface as oo}from"node:readline/promises";import{stdin as He,stdout as R}from"node:process";import{pathToFileURL as io}from"node:url";function ve(){return{text:"",cursor:0,history:[],historyIndex:null}}i(ve,"createComposer");function bt(e,t){let r=e.text.slice(0,e.cursor),n=e.text.slice(e.cursor);return{...e,text:`${r}${t}${n}`,cursor:e.cursor+t.length,historyIndex:null}}i(bt,"insertText");function ye(e,t){return{...e,text:t,cursor:t.length}}i(ye,"replaceComposerText");function Rr(e){let t=e.text.trim();return t?{state:{text:"",cursor:0,history:[...e.history.filter(r=>r!==t),t].slice(-100),historyIndex:null},action:{type:"submit",text:t}}:{state:{...e,text:"",cursor:0,historyIndex:null},action:{type:"none"}}}i(Rr,"submitComposer");function Pt(e,t){if(t==="ctrl+c")return{state:e,action:{type:"cancel-or-exit"}};if(t==="ctrl+d")return{state:e,action:e.text?{type:"none"}:{type:"exit"}};if(t==="ctrl+l")return{state:e,action:{type:"rerender"}};if(t==="enter")return Rr(e);if(t==="alt+enter")return{state:bt(e,`
4
4
  `),action:{type:"none"}};if(t==="backspace")return e.cursor<=0?{state:e,action:{type:"none"}}:{state:{...e,text:`${e.text.slice(0,e.cursor-1)}${e.text.slice(e.cursor)}`,cursor:e.cursor-1},action:{type:"none"}};if(t==="delete")return e.cursor>=e.text.length?{state:e,action:{type:"none"}}:{state:{...e,text:`${e.text.slice(0,e.cursor)}${e.text.slice(e.cursor+1)}`},action:{type:"none"}};if(t==="left")return{state:{...e,cursor:Math.max(0,e.cursor-1)},action:{type:"none"}};if(t==="right")return{state:{...e,cursor:Math.min(e.text.length,e.cursor+1)},action:{type:"none"}};if(t==="home"||t==="ctrl+a")return{state:{...e,cursor:0},action:{type:"none"}};if(t==="end"||t==="ctrl+e")return{state:{...e,cursor:e.text.length},action:{type:"none"}};if(t==="ctrl+u")return{state:{...e,text:e.text.slice(e.cursor),cursor:0},action:{type:"none"}};if(t==="ctrl+k")return{state:{...e,text:e.text.slice(0,e.cursor)},action:{type:"none"}};if(t==="up"){if(e.history.length===0)return{state:e,action:{type:"none"}};let r=e.historyIndex===null?e.history.length-1:Math.max(0,e.historyIndex-1);return{state:ye({...e,historyIndex:r},e.history[r]??""),action:{type:"none"}}}if(t==="down"){if(e.historyIndex===null)return{state:e,action:{type:"none"}};let r=e.historyIndex+1;return r>=e.history.length?{state:{...e,text:"",cursor:0,historyIndex:null},action:{type:"none"}}:{state:ye({...e,historyIndex:r},e.history[r]??""),action:{type:"none"}}}return t.length>0?{state:bt(e,t),action:{type:"none"}}:{state:e,action:{type:"none"}}}i(Pt,"handleComposerKey");var xt="A turn is already running. Wait for it to finish before sending another line.";function Mr(){let e=!1;return{isRunning(){return e},tryStartSubmission(){return e?!1:(e=!0,!0)},failSubmission(){e=!1},applyRuntimeEvent(t){t.name==="turn.started"&&(e=!0),(t.name==="turn.completed"||t.name==="turn.failed"||t.name==="turn.interrupted")&&(e=!1)}}}i(Mr,"createTerminalTurnSubmissionGuard");function Ct(){return Mr()}i(Ct,"createLineModeTurnGuard");var Se=[{name:"help",usage:"/help",description:"show this help"},{name:"providers",usage:"/providers",description:"list providers"},{name:"provider",usage:"/provider [id]",description:"switch provider",requiresArgument:!0},{name:"model",usage:"/model [id]",description:"list or switch model"},{name:"apps",usage:"/apps",description:"list connectable apps"},{name:"install",usage:"/install <app>",description:"open app details",requiresArgument:!0},{name:"projects",usage:"/projects",description:"list projects"},{name:"project",usage:"/project <id>",description:"switch project",requiresArgument:!0},{name:"permissions",usage:"/permissions [ask|full-access]",description:"show or change command access"},{name:"profile",usage:"/profile [status|diff|catalog|check|push]",description:"show or sync profile"},{name:"agents",usage:"/agents",description:"list agents"},{name:"agent",usage:"/agent <id>",description:"select agent",requiresArgument:!0},{name:"run",usage:"/run <action> [json]",description:"run profile action",requiresArgument:!0},{name:"settings",usage:"/settings",description:"show settings"},{name:"logs",usage:"/logs",description:"show recent events"},{name:"compact",usage:"/compact",description:"compact current session"},{name:"clear",usage:"/clear",description:"clear terminal transcript"},{name:"exit",usage:"/exit",description:"exit"},{name:"hooks",usage:"/hooks",description:"show hook status"},{name:"start",usage:"/start",description:"start a new session"}];function Ke(e){if(!e.startsWith("/"))return null;let[t="",...r]=e.slice(1).trim().split(/\s+/),n=t.toLowerCase();if(!n)return null;if(n==="exit"||n==="quit")return{type:"exit"};if(n==="help")return{type:"help"};if(n==="clear")return{type:"clear"};if(n==="agents")return{type:"agents"};if(n==="apps")return{type:"apps"};if(n==="agent")return{type:"agent",id:r.join(" ").trim()};if(n==="install")return{type:"install",id:r.join(" ").trim()};if(n==="projects")return{type:"projects"};if(n==="project")return{type:"project",id:r.join(" ").trim()};if(n==="model")return{type:"model",id:r.join(" ").trim()||null};if(n==="permissions")return{type:"permissions",args:r};if(n==="profile")return{type:"profile",args:r};if(n==="logs")return{type:"logs"};if(n==="providers")return{type:"providers"};if(n==="provider")return{type:"provider",id:r.join(" ").trim()||null};if(n==="compact")return{type:"compact"};if(n==="hooks")return{type:"hooks"};if(n==="start")return{type:"start"};if(n==="run"){let o=r[0]??"",s=r.slice(1).join(" ").trim();return s?{type:"run",action:o,input:JSON.parse(s)}:{type:"run",action:o,input:void 0}}return n==="settings"?{type:"settings",args:r}:{type:"unknown",command:n}}i(Ke,"parseSlashCommand");function It(e){let t=e.trim();if(!t.startsWith("!"))return null;let r=t.slice(1).trim();return r?{command:r}:null}i(It,"parseDirectCommandPrompt");function At(){let e=Math.max(...Se.map(t=>t.usage.length));return["Commands:",...Se.map(t=>`${t.usage.padEnd(e+2)}${t.description}`)].join(`
5
5
  `)}i(At,"helpText");var we=class{static{i(this,"RawInput")}input;onKey;previousRawMode=!1;dataHandler=null;constructor(t,r){this.input=t,this.onKey=r}start(){this.previousRawMode=this.input.isRaw??!1,this.input.setRawMode(!0),this.input.resume(),this.dataHandler=t=>{for(let r of Or(t))this.onKey(r)},this.input.on("data",this.dataHandler)}stop(){this.dataHandler&&this.input.off("data",this.dataHandler),this.dataHandler=null,this.input.setRawMode(this.previousRawMode),this.input.pause()}};function Or(e){let t=e.toString("utf8"),r=[];for(let n=0;n<t.length;n+=1){let o=t[n],s=t[n+1];if(o==="\x1B"){let a=jr(t,n);r.push(a.key),n=a.end;continue}o===""?r.push("ctrl+c"):o===""?r.push("ctrl+d"):o==="\f"?r.push("ctrl+l"):o===""?r.push("ctrl+a"):o===""?r.push("ctrl+e"):o==="\v"?r.push("ctrl+k"):o===""?r.push("ctrl+u"):o==="\x7F"||o==="\b"?r.push("backspace"):o==="\r"||o===`
6
6
  `?r.push("enter"):(o>=" "||o&&s)&&r.push(o)}return r}i(Or,"decodeKeys");function jr(e,t){let r=e.slice(t);return r.startsWith("\x1B\r")||r.startsWith(`\x1B
@@ -1,3 +1,3 @@
1
1
  import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
- import{a as C,b as Te}from"./chunk-SDHG6CKU.js";import{a as Q,d as ve}from"./chunk-GYYJ47GX.js";import{d as we,f as Ie,g as ye}from"./chunk-WCNPGKST.js";import{a as he,b as F,c as J,d as ge,e as ke,f as Me}from"./chunk-HKVFU3B3.js";import"./chunk-DWF3FCY4.js";import{a as me,d as B,e as b,g as fe}from"./chunk-YDZBX4XQ.js";import{b as Se,c as Pe,d as W}from"./chunk-AFH462DO.js";import{b as pe}from"./chunk-CIZI6Z7D.js";import{a as ue}from"./chunk-KCJVFLBB.js";import"./chunk-HG2YFMVU.js";import"./chunk-OQPJ7FJF.js";import"./chunk-BL3CZWWD.js";import"./chunk-FYWQWKVS.js";import"./chunk-GD3RCUDH.js";import"./chunk-7OKZCJHS.js";import"./chunk-UTIELP6F.js";import"./chunk-7NCM6GBN.js";import"./chunk-4V73I4OL.js";import"./chunk-LE75SVEL.js";import"./chunk-6ESBAHWK.js";import"./chunk-7J2NMUTK.js";import"./chunk-VEBW7NKD.js";import"./chunk-W45RKGM6.js";import"./chunk-AUO5DCEU.js";import"./chunk-Y4I6CFZJ.js";import"./chunk-EDYCSW22.js";import"./chunk-JT5YQ52I.js";import"./chunk-XGY4OQLC.js";import"./chunk-PAYFJHPO.js";import"./chunk-WD4KAKEX.js";import"./chunk-2PXKSAG6.js";import"./chunk-ULTV6INR.js";import"./chunk-WGQ3FMRF.js";import"./chunk-JXLDEYRW.js";import"./chunk-JVMSN7LH.js";import{b as de,c as ce,z as le}from"./chunk-YI6ME6PU.js";import"./chunk-DRLP7GIU.js";import{Ca as x,Da as ie,Ia as ne,M as ee,O as L,R as te,U as re,oa as ae,wa as oe,za as se}from"./chunk-BU6MW65V.js";import"./chunk-LVXL7T5O.js";import"./chunk-HIQPGYVH.js";import{D as X,H as v,O as Y,U as Z,j as k,x as N}from"./chunk-DXJC3QW7.js";import"./chunk-P4QM63L3.js";import"./chunk-MTP3B2SU.js";import"./chunk-LK77GI6M.js";import"./chunk-HVM2GUM3.js";import"./chunk-I6VMRQF4.js";import"./chunk-D6L6UNUQ.js";import"./chunk-AJXWJLZA.js";import"./chunk-OKKNDQJF.js";import{L as g,M as R,O as G,S as V,mb as K}from"./chunk-4PUOWSDE.js";import"./chunk-ZY32SZ2P.js";import"./chunk-OTDDXEQ6.js";import"./chunk-ECOH24MC.js";import"./chunk-KUE46HTH.js";import"./chunk-6FA3GG5B.js";import"./chunk-2MEOUS24.js";import"./chunk-HNQPEOJD.js";import"./chunk-RCT3O3HQ.js";import"./chunk-ZFJWA4JK.js";import{A as I}from"./chunk-X2J2P5ZT.js";import{a as m}from"./chunk-FTQLQJQV.js";import qe from"node:path";import{createHash as xe}from"node:crypto";function j(o){let{request:a,resolved:r}=b(o.request,o.package),{starter:t,...n}=r,e=a.rewardBindingRef&&!R(a.rewardBindingRef,g(r.rewardBinding));if(e&&(!o.rewardSelection||!R(a.rewardBindingRef,g(o.rewardSelection.rewardBinding))))throw new Error("The selected starter Reward is unavailable for package preparation.");let i=re({owner:{scopeId:a.profileId,modelId:a.modelId},source:n,...e?o.rewardSelection:{rewardBinding:n.rewardBinding,rewards:n.rewards,assets:n.assets}}),{taskset:s,taskDefinition:p,rewardBinding:l,rewards:d,assets:h}=i;if(o.source.profileId!==a.profileId||o.source.sourceHash!==t.contentHash)throw new Error("Starter source must belong to this Profile and pin the catalog package.");let u=i.execution!==void 0,y=s.environment.kind==="text"&&s.environment.entrypoint==="openpond.text.v1"&&!s.environment.stateful&&(!s.environmentRelease&&!s.verifierSetRelease||i.executionResources!==void 0)&&!s.capabilities.length&&!s.tools.length;if(!["sft","grpo"].includes(a.method)||p.harness||!y&&!u||s.tasks.some(c=>c.artifactRefs.length)||s.graders.some(c=>c.kind==="model_judge"&&(!c.model||c.calibrationStatus!=="passed")))throw new Error("This starter requires an additional training or environment adapter before preparation.");let w=new Set(o.approvedTrainingTaskIds);if(w.size!==o.approvedTrainingTaskIds.length)throw new Error("Starter training approvals must be unique.");for(let c of w){let P=s.tasks.find(H=>H.id===c);if(!P||P.split!=="train")throw new Error(`Starter approval must reference a training task: ${c}.`);if(a.method==="sft"&&P.expectedOutput===null)throw new Error(`SFT starter approval requires a reviewed target: ${c}.`)}if(a.method==="grpo"&&s.tasks.some(c=>c.split==="train"&&!w.has(c.id)))throw new Error("GRPO starter preparation requires approval of every training task.");for(let c of o.fixtures){if(!s.tasks.some(P=>P.id===c.taskId))throw new Error(`Starter fixture references an unknown task: ${c.taskId}.`);u&&!c.infrastructureError&&ee.parse(c.metadata.toolScript)}let E=s.id,f=se({profileId:a.profileId,id:`${E}-draft`,name:t.name,now:o.createdAt}),S=[];for(let c of s.graders){if(c.kind!=="custom_verifier")continue;let P=h.find(D=>D.id===c.verifierRef.id);if(!P)throw new Error(`Starter verifier asset is missing: ${c.id}.`);let H=c.verifierRef.path;S.some(D=>D.path===H)||S.push({path:H,role:"verifier",content:V(P,c.verifierRef)})}let _=ae.parse({...f,objective:p.instructions,metrics:s.metrics??f.metrics,sourceRefs:[o.source],policy:s.policy,environment:{...f.environment,kind:u?"agent":"chat",entrypoint:s.environment.entrypoint,stateful:s.environment.stateful,toolNames:s.tools.map(c=>c.name),deterministicSeeds:s.environment.deterministicSeeds,defaultTimeoutMs:s.environment.defaultTimeoutMs,networkPolicy:s.environment.networkPolicy,metadata:{portableEnvironment:s.environment,portableTools:s.tools,...i.executionResources?{portableExecutionResources:i.executionResources}:i.execution?{portableExecutionResources:{environment:i.execution.environment,verifierSet:i.execution.verifierSet}}:{}}},output:{mode:"structured_json",jsonSchema:p.outputSchema,renderer:null},capabilities:{...f.capabilities,taskKind:u?"single_agent":"chat",requiresTools:u,requiresState:u,supportedSignals:a.method==="grpo"?["reward"]:["demonstration"],compatibleMethods:[a.method],rewardKinds:[...new Set(s.graders.map(c=>c.kind==="human"?"human":c.kind==="model_judge"?"model_judge":"deterministic"))],requiresPrivilegedGrading:!0,environmentPlacements:["local","remote"]},tasks:s.tasks.map(({artifactRefs:c,...P})=>({...P,schemaVersion:"openpond.taskData.v1",sourceRefs:[o.source.id],metadata:{exampleOrigin:"curated_starter",starter:g(t),portableTaskRecord:{...P,artifactRefs:[]}}})),graders:ie(l,d,h),graderFixtures:o.fixtures,learningSignals:{...f.learningSignals,rewards:a.method==="grpo"?s.tasks.filter(c=>w.has(c.id)).map(c=>({kind:"reward",id:`starter-reward-${c.id}`,taskId:c.id,task:p.instructions,rules:[{id:l.id,points:1,condition:"Execute the published Reward binding with its declared normalization, weights and required gates."}],otherwisePoints:0,executable:!0,approved:!0,confidence:1,sourceRefs:[o.source.id],artifactRef:l.id,metadata:{starter:g(t),rewardBinding:g(l),approvalOrigin:"catalog_publication"}})):[],demonstrations:a.method==="sft"?s.tasks.filter(c=>w.has(c.id)).map(c=>({kind:"demonstration",id:`starter-target-${c.id}`,taskId:c.id,sourceRefs:[o.source.id],artifactRef:s.id,approved:!0,confidence:1,prompt:null,response:JSON.stringify(c.expectedOutput),metadata:{starter:g(t),approvalOrigin:"catalog_publication"}})):[]},metadata:{starter:g(t),starterTasksetRelease:g(s),taskDefinition:g(p),rewardBinding:g(l),rewardExecution:{binding:l,rewards:d},portableCapabilities:s.capabilities,derivedPortableMetadata:s.metadata,modelTasksetDerivation:s.metadata.modelTasksetDerivation}}),M=le({draft:_,now:o.createdAt,tasksetId:E,sourcePackageHash:s.contentHash});return M.metrics=s.metrics,s.metadata.tasksetOutputContract===void 0?delete M.metadata.tasksetOutputContract:M.metadata.tasksetOutputContract=s.metadata.tasksetOutputContract,M.contentHash=x(M),{draft:_,taskset:M,generatedFiles:S,resources:i}}m(j,"prepareModelStarterTaskset");function O(o,a){let r=B(a),t=o.get("SELECT request_hash, payload FROM model_starter_creation_operations WHERE profile_id = ? AND operation_id = ?",[r.profileId,r.operationId]);if(!t)return null;if(t.request_hash!==Re(r))throw new Error("Starter creation operation was already used with different configuration.");return v.parse(JSON.parse(t.payload))}m(O,"findModelStarterCreation");async function Ee(o,a){let r=B(a.request);if(r.learning)throw new Error("Create this Model in a hosted workspace to enable continual learning.");let t=O(o,r);if(t)return t;let{taskset:n,resources:e}=j(a),i=fe(a.package),s=await Y({id:r.modelId,profileId:r.profileId,name:r.name,objective:i.taskDefinition.instructions,defaultBaseModel:r.startingModel,defaultDestinationId:null,trainingSetup:me({package:e,setup:X.parse({tasksetRef:g(n),rewardBindingRef:g(e.rewardBinding),baseModel:r.startingModel,method:r.method,managedRolloutPlacement:"remote"})})},0);o.exec("BEGIN IMMEDIATE");try{let p=O(o,r);if(p)return o.exec("COMMIT"),p;if(o.get("SELECT id FROM tasksets WHERE id = ?",[n.id])||o.get("SELECT id FROM model_projects WHERE id = ?",[r.modelId]))throw new Error("Starter creation requires a new Model and Taskset identity.");let l=[...e.executionResources??e.execution?[{kind:"asset",resource:te(e.executionResources??e.execution)}]:[],...i.execution?[{kind:"asset",resource:L(i.execution)}]:[],...i.assets.map(u=>({kind:"asset",resource:u})),...i.rewards.map(u=>({kind:"reward",resource:u})),{kind:"binding",resource:i.rewardBinding},{kind:"definition",resource:i.taskDefinition},{kind:"package",resource:i.taskset},...e.taskset.contentHash===i.taskset.contentHash?[]:[{kind:"definition",resource:e.taskDefinition},{kind:"package",resource:e.taskset},...e.execution?[{kind:"asset",resource:L(e.execution)}]:[]]];for(let{kind:u,resource:y}of l)he(o,r.profileId,u,y);let d=JSON.stringify(n);o.run("INSERT INTO tasksets (id, profile_id, status, payload, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?)",[n.id,n.profileId,n.status,d,n.createdAt,n.updatedAt]),o.run("INSERT INTO taskset_revisions (taskset_id, revision, content_hash, profile_id, status, payload, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?)",[n.id,n.revision,n.contentHash,n.profileId,n.status,d,n.createdAt,n.updatedAt]);let h=ke(o,s);return o.run("INSERT INTO model_starter_creation_operations (profile_id, operation_id, request_hash, payload) VALUES (?, ?, ?, ?)",[r.profileId,r.operationId,Re(r),JSON.stringify(h)]),o.exec("COMMIT"),h}catch(p){throw o.exec("ROLLBACK"),p}}m(Ee,"commitModelStarterCreation");function Re(o){return xe("sha256").update(k(o)).digest("hex")}m(Re,"requestHash");function q(o,a,r,t,n){let e=v.parse(r);o.exec("BEGIN IMMEDIATE");try{let i=o.get("SELECT payload FROM model_projects WHERE id = ?",[e.id]),s=i?v.parse(JSON.parse(i.payload)):null;s&&s.profileId!==e.profileId&&T("Model ownership changed during hosted synchronization.");let p;if(t)k(s)!==k(a)&&T("Model changed while its hosted configuration was loading. Refresh before applying it."),p=e;else{(!s||!a||a.id!==e.id||a.profileId!==e.profileId)&&T("Model is no longer available for hosted synchronization."),s.hosted?.teamId!==a.hosted?.teamId&&s.hosted?.teamId!==e.hosted?.teamId&&T("Model hosting team changed during synchronization.");let l=e.hosted,d=s.hosted,h=d;if(l){d?.apiOrigin&&d.apiOrigin!==l.apiOrigin&&T("Model hosting API changed during synchronization.");let u=d?.apiOrigin===l.apiOrigin&&d?.teamId===l.teamId&&d.projectId===l.projectId;u&&d.revision===l.revision&&d.etag!==l.etag&&T("Hosted Model receipts disagree about the same revision."),h={...u&&d.revision>l.revision?d:l,tasksets:u?je(d.tasksets,l.tasksets,w=>`${w.localTasksetId}:${w.releaseHash}`,w=>w.syncedAt):l.tasksets}}p=v.parse({...s,hosted:h,tasksetSyncs:je(s.tasksetSyncs,e.tasksetSyncs,u=>u.localTasksetId,u=>u.lastAttemptAt)})}return n?.(),o.run(`INSERT INTO model_projects (id, profile_id, payload, created_at, updated_at) VALUES (?, ?, ?, ?, ?)
2
+ import{a as C,b as Te}from"./chunk-SDHG6CKU.js";import{a as Q,d as ve}from"./chunk-GYYJ47GX.js";import{d as we,f as Ie,g as ye}from"./chunk-WCNPGKST.js";import{a as he,b as F,c as J,d as ge,e as ke,f as Me}from"./chunk-5FSPDSAO.js";import"./chunk-DWF3FCY4.js";import{a as me,d as B,e as b,g as fe}from"./chunk-YAA7F5LI.js";import{b as Se,c as Pe,d as W}from"./chunk-AFH462DO.js";import{b as pe}from"./chunk-CIZI6Z7D.js";import{a as ue}from"./chunk-KCJVFLBB.js";import"./chunk-HG2YFMVU.js";import"./chunk-OQPJ7FJF.js";import"./chunk-BL3CZWWD.js";import"./chunk-FYWQWKVS.js";import"./chunk-GD3RCUDH.js";import"./chunk-7OKZCJHS.js";import"./chunk-UTIELP6F.js";import"./chunk-7NCM6GBN.js";import"./chunk-4V73I4OL.js";import"./chunk-LE75SVEL.js";import"./chunk-6ESBAHWK.js";import"./chunk-7J2NMUTK.js";import"./chunk-VEBW7NKD.js";import"./chunk-W45RKGM6.js";import"./chunk-AUO5DCEU.js";import"./chunk-Y4I6CFZJ.js";import"./chunk-EDYCSW22.js";import"./chunk-JT5YQ52I.js";import"./chunk-XGY4OQLC.js";import"./chunk-PAYFJHPO.js";import"./chunk-WD4KAKEX.js";import"./chunk-2PXKSAG6.js";import"./chunk-ULTV6INR.js";import"./chunk-WGQ3FMRF.js";import"./chunk-JXLDEYRW.js";import"./chunk-JVMSN7LH.js";import{b as de,c as ce,z as le}from"./chunk-YI6ME6PU.js";import"./chunk-DRLP7GIU.js";import{Ca as x,Da as ie,Ia as ne,M as ee,O as L,R as te,U as re,oa as ae,wa as oe,za as se}from"./chunk-BU6MW65V.js";import"./chunk-LVXL7T5O.js";import"./chunk-HIQPGYVH.js";import{D as X,H as v,O as Y,U as Z,j as k,x as N}from"./chunk-DXJC3QW7.js";import"./chunk-P4QM63L3.js";import"./chunk-MTP3B2SU.js";import"./chunk-LK77GI6M.js";import"./chunk-HVM2GUM3.js";import"./chunk-I6VMRQF4.js";import"./chunk-D6L6UNUQ.js";import"./chunk-AJXWJLZA.js";import"./chunk-OKKNDQJF.js";import{L as g,M as R,O as G,S as V,mb as K}from"./chunk-4PUOWSDE.js";import"./chunk-ZY32SZ2P.js";import"./chunk-OTDDXEQ6.js";import"./chunk-ECOH24MC.js";import"./chunk-KUE46HTH.js";import"./chunk-6FA3GG5B.js";import"./chunk-2MEOUS24.js";import"./chunk-HNQPEOJD.js";import"./chunk-RCT3O3HQ.js";import"./chunk-ZFJWA4JK.js";import{A as I}from"./chunk-X2J2P5ZT.js";import{a as m}from"./chunk-FTQLQJQV.js";import qe from"node:path";import{createHash as xe}from"node:crypto";function j(o){let{request:a,resolved:r}=b(o.request,o.package),{starter:t,...n}=r,e=a.rewardBindingRef&&!R(a.rewardBindingRef,g(r.rewardBinding));if(e&&(!o.rewardSelection||!R(a.rewardBindingRef,g(o.rewardSelection.rewardBinding))))throw new Error("The selected starter Reward is unavailable for package preparation.");let i=re({owner:{scopeId:a.profileId,modelId:a.modelId},source:n,...e?o.rewardSelection:{rewardBinding:n.rewardBinding,rewards:n.rewards,assets:n.assets}}),{taskset:s,taskDefinition:p,rewardBinding:l,rewards:d,assets:h}=i;if(o.source.profileId!==a.profileId||o.source.sourceHash!==t.contentHash)throw new Error("Starter source must belong to this Profile and pin the catalog package.");let u=i.execution!==void 0,y=s.environment.kind==="text"&&s.environment.entrypoint==="openpond.text.v1"&&!s.environment.stateful&&(!s.environmentRelease&&!s.verifierSetRelease||i.executionResources!==void 0)&&!s.capabilities.length&&!s.tools.length;if(!["sft","grpo"].includes(a.method)||p.harness||!y&&!u||s.tasks.some(c=>c.artifactRefs.length)||s.graders.some(c=>c.kind==="model_judge"&&(!c.model||c.calibrationStatus!=="passed")))throw new Error("This starter requires an additional training or environment adapter before preparation.");let w=new Set(o.approvedTrainingTaskIds);if(w.size!==o.approvedTrainingTaskIds.length)throw new Error("Starter training approvals must be unique.");for(let c of w){let P=s.tasks.find(H=>H.id===c);if(!P||P.split!=="train")throw new Error(`Starter approval must reference a training task: ${c}.`);if(a.method==="sft"&&P.expectedOutput===null)throw new Error(`SFT starter approval requires a reviewed target: ${c}.`)}if(a.method==="grpo"&&s.tasks.some(c=>c.split==="train"&&!w.has(c.id)))throw new Error("GRPO starter preparation requires approval of every training task.");for(let c of o.fixtures){if(!s.tasks.some(P=>P.id===c.taskId))throw new Error(`Starter fixture references an unknown task: ${c.taskId}.`);u&&!c.infrastructureError&&ee.parse(c.metadata.toolScript)}let E=s.id,f=se({profileId:a.profileId,id:`${E}-draft`,name:t.name,now:o.createdAt}),S=[];for(let c of s.graders){if(c.kind!=="custom_verifier")continue;let P=h.find(D=>D.id===c.verifierRef.id);if(!P)throw new Error(`Starter verifier asset is missing: ${c.id}.`);let H=c.verifierRef.path;S.some(D=>D.path===H)||S.push({path:H,role:"verifier",content:V(P,c.verifierRef)})}let _=ae.parse({...f,objective:p.instructions,metrics:s.metrics??f.metrics,sourceRefs:[o.source],policy:s.policy,environment:{...f.environment,kind:u?"agent":"chat",entrypoint:s.environment.entrypoint,stateful:s.environment.stateful,toolNames:s.tools.map(c=>c.name),deterministicSeeds:s.environment.deterministicSeeds,defaultTimeoutMs:s.environment.defaultTimeoutMs,networkPolicy:s.environment.networkPolicy,metadata:{portableEnvironment:s.environment,portableTools:s.tools,...i.executionResources?{portableExecutionResources:i.executionResources}:i.execution?{portableExecutionResources:{environment:i.execution.environment,verifierSet:i.execution.verifierSet}}:{}}},output:{mode:"structured_json",jsonSchema:p.outputSchema,renderer:null},capabilities:{...f.capabilities,taskKind:u?"single_agent":"chat",requiresTools:u,requiresState:u,supportedSignals:a.method==="grpo"?["reward"]:["demonstration"],compatibleMethods:[a.method],rewardKinds:[...new Set(s.graders.map(c=>c.kind==="human"?"human":c.kind==="model_judge"?"model_judge":"deterministic"))],requiresPrivilegedGrading:!0,environmentPlacements:["local","remote"]},tasks:s.tasks.map(({artifactRefs:c,...P})=>({...P,schemaVersion:"openpond.taskData.v1",sourceRefs:[o.source.id],metadata:{exampleOrigin:"curated_starter",starter:g(t),portableTaskRecord:{...P,artifactRefs:[]}}})),graders:ie(l,d,h),graderFixtures:o.fixtures,learningSignals:{...f.learningSignals,rewards:a.method==="grpo"?s.tasks.filter(c=>w.has(c.id)).map(c=>({kind:"reward",id:`starter-reward-${c.id}`,taskId:c.id,task:p.instructions,rules:[{id:l.id,points:1,condition:"Execute the published Reward binding with its declared normalization, weights and required gates."}],otherwisePoints:0,executable:!0,approved:!0,confidence:1,sourceRefs:[o.source.id],artifactRef:l.id,metadata:{starter:g(t),rewardBinding:g(l),approvalOrigin:"catalog_publication"}})):[],demonstrations:a.method==="sft"?s.tasks.filter(c=>w.has(c.id)).map(c=>({kind:"demonstration",id:`starter-target-${c.id}`,taskId:c.id,sourceRefs:[o.source.id],artifactRef:s.id,approved:!0,confidence:1,prompt:null,response:JSON.stringify(c.expectedOutput),metadata:{starter:g(t),approvalOrigin:"catalog_publication"}})):[]},metadata:{starter:g(t),starterTasksetRelease:g(s),taskDefinition:g(p),rewardBinding:g(l),rewardExecution:{binding:l,rewards:d},portableCapabilities:s.capabilities,derivedPortableMetadata:s.metadata,modelTasksetDerivation:s.metadata.modelTasksetDerivation}}),M=le({draft:_,now:o.createdAt,tasksetId:E,sourcePackageHash:s.contentHash});return M.metrics=s.metrics,s.metadata.tasksetOutputContract===void 0?delete M.metadata.tasksetOutputContract:M.metadata.tasksetOutputContract=s.metadata.tasksetOutputContract,M.contentHash=x(M),{draft:_,taskset:M,generatedFiles:S,resources:i}}m(j,"prepareModelStarterTaskset");function O(o,a){let r=B(a),t=o.get("SELECT request_hash, payload FROM model_starter_creation_operations WHERE profile_id = ? AND operation_id = ?",[r.profileId,r.operationId]);if(!t)return null;if(t.request_hash!==Re(r))throw new Error("Starter creation operation was already used with different configuration.");return v.parse(JSON.parse(t.payload))}m(O,"findModelStarterCreation");async function Ee(o,a){let r=B(a.request);if(r.learning)throw new Error("Create this Model in a hosted workspace to enable continual learning.");let t=O(o,r);if(t)return t;let{taskset:n,resources:e}=j(a),i=fe(a.package),s=await Y({id:r.modelId,profileId:r.profileId,name:r.name,objective:i.taskDefinition.instructions,defaultBaseModel:r.startingModel,defaultDestinationId:null,trainingSetup:me({package:e,setup:X.parse({tasksetRef:g(n),rewardBindingRef:g(e.rewardBinding),baseModel:r.startingModel,method:r.method,managedRolloutPlacement:"remote"})})},0);o.exec("BEGIN IMMEDIATE");try{let p=O(o,r);if(p)return o.exec("COMMIT"),p;if(o.get("SELECT id FROM tasksets WHERE id = ?",[n.id])||o.get("SELECT id FROM model_projects WHERE id = ?",[r.modelId]))throw new Error("Starter creation requires a new Model and Taskset identity.");let l=[...e.executionResources??e.execution?[{kind:"asset",resource:te(e.executionResources??e.execution)}]:[],...i.execution?[{kind:"asset",resource:L(i.execution)}]:[],...i.assets.map(u=>({kind:"asset",resource:u})),...i.rewards.map(u=>({kind:"reward",resource:u})),{kind:"binding",resource:i.rewardBinding},{kind:"definition",resource:i.taskDefinition},{kind:"package",resource:i.taskset},...e.taskset.contentHash===i.taskset.contentHash?[]:[{kind:"definition",resource:e.taskDefinition},{kind:"package",resource:e.taskset},...e.execution?[{kind:"asset",resource:L(e.execution)}]:[]]];for(let{kind:u,resource:y}of l)he(o,r.profileId,u,y);let d=JSON.stringify(n);o.run("INSERT INTO tasksets (id, profile_id, status, payload, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?)",[n.id,n.profileId,n.status,d,n.createdAt,n.updatedAt]),o.run("INSERT INTO taskset_revisions (taskset_id, revision, content_hash, profile_id, status, payload, created_at, updated_at) VALUES (?, ?, ?, ?, ?, ?, ?, ?)",[n.id,n.revision,n.contentHash,n.profileId,n.status,d,n.createdAt,n.updatedAt]);let h=ke(o,s);return o.run("INSERT INTO model_starter_creation_operations (profile_id, operation_id, request_hash, payload) VALUES (?, ?, ?, ?)",[r.profileId,r.operationId,Re(r),JSON.stringify(h)]),o.exec("COMMIT"),h}catch(p){throw o.exec("ROLLBACK"),p}}m(Ee,"commitModelStarterCreation");function Re(o){return xe("sha256").update(k(o)).digest("hex")}m(Re,"requestHash");function q(o,a,r,t,n){let e=v.parse(r);o.exec("BEGIN IMMEDIATE");try{let i=o.get("SELECT payload FROM model_projects WHERE id = ?",[e.id]),s=i?v.parse(JSON.parse(i.payload)):null;s&&s.profileId!==e.profileId&&T("Model ownership changed during hosted synchronization.");let p;if(t)k(s)!==k(a)&&T("Model changed while its hosted configuration was loading. Refresh before applying it."),p=e;else{(!s||!a||a.id!==e.id||a.profileId!==e.profileId)&&T("Model is no longer available for hosted synchronization."),s.hosted?.teamId!==a.hosted?.teamId&&s.hosted?.teamId!==e.hosted?.teamId&&T("Model hosting team changed during synchronization.");let l=e.hosted,d=s.hosted,h=d;if(l){d?.apiOrigin&&d.apiOrigin!==l.apiOrigin&&T("Model hosting API changed during synchronization.");let u=d?.apiOrigin===l.apiOrigin&&d?.teamId===l.teamId&&d.projectId===l.projectId;u&&d.revision===l.revision&&d.etag!==l.etag&&T("Hosted Model receipts disagree about the same revision."),h={...u&&d.revision>l.revision?d:l,tasksets:u?je(d.tasksets,l.tasksets,w=>`${w.localTasksetId}:${w.releaseHash}`,w=>w.syncedAt):l.tasksets}}p=v.parse({...s,hosted:h,tasksetSyncs:je(s.tasksetSyncs,e.tasksetSyncs,u=>u.localTasksetId,u=>u.lastAttemptAt)})}return n?.(),o.run(`INSERT INTO model_projects (id, profile_id, payload, created_at, updated_at) VALUES (?, ?, ?, ?, ?)
3
3
  ON CONFLICT(id) DO UPDATE SET payload = excluded.payload, updated_at = excluded.updated_at`,[p.id,p.profileId,JSON.stringify(p),p.createdAt,p.updatedAt]),o.exec("COMMIT"),p}catch(i){throw o.exec("ROLLBACK"),i}}m(q,"commitModelProjectHosting");function je(o,a,r,t){let n=new Map(o.map(e=>[r(e),e]));for(let e of a){let i=n.get(r(e));(!i||Date.parse(t(e))>=Date.parse(t(i)))&&n.set(r(e),e)}return[...n.values()]}m(je,"mergeLatest");function T(o){throw new Z(409,{schemaVersion:"openpond.modelProjectApiError.v2",code:"model_hosting_conflict",message:o,retryable:!1,requestId:null,details:{}})}m(T,"conflict");function z(o,a){let{request:r,resolved:t}=b(a.request,a.package),n=r.rewardBindingRef;if(!n||R(n,g(t.rewardBinding)))return a;function e(l,d){let h=o.get("SELECT payload FROM learning_revisions WHERE scope = ? AND kind = ? AND id = ? AND revision = ?",[r.profileId,l,d.id,d.revision]);if(!h)throw new Error(`The selected starter ${l} is unavailable in this Profile.`);let u=K[l].parse(JSON.parse(h.payload));if(G(u),d.contentHash&&d.contentHash!==u.contentHash)throw new Error("The selected starter Reward differs from its immutable reference.");return u}m(e,"read");let i=e("binding",n),s=[...new Map(i.sources.map(l=>[k(l.reward),e("reward",l.reward)])).values()],p=new Map(t.assets.map(l=>[l.id,l]));for(let l of s){let d=l.implementation;for(let h of[...l.assets,..."verifierRef"in d?[d.verifierRef]:[],..."rubricRef"in d?[d.rubricRef]:[],..."inputContract"in d?[d.inputContract]:[]])p.has(h.id)||p.set(h.id,e("asset",{id:h.id,revision:1}))}return{...a,rewardSelection:{rewardBinding:i,rewards:s,assets:[...p.values()]}}}m(z,"resolveModelStarterSelection");import be from"node:path";async function $(o,a,r){let t=r.project.trainingSetup.tasksetRef;if(!t)return;let n=o.get("SELECT payload FROM taskset_revisions WHERE taskset_id = ? AND revision = ?",[t.id,t.revision]);if(!n)return;let e=oe.parse(JSON.parse(n.payload));if(e.profileId!==r.project.profileId||e.contentHash!==t.contentHash)return;let i=o.get("SELECT payload FROM model_projects WHERE id = ?",[r.project.id]),s=i?v.parse(JSON.parse(i.payload)):null;if(s&&(s.profileId!==r.project.profileId||s.revision!==r.expectedRevision))return;let p=s?.hosted?.tasksets.find(f=>f.localTasksetId===e.id&&f.localTasksetHash===e.contentHash),l=typeof e.metadata.importedPackageHash=="string"?e.metadata.importedPackageHash:p?.packageHash;if(!l){if(e.metadata.learning!==void 0||e.metadata.taskDefinition!==void 0||e.metadata.rewardBinding!==void 0)return;let f=r.project.trainingSetup,S=f.baseModel??r.project.defaultBaseModel,_=f.method??(e.authoringProvenance.buildIntent==="verifiable_reward"?"grpo":null);if(!f.rewardBindingRef&&(_!=="grpo"||f.recipe||!S?.revision||!S.tokenizerRevision||!S.chatTemplateHash))return;if(x(e)!==t.contentHash)throw new Error("Selected Taskset differs from its immutable content hash.");let M=ne({taskset:e,adapterId:we(e)});return Te({storeDir:a,taskset:e,content:{schemaVersion:"openpond.tasksetPackage.v1",taskset:M.tasksetRelease,environment:M.environmentRelease,verifierSet:M.verifierSetRelease}})}let d=await Pe(a,l);if(d.taskset.id!==(p?.releaseId??t.id)||d.taskset.revision!==(p?.releaseRevision??t.revision))throw new Error("Cached package differs from its selected Taskset revision.");let{files:h,contentHash:u,...y}=d,w=Ie(d,typeof e.metadata.importedPackageHash=="string"),E=await ye({root:be.join(a,"training","tasksets",C(e)),content:y,sources:h.filter(f=>!w.has(f.asset.id)).map(f=>({asset:f.asset,sourcePath:e.tasks.flatMap(S=>S.assets??[]).find(S=>S.id===f.asset.id)?.artifactRef??f.asset.path})),fileOrder:h.map(f=>f.asset.id)});if(E.contentHash!==d.contentHash)throw new Error("Imported package bytes changed before the Reward edit.");return E}m($,"loadModelTasksetPackage");var{package:It,evaluationPackage:yt,...Ce}=de.shape,A=I.object({apiOrigin:I.string().url().refine(o=>new URL(o).origin===o),teamId:I.string().min(1),project:v,localTaskset:N,localEvaluation:N.optional(),evaluationPackageHash:I.string().regex(/^[a-f0-9]{64}$/).optional(),packageHash:I.string().regex(/^[a-f0-9]{64}$/),request:I.object(Ce).strict()}).strict().refine(o=>!!o.localEvaluation==!!o.evaluationPackageHash,"Evaluation bytes and local identity must be captured together.");function U(o,a){let r=o.get("SELECT payload FROM model_project_package_operations WHERE profile_id = ? AND model_id = ? AND state = 'pending'",[a.profileId,a.modelId]),t=r?A.parse(JSON.parse(r.payload)):null;if(t&&(t.apiOrigin!==a.apiOrigin||t.teamId!==a.teamId))throw new Error("Finish the pending package publication in its original API and workspace before changing hosting.");return t}m(U,"pendingModelPackageOperation");function Oe(o,a){let r=A.parse(a);o.exec("BEGIN IMMEDIATE");try{let t=U(o,{profileId:r.project.profileId,modelId:r.project.id,apiOrigin:r.apiOrigin,teamId:r.teamId});if(t)return o.exec("COMMIT"),t;let n=o.get("SELECT payload FROM model_projects WHERE id = ?",[r.project.id]),e=n?v.parse(JSON.parse(n.payload)):null;if(k(e)!==k(r.project))throw new Error("Model changed while its package was being prepared. Retry the push.");let i=o.get("SELECT payload, state FROM model_project_package_operations WHERE operation_id = ?",[r.request.operationId]);if(i){let s=A.parse(JSON.parse(i.payload));if(k({...s,project:r.project})!==k(r))throw new Error("Package operation identity was reused with different publication content.");if(i.state==="committed")return o.exec("COMMIT"),s;o.run("UPDATE model_project_package_operations SET state = 'pending', payload = ? WHERE operation_id = ? AND state = 'rejected'",[JSON.stringify(r),r.request.operationId])}else o.run("INSERT INTO model_project_package_operations (operation_id, profile_id, model_id, api_origin, team_id, state, payload, created_at) VALUES (?, ?, ?, ?, ?, 'pending', ?, ?)",[r.request.operationId,r.project.profileId,r.project.id,r.apiOrigin,r.teamId,JSON.stringify(r),new Date().toISOString()]);return o.exec("COMMIT"),r}catch(t){throw o.exec("ROLLBACK"),t}}m(Oe,"prepareModelPackageOperation");function _e(o,a,r){let t=ce.parse(r),n=o.get("SELECT payload, receipt FROM model_project_package_operations WHERE operation_id = ?",[a]);if(!n)throw new Error("Package push has no durable local intent.");let e=A.parse(JSON.parse(n.payload));if(n.receipt&&k(JSON.parse(n.receipt))!==k(t))throw new Error("Package push retry returned a different receipt.");if(t.operationId!==a||t.teamId!==e.teamId||t.packageHash!==e.packageHash||t.modelProjectId!==e.request.modelProjectId)throw new Error("Package push receipt differs from its local intent.");if(e.evaluationPackageHash&&(!t.evaluation||t.evaluation.packageHash!==e.evaluationPackageHash||k(t.evaluation.taskset)!==k(e.request.modelConfiguration?.trainingSetup.evaluationTasksetRef)))throw new Error("Evaluation package receipt differs from its local intent.");let i=e.project,s=t.project;if(e.request.selection==="select"&&!s)throw new Error("Selected package receipt is missing Model configuration.");if(!s&&!i.hosted)throw new Error("Historical package receipt has no existing hosted Model.");let p=new Date().toISOString(),l=v.parse({...i,hosted:{schemaVersion:"openpond.hostedModelProjectLink.v1",apiOrigin:e.apiOrigin,teamId:e.teamId,projectId:s?.id??i.hosted.projectId,portableProjectId:i.id,revision:s?.revision??i.hosted.revision,etag:t.projectEtag,syncedSourceRevision:e.request.selection==="select"?i.revision:i.hosted.syncedSourceRevision,syncedAt:p,tasksets:[...(i.hosted?.tasksets??[]).filter(d=>d.releaseHash!==t.taskset.contentHash&&d.releaseHash!==t.evaluation?.taskset.contentHash),{localTasksetId:e.localTaskset.id,localTasksetHash:e.localTaskset.contentHash,releaseId:t.taskset.id,releaseRevision:t.taskset.revision,releaseHash:t.taskset.contentHash,packageHash:t.packageHash,hostedTasksetId:t.hostedTasksetId,syncedAt:p},...e.localEvaluation&&t.evaluation?[{localTasksetId:e.localEvaluation.id,localTasksetHash:e.localEvaluation.contentHash,releaseId:t.evaluation.taskset.id,releaseRevision:t.evaluation.taskset.revision,releaseHash:t.evaluation.taskset.contentHash,packageHash:t.evaluation.packageHash,hostedTasksetId:t.evaluation.hostedTasksetId,syncedAt:p}]:[]]},tasksetSyncs:[...i.tasksetSyncs.filter(d=>d.localTasksetId!==e.localTaskset.id&&d.localTasksetId!==e.localEvaluation?.id),{localTasksetId:e.localTaskset.id,releaseId:t.taskset.id,releaseRevision:t.taskset.revision,releaseHash:t.taskset.contentHash,state:"synced",hostedTasksetId:t.hostedTasksetId,lastAttemptAt:p,syncedAt:p,lastError:null},...e.localEvaluation&&t.evaluation?[{localTasksetId:e.localEvaluation.id,releaseId:t.evaluation.taskset.id,releaseRevision:t.evaluation.taskset.revision,releaseHash:t.evaluation.taskset.contentHash,state:"synced",hostedTasksetId:t.evaluation.hostedTasksetId,lastAttemptAt:p,syncedAt:p,lastError:null}]:[]]});return q(o,i,l,!1,()=>{o.run("UPDATE model_project_package_operations SET state = 'committed', receipt = ? WHERE operation_id = ?",[JSON.stringify(t),a])})}m(_e,"completeModelPackageOperation");var He=class extends ue{static{m(this,"SqliteModelConfigurationStore")}async pendingModelPackagePush(a){if(await this.ready,await this.writeQueue,!this.db)throw new Error("Package push store is closed.");return U(this.db,a)}async prepareModelPackagePush(a){await this.ready;let r=this.writeQueue.then(()=>{if(!this.db)throw new Error("Package push store is closed.");return Oe(this.db,a)});return this.writeQueue=r.then(()=>{},()=>{}),r}async completeModelPackagePush(a,r){await this.ready;let t=this.writeQueue.then(()=>{if(!this.db)throw new Error("Package push store is closed.");return _e(this.db,a,r)});return this.writeQueue=t.then(()=>{},()=>{}),t}async rejectModelPackagePush(a){await this.ready;let r=this.writeQueue.then(()=>{if(!this.db)throw new Error("Package push store is closed.");this.db.run("UPDATE model_project_package_operations SET state = 'rejected' WHERE operation_id = ? AND state = 'pending'",[a])});return this.writeQueue=r.then(()=>{},()=>{}),r}async findModelProjectConfigurationSave(a){if(await this.ready,await this.writeQueue,!this.db)throw new Error("Model check failed because the local store is closed.");return J(this.db,a)}async saveModelProjectConfiguration(a){await this.ready;let r=this.writeQueue.then(async()=>{if(!this.db)throw new Error("Model save failed because the local store is closed.");let t=J(this.db,a);if(t)return t;let n=await $(this.db,this.home,a),e=F(this.db,a,!0,n);if(e?.imported)await W({home:this.home,...e.imported});else if(e){let i=qe.join(this.home,"training","tasksets",C(e.source));await Q(this.home,e,e.directoryId,{source:{directory:i,packageHash:await pe(i)},verify:m(s=>ve(s,e.taskset),"verify")}),this.db.run("UPDATE model_project_taskset_preparations SET state = 'materialized' WHERE profile_id = ? AND operation_id = ?",[a.project.profileId,a.operationId])}return ge(this.db,a,e,n?.modelResources?{...n.modelResources,taskset:n.taskset,executionResources:{environment:n.environment,verifierSet:n.verifierSet}}:n)});return this.writeQueue=r.then(()=>{},()=>{}),r}async previewModelProjectTasksetSave(a){if(await this.ready,await this.writeQueue,!this.db)throw new Error("Model check failed because the local store is closed.");return F(this.db,a,!1,await $(this.db,this.home,a))?.taskset??null}async findModelStarterCreation(a){if(await this.ready,await this.writeQueue,!this.db)throw new Error("Starter lookup failed because the local store is closed.");return O(this.db,a)}async saveModelStarterCreation(a){await this.ready;let r=this.writeQueue.then(async()=>{if(!this.db)throw new Error("Starter creation failed because the local store is closed.");let t=O(this.db,a.request);if(t)return t;let n=z(this.db,a),e=j(n);return await Q(this.home,e,e.taskset.id),Ee(this.db,n)});return this.writeQueue=r.then(()=>{},()=>{}),r}async prepareModelStarterCreation(a){if(await this.ready,await this.writeQueue,!this.db)throw new Error("Starter check failed because the local store is closed.");return j(z(this.db,a))}async saveModelProjectHosting(a,r,t=!1,n=[]){await this.ready;let e=this.writeQueue.then(async()=>{if(!this.db)throw new Error("Model synchronization failed because the local store is closed.");if(n.length&&!t)throw new Error("Package import requires an atomic Model replacement.");for(let i of n){if(i.taskset.profileId!==r.profileId)throw new Error("Imported package belongs to another Profile.");i.reuseExisting?await Se(this.home,i.package):await W({home:this.home,...i})}return q(this.db,a,r,t,()=>{for(let i of n)Me(this.db,i)})});return this.writeQueue=e.then(()=>{},()=>{}),e}};export{He as SqliteModelConfigurationStore};
@@ -1,2 +1,2 @@
1
1
  import { createRequire as __openpondCreateRequire } from "node:module"; var require = __openpondCreateRequire(import.meta.url);
2
- import"./chunk-XHACK2KR.js";import{c as D,e as O,f as W}from"./chunk-HKVFU3B3.js";import{a as _}from"./chunk-DWF3FCY4.js";import"./chunk-YDZBX4XQ.js";import{d as C}from"./chunk-AFH462DO.js";import"./chunk-CIZI6Z7D.js";import"./chunk-U7X5ZLAL.js";import{e as B}from"./chunk-SO4GMSNP.js";import{a as z}from"./chunk-KCJVFLBB.js";import"./chunk-HG2YFMVU.js";import"./chunk-OQPJ7FJF.js";import"./chunk-BL3CZWWD.js";import"./chunk-FYWQWKVS.js";import"./chunk-GD3RCUDH.js";import"./chunk-7OKZCJHS.js";import"./chunk-UTIELP6F.js";import"./chunk-7NCM6GBN.js";import"./chunk-4V73I4OL.js";import"./chunk-LE75SVEL.js";import"./chunk-6ESBAHWK.js";import"./chunk-7J2NMUTK.js";import"./chunk-VEBW7NKD.js";import"./chunk-W45RKGM6.js";import"./chunk-AUO5DCEU.js";import"./chunk-Y4I6CFZJ.js";import"./chunk-EDYCSW22.js";import"./chunk-JT5YQ52I.js";import"./chunk-XGY4OQLC.js";import"./chunk-PAYFJHPO.js";import"./chunk-WD4KAKEX.js";import"./chunk-2PXKSAG6.js";import"./chunk-ULTV6INR.js";import"./chunk-WGQ3FMRF.js";import"./chunk-JXLDEYRW.js";import{f as q,h as A}from"./chunk-JVMSN7LH.js";import{z as L}from"./chunk-YI6ME6PU.js";import"./chunk-DRLP7GIU.js";import{Fa as u,ga as b,ja as H,wa as x}from"./chunk-BU6MW65V.js";import"./chunk-LVXL7T5O.js";import"./chunk-HIQPGYVH.js";import{I as T,J as I,O as y}from"./chunk-DXJC3QW7.js";import"./chunk-P4QM63L3.js";import"./chunk-MTP3B2SU.js";import"./chunk-AMC4Z7G4.js";import"./chunk-LK77GI6M.js";import"./chunk-HVM2GUM3.js";import"./chunk-I6VMRQF4.js";import"./chunk-D6L6UNUQ.js";import"./chunk-AJXWJLZA.js";import"./chunk-OKKNDQJF.js";import{L as w,Q as E,S}from"./chunk-4PUOWSDE.js";import{Ra as R,Wa as M}from"./chunk-ZY32SZ2P.js";import"./chunk-OTDDXEQ6.js";import"./chunk-ECOH24MC.js";import"./chunk-KUE46HTH.js";import"./chunk-6FA3GG5B.js";import"./chunk-2MEOUS24.js";import"./chunk-HNQPEOJD.js";import{n as c}from"./chunk-RCT3O3HQ.js";import"./chunk-ZFJWA4JK.js";import{A as s}from"./chunk-X2J2P5ZT.js";import{a as h}from"./chunk-FTQLQJQV.js";var F=s.string().trim().min(1).max(500),P=s.string().regex(/^[a-f0-9]{64}$/),f=s.object({schemaVersion:s.literal("openpond.localModelProjectPreparationInput.v1"),source:s.object({ownerId:F,datasetId:F,revision:s.number().int().positive(),workspaceHash:P,packageHash:P}).strict(),project:T,rewardBinding:M,rewards:s.array(R).min(1).max(100),assets:s.array(E).max(100)}).strict(),N=s.object({schemaVersion:s.literal("openpond.localModelProjectPreparation.v1"),request:f,package:b,taskset:x,saveRequest:I,contentHash:P}).strict();async function Q(p){let e=f.parse(p.request),r=H(p.source);if(r.contentHash!==e.source.packageHash)throw new Error("Dataset package changed since preparation was requested.");if(e.project.trainingSetup.tasksetRef||e.project.trainingSetup.tasksetRelease||e.project.trainingSetup.evaluationTasksetRef||e.project.trainingSetup.rewardBindingRef||e.project.trainingSetup.harnessRelease)throw new Error("Preparation selects its Taskset and Reward from the pinned source; omit preselected Taskset, Reward and Harness references.");if(!e.project.trainingSetup.recipe||!e.project.trainingSetup.baseModel)throw new Error("Preparation requires an explicit pinned base model and complete recipe.");let a=e.project.trainingSetup.baseModel,o=e.project.trainingSetup.recipe,i=o.baseModel;if(!a.revision||!a.tokenizerRevision||!a.chatTemplateHash||!i||i.id!==a.modelId||i.revision!==a.revision||i.tokenizerRevision!==a.tokenizerRevision||i.chatTemplateHash!==a.chatTemplateHash||o.method!==e.project.trainingSetup.method)throw new Error("Project and recipe must select the same pinned base model and training method.");if(!r.taskset.tasks.some(t=>t.split==="train")||!r.taskset.tasks.some(t=>t.split==="validation"||t.split==="frozen_eval"))throw new Error("Preparation requires existing training and held-out validation tasks; it never changes splits.");let n=new Set(e.rewardBinding.sources.map(t=>c(t.reward)));if(new Set(e.rewards.map(t=>c(w(t)))).size!==e.rewards.length||e.rewards.some(t=>!n.has(c(w(t)))))throw new Error("Preparation Reward closure contains unexpected or duplicate releases.");let l=e.rewards.flatMap(t=>[...t.assets,..."verifierRef"in t.implementation?[t.implementation.verifierRef]:[],..."rubricRef"in t.implementation?[t.implementation.rubricRef]:[],..."inputContract"in t.implementation?[t.implementation.inputContract]:[]]),G=new Set(l.map(t=>t.id));if(new Set(e.assets.map(t=>t.id)).size!==e.assets.length||e.assets.some(t=>!G.has(t.id)))throw new Error("Preparation Reward closure contains unexpected or duplicate assets.");for(let t of l){let d=e.assets.find(K=>K.id===t.id);if(!d||t.visibility!=="verifier")throw new Error("Preparation requires its exact private verifier asset closure.");S(d,t)}for(let t of["training","evaluation"])if(!e.rewardBinding.sources.some(d=>d.role===t&&d.weight>0))throw new Error(`Preparation requires a positively weighted ${t} Reward source.`);let k=A({owner:{scopeId:e.project.profileId,modelId:e.project.id},source:r,rewardBinding:e.rewardBinding,rewards:e.rewards,assets:e.assets}),g=k.modelResources.assets.filter(t=>e.assets.some(d=>d.id===t.id));if(new Set(g.map(t=>t.asset.path)).size!==g.length||g.some(t=>t.asset.visibility!=="verifier"))throw new Error("Preparation requires distinct private verifier paths with verifier visibility.");let m=u({package:k,profileId:e.project.profileId,name:p.name,createdAt:p.createdAt});m.taskset=_(m.taskset,p.reviewedTaskset,r);let j=w(m.taskset),J=await y({...e.project,trainingSetup:{...e.project.trainingSetup,tasksetRef:j,evaluationTasksetRef:m.taskset.tasks.some(t=>t.split==="validation"||t.split==="frozen_eval")?j:null,rewardBindingRef:w(e.rewardBinding)}},0),v={schemaVersion:"openpond.localModelProjectPreparation.v1",request:e,package:k,taskset:m.taskset,saveRequest:J};return N.parse({...v,contentHash:c(v)})}h(Q,"prepareLocalModelProject");function V(p){let e=N.parse(p),{contentHash:r,...a}=e;if(c(a)!==r)throw new Error("Project preparation receipt content hash changed.");return e}h(V,"parseLocalModelProjectPreparation");var $=class extends z{static{h(this,"SqliteModelProjectPreparationStore")}async compile(e){let r=this.database.get("SELECT id FROM local_resource_owner WHERE singleton=1",[]),a=this.database.get("SELECT r.payload FROM local_dataset_versions w JOIN local_dataset_records r ON r.record_hash=w.record_hash WHERE w.id=? AND w.revision=?",[e.source.datasetId,e.source.revision]);if(!a||!r||r.id!==e.source.ownerId)throw new Error("Dataset is unavailable on the selected local owner.");let o=B(this.database,a.payload);if(o.ownerId!==r.id||o.workspace.contentHash!==e.source.workspaceHash)throw new Error("Dataset owner or workspace changed since preparation was requested.");let i=q({workspace:o.workspace,preparation:null,adapterId:"openpond-desktop-taskset-authoring-v1",now:o.workspace.draft.updatedAt}),n=L({draft:{...o.workspace.draft,profileId:e.project.profileId},now:o.workspace.draft.updatedAt});return Q({request:e,source:i,reviewedTaskset:n,createdAt:o.workspace.draft.updatedAt,name:o.workspace.draft.name})}async prepareLocalModelProject(e){let r=f.parse(e);await this.ready;let a=this.writeQueue.then(async()=>{if(this.database.get("SELECT id FROM model_projects WHERE id=?",[r.project.id]))throw new Error("Model Project already exists; preparation only creates a distinct Model.");return this.compile(r)});return this.writeQueue=a.then(()=>{},()=>{}),a}async applyLocalModelProjectPreparation(e){let r=V(e);await this.ready;let a=this.writeQueue.then(async()=>{let o=await this.compile(r.request);if(c(o)!==c(r))throw new Error("Project preparation differs from the exact source, Reward closure or recipe. Prepare and review it again.");let i=D(this.database,r.saveRequest);if(i)return{project:i,taskset:r.taskset,packageHash:r.package.contentHash,preparationHash:r.contentHash};if(this.database.get("SELECT id FROM model_projects WHERE id=?",[r.request.project.id]))throw new Error("Model Project already exists with a different preparation.");let n=u({package:r.package,profileId:r.request.project.profileId,name:r.taskset.name,createdAt:r.taskset.createdAt});n.taskset=o.taskset,await C({home:this.home,...n}),this.database.exec("BEGIN IMMEDIATE");try{W(this.database,n);let l=O(this.database,r.saveRequest,null,r.package);return this.database.exec("COMMIT"),{project:l,taskset:n.taskset,packageHash:n.package.contentHash,preparationHash:r.contentHash}}catch(l){throw this.database.exec("ROLLBACK"),l}});return this.writeQueue=a.then(()=>{},()=>{}),a}};export{$ as SqliteModelProjectPreparationStore};
2
+ import"./chunk-XHACK2KR.js";import{c as D,e as O,f as W}from"./chunk-5FSPDSAO.js";import{a as _}from"./chunk-DWF3FCY4.js";import"./chunk-YAA7F5LI.js";import{d as C}from"./chunk-AFH462DO.js";import"./chunk-CIZI6Z7D.js";import"./chunk-U7X5ZLAL.js";import{e as B}from"./chunk-SO4GMSNP.js";import{a as z}from"./chunk-KCJVFLBB.js";import"./chunk-HG2YFMVU.js";import"./chunk-OQPJ7FJF.js";import"./chunk-BL3CZWWD.js";import"./chunk-FYWQWKVS.js";import"./chunk-GD3RCUDH.js";import"./chunk-7OKZCJHS.js";import"./chunk-UTIELP6F.js";import"./chunk-7NCM6GBN.js";import"./chunk-4V73I4OL.js";import"./chunk-LE75SVEL.js";import"./chunk-6ESBAHWK.js";import"./chunk-7J2NMUTK.js";import"./chunk-VEBW7NKD.js";import"./chunk-W45RKGM6.js";import"./chunk-AUO5DCEU.js";import"./chunk-Y4I6CFZJ.js";import"./chunk-EDYCSW22.js";import"./chunk-JT5YQ52I.js";import"./chunk-XGY4OQLC.js";import"./chunk-PAYFJHPO.js";import"./chunk-WD4KAKEX.js";import"./chunk-2PXKSAG6.js";import"./chunk-ULTV6INR.js";import"./chunk-WGQ3FMRF.js";import"./chunk-JXLDEYRW.js";import{f as q,h as A}from"./chunk-JVMSN7LH.js";import{z as L}from"./chunk-YI6ME6PU.js";import"./chunk-DRLP7GIU.js";import{Fa as u,ga as b,ja as H,wa as x}from"./chunk-BU6MW65V.js";import"./chunk-LVXL7T5O.js";import"./chunk-HIQPGYVH.js";import{I as T,J as I,O as y}from"./chunk-DXJC3QW7.js";import"./chunk-P4QM63L3.js";import"./chunk-MTP3B2SU.js";import"./chunk-AMC4Z7G4.js";import"./chunk-LK77GI6M.js";import"./chunk-HVM2GUM3.js";import"./chunk-I6VMRQF4.js";import"./chunk-D6L6UNUQ.js";import"./chunk-AJXWJLZA.js";import"./chunk-OKKNDQJF.js";import{L as w,Q as E,S}from"./chunk-4PUOWSDE.js";import{Ra as R,Wa as M}from"./chunk-ZY32SZ2P.js";import"./chunk-OTDDXEQ6.js";import"./chunk-ECOH24MC.js";import"./chunk-KUE46HTH.js";import"./chunk-6FA3GG5B.js";import"./chunk-2MEOUS24.js";import"./chunk-HNQPEOJD.js";import{n as c}from"./chunk-RCT3O3HQ.js";import"./chunk-ZFJWA4JK.js";import{A as s}from"./chunk-X2J2P5ZT.js";import{a as h}from"./chunk-FTQLQJQV.js";var F=s.string().trim().min(1).max(500),P=s.string().regex(/^[a-f0-9]{64}$/),f=s.object({schemaVersion:s.literal("openpond.localModelProjectPreparationInput.v1"),source:s.object({ownerId:F,datasetId:F,revision:s.number().int().positive(),workspaceHash:P,packageHash:P}).strict(),project:T,rewardBinding:M,rewards:s.array(R).min(1).max(100),assets:s.array(E).max(100)}).strict(),N=s.object({schemaVersion:s.literal("openpond.localModelProjectPreparation.v1"),request:f,package:b,taskset:x,saveRequest:I,contentHash:P}).strict();async function Q(p){let e=f.parse(p.request),r=H(p.source);if(r.contentHash!==e.source.packageHash)throw new Error("Dataset package changed since preparation was requested.");if(e.project.trainingSetup.tasksetRef||e.project.trainingSetup.tasksetRelease||e.project.trainingSetup.evaluationTasksetRef||e.project.trainingSetup.rewardBindingRef||e.project.trainingSetup.harnessRelease)throw new Error("Preparation selects its Taskset and Reward from the pinned source; omit preselected Taskset, Reward and Harness references.");if(!e.project.trainingSetup.recipe||!e.project.trainingSetup.baseModel)throw new Error("Preparation requires an explicit pinned base model and complete recipe.");let a=e.project.trainingSetup.baseModel,o=e.project.trainingSetup.recipe,i=o.baseModel;if(!a.revision||!a.tokenizerRevision||!a.chatTemplateHash||!i||i.id!==a.modelId||i.revision!==a.revision||i.tokenizerRevision!==a.tokenizerRevision||i.chatTemplateHash!==a.chatTemplateHash||o.method!==e.project.trainingSetup.method)throw new Error("Project and recipe must select the same pinned base model and training method.");if(!r.taskset.tasks.some(t=>t.split==="train")||!r.taskset.tasks.some(t=>t.split==="validation"||t.split==="frozen_eval"))throw new Error("Preparation requires existing training and held-out validation tasks; it never changes splits.");let n=new Set(e.rewardBinding.sources.map(t=>c(t.reward)));if(new Set(e.rewards.map(t=>c(w(t)))).size!==e.rewards.length||e.rewards.some(t=>!n.has(c(w(t)))))throw new Error("Preparation Reward closure contains unexpected or duplicate releases.");let l=e.rewards.flatMap(t=>[...t.assets,..."verifierRef"in t.implementation?[t.implementation.verifierRef]:[],..."rubricRef"in t.implementation?[t.implementation.rubricRef]:[],..."inputContract"in t.implementation?[t.implementation.inputContract]:[]]),G=new Set(l.map(t=>t.id));if(new Set(e.assets.map(t=>t.id)).size!==e.assets.length||e.assets.some(t=>!G.has(t.id)))throw new Error("Preparation Reward closure contains unexpected or duplicate assets.");for(let t of l){let d=e.assets.find(K=>K.id===t.id);if(!d||t.visibility!=="verifier")throw new Error("Preparation requires its exact private verifier asset closure.");S(d,t)}for(let t of["training","evaluation"])if(!e.rewardBinding.sources.some(d=>d.role===t&&d.weight>0))throw new Error(`Preparation requires a positively weighted ${t} Reward source.`);let k=A({owner:{scopeId:e.project.profileId,modelId:e.project.id},source:r,rewardBinding:e.rewardBinding,rewards:e.rewards,assets:e.assets}),g=k.modelResources.assets.filter(t=>e.assets.some(d=>d.id===t.id));if(new Set(g.map(t=>t.asset.path)).size!==g.length||g.some(t=>t.asset.visibility!=="verifier"))throw new Error("Preparation requires distinct private verifier paths with verifier visibility.");let m=u({package:k,profileId:e.project.profileId,name:p.name,createdAt:p.createdAt});m.taskset=_(m.taskset,p.reviewedTaskset,r);let j=w(m.taskset),J=await y({...e.project,trainingSetup:{...e.project.trainingSetup,tasksetRef:j,evaluationTasksetRef:m.taskset.tasks.some(t=>t.split==="validation"||t.split==="frozen_eval")?j:null,rewardBindingRef:w(e.rewardBinding)}},0),v={schemaVersion:"openpond.localModelProjectPreparation.v1",request:e,package:k,taskset:m.taskset,saveRequest:J};return N.parse({...v,contentHash:c(v)})}h(Q,"prepareLocalModelProject");function V(p){let e=N.parse(p),{contentHash:r,...a}=e;if(c(a)!==r)throw new Error("Project preparation receipt content hash changed.");return e}h(V,"parseLocalModelProjectPreparation");var $=class extends z{static{h(this,"SqliteModelProjectPreparationStore")}async compile(e){let r=this.database.get("SELECT id FROM local_resource_owner WHERE singleton=1",[]),a=this.database.get("SELECT r.payload FROM local_dataset_versions w JOIN local_dataset_records r ON r.record_hash=w.record_hash WHERE w.id=? AND w.revision=?",[e.source.datasetId,e.source.revision]);if(!a||!r||r.id!==e.source.ownerId)throw new Error("Dataset is unavailable on the selected local owner.");let o=B(this.database,a.payload);if(o.ownerId!==r.id||o.workspace.contentHash!==e.source.workspaceHash)throw new Error("Dataset owner or workspace changed since preparation was requested.");let i=q({workspace:o.workspace,preparation:null,adapterId:"openpond-desktop-taskset-authoring-v1",now:o.workspace.draft.updatedAt}),n=L({draft:{...o.workspace.draft,profileId:e.project.profileId},now:o.workspace.draft.updatedAt});return Q({request:e,source:i,reviewedTaskset:n,createdAt:o.workspace.draft.updatedAt,name:o.workspace.draft.name})}async prepareLocalModelProject(e){let r=f.parse(e);await this.ready;let a=this.writeQueue.then(async()=>{if(this.database.get("SELECT id FROM model_projects WHERE id=?",[r.project.id]))throw new Error("Model Project already exists; preparation only creates a distinct Model.");return this.compile(r)});return this.writeQueue=a.then(()=>{},()=>{}),a}async applyLocalModelProjectPreparation(e){let r=V(e);await this.ready;let a=this.writeQueue.then(async()=>{let o=await this.compile(r.request);if(c(o)!==c(r))throw new Error("Project preparation differs from the exact source, Reward closure or recipe. Prepare and review it again.");let i=D(this.database,r.saveRequest);if(i)return{project:i,taskset:r.taskset,packageHash:r.package.contentHash,preparationHash:r.contentHash};if(this.database.get("SELECT id FROM model_projects WHERE id=?",[r.request.project.id]))throw new Error("Model Project already exists with a different preparation.");let n=u({package:r.package,profileId:r.request.project.profileId,name:r.taskset.name,createdAt:r.taskset.createdAt});n.taskset=o.taskset,await C({home:this.home,...n}),this.database.exec("BEGIN IMMEDIATE");try{W(this.database,n);let l=O(this.database,r.saveRequest,null,r.package);return this.database.exec("COMMIT"),{project:l,taskset:n.taskset,packageHash:n.package.contentHash,preparationHash:r.contentHash}}catch(l){throw this.database.exec("ROLLBACK"),l}});return this.writeQueue=a.then(()=>{},()=>{}),a}};export{$ as SqliteModelProjectPreparationStore};