@inkeep/open-knowledge 0.50.0-beta.5 → 0.50.0-beta.6

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 (440) hide show
  1. package/dist/{acp-harness-probe-C67QIRhp.mjs → acp-harness-probe-PEHo_hYG.mjs} +2 -2
  2. package/dist/cli.mjs +7 -7
  3. package/dist/constants-D9HRzNQG.mjs +2 -0
  4. package/dist/git-handle-B24ZRv9k.mjs +1 -0
  5. package/dist/{git-handle-oaKkz-wn.mjs → git-handle-D48CPnbp.mjs} +2 -2
  6. package/dist/index.d.mts +18 -18
  7. package/dist/index.mjs +67 -67
  8. package/dist/{init-DU6p7L9F.mjs → init-BJCusUuy.mjs} +3 -3
  9. package/dist/init-zePCt6tf.mjs +1 -0
  10. package/dist/{launch-json-removal-CZL2haTE.mjs → launch-json-removal-BXFgQzfH.mjs} +2 -2
  11. package/dist/loader-DDNAwcPM.mjs +1 -0
  12. package/dist/{loader-D0Y-7GtO.mjs → loader-DbPx77mt.mjs} +2 -2
  13. package/dist/md-manager-DLcJdRDn.mjs +2 -0
  14. package/dist/{open-browser-S-UcIs_h.mjs → open-browser-DITljs8e.mjs} +2 -2
  15. package/dist/parse-worker.mjs +1 -1
  16. package/dist/preview-AsssSL6s.mjs +1 -0
  17. package/dist/{preview-BPAu6Ln2.mjs → preview-DXyVMz8b.mjs} +2 -2
  18. package/dist/public/assets/{ActivityModeContent-oK0Ukipq.js → ActivityModeContent-c7Ng5dOt.js} +1 -1
  19. package/dist/public/assets/{AgentDiffPane-c-eXlgET.js → AgentDiffPane-CdvdlrTA.js} +2 -2
  20. package/dist/public/assets/{AgentThreadClientBinder-BjgVrGGG.js → AgentThreadClientBinder-CvHvukLZ.js} +1 -1
  21. package/dist/public/assets/{AppMenubar-Dk1BEmD9.js → AppMenubar-DzKyqu4x.js} +1 -1
  22. package/dist/public/assets/{BugReportHistory-CRlvJE2K.js → BugReportHistory-BJFLBqUw.js} +1 -1
  23. package/dist/public/assets/{BugReportHistoryDialog-DIqnZXkT.js → BugReportHistoryDialog-y4fa4pzg.js} +1 -1
  24. package/dist/public/assets/{ChangedOutsideBadge-Tm9eQzQd.js → ChangedOutsideBadge-Bu8uPTJS.js} +1 -1
  25. package/dist/public/assets/CodeMirrorPropInput-fWbdlCkS.js +3 -0
  26. package/dist/public/assets/{ConfigSharingInfoTooltip-BNI3Q3Qo.js → ConfigSharingInfoTooltip-BPA8HEYl.js} +1 -1
  27. package/dist/public/assets/{ConsentDialogBody-BlayjFQq.js → ConsentDialogBody-KXeO_ZFL.js} +1 -1
  28. package/dist/public/assets/{CopyButton-Q-6hSzy6.js → CopyButton-DhHoiQJR.js} +1 -1
  29. package/dist/public/assets/{DiffView-BnNY_4OT.js → DiffView-BjOsi4GM.js} +1 -1
  30. package/dist/public/assets/{DocumentContext-BZs9wGsy.js → DocumentContext-sNpqhUlI.js} +11 -11
  31. package/dist/public/assets/{EditorModeToggle-Dx-H0DAT.js → EditorModeToggle-D4871FSZ.js} +1 -1
  32. package/dist/public/assets/{EnableSyncConfirmDialog-Djkj66_G.js → EnableSyncConfirmDialog-cBuI6coM.js} +1 -1
  33. package/dist/public/assets/FeedbackForm-BFd0ubqI.js +1 -0
  34. package/dist/public/assets/{GraphPanel-5y13eIH-.js → GraphPanel-CAMYjjtr.js} +2 -2
  35. package/dist/public/assets/{ImportSkillDialog-BpbNmo53.js → ImportSkillDialog-BepHDHz6.js} +1 -1
  36. package/dist/public/assets/{LintConfigEditor-B8UqIDri.js → LintConfigEditor-DRA7zDJD.js} +1 -1
  37. package/dist/public/assets/ManagedArtifactProperties-CLh5T0qS.js +2 -0
  38. package/dist/public/assets/ManagedArtifactProperties-Ct_XfVJo.js +1 -0
  39. package/dist/public/assets/{McpConsentDialogBody-DmSeUtFh.js → McpConsentDialogBody-ONRUf-u9.js} +1 -1
  40. package/dist/public/assets/{Mermaid-cUFqNhzC.js → Mermaid-D-pcyGRV.js} +2 -2
  41. package/dist/public/assets/{MermaidDocEditor-yGV5TYvo.js → MermaidDocEditor-DC95RR-G.js} +1 -1
  42. package/dist/public/assets/{RegisteredAgentIcon-CCgDsAUc.js → RegisteredAgentIcon-BgDInKA9.js} +1 -1
  43. package/dist/public/assets/{ReportBugDialogBody-B0bj47YU.js → ReportBugDialogBody-7VaenClj.js} +1 -1
  44. package/dist/public/assets/{SchemaConfigEditor-OWVRrCyd.js → SchemaConfigEditor-B2VRQNhY.js} +1 -1
  45. package/dist/public/assets/SessionsHost-CJM2wXx0.js +2 -0
  46. package/dist/public/assets/SettingsDialogBody-LwuRFjnU.js +12 -0
  47. package/dist/public/assets/{ShareBranchSwitchDialog-295DE9n_.js → ShareBranchSwitchDialog-DD7xybfa.js} +1 -1
  48. package/dist/public/assets/{ShareReceiveDialog-BbOB46ar.js → ShareReceiveDialog-Bz3zpKKF.js} +1 -1
  49. package/dist/public/assets/{ShareReceiveMissDialog-iz73ffK2.js → ShareReceiveMissDialog-DqXylco3.js} +1 -1
  50. package/dist/public/assets/{SkillEditBanner-C0motCdk.js → SkillEditBanner-BwzPIxd8.js} +1 -1
  51. package/dist/public/assets/{SkillOriginInline-BKp-kWXv.js → SkillOriginInline-BFCXo8sI.js} +1 -1
  52. package/dist/public/assets/SkillToolbarControls-DF0m8f6g.js +1 -0
  53. package/dist/public/assets/{SlidesToolbarControls-CD_n21A3.js → SlidesToolbarControls-DJXDoZdd.js} +1 -1
  54. package/dist/public/assets/SourceEditor-CBToWgb8.js +1 -0
  55. package/dist/public/assets/{TerminalPanel-CLfRiG4p.js → TerminalPanel-BlK8X0ar.js} +2 -2
  56. package/dist/public/assets/{TerminalWindowApp-B2TPEGtR.js → TerminalWindowApp-Cy9Ov0_z.js} +1 -1
  57. package/dist/public/assets/{TextDocEditor-DmN6Zt5R.js → TextDocEditor-D3Hjb2Vu.js} +1 -1
  58. package/dist/public/assets/{ThreadView-Cn6Viupp.js → ThreadView-YWeuTsL5.js} +3 -3
  59. package/dist/public/assets/{TimelineDiffPane-DzMaO_MM.js → TimelineDiffPane-CGiWI4cl.js} +2 -2
  60. package/dist/public/assets/{abnfDiagram-VRR7QNED-zrdnvCxH.js → abnfDiagram-VRR7QNED-CQ5y3jGZ.js} +1 -1
  61. package/dist/public/assets/{agent-diff-store-CBfJPWXq.js → agent-diff-store-CEeOURzl.js} +1 -1
  62. package/dist/public/assets/{arc-DNWUH4a1.js → arc-DllfmQO6.js} +1 -1
  63. package/dist/public/assets/architecture-TIHT7OUA-CIR5HZsg.js +1 -0
  64. package/dist/public/assets/{architectureDiagram-ZJ3FMSHR-C8Bd5LWV.js → architectureDiagram-ZJ3FMSHR-DEDVgPeV.js} +1 -1
  65. package/dist/public/assets/arrow-up-right-D_WN0VGP.js +1 -0
  66. package/dist/public/assets/{auth-state-cache-DBVfH7MV.js → auth-state-cache-kFk2nWdi.js} +4 -4
  67. package/dist/public/assets/{blockDiagram-677ZJIJ3-B9IYmQZQ.js → blockDiagram-677ZJIJ3-Biovo5Vk.js} +1 -1
  68. package/dist/public/assets/{braces-54VO1tdr.js → braces-B2tgJ4cu.js} +1 -1
  69. package/dist/public/assets/{c4Diagram-LMCZKHZV-BAmqGVbu.js → c4Diagram-LMCZKHZV-BUMbkcfU.js} +1 -1
  70. package/dist/public/assets/{calendar-BhCmsdcp.js → calendar-q3K0fDI1.js} +1 -1
  71. package/dist/public/assets/{case-sensitive-BpYLDHFG.js → case-sensitive-Cz58rAyi.js} +1 -1
  72. package/dist/public/assets/channel-C6KgPQqg.js +1 -0
  73. package/dist/public/assets/check-xiKupoJh.js +1 -0
  74. package/dist/public/assets/{checkbox-gpfWb1pY.js → checkbox-DxTkAw0k.js} +1 -1
  75. package/dist/public/assets/{chevron-down-Ccgt58N5.js → chevron-down-DmoBYxyq.js} +1 -1
  76. package/dist/public/assets/chevron-left-CiNweXA3.js +1 -0
  77. package/dist/public/assets/chevron-right-DJvandMc.js +1 -0
  78. package/dist/public/assets/{chevron-up-DXAtCwKR.js → chevron-up-eNJS5_XA.js} +1 -1
  79. package/dist/public/assets/chunk-2Q5K7J3B-CgG_zTm9.js +1 -0
  80. package/dist/public/assets/{chunk-32BRIVSS-DMLdlgjI.js → chunk-32BRIVSS-CJfLw0io.js} +1 -1
  81. package/dist/public/assets/{chunk-52WLFC77-CA6wNZGK.js → chunk-52WLFC77-CKUXR-Lo.js} +1 -1
  82. package/dist/public/assets/{chunk-5FCAYU7R-DqJZ_M2Z.js → chunk-5FCAYU7R-Blhoqerk.js} +1 -1
  83. package/dist/public/assets/{chunk-5HE753X5-xEmSuz1X.js → chunk-5HE753X5-Be3l52OO.js} +1 -1
  84. package/dist/public/assets/{chunk-5JV3BV7I-Ck8lDs_Z.js → chunk-5JV3BV7I-COJRGdXn.js} +1 -1
  85. package/dist/public/assets/{chunk-5TONJI2A-PrC_RJYQ.js → chunk-5TONJI2A-6Fwn-ZXg.js} +1 -1
  86. package/dist/public/assets/{chunk-5VM5RSS4-uHW5nKzV.js → chunk-5VM5RSS4-CBB7ddJZ.js} +1 -1
  87. package/dist/public/assets/{chunk-7BUUIJ7U-QsQRXodN.js → chunk-7BUUIJ7U-BCqa-5nq.js} +1 -1
  88. package/dist/public/assets/{chunk-BIQX33UG-Bn3R7PMg.js → chunk-BIQX33UG-DzD4i2B0.js} +1 -1
  89. package/dist/public/assets/{chunk-BO2N2NFS-XrP3H1kD.js → chunk-BO2N2NFS-KCTBsTca.js} +3 -3
  90. package/dist/public/assets/{chunk-C7G6YPKG-Cyi6lMg0.js → chunk-C7G6YPKG-DxT1wdEz.js} +1 -1
  91. package/dist/public/assets/{chunk-CQNSW5MT-DcGjpkNq.js → chunk-CQNSW5MT-DFeH5OJq.js} +1 -1
  92. package/dist/public/assets/{chunk-CYSBUYHQ-DtqK9e9B.js → chunk-CYSBUYHQ-BnJMwkKI.js} +1 -1
  93. package/dist/public/assets/{chunk-EMLP6XTP-CwGsiDUi.js → chunk-EMLP6XTP-MSvlJ735.js} +1 -1
  94. package/dist/public/assets/{chunk-EX3LRPZG-DLPjvnJt.js → chunk-EX3LRPZG-DUzsTxw6.js} +1 -1
  95. package/dist/public/assets/{chunk-FWX5IMBZ-Dl1Yx5lK.js → chunk-FWX5IMBZ-D3EMolHi.js} +2 -2
  96. package/dist/public/assets/{chunk-HOUHSVGY-DV13h0Pr.js → chunk-HOUHSVGY-CA499J_e.js} +1 -1
  97. package/dist/public/assets/{chunk-ICXQ74PX-INpeR2_Y.js → chunk-ICXQ74PX-CNLojPkU.js} +1 -1
  98. package/dist/public/assets/{chunk-JG7HCLWE-DjqF4wz1.js → chunk-JG7HCLWE-BjvLoZ4O.js} +1 -1
  99. package/dist/public/assets/{chunk-JWPE2WC7-ChNUGWh8.js → chunk-JWPE2WC7-DKo0ygBr.js} +1 -1
  100. package/dist/public/assets/{chunk-MOJQB5TN-DYAyc4PI.js → chunk-MOJQB5TN-hxtcpfx_.js} +1 -1
  101. package/dist/public/assets/{chunk-MOZMSUNE-DAoBuwD4.js → chunk-MOZMSUNE-DQOK9LgW.js} +1 -1
  102. package/dist/public/assets/{chunk-OGEWGWER-_vqBGeRc.js → chunk-OGEWGWER-DmUP6YIh.js} +1 -1
  103. package/dist/public/assets/{chunk-OSBZ3O6U-SeZvOun8.js → chunk-OSBZ3O6U-D1WpsIpR.js} +1 -1
  104. package/dist/public/assets/{chunk-PUDLZKDR-C184t24_.js → chunk-PUDLZKDR-CQKVQESS.js} +1 -1
  105. package/dist/public/assets/{chunk-Q4XR5HBZ-SaCK9erE.js → chunk-Q4XR5HBZ-CChmYrK9.js} +1 -1
  106. package/dist/public/assets/{chunk-QBLGF6JB-CJVMUUtn.js → chunk-QBLGF6JB-CgndLuEz.js} +1 -1
  107. package/dist/public/assets/{chunk-R7FJI6CG-q21e0CIM.js → chunk-R7FJI6CG-DCv2sUq2.js} +1 -1
  108. package/dist/public/assets/{chunk-RYQCIY6F-nQAz-0yS.js → chunk-RYQCIY6F-AIaldrY4.js} +1 -1
  109. package/dist/public/assets/{chunk-U6XO7XAA-hembI7o8.js → chunk-U6XO7XAA-CxMMdww-.js} +1 -1
  110. package/dist/public/assets/{chunk-V7JOEXUC-3RMXHrzo.js → chunk-V7JOEXUC-CXy9SmJk.js} +1 -1
  111. package/dist/public/assets/chunk-VAUOI2AC-ujVxk4Ze.js +1 -0
  112. package/dist/public/assets/{chunk-VR4S4FIN-YHQiPjFo.js → chunk-VR4S4FIN-KG7H_g4c.js} +1 -1
  113. package/dist/public/assets/{chunk-WYO6CB5R-tHLnBMnY.js → chunk-WYO6CB5R-B368j75q.js} +1 -1
  114. package/dist/public/assets/chunk-XXDRQBXY-B7w13F3i.js +1 -0
  115. package/dist/public/assets/{chunk-YOTPTUD7-u4FR_PoG.js → chunk-YOTPTUD7-Cqb1OWoI.js} +1 -1
  116. package/dist/public/assets/{chunk-ZGVPDNZ5-BFUSTZTU.js → chunk-ZGVPDNZ5-BKdDRJat.js} +1 -1
  117. package/dist/public/assets/{chunk-ZIRB5QZD-D120inkG.js → chunk-ZIRB5QZD-CvXXd6Mf.js} +1 -1
  118. package/dist/public/assets/classDiagram-OUVF2IWQ-CrrbWSrl.js +1 -0
  119. package/dist/public/assets/classDiagram-v2-EOCWNBFH-BYbi6pvW.js +1 -0
  120. package/dist/public/assets/client-version-B0MkkJjB.js +1 -0
  121. package/dist/public/assets/{cm-theme-DPWSzbOc.js → cm-theme-ChFGbVCe.js} +1 -1
  122. package/dist/public/assets/{comment-chips-DYqcIz_E.js → comment-chips-CmSdX8nJ.js} +1 -1
  123. package/dist/public/assets/{config-provider-DAxeLK4k.js → config-provider-BkvKKK43.js} +3 -3
  124. package/dist/public/assets/context-menu-CYgsnEgV.js +1 -0
  125. package/dist/public/assets/{cose-bilkent-JH36ORCC-D0CYnCA3.js → cose-bilkent-JH36ORCC-CwtkHR1Y.js} +1 -1
  126. package/dist/public/assets/cynefin-VYW2F7L2-BdPtv88z.js +1 -0
  127. package/dist/public/assets/{cynefinDiagram-TSTJHNR4-Bgric3JJ.js → cynefinDiagram-TSTJHNR4-LsplRO2K.js} +1 -1
  128. package/dist/public/assets/{dagre-uJOGPMM-.js → dagre-C6VKrNvO.js} +1 -1
  129. package/dist/public/assets/{dagre-VKFMJZFB-BXjUnJMs.js → dagre-VKFMJZFB-DhzjgRUZ.js} +1 -1
  130. package/dist/public/assets/{diagram-FQU43EPY-dXOWFjMG.js → diagram-FQU43EPY-a4jh9ybB.js} +1 -1
  131. package/dist/public/assets/{diagram-G47NLZAW-zdJG9pHl.js → diagram-G47NLZAW-Jgkwuc6y.js} +1 -1
  132. package/dist/public/assets/{diagram-NH7WQ7WH-BVYbs_C0.js → diagram-NH7WQ7WH-Cz1HEitz.js} +1 -1
  133. package/dist/public/assets/{diagram-OA4YK3LP-Ds5ohbs1.js → diagram-OA4YK3LP-CIcVtjXP.js} +1 -1
  134. package/dist/public/assets/{diagram-WEI45ONY-BluqqbZ4.js → diagram-WEI45ONY-C8wU887b.js} +1 -1
  135. package/dist/public/assets/{dialog-O4u6_xiQ.js → dialog-Bxcn1sLm.js} +1 -1
  136. package/dist/public/assets/{dist-C1TyNsxp.js → dist-BOhFaMG0.js} +1 -1
  137. package/dist/public/assets/{dist-tByLfm_n.js → dist-Bb1r1o6u.js} +1 -1
  138. package/dist/public/assets/{dist-CNm9tACe.js → dist-Bx9oFJRu.js} +1 -1
  139. package/dist/public/assets/{dist-CpwfhxFl.js → dist-C9uRrl_E.js} +1 -1
  140. package/dist/public/assets/{dist-hrQOAqN1.js → dist-CFyOS6pn.js} +1 -1
  141. package/dist/public/assets/{dist-CI5_cNui.js → dist-CXSIgvvA.js} +1 -1
  142. package/dist/public/assets/{dist-D1vjmDZ_2.js → dist-Cy5lktAQ2.js} +181 -181
  143. package/dist/public/assets/{dist-CJuiZAB0.js → dist-DL1WTl5d.js} +1 -1
  144. package/dist/public/assets/{dist-CDMQmWZl.js → dist-DRg5A_HQ.js} +1 -1
  145. package/dist/public/assets/{dist-CebtYbHb.js → dist-D_1xxRDt.js} +1 -1
  146. package/dist/public/assets/{dist-DU2smIGg.js → dist-DgRDZMLf.js} +1 -1
  147. package/dist/public/assets/{dist-BpOfJRMm.js → dist-DrCK4JBL.js} +1 -1
  148. package/dist/public/assets/{dist-y6w4IT08.js → dist-DuPjpj5-.js} +1 -1
  149. package/dist/public/assets/{dist-wfUjMP-v.js → dist-EpVTQF77.js} +1 -1
  150. package/dist/public/assets/{doc-paths-v_LqWyej.js → doc-paths-CBKXYveW.js} +1 -1
  151. package/dist/public/assets/{documents-events-BVk5JL1j.js → documents-events-DNLLVEPR.js} +1 -1
  152. package/dist/public/assets/{download-BuEN0lZf.js → download-btG_KeFQ.js} +1 -1
  153. package/dist/public/assets/{dropdown-menu-CP1RnfZI.js → dropdown-menu-K4eCFwQy.js} +1 -1
  154. package/dist/public/assets/{ebnfDiagram-CCIWWBDH-BWiN4nWj.js → ebnfDiagram-CCIWWBDH-CjptFZja.js} +1 -1
  155. package/dist/public/assets/{erDiagram-Q63AITRT-5GE6Syx5.js → erDiagram-Q63AITRT-BYiJa_5G.js} +1 -1
  156. package/dist/public/assets/eventmodeling-45OFAUF4-ur3Hg9pT.js +1 -0
  157. package/dist/public/assets/{eye-CYj_zi2W.js → eye-j_4QS15C.js} +1 -1
  158. package/dist/public/assets/{field-BADrt9_J.js → field-9eXIpxzl.js} +1 -1
  159. package/dist/public/assets/{file-tree-adapter-j4_0rR4k.js → file-tree-adapter-BQ9idF-F.js} +1 -1
  160. package/dist/public/assets/{file-tree-utils-ChaLadja.js → file-tree-utils-DrTcSGTj.js} +1 -1
  161. package/dist/public/assets/flowDiagram-23GEKE2U-C1BAvCbz.js +1 -0
  162. package/dist/public/assets/{folder-CWVPrRtx.js → folder-C8rE1Soy.js} +1 -1
  163. package/dist/public/assets/{folder-config-api-Cyxss03I.js → folder-config-api-Cf3ca6iE.js} +1 -1
  164. package/dist/public/assets/{folder-open-BXfoqsrp.js → folder-open-CB-trByC.js} +1 -1
  165. package/dist/public/assets/{follow-file-BMJH7ZWv.js → follow-file-Ctr47jtP.js} +1 -1
  166. package/dist/public/assets/{ganttDiagram-NO4QXBWP-DGnL6oh-.js → ganttDiagram-NO4QXBWP-TYuuGc0X.js} +1 -1
  167. package/dist/public/assets/{git-branch-CMN6cdzm.js → git-branch-JnfmLuHd.js} +1 -1
  168. package/dist/public/assets/gitGraph-TEB2WS4Q-l_1SzZcb.js +1 -0
  169. package/dist/public/assets/{gitGraphDiagram-IHSO6WYX-mMfBO0xv.js → gitGraphDiagram-IHSO6WYX-BrjUrrk2.js} +1 -1
  170. package/dist/public/assets/globals-B-lWUzDu.css +1 -0
  171. package/dist/public/assets/{graphlib-CS7i3af0.js → graphlib-D8PlvV2o.js} +1 -1
  172. package/dist/public/assets/{hash-BS4ux6bl.js → hash-DKiwvmF3.js} +1 -1
  173. package/dist/public/assets/{highlighted-body-OFNGDK62-Bc_b2HT_.js → highlighted-body-OFNGDK62-eJrwOujA.js} +1 -1
  174. package/dist/public/assets/{history-CiIvI4I4.js → history-eaFgPZWX.js} +1 -1
  175. package/dist/public/assets/i18n-CC8DkJXO.js +1 -0
  176. package/dist/public/assets/index-DrqV8949.js +2097 -0
  177. package/dist/public/assets/{info-160SNOuG.js → info-CsTy513y.js} +1 -1
  178. package/dist/public/assets/info-DKCQHKI2-CCDXfGhV.js +1 -0
  179. package/dist/public/assets/{infoDiagram-FWYZ7A6U-DuU1GDQ6.js → infoDiagram-FWYZ7A6U-B6_Knuir.js} +1 -1
  180. package/dist/public/assets/{input-group-CPKSxoq5.js → input-group-BA2Li4LU.js} +1 -1
  181. package/dist/public/assets/{ishikawaDiagram-FXEZZL3T-Bg0KJFCj.js → ishikawaDiagram-FXEZZL3T-CqxHoebw.js} +1 -1
  182. package/dist/public/assets/{journeyDiagram-5HDEW3XC-DLWkGhNH.js → journeyDiagram-5HDEW3XC-B1-3fVtR.js} +1 -1
  183. package/dist/public/assets/{kanban-definition-HUTT4EX6-BhYGhRMu.js → kanban-definition-HUTT4EX6-CdhMOBCU.js} +1 -1
  184. package/dist/public/assets/{line-e19R8FCM.js → line-C0o9Fjf4.js} +1 -1
  185. package/dist/public/assets/{linear-a82bFSBJ.js → linear-CjM1R4zy.js} +1 -1
  186. package/dist/public/assets/{lint-config-client-CN7WtJJN.js → lint-config-client-DzdtSJp-.js} +1 -1
  187. package/dist/public/assets/{list-plus-BPvSuFZX.js → list-plus-ByOuGBSE.js} +1 -1
  188. package/dist/public/assets/loader-circle-BJLNGSB4.js +1 -0
  189. package/dist/public/assets/{local-menu-action-bus-BDB0W02w.js → local-menu-action-bus-BKJCODnD.js} +1 -1
  190. package/dist/public/assets/{map-il90ypLM.js → map-Cu759seX.js} +1 -1
  191. package/dist/public/assets/{markdownlint-rule-browser-uB5xoBRt.js → markdownlint-rule-browser-DMQXiRek.js} +1 -1
  192. package/dist/public/assets/mermaid-GHXKKRXX-C9G7CQ6h.js +1 -0
  193. package/dist/public/assets/{mermaid-parser.core-ueh8mdU-.js → mermaid-parser.core-DpHycRcl.js} +2 -2
  194. package/dist/public/assets/{mermaid.core-RZ5le45c.js → mermaid.core-BnYdLHjl.js} +3 -3
  195. package/dist/public/assets/messages-BNq0JS1I.js +1 -0
  196. package/dist/public/assets/messages-C1QZwdEx.js +1 -0
  197. package/dist/public/assets/messages-CAevTmZQ.js +1 -0
  198. package/dist/public/assets/messages-CG-GHBB9.js +1 -0
  199. package/dist/public/assets/messages-CIxg-v3C.js +1 -0
  200. package/dist/public/assets/messages-CKi8pZ4Q.js +1 -0
  201. package/dist/public/assets/messages-Cv5HHzZF.js +1 -0
  202. package/dist/public/assets/messages-DTRz3g9F.js +1 -0
  203. package/dist/public/assets/messages-DWBpIisU.js +1 -0
  204. package/dist/public/assets/messages-XzeH2iOB.js +1 -0
  205. package/dist/public/assets/messages-bBtIkGs7.js +1 -0
  206. package/dist/public/assets/{mindmap-definition-LN4V7U3C-Bcv7y0kn.js → mindmap-definition-LN4V7U3C-D6FYi_vY.js} +1 -1
  207. package/dist/public/assets/minus-H7UCODAH.js +1 -0
  208. package/dist/public/assets/{miss-dialog-store-CdaZpyLg.js → miss-dialog-store-DKfFwAsF.js} +1 -1
  209. package/dist/public/assets/navigation-targets-Ce74CisT.js +1 -0
  210. package/dist/public/assets/{now-CZywS9tX.js → now-Cd_fQsCQ.js} +1 -1
  211. package/dist/public/assets/{open-managed-artifact-tab-CFg9s1Dl.js → open-managed-artifact-tab-B84Y6EsP.js} +1 -1
  212. package/dist/public/assets/{ordinal-Bj6MlRdi.js → ordinal-oNJqAlZi.js} +1 -1
  213. package/dist/public/assets/packet-7NZHBO7P-BBeRj-Du.js +1 -0
  214. package/dist/public/assets/{panel-right-open-_nL1w4h-.js → panel-right-open-JxkSMPMb.js} +1 -1
  215. package/dist/public/assets/{paperclip-DV67TMJS.js → paperclip-BxFhnUjq.js} +1 -1
  216. package/dist/public/assets/{pegDiagram-2B236MQR-Du6F68bP.js → pegDiagram-2B236MQR-Cic2_Ooi.js} +1 -1
  217. package/dist/public/assets/{pending-receive-nav-store-By3F7IeX.js → pending-receive-nav-store-DosIhFkt.js} +1 -1
  218. package/dist/public/assets/pie-RZYD4A2V-BszLCTWh.js +1 -0
  219. package/dist/public/assets/{pieDiagram-ENE6RG2P-Du-eEA1d.js → pieDiagram-ENE6RG2P-DgqO0C3j.js} +1 -1
  220. package/dist/public/assets/{project-paths-BWmSfpDI.js → project-paths-DC6bWLUQ.js} +1 -1
  221. package/dist/public/assets/{prop-types-BUGU9oYX.js → prop-types-BxhIEdp4.js} +1 -1
  222. package/dist/public/assets/{quadrantDiagram-ABIIQ3AL-NefyxxyK.js → quadrantDiagram-ABIIQ3AL-CC3ZGpWb.js} +1 -1
  223. package/dist/public/assets/radar-I7S5WNFK-CG0ShGDu.js +1 -0
  224. package/dist/public/assets/railroad-3IZDKUUU-N5ekmrCL.js +1 -0
  225. package/dist/public/assets/railroad-abnf-AHOZXSZD-DnjoKlG9.js +1 -0
  226. package/dist/public/assets/railroad-ebnf-EBAXGLYW-qDwmtJRh.js +1 -0
  227. package/dist/public/assets/railroad-peg-LSFZ7HO6-DSfMsKSD.js +1 -0
  228. package/dist/public/assets/{railroadDiagram-RFXS5EU6-CN_1Ywzn.js → railroadDiagram-RFXS5EU6-DaoKPEli.js} +1 -1
  229. package/dist/public/assets/{receive-store-DQ2cxNlN.js → receive-store-DO5w93VK.js} +1 -1
  230. package/dist/public/assets/{refresh-cw-Bjv-Fpq5.js → refresh-cw-CAV3aG7d.js} +1 -1
  231. package/dist/public/assets/{requirementDiagram-TGXJPOKE-bDLvkWBT.js → requirementDiagram-TGXJPOKE-qmFI0ev3.js} +1 -1
  232. package/dist/public/assets/{sankeyDiagram-HTMAVEWB-CyhjQEet.js → sankeyDiagram-HTMAVEWB-CYeZQsa5.js} +1 -1
  233. package/dist/public/assets/{schema-fields-view-intent-BMlW8LRz.js → schema-fields-view-intent-CeZOW3HG.js} +1 -1
  234. package/dist/public/assets/{select-BaOsrrG7.js → select-BjNoD_FX.js} +1 -1
  235. package/dist/public/assets/{selection-context-Q2igplxe.js → selection-context-DAl-Wxy6.js} +1 -1
  236. package/dist/public/assets/{separator-BXBsYPiB.js → separator-BKbgOjgy.js} +1 -1
  237. package/dist/public/assets/{sequenceDiagram-DBY2YBRQ-BeYilBxj.js → sequenceDiagram-DBY2YBRQ-DfXkoRwp.js} +1 -1
  238. package/dist/public/assets/{sizeCapture-X5ZJPWSS-Mb3J__hm.js → sizeCapture-X5ZJPWSS-Bd7A4fpz.js} +1 -1
  239. package/dist/public/assets/skill-actions-1VvTttnO.js +2 -0
  240. package/dist/public/assets/{skill-scope-CLm-DjVO.js → skill-scope-uWACL-4X.js} +1 -1
  241. package/dist/public/assets/{skills-api-Do-yD8Wd.js → skills-api-S9b1zvZ6.js} +1 -1
  242. package/dist/public/assets/{square-pen-CW0s3lqC.js → square-pen-hwoIfi3M.js} +1 -1
  243. package/dist/public/assets/{src-rGs2GXpJ.js → src-CVA7Dtfv.js} +1 -1
  244. package/dist/public/assets/{src-DT86yydp.js → src-XHagG0Wj.js} +1 -1
  245. package/dist/public/assets/{stateDiagram-2N3HPSRC-D0WNjYjx.js → stateDiagram-2N3HPSRC-CCh_abZC.js} +1 -1
  246. package/dist/public/assets/stateDiagram-v2-6OUMAXLB-CUhlDos5.js +1 -0
  247. package/dist/public/assets/{swimlanes-5IMT3BWC-BAPdgrYU.js → swimlanes-5IMT3BWC-Dk2uoutn.js} +2 -2
  248. package/dist/public/assets/swimlanesDiagram-G3AALYLV-DHL99Ckz.js +8 -0
  249. package/dist/public/assets/{tag-pill-input-DLcAHAth.js → tag-pill-input-er0MqvFK.js} +1 -1
  250. package/dist/public/assets/{target-navigation-intent-AJHzhxLh.js → target-navigation-intent-DBvgpA7l.js} +1 -1
  251. package/dist/public/assets/{telemetry-impl-DFcgjFFc.js → telemetry-impl-LPWb9DJh.js} +2 -2
  252. package/dist/public/assets/{telemetry-startup-0F_AW_hr.js → telemetry-startup-B-jACYNe.js} +1 -1
  253. package/dist/public/assets/terminal-bCsp6kPz.js +1 -0
  254. package/dist/public/assets/{terminal-cli-display-DcmUJBJ0.js → terminal-cli-display-CBMTYLbQ.js} +1 -1
  255. package/dist/public/assets/terminal-launch-events-CbqKUJ57.js +1 -0
  256. package/dist/public/assets/{terminal-telemetry-BaIL0R4h.js → terminal-telemetry-BRNk9k9Y.js} +1 -1
  257. package/dist/public/assets/{text-viewer-languages-BBrkAtBf.js → text-viewer-languages-BmEIetCD.js} +2 -2
  258. package/dist/public/assets/{timeline-definition-FHXFAJF6-BnIpQBQO.js → timeline-definition-FHXFAJF6-tb13RhWP.js} +1 -1
  259. package/dist/public/assets/{trash-2-rgduGgZB.js → trash-2-CSpv7np3.js} +1 -1
  260. package/dist/public/assets/treeView-QDETBFTQ-DwFOcFO4.js +1 -0
  261. package/dist/public/assets/treemap-6X3UGDF4-D_-cggQd.js +1 -0
  262. package/dist/public/assets/{triangle-alert-CnW4IElJ.js → triangle-alert-xKPljhlK.js} +1 -1
  263. package/dist/public/assets/typing-burst-detector-D114TNgO.js +8 -0
  264. package/dist/public/assets/{undo-2-BmxrL5XS.js → undo-2-D5cqFzyJ.js} +1 -1
  265. package/dist/public/assets/{uninstall-DEqbq9oi.js → uninstall-B7OIrc24.js} +1 -1
  266. package/dist/public/assets/{use-activity-panel-HhWhJyPS.js → use-activity-panel-DnpzFXIs.js} +1 -1
  267. package/dist/public/assets/{use-apply-config-color-theme-dRh7Xul9.js → use-apply-config-color-theme-DLZre1dS.js} +1 -1
  268. package/dist/public/assets/{use-collab-url-CtzTnNTo.js → use-collab-url-CjkHphlr.js} +1 -1
  269. package/dist/public/assets/{use-live-xterm-theme-CEFo40Qe.js → use-live-xterm-theme-CVQrPooY.js} +1 -1
  270. package/dist/public/assets/{use-open-skill-Cscl8Yx2.js → use-open-skill-DImLrKgY.js} +1 -1
  271. package/dist/public/assets/{use-popular-skills-Yh3HxWUQ.js → use-popular-skills-Dj_DcxJ4.js} +1 -1
  272. package/dist/public/assets/{use-settings-route-BDWFTRtx.js → use-settings-route-DEoOHvHf.js} +1 -1
  273. package/dist/public/assets/{use-skill-origin-JUAmtC9e.js → use-skill-origin-Bj3wYKq2.js} +1 -1
  274. package/dist/public/assets/{use-skills-BmTj83Vv.js → use-skills-k_NyqOb0.js} +1 -1
  275. package/dist/public/assets/{use-terminal-enabled-BJe4ZzuL.js → use-terminal-enabled-D2ShR7ZJ.js} +1 -1
  276. package/dist/public/assets/{use-timeline-entry-diff-BEA4Wm90.js → use-timeline-entry-diff-CjhWQfrw.js} +4 -4
  277. package/dist/public/assets/{use-workspace-BJfeN9YT.js → use-workspace-D0EhHpoU.js} +1 -1
  278. package/dist/public/assets/{vennDiagram-L72KCM5P-C38RYC28.js → vennDiagram-L72KCM5P-Cyp_-2xs.js} +1 -1
  279. package/dist/public/assets/wardley-OPB4EBWU-Dz0s9mBi.js +1 -0
  280. package/dist/public/assets/{wardleyDiagram-EHGQE667-B0VRsKo1.js → wardleyDiagram-EHGQE667-C5z1_r-x.js} +1 -1
  281. package/dist/public/assets/{wrench-DtGaC8XY.js → wrench-yAsO-Pm9.js} +1 -1
  282. package/dist/public/assets/x-BopM5CF8.js +1 -0
  283. package/dist/public/assets/{xychartDiagram-FW5EYKEG-jAQK9E85.js → xychartDiagram-FW5EYKEG-DH9RxgRE.js} +1 -1
  284. package/dist/public/index.html +134 -133
  285. package/dist/public/uninstall.html +14 -14
  286. package/dist/{repair-launch-json-CMoUKDAg.mjs → repair-launch-json-DJCBlxLw.mjs} +2 -2
  287. package/dist/{repair-mcp-configs-BNOodZWo.mjs → repair-mcp-configs-C8bpTpxh.mjs} +2 -2
  288. package/dist/repair-skills-BK1EcvXS.mjs +1 -0
  289. package/dist/{repair-skills-hf9Efmkp.mjs → repair-skills-CMm13M8P.mjs} +2 -2
  290. package/dist/server-lock-Dy_yO6Nk.mjs +1 -0
  291. package/dist/{server-lock-DEOF_T1n.mjs → server-lock-V3bg8zL0.mjs} +2 -2
  292. package/dist/{skill-teardown-B7FIoHkS.mjs → skill-teardown-CO4xteJC.mjs} +2 -2
  293. package/dist/{src-EOJBnmi7.mjs → src-C2Gyjygx.mjs} +1 -1
  294. package/dist/src-CRHuZPcr.mjs +1 -0
  295. package/dist/{src-DiMa3Hqv.mjs → src-DwT4IlXo.mjs} +2 -2
  296. package/dist/{src-v83peLAF.mjs → src-IM6msWeV.mjs} +2 -2
  297. package/dist/{src-T22OxNCJ.mjs → src-bozJXbns.mjs} +4 -4
  298. package/dist/start-BGjifSjp.mjs +1 -0
  299. package/dist/{start-BRUIviEZ.mjs → start-Bua6MR2W.mjs} +3 -3
  300. package/dist/{write-project-skill-Ds6QPmhs.mjs → write-project-skill-BoeD2RUw.mjs} +2 -2
  301. package/package.json +4 -4
  302. package/dist/constants-CHijDPGq.mjs +0 -2
  303. package/dist/git-handle-Rma56ZDs.mjs +0 -1
  304. package/dist/init-D90nzFt2.mjs +0 -1
  305. package/dist/loader-DgwfFb4P.mjs +0 -1
  306. package/dist/md-manager-wsrK03Vr.mjs +0 -2
  307. package/dist/preview-DU9aVflr.mjs +0 -1
  308. package/dist/public/assets/CodeMirrorPropInput-D6Vpy6cC.js +0 -3
  309. package/dist/public/assets/FeedbackForm-DK3Eafhu.js +0 -1
  310. package/dist/public/assets/ManagedArtifactProperties-BoQaa-VP.js +0 -2
  311. package/dist/public/assets/ManagedArtifactProperties-F3vbLcfn.js +0 -1
  312. package/dist/public/assets/SessionsHost-CldPPD2R.js +0 -2
  313. package/dist/public/assets/SettingsDialogBody-B-5j1KKE.js +0 -12
  314. package/dist/public/assets/SkillToolbarControls-DnCihwAh.js +0 -1
  315. package/dist/public/assets/SourceEditor-BuOJMaXx.js +0 -1
  316. package/dist/public/assets/architecture-TIHT7OUA-DHywK0qf.js +0 -1
  317. package/dist/public/assets/arrow-up-right-CXYxHO7Z.js +0 -1
  318. package/dist/public/assets/channel-BNyr5ucm.js +0 -1
  319. package/dist/public/assets/check-DA6LolTH.js +0 -1
  320. package/dist/public/assets/chevron-left-DY9flfyc.js +0 -1
  321. package/dist/public/assets/chevron-right-2RK4DD3b.js +0 -1
  322. package/dist/public/assets/chunk-2Q5K7J3B-UKfnOi4g.js +0 -1
  323. package/dist/public/assets/chunk-VAUOI2AC-ChJppfl7.js +0 -1
  324. package/dist/public/assets/chunk-XXDRQBXY-Bsh29NfZ.js +0 -1
  325. package/dist/public/assets/classDiagram-OUVF2IWQ-6PbrHEW6.js +0 -1
  326. package/dist/public/assets/classDiagram-v2-EOCWNBFH-B4bz8Etj.js +0 -1
  327. package/dist/public/assets/client-version-BESEvZR7.js +0 -1
  328. package/dist/public/assets/cynefin-VYW2F7L2-CjkKc5Wd.js +0 -1
  329. package/dist/public/assets/eventmodeling-45OFAUF4-GQ05Sah7.js +0 -1
  330. package/dist/public/assets/flowDiagram-23GEKE2U-CwO12b-s.js +0 -1
  331. package/dist/public/assets/gitGraph-TEB2WS4Q-Da8kWWZb.js +0 -1
  332. package/dist/public/assets/globals-CyYdI-wx.css +0 -1
  333. package/dist/public/assets/i18n-CqChyNE3.js +0 -1
  334. package/dist/public/assets/index-CJ9IqjVe.js +0 -2097
  335. package/dist/public/assets/info-DKCQHKI2-BPZv5cfZ.js +0 -1
  336. package/dist/public/assets/loader-circle-BbuX0POi.js +0 -1
  337. package/dist/public/assets/mermaid-GHXKKRXX-CaB-_LCR.js +0 -1
  338. package/dist/public/assets/messages-BTQ6QHGD.js +0 -1
  339. package/dist/public/assets/messages-C1_vqjO0.js +0 -1
  340. package/dist/public/assets/messages-CcNmHSRm.js +0 -1
  341. package/dist/public/assets/messages-CuCFXL8u.js +0 -1
  342. package/dist/public/assets/messages-D-wGArHz.js +0 -1
  343. package/dist/public/assets/messages-DCORBVvf.js +0 -1
  344. package/dist/public/assets/messages-DK20PMTg.js +0 -1
  345. package/dist/public/assets/messages-DaaRRAol.js +0 -1
  346. package/dist/public/assets/messages-TrWXqll1.js +0 -1
  347. package/dist/public/assets/messages-_5gcf9E8.js +0 -1
  348. package/dist/public/assets/messages-l5kO2Bq5.js +0 -1
  349. package/dist/public/assets/minus-Ba4o_31L.js +0 -1
  350. package/dist/public/assets/navigation-targets-BmGfXtLg.js +0 -1
  351. package/dist/public/assets/packet-7NZHBO7P-BtkfuFQU.js +0 -1
  352. package/dist/public/assets/pie-RZYD4A2V-DipSPJ4R.js +0 -1
  353. package/dist/public/assets/radar-I7S5WNFK-CsW1Ke6j.js +0 -1
  354. package/dist/public/assets/railroad-3IZDKUUU-CDGYvuvs.js +0 -1
  355. package/dist/public/assets/railroad-abnf-AHOZXSZD-IJHoKQ5T.js +0 -1
  356. package/dist/public/assets/railroad-ebnf-EBAXGLYW-DiwXL3Zg.js +0 -1
  357. package/dist/public/assets/railroad-peg-LSFZ7HO6-B4tduAeK.js +0 -1
  358. package/dist/public/assets/skill-actions-CBlHW4d_.js +0 -2
  359. package/dist/public/assets/stateDiagram-v2-6OUMAXLB-NccT1PAw.js +0 -1
  360. package/dist/public/assets/swimlanesDiagram-G3AALYLV-CIDy7tZE.js +0 -8
  361. package/dist/public/assets/terminal-BNdVsbND.js +0 -1
  362. package/dist/public/assets/terminal-launch-events-DL9JJPUH.js +0 -1
  363. package/dist/public/assets/treeView-QDETBFTQ-DCy4i-OI.js +0 -1
  364. package/dist/public/assets/treemap-6X3UGDF4-BrUnfA75.js +0 -1
  365. package/dist/public/assets/typing-burst-detector-CPW5PZdn.js +0 -8
  366. package/dist/public/assets/wardley-OPB4EBWU-yXijkZ08.js +0 -1
  367. package/dist/public/assets/x-D8xzRaMT.js +0 -1
  368. package/dist/repair-skills-BmOui_rF.mjs +0 -1
  369. package/dist/server-lock-Rh5J9yH2.mjs +0 -1
  370. package/dist/src-DFbDxxC5.mjs +0 -1
  371. package/dist/start-0rwkS2vl.mjs +0 -1
  372. /package/dist/public/assets/{ActivityPanelDiffView-aQoOngI6.js → ActivityPanelDiffView-fDxLwTi2.js} +0 -0
  373. /package/dist/public/assets/{SkillModeBanner-Y5LYtJrC.js → SkillModeBanner-d0ZDkWTk.js} +0 -0
  374. /package/dist/public/assets/{__vite-browser-external-6FU8ctEn.js → __vite-browser-external-D_48KNDi.js} +0 -0
  375. /package/dist/public/assets/{agent-presence-DntZZFlY.js → agent-presence-DK_W4GTa.js} +0 -0
  376. /package/dist/public/assets/{array-Ce922FV9.js → array-DYKIbRR-.js} +0 -0
  377. /package/dist/public/assets/{asset-dispatch-_dEhJuVP.js → asset-dispatch-DsHoHhCG.js} +0 -0
  378. /package/dist/public/assets/{auth-prompt-store-CeaWNesV.js → auth-prompt-store-CyiGTt3C.js} +0 -0
  379. /package/dist/public/assets/{badge-CY_v_nGy.js → badge-zHd29IKW.js} +0 -0
  380. /package/dist/public/assets/{chunk-KEIR6QF5-88h2AcFS.js → chunk-KEIR6QF5-Z0IgTo4K.js} +0 -0
  381. /package/dist/public/assets/{chunk-Y2CYZVJY-B-DQ9l1H.js → chunk-Y2CYZVJY-Bmis3P2F.js} +0 -0
  382. /package/dist/public/assets/{clike-DDeLLKpf.js → clike-l3ublWpW.js} +0 -0
  383. /package/dist/public/assets/{clipboard-adapter-C4L1qX1X.js → clipboard-adapter-DEJxizFj.js} +0 -0
  384. /package/dist/public/assets/{code-highlighter-impl-Bq6VPPCL.js → code-highlighter-impl-CHS525hA.js} +0 -0
  385. /package/dist/public/assets/{colors-DXv_7g0X.js → colors-C77NTF6g.js} +0 -0
  386. /package/dist/public/assets/{copilot-D0J83lOh.js → copilot-BdGxiVpg.js} +0 -0
  387. /package/dist/public/assets/{createLucideIcon-BcLKHslE.js → createLucideIcon-6iYxif1u.js} +0 -0
  388. /package/dist/public/assets/{cursor-B6-YoFzF.js → cursor-CUtcHGV-.js} +0 -0
  389. /package/dist/public/assets/{cytoscape.esm-61X9Wf4W.js → cytoscape.esm-C2gIT5zZ.js} +0 -0
  390. /package/dist/public/assets/{defaultLocale-BypL9rsE.js → defaultLocale-BugBqEWo.js} +0 -0
  391. /package/dist/public/assets/{desktop-bridge-types-rBjHIYSI.js → desktop-bridge-types-oYPdTDmz.js} +0 -0
  392. /package/dist/public/assets/{diff-CUOV9XAb.js → diff-TXhtTD_D.js} +0 -0
  393. /package/dist/public/assets/{dist-BSzXg9wc.js → dist-1ia0sKe1.js} +0 -0
  394. /package/dist/public/assets/{dist-BTu6o3T-.js → dist-B0Beym3_.js} +0 -0
  395. /package/dist/public/assets/{dist-CG-e4AlS.js → dist-DNiTklSL.js} +0 -0
  396. /package/dist/public/assets/{documents-fetch-B8A9IAH3.js → documents-fetch-I34CgFeh.js} +0 -0
  397. /package/dist/public/assets/{external-link-Bw5EK5AQ.js → external-link-CHCx4FXC.js} +0 -0
  398. /package/dist/public/assets/{file-tree-rename-validation-Dt6fQYnB.js → file-tree-rename-validation-DEuNOzhg.js} +0 -0
  399. /package/dist/public/assets/{form-WTEKK5Th.js → form-_Bm7VdZa.js} +0 -0
  400. /package/dist/public/assets/{format-C7y0e043.js → format-Dx1Bv63R.js} +0 -0
  401. /package/dist/public/assets/{gherkin-DHKdvgzn.js → gherkin-Bu_VunKM.js} +0 -0
  402. /package/dist/public/assets/{globals-fH7sZOn9.js → globals-CZJtsuL5.js} +0 -0
  403. /package/dist/public/assets/{go-C7e4ztpP.js → go-BYJ3ESi0.js} +0 -0
  404. /package/dist/public/assets/{init-DQ9T43b9.js → init-B44NBVpk.js} +0 -0
  405. /package/dist/public/assets/{input-_CzMpvY9.js → input-VnbFvuKd.js} +0 -0
  406. /package/dist/public/assets/{isObject-B3vD71ho.js → isObject-Dhzo1ma6.js} +0 -0
  407. /package/dist/public/assets/{libesm-DLjHMG6S.js → libesm-BYxokP1G.js} +0 -0
  408. /package/dist/public/assets/{lint-plugin-meta-D6yg1VIa.js → lint-plugin-meta-FPoTE-0t.js} +0 -0
  409. /package/dist/public/assets/{lru-string-cache-D1rxjuni.js → lru-string-cache-BgNKFfCO.js} +0 -0
  410. /package/dist/public/assets/{lua-BbsHik3c.js → lua-De9v6Xwm.js} +0 -0
  411. /package/dist/public/assets/{mcp-consent-store-yqsuAEir.js → mcp-consent-store-CBPF1Ll9.js} +0 -0
  412. /package/dist/public/assets/{min-LWIJDKXt.js → min-CgRbfTQR.js} +0 -0
  413. /package/dist/public/assets/{panel-DVJ8gssn.js → panel-9S5Pf2VO.js} +0 -0
  414. /package/dist/public/assets/{panzoom.es-CnTJleIF.js → panzoom.es-CebiCTnw.js} +0 -0
  415. /package/dist/public/assets/{path-CdhP4z-N.js → path-DNVjzh9n.js} +0 -0
  416. /package/dist/public/assets/{pdf-CvpTyCsQ.js → pdf-19dxfod4.js} +0 -0
  417. /package/dist/public/assets/{pdf.worker-Dwl0H-tq.js → pdf.worker-Cn0IyjYR.js} +0 -0
  418. /package/dist/public/assets/{perl-B_IBZ74F.js → perl-DAC-0-L4.js} +0 -0
  419. /package/dist/public/assets/{properties-DC2eg36q.js → properties-BuEq0L0N.js} +0 -0
  420. /package/dist/public/assets/{r-Cuws8T_X.js → r-D6J_8GbJ.js} +0 -0
  421. /package/dist/public/assets/{rough.esm-Bmw38t74.js → rough.esm-hH2VdTtm.js} +0 -0
  422. /package/dist/public/assets/{ruby-B4Exyfkx.js → ruby-BulDdqGQ.js} +0 -0
  423. /package/dist/public/assets/{share-metadata-rows-a0ScdR3d.js → share-metadata-rows-CBd7DuHz.js} +0 -0
  424. /package/dist/public/assets/{shell-DA6f2ert.js → shell-FYbPjPiK.js} +0 -0
  425. /package/dist/public/assets/{skeleton-ColtBPsg.js → skeleton-BOVIbSHk.js} +0 -0
  426. /package/dist/public/assets/{sortable.esm-DlAqBM0z.js → sortable.esm-mqYoEMD5.js} +0 -0
  427. /package/dist/public/assets/{sql-gKfhysbI.js → sql-BTcd-g6A.js} +0 -0
  428. /package/dist/public/assets/{src-l8acH7-t.js → src-D2oHIihg.js} +0 -0
  429. /package/dist/public/assets/{startup-marks-BPO-vrjH.js → startup-marks-BYurBbnW.js} +0 -0
  430. /package/dist/public/assets/{stex-Cj2UNqUe.js → stex-BmYSnOnf.js} +0 -0
  431. /package/dist/public/assets/{swift-D4PiCeXt.js → swift-CnW5XUwC.js} +0 -0
  432. /package/dist/public/assets/{terminal-command-events-BBYZtptJ.js → terminal-command-events-mSM3ArSl.js} +0 -0
  433. /package/dist/public/assets/{textarea-C5-cm3M6.js → textarea-D59GB_Zy.js} +0 -0
  434. /package/dist/public/assets/{thread-client-CER-baRK.js → thread-client-DySYYPC9.js} +0 -0
  435. /package/dist/public/assets/{thread-draft-staging-DZhf3sQU.js → thread-draft-staging-BZaq81Sj.js} +0 -0
  436. /package/dist/public/assets/{timeline-diff-store-BpUHW_Yp.js → timeline-diff-store-cCBpDgND.js} +0 -0
  437. /package/dist/public/assets/{toml-BAg1ozw3.js → toml-vEnVjPi4.js} +0 -0
  438. /package/dist/public/assets/{use-installed-clis-CsPJ2Mod.js → use-installed-clis-CdB0ME5s.js} +0 -0
  439. /package/dist/public/assets/{useLintConfigViewMode-shAfv89B.js → useLintConfigViewMode-C89oTBHY.js} +0 -0
  440. /package/dist/public/assets/{workspace-paths-D7hYulMY.js → workspace-paths-C2pS_Pbn.js} +0 -0
package/dist/index.mjs CHANGED
@@ -174,11 +174,11 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\
174
174
  }
175
175
  }
176
176
 
177
- `)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=xn,s=!sn.jitless,c=s&&pee.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?Ar([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function jr(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!Dn(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>An(e,r,cn())))}),t)}const Mr=N(`$ZodUnion`,(e,t)=>{Sr.init(e,t),gn(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),gn(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),gn(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),gn(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>pn(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>jr(t,r,e,i)):jr(o,r,e,i)}}),Ate=N(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,Mr.init(e,t);let n=e._zod.parse;gn(e._zod,`propValues`,()=>{let e={};for(let n of t.options){let r=n._zod.propValues;if(!r||Object.keys(r).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let[t,n]of Object.entries(r)){e[t]||(e[t]=new Set);for(let r of n)e[t].add(r)}}return e});let r=dn(()=>{let e=t.options,n=new Map;for(let r of e){let e=r._zod.propValues?.[t.discriminator];if(!e||e.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let t of e){if(n.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(i,a)=>{let o=i.value;if(!xn(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=r.value.get(o?.[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback||a.direction===`backward`?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(r.value.keys()),input:o,path:[t.discriminator],inst:e}),i)}}),jte=N(`$ZodIntersection`,(e,t)=>{Sr.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>Pr(e,t,n)):Pr(e,i,a)}});function Nr(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Sn(e)&&Sn(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=Nr(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=Nr(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Pr(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),Dn(e))return e;let o=Nr(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}const Mte=N(`$ZodRecord`,(e,t)=>{Sr.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Sn(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[],o=t.keyType._zod.values;if(o){n.value={};let s=new Set;for(let c of o)if(typeof c==`string`||typeof c==`number`||typeof c==`symbol`){s.add(typeof c==`number`?c.toString():c);let o=t.keyType._zod.run({value:c,issues:[]},r);if(o instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(o.issues.length){n.issues.push({code:`invalid_key`,origin:`record`,issues:o.issues.map(e=>An(e,r,cn())),input:c,path:[c],inst:e});continue}let l=o.value,u=t.valueType._zod.run({value:i[c],issues:[]},r);u instanceof Promise?a.push(u.then(e=>{e.issues.length&&n.issues.push(...On(c,e.issues)),n.value[l]=e.value})):(u.issues.length&&n.issues.push(...On(c,u.issues)),n.value[l]=u.value)}let c;for(let e in i)s.has(e)||(c??=[],c.push(e));c&&c.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:c})}else{n.value={};for(let o of Reflect.ownKeys(i)){if(o===`__proto__`||!Object.prototype.propertyIsEnumerable.call(i,o))continue;let s=t.keyType._zod.run({value:o,issues:[]},r);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof o==`string`&&gr.test(o)&&s.issues.length){let e=t.keyType._zod.run({value:Number(o),issues:[]},r);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(s=e)}if(s.issues.length){t.mode===`loose`?n.value[o]=i[o]:n.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>An(e,r,cn())),input:o,path:[o],inst:e});continue}let c=t.valueType._zod.run({value:i[o],issues:[]},r);c instanceof Promise?a.push(c.then(e=>{e.issues.length&&n.issues.push(...On(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(...On(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),Nte=N(`$ZodEnum`,(e,t)=>{Sr.init(e,t);let n=ln(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>mee.has(typeof e)).map(e=>typeof e==`string`?wn(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),Pte=N(`$ZodLiteral`,(e,t)=>{if(Sr.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?wn(e):e?wn(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),Fte=N(`$ZodTransform`,(e,t)=>{Sr.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new on(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n.fallback=!0,n));if(i instanceof Promise)throw new an;return n.value=i,n.fallback=!0,n}});function Fr(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}const Ir=N(`$ZodOptional`,(e,t)=>{Sr.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,gn(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),gn(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${pn(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=e.value,i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(e=>Fr(e,r)):Fr(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),Ite=N(`$ZodExactOptional`,(e,t)=>{Ir.init(e,t),gn(e._zod,`values`,()=>t.innerType._zod.values),gn(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Lte=N(`$ZodNullable`,(e,t)=>{Sr.init(e,t),gn(e._zod,`optin`,()=>t.innerType._zod.optin),gn(e._zod,`optout`,()=>t.innerType._zod.optout),gn(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${pn(e.source)}|null)$`):void 0}),gn(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Rte=N(`$ZodDefault`,(e,t)=>{Sr.init(e,t),e._zod.optin=`optional`,gn(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>Lr(e,t)):Lr(r,t)}});function Lr(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const zte=N(`$ZodPrefault`,(e,t)=>{Sr.init(e,t),e._zod.optin=`optional`,gn(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Rr=N(`$ZodNonOptional`,(e,t)=>{Sr.init(e,t),gn(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>zr(t,e)):zr(i,e)}});function zr(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}const Br=N(`$ZodCatch`,(e,t)=>{Sr.init(e,t),e._zod.optin=`optional`,gn(e._zod,`optout`,()=>t.innerType._zod.optout),gn(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>An(e,n,cn()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>An(e,n,cn()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),Vr=N(`$ZodPipe`,(e,t)=>{Sr.init(e,t),gn(e._zod,`values`,()=>t.in._zod.values),gn(e._zod,`optin`,()=>t.in._zod.optin),gn(e._zod,`optout`,()=>t.out._zod.optout),gn(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>Hr(e,t.in,n)):Hr(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Hr(e,t.out,n)):Hr(r,t.out,n)}});function Hr(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}const Ur=N(`$ZodPreprocess`,(e,t)=>{Vr.init(e,t)}),Wr=N(`$ZodReadonly`,(e,t)=>{Sr.init(e,t),gn(e._zod,`propValues`,()=>t.innerType._zod.propValues),gn(e._zod,`values`,()=>t.innerType._zod.values),gn(e._zod,`optin`,()=>t.innerType?._zod?.optin),gn(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(Gr):Gr(r)}});function Gr(e){return e.value=Object.freeze(e.value),e}const Kr=N(`$ZodLazy`,(e,t)=>{Sr.init(e,t),gn(e._zod,`innerType`,()=>{let e=t;return e._cachedInner||=t.getter(),e._cachedInner}),gn(e._zod,`pattern`,()=>e._zod.innerType?._zod?.pattern),gn(e._zod,`propValues`,()=>e._zod.innerType?._zod?.propValues),gn(e._zod,`optin`,()=>e._zod.innerType?._zod?.optin??void 0),gn(e._zod,`optout`,()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),qr=N(`$ZodCustom`,(e,t)=>{_r.init(e,t),Sr.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>Jr(t,n,r,e));Jr(i,n,r,e)}});function Jr(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(Mn(e))}}var Yr,Xr=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function Zr(){return new Xr}(Yr=globalThis).__zod_globalRegistry??(Yr.__zod_globalRegistry=Zr());const Qr=globalThis.__zod_globalRegistry;function $r(e,t){return new e({type:`string`,...En(t)})}function ei(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...En(t)})}function ti(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...En(t)})}function ni(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...En(t)})}function ri(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...En(t)})}function ii(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...En(t)})}function ai(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...En(t)})}function oi(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...En(t)})}function si(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...En(t)})}function ci(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...En(t)})}function li(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...En(t)})}function ui(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...En(t)})}function di(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...En(t)})}function fi(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...En(t)})}function pi(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...En(t)})}function mi(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...En(t)})}function hi(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...En(t)})}function gi(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...En(t)})}function _i(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...En(t)})}function vi(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...En(t)})}function yi(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...En(t)})}function bi(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...En(t)})}function xi(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...En(t)})}function Si(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...En(t)})}function Ci(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...En(t)})}function wi(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...En(t)})}function Ti(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...En(t)})}function Ei(e,t){return new e({type:`number`,checks:[],...En(t)})}function Di(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...En(t)})}function Oi(e,t){return new e({type:`boolean`,...En(t)})}function ki(e,t){return new e({type:`null`,...En(t)})}function Ai(e){return new e({type:`unknown`})}function ji(e,t){return new e({type:`never`,...En(t)})}function Mi(e,t){return new yr({check:`less_than`,...En(t),value:e,inclusive:!1})}function Ni(e,t){return new yr({check:`less_than`,...En(t),value:e,inclusive:!0})}function Pi(e,t){return new br({check:`greater_than`,...En(t),value:e,inclusive:!1})}function Fi(e,t){return new br({check:`greater_than`,...En(t),value:e,inclusive:!0})}function Ii(e,t){return new Lee({check:`multiple_of`,...En(t),value:e})}function Li(e,t){return new zee({check:`max_length`,...En(t),maximum:e})}function Ri(e,t){return new Bee({check:`min_length`,...En(t),minimum:e})}function zi(e,t){return new Vee({check:`length_equals`,...En(t),length:e})}function Bi(e,t){return new Hee({check:`string_format`,format:`regex`,...En(t),pattern:e})}function Vi(e){return new Uee({check:`string_format`,format:`lowercase`,...En(e)})}function Hi(e){return new Wee({check:`string_format`,format:`uppercase`,...En(e)})}function Ui(e,t){return new Gee({check:`string_format`,format:`includes`,...En(t),includes:e})}function Wi(e,t){return new Kee({check:`string_format`,format:`starts_with`,...En(t),prefix:e})}function Gi(e,t){return new qee({check:`string_format`,format:`ends_with`,...En(t),suffix:e})}function Ki(e){return new Jee({check:`overwrite`,tx:e})}function qi(e){return Ki(t=>t.normalize(e))}function Ji(){return Ki(e=>e.trim())}function Yi(){return Ki(e=>e.toLowerCase())}function Xi(){return Ki(e=>e.toUpperCase())}function Zi(){return Ki(e=>fee(e))}function Qi(e,t,n){return new e({type:`array`,element:t,...En(n)})}function $i(e,t,n){let r=En(n);return r.abort??=!0,new e({type:`custom`,check:`custom`,fn:t,...r})}function ea(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...En(n)})}function ta(e,t){let n=na(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(Mn(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=t.value,r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(Mn(r))}},e(t.value,t)),t);return n}function na(e,t){let n=new _r({check:`custom`,...En(t)});return n._zod.check=e,n}function ra(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??Qr,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function ia(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,ia(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&sa(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function aa(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
177
+ `)}t.write(`payload.value = newResult;`),t.write(`return payload;`);let s=t.compile();return(t,n)=>s(e,t,n)},a,o=xn,s=!sn.jitless,c=s&&pee.value,l=t.catchall,u;e._zod.parse=(d,f)=>{u??=r.value;let p=d.value;return o(p)?s&&c&&f?.async===!1&&f.jitless!==!0?(a||=i(t.shape),d=a(d,f),l?Ar([],p,d,f,u,e):d):n(d,f):(d.issues.push({expected:`object`,code:`invalid_type`,input:p,inst:e}),d)}});function jr(e,t,n,r){for(let n of e)if(n.issues.length===0)return t.value=n.value,t;let i=e.filter(e=>!Dn(e));return i.length===1?(t.value=i[0].value,i[0]):(t.issues.push({code:`invalid_union`,input:t.value,inst:n,errors:e.map(e=>e.issues.map(e=>An(e,r,cn())))}),t)}const Mr=N(`$ZodUnion`,(e,t)=>{Sr.init(e,t),gn(e._zod,`optin`,()=>t.options.some(e=>e._zod.optin===`optional`)?`optional`:void 0),gn(e._zod,`optout`,()=>t.options.some(e=>e._zod.optout===`optional`)?`optional`:void 0),gn(e._zod,`values`,()=>{if(t.options.every(e=>e._zod.values))return new Set(t.options.flatMap(e=>Array.from(e._zod.values)))}),gn(e._zod,`pattern`,()=>{if(t.options.every(e=>e._zod.pattern)){let e=t.options.map(e=>e._zod.pattern);return RegExp(`^(${e.map(e=>pn(e.source)).join(`|`)})$`)}});let n=t.options.length===1?t.options[0]._zod.run:null;e._zod.parse=(r,i)=>{if(n)return n(r,i);let a=!1,o=[];for(let e of t.options){let t=e._zod.run({value:r.value,issues:[]},i);if(t instanceof Promise)o.push(t),a=!0;else{if(t.issues.length===0)return t;o.push(t)}}return a?Promise.all(o).then(t=>jr(t,r,e,i)):jr(o,r,e,i)}}),Ate=N(`$ZodDiscriminatedUnion`,(e,t)=>{t.inclusive=!1,Mr.init(e,t);let n=e._zod.parse;gn(e._zod,`propValues`,()=>{let e={};for(let n of t.options){let r=n._zod.propValues;if(!r||Object.keys(r).length===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(n)}"`);for(let[t,n]of Object.entries(r)){e[t]||(e[t]=new Set);for(let r of n)e[t].add(r)}}return e});let r=dn(()=>{let e=t.options,n=new Map;for(let r of e){let e=r._zod.propValues?.[t.discriminator];if(!e||e.size===0)throw Error(`Invalid discriminated union option at index "${t.options.indexOf(r)}"`);for(let t of e){if(n.has(t))throw Error(`Duplicate discriminator value "${String(t)}"`);n.set(t,r)}}return n});e._zod.parse=(i,a)=>{let o=i.value;if(!xn(o))return i.issues.push({code:`invalid_type`,expected:`object`,input:o,inst:e}),i;let s=r.value.get(o?.[t.discriminator]);return s?s._zod.run(i,a):t.unionFallback||a.direction===`backward`?n(i,a):(i.issues.push({code:`invalid_union`,errors:[],note:`No matching discriminator`,discriminator:t.discriminator,options:Array.from(r.value.keys()),input:o,path:[t.discriminator],inst:e}),i)}}),jte=N(`$ZodIntersection`,(e,t)=>{Sr.init(e,t),e._zod.parse=(e,n)=>{let r=e.value,i=t.left._zod.run({value:r,issues:[]},n),a=t.right._zod.run({value:r,issues:[]},n);return i instanceof Promise||a instanceof Promise?Promise.all([i,a]).then(([t,n])=>Pr(e,t,n)):Pr(e,i,a)}});function Nr(e,t){if(e===t||e instanceof Date&&t instanceof Date&&+e==+t)return{valid:!0,data:e};if(Sn(e)&&Sn(t)){let n=Object.keys(t),r=Object.keys(e).filter(e=>n.indexOf(e)!==-1),i={...e,...t};for(let n of r){let r=Nr(e[n],t[n]);if(!r.valid)return{valid:!1,mergeErrorPath:[n,...r.mergeErrorPath]};i[n]=r.data}return{valid:!0,data:i}}if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return{valid:!1,mergeErrorPath:[]};let n=[];for(let r=0;r<e.length;r++){let i=e[r],a=t[r],o=Nr(i,a);if(!o.valid)return{valid:!1,mergeErrorPath:[r,...o.mergeErrorPath]};n.push(o.data)}return{valid:!0,data:n}}return{valid:!1,mergeErrorPath:[]}}function Pr(e,t,n){let r=new Map,i;for(let n of t.issues)if(n.code===`unrecognized_keys`){i??=n;for(let e of n.keys)r.has(e)||r.set(e,{}),r.get(e).l=!0}else e.issues.push(n);for(let t of n.issues)if(t.code===`unrecognized_keys`)for(let e of t.keys)r.has(e)||r.set(e,{}),r.get(e).r=!0;else e.issues.push(t);let a=[...r].filter(([,e])=>e.l&&e.r).map(([e])=>e);if(a.length&&i&&e.issues.push({...i,keys:a}),Dn(e))return e;let o=Nr(t.value,n.value);if(!o.valid)throw Error(`Unmergable intersection. Error path: ${JSON.stringify(o.mergeErrorPath)}`);return e.value=o.data,e}const Mte=N(`$ZodRecord`,(e,t)=>{Sr.init(e,t),e._zod.parse=(n,r)=>{let i=n.value;if(!Sn(i))return n.issues.push({expected:`record`,code:`invalid_type`,input:i,inst:e}),n;let a=[],o=t.keyType._zod.values;if(o){n.value={};let s=new Set;for(let c of o)if(typeof c==`string`||typeof c==`number`||typeof c==`symbol`){s.add(typeof c==`number`?c.toString():c);let o=t.keyType._zod.run({value:c,issues:[]},r);if(o instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(o.issues.length){n.issues.push({code:`invalid_key`,origin:`record`,issues:o.issues.map(e=>An(e,r,cn())),input:c,path:[c],inst:e});continue}let l=o.value,u=t.valueType._zod.run({value:i[c],issues:[]},r);u instanceof Promise?a.push(u.then(e=>{e.issues.length&&n.issues.push(...On(c,e.issues)),n.value[l]=e.value})):(u.issues.length&&n.issues.push(...On(c,u.issues)),n.value[l]=u.value)}let c;for(let e in i)s.has(e)||(c??=[],c.push(e));c&&c.length>0&&n.issues.push({code:`unrecognized_keys`,input:i,inst:e,keys:c})}else{n.value={};for(let o of Reflect.ownKeys(i)){if(o===`__proto__`||!Object.prototype.propertyIsEnumerable.call(i,o))continue;let s=t.keyType._zod.run({value:o,issues:[]},r);if(s instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);if(typeof o==`string`&&gr.test(o)&&s.issues.length){let e=t.keyType._zod.run({value:Number(o),issues:[]},r);if(e instanceof Promise)throw Error(`Async schemas not supported in object keys currently`);e.issues.length===0&&(s=e)}if(s.issues.length){t.mode===`loose`?n.value[o]=i[o]:n.issues.push({code:`invalid_key`,origin:`record`,issues:s.issues.map(e=>An(e,r,cn())),input:o,path:[o],inst:e});continue}let c=t.valueType._zod.run({value:i[o],issues:[]},r);c instanceof Promise?a.push(c.then(e=>{e.issues.length&&n.issues.push(...On(o,e.issues)),n.value[s.value]=e.value})):(c.issues.length&&n.issues.push(...On(o,c.issues)),n.value[s.value]=c.value)}}return a.length?Promise.all(a).then(()=>n):n}}),Nte=N(`$ZodEnum`,(e,t)=>{Sr.init(e,t);let n=ln(t.entries),r=new Set(n);e._zod.values=r,e._zod.pattern=RegExp(`^(${n.filter(e=>mee.has(typeof e)).map(e=>typeof e==`string`?wn(e):e.toString()).join(`|`)})$`),e._zod.parse=(t,i)=>{let a=t.value;return r.has(a)||t.issues.push({code:`invalid_value`,values:n,input:a,inst:e}),t}}),Pte=N(`$ZodLiteral`,(e,t)=>{if(Sr.init(e,t),t.values.length===0)throw Error(`Cannot create literal schema with no valid values`);let n=new Set(t.values);e._zod.values=n,e._zod.pattern=RegExp(`^(${t.values.map(e=>typeof e==`string`?wn(e):e?wn(e.toString()):String(e)).join(`|`)})$`),e._zod.parse=(r,i)=>{let a=r.value;return n.has(a)||r.issues.push({code:`invalid_value`,values:t.values,input:a,inst:e}),r}}),Fte=N(`$ZodTransform`,(e,t)=>{Sr.init(e,t),e._zod.optin=`optional`,e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new on(e.constructor.name);let i=t.transform(n.value,n);if(r.async)return(i instanceof Promise?i:Promise.resolve(i)).then(e=>(n.value=e,n.fallback=!0,n));if(i instanceof Promise)throw new an;return n.value=i,n.fallback=!0,n}});function Fr(e,t){return t===void 0&&(e.issues.length||e.fallback)?{issues:[],value:void 0}:e}const Ir=N(`$ZodOptional`,(e,t)=>{Sr.init(e,t),e._zod.optin=`optional`,e._zod.optout=`optional`,gn(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,void 0]):void 0),gn(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${pn(e.source)})?$`):void 0}),e._zod.parse=(e,n)=>{if(t.innerType._zod.optin===`optional`){let r=e.value,i=t.innerType._zod.run(e,n);return i instanceof Promise?i.then(e=>Fr(e,r)):Fr(i,r)}return e.value===void 0?e:t.innerType._zod.run(e,n)}}),Ite=N(`$ZodExactOptional`,(e,t)=>{Ir.init(e,t),gn(e._zod,`values`,()=>t.innerType._zod.values),gn(e._zod,`pattern`,()=>t.innerType._zod.pattern),e._zod.parse=(e,n)=>t.innerType._zod.run(e,n)}),Lte=N(`$ZodNullable`,(e,t)=>{Sr.init(e,t),gn(e._zod,`optin`,()=>t.innerType._zod.optin),gn(e._zod,`optout`,()=>t.innerType._zod.optout),gn(e._zod,`pattern`,()=>{let e=t.innerType._zod.pattern;return e?RegExp(`^(${pn(e.source)}|null)$`):void 0}),gn(e._zod,`values`,()=>t.innerType._zod.values?new Set([...t.innerType._zod.values,null]):void 0),e._zod.parse=(e,n)=>e.value===null?e:t.innerType._zod.run(e,n)}),Rte=N(`$ZodDefault`,(e,t)=>{Sr.init(e,t),e._zod.optin=`optional`,gn(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);if(e.value===void 0)return e.value=t.defaultValue,e;let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(e=>Lr(e,t)):Lr(r,t)}});function Lr(e,t){return e.value===void 0&&(e.value=t.defaultValue),e}const zte=N(`$ZodPrefault`,(e,t)=>{Sr.init(e,t),e._zod.optin=`optional`,gn(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>(n.direction===`backward`||e.value===void 0&&(e.value=t.defaultValue),t.innerType._zod.run(e,n))}),Bte=N(`$ZodNonOptional`,(e,t)=>{Sr.init(e,t),gn(e._zod,`values`,()=>{let e=t.innerType._zod.values;return e?new Set([...e].filter(e=>e!==void 0)):void 0}),e._zod.parse=(n,r)=>{let i=t.innerType._zod.run(n,r);return i instanceof Promise?i.then(t=>Rr(t,e)):Rr(i,e)}});function Rr(e,t){return!e.issues.length&&e.value===void 0&&e.issues.push({code:`invalid_type`,expected:`nonoptional`,input:e.value,inst:t}),e}const zr=N(`$ZodCatch`,(e,t)=>{Sr.init(e,t),e._zod.optin=`optional`,gn(e._zod,`optout`,()=>t.innerType._zod.optout),gn(e._zod,`values`,()=>t.innerType._zod.values),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(r=>(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>An(e,n,cn()))},input:e.value}),e.issues=[],e.fallback=!0),e)):(e.value=r.value,r.issues.length&&(e.value=t.catchValue({...e,error:{issues:r.issues.map(e=>An(e,n,cn()))},input:e.value}),e.issues=[],e.fallback=!0),e)}}),Br=N(`$ZodPipe`,(e,t)=>{Sr.init(e,t),gn(e._zod,`values`,()=>t.in._zod.values),gn(e._zod,`optin`,()=>t.in._zod.optin),gn(e._zod,`optout`,()=>t.out._zod.optout),gn(e._zod,`propValues`,()=>t.in._zod.propValues),e._zod.parse=(e,n)=>{if(n.direction===`backward`){let r=t.out._zod.run(e,n);return r instanceof Promise?r.then(e=>Vr(e,t.in,n)):Vr(r,t.in,n)}let r=t.in._zod.run(e,n);return r instanceof Promise?r.then(e=>Vr(e,t.out,n)):Vr(r,t.out,n)}});function Vr(e,t,n){return e.issues.length?(e.aborted=!0,e):t._zod.run({value:e.value,issues:e.issues,fallback:e.fallback},n)}const Hr=N(`$ZodPreprocess`,(e,t)=>{Br.init(e,t)}),Ur=N(`$ZodReadonly`,(e,t)=>{Sr.init(e,t),gn(e._zod,`propValues`,()=>t.innerType._zod.propValues),gn(e._zod,`values`,()=>t.innerType._zod.values),gn(e._zod,`optin`,()=>t.innerType?._zod?.optin),gn(e._zod,`optout`,()=>t.innerType?._zod?.optout),e._zod.parse=(e,n)=>{if(n.direction===`backward`)return t.innerType._zod.run(e,n);let r=t.innerType._zod.run(e,n);return r instanceof Promise?r.then(Wr):Wr(r)}});function Wr(e){return e.value=Object.freeze(e.value),e}const Gr=N(`$ZodLazy`,(e,t)=>{Sr.init(e,t),gn(e._zod,`innerType`,()=>{let e=t;return e._cachedInner||=t.getter(),e._cachedInner}),gn(e._zod,`pattern`,()=>e._zod.innerType?._zod?.pattern),gn(e._zod,`propValues`,()=>e._zod.innerType?._zod?.propValues),gn(e._zod,`optin`,()=>e._zod.innerType?._zod?.optin??void 0),gn(e._zod,`optout`,()=>e._zod.innerType?._zod?.optout??void 0),e._zod.parse=(t,n)=>e._zod.innerType._zod.run(t,n)}),Kr=N(`$ZodCustom`,(e,t)=>{_r.init(e,t),Sr.init(e,t),e._zod.parse=(e,t)=>e,e._zod.check=n=>{let r=n.value,i=t.fn(r);if(i instanceof Promise)return i.then(t=>qr(t,n,r,e));qr(i,n,r,e)}});function qr(e,t,n,r){if(!e){let e={code:`custom`,input:n,inst:r,path:[...r._zod.def.path??[]],continue:!r._zod.def.abort};r._zod.def.params&&(e.params=r._zod.def.params),t.issues.push(Mn(e))}}var Jr,Yr=class{constructor(){this._map=new WeakMap,this._idmap=new Map}add(e,...t){let n=t[0];return this._map.set(e,n),n&&typeof n==`object`&&`id`in n&&this._idmap.set(n.id,e),this}clear(){return this._map=new WeakMap,this._idmap=new Map,this}remove(e){let t=this._map.get(e);return t&&typeof t==`object`&&`id`in t&&this._idmap.delete(t.id),this._map.delete(e),this}get(e){let t=e._zod.parent;if(t){let n={...this.get(t)??{}};delete n.id;let r={...n,...this._map.get(e)};return Object.keys(r).length?r:void 0}return this._map.get(e)}has(e){return this._map.has(e)}};function Xr(){return new Yr}(Jr=globalThis).__zod_globalRegistry??(Jr.__zod_globalRegistry=Xr());const Zr=globalThis.__zod_globalRegistry;function Qr(e,t){return new e({type:`string`,...En(t)})}function $r(e,t){return new e({type:`string`,format:`email`,check:`string_format`,abort:!1,...En(t)})}function ei(e,t){return new e({type:`string`,format:`guid`,check:`string_format`,abort:!1,...En(t)})}function ti(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,...En(t)})}function ni(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v4`,...En(t)})}function ri(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v6`,...En(t)})}function ii(e,t){return new e({type:`string`,format:`uuid`,check:`string_format`,abort:!1,version:`v7`,...En(t)})}function ai(e,t){return new e({type:`string`,format:`url`,check:`string_format`,abort:!1,...En(t)})}function oi(e,t){return new e({type:`string`,format:`emoji`,check:`string_format`,abort:!1,...En(t)})}function si(e,t){return new e({type:`string`,format:`nanoid`,check:`string_format`,abort:!1,...En(t)})}function ci(e,t){return new e({type:`string`,format:`cuid`,check:`string_format`,abort:!1,...En(t)})}function li(e,t){return new e({type:`string`,format:`cuid2`,check:`string_format`,abort:!1,...En(t)})}function ui(e,t){return new e({type:`string`,format:`ulid`,check:`string_format`,abort:!1,...En(t)})}function di(e,t){return new e({type:`string`,format:`xid`,check:`string_format`,abort:!1,...En(t)})}function fi(e,t){return new e({type:`string`,format:`ksuid`,check:`string_format`,abort:!1,...En(t)})}function pi(e,t){return new e({type:`string`,format:`ipv4`,check:`string_format`,abort:!1,...En(t)})}function mi(e,t){return new e({type:`string`,format:`ipv6`,check:`string_format`,abort:!1,...En(t)})}function hi(e,t){return new e({type:`string`,format:`cidrv4`,check:`string_format`,abort:!1,...En(t)})}function gi(e,t){return new e({type:`string`,format:`cidrv6`,check:`string_format`,abort:!1,...En(t)})}function _i(e,t){return new e({type:`string`,format:`base64`,check:`string_format`,abort:!1,...En(t)})}function vi(e,t){return new e({type:`string`,format:`base64url`,check:`string_format`,abort:!1,...En(t)})}function yi(e,t){return new e({type:`string`,format:`e164`,check:`string_format`,abort:!1,...En(t)})}function bi(e,t){return new e({type:`string`,format:`jwt`,check:`string_format`,abort:!1,...En(t)})}function xi(e,t){return new e({type:`string`,format:`datetime`,check:`string_format`,offset:!1,local:!1,precision:null,...En(t)})}function Si(e,t){return new e({type:`string`,format:`date`,check:`string_format`,...En(t)})}function Ci(e,t){return new e({type:`string`,format:`time`,check:`string_format`,precision:null,...En(t)})}function wi(e,t){return new e({type:`string`,format:`duration`,check:`string_format`,...En(t)})}function Ti(e,t){return new e({type:`number`,checks:[],...En(t)})}function Ei(e,t){return new e({type:`number`,check:`number_format`,abort:!1,format:`safeint`,...En(t)})}function Di(e,t){return new e({type:`boolean`,...En(t)})}function Oi(e,t){return new e({type:`null`,...En(t)})}function ki(e){return new e({type:`unknown`})}function Ai(e,t){return new e({type:`never`,...En(t)})}function ji(e,t){return new yr({check:`less_than`,...En(t),value:e,inclusive:!1})}function Mi(e,t){return new yr({check:`less_than`,...En(t),value:e,inclusive:!0})}function Ni(e,t){return new br({check:`greater_than`,...En(t),value:e,inclusive:!1})}function Pi(e,t){return new br({check:`greater_than`,...En(t),value:e,inclusive:!0})}function Fi(e,t){return new Lee({check:`multiple_of`,...En(t),value:e})}function Ii(e,t){return new zee({check:`max_length`,...En(t),maximum:e})}function Li(e,t){return new Bee({check:`min_length`,...En(t),minimum:e})}function Ri(e,t){return new Vee({check:`length_equals`,...En(t),length:e})}function zi(e,t){return new Hee({check:`string_format`,format:`regex`,...En(t),pattern:e})}function Bi(e){return new Uee({check:`string_format`,format:`lowercase`,...En(e)})}function Vi(e){return new Wee({check:`string_format`,format:`uppercase`,...En(e)})}function Hi(e,t){return new Gee({check:`string_format`,format:`includes`,...En(t),includes:e})}function Ui(e,t){return new Kee({check:`string_format`,format:`starts_with`,...En(t),prefix:e})}function Wi(e,t){return new qee({check:`string_format`,format:`ends_with`,...En(t),suffix:e})}function Gi(e){return new Jee({check:`overwrite`,tx:e})}function Ki(e){return Gi(t=>t.normalize(e))}function qi(){return Gi(e=>e.trim())}function Ji(){return Gi(e=>e.toLowerCase())}function Yi(){return Gi(e=>e.toUpperCase())}function Xi(){return Gi(e=>fee(e))}function Zi(e,t,n){return new e({type:`array`,element:t,...En(n)})}function Qi(e,t,n){let r=En(n);return r.abort??=!0,new e({type:`custom`,check:`custom`,fn:t,...r})}function $i(e,t,n){return new e({type:`custom`,check:`custom`,fn:t,...En(n)})}function ea(e,t){let n=ta(t=>(t.addIssue=e=>{if(typeof e==`string`)t.issues.push(Mn(e,t.value,n._zod.def));else{let r=e;r.fatal&&(r.continue=!1),r.code??=`custom`,r.input??=t.value,r.inst??=n,r.continue??=!n._zod.def.abort,t.issues.push(Mn(r))}},e(t.value,t)),t);return n}function ta(e,t){let n=new _r({check:`custom`,...En(t)});return n._zod.check=e,n}function na(e){let t=e?.target??`draft-2020-12`;return t===`draft-4`&&(t=`draft-04`),t===`draft-7`&&(t=`draft-07`),{processors:e.processors??{},metadataRegistry:e?.metadata??Zr,target:t,unrepresentable:e?.unrepresentable??`throw`,override:e?.override??(()=>{}),io:e?.io??`output`,counter:0,seen:new Map,cycles:e?.cycles??`ref`,reused:e?.reused??`inline`,external:e?.external??void 0}}function ra(e,t,n={path:[],schemaPath:[]}){var r;let i=e._zod.def,a=t.seen.get(e);if(a)return a.count++,n.schemaPath.includes(e)&&(a.cycle=n.path),a.schema;let o={schema:{},count:1,cycle:void 0,path:n.path};t.seen.set(e,o);let s=e._zod.toJSONSchema?.();if(s)o.schema=s;else{let r={...n,schemaPath:[...n.schemaPath,e],path:n.path};if(e._zod.processJSONSchema)e._zod.processJSONSchema(t,o.schema,r);else{let n=o.schema,a=t.processors[i.type];if(!a)throw Error(`[toJSONSchema]: Non-representable type encountered: ${i.type}`);a(e,t,n,r)}let a=e._zod.parent;a&&(o.ref||=a,ra(a,t,r),t.seen.get(a).isParent=!0)}let c=t.metadataRegistry.get(e);return c&&Object.assign(o.schema,c),t.io===`input`&&oa(e)&&(delete o.schema.examples,delete o.schema.default),t.io===`input`&&`_prefault`in o.schema&&((r=o.schema).default??(r.default=o.schema._prefault)),delete o.schema._prefault,t.seen.get(e).schema}function ia(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=new Map;for(let t of e.seen.entries()){let n=e.metadataRegistry.get(t[0])?.id;if(n){let e=r.get(n);if(e&&e!==t[0])throw Error(`Duplicate schema id "${n}" detected during JSON Schema conversion. Two different schemas cannot share the same id when converted together.`);r.set(n,t[0])}}let i=t=>{let r=e.target===`draft-2020-12`?`$defs`:`definitions`;if(e.external){let n=e.external.registry.get(t[0])?.id,i=e.external.uri??(e=>e);if(n)return{ref:i(n)};let a=t[1].defId??t[1].schema.id??`schema${e.counter++}`;return t[1].defId=a,{defId:a,ref:`${i(`__shared`)}#/${r}/${a}`}}if(t[1]===n)return{ref:`#`};let i=`#/${r}/`,a=t[1].schema.id??`__schema${e.counter++}`;return{defId:a,ref:i+a}},a=e=>{if(e[1].schema.$ref)return;let t=e[1],{ref:n,defId:r}=i(e);t.def={...t.schema},r&&(t.defId=r);let a=t.schema;for(let e in a)delete a[e];a.$ref=n};if(e.cycles===`throw`)for(let t of e.seen.entries()){let e=t[1];if(e.cycle)throw Error(`Cycle detected: #/${e.cycle?.join(`/`)}/<root>
178
178
 
179
- Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function oa(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,`~standard`,{value:{...t[`~standard`],jsonSchema:{input:la(t,`input`,e.processors),output:la(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function sa(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return sa(r.element,n);if(r.type===`set`)return sa(r.valueType,n);if(r.type===`lazy`)return sa(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type===`default`||r.type===`prefault`)return sa(r.innerType,n);if(r.type===`intersection`)return sa(r.left,n)||sa(r.right,n);if(r.type===`record`||r.type===`map`)return sa(r.keyType,n)||sa(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:sa(r.in,n)||sa(r.out,n);if(r.type===`object`){for(let e in r.shape)if(sa(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(sa(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(sa(e,n))return!0;return!!(r.rest&&sa(r.rest,n))}return!1}const ca=(e,t={})=>n=>{let r=ra({...n,processors:t});return ia(e,r),aa(r,e),oa(r,e)},la=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=ra({...i??{},target:a,io:t,processors:n});return ia(e,o),aa(o,e),oa(o,e)},ua={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},da=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=ua[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},fa=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`;let d=typeof u==`number`&&u>=(a??-1/0),f=typeof l==`number`&&l<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(i.multipleOf=c)},pa=(e,t,n,r)=>{n.type=`boolean`},ma=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},ha=(e,t,n,r)=>{n.not={}},ga=(e,t,n,r)=>{let i=e._zod.def,a=ln(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},_a=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},va=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},ya=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},ba=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=ia(a.element,t,{...r,path:[...r.path,`items`]})},xa=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=ia(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=ia(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},Sa=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>ia(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Ca=(e,t,n,r)=>{let i=e._zod.def,a=ia(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=ia(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},wa=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=ia(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else (t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=ia(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=ia(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},Ta=(e,t,n,r)=>{let i=e._zod.def,a=ia(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Ea=(e,t,n,r)=>{let i=e._zod.def;ia(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Da=(e,t,n,r)=>{let i=e._zod.def;ia(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},Oa=(e,t,n,r)=>{let i=e._zod.def;ia(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},ka=(e,t,n,r)=>{let i=e._zod.def;ia(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},Aa=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;ia(o,t,r);let s=t.seen.get(e);s.ref=o},ja=(e,t,n,r)=>{let i=e._zod.def;ia(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},Ma=(e,t,n,r)=>{let i=e._zod.def;ia(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Na=(e,t,n,r)=>{let i=e._zod.innerType;ia(i,t,r);let a=t.seen.get(e);a.ref=i},Pa=N(`ZodISODateTime`,(e,t)=>{cte.init(e,t),oo.init(e,t)});function Fa(e){return Si(Pa,e)}const Ia=N(`ZodISODate`,(e,t)=>{lte.init(e,t),oo.init(e,t)});function La(e){return Ci(Ia,e)}const Ra=N(`ZodISOTime`,(e,t)=>{ute.init(e,t),oo.init(e,t)});function za(e){return wi(Ra,e)}const Ba=N(`ZodISODuration`,(e,t)=>{dte.init(e,t),oo.init(e,t)});function Va(e){return Ti(Ba,e)}const Ha=N(`ZodError`,(e,t)=>{Pn.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>Ln(e,t)},flatten:{value:t=>In(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,un,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,un,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),Ua=Rn(Ha),Wa=zn(Ha),Ga=Bn(Ha),Ka=Hn(Ha),qa=Wn(Ha),Ja=Gn(Ha),Ya=Kn(Ha),Xa=qn(Ha),Za=Jn(Ha),Qa=Yn(Ha),$a=Xn(Ha),eo=Zn(Ha),to=new WeakMap;function no(e,t,n){let r=Object.getPrototypeOf(e),i=to.get(r);if(i||(i=new Set,to.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}const ro=N(`ZodType`,(e,t)=>(Sr.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:la(e,`input`),output:la(e,`output`)}}),e.toJSONSchema=ca(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,`_def`,{value:t}),e.parse=(t,n)=>Ua(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>Ga(e,t,n),e.parseAsync=async(t,n)=>Wa(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>Ka(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>qa(e,t,n),e.decode=(t,n)=>Ja(e,t,n),e.encodeAsync=async(t,n)=>Ya(e,t,n),e.decodeAsync=async(t,n)=>Xa(e,t,n),e.safeEncode=(t,n)=>Za(e,t,n),e.safeDecode=(t,n)=>Qa(e,t,n),e.safeEncodeAsync=async(t,n)=>$a(e,t,n),e.safeDecodeAsync=async(t,n)=>eo(e,t,n),no(e,`ZodType`,{check(...e){let t=this.def;return this.clone(vn(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return Tn(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(wne(e,t))},superRefine(e,t){return this.check(Tne(e,t))},overwrite(e){return this.check(Ki(e))},optional(){return ko(this)},exactOptional(){return dne(this)},nullable(){return Ao(this)},nullish(){return ko(Ao(this))},nonoptional(e){return _ne(this,e)},array(){return R(this)},or(e){return So([this,e])},and(e){return wo(this,e)},transform(e){return No(this,Do(e))},default(e){return mne(this,e)},prefault(e){return gne(this,e)},catch(e){return yne(this,e)},pipe(e){return No(this,e)},readonly(){return Sne(this)},describe(e){let t=this.clone();return Qr.add(t,{description:e}),t},meta(...e){if(e.length===0)return Qr.get(this);let t=this.clone();return Qr.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,`description`,{get(){return Qr.get(e)?.description},configurable:!0}),e)),io=N(`_ZodString`,(e,t)=>{Cr.init(e,t),ro.init(e,t),e._zod.processJSONSchema=(t,n,r)=>da(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,no(e,`_ZodString`,{regex(...e){return this.check(Bi(...e))},includes(...e){return this.check(Ui(...e))},startsWith(...e){return this.check(Wi(...e))},endsWith(...e){return this.check(Gi(...e))},min(...e){return this.check(Ri(...e))},max(...e){return this.check(Li(...e))},length(...e){return this.check(zi(...e))},nonempty(...e){return this.check(Ri(1,...e))},lowercase(e){return this.check(Vi(e))},uppercase(e){return this.check(Hi(e))},trim(){return this.check(Ji())},normalize(...e){return this.check(qi(...e))},toLowerCase(){return this.check(Yi())},toUpperCase(){return this.check(Xi())},slugify(){return this.check(Zi())}})}),ao=N(`ZodString`,(e,t)=>{Cr.init(e,t),io.init(e,t),e.email=t=>e.check(ei(so,t)),e.url=t=>e.check(oi(fo,t)),e.jwt=t=>e.check(xi(Qte,t)),e.emoji=t=>e.check(si(mo,t)),e.guid=t=>e.check(ti(co,t)),e.uuid=t=>e.check(ni(lo,t)),e.uuidv4=t=>e.check(ri(lo,t)),e.uuidv6=t=>e.check(ii(lo,t)),e.uuidv7=t=>e.check(ai(lo,t)),e.nanoid=t=>e.check(ci(ho,t)),e.guid=t=>e.check(ti(co,t)),e.cuid=t=>e.check(li(Bte,t)),e.cuid2=t=>e.check(ui(Vte,t)),e.ulid=t=>e.check(di(Hte,t)),e.base64=t=>e.check(vi(Yte,t)),e.base64url=t=>e.check(yi(Xte,t)),e.xid=t=>e.check(fi(Ute,t)),e.ksuid=t=>e.check(pi(Wte,t)),e.ipv4=t=>e.check(mi(Gte,t)),e.ipv6=t=>e.check(hi(Kte,t)),e.cidrv4=t=>e.check(gi(qte,t)),e.cidrv6=t=>e.check(_i(Jte,t)),e.e164=t=>e.check(bi(Zte,t)),e.datetime=t=>e.check(Fa(t)),e.date=t=>e.check(La(t)),e.time=t=>e.check(za(t)),e.duration=t=>e.check(Va(t))});function P(e){return $r(ao,e)}const oo=N(`ZodStringFormat`,(e,t)=>{wr.init(e,t),io.init(e,t)}),so=N(`ZodEmail`,(e,t)=>{$ee.init(e,t),oo.init(e,t)}),co=N(`ZodGUID`,(e,t)=>{Zee.init(e,t),oo.init(e,t)}),lo=N(`ZodUUID`,(e,t)=>{Qee.init(e,t),oo.init(e,t)});function uo(e){return ni(lo,e)}const fo=N(`ZodURL`,(e,t)=>{ete.init(e,t),oo.init(e,t)});function po(e){return oi(fo,e)}const mo=N(`ZodEmoji`,(e,t)=>{tte.init(e,t),oo.init(e,t)}),ho=N(`ZodNanoID`,(e,t)=>{nte.init(e,t),oo.init(e,t)}),Bte=N(`ZodCUID`,(e,t)=>{rte.init(e,t),oo.init(e,t)}),Vte=N(`ZodCUID2`,(e,t)=>{ite.init(e,t),oo.init(e,t)}),Hte=N(`ZodULID`,(e,t)=>{ate.init(e,t),oo.init(e,t)}),Ute=N(`ZodXID`,(e,t)=>{ote.init(e,t),oo.init(e,t)}),Wte=N(`ZodKSUID`,(e,t)=>{ste.init(e,t),oo.init(e,t)}),Gte=N(`ZodIPv4`,(e,t)=>{fte.init(e,t),oo.init(e,t)}),Kte=N(`ZodIPv6`,(e,t)=>{pte.init(e,t),oo.init(e,t)}),qte=N(`ZodCIDRv4`,(e,t)=>{mte.init(e,t),oo.init(e,t)}),Jte=N(`ZodCIDRv6`,(e,t)=>{hte.init(e,t),oo.init(e,t)}),Yte=N(`ZodBase64`,(e,t)=>{gte.init(e,t),oo.init(e,t)}),Xte=N(`ZodBase64URL`,(e,t)=>{vte.init(e,t),oo.init(e,t)}),Zte=N(`ZodE164`,(e,t)=>{yte.init(e,t),oo.init(e,t)}),Qte=N(`ZodJWT`,(e,t)=>{xte.init(e,t),oo.init(e,t)}),go=N(`ZodNumber`,(e,t)=>{Er.init(e,t),ro.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fa(e,t,n,r),no(e,`ZodNumber`,{gt(e,t){return this.check(Pi(e,t))},gte(e,t){return this.check(Fi(e,t))},min(e,t){return this.check(Fi(e,t))},lt(e,t){return this.check(Mi(e,t))},lte(e,t){return this.check(Ni(e,t))},max(e,t){return this.check(Ni(e,t))},int(e){return this.check(_o(e))},safe(e){return this.check(_o(e))},positive(e){return this.check(Pi(0,e))},nonnegative(e){return this.check(Fi(0,e))},negative(e){return this.check(Mi(0,e))},nonpositive(e){return this.check(Ni(0,e))},multipleOf(e,t){return this.check(Ii(e,t))},step(e,t){return this.check(Ii(e,t))},finite(){return this}});let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function F(e){return Ei(go,e)}const $te=N(`ZodNumberFormat`,(e,t)=>{Ste.init(e,t),go.init(e,t)});function _o(e){return Di($te,e)}const ene=N(`ZodBoolean`,(e,t)=>{Cte.init(e,t),ro.init(e,t),e._zod.processJSONSchema=(t,n,r)=>pa(e,t,n,r)});function I(e){return Oi(ene,e)}const tne=N(`ZodNull`,(e,t)=>{wte.init(e,t),ro.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ma(e,t,n,r)});function vo(e){return ki(tne,e)}const nne=N(`ZodUnknown`,(e,t)=>{Tte.init(e,t),ro.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function L(){return Ai(nne)}const rne=N(`ZodNever`,(e,t)=>{Ete.init(e,t),ro.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ha(e,t,n,r)});function ine(e){return ji(rne,e)}const ane=N(`ZodArray`,(e,t)=>{Dte.init(e,t),ro.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ba(e,t,n,r),e.element=t.element,no(e,`ZodArray`,{min(e,t){return this.check(Ri(e,t))},nonempty(e){return this.check(Ri(1,e))},max(e,t){return this.check(Li(e,t))},length(e,t){return this.check(zi(e,t))},unwrap(){return this.element}})});function R(e,t){return Qi(ane,e,t)}const yo=N(`ZodObject`,(e,t)=>{kte.init(e,t),ro.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xa(e,t,n,r),gn(e,`shape`,()=>t.shape),no(e,`ZodObject`,{keyof(){return V(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:L()})},loose(){return this.clone({...this._zod.def,catchall:L()})},strict(){return this.clone({...this._zod.def,catchall:ine()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return yee(this,e)},safeExtend(e){return bee(this,e)},merge(e){return xee(this,e)},pick(e){return _ee(this,e)},omit(e){return vee(this,e)},partial(...e){return See(Oo,this,e[0])},required(...e){return Cee(jo,this,e[0])}})});function z(e,t){return new yo({type:`object`,shape:e??{},...En(t)})}function bo(e,t){return new yo({type:`object`,shape:e,catchall:L(),...En(t)})}const xo=N(`ZodUnion`,(e,t)=>{Mr.init(e,t),ro.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Sa(e,t,n,r),e.options=t.options});function So(e,t){return new xo({type:`union`,options:e,...En(t)})}const one=N(`ZodDiscriminatedUnion`,(e,t)=>{xo.init(e,t),Ate.init(e,t)});function Co(e,t,n){return new one({type:`union`,options:t,discriminator:e,...En(n)})}const sne=N(`ZodIntersection`,(e,t)=>{jte.init(e,t),ro.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ca(e,t,n,r)});function wo(e,t){return new sne({type:`intersection`,left:e,right:t})}const To=N(`ZodRecord`,(e,t)=>{Mte.init(e,t),ro.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wa(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function B(e,t,n){return!t||!t._zod?new To({type:`record`,keyType:P(),valueType:e,...En(t)}):new To({type:`record`,keyType:e,valueType:t,...En(n)})}const Eo=N(`ZodEnum`,(e,t)=>{Nte.init(e,t),ro.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ga(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new Eo({...t,checks:[],...En(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new Eo({...t,checks:[],...En(r),entries:i})}});function V(e,t){return new Eo({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...En(t)})}const cne=N(`ZodLiteral`,(e,t)=>{Pte.init(e,t),ro.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_a(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,`value`,{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function H(e,t){return new cne({type:`literal`,values:Array.isArray(e)?e:[e],...En(t)})}const lne=N(`ZodTransform`,(e,t)=>{Fte.init(e,t),ro.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ya(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new on(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Mn(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(Mn(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function Do(e){return new lne({type:`transform`,transform:e})}const Oo=N(`ZodOptional`,(e,t)=>{Ir.init(e,t),ro.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ma(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ko(e){return new Oo({type:`optional`,innerType:e})}const une=N(`ZodExactOptional`,(e,t)=>{Ite.init(e,t),ro.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ma(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function dne(e){return new une({type:`optional`,innerType:e})}const fne=N(`ZodNullable`,(e,t)=>{Lte.init(e,t),ro.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ta(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ao(e){return new fne({type:`nullable`,innerType:e})}const pne=N(`ZodDefault`,(e,t)=>{Rte.init(e,t),ro.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Da(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function mne(e,t){return new pne({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():Cn(t)}})}const hne=N(`ZodPrefault`,(e,t)=>{zte.init(e,t),ro.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Oa(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function gne(e,t){return new hne({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():Cn(t)}})}const jo=N(`ZodNonOptional`,(e,t)=>{Rr.init(e,t),ro.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ea(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function _ne(e,t){return new jo({type:`nonoptional`,innerType:e,...En(t)})}const vne=N(`ZodCatch`,(e,t)=>{Br.init(e,t),ro.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ka(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function yne(e,t){return new vne({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}const Mo=N(`ZodPipe`,(e,t)=>{Vr.init(e,t),ro.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Aa(e,t,n,r),e.in=t.in,e.out=t.out});function No(e,t){return new Mo({type:`pipe`,in:e,out:t})}const bne=N(`ZodPreprocess`,(e,t)=>{Mo.init(e,t),Ur.init(e,t)}),xne=N(`ZodReadonly`,(e,t)=>{Wr.init(e,t),ro.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ja(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Sne(e){return new xne({type:`readonly`,innerType:e})}const Cne=N(`ZodLazy`,(e,t)=>{Kr.init(e,t),ro.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Na(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function Po(e){return new Cne({type:`lazy`,getter:e})}const Fo=N(`ZodCustom`,(e,t)=>{qr.init(e,t),ro.init(e,t),e._zod.processJSONSchema=(t,n,r)=>va(e,t,n,r)});function Io(e,t){return $i(Fo,e??(()=>!0),t)}function wne(e,t={}){return ea(Fo,e,t)}function Tne(e,t){return ta(e,t)}function Lo(e,t){return new bne({type:`pipe`,in:Do(e),out:t})}const Ene=bo({at:P(),transport:P(),outcome:P(),reference:P().optional(),error:P().optional()}),Dne=bo({reason:P(),at:P()});bo({version:F().int().catch(1),id:P(),createdAt:P(),bundleLevel:P(),zipBytes:F().int().nonnegative().catch(0),zipDeleted:I().optional(),state:P(),systemWide:I().optional(),projectSlug:P().nullable().optional(),reference:P().optional(),lastError:Dne.optional(),attempts:R(Ene).optional(),note:P().optional()});const Ro=[{name:`macos-home-path`,regex:/\/Users\/[^/]+\//g,replacement:`~/`},{name:`linux-home-path`,regex:/\/home\/[^/]+\//g,replacement:`~/`},{name:`github-pat`,regex:/\b(ghp_|gho_|ghu_|ghs_|ghr_)[A-Za-z0-9]{36,}\b/g,replacement:`[REDACTED-GH-PAT]`},{name:`aws-access-key`,regex:/\b(AKIA|ASIA|ABIA)[A-Z2-7]{16}\b/g,replacement:`[REDACTED-AWS-KEY]`},{name:`anthropic-key`,regex:/\bsk-ant-api03-[A-Za-z0-9_-]{20,}\b/g,replacement:`[REDACTED-ANTHROPIC]`},{name:`openai-key`,regex:/\bsk-[A-Za-z0-9]{20,}\b/g,replacement:`[REDACTED-OPENAI]`},{name:`bearer-token`,regex:/([Aa]uthorization:\s*[Bb]earer\s+)\S+/g,replacement:`$1[REDACTED]`},{name:`jwt`,regex:/eyJ[A-Za-z0-9_-]{8,}\.eyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}/g,replacement:`[REDACTED-JWT]`},{name:`url-credentials`,regex:/:\/\/[^/\s:@]+:[^/\s:@]+@/g,replacement:`://[REDACTED]@`},{name:`github-pat-fine-grained`,regex:/\bgithub_pat_[0-9A-Za-z_]{20,}/g,replacement:`[REDACTED-GH-PAT]`},{name:`openai-key-modern`,regex:/\bsk-(?:proj|svcacct|admin|None)-[A-Za-z0-9_-]{20,}/g,replacement:`[REDACTED-OPENAI]`},{name:`slack-token`,regex:/\bxox[a-z]-[A-Za-z0-9-]{10,}/g,replacement:`[REDACTED-SLACK]`},{name:`google-api-key`,regex:/\bAIza[0-9A-Za-z_-]{35}/g,replacement:`[REDACTED-GOOGLE]`},{name:`stripe-secret-key`,regex:/\b(?:sk|rk)_live_[0-9A-Za-z]{16,}\b/g,replacement:`[REDACTED-STRIPE]`},{name:`gitlab-pat`,regex:/\bglpat-[0-9A-Za-z_-]{20,}/g,replacement:`[REDACTED-GITLAB]`},{name:`bearer-token-json`,regex:/("[Aa]uthorization"\s*:\s*"[Bb]earer\s+)[^"]+/g,replacement:`$1[REDACTED]`}],One=Ro.map(e=>e.name);function zo(e){let t=new Set,n=0;return{redacted:e.split(`
179
+ Set the \`cycles\` parameter to \`"ref"\` to resolve cyclical schemas with defs.`)}for(let n of e.seen.entries()){let r=n[1];if(t===n[0]){a(n);continue}if(e.external){let r=e.external.registry.get(n[0])?.id;if(t!==n[0]&&r){a(n);continue}}if(e.metadataRegistry.get(n[0])?.id){a(n);continue}if(r.cycle){a(n);continue}if(r.count>1&&e.reused===`ref`){a(n);continue}}}function aa(e,t){let n=e.seen.get(t);if(!n)throw Error(`Unprocessed schema. This is a bug in Zod.`);let r=t=>{let n=e.seen.get(t);if(n.ref===null)return;let i=n.def??n.schema,a={...i},o=n.ref;if(n.ref=null,o){r(o);let n=e.seen.get(o),s=n.schema;if(s.$ref&&(e.target===`draft-07`||e.target===`draft-04`||e.target===`openapi-3.0`)?(i.allOf=i.allOf??[],i.allOf.push(s)):Object.assign(i,s),Object.assign(i,a),t._zod.parent===o)for(let e in i)e===`$ref`||e===`allOf`||e in a||delete i[e];if(s.$ref&&n.def)for(let e in i)e===`$ref`||e===`allOf`||e in n.def&&JSON.stringify(i[e])===JSON.stringify(n.def[e])&&delete i[e]}let s=t._zod.parent;if(s&&s!==o){r(s);let t=e.seen.get(s);if(t?.schema.$ref&&(i.$ref=t.schema.$ref,t.def))for(let e in i)e===`$ref`||e===`allOf`||e in t.def&&JSON.stringify(i[e])===JSON.stringify(t.def[e])&&delete i[e]}e.override({zodSchema:t,jsonSchema:i,path:n.path??[]})};for(let t of[...e.seen.entries()].reverse())r(t[0]);let i={};if(e.target===`draft-2020-12`?i.$schema=`https://json-schema.org/draft/2020-12/schema`:e.target===`draft-07`?i.$schema=`http://json-schema.org/draft-07/schema#`:e.target===`draft-04`?i.$schema=`http://json-schema.org/draft-04/schema#`:e.target,e.external?.uri){let n=e.external.registry.get(t)?.id;if(!n)throw Error("Schema is missing an `id` property");i.$id=e.external.uri(n)}Object.assign(i,n.def??n.schema);let a=e.metadataRegistry.get(t)?.id;a!==void 0&&i.id===a&&delete i.id;let o=e.external?.defs??{};for(let t of e.seen.entries()){let e=t[1];e.def&&e.defId&&(e.def.id===e.defId&&delete e.def.id,o[e.defId]=e.def)}e.external||Object.keys(o).length>0&&(e.target===`draft-2020-12`?i.$defs=o:i.definitions=o);try{let n=JSON.parse(JSON.stringify(i));return Object.defineProperty(n,`~standard`,{value:{...t[`~standard`],jsonSchema:{input:ca(t,`input`,e.processors),output:ca(t,`output`,e.processors)}},enumerable:!1,writable:!1}),n}catch{throw Error(`Error converting schema to JSON.`)}}function oa(e,t){let n=t??{seen:new Set};if(n.seen.has(e))return!1;n.seen.add(e);let r=e._zod.def;if(r.type===`transform`)return!0;if(r.type===`array`)return oa(r.element,n);if(r.type===`set`)return oa(r.valueType,n);if(r.type===`lazy`)return oa(r.getter(),n);if(r.type===`promise`||r.type===`optional`||r.type===`nonoptional`||r.type===`nullable`||r.type===`readonly`||r.type===`default`||r.type===`prefault`)return oa(r.innerType,n);if(r.type===`intersection`)return oa(r.left,n)||oa(r.right,n);if(r.type===`record`||r.type===`map`)return oa(r.keyType,n)||oa(r.valueType,n);if(r.type===`pipe`)return e._zod.traits.has(`$ZodCodec`)?!0:oa(r.in,n)||oa(r.out,n);if(r.type===`object`){for(let e in r.shape)if(oa(r.shape[e],n))return!0;return!1}if(r.type===`union`){for(let e of r.options)if(oa(e,n))return!0;return!1}if(r.type===`tuple`){for(let e of r.items)if(oa(e,n))return!0;return!!(r.rest&&oa(r.rest,n))}return!1}const sa=(e,t={})=>n=>{let r=na({...n,processors:t});return ra(e,r),ia(r,e),aa(r,e)},ca=(e,t,n={})=>r=>{let{libraryOptions:i,target:a}=r??{},o=na({...i??{},target:a,io:t,processors:n});return ra(e,o),ia(o,e),aa(o,e)},la={guid:`uuid`,url:`uri`,datetime:`date-time`,json_string:`json-string`,regex:``},ua=(e,t,n,r)=>{let i=n;i.type=`string`;let{minimum:a,maximum:o,format:s,patterns:c,contentEncoding:l}=e._zod.bag;if(typeof a==`number`&&(i.minLength=a),typeof o==`number`&&(i.maxLength=o),s&&(i.format=la[s]??s,i.format===``&&delete i.format,s===`time`&&delete i.format),l&&(i.contentEncoding=l),c&&c.size>0){let e=[...c];e.length===1?i.pattern=e[0].source:e.length>1&&(i.allOf=[...e.map(e=>({...t.target===`draft-07`||t.target===`draft-04`||t.target===`openapi-3.0`?{type:`string`}:{},pattern:e.source}))])}},da=(e,t,n,r)=>{let i=n,{minimum:a,maximum:o,format:s,multipleOf:c,exclusiveMaximum:l,exclusiveMinimum:u}=e._zod.bag;typeof s==`string`&&s.includes(`int`)?i.type=`integer`:i.type=`number`;let d=typeof u==`number`&&u>=(a??-1/0),f=typeof l==`number`&&l<=(o??1/0),p=t.target===`draft-04`||t.target===`openapi-3.0`;d?p?(i.minimum=u,i.exclusiveMinimum=!0):i.exclusiveMinimum=u:typeof a==`number`&&(i.minimum=a),f?p?(i.maximum=l,i.exclusiveMaximum=!0):i.exclusiveMaximum=l:typeof o==`number`&&(i.maximum=o),typeof c==`number`&&(i.multipleOf=c)},fa=(e,t,n,r)=>{n.type=`boolean`},pa=(e,t,n,r)=>{t.target===`openapi-3.0`?(n.type=`string`,n.nullable=!0,n.enum=[null]):n.type=`null`},ma=(e,t,n,r)=>{n.not={}},ha=(e,t,n,r)=>{let i=e._zod.def,a=ln(i.entries);a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),n.enum=a},ga=(e,t,n,r)=>{let i=e._zod.def,a=[];for(let e of i.values)if(e===void 0){if(t.unrepresentable===`throw`)throw Error("Literal `undefined` cannot be represented in JSON Schema")}else if(typeof e==`bigint`){if(t.unrepresentable===`throw`)throw Error(`BigInt literals cannot be represented in JSON Schema`);a.push(Number(e))}else a.push(e);if(a.length!==0)if(a.length===1){let e=a[0];n.type=e===null?`null`:typeof e,t.target===`draft-04`||t.target===`openapi-3.0`?n.enum=[e]:n.const=e}else a.every(e=>typeof e==`number`)&&(n.type=`number`),a.every(e=>typeof e==`string`)&&(n.type=`string`),a.every(e=>typeof e==`boolean`)&&(n.type=`boolean`),a.every(e=>e===null)&&(n.type=`null`),n.enum=a},_a=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Custom types cannot be represented in JSON Schema`)},va=(e,t,n,r)=>{if(t.unrepresentable===`throw`)throw Error(`Transforms cannot be represented in JSON Schema`)},ya=(e,t,n,r)=>{let i=n,a=e._zod.def,{minimum:o,maximum:s}=e._zod.bag;typeof o==`number`&&(i.minItems=o),typeof s==`number`&&(i.maxItems=s),i.type=`array`,i.items=ra(a.element,t,{...r,path:[...r.path,`items`]})},ba=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`,i.properties={};let o=a.shape;for(let e in o)i.properties[e]=ra(o[e],t,{...r,path:[...r.path,`properties`,e]});let s=new Set(Object.keys(o)),c=new Set([...s].filter(e=>{let n=a.shape[e]._zod;return t.io===`input`?n.optin===void 0:n.optout===void 0}));c.size>0&&(i.required=Array.from(c)),a.catchall?._zod.def.type===`never`?i.additionalProperties=!1:a.catchall?a.catchall&&(i.additionalProperties=ra(a.catchall,t,{...r,path:[...r.path,`additionalProperties`]})):t.io===`output`&&(i.additionalProperties=!1)},xa=(e,t,n,r)=>{let i=e._zod.def,a=i.inclusive===!1,o=i.options.map((e,n)=>ra(e,t,{...r,path:[...r.path,a?`oneOf`:`anyOf`,n]}));a?n.oneOf=o:n.anyOf=o},Sa=(e,t,n,r)=>{let i=e._zod.def,a=ra(i.left,t,{...r,path:[...r.path,`allOf`,0]}),o=ra(i.right,t,{...r,path:[...r.path,`allOf`,1]}),s=e=>`allOf`in e&&Object.keys(e).length===1;n.allOf=[...s(a)?a.allOf:[a],...s(o)?o.allOf:[o]]},Ca=(e,t,n,r)=>{let i=n,a=e._zod.def;i.type=`object`;let o=a.keyType,s=o._zod.bag?.patterns;if(a.mode===`loose`&&s&&s.size>0){let e=ra(a.valueType,t,{...r,path:[...r.path,`patternProperties`,`*`]});i.patternProperties={};for(let t of s)i.patternProperties[t.source]=e}else (t.target===`draft-07`||t.target===`draft-2020-12`)&&(i.propertyNames=ra(a.keyType,t,{...r,path:[...r.path,`propertyNames`]})),i.additionalProperties=ra(a.valueType,t,{...r,path:[...r.path,`additionalProperties`]});let c=o._zod.values;if(c){let e=[...c].filter(e=>typeof e==`string`||typeof e==`number`);e.length>0&&(i.required=e)}},wa=(e,t,n,r)=>{let i=e._zod.def,a=ra(i.innerType,t,r),o=t.seen.get(e);t.target===`openapi-3.0`?(o.ref=i.innerType,n.nullable=!0):n.anyOf=[a,{type:`null`}]},Ta=(e,t,n,r)=>{let i=e._zod.def;ra(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Ea=(e,t,n,r)=>{let i=e._zod.def;ra(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.default=JSON.parse(JSON.stringify(i.defaultValue))},Da=(e,t,n,r)=>{let i=e._zod.def;ra(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,t.io===`input`&&(n._prefault=JSON.parse(JSON.stringify(i.defaultValue)))},Oa=(e,t,n,r)=>{let i=e._zod.def;ra(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType;let o;try{o=i.catchValue(void 0)}catch{throw Error(`Dynamic catch values are not supported in JSON Schema`)}n.default=o},ka=(e,t,n,r)=>{let i=e._zod.def,a=i.in._zod.traits.has(`$ZodTransform`),o=t.io===`input`?a?i.out:i.in:i.out;ra(o,t,r);let s=t.seen.get(e);s.ref=o},Aa=(e,t,n,r)=>{let i=e._zod.def;ra(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType,n.readOnly=!0},ja=(e,t,n,r)=>{let i=e._zod.def;ra(i.innerType,t,r);let a=t.seen.get(e);a.ref=i.innerType},Ma=(e,t,n,r)=>{let i=e._zod.innerType;ra(i,t,r);let a=t.seen.get(e);a.ref=i},Na=N(`ZodISODateTime`,(e,t)=>{cte.init(e,t),ao.init(e,t)});function Pa(e){return xi(Na,e)}const Fa=N(`ZodISODate`,(e,t)=>{lte.init(e,t),ao.init(e,t)});function Ia(e){return Si(Fa,e)}const La=N(`ZodISOTime`,(e,t)=>{ute.init(e,t),ao.init(e,t)});function Ra(e){return Ci(La,e)}const za=N(`ZodISODuration`,(e,t)=>{dte.init(e,t),ao.init(e,t)});function Ba(e){return wi(za,e)}const Va=N(`ZodError`,(e,t)=>{Pn.init(e,t),e.name=`ZodError`,Object.defineProperties(e,{format:{value:t=>Ln(e,t)},flatten:{value:t=>In(e,t)},addIssue:{value:t=>{e.issues.push(t),e.message=JSON.stringify(e.issues,un,2)}},addIssues:{value:t=>{e.issues.push(...t),e.message=JSON.stringify(e.issues,un,2)}},isEmpty:{get(){return e.issues.length===0}}})},{Parent:Error}),Ha=Rn(Va),Ua=zn(Va),Wa=Bn(Va),Ga=Hn(Va),Ka=Wn(Va),qa=Gn(Va),Ja=Kn(Va),Ya=qn(Va),Xa=Jn(Va),Za=Yn(Va),Qa=Xn(Va),$a=Zn(Va),eo=new WeakMap;function to(e,t,n){let r=Object.getPrototypeOf(e),i=eo.get(r);if(i||(i=new Set,eo.set(r,i)),!i.has(t)){i.add(t);for(let e in n){let t=n[e];Object.defineProperty(r,e,{configurable:!0,enumerable:!1,get(){let n=t.bind(this);return Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:n}),n},set(t){Object.defineProperty(this,e,{configurable:!0,writable:!0,enumerable:!0,value:t})}})}}}const no=N(`ZodType`,(e,t)=>(Sr.init(e,t),Object.assign(e[`~standard`],{jsonSchema:{input:ca(e,`input`),output:ca(e,`output`)}}),e.toJSONSchema=sa(e,{}),e.def=t,e.type=t.type,Object.defineProperty(e,`_def`,{value:t}),e.parse=(t,n)=>Ha(e,t,n,{callee:e.parse}),e.safeParse=(t,n)=>Wa(e,t,n),e.parseAsync=async(t,n)=>Ua(e,t,n,{callee:e.parseAsync}),e.safeParseAsync=async(t,n)=>Ga(e,t,n),e.spa=e.safeParseAsync,e.encode=(t,n)=>Ka(e,t,n),e.decode=(t,n)=>qa(e,t,n),e.encodeAsync=async(t,n)=>Ja(e,t,n),e.decodeAsync=async(t,n)=>Ya(e,t,n),e.safeEncode=(t,n)=>Xa(e,t,n),e.safeDecode=(t,n)=>Za(e,t,n),e.safeEncodeAsync=async(t,n)=>Qa(e,t,n),e.safeDecodeAsync=async(t,n)=>$a(e,t,n),to(e,`ZodType`,{check(...e){let t=this.def;return this.clone(vn(t,{checks:[...t.checks??[],...e.map(e=>typeof e==`function`?{_zod:{check:e,def:{check:`custom`},onattach:[]}}:e)]}),{parent:!0})},with(...e){return this.check(...e)},clone(e,t){return Tn(this,e,t)},brand(){return this},register(e,t){return e.add(this,t),this},refine(e,t){return this.check(wne(e,t))},superRefine(e,t){return this.check(Tne(e,t))},overwrite(e){return this.check(Gi(e))},optional(){return ko(this)},exactOptional(){return dne(this)},nullable(){return Ao(this)},nullish(){return ko(Ao(this))},nonoptional(e){return _ne(this,e)},array(){return R(this)},or(e){return So([this,e])},and(e){return wo(this,e)},transform(e){return No(this,Do(e))},default(e){return mne(this,e)},prefault(e){return gne(this,e)},catch(e){return yne(this,e)},pipe(e){return No(this,e)},readonly(){return Sne(this)},describe(e){let t=this.clone();return Zr.add(t,{description:e}),t},meta(...e){if(e.length===0)return Zr.get(this);let t=this.clone();return Zr.add(t,e[0]),t},isOptional(){return this.safeParse(void 0).success},isNullable(){return this.safeParse(null).success},apply(e){return e(this)}}),Object.defineProperty(e,`description`,{get(){return Zr.get(e)?.description},configurable:!0}),e)),ro=N(`_ZodString`,(e,t)=>{Cr.init(e,t),no.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ua(e,t,n,r);let n=e._zod.bag;e.format=n.format??null,e.minLength=n.minimum??null,e.maxLength=n.maximum??null,to(e,`_ZodString`,{regex(...e){return this.check(zi(...e))},includes(...e){return this.check(Hi(...e))},startsWith(...e){return this.check(Ui(...e))},endsWith(...e){return this.check(Wi(...e))},min(...e){return this.check(Li(...e))},max(...e){return this.check(Ii(...e))},length(...e){return this.check(Ri(...e))},nonempty(...e){return this.check(Li(1,...e))},lowercase(e){return this.check(Bi(e))},uppercase(e){return this.check(Vi(e))},trim(){return this.check(qi())},normalize(...e){return this.check(Ki(...e))},toLowerCase(){return this.check(Ji())},toUpperCase(){return this.check(Yi())},slugify(){return this.check(Xi())}})}),io=N(`ZodString`,(e,t)=>{Cr.init(e,t),ro.init(e,t),e.email=t=>e.check($r(oo,t)),e.url=t=>e.check(ai(uo,t)),e.jwt=t=>e.check(bi(Qte,t)),e.emoji=t=>e.check(oi(po,t)),e.guid=t=>e.check(ei(so,t)),e.uuid=t=>e.check(ti(co,t)),e.uuidv4=t=>e.check(ni(co,t)),e.uuidv6=t=>e.check(ri(co,t)),e.uuidv7=t=>e.check(ii(co,t)),e.nanoid=t=>e.check(si(mo,t)),e.guid=t=>e.check(ei(so,t)),e.cuid=t=>e.check(ci(ho,t)),e.cuid2=t=>e.check(li(Vte,t)),e.ulid=t=>e.check(ui(Hte,t)),e.base64=t=>e.check(_i(Yte,t)),e.base64url=t=>e.check(vi(Xte,t)),e.xid=t=>e.check(di(Ute,t)),e.ksuid=t=>e.check(fi(Wte,t)),e.ipv4=t=>e.check(pi(Gte,t)),e.ipv6=t=>e.check(mi(Kte,t)),e.cidrv4=t=>e.check(hi(qte,t)),e.cidrv6=t=>e.check(gi(Jte,t)),e.e164=t=>e.check(yi(Zte,t)),e.datetime=t=>e.check(Pa(t)),e.date=t=>e.check(Ia(t)),e.time=t=>e.check(Ra(t)),e.duration=t=>e.check(Ba(t))});function P(e){return Qr(io,e)}const ao=N(`ZodStringFormat`,(e,t)=>{wr.init(e,t),ro.init(e,t)}),oo=N(`ZodEmail`,(e,t)=>{$ee.init(e,t),ao.init(e,t)}),so=N(`ZodGUID`,(e,t)=>{Zee.init(e,t),ao.init(e,t)}),co=N(`ZodUUID`,(e,t)=>{Qee.init(e,t),ao.init(e,t)});function lo(e){return ti(co,e)}const uo=N(`ZodURL`,(e,t)=>{ete.init(e,t),ao.init(e,t)});function fo(e){return ai(uo,e)}const po=N(`ZodEmoji`,(e,t)=>{tte.init(e,t),ao.init(e,t)}),mo=N(`ZodNanoID`,(e,t)=>{nte.init(e,t),ao.init(e,t)}),ho=N(`ZodCUID`,(e,t)=>{rte.init(e,t),ao.init(e,t)}),Vte=N(`ZodCUID2`,(e,t)=>{ite.init(e,t),ao.init(e,t)}),Hte=N(`ZodULID`,(e,t)=>{ate.init(e,t),ao.init(e,t)}),Ute=N(`ZodXID`,(e,t)=>{ote.init(e,t),ao.init(e,t)}),Wte=N(`ZodKSUID`,(e,t)=>{ste.init(e,t),ao.init(e,t)}),Gte=N(`ZodIPv4`,(e,t)=>{fte.init(e,t),ao.init(e,t)}),Kte=N(`ZodIPv6`,(e,t)=>{pte.init(e,t),ao.init(e,t)}),qte=N(`ZodCIDRv4`,(e,t)=>{mte.init(e,t),ao.init(e,t)}),Jte=N(`ZodCIDRv6`,(e,t)=>{hte.init(e,t),ao.init(e,t)}),Yte=N(`ZodBase64`,(e,t)=>{gte.init(e,t),ao.init(e,t)}),Xte=N(`ZodBase64URL`,(e,t)=>{vte.init(e,t),ao.init(e,t)}),Zte=N(`ZodE164`,(e,t)=>{yte.init(e,t),ao.init(e,t)}),Qte=N(`ZodJWT`,(e,t)=>{xte.init(e,t),ao.init(e,t)}),go=N(`ZodNumber`,(e,t)=>{Er.init(e,t),no.init(e,t),e._zod.processJSONSchema=(t,n,r)=>da(e,t,n,r),to(e,`ZodNumber`,{gt(e,t){return this.check(Ni(e,t))},gte(e,t){return this.check(Pi(e,t))},min(e,t){return this.check(Pi(e,t))},lt(e,t){return this.check(ji(e,t))},lte(e,t){return this.check(Mi(e,t))},max(e,t){return this.check(Mi(e,t))},int(e){return this.check(_o(e))},safe(e){return this.check(_o(e))},positive(e){return this.check(Ni(0,e))},nonnegative(e){return this.check(Pi(0,e))},negative(e){return this.check(ji(0,e))},nonpositive(e){return this.check(Mi(0,e))},multipleOf(e,t){return this.check(Fi(e,t))},step(e,t){return this.check(Fi(e,t))},finite(){return this}});let n=e._zod.bag;e.minValue=Math.max(n.minimum??-1/0,n.exclusiveMinimum??-1/0)??null,e.maxValue=Math.min(n.maximum??1/0,n.exclusiveMaximum??1/0)??null,e.isInt=(n.format??``).includes(`int`)||Number.isSafeInteger(n.multipleOf??.5),e.isFinite=!0,e.format=n.format??null});function F(e){return Ti(go,e)}const $te=N(`ZodNumberFormat`,(e,t)=>{Ste.init(e,t),go.init(e,t)});function _o(e){return Ei($te,e)}const ene=N(`ZodBoolean`,(e,t)=>{Cte.init(e,t),no.init(e,t),e._zod.processJSONSchema=(t,n,r)=>fa(e,t,n,r)});function I(e){return Di(ene,e)}const tne=N(`ZodNull`,(e,t)=>{wte.init(e,t),no.init(e,t),e._zod.processJSONSchema=(t,n,r)=>pa(e,t,n,r)});function vo(e){return Oi(tne,e)}const nne=N(`ZodUnknown`,(e,t)=>{Tte.init(e,t),no.init(e,t),e._zod.processJSONSchema=(e,t,n)=>void 0});function L(){return ki(nne)}const rne=N(`ZodNever`,(e,t)=>{Ete.init(e,t),no.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ma(e,t,n,r)});function ine(e){return Ai(rne,e)}const ane=N(`ZodArray`,(e,t)=>{Dte.init(e,t),no.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ya(e,t,n,r),e.element=t.element,to(e,`ZodArray`,{min(e,t){return this.check(Li(e,t))},nonempty(e){return this.check(Li(1,e))},max(e,t){return this.check(Ii(e,t))},length(e,t){return this.check(Ri(e,t))},unwrap(){return this.element}})});function R(e,t){return Zi(ane,e,t)}const yo=N(`ZodObject`,(e,t)=>{kte.init(e,t),no.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ba(e,t,n,r),gn(e,`shape`,()=>t.shape),to(e,`ZodObject`,{keyof(){return V(Object.keys(this._zod.def.shape))},catchall(e){return this.clone({...this._zod.def,catchall:e})},passthrough(){return this.clone({...this._zod.def,catchall:L()})},loose(){return this.clone({...this._zod.def,catchall:L()})},strict(){return this.clone({...this._zod.def,catchall:ine()})},strip(){return this.clone({...this._zod.def,catchall:void 0})},extend(e){return yee(this,e)},safeExtend(e){return bee(this,e)},merge(e){return xee(this,e)},pick(e){return _ee(this,e)},omit(e){return vee(this,e)},partial(...e){return See(Oo,this,e[0])},required(...e){return Cee(jo,this,e[0])}})});function z(e,t){return new yo({type:`object`,shape:e??{},...En(t)})}function bo(e,t){return new yo({type:`object`,shape:e,catchall:L(),...En(t)})}const xo=N(`ZodUnion`,(e,t)=>{Mr.init(e,t),no.init(e,t),e._zod.processJSONSchema=(t,n,r)=>xa(e,t,n,r),e.options=t.options});function So(e,t){return new xo({type:`union`,options:e,...En(t)})}const one=N(`ZodDiscriminatedUnion`,(e,t)=>{xo.init(e,t),Ate.init(e,t)});function Co(e,t,n){return new one({type:`union`,options:t,discriminator:e,...En(n)})}const sne=N(`ZodIntersection`,(e,t)=>{jte.init(e,t),no.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Sa(e,t,n,r)});function wo(e,t){return new sne({type:`intersection`,left:e,right:t})}const To=N(`ZodRecord`,(e,t)=>{Mte.init(e,t),no.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ca(e,t,n,r),e.keyType=t.keyType,e.valueType=t.valueType});function B(e,t,n){return!t||!t._zod?new To({type:`record`,keyType:P(),valueType:e,...En(t)}):new To({type:`record`,keyType:e,valueType:t,...En(n)})}const Eo=N(`ZodEnum`,(e,t)=>{Nte.init(e,t),no.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ha(e,t,n,r),e.enum=t.entries,e.options=Object.values(t.entries);let n=new Set(Object.keys(t.entries));e.extract=(e,r)=>{let i={};for(let r of e)if(n.has(r))i[r]=t.entries[r];else throw Error(`Key ${r} not found in enum`);return new Eo({...t,checks:[],...En(r),entries:i})},e.exclude=(e,r)=>{let i={...t.entries};for(let t of e)if(n.has(t))delete i[t];else throw Error(`Key ${t} not found in enum`);return new Eo({...t,checks:[],...En(r),entries:i})}});function V(e,t){return new Eo({type:`enum`,entries:Array.isArray(e)?Object.fromEntries(e.map(e=>[e,e])):e,...En(t)})}const cne=N(`ZodLiteral`,(e,t)=>{Pte.init(e,t),no.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ga(e,t,n,r),e.values=new Set(t.values),Object.defineProperty(e,`value`,{get(){if(t.values.length>1)throw Error("This schema contains multiple valid literal values. Use `.values` instead.");return t.values[0]}})});function H(e,t){return new cne({type:`literal`,values:Array.isArray(e)?e:[e],...En(t)})}const lne=N(`ZodTransform`,(e,t)=>{Fte.init(e,t),no.init(e,t),e._zod.processJSONSchema=(t,n,r)=>va(e,t,n,r),e._zod.parse=(n,r)=>{if(r.direction===`backward`)throw new on(e.constructor.name);n.addIssue=r=>{if(typeof r==`string`)n.issues.push(Mn(r,n.value,t));else{let t=r;t.fatal&&(t.continue=!1),t.code??=`custom`,t.input??=n.value,t.inst??=e,n.issues.push(Mn(t))}};let i=t.transform(n.value,n);return i instanceof Promise?i.then(e=>(n.value=e,n.fallback=!0,n)):(n.value=i,n.fallback=!0,n)}});function Do(e){return new lne({type:`transform`,transform:e})}const Oo=N(`ZodOptional`,(e,t)=>{Ir.init(e,t),no.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ja(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function ko(e){return new Oo({type:`optional`,innerType:e})}const une=N(`ZodExactOptional`,(e,t)=>{Ite.init(e,t),no.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ja(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function dne(e){return new une({type:`optional`,innerType:e})}const fne=N(`ZodNullable`,(e,t)=>{Lte.init(e,t),no.init(e,t),e._zod.processJSONSchema=(t,n,r)=>wa(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Ao(e){return new fne({type:`nullable`,innerType:e})}const pne=N(`ZodDefault`,(e,t)=>{Rte.init(e,t),no.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ea(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeDefault=e.unwrap});function mne(e,t){return new pne({type:`default`,innerType:e,get defaultValue(){return typeof t==`function`?t():Cn(t)}})}const hne=N(`ZodPrefault`,(e,t)=>{zte.init(e,t),no.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Da(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function gne(e,t){return new hne({type:`prefault`,innerType:e,get defaultValue(){return typeof t==`function`?t():Cn(t)}})}const jo=N(`ZodNonOptional`,(e,t)=>{Bte.init(e,t),no.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ta(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function _ne(e,t){return new jo({type:`nonoptional`,innerType:e,...En(t)})}const vne=N(`ZodCatch`,(e,t)=>{zr.init(e,t),no.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Oa(e,t,n,r),e.unwrap=()=>e._zod.def.innerType,e.removeCatch=e.unwrap});function yne(e,t){return new vne({type:`catch`,innerType:e,catchValue:typeof t==`function`?t:()=>t})}const Mo=N(`ZodPipe`,(e,t)=>{Br.init(e,t),no.init(e,t),e._zod.processJSONSchema=(t,n,r)=>ka(e,t,n,r),e.in=t.in,e.out=t.out});function No(e,t){return new Mo({type:`pipe`,in:e,out:t})}const bne=N(`ZodPreprocess`,(e,t)=>{Mo.init(e,t),Hr.init(e,t)}),xne=N(`ZodReadonly`,(e,t)=>{Ur.init(e,t),no.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Aa(e,t,n,r),e.unwrap=()=>e._zod.def.innerType});function Sne(e){return new xne({type:`readonly`,innerType:e})}const Cne=N(`ZodLazy`,(e,t)=>{Gr.init(e,t),no.init(e,t),e._zod.processJSONSchema=(t,n,r)=>Ma(e,t,n,r),e.unwrap=()=>e._zod.def.getter()});function Po(e){return new Cne({type:`lazy`,getter:e})}const Fo=N(`ZodCustom`,(e,t)=>{Kr.init(e,t),no.init(e,t),e._zod.processJSONSchema=(t,n,r)=>_a(e,t,n,r)});function Io(e,t){return Qi(Fo,e??(()=>!0),t)}function wne(e,t={}){return $i(Fo,e,t)}function Tne(e,t){return ea(e,t)}function Lo(e,t){return new bne({type:`pipe`,in:Do(e),out:t})}const Ene=bo({at:P(),transport:P(),outcome:P(),reference:P().optional(),error:P().optional()}),Dne=bo({reason:P(),at:P()});bo({version:F().int().catch(1),id:P(),createdAt:P(),bundleLevel:P(),zipBytes:F().int().nonnegative().catch(0),zipDeleted:I().optional(),state:P(),systemWide:I().optional(),projectSlug:P().nullable().optional(),reference:P().optional(),lastError:Dne.optional(),attempts:R(Ene).optional(),note:P().optional()});const Ro=[{name:`macos-home-path`,regex:/\/Users\/[^/]+\//g,replacement:`~/`},{name:`linux-home-path`,regex:/\/home\/[^/]+\//g,replacement:`~/`},{name:`github-pat`,regex:/\b(ghp_|gho_|ghu_|ghs_|ghr_)[A-Za-z0-9]{36,}\b/g,replacement:`[REDACTED-GH-PAT]`},{name:`aws-access-key`,regex:/\b(AKIA|ASIA|ABIA)[A-Z2-7]{16}\b/g,replacement:`[REDACTED-AWS-KEY]`},{name:`anthropic-key`,regex:/\bsk-ant-api03-[A-Za-z0-9_-]{20,}\b/g,replacement:`[REDACTED-ANTHROPIC]`},{name:`openai-key`,regex:/\bsk-[A-Za-z0-9]{20,}\b/g,replacement:`[REDACTED-OPENAI]`},{name:`bearer-token`,regex:/([Aa]uthorization:\s*[Bb]earer\s+)\S+/g,replacement:`$1[REDACTED]`},{name:`jwt`,regex:/eyJ[A-Za-z0-9_-]{8,}\.eyJ[A-Za-z0-9_-]{8,}\.[A-Za-z0-9_-]{8,}/g,replacement:`[REDACTED-JWT]`},{name:`url-credentials`,regex:/:\/\/[^/\s:@]+:[^/\s:@]+@/g,replacement:`://[REDACTED]@`},{name:`github-pat-fine-grained`,regex:/\bgithub_pat_[0-9A-Za-z_]{20,}/g,replacement:`[REDACTED-GH-PAT]`},{name:`openai-key-modern`,regex:/\bsk-(?:proj|svcacct|admin|None)-[A-Za-z0-9_-]{20,}/g,replacement:`[REDACTED-OPENAI]`},{name:`slack-token`,regex:/\bxox[a-z]-[A-Za-z0-9-]{10,}/g,replacement:`[REDACTED-SLACK]`},{name:`google-api-key`,regex:/\bAIza[0-9A-Za-z_-]{35}/g,replacement:`[REDACTED-GOOGLE]`},{name:`stripe-secret-key`,regex:/\b(?:sk|rk)_live_[0-9A-Za-z]{16,}\b/g,replacement:`[REDACTED-STRIPE]`},{name:`gitlab-pat`,regex:/\bglpat-[0-9A-Za-z_-]{20,}/g,replacement:`[REDACTED-GITLAB]`},{name:`bearer-token-json`,regex:/("[Aa]uthorization"\s*:\s*"[Bb]earer\s+)[^"]+/g,replacement:`$1[REDACTED]`}],One=Ro.map(e=>e.name);function zo(e){let t=new Set,n=0;return{redacted:e.split(`
180
180
  `).map(e=>{let r=e,i=!1;for(let{name:e,regex:n,replacement:a}of Ro)n.lastIndex=0,n.test(r)&&(t.add(e),i=!0,n.lastIndex=0,r=r.replace(n,a));return i&&n++,r}).join(`
181
- `),patterns:[...t],lineCount:n}}function Bo(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?Ho(e.position):`start`in e||`end`in e?Ho(e):`line`in e||`column`in e?Vo(e):``}function Vo(e){return Uo(e&&e.line)+`:`+Uo(e&&e.column)}function Ho(e){return Vo(e&&e.start)+`-`+Vo(e&&e.end)}function Uo(e){return e&&typeof e==`number`?e:1}var Wo=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=Bo(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};Wo.prototype.file=``,Wo.prototype.name=``,Wo.prototype.reason=``,Wo.prototype.message=``,Wo.prototype.stack=``,Wo.prototype.column=void 0,Wo.prototype.line=void 0,Wo.prototype.ancestors=void 0,Wo.prototype.cause=void 0,Wo.prototype.fatal=void 0,Wo.prototype.place=void 0,Wo.prototype.ruleId=void 0,Wo.prototype.source=void 0;const kne=[`off`,`follow`,`full`],Go=`pull`,Ko=[`off`,`follow`,`full`,Go],Ane=[`follow`,`full`,Go],jne=new Set(Object.keys({sh:`bash`,zsh:`bash`,bash:`bash`,c:`c`,cc:`cpp`,cpp:`cpp`,cxx:`cpp`,"c++":`cpp`,h:`c`,hh:`cpp`,hpp:`cpp`,cs:`csharp`,css:`css`,less:`less`,scss:`scss`,sass:`scss`,diff:`diff`,patch:`diff`,feature:`gherkin`,go:`go`,gql:`graphql`,graphql:`graphql`,ini:`ini`,cfg:`ini`,conf:`ini`,properties:`ini`,java:`java`,js:`javascript`,jsx:`javascript`,mjs:`javascript`,cjs:`javascript`,json:`json`,jsonc:`json`,kt:`kotlin`,kts:`kotlin`,lua:`lua`,makefile:`makefile`,md:`markdown`,mdx:`markdown`,m:`objectivec`,mm:`objectivec`,pl:`perl`,pm:`perl`,php:`php`,phtml:`php`,py:`python`,pyi:`python`,pyx:`python`,r:`r`,rb:`ruby`,rs:`rust`,sql:`sql`,swift:`swift`,ts:`typescript`,tsx:`typescript`,xml:`xml`,yaml:`yaml`,yml:`yaml`})),Mne=new Set([`md`,`mdx`,`mmd`,`mermaid`]);new Set([...jne,`txt`,`text`,`csv`,`tsv`,`log`,`toml`,`html`,`htm`,`svg`,`vue`,`svelte`,`astro`,`lock`].filter(e=>!Mne.has(e)));const qo=[`image/jpeg`,`image/png`,`image/gif`,`image/webp`,`image/svg+xml`],Nne=[`video/mp4`,`video/webm`,`video/ogg`],Pne=[`audio/mpeg`,`audio/wav`,`audio/ogg`],Fne=[`application/pdf`],Jo=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`,`svg`]),Yo=new Set([`mp4`,`webm`,`mov`,`m4v`,`mkv`]),Ine=new Set([`pdf`]),Xo=new Set([`mp3`,`wav`,`ogg`,`m4a`,`flac`,`aac`,`opus`]),Zo=new Set(`pdf.docx.xlsx.pptx.doc.xls.ppt.zip.7z.tar.gz.rar.csv.tsv.rtf.json.yaml.yml.xml.txt.pages.numbers.key.odt.ods.odp.epub.mobi`.split(`.`)),Qo=new Set(`png.jpg.jpeg.gif.webp.avif.svg.apng.heic.heif.tiff.bmp.ico.pdf.mp4.webm.mov.m4v.mkv.avi.flv.wmv.mpeg.mpg.mp3.wav.ogg.m4a.flac.aac.opus.zip.7z.tar.gz.rar.woff.woff2.ttf.otf.eot.docx.xlsx.pptx.doc.xls.ppt.odt.ods.odp.pages.numbers.key.epub.mobi.csv.tsv.txt.rtf.json.yaml.yml.xml.toml.lock.gpx.html.htm`.split(`.`)),Lne=new Set(`png.jpg.jpeg.gif.webp.avif.apng.heic.heif.tiff.bmp.ico.svg.pdf.mp4.webm.mov.m4v.mkv.mp3.wav.ogg.m4a.flac.aac.opus.json.toml.lock`.split(`.`)),$o=new Set(`png.jpg.jpeg.gif.webp.avif.svg.pdf.mp4.webm.mov.m4v.mkv.mp3.wav.ogg.m4a.flac.aac.opus.docx.xlsx.pptx.doc.xls.ppt.zip.7z.tar.gz.rar.csv.tsv.rtf.json.yaml.yml.xml.txt.pages.numbers.key.odt.ods.odp.epub.mobi`.split(`.`)),es=[`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`],ts=[`mp4`,`webm`,`mov`,`m4v`],ns=[`mp3`,`wav`,`ogg`,`m4a`,`flac`,`aac`,`opus`],rs=[`pdf`],is=[`json`,`toml`,`lock`];function as(e,t,n){for(let r of t)if(!n.has(r))throw Error(`${e}: ${r} is not present in canonical upload constants`)}as(`SIDEBAR_IMAGE_ASSET_EXTENSIONS`,es,Jo),as(`SIDEBAR_VIDEO_ASSET_EXTENSIONS`,ts,Yo),as(`SIDEBAR_AUDIO_ASSET_EXTENSIONS`,ns,Xo),as(`SIDEBAR_PDF_ASSET_EXTENSIONS`,rs,Ine),as(`FILE_ATTACHMENT_EXTENSIONS`,[...Zo],$o),as(`WIKI_EMBED_EXTENSIONS`,[...$o],Qo),new Set(es),new Set(ts),new Set(ns),new Set(rs),new Set(is),as(`SIDEBAR_RENDERABLE_ASSET_EXTENSIONS`,[...new Set([...es,...ts,...ns,...rs,...is])],Lne);const Rne=new Set([`base`,`canvas`]),zne=new Set([`mmd`,`mermaid`]),ss=new Set([...Qo,...Rne,...zne]),cs=[`en`,`zh-Hans`,`zh-Hant`,`hi`,`es`,`ar`,`fr`,`bn`,`pt-BR`,`id`,`ur`],Bne=new Set([`ar`,`ur`]);cs.filter(e=>!Bne.has(e));const Vne=[`off`,`warning`,`error`],ls=`warning`,Hne=[`error`,`warning`],Une=[`base00`,`base01`,`base02`,`base03`,`base04`,`base05`,`base06`,`base07`,`base08`,`base09`,`base0A`,`base0B`,`base0C`,`base0D`,`base0E`,`base0F`],Wne={base00:`default background`,base01:`alt background — cards, popovers, sidebar`,base02:`selection background, borders`,base03:`comments, invisibles`,base04:`secondary text`,base05:`default foreground`,base06:`light foreground`,base07:`lightest foreground`,base08:`red — variables, tags, diff deleted`,base09:`orange — numbers, constants`,base0A:`yellow — classes, search highlight`,base0B:`green — strings, diff inserted`,base0C:`cyan — support, escapes, quotes`,base0D:`blue — functions, headings, accent`,base0E:`magenta — keywords, storage`,base0F:`deprecated markers, embedded tags`};function Gne(e){let t=e.palette;return{background:t.base00,foreground:t.base05,card:t.base01,"card-foreground":t.base05,popover:t.base01,"popover-foreground":t.base05,primary:t.base0D,"primary-foreground":t.base00,secondary:t.base01,"secondary-foreground":t.base05,muted:t.base01,"muted-foreground":t.base04,accent:t.base02,"accent-foreground":t.base05,destructive:t.base08,border:t.base02,input:t.base02,ring:t.base0D,"selection-soft":t.base02,"chart-1":t.base0D,"chart-2":t.base0B,"chart-3":t.base0A,"chart-4":t.base0E,"chart-5":t.base08,sidebar:t.base01,"sidebar-foreground":t.base05,"sidebar-primary":t.base0D,"sidebar-primary-foreground":t.base00,"sidebar-accent":t.base02,"sidebar-accent-foreground":t.base0D,"sidebar-hover":t.base02,"sidebar-border":t.base02,"sidebar-ring":t.base0D,"syntax-keyword":t.base0E,"syntax-tag":t.base08,"syntax-attr":t.base0D,"syntax-string":t.base0B,"syntax-number":t.base09,"syntax-atom":t.base0C,"syntax-comment":t.base03,"syntax-func":t.base0D,"syntax-var":t.base08,"syntax-type":t.base0A,"syntax-operator":t.base05,"syntax-meta":t.base0F,"syntax-bg":t.base01,"link-color":t.base0D,"broken-link-color":t.base08,"lint-warning-color":t.base0A,"lint-error-color":t.base08,"diff-added":t.base0B,"diff-removed":t.base08,"callout-note-color":t.base0D,"callout-info-color":t.base0D,"callout-todo-color":t.base0D,"callout-abstract-color":t.base0C,"callout-tip-color":t.base0B,"callout-success-color":t.base0B,"callout-important-color":t.base0E,"callout-example-color":t.base0E,"callout-question-color":t.base0E,"callout-warning-color":t.base0A,"callout-caution-color":t.base09,"callout-danger-color":t.base09,"callout-failure-color":t.base08,"callout-bug-color":t.base08,"callout-quote-color":t.base03,...qne(t)}}const us={black:`base00`,red:`base08`,green:`base0B`,yellow:`base0A`,blue:`base0D`,magenta:`base0E`,cyan:`base0C`,white:`base05`,brightBlack:`base03`,brightRed:`base08`,brightGreen:`base0B`,brightYellow:`base0A`,brightBlue:`base0D`,brightMagenta:`base0E`,brightCyan:`base0C`,brightWhite:`base07`},Kne=Object.keys(us);function qne(e){let t={};for(let n of Kne)t[`ansi-${Jne(n)}`]=e[us[n]];return t}function Jne(e){return e.replace(/([a-z])([A-Z])/g,`$1-$2`).toLowerCase()}const Yne={name:`Dracula`,author:`clach04 (https://github.com/clach04)`,variant:`dark`,palette:{base00:`#282a36`,base01:`#21222c`,base02:`#44475a`,base03:`#6272a4`,base04:`#9ea8c7`,base05:`#f8f8f2`,base06:`#f8f8f2`,base07:`#ffffff`,base08:`#ff5555`,base09:`#ffb86c`,base0A:`#f1fa8c`,base0B:`#50fa7b`,base0C:`#8be9fd`,base0D:`#bd93f9`,base0E:`#ff79c6`,base0F:`#993333`}},Xne={name:`Catppuccin Frappé`,author:`https://github.com/catppuccin/catppuccin`,variant:`dark`,palette:{base00:`#303446`,base01:`#292c3c`,base02:`#414559`,base03:`#51576d`,base04:`#626880`,base05:`#c6d0f5`,base06:`#f2d5cf`,base07:`#babbf1`,base08:`#e78284`,base09:`#ef9f76`,base0A:`#e5c890`,base0B:`#a6d189`,base0C:`#81c8be`,base0D:`#8caaee`,base0E:`#ca9ee6`,base0F:`#eebebe`}},Zne={name:`Catppuccin Latte`,author:`https://github.com/catppuccin/catppuccin`,variant:`light`,palette:{base00:`#eff1f5`,base01:`#e6e9ef`,base02:`#ccd0da`,base03:`#bcc0cc`,base04:`#acb0be`,base05:`#4c4f69`,base06:`#dc8a78`,base07:`#7287fd`,base08:`#d20f39`,base09:`#fe640b`,base0A:`#df8e1d`,base0B:`#40a02b`,base0C:`#179299`,base0D:`#1e66f5`,base0E:`#8839ef`,base0F:`#dd7878`}},Qne={name:`Monokai`,author:`Wimer Hazenberg (http://www.monokai.nl)`,variant:`dark`,palette:{base00:`#272822`,base01:`#383830`,base02:`#49483e`,base03:`#75715e`,base04:`#a59f85`,base05:`#f8f8f2`,base06:`#f5f4f1`,base07:`#f9f8f5`,base08:`#f92672`,base09:`#fd971f`,base0A:`#f4bf75`,base0B:`#a6e22e`,base0C:`#a1efe4`,base0D:`#66d9ef`,base0E:`#ae81ff`,base0F:`#cc6633`}},$ne={name:`Gruvbox dark, medium`,author:`Dawid Kurek, morhetz (https://github.com/morhetz/gruvbox)`,variant:`dark`,palette:{base00:`#282828`,base01:`#3c3836`,base02:`#504945`,base03:`#665c54`,base04:`#bdae93`,base05:`#d5c4a1`,base06:`#ebdbb2`,base07:`#fbf1c7`,base08:`#fb4934`,base09:`#fe8019`,base0A:`#fabd2f`,base0B:`#b8bb26`,base0C:`#8ec07c`,base0D:`#83a598`,base0E:`#d3869b`,base0F:`#d65d0e`}},ere={name:`Solarized Dark`,author:`Ethan Schoonover (modified by aramisgithub)`,variant:`dark`,palette:{base00:`#002b36`,base01:`#073642`,base02:`#586e75`,base03:`#657b83`,base04:`#839496`,base05:`#93a1a1`,base06:`#eee8d5`,base07:`#fdf6e3`,base08:`#dc322f`,base09:`#cb4b16`,base0A:`#b58900`,base0B:`#859900`,base0C:`#2aa198`,base0D:`#268bd2`,base0E:`#6c71c4`,base0F:`#d33682`}};function ds(e,t,n){return{id:e,label:t,kind:n.variant,scheme:n,toTokens:()=>Gne(n)}}function fs(e,t){return{id:e,label:t,kind:`system`}}const ps=[fs(`default`,`Default`),ds(`dracula`,`Dracula`,Yne),ds(`catppuccin-frappe`,`Catppuccin Frappé`,Xne),ds(`catppuccin-latte`,`Catppuccin Latte`,Zne),ds(`monokai`,`Monokai`,Qne),ds(`gruvbox`,`Gruvbox`,$ne),ds(`solarized`,`Solarized`,ere),fs(`custom`,`Custom`)],ms=ps.map(e=>e.id);new Map(ps.map(e=>[e.id,e]));const hs=Symbol.for(`@inkeep/open-knowledge/field-registry`),gs=globalThis;gs[hs]===void 0&&(gs[hs]=Zr());const _s=gs[hs];function tre(){return Object.fromEntries(Une.map(e=>[e,P().register(_s,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:`Custom theme: base16 ${e} — ${Wne[e]}, as a #rrggbb hex string.`}).optional()]))}function vs(){return ms.filter(e=>e!==`default`&&e!==`custom`).map(e=>`'${e}'`).join(`, `)}const ys=Object.freeze([`authorization`,`auth.token`,`auth.bearer`,`cookie`,`set-cookie`,`x-api-key`,`password`,`secret`]),bs=52428800,xs=26214400,Ss=12582912,Cs=`https://api.openai.com/v1`,ws=`text-embedding-3-small`;function nre(e){let t=e.trim();return t===``?`./`:t}function rre(e){let t=nre(e);return t.includes(`\0`)||t.includes(`\\`)?!1:t===`/`?!0:!(t.startsWith(`/`)||/^[A-Za-z]:/.test(t)||t.split(`/`).some(e=>e===`..`))}const Ts=bo({content:bo({dir:P().register(_s,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Folder OpenKnowledge reads and writes documents under, relative to the project root (the folder that contains .ok/). Defaults to the project root. Exclude paths with .okignore.`}).default(`.`),attachmentFolderPath:P().register(_s,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Where pasted and dropped assets are stored, relative to the content root. './' colocates beside the current document (default); '/' targets the content root; './subdir' targets a subfolder under the current document folder; 'folder' targets a fixed folder under the content root. Whitespace-only values are treated as './'.`}).refine(rre,{message:`Invalid attachment folder path: must not contain '..' segments, NUL bytes, backslashes, or OS absolute paths (use '/' for the content root).`}).default(`./`)}).default({dir:`.`,attachmentFolderPath:`./`}),appearance:bo({theme:V([`light`,`dark`,`system`]).register(_s,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:`Editor color theme: 'light', 'dark', or 'system' (follow the OS). A personal preference (user scope) — not shared with the project.`}).optional(),language:V([`system`,...cs]).register(_s,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:`Interface language. 'system' follows the operating system. A personal preference (user scope) — not shared with the project, and never applied to document content.`}).optional(),colorThemeLight:V(ms).register(_s,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:`IDE color palette applied in light mode: 'default' (no palette), 'custom' (your own colors from appearance.customTheme), or one of ${vs()}. A personal preference (user scope) — not shared with the project.`}).optional(),colorThemeDark:V(ms).register(_s,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:`IDE color palette applied in dark mode: 'default' (no palette), 'custom' (your own colors from appearance.customTheme), or one of ${vs()}. A personal preference (user scope) — not shared with the project.`}).optional(),colorTheme:V(ms).register(_s,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:`Superseded by appearance.colorThemeLight / appearance.colorThemeDark. Read as the palette for both modes while neither of those is set. A personal preference (user scope) — not shared with the project.`}).optional(),colorThemeEnabled:I().register(_s,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:`Whether the Themes plugin appears in Settings → Plugins. A personal preference (user scope). Default on.`}).optional(),customTheme:bo({name:P().register(_s,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:`Custom theme: the scheme's display name.`}).optional(),author:P().register(_s,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:`Custom theme: the scheme's author credit, carried through from an imported base16 scheme.`}).optional(),variant:V([`dark`,`light`]).register(_s,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:`Custom theme: whether the scheme is 'dark' or 'light'. Auto-detected from the palette when omitted.`}).optional(),...tre()}).optional(),preview:bo({autoOpen:I().register(_s,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:`When on, the agent opens or refreshes the live preview after each edit. Turn off if you manage your own preview window. A personal preference (user scope).`}).default(!0)}).default({autoOpen:!0}),sidebar:bo({showHiddenFiles:I().register(_s,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Show dot-prefixed entries (e.g. .ok/, .okignore) in the file tree. Per-machine (project-local) — not shared with collaborators.`}).default(!1),showOnlyMarkdownFiles:I().register(_s,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Show only markdown documents (.md/.mdx) and folders in the file tree, hiding other file types from view. View-only: hidden files stay on disk and remain reachable via links and search. Per-machine (project-local) — not shared with collaborators.`}).default(!1),showSkillsSection:I().register(_s,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Show the Skills section in the sidebar. Skill documents remain reachable via links and search while the section is hidden. Per-machine (project-local) — not shared with collaborators.`}).default(!0),showOkFolders:I().register(_s,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Show .ok folders (skills, templates, and other OpenKnowledge-managed state) in the file tree as read-only entries. .ok/worktrees and .ok/local never appear. Per-machine (project-local) — not shared with collaborators.`}).default(!1)}).optional()}).default({preview:{autoOpen:!0}}),editor:bo({wordWrap:I().register(_s,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:`Soft-wrap long lines in the source (CodeMirror) editor. A personal preference (user scope).`}).default(!0),previewTabs:I().register(_s,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:`Reuse one tab when clicking through the Files and Skills sidebars, the way an editor preview tab works. Turn off to open every click in its own tab. Pinned tabs keep their own tab either way. A personal preference (user scope).`}).default(!0)}).default({wordWrap:!0,previewTabs:!0}),agents:bo({autoApproveOkTools:I().register(_s,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:"Auto-approve OpenKnowledge's own tools (and `ok open` on Claude) for agents launched from the built-in terminal. Destructive tools (delete/move/share/install) still prompt. Per-machine personal preference (user scope)."}).default(!0)}).default({autoApproveOkTools:!0}),autoSync:bo({mode:V(Ko).register(_s,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`How this machine syncs this project with its git remote: 'off' (no sync), 'follow' (one-directional — pull remote changes, never push your own; 'pull' is accepted as a legacy alias), or 'full' (bidirectional pull and push). null = not chosen yet (onboarding asks). Per-machine (project-local) — not shared. Supersedes the legacy autoSync.enabled boolean.`}).nullable().default(null),enabled:I().register(_s,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Legacy per-machine sync toggle, superseded by autoSync.mode. Read only when mode is absent (true = full, false = off). null = not chosen yet. Per-machine (project-local) — not shared.`}).nullable().default(null),resumeMode:V(Ane).register(_s,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`When sync is paused (autoSync.mode 'off') after having been enabled, the active mode to resume into ('follow' | 'full'). Per-machine UI memory; ignored while a mode is active. Not shared.`}).optional(),default:So([I(),V(Ko)]).register(_s,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Committed project default for a machine's sync mode on first open: 'off' | 'follow' | 'full', or the legacy boolean (true = full, false = off). null = ask (show the onboarding prompt). Shared via git. A per-machine autoSync.mode choice overrides it.`}).nullable().default(null)}).default({mode:null,enabled:null,default:null}),terminal:bo({enabled:I().register(_s,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Opt-out for the in-app terminal (a real OS shell at full user privilege). The terminal is on by default; set false to disable it for this project on this machine. Per-machine (project-local) — never shared via git, clone, or sync.`}).nullable().default(null)}).default({enabled:null}),slides:bo({enabled:I().register(_s,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:"Whether the Slides plugin appears in Settings → Plugins. When on, a document whose frontmatter has `slides: true` offers an action that opens the deck in a dedicated window (desktop only, requires a resolvable slidev). A personal preference (user scope). Default off."}).default(!1)}).default({enabled:!1}),telemetry:bo({localSink:bo({enabled:I().register(_s,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:"Write local diagnostic spans + logs under .ok/local/ for `ok diagnose bundle`. Local-only — never leaves the machine until you run bundle. Set false for sensitive workspaces. Shared across collaborators."}).default(!0),spans:bo({maxBytes:F().register(_s,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Maximum size, in bytes, of the local diagnostic spans file before it rotates (default ~50 MB).`}).default(bs)}).default({maxBytes:bs}),logs:bo({maxBytes:F().register(_s,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Maximum size, in bytes, of the local diagnostic logs file before it rotates (default ~25 MB).`}).default(xs)}).default({maxBytes:xs}),attributeDenylist:R(P()).register(_s,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Telemetry attribute keys whose values are redacted before any local span/log is written (credential / secret guard). Extends the built-in denylist.`}).default([...ys])}).default({enabled:!0,spans:{maxBytes:bs},logs:{maxBytes:xs},attributeDenylist:[...ys]}),skillInstallReports:bo({enabled:I().register(_s,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:`Report skill installs to skills.sh so a published skill shows an accurate install count. Sends the skill name, its source repo, and which agent tools it was installed for — never file contents, and never for a private or local source. One report per skill per machine. Default on; the DO_NOT_TRACK and DISABLE_TELEMETRY environment variables also turn it off.`}).default(!0)}).default({enabled:!0})}).default({localSink:{enabled:!0,spans:{maxBytes:bs},logs:{maxBytes:xs},attributeDenylist:[...ys]},skillInstallReports:{enabled:!0}}),lossCapture:bo({enabled:I().register(_s,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:"Record bridge loss-class events (content-free) under .ok/local/loss-capture/ for `ok diagnose bundle`. Local-only — never leaves the machine until you run bundle. Set false for sensitive workspaces. Shared across collaborators."}).default(!0),maxBytes:F().register(_s,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Maximum size, in bytes, of the local loss-capture file before it rotates (default ~12 MB).`}).default(Ss)}).default({enabled:!0,maxBytes:Ss}),bridge:bo({backgroundThrottle:bo({enabled:I().register(_s,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Keep the desktop window's timers running at full rate while it holds unsynced work, so backgrounding the app never starves sync or recovery; when the window is idle the OS-default background throttling is restored (battery). Honored by the desktop app. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0}),deferGuard:bo({enabled:I().register(_s,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Defer a drain-shaped Observer B re-derive when the WYSIWYG fragment holds an un-propagated keystroke Y.Text lacks, so the keystroke survives instead of being stomped. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0}),lossDetector:bo({enabled:I().register(_s,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Detect content the bridge silently dropped at its reconciliation boundary (an Observer-A apply arm or a paired agent-undo derive) and write a recovery checkpoint plus a content-free loss event. Detection only — never blocks a write. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0}),fixedPoint:bo({enabled:I().register(_s,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Bound the Y.Text→WYSIWYG re-derive loop with a drain-count backstop: a run of re-derive drains that never reaches a raw-byte fixed point freezes the re-derive loop and writes a recovery checkpoint plus a content-free loss event, instead of churning unbounded. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0}),preDrain:bo({enabled:I().register(_s,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Before an agent write or undo rebuilds the WYSIWYG fragment, flush an un-propagated keystroke that provably does not overlap the operation into Y.Text so the keystroke survives instead of needing recovery; overlapping or unmodellable cases fall back to the checkpoint floor. Scope: appending writes and single-frame undos — a write that replaces the whole body (replace / edit) overwrites the keystroke either way, so those always take the checkpoint floor. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0}),flushOnHide:bo({enabled:I().register(_s,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`On tab hide/unload, force-send each doc's unsynced work to the server and commit its local cache, and re-sync on return to foreground, so a backgrounded tab never strands edits that IndexedDB alone would lose on recycle. Honored client-side. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0})}).default({backgroundThrottle:{enabled:!0},deferGuard:{enabled:!0},lossDetector:{enabled:!0},fixedPoint:{enabled:!0},preDrain:{enabled:!0},flushOnHide:{enabled:!0}}),search:bo({semantic:bo({enabled:I().register(_s,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:"Add semantic (embeddings) ranking to the MCP search tool, fused with the lexical engine so conceptually-related pages surface even with no shared keywords. When ON and an API key is set (`ok embeddings set-key`), the search query and matching document content are sent to the configured embeddings provider — content egress. Default OFF. Per-machine (project-local) — not shared with collaborators."}).default(!1),baseUrl:P().register(_s,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:"Base URL of the OpenAI-compatible embeddings API (default https://api.openai.com/v1). Override to point at a self-hosted server (Ollama / vLLM / LM Studio) or another provider. The API key is NOT stored here — set it with `ok embeddings set-key` (`~/.ok/secrets.yml`); it is sent to whichever endpoint this names."}).default(Cs),model:P().register(_s,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Embeddings model id (default text-embedding-3-small). Must be served by the provider at baseUrl. Changing it re-embeds the corpus (the cache is keyed by provider + model + dimensions).`}).default(ws),dimensions:F().int().positive().register(_s,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Optional output vector dimensions. Omit (recommended) to detect the model's native size from its first response — that is what lets a non-OpenAI model work without knowing its size up front. Set a smaller value (text-embedding-3 supports e.g. 512 / 1024) to shrink the on-disk cache, trading a little retrieval quality; a server that ignores the request param then fails loudly instead of silently. Changing it re-embeds the corpus.`}).optional(),similarityFloor:F().min(0).max(1).register(_s,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Optional hard cutoff: drop any "by meaning" match whose cosine similarity is below this value. Off by default (0) because retrieval is rank-based (the closest pages are returned regardless of absolute score) and the right cutoff is model-specific. Set it only to suppress weak matches for a specific provider/model whose cosine scale you know. Most setups should leave it unset and rely on the result-count cap.`}).optional()}).default({enabled:!1,baseUrl:Cs,model:ws})}).default({semantic:{enabled:!1,baseUrl:Cs,model:ws}}),contentRules:bo({markdownlint:z({enabled:I().register(_s,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Whether the markdownlint plugin (body rules) contributes diagnostics.`}).default(!1)}).default({enabled:!1}),frontmatter:z({enabled:I().register(_s,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Whether the frontmatter plugin (JSON-Schema validation of document frontmatter) contributes diagnostics.`}).default(!1),schemas:R(z({appliesTo:So([P(),R(P())]).optional(),file:P(),enabled:I().optional()})).register(_s,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Frontmatter schema mappings: which docs (appliesTo globs) validate against which JSON Schema file (project-root-relative path).`}).default([])}).default({enabled:!1,schemas:[]})}).default({markdownlint:{enabled:!1},frontmatter:{enabled:!1,schemas:[]}}),validation:bo({links:V(Vne).register(_s,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`How broken internal links are reported on the validation plane: 'off' hides them, 'warning' (default) or 'error' sets their severity.`}).default(ls),fileTreeIndicators:I().register(_s,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Whether the file tree tints and badges files that have validation problems.`}).default(!0)}).default({links:ls,fileTreeIndicators:!0}),linkPreviews:bo({enabled:I().register(_s,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Show a rich preview card (site name, page title, description, favicon) when you hover an external link in the editor. When ON, hovering an external link sends that link's URL to the destination site to fetch its preview metadata — outbound egress, one request per previewed link. Default ON; set to false to turn external previews off. Per-machine (project-local) — not shared with collaborators. Previews of links to other documents in this project are read from the local index with no network request and are always on.`}).default(!0)}).default({enabled:!0}),remote:bo({url:P().register(_s,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:"Public URL your tunnel gives you, e.g. https://myproject.ngrok.app. Used only with `ok start --remote` (config alone never enables remote access); its host is admitted through the Host-header allowlist. There is no server-side auth, so restrict access at the tunnel (ngrok OAuth, Cloudflare Access, Tailscale ACLs)."}).optional(),port:F().int().min(1).max(65535).register(_s,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`TCP port the server binds when remote access is enabled (default 24550). Fixed so the tunnel's port mapping survives restarts. Set it only on a conflict. An explicit --port still wins; the PORT env var is ignored in remote mode.`}).default(24550)}).default({port:24550})});var Es,Ds=n((()=>{Es=`1.9.1`}));function ire(e){let t=new Set([e]),n=new Set,r=e.match(Os);if(!r)return()=>!1;let i={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[4]};if(i.prerelease!=null)return function(t){return t===e};function a(e){return n.add(e),!1}function o(e){return t.add(e),!0}return function(e){if(t.has(e))return!0;if(n.has(e))return!1;let r=e.match(Os);if(!r)return a(e);let s={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[4]};return s.prerelease!=null||i.major!==s.major?a(e):i.major===0?i.minor===s.minor&&i.patch<=s.patch?o(e):a(e):i.minor<=s.minor?o(e):a(e)}}var Os,ks,are=n((()=>{Ds(),Os=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/,ks=ire(Es)}));function As(e,t,n,r=!1){let i=Fs[Ps]=Fs[Ps]??{version:Es};if(!r&&i[e]){let t=Error(`@opentelemetry/api: Attempted duplicate registration of API: ${e}`);return n.error(t.stack||t.message),!1}if(i.version!==`1.9.1`){let t=Error(`@opentelemetry/api: Registration of version v${i.version} for ${e} does not match previously registered API v${Es}`);return n.error(t.stack||t.message),!1}return i[e]=t,n.debug(`@opentelemetry/api: Registered a global for ${e} v${Es}.`),!0}function js(e){let t=Fs[Ps]?.version;if(!(!t||!ks(t)))return Fs[Ps]?.[e]}function Ms(e,t){t.debug(`@opentelemetry/api: Unregistering a global for ${e} v${Es}.`);let n=Fs[Ps];n&&delete n[e]}var Ns,Ps,Fs,Is=n((()=>{Ds(),are(),Ns=Es.split(`.`)[0],Ps=Symbol.for(`opentelemetry.js.api.${Ns}`),Fs=typeof globalThis==`object`?globalThis:typeof self==`object`?self:typeof window==`object`?window:typeof global==`object`?global:{}}));function Ls(e,t,n){let r=js(`diag`);if(r)return r[e](t,...n)}var Rs,ore=n((()=>{Is(),Rs=class{constructor(e){this._namespace=e.namespace||`DiagComponentLogger`}debug(...e){return Ls(`debug`,this._namespace,e)}error(...e){return Ls(`error`,this._namespace,e)}info(...e){return Ls(`info`,this._namespace,e)}warn(...e){return Ls(`warn`,this._namespace,e)}verbose(...e){return Ls(`verbose`,this._namespace,e)}}})),zs,Bs=n((()=>{(function(e){e[e.NONE=0]=`NONE`,e[e.ERROR=30]=`ERROR`,e[e.WARN=50]=`WARN`,e[e.INFO=60]=`INFO`,e[e.DEBUG=70]=`DEBUG`,e[e.VERBOSE=80]=`VERBOSE`,e[e.ALL=9999]=`ALL`})(zs||={})}));function sre(e,t){e<zs.NONE?e=zs.NONE:e>zs.ALL&&(e=zs.ALL),t||={};function n(n,r){let i=t[n];return typeof i==`function`&&e>=r?i.bind(t):function(){}}return{error:n(`error`,zs.ERROR),warn:n(`warn`,zs.WARN),info:n(`info`,zs.INFO),debug:n(`debug`,zs.DEBUG),verbose:n(`verbose`,zs.VERBOSE)}}var cre=n((()=>{Bs()})),Vs,Hs,Us=n((()=>{ore(),cre(),Bs(),Is(),Vs=`diag`,Hs=class e{static instance(){return this._instance||=new e,this._instance}constructor(){function e(e){return function(...t){let n=js(`diag`);if(n)return n[e](...t)}}let t=this;t.setLogger=(e,n={logLevel:zs.INFO})=>{if(e===t){let e=Error(`Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation`);return t.error(e.stack??e.message),!1}typeof n==`number`&&(n={logLevel:n});let r=js(`diag`),i=sre(n.logLevel??zs.INFO,e);if(r&&!n.suppressOverrideMessage){let e=Error().stack??`<failed to generate stacktrace>`;r.warn(`Current logger will be overwritten from ${e}`),i.warn(`Current logger will overwrite one already registered from ${e}`)}return As(`diag`,i,t,!0)},t.disable=()=>{Ms(Vs,t)},t.createComponentLogger=e=>new Rs(e),t.verbose=e(`verbose`),t.debug=e(`debug`),t.info=e(`info`),t.warn=e(`warn`),t.error=e(`error`)}}}));function lre(e){return Symbol.for(e)}var Ws,Gs,Ks=n((()=>{Ws=class e{constructor(t){let n=this;n._currentContext=t?new Map(t):new Map,n.getValue=e=>n._currentContext.get(e),n.setValue=(t,r)=>{let i=new e(n._currentContext);return i._currentContext.set(t,r),i},n.deleteValue=t=>{let r=new e(n._currentContext);return r._currentContext.delete(t),r}}},Gs=new Ws})),qs,ure=n((()=>{Ks(),qs=class{active(){return Gs}with(e,t,n,...r){return t.call(n,...r)}bind(e,t){return t}enable(){return this}disable(){return this}}})),Js,Ys,Xs,Zs=n((()=>{ure(),Is(),Us(),Js=`context`,Ys=new qs,Xs=class e{constructor(){}static getInstance(){return this._instance||=new e,this._instance}setGlobalContextManager(e){return As(Js,e,Hs.instance())}active(){return this._getContextManager().active()}with(e,t,n,...r){return this._getContextManager().with(e,t,n,...r)}bind(e,t){return this._getContextManager().bind(e,t)}_getContextManager(){return js(Js)||Ys}disable(){this._getContextManager().disable(),Ms(Js,Hs.instance())}}})),Qs,$s=n((()=>{(function(e){e[e.NONE=0]=`NONE`,e[e.SAMPLED=1]=`SAMPLED`})(Qs||={})})),ec,tc,nc,rc=n((()=>{$s(),ec=`0000000000000000`,tc=`00000000000000000000000000000000`,nc={traceId:tc,spanId:ec,traceFlags:Qs.NONE}})),ic,ac=n((()=>{rc(),ic=class{constructor(e=nc){this._spanContext=e}spanContext(){return this._spanContext}setAttribute(e,t){return this}setAttributes(e){return this}addEvent(e,t){return this}addLink(e){return this}addLinks(e){return this}setStatus(e){return this}updateName(e){return this}end(e){}isRecording(){return!1}recordException(e,t){}}}));function oc(e){return e.getValue(fc)||void 0}function sc(){return oc(Xs.getInstance().active())}function cc(e,t){return e.setValue(fc,t)}function lc(e){return e.deleteValue(fc)}function uc(e,t){return cc(e,new ic(t))}function dc(e){return oc(e)?.spanContext()}var fc,pc=n((()=>{Ks(),ac(),Zs(),fc=lre(`OpenTelemetry Context Key SPAN`)}));function mc(e,t){if(typeof e!=`string`||e.length!==t)return!1;let n=0;for(let t=0;t<e.length;t+=4)n+=(yc[e.charCodeAt(t)]|0)+(yc[e.charCodeAt(t+1)]|0)+(yc[e.charCodeAt(t+2)]|0)+(yc[e.charCodeAt(t+3)]|0);return n===t}function hc(e){return mc(e,32)&&e!==`00000000000000000000000000000000`}function gc(e){return mc(e,16)&&e!==`0000000000000000`}function _c(e){return hc(e.traceId)&&gc(e.spanId)}function vc(e){return new ic(e)}var yc,bc=n((()=>{rc(),ac(),yc=new Uint8Array([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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,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,1,1,1,1,1])}));function xc(e){return typeof e==`object`&&!!e&&`spanId`in e&&typeof e.spanId==`string`&&`traceId`in e&&typeof e.traceId==`string`&&`traceFlags`in e&&typeof e.traceFlags==`number`}var Sc,Cc,wc=n((()=>{Zs(),pc(),ac(),bc(),Sc=Xs.getInstance(),Cc=class{startSpan(e,t,n=Sc.active()){if(t?.root)return new ic;let r=n&&dc(n);return xc(r)&&_c(r)?new ic(r):new ic}startActiveSpan(e,t,n,r){let i,a,o;if(arguments.length<2)return;arguments.length===2?o=t:arguments.length===3?(i=t,o=n):(i=t,a=n,o=r);let s=a??Sc.active(),c=this.startSpan(e,i,s),l=cc(s,c);return Sc.with(l,o,void 0,c)}}})),Tc,Ec,Dc=n((()=>{wc(),Tc=new Cc,Ec=class{constructor(e,t,n,r){this._provider=e,this.name=t,this.version=n,this.options=r}startSpan(e,t,n){return this._getTracer().startSpan(e,t,n)}startActiveSpan(e,t,n,r){let i=this._getTracer();return Reflect.apply(i.startActiveSpan,i,arguments)}_getTracer(){if(this._delegate)return this._delegate;let e=this._provider.getDelegateTracer(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):Tc}}})),Oc,kc=n((()=>{wc(),Oc=class{getTracer(e,t,n){return new Cc}}})),Ac,jc,Mc=n((()=>{Dc(),kc(),Ac=new Oc,jc=class{getTracer(e,t,n){return this.getDelegateTracer(e,t,n)??new Ec(this,e,t,n)}getDelegate(){return this._delegate??Ac}setDelegate(e){this._delegate=e}getDelegateTracer(e,t,n){return this._delegate?.getTracer(e,t,n)}}})),Nc,Pc=n((()=>{(function(e){e[e.UNSET=0]=`UNSET`,e[e.OK=1]=`OK`,e[e.ERROR=2]=`ERROR`})(Nc||={})})),Fc,Ic=n((()=>{Zs(),Fc=Xs.getInstance()})),Lc,Rc,zc=n((()=>{Is(),Mc(),bc(),pc(),Us(),Lc=`trace`,Rc=class e{constructor(){this._proxyTracerProvider=new jc,this.wrapSpanContext=vc,this.isSpanContextValid=_c,this.deleteSpan=lc,this.getSpan=oc,this.getActiveSpan=sc,this.getSpanContext=dc,this.setSpan=cc,this.setSpanContext=uc}static getInstance(){return this._instance||=new e,this._instance}setGlobalTracerProvider(e){let t=As(Lc,this._proxyTracerProvider,Hs.instance());return t&&this._proxyTracerProvider.setDelegate(e),t}getTracerProvider(){return js(Lc)||this._proxyTracerProvider}getTracer(e,t){return this.getTracerProvider().getTracer(e,t)}disable(){Ms(Lc,Hs.instance()),this._proxyTracerProvider=new jc}}})),Bc,Vc=n((()=>{zc(),Bc=Rc.getInstance()})),Hc=n((()=>{Us(),Ks(),Bs(),Dc(),Mc(),Pc(),$s(),bc(),rc(),Ic(),Vc()}));const Uc=z({file:P(),line:F().int().min(1),column:F().int().min(1),snippet:P().optional()}),Wc=z({path:R(So([P(),F()])),message:P(),issueCode:P(),params:B(P(),L()).optional(),source:Uc.optional()}),Gc=V([`user`,`project`,`project-local`,`either`]),Kc=V([`user`,`project`,`project-local`]),qc=z({code:H(`YAML_PARSE`),detail:P()}),Jc=z({code:H(`UNREADABLE`),detail:P()}),Yc=z({code:H(`SCHEMA_INVALID`),issues:R(Wc)}),Xc=z({code:H(`REMOVED_KEY`),path:R(P()),redirect:P(),source:Uc.optional()}),Zc=Co(`code`,[qc,Yc,Jc,z({code:H(`SCOPE_VIOLATION`),path:R(P()),expectedScope:Gc,actualScope:Kc}),z({code:H(`NOT_AGENT_SETTABLE`),path:R(P())}),z({code:H(`MIXED_SCOPE`),paths:R(z({path:R(P()),scope:Kc}))}),Xc,z({code:H(`WRITE_ERROR`),detail:P()}),z({code:H(`OKIGNORE_INVALID`),detail:P(),lineNumber:F().int().min(1).optional()}),z({code:H(`UNKNOWN`),message:P().optional()})]);Co(`code`,[Xc,qc,Yc,Jc]),z({diagnostics:R(Co(`code`,[z({code:H(`REMOVED_KEY`),scope:Kc,file:P(),path:R(P()),redirect:P()}),z({code:H(`YAML_PARSE`),scope:Kc,file:P()}),z({code:H(`SCHEMA_INVALID`),scope:Kc,file:P()}),z({code:H(`UNREADABLE`),scope:Kc,file:P()})]))});const Qc=new Set(Zc.options.map(e=>e.shape.code.value)),$c=So([Zc,bo({code:P(),message:P().optional()})]);function el(e){return Qc.has(e.code)}function tl(e){switch(e){case`user`:return`~/.ok/global.yml`;case`project`:return`.ok/config.yml`;case`project-local`:return`.ok/local/config.yml`;case`either`:return`.ok/config.yml or ~/.ok/global.yml`}}function nl(e){switch(e){case`user`:return`personal to you, across all projects`;case`project`:return`shared with your team via git`;case`project-local`:return`this machine only, not shared`;case`either`:return`user or project`}}function rl(e){if(!el(e))return e.message??`Unknown error (${e.code}).`;switch(e.code){case`YAML_PARSE`:return`Failed to parse YAML: ${e.detail}`;case`UNREADABLE`:return`Could not read the file: ${e.detail}`;case`SCHEMA_INVALID`:{if(e.issues.length===0)return`Invalid configuration.`;let t=new Map;for(let n of e.issues){let e=n.source?.file??`<no source>`,r=t.get(e)??[];r.push(n),t.set(e,r)}let n=[];for(let[e,r]of t){e===`<no source>`?n.push(`Invalid configuration:`):n.push(`Invalid configuration at ${e}:`);for(let t of r){let r=t.path.length===0?`<root>`:t.path.join(`.`);if(t.source){if(n.push(` ${e}:${t.source.line}:${t.source.column}`),n.push(` ${r}: ${t.message}`),t.source.snippet&&t.source.snippet.length>0)for(let e of t.source.snippet.split(`
181
+ `),patterns:[...t],lineCount:n}}function Bo(e){return!e||typeof e!=`object`?``:`position`in e||`type`in e?Ho(e.position):`start`in e||`end`in e?Ho(e):`line`in e||`column`in e?Vo(e):``}function Vo(e){return Uo(e&&e.line)+`:`+Uo(e&&e.column)}function Ho(e){return Vo(e&&e.start)+`-`+Vo(e&&e.end)}function Uo(e){return e&&typeof e==`number`?e:1}var Wo=class extends Error{constructor(e,t,n){super(),typeof t==`string`&&(n=t,t=void 0);let r=``,i={},a=!1;if(t&&(i=`line`in t&&`column`in t||`start`in t&&`end`in t?{place:t}:`type`in t?{ancestors:[t],place:t.position}:{...t}),typeof e==`string`?r=e:!i.cause&&e&&(a=!0,r=e.message,i.cause=e),!i.ruleId&&!i.source&&typeof n==`string`){let e=n.indexOf(`:`);e===-1?i.ruleId=n:(i.source=n.slice(0,e),i.ruleId=n.slice(e+1))}if(!i.place&&i.ancestors&&i.ancestors){let e=i.ancestors[i.ancestors.length-1];e&&(i.place=e.position)}let o=i.place&&`start`in i.place?i.place.start:i.place;this.ancestors=i.ancestors||void 0,this.cause=i.cause||void 0,this.column=o?o.column:void 0,this.fatal=void 0,this.file=``,this.message=r,this.line=o?o.line:void 0,this.name=Bo(i.place)||`1:1`,this.place=i.place||void 0,this.reason=this.message,this.ruleId=i.ruleId||void 0,this.source=i.source||void 0,this.stack=a&&i.cause&&typeof i.cause.stack==`string`?i.cause.stack:``,this.actual=void 0,this.expected=void 0,this.note=void 0,this.url=void 0}};Wo.prototype.file=``,Wo.prototype.name=``,Wo.prototype.reason=``,Wo.prototype.message=``,Wo.prototype.stack=``,Wo.prototype.column=void 0,Wo.prototype.line=void 0,Wo.prototype.ancestors=void 0,Wo.prototype.cause=void 0,Wo.prototype.fatal=void 0,Wo.prototype.place=void 0,Wo.prototype.ruleId=void 0,Wo.prototype.source=void 0;const kne=[`off`,`follow`,`full`],Go=`pull`,Ko=[`off`,`follow`,`full`,Go],Ane=[`follow`,`full`,Go],jne=new Set(Object.keys({sh:`bash`,zsh:`bash`,bash:`bash`,c:`c`,cc:`cpp`,cpp:`cpp`,cxx:`cpp`,"c++":`cpp`,h:`c`,hh:`cpp`,hpp:`cpp`,cs:`csharp`,css:`css`,less:`less`,scss:`scss`,sass:`scss`,diff:`diff`,patch:`diff`,feature:`gherkin`,go:`go`,gql:`graphql`,graphql:`graphql`,ini:`ini`,cfg:`ini`,conf:`ini`,properties:`ini`,java:`java`,js:`javascript`,jsx:`javascript`,mjs:`javascript`,cjs:`javascript`,json:`json`,jsonc:`json`,kt:`kotlin`,kts:`kotlin`,lua:`lua`,makefile:`makefile`,md:`markdown`,mdx:`markdown`,m:`objectivec`,mm:`objectivec`,pl:`perl`,pm:`perl`,php:`php`,phtml:`php`,py:`python`,pyi:`python`,pyx:`python`,r:`r`,rb:`ruby`,rs:`rust`,sql:`sql`,swift:`swift`,ts:`typescript`,tsx:`typescript`,xml:`xml`,yaml:`yaml`,yml:`yaml`})),Mne=new Set([`md`,`mdx`,`mmd`,`mermaid`]);new Set([...jne,`txt`,`text`,`csv`,`tsv`,`log`,`toml`,`html`,`htm`,`svg`,`vue`,`svelte`,`astro`,`lock`].filter(e=>!Mne.has(e)));const qo=[`image/jpeg`,`image/png`,`image/gif`,`image/webp`,`image/svg+xml`],Nne=[`video/mp4`,`video/webm`,`video/ogg`],Pne=[`audio/mpeg`,`audio/wav`,`audio/ogg`],Fne=[`application/pdf`],Jo=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`,`svg`]),Yo=new Set([`mp4`,`webm`,`mov`,`m4v`,`mkv`]),Ine=new Set([`pdf`]),Xo=new Set([`mp3`,`wav`,`ogg`,`m4a`,`flac`,`aac`,`opus`]),Zo=new Set(`pdf.docx.xlsx.pptx.doc.xls.ppt.zip.7z.tar.gz.rar.csv.tsv.rtf.json.yaml.yml.xml.txt.pages.numbers.key.odt.ods.odp.epub.mobi`.split(`.`)),Qo=new Set(`png.jpg.jpeg.gif.webp.avif.svg.apng.heic.heif.tiff.bmp.ico.pdf.mp4.webm.mov.m4v.mkv.avi.flv.wmv.mpeg.mpg.mp3.wav.ogg.m4a.flac.aac.opus.zip.7z.tar.gz.rar.woff.woff2.ttf.otf.eot.docx.xlsx.pptx.doc.xls.ppt.odt.ods.odp.pages.numbers.key.epub.mobi.csv.tsv.txt.rtf.json.yaml.yml.xml.toml.lock.gpx.html.htm`.split(`.`)),Lne=new Set(`png.jpg.jpeg.gif.webp.avif.apng.heic.heif.tiff.bmp.ico.svg.pdf.mp4.webm.mov.m4v.mkv.mp3.wav.ogg.m4a.flac.aac.opus.json.toml.lock`.split(`.`)),$o=new Set(`png.jpg.jpeg.gif.webp.avif.svg.pdf.mp4.webm.mov.m4v.mkv.mp3.wav.ogg.m4a.flac.aac.opus.docx.xlsx.pptx.doc.xls.ppt.zip.7z.tar.gz.rar.csv.tsv.rtf.json.yaml.yml.xml.txt.pages.numbers.key.odt.ods.odp.epub.mobi`.split(`.`)),es=[`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`],ts=[`mp4`,`webm`,`mov`,`m4v`],ns=[`mp3`,`wav`,`ogg`,`m4a`,`flac`,`aac`,`opus`],rs=[`pdf`],is=[`json`,`toml`,`lock`];function as(e,t,n){for(let r of t)if(!n.has(r))throw Error(`${e}: ${r} is not present in canonical upload constants`)}as(`SIDEBAR_IMAGE_ASSET_EXTENSIONS`,es,Jo),as(`SIDEBAR_VIDEO_ASSET_EXTENSIONS`,ts,Yo),as(`SIDEBAR_AUDIO_ASSET_EXTENSIONS`,ns,Xo),as(`SIDEBAR_PDF_ASSET_EXTENSIONS`,rs,Ine),as(`FILE_ATTACHMENT_EXTENSIONS`,[...Zo],$o),as(`WIKI_EMBED_EXTENSIONS`,[...$o],Qo),new Set(es),new Set(ts),new Set(ns),new Set(rs),new Set(is),as(`SIDEBAR_RENDERABLE_ASSET_EXTENSIONS`,[...new Set([...es,...ts,...ns,...rs,...is])],Lne);const Rne=new Set([`base`,`canvas`]),zne=new Set([`mmd`,`mermaid`]),ss=new Set([...Qo,...Rne,...zne]),cs=[`en`,`zh-Hans`,`zh-Hant`,`hi`,`es`,`ar`,`fr`,`bn`,`pt-BR`,`id`,`ur`],Bne=new Set([`ar`,`ur`]);cs.filter(e=>!Bne.has(e));const Vne=[`off`,`warning`,`error`],ls=`warning`,Hne=[`error`,`warning`],Une=[`base00`,`base01`,`base02`,`base03`,`base04`,`base05`,`base06`,`base07`,`base08`,`base09`,`base0A`,`base0B`,`base0C`,`base0D`,`base0E`,`base0F`],Wne={base00:`default background`,base01:`alt background — cards, popovers, sidebar`,base02:`selection background, borders`,base03:`comments, invisibles`,base04:`secondary text`,base05:`default foreground`,base06:`light foreground`,base07:`lightest foreground`,base08:`red — variables, tags, diff deleted`,base09:`orange — numbers, constants`,base0A:`yellow — classes, search highlight`,base0B:`green — strings, diff inserted`,base0C:`cyan — support, escapes, quotes`,base0D:`blue — functions, headings, accent`,base0E:`magenta — keywords, storage`,base0F:`deprecated markers, embedded tags`};function Gne(e){let t=e.palette;return{background:t.base00,foreground:t.base05,card:t.base01,"card-foreground":t.base05,popover:t.base01,"popover-foreground":t.base05,primary:t.base0D,"primary-foreground":t.base00,secondary:t.base01,"secondary-foreground":t.base05,muted:t.base01,"muted-foreground":t.base04,accent:t.base02,"accent-foreground":t.base05,destructive:t.base08,border:t.base02,input:t.base02,ring:t.base0D,"selection-soft":t.base02,"chart-1":t.base0D,"chart-2":t.base0B,"chart-3":t.base0A,"chart-4":t.base0E,"chart-5":t.base08,sidebar:t.base01,"sidebar-foreground":t.base05,"sidebar-primary":t.base0D,"sidebar-primary-foreground":t.base00,"sidebar-accent":t.base02,"sidebar-accent-foreground":t.base0D,"sidebar-hover":t.base02,"sidebar-border":t.base02,"sidebar-ring":t.base0D,"syntax-keyword":t.base0E,"syntax-tag":t.base08,"syntax-attr":t.base0D,"syntax-string":t.base0B,"syntax-number":t.base09,"syntax-atom":t.base0C,"syntax-comment":t.base03,"syntax-func":t.base0D,"syntax-var":t.base08,"syntax-type":t.base0A,"syntax-operator":t.base05,"syntax-meta":t.base0F,"syntax-bg":t.base01,"link-color":t.base0D,"broken-link-color":t.base08,"lint-warning-color":t.base0A,"lint-error-color":t.base08,"diff-added":t.base0B,"diff-removed":t.base08,"callout-note-color":t.base0D,"callout-info-color":t.base0D,"callout-todo-color":t.base0D,"callout-abstract-color":t.base0C,"callout-tip-color":t.base0B,"callout-success-color":t.base0B,"callout-important-color":t.base0E,"callout-example-color":t.base0E,"callout-question-color":t.base0E,"callout-warning-color":t.base0A,"callout-caution-color":t.base09,"callout-danger-color":t.base09,"callout-failure-color":t.base08,"callout-bug-color":t.base08,"callout-quote-color":t.base03,...qne(t)}}const us={black:`base00`,red:`base08`,green:`base0B`,yellow:`base0A`,blue:`base0D`,magenta:`base0E`,cyan:`base0C`,white:`base05`,brightBlack:`base03`,brightRed:`base08`,brightGreen:`base0B`,brightYellow:`base0A`,brightBlue:`base0D`,brightMagenta:`base0E`,brightCyan:`base0C`,brightWhite:`base07`},Kne=Object.keys(us);function qne(e){let t={};for(let n of Kne)t[`ansi-${Jne(n)}`]=e[us[n]];return t}function Jne(e){return e.replace(/([a-z])([A-Z])/g,`$1-$2`).toLowerCase()}const Yne={name:`Dracula`,author:`clach04 (https://github.com/clach04)`,variant:`dark`,palette:{base00:`#282a36`,base01:`#21222c`,base02:`#44475a`,base03:`#6272a4`,base04:`#9ea8c7`,base05:`#f8f8f2`,base06:`#f8f8f2`,base07:`#ffffff`,base08:`#ff5555`,base09:`#ffb86c`,base0A:`#f1fa8c`,base0B:`#50fa7b`,base0C:`#8be9fd`,base0D:`#bd93f9`,base0E:`#ff79c6`,base0F:`#993333`}},Xne={name:`Catppuccin Frappé`,author:`https://github.com/catppuccin/catppuccin`,variant:`dark`,palette:{base00:`#303446`,base01:`#292c3c`,base02:`#414559`,base03:`#51576d`,base04:`#626880`,base05:`#c6d0f5`,base06:`#f2d5cf`,base07:`#babbf1`,base08:`#e78284`,base09:`#ef9f76`,base0A:`#e5c890`,base0B:`#a6d189`,base0C:`#81c8be`,base0D:`#8caaee`,base0E:`#ca9ee6`,base0F:`#eebebe`}},Zne={name:`Catppuccin Latte`,author:`https://github.com/catppuccin/catppuccin`,variant:`light`,palette:{base00:`#eff1f5`,base01:`#e6e9ef`,base02:`#ccd0da`,base03:`#bcc0cc`,base04:`#acb0be`,base05:`#4c4f69`,base06:`#dc8a78`,base07:`#7287fd`,base08:`#d20f39`,base09:`#fe640b`,base0A:`#df8e1d`,base0B:`#40a02b`,base0C:`#179299`,base0D:`#1e66f5`,base0E:`#8839ef`,base0F:`#dd7878`}},Qne={name:`Monokai`,author:`Wimer Hazenberg (http://www.monokai.nl)`,variant:`dark`,palette:{base00:`#272822`,base01:`#383830`,base02:`#49483e`,base03:`#75715e`,base04:`#a59f85`,base05:`#f8f8f2`,base06:`#f5f4f1`,base07:`#f9f8f5`,base08:`#f92672`,base09:`#fd971f`,base0A:`#f4bf75`,base0B:`#a6e22e`,base0C:`#a1efe4`,base0D:`#66d9ef`,base0E:`#ae81ff`,base0F:`#cc6633`}},$ne={name:`Gruvbox dark, medium`,author:`Dawid Kurek, morhetz (https://github.com/morhetz/gruvbox)`,variant:`dark`,palette:{base00:`#282828`,base01:`#3c3836`,base02:`#504945`,base03:`#665c54`,base04:`#bdae93`,base05:`#d5c4a1`,base06:`#ebdbb2`,base07:`#fbf1c7`,base08:`#fb4934`,base09:`#fe8019`,base0A:`#fabd2f`,base0B:`#b8bb26`,base0C:`#8ec07c`,base0D:`#83a598`,base0E:`#d3869b`,base0F:`#d65d0e`}},ere={name:`Solarized Dark`,author:`Ethan Schoonover (modified by aramisgithub)`,variant:`dark`,palette:{base00:`#002b36`,base01:`#073642`,base02:`#586e75`,base03:`#657b83`,base04:`#839496`,base05:`#93a1a1`,base06:`#eee8d5`,base07:`#fdf6e3`,base08:`#dc322f`,base09:`#cb4b16`,base0A:`#b58900`,base0B:`#859900`,base0C:`#2aa198`,base0D:`#268bd2`,base0E:`#6c71c4`,base0F:`#d33682`}};function ds(e,t,n){return{id:e,label:t,kind:n.variant,scheme:n,toTokens:()=>Gne(n)}}function fs(e,t){return{id:e,label:t,kind:`system`}}const ps=[fs(`default`,`Default`),ds(`dracula`,`Dracula`,Yne),ds(`catppuccin-frappe`,`Catppuccin Frappé`,Xne),ds(`catppuccin-latte`,`Catppuccin Latte`,Zne),ds(`monokai`,`Monokai`,Qne),ds(`gruvbox`,`Gruvbox`,$ne),ds(`solarized`,`Solarized`,ere),fs(`custom`,`Custom`)],ms=ps.map(e=>e.id);new Map(ps.map(e=>[e.id,e]));const hs=Symbol.for(`@inkeep/open-knowledge/field-registry`),gs=globalThis;gs[hs]===void 0&&(gs[hs]=Xr());const _s=gs[hs];function tre(){return Object.fromEntries(Une.map(e=>[e,P().register(_s,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:`Custom theme: base16 ${e} — ${Wne[e]}, as a #rrggbb hex string.`}).optional()]))}function vs(){return ms.filter(e=>e!==`default`&&e!==`custom`).map(e=>`'${e}'`).join(`, `)}const ys=Object.freeze([`authorization`,`auth.token`,`auth.bearer`,`cookie`,`set-cookie`,`x-api-key`,`password`,`secret`]),bs=52428800,xs=26214400,Ss=12582912,Cs=`https://api.openai.com/v1`,ws=`text-embedding-3-small`;function nre(e){let t=e.trim();return t===``?`./`:t}function rre(e){let t=nre(e);return t.includes(`\0`)||t.includes(`\\`)?!1:t===`/`?!0:!(t.startsWith(`/`)||/^[A-Za-z]:/.test(t)||t.split(`/`).some(e=>e===`..`))}const Ts=bo({content:bo({dir:P().register(_s,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Folder OpenKnowledge reads and writes documents under, relative to the project root (the folder that contains .ok/). Defaults to the project root. Exclude paths with .okignore.`}).default(`.`),attachmentFolderPath:P().register(_s,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Where pasted and dropped assets are stored, relative to the content root. './' colocates beside the current document (default); '/' targets the content root; './subdir' targets a subfolder under the current document folder; 'folder' targets a fixed folder under the content root. Whitespace-only values are treated as './'.`}).refine(rre,{message:`Invalid attachment folder path: must not contain '..' segments, NUL bytes, backslashes, or OS absolute paths (use '/' for the content root).`}).default(`./`)}).default({dir:`.`,attachmentFolderPath:`./`}),appearance:bo({theme:V([`light`,`dark`,`system`]).register(_s,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:`Editor color theme: 'light', 'dark', or 'system' (follow the OS). A personal preference (user scope) — not shared with the project.`}).optional(),language:V([`system`,...cs]).register(_s,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:`Interface language. 'system' follows the operating system. A personal preference (user scope) — not shared with the project, and never applied to document content.`}).optional(),colorThemeLight:V(ms).register(_s,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:`IDE color palette applied in light mode: 'default' (no palette), 'custom' (your own colors from appearance.customTheme), or one of ${vs()}. A personal preference (user scope) — not shared with the project.`}).optional(),colorThemeDark:V(ms).register(_s,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:`IDE color palette applied in dark mode: 'default' (no palette), 'custom' (your own colors from appearance.customTheme), or one of ${vs()}. A personal preference (user scope) — not shared with the project.`}).optional(),colorTheme:V(ms).register(_s,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:`Superseded by appearance.colorThemeLight / appearance.colorThemeDark. Read as the palette for both modes while neither of those is set. A personal preference (user scope) — not shared with the project.`}).optional(),colorThemeEnabled:I().register(_s,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:`Whether the Themes plugin appears in Settings → Plugins. A personal preference (user scope). Default on.`}).optional(),customTheme:bo({name:P().register(_s,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:`Custom theme: the scheme's display name.`}).optional(),author:P().register(_s,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:`Custom theme: the scheme's author credit, carried through from an imported base16 scheme.`}).optional(),variant:V([`dark`,`light`]).register(_s,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:`Custom theme: whether the scheme is 'dark' or 'light'. Auto-detected from the palette when omitted.`}).optional(),...tre()}).optional(),preview:bo({autoOpen:I().register(_s,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:`When on, the agent opens or refreshes the live preview after each edit. Turn off if you manage your own preview window. A personal preference (user scope).`}).default(!0)}).default({autoOpen:!0}),sidebar:bo({showHiddenFiles:I().register(_s,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Show dot-prefixed entries (e.g. .ok/, .okignore) in the file tree. Per-machine (project-local) — not shared with collaborators.`}).default(!1),showOnlyMarkdownFiles:I().register(_s,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Show only markdown documents (.md/.mdx) and folders in the file tree, hiding other file types from view. View-only: hidden files stay on disk and remain reachable via links and search. Per-machine (project-local) — not shared with collaborators.`}).default(!1),showSkillsSection:I().register(_s,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Show the Skills section in the sidebar. Skill documents remain reachable via links and search while the section is hidden. Per-machine (project-local) — not shared with collaborators.`}).default(!0),showOkFolders:I().register(_s,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Show .ok folders (skills, templates, and other OpenKnowledge-managed state) in the file tree as read-only entries. .ok/worktrees and .ok/local never appear. Per-machine (project-local) — not shared with collaborators.`}).default(!1)}).optional()}).default({preview:{autoOpen:!0}}),editor:bo({wordWrap:I().register(_s,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:`Soft-wrap long lines in the source (CodeMirror) editor. A personal preference (user scope).`}).default(!0),previewTabs:I().register(_s,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:`Reuse one tab when clicking through the Files and Skills sidebars, the way an editor preview tab works. Turn off to open every click in its own tab. Pinned tabs keep their own tab either way. A personal preference (user scope).`}).default(!0)}).default({wordWrap:!0,previewTabs:!0}),agents:bo({autoApproveOkTools:I().register(_s,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:"Auto-approve OpenKnowledge's own tools (and `ok open` on Claude) for agents launched from the built-in terminal. Destructive tools (delete/move/share/install) still prompt. Per-machine personal preference (user scope)."}).default(!0)}).default({autoApproveOkTools:!0}),autoSync:bo({mode:V(Ko).register(_s,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`How this machine syncs this project with its git remote: 'off' (no sync), 'follow' (one-directional — pull remote changes, never push your own; 'pull' is accepted as a legacy alias), or 'full' (bidirectional pull and push). null = not chosen yet (onboarding asks). Per-machine (project-local) — not shared. Supersedes the legacy autoSync.enabled boolean.`}).nullable().default(null),enabled:I().register(_s,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Legacy per-machine sync toggle, superseded by autoSync.mode. Read only when mode is absent (true = full, false = off). null = not chosen yet. Per-machine (project-local) — not shared.`}).nullable().default(null),resumeMode:V(Ane).register(_s,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`When sync is paused (autoSync.mode 'off') after having been enabled, the active mode to resume into ('follow' | 'full'). Per-machine UI memory; ignored while a mode is active. Not shared.`}).optional(),default:So([I(),V(Ko)]).register(_s,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Committed project default for a machine's sync mode on first open: 'off' | 'follow' | 'full', or the legacy boolean (true = full, false = off). null = ask (show the onboarding prompt). Shared via git. A per-machine autoSync.mode choice overrides it.`}).nullable().default(null)}).default({mode:null,enabled:null,default:null}),terminal:bo({enabled:I().register(_s,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Opt-out for the in-app terminal (a real OS shell at full user privilege). The terminal is on by default; set false to disable it for this project on this machine. Per-machine (project-local) — never shared via git, clone, or sync.`}).nullable().default(null)}).default({enabled:null}),slides:bo({enabled:I().register(_s,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:"Whether the Slides plugin appears in Settings → Plugins. When on, a document whose frontmatter has `slides: true` offers an action that opens the deck in a dedicated window (desktop only, requires a resolvable slidev). A personal preference (user scope). Default off."}).default(!1)}).default({enabled:!1}),telemetry:bo({localSink:bo({enabled:I().register(_s,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:"Write local diagnostic spans + logs under .ok/local/ for `ok diagnose bundle`. Local-only — never leaves the machine until you run bundle. Set false for sensitive workspaces. Shared across collaborators."}).default(!0),spans:bo({maxBytes:F().register(_s,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Maximum size, in bytes, of the local diagnostic spans file before it rotates (default ~50 MB).`}).default(bs)}).default({maxBytes:bs}),logs:bo({maxBytes:F().register(_s,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Maximum size, in bytes, of the local diagnostic logs file before it rotates (default ~25 MB).`}).default(xs)}).default({maxBytes:xs}),attributeDenylist:R(P()).register(_s,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Telemetry attribute keys whose values are redacted before any local span/log is written (credential / secret guard). Extends the built-in denylist.`}).default([...ys])}).default({enabled:!0,spans:{maxBytes:bs},logs:{maxBytes:xs},attributeDenylist:[...ys]}),skillInstallReports:bo({enabled:I().register(_s,{scope:`user`,agentSettable:!1,defaultScope:`user`,description:`Report skill installs to skills.sh so a published skill shows an accurate install count. Sends the skill name, its source repo, and which agent tools it was installed for — never file contents, and never for a private or local source. One report per skill per machine. Default on; the DO_NOT_TRACK and DISABLE_TELEMETRY environment variables also turn it off.`}).default(!0)}).default({enabled:!0})}).default({localSink:{enabled:!0,spans:{maxBytes:bs},logs:{maxBytes:xs},attributeDenylist:[...ys]},skillInstallReports:{enabled:!0}}),lossCapture:bo({enabled:I().register(_s,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:"Record bridge loss-class events (content-free) under .ok/local/loss-capture/ for `ok diagnose bundle`. Local-only — never leaves the machine until you run bundle. Set false for sensitive workspaces. Shared across collaborators."}).default(!0),maxBytes:F().register(_s,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Maximum size, in bytes, of the local loss-capture file before it rotates (default ~12 MB).`}).default(Ss)}).default({enabled:!0,maxBytes:Ss}),bridge:bo({backgroundThrottle:bo({enabled:I().register(_s,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Keep the desktop window's timers running at full rate while it holds unsynced work, so backgrounding the app never starves sync or recovery; when the window is idle the OS-default background throttling is restored (battery). Honored by the desktop app. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0}),deferGuard:bo({enabled:I().register(_s,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Defer a drain-shaped Observer B re-derive when the WYSIWYG fragment holds an un-propagated keystroke Y.Text lacks, so the keystroke survives instead of being stomped. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0}),lossDetector:bo({enabled:I().register(_s,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Detect content the bridge silently dropped at its reconciliation boundary (an Observer-A apply arm or a paired agent-undo derive) and write a recovery checkpoint plus a content-free loss event. Detection only — never blocks a write. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0}),fixedPoint:bo({enabled:I().register(_s,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Bound the Y.Text→WYSIWYG re-derive loop with a drain-count backstop: a run of re-derive drains that never reaches a raw-byte fixed point freezes the re-derive loop and writes a recovery checkpoint plus a content-free loss event, instead of churning unbounded. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0}),preDrain:bo({enabled:I().register(_s,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Before an agent write or undo rebuilds the WYSIWYG fragment, flush an un-propagated keystroke that provably does not overlap the operation into Y.Text so the keystroke survives instead of needing recovery; overlapping or unmodellable cases fall back to the checkpoint floor. Scope: appending writes and single-frame undos — a write that replaces the whole body (replace / edit) overwrites the keystroke either way, so those always take the checkpoint floor. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0}),flushOnHide:bo({enabled:I().register(_s,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`On tab hide/unload, force-send each doc's unsynced work to the server and commit its local cache, and re-sync on return to foreground, so a backgrounded tab never strands edits that IndexedDB alone would lose on recycle. Honored client-side. Default ON — disable only to isolate a suspected regression.`}).default(!0)}).default({enabled:!0})}).default({backgroundThrottle:{enabled:!0},deferGuard:{enabled:!0},lossDetector:{enabled:!0},fixedPoint:{enabled:!0},preDrain:{enabled:!0},flushOnHide:{enabled:!0}}),search:bo({semantic:bo({enabled:I().register(_s,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:"Add semantic (embeddings) ranking to the MCP search tool, fused with the lexical engine so conceptually-related pages surface even with no shared keywords. When ON and an API key is set (`ok embeddings set-key`), the search query and matching document content are sent to the configured embeddings provider — content egress. Default OFF. Per-machine (project-local) — not shared with collaborators."}).default(!1),baseUrl:P().register(_s,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:"Base URL of the OpenAI-compatible embeddings API (default https://api.openai.com/v1). Override to point at a self-hosted server (Ollama / vLLM / LM Studio) or another provider. The API key is NOT stored here — set it with `ok embeddings set-key` (`~/.ok/secrets.yml`); it is sent to whichever endpoint this names."}).default(Cs),model:P().register(_s,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Embeddings model id (default text-embedding-3-small). Must be served by the provider at baseUrl. Changing it re-embeds the corpus (the cache is keyed by provider + model + dimensions).`}).default(ws),dimensions:F().int().positive().register(_s,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Optional output vector dimensions. Omit (recommended) to detect the model's native size from its first response — that is what lets a non-OpenAI model work without knowing its size up front. Set a smaller value (text-embedding-3 supports e.g. 512 / 1024) to shrink the on-disk cache, trading a little retrieval quality; a server that ignores the request param then fails loudly instead of silently. Changing it re-embeds the corpus.`}).optional(),similarityFloor:F().min(0).max(1).register(_s,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Optional hard cutoff: drop any "by meaning" match whose cosine similarity is below this value. Off by default (0) because retrieval is rank-based (the closest pages are returned regardless of absolute score) and the right cutoff is model-specific. Set it only to suppress weak matches for a specific provider/model whose cosine scale you know. Most setups should leave it unset and rely on the result-count cap.`}).optional()}).default({enabled:!1,baseUrl:Cs,model:ws})}).default({semantic:{enabled:!1,baseUrl:Cs,model:ws}}),contentRules:bo({markdownlint:z({enabled:I().register(_s,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Whether the markdownlint plugin (body rules) contributes diagnostics.`}).default(!1)}).default({enabled:!1}),frontmatter:z({enabled:I().register(_s,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Whether the frontmatter plugin (JSON-Schema validation of document frontmatter) contributes diagnostics.`}).default(!1),schemas:R(z({appliesTo:So([P(),R(P())]).optional(),file:P(),enabled:I().optional()})).register(_s,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Frontmatter schema mappings: which docs (appliesTo globs) validate against which JSON Schema file (project-root-relative path).`}).default([])}).default({enabled:!1,schemas:[]})}).default({markdownlint:{enabled:!1},frontmatter:{enabled:!1,schemas:[]}}),validation:bo({links:V(Vne).register(_s,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`How broken internal links are reported on the validation plane: 'off' hides them, 'warning' (default) or 'error' sets their severity.`}).default(ls),fileTreeIndicators:I().register(_s,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`Whether the file tree tints and badges files that have validation problems.`}).default(!0)}).default({links:ls,fileTreeIndicators:!0}),linkPreviews:bo({enabled:I().register(_s,{scope:`project-local`,agentSettable:!1,defaultScope:`project-local`,description:`Show a rich preview card (site name, page title, description, favicon) when you hover an external link in the editor. When ON, hovering an external link sends that link's URL to the destination site to fetch its preview metadata — outbound egress, one request per previewed link. Default ON; set to false to turn external previews off. Per-machine (project-local) — not shared with collaborators. Previews of links to other documents in this project are read from the local index with no network request and are always on.`}).default(!0)}).default({enabled:!0}),remote:bo({url:P().register(_s,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:"Public URL your tunnel gives you, e.g. https://myproject.ngrok.app. Used only with `ok start --remote` (config alone never enables remote access); its host is admitted through the Host-header allowlist. There is no server-side auth, so restrict access at the tunnel (ngrok OAuth, Cloudflare Access, Tailscale ACLs)."}).optional(),port:F().int().min(1).max(65535).register(_s,{scope:`project`,agentSettable:!1,defaultScope:`project`,description:`TCP port the server binds when remote access is enabled (default 24550). Fixed so the tunnel's port mapping survives restarts. Set it only on a conflict. An explicit --port still wins; the PORT env var is ignored in remote mode.`}).default(24550)}).default({port:24550})});var Es,Ds=n((()=>{Es=`1.9.1`}));function ire(e){let t=new Set([e]),n=new Set,r=e.match(Os);if(!r)return()=>!1;let i={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[4]};if(i.prerelease!=null)return function(t){return t===e};function a(e){return n.add(e),!1}function o(e){return t.add(e),!0}return function(e){if(t.has(e))return!0;if(n.has(e))return!1;let r=e.match(Os);if(!r)return a(e);let s={major:+r[1],minor:+r[2],patch:+r[3],prerelease:r[4]};return s.prerelease!=null||i.major!==s.major?a(e):i.major===0?i.minor===s.minor&&i.patch<=s.patch?o(e):a(e):i.minor<=s.minor?o(e):a(e)}}var Os,ks,are=n((()=>{Ds(),Os=/^(\d+)\.(\d+)\.(\d+)(-(.+))?$/,ks=ire(Es)}));function As(e,t,n,r=!1){let i=Fs[Ps]=Fs[Ps]??{version:Es};if(!r&&i[e]){let t=Error(`@opentelemetry/api: Attempted duplicate registration of API: ${e}`);return n.error(t.stack||t.message),!1}if(i.version!==`1.9.1`){let t=Error(`@opentelemetry/api: Registration of version v${i.version} for ${e} does not match previously registered API v${Es}`);return n.error(t.stack||t.message),!1}return i[e]=t,n.debug(`@opentelemetry/api: Registered a global for ${e} v${Es}.`),!0}function js(e){let t=Fs[Ps]?.version;if(!(!t||!ks(t)))return Fs[Ps]?.[e]}function Ms(e,t){t.debug(`@opentelemetry/api: Unregistering a global for ${e} v${Es}.`);let n=Fs[Ps];n&&delete n[e]}var Ns,Ps,Fs,Is=n((()=>{Ds(),are(),Ns=Es.split(`.`)[0],Ps=Symbol.for(`opentelemetry.js.api.${Ns}`),Fs=typeof globalThis==`object`?globalThis:typeof self==`object`?self:typeof window==`object`?window:typeof global==`object`?global:{}}));function Ls(e,t,n){let r=js(`diag`);if(r)return r[e](t,...n)}var Rs,ore=n((()=>{Is(),Rs=class{constructor(e){this._namespace=e.namespace||`DiagComponentLogger`}debug(...e){return Ls(`debug`,this._namespace,e)}error(...e){return Ls(`error`,this._namespace,e)}info(...e){return Ls(`info`,this._namespace,e)}warn(...e){return Ls(`warn`,this._namespace,e)}verbose(...e){return Ls(`verbose`,this._namespace,e)}}})),zs,Bs=n((()=>{(function(e){e[e.NONE=0]=`NONE`,e[e.ERROR=30]=`ERROR`,e[e.WARN=50]=`WARN`,e[e.INFO=60]=`INFO`,e[e.DEBUG=70]=`DEBUG`,e[e.VERBOSE=80]=`VERBOSE`,e[e.ALL=9999]=`ALL`})(zs||={})}));function sre(e,t){e<zs.NONE?e=zs.NONE:e>zs.ALL&&(e=zs.ALL),t||={};function n(n,r){let i=t[n];return typeof i==`function`&&e>=r?i.bind(t):function(){}}return{error:n(`error`,zs.ERROR),warn:n(`warn`,zs.WARN),info:n(`info`,zs.INFO),debug:n(`debug`,zs.DEBUG),verbose:n(`verbose`,zs.VERBOSE)}}var cre=n((()=>{Bs()})),Vs,Hs,Us=n((()=>{ore(),cre(),Bs(),Is(),Vs=`diag`,Hs=class e{static instance(){return this._instance||=new e,this._instance}constructor(){function e(e){return function(...t){let n=js(`diag`);if(n)return n[e](...t)}}let t=this;t.setLogger=(e,n={logLevel:zs.INFO})=>{if(e===t){let e=Error(`Cannot use diag as the logger for itself. Please use a DiagLogger implementation like ConsoleDiagLogger or a custom implementation`);return t.error(e.stack??e.message),!1}typeof n==`number`&&(n={logLevel:n});let r=js(`diag`),i=sre(n.logLevel??zs.INFO,e);if(r&&!n.suppressOverrideMessage){let e=Error().stack??`<failed to generate stacktrace>`;r.warn(`Current logger will be overwritten from ${e}`),i.warn(`Current logger will overwrite one already registered from ${e}`)}return As(`diag`,i,t,!0)},t.disable=()=>{Ms(Vs,t)},t.createComponentLogger=e=>new Rs(e),t.verbose=e(`verbose`),t.debug=e(`debug`),t.info=e(`info`),t.warn=e(`warn`),t.error=e(`error`)}}}));function lre(e){return Symbol.for(e)}var Ws,Gs,Ks=n((()=>{Ws=class e{constructor(t){let n=this;n._currentContext=t?new Map(t):new Map,n.getValue=e=>n._currentContext.get(e),n.setValue=(t,r)=>{let i=new e(n._currentContext);return i._currentContext.set(t,r),i},n.deleteValue=t=>{let r=new e(n._currentContext);return r._currentContext.delete(t),r}}},Gs=new Ws})),qs,ure=n((()=>{Ks(),qs=class{active(){return Gs}with(e,t,n,...r){return t.call(n,...r)}bind(e,t){return t}enable(){return this}disable(){return this}}})),Js,Ys,Xs,Zs=n((()=>{ure(),Is(),Us(),Js=`context`,Ys=new qs,Xs=class e{constructor(){}static getInstance(){return this._instance||=new e,this._instance}setGlobalContextManager(e){return As(Js,e,Hs.instance())}active(){return this._getContextManager().active()}with(e,t,n,...r){return this._getContextManager().with(e,t,n,...r)}bind(e,t){return this._getContextManager().bind(e,t)}_getContextManager(){return js(Js)||Ys}disable(){this._getContextManager().disable(),Ms(Js,Hs.instance())}}})),Qs,$s=n((()=>{(function(e){e[e.NONE=0]=`NONE`,e[e.SAMPLED=1]=`SAMPLED`})(Qs||={})})),ec,tc,nc,rc=n((()=>{$s(),ec=`0000000000000000`,tc=`00000000000000000000000000000000`,nc={traceId:tc,spanId:ec,traceFlags:Qs.NONE}})),ic,ac=n((()=>{rc(),ic=class{constructor(e=nc){this._spanContext=e}spanContext(){return this._spanContext}setAttribute(e,t){return this}setAttributes(e){return this}addEvent(e,t){return this}addLink(e){return this}addLinks(e){return this}setStatus(e){return this}updateName(e){return this}end(e){}isRecording(){return!1}recordException(e,t){}}}));function oc(e){return e.getValue(fc)||void 0}function sc(){return oc(Xs.getInstance().active())}function cc(e,t){return e.setValue(fc,t)}function lc(e){return e.deleteValue(fc)}function uc(e,t){return cc(e,new ic(t))}function dc(e){return oc(e)?.spanContext()}var fc,pc=n((()=>{Ks(),ac(),Zs(),fc=lre(`OpenTelemetry Context Key SPAN`)}));function mc(e,t){if(typeof e!=`string`||e.length!==t)return!1;let n=0;for(let t=0;t<e.length;t+=4)n+=(yc[e.charCodeAt(t)]|0)+(yc[e.charCodeAt(t+1)]|0)+(yc[e.charCodeAt(t+2)]|0)+(yc[e.charCodeAt(t+3)]|0);return n===t}function hc(e){return mc(e,32)&&e!==`00000000000000000000000000000000`}function gc(e){return mc(e,16)&&e!==`0000000000000000`}function _c(e){return hc(e.traceId)&&gc(e.spanId)}function vc(e){return new ic(e)}var yc,bc=n((()=>{rc(),ac(),yc=new Uint8Array([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,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,1,1,1,1,1,1,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,1,1,1,1,1])}));function xc(e){return typeof e==`object`&&!!e&&`spanId`in e&&typeof e.spanId==`string`&&`traceId`in e&&typeof e.traceId==`string`&&`traceFlags`in e&&typeof e.traceFlags==`number`}var Sc,Cc,wc=n((()=>{Zs(),pc(),ac(),bc(),Sc=Xs.getInstance(),Cc=class{startSpan(e,t,n=Sc.active()){if(t?.root)return new ic;let r=n&&dc(n);return xc(r)&&_c(r)?new ic(r):new ic}startActiveSpan(e,t,n,r){let i,a,o;if(arguments.length<2)return;arguments.length===2?o=t:arguments.length===3?(i=t,o=n):(i=t,a=n,o=r);let s=a??Sc.active(),c=this.startSpan(e,i,s),l=cc(s,c);return Sc.with(l,o,void 0,c)}}})),Tc,Ec,Dc=n((()=>{wc(),Tc=new Cc,Ec=class{constructor(e,t,n,r){this._provider=e,this.name=t,this.version=n,this.options=r}startSpan(e,t,n){return this._getTracer().startSpan(e,t,n)}startActiveSpan(e,t,n,r){let i=this._getTracer();return Reflect.apply(i.startActiveSpan,i,arguments)}_getTracer(){if(this._delegate)return this._delegate;let e=this._provider.getDelegateTracer(this.name,this.version,this.options);return e?(this._delegate=e,this._delegate):Tc}}})),Oc,kc=n((()=>{wc(),Oc=class{getTracer(e,t,n){return new Cc}}})),Ac,jc,Mc=n((()=>{Dc(),kc(),Ac=new Oc,jc=class{getTracer(e,t,n){return this.getDelegateTracer(e,t,n)??new Ec(this,e,t,n)}getDelegate(){return this._delegate??Ac}setDelegate(e){this._delegate=e}getDelegateTracer(e,t,n){return this._delegate?.getTracer(e,t,n)}}})),Nc,Pc=n((()=>{(function(e){e[e.UNSET=0]=`UNSET`,e[e.OK=1]=`OK`,e[e.ERROR=2]=`ERROR`})(Nc||={})})),Fc,Ic=n((()=>{Zs(),Fc=Xs.getInstance()})),Lc,Rc,zc=n((()=>{Is(),Mc(),bc(),pc(),Us(),Lc=`trace`,Rc=class e{constructor(){this._proxyTracerProvider=new jc,this.wrapSpanContext=vc,this.isSpanContextValid=_c,this.deleteSpan=lc,this.getSpan=oc,this.getActiveSpan=sc,this.getSpanContext=dc,this.setSpan=cc,this.setSpanContext=uc}static getInstance(){return this._instance||=new e,this._instance}setGlobalTracerProvider(e){let t=As(Lc,this._proxyTracerProvider,Hs.instance());return t&&this._proxyTracerProvider.setDelegate(e),t}getTracerProvider(){return js(Lc)||this._proxyTracerProvider}getTracer(e,t){return this.getTracerProvider().getTracer(e,t)}disable(){Ms(Lc,Hs.instance()),this._proxyTracerProvider=new jc}}})),Bc,Vc=n((()=>{zc(),Bc=Rc.getInstance()})),Hc=n((()=>{Us(),Ks(),Bs(),Dc(),Mc(),Pc(),$s(),bc(),rc(),Ic(),Vc()}));const Uc=z({file:P(),line:F().int().min(1),column:F().int().min(1),snippet:P().optional()}),Wc=z({path:R(So([P(),F()])),message:P(),issueCode:P(),params:B(P(),L()).optional(),source:Uc.optional()}),Gc=V([`user`,`project`,`project-local`,`either`]),Kc=V([`user`,`project`,`project-local`]),qc=z({code:H(`YAML_PARSE`),detail:P()}),Jc=z({code:H(`UNREADABLE`),detail:P()}),Yc=z({code:H(`SCHEMA_INVALID`),issues:R(Wc)}),Xc=z({code:H(`REMOVED_KEY`),path:R(P()),redirect:P(),source:Uc.optional()}),Zc=Co(`code`,[qc,Yc,Jc,z({code:H(`SCOPE_VIOLATION`),path:R(P()),expectedScope:Gc,actualScope:Kc}),z({code:H(`NOT_AGENT_SETTABLE`),path:R(P())}),z({code:H(`MIXED_SCOPE`),paths:R(z({path:R(P()),scope:Kc}))}),Xc,z({code:H(`WRITE_ERROR`),detail:P()}),z({code:H(`OKIGNORE_INVALID`),detail:P(),lineNumber:F().int().min(1).optional()}),z({code:H(`UNKNOWN`),message:P().optional()})]);Co(`code`,[Xc,qc,Yc,Jc]),z({diagnostics:R(Co(`code`,[z({code:H(`REMOVED_KEY`),scope:Kc,file:P(),path:R(P()),redirect:P()}),z({code:H(`YAML_PARSE`),scope:Kc,file:P()}),z({code:H(`SCHEMA_INVALID`),scope:Kc,file:P()}),z({code:H(`UNREADABLE`),scope:Kc,file:P()})]))});const Qc=new Set(Zc.options.map(e=>e.shape.code.value)),$c=So([Zc,bo({code:P(),message:P().optional()})]);function el(e){return Qc.has(e.code)}function tl(e){switch(e){case`user`:return`~/.ok/global.yml`;case`project`:return`.ok/config.yml`;case`project-local`:return`.ok/local/config.yml`;case`either`:return`.ok/config.yml or ~/.ok/global.yml`}}function nl(e){switch(e){case`user`:return`personal to you, across all projects`;case`project`:return`shared with your team via git`;case`project-local`:return`this machine only, not shared`;case`either`:return`user or project`}}function rl(e){if(!el(e))return e.message??`Unknown error (${e.code}).`;switch(e.code){case`YAML_PARSE`:return`Failed to parse YAML: ${e.detail}`;case`UNREADABLE`:return`Could not read the file: ${e.detail}`;case`SCHEMA_INVALID`:{if(e.issues.length===0)return`Invalid configuration.`;let t=new Map;for(let n of e.issues){let e=n.source?.file??`<no source>`,r=t.get(e)??[];r.push(n),t.set(e,r)}let n=[];for(let[e,r]of t){e===`<no source>`?n.push(`Invalid configuration:`):n.push(`Invalid configuration at ${e}:`);for(let t of r){let r=t.path.length===0?`<root>`:t.path.join(`.`);if(t.source){if(n.push(` ${e}:${t.source.line}:${t.source.column}`),n.push(` ${r}: ${t.message}`),t.source.snippet&&t.source.snippet.length>0)for(let e of t.source.snippet.split(`
182
182
  `))n.push(` ${e}`)}else n.push(` ${r}: ${t.message}`)}}return n.join(`
183
183
  `)}case`SCOPE_VIOLATION`:return[`Setting ${e.path.join(`.`)} belongs in your ${e.expectedScope} config`,`(${tl(e.expectedScope)} — ${nl(e.expectedScope)}),`,`but it was set in the ${e.actualScope} config (${tl(e.actualScope)}).`,`Move it to ${tl(e.expectedScope)}.`].join(` `);case`NOT_AGENT_SETTABLE`:return[`Setting ${e.path.join(`.`)} is human-only and can't be changed by an agent.`,`Change it in the Settings pane, or edit the config.yml by hand.`].join(` `);case`MIXED_SCOPE`:return[`This change touches settings that live in different config files. Apply them one file at a time:`,e.paths.map(({path:e,scope:t})=>` ${e.join(`.`)} → ${tl(t)} (${t})`).join(`
184
184
  `)].join(`
@@ -406,49 +406,49 @@ ${t.slice(l+2)}`,d+=1;else break}t.push({indent:l,number:parseInt(s,10),content:
406
406
  `){let{editColumn:r,deleteCount:i,insertText:a}=fq(t),o=r-1;return i===-1?null:e.slice(0,o)+a.replace(/\n/g,n)+e.slice(o+i)}function mq(e,t){let n=Z.getPreferredLineEnding(e,wU),r=e.split(Z.newLineRe),i=t.filter(e=>e.fixInfo).map(e=>fq(e.fixInfo,e.lineNumber));i.sort((e,t)=>{let n=e.deleteCount===-1,r=t.deleteCount===-1;return t.lineNumber-e.lineNumber||(n?1:r?-1:0)||t.editColumn-e.editColumn||t.insertText.length-e.insertText.length});let a={};i=i.filter(e=>{let t=e.lineNumber!==a.lineNumber||e.editColumn!==a.editColumn||e.deleteCount!==a.deleteCount||e.insertText!==a.insertText;return a=e,t}),a={lineNumber:-1};for(let e of i)e.lineNumber===a.lineNumber&&e.editColumn===a.editColumn&&!e.insertText&&e.deleteCount>0&&a.insertText&&!a.deleteCount&&(e.insertText=a.insertText,a.lineNumber=0),a=e;i=i.filter(e=>e.lineNumber);let o=-1,s=-1;for(let e of i){let{lineNumber:t,editColumn:i,deleteCount:a}=e,c=t-1,l=i-1;(c!==o||a===-1||l+a<=s-(a>0?0:1))&&(r[c]=pq(r[c],e,n)),o=c,s=l}return r.filter(e=>e!==null).join(n)}function hq(e,t){return mq(e,dq({strings:{doc:e},config:t}).doc??[])}function gq(e,t){let n=dq({strings:{doc:e},config:t}).doc??[],r=e.split(`
407
407
  `),i=_q(t);return n.map(e=>yq(e,r,vq(e,i)))}function _q(e){let t=new Map;return Object.entries(e).forEach(([e,n],r)=>{let i=e.toUpperCase();if(i===`DEFAULT`)return;let a=null;if(n===`error`||n===`warning`)a=n;else if(typeof n==`object`&&n&&!Array.isArray(n)){let e=n.severity;(e===`error`||e===`warning`)&&(a=e)}a!==null&&t.set(i,{entryIndex:r,severity:a})}),t}function vq(e,t){let n;for(let r of e.ruleNames){let e=t.get(r.toUpperCase());e!==void 0&&(n===void 0||e.entryIndex>n.entryIndex)&&(n=e)}return n?.severity??`warning`}function yq(e,t,n){let[r,i]=e.errorRange??[1,null],a=e.lineNumber-1,o=(r??1)-1,s=t[a]?.length??0,c=i==null?s:Math.min(o+i,s),l=e.fixInfo?[bq(e.fixInfo,e.lineNumber,t)]:void 0;return{range:{start:{line:a,character:o},end:{line:a,character:Math.max(c,o)}},severity:n,source:`markdownlint`,code:e.ruleNames[0]??`MD000`,message:e.errorDetail?`${e.ruleDescription}: ${e.errorDetail}`:e.ruleDescription,...l?{fixes:l}:{}}}function bq(e,t,n){let r=e.lineNumber??t,i=r-1;if(e.deleteCount===-1){if(r<n.length)return{range:{start:{line:i,character:0},end:{line:i+1,character:0}},newText:``};if(i>0){let e=n[i-1]?.length??0;return{range:{start:{line:i-1,character:e},end:{line:i,character:n[i]?.length??0}},newText:``}}return{range:{start:{line:0,character:0},end:{line:0,character:n[0]?.length??0}},newText:``}}let a=(e.editColumn??1)-1;return{range:{start:{line:i,character:a},end:{line:i,character:a+Math.max(0,e.deleteCount??0)}},newText:e.insertText??``}}const xq=So([I(),V(Hne),B(P(),L())]),Sq={id:`markdownlint`,sliceSchema:z({enabled:I(),rules:B(P(),xq)}),defaultSlice:{enabled:!1,rules:XB},async lint(e,t){return gq(e,ZB(t.rules))},fix(e,t){return hq(e,ZB(t.rules))}},Cq=z({appliesTo:So([P(),R(P())]).optional(),file:P(),enabled:I().optional(),key:P().optional(),schema:B(P(),L()).optional()}),wq=[Sq,{id:`frontmatter`,sliceSchema:z({enabled:I(),schemas:R(Cq)}),defaultSlice:{enabled:!1,schemas:[]},async lint(e,t,n){return SU(e,oU(t.schemas,n.docName))}}];Object.fromEntries(wq.map(e=>[e.id,e.defaultSlice]));const Tq=Object.fromEntries(wq.map(e=>[e.id,e.sliceSchema]));z({effective:z({enabled:I(),plugins:z(Tq)}),configFile:P().nullable().optional(),configProblems:R(P()).optional()});const Eq=So([I(),B(P(),L())]);z({ruleId:P().min(1).max(64).regex(/^[A-Za-z][A-Za-z0-9_-]*$/),value:So([Eq,vo()])}),z({file:P().min(1).max(512),delete:H(!0).optional(),field:P().min(1).max(256).optional(),parentPath:R(So([P().min(1).max(256),z({items:H(!0)}).strict()])).max(8).optional(),removeField:H(!0).optional(),renameTo:P().min(1).max(256).optional(),constraint:z({type:V([`string`,`number`,`boolean`,`array`,`object`]).nullable().optional(),enum:R(So([P(),F(),I()])).nullable().optional(),itemsEnum:R(So([P(),F(),I()])).nullable().optional(),itemsType:V([`string`,`number`,`boolean`,`object`]).nullable().optional(),pattern:P().nullable().optional(),format:P().nullable().optional(),description:P().max(2048).nullable().optional(),required:I().optional()}).optional()}).refine(e=>e.delete===void 0||e.field===void 0&&e.constraint===void 0&&e.removeField===void 0&&e.renameTo===void 0,{message:`delete cannot be combined with a field edit`}).refine(e=>[e.constraint,e.removeField,e.renameTo].filter(e=>e!==void 0).length<=1,{message:`constraint, removeField, and renameTo are mutually exclusive`}).refine(e=>e.removeField===void 0&&e.renameTo===void 0||e.field!==void 0,{message:`removeField and renameTo require field`}).refine(e=>e.parentPath===void 0||e.field!==void 0,{message:`parentPath requires field`}).refine(e=>e.field===void 0?e.constraint===void 0:e.constraint!==void 0||e.removeField!==void 0||e.renameTo!==void 0,{message:`field requires constraint, removeField, or renameTo`}),z({schemas:R(P()),truncated:I()}).strict();const Dq=z({line:F(),character:F()}),Oq=z({start:Dq,end:Dq}),kq=z({range:Oq,severity:V([`error`,`warning`,`info`,`hint`]),source:P(),code:P(),message:P(),fixes:R(z({range:Oq,newText:P()})).optional(),frontmatterScope:V([`missing`,`invalid`]).optional(),frontmatterProperty:P().optional()});z({files:R(z({file:P(),diagnostics:R(kq),warnings:R(P()).optional()})),fileCount:F(),errorCount:F(),warningCount:F(),warnings:R(P())});const Aq=kq.extend({linkTarget:P().optional()});z({files:R(z({file:P(),diagnostics:R(Aq)})),fileCount:F(),errorCount:F(),warningCount:F(),warnings:R(P())});const jq=z({errorCount:F().int().nonnegative(),warningCount:F().int().nonnegative()});z({files:R(z({file:P(),lint:jq,links:jq})),fileCount:F().int().nonnegative(),errorCount:F().int().nonnegative(),warningCount:F().int().nonnegative(),warnings:R(P())}),z({docName:yw,summary:xw,...bw}).loose(),z({file:P(),fixedCount:F(),diagnostics:R(kq),errorCount:F(),warningCount:F(),warning:P().optional()});const Mq=[{id:`MD001`,alias:`heading-increment`,aliases:[`heading-increment`],name:`Heading levels should only increment by one level at a time`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md001.md`,tags:[`headings`],options:[{key:`front_matter_title`,type:`string`,description:`RegExp for matching title in front matter`,default:`^\\s*title\\s*[:=]`}]},{id:`MD003`,alias:`heading-style`,aliases:[`heading-style`],name:`Heading style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md003.md`,tags:[`headings`],options:[{key:`style`,type:`enum`,description:`Heading style`,enum:[`consistent`,`atx`,`atx_closed`,`setext`,`setext_with_atx`,`setext_with_atx_closed`],default:`consistent`}]},{id:`MD004`,alias:`ul-style`,aliases:[`ul-style`],name:`Unordered list style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md004.md`,tags:[`bullet`,`ul`],options:[{key:`style`,type:`enum`,description:`List style`,enum:[`consistent`,`asterisk`,`plus`,`dash`,`sublist`],default:`consistent`}]},{id:`MD005`,alias:`list-indent`,aliases:[`list-indent`],name:`Inconsistent indentation for list items at the same level`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md005.md`,tags:[`bullet`,`ul`,`indentation`],options:[]},{id:`MD007`,alias:`ul-indent`,aliases:[`ul-indent`],name:`Unordered list indentation`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md007.md`,tags:[`bullet`,`ul`,`indentation`],options:[{key:`indent`,type:`integer`,description:`Spaces for indent`,default:2,minimum:1},{key:`start_indented`,type:`boolean`,description:`Whether to indent the first level of the list`,default:!1},{key:`start_indent`,type:`integer`,description:`Spaces for first level indent (when start_indented is set)`,default:2,minimum:1}]},{id:`MD009`,alias:`no-trailing-spaces`,aliases:[`no-trailing-spaces`],name:`Trailing spaces`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md009.md`,tags:[`whitespace`],options:[{key:`br_spaces`,type:`integer`,description:`Spaces for line break`,default:2,minimum:0},{key:`code_blocks`,type:`boolean`,description:`Include code blocks`,default:!1},{key:`list_item_empty_lines`,type:`boolean`,description:`Allow spaces for empty lines in list items`,default:!1},{key:`strict`,type:`boolean`,description:`Include unnecessary breaks`,default:!1}]},{id:`MD010`,alias:`no-hard-tabs`,aliases:[`no-hard-tabs`],name:`Hard tabs`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md010.md`,tags:[`whitespace`,`hard_tab`],options:[{key:`code_blocks`,type:`boolean`,description:`Include code blocks`,default:!0},{key:`ignore_code_languages`,type:`string-array`,description:`Fenced code languages to ignore`,default:[]},{key:`spaces_per_tab`,type:`integer`,description:`Number of spaces for each hard tab`,default:1,minimum:0}]},{id:`MD011`,alias:`no-reversed-links`,aliases:[`no-reversed-links`],name:`Reversed link syntax`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md011.md`,tags:[`links`],options:[]},{id:`MD012`,alias:`no-multiple-blanks`,aliases:[`no-multiple-blanks`],name:`Multiple consecutive blank lines`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md012.md`,tags:[`whitespace`,`blank_lines`],options:[{key:`maximum`,type:`integer`,description:`Consecutive blank lines`,default:1,minimum:1}]},{id:`MD013`,alias:`line-length`,aliases:[`line-length`],name:`Line length`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md013.md`,tags:[`line_length`],options:[{key:`line_length`,type:`integer`,description:`Number of characters`,default:80,minimum:1},{key:`heading_line_length`,type:`integer`,description:`Number of characters for headings`,default:80,minimum:1},{key:`code_block_line_length`,type:`integer`,description:`Number of characters for code blocks`,default:80,minimum:1},{key:`code_blocks`,type:`boolean`,description:`Include code blocks`,default:!0},{key:`tables`,type:`boolean`,description:`Include tables`,default:!0},{key:`headings`,type:`boolean`,description:`Include headings`,default:!0},{key:`strict`,type:`boolean`,description:`Strict length checking`,default:!1},{key:`stern`,type:`boolean`,description:`Stern length checking`,default:!1}]},{id:`MD014`,alias:`commands-show-output`,aliases:[`commands-show-output`],name:`Dollar signs used before commands without showing output`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md014.md`,tags:[`code`],options:[]},{id:`MD018`,alias:`no-missing-space-atx`,aliases:[`no-missing-space-atx`],name:`No space after hash on atx style heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md018.md`,tags:[`headings`,`atx`,`spaces`],options:[]},{id:`MD019`,alias:`no-multiple-space-atx`,aliases:[`no-multiple-space-atx`],name:`Multiple spaces after hash on atx style heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md019.md`,tags:[`headings`,`atx`,`spaces`],options:[]},{id:`MD020`,alias:`no-missing-space-closed-atx`,aliases:[`no-missing-space-closed-atx`],name:`No space inside hashes on closed atx style heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md020.md`,tags:[`headings`,`spaces`,`atx_closed`],options:[]},{id:`MD021`,alias:`no-multiple-space-closed-atx`,aliases:[`no-multiple-space-closed-atx`],name:`Multiple spaces inside hashes on closed atx style heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md021.md`,tags:[`headings`,`spaces`,`atx_closed`],options:[]},{id:`MD022`,alias:`blanks-around-headings`,aliases:[`blanks-around-headings`],name:`Headings should be surrounded by blank lines`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md022.md`,tags:[`headings`,`blank_lines`],options:[{key:`include_front_matter`,type:`boolean`,description:`Include front matter content`,default:!1},{key:`lines_above`,type:`unsupported`,description:`Blank lines above heading`,default:1},{key:`lines_below`,type:`unsupported`,description:`Blank lines below heading`,default:1}]},{id:`MD023`,alias:`heading-start-left`,aliases:[`heading-start-left`],name:`Headings must start at the beginning of the line`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md023.md`,tags:[`headings`,`spaces`],options:[]},{id:`MD024`,alias:`no-duplicate-heading`,aliases:[`no-duplicate-heading`],name:`Multiple headings with the same content`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md024.md`,tags:[`headings`],options:[{key:`siblings_only`,type:`boolean`,description:`Only check sibling headings`,default:!1}]},{id:`MD025`,alias:`single-title`,aliases:[`single-title`,`single-h1`],name:`Multiple top-level headings in the same document`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md025.md`,tags:[`headings`],options:[{key:`front_matter_title`,type:`string`,description:`RegExp for matching title in front matter`,default:`^\\s*title\\s*[:=]`},{key:`level`,type:`integer`,description:`Heading level`,default:1,minimum:1,maximum:6}]},{id:`MD026`,alias:`no-trailing-punctuation`,aliases:[`no-trailing-punctuation`],name:`Trailing punctuation in heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md026.md`,tags:[`headings`],options:[{key:`punctuation`,type:`string`,description:`Punctuation characters`,default:`.,;:!。,;:!`}]},{id:`MD027`,alias:`no-multiple-space-blockquote`,aliases:[`no-multiple-space-blockquote`],name:`Multiple spaces after blockquote symbol`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md027.md`,tags:[`indentation`,`whitespace`,`blockquote`],options:[{key:`list_items`,type:`boolean`,description:`Include list items`,default:!0}]},{id:`MD028`,alias:`no-blanks-blockquote`,aliases:[`no-blanks-blockquote`],name:`Blank line inside blockquote`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md028.md`,tags:[`whitespace`,`blockquote`],options:[]},{id:`MD029`,alias:`ol-prefix`,aliases:[`ol-prefix`],name:`Ordered list item prefix`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md029.md`,tags:[`ol`],options:[{key:`style`,type:`enum`,description:`List style`,enum:[`one`,`ordered`,`one_or_ordered`,`zero`],default:`one_or_ordered`}]},{id:`MD030`,alias:`list-marker-space`,aliases:[`list-marker-space`],name:`Spaces after list markers`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md030.md`,tags:[`ul`,`whitespace`,`ol`],options:[{key:`ul_single`,type:`integer`,description:`Spaces for single-line unordered list items`,default:1,minimum:1},{key:`ol_single`,type:`integer`,description:`Spaces for single-line ordered list items`,default:1,minimum:1},{key:`ul_multi`,type:`integer`,description:`Spaces for multi-line unordered list items`,default:1,minimum:1},{key:`ol_multi`,type:`integer`,description:`Spaces for multi-line ordered list items`,default:1,minimum:1}]},{id:`MD031`,alias:`blanks-around-fences`,aliases:[`blanks-around-fences`],name:`Fenced code blocks should be surrounded by blank lines`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md031.md`,tags:[`blank_lines`,`code`],options:[{key:`list_items`,type:`boolean`,description:`Include list items`,default:!0}]},{id:`MD032`,alias:`blanks-around-lists`,aliases:[`blanks-around-lists`],name:`Lists should be surrounded by blank lines`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md032.md`,tags:[`bullet`,`ul`,`blank_lines`,`ol`],options:[]},{id:`MD033`,alias:`no-inline-html`,aliases:[`no-inline-html`],name:`Inline HTML`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md033.md`,tags:[`html`],options:[{key:`allowed_elements`,type:`string-array`,description:`Allowed elements`,default:[]},{key:`table_allowed_elements`,type:`string-array`,description:`Allowed elements in tables`,default:[]}]},{id:`MD034`,alias:`no-bare-urls`,aliases:[`no-bare-urls`],name:`Bare URL used`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md034.md`,tags:[`links`,`url`],options:[]},{id:`MD035`,alias:`hr-style`,aliases:[`hr-style`],name:`Horizontal rule style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md035.md`,tags:[`hr`],options:[{key:`style`,type:`string`,description:`Horizontal rule style`,default:`consistent`}]},{id:`MD036`,alias:`no-emphasis-as-heading`,aliases:[`no-emphasis-as-heading`],name:`Emphasis used instead of a heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md036.md`,tags:[`headings`,`emphasis`],options:[{key:`punctuation`,type:`string`,description:`Punctuation characters`,default:`.,;:!?。,;:!?`}]},{id:`MD037`,alias:`no-space-in-emphasis`,aliases:[`no-space-in-emphasis`],name:`Spaces inside emphasis markers`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md037.md`,tags:[`whitespace`,`emphasis`],options:[]},{id:`MD038`,alias:`no-space-in-code`,aliases:[`no-space-in-code`],name:`Spaces inside code span elements`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md038.md`,tags:[`whitespace`,`code`],options:[]},{id:`MD039`,alias:`no-space-in-links`,aliases:[`no-space-in-links`],name:`Spaces inside link text`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md039.md`,tags:[`whitespace`,`links`],options:[]},{id:`MD040`,alias:`fenced-code-language`,aliases:[`fenced-code-language`],name:`Fenced code blocks should have a language specified`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md040.md`,tags:[`code`,`language`],options:[{key:`allowed_languages`,type:`string-array`,description:`List of languages`,default:[]},{key:`language_only`,type:`boolean`,description:`Require language only`,default:!1}]},{id:`MD041`,alias:`first-line-heading`,aliases:[`first-line-heading`,`first-line-h1`],name:`First line in a file should be a top-level heading`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md041.md`,tags:[`headings`],options:[{key:`allow_preamble`,type:`boolean`,description:`Allow content before first heading`,default:!1},{key:`front_matter_title`,type:`string`,description:`RegExp for matching title in front matter`,default:`^\\s*title\\s*[:=]`},{key:`level`,type:`integer`,description:`Heading level`,default:1,minimum:1,maximum:6}]},{id:`MD042`,alias:`no-empty-links`,aliases:[`no-empty-links`],name:`No empty links`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md042.md`,tags:[`links`],options:[]},{id:`MD043`,alias:`required-headings`,aliases:[`required-headings`],name:`Required heading structure`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md043.md`,tags:[`headings`],options:[{key:`headings`,type:`string-array`,description:`List of headings`,default:[]},{key:`match_case`,type:`boolean`,description:`Match case of headings`,default:!1}]},{id:`MD044`,alias:`proper-names`,aliases:[`proper-names`],name:`Proper names should have the correct capitalization`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md044.md`,tags:[`spelling`],options:[{key:`names`,type:`string-array`,description:`List of proper names`,default:[]},{key:`code_blocks`,type:`boolean`,description:`Include code blocks`,default:!0},{key:`html_elements`,type:`boolean`,description:`Include HTML elements`,default:!0}]},{id:`MD045`,alias:`no-alt-text`,aliases:[`no-alt-text`],name:`Images should have alternate text (alt text)`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md045.md`,tags:[`accessibility`,`images`],options:[]},{id:`MD046`,alias:`code-block-style`,aliases:[`code-block-style`],name:`Code block style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md046.md`,tags:[`code`],options:[{key:`style`,type:`enum`,description:`Block style`,enum:[`consistent`,`fenced`,`indented`],default:`consistent`}]},{id:`MD047`,alias:`single-trailing-newline`,aliases:[`single-trailing-newline`],name:`Files should end with a single newline character`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md047.md`,tags:[`blank_lines`],options:[]},{id:`MD048`,alias:`code-fence-style`,aliases:[`code-fence-style`],name:`Code fence style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md048.md`,tags:[`code`],options:[{key:`style`,type:`enum`,description:`Code fence style`,enum:[`consistent`,`backtick`,`tilde`],default:`consistent`}]},{id:`MD049`,alias:`emphasis-style`,aliases:[`emphasis-style`],name:`Emphasis style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md049.md`,tags:[`emphasis`],options:[{key:`style`,type:`enum`,description:`Emphasis style`,enum:[`consistent`,`asterisk`,`underscore`],default:`consistent`}]},{id:`MD050`,alias:`strong-style`,aliases:[`strong-style`],name:`Strong style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md050.md`,tags:[`emphasis`],options:[{key:`style`,type:`enum`,description:`Strong style`,enum:[`consistent`,`asterisk`,`underscore`],default:`consistent`}]},{id:`MD051`,alias:`link-fragments`,aliases:[`link-fragments`],name:`Link fragments should be valid`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md051.md`,tags:[`links`],options:[{key:`ignore_case`,type:`boolean`,description:`Ignore case of fragments`,default:!1},{key:`ignored_pattern`,type:`string`,description:`Pattern for ignoring additional fragments`,default:``}]},{id:`MD052`,alias:`reference-links-images`,aliases:[`reference-links-images`],name:`Reference links and images should use a label that is defined`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md052.md`,tags:[`links`,`images`],options:[{key:`ignored_labels`,type:`string-array`,description:`Ignored link labels`,default:[`x`]},{key:`shortcut_syntax`,type:`boolean`,description:`Include shortcut syntax`,default:!1}]},{id:`MD053`,alias:`link-image-reference-definitions`,aliases:[`link-image-reference-definitions`],name:`Link and image reference definitions should be needed`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md053.md`,tags:[`links`,`images`],options:[{key:`ignored_definitions`,type:`string-array`,description:`Ignored definitions`,default:[`//`]}]},{id:`MD054`,alias:`link-image-style`,aliases:[`link-image-style`],name:`Link and image style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md054.md`,tags:[`links`,`images`],options:[{key:`autolink`,type:`boolean`,description:`Allow autolinks`,default:!0},{key:`inline`,type:`boolean`,description:`Allow inline links and images`,default:!0},{key:`full`,type:`boolean`,description:`Allow full reference links and images`,default:!0},{key:`collapsed`,type:`boolean`,description:`Allow collapsed reference links and images`,default:!0},{key:`shortcut`,type:`boolean`,description:`Allow shortcut reference links and images`,default:!0},{key:`url_inline`,type:`boolean`,description:`Allow URLs as inline links`,default:!0}]},{id:`MD055`,alias:`table-pipe-style`,aliases:[`table-pipe-style`],name:`Table pipe style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md055.md`,tags:[`table`],options:[{key:`style`,type:`enum`,description:`Table pipe style`,enum:[`consistent`,`leading_only`,`trailing_only`,`leading_and_trailing`,`no_leading_or_trailing`],default:`consistent`}]},{id:`MD056`,alias:`table-column-count`,aliases:[`table-column-count`],name:`Table column count`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md056.md`,tags:[`table`],options:[]},{id:`MD058`,alias:`blanks-around-tables`,aliases:[`blanks-around-tables`],name:`Tables should be surrounded by blank lines`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md058.md`,tags:[`table`],options:[]},{id:`MD059`,alias:`descriptive-link-text`,aliases:[`descriptive-link-text`],name:`Link text should be descriptive`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md059.md`,tags:[`links`,`accessibility`],options:[{key:`prohibited_texts`,type:`string-array`,description:`Prohibited link texts`,default:[`click here`,`here`,`link`,`more`]}]},{id:`MD060`,alias:`table-column-style`,aliases:[`table-column-style`],name:`Table column style`,docUrl:`https://github.com/DavidAnson/markdownlint/blob/v0.41.1/doc/md060.md`,tags:[`table`],options:[{key:`style`,type:`enum`,description:`Table column style`,enum:[`any`,`aligned`,`compact`,`tight`],default:`any`},{key:`aligned_delimiter`,type:`boolean`,description:`Aligned delimiter columns`,default:!1}]}];(()=>{let e=new Map;for(let t of Mq){e.set(t.id.toUpperCase(),t.id);for(let n of t.aliases)e.set(n.toUpperCase(),t.id)}return e})();const Nq=new Set([`img`,`video`,`audio`,`mark`,`u`,`ins`]);new Map(tN.flatMap(e=>e.surface===`compat`&&Nq.has(e.rendersAs)?[[e.name,e]]:[])),BO(`<>`),iz(),SR(),CR();function Pq(){return tN.filter(e=>e.surface===`canonical`&&e.name!==`*`)}function Fq(){return Pq().filter(e=>{let t=Iq(e);return t!==`fence`&&t!==`html`})}function Iq(e){return e.name===`MermaidFence`?`fence`:e.name===`HtmlAlignBlock`?`html`:e.hasChildren?`jsx-block`:`jsx-void`}function Lq(e){return{id:e.name,displayName:e.displayName??e.name,description:e.description??``,kind:Iq(e)}}function Rq(){return[``,"**Custom canonical components.** OK `.md` / `.mdx` supports the JSX components below. For source syntax + parameter schemas, call `palette({ components: [ids] })`. Arbitrary `<TagName>` JSX falls through as raw MDX when no canonical fits.",``,...Fq().map(Lq).map(e=>`- \`${e.id}\` (${e.kind}) — ${e.description}`)].join(`
408
408
  `)}function zq(){return[Rq(),``,"Fenced code blocks render naturally and don't need a fetch — including ` ```mermaid ` for diagrams (mermaid label text has sharp edges — `palette({ components: [\"Mermaid\"] })` lists them; parse failures come back as `warnings` entries on write/edit) and ` ```html preview ` for interactive HTML/JS/CSS pages (the fence info-string `preview` token renders the block as a live iframe; works for `html` / `htm` / `xml`; optional `h=` / `w=` tokens set size, e.g. ` ```html preview h=400px `). Use ` ```html preview ` whenever you want anything interactive or JS-powered (charts, demos, calculators, animations) — just author the standalone HTML page in the fence. Call `palette` for the markdown-native component forms (write `> [!NOTE]`, not `<Callout>`), copy-ready themed `html preview` starters, and the theme tokens (`var(--chart-1)`, `var(--foreground)`, …) an embed should reference so it tracks the reader's light/dark theme."].join(`
409
- `)}const Bq=[`text`,`number`,`boolean`,`date`,`list`,`object`];V(Bq);const Vq=So([P(),F(),I()]),Hq=Po(()=>So([Vq.transform(e=>String(e)),B(P(),Uq),R(Hq)])),Uq=Po(()=>So([P(),F(),I(),R(Hq),B(P(),Uq)]));function Wq(e){if(Array.isArray(e)){let t=[];for(let n of e)n!==null&&t.push(Wq(n));return t}if(typeof e==`object`&&e){let t={};for(let[n,r]of Object.entries(e))t[n]=r===null?``:Wq(r);return t}return e}Lo(Wq,B(P(),Uq)),B(P(),So([Uq,vo()])),z({docName:yw,summary:xw,content:P().optional(),...bw}).loose(),z({docName:yw,summary:xw,markdown:P(),position:V([`append`,`prepend`,`replace`]).optional(),extension:V(yl).optional(),...bw}).loose(),z({docName:yw,summary:xw,find:P().min(1),replace:P(),offset:F().int().nonnegative().optional(),...bw}).loose(),z({docName:yw,connectionId:P().min(1),scope:V([`last`,`session`,`file`,`count`]).optional(),count:F().int().positive().optional(),...bw}).loose().refine(e=>e.scope!==`count`||e.count!==void 0,{message:`count is required when scope is 'count'`,path:[`count`]});const Gq=z({value:P(),truncatedFrom:F().int().nonnegative().optional(),hint:P().optional()}).loose(),Kq=Co(`kind`,[z({kind:H(`inline`),content:P()}),z({kind:H(`truncated`),byteLength:F().int().nonnegative(),hint:P()})]),qq=z({kind:H(`content-divergence`),intendedBytes:F().int().nonnegative(),actualBytes:F().int().nonnegative(),byteDelta:F().int(),divergenceType:P().optional(),currentState:Kq.optional(),hint:P().optional()}).loose(),Jq=z({type:H(`orphan`),parentCandidates:R(P()),message:P()}).loose(),Yq=z({kind:H(`disk-edit-reconciled`),intendedBytes:F().int().nonnegative(),actualBytes:F().int().nonnegative(),byteDelta:F().int(),mergeOutcome:P().optional(),hint:P().optional()}).loose(),Xq=Co(`kind`,[qq,Yq]),Zq=Co(`kind`,[qq,Yq,z({kind:H(`mermaid-parse-error`),fenceIndex:F().int().positive(),fenceFirstLine:P(),message:P(),line:F().int().positive().optional()}).loose(),z({kind:H(`lint-violation`),source:P(),code:P(),message:P(),severity:V([`error`,`warning`,`info`,`hint`]),line:F().int().positive(),column:F().int().positive(),linkTarget:P().optional()}).loose()]),Qq=R(Zq).min(1),$q=z({href:P(),resolvedTo:P().nullable(),reason:V([`no-such-doc`,`no-such-file`,`unresolvable`])}).loose(),eJ=R($q);z({timestamp:P().min(1),summary:Gq.optional(),warning:Xq.optional(),warnings:Qq.optional()}).loose(),z({timestamp:P().min(1),subscriberCount:F().int().nonnegative(),systemSubscriberCount:F().int().nonnegative(),hints:R(Jq).optional(),summary:Gq.optional(),warning:Xq.optional(),warnings:Qq.optional(),brokenLinks:eJ}).loose(),z({timestamp:P().min(1),subscriberCount:F().int().nonnegative(),systemSubscriberCount:F().int().nonnegative(),summary:Gq.optional(),warning:Xq.optional(),warnings:Qq.optional(),brokenLinks:eJ}).loose(),z({docName:P().min(1),scope:V([`last`,`session`,`count`]),undone:I()}).loose(),z({docs:R(z({docName:doe,markdown:P(),position:V([`append`,`prepend`,`replace`]).optional(),extension:V(yl).optional(),summary:xw}).loose()).min(1).max(100),...bw}).loose();const tJ=z({type:Dw,title:P(),detail:P().optional()}).loose(),nJ=Co(`status`,[z({status:H(`written`),docName:P().min(1),summary:Gq.optional(),warnings:Qq.optional(),brokenLinks:eJ}).loose(),z({status:H(`error`),docName:P().min(1),error:tJ}).loose()]);z({timestamp:P().min(1),results:R(nJ),written:F().int().nonnegative(),failed:F().int().nonnegative()}).loose(),z({docName:yw,patch:B(P(),So([Uq,vo()])),types:B(P(),V(Bq)).optional(),summary:xw,...bw}).loose(),z({timestamp:P().min(1),subscriberCount:F().int().nonnegative(),systemSubscriberCount:F().int().nonnegative(),appliedKeys:R(P()),summary:Gq.optional(),warning:Xq.optional(),warnings:Qq.optional(),brokenLinks:eJ}).loose(),z({entries:R(z({level:V([`info`,`warn`,`error`]),message:P().max(8192),event:P().optional(),fields:B(P(),L()).optional(),ts:F().optional(),sourceId:P().optional(),lineNumber:F().optional()}).loose()).max(100),droppedSinceLastFlush:F().int().min(0).optional()}).loose(),z({accepted:F().int().min(0)}).loose();const rJ=z({exact:P().min(1),prefix:P(),suffix:P(),start:F().int().nonnegative(),end:F().int().nonnegative()}),iJ=R(So([P(),F().int().nonnegative()])),aJ=Co(`kind`,[z({kind:H(`body`)}),z({kind:H(`property`),key:P().min(1),path:iJ.default([])})]).default({kind:`body`}),oJ=V([`anchored`,`orphaned`,`resolved`]),sJ=z({threadId:P().min(1),docName:P().min(1),target:aJ,anchor:rJ.nullable(),state:oJ,queued:I(),latestComment:P(),createdBy:P().min(1),createdAt:F()}),cJ=z({docName:P(),instruction:P(),property:P().nullable(),passage:z({exact:P(),prefix:P(),suffix:P()}).nullable(),anchorLost:I(),passageRepeats:I()}).loose(),lJ=z({threadId:P(),ok:H(!0)}),uJ=z({threadId:P(),ok:H(!1),error:H(`not-found`)});z({threads:R(sJ)}).loose(),z({meta:sJ,orphaned:I()}).loose(),z({threadId:P()}).loose(),z({meta:sJ,payload:cJ}).loose(),z({results:R(So([lJ.extend({meta:sJ,payload:cJ}),uJ]))}).loose(),z({results:R(So([lJ.extend({meta:sJ}),uJ]))}).loose();const dJ=z({status:P().min(1),reason:P()}).loose();z({docName:P().min(1),content:P(),lifecycle:dJ.nullable()}).loose(),z({documents:R(z({kind:V([`document`,`asset`,`folder`,`file`]).default(`document`),docName:P().min(1).optional(),docExt:P().min(1).default(`.md`),size:F().int().nonnegative(),modified:P().min(1),isSymlink:I().default(!1),canonicalDocName:P().nullable().default(null),targetPath:P().nullable().default(null),path:P().min(1).optional(),assetExt:P().min(1).optional(),mediaKind:V([`image`,`video`,`audio`,`pdf`,`text`,`mermaid`]).nullable().optional(),referencedBy:R(P().min(1)).optional(),hasChildren:I().optional()}).loose().refine(e=>e.kind===`document`?e.docName!==void 0&&e.path===void 0&&e.assetExt===void 0&&e.mediaKind===void 0&&e.referencedBy===void 0&&e.hasChildren===void 0:e.kind===`folder`?e.docName===void 0&&e.path!==void 0&&e.assetExt===void 0&&e.mediaKind===void 0&&e.referencedBy===void 0:e.kind===`file`?e.path!==void 0&&e.mediaKind===void 0&&e.referencedBy===void 0&&e.hasChildren===void 0:e.path!==void 0&&e.assetExt!==void 0&&e.referencedBy!==void 0&&e.hasChildren===void 0,{message:`document/asset/folder/file kind must match its required fields (document → docName; asset → path+assetExt+referencedBy; folder → path only, no docName; file → path, no mediaKind/referencedBy/hasChildren)`})),truncated:I().optional()}).loose();const fJ=z({source:P().min(1),anchor:P().nullable(),title:P(),snippet:P().nullable()}).loose();z({docName:P().min(1),backlinks:R(fJ)}).loose(),z({counts:B(P().min(1),F().int().nonnegative())}).loose(),z({counts:B(P().min(1),F().int().nonnegative())}).loose();const pJ=Co(`kind`,[z({kind:H(`doc`),docName:P().min(1),anchor:P().nullable(),title:P(),snippet:P().nullable()}).loose(),z({kind:H(`external`),url:P().min(1),title:P(),snippet:P().nullable()}).loose()]);z({docName:P().min(1),forwardLinks:R(pJ)}).loose();const mJ=Co(`kind`,[z({id:P().min(1),kind:H(`doc`),docName:P().min(1),anchor:P().nullable(),label:P(),cluster:P().nullable(),category:P().nullable(),tags:R(P()).nullable()}).loose(),z({id:P().min(1),kind:H(`external`),url:P().min(1),label:P()}).loose()]),hJ=z({source:P().min(1),target:P().min(1)}).loose();z({nodes:R(mJ),links:R(hJ)}).loose();const gJ=z({ts:F().int().min(0),url:P(),method:P(),ua:P().optional(),origin:P().optional(),referer:P().optional(),host:P().optional(),remote:P().optional(),secChUa:P().optional(),secChUaMobile:P().optional(),secChUaPlatform:P().optional(),secFetchSite:P().optional(),secFetchDest:P().optional(),secFetchMode:P().optional(),secFetchUser:P().optional()}).loose(),_J=z({app:So([H(`cursor`),H(`codex`),H(`claude`),vo()]),signals_fired:R(P())}).loose();z({entries:R(gJ),count:F().int().min(0),detection:_J}).loose(),z({writers:R(z({id:P().min(1),name:P().optional(),email:P().optional()}).loose()).optional(),summary:xw,...bw}).loose(),z({checkpointRef:P().min(1)}).loose();const vJ=z({v:F().int().optional(),id:P().min(1),name:P().min(1),colorSeed:P().optional(),docs:R(P()),summaries:R(P()).optional()}).loose();z({entries:R(z({sha:P().min(1),timestamp:P().min(1),author:P(),authorEmail:P(),type:V([`checkpoint`,`wip`,`upstream`,`park`]),message:P(),contributors:R(vJ),checkpoint:L().nullable(),parentSha:P().nullable().optional()}).loose()),total:F().int().nonnegative().optional(),truncated:I().optional(),hasMore:I().optional()}).loose(),z({sha:P().regex(/^[0-9a-f]{40}$/i),content:P(),timestamp:P(),author:P()}).loose(),z({contentDir:P().min(1),pathSeparator:V([`/`,`\\`]),symlinkResolved:I()}).loose(),R(Co(`source`,[z({docName:P().min(1),timestamp:P().min(1),size:F().int().nonnegative(),source:H(`flat`)}).loose(),z({docName:P().min(1),timestamp:P().min(1),source:H(`timeline`),sha:P().min(1)}).loose()])).meta({description:"Flat array of rescue buffer entries; discriminated via `source`."});const yJ=z({domain:P().min(1),title:P().optional(),description:P().optional(),siteName:P().optional(),faviconDataUri:P().optional()}).loose();z({url:P()}).loose(),Co(`ok`,[z({ok:H(!0),metadata:yJ}).loose(),z({ok:H(!1),reason:P()}).loose()]),z({orphans:R(z({docName:P().min(1),title:P()}).loose())}).loose(),z({hubs:R(z({docName:P().min(1),title:P(),count:F().int().nonnegative()}).loose())}).loose();const bJ=z({source:P().min(1),title:P(),snippet:P().nullable()}).loose();z({deadLinks:R(z({target:P().min(1),sources:R(bJ)}).loose())}).loose(),z({target:z({docName:P().min(1),title:P(),aliases:R(P())}).loose(),mentions:R(z({source:P().min(1),excerpt:P(),offset:F().int().nonnegative()}).loose()),truncated:I()}).loose(),z({projectPath:P().min(1)}).loose();const xJ=V([`not-a-git-worktree`,`init-failed`]);Co(`ok`,[z({ok:H(!0),projectPath:P().min(1)}).loose(),z({ok:H(!1),reason:xJ,message:P().min(1)}).loose()]),z({host:P().min(1).optional()}).loose(),z({host:P().min(1).optional(),token:P().min(1)}).loose(),z({host:P(),login:P()}).loose(),z({key:P().min(1)}).loose(),z({keyPresent:I()}).loose();const SJ=V([`no_key`,`invalid_endpoint`,`rate_limit`,`timeout`,`http_error`,`network`,`dims_mismatch`,`malformed_response`]);Co(`ok`,[z({ok:H(!0),endpoint:P().min(1),model:P().min(1),dimensions:F().int().positive()}).loose(),z({ok:H(!1),endpoint:P().min(1),model:P().min(1),reason:SJ,status:F().int().optional()}).loose()]),z({name:P().refine(e=>e.trim().length>0,{message:`name must be non-empty`}),email:P().refine(e=>e.trim().length>0,{message:`email must be non-empty`})}).loose(),z({authenticated:I()}).loose(),z({channel:V([`login`,`gh-login`]).default(`login`)}).loose(),z({}).loose();const CJ=z({stackIndex:F().int().min(0),ts:F().int().min(0),additions:F().int().min(0),deletions:F().int().min(0)}).loose(),wJ=z({docName:P().min(1),additionsTotal:F().int().min(0),deletionsTotal:F().int().min(0),lastTs:F().int().min(0),bursts:R(CJ)}).loose(),TJ=z({displayName:P().min(1),color:P().min(1),icon:P().optional(),connectionId:P().min(1)}).loose();z({sessionAlive:I(),agent:TJ.nullable(),files:R(wJ)}).loose(),z({diff:P(),before:P(),after:P(),generatedAt:F().int().min(0)}).loose(),z({}).loose(),z({}).loose(),z({}).loose(),z({}).loose(),z({}).loose(),z({}).loose();const EJ=z({displayName:P().min(1),icon:P(),color:P().min(1),currentDoc:P().nullable(),mode:V([`idle`,`writing`]),ts:F().int().min(0)}).loose();z({presence:B(P().min(1),EJ)}).loose();const DJ=z({sessionId:P().min(1),agentType:P().min(1),ts:F().int().min(0),insertedChars:F().int().min(0),deletedChars:F().int().min(0)}).loose();z({effects:R(z({"doc.name":P().min(1),entries:R(DJ)}).loose())}).loose(),z({decisions:R(z({ts:F().int().min(0),decision:P().min(1),kind:P().min(1),"doc.name":P().min(1),pathRole:P().min(1)}).loose())}).loose(),B(P().min(1),I()).meta({description:`Flat boolean record keyed by agent-scheme name (claude / codex / cursor). True = installed.`}),z({path:P().min(1,`path must be non-empty`)}).loose(),z({}).loose();const OJ=z({fromDocName:P().min(1),toDocName:P().min(1)}).loose(),kJ=z({fromPath:P().min(1),toPath:P().min(1)}).loose();z({}).loose(),z({path:P().min(1),...bw,summary:xw}).loose(),z({docName:P().min(1)}).loose(),z({path:P().min(1),...bw,summary:xw}).loose(),z({path:P().min(1)}).loose(),z({kind:V([`file`,`folder`]),path:P().min(1),...bw,summary:xw}).loose(),z({kind:V([`file`,`folder`]),path:P().min(1),duplicatedDocNames:R(P().min(1))}).loose(),z({pages:R(z({docName:P().min(1),title:P(),docExt:P().min(1),size:F().int().nonnegative(),modified:P().min(1),icon:P().min(1).max(2048).optional()}).loose())}).loose();const AJ=z({level:F().int().min(1).max(6),text:P(),slug:P()}).loose();z({docName:P().min(1),headings:R(AJ)}).loose();const jJ=z({docName:P().min(1),rewrites:F().int().nonnegative()}).loose();z({kind:V([`file`,`folder`,`asset`]),fromPath:P().min(1),toPath:P().min(1),...bw,summary:xw}).loose(),z({renamed:R(OJ),renamedAssets:R(kJ),rewrittenDocs:R(jJ).optional(),summary:Gq.optional()}).loose(),z({kind:V([`file`,`folder`,`asset`]),path:P().min(1),...bw}).loose(),z({deletedDocNames:R(P().min(1))}).loose(),z({kind:V([`file`,`folder`,`asset`]),path:P().min(1),...bw,summary:xw}).loose(),z({deletedDocNames:R(P().min(1))}).loose(),z({docName:P().min(1),commitSha:P().regex(/^[0-9a-f]{40}$/i,{message:`commitSha must be a 40-char git SHA`}),summary:xw,...bw}).loose(),z({restoredFrom:P().min(1),timestamp:P().min(1),summary:Gq.optional(),warning:qq.optional(),warnings:Qq.optional()}).loose();const MJ=V([`dormant`,`idle`,`fetching`,`pulling`,`pushing`,`conflict`,`offline`,`auth-error`,`disabled`]),NJ=z({label:P().min(1),webUrl:po().nullable()}).loose(),PJ=Co(`checkStatus`,[z({checkStatus:H(`allowed`)}).loose(),z({checkStatus:H(`denied`),deniedReason:V([`no-collaborator`,`private-no-access`,`repo-not-found`,`not-authenticated`])}).loose(),z({checkStatus:H(`unknown`),unknownError:V([`network`,`timeout`,`rate-limit`,`token-invalid`,`malformed-response`,`ssh-unverified`]).optional()}).loose()]),FJ=V([`auth-403`,`auth-401`,`auth-scope-mismatch`,`auth-no-credential`,`semantic-protected-branch`]),IJ=V(kne),LJ=V([`succeeded`,`up-to-date`,`conflict`,`refused`,`error`]);z({state:MJ,lastSyncUtc:P().nullable(),lastFetchUtc:P().nullable(),lastPushedSha:P().nullable(),ahead:F().int().min(0),behind:F().int().min(0),consecutiveFailures:F().int().min(0),conflictCount:F().int().min(0),hasRemote:I(),syncEnabled:I(),identityUnresolved:I(),remote:NJ.nullable().optional(),pushError:P().optional(),pushErrorCode:FJ.optional(),pullError:P().optional(),pullErrorCode:FJ.optional(),pausedReason:P().optional(),pushPermission:PJ.optional(),syncMode:IJ.optional(),lastPullUtc:P().nullable().optional(),lastPullOutcome:LJ.nullable().optional()}).loose(),z({op:V([`sync`,`push`,`pull`]).optional()}).loose(),z({op:V([`sync`,`push`,`pull`])}).loose(),z({conflicts:R(z({file:P().min(1),detectedAt:P().min(1),oursSha:P().optional(),theirsSha:P().optional(),baseSha:P().optional()}).loose())}).loose(),z({file:P().min(1),strategy:V([`mine`,`theirs`,`content`,`delete`]),content:P().optional()}).loose().refine(e=>e.strategy!==`content`||e.content!==void 0&&e.content!==``,{message:`content must be a non-empty string when strategy is 'content'`,path:[`content`]}),z({}).loose(),z({file:P().min(1),base:P(),ours:P(),theirs:P(),kind:V([`both-modified`,`delete-modify`,`modify-delete`]),lifecycleStatus:P().nullable()}).loose(),z({plan:Io(e=>e!==void 0,{message:`plan is required`})}).loose(),z({plan:Io(e=>e!==void 0,{message:`plan is required`})}).loose(),z({result:Io(e=>e!==void 0,{message:`result is required`})}).loose();const RJ=z({path:P().min(1),summary:P().min(1)}).loose(),zJ=z({files:F().int().nonnegative(),folders:F().int().nonnegative()}).loose();z({packs:R(z({id:P().min(1),name:P().min(1),description:P().min(1),defaultSubfolder:P().optional(),folders:R(RJ),entryCounts:zJ}).loose())}).loose(),z({noOpen:I().optional(),out:P().min(1).optional()}).loose();const BJ=z({reason:V([`unsupported-platform`,`spawn-error`]),message:P()}).loose();Co(`status`,[z({status:H(`installed`),outputPath:P(),size:F().int().nonnegative(),sha256:P(),skillVersion:P()}).loose(),z({status:H(`built`),outputPath:P(),size:F().int().nonnegative(),sha256:P(),skillVersion:P(),handoffError:BJ.optional()}).loose(),z({status:H(`failed`),buildError:P()}).loose(),z({status:H(`skip-current`),skillVersion:P(),recordedAt:P().optional()}).loose()]);const VJ=V(wl);z({tags:R(z({name:P().min(1),count:F().int().nonnegative(),isLeaf:I()}).loose())}).loose();const HJ=z({docName:P().min(1),title:P(),matchingTags:R(P().min(1)),snippet:P().nullable()}).loose();z({name:P().min(1),docs:R(HJ)}).loose(),z({folder:L(),frontmatter_local:B(P(),L()).nullable()}).loose(),z({path:P(),frontmatter:B(P(),L()).optional()}).loose(),z({applied:L()}).loose();const UJ=B(P(),L()).meta({description:`Free-form frontmatter map embedded in template payloads.`});z({template:z({name:P().min(1),folder:P(),scope:V([`local`,`inherited`]),path:P().min(1),frontmatter:UJ,body:P()}).strict()}).strict(),z({templates:R(z({name:P().min(1),title:P().optional(),description:P().optional(),path:P().min(1),source_folder:P()}).strict()),truncated:I()}).strict(),z({folder:P(),name:P(),body:P().optional(),frontmatter:UJ.optional(),...bw,summary:xw}).strict(),z({path:P().min(1),created:I(),warnings:R(P())}).strict(),z({sourcePath:P().min(1),targetFolder:P(),name:P().optional(),title:P().optional(),deleteSource:I().optional(),...bw,summary:xw}).strict(),z({path:P().min(1),created:I(),warnings:R(P())}).strict(),z({existed:I(),path:P().min(1)}).strict(),z({fromFolder:P(),fromName:P(),toFolder:P(),toName:P(),body:P().optional(),frontmatter:UJ.optional(),...bw,summary:xw}).strict(),z({from:P().min(1),to:P().min(1),committed:I()}).strict();const WJ=V(gl),GJ=/^[a-z0-9-]+$/,KJ=z({name:P(),description:P()}).strict();z({skill:z({name:P().min(1),scope:WJ,path:P().min(1),frontmatter:KJ,body:P(),files:R(z({path:P().min(1),text:P().nullable()})).optional(),managed:I().optional()}).strict()}).strict();const qJ=z({source:P().min(1),publisher:P().optional(),skill:P().optional(),marketplaceUrl:P().optional(),importedAt:P().min(1),autoUpdate:I().optional()}).strict();z({skills:R(z({name:P().min(1),description:P().optional(),scope:WJ,path:P().min(1),absolutePath:P().min(1).optional(),installed:I(),hosts:R(P()),driftPaths:R(P()).optional().meta({description:`Recorded locations whose on-disk form (copy vs symlink) no longer matches what OK last wrote there — evidence another tool rewrote the path.`}),hostAliases:B(P(),P()).optional().meta({description:`Host skills roots that are symlink ALIASES of another location (host id → base-relative target root). An aliased folder is a derived view — no menu row, never a write target; the host's icon rides the target root's row.`}),conflictHosts:R(P()).optional().meta({description:`Hosts whose dir holds a DIFFERENT same-name skill (fork/conflict) — occupied, not this skill.`}),symlinkedHosts:R(P()).optional(),installableEditors:R(P()).optional(),linkMode:I().optional(),customPlacements:R(z({path:P(),mode:V([`copy`,`link`])}).strict()).optional(),managed:I().optional(),origin:qJ.optional(),modified:I().optional(),revertable:I().optional()}).strict()),truncated:I()}).strict(),z({scope:WJ.default(`project`),name:P().meta({description:`Managed skill name to create or update.`}),body:P().optional(),frontmatter:KJ,...bw,summary:xw}).strict(),z({path:P().min(1),created:I(),warnings:R(P())}).strict(),z({scope:WJ.default(`project`),name:P(),dryRun:I().optional(),setAutoUpdate:I().optional(),...bw,summary:xw}).strict(),z({name:P().min(1),updated:I(),source:P().min(1),localBody:P().optional(),upstreamBody:P().optional(),gitTracked:I().optional(),warnings:R(P())}).strict(),z({scope:WJ.default(`project`),name:P(),...bw,summary:xw}).strict(),z({name:P().min(1),baselineRef:P().min(1),restoredFiles:R(P()),warnings:R(P())}).strict(),z({existed:I(),path:P().min(1)}).strict(),z({scope:WJ.default(`project`),fromName:P(),toName:P(),body:P().optional(),frontmatter:KJ.optional(),...bw,summary:xw}).strict(),z({from:P().min(1),to:P().min(1),committed:I()}).strict(),z({name:P(),fromScope:WJ,toScope:WJ,...bw,summary:xw}).strict(),z({scope:WJ,path:P().optional()}).strict(),z({scope:WJ,name:P(),toName:P(),...bw,summary:xw}).strict(),z({name:P().min(1)}).strict(),z({name:P(),home:P().min(1)}).strict(),z({docName:P().min(1)}).strict();const JJ=V([`reference`,`script`,`file`]);z({scope:WJ.default(`project`),name:P(),path:P().min(1),content:P(),...bw,summary:xw}).strict(),z({path:P().min(1),created:I(),kind:JJ,content:I()}).strict(),z({scope:WJ.default(`project`),name:P(),from:P().min(1),to:P().min(1),...bw,summary:xw}).strict(),z({from:P().min(1),to:P().min(1),fromDocName:P().optional(),toDocName:P().optional()}).strict(),z({path:P().min(1),kind:JJ,text:P()}).strict(),z({path:P().min(1),existed:I(),kind:JJ}).strict();const YJ=So([VJ,H(`agents`)]),XJ=P().min(1).refine(e=>!e.startsWith(`/`)&&!e.startsWith(`~`)&&!/^[A-Za-z]:/.test(e),{error:`a custom root is base-relative (e.g. ".tim/skills"), not absolute or ~-prefixed`}).refine(e=>e.split(`/`).every(e=>e!==``&&e!==`.`&&e!==`..`),{error:`a custom root may not contain "..", "." or empty path segments`}).refine(e=>e.includes(`/`),{error:`a custom root is a path (e.g. ".tim/skills") — bare editor names are host ids`}),ZJ=So([YJ,XJ]);z({scope:WJ.default(`project`),name:P(),targets:R(YJ).optional().meta({description:'SET-EXACT install targets (editor ids, plus "agents" for the .agents hub — in-place skills only): the COMPLETE resulting host set. Omit to use project-configured editors; pass [] to uninstall everywhere. Stateless callers should prefer `add`/`remove`.'}),add:R(ZJ).optional().meta({description:`Locations to ADD the skill to (everything else untouched). Editor ids fan out a managed copy/symlink; a custom root path (".tim/skills") places the bundle there.`}),remove:R(ZJ).optional().meta({description:"Locations to REMOVE the skill from (lossless only — a hand-edited fork is refused, never deleted). The source cannot be removed; move it first with `source`."}),mode:V([`copy`,`link`]).optional().meta({description:`"link": one real folder (the source); every other location becomes a symlink to it. "copy": independent real folders, refreshed from the source until hand-edited (a hand-edit forks that copy). Converts existing locations losslessly. Omit to follow the form the skill already uses.`}),source:ZJ.optional().meta({description:`Move the skill's REAL folder to this location (the old source becomes a symlink to it — never a removal). Sticky across rescans.`}),linkMode:I().optional(),setSource:P().min(1).optional(),place:z({dir:P().min(1).meta({description:`Project-relative directory the bundle dir is created under (e.g. ".windsurf/skills").`}),mode:V([`copy`,`link`])}).strict().optional(),convert:z({target:ZJ.meta({description:`The installed location to convert — an editor id, "agents", or a recorded custom placement path.`}),mode:V([`copy`,`link`]).meta({description:`"link": replace this location with a symlink to the source. "copy": replace it with an independent real folder.`})}).strict().optional(),unplace:z({path:P().min(1).meta({description:`The recorded placement bundle path (e.g. ".windsurf/skills/my-skill").`})}).strict().optional(),...bw,summary:xw,fork:z({editor:P().min(1),action:V([`align`,`make-source`,`rename`]),toName:P().optional()}).strict().optional()}).strict().refine(e=>!(e.targets!==void 0&&(e.add!==void 0||e.remove!==void 0)),{error:"`targets` is set-exact; `add`/`remove` are additive — use one style per call"}).refine(e=>e.fork===void 0||e.targets===void 0&&e.add===void 0&&e.remove===void 0&&e.source===void 0&&e.setSource===void 0,{error:"`fork` is its own operation — run it in a separate call"}).refine(e=>e.fork?.action!==`rename`||e.fork.toName!==void 0,{error:"`fork.rename` requires `toName`"}).refine(e=>!(e.source!==void 0&&(e.add!==void 0||e.remove!==void 0)),{error:"a `source` move is its own operation — run it in a separate call from `add`/`remove`"}).refine(e=>[e.targets!==void 0||e.add!==void 0||e.remove!==void 0,e.place!==void 0,e.unplace!==void 0,e.convert!==void 0,e.source!==void 0||e.setSource!==void 0,e.fork!==void 0].filter(Boolean).length<=1,{error:"one operation per call — membership (`targets`/`add`/`remove`), `place`, `unplace`, `convert`, `source`, and `fork` are mutually exclusive"}),z({name:P().min(1).meta({description:`Managed skill name installed or uninstalled.`}),hosts:R(P()).meta({description:`Editor ids the skill is projected into after the operation; [] is expected after uninstall.`}),scripts:I().meta({description:`True when the skill ships executable scripts, projected but never run.`}),warnings:R(P()).meta({description:`Non-fatal install/uninstall warnings from target projection.`}),warningCodes:R(V([`no-targets`,`scripts-present`,`name-conflict`,`no-description`,`skill-fork-name-unpatched`,`place-path-invalid`,`place-fork-refused`])).meta({description:"Machine-readable warning codes aligned with `warnings`."}),placedAt:P().optional(),sourceMovedTo:P().optional()}).strict(),z({scope:WJ.default(`project`),name:P().meta({description:`Managed skill name to uninstall without deleting source.`})}).strict(),z({name:P().min(1).meta({description:`Managed skill name requested for uninstall.`}),uninstalled:I().meta({description:`True when an install marker existed and was removed; false for an idempotent no-op.`})}).strict(),z({targets:R(VJ),configured:I(),folders:R(z({scope:WJ,host:P(),root:P(),state:V([`own`,`linked`,`linked-parent`,`absent`]),target:P().optional(),drift:H(!0).optional(),expected:P().optional()}).strict()).optional()}).strict(),z({folderAction:Co(`action`,[z({action:H(`link`),scope:WJ,root:P().min(1).meta({description:`The folder to link (e.g. ".codex/skills").`}),target:P().min(1).meta({description:`The root it merges into (e.g. ".agents/skills"). Required.`})}).strict(),z({action:H(`unlink`),scope:WJ,root:P().min(1).meta({description:`The linked folder to materialize back.`}),exclude:R(P().min(1)).optional().meta({description:`Skill names to LEAVE OUT when materializing — the folder keeps every other skill it currently sees (as per-skill links) and stops auto-following the target root.`})}).strict(),z({action:H(`add-root`),scope:WJ,root:XJ.meta({description:`New custom skills root to declare (base-relative, e.g. ".team/skills").`})}).strict()])}).strict(),z({targets:R(VJ),reprojected:R(z({name:P(),hosts:R(P())}).strict()),bundleHosts:R(P()),removedFrom:R(P()),folder:z({moved:R(P()),dropped:R(P()),linked:R(P())}).strict().optional()}).strict(),z({scope:WJ.default(`project`),name:P(),version:P().regex(/^[0-9a-f]{40}$/i),...bw,summary:xw}).strict(),z({name:P().min(1),version:P(),restoredFiles:R(P()),warnings:R(P())}).strict(),z({query:P().optional(),intent:V([`autocomplete`,`full_text`,`omnibar`]).optional(),ranking:V([`navigation`,`relevance`]).optional(),scopes:R(V([`page`,`folder`,`content`,`file`])).optional(),scope:P().optional(),limit:F().int().nonnegative().optional(),semantic:I().optional(),source:V([`omnibar`,`mcp`,`http`]).optional()}).loose();const QJ=z({kind:V([`page`,`folder`,`content`,`file`]),path:P().min(1),title:P(),score:F(),signals:B(P(),L()),snippet:P().optional()}).loose(),$J=z({capable:I(),applied:I(),coverage:z({embedded:F().int().nonnegative(),total:F().int().nonnegative()})}).loose();z({enabled:I(),keyPresent:I(),keyNotRequired:I(),keySource:V([`project`,`file`,`env`]).nullable(),keyHint:P().nullable(),ready:I(),capable:I(),embedded:F().int().nonnegative(),total:F().int().nonnegative()}).loose(),z({query:P(),intent:V([`autocomplete`,`full_text`,`omnibar`]),results:R(QJ),elapsedMs:F().nonnegative(),semantic:$J.optional(),truncated:I().optional(),ready:I().optional()}).loose();const eY=z({version:P().min(1),recordedAt:P().min(1)}).loose();z({currentVersion:P().min(1),targets:B(P(),eY.nullable())}).loose(),z({scope:WJ.default(`project`),source:P().min(1).meta({description:`External skill source: full skills.sh skill-page URL (https://www.skills.sh/<owner>/<repo>/<skill>, or https://www.skills.sh/site/<hostname>/<skill> for a website catalog), GitHub owner/repo[/subpath], git URL, or local/file path.`}),skill:P().min(1).optional().meta({description:`Specific skill name to import from a multi-skill source.`}),install:I().optional().meta({description:`Pass false to import WITHOUT the default-editor auto-projection (the caller installs explicitly afterwards). Default true.`}),marketplace:I().optional().meta({description:"The source came from a skills.sh listing the user chose (the Explore tab), so the install is reported to skills.sh and counts toward that listing. Off by default: a hand-typed repo must not be announced to skills.sh. Honors the `telemetry.skillInstallReports.enabled` setting and DO_NOT_TRACK."}),...bw,summary:xw}).strict(),z({scope:WJ.default(`project`),source:P().min(1).meta({description:`External skill source: full skills.sh skill-page URL, GitHub owner/repo[/subpath], git URL, or local/file path.`}),skills:R(P().min(1)).min(1).max(100).meta({description:`Skill names to import from the source.`}),install:I().optional().meta({description:`Pass false to import WITHOUT the default-editor auto-projection. Default true.`}),marketplace:I().optional().meta({description:"The source came from a skills.sh listing the user chose (a marketplace plugin bundle), so the import is reported to skills.sh as one batched install event and counts toward that listing. Off by default: a hand-typed repo must not be announced to skills.sh. Honors the `telemetry.skillInstallReports.enabled` setting and DO_NOT_TRACK."}),...bw,summary:xw}).strict(),z({results:R(z({requested:P(),status:V([`imported`,`already-imported`,`not-found`,`failed`]),name:P().optional(),collisionRenamedFrom:P().optional(),warnings:R(P()),error:P().optional()}).loose()),imported:F(),alreadyImported:F(),failed:F()}).loose();const tY=z({source:P(),ref:P().optional(),contentHash:P(),publisher:P().optional()}).loose();z({name:P().min(1).meta({description:`Managed skill name created or matched.`}),path:P().min(1).meta({description:`Store-relative path to the imported skill source.`}),created:I().meta({description:`True when this request created new source files.`}),alreadyImported:I().meta({description:`True when identical content was already present and no files changed.`}),collisionRenamedFrom:P().optional().meta({description:`Original source name when collision handling renamed the import.`}),provenance:tY,warnings:R(P()).meta({description:`Non-fatal import warnings, such as skipped unsupported files.`})}).loose();const nY=V([`files`,`backlinks`,`graph`,`sync-status`,`session-activity`,`tags`,`comments`,`lint-config`]);z({v:H(1),ch:H(`server-info`),seq:F(),serverInstanceId:P().min(1),currentBranch:P().min(1).optional()}).loose(),z({v:H(1),ch:H(`branch-switched`),seq:F(),branch:P().min(1)}).loose(),z({v:H(1),ch:nY,seq:F()}).loose(),z({v:H(1),ch:H(`disk-ack`),seq:F(),docName:P().min(1),sv:P().min(1)}).loose(),z({v:H(1),ch:H(`config-validation-rejected`),seq:F(),docName:P().min(1),error:$c}).loose(),z({v:H(1),ch:H(`config-ignore-nested-error`),seq:F(),path:P().min(1),error:P().min(1)}).loose();var rY=e(i(((e,t)=>{var n=function(){this.Diff_Timeout=1,this.Diff_EditCost=4,this.Match_Threshold=.5,this.Match_Distance=1e3,this.Patch_DeleteThreshold=.5,this.Patch_Margin=4,this.Match_MaxBits=32},r=-1,i=1,a=0;n.Diff=function(e,t){return[e,t]},n.prototype.diff_main=function(e,t,r,i){i===void 0&&(i=this.Diff_Timeout<=0?Number.MAX_VALUE:new Date().getTime()+this.Diff_Timeout*1e3);var o=i;if(e==null||t==null)throw Error(`Null input. (diff_main)`);if(e==t)return e?[new n.Diff(a,e)]:[];r===void 0&&(r=!0);var s=r,c=this.diff_commonPrefix(e,t),l=e.substring(0,c);e=e.substring(c),t=t.substring(c),c=this.diff_commonSuffix(e,t);var u=e.substring(e.length-c);e=e.substring(0,e.length-c),t=t.substring(0,t.length-c);var d=this.diff_compute_(e,t,s,o);return l&&d.unshift(new n.Diff(a,l)),u&&d.push(new n.Diff(a,u)),this.diff_cleanupMerge(d),d},n.prototype.diff_compute_=function(e,t,o,s){var c;if(!e)return[new n.Diff(i,t)];if(!t)return[new n.Diff(r,e)];var l=e.length>t.length?e:t,u=e.length>t.length?t:e,d=l.indexOf(u);if(d!=-1)return c=[new n.Diff(i,l.substring(0,d)),new n.Diff(a,u),new n.Diff(i,l.substring(d+u.length))],e.length>t.length&&(c[0][0]=c[2][0]=r),c;if(u.length==1)return[new n.Diff(r,e),new n.Diff(i,t)];var f=this.diff_halfMatch_(e,t);if(f){var p=f[0],m=f[1],h=f[2],g=f[3],_=f[4],v=this.diff_main(p,h,o,s),y=this.diff_main(m,g,o,s);return v.concat([new n.Diff(a,_)],y)}return o&&e.length>100&&t.length>100?this.diff_lineMode_(e,t,s):this.diff_bisect_(e,t,s)},n.prototype.diff_lineMode_=function(e,t,o){var s=this.diff_linesToChars_(e,t);e=s.chars1,t=s.chars2;var c=s.lineArray,l=this.diff_main(e,t,!1,o);this.diff_charsToLines_(l,c),this.diff_cleanupSemantic(l),l.push(new n.Diff(a,``));for(var u=0,d=0,f=0,p=``,m=``;u<l.length;){switch(l[u][0]){case i:f++,m+=l[u][1];break;case r:d++,p+=l[u][1];break;case a:if(d>=1&&f>=1){l.splice(u-d-f,d+f),u=u-d-f;for(var h=this.diff_main(p,m,!1,o),g=h.length-1;g>=0;g--)l.splice(u,0,h[g]);u+=h.length}f=0,d=0,p=``,m=``;break}u++}return l.pop(),l},n.prototype.diff_bisect_=function(e,t,a){for(var o=e.length,s=t.length,c=Math.ceil((o+s)/2),l=c,u=2*c,d=Array(u),f=Array(u),p=0;p<u;p++)d[p]=-1,f[p]=-1;d[l+1]=0,f[l+1]=0;for(var m=o-s,h=m%2!=0,g=0,_=0,v=0,y=0,b=0;b<c&&!(new Date().getTime()>a);b++){for(var x=-b+g;x<=b-_;x+=2){for(var S=l+x,C=x==-b||x!=b&&d[S-1]<d[S+1]?d[S+1]:d[S-1]+1,w=C-x;C<o&&w<s&&e.charAt(C)==t.charAt(w);)C++,w++;if(d[S]=C,C>o)_+=2;else if(w>s)g+=2;else if(h){var T=l+m-x;if(T>=0&&T<u&&f[T]!=-1){var E=o-f[T];if(C>=E)return this.diff_bisectSplit_(e,t,C,w,a)}}}for(var D=-b+v;D<=b-y;D+=2){for(var T=l+D,E=D==-b||D!=b&&f[T-1]<f[T+1]?f[T+1]:f[T-1]+1,ee=E-D;E<o&&ee<s&&e.charAt(o-E-1)==t.charAt(s-ee-1);)E++,ee++;if(f[T]=E,E>o)y+=2;else if(ee>s)v+=2;else if(!h){var S=l+m-D;if(S>=0&&S<u&&d[S]!=-1){var C=d[S],w=l+C-S;if(E=o-E,C>=E)return this.diff_bisectSplit_(e,t,C,w,a)}}}}return[new n.Diff(r,e),new n.Diff(i,t)]},n.prototype.diff_bisectSplit_=function(e,t,n,r,i){var a=e.substring(0,n),o=t.substring(0,r),s=e.substring(n),c=t.substring(r),l=this.diff_main(a,o,!1,i),u=this.diff_main(s,c,!1,i);return l.concat(u)},n.prototype.diff_linesToChars_=function(e,t){var n=[],r={};n[0]=``;function i(e){for(var t=``,i=0,o=-1,s=n.length;o<e.length-1;){o=e.indexOf(`
409
+ `)}const Bq=[`text`,`number`,`boolean`,`date`,`list`,`object`];V(Bq);const Vq=So([P(),F(),I()]),Hq=Po(()=>So([Vq.transform(e=>String(e)),B(P(),Uq),R(Hq)])),Uq=Po(()=>So([P(),F(),I(),R(Hq),B(P(),Uq)]));function Wq(e){if(Array.isArray(e)){let t=[];for(let n of e)n!==null&&t.push(Wq(n));return t}if(typeof e==`object`&&e){let t={};for(let[n,r]of Object.entries(e))t[n]=r===null?``:Wq(r);return t}return e}Lo(Wq,B(P(),Uq)),B(P(),So([Uq,vo()])),z({docName:yw,summary:xw,content:P().optional(),...bw}).loose(),z({docName:yw,summary:xw,markdown:P(),position:V([`append`,`prepend`,`replace`]).optional(),extension:V(yl).optional(),...bw}).loose(),z({docName:yw,summary:xw,find:P().min(1),replace:P(),offset:F().int().nonnegative().optional(),...bw}).loose(),z({docName:yw,connectionId:P().min(1),scope:V([`last`,`session`,`file`,`count`]).optional(),count:F().int().positive().optional(),...bw}).loose().refine(e=>e.scope!==`count`||e.count!==void 0,{message:`count is required when scope is 'count'`,path:[`count`]});const Gq=z({value:P(),truncatedFrom:F().int().nonnegative().optional(),hint:P().optional()}).loose(),Kq=Co(`kind`,[z({kind:H(`inline`),content:P()}),z({kind:H(`truncated`),byteLength:F().int().nonnegative(),hint:P()})]),qq=z({kind:H(`content-divergence`),intendedBytes:F().int().nonnegative(),actualBytes:F().int().nonnegative(),byteDelta:F().int(),divergenceType:P().optional(),currentState:Kq.optional(),hint:P().optional()}).loose(),Jq=z({type:H(`orphan`),parentCandidates:R(P()),message:P()}).loose(),Yq=z({kind:H(`disk-edit-reconciled`),intendedBytes:F().int().nonnegative(),actualBytes:F().int().nonnegative(),byteDelta:F().int(),mergeOutcome:P().optional(),hint:P().optional()}).loose(),Xq=Co(`kind`,[qq,Yq]),Zq=Co(`kind`,[qq,Yq,z({kind:H(`mermaid-parse-error`),fenceIndex:F().int().positive(),fenceFirstLine:P(),message:P(),line:F().int().positive().optional()}).loose(),z({kind:H(`lint-violation`),source:P(),code:P(),message:P(),severity:V([`error`,`warning`,`info`,`hint`]),line:F().int().positive(),column:F().int().positive(),linkTarget:P().optional()}).loose()]),Qq=R(Zq).min(1),$q=z({href:P(),resolvedTo:P().nullable(),reason:V([`no-such-doc`,`no-such-file`,`unresolvable`])}).loose(),eJ=R($q);z({timestamp:P().min(1),summary:Gq.optional(),warning:Xq.optional(),warnings:Qq.optional()}).loose(),z({timestamp:P().min(1),subscriberCount:F().int().nonnegative(),systemSubscriberCount:F().int().nonnegative(),hints:R(Jq).optional(),summary:Gq.optional(),warning:Xq.optional(),warnings:Qq.optional(),brokenLinks:eJ}).loose(),z({timestamp:P().min(1),subscriberCount:F().int().nonnegative(),systemSubscriberCount:F().int().nonnegative(),summary:Gq.optional(),warning:Xq.optional(),warnings:Qq.optional(),brokenLinks:eJ}).loose(),z({docName:P().min(1),scope:V([`last`,`session`,`count`]),undone:I()}).loose(),z({docs:R(z({docName:doe,markdown:P(),position:V([`append`,`prepend`,`replace`]).optional(),extension:V(yl).optional(),summary:xw}).loose()).min(1).max(100),...bw}).loose();const tJ=z({type:Dw,title:P(),detail:P().optional()}).loose(),nJ=Co(`status`,[z({status:H(`written`),docName:P().min(1),summary:Gq.optional(),warnings:Qq.optional(),brokenLinks:eJ}).loose(),z({status:H(`error`),docName:P().min(1),error:tJ}).loose()]);z({timestamp:P().min(1),results:R(nJ),written:F().int().nonnegative(),failed:F().int().nonnegative()}).loose(),z({docName:yw,patch:B(P(),So([Uq,vo()])),types:B(P(),V(Bq)).optional(),summary:xw,...bw}).loose(),z({timestamp:P().min(1),subscriberCount:F().int().nonnegative(),systemSubscriberCount:F().int().nonnegative(),appliedKeys:R(P()),summary:Gq.optional(),warning:Xq.optional(),warnings:Qq.optional(),brokenLinks:eJ}).loose(),z({entries:R(z({level:V([`info`,`warn`,`error`]),message:P().max(8192),event:P().optional(),fields:B(P(),L()).optional(),ts:F().optional(),sourceId:P().optional(),lineNumber:F().optional()}).loose()).max(100),droppedSinceLastFlush:F().int().min(0).optional()}).loose(),z({accepted:F().int().min(0)}).loose();const rJ=z({exact:P().min(1),prefix:P(),suffix:P(),start:F().int().nonnegative(),end:F().int().nonnegative()}),iJ=R(So([P(),F().int().nonnegative()])),aJ=Co(`kind`,[z({kind:H(`body`)}),z({kind:H(`property`),key:P().min(1),path:iJ.default([])})]).default({kind:`body`}),oJ=V([`anchored`,`orphaned`,`resolved`]),sJ=z({threadId:P().min(1),docName:P().min(1),target:aJ,anchor:rJ.nullable(),state:oJ,queued:I(),latestComment:P(),createdBy:P().min(1),createdAt:F()}),cJ=z({docName:P(),instruction:P(),property:P().nullable(),passage:z({exact:P(),prefix:P(),suffix:P()}).nullable(),anchorLost:I(),passageRepeats:I()}).loose(),lJ=z({threadId:P(),ok:H(!0)}),uJ=z({threadId:P(),ok:H(!1),error:H(`not-found`)});z({threads:R(sJ)}).loose(),z({meta:sJ,orphaned:I()}).loose(),z({threadId:P()}).loose(),z({meta:sJ,payload:cJ}).loose(),z({results:R(So([lJ.extend({meta:sJ,payload:cJ}),uJ]))}).loose(),z({results:R(So([lJ.extend({meta:sJ}),uJ]))}).loose();const dJ=z({status:P().min(1),reason:P()}).loose();z({docName:P().min(1),content:P(),lifecycle:dJ.nullable()}).loose(),z({documents:R(z({kind:V([`document`,`asset`,`folder`,`file`]).default(`document`),docName:P().min(1).optional(),docExt:P().min(1).default(`.md`),size:F().int().nonnegative(),modified:P().min(1),isSymlink:I().default(!1),canonicalDocName:P().nullable().default(null),targetPath:P().nullable().default(null),path:P().min(1).optional(),assetExt:P().min(1).optional(),mediaKind:V([`image`,`video`,`audio`,`pdf`,`text`,`mermaid`]).nullable().optional(),referencedBy:R(P().min(1)).optional(),hasChildren:I().optional()}).loose().refine(e=>e.kind===`document`?e.docName!==void 0&&e.path===void 0&&e.assetExt===void 0&&e.mediaKind===void 0&&e.referencedBy===void 0&&e.hasChildren===void 0:e.kind===`folder`?e.docName===void 0&&e.path!==void 0&&e.assetExt===void 0&&e.mediaKind===void 0&&e.referencedBy===void 0:e.kind===`file`?e.path!==void 0&&e.mediaKind===void 0&&e.referencedBy===void 0&&e.hasChildren===void 0:e.path!==void 0&&e.assetExt!==void 0&&e.referencedBy!==void 0&&e.hasChildren===void 0,{message:`document/asset/folder/file kind must match its required fields (document → docName; asset → path+assetExt+referencedBy; folder → path only, no docName; file → path, no mediaKind/referencedBy/hasChildren)`})),truncated:I().optional()}).loose();const fJ=z({source:P().min(1),anchor:P().nullable(),title:P(),snippet:P().nullable()}).loose();z({docName:P().min(1),backlinks:R(fJ)}).loose(),z({counts:B(P().min(1),F().int().nonnegative())}).loose(),z({counts:B(P().min(1),F().int().nonnegative())}).loose();const pJ=Co(`kind`,[z({kind:H(`doc`),docName:P().min(1),anchor:P().nullable(),title:P(),snippet:P().nullable()}).loose(),z({kind:H(`external`),url:P().min(1),title:P(),snippet:P().nullable()}).loose()]);z({docName:P().min(1),forwardLinks:R(pJ)}).loose();const mJ=Co(`kind`,[z({id:P().min(1),kind:H(`doc`),docName:P().min(1),anchor:P().nullable(),label:P(),cluster:P().nullable(),category:P().nullable(),tags:R(P()).nullable()}).loose(),z({id:P().min(1),kind:H(`external`),url:P().min(1),label:P()}).loose()]),hJ=z({source:P().min(1),target:P().min(1)}).loose();z({nodes:R(mJ),links:R(hJ)}).loose();const gJ=z({ts:F().int().min(0),url:P(),method:P(),ua:P().optional(),origin:P().optional(),referer:P().optional(),host:P().optional(),remote:P().optional(),secChUa:P().optional(),secChUaMobile:P().optional(),secChUaPlatform:P().optional(),secFetchSite:P().optional(),secFetchDest:P().optional(),secFetchMode:P().optional(),secFetchUser:P().optional()}).loose(),_J=z({app:So([H(`cursor`),H(`codex`),H(`claude`),vo()]),signals_fired:R(P())}).loose();z({entries:R(gJ),count:F().int().min(0),detection:_J}).loose(),z({writers:R(z({id:P().min(1),name:P().optional(),email:P().optional()}).loose()).optional(),summary:xw,...bw}).loose(),z({checkpointRef:P().min(1)}).loose();const vJ=z({v:F().int().optional(),id:P().min(1),name:P().min(1),colorSeed:P().optional(),docs:R(P()),summaries:R(P()).optional()}).loose();z({entries:R(z({sha:P().min(1),timestamp:P().min(1),author:P(),authorEmail:P(),type:V([`checkpoint`,`wip`,`upstream`,`park`]),message:P(),contributors:R(vJ),checkpoint:L().nullable(),parentSha:P().nullable().optional()}).loose()),total:F().int().nonnegative().optional(),truncated:I().optional(),hasMore:I().optional()}).loose(),z({sha:P().regex(/^[0-9a-f]{40}$/i),content:P(),timestamp:P(),author:P()}).loose(),z({contentDir:P().min(1),pathSeparator:V([`/`,`\\`]),symlinkResolved:I()}).loose(),R(Co(`source`,[z({docName:P().min(1),timestamp:P().min(1),size:F().int().nonnegative(),source:H(`flat`)}).loose(),z({docName:P().min(1),timestamp:P().min(1),source:H(`timeline`),sha:P().min(1)}).loose()])).meta({description:"Flat array of rescue buffer entries; discriminated via `source`."});const yJ=z({domain:P().min(1),title:P().optional(),description:P().optional(),siteName:P().optional(),faviconDataUri:P().optional()}).loose();z({url:P()}).loose(),Co(`ok`,[z({ok:H(!0),metadata:yJ}).loose(),z({ok:H(!1),reason:P()}).loose()]),z({orphans:R(z({docName:P().min(1),title:P()}).loose())}).loose(),z({hubs:R(z({docName:P().min(1),title:P(),count:F().int().nonnegative()}).loose())}).loose();const bJ=z({source:P().min(1),title:P(),snippet:P().nullable()}).loose();z({deadLinks:R(z({target:P().min(1),sources:R(bJ)}).loose())}).loose(),z({target:z({docName:P().min(1),title:P(),aliases:R(P())}).loose(),mentions:R(z({source:P().min(1),excerpt:P(),offset:F().int().nonnegative()}).loose()),truncated:I()}).loose(),z({projectPath:P().min(1)}).loose();const xJ=V([`not-a-git-worktree`,`init-failed`]);Co(`ok`,[z({ok:H(!0),projectPath:P().min(1)}).loose(),z({ok:H(!1),reason:xJ,message:P().min(1)}).loose()]),z({host:P().min(1).optional()}).loose(),z({host:P().min(1).optional(),token:P().min(1)}).loose(),z({host:P(),login:P()}).loose(),z({key:P().min(1)}).loose(),z({keyPresent:I()}).loose();const SJ=V([`no_key`,`invalid_endpoint`,`rate_limit`,`timeout`,`http_error`,`network`,`dims_mismatch`,`malformed_response`]);Co(`ok`,[z({ok:H(!0),endpoint:P().min(1),model:P().min(1),dimensions:F().int().positive()}).loose(),z({ok:H(!1),endpoint:P().min(1),model:P().min(1),reason:SJ,status:F().int().optional()}).loose()]),z({name:P().refine(e=>e.trim().length>0,{message:`name must be non-empty`}),email:P().refine(e=>e.trim().length>0,{message:`email must be non-empty`})}).loose(),z({authenticated:I()}).loose(),z({channel:V([`login`,`gh-login`]).default(`login`)}).loose(),z({}).loose();const CJ=z({stackIndex:F().int().min(0),ts:F().int().min(0),additions:F().int().min(0),deletions:F().int().min(0)}).loose(),wJ=z({docName:P().min(1),additionsTotal:F().int().min(0),deletionsTotal:F().int().min(0),lastTs:F().int().min(0),bursts:R(CJ)}).loose(),TJ=z({displayName:P().min(1),color:P().min(1),icon:P().optional(),connectionId:P().min(1)}).loose();z({sessionAlive:I(),agent:TJ.nullable(),files:R(wJ)}).loose(),z({diff:P(),before:P(),after:P(),generatedAt:F().int().min(0)}).loose(),z({}).loose(),z({}).loose(),z({}).loose(),z({}).loose(),z({}).loose(),z({}).loose();const EJ=z({displayName:P().min(1),icon:P(),color:P().min(1),currentDoc:P().nullable(),mode:V([`idle`,`writing`]),ts:F().int().min(0)}).loose();z({presence:B(P().min(1),EJ)}).loose();const DJ=z({sessionId:P().min(1),agentType:P().min(1),ts:F().int().min(0),insertedChars:F().int().min(0),deletedChars:F().int().min(0)}).loose();z({effects:R(z({"doc.name":P().min(1),entries:R(DJ)}).loose())}).loose(),z({decisions:R(z({ts:F().int().min(0),decision:P().min(1),kind:P().min(1),"doc.name":P().min(1),pathRole:P().min(1)}).loose())}).loose(),B(P().min(1),I()).meta({description:`Flat boolean record keyed by agent-scheme name (claude / codex / cursor). True = installed.`}),z({path:P().min(1,`path must be non-empty`)}).loose(),z({}).loose();const OJ=z({fromDocName:P().min(1),toDocName:P().min(1)}).loose(),kJ=z({fromPath:P().min(1),toPath:P().min(1)}).loose();z({}).loose(),z({path:P().min(1),...bw,summary:xw}).loose(),z({docName:P().min(1)}).loose(),z({path:P().min(1),...bw,summary:xw}).loose(),z({path:P().min(1)}).loose(),z({kind:V([`file`,`folder`]),path:P().min(1),...bw,summary:xw}).loose(),z({kind:V([`file`,`folder`]),path:P().min(1),duplicatedDocNames:R(P().min(1))}).loose(),z({pages:R(z({docName:P().min(1),title:P(),docExt:P().min(1),size:F().int().nonnegative(),modified:P().min(1),icon:P().min(1).max(2048).optional()}).loose())}).loose();const AJ=z({level:F().int().min(1).max(6),text:P(),slug:P()}).loose();z({docName:P().min(1),headings:R(AJ)}).loose();const jJ=z({docName:P().min(1),rewrites:F().int().nonnegative()}).loose();z({kind:V([`file`,`folder`,`asset`]),fromPath:P().min(1),toPath:P().min(1),...bw,summary:xw}).loose(),z({renamed:R(OJ),renamedAssets:R(kJ),rewrittenDocs:R(jJ).optional(),summary:Gq.optional()}).loose(),z({kind:V([`file`,`folder`,`asset`]),path:P().min(1),...bw}).loose(),z({deletedDocNames:R(P().min(1))}).loose(),z({kind:V([`file`,`folder`,`asset`]),path:P().min(1),...bw,summary:xw}).loose(),z({deletedDocNames:R(P().min(1))}).loose(),z({docName:P().min(1),commitSha:P().regex(/^[0-9a-f]{40}$/i,{message:`commitSha must be a 40-char git SHA`}),summary:xw,...bw}).loose(),z({restoredFrom:P().min(1),timestamp:P().min(1),summary:Gq.optional(),warning:qq.optional(),warnings:Qq.optional()}).loose();const MJ=V([`dormant`,`idle`,`fetching`,`pulling`,`pushing`,`conflict`,`offline`,`auth-error`,`disabled`]),NJ=z({label:P().min(1),webUrl:fo().nullable()}).loose(),PJ=Co(`checkStatus`,[z({checkStatus:H(`allowed`)}).loose(),z({checkStatus:H(`denied`),deniedReason:V([`no-collaborator`,`private-no-access`,`repo-not-found`,`not-authenticated`])}).loose(),z({checkStatus:H(`unknown`),unknownError:V([`network`,`timeout`,`rate-limit`,`token-invalid`,`malformed-response`,`ssh-unverified`]).optional()}).loose()]),FJ=V([`auth-403`,`auth-401`,`auth-scope-mismatch`,`auth-no-credential`,`semantic-protected-branch`]),IJ=V(kne),LJ=V([`succeeded`,`up-to-date`,`conflict`,`refused`,`error`]);z({state:MJ,lastSyncUtc:P().nullable(),lastFetchUtc:P().nullable(),lastPushedSha:P().nullable(),ahead:F().int().min(0),behind:F().int().min(0),consecutiveFailures:F().int().min(0),conflictCount:F().int().min(0),hasRemote:I(),syncEnabled:I(),identityUnresolved:I(),remote:NJ.nullable().optional(),pushError:P().optional(),pushErrorCode:FJ.optional(),pullError:P().optional(),pullErrorCode:FJ.optional(),pausedReason:P().optional(),pushPermission:PJ.optional(),syncMode:IJ.optional(),lastPullUtc:P().nullable().optional(),lastPullOutcome:LJ.nullable().optional()}).loose(),z({op:V([`sync`,`push`,`pull`]).optional()}).loose(),z({op:V([`sync`,`push`,`pull`])}).loose(),z({conflicts:R(z({file:P().min(1),detectedAt:P().min(1),oursSha:P().optional(),theirsSha:P().optional(),baseSha:P().optional()}).loose())}).loose(),z({file:P().min(1),strategy:V([`mine`,`theirs`,`content`,`delete`]),content:P().optional()}).loose().refine(e=>e.strategy!==`content`||e.content!==void 0&&e.content!==``,{message:`content must be a non-empty string when strategy is 'content'`,path:[`content`]}),z({}).loose(),z({file:P().min(1),base:P(),ours:P(),theirs:P(),kind:V([`both-modified`,`delete-modify`,`modify-delete`]),lifecycleStatus:P().nullable()}).loose(),z({plan:Io(e=>e!==void 0,{message:`plan is required`})}).loose(),z({plan:Io(e=>e!==void 0,{message:`plan is required`})}).loose(),z({result:Io(e=>e!==void 0,{message:`result is required`})}).loose();const RJ=z({path:P().min(1),summary:P().min(1)}).loose(),zJ=z({files:F().int().nonnegative(),folders:F().int().nonnegative()}).loose();z({packs:R(z({id:P().min(1),name:P().min(1),description:P().min(1),defaultSubfolder:P().optional(),folders:R(RJ),entryCounts:zJ}).loose())}).loose(),z({noOpen:I().optional(),out:P().min(1).optional()}).loose();const BJ=z({reason:V([`unsupported-platform`,`spawn-error`]),message:P()}).loose();Co(`status`,[z({status:H(`installed`),outputPath:P(),size:F().int().nonnegative(),sha256:P(),skillVersion:P()}).loose(),z({status:H(`built`),outputPath:P(),size:F().int().nonnegative(),sha256:P(),skillVersion:P(),handoffError:BJ.optional()}).loose(),z({status:H(`failed`),buildError:P()}).loose(),z({status:H(`skip-current`),skillVersion:P(),recordedAt:P().optional()}).loose()]);const VJ=V(wl);z({tags:R(z({name:P().min(1),count:F().int().nonnegative(),isLeaf:I()}).loose())}).loose();const HJ=z({docName:P().min(1),title:P(),matchingTags:R(P().min(1)),snippet:P().nullable()}).loose();z({name:P().min(1),docs:R(HJ)}).loose(),z({folder:L(),frontmatter_local:B(P(),L()).nullable()}).loose(),z({path:P(),frontmatter:B(P(),L()).optional()}).loose(),z({applied:L()}).loose();const UJ=B(P(),L()).meta({description:`Free-form frontmatter map embedded in template payloads.`});z({template:z({name:P().min(1),folder:P(),scope:V([`local`,`inherited`]),path:P().min(1),frontmatter:UJ,body:P()}).strict()}).strict(),z({templates:R(z({name:P().min(1),title:P().optional(),description:P().optional(),path:P().min(1),source_folder:P()}).strict()),truncated:I()}).strict(),z({folder:P(),name:P(),body:P().optional(),frontmatter:UJ.optional(),...bw,summary:xw}).strict(),z({path:P().min(1),created:I(),warnings:R(P())}).strict(),z({sourcePath:P().min(1),targetFolder:P(),name:P().optional(),title:P().optional(),deleteSource:I().optional(),...bw,summary:xw}).strict(),z({path:P().min(1),created:I(),warnings:R(P())}).strict(),z({existed:I(),path:P().min(1)}).strict(),z({fromFolder:P(),fromName:P(),toFolder:P(),toName:P(),body:P().optional(),frontmatter:UJ.optional(),...bw,summary:xw}).strict(),z({from:P().min(1),to:P().min(1),committed:I()}).strict();const WJ=V(gl),GJ=/^[a-z0-9-]+$/,KJ=z({name:P(),description:P()}).strict();z({skill:z({name:P().min(1),scope:WJ,path:P().min(1),frontmatter:KJ,body:P(),files:R(z({path:P().min(1),text:P().nullable()})).optional(),managed:I().optional()}).strict()}).strict();const qJ=z({source:P().min(1),publisher:P().optional(),skill:P().optional(),marketplaceUrl:P().optional(),importedAt:P().min(1),autoUpdate:I().optional()}).strict();z({skills:R(z({name:P().min(1),description:P().optional(),scope:WJ,path:P().min(1),absolutePath:P().min(1).optional(),installed:I(),hosts:R(P()),driftPaths:R(P()).optional().meta({description:`Recorded locations whose on-disk form (copy vs symlink) no longer matches what OK last wrote there — evidence another tool rewrote the path.`}),hostAliases:B(P(),P()).optional().meta({description:`Host skills roots that are symlink ALIASES of another location (host id → base-relative target root). An aliased folder is a derived view — no menu row, never a write target; the host's icon rides the target root's row.`}),conflictHosts:R(P()).optional().meta({description:`Hosts whose dir holds a DIFFERENT same-name skill (fork/conflict) — occupied, not this skill.`}),symlinkedHosts:R(P()).optional(),installableEditors:R(P()).optional(),linkMode:I().optional(),customPlacements:R(z({path:P(),mode:V([`copy`,`link`])}).strict()).optional(),managed:I().optional(),origin:qJ.optional(),modified:I().optional(),revertable:I().optional()}).strict()),truncated:I()}).strict(),z({scope:WJ.default(`project`),name:P().meta({description:`Managed skill name to create or update.`}),body:P().optional(),frontmatter:KJ,...bw,summary:xw}).strict(),z({path:P().min(1),created:I(),warnings:R(P())}).strict(),z({scope:WJ.default(`project`),name:P(),dryRun:I().optional(),setAutoUpdate:I().optional(),...bw,summary:xw}).strict(),z({name:P().min(1),updated:I(),source:P().min(1),localBody:P().optional(),upstreamBody:P().optional(),gitTracked:I().optional(),warnings:R(P())}).strict(),z({scope:WJ.default(`project`),name:P(),...bw,summary:xw}).strict(),z({name:P().min(1),baselineRef:P().min(1),restoredFiles:R(P()),warnings:R(P())}).strict(),z({existed:I(),path:P().min(1)}).strict(),z({scope:WJ.default(`project`),fromName:P(),toName:P(),body:P().optional(),frontmatter:KJ.optional(),...bw,summary:xw}).strict(),z({from:P().min(1),to:P().min(1),committed:I()}).strict(),z({name:P(),fromScope:WJ,toScope:WJ,...bw,summary:xw}).strict(),z({scope:WJ,path:P().optional()}).strict(),z({scope:WJ,name:P(),toName:P(),...bw,summary:xw}).strict(),z({name:P().min(1)}).strict(),z({name:P(),home:P().min(1)}).strict(),z({docName:P().min(1)}).strict();const JJ=V([`reference`,`script`,`file`]);z({scope:WJ.default(`project`),name:P(),path:P().min(1),content:P(),...bw,summary:xw}).strict(),z({path:P().min(1),created:I(),kind:JJ,content:I()}).strict(),z({scope:WJ.default(`project`),name:P(),from:P().min(1),to:P().min(1),...bw,summary:xw}).strict(),z({from:P().min(1),to:P().min(1),fromDocName:P().optional(),toDocName:P().optional()}).strict(),z({path:P().min(1),kind:JJ,text:P()}).strict(),z({path:P().min(1),existed:I(),kind:JJ}).strict();const YJ=So([VJ,H(`agents`)]),XJ=P().min(1).refine(e=>!e.startsWith(`/`)&&!e.startsWith(`~`)&&!/^[A-Za-z]:/.test(e),{error:`a custom root is base-relative (e.g. ".tim/skills"), not absolute or ~-prefixed`}).refine(e=>e.split(`/`).every(e=>e!==``&&e!==`.`&&e!==`..`),{error:`a custom root may not contain "..", "." or empty path segments`}).refine(e=>e.includes(`/`),{error:`a custom root is a path (e.g. ".tim/skills") — bare editor names are host ids`}),ZJ=So([YJ,XJ]);z({scope:WJ.default(`project`),name:P(),targets:R(YJ).optional().meta({description:'SET-EXACT install targets (editor ids, plus "agents" for the .agents hub — in-place skills only): the COMPLETE resulting host set. Omit to use project-configured editors; pass [] to uninstall everywhere. Stateless callers should prefer `add`/`remove`.'}),add:R(ZJ).optional().meta({description:`Locations to ADD the skill to (everything else untouched). Editor ids fan out a managed copy/symlink; a custom root path (".tim/skills") places the bundle there.`}),remove:R(ZJ).optional().meta({description:"Locations to REMOVE the skill from (lossless only — a hand-edited fork is refused, never deleted). The source cannot be removed; move it first with `source`."}),mode:V([`copy`,`link`]).optional().meta({description:`"link": one real folder (the source); every other location becomes a symlink to it. "copy": independent real folders, refreshed from the source until hand-edited (a hand-edit forks that copy). Converts existing locations losslessly. Omit to follow the form the skill already uses.`}),source:ZJ.optional().meta({description:`Move the skill's REAL folder to this location (the old source becomes a symlink to it — never a removal). Sticky across rescans.`}),linkMode:I().optional(),setSource:P().min(1).optional(),place:z({dir:P().min(1).meta({description:`Project-relative directory the bundle dir is created under (e.g. ".windsurf/skills").`}),mode:V([`copy`,`link`])}).strict().optional(),convert:z({target:ZJ.meta({description:`The installed location to convert — an editor id, "agents", or a recorded custom placement path.`}),mode:V([`copy`,`link`]).meta({description:`"link": replace this location with a symlink to the source. "copy": replace it with an independent real folder.`})}).strict().optional(),unplace:z({path:P().min(1).meta({description:`The recorded placement bundle path (e.g. ".windsurf/skills/my-skill").`})}).strict().optional(),...bw,summary:xw,fork:z({editor:P().min(1),action:V([`align`,`make-source`,`rename`]),toName:P().optional()}).strict().optional()}).strict().refine(e=>!(e.targets!==void 0&&(e.add!==void 0||e.remove!==void 0)),{error:"`targets` is set-exact; `add`/`remove` are additive — use one style per call"}).refine(e=>e.fork===void 0||e.targets===void 0&&e.add===void 0&&e.remove===void 0&&e.source===void 0&&e.setSource===void 0,{error:"`fork` is its own operation — run it in a separate call"}).refine(e=>e.fork?.action!==`rename`||e.fork.toName!==void 0,{error:"`fork.rename` requires `toName`"}).refine(e=>!(e.source!==void 0&&(e.add!==void 0||e.remove!==void 0)),{error:"a `source` move is its own operation — run it in a separate call from `add`/`remove`"}).refine(e=>[e.targets!==void 0||e.add!==void 0||e.remove!==void 0,e.place!==void 0,e.unplace!==void 0,e.convert!==void 0,e.source!==void 0||e.setSource!==void 0,e.fork!==void 0].filter(Boolean).length<=1,{error:"one operation per call — membership (`targets`/`add`/`remove`), `place`, `unplace`, `convert`, `source`, and `fork` are mutually exclusive"}),z({name:P().min(1).meta({description:`Managed skill name installed or uninstalled.`}),hosts:R(P()).meta({description:`Editor ids the skill is projected into after the operation; [] is expected after uninstall.`}),scripts:I().meta({description:`True when the skill ships executable scripts, projected but never run.`}),warnings:R(P()).meta({description:`Non-fatal install/uninstall warnings from target projection.`}),warningCodes:R(V([`no-targets`,`scripts-present`,`name-conflict`,`no-description`,`skill-fork-name-unpatched`,`place-path-invalid`,`place-fork-refused`])).meta({description:"Machine-readable warning codes aligned with `warnings`."}),placedAt:P().optional(),sourceMovedTo:P().optional()}).strict(),z({scope:WJ.default(`project`),name:P().meta({description:`Managed skill name to uninstall without deleting source.`})}).strict(),z({name:P().min(1).meta({description:`Managed skill name requested for uninstall.`}),uninstalled:I().meta({description:`True when an install marker existed and was removed; false for an idempotent no-op.`})}).strict(),z({targets:R(VJ),configured:I(),folders:R(z({scope:WJ,host:P(),root:P(),state:V([`own`,`linked`,`linked-parent`,`absent`]),target:P().optional(),drift:H(!0).optional(),expected:P().optional()}).strict()).optional()}).strict(),z({folderAction:Co(`action`,[z({action:H(`link`),scope:WJ,root:P().min(1).meta({description:`The folder to link (e.g. ".codex/skills").`}),target:P().min(1).meta({description:`The root it merges into (e.g. ".agents/skills"). Required.`})}).strict(),z({action:H(`unlink`),scope:WJ,root:P().min(1).meta({description:`The linked folder to materialize back.`}),exclude:R(P().min(1)).optional().meta({description:`Skill names to LEAVE OUT when materializing — the folder keeps every other skill it currently sees (as per-skill links) and stops auto-following the target root.`})}).strict(),z({action:H(`add-root`),scope:WJ,root:XJ.meta({description:`New custom skills root to declare (base-relative, e.g. ".team/skills").`})}).strict()])}).strict(),z({targets:R(VJ),reprojected:R(z({name:P(),hosts:R(P())}).strict()),bundleHosts:R(P()),removedFrom:R(P()),folder:z({moved:R(P()),dropped:R(P()),linked:R(P())}).strict().optional()}).strict(),z({scope:WJ.default(`project`),name:P(),version:P().regex(/^[0-9a-f]{40}$/i),...bw,summary:xw}).strict(),z({name:P().min(1),version:P(),restoredFiles:R(P()),warnings:R(P())}).strict(),z({query:P().optional(),intent:V([`autocomplete`,`full_text`,`omnibar`]).optional(),ranking:V([`navigation`,`relevance`]).optional(),scopes:R(V([`page`,`folder`,`content`,`file`])).optional(),scope:P().optional(),limit:F().int().nonnegative().optional(),semantic:I().optional(),source:V([`omnibar`,`mcp`,`http`]).optional()}).loose();const QJ=z({kind:V([`page`,`folder`,`content`,`file`]),path:P().min(1),title:P(),score:F(),signals:B(P(),L()),snippet:P().optional()}).loose(),$J=z({capable:I(),applied:I(),coverage:z({embedded:F().int().nonnegative(),total:F().int().nonnegative()})}).loose();z({enabled:I(),keyPresent:I(),keyNotRequired:I(),keySource:V([`project`,`file`,`env`]).nullable(),keyHint:P().nullable(),ready:I(),capable:I(),embedded:F().int().nonnegative(),total:F().int().nonnegative()}).loose(),z({query:P(),intent:V([`autocomplete`,`full_text`,`omnibar`]),results:R(QJ),elapsedMs:F().nonnegative(),semantic:$J.optional(),truncated:I().optional(),ready:I().optional()}).loose();const eY=z({version:P().min(1),recordedAt:P().min(1)}).loose();z({currentVersion:P().min(1),targets:B(P(),eY.nullable())}).loose(),z({scope:WJ.default(`project`),source:P().min(1).meta({description:`External skill source: full skills.sh skill-page URL (https://www.skills.sh/<owner>/<repo>/<skill>, or https://www.skills.sh/site/<hostname>/<skill> for a website catalog), GitHub owner/repo[/subpath], git URL, or local/file path.`}),skill:P().min(1).optional().meta({description:`Specific skill name to import from a multi-skill source.`}),install:I().optional().meta({description:`Pass false to import WITHOUT the default-editor auto-projection (the caller installs explicitly afterwards). Default true.`}),marketplace:I().optional().meta({description:"The source came from a skills.sh listing the user chose (the Explore tab), so the install is reported to skills.sh and counts toward that listing. Off by default: a hand-typed repo must not be announced to skills.sh. Honors the `telemetry.skillInstallReports.enabled` setting and DO_NOT_TRACK."}),...bw,summary:xw}).strict(),z({scope:WJ.default(`project`),source:P().min(1).meta({description:`External skill source: full skills.sh skill-page URL, GitHub owner/repo[/subpath], git URL, or local/file path.`}),skills:R(P().min(1)).min(1).max(100).meta({description:`Skill names to import from the source.`}),install:I().optional().meta({description:`Pass false to import WITHOUT the default-editor auto-projection. Default true.`}),marketplace:I().optional().meta({description:"The source came from a skills.sh listing the user chose (a marketplace plugin bundle), so the import is reported to skills.sh as one batched install event and counts toward that listing. Off by default: a hand-typed repo must not be announced to skills.sh. Honors the `telemetry.skillInstallReports.enabled` setting and DO_NOT_TRACK."}),...bw,summary:xw}).strict(),z({results:R(z({requested:P(),status:V([`imported`,`already-imported`,`not-found`,`failed`]),name:P().optional(),collisionRenamedFrom:P().optional(),warnings:R(P()),error:P().optional()}).loose()),imported:F(),alreadyImported:F(),failed:F()}).loose();const tY=z({source:P(),ref:P().optional(),contentHash:P(),publisher:P().optional()}).loose();z({name:P().min(1).meta({description:`Managed skill name created or matched.`}),path:P().min(1).meta({description:`Store-relative path to the imported skill source.`}),created:I().meta({description:`True when this request created new source files.`}),alreadyImported:I().meta({description:`True when identical content was already present and no files changed.`}),collisionRenamedFrom:P().optional().meta({description:`Original source name when collision handling renamed the import.`}),provenance:tY,warnings:R(P()).meta({description:`Non-fatal import warnings, such as skipped unsupported files.`})}).loose();const nY=V([`files`,`backlinks`,`graph`,`sync-status`,`session-activity`,`tags`,`comments`,`lint-config`]);z({v:H(1),ch:H(`server-info`),seq:F(),serverInstanceId:P().min(1),currentBranch:P().min(1).optional()}).loose(),z({v:H(1),ch:H(`branch-switched`),seq:F(),branch:P().min(1)}).loose(),z({v:H(1),ch:nY,seq:F()}).loose(),z({v:H(1),ch:H(`disk-ack`),seq:F(),docName:P().min(1),sv:P().min(1)}).loose(),z({v:H(1),ch:H(`config-validation-rejected`),seq:F(),docName:P().min(1),error:$c}).loose(),z({v:H(1),ch:H(`config-ignore-nested-error`),seq:F(),path:P().min(1),error:P().min(1)}).loose();var rY=e(i(((e,t)=>{var n=function(){this.Diff_Timeout=1,this.Diff_EditCost=4,this.Match_Threshold=.5,this.Match_Distance=1e3,this.Patch_DeleteThreshold=.5,this.Patch_Margin=4,this.Match_MaxBits=32},r=-1,i=1,a=0;n.Diff=function(e,t){return[e,t]},n.prototype.diff_main=function(e,t,r,i){i===void 0&&(i=this.Diff_Timeout<=0?Number.MAX_VALUE:new Date().getTime()+this.Diff_Timeout*1e3);var o=i;if(e==null||t==null)throw Error(`Null input. (diff_main)`);if(e==t)return e?[new n.Diff(a,e)]:[];r===void 0&&(r=!0);var s=r,c=this.diff_commonPrefix(e,t),l=e.substring(0,c);e=e.substring(c),t=t.substring(c),c=this.diff_commonSuffix(e,t);var u=e.substring(e.length-c);e=e.substring(0,e.length-c),t=t.substring(0,t.length-c);var d=this.diff_compute_(e,t,s,o);return l&&d.unshift(new n.Diff(a,l)),u&&d.push(new n.Diff(a,u)),this.diff_cleanupMerge(d),d},n.prototype.diff_compute_=function(e,t,o,s){var c;if(!e)return[new n.Diff(i,t)];if(!t)return[new n.Diff(r,e)];var l=e.length>t.length?e:t,u=e.length>t.length?t:e,d=l.indexOf(u);if(d!=-1)return c=[new n.Diff(i,l.substring(0,d)),new n.Diff(a,u),new n.Diff(i,l.substring(d+u.length))],e.length>t.length&&(c[0][0]=c[2][0]=r),c;if(u.length==1)return[new n.Diff(r,e),new n.Diff(i,t)];var f=this.diff_halfMatch_(e,t);if(f){var p=f[0],m=f[1],h=f[2],g=f[3],_=f[4],v=this.diff_main(p,h,o,s),y=this.diff_main(m,g,o,s);return v.concat([new n.Diff(a,_)],y)}return o&&e.length>100&&t.length>100?this.diff_lineMode_(e,t,s):this.diff_bisect_(e,t,s)},n.prototype.diff_lineMode_=function(e,t,o){var s=this.diff_linesToChars_(e,t);e=s.chars1,t=s.chars2;var c=s.lineArray,l=this.diff_main(e,t,!1,o);this.diff_charsToLines_(l,c),this.diff_cleanupSemantic(l),l.push(new n.Diff(a,``));for(var u=0,d=0,f=0,p=``,m=``;u<l.length;){switch(l[u][0]){case i:f++,m+=l[u][1];break;case r:d++,p+=l[u][1];break;case a:if(d>=1&&f>=1){l.splice(u-d-f,d+f),u=u-d-f;for(var h=this.diff_main(p,m,!1,o),g=h.length-1;g>=0;g--)l.splice(u,0,h[g]);u+=h.length}f=0,d=0,p=``,m=``;break}u++}return l.pop(),l},n.prototype.diff_bisect_=function(e,t,a){for(var o=e.length,s=t.length,c=Math.ceil((o+s)/2),l=c,u=2*c,d=Array(u),f=Array(u),p=0;p<u;p++)d[p]=-1,f[p]=-1;d[l+1]=0,f[l+1]=0;for(var m=o-s,h=m%2!=0,g=0,_=0,v=0,y=0,b=0;b<c&&!(new Date().getTime()>a);b++){for(var x=-b+g;x<=b-_;x+=2){for(var S=l+x,C=x==-b||x!=b&&d[S-1]<d[S+1]?d[S+1]:d[S-1]+1,w=C-x;C<o&&w<s&&e.charAt(C)==t.charAt(w);)C++,w++;if(d[S]=C,C>o)_+=2;else if(w>s)g+=2;else if(h){var T=l+m-x;if(T>=0&&T<u&&f[T]!=-1){var E=o-f[T];if(C>=E)return this.diff_bisectSplit_(e,t,C,w,a)}}}for(var D=-b+v;D<=b-y;D+=2){for(var T=l+D,E=D==-b||D!=b&&f[T-1]<f[T+1]?f[T+1]:f[T-1]+1,ee=E-D;E<o&&ee<s&&e.charAt(o-E-1)==t.charAt(s-ee-1);)E++,ee++;if(f[T]=E,E>o)y+=2;else if(ee>s)v+=2;else if(!h){var S=l+m-D;if(S>=0&&S<u&&d[S]!=-1){var C=d[S],w=l+C-S;if(E=o-E,C>=E)return this.diff_bisectSplit_(e,t,C,w,a)}}}}return[new n.Diff(r,e),new n.Diff(i,t)]},n.prototype.diff_bisectSplit_=function(e,t,n,r,i){var a=e.substring(0,n),o=t.substring(0,r),s=e.substring(n),c=t.substring(r),l=this.diff_main(a,o,!1,i),u=this.diff_main(s,c,!1,i);return l.concat(u)},n.prototype.diff_linesToChars_=function(e,t){var n=[],r={};n[0]=``;function i(e){for(var t=``,i=0,o=-1,s=n.length;o<e.length-1;){o=e.indexOf(`
410
410
  `,i),o==-1&&(o=e.length-1);var c=e.substring(i,o+1);(r.hasOwnProperty?r.hasOwnProperty(c):r[c]!==void 0)?t+=String.fromCharCode(r[c]):(s==a&&(c=e.substring(i),o=e.length),t+=String.fromCharCode(s),r[c]=s,n[s++]=c),i=o+1}return t}var a=4e4,o=i(e);return a=65535,{chars1:o,chars2:i(t),lineArray:n}},n.prototype.diff_charsToLines_=function(e,t){for(var n=0;n<e.length;n++){for(var r=e[n][1],i=[],a=0;a<r.length;a++)i[a]=t[r.charCodeAt(a)];e[n][1]=i.join(``)}},n.prototype.diff_commonPrefix=function(e,t){if(!e||!t||e.charAt(0)!=t.charAt(0))return 0;for(var n=0,r=Math.min(e.length,t.length),i=r,a=0;n<i;)e.substring(a,i)==t.substring(a,i)?(n=i,a=n):r=i,i=Math.floor((r-n)/2+n);return i},n.prototype.diff_commonSuffix=function(e,t){if(!e||!t||e.charAt(e.length-1)!=t.charAt(t.length-1))return 0;for(var n=0,r=Math.min(e.length,t.length),i=r,a=0;n<i;)e.substring(e.length-i,e.length-a)==t.substring(t.length-i,t.length-a)?(n=i,a=n):r=i,i=Math.floor((r-n)/2+n);return i},n.prototype.diff_commonOverlap_=function(e,t){var n=e.length,r=t.length;if(n==0||r==0)return 0;n>r?e=e.substring(n-r):n<r&&(t=t.substring(0,n));var i=Math.min(n,r);if(e==t)return i;for(var a=0,o=1;;){var s=e.substring(i-o),c=t.indexOf(s);if(c==-1)return a;o+=c,(c==0||e.substring(i-o)==t.substring(0,o))&&(a=o,o++)}},n.prototype.diff_halfMatch_=function(e,t){if(this.Diff_Timeout<=0)return null;var n=e.length>t.length?e:t,r=e.length>t.length?t:e;if(n.length<4||r.length*2<n.length)return null;var i=this;function a(e,t,n){for(var r=e.substring(n,n+Math.floor(e.length/4)),a=-1,o=``,s,c,l,u;(a=t.indexOf(r,a+1))!=-1;){var d=i.diff_commonPrefix(e.substring(n),t.substring(a)),f=i.diff_commonSuffix(e.substring(0,n),t.substring(0,a));o.length<f+d&&(o=t.substring(a-f,a)+t.substring(a,a+d),s=e.substring(0,n-f),c=e.substring(n+d),l=t.substring(0,a-f),u=t.substring(a+d))}return o.length*2>=e.length?[s,c,l,u,o]:null}var o=a(n,r,Math.ceil(n.length/4)),s=a(n,r,Math.ceil(n.length/2)),c;if(!o&&!s)return null;c=s?o&&o[4].length>s[4].length?o:s:o;var l,u,d,f;e.length>t.length?(l=c[0],u=c[1],d=c[2],f=c[3]):(d=c[0],f=c[1],l=c[2],u=c[3]);var p=c[4];return[l,u,d,f,p]},n.prototype.diff_cleanupSemantic=function(e){for(var t=!1,o=[],s=0,c=null,l=0,u=0,d=0,f=0,p=0;l<e.length;)e[l][0]==a?(o[s++]=l,u=f,d=p,f=0,p=0,c=e[l][1]):(e[l][0]==i?f+=e[l][1].length:p+=e[l][1].length,c&&c.length<=Math.max(u,d)&&c.length<=Math.max(f,p)&&(e.splice(o[s-1],0,new n.Diff(r,c)),e[o[s-1]+1][0]=i,s--,s--,l=s>0?o[s-1]:-1,u=0,d=0,f=0,p=0,c=null,t=!0)),l++;for(t&&this.diff_cleanupMerge(e),this.diff_cleanupSemanticLossless(e),l=1;l<e.length;){if(e[l-1][0]==r&&e[l][0]==i){var m=e[l-1][1],h=e[l][1],g=this.diff_commonOverlap_(m,h),_=this.diff_commonOverlap_(h,m);g>=_?(g>=m.length/2||g>=h.length/2)&&(e.splice(l,0,new n.Diff(a,h.substring(0,g))),e[l-1][1]=m.substring(0,m.length-g),e[l+1][1]=h.substring(g),l++):(_>=m.length/2||_>=h.length/2)&&(e.splice(l,0,new n.Diff(a,m.substring(0,_))),e[l-1][0]=i,e[l-1][1]=h.substring(0,h.length-_),e[l+1][0]=r,e[l+1][1]=m.substring(_),l++),l++}l++}},n.prototype.diff_cleanupSemanticLossless=function(e){function t(e,t){if(!e||!t)return 6;var r=e.charAt(e.length-1),i=t.charAt(0),a=r.match(n.nonAlphaNumericRegex_),o=i.match(n.nonAlphaNumericRegex_),s=a&&r.match(n.whitespaceRegex_),c=o&&i.match(n.whitespaceRegex_),l=s&&r.match(n.linebreakRegex_),u=c&&i.match(n.linebreakRegex_),d=l&&e.match(n.blanklineEndRegex_),f=u&&t.match(n.blanklineStartRegex_);return d||f?5:l||u?4:a&&!s&&c?3:s||c?2:a||o?1:0}for(var r=1;r<e.length-1;){if(e[r-1][0]==a&&e[r+1][0]==a){var i=e[r-1][1],o=e[r][1],s=e[r+1][1],c=this.diff_commonSuffix(i,o);if(c){var l=o.substring(o.length-c);i=i.substring(0,i.length-c),o=l+o.substring(0,o.length-c),s=l+s}for(var u=i,d=o,f=s,p=t(i,o)+t(o,s);o.charAt(0)===s.charAt(0);){i+=o.charAt(0),o=o.substring(1)+s.charAt(0),s=s.substring(1);var m=t(i,o)+t(o,s);m>=p&&(p=m,u=i,d=o,f=s)}e[r-1][1]!=u&&(u?e[r-1][1]=u:(e.splice(r-1,1),r--),e[r][1]=d,f?e[r+1][1]=f:(e.splice(r+1,1),r--))}r++}},n.nonAlphaNumericRegex_=/[^a-zA-Z0-9]/,n.whitespaceRegex_=/\s/,n.linebreakRegex_=/[\r\n]/,n.blanklineEndRegex_=/\n\r?\n$/,n.blanklineStartRegex_=/^\r?\n\r?\n/,n.prototype.diff_cleanupEfficiency=function(e){for(var t=!1,o=[],s=0,c=null,l=0,u=!1,d=!1,f=!1,p=!1;l<e.length;)e[l][0]==a?(e[l][1].length<this.Diff_EditCost&&(f||p)?(o[s++]=l,u=f,d=p,c=e[l][1]):(s=0,c=null),f=p=!1):(e[l][0]==r?p=!0:f=!0,c&&(u&&d&&f&&p||c.length<this.Diff_EditCost/2&&u+d+f+p==3)&&(e.splice(o[s-1],0,new n.Diff(r,c)),e[o[s-1]+1][0]=i,s--,c=null,u&&d?(f=p=!0,s=0):(s--,l=s>0?o[s-1]:-1,f=p=!1),t=!0)),l++;t&&this.diff_cleanupMerge(e)},n.prototype.diff_cleanupMerge=function(e){e.push(new n.Diff(a,``));for(var t=0,o=0,s=0,c=``,l=``,u;t<e.length;)switch(e[t][0]){case i:s++,l+=e[t][1],t++;break;case r:o++,c+=e[t][1],t++;break;case a:o+s>1?(o!==0&&s!==0&&(u=this.diff_commonPrefix(l,c),u!==0&&(t-o-s>0&&e[t-o-s-1][0]==a?e[t-o-s-1][1]+=l.substring(0,u):(e.splice(0,0,new n.Diff(a,l.substring(0,u))),t++),l=l.substring(u),c=c.substring(u)),u=this.diff_commonSuffix(l,c),u!==0&&(e[t][1]=l.substring(l.length-u)+e[t][1],l=l.substring(0,l.length-u),c=c.substring(0,c.length-u))),t-=o+s,e.splice(t,o+s),c.length&&(e.splice(t,0,new n.Diff(r,c)),t++),l.length&&(e.splice(t,0,new n.Diff(i,l)),t++),t++):t!==0&&e[t-1][0]==a?(e[t-1][1]+=e[t][1],e.splice(t,1)):t++,s=0,o=0,c=``,l=``;break}e[e.length-1][1]===``&&e.pop();var d=!1;for(t=1;t<e.length-1;)e[t-1][0]==a&&e[t+1][0]==a&&(e[t][1].substring(e[t][1].length-e[t-1][1].length)==e[t-1][1]?(e[t][1]=e[t-1][1]+e[t][1].substring(0,e[t][1].length-e[t-1][1].length),e[t+1][1]=e[t-1][1]+e[t+1][1],e.splice(t-1,1),d=!0):e[t][1].substring(0,e[t+1][1].length)==e[t+1][1]&&(e[t-1][1]+=e[t+1][1],e[t][1]=e[t][1].substring(e[t+1][1].length)+e[t+1][1],e.splice(t+1,1),d=!0)),t++;d&&this.diff_cleanupMerge(e)},n.prototype.diff_xIndex=function(e,t){var n=0,a=0,o=0,s=0,c;for(c=0;c<e.length&&(e[c][0]!==i&&(n+=e[c][1].length),e[c][0]!==r&&(a+=e[c][1].length),!(n>t));c++)o=n,s=a;return e.length!=c&&e[c][0]===r?s:s+(t-o)},n.prototype.diff_prettyHtml=function(e){for(var t=[],n=/&/g,o=/</g,s=/>/g,c=/\n/g,l=0;l<e.length;l++){var u=e[l][0],d=e[l][1].replace(n,`&amp;`).replace(o,`&lt;`).replace(s,`&gt;`).replace(c,`&para;<br>`);switch(u){case i:t[l]=`<ins style="background:#e6ffe6;">`+d+`</ins>`;break;case r:t[l]=`<del style="background:#ffe6e6;">`+d+`</del>`;break;case a:t[l]=`<span>`+d+`</span>`;break}}return t.join(``)},n.prototype.diff_text1=function(e){for(var t=[],n=0;n<e.length;n++)e[n][0]!==i&&(t[n]=e[n][1]);return t.join(``)},n.prototype.diff_text2=function(e){for(var t=[],n=0;n<e.length;n++)e[n][0]!==r&&(t[n]=e[n][1]);return t.join(``)},n.prototype.diff_levenshtein=function(e){for(var t=0,n=0,o=0,s=0;s<e.length;s++){var c=e[s][0],l=e[s][1];switch(c){case i:n+=l.length;break;case r:o+=l.length;break;case a:t+=Math.max(n,o),n=0,o=0;break}}return t+=Math.max(n,o),t},n.prototype.diff_toDelta=function(e){for(var t=[],n=0;n<e.length;n++)switch(e[n][0]){case i:t[n]=`+`+encodeURI(e[n][1]);break;case r:t[n]=`-`+e[n][1].length;break;case a:t[n]=`=`+e[n][1].length;break}return t.join(` `).replace(/%20/g,` `)},n.prototype.diff_fromDelta=function(e,t){for(var o=[],s=0,c=0,l=t.split(/\t/g),u=0;u<l.length;u++){var d=l[u].substring(1);switch(l[u].charAt(0)){case`+`:try{o[s++]=new n.Diff(i,decodeURI(d))}catch{throw Error(`Illegal escape in diff_fromDelta: `+d)}break;case`-`:case`=`:var f=parseInt(d,10);if(isNaN(f)||f<0)throw Error(`Invalid number in diff_fromDelta: `+d);var p=e.substring(c,c+=f);l[u].charAt(0)==`=`?o[s++]=new n.Diff(a,p):o[s++]=new n.Diff(r,p);break;default:if(l[u])throw Error(`Invalid diff operation in diff_fromDelta: `+l[u])}}if(c!=e.length)throw Error(`Delta length (`+c+`) does not equal source text length (`+e.length+`).`);return o},n.prototype.match_main=function(e,t,n){if(e==null||t==null||n==null)throw Error(`Null input. (match_main)`);return n=Math.max(0,Math.min(n,e.length)),e==t?0:e.length?e.substring(n,n+t.length)==t?n:this.match_bitap_(e,t,n):-1},n.prototype.match_bitap_=function(e,t,n){if(t.length>this.Match_MaxBits)throw Error(`Pattern too long for this browser.`);var r=this.match_alphabet_(t),i=this;function a(e,r){var a=e/t.length,o=Math.abs(n-r);return i.Match_Distance?a+o/i.Match_Distance:o?1:a}var o=this.Match_Threshold,s=e.indexOf(t,n);s!=-1&&(o=Math.min(a(0,s),o),s=e.lastIndexOf(t,n+t.length),s!=-1&&(o=Math.min(a(0,s),o)));var c=1<<t.length-1;s=-1;for(var l,u,d=t.length+e.length,f,p=0;p<t.length;p++){for(l=0,u=d;l<u;)a(p,n+u)<=o?l=u:d=u,u=Math.floor((d-l)/2+l);d=u;var m=Math.max(1,n-u+1),h=Math.min(n+u,e.length)+t.length,g=Array(h+2);g[h+1]=(1<<p)-1;for(var _=h;_>=m;_--){var v=r[e.charAt(_-1)];if(p===0?g[_]=(g[_+1]<<1|1)&v:g[_]=(g[_+1]<<1|1)&v|(f[_+1]|f[_])<<1|1|f[_+1],g[_]&c){var y=a(p,_-1);if(y<=o)if(o=y,s=_-1,s>n)m=Math.max(1,2*n-s);else break}}if(a(p+1,n)>o)break;f=g}return s},n.prototype.match_alphabet_=function(e){for(var t={},n=0;n<e.length;n++)t[e.charAt(n)]=0;for(var n=0;n<e.length;n++)t[e.charAt(n)]|=1<<e.length-n-1;return t},n.prototype.patch_addContext_=function(e,t){if(t.length!=0){if(e.start2===null)throw Error(`patch not initialized`);for(var r=t.substring(e.start2,e.start2+e.length1),i=0;t.indexOf(r)!=t.lastIndexOf(r)&&r.length<this.Match_MaxBits-this.Patch_Margin-this.Patch_Margin;)i+=this.Patch_Margin,r=t.substring(e.start2-i,e.start2+e.length1+i);i+=this.Patch_Margin;var o=t.substring(e.start2-i,e.start2);o&&e.diffs.unshift(new n.Diff(a,o));var s=t.substring(e.start2+e.length1,e.start2+e.length1+i);s&&e.diffs.push(new n.Diff(a,s)),e.start1-=o.length,e.start2-=o.length,e.length1+=o.length+s.length,e.length2+=o.length+s.length}},n.prototype.patch_make=function(e,t,o){var s,c;if(typeof e==`string`&&typeof t==`string`&&o===void 0)s=e,c=this.diff_main(s,t,!0),c.length>2&&(this.diff_cleanupSemantic(c),this.diff_cleanupEfficiency(c));else if(e&&typeof e==`object`&&t===void 0&&o===void 0)c=e,s=this.diff_text1(c);else if(typeof e==`string`&&t&&typeof t==`object`&&o===void 0)s=e,c=t;else if(typeof e==`string`&&typeof t==`string`&&o&&typeof o==`object`)s=e,c=o;else throw Error(`Unknown call format to patch_make.`);if(c.length===0)return[];for(var l=[],u=new n.patch_obj,d=0,f=0,p=0,m=s,h=s,g=0;g<c.length;g++){var _=c[g][0],v=c[g][1];switch(!d&&_!==a&&(u.start1=f,u.start2=p),_){case i:u.diffs[d++]=c[g],u.length2+=v.length,h=h.substring(0,p)+v+h.substring(p);break;case r:u.length1+=v.length,u.diffs[d++]=c[g],h=h.substring(0,p)+h.substring(p+v.length);break;case a:v.length<=2*this.Patch_Margin&&d&&c.length!=g+1?(u.diffs[d++]=c[g],u.length1+=v.length,u.length2+=v.length):v.length>=2*this.Patch_Margin&&d&&(this.patch_addContext_(u,m),l.push(u),u=new n.patch_obj,d=0,m=h,f=p);break}_!==i&&(f+=v.length),_!==r&&(p+=v.length)}return d&&(this.patch_addContext_(u,m),l.push(u)),l},n.prototype.patch_deepCopy=function(e){for(var t=[],r=0;r<e.length;r++){var i=e[r],a=new n.patch_obj;a.diffs=[];for(var o=0;o<i.diffs.length;o++)a.diffs[o]=new n.Diff(i.diffs[o][0],i.diffs[o][1]);a.start1=i.start1,a.start2=i.start2,a.length1=i.length1,a.length2=i.length2,t[r]=a}return t},n.prototype.patch_apply=function(e,t){if(e.length==0)return[t,[]];e=this.patch_deepCopy(e);var n=this.patch_addPadding(e);t=n+t+n,this.patch_splitMax(e);for(var o=0,s=[],c=0;c<e.length;c++){var l=e[c].start2+o,u=this.diff_text1(e[c].diffs),d,f=-1;if(u.length>this.Match_MaxBits?(d=this.match_main(t,u.substring(0,this.Match_MaxBits),l),d!=-1&&(f=this.match_main(t,u.substring(u.length-this.Match_MaxBits),l+u.length-this.Match_MaxBits),(f==-1||d>=f)&&(d=-1))):d=this.match_main(t,u,l),d==-1)s[c]=!1,o-=e[c].length2-e[c].length1;else{s[c]=!0,o=d-l;var p=f==-1?t.substring(d,d+u.length):t.substring(d,f+this.Match_MaxBits);if(u==p)t=t.substring(0,d)+this.diff_text2(e[c].diffs)+t.substring(d+u.length);else{var m=this.diff_main(u,p,!1);if(u.length>this.Match_MaxBits&&this.diff_levenshtein(m)/u.length>this.Patch_DeleteThreshold)s[c]=!1;else{this.diff_cleanupSemanticLossless(m);for(var h=0,g,_=0;_<e[c].diffs.length;_++){var v=e[c].diffs[_];v[0]!==a&&(g=this.diff_xIndex(m,h)),v[0]===i?t=t.substring(0,d+g)+v[1]+t.substring(d+g):v[0]===r&&(t=t.substring(0,d+g)+t.substring(d+this.diff_xIndex(m,h+v[1].length))),v[0]!==r&&(h+=v[1].length)}}}}}return t=t.substring(n.length,t.length-n.length),[t,s]},n.prototype.patch_addPadding=function(e){for(var t=this.Patch_Margin,r=``,i=1;i<=t;i++)r+=String.fromCharCode(i);for(var i=0;i<e.length;i++)e[i].start1+=t,e[i].start2+=t;var o=e[0],s=o.diffs;if(s.length==0||s[0][0]!=a)s.unshift(new n.Diff(a,r)),o.start1-=t,o.start2-=t,o.length1+=t,o.length2+=t;else if(t>s[0][1].length){var c=t-s[0][1].length;s[0][1]=r.substring(s[0][1].length)+s[0][1],o.start1-=c,o.start2-=c,o.length1+=c,o.length2+=c}if(o=e[e.length-1],s=o.diffs,s.length==0||s[s.length-1][0]!=a)s.push(new n.Diff(a,r)),o.length1+=t,o.length2+=t;else if(t>s[s.length-1][1].length){var c=t-s[s.length-1][1].length;s[s.length-1][1]+=r.substring(0,c),o.length1+=c,o.length2+=c}return r},n.prototype.patch_splitMax=function(e){for(var t=this.Match_MaxBits,o=0;o<e.length;o++)if(!(e[o].length1<=t)){var s=e[o];e.splice(o--,1);for(var c=s.start1,l=s.start2,u=``;s.diffs.length!==0;){var d=new n.patch_obj,f=!0;for(d.start1=c-u.length,d.start2=l-u.length,u!==``&&(d.length1=d.length2=u.length,d.diffs.push(new n.Diff(a,u)));s.diffs.length!==0&&d.length1<t-this.Patch_Margin;){var p=s.diffs[0][0],m=s.diffs[0][1];p===i?(d.length2+=m.length,l+=m.length,d.diffs.push(s.diffs.shift()),f=!1):p===r&&d.diffs.length==1&&d.diffs[0][0]==a&&m.length>2*t?(d.length1+=m.length,c+=m.length,f=!1,d.diffs.push(new n.Diff(p,m)),s.diffs.shift()):(m=m.substring(0,t-d.length1-this.Patch_Margin),d.length1+=m.length,c+=m.length,p===a?(d.length2+=m.length,l+=m.length):f=!1,d.diffs.push(new n.Diff(p,m)),m==s.diffs[0][1]?s.diffs.shift():s.diffs[0][1]=s.diffs[0][1].substring(m.length))}u=this.diff_text2(d.diffs),u=u.substring(u.length-this.Patch_Margin);var h=this.diff_text1(s.diffs).substring(0,this.Patch_Margin);h!==``&&(d.length1+=h.length,d.length2+=h.length,d.diffs.length!==0&&d.diffs[d.diffs.length-1][0]===a?d.diffs[d.diffs.length-1][1]+=h:d.diffs.push(new n.Diff(a,h))),f||e.splice(++o,0,d)}}},n.prototype.patch_toText=function(e){for(var t=[],n=0;n<e.length;n++)t[n]=e[n];return t.join(``)},n.prototype.patch_fromText=function(e){var t=[];if(!e)return t;for(var o=e.split(`
411
411
  `),s=0,c=/^@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@$/;s<o.length;){var l=o[s].match(c);if(!l)throw Error(`Invalid patch string: `+o[s]);var u=new n.patch_obj;for(t.push(u),u.start1=parseInt(l[1],10),l[2]===``?(u.start1--,u.length1=1):l[2]==`0`?u.length1=0:(u.start1--,u.length1=parseInt(l[2],10)),u.start2=parseInt(l[3],10),l[4]===``?(u.start2--,u.length2=1):l[4]==`0`?u.length2=0:(u.start2--,u.length2=parseInt(l[4],10)),s++;s<o.length;){var d=o[s].charAt(0);try{var f=decodeURI(o[s].substring(1))}catch{throw Error(`Illegal escape in patch_fromText: `+f)}if(d==`-`)u.diffs.push(new n.Diff(r,f));else if(d==`+`)u.diffs.push(new n.Diff(i,f));else if(d==` `)u.diffs.push(new n.Diff(a,f));else if(d==`@`)break;else if(d!==``)throw Error(`Invalid patch mode "`+d+`" in: `+f);s++}}return t},n.patch_obj=function(){this.diffs=[],this.start1=null,this.start2=null,this.length1=0,this.length2=0},n.patch_obj.prototype.toString=function(){for(var e=this.length1===0?this.start1+`,0`:this.length1==1?this.start1+1:this.start1+1+`,`+this.length1,t=this.length2===0?this.start2+`,0`:this.length2==1?this.start2+1:this.start2+1+`,`+this.length2,n=[`@@ -`+e+` +`+t+` @@
412
412
  `],o,s=0;s<this.diffs.length;s++){switch(this.diffs[s][0]){case i:o=`+`;break;case r:o=`-`;break;case a:o=` `;break}n[s+1]=o+encodeURI(this.diffs[s][1])+`
413
- `}return n.join(``).replace(/%20/g,` `)},t.exports=n,t.exports.diff_match_patch=n,t.exports.DIFF_DELETE=r,t.exports.DIFF_INSERT=i,t.exports.DIFF_EQUAL=a}))(),1);new rY.default;const iY=z({path:R(So([P(),F()])),message:P(),issueCode:P()});Co(`code`,[z({code:H(`SCHEMA_INVALID`),issues:R(iY)}),z({code:H(`WRITE_ERROR`),detail:P()})]),Object.freeze({source:`local`,skipStoreHooks:!1,context:Object.freeze({origin:`form-write`})});const aY=new rY.default;aY.Match_Threshold=.5;const oY=`last-server-exit.json`,sY=`last-server-crash.json`,cY=[`.ok`,`local`,`installed-skills.json`],lY=V(gl),uY=bo({hosts:R(P()),scope:lY,scripts:I(),installedAt:Fa(),projection:V([`symlink`,`copy`]).optional(),contentHash:P().optional()}),dY=bo({schema:H(1),skills:B(P(),uY).default({})});function fY(e){let t;try{t=JSON.parse(e)}catch{return null}let n=dY.safeParse(t);return n.success?n.data:null}(()=>{let e=globalThis.Intl.Segmenter;return e?new e(`en`,{granularity:`word`}):null})();const pY=Symbol.for(`@inkeep/open-knowledge/skill-state-field-registry`),mY=globalThis;mY[pY]===void 0&&(mY[pY]=Zr());const hY=mY[pY],gY=bo({version:P().regex(/^\d+\.\d+\.\d+(?:[-+][\w.-]+)?$/,`version must match /^\\d+\\.\\d+\\.\\d+(?:[-+][\\w.-]+)?$/`).register(hY,{description:`Recorded skill version for this target.`}),recordedAt:Fa().register(hY,{description:`ISO 8601 timestamp of the most recent successful write. Updated on every write, including reinstalls of the same version.`}),surface:V([`server-build-and-open`,`electron-build-and-open`,`cli-npx-skills-add`,`desktop-direct`,`cli-start`]).register(hY,{description:`Install-source surface that recorded this entry.`}).optional()}),_Y=bo({enabled:I().register(hY,{description:`Whether this user-global skill bundle is opted in.`}),decidedAt:Fa().register(hY,{description:`ISO 8601 timestamp of the opt-in / opt-out decision.`})});bo({schema:H(1).register(hY,{description:`Schema major version. Bumped only on breaking shape changes.`}),targets:bo({"claude-cowork":gY.optional(),"cli-hosts":gY.optional()}).register(hY,{description:`Per-target install-state entries. Absent target = no recorded install.`}).default({}),bundles:B(P(),_Y).register(hY,{description:`Per-bundle opt-in decisions keyed by install name. Absent key = no recorded decision.`}).optional(),installsReported:R(P()).register(hY,{description:"Skill installs already reported to skills.sh from this machine, as `<owner/repo>#<skill>`. Append-only; presence suppresses a re-report."}).optional()});const vY=bo({name:P(),description:P(),files:bo({skillMd:P(),scripts:R(P()),references:R(P())})}),yY=bo({pluginProvider:P().optional(),plugin:P().optional(),marketplace:P().optional(),version:P().optional(),gitCommitSha:P().optional(),scope:P().optional(),projectPath:P().optional()}),bY=bo({commands:I(),hooks:I(),mcp:I()}),xY=bo({...vY.shape,sourceHarness:P(),sourceHarnesses:R(P()),home:P(),provenance:yY,inert:bY,outsideProject:I().optional()}),SY=bo({schema:H(1),name:P(),version:P(),description:P().optional(),author:bo({name:P()}).optional(),skills:R(P()),hostCompatibility:R(P()).optional(),capabilities:bo({scripts:P(),network:P(),inert:R(P())}).optional(),provenance:bo({source:P(),ref:P(),contentHash:P()}).optional()});z({skills:R(xY),packs:R(SY)}).loose(),z({results:R(z({id:P().min(1),name:P().min(1),source:P().min(1),description:P(),installs:F().int().nonnegative().nullable(),publisher:P().nullable()}).loose()),backend:V([`skills.sh`,`github-fallback`]),degraded:I()}).loose(),z({title:P(),description:P(),image:P().nullable(),skillsUrl:P().nullable(),sourceKind:V([`github`,`site`]),sourceUrl:P()}).loose(),z({skills:R(z({name:P(),description:P().nullable()}).loose())}).loose(),z({kind:V([`local`,`import`,`none`]),scope:V(gl).optional(),name:P().optional(),dir:P().optional(),source:P().optional(),ref:P().optional(),via:V([`source`,`publisher`]).optional()}).loose();const CY=z({relPath:P(),content:P().nullable()}).loose(),wY=z({provider:P(),plugin:P(),version:P().optional(),marketplace:P().optional(),repositoryUrl:P().optional()}).loose(),TY=z({provider:P(),plugin:P(),version:P().optional(),description:P().optional(),repositoryUrl:P().optional(),bundledSkills:R(P()),capabilities:z({commands:I(),hooks:I(),mcp:I(),agents:I()}),setupSupported:I()}).loose();z({name:P(),description:P().nullable(),skillMd:P(),files:R(CY),plugin:wY.optional(),pluginBundle:TY.optional()}).loose(),Hc();var EY=class{kind;projectRoot;projectSubPath;gitPath;gitDir;cachedCommonDir;constructor(e,t,n,r,i){this.kind=e,this.projectRoot=t,this.projectSubPath=n,this.gitPath=r,this.gitDir=i}readCommonDir(){if(this.cachedCommonDir!==void 0)return{kind:`resolved`,path:this.cachedCommonDir};let e=this.gitDir;try{let t=S(M(this.gitDir,`commondir`),`utf-8`).trim();t.length>0&&(e=j(t)?t:ye(this.gitDir,t))}catch(e){if(!NY(e))return{kind:`unreadable`,cause:e}}return this.cachedCommonDir=e,{kind:`resolved`,path:e}}readHead(){let e;try{e=S(M(this.gitDir,`HEAD`),`utf-8`).trim()}catch(e){return NY(e)?{kind:`absent`}:{kind:`unreadable`,cause:e}}let t=/^ref:[ \t]*(refs\/heads\/(.+))$/.exec(e);return t?.[2]?{kind:`branch`,branch:t[2],ref:t[1]}:IY(e)?{kind:`detached`,oid:e}:{kind:`malformed`,raw:e}}readRemoteUrl(e){let t=this.readCommonDir();if(t.kind===`unreadable`)return t;let n;try{n=S(M(t.path,`config`),`utf-8`)}catch(e){return NY(e)?{kind:`absent`,reason:`config-missing`}:{kind:`unreadable`,cause:e}}let r=AY(n,e);return r===null?{kind:`absent`,reason:`remote-missing`}:{kind:`configured`,url:r}}readRef(e){if(!PY(e))return{kind:`invalid`};let t=this.readCommonDir();if(t.kind===`unreadable`)return t;let n=ye(t.path,e),r=ve(t.path,n);if(r.startsWith(`..`)||j(r))return{kind:`invalid`};try{let e=S(n,`utf-8`).trim(),t=FY(e);return t===null?{kind:`malformed`,raw:e}:{kind:`present`,storage:`loose`,value:t}}catch(e){if(!NY(e))return{kind:`unreadable`,cause:e}}let i;try{i=S(M(t.path,`packed-refs`),`utf-8`)}catch(e){return NY(e)?{kind:`absent`}:{kind:`unreadable`,cause:e}}for(let t of i.split(/\r?\n/)){let n=t.trim();if(n.length===0||n.startsWith(`#`)||n.startsWith(`^`))continue;let r=n.split(/\s+/);if(r.length===2&&r[1]===e)return IY(r[0])?{kind:`present`,storage:`packed`,value:{kind:`oid`,oid:r[0]}}:{kind:`malformed`,raw:n}}return{kind:`absent`}}};function DY(e){return kY(ye(e),``)}function OY(e){let t=ye(e),n=ye(se());if(t===n)return{kind:`absent`};let r=kY(t,``);if(r.kind!==`absent`)return r;let i=t;for(let e=0;e<64;e++){if(i===n)return{kind:`absent`};let e=me(i);if(e===i||e===n)return{kind:`absent`};let r=kY(e,ve(e,t));if(r.kind!==`absent`)return r;i=e}return{kind:`absent`}}function kY(e,t){let n=M(e,`.git`),r;try{r=ee(n)}catch(e){return NY(e)?{kind:`absent`}:{kind:`inaccessible`,gitPath:n,cause:e}}if(r.isDirectory())return{kind:`repository`,repository:new EY(`directory`,e,t,n,n)};if(!r.isFile())return{kind:`absent`};let i;try{i=S(n,`utf-8`).trim()}catch(e){return{kind:`malformed-pointer`,gitPath:n,target:``,cause:e}}let a=/^gitdir:[ \t]*(.+)$/.exec(i);if(!a)return{kind:`malformed-pointer`,gitPath:n,target:``};let o=a[1].trim(),s=j(o)?o:ye(e,o);try{if(!ee(s).isDirectory())return{kind:`malformed-pointer`,gitPath:n,target:s}}catch(e){return{kind:`malformed-pointer`,gitPath:n,target:s,cause:e}}return{kind:`repository`,repository:new EY(`linked`,e,t,n,s)}}function AY(e,t){let n=!1;for(let r of e.split(/\r?\n/)){let e=jY(r);if(e.length===0)continue;if(e.startsWith(`[`)){n=/^\[\s*remote\s+["'](.+)["']\s*\]$/.exec(e)?.[1]===t;continue}if(!n)continue;let i=/^url\s*=\s*(.*)$/.exec(e);if(!i)continue;let a=MY(i[1]);if(a.length>0)return a}return null}function jY(e){let t=e.search(/[;#]/);return(t===-1?e:e.slice(0,t)).trim()}function MY(e){let t=e.trim();return t.startsWith(`"`)&&t.endsWith(`"`)||t.startsWith(`'`)&&t.endsWith(`'`)?t.slice(1,-1):t}function NY(e){let t=e?.code;return t===`ENOENT`||t===`ENOTDIR`}function PY(e){return e.startsWith(`refs/`)&&!e.includes(`\0`)&&!e.includes(`\\`)&&!e.includes(`..`)&&!e.includes(`//`)&&!e.endsWith(`/`)}function FY(e){if(e.length===0)return null;let t=/^ref:[ \t]*(refs\/.+)$/.exec(e);return t?PY(t[1])?{kind:`symbolic`,target:t[1]}:null:IY(e)?{kind:`oid`,oid:e}:null}function IY(e){return/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/.test(e)}const LY={initialize:`initialize`,authenticate:`authenticate`,providers_list:`providers/list`,providers_set:`providers/set`,providers_disable:`providers/disable`,session_new:`session/new`,session_load:`session/load`,session_set_mode:`session/set_mode`,session_set_config_option:`session/set_config_option`,session_prompt:`session/prompt`,session_cancel:`session/cancel`,mcp_message:`mcp/message`,session_list:`session/list`,session_delete:`session/delete`,session_fork:`session/fork`,session_resume:`session/resume`,session_close:`session/close`,logout:`logout`,nes_start:`nes/start`,nes_suggest:`nes/suggest`,nes_accept:`nes/accept`,nes_reject:`nes/reject`,nes_close:`nes/close`,document_did_open:`document/didOpen`,document_did_change:`document/didChange`,document_did_close:`document/didClose`,document_did_save:`document/didSave`,document_did_focus:`document/didFocus`},RY={session_request_permission:`session/request_permission`,session_update:`session/update`,fs_write_text_file:`fs/write_text_file`,fs_read_text_file:`fs/read_text_file`,terminal_create:`terminal/create`,terminal_output:`terminal/output`,terminal_release:`terminal/release`,terminal_wait_for_exit:`terminal/wait_for_exit`,terminal_kill:`terminal/kill`,mcp_connect:`mcp/connect`,mcp_message:`mcp/message`,mcp_disconnect:`mcp/disconnect`,elicitation_create:`elicitation/create`,elicitation_complete:`elicitation/complete`},zY={cancel_request:`$/cancel_request`},BY=Symbol(`skippedItem`);function $(e,t){return e.catch(t)}function VY(e,t){let n=e.catch(t);return L().transform((e,t)=>e===void 0?(t.addIssue({code:`custom`,message:`Required value is missing`}),rn):n.parse(e))}function HY(e,t){if(typeof e!=`object`||!e||Array.isArray(e))return;let n=e[t];return typeof n==`string`?n:void 0}function UY(e,t,n){return e.superRefine((e,r)=>{let i=HY(e,t);i!==void 0&&n.includes(i)&&r.addIssue({code:`custom`,path:[t],message:`${t} ${JSON.stringify(i)} is reserved by a known variant, but the value does not match that variant's schema`})})}function WY(e,t,n){return L().transform((r,i)=>{let a=e.safeParse(r);if(!a.success){for(let e of a.error.issues)i.addIssue({...e,input:r});return rn}let o=a.data,s=HY(r,t);if(s!==void 0&&!n.includes(s)){let e=r;for(let[t,n]of Object.entries(e))t!==`__proto__`&&(Object.hasOwn(o,t)||(o[t]=n))}return o})}function GY(e){return R(e.catch(BY)).transform(e=>e.filter(e=>e!==BY))}const KY=So([F(),P()]).nullable(),qY=P(),JY=z({sessionId:qY,path:P(),content:P(),_meta:$(B(P(),L()).nullish(),()=>void 0)}),YY=z({sessionId:qY,path:P(),line:$(_o().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),()=>void 0),limit:$(_o().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),XY=P(),ZY=So([H(`read`),H(`edit`),H(`delete`),H(`move`),H(`search`),H(`execute`),H(`think`),H(`fetch`),H(`switch_mode`),H(`other`)]),QY=So([H(`pending`),H(`in_progress`),H(`completed`),H(`failed`)]),$Y=z({audience:$(GY(So([H(`assistant`),H(`user`)])).nullish(),()=>void 0),lastModified:$(P().nullish(),()=>void 0),priority:$(F().nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),eX=z({annotations:$($Y.nullish(),()=>void 0),text:P(),_meta:$(B(P(),L()).nullish(),()=>void 0)}),tX=z({annotations:$($Y.nullish(),()=>void 0),data:P(),mimeType:P(),uri:$(P().nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),nX=z({annotations:$($Y.nullish(),()=>void 0),data:P(),mimeType:P(),_meta:$(B(P(),L()).nullish(),()=>void 0)}),rX=z({annotations:$($Y.nullish(),()=>void 0),description:$(P().nullish(),()=>void 0),mimeType:$(P().nullish(),()=>void 0),name:P(),size:$(F().nullish(),()=>void 0),title:$(P().nullish(),()=>void 0),uri:P(),_meta:$(B(P(),L()).nullish(),()=>void 0)}),iX=So([z({mimeType:$(P().nullish(),()=>void 0),text:P(),uri:P(),_meta:$(B(P(),L()).nullish(),()=>void 0)}),z({blob:P(),mimeType:$(P().nullish(),()=>void 0),uri:P(),_meta:$(B(P(),L()).nullish(),()=>void 0)})]),aX=z({annotations:$($Y.nullish(),()=>void 0),resource:iX,_meta:$(B(P(),L()).nullish(),()=>void 0)}),oX=So([eX.and(z({type:H(`text`)})),tX.and(z({type:H(`image`)})),nX.and(z({type:H(`audio`)})),rX.and(z({type:H(`resource_link`)})),aX.and(z({type:H(`resource`)}))]),sX=z({content:oX,_meta:$(B(P(),L()).nullish(),()=>void 0)}),cX=z({path:P(),oldText:$(P().nullish(),()=>void 0),newText:P(),_meta:$(B(P(),L()).nullish(),()=>void 0)}),lX=P(),uX=z({terminalId:lX,_meta:$(B(P(),L()).nullish(),()=>void 0)}),dX=So([sX.and(z({type:H(`content`)})),cX.and(z({type:H(`diff`)})),uX.and(z({type:H(`terminal`)}))]),fX=z({path:P(),line:$(_o().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),pX=z({toolCallId:XY,kind:$(ZY.nullish(),()=>void 0),status:$(QY.nullish(),()=>void 0),title:$(P().nullish(),()=>void 0),content:$(GY(dX).nullish(),()=>void 0),locations:$(GY(fX).nullish(),()=>void 0),rawInput:$(L().optional(),()=>void 0),rawOutput:$(L().optional(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),mX=P(),hX=So([H(`allow_once`),H(`allow_always`),H(`reject_once`),H(`reject_always`)]),gX=z({sessionId:qY,toolCall:pX,options:R(z({optionId:mX,name:P(),kind:hX,_meta:$(B(P(),L()).nullish(),()=>void 0)})),_meta:$(B(P(),L()).nullish(),()=>void 0)}),_X=z({name:P(),value:P(),_meta:$(B(P(),L()).nullish(),()=>void 0)}),vX=z({sessionId:qY,command:P(),args:$(GY(P()).optional(),()=>[]),env:$(GY(_X).optional(),()=>[]),cwd:$(P().nullish(),()=>void 0),outputByteLimit:$(F().nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),yX=z({sessionId:qY,terminalId:lX,_meta:$(B(P(),L()).nullish(),()=>void 0)}),bX=z({sessionId:qY,terminalId:lX,_meta:$(B(P(),L()).nullish(),()=>void 0)}),xX=z({sessionId:qY,terminalId:lX,_meta:$(B(P(),L()).nullish(),()=>void 0)}),SX=z({sessionId:qY,terminalId:lX,_meta:$(B(P(),L()).nullish(),()=>void 0)}),CX=z({sessionId:qY,toolCallId:$(XY.nullish(),()=>void 0)}),wX=z({requestId:KY}),TX=H(`object`),EX=So([H(`email`),H(`uri`),H(`date`),H(`date-time`)]),DX=z({const:P(),title:P(),description:$(P().nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),OX=z({title:$(P().nullish(),()=>void 0),description:$(P().nullish(),()=>void 0),minLength:_o().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),maxLength:_o().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),pattern:P().nullish(),format:EX.nullish(),default:$(P().nullish(),()=>void 0),enum:R(P()).nullish(),oneOf:R(DX).nullish(),_meta:$(B(P(),L()).nullish(),()=>void 0)}),kX=z({title:$(P().nullish(),()=>void 0),description:$(P().nullish(),()=>void 0),minimum:F().nullish(),maximum:F().nullish(),default:$(F().nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),AX=z({title:$(P().nullish(),()=>void 0),description:$(P().nullish(),()=>void 0),minimum:F().nullish(),maximum:F().nullish(),default:$(F().nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),jX=z({title:$(P().nullish(),()=>void 0),description:$(P().nullish(),()=>void 0),default:$(I().nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),MX=z({enum:R(P()),_meta:$(B(P(),L()).nullish(),()=>void 0)}),NX=z({anyOf:R(DX),_meta:$(B(P(),L()).nullish(),()=>void 0)}),PX=WY(So([MX.and(z({type:H(`string`)})),UY(z({type:P()}),`type`,[`string`]),NX]),`type`,[`string`]),FX=z({title:$(P().nullish(),()=>void 0),description:$(P().nullish(),()=>void 0),minItems:F().nullish(),maxItems:F().nullish(),items:PX,default:$(GY(P()).nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),IX=WY(So([OX.and(z({type:H(`string`)})),kX.and(z({type:H(`number`)})),AX.and(z({type:H(`integer`)})),jX.and(z({type:H(`boolean`)})),FX.and(z({type:H(`array`)})),UY(z({type:P()}),`type`,[`array`,`boolean`,`integer`,`number`,`string`])]),`type`,[`array`,`boolean`,`integer`,`number`,`string`]),LX=z({type:$(TX.optional().default(`object`),()=>`object`),title:$(P().nullish(),()=>void 0),properties:B(P(),IX).optional().default({}),required:R(P()).nullish(),description:$(P().nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),RX=wo(So([CX,wX]),z({requestedSchema:LX})),zX=P(),BX=wo(So([CX,wX]),z({elicitationId:zX,url:po()})),VX=WY(wo(So([RX.and(z({mode:H(`form`)})),BX.and(z({mode:H(`url`)})),UY(wo(So([CX,wX]),z({mode:P()})),`mode`,[`form`,`url`])]),z({message:P(),_meta:$(B(P(),L()).nullish(),()=>void 0)})),`mode`,[`form`,`url`]),HX=P(),UX=z({serverId:HX,_meta:$(B(P(),L()).nullish(),()=>void 0)}),WX=P(),GX=z({connectionId:WX,method:P(),params:B(P(),L()).nullish(),_meta:$(B(P(),L()).nullish(),()=>void 0)}),KX=z({connectionId:WX,_meta:$(B(P(),L()).nullish(),()=>void 0)}),qX=L();z({id:KY,method:P(),params:So([JY,YY,gX,vX,yX,bX,xX,SX,VX,UX,GX,KX,qX]).nullish()});const JX=_o().gte(0).lte(65535),YX=z({image:$(I().optional().default(!1),()=>!1),audio:$(I().optional().default(!1),()=>!1),embeddedContext:$(I().optional().default(!1),()=>!1),_meta:$(B(P(),L()).nullish(),()=>void 0)}),XX=z({http:$(I().optional().default(!1),()=>!1),sse:$(I().optional().default(!1),()=>!1),acp:$(I().optional().default(!1),()=>!1),_meta:$(B(P(),L()).nullish(),()=>void 0)}),ZX=z({_meta:$(B(P(),L()).nullish(),()=>void 0)}),QX=z({_meta:$(B(P(),L()).nullish(),()=>void 0)}),$X=z({_meta:$(B(P(),L()).nullish(),()=>void 0)}),eZ=z({_meta:$(B(P(),L()).nullish(),()=>void 0)}),tZ=z({_meta:$(B(P(),L()).nullish(),()=>void 0)}),nZ=z({_meta:$(B(P(),L()).nullish(),()=>void 0)}),rZ=z({list:$(ZX.nullish(),()=>void 0),delete:$(QX.nullish(),()=>void 0),additionalDirectories:$($X.nullish(),()=>void 0),fork:$(eZ.nullish(),()=>void 0),resume:$(tZ.nullish(),()=>void 0),close:$(nZ.nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),iZ=z({logout:$(z({_meta:$(B(P(),L()).nullish(),()=>void 0)}).nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),aZ=z({_meta:$(B(P(),L()).nullish(),()=>void 0)}),oZ=z({_meta:$(B(P(),L()).nullish(),()=>void 0)}),sZ=z({syncKind:So([H(`full`),H(`incremental`)]),_meta:$(B(P(),L()).nullish(),()=>void 0)}),cZ=z({_meta:$(B(P(),L()).nullish(),()=>void 0)}),lZ=z({_meta:$(B(P(),L()).nullish(),()=>void 0)}),uZ=z({_meta:$(B(P(),L()).nullish(),()=>void 0)}),dZ=z({document:$(z({didOpen:$(oZ.nullish(),()=>void 0),didChange:$(sZ.nullish(),()=>void 0),didClose:$(cZ.nullish(),()=>void 0),didSave:$(lZ.nullish(),()=>void 0),didFocus:$(uZ.nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}).nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),fZ=z({maxCount:$(_o().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),pZ=z({_meta:$(B(P(),L()).nullish(),()=>void 0)}),mZ=z({maxCount:$(_o().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),hZ=z({maxCount:$(_o().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),gZ=z({_meta:$(B(P(),L()).nullish(),()=>void 0)}),_Z=z({_meta:$(B(P(),L()).nullish(),()=>void 0)}),vZ=z({recentFiles:$(fZ.nullish(),()=>void 0),relatedSnippets:$(pZ.nullish(),()=>void 0),editHistory:$(mZ.nullish(),()=>void 0),userActions:$(hZ.nullish(),()=>void 0),openFiles:$(gZ.nullish(),()=>void 0),diagnostics:$(_Z.nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),yZ=z({events:$(dZ.nullish(),()=>void 0),context:$(vZ.nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),bZ=So([H(`utf-16`),H(`utf-32`),H(`utf-8`)]),xZ=z({loadSession:$(I().optional().default(!1),()=>!1),promptCapabilities:$(YX.optional().default({image:!1,audio:!1,embeddedContext:!1}),()=>({image:!1,audio:!1,embeddedContext:!1})),mcpCapabilities:$(XX.optional().default({http:!1,sse:!1,acp:!1}),()=>({http:!1,sse:!1,acp:!1})),sessionCapabilities:$(rZ.optional().default({}),()=>({})),auth:$(iZ.optional().default({}),()=>({})),providers:$(aZ.nullish(),()=>void 0),nes:$(yZ.nullish(),()=>void 0),positionEncoding:$(bZ.nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),SZ=P(),CZ=z({name:P(),label:$(P().nullish(),()=>void 0),secret:$(I().optional().default(!0),()=>!0),optional:$(I().optional().default(!1),()=>!1),_meta:$(B(P(),L()).nullish(),()=>void 0)}),wZ=z({id:SZ,name:P(),description:$(P().nullish(),()=>void 0),vars:VY(GY(CZ),()=>[]),link:$(P().nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),TZ=z({id:SZ,name:P(),description:$(P().nullish(),()=>void 0),args:$(GY(P()).optional(),()=>[]),env:$(B(P(),P()).optional(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),EZ=z({id:SZ,name:P(),description:$(P().nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),DZ=So([wZ.and(z({type:H(`env_var`)})),TZ.and(z({type:H(`terminal`)})),EZ]),OZ=z({name:P(),title:$(P().nullish(),()=>void 0),version:P(),_meta:$(B(P(),L()).nullish(),()=>void 0)}),kZ=z({protocolVersion:JX,agentCapabilities:$(xZ.optional().default({loadSession:!1,promptCapabilities:{image:!1,audio:!1,embeddedContext:!1},mcpCapabilities:{http:!1,sse:!1,acp:!1},sessionCapabilities:{},auth:{}}),()=>({loadSession:!1,promptCapabilities:{image:!1,audio:!1,embeddedContext:!1},mcpCapabilities:{http:!1,sse:!1,acp:!1},sessionCapabilities:{},auth:{}})),authMethods:$(GY(DZ).optional().default([]),()=>[]),agentInfo:$(OZ.nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),AZ=z({_meta:$(B(P(),L()).nullish(),()=>void 0)}),jZ=P(),MZ=So([H(`anthropic`),H(`openai`),H(`azure`),H(`vertex`),H(`bedrock`),P()]),NZ=z({apiType:MZ,baseUrl:P(),_meta:$(B(P(),L()).nullish(),()=>void 0)}),PZ=z({providers:R(z({providerId:jZ,supported:VY(GY(MZ),()=>[]),required:I(),current:NZ.nullish(),_meta:$(B(P(),L()).nullish(),()=>void 0)})),_meta:$(B(P(),L()).nullish(),()=>void 0)}),FZ=z({_meta:$(B(P(),L()).nullish(),()=>void 0)}),IZ=z({_meta:$(B(P(),L()).nullish(),()=>void 0)}),LZ=z({_meta:$(B(P(),L()).nullish(),()=>void 0)}),RZ=P(),zZ=z({currentModeId:RZ,availableModes:VY(GY(z({id:RZ,name:P(),description:$(P().nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)})),()=>[]),_meta:$(B(P(),L()).nullish(),()=>void 0)}),BZ=P(),VZ=So([H(`mode`),H(`model`),H(`model_config`),H(`thought_level`),P()]),HZ=P(),UZ=z({value:HZ,name:P(),description:$(P().nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),WZ=z({group:P(),name:P(),options:VY(GY(UZ),()=>[]),_meta:$(B(P(),L()).nullish(),()=>void 0)}),GZ=z({currentValue:HZ,options:So([R(UZ),R(WZ)])}),KZ=z({currentValue:I()}),qZ=wo(So([GZ.and(z({type:H(`select`)})),KZ.and(z({type:H(`boolean`)}))]),z({id:BZ,name:P(),description:$(P().nullish(),()=>void 0),category:$(VZ.nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)})),JZ=z({sessionId:qY,modes:$(zZ.nullish(),()=>void 0),configOptions:$(GY(qZ).nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),YZ=z({modes:$(zZ.nullish(),()=>void 0),configOptions:$(GY(qZ).nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),XZ=z({sessions:VY(GY(z({sessionId:qY,cwd:P(),additionalDirectories:$(GY(P()).optional(),()=>[]),title:$(P().nullish(),()=>void 0),updatedAt:$(P().nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)})),()=>[]),nextCursor:$(P().nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),ZZ=z({_meta:$(B(P(),L()).nullish(),()=>void 0)}),QZ=z({sessionId:qY,modes:$(zZ.nullish(),()=>void 0),configOptions:$(GY(qZ).nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),$Z=z({modes:$(zZ.nullish(),()=>void 0),configOptions:$(GY(qZ).nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),eQ=z({_meta:$(B(P(),L()).nullish(),()=>void 0)}),tQ=z({_meta:$(B(P(),L()).nullish(),()=>void 0)}),nQ=z({configOptions:VY(GY(qZ),()=>[]),_meta:$(B(P(),L()).nullish(),()=>void 0)}),rQ=z({stopReason:So([H(`end_turn`),H(`max_tokens`),H(`max_turn_requests`),H(`refusal`),H(`cancelled`)]),usage:$(z({totalTokens:F(),inputTokens:F(),outputTokens:F(),thoughtTokens:$(F().nullish(),()=>void 0),cachedReadTokens:$(F().nullish(),()=>void 0),cachedWriteTokens:$(F().nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}).nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),iQ=z({sessionId:qY,_meta:$(B(P(),L()).nullish(),()=>void 0)}),aQ=P(),oQ=z({line:_o().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}),character:_o().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}),_meta:$(B(P(),L()).nullish(),()=>void 0)}),sQ=z({start:oQ,end:oQ,_meta:$(B(P(),L()).nullish(),()=>void 0)}),cQ=z({range:sQ,newText:P(),_meta:$(B(P(),L()).nullish(),()=>void 0)}),lQ=z({id:aQ,uri:P(),edits:R(cQ),cursorPosition:$(oQ.nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),uQ=z({id:aQ,uri:P(),position:oQ,_meta:$(B(P(),L()).nullish(),()=>void 0)}),dQ=z({id:aQ,uri:P(),position:oQ,newName:P(),_meta:$(B(P(),L()).nullish(),()=>void 0)}),fQ=z({id:aQ,uri:P(),search:P(),replace:P(),isRegex:I().nullish(),_meta:$(B(P(),L()).nullish(),()=>void 0)}),pQ=z({suggestions:R(So([lQ.and(z({kind:H(`edit`)})),uQ.and(z({kind:H(`jump`)})),dQ.and(z({kind:H(`rename`)})),fQ.and(z({kind:H(`searchAndReplace`)}))])),_meta:$(B(P(),L()).nullish(),()=>void 0)}),mQ=z({_meta:$(B(P(),L()).nullish(),()=>void 0)}),hQ=L(),gQ=L(),_Q=z({code:So([H(-32700),H(-32600),H(-32601),H(-32602),H(-32603),H(-32800),H(-32e3),H(-32002),_o().min(-2147483648,{error:`Invalid value: Expected int32 to be >= -2147483648`}).max(2147483647,{error:`Invalid value: Expected int32 to be <= 2147483647`})]),message:P(),data:$(L().optional(),()=>void 0)});So([z({id:KY,result:So([kZ,AZ,PZ,FZ,IZ,LZ,JZ,YZ,XZ,ZZ,QZ,$Z,eQ,tQ,nQ,rQ,iQ,pQ,mQ,hQ,gQ])}),z({id:KY,error:_Q})]);const vQ=z({content:oX,messageId:$(P().nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),yQ=z({toolCallId:XY,title:P(),kind:$(ZY.optional(),()=>void 0),status:$(QY.optional(),()=>void 0),content:$(GY(dX).optional(),()=>[]),locations:$(GY(fX).optional(),()=>[]),rawInput:$(L().optional(),()=>void 0),rawOutput:$(L().optional(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),bQ=So([H(`high`),H(`medium`),H(`low`)]),xQ=So([H(`pending`),H(`in_progress`),H(`completed`)]),SQ=z({content:P(),priority:bQ,status:xQ,_meta:$(B(P(),L()).nullish(),()=>void 0)}),CQ=z({entries:VY(GY(SQ),()=>[]),_meta:$(B(P(),L()).nullish(),()=>void 0)}),wQ=P(),jde=z({planId:wQ,entries:VY(GY(SQ),()=>[]),_meta:$(B(P(),L()).nullish(),()=>void 0)}),Mde=z({planId:wQ,uri:P(),_meta:$(B(P(),L()).nullish(),()=>void 0)}),Nde=z({planId:wQ,content:P(),_meta:$(B(P(),L()).nullish(),()=>void 0)}),Pde=z({plan:So([jde.and(z({type:H(`items`)})),Mde.and(z({type:H(`file`)})),Nde.and(z({type:H(`markdown`)}))]),_meta:$(B(P(),L()).nullish(),()=>void 0)}),Fde=z({planId:wQ,_meta:$(B(P(),L()).nullish(),()=>void 0)}),Ide=z({hint:P(),_meta:$(B(P(),L()).nullish(),()=>void 0)}),Lde=z({availableCommands:VY(GY(z({name:P(),description:P(),input:$(Ide.nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)})),()=>[]),_meta:$(B(P(),L()).nullish(),()=>void 0)}),Rde=z({currentModeId:RZ,_meta:$(B(P(),L()).nullish(),()=>void 0)}),zde=z({configOptions:VY(GY(qZ),()=>[]),_meta:$(B(P(),L()).nullish(),()=>void 0)}),Bde=z({title:$(P().nullish(),()=>void 0),updatedAt:$(P().nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),Vde=z({amount:F(),currency:P(),_meta:$(B(P(),L()).nullish(),()=>void 0)}),Hde=z({used:F(),size:F(),cost:$(Vde.nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),TQ=z({sessionId:qY,update:So([vQ.and(z({sessionUpdate:H(`user_message_chunk`)})),vQ.and(z({sessionUpdate:H(`agent_message_chunk`)})),vQ.and(z({sessionUpdate:H(`agent_thought_chunk`)})),yQ.and(z({sessionUpdate:H(`tool_call`)})),pX.and(z({sessionUpdate:H(`tool_call_update`)})),CQ.and(z({sessionUpdate:H(`plan`)})),Pde.and(z({sessionUpdate:H(`plan_update`)})),Fde.and(z({sessionUpdate:H(`plan_removed`)})),Lde.and(z({sessionUpdate:H(`available_commands_update`)})),Rde.and(z({sessionUpdate:H(`current_mode_update`)})),zde.and(z({sessionUpdate:H(`config_option_update`)})),Bde.and(z({sessionUpdate:H(`session_info_update`)})),Hde.and(z({sessionUpdate:H(`usage_update`)}))]),_meta:$(B(P(),L()).nullish(),()=>void 0)}),EQ=z({elicitationId:zX,_meta:$(B(P(),L()).nullish(),()=>void 0)}),DQ=z({connectionId:WX,method:P(),params:$(B(P(),L()).nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),OQ=L();z({method:P(),params:So([TQ,EQ,DQ,OQ]).nullish()});const Ude=z({readTextFile:$(I().optional().default(!1),()=>!1),writeTextFile:$(I().optional().default(!1),()=>!1),_meta:$(B(P(),L()).nullish(),()=>void 0)}),Wde=z({configOptions:$(z({boolean:$(z({_meta:$(B(P(),L()).nullish(),()=>void 0)}).nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}).nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),Gde=z({_meta:$(B(P(),L()).nullish(),()=>void 0)}),Kde=z({terminal:$(I().optional().default(!1),()=>!1),_meta:$(B(P(),L()).nullish(),()=>void 0)}),qde=z({_meta:$(B(P(),L()).nullish(),()=>void 0)}),Jde=z({_meta:$(B(P(),L()).nullish(),()=>void 0)}),Yde=z({form:$(qde.nullish(),()=>void 0),url:$(Jde.nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),Xde=z({_meta:$(B(P(),L()).nullish(),()=>void 0)}),Zde=z({_meta:$(B(P(),L()).nullish(),()=>void 0)}),Qde=z({_meta:$(B(P(),L()).nullish(),()=>void 0)}),$de=z({jump:$(Xde.nullish(),()=>void 0),rename:$(Zde.nullish(),()=>void 0),searchAndReplace:$(Qde.nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),kQ=z({protocolVersion:JX,clientCapabilities:$(z({fs:$(Ude.optional().default({readTextFile:!1,writeTextFile:!1}),()=>({readTextFile:!1,writeTextFile:!1})),terminal:$(I().optional().default(!1),()=>!1),session:$(Wde.nullish(),()=>void 0),plan:$(Gde.nullish(),()=>void 0),auth:$(Kde.optional().default({terminal:!1}),()=>({terminal:!1})),elicitation:$(Yde.nullish(),()=>void 0),nes:$($de.nullish(),()=>void 0),positionEncodings:$(GY(bZ).optional(),()=>[]),_meta:$(B(P(),L()).nullish(),()=>void 0)}).optional().default({fs:{readTextFile:!1,writeTextFile:!1},terminal:!1,auth:{terminal:!1}}),()=>({fs:{readTextFile:!1,writeTextFile:!1},terminal:!1,auth:{terminal:!1}})),clientInfo:$(OZ.nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),AQ=z({methodId:SZ,_meta:$(B(P(),L()).nullish(),()=>void 0)}),jQ=z({_meta:$(B(P(),L()).nullish(),()=>void 0)}),MQ=z({providerId:jZ,apiType:MZ,baseUrl:P(),headers:B(P(),P()).optional(),_meta:$(B(P(),L()).nullish(),()=>void 0)}),NQ=z({providerId:jZ,_meta:$(B(P(),L()).nullish(),()=>void 0)}),PQ=z({_meta:$(B(P(),L()).nullish(),()=>void 0)}),FQ=z({name:P(),value:P(),_meta:$(B(P(),L()).nullish(),()=>void 0)}),efe=z({name:P(),url:P(),headers:R(FQ),_meta:$(B(P(),L()).nullish(),()=>void 0)}),tfe=z({name:P(),url:P(),headers:R(FQ),_meta:$(B(P(),L()).nullish(),()=>void 0)}),nfe=z({name:P(),serverId:HX,_meta:$(B(P(),L()).nullish(),()=>void 0)}),rfe=z({name:P(),command:P(),args:R(P()),env:R(_X),_meta:$(B(P(),L()).nullish(),()=>void 0)}),IQ=So([efe.and(z({type:H(`http`)})),tfe.and(z({type:H(`sse`)})),nfe.and(z({type:H(`acp`)})),rfe]),LQ=z({cwd:P(),additionalDirectories:$(GY(P()).optional(),()=>[]),mcpServers:VY(GY(IQ),()=>[]),_meta:$(B(P(),L()).nullish(),()=>void 0)}),RQ=z({mcpServers:VY(GY(IQ),()=>[]),cwd:P(),additionalDirectories:$(GY(P()).optional(),()=>[]),sessionId:qY,_meta:$(B(P(),L()).nullish(),()=>void 0)}),zQ=z({cwd:P().nullish(),cursor:P().nullish(),_meta:$(B(P(),L()).nullish(),()=>void 0)}),BQ=z({sessionId:qY,_meta:$(B(P(),L()).nullish(),()=>void 0)}),VQ=z({sessionId:qY,cwd:P(),additionalDirectories:$(GY(P()).optional(),()=>[]),mcpServers:$(GY(IQ).optional(),()=>[]),_meta:$(B(P(),L()).nullish(),()=>void 0)}),HQ=z({sessionId:qY,cwd:P(),additionalDirectories:$(GY(P()).optional(),()=>[]),mcpServers:$(GY(IQ).optional(),()=>[]),_meta:$(B(P(),L()).nullish(),()=>void 0)}),UQ=z({sessionId:qY,_meta:$(B(P(),L()).nullish(),()=>void 0)}),WQ=z({sessionId:qY,modeId:RZ,_meta:$(B(P(),L()).nullish(),()=>void 0)}),GQ=wo(So([z({value:I(),type:H(`boolean`)}),z({value:HZ})]),z({sessionId:qY,configId:BZ,_meta:$(B(P(),L()).nullish(),()=>void 0)})),KQ=z({sessionId:qY,prompt:R(oX),_meta:$(B(P(),L()).nullish(),()=>void 0)}),ife=z({uri:P(),name:P(),_meta:$(B(P(),L()).nullish(),()=>void 0)}),afe=z({name:P(),owner:P(),remoteUrl:P(),_meta:$(B(P(),L()).nullish(),()=>void 0)}),qQ=z({workspaceUri:$(P().nullish(),()=>void 0),workspaceFolders:R(ife).nullish(),repository:$(afe.nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),ofe=So([H(`automatic`),H(`diagnostic`),H(`manual`)]),sfe=z({uri:P(),languageId:P(),text:P(),_meta:$(B(P(),L()).nullish(),()=>void 0)}),cfe=z({startLine:_o().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}),endLine:_o().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}),text:P(),_meta:$(B(P(),L()).nullish(),()=>void 0)}),lfe=z({uri:P(),excerpts:R(cfe),_meta:$(B(P(),L()).nullish(),()=>void 0)}),ufe=z({uri:P(),diff:P(),_meta:$(B(P(),L()).nullish(),()=>void 0)}),dfe=z({action:P(),uri:P(),position:oQ,timestampMs:F(),_meta:$(B(P(),L()).nullish(),()=>void 0)}),ffe=z({uri:P(),languageId:P(),visibleRange:$(sQ.nullish(),()=>void 0),lastFocusedMs:$(F().nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),pfe=So([H(`error`),H(`warning`),H(`information`),H(`hint`)]),mfe=z({uri:P(),range:sQ,severity:pfe,message:P(),_meta:$(B(P(),L()).nullish(),()=>void 0)}),hfe=z({recentFiles:R(sfe).nullish(),relatedSnippets:R(lfe).nullish(),editHistory:R(ufe).nullish(),userActions:R(dfe).nullish(),openFiles:R(ffe).nullish(),diagnostics:R(mfe).nullish(),_meta:$(B(P(),L()).nullish(),()=>void 0)}),JQ=z({sessionId:qY,uri:P(),version:F(),position:oQ,selection:sQ.nullish(),triggerKind:ofe,context:hfe.nullish(),_meta:$(B(P(),L()).nullish(),()=>void 0)}),YQ=z({sessionId:qY,_meta:$(B(P(),L()).nullish(),()=>void 0)});z({id:KY,method:P(),params:So([kQ,AQ,jQ,MQ,NQ,PQ,LQ,RQ,zQ,BQ,VQ,HQ,UQ,WQ,GQ,KQ,qQ,JQ,YQ,GX,qX]).nullish()});const gfe=z({_meta:$(B(P(),L()).nullish(),()=>void 0)}),_fe=z({content:P(),_meta:$(B(P(),L()).nullish(),()=>void 0)}),vfe=z({optionId:mX,_meta:$(B(P(),L()).nullish(),()=>void 0)}),yfe=z({outcome:So([z({outcome:H(`cancelled`)}),vfe.and(z({outcome:H(`selected`)}))]),_meta:$(B(P(),L()).nullish(),()=>void 0)}),bfe=z({terminalId:lX,_meta:$(B(P(),L()).nullish(),()=>void 0)}),xfe=z({exitCode:$(_o().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),()=>void 0),signal:$(P().nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),Sfe=z({output:P(),truncated:I(),exitStatus:$(xfe.nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),Cfe=z({_meta:$(B(P(),L()).nullish(),()=>void 0)}),wfe=z({exitCode:$(_o().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),()=>void 0),signal:$(P().nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),Tfe=z({_meta:$(B(P(),L()).nullish(),()=>void 0)}),Efe=So([P(),F(),F(),I(),R(P())]),XQ=z({content:B(P(),Efe).nullish()});So([z({id:KY,result:So([gfe,_fe,yfe,bfe,Sfe,Cfe,wfe,Tfe,WY(wo(So([XQ.and(z({action:H(`accept`)})),z({action:H(`decline`)}),z({action:H(`cancel`)}),UY(z({action:P()}),`action`,[`accept`,`cancel`,`decline`])]),z({_meta:$(B(P(),L()).nullish(),()=>void 0)})),`action`,[`accept`,`cancel`,`decline`]),z({connectionId:WX,_meta:$(B(P(),L()).nullish(),()=>void 0)}),z({_meta:$(B(P(),L()).nullish(),()=>void 0)}),gQ,hQ])}),z({id:KY,error:_Q})]);const ZQ=z({sessionId:qY,_meta:$(B(P(),L()).nullish(),()=>void 0)}),QQ=z({sessionId:qY,uri:P(),languageId:P(),version:F(),text:P(),_meta:$(B(P(),L()).nullish(),()=>void 0)}),Dfe=z({range:sQ.nullish(),text:P(),_meta:$(B(P(),L()).nullish(),()=>void 0)}),$Q=z({sessionId:qY,uri:P(),version:F(),contentChanges:VY(GY(Dfe),()=>[]),_meta:$(B(P(),L()).nullish(),()=>void 0)}),e$=z({sessionId:qY,uri:P(),_meta:$(B(P(),L()).nullish(),()=>void 0)}),t$=z({sessionId:qY,uri:P(),_meta:$(B(P(),L()).nullish(),()=>void 0)}),n$=z({sessionId:qY,uri:P(),version:F(),position:oQ,visibleRange:sQ,_meta:$(B(P(),L()).nullish(),()=>void 0)}),r$=z({sessionId:qY,id:aQ,_meta:$(B(P(),L()).nullish(),()=>void 0)}),i$=z({sessionId:qY,id:aQ,reason:$(So([H(`rejected`),H(`ignored`),H(`replaced`),H(`cancelled`)]).nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)});z({method:P(),params:So([ZQ,QQ,$Q,e$,t$,n$,r$,i$,DQ,OQ]).nullish()}),z({requestId:KY,_meta:$(B(P(),L()).nullish(),()=>void 0)}),RX.and(z({mode:H(`form`)})).and(z({message:P()})),BX.and(z({mode:H(`url`)})).and(z({message:P()})),So([CX,wX]).and(z({message:P()})),OX.and(z({type:H(`string`)})),kX.and(z({type:H(`number`)})),AX.and(z({type:H(`integer`)})),jX.and(z({type:H(`boolean`)})),FX.and(z({type:H(`array`)})),MX.and(z({type:H(`string`)})),XQ.and(z({action:H(`accept`)})),z({action:H(`decline`)}),z({action:H(`cancel`)});function a$(e){return e??{}}LY.initialize,LY.authenticate,LY.logout,LY.providers_list,LY.providers_set,LY.providers_disable,LY.session_new,LY.session_load,LY.session_list,LY.session_delete,LY.session_fork,LY.session_resume,LY.session_close,LY.session_set_mode,LY.session_set_config_option,LY.session_prompt,LY.session_cancel,LY.nes_start,LY.nes_suggest,LY.nes_accept,LY.nes_reject,LY.nes_close,LY.document_did_open,LY.document_did_change,LY.document_did_close,LY.document_did_save,LY.document_did_focus,RY.session_request_permission,RY.session_update,RY.fs_write_text_file,RY.fs_read_text_file,RY.terminal_create,RY.terminal_output,RY.terminal_release,RY.terminal_wait_for_exit,RY.terminal_kill,RY.elicitation_create,RY.elicitation_complete,zY.cancel_request;function o$(e,t,n){return{method:e,params:t,mapResponse:n}}function s$(e,t){return{method:e,params:t}}function c$(e){let t={};for(let n of Object.values(e))t[n.method]=n;return t}const Ofe={initialize:o$(LY.initialize,kQ),newSession:o$(LY.session_new,LQ),loadSession:o$(LY.session_load,RQ,a$),unstable_forkSession:o$(LY.session_fork,VQ),listSessions:o$(LY.session_list,zQ),deleteSession:o$(LY.session_delete,BQ,a$),resumeSession:o$(LY.session_resume,HQ),closeSession:o$(LY.session_close,UQ,a$),setSessionMode:o$(LY.session_set_mode,WQ,a$),setSessionConfigOption:o$(LY.session_set_config_option,GQ),authenticate:o$(LY.authenticate,AQ,a$),unstable_listProviders:o$(LY.providers_list,jQ),unstable_setProvider:o$(LY.providers_set,MQ,a$),unstable_disableProvider:o$(LY.providers_disable,NQ,a$),logout:o$(LY.logout,PQ,a$),prompt:o$(LY.session_prompt,KQ),unstable_startNes:o$(LY.nes_start,qQ),unstable_suggestNes:o$(LY.nes_suggest,JQ),unstable_closeNes:o$(LY.nes_close,YQ,a$)},kfe={cancel:s$(LY.session_cancel,ZQ),unstable_didOpenDocument:s$(LY.document_did_open,QQ),unstable_didChangeDocument:s$(LY.document_did_change,$Q),unstable_didCloseDocument:s$(LY.document_did_close,e$),unstable_didSaveDocument:s$(LY.document_did_save,t$),unstable_didFocusDocument:s$(LY.document_did_focus,n$),unstable_acceptNes:s$(LY.nes_accept,r$),unstable_rejectNes:s$(LY.nes_reject,i$)},Afe={requestPermission:o$(RY.session_request_permission,gX),writeTextFile:o$(RY.fs_write_text_file,JY,a$),readTextFile:o$(RY.fs_read_text_file,YY),createTerminal:o$(RY.terminal_create,vX),terminalOutput:o$(RY.terminal_output,yX),releaseTerminal:o$(RY.terminal_release,bX,a$),waitForTerminalExit:o$(RY.terminal_wait_for_exit,xX),killTerminal:o$(RY.terminal_kill,SX,a$),unstable_createElicitation:o$(RY.elicitation_create,VX)},jfe={sessionUpdate:s$(RY.session_update,TQ),unstable_completeElicitation:s$(RY.elicitation_complete,EQ)};c$(Ofe),c$(kfe),c$(Afe),c$(jfe),new Set([LY.initialize,LY.authenticate,LY.providers_list,LY.providers_set,LY.providers_disable,LY.session_new,LY.session_load,LY.session_set_mode,LY.session_set_config_option,LY.session_prompt,LY.session_list,LY.session_delete,LY.session_fork,LY.session_resume,LY.session_close,LY.logout,LY.nes_start,LY.nes_suggest,LY.nes_close]),new Set([LY.session_cancel,LY.nes_accept,LY.nes_reject,LY.document_did_open,LY.document_did_change,LY.document_did_close,LY.document_did_save,LY.document_did_focus]),new Set([RY.session_request_permission,RY.fs_write_text_file,RY.fs_read_text_file,RY.terminal_create,RY.terminal_output,RY.terminal_release,RY.terminal_wait_for_exit,RY.terminal_kill,RY.elicitation_create]),new Set([RY.session_update,RY.elicitation_complete]),new RB({extensions:_w,deriveStructuralFreshness:!0}),ev(_w);function Mfe(e,t,n,r){return e.success?{code:`UNKNOWN`,message:`unexpected success in error path`}:{code:`SCHEMA_INVALID`,issues:e.error.issues.map(e=>{let i=e.path.map(e=>typeof e==`symbol`?String(e):e),a=sl({file:r,source:n,doc:t,path:i});return{path:i,message:e.message,issueCode:e.code,...a===void 0?{}:{source:a}}})}}function l$(e,t,n){let r=`${e}.invalid-${t.replace(/[:.]/g,`-`)}`;try{return E(e,r),r}catch(t){n(`[config] Could not sideline invalid config file ${e} → ${r}: ${t instanceof Error?t.message:String(t)}. File left in place; using schema defaults.`);return}}function Nfe(e){let{absPath:t,sideline:n=!0,timestamp:r=new Date().toISOString()}=e,i=e.warn??(e=>console.warn(e)),a=Ts.parse({});if(!g(t))return{valid:!0,value:a,source:void 0,diagnostics:[]};let o;try{o=S(t,`utf-8`)}catch(e){let n=e instanceof Error?e.message:String(e);i(`[config] Could not read ${t}: ${n}. Using schema defaults.`);let r={code:`UNREADABLE`,detail:n};return{valid:!1,value:a,error:r,diagnostics:[{...r}]}}let s=(0,Zt.parseDocument)(o);if(s.errors.length>0){let e=s.errors.map(e=>e.message).join(`; `);i(`[config] ${t} contains invalid YAML (${e}). Using schema defaults.`+(n?``:` Pass-through mode: file left in place.`));let o=n?l$(t,r,i):void 0,c={code:`YAML_PARSE`,detail:e};return{valid:!1,value:a,error:c,diagnostics:[{...c}],...o===void 0?{}:{sidelinedTo:o}}}let c=s.toJSON()??{},l=fl({value:c,file:t,source:o,doc:s}),u=l.length>0?ml(c):c,d=Ts.safeParse(u);if(!d.success){let e=Mfe(d,s,o,t);i(`[config] ${t} fails schema validation (${d.error.issues.length} issue(s)). Using schema defaults.`+(n?``:` Pass-through mode: file left in place.`));let c=n?l$(t,r,i):void 0;return{valid:!1,value:a,error:e,diagnostics:[...l,...el(e)&&e.code===`SCHEMA_INVALID`?[{...e}]:[]],...c===void 0?{}:{sidelinedTo:c}}}return{valid:!0,value:d.data,source:t,diagnostics:l}}function Pfe(e){try{let t=me(e),n=`${pe(e)}.tmp.`,r=Date.now()-3e4;for(let e of C(t)){if(!e.startsWith(n))continue;let i=M(t,e);try{ee(i).mtimeMs<r&&te(i)}catch{}}}catch{}}function u$(e,t,n={}){Pfe(e);let r=`${e}.tmp.${crypto.randomUUID()}`;try{ne(r,t,{encoding:`utf-8`,mode:n.mode??420}),E(r,e)}catch(e){try{te(r)}catch{}throw e}}var Ffe=class extends Error{code=`LOCK_TIMEOUT`;lockPath;timeoutMs;constructor(e,t){super(`Could not acquire file lock at ${e} within ${t}ms`),this.name=`FileLockTimeoutError`,this.lockPath=e,this.timeoutMs=t}};function Ife(e){let t=Date.now()+e;for(;Date.now()<t;);}function d$(e,t,n={}){let r=n.timeoutMs??5e3,i=n.retryIntervalMs??25,a=r*2,o=Date.now()+r;for(;;){let s;try{s=b(e,`wx`,384)}catch(t){if(t.code!==`EEXIST`)throw t;let s;try{let t=ee(e);s=Date.now()-t.mtimeMs}catch{continue}let c=!1;if(s>a){n.onWarn?.(`cleared stale file lock`,{lockPath:e,ageMs:s,staleThresholdMs:a});try{te(e),c=!0}catch{}}if(c)continue;if(Date.now()>=o)throw new Ffe(e,r);Ife(i);continue}try{return t()}finally{try{p(s)}catch{}try{te(e)}catch{}}}}const f$=`config.yml`;function p$(e,t,n){if(e===`user`)return ye(n??se(),`.ok`,`global.yml`);let r=j(t)?t:ye(t);return e===`project-local`?ye(r,`.ok`,jl,f$):ye(r,`.ok`,f$)}var m$=i(((e,t)=>{let n=e=>e&&typeof e.message==`string`,r=e=>{if(!e)return;let t=e.cause;if(typeof t==`function`){let t=e.cause();return n(t)?t:void 0}else return n(t)?t:void 0},i=(e,t)=>{if(!n(e))return``;let a=e.stack||``;if(t.has(e))return a+`
413
+ `}return n.join(``).replace(/%20/g,` `)},t.exports=n,t.exports.diff_match_patch=n,t.exports.DIFF_DELETE=r,t.exports.DIFF_INSERT=i,t.exports.DIFF_EQUAL=a}))(),1);new rY.default;const iY=z({path:R(So([P(),F()])),message:P(),issueCode:P()});Co(`code`,[z({code:H(`SCHEMA_INVALID`),issues:R(iY)}),z({code:H(`WRITE_ERROR`),detail:P()})]),Object.freeze({source:`local`,skipStoreHooks:!1,context:Object.freeze({origin:`form-write`})});const aY=new rY.default;aY.Match_Threshold=.5;const oY=`last-server-exit.json`,sY=`last-server-crash.json`,cY=[`.ok`,`local`,`installed-skills.json`],lY=V(gl),uY=bo({hosts:R(P()),scope:lY,scripts:I(),installedAt:Pa(),projection:V([`symlink`,`copy`]).optional(),contentHash:P().optional()}),dY=bo({schema:H(1),skills:B(P(),uY).default({})});function fY(e){let t;try{t=JSON.parse(e)}catch{return null}let n=dY.safeParse(t);return n.success?n.data:null}(()=>{let e=globalThis.Intl.Segmenter;return e?new e(`en`,{granularity:`word`}):null})();const pY=Symbol.for(`@inkeep/open-knowledge/skill-state-field-registry`),mY=globalThis;mY[pY]===void 0&&(mY[pY]=Xr());const hY=mY[pY],gY=bo({version:P().regex(/^\d+\.\d+\.\d+(?:[-+][\w.-]+)?$/,`version must match /^\\d+\\.\\d+\\.\\d+(?:[-+][\\w.-]+)?$/`).register(hY,{description:`Recorded skill version for this target.`}),recordedAt:Pa().register(hY,{description:`ISO 8601 timestamp of the most recent successful write. Updated on every write, including reinstalls of the same version.`}),surface:V([`server-build-and-open`,`electron-build-and-open`,`cli-npx-skills-add`,`desktop-direct`,`cli-start`]).register(hY,{description:`Install-source surface that recorded this entry.`}).optional()}),_Y=bo({enabled:I().register(hY,{description:`Whether this user-global skill bundle is opted in.`}),decidedAt:Pa().register(hY,{description:`ISO 8601 timestamp of the opt-in / opt-out decision.`})});bo({schema:H(1).register(hY,{description:`Schema major version. Bumped only on breaking shape changes.`}),targets:bo({"claude-cowork":gY.optional(),"cli-hosts":gY.optional()}).register(hY,{description:`Per-target install-state entries. Absent target = no recorded install.`}).default({}),bundles:B(P(),_Y).register(hY,{description:`Per-bundle opt-in decisions keyed by install name. Absent key = no recorded decision.`}).optional(),installsReported:R(P()).register(hY,{description:"Skill installs already reported to skills.sh from this machine, as `<owner/repo>#<skill>`. Append-only; presence suppresses a re-report."}).optional()});const vY=bo({name:P(),description:P(),files:bo({skillMd:P(),scripts:R(P()),references:R(P())})}),yY=bo({pluginProvider:P().optional(),plugin:P().optional(),marketplace:P().optional(),version:P().optional(),gitCommitSha:P().optional(),scope:P().optional(),projectPath:P().optional()}),bY=bo({commands:I(),hooks:I(),mcp:I()}),xY=bo({...vY.shape,sourceHarness:P(),sourceHarnesses:R(P()),home:P(),provenance:yY,inert:bY,outsideProject:I().optional()}),SY=bo({schema:H(1),name:P(),version:P(),description:P().optional(),author:bo({name:P()}).optional(),skills:R(P()),hostCompatibility:R(P()).optional(),capabilities:bo({scripts:P(),network:P(),inert:R(P())}).optional(),provenance:bo({source:P(),ref:P(),contentHash:P()}).optional()});z({skills:R(xY),packs:R(SY)}).loose(),z({results:R(z({id:P().min(1),name:P().min(1),source:P().min(1),description:P(),installs:F().int().nonnegative().nullable(),publisher:P().nullable()}).loose()),backend:V([`skills.sh`,`github-fallback`]),degraded:I()}).loose(),z({title:P(),description:P(),image:P().nullable(),skillsUrl:P().nullable(),sourceKind:V([`github`,`site`]),sourceUrl:P()}).loose(),z({skills:R(z({name:P(),description:P().nullable()}).loose())}).loose(),z({kind:V([`local`,`import`,`none`]),scope:V(gl).optional(),name:P().optional(),dir:P().optional(),source:P().optional(),ref:P().optional(),via:V([`source`,`publisher`]).optional()}).loose();const CY=z({relPath:P(),content:P().nullable()}).loose(),wY=z({provider:P(),plugin:P(),version:P().optional(),marketplace:P().optional(),repositoryUrl:P().optional()}).loose(),TY=z({provider:P(),plugin:P(),version:P().optional(),description:P().optional(),repositoryUrl:P().optional(),bundledSkills:R(P()),capabilities:z({commands:I(),hooks:I(),mcp:I(),agents:I()}),setupSupported:I()}).loose();z({name:P(),description:P().nullable(),skillMd:P(),files:R(CY),plugin:wY.optional(),pluginBundle:TY.optional()}).loose();const EY=e=>e*8+4;EY(92),EY(40),Hc();var DY=class{kind;projectRoot;projectSubPath;gitPath;gitDir;cachedCommonDir;constructor(e,t,n,r,i){this.kind=e,this.projectRoot=t,this.projectSubPath=n,this.gitPath=r,this.gitDir=i}readCommonDir(){if(this.cachedCommonDir!==void 0)return{kind:`resolved`,path:this.cachedCommonDir};let e=this.gitDir;try{let t=S(M(this.gitDir,`commondir`),`utf-8`).trim();t.length>0&&(e=j(t)?t:ye(this.gitDir,t))}catch(e){if(!PY(e))return{kind:`unreadable`,cause:e}}return this.cachedCommonDir=e,{kind:`resolved`,path:e}}readHead(){let e;try{e=S(M(this.gitDir,`HEAD`),`utf-8`).trim()}catch(e){return PY(e)?{kind:`absent`}:{kind:`unreadable`,cause:e}}let t=/^ref:[ \t]*(refs\/heads\/(.+))$/.exec(e);return t?.[2]?{kind:`branch`,branch:t[2],ref:t[1]}:LY(e)?{kind:`detached`,oid:e}:{kind:`malformed`,raw:e}}readRemoteUrl(e){let t=this.readCommonDir();if(t.kind===`unreadable`)return t;let n;try{n=S(M(t.path,`config`),`utf-8`)}catch(e){return PY(e)?{kind:`absent`,reason:`config-missing`}:{kind:`unreadable`,cause:e}}let r=jY(n,e);return r===null?{kind:`absent`,reason:`remote-missing`}:{kind:`configured`,url:r}}readRef(e){if(!FY(e))return{kind:`invalid`};let t=this.readCommonDir();if(t.kind===`unreadable`)return t;let n=ye(t.path,e),r=ve(t.path,n);if(r.startsWith(`..`)||j(r))return{kind:`invalid`};try{let e=S(n,`utf-8`).trim(),t=IY(e);return t===null?{kind:`malformed`,raw:e}:{kind:`present`,storage:`loose`,value:t}}catch(e){if(!PY(e))return{kind:`unreadable`,cause:e}}let i;try{i=S(M(t.path,`packed-refs`),`utf-8`)}catch(e){return PY(e)?{kind:`absent`}:{kind:`unreadable`,cause:e}}for(let t of i.split(/\r?\n/)){let n=t.trim();if(n.length===0||n.startsWith(`#`)||n.startsWith(`^`))continue;let r=n.split(/\s+/);if(r.length===2&&r[1]===e)return LY(r[0])?{kind:`present`,storage:`packed`,value:{kind:`oid`,oid:r[0]}}:{kind:`malformed`,raw:n}}return{kind:`absent`}}};function OY(e){return AY(ye(e),``)}function kY(e){let t=ye(e),n=ye(se());if(t===n)return{kind:`absent`};let r=AY(t,``);if(r.kind!==`absent`)return r;let i=t;for(let e=0;e<64;e++){if(i===n)return{kind:`absent`};let e=me(i);if(e===i||e===n)return{kind:`absent`};let r=AY(e,ve(e,t));if(r.kind!==`absent`)return r;i=e}return{kind:`absent`}}function AY(e,t){let n=M(e,`.git`),r;try{r=ee(n)}catch(e){return PY(e)?{kind:`absent`}:{kind:`inaccessible`,gitPath:n,cause:e}}if(r.isDirectory())return{kind:`repository`,repository:new DY(`directory`,e,t,n,n)};if(!r.isFile())return{kind:`absent`};let i;try{i=S(n,`utf-8`).trim()}catch(e){return{kind:`malformed-pointer`,gitPath:n,target:``,cause:e}}let a=/^gitdir:[ \t]*(.+)$/.exec(i);if(!a)return{kind:`malformed-pointer`,gitPath:n,target:``};let o=a[1].trim(),s=j(o)?o:ye(e,o);try{if(!ee(s).isDirectory())return{kind:`malformed-pointer`,gitPath:n,target:s}}catch(e){return{kind:`malformed-pointer`,gitPath:n,target:s,cause:e}}return{kind:`repository`,repository:new DY(`linked`,e,t,n,s)}}function jY(e,t){let n=!1;for(let r of e.split(/\r?\n/)){let e=MY(r);if(e.length===0)continue;if(e.startsWith(`[`)){n=/^\[\s*remote\s+["'](.+)["']\s*\]$/.exec(e)?.[1]===t;continue}if(!n)continue;let i=/^url\s*=\s*(.*)$/.exec(e);if(!i)continue;let a=NY(i[1]);if(a.length>0)return a}return null}function MY(e){let t=e.search(/[;#]/);return(t===-1?e:e.slice(0,t)).trim()}function NY(e){let t=e.trim();return t.startsWith(`"`)&&t.endsWith(`"`)||t.startsWith(`'`)&&t.endsWith(`'`)?t.slice(1,-1):t}function PY(e){let t=e?.code;return t===`ENOENT`||t===`ENOTDIR`}function FY(e){return e.startsWith(`refs/`)&&!e.includes(`\0`)&&!e.includes(`\\`)&&!e.includes(`..`)&&!e.includes(`//`)&&!e.endsWith(`/`)}function IY(e){if(e.length===0)return null;let t=/^ref:[ \t]*(refs\/.+)$/.exec(e);return t?FY(t[1])?{kind:`symbolic`,target:t[1]}:null:LY(e)?{kind:`oid`,oid:e}:null}function LY(e){return/^(?:[0-9a-f]{40}|[0-9a-f]{64})$/.test(e)}const RY={initialize:`initialize`,authenticate:`authenticate`,providers_list:`providers/list`,providers_set:`providers/set`,providers_disable:`providers/disable`,session_new:`session/new`,session_load:`session/load`,session_set_mode:`session/set_mode`,session_set_config_option:`session/set_config_option`,session_prompt:`session/prompt`,session_cancel:`session/cancel`,mcp_message:`mcp/message`,session_list:`session/list`,session_delete:`session/delete`,session_fork:`session/fork`,session_resume:`session/resume`,session_close:`session/close`,logout:`logout`,nes_start:`nes/start`,nes_suggest:`nes/suggest`,nes_accept:`nes/accept`,nes_reject:`nes/reject`,nes_close:`nes/close`,document_did_open:`document/didOpen`,document_did_change:`document/didChange`,document_did_close:`document/didClose`,document_did_save:`document/didSave`,document_did_focus:`document/didFocus`},zY={session_request_permission:`session/request_permission`,session_update:`session/update`,fs_write_text_file:`fs/write_text_file`,fs_read_text_file:`fs/read_text_file`,terminal_create:`terminal/create`,terminal_output:`terminal/output`,terminal_release:`terminal/release`,terminal_wait_for_exit:`terminal/wait_for_exit`,terminal_kill:`terminal/kill`,mcp_connect:`mcp/connect`,mcp_message:`mcp/message`,mcp_disconnect:`mcp/disconnect`,elicitation_create:`elicitation/create`,elicitation_complete:`elicitation/complete`},BY={cancel_request:`$/cancel_request`},VY=Symbol(`skippedItem`);function $(e,t){return e.catch(t)}function HY(e,t){let n=e.catch(t);return L().transform((e,t)=>e===void 0?(t.addIssue({code:`custom`,message:`Required value is missing`}),rn):n.parse(e))}function UY(e,t){if(typeof e!=`object`||!e||Array.isArray(e))return;let n=e[t];return typeof n==`string`?n:void 0}function WY(e,t,n){return e.superRefine((e,r)=>{let i=UY(e,t);i!==void 0&&n.includes(i)&&r.addIssue({code:`custom`,path:[t],message:`${t} ${JSON.stringify(i)} is reserved by a known variant, but the value does not match that variant's schema`})})}function GY(e,t,n){return L().transform((r,i)=>{let a=e.safeParse(r);if(!a.success){for(let e of a.error.issues)i.addIssue({...e,input:r});return rn}let o=a.data,s=UY(r,t);if(s!==void 0&&!n.includes(s)){let e=r;for(let[t,n]of Object.entries(e))t!==`__proto__`&&(Object.hasOwn(o,t)||(o[t]=n))}return o})}function KY(e){return R(e.catch(VY)).transform(e=>e.filter(e=>e!==VY))}const qY=So([F(),P()]).nullable(),JY=P(),YY=z({sessionId:JY,path:P(),content:P(),_meta:$(B(P(),L()).nullish(),()=>void 0)}),XY=z({sessionId:JY,path:P(),line:$(_o().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),()=>void 0),limit:$(_o().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),ZY=P(),QY=So([H(`read`),H(`edit`),H(`delete`),H(`move`),H(`search`),H(`execute`),H(`think`),H(`fetch`),H(`switch_mode`),H(`other`)]),$Y=So([H(`pending`),H(`in_progress`),H(`completed`),H(`failed`)]),eX=z({audience:$(KY(So([H(`assistant`),H(`user`)])).nullish(),()=>void 0),lastModified:$(P().nullish(),()=>void 0),priority:$(F().nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),tX=z({annotations:$(eX.nullish(),()=>void 0),text:P(),_meta:$(B(P(),L()).nullish(),()=>void 0)}),nX=z({annotations:$(eX.nullish(),()=>void 0),data:P(),mimeType:P(),uri:$(P().nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),rX=z({annotations:$(eX.nullish(),()=>void 0),data:P(),mimeType:P(),_meta:$(B(P(),L()).nullish(),()=>void 0)}),iX=z({annotations:$(eX.nullish(),()=>void 0),description:$(P().nullish(),()=>void 0),mimeType:$(P().nullish(),()=>void 0),name:P(),size:$(F().nullish(),()=>void 0),title:$(P().nullish(),()=>void 0),uri:P(),_meta:$(B(P(),L()).nullish(),()=>void 0)}),aX=So([z({mimeType:$(P().nullish(),()=>void 0),text:P(),uri:P(),_meta:$(B(P(),L()).nullish(),()=>void 0)}),z({blob:P(),mimeType:$(P().nullish(),()=>void 0),uri:P(),_meta:$(B(P(),L()).nullish(),()=>void 0)})]),oX=z({annotations:$(eX.nullish(),()=>void 0),resource:aX,_meta:$(B(P(),L()).nullish(),()=>void 0)}),sX=So([tX.and(z({type:H(`text`)})),nX.and(z({type:H(`image`)})),rX.and(z({type:H(`audio`)})),iX.and(z({type:H(`resource_link`)})),oX.and(z({type:H(`resource`)}))]),cX=z({content:sX,_meta:$(B(P(),L()).nullish(),()=>void 0)}),lX=z({path:P(),oldText:$(P().nullish(),()=>void 0),newText:P(),_meta:$(B(P(),L()).nullish(),()=>void 0)}),uX=P(),dX=z({terminalId:uX,_meta:$(B(P(),L()).nullish(),()=>void 0)}),fX=So([cX.and(z({type:H(`content`)})),lX.and(z({type:H(`diff`)})),dX.and(z({type:H(`terminal`)}))]),pX=z({path:P(),line:$(_o().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),mX=z({toolCallId:ZY,kind:$(QY.nullish(),()=>void 0),status:$($Y.nullish(),()=>void 0),title:$(P().nullish(),()=>void 0),content:$(KY(fX).nullish(),()=>void 0),locations:$(KY(pX).nullish(),()=>void 0),rawInput:$(L().optional(),()=>void 0),rawOutput:$(L().optional(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),hX=P(),gX=So([H(`allow_once`),H(`allow_always`),H(`reject_once`),H(`reject_always`)]),_X=z({sessionId:JY,toolCall:mX,options:R(z({optionId:hX,name:P(),kind:gX,_meta:$(B(P(),L()).nullish(),()=>void 0)})),_meta:$(B(P(),L()).nullish(),()=>void 0)}),vX=z({name:P(),value:P(),_meta:$(B(P(),L()).nullish(),()=>void 0)}),yX=z({sessionId:JY,command:P(),args:$(KY(P()).optional(),()=>[]),env:$(KY(vX).optional(),()=>[]),cwd:$(P().nullish(),()=>void 0),outputByteLimit:$(F().nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),bX=z({sessionId:JY,terminalId:uX,_meta:$(B(P(),L()).nullish(),()=>void 0)}),xX=z({sessionId:JY,terminalId:uX,_meta:$(B(P(),L()).nullish(),()=>void 0)}),SX=z({sessionId:JY,terminalId:uX,_meta:$(B(P(),L()).nullish(),()=>void 0)}),CX=z({sessionId:JY,terminalId:uX,_meta:$(B(P(),L()).nullish(),()=>void 0)}),wX=z({sessionId:JY,toolCallId:$(ZY.nullish(),()=>void 0)}),TX=z({requestId:qY}),EX=H(`object`),DX=So([H(`email`),H(`uri`),H(`date`),H(`date-time`)]),OX=z({const:P(),title:P(),description:$(P().nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),kX=z({title:$(P().nullish(),()=>void 0),description:$(P().nullish(),()=>void 0),minLength:_o().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),maxLength:_o().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),pattern:P().nullish(),format:DX.nullish(),default:$(P().nullish(),()=>void 0),enum:R(P()).nullish(),oneOf:R(OX).nullish(),_meta:$(B(P(),L()).nullish(),()=>void 0)}),AX=z({title:$(P().nullish(),()=>void 0),description:$(P().nullish(),()=>void 0),minimum:F().nullish(),maximum:F().nullish(),default:$(F().nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),jX=z({title:$(P().nullish(),()=>void 0),description:$(P().nullish(),()=>void 0),minimum:F().nullish(),maximum:F().nullish(),default:$(F().nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),MX=z({title:$(P().nullish(),()=>void 0),description:$(P().nullish(),()=>void 0),default:$(I().nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),NX=z({enum:R(P()),_meta:$(B(P(),L()).nullish(),()=>void 0)}),PX=z({anyOf:R(OX),_meta:$(B(P(),L()).nullish(),()=>void 0)}),FX=GY(So([NX.and(z({type:H(`string`)})),WY(z({type:P()}),`type`,[`string`]),PX]),`type`,[`string`]),IX=z({title:$(P().nullish(),()=>void 0),description:$(P().nullish(),()=>void 0),minItems:F().nullish(),maxItems:F().nullish(),items:FX,default:$(KY(P()).nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),LX=GY(So([kX.and(z({type:H(`string`)})),AX.and(z({type:H(`number`)})),jX.and(z({type:H(`integer`)})),MX.and(z({type:H(`boolean`)})),IX.and(z({type:H(`array`)})),WY(z({type:P()}),`type`,[`array`,`boolean`,`integer`,`number`,`string`])]),`type`,[`array`,`boolean`,`integer`,`number`,`string`]),RX=z({type:$(EX.optional().default(`object`),()=>`object`),title:$(P().nullish(),()=>void 0),properties:B(P(),LX).optional().default({}),required:R(P()).nullish(),description:$(P().nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),zX=wo(So([wX,TX]),z({requestedSchema:RX})),BX=P(),VX=wo(So([wX,TX]),z({elicitationId:BX,url:fo()})),HX=GY(wo(So([zX.and(z({mode:H(`form`)})),VX.and(z({mode:H(`url`)})),WY(wo(So([wX,TX]),z({mode:P()})),`mode`,[`form`,`url`])]),z({message:P(),_meta:$(B(P(),L()).nullish(),()=>void 0)})),`mode`,[`form`,`url`]),UX=P(),WX=z({serverId:UX,_meta:$(B(P(),L()).nullish(),()=>void 0)}),GX=P(),KX=z({connectionId:GX,method:P(),params:B(P(),L()).nullish(),_meta:$(B(P(),L()).nullish(),()=>void 0)}),qX=z({connectionId:GX,_meta:$(B(P(),L()).nullish(),()=>void 0)}),JX=L();z({id:qY,method:P(),params:So([YY,XY,_X,yX,bX,xX,SX,CX,HX,WX,KX,qX,JX]).nullish()});const YX=_o().gte(0).lte(65535),XX=z({image:$(I().optional().default(!1),()=>!1),audio:$(I().optional().default(!1),()=>!1),embeddedContext:$(I().optional().default(!1),()=>!1),_meta:$(B(P(),L()).nullish(),()=>void 0)}),ZX=z({http:$(I().optional().default(!1),()=>!1),sse:$(I().optional().default(!1),()=>!1),acp:$(I().optional().default(!1),()=>!1),_meta:$(B(P(),L()).nullish(),()=>void 0)}),QX=z({_meta:$(B(P(),L()).nullish(),()=>void 0)}),$X=z({_meta:$(B(P(),L()).nullish(),()=>void 0)}),eZ=z({_meta:$(B(P(),L()).nullish(),()=>void 0)}),tZ=z({_meta:$(B(P(),L()).nullish(),()=>void 0)}),nZ=z({_meta:$(B(P(),L()).nullish(),()=>void 0)}),rZ=z({_meta:$(B(P(),L()).nullish(),()=>void 0)}),iZ=z({list:$(QX.nullish(),()=>void 0),delete:$($X.nullish(),()=>void 0),additionalDirectories:$(eZ.nullish(),()=>void 0),fork:$(tZ.nullish(),()=>void 0),resume:$(nZ.nullish(),()=>void 0),close:$(rZ.nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),aZ=z({logout:$(z({_meta:$(B(P(),L()).nullish(),()=>void 0)}).nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),oZ=z({_meta:$(B(P(),L()).nullish(),()=>void 0)}),sZ=z({_meta:$(B(P(),L()).nullish(),()=>void 0)}),cZ=z({syncKind:So([H(`full`),H(`incremental`)]),_meta:$(B(P(),L()).nullish(),()=>void 0)}),lZ=z({_meta:$(B(P(),L()).nullish(),()=>void 0)}),uZ=z({_meta:$(B(P(),L()).nullish(),()=>void 0)}),dZ=z({_meta:$(B(P(),L()).nullish(),()=>void 0)}),fZ=z({document:$(z({didOpen:$(sZ.nullish(),()=>void 0),didChange:$(cZ.nullish(),()=>void 0),didClose:$(lZ.nullish(),()=>void 0),didSave:$(uZ.nullish(),()=>void 0),didFocus:$(dZ.nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}).nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),pZ=z({maxCount:$(_o().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),mZ=z({_meta:$(B(P(),L()).nullish(),()=>void 0)}),hZ=z({maxCount:$(_o().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),gZ=z({maxCount:$(_o().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),_Z=z({_meta:$(B(P(),L()).nullish(),()=>void 0)}),vZ=z({_meta:$(B(P(),L()).nullish(),()=>void 0)}),yZ=z({recentFiles:$(pZ.nullish(),()=>void 0),relatedSnippets:$(mZ.nullish(),()=>void 0),editHistory:$(hZ.nullish(),()=>void 0),userActions:$(gZ.nullish(),()=>void 0),openFiles:$(_Z.nullish(),()=>void 0),diagnostics:$(vZ.nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),bZ=z({events:$(fZ.nullish(),()=>void 0),context:$(yZ.nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),xZ=So([H(`utf-16`),H(`utf-32`),H(`utf-8`)]),SZ=z({loadSession:$(I().optional().default(!1),()=>!1),promptCapabilities:$(XX.optional().default({image:!1,audio:!1,embeddedContext:!1}),()=>({image:!1,audio:!1,embeddedContext:!1})),mcpCapabilities:$(ZX.optional().default({http:!1,sse:!1,acp:!1}),()=>({http:!1,sse:!1,acp:!1})),sessionCapabilities:$(iZ.optional().default({}),()=>({})),auth:$(aZ.optional().default({}),()=>({})),providers:$(oZ.nullish(),()=>void 0),nes:$(bZ.nullish(),()=>void 0),positionEncoding:$(xZ.nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),CZ=P(),wZ=z({name:P(),label:$(P().nullish(),()=>void 0),secret:$(I().optional().default(!0),()=>!0),optional:$(I().optional().default(!1),()=>!1),_meta:$(B(P(),L()).nullish(),()=>void 0)}),TZ=z({id:CZ,name:P(),description:$(P().nullish(),()=>void 0),vars:HY(KY(wZ),()=>[]),link:$(P().nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),EZ=z({id:CZ,name:P(),description:$(P().nullish(),()=>void 0),args:$(KY(P()).optional(),()=>[]),env:$(B(P(),P()).optional(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),DZ=z({id:CZ,name:P(),description:$(P().nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),OZ=So([TZ.and(z({type:H(`env_var`)})),EZ.and(z({type:H(`terminal`)})),DZ]),kZ=z({name:P(),title:$(P().nullish(),()=>void 0),version:P(),_meta:$(B(P(),L()).nullish(),()=>void 0)}),AZ=z({protocolVersion:YX,agentCapabilities:$(SZ.optional().default({loadSession:!1,promptCapabilities:{image:!1,audio:!1,embeddedContext:!1},mcpCapabilities:{http:!1,sse:!1,acp:!1},sessionCapabilities:{},auth:{}}),()=>({loadSession:!1,promptCapabilities:{image:!1,audio:!1,embeddedContext:!1},mcpCapabilities:{http:!1,sse:!1,acp:!1},sessionCapabilities:{},auth:{}})),authMethods:$(KY(OZ).optional().default([]),()=>[]),agentInfo:$(kZ.nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),jZ=z({_meta:$(B(P(),L()).nullish(),()=>void 0)}),MZ=P(),NZ=So([H(`anthropic`),H(`openai`),H(`azure`),H(`vertex`),H(`bedrock`),P()]),PZ=z({apiType:NZ,baseUrl:P(),_meta:$(B(P(),L()).nullish(),()=>void 0)}),FZ=z({providers:R(z({providerId:MZ,supported:HY(KY(NZ),()=>[]),required:I(),current:PZ.nullish(),_meta:$(B(P(),L()).nullish(),()=>void 0)})),_meta:$(B(P(),L()).nullish(),()=>void 0)}),IZ=z({_meta:$(B(P(),L()).nullish(),()=>void 0)}),LZ=z({_meta:$(B(P(),L()).nullish(),()=>void 0)}),RZ=z({_meta:$(B(P(),L()).nullish(),()=>void 0)}),zZ=P(),BZ=z({currentModeId:zZ,availableModes:HY(KY(z({id:zZ,name:P(),description:$(P().nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)})),()=>[]),_meta:$(B(P(),L()).nullish(),()=>void 0)}),VZ=P(),HZ=So([H(`mode`),H(`model`),H(`model_config`),H(`thought_level`),P()]),UZ=P(),WZ=z({value:UZ,name:P(),description:$(P().nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),GZ=z({group:P(),name:P(),options:HY(KY(WZ),()=>[]),_meta:$(B(P(),L()).nullish(),()=>void 0)}),KZ=z({currentValue:UZ,options:So([R(WZ),R(GZ)])}),qZ=z({currentValue:I()}),JZ=wo(So([KZ.and(z({type:H(`select`)})),qZ.and(z({type:H(`boolean`)}))]),z({id:VZ,name:P(),description:$(P().nullish(),()=>void 0),category:$(HZ.nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)})),YZ=z({sessionId:JY,modes:$(BZ.nullish(),()=>void 0),configOptions:$(KY(JZ).nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),XZ=z({modes:$(BZ.nullish(),()=>void 0),configOptions:$(KY(JZ).nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),ZZ=z({sessions:HY(KY(z({sessionId:JY,cwd:P(),additionalDirectories:$(KY(P()).optional(),()=>[]),title:$(P().nullish(),()=>void 0),updatedAt:$(P().nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)})),()=>[]),nextCursor:$(P().nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),QZ=z({_meta:$(B(P(),L()).nullish(),()=>void 0)}),$Z=z({sessionId:JY,modes:$(BZ.nullish(),()=>void 0),configOptions:$(KY(JZ).nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),eQ=z({modes:$(BZ.nullish(),()=>void 0),configOptions:$(KY(JZ).nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),tQ=z({_meta:$(B(P(),L()).nullish(),()=>void 0)}),nQ=z({_meta:$(B(P(),L()).nullish(),()=>void 0)}),rQ=z({configOptions:HY(KY(JZ),()=>[]),_meta:$(B(P(),L()).nullish(),()=>void 0)}),iQ=z({stopReason:So([H(`end_turn`),H(`max_tokens`),H(`max_turn_requests`),H(`refusal`),H(`cancelled`)]),usage:$(z({totalTokens:F(),inputTokens:F(),outputTokens:F(),thoughtTokens:$(F().nullish(),()=>void 0),cachedReadTokens:$(F().nullish(),()=>void 0),cachedWriteTokens:$(F().nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}).nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),aQ=z({sessionId:JY,_meta:$(B(P(),L()).nullish(),()=>void 0)}),oQ=P(),sQ=z({line:_o().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}),character:_o().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}),_meta:$(B(P(),L()).nullish(),()=>void 0)}),cQ=z({start:sQ,end:sQ,_meta:$(B(P(),L()).nullish(),()=>void 0)}),lQ=z({range:cQ,newText:P(),_meta:$(B(P(),L()).nullish(),()=>void 0)}),uQ=z({id:oQ,uri:P(),edits:R(lQ),cursorPosition:$(sQ.nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),dQ=z({id:oQ,uri:P(),position:sQ,_meta:$(B(P(),L()).nullish(),()=>void 0)}),fQ=z({id:oQ,uri:P(),position:sQ,newName:P(),_meta:$(B(P(),L()).nullish(),()=>void 0)}),pQ=z({id:oQ,uri:P(),search:P(),replace:P(),isRegex:I().nullish(),_meta:$(B(P(),L()).nullish(),()=>void 0)}),mQ=z({suggestions:R(So([uQ.and(z({kind:H(`edit`)})),dQ.and(z({kind:H(`jump`)})),fQ.and(z({kind:H(`rename`)})),pQ.and(z({kind:H(`searchAndReplace`)}))])),_meta:$(B(P(),L()).nullish(),()=>void 0)}),hQ=z({_meta:$(B(P(),L()).nullish(),()=>void 0)}),gQ=L(),_Q=L(),vQ=z({code:So([H(-32700),H(-32600),H(-32601),H(-32602),H(-32603),H(-32800),H(-32e3),H(-32002),_o().min(-2147483648,{error:`Invalid value: Expected int32 to be >= -2147483648`}).max(2147483647,{error:`Invalid value: Expected int32 to be <= 2147483647`})]),message:P(),data:$(L().optional(),()=>void 0)});So([z({id:qY,result:So([AZ,jZ,FZ,IZ,LZ,RZ,YZ,XZ,ZZ,QZ,$Z,eQ,tQ,nQ,rQ,iQ,aQ,mQ,hQ,gQ,_Q])}),z({id:qY,error:vQ})]);const yQ=z({content:sX,messageId:$(P().nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),bQ=z({toolCallId:ZY,title:P(),kind:$(QY.optional(),()=>void 0),status:$($Y.optional(),()=>void 0),content:$(KY(fX).optional(),()=>[]),locations:$(KY(pX).optional(),()=>[]),rawInput:$(L().optional(),()=>void 0),rawOutput:$(L().optional(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),xQ=So([H(`high`),H(`medium`),H(`low`)]),SQ=So([H(`pending`),H(`in_progress`),H(`completed`)]),CQ=z({content:P(),priority:xQ,status:SQ,_meta:$(B(P(),L()).nullish(),()=>void 0)}),jde=z({entries:HY(KY(CQ),()=>[]),_meta:$(B(P(),L()).nullish(),()=>void 0)}),wQ=P(),Mde=z({planId:wQ,entries:HY(KY(CQ),()=>[]),_meta:$(B(P(),L()).nullish(),()=>void 0)}),Nde=z({planId:wQ,uri:P(),_meta:$(B(P(),L()).nullish(),()=>void 0)}),Pde=z({planId:wQ,content:P(),_meta:$(B(P(),L()).nullish(),()=>void 0)}),Fde=z({plan:So([Mde.and(z({type:H(`items`)})),Nde.and(z({type:H(`file`)})),Pde.and(z({type:H(`markdown`)}))]),_meta:$(B(P(),L()).nullish(),()=>void 0)}),Ide=z({planId:wQ,_meta:$(B(P(),L()).nullish(),()=>void 0)}),Lde=z({hint:P(),_meta:$(B(P(),L()).nullish(),()=>void 0)}),Rde=z({availableCommands:HY(KY(z({name:P(),description:P(),input:$(Lde.nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)})),()=>[]),_meta:$(B(P(),L()).nullish(),()=>void 0)}),zde=z({currentModeId:zZ,_meta:$(B(P(),L()).nullish(),()=>void 0)}),Bde=z({configOptions:HY(KY(JZ),()=>[]),_meta:$(B(P(),L()).nullish(),()=>void 0)}),Vde=z({title:$(P().nullish(),()=>void 0),updatedAt:$(P().nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),Hde=z({amount:F(),currency:P(),_meta:$(B(P(),L()).nullish(),()=>void 0)}),Ude=z({used:F(),size:F(),cost:$(Hde.nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),TQ=z({sessionId:JY,update:So([yQ.and(z({sessionUpdate:H(`user_message_chunk`)})),yQ.and(z({sessionUpdate:H(`agent_message_chunk`)})),yQ.and(z({sessionUpdate:H(`agent_thought_chunk`)})),bQ.and(z({sessionUpdate:H(`tool_call`)})),mX.and(z({sessionUpdate:H(`tool_call_update`)})),jde.and(z({sessionUpdate:H(`plan`)})),Fde.and(z({sessionUpdate:H(`plan_update`)})),Ide.and(z({sessionUpdate:H(`plan_removed`)})),Rde.and(z({sessionUpdate:H(`available_commands_update`)})),zde.and(z({sessionUpdate:H(`current_mode_update`)})),Bde.and(z({sessionUpdate:H(`config_option_update`)})),Vde.and(z({sessionUpdate:H(`session_info_update`)})),Ude.and(z({sessionUpdate:H(`usage_update`)}))]),_meta:$(B(P(),L()).nullish(),()=>void 0)}),EQ=z({elicitationId:BX,_meta:$(B(P(),L()).nullish(),()=>void 0)}),DQ=z({connectionId:GX,method:P(),params:$(B(P(),L()).nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),OQ=L();z({method:P(),params:So([TQ,EQ,DQ,OQ]).nullish()});const Wde=z({readTextFile:$(I().optional().default(!1),()=>!1),writeTextFile:$(I().optional().default(!1),()=>!1),_meta:$(B(P(),L()).nullish(),()=>void 0)}),Gde=z({configOptions:$(z({boolean:$(z({_meta:$(B(P(),L()).nullish(),()=>void 0)}).nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}).nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),Kde=z({_meta:$(B(P(),L()).nullish(),()=>void 0)}),qde=z({terminal:$(I().optional().default(!1),()=>!1),_meta:$(B(P(),L()).nullish(),()=>void 0)}),Jde=z({_meta:$(B(P(),L()).nullish(),()=>void 0)}),Yde=z({_meta:$(B(P(),L()).nullish(),()=>void 0)}),Xde=z({form:$(Jde.nullish(),()=>void 0),url:$(Yde.nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),Zde=z({_meta:$(B(P(),L()).nullish(),()=>void 0)}),Qde=z({_meta:$(B(P(),L()).nullish(),()=>void 0)}),$de=z({_meta:$(B(P(),L()).nullish(),()=>void 0)}),efe=z({jump:$(Zde.nullish(),()=>void 0),rename:$(Qde.nullish(),()=>void 0),searchAndReplace:$($de.nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),kQ=z({protocolVersion:YX,clientCapabilities:$(z({fs:$(Wde.optional().default({readTextFile:!1,writeTextFile:!1}),()=>({readTextFile:!1,writeTextFile:!1})),terminal:$(I().optional().default(!1),()=>!1),session:$(Gde.nullish(),()=>void 0),plan:$(Kde.nullish(),()=>void 0),auth:$(qde.optional().default({terminal:!1}),()=>({terminal:!1})),elicitation:$(Xde.nullish(),()=>void 0),nes:$(efe.nullish(),()=>void 0),positionEncodings:$(KY(xZ).optional(),()=>[]),_meta:$(B(P(),L()).nullish(),()=>void 0)}).optional().default({fs:{readTextFile:!1,writeTextFile:!1},terminal:!1,auth:{terminal:!1}}),()=>({fs:{readTextFile:!1,writeTextFile:!1},terminal:!1,auth:{terminal:!1}})),clientInfo:$(kZ.nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),AQ=z({methodId:CZ,_meta:$(B(P(),L()).nullish(),()=>void 0)}),jQ=z({_meta:$(B(P(),L()).nullish(),()=>void 0)}),MQ=z({providerId:MZ,apiType:NZ,baseUrl:P(),headers:B(P(),P()).optional(),_meta:$(B(P(),L()).nullish(),()=>void 0)}),NQ=z({providerId:MZ,_meta:$(B(P(),L()).nullish(),()=>void 0)}),PQ=z({_meta:$(B(P(),L()).nullish(),()=>void 0)}),FQ=z({name:P(),value:P(),_meta:$(B(P(),L()).nullish(),()=>void 0)}),tfe=z({name:P(),url:P(),headers:R(FQ),_meta:$(B(P(),L()).nullish(),()=>void 0)}),nfe=z({name:P(),url:P(),headers:R(FQ),_meta:$(B(P(),L()).nullish(),()=>void 0)}),rfe=z({name:P(),serverId:UX,_meta:$(B(P(),L()).nullish(),()=>void 0)}),ife=z({name:P(),command:P(),args:R(P()),env:R(vX),_meta:$(B(P(),L()).nullish(),()=>void 0)}),IQ=So([tfe.and(z({type:H(`http`)})),nfe.and(z({type:H(`sse`)})),rfe.and(z({type:H(`acp`)})),ife]),LQ=z({cwd:P(),additionalDirectories:$(KY(P()).optional(),()=>[]),mcpServers:HY(KY(IQ),()=>[]),_meta:$(B(P(),L()).nullish(),()=>void 0)}),RQ=z({mcpServers:HY(KY(IQ),()=>[]),cwd:P(),additionalDirectories:$(KY(P()).optional(),()=>[]),sessionId:JY,_meta:$(B(P(),L()).nullish(),()=>void 0)}),zQ=z({cwd:P().nullish(),cursor:P().nullish(),_meta:$(B(P(),L()).nullish(),()=>void 0)}),BQ=z({sessionId:JY,_meta:$(B(P(),L()).nullish(),()=>void 0)}),VQ=z({sessionId:JY,cwd:P(),additionalDirectories:$(KY(P()).optional(),()=>[]),mcpServers:$(KY(IQ).optional(),()=>[]),_meta:$(B(P(),L()).nullish(),()=>void 0)}),HQ=z({sessionId:JY,cwd:P(),additionalDirectories:$(KY(P()).optional(),()=>[]),mcpServers:$(KY(IQ).optional(),()=>[]),_meta:$(B(P(),L()).nullish(),()=>void 0)}),UQ=z({sessionId:JY,_meta:$(B(P(),L()).nullish(),()=>void 0)}),WQ=z({sessionId:JY,modeId:zZ,_meta:$(B(P(),L()).nullish(),()=>void 0)}),GQ=wo(So([z({value:I(),type:H(`boolean`)}),z({value:UZ})]),z({sessionId:JY,configId:VZ,_meta:$(B(P(),L()).nullish(),()=>void 0)})),KQ=z({sessionId:JY,prompt:R(sX),_meta:$(B(P(),L()).nullish(),()=>void 0)}),afe=z({uri:P(),name:P(),_meta:$(B(P(),L()).nullish(),()=>void 0)}),ofe=z({name:P(),owner:P(),remoteUrl:P(),_meta:$(B(P(),L()).nullish(),()=>void 0)}),qQ=z({workspaceUri:$(P().nullish(),()=>void 0),workspaceFolders:R(afe).nullish(),repository:$(ofe.nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),sfe=So([H(`automatic`),H(`diagnostic`),H(`manual`)]),cfe=z({uri:P(),languageId:P(),text:P(),_meta:$(B(P(),L()).nullish(),()=>void 0)}),lfe=z({startLine:_o().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}),endLine:_o().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}),text:P(),_meta:$(B(P(),L()).nullish(),()=>void 0)}),ufe=z({uri:P(),excerpts:R(lfe),_meta:$(B(P(),L()).nullish(),()=>void 0)}),dfe=z({uri:P(),diff:P(),_meta:$(B(P(),L()).nullish(),()=>void 0)}),ffe=z({action:P(),uri:P(),position:sQ,timestampMs:F(),_meta:$(B(P(),L()).nullish(),()=>void 0)}),pfe=z({uri:P(),languageId:P(),visibleRange:$(cQ.nullish(),()=>void 0),lastFocusedMs:$(F().nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),mfe=So([H(`error`),H(`warning`),H(`information`),H(`hint`)]),hfe=z({uri:P(),range:cQ,severity:mfe,message:P(),_meta:$(B(P(),L()).nullish(),()=>void 0)}),gfe=z({recentFiles:R(cfe).nullish(),relatedSnippets:R(ufe).nullish(),editHistory:R(dfe).nullish(),userActions:R(ffe).nullish(),openFiles:R(pfe).nullish(),diagnostics:R(hfe).nullish(),_meta:$(B(P(),L()).nullish(),()=>void 0)}),JQ=z({sessionId:JY,uri:P(),version:F(),position:sQ,selection:cQ.nullish(),triggerKind:sfe,context:gfe.nullish(),_meta:$(B(P(),L()).nullish(),()=>void 0)}),YQ=z({sessionId:JY,_meta:$(B(P(),L()).nullish(),()=>void 0)});z({id:qY,method:P(),params:So([kQ,AQ,jQ,MQ,NQ,PQ,LQ,RQ,zQ,BQ,VQ,HQ,UQ,WQ,GQ,KQ,qQ,JQ,YQ,KX,JX]).nullish()});const _fe=z({_meta:$(B(P(),L()).nullish(),()=>void 0)}),vfe=z({content:P(),_meta:$(B(P(),L()).nullish(),()=>void 0)}),yfe=z({optionId:hX,_meta:$(B(P(),L()).nullish(),()=>void 0)}),bfe=z({outcome:So([z({outcome:H(`cancelled`)}),yfe.and(z({outcome:H(`selected`)}))]),_meta:$(B(P(),L()).nullish(),()=>void 0)}),xfe=z({terminalId:uX,_meta:$(B(P(),L()).nullish(),()=>void 0)}),Sfe=z({exitCode:$(_o().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),()=>void 0),signal:$(P().nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),Cfe=z({output:P(),truncated:I(),exitStatus:$(Sfe.nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),wfe=z({_meta:$(B(P(),L()).nullish(),()=>void 0)}),Tfe=z({exitCode:$(_o().gte(0).max(4294967295,{error:`Invalid value: Expected uint32 to be <= 4294967295`}).nullish(),()=>void 0),signal:$(P().nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)}),Efe=z({_meta:$(B(P(),L()).nullish(),()=>void 0)}),Dfe=So([P(),F(),F(),I(),R(P())]),XQ=z({content:B(P(),Dfe).nullish()});So([z({id:qY,result:So([_fe,vfe,bfe,xfe,Cfe,wfe,Tfe,Efe,GY(wo(So([XQ.and(z({action:H(`accept`)})),z({action:H(`decline`)}),z({action:H(`cancel`)}),WY(z({action:P()}),`action`,[`accept`,`cancel`,`decline`])]),z({_meta:$(B(P(),L()).nullish(),()=>void 0)})),`action`,[`accept`,`cancel`,`decline`]),z({connectionId:GX,_meta:$(B(P(),L()).nullish(),()=>void 0)}),z({_meta:$(B(P(),L()).nullish(),()=>void 0)}),_Q,gQ])}),z({id:qY,error:vQ})]);const ZQ=z({sessionId:JY,_meta:$(B(P(),L()).nullish(),()=>void 0)}),QQ=z({sessionId:JY,uri:P(),languageId:P(),version:F(),text:P(),_meta:$(B(P(),L()).nullish(),()=>void 0)}),Ofe=z({range:cQ.nullish(),text:P(),_meta:$(B(P(),L()).nullish(),()=>void 0)}),$Q=z({sessionId:JY,uri:P(),version:F(),contentChanges:HY(KY(Ofe),()=>[]),_meta:$(B(P(),L()).nullish(),()=>void 0)}),e$=z({sessionId:JY,uri:P(),_meta:$(B(P(),L()).nullish(),()=>void 0)}),t$=z({sessionId:JY,uri:P(),_meta:$(B(P(),L()).nullish(),()=>void 0)}),n$=z({sessionId:JY,uri:P(),version:F(),position:sQ,visibleRange:cQ,_meta:$(B(P(),L()).nullish(),()=>void 0)}),r$=z({sessionId:JY,id:oQ,_meta:$(B(P(),L()).nullish(),()=>void 0)}),i$=z({sessionId:JY,id:oQ,reason:$(So([H(`rejected`),H(`ignored`),H(`replaced`),H(`cancelled`)]).nullish(),()=>void 0),_meta:$(B(P(),L()).nullish(),()=>void 0)});z({method:P(),params:So([ZQ,QQ,$Q,e$,t$,n$,r$,i$,DQ,OQ]).nullish()}),z({requestId:qY,_meta:$(B(P(),L()).nullish(),()=>void 0)}),zX.and(z({mode:H(`form`)})).and(z({message:P()})),VX.and(z({mode:H(`url`)})).and(z({message:P()})),So([wX,TX]).and(z({message:P()})),kX.and(z({type:H(`string`)})),AX.and(z({type:H(`number`)})),jX.and(z({type:H(`integer`)})),MX.and(z({type:H(`boolean`)})),IX.and(z({type:H(`array`)})),NX.and(z({type:H(`string`)})),XQ.and(z({action:H(`accept`)})),z({action:H(`decline`)}),z({action:H(`cancel`)});function a$(e){return e??{}}RY.initialize,RY.authenticate,RY.logout,RY.providers_list,RY.providers_set,RY.providers_disable,RY.session_new,RY.session_load,RY.session_list,RY.session_delete,RY.session_fork,RY.session_resume,RY.session_close,RY.session_set_mode,RY.session_set_config_option,RY.session_prompt,RY.session_cancel,RY.nes_start,RY.nes_suggest,RY.nes_accept,RY.nes_reject,RY.nes_close,RY.document_did_open,RY.document_did_change,RY.document_did_close,RY.document_did_save,RY.document_did_focus,zY.session_request_permission,zY.session_update,zY.fs_write_text_file,zY.fs_read_text_file,zY.terminal_create,zY.terminal_output,zY.terminal_release,zY.terminal_wait_for_exit,zY.terminal_kill,zY.elicitation_create,zY.elicitation_complete,BY.cancel_request;function o$(e,t,n){return{method:e,params:t,mapResponse:n}}function s$(e,t){return{method:e,params:t}}function c$(e){let t={};for(let n of Object.values(e))t[n.method]=n;return t}const kfe={initialize:o$(RY.initialize,kQ),newSession:o$(RY.session_new,LQ),loadSession:o$(RY.session_load,RQ,a$),unstable_forkSession:o$(RY.session_fork,VQ),listSessions:o$(RY.session_list,zQ),deleteSession:o$(RY.session_delete,BQ,a$),resumeSession:o$(RY.session_resume,HQ),closeSession:o$(RY.session_close,UQ,a$),setSessionMode:o$(RY.session_set_mode,WQ,a$),setSessionConfigOption:o$(RY.session_set_config_option,GQ),authenticate:o$(RY.authenticate,AQ,a$),unstable_listProviders:o$(RY.providers_list,jQ),unstable_setProvider:o$(RY.providers_set,MQ,a$),unstable_disableProvider:o$(RY.providers_disable,NQ,a$),logout:o$(RY.logout,PQ,a$),prompt:o$(RY.session_prompt,KQ),unstable_startNes:o$(RY.nes_start,qQ),unstable_suggestNes:o$(RY.nes_suggest,JQ),unstable_closeNes:o$(RY.nes_close,YQ,a$)},Afe={cancel:s$(RY.session_cancel,ZQ),unstable_didOpenDocument:s$(RY.document_did_open,QQ),unstable_didChangeDocument:s$(RY.document_did_change,$Q),unstable_didCloseDocument:s$(RY.document_did_close,e$),unstable_didSaveDocument:s$(RY.document_did_save,t$),unstable_didFocusDocument:s$(RY.document_did_focus,n$),unstable_acceptNes:s$(RY.nes_accept,r$),unstable_rejectNes:s$(RY.nes_reject,i$)},jfe={requestPermission:o$(zY.session_request_permission,_X),writeTextFile:o$(zY.fs_write_text_file,YY,a$),readTextFile:o$(zY.fs_read_text_file,XY),createTerminal:o$(zY.terminal_create,yX),terminalOutput:o$(zY.terminal_output,bX),releaseTerminal:o$(zY.terminal_release,xX,a$),waitForTerminalExit:o$(zY.terminal_wait_for_exit,SX),killTerminal:o$(zY.terminal_kill,CX,a$),unstable_createElicitation:o$(zY.elicitation_create,HX)},Mfe={sessionUpdate:s$(zY.session_update,TQ),unstable_completeElicitation:s$(zY.elicitation_complete,EQ)};c$(kfe),c$(Afe),c$(jfe),c$(Mfe),new Set([RY.initialize,RY.authenticate,RY.providers_list,RY.providers_set,RY.providers_disable,RY.session_new,RY.session_load,RY.session_set_mode,RY.session_set_config_option,RY.session_prompt,RY.session_list,RY.session_delete,RY.session_fork,RY.session_resume,RY.session_close,RY.logout,RY.nes_start,RY.nes_suggest,RY.nes_close]),new Set([RY.session_cancel,RY.nes_accept,RY.nes_reject,RY.document_did_open,RY.document_did_change,RY.document_did_close,RY.document_did_save,RY.document_did_focus]),new Set([zY.session_request_permission,zY.fs_write_text_file,zY.fs_read_text_file,zY.terminal_create,zY.terminal_output,zY.terminal_release,zY.terminal_wait_for_exit,zY.terminal_kill,zY.elicitation_create]),new Set([zY.session_update,zY.elicitation_complete]),new RB({extensions:_w,deriveStructuralFreshness:!0}),ev(_w);function Nfe(e,t,n,r){return e.success?{code:`UNKNOWN`,message:`unexpected success in error path`}:{code:`SCHEMA_INVALID`,issues:e.error.issues.map(e=>{let i=e.path.map(e=>typeof e==`symbol`?String(e):e),a=sl({file:r,source:n,doc:t,path:i});return{path:i,message:e.message,issueCode:e.code,...a===void 0?{}:{source:a}}})}}function l$(e,t,n){let r=`${e}.invalid-${t.replace(/[:.]/g,`-`)}`;try{return E(e,r),r}catch(t){n(`[config] Could not sideline invalid config file ${e} → ${r}: ${t instanceof Error?t.message:String(t)}. File left in place; using schema defaults.`);return}}function Pfe(e){let{absPath:t,sideline:n=!0,timestamp:r=new Date().toISOString()}=e,i=e.warn??(e=>console.warn(e)),a=Ts.parse({});if(!g(t))return{valid:!0,value:a,source:void 0,diagnostics:[]};let o;try{o=S(t,`utf-8`)}catch(e){let n=e instanceof Error?e.message:String(e);i(`[config] Could not read ${t}: ${n}. Using schema defaults.`);let r={code:`UNREADABLE`,detail:n};return{valid:!1,value:a,error:r,diagnostics:[{...r}]}}let s=(0,Zt.parseDocument)(o);if(s.errors.length>0){let e=s.errors.map(e=>e.message).join(`; `);i(`[config] ${t} contains invalid YAML (${e}). Using schema defaults.`+(n?``:` Pass-through mode: file left in place.`));let o=n?l$(t,r,i):void 0,c={code:`YAML_PARSE`,detail:e};return{valid:!1,value:a,error:c,diagnostics:[{...c}],...o===void 0?{}:{sidelinedTo:o}}}let c=s.toJSON()??{},l=fl({value:c,file:t,source:o,doc:s}),u=l.length>0?ml(c):c,d=Ts.safeParse(u);if(!d.success){let e=Nfe(d,s,o,t);i(`[config] ${t} fails schema validation (${d.error.issues.length} issue(s)). Using schema defaults.`+(n?``:` Pass-through mode: file left in place.`));let c=n?l$(t,r,i):void 0;return{valid:!1,value:a,error:e,diagnostics:[...l,...el(e)&&e.code===`SCHEMA_INVALID`?[{...e}]:[]],...c===void 0?{}:{sidelinedTo:c}}}return{valid:!0,value:d.data,source:t,diagnostics:l}}function Ffe(e){try{let t=me(e),n=`${pe(e)}.tmp.`,r=Date.now()-3e4;for(let e of C(t)){if(!e.startsWith(n))continue;let i=M(t,e);try{ee(i).mtimeMs<r&&te(i)}catch{}}}catch{}}function u$(e,t,n={}){Ffe(e);let r=`${e}.tmp.${crypto.randomUUID()}`;try{ne(r,t,{encoding:`utf-8`,mode:n.mode??420}),E(r,e)}catch(e){try{te(r)}catch{}throw e}}var Ife=class extends Error{code=`LOCK_TIMEOUT`;lockPath;timeoutMs;constructor(e,t){super(`Could not acquire file lock at ${e} within ${t}ms`),this.name=`FileLockTimeoutError`,this.lockPath=e,this.timeoutMs=t}};function Lfe(e){let t=Date.now()+e;for(;Date.now()<t;);}function d$(e,t,n={}){let r=n.timeoutMs??5e3,i=n.retryIntervalMs??25,a=r*2,o=Date.now()+r;for(;;){let s;try{s=b(e,`wx`,384)}catch(t){if(t.code!==`EEXIST`)throw t;let s;try{let t=ee(e);s=Date.now()-t.mtimeMs}catch{continue}let c=!1;if(s>a){n.onWarn?.(`cleared stale file lock`,{lockPath:e,ageMs:s,staleThresholdMs:a});try{te(e),c=!0}catch{}}if(c)continue;if(Date.now()>=o)throw new Ife(e,r);Lfe(i);continue}try{return t()}finally{try{p(s)}catch{}try{te(e)}catch{}}}}const f$=`config.yml`;function p$(e,t,n){if(e===`user`)return ye(n??se(),`.ok`,`global.yml`);let r=j(t)?t:ye(t);return e===`project-local`?ye(r,`.ok`,jl,f$):ye(r,`.ok`,f$)}var m$=i(((e,t)=>{let n=e=>e&&typeof e.message==`string`,r=e=>{if(!e)return;let t=e.cause;if(typeof t==`function`){let t=e.cause();return n(t)?t:void 0}else return n(t)?t:void 0},i=(e,t)=>{if(!n(e))return``;let a=e.stack||``;if(t.has(e))return a+`
414
414
  causes have become circular...`;let o=r(e);return o?(t.add(e),a+`
415
- caused by: `+i(o,t)):a},a=e=>i(e,new Set),o=(e,t,i)=>{if(!n(e))return``;let a=i?``:e.message||``;if(t.has(e))return a+`: ...`;let s=r(e);if(s){t.add(e);let n=typeof e.cause==`function`;return a+(n?``:`: `)+o(s,t,n)}else return a};t.exports={isErrorLike:n,getErrorCause:r,stackWithCauses:a,messageWithCauses:e=>o(e,new Set)}})),h$=i(((e,t)=>{let n=Symbol(`circular-ref-tag`),r=Symbol(`pino-raw-err-ref`),i=Object.create({},{type:{enumerable:!0,writable:!0,value:void 0},message:{enumerable:!0,writable:!0,value:void 0},stack:{enumerable:!0,writable:!0,value:void 0},aggregateErrors:{enumerable:!0,writable:!0,value:void 0},raw:{enumerable:!1,get:function(){return this[r]},set:function(e){this[r]=e}}});Object.defineProperty(i,r,{writable:!0,value:{}}),t.exports={pinoErrProto:i,pinoErrorSymbols:{seen:n,rawSymbol:r}}})),Lfe=i(((e,t)=>{t.exports=l;let{messageWithCauses:n,stackWithCauses:r,isErrorLike:i}=m$(),{pinoErrProto:a,pinoErrorSymbols:o}=h$(),{seen:s}=o,{toString:c}=Object.prototype;function l(e){if(!i(e))return e;e[s]=void 0;let t=Object.create(a);t.type=c.call(e.constructor)===`[object Function]`?e.constructor.name:e.name,t.message=n(e),t.stack=r(e),Array.isArray(e.errors)&&(t.aggregateErrors=e.errors.map(e=>l(e)));for(let n in e)if(t[n]===void 0){let r=e[n];i(r)?n!==`cause`&&!Object.prototype.hasOwnProperty.call(r,s)&&(t[n]=l(r)):t[n]=r}return delete e[s],t.raw=e,t}})),Rfe=i(((e,t)=>{t.exports=s;let{isErrorLike:n}=m$(),{pinoErrProto:r,pinoErrorSymbols:i}=h$(),{seen:a}=i,{toString:o}=Object.prototype;function s(e){if(!n(e))return e;e[a]=void 0;let t=Object.create(r);t.type=o.call(e.constructor)===`[object Function]`?e.constructor.name:e.name,t.message=e.message,t.stack=e.stack,Array.isArray(e.errors)&&(t.aggregateErrors=e.errors.map(e=>s(e))),n(e.cause)&&!Object.prototype.hasOwnProperty.call(e.cause,a)&&(t.cause=s(e.cause));for(let r in e)if(t[r]===void 0){let i=e[r];n(i)?Object.prototype.hasOwnProperty.call(i,a)||(t[r]=s(i)):t[r]=i}return delete e[a],t.raw=e,t}})),zfe=i(((e,t)=>{t.exports={mapHttpRequest:a,reqSerializer:i};let n=Symbol(`pino-raw-req-ref`),r=Object.create({},{id:{enumerable:!0,writable:!0,value:``},method:{enumerable:!0,writable:!0,value:``},url:{enumerable:!0,writable:!0,value:``},query:{enumerable:!0,writable:!0,value:``},params:{enumerable:!0,writable:!0,value:``},headers:{enumerable:!0,writable:!0,value:{}},remoteAddress:{enumerable:!0,writable:!0,value:``},remotePort:{enumerable:!0,writable:!0,value:``},raw:{enumerable:!1,get:function(){return this[n]},set:function(e){this[n]=e}}});Object.defineProperty(r,n,{writable:!0,value:{}});function i(e){let t=e.info||e.socket,n=Object.create(r);if(n.id=typeof e.id==`function`?e.id():e.id||(e.info?e.info.id:void 0),n.method=e.method,e.originalUrl)n.url=e.originalUrl;else{let t=e.path;n.url=typeof t==`string`?t:e.url?e.url.path||e.url:void 0}return e.query&&(n.query=e.query),e.params&&(n.params=e.params),n.headers=e.headers,n.remoteAddress=t&&t.remoteAddress,n.remotePort=t&&t.remotePort,n.raw=e.raw||e,n}function a(e){return{req:i(e)}}})),Bfe=i(((e,t)=>{t.exports={mapHttpResponse:a,resSerializer:i};let n=Symbol(`pino-raw-res-ref`),r=Object.create({},{statusCode:{enumerable:!0,writable:!0,value:0},headers:{enumerable:!0,writable:!0,value:``},raw:{enumerable:!1,get:function(){return this[n]},set:function(e){this[n]=e}}});Object.defineProperty(r,n,{writable:!0,value:{}});function i(e){let t=Object.create(r);return t.statusCode=e.headersSent?e.statusCode:null,t.headers=e.getHeaders?e.getHeaders():e._headers,t.raw=e,t}function a(e){return{res:i(e)}}})),g$=i(((e,t)=>{let n=Lfe(),r=Rfe(),i=zfe(),a=Bfe();t.exports={err:n,errWithCause:r,mapHttpRequest:i.mapHttpRequest,mapHttpResponse:a.mapHttpResponse,req:i.reqSerializer,res:a.resSerializer,wrapErrorSerializer:function(e){return e===n?e:function(t){return e(n(t))}},wrapRequestSerializer:function(e){return e===i.reqSerializer?e:function(t){return e(i.reqSerializer(t))}},wrapResponseSerializer:function(e){return e===a.resSerializer?e:function(t){return e(a.resSerializer(t))}}}})),_$=i(((e,t)=>{function n(e,t){return t}t.exports=function(){let e=Error.prepareStackTrace;Error.prepareStackTrace=n;let t=Error().stack;if(Error.prepareStackTrace=e,!Array.isArray(t))return;let r=t.slice(2),i=[];for(let e of r)e&&i.push(e.getFileName());return i}})),Vfe=i(((e,t)=>{function n(e){if(typeof e!=`object`||!e)return e;if(e instanceof Date)return new Date(e.getTime());if(e instanceof Array){let t=[];for(let r=0;r<e.length;r++)t[r]=n(e[r]);return t}if(typeof e==`object`){let t=Object.create(Object.getPrototypeOf(e));for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=n(e[r]));return t}return e}function r(e){let t=[],n=``,r=!1,i=!1,a=``;for(let o=0;o<e.length;o++){let s=e[o];!r&&s===`.`?n&&=(t.push(n),``):s===`[`?(n&&=(t.push(n),``),r=!0):s===`]`&&r?(t.push(n),n=``,r=!1,i=!1):(s===`"`||s===`'`)&&r?i?s===a?(i=!1,a=``):n+=s:(i=!0,a=s):n+=s}return n&&t.push(n),t}function i(e,t,n){let r=e;for(let e=0;e<t.length-1;e++){let n=t[e];if(typeof r!=`object`||!r||!(n in r)||typeof r[n]!=`object`||r[n]===null)return!1;r=r[n]}let i=t[t.length-1];if(i===`*`){if(Array.isArray(r))for(let e=0;e<r.length;e++)r[e]=n;else if(typeof r==`object`&&r)for(let e in r)Object.prototype.hasOwnProperty.call(r,e)&&(r[e]=n)}else typeof r==`object`&&r&&i in r&&Object.prototype.hasOwnProperty.call(r,i)&&(r[i]=n);return!0}function a(e,t){let n=e;for(let e=0;e<t.length-1;e++){let r=t[e];if(typeof n!=`object`||!n||!(r in n)||typeof n[r]!=`object`||n[r]===null)return!1;n=n[r]}let r=t[t.length-1];if(r===`*`){if(Array.isArray(n))for(let e=0;e<n.length;e++)n[e]=void 0;else if(typeof n==`object`&&n)for(let e in n)Object.prototype.hasOwnProperty.call(n,e)&&delete n[e]}else typeof n==`object`&&n&&r in n&&Object.prototype.hasOwnProperty.call(n,r)&&delete n[r];return!0}let o=Symbol(`PATH_NOT_FOUND`);function s(e,t){let n=e;for(let e of t){if(typeof n!=`object`||!n||!n||!(e in n))return o;n=n[e]}return n}function c(e,t){let n=e;for(let e of t){if(typeof n!=`object`||!n||!n)return;n=n[e]}return n}function l(e,t,n,c=!1){for(let l of t){let t=r(l);if(t.includes(`*`))u(e,t,n,l,c);else if(c)a(e,t);else{let r=s(e,t);if(r===o)continue;i(e,t,typeof n==`function`?n(r,t):n)}}}function u(e,t,n,r,i=!1){let a=t.indexOf(`*`);if(a===t.length-1){let r=t.slice(0,-1),a=e;for(let e of r){if(typeof a!=`object`||!a||!a)return;a=a[e]}if(Array.isArray(a))if(i)for(let e=0;e<a.length;e++)a[e]=void 0;else for(let e=0;e<a.length;e++){let t=[...r,e.toString()],i=typeof n==`function`?n(a[e],t):n;a[e]=i}else if(typeof a==`object`&&a)if(i){let e=[];for(let t in a)Object.prototype.hasOwnProperty.call(a,t)&&e.push(t);for(let t of e)delete a[t]}else for(let e in a){let t=[...r,e],i=typeof n==`function`?n(a[e],t):n;a[e]=i}}else d(e,t,n,a,r,i)}function d(e,t,n,r,o,s=!1){let l=t.slice(0,r),d=t.slice(r+1),f=[];function p(e,t){if(t===l.length){if(Array.isArray(e))for(let n=0;n<e.length;n++)f[t]=n.toString(),p(e[n],t+1);else if(typeof e==`object`&&e)for(let n in e)f[t]=n,p(e[n],t+1)}else if(t<l.length){let n=l[t];e&&typeof e==`object`&&e&&n in e&&(f[t]=n,p(e[n],t+1))}else d.includes(`*`)?u(e,d,typeof n==`function`?(e,r)=>n(e,[...f.slice(0,t),...r]):n,o,s):s?a(e,d):i(e,d,typeof n==`function`?n(c(e,d),[...f.slice(0,t),...d]):n)}if(l.length===0)p(e,0);else{let t=e;for(let e=0;e<l.length;e++){let n=l[e];if(typeof t!=`object`||!t||!t)return;t=t[n],f[e]=n}t!=null&&p(t,l.length)}}function f(e){if(e.length===0)return null;let t=new Map;for(let n of e){let e=r(n),i=t;for(let t=0;t<e.length;t++){let n=e[t];i.has(n)||i.set(n,new Map),i=i.get(n)}}return t}function p(e,t){if(!t)return e;function n(e,t,r=0){if(!t||t.size===0||typeof e!=`object`||!e)return e;if(e instanceof Date)return new Date(e.getTime());if(Array.isArray(e)){let r=[];for(let i=0;i<e.length;i++){let a=i.toString();t.has(a)||t.has(`*`)?r[i]=n(e[i],t.get(a)||t.get(`*`)):r[i]=e[i]}return r}let i=Object.create(Object.getPrototypeOf(e));for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t.has(r)||t.has(`*`)?i[r]=n(e[r],t.get(r)||t.get(`*`)):i[r]=e[r]);return i}return n(e,t)}function m(e){if(typeof e!=`string`)throw Error(`Paths must be (non-empty) strings`);if(e===``)throw Error(`Invalid redaction path ()`);if(e.includes(`..`)||e.includes(`,`))throw Error(`Invalid redaction path (${e})`);let t=0,n=!1,r=``;for(let i=0;i<e.length;i++){let a=e[i];if((a===`"`||a===`'`)&&t>0)n?a===r&&(n=!1,r=``):(n=!0,r=a);else if(a===`[`&&!n)t++;else if(a===`]`&&!n&&(t--,t<0))throw Error(`Invalid redaction path (${e})`)}if(t!==0)throw Error(`Invalid redaction path (${e})`)}function h(e){if(!Array.isArray(e))throw TypeError(`paths must be an array`);for(let t of e)m(t)}function g(e={}){let{paths:t=[],censor:r=`[REDACTED]`,serialize:i=JSON.stringify,strict:a=!0,remove:o=!1}=e;h(t);let s=f(t);return function(e){if(a&&(typeof e!=`object`||!e)&&(typeof e!=`object`||!e))return i?i(e):e;let c=p(e,s),u=e,d=r;return typeof r==`function`&&(d=r),l(c,t,d,o),i===!1?(c.restore=function(){return n(u)},c):typeof i==`function`?i(c):JSON.stringify(c)}}t.exports=g})),v$=i(((e,t)=>{let n=Symbol(`pino.setLevel`),r=Symbol(`pino.getLevel`),i=Symbol(`pino.levelVal`),a=Symbol(`pino.levelComp`),o=Symbol(`pino.useLevelLabels`),s=Symbol(`pino.useOnlyCustomLevels`),c=Symbol(`pino.mixin`),l=Symbol(`pino.lsCache`),u=Symbol(`pino.chindings`),d=Symbol(`pino.asJson`),f=Symbol(`pino.write`),p=Symbol(`pino.redactFmt`),m=Symbol(`pino.time`),h=Symbol(`pino.timeSliceIndex`),g=Symbol(`pino.stream`),_=Symbol(`pino.stringify`),v=Symbol(`pino.stringifySafe`),y=Symbol(`pino.stringifiers`),b=Symbol(`pino.end`),x=Symbol(`pino.formatOpts`),S=Symbol(`pino.messageKey`),C=Symbol(`pino.errorKey`),w=Symbol(`pino.nestedKey`),T=Symbol(`pino.nestedKeyStr`),E=Symbol(`pino.mixinMergeStrategy`),D=Symbol(`pino.msgPrefix`),ee=Symbol(`pino.wildcardFirst`),te=Symbol.for(`pino.serializers`),ne=Symbol.for(`pino.formatters`),re=Symbol.for(`pino.hooks`);t.exports={setLevelSym:n,getLevelSym:r,levelValSym:i,levelCompSym:a,useLevelLabelsSym:o,mixinSym:c,lsCacheSym:l,chindingsSym:u,asJsonSym:d,writeSym:f,serializersSym:te,redactFmtSym:p,timeSym:m,timeSliceIndexSym:h,streamSym:g,stringifySym:_,stringifySafeSym:v,stringifiersSym:y,endSym:b,formatOptsSym:x,messageKeySym:S,errorKeySym:C,nestedKeySym:w,wildcardFirstSym:ee,needsMetadataGsym:Symbol.for(`pino.metadata`),useOnlyCustomLevelsSym:s,formattersSym:ne,hooksSym:re,nestedKeyStrSym:T,mixinMergeStrategySym:E,msgPrefixSym:D}})),y$=i(((e,t)=>{let n=Vfe(),{redactFmtSym:r,wildcardFirstSym:i}=v$(),a=/[^.[\]]+|\[([^[\]]*?)\]/g,o=`[Redacted]`;function s(e,t){let{paths:o,censor:s,remove:l}=c(e),u=o.reduce((e,t)=>{a.lastIndex=0;let n=a.exec(t),r=a.exec(t),o=n[1]===void 0?n[0]:n[1].replace(/^(?:"|'|`)(.*)(?:"|'|`)$/,`$1`);if(o===`*`&&(o=i),r===null)return e[o]=null,e;if(e[o]===null)return e;let{index:s}=r,c=`${t.substr(s,t.length-1)}`;return e[o]=e[o]||[],o!==i&&e[o].length===0&&e[o].push(...e[i]||[]),o===i&&Object.keys(e).forEach(function(t){e[t]&&e[t].push(c)}),e[o].push(c),e},{}),d={[r]:n({paths:o,censor:s,serialize:t,strict:!1,remove:l})},f=(...e)=>t(typeof s==`function`?s(...e):s);return[...Object.keys(u),...Object.getOwnPropertySymbols(u)].reduce((e,r)=>{if(u[r]===null)e[r]=e=>f(e,[r]);else{let i=typeof s==`function`?(e,t)=>s(e,[r,...t]):s;e[r]=n({paths:u[r],censor:i,serialize:t,strict:!1,remove:l})}return e},d)}function c(e){if(Array.isArray(e))return e={paths:e,censor:o},e;let{paths:t,censor:n=o,remove:r}=e;if(Array.isArray(t)===!1)throw Error(`pino – redact must contain an array of strings`);return r===!0&&(n=void 0),{paths:t,censor:n,remove:r}}t.exports=s})),Hfe=i(((e,t)=>{let n=()=>``,r=()=>`,"time":${Date.now()}`,i=()=>`,"time":${Math.round(Date.now()/1e3)}`,a=()=>`,"time":"${new Date(Date.now()).toISOString()}"`,o=1000000000n,s=BigInt(Date.now())*1000000n,c=process.hrtime.bigint();t.exports={nullTime:n,epochTime:r,unixTime:i,isoTime:a,isoTimeNano:()=>{let e=s+(process.hrtime.bigint()-c),t=e/o,n=e%o,r=Number(t*1000n+n/1000000n),i=new Date(r);return`,"time":"${i.getUTCFullYear()}-${(i.getUTCMonth()+1).toString().padStart(2,`0`)}-${i.getUTCDate().toString().padStart(2,`0`)}T${i.getUTCHours().toString().padStart(2,`0`)}:${i.getUTCMinutes().toString().padStart(2,`0`)}:${i.getUTCSeconds().toString().padStart(2,`0`)}.${n.toString().padStart(9,`0`)}Z"`}}})),Ufe=i(((e,t)=>{function n(e){try{return JSON.stringify(e)}catch{return`"[Circular]"`}}t.exports=r;function r(e,t,r){var i=r&&r.stringify||n,a=1;if(typeof e==`object`&&e){var o=t.length+a;if(o===1)return e;var s=Array(o);s[0]=i(e);for(var c=1;c<o;c++)s[c]=i(t[c]);return s.join(` `)}if(typeof e!=`string`)return e;var l=t.length;if(l===0)return e;for(var u=``,d=1-a,f=-1,p=e&&e.length||0,m=0;m<p;){if(e.charCodeAt(m)===37&&m+1<p){switch(f=f>-1?f:0,e.charCodeAt(m+1)){case 100:case 102:if(d>=l||t[d]==null)break;f<m&&(u+=e.slice(f,m)),u+=Number(t[d]),f=m+2,m++;break;case 105:if(d>=l||t[d]==null)break;f<m&&(u+=e.slice(f,m)),u+=Math.floor(Number(t[d])),f=m+2,m++;break;case 79:case 111:case 106:if(d>=l||t[d]===void 0)break;f<m&&(u+=e.slice(f,m));var h=typeof t[d];if(h===`string`){u+=`'`+t[d]+`'`,f=m+2,m++;break}if(h===`function`){u+=t[d].name||`<anonymous>`,f=m+2,m++;break}u+=i(t[d]),f=m+2,m++;break;case 115:if(d>=l)break;f<m&&(u+=e.slice(f,m)),u+=String(t[d]),f=m+2,m++;break;case 37:f<m&&(u+=e.slice(f,m)),u+=`%`,f=m+2,m++,d--;break}++d}++m}return f===-1?e:(f<p&&(u+=e.slice(f)),u)}})),b$=i(((e,t)=>{if(typeof SharedArrayBuffer<`u`&&typeof Atomics<`u`){let e=new Int32Array(new SharedArrayBuffer(4));function n(t){if(!(t>0&&t<1/0))throw typeof t!=`number`&&typeof t!=`bigint`?TypeError(`sleep: ms must be a number`):RangeError(`sleep: ms must be a number that is greater than 0 but less than Infinity`);Atomics.wait(e,0,0,Number(t))}t.exports=n}else{function e(e){if(!(e>0&&e<1/0))throw typeof e!=`number`&&typeof e!=`bigint`?TypeError(`sleep: ms must be a number`):RangeError(`sleep: ms must be a number that is greater than 0 but less than Infinity`);let t=Date.now()+Number(e);for(;t>Date.now(););}t.exports=e}})),x$=i(((e,n)=>{let r=t(`fs`),i=t(`events`),a=t(`util`).inherits,o=t(`path`),s=b$(),c=t(`assert`),l=Buffer.allocUnsafe(0),u=`buffer`,d=`utf8`,[f,p]=(process.versions.node||`0.0`).split(`.`).map(Number),m=f>=22&&p>=7;function h(e,t){t._opening=!0,t._writing=!0,t._asyncDrainScheduled=!1;function n(n,r){if(n){t._reopening=!1,t._writing=!1,t._opening=!1,t.sync?process.nextTick(()=>{t.listenerCount(`error`)>0&&t.emit(`error`,n)}):t.emit(`error`,n);return}let i=t._reopening;t.fd=r,t.file=e,t._reopening=!1,t._opening=!1,t._writing=!1,t.sync?process.nextTick(()=>t.emit(`ready`)):t.emit(`ready`),!t.destroyed&&(!t._writing&&t._len>t.minLength||t._flushPending?t._actualWrite():i&&process.nextTick(()=>t.emit(`drain`)))}let i=t.append?`a`:`w`,a=t.mode;if(t.sync)try{t.mkdir&&r.mkdirSync(o.dirname(e),{recursive:!0}),n(null,r.openSync(e,i,a))}catch(e){throw n(e),e}else t.mkdir?r.mkdir(o.dirname(e),{recursive:!0},t=>{if(t)return n(t);r.open(e,i,a,n)}):r.open(e,i,a,n)}function g(e){if(!(this instanceof g))return new g(e);let{fd:t,dest:n,minLength:i,maxLength:a,maxWrite:o,periodicFlush:c,sync:f,append:p=!0,mkdir:m,retryEAGAIN:y,fsync:S,contentMode:ne,mode:re}=e||{};t||=n,this._len=0,this.fd=-1,this._bufs=[],this._lens=[],this._writing=!1,this._ending=!1,this._reopening=!1,this._asyncDrainScheduled=!1,this._flushPending=!1,this._hwm=Math.max(i||0,16387),this.file=null,this.destroyed=!1,this.minLength=i||0,this.maxLength=a||0,this.maxWrite=o||16384,this._periodicFlush=c||0,this._periodicFlushTimer=void 0,this.sync=f||!1,this.writable=!0,this._fsync=S||!1,this.append=p||!1,this.mode=re,this.retryEAGAIN=y||(()=>!0),this.mkdir=m||!1;let ie,ae;if(ne===u)this._writingBuf=l,this.write=x,this.flush=w,this.flushSync=E,this._actualWrite=ee,ie=()=>r.writeSync(this.fd,this._writingBuf),ae=()=>r.write(this.fd,this._writingBuf,this.release);else if(ne===void 0||ne===d)this._writingBuf=``,this.write=b,this.flush=C,this.flushSync=T,this._actualWrite=D,ie=()=>Buffer.isBuffer(this._writingBuf)?r.writeSync(this.fd,this._writingBuf):r.writeSync(this.fd,this._writingBuf,`utf8`),ae=()=>Buffer.isBuffer(this._writingBuf)?r.write(this.fd,this._writingBuf,this.release):r.write(this.fd,this._writingBuf,`utf8`,this.release);else throw Error(`SonicBoom supports "${d}" and "${u}", but passed ${ne}`);if(typeof t==`number`)this.fd=t,process.nextTick(()=>this.emit(`ready`));else if(typeof t==`string`)h(t,this);else throw Error(`SonicBoom supports only file descriptors and files`);if(this.minLength>=this.maxWrite)throw Error(`minLength should be smaller than maxWrite (${this.maxWrite})`);this.release=(e,t)=>{if(e){if((e.code===`EAGAIN`||e.code===`EBUSY`)&&this.retryEAGAIN(e,this._writingBuf.length,this._len-this._writingBuf.length))if(this.sync)try{s(100),this.release(void 0,0)}catch(e){this.release(e)}else setTimeout(ae,100);else this._writing=!1,this.emit(`error`,e);return}this.emit(`write`,t);let n=_(this._writingBuf,this._len,t);if(this._len=n.len,this._writingBuf=n.writingBuf,this._writingBuf.length){if(!this.sync){ae();return}try{do{let e=ie(),t=_(this._writingBuf,this._len,e);this._len=t.len,this._writingBuf=t.writingBuf}while(this._writingBuf.length)}catch(e){this.release(e);return}}this._fsync&&r.fsyncSync(this.fd);let i=this._len;this._reopening?(this._writing=!1,this._reopening=!1,this.reopen()):i>this.minLength?this._actualWrite():this._ending?i>0?this._actualWrite():(this._writing=!1,te(this)):(this._writing=!1,this.sync?this._asyncDrainScheduled||(this._asyncDrainScheduled=!0,process.nextTick(v,this)):this.emit(`drain`))},this.on(`newListener`,function(e){e===`drain`&&(this._asyncDrainScheduled=!1)}),this._periodicFlush!==0&&(this._periodicFlushTimer=setInterval(()=>this.flush(null),this._periodicFlush),this._periodicFlushTimer.unref())}function _(e,t,n){return typeof e==`string`&&(e=Buffer.from(e)),t=Math.max(t-n,0),e=e.subarray(n),{writingBuf:e,len:t}}function v(e){e.listenerCount(`drain`)>0&&(e._asyncDrainScheduled=!1,e.emit(`drain`))}a(g,i);function y(e,t){return e.length===0?l:e.length===1?e[0]:Buffer.concat(e,t)}function b(e){if(this.destroyed)throw Error(`SonicBoom destroyed`);e=``+e;let t=Buffer.byteLength(e),n=this._len+t,r=this._bufs;return this.maxLength&&n>this.maxLength?(this.emit(`drop`,e),this._len<this._hwm):(r.length===0||Buffer.byteLength(r[r.length-1])+t>this.maxWrite?r.push(e):r[r.length-1]+=e,this._len=n,!this._writing&&this._len>=this.minLength&&this._actualWrite(),this._len<this._hwm)}function x(e){if(this.destroyed)throw Error(`SonicBoom destroyed`);let t=this._len+e.length,n=this._bufs,r=this._lens;return this.maxLength&&t>this.maxLength?(this.emit(`drop`,e),this._len<this._hwm):(n.length===0||r[r.length-1]+e.length>this.maxWrite?(n.push([e]),r.push(e.length)):(n[n.length-1].push(e),r[r.length-1]+=e.length),this._len=t,!this._writing&&this._len>=this.minLength&&this._actualWrite(),this._len<this._hwm)}function S(e){this._flushPending=!0;let t=()=>{if(this._fsync)this._flushPending=!1,e();else try{r.fsync(this.fd,t=>{this._flushPending=!1,e(t)})}catch(t){e(t)}this.off(`error`,n)},n=n=>{this._flushPending=!1,e(n),this.off(`drain`,t)};this.once(`drain`,t),this.once(`error`,n)}function C(e){if(e!=null&&typeof e!=`function`)throw Error(`flush cb must be a function`);if(this.destroyed){let t=Error(`SonicBoom destroyed`);if(e){e(t);return}throw t}if(this.minLength<=0){e?.();return}e&&S.call(this,e),!this._writing&&(this._bufs.length===0&&this._bufs.push(``),this._actualWrite())}function w(e){if(e!=null&&typeof e!=`function`)throw Error(`flush cb must be a function`);if(this.destroyed){let t=Error(`SonicBoom destroyed`);if(e){e(t);return}throw t}if(this.minLength<=0){e?.();return}e&&S.call(this,e),!this._writing&&(this._bufs.length===0&&(this._bufs.push([]),this._lens.push(0)),this._actualWrite())}g.prototype.reopen=function(e){if(this.destroyed)throw Error(`SonicBoom destroyed`);if(this._opening){this.once(`ready`,()=>{this.reopen(e)});return}if(this._ending)return;if(!this.file)throw Error(`Unable to reopen a file descriptor, you must pass a file to SonicBoom`);if(e&&(this.file=e),this._reopening=!0,this._writing)return;let t=this.fd;this.once(`ready`,()=>{t!==this.fd&&r.close(t,e=>{if(e)return this.emit(`error`,e)})}),h(this.file,this)},g.prototype.end=function(){if(this.destroyed)throw Error(`SonicBoom destroyed`);if(this._opening){this.once(`ready`,()=>{this.end()});return}this._ending||(this._ending=!0,!this._writing&&(this._len>0&&this.fd>=0?this._actualWrite():te(this)))};function T(){if(this.destroyed)throw Error(`SonicBoom destroyed`);if(this.fd<0)throw Error(`sonic boom is not ready yet`);!this._writing&&this._writingBuf.length>0&&(this._bufs.unshift(this._writingBuf),this._writingBuf=``);let e=``;for(;this._bufs.length||e.length;){e.length<=0&&(e=this._bufs[0]);try{let t=Buffer.isBuffer(e)?r.writeSync(this.fd,e):r.writeSync(this.fd,e,`utf8`),n=_(e,this._len,t);e=n.writingBuf,this._len=n.len,e.length<=0&&this._bufs.shift()}catch(t){if((t.code===`EAGAIN`||t.code===`EBUSY`)&&!this.retryEAGAIN(t,e.length,this._len-e.length))throw t;s(100)}}try{r.fsyncSync(this.fd)}catch{}}function E(){if(this.destroyed)throw Error(`SonicBoom destroyed`);if(this.fd<0)throw Error(`sonic boom is not ready yet`);!this._writing&&this._writingBuf.length>0&&(this._bufs.unshift([this._writingBuf]),this._writingBuf=l);let e=l;for(;this._bufs.length||e.length;){e.length<=0&&(e=y(this._bufs[0],this._lens[0]));try{let t=r.writeSync(this.fd,e);e=e.subarray(t),this._len=Math.max(this._len-t,0),e.length<=0&&(this._bufs.shift(),this._lens.shift())}catch(t){if((t.code===`EAGAIN`||t.code===`EBUSY`)&&!this.retryEAGAIN(t,e.length,this._len-e.length))throw t;s(100)}}}g.prototype.destroy=function(){this.destroyed||te(this)};function D(){let e=this.release;if(this._writing=!0,this._writingBuf=this._writingBuf.length?this._writingBuf:this._bufs.shift()||``,this.sync)try{e(null,Buffer.isBuffer(this._writingBuf)?r.writeSync(this.fd,this._writingBuf):r.writeSync(this.fd,this._writingBuf,`utf8`))}catch(t){e(t)}else r.write(this.fd,this._writingBuf,e)}function ee(){let e=this.release;if(this._writing=!0,this._writingBuf=this._writingBuf.length?this._writingBuf:y(this._bufs.shift(),this._lens.shift()),this.sync)try{e(null,r.writeSync(this.fd,this._writingBuf))}catch(t){e(t)}else m&&(this._writingBuf=Buffer.from(this._writingBuf)),r.write(this.fd,this._writingBuf,e)}function te(e){if(e.fd===-1){e.once(`ready`,te.bind(null,e));return}e._periodicFlushTimer!==void 0&&clearInterval(e._periodicFlushTimer),e.destroyed=!0,e._bufs=[],e._lens=[],c(typeof e.fd==`number`,`sonic.fd must be a number, got ${typeof e.fd}`);try{r.fsync(e.fd,t)}catch{}function t(){e.fd!==1&&e.fd!==2?r.close(e.fd,n):n()}function n(t){if(t){e.emit(`error`,t);return}e._ending&&!e._writing&&e.emit(`finish`),e.emit(`close`)}}g.SonicBoom=g,g.default=g,n.exports=g})),S$=i(((e,t)=>{let n={exit:[],beforeExit:[]},r={exit:c,beforeExit:l},i;function a(){i===void 0&&(i=new FinalizationRegistry(d))}function o(e){n[e].length>0||process.on(e,r[e])}function s(e){n[e].length>0||(process.removeListener(e,r[e]),n.exit.length===0&&n.beforeExit.length===0&&(i=void 0))}function c(){u(`exit`)}function l(){u(`beforeExit`)}function u(e){for(let t of n[e]){let n=t.deref(),r=t.fn;n!==void 0&&r(n,e)}n[e]=[]}function d(e){for(let t of[`exit`,`beforeExit`]){let r=n[t].indexOf(e);n[t].splice(r,r+1),s(t)}}function f(e,t,r){if(t===void 0)throw Error(`the object can't be undefined`);o(e);let s=new WeakRef(t);s.fn=r,a(),i.register(t,s),n[e].push(s)}function p(e,t){f(`exit`,e,t)}function m(e,t){f(`beforeExit`,e,t)}function h(e){if(i!==void 0){i.unregister(e);for(let t of[`exit`,`beforeExit`])n[t]=n[t].filter(t=>{let n=t.deref();return n&&n!==e}),s(t)}}t.exports={register:p,registerBeforeExit:m,unregister:h}})),Wfe=i(((e,t)=>{t.exports={name:`thread-stream`,version:`4.2.0`,description:`A streaming way to send data to a Node.js Worker Thread`,main:`index.js`,types:`index.d.ts`,engines:{node:`>=20`},dependencies:{"real-require":`^1.0.0`},devDependencies:{"@types/node":`^25.0.2`,"@yao-pkg/pkg":`^6.0.0`,borp:`^1.0.0`,desm:`^1.3.0`,eslint:`^9.39.1`,fastbench:`^1.0.1`,neostandard:`^0.13.0`,"pino-elasticsearch":`^9.0.0`,"sonic-boom":`^5.0.0`,"ts-node":`^10.8.0`,typescript:`~5.7.3`},scripts:{build:`tsc --noEmit`,lint:`eslint`,test:`npm run lint && npm run build && npm run transpile && borp --pattern "test/*.test.{js,mjs}"`,"test:ci":`npm run lint && npm run transpile && borp --pattern "test/*.test.{js,mjs}"`,"test:yarn":`npm run transpile && borp --pattern "test/*.test.js"`,transpile:`sh ./test/ts/transpile.sh`},repository:{type:`git`,url:`git+https://github.com/mcollina/thread-stream.git`},keywords:[`worker`,`thread`,`threads`,`stream`],author:`Matteo Collina <hello@matteocollina.com>`,license:`MIT`,bugs:{url:`https://github.com/mcollina/thread-stream/issues`},homepage:`https://github.com/mcollina/thread-stream#readme`}})),Gfe=i(((e,t)=>{let n=1e4;function r(e,t,r,i,a){let o=i===1/0?1/0:Date.now()+i,s=()=>{let i=Atomics.load(e,t);if(i===r){a(null,`ok`);return}if(o!==1/0&&Date.now()>o){a(null,`timed-out`);return}let c=o===1/0?n:Math.min(n,Math.max(1,o-Date.now())),l=Atomics.waitAsync(e,t,i,c);l.async?l.value.then(s):setImmediate(s)};s()}function i(e,t,r,i,a){let o=i===1/0?1/0:Date.now()+i,s=()=>{if(Atomics.load(e,t)!==r){a(null,`ok`);return}if(o!==1/0&&Date.now()>o){a(null,`timed-out`);return}let i=o===1/0?n:Math.min(n,Math.max(1,o-Date.now())),c=Atomics.waitAsync(e,t,r,i);c.async?c.value.then(e=>{if(e===`ok`){a(null,`ok`);return}s()}):setImmediate(s)};s()}t.exports={wait:r,waitDiff:i}})),Kfe=i(((e,t)=>{t.exports={WRITE_INDEX:4,READ_INDEX:8,SEQ_INDEX:2}})),qfe=i(((e,n)=>{let{version:r}=Wfe(),{EventEmitter:i}=t(`events`),{Worker:a}=t(`worker_threads`),{join:o}=t(`path`),{pathToFileURL:s}=t(`url`),{wait:c}=Gfe(),{WRITE_INDEX:l,READ_INDEX:u,SEQ_INDEX:d}=Kfe(),f=t(`buffer`),p=t(`assert`),m=Symbol(`kImpl`),h=f.constants.MAX_STRING_LENGTH;function g(){}function _(e,t){Atomics.add(e[m].state,d,1),t(),Atomics.add(e[m].state,d,1),Atomics.notify(e[m].state,d)}function v(e){_(e,()=>{Atomics.store(e[m].state,u,0),Atomics.store(e[m].state,l,0)})}var y=class{constructor(e){this._value=e}deref(){return this._value}},b=class{register(){}unregister(){}};let x=process.env.NODE_V8_COVERAGE?b:global.FinalizationRegistry||b,S=process.env.NODE_V8_COVERAGE?y:global.WeakRef||y,C=new x(e=>{e.exited||e.terminate()});function w(e,t){let{filename:n,workerData:i}=t,c=new a((`__bundlerPathsOverrides`in globalThis?globalThis.__bundlerPathsOverrides:{})[`thread-stream-worker`]||o(__dirname,`lib`,`worker.js`),{...t.workerOpts,name:t.workerOpts?.name||`thread-stream`,trackUnmanagedFds:!1,workerData:{filename:n.indexOf(`file://`)===0?n:s(n).href,dataBuf:e[m].dataBuf,stateBuf:e[m].stateBuf,workerData:{$context:{threadStreamVersion:r},...i}}});return c.stream=new y(e),c.on(`message`,D),c.on(`exit`,ee),C.register(e,c),c}function T(e){p(!e[m].sync),e[m].needDrain&&(e[m].needDrain=!1,e.emit(`drain`))}function E(e){for(;;){let t=Atomics.load(e[m].state,l),n=e[m].data.length-t;if(n>0){if(e[m].bufLen===0){e[m].flushing=!1,e[m].ending?O(e):e[m].needDrain&&process.nextTick(T,e);return}ce(e,n,g);continue}if(n===0){if(t===0&&e[m].bufLen===0)return;re(e,()=>{e.destroyed||(v(e),E(e))});return}se(e,Error(`overwritten`));return}}function D(e){let t=this.stream.deref();if(t===void 0){this.exited=!0,this.terminate();return}if(e?.code!=null)switch(e.code){case`READY`:this.stream=new S(t),re(t,()=>{t[m].ready=!0,t.emit(`ready`)});break;case`ERROR`:se(t,e.err);break;case`EVENT`:Array.isArray(e.args)?t.emit(e.name,...e.args):t.emit(e.name,e.args);break;case`FLUSHED`:{if(e.context!==`thread-stream`){se(t,Error(`this should not happen: `+e.code));break}let n=t[m].flushCallbacks.get(e.id);n&&(t[m].flushCallbacks.delete(e.id),process.nextTick(n));break}case`WARNING`:process.emitWarning(e.err);break;default:se(t,Error(`this should not happen: `+e.code))}}function ee(e){let t=this.stream.deref();t!==void 0&&(C.unregister(t),t.worker.exited=!0,t.worker.off(`exit`,ee),se(t,e===0?null:Error(`the worker thread exited`)))}var te=class extends i{constructor(e={}){if(super(),e.bufferSize<4)throw Error(`bufferSize must at least fit a 4-byte utf-8 char`);this[m]={},this[m].stateBuf=new SharedArrayBuffer(128),this[m].state=new Int32Array(this[m].stateBuf),this[m].dataBuf=new SharedArrayBuffer(e.bufferSize||4*1024*1024),this[m].data=Buffer.from(this[m].dataBuf),this[m].sync=e.sync||!1,this[m].ending=!1,this[m].ended=!1,this[m].needDrain=!1,this[m].destroyed=!1,this[m].flushing=!1,this[m].ready=!1,this[m].finished=!1,this[m].errored=null,this[m].closed=!1,this[m].buf=[],this[m].bufHead=0,this[m].bufLen=0,this[m].flushCallbacks=new Map,this[m].nextFlushId=0,this.worker=w(this,e),this.on(`message`,(e,t)=>{this.worker.postMessage(e,t)})}write(e){let t=Buffer.isBuffer(e)?e:Buffer.from(e);if(this[m].destroyed)return oe(this,Error(`the worker has exited`)),!1;if(this[m].ending)return oe(this,Error(`the worker is ending`)),!1;if(this[m].flushing&&this[m].bufLen+t.length>=h)try{le(this),this[m].flushing=!0}catch(e){return se(this,e),!1}if(this[m].buf.push(t),this[m].bufLen+=t.length,this[m].sync)try{return le(this),!0}catch(e){return se(this,e),!1}return this[m].flushing||(this[m].flushing=!0,setImmediate(E,this)),this[m].needDrain=this[m].data.length-this[m].bufLen-Atomics.load(this[m].state,l)<=0,!this[m].needDrain}end(){this[m].destroyed||(this[m].ending=!0,O(this))}flush(e){e=typeof e==`function`?e:g,ne(this,t=>{if(t){process.nextTick(e,t);return}ie(this,e)})}flushSync(){this[m].destroyed||(le(this),ue(this))}unref(){this.worker.unref()}ref(){this.worker.ref()}get ready(){return this[m].ready}get destroyed(){return this[m].destroyed}get closed(){return this[m].closed}get writable(){return!this[m].destroyed&&!this[m].ending}get writableEnded(){return this[m].ending}get writableFinished(){return this[m].finished}get writableNeedDrain(){return this[m].needDrain}get writableObjectMode(){return!1}get writableErrored(){return this[m].errored}};function ne(e,t){if(e[m].destroyed){process.nextTick(t,Error(`the worker has exited`));return}if(!e[m].sync&&(e[m].flushing||e[m].bufLen>0)){setImmediate(ne,e,t);return}re(e,t)}function re(e,t){let n=Atomics.load(e[m].state,l);c(e[m].state,u,n,1/0,(n,r)=>{if(n){se(e,n),t(n);return}if(r!==`ok`){re(e,t);return}t()})}function ie(e,t){if(e[m].destroyed){process.nextTick(t,Error(`the worker has exited`));return}if(!e[m].ready){let n=()=>{i(),ie(e,t)},r=()=>{i(),process.nextTick(t,Error(`the worker has exited`))},i=()=>{e.off(`ready`,n),e.off(`close`,r)};e.once(`ready`,n),e.once(`close`,r);return}let n=++e[m].nextFlushId;e[m].flushCallbacks.set(n,t);try{e.worker.postMessage({code:`FLUSH`,context:`thread-stream`,id:n})}catch(r){e[m].flushCallbacks.delete(n),se(e,r),process.nextTick(t,r)}}function ae(e,t){let n=e[m].flushCallbacks;if(n.size===0)return;let r=t||Error(`the worker has exited`);for(let e of n.values())process.nextTick(e,r);n.clear()}function oe(e,t){setImmediate(()=>{e.emit(`error`,t)})}function se(e,t){e[m].destroyed||(e[m].destroyed=!0,ae(e,t),t&&(e[m].errored=t,oe(e,t)),e.worker.exited?setImmediate(()=>{e[m].closed=!0,e.emit(`close`)}):e.worker.terminate().catch(()=>{}).then(()=>{e[m].closed=!0,e.emit(`close`)}))}function ce(e,t,n){let r=Atomics.load(e[m].state,l),i=t;for(;i>0&&e[m].bufLen!==0;){let t=e[m].bufHead,n=e[m].buf[t];if(n.length<=i){n.copy(e[m].data,r),r+=n.length,i-=n.length,e[m].bufLen-=n.length,e[m].bufHead=t+1,e[m].bufHead===e[m].buf.length?(e[m].buf.length=0,e[m].bufHead=0):e[m].bufHead>=1024&&e[m].bufHead*2>=e[m].buf.length&&(e[m].buf.splice(0,e[m].bufHead),e[m].bufHead=0);continue}n.copy(e[m].data,r,0,i),e[m].buf[t]=n.subarray(i),e[m].bufLen-=i,r+=i,i=0}return _(e,()=>{Atomics.store(e[m].state,l,r)}),n(),!0}function O(e){if(!(e[m].ended||!e[m].ending||e[m].flushing)){e[m].ended=!0;try{e.flushSync();let t=Atomics.load(e[m].state,u);_(e,()=>{Atomics.store(e[m].state,l,-1)});let n=0;for(;t!==-1;){if(Atomics.wait(e[m].state,u,t,1e3),t=Atomics.load(e[m].state,u),t===-2){se(e,Error(`end() failed`));return}if(++n===10){se(e,Error(`end() took too long (10s)`));return}}process.nextTick(()=>{e[m].finished=!0,e.emit(`finish`)})}catch(t){se(e,t)}}}function le(e){let t=()=>{e[m].ending?O(e):e[m].needDrain&&process.nextTick(T,e)};for(e[m].flushing=!1;e[m].bufLen!==0;){let n=Atomics.load(e[m].state,l),r=e[m].data.length-n;if(r===0){ue(e),v(e);continue}else if(r<0)throw Error(`overwritten`);ce(e,r,t)}}function ue(e){if(e[m].flushing)throw Error(`unable to flush while flushing`);let t=Atomics.load(e[m].state,l),n=0;for(;;){let r=Atomics.load(e[m].state,u);if(r===-2)throw Error(`_flushSync failed`);if(r!==t)Atomics.wait(e[m].state,u,r,1e3);else break;if(++n===10)throw Error(`_flushSync took too long (10s)`)}}n.exports=te})),C$=i(((e,n)=>{let{createRequire:r}=t(`module`),{existsSync:i}=t(`node:fs`),a=_$(),{join:o,isAbsolute:s,sep:c}=t(`node:path`),{fileURLToPath:l}=t(`node:url`),u=b$(),d=S$(),f=qfe();function p(e){d.register(e,y),d.registerBeforeExit(e,b),e.on(`close`,function(){d.unregister(e)})}function m(){let e=process.execArgv;for(let t=0;t<e.length;t++){let n=e[t];if(n===`--import`||n===`--require`||n===`-r`||n.startsWith(`--import=`)||n.startsWith(`--require=`)||n.startsWith(`-r=`))return!0}return!1}function h(e){let t=e.match(/(?:[^\s"']+|"[^"]*"|'[^']*')+/g);if(!t)return e;let n=[],r=!1;for(let e=0;e<t.length;e++){let i=t[e];if(i===`--require`||i===`-r`||i===`--import`){let a=t[e+1];if(a&&g(a)){r=!0,e++;continue}n.push(i),a&&(n.push(a),e++);continue}if((i.startsWith(`--require=`)||i.startsWith(`-r=`)||i.startsWith(`--import=`))&&g(i.slice(i.indexOf(`=`)+1))){r=!0;continue}n.push(i)}return r?n.join(` `):e}function g(e){let t=_(e);if(!t)return!1;let n=t;if(n.startsWith(`file://`))try{n=l(n)}catch{return!1}return s(n)&&!i(n)}function _(e){let t=e[0],n=e[e.length-1];return t===`"`&&n===`"`||t===`'`&&n===`'`?e.slice(1,-1):e}function v(e,n,r,i,a){if(!r.execArgv&&m()&&t.main===void 0&&(r={...r,execArgv:[]}),!r.env&&process.env.NODE_OPTIONS){let e=h(process.env.NODE_OPTIONS);e!==process.env.NODE_OPTIONS&&(r={...r,env:{...process.env,NODE_OPTIONS:e}})}r={...r,name:a};let o=new f({filename:e,workerData:n,workerOpts:r,sync:i});o.on(`ready`,s),o.on(`close`,function(){process.removeListener(`exit`,c)}),process.on(`exit`,c);function s(){process.removeListener(`exit`,c),o.unref(),r.autoEnd!==!1&&p(o)}function c(){o.closed||(o.flushSync(),u(100),o.end())}return o}function y(e){e.ref(),e.flushSync(),e.end(),e.once(`close`,function(){e.unref()})}function b(e){e.flushSync()}function x(e){let{pipeline:t,targets:n,levels:i,dedupe:l,worker:u={},caller:d=a(),sync:f=!1}=e,p={...e.options},m=typeof d==`string`?[d]:d,h=typeof globalThis==`object`&&Object.prototype.hasOwnProperty.call(globalThis,`__bundlerPathsOverrides`)&&globalThis.__bundlerPathsOverrides&&typeof globalThis.__bundlerPathsOverrides==`object`?globalThis.__bundlerPathsOverrides:Object.create(null),g=e.target;if(g&&n)throw Error(`only one of target or targets can be specified`);n?(g=h[`pino-worker`]||o(__dirname,`worker.js`),p.targets=n.filter(e=>e.target).map(e=>({...e,target:y(e.target)})),p.pipelines=n.filter(e=>e.pipeline).map(e=>e.pipeline.map(t=>({...t,level:e.level,target:y(t.target)})))):t&&(g=h[`pino-worker`]||o(__dirname,`worker.js`),p.pipelines=[t.map(e=>({...e,target:y(e.target)}))]),i&&(p.levels=i),l&&(p.dedupe=l),p.pinoWillSendConfig=!0;let _=n||t?`pino.transport`:g;return v(y(g),p,u,f,_);function y(e){if(e=h[e]||e,s(e)||e.indexOf(`file://`)===0)return e;if(e===`pino/file`)return o(__dirname,`..`,`file.js`);let t;for(let n of m)try{t=r(n===`node:repl`?process.cwd()+c:n).resolve(e);break}catch{continue}if(!t)throw Error(`unable to determine transport target for "${e}"`);return t}}n.exports=x})),w$=i(((e,n)=>{let r=t(`node:diagnostics_channel`),i=Ufe(),{mapHttpRequest:a,mapHttpResponse:o}=g$(),s=x$(),c=S$(),{lsCacheSym:l,chindingsSym:u,writeSym:d,serializersSym:f,formatOptsSym:p,endSym:m,stringifiersSym:h,stringifySym:g,stringifySafeSym:_,wildcardFirstSym:v,nestedKeySym:y,formattersSym:b,messageKeySym:x,errorKeySym:S,nestedKeyStrSym:C,msgPrefixSym:w}=v$(),{isMainThread:T}=t(`worker_threads`),E=C$(),[D]=process.versions.node.split(`.`).map(e=>Number(e)),ee=r.tracingChannel(`pino_asJson`),te=D>=25?e=>JSON.stringify(e):ie;function ne(){}function re(e,t){if(!t)return n;return function(...r){t.call(this,r,n,e)};function n(t,...n){if(typeof t==`object`){let r=t;t!==null&&(t.method&&t.headers&&t.socket?t=a(t):typeof t.setHeader==`function`&&(t=o(t)));let s;r===null&&n.length===0?s=[null]:(r=n.shift(),s=n),typeof this[w]==`string`&&r!=null&&(r=this[w]+r),this[d](t,i(r,s,this[p]),e)}else{let r=t===void 0?n.shift():t;typeof this[w]==`string`&&r!=null&&(r=this[w]+r),this[d](null,i(r,n,this[p]),e)}}}function ie(e){let t=``,n=0,r=!1,i=255,a=e.length;if(a>100)return JSON.stringify(e);for(var o=0;o<a&&i>=32;o++)i=e.charCodeAt(o),(i===34||i===92)&&(t+=e.slice(n,o)+`\\`,n=o,r=!0);return r?t+=e.slice(n):t=e,i<32?JSON.stringify(e):`"`+t+`"`}function ae(e,t,n,r){if(ee.hasSubscribers===!1)return oe.call(this,e,t,n,r);let i={instance:this,arguments};return ee.traceSync(oe,i,this,e,t,n,r)}function oe(e,t,n,r){let i=this[g],a=this[_],o=this[h],s=this[m],c=this[u],d=this[f],p=this[b],w=this[x],T=this[S],E=this[l][n]+r;E+=c;let D;p.log&&(e=p.log(e));let ee=o[v],ne=``;for(let t in e)if(D=e[t],Object.prototype.hasOwnProperty.call(e,t)&&D!==void 0){d[t]?D=d[t](D):t===T&&d.err&&(D=d.err(D));let e=o[t]||ee;switch(typeof D){case`undefined`:case`function`:continue;case`number`:Number.isFinite(D)===!1&&(D=null);case`boolean`:e&&(D=e(D));break;case`string`:D=(e||te)(D);break;default:D=(e||i)(D,a)}if(D===void 0)continue;let n=te(t);ne+=`,`+n+`:`+D}let re=``;if(t!==void 0){D=d[w]?d[w](t):t;let e=o[w]||ee;switch(typeof D){case`function`:break;case`number`:Number.isFinite(D)===!1&&(D=null);case`boolean`:e&&(D=e(D)),re=`,"`+w+`":`+D;break;case`string`:D=(e||te)(D),re=`,"`+w+`":`+D;break;default:D=(e||i)(D,a),re=`,"`+w+`":`+D}}return this[y]&&ne?E+this[C]+ne.slice(1)+`}`+re+s:E+ne+re+s}function se(e,t){let n,r=e[u],i=e[g],a=e[_],o=e[h],s=o[v],c=e[f],l=e[b].bindings;t=l(t);for(let e in t)if(n=t[e],((e.length<5||e!==`level`&&e!==`serializers`&&e!==`formatters`&&e!==`customLevels`)&&t.hasOwnProperty(e)&&n!==void 0)===!0){if(n=c[e]?c[e](n):n,n=(o[e]||s||i)(n,a),n===void 0)continue;r+=`,"`+e+`":`+n}return r}function ce(e){return e.write!==e.constructor.prototype.write}function O(e){let t=new s(e);return t.on(`error`,n),!e.sync&&T&&(c.register(t,le),t.on(`close`,function(){c.unregister(t)})),t;function n(e){if(e.code===`EPIPE`){t.write=ne,t.end=ne,t.flushSync=ne,t.destroy=ne;return}t.removeListener(`error`,n),t.emit(`error`,e)}}function le(e,t){e.destroyed||(t===`beforeExit`?(e.flush(),e.on(`drain`,function(){e.end()})):e.flushSync())}function ue(e){return function(t,n,r={},i){if(typeof r==`string`)i=O({dest:r}),r={};else if(typeof i==`string`){if(r&&r.transport)throw Error(`only one of option.transport or stream can be specified`);i=O({dest:i})}else if(r instanceof s||r.writable||r._writableState)i=r,r={};else if(r.transport){if(r.transport instanceof s||r.transport.writable||r.transport._writableState)throw Error(`option.transport do not allow stream, please pass to option directly. e.g. pino(transport)`);if(r.transport.targets&&r.transport.targets.length&&r.formatters&&typeof r.formatters.level==`function`)throw Error(`option.transport.targets do not allow custom level formatters`);let e;r.customLevels&&(e=r.useOnlyCustomLevels?r.customLevels:Object.assign({},r.levels,r.customLevels)),i=E({caller:n,...r.transport,levels:e})}if(r=Object.assign({},e,r),r.serializers=Object.assign({},e.serializers,r.serializers),r.formatters=Object.assign({},e.formatters,r.formatters),r.prettyPrint)throw Error(`prettyPrint option is no longer supported, see the pino-pretty package (https://github.com/pinojs/pino-pretty)`);let{enabled:a,onChild:o}=r;return a===!1&&(r.level=`silent`),o||(r.onChild=ne),i||=ce(process.stdout)?process.stdout:O({fd:process.stdout.fd||1}),{opts:r,stream:i}}}function de(e,t){try{return JSON.stringify(e)}catch{try{return(t||this[_])(e)}catch{return`"[unable to serialize, circular reference is too complex to analyze]"`}}}function k(e,t,n){return{level:e,bindings:t,log:n}}function A(e){let t=Number(e);return typeof e==`string`&&Number.isFinite(t)?t:e===void 0?1:e}n.exports={noop:ne,buildSafeSonicBoom:O,asChindings:se,asJson:ae,genLog:re,createArgsNormalizer:ue,stringify:de,buildFormatters:k,normalizeDestFileDescriptor:A}})),T$=i(((e,t)=>{t.exports={DEFAULT_LEVELS:{trace:10,debug:20,info:30,warn:40,error:50,fatal:60},SORTING_ORDER:{ASC:`ASC`,DESC:`DESC`}}})),E$=i(((e,t)=>{let{lsCacheSym:n,levelValSym:r,useOnlyCustomLevelsSym:i,streamSym:a,formattersSym:o,hooksSym:s,levelCompSym:c}=v$(),{noop:l,genLog:u}=w$(),{DEFAULT_LEVELS:d,SORTING_ORDER:f}=T$(),p={fatal:e=>{let t=u(d.fatal,e);return function(...e){let n=this[a];if(t.call(this,...e),typeof n.flushSync==`function`)try{n.flushSync()}catch{}}},error:e=>u(d.error,e),warn:e=>u(d.warn,e),info:e=>u(d.info,e),debug:e=>u(d.debug,e),trace:e=>u(d.trace,e)},m=Object.keys(d).reduce((e,t)=>(e[d[t]]=t,e),{}),h=Object.keys(m).reduce((e,t)=>(e[t]=`{"level":`+Number(t),e),{});function g(e){let t=e[o].level,{labels:r}=e.levels,i={};for(let e in r){let n=t(r[e],Number(e));i[e]=JSON.stringify(n).slice(0,-1)}return e[n]=i,e}function _(e,t){if(t)return!1;switch(e){case`fatal`:case`error`:case`warn`:case`info`:case`debug`:case`trace`:return!0;default:return!1}}function v(e){let{labels:t,values:n}=this.levels;if(typeof e==`number`){if(t[e]===void 0)throw Error(`unknown level value`+e);e=t[e]}if(n[e]===void 0)throw Error(`unknown level `+e);let a=this[r],o=this[r]=n[e],d=this[i],f=this[c],m=this[s].logMethod;for(let e in n){if(f(n[e],o)===!1){this[e]=l;continue}this[e]=_(e,d)?p[e](m):u(n[e],m)}this.emit(`level-change`,e,o,t[a],a,this)}function y(e){let{levels:t,levelVal:n}=this;return t&&t.labels?t.labels[n]:``}function b(e){let{values:t}=this.levels,n=t[e];return n!==void 0&&this[c](n,this[r])}function x(e,t,n){return e===f.DESC?t<=n:t>=n}function S(e){return typeof e==`string`?x.bind(null,e):e}function C(e=null,t=!1){let n=e?Object.keys(e).reduce((t,n)=>(t[e[n]]=n,t),{}):null;return{labels:Object.assign(Object.create(Object.prototype,{Infinity:{value:`silent`}}),t?null:m,n),values:Object.assign(Object.create(Object.prototype,{silent:{value:1/0}}),t?null:d,e)}}function w(e,t,n){if(typeof e==`number`){if(![].concat(Object.keys(t||{}).map(e=>t[e]),n?[]:Object.keys(m).map(e=>+e),1/0).includes(e))throw Error(`default level:${e} must be included in custom levels`);return}if(!(e in Object.assign(Object.create(Object.prototype,{silent:{value:1/0}}),n?null:d,t)))throw Error(`default level:${e} must be included in custom levels`)}function T(e,t){let{labels:n,values:r}=e;for(let e in t){if(e in r)throw Error(`levels cannot be overridden`);if(t[e]in n)throw Error(`pre-existing level values cannot be used for new levels`)}}function E(e){if(typeof e!=`function`&&!(typeof e==`string`&&Object.values(f).includes(e)))throw Error(`Levels comparison should be one of "ASC", "DESC" or "function" type`)}t.exports={initialLsCache:h,genLsCache:g,levelMethods:p,getLevel:y,setLevel:v,isLevelEnabled:b,mappings:C,assertNoLevelCollisions:T,assertDefaultLevelFound:w,genLevelComparison:S,assertLevelComparison:E}})),D$=i(((e,t)=>{t.exports={version:`10.3.1`}})),Jfe=i(((e,n)=>{let{EventEmitter:r}=t(`node:events`),{lsCacheSym:i,levelValSym:a,setLevelSym:o,getLevelSym:s,chindingsSym:c,mixinSym:l,asJsonSym:u,writeSym:d,mixinMergeStrategySym:f,timeSym:p,timeSliceIndexSym:m,streamSym:h,serializersSym:g,formattersSym:_,errorKeySym:v,messageKeySym:y,useOnlyCustomLevelsSym:b,needsMetadataGsym:x,redactFmtSym:S,stringifySym:C,formatOptsSym:w,stringifiersSym:T,msgPrefixSym:E,hooksSym:D}=v$(),{getLevel:ee,setLevel:te,isLevelEnabled:ne,mappings:re,initialLsCache:ie,genLsCache:ae,assertNoLevelCollisions:oe}=E$(),{asChindings:se,asJson:ce,buildFormatters:O,stringify:le,noop:ue}=w$(),{version:de}=D$(),k=y$(),A={constructor:class{},child:pe,bindings:me,setBindings:he,flush:ge,isLevelEnabled:ne,version:de,get level(){return this[s]()},set level(e){this[o](e)},get levelVal(){return this[a]},set levelVal(e){throw Error(`levelVal is read-only`)},get msgPrefix(){return this[E]},get[Symbol.toStringTag](){return`Pino`},[i]:ie,[d]:M,[u]:ce,[s]:ee,[o]:te};Object.setPrototypeOf(A,r.prototype),n.exports=function(){return Object.create(A)};let fe=e=>e;function pe(e,t){if(!e)throw Error(`missing bindings for child Pino`);let n=this[g],r=this[_],i=Object.create(this);if(t==null)return i[_].bindings!==fe&&(i[_]=O(r.level,fe,r.log)),i[c]=se(i,e),this.onChild!==ue&&this.onChild(i),i;if(t.hasOwnProperty(`serializers`)===!0){i[g]=Object.create(null);for(let e in n)i[g][e]=n[e];let e=Object.getOwnPropertySymbols(n);for(var a=0;a<e.length;a++){let t=e[a];i[g][t]=n[t]}for(let e in t.serializers)i[g][e]=t.serializers[e];let r=Object.getOwnPropertySymbols(t.serializers);for(var s=0;s<r.length;s++){let e=r[s];i[g][e]=t.serializers[e]}}else i[g]=n;if(t.hasOwnProperty(`formatters`)){let{level:e,bindings:n,log:a}=t.formatters;i[_]=O(e||r.level,n||fe,a||r.log)}else i[_]=O(r.level,fe,r.log);if(t.hasOwnProperty(`customLevels`)===!0&&(oe(this.levels,t.customLevels),i.levels=re(t.customLevels,i[b]),ae(i)),typeof t.redact==`object`&&t.redact!==null||Array.isArray(t.redact)){i.redact=t.redact;let e=k(i.redact,le),n={stringify:e[S]};i[C]=le,i[T]=e,i[w]=n}if(typeof t.msgPrefix==`string`&&(i[E]=(this[E]||``)+t.msgPrefix),i[c]=se(i,e),t.level!==void 0&&t.level!==this.level||t.hasOwnProperty(`customLevels`)){let e=t.level||this.level;i[o](e)}return this.onChild(i),i}function me(){let e=`{${this[c].substr(1)}}`,t=JSON.parse(e);return delete t.pid,delete t.hostname,t}function he(e){let t=se(this,e);this[c]=t}function j(e,t){return Object.assign(t,e)}function M(e,t,n){let r=this[p](),i=this[l],a=this[v],o=this[y],s=this[f]||j,c,d=this[D].streamWrite;e==null?c={}:e instanceof Error?(c={[a]:e},t===void 0&&(t=e.message)):(c=e,t===void 0&&e[o]===void 0&&e[a]&&(t=e[a].message)),i&&(c=s(c,i(c,n,this)));let g=this[u](c,t,n,r),_=this[h];_[x]===!0&&(_.lastLevel=n,_.lastObj=c,_.lastMsg=t,_.lastTime=r.slice(this[m]),_.lastLogger=this),_.write(d?d(g):g)}function ge(e){if(e!=null&&typeof e!=`function`)throw Error(`callback must be a function`);let t=this[h];typeof t.flush==`function`?t.flush(e||ue):e&&e()}})),Yfe=i(((e,t)=>{let{hasOwnProperty:n}=Object.prototype,r=_();r.configure=_,r.stringify=r,r.default=r,e.stringify=r,e.configure=_,t.exports=r;let i=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]/;function a(e){return e.length<5e3&&!i.test(e)?`"${e}"`:JSON.stringify(e)}function o(e,t){if(e.length>200||t)return e.sort(t);for(let t=1;t<e.length;t++){let n=e[t],r=t;for(;r!==0&&e[r-1]>n;)e[r]=e[r-1],r--;e[r]=n}return e}let s=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function c(e){return s.call(e)!==void 0&&e.length!==0}function l(e,t,n){e.length<n&&(n=e.length);let r=t===`,`?``:` `,i=`"0":${r}${e[0]}`;for(let a=1;a<n;a++)i+=`${t}"${a}":${r}${e[a]}`;return i}function u(e){if(n.call(e,`circularValue`)){let t=e.circularValue;if(typeof t==`string`)return`"${t}"`;if(t==null)return t;if(t===Error||t===TypeError)return{toString(){throw TypeError(`Converting circular structure to JSON`)}};throw TypeError(`The "circularValue" argument must be of type string or the value null or undefined`)}return`"[Circular]"`}function d(e){let t;if(n.call(e,`deterministic`)&&(t=e.deterministic,typeof t!=`boolean`&&typeof t!=`function`))throw TypeError(`The "deterministic" argument must be of type boolean or comparator function`);return t===void 0?!0:t}function f(e,t){let r;if(n.call(e,t)&&(r=e[t],typeof r!=`boolean`))throw TypeError(`The "${t}" argument must be of type boolean`);return r===void 0?!0:r}function p(e,t){let r;if(n.call(e,t)){if(r=e[t],typeof r!=`number`)throw TypeError(`The "${t}" argument must be of type number`);if(!Number.isInteger(r))throw TypeError(`The "${t}" argument must be an integer`);if(r<1)throw RangeError(`The "${t}" argument must be >= 1`)}return r===void 0?1/0:r}function m(e){return e===1?`1 item`:`${e} items`}function h(e){let t=new Set;for(let n of e)(typeof n==`string`||typeof n==`number`)&&t.add(String(n));return t}function g(e){if(n.call(e,`strict`)){let t=e.strict;if(typeof t!=`boolean`)throw TypeError(`The "strict" argument must be of type boolean`);if(t)return e=>{let t=`Object can not safely be stringified. Received type ${typeof e}`;throw typeof e!=`function`&&(t+=` (${e.toString()})`),Error(t)}}}function _(e){e={...e};let t=g(e);t&&(e.bigint===void 0&&(e.bigint=!1),`circularValue`in e||(e.circularValue=Error));let n=u(e),r=f(e,`bigint`),i=d(e),s=typeof i==`function`?i:void 0,_=p(e,`maximumDepth`),v=p(e,`maximumBreadth`);function y(e,l,u,d,f,p){let h=l[e];switch(typeof h==`object`&&h&&typeof h.toJSON==`function`&&(h=h.toJSON(e)),h=d.call(l,e,h),typeof h){case`string`:return a(h);case`object`:{if(h===null)return`null`;if(u.indexOf(h)!==-1)return n;let e=``,t=`,`,r=p;if(Array.isArray(h)){if(h.length===0)return`[]`;if(_<u.length+1)return`"[Array]"`;u.push(h),f!==``&&(p+=f,e+=`\n${p}`,t=`,\n${p}`);let n=Math.min(h.length,v),i=0;for(;i<n-1;i++){let n=y(String(i),h,u,d,f,p);e+=n===void 0?`null`:n,e+=t}let a=y(String(i),h,u,d,f,p);if(e+=a===void 0?`null`:a,h.length-1>v){let n=h.length-v-1;e+=`${t}"... ${m(n)} not stringified"`}return f!==``&&(e+=`\n${r}`),u.pop(),`[${e}]`}let l=Object.keys(h),g=l.length;if(g===0)return`{}`;if(_<u.length+1)return`"[Object]"`;let b=``,x=``;f!==``&&(p+=f,t=`,\n${p}`,b=` `);let S=Math.min(g,v);i&&!c(h)&&(l=o(l,s)),u.push(h);for(let n=0;n<S;n++){let r=l[n],i=y(r,h,u,d,f,p);i!==void 0&&(e+=`${x}${a(r)}:${b}${i}`,x=t)}if(g>v){let n=g-v;e+=`${x}"...":${b}"${m(n)} not stringified"`,x=t}return f!==``&&x.length>1&&(e=`\n${p}${e}\n${r}`),u.pop(),`{${e}}`}case`number`:return isFinite(h)?String(h):t?t(h):`null`;case`boolean`:return h===!0?`true`:`false`;case`undefined`:return;case`bigint`:if(r)return String(h);default:return t?t(h):void 0}}function b(e,i,o,s,c,l){switch(typeof i==`object`&&i&&typeof i.toJSON==`function`&&(i=i.toJSON(e)),typeof i){case`string`:return a(i);case`object`:{if(i===null)return`null`;if(o.indexOf(i)!==-1)return n;let e=l,t=``,r=`,`;if(Array.isArray(i)){if(i.length===0)return`[]`;if(_<o.length+1)return`"[Array]"`;o.push(i),c!==``&&(l+=c,t+=`\n${l}`,r=`,\n${l}`);let n=Math.min(i.length,v),a=0;for(;a<n-1;a++){let e=b(String(a),i[a],o,s,c,l);t+=e===void 0?`null`:e,t+=r}let u=b(String(a),i[a],o,s,c,l);if(t+=u===void 0?`null`:u,i.length-1>v){let e=i.length-v-1;t+=`${r}"... ${m(e)} not stringified"`}return c!==``&&(t+=`\n${e}`),o.pop(),`[${t}]`}o.push(i);let u=``;c!==``&&(l+=c,r=`,\n${l}`,u=` `);let d=``;for(let e of s){let n=b(e,i[e],o,s,c,l);n!==void 0&&(t+=`${d}${a(e)}:${u}${n}`,d=r)}return c!==``&&d.length>1&&(t=`\n${l}${t}\n${e}`),o.pop(),`{${t}}`}case`number`:return isFinite(i)?String(i):t?t(i):`null`;case`boolean`:return i===!0?`true`:`false`;case`undefined`:return;case`bigint`:if(r)return String(i);default:return t?t(i):void 0}}function x(e,u,d,f,p){switch(typeof u){case`string`:return a(u);case`object`:{if(u===null)return`null`;if(typeof u.toJSON==`function`){if(u=u.toJSON(e),typeof u!=`object`)return x(e,u,d,f,p);if(u===null)return`null`}if(d.indexOf(u)!==-1)return n;let t=p;if(Array.isArray(u)){if(u.length===0)return`[]`;if(_<d.length+1)return`"[Array]"`;d.push(u),p+=f;let e=`\n${p}`,n=`,\n${p}`,r=Math.min(u.length,v),i=0;for(;i<r-1;i++){let t=x(String(i),u[i],d,f,p);e+=t===void 0?`null`:t,e+=n}let a=x(String(i),u[i],d,f,p);if(e+=a===void 0?`null`:a,u.length-1>v){let t=u.length-v-1;e+=`${n}"... ${m(t)} not stringified"`}return e+=`\n${t}`,d.pop(),`[${e}]`}let r=Object.keys(u),h=r.length;if(h===0)return`{}`;if(_<d.length+1)return`"[Object]"`;p+=f;let g=`,\n${p}`,y=``,b=``,S=Math.min(h,v);c(u)&&(y+=l(u,g,v),r=r.slice(u.length),S-=u.length,b=g),i&&(r=o(r,s)),d.push(u);for(let e=0;e<S;e++){let t=r[e],n=x(t,u[t],d,f,p);n!==void 0&&(y+=`${b}${a(t)}: ${n}`,b=g)}if(h>v){let e=h-v;y+=`${b}"...": "${m(e)} not stringified"`,b=g}return b!==``&&(y=`\n${p}${y}\n${t}`),d.pop(),`{${y}}`}case`number`:return isFinite(u)?String(u):t?t(u):`null`;case`boolean`:return u===!0?`true`:`false`;case`undefined`:return;case`bigint`:if(r)return String(u);default:return t?t(u):void 0}}function S(e,u,d){switch(typeof u){case`string`:return a(u);case`object`:{if(u===null)return`null`;if(typeof u.toJSON==`function`){if(u=u.toJSON(e),typeof u!=`object`)return S(e,u,d);if(u===null)return`null`}if(d.indexOf(u)!==-1)return n;let t=``,r=u.length!==void 0;if(r&&Array.isArray(u)){if(u.length===0)return`[]`;if(_<d.length+1)return`"[Array]"`;d.push(u);let e=Math.min(u.length,v),n=0;for(;n<e-1;n++){let e=S(String(n),u[n],d);t+=e===void 0?`null`:e,t+=`,`}let r=S(String(n),u[n],d);if(t+=r===void 0?`null`:r,u.length-1>v){let e=u.length-v-1;t+=`,"... ${m(e)} not stringified"`}return d.pop(),`[${t}]`}let f=Object.keys(u),p=f.length;if(p===0)return`{}`;if(_<d.length+1)return`"[Object]"`;let h=``,g=Math.min(p,v);r&&c(u)&&(t+=l(u,`,`,v),f=f.slice(u.length),g-=u.length,h=`,`),i&&(f=o(f,s)),d.push(u);for(let e=0;e<g;e++){let n=f[e],r=S(n,u[n],d);r!==void 0&&(t+=`${h}${a(n)}:${r}`,h=`,`)}if(p>v){let e=p-v;t+=`${h}"...":"${m(e)} not stringified"`}return d.pop(),`{${t}}`}case`number`:return isFinite(u)?String(u):t?t(u):`null`;case`boolean`:return u===!0?`true`:`false`;case`undefined`:return;case`bigint`:if(r)return String(u);default:return t?t(u):void 0}}function C(e,t,n){if(arguments.length>1){let r=``;if(typeof n==`number`?r=` `.repeat(Math.min(n,10)):typeof n==`string`&&(r=n.slice(0,10)),t!=null){if(typeof t==`function`)return y(``,{"":e},[],t,r,``);if(Array.isArray(t))return b(``,e,[],h(t),r,``)}if(r.length!==0)return x(``,e,[],r,``)}return S(``,e,[])}return C}})),Xfe=i(((e,t)=>{let n=Symbol.for(`pino.metadata`),{DEFAULT_LEVELS:r}=T$(),i=r.info;function a(e,t){e||=[],t||={dedupe:!1};let a=Object.create(r);a.silent=1/0,t.levels&&typeof t.levels==`object`&&Object.keys(t.levels).forEach(e=>{a[e]=t.levels[e]});let u={write:d,add:m,remove:h,emit:f,flushSync:p,end:g,minLevel:0,lastId:0,streams:[],clone:_,[n]:!0,streamLevels:a};return Array.isArray(e)?e.forEach(m,u):m.call(u,e),e=null,u;function d(e){let r,i=this.lastLevel,{streams:a}=this,o=0,u;for(let d=s(a.length,t.dedupe);l(d,a.length,t.dedupe);d=c(d,t.dedupe))if(r=a[d],r.level<=i){if(o!==0&&o!==r.level)break;if(u=r.stream,u[n]){let{lastTime:e,lastMsg:t,lastObj:n,lastLogger:r}=this;u.lastLevel=i,u.lastTime=e,u.lastMsg=t,u.lastObj=n,u.lastLogger=r}u.write(e),t.dedupe&&(o=r.level)}else if(!t.dedupe)break}function f(...e){for(let{stream:t}of this.streams)typeof t.emit==`function`&&t.emit(...e)}function p(){for(let{stream:e}of this.streams)typeof e.flushSync==`function`&&e.flushSync()}function m(e){if(!e)return u;let t=typeof e.write==`function`||e.stream,n=e.write?e:e.stream;if(!t)throw Error(`stream object needs to implement either StreamEntry or DestinationStream interface`);let{streams:r,streamLevels:a}=this,s;s=typeof e.levelVal==`number`?e.levelVal:typeof e.level==`string`?a[e.level]:typeof e.level==`number`?e.level:i;let c={stream:n,level:s,levelVal:void 0,id:++u.lastId};return r.unshift(c),r.sort(o),this.minLevel=r[0].level,u}function h(e){let{streams:t}=this,n=t.findIndex(t=>t.id===e);return n>=0&&(t.splice(n,1),t.sort(o),this.minLevel=t.length>0?t[0].level:-1),u}function g(){for(let{stream:e}of this.streams)typeof e.flushSync==`function`&&e.flushSync(),e.end()}function _(e){let t=Array(this.streams.length);for(let n=0;n<t.length;n++)t[n]={level:e,stream:this.streams[n].stream};return{write:d,add:m,remove:h,minLevel:e,streams:t,clone:_,emit:f,flushSync:p,[n]:!0}}}function o(e,t){return e.level-t.level}function s(e,t){return t?e-1:0}function c(e,t){return t?e-1:e+1}function l(e,t,n){return n?e>=0:e<t}t.exports=a})),Zfe=i(((e,n)=>{let r=t(`node:os`),i=g$(),a=_$(),o=y$(),s=Hfe(),c=Jfe(),l=v$(),{configure:u}=Yfe(),{assertDefaultLevelFound:d,mappings:f,genLsCache:p,genLevelComparison:m,assertLevelComparison:h}=E$(),{DEFAULT_LEVELS:g,SORTING_ORDER:_}=T$(),{createArgsNormalizer:v,asChindings:y,buildSafeSonicBoom:b,buildFormatters:x,stringify:S,normalizeDestFileDescriptor:C,noop:w}=w$(),{version:T}=D$(),{chindingsSym:E,redactFmtSym:D,serializersSym:ee,timeSym:te,timeSliceIndexSym:ne,streamSym:re,stringifySym:ie,stringifySafeSym:ae,stringifiersSym:oe,setLevelSym:se,endSym:ce,formatOptsSym:O,messageKeySym:le,errorKeySym:ue,nestedKeySym:de,mixinSym:k,levelCompSym:A,useOnlyCustomLevelsSym:fe,formattersSym:pe,hooksSym:me,nestedKeyStrSym:he,mixinMergeStrategySym:j,msgPrefixSym:M}=l,{epochTime:ge,nullTime:_e}=s,{pid:ve}=process,ye=r.hostname(),be=i.err,xe=v({level:`info`,levelComparison:_.ASC,levels:g,messageKey:`msg`,errorKey:`err`,nestedKey:null,enabled:!0,base:{pid:ve,hostname:ye},serializers:Object.assign(Object.create(null),{err:be}),formatters:Object.assign(Object.create(null),{bindings(e){return e},level(e,t){return{level:t}}}),hooks:{logMethod:void 0,streamWrite:void 0},timestamp:ge,name:void 0,redact:null,customLevels:null,useOnlyCustomLevels:!1,depthLimit:5,edgeLimit:100}),Se=Object.assign(Object.create(null),i);function Ce(...e){let t={},{opts:n,stream:r}=xe(t,a(),...e);n.level&&typeof n.level==`string`&&g[n.level.toLowerCase()]!==void 0&&(n.level=n.level.toLowerCase());let{redact:i,crlf:s,serializers:l,timestamp:_,messageKey:v,errorKey:b,nestedKey:C,base:T,name:ve,level:ye,customLevels:be,levelComparison:Se,mixin:Ce,mixinMergeStrategy:we,useOnlyCustomLevels:Te,formatters:Ee,hooks:De,depthLimit:Oe,edgeLimit:ke,onChild:Ae,msgPrefix:je}=n,Me=u({maximumDepth:Oe,maximumBreadth:ke}),Ne=x(Ee.level,Ee.bindings,Ee.log),Pe=S.bind({[ae]:Me}),Fe=i?o(i,Pe):{},Ie=i?{stringify:Fe[D]}:{stringify:Pe},Le=`}`+(s?`\r
415
+ caused by: `+i(o,t)):a},a=e=>i(e,new Set),o=(e,t,i)=>{if(!n(e))return``;let a=i?``:e.message||``;if(t.has(e))return a+`: ...`;let s=r(e);if(s){t.add(e);let n=typeof e.cause==`function`;return a+(n?``:`: `)+o(s,t,n)}else return a};t.exports={isErrorLike:n,getErrorCause:r,stackWithCauses:a,messageWithCauses:e=>o(e,new Set)}})),h$=i(((e,t)=>{let n=Symbol(`circular-ref-tag`),r=Symbol(`pino-raw-err-ref`),i=Object.create({},{type:{enumerable:!0,writable:!0,value:void 0},message:{enumerable:!0,writable:!0,value:void 0},stack:{enumerable:!0,writable:!0,value:void 0},aggregateErrors:{enumerable:!0,writable:!0,value:void 0},raw:{enumerable:!1,get:function(){return this[r]},set:function(e){this[r]=e}}});Object.defineProperty(i,r,{writable:!0,value:{}}),t.exports={pinoErrProto:i,pinoErrorSymbols:{seen:n,rawSymbol:r}}})),Rfe=i(((e,t)=>{t.exports=l;let{messageWithCauses:n,stackWithCauses:r,isErrorLike:i}=m$(),{pinoErrProto:a,pinoErrorSymbols:o}=h$(),{seen:s}=o,{toString:c}=Object.prototype;function l(e){if(!i(e))return e;e[s]=void 0;let t=Object.create(a);t.type=c.call(e.constructor)===`[object Function]`?e.constructor.name:e.name,t.message=n(e),t.stack=r(e),Array.isArray(e.errors)&&(t.aggregateErrors=e.errors.map(e=>l(e)));for(let n in e)if(t[n]===void 0){let r=e[n];i(r)?n!==`cause`&&!Object.prototype.hasOwnProperty.call(r,s)&&(t[n]=l(r)):t[n]=r}return delete e[s],t.raw=e,t}})),zfe=i(((e,t)=>{t.exports=s;let{isErrorLike:n}=m$(),{pinoErrProto:r,pinoErrorSymbols:i}=h$(),{seen:a}=i,{toString:o}=Object.prototype;function s(e){if(!n(e))return e;e[a]=void 0;let t=Object.create(r);t.type=o.call(e.constructor)===`[object Function]`?e.constructor.name:e.name,t.message=e.message,t.stack=e.stack,Array.isArray(e.errors)&&(t.aggregateErrors=e.errors.map(e=>s(e))),n(e.cause)&&!Object.prototype.hasOwnProperty.call(e.cause,a)&&(t.cause=s(e.cause));for(let r in e)if(t[r]===void 0){let i=e[r];n(i)?Object.prototype.hasOwnProperty.call(i,a)||(t[r]=s(i)):t[r]=i}return delete e[a],t.raw=e,t}})),Bfe=i(((e,t)=>{t.exports={mapHttpRequest:a,reqSerializer:i};let n=Symbol(`pino-raw-req-ref`),r=Object.create({},{id:{enumerable:!0,writable:!0,value:``},method:{enumerable:!0,writable:!0,value:``},url:{enumerable:!0,writable:!0,value:``},query:{enumerable:!0,writable:!0,value:``},params:{enumerable:!0,writable:!0,value:``},headers:{enumerable:!0,writable:!0,value:{}},remoteAddress:{enumerable:!0,writable:!0,value:``},remotePort:{enumerable:!0,writable:!0,value:``},raw:{enumerable:!1,get:function(){return this[n]},set:function(e){this[n]=e}}});Object.defineProperty(r,n,{writable:!0,value:{}});function i(e){let t=e.info||e.socket,n=Object.create(r);if(n.id=typeof e.id==`function`?e.id():e.id||(e.info?e.info.id:void 0),n.method=e.method,e.originalUrl)n.url=e.originalUrl;else{let t=e.path;n.url=typeof t==`string`?t:e.url?e.url.path||e.url:void 0}return e.query&&(n.query=e.query),e.params&&(n.params=e.params),n.headers=e.headers,n.remoteAddress=t&&t.remoteAddress,n.remotePort=t&&t.remotePort,n.raw=e.raw||e,n}function a(e){return{req:i(e)}}})),Vfe=i(((e,t)=>{t.exports={mapHttpResponse:a,resSerializer:i};let n=Symbol(`pino-raw-res-ref`),r=Object.create({},{statusCode:{enumerable:!0,writable:!0,value:0},headers:{enumerable:!0,writable:!0,value:``},raw:{enumerable:!1,get:function(){return this[n]},set:function(e){this[n]=e}}});Object.defineProperty(r,n,{writable:!0,value:{}});function i(e){let t=Object.create(r);return t.statusCode=e.headersSent?e.statusCode:null,t.headers=e.getHeaders?e.getHeaders():e._headers,t.raw=e,t}function a(e){return{res:i(e)}}})),g$=i(((e,t)=>{let n=Rfe(),r=zfe(),i=Bfe(),a=Vfe();t.exports={err:n,errWithCause:r,mapHttpRequest:i.mapHttpRequest,mapHttpResponse:a.mapHttpResponse,req:i.reqSerializer,res:a.resSerializer,wrapErrorSerializer:function(e){return e===n?e:function(t){return e(n(t))}},wrapRequestSerializer:function(e){return e===i.reqSerializer?e:function(t){return e(i.reqSerializer(t))}},wrapResponseSerializer:function(e){return e===a.resSerializer?e:function(t){return e(a.resSerializer(t))}}}})),_$=i(((e,t)=>{function n(e,t){return t}t.exports=function(){let e=Error.prepareStackTrace;Error.prepareStackTrace=n;let t=Error().stack;if(Error.prepareStackTrace=e,!Array.isArray(t))return;let r=t.slice(2),i=[];for(let e of r)e&&i.push(e.getFileName());return i}})),Hfe=i(((e,t)=>{function n(e){if(typeof e!=`object`||!e)return e;if(e instanceof Date)return new Date(e.getTime());if(e instanceof Array){let t=[];for(let r=0;r<e.length;r++)t[r]=n(e[r]);return t}if(typeof e==`object`){let t=Object.create(Object.getPrototypeOf(e));for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t[r]=n(e[r]));return t}return e}function r(e){let t=[],n=``,r=!1,i=!1,a=``;for(let o=0;o<e.length;o++){let s=e[o];!r&&s===`.`?n&&=(t.push(n),``):s===`[`?(n&&=(t.push(n),``),r=!0):s===`]`&&r?(t.push(n),n=``,r=!1,i=!1):(s===`"`||s===`'`)&&r?i?s===a?(i=!1,a=``):n+=s:(i=!0,a=s):n+=s}return n&&t.push(n),t}function i(e,t,n){let r=e;for(let e=0;e<t.length-1;e++){let n=t[e];if(typeof r!=`object`||!r||!(n in r)||typeof r[n]!=`object`||r[n]===null)return!1;r=r[n]}let i=t[t.length-1];if(i===`*`){if(Array.isArray(r))for(let e=0;e<r.length;e++)r[e]=n;else if(typeof r==`object`&&r)for(let e in r)Object.prototype.hasOwnProperty.call(r,e)&&(r[e]=n)}else typeof r==`object`&&r&&i in r&&Object.prototype.hasOwnProperty.call(r,i)&&(r[i]=n);return!0}function a(e,t){let n=e;for(let e=0;e<t.length-1;e++){let r=t[e];if(typeof n!=`object`||!n||!(r in n)||typeof n[r]!=`object`||n[r]===null)return!1;n=n[r]}let r=t[t.length-1];if(r===`*`){if(Array.isArray(n))for(let e=0;e<n.length;e++)n[e]=void 0;else if(typeof n==`object`&&n)for(let e in n)Object.prototype.hasOwnProperty.call(n,e)&&delete n[e]}else typeof n==`object`&&n&&r in n&&Object.prototype.hasOwnProperty.call(n,r)&&delete n[r];return!0}let o=Symbol(`PATH_NOT_FOUND`);function s(e,t){let n=e;for(let e of t){if(typeof n!=`object`||!n||!n||!(e in n))return o;n=n[e]}return n}function c(e,t){let n=e;for(let e of t){if(typeof n!=`object`||!n||!n)return;n=n[e]}return n}function l(e,t,n,c=!1){for(let l of t){let t=r(l);if(t.includes(`*`))u(e,t,n,l,c);else if(c)a(e,t);else{let r=s(e,t);if(r===o)continue;i(e,t,typeof n==`function`?n(r,t):n)}}}function u(e,t,n,r,i=!1){let a=t.indexOf(`*`);if(a===t.length-1){let r=t.slice(0,-1),a=e;for(let e of r){if(typeof a!=`object`||!a||!a)return;a=a[e]}if(Array.isArray(a))if(i)for(let e=0;e<a.length;e++)a[e]=void 0;else for(let e=0;e<a.length;e++){let t=[...r,e.toString()],i=typeof n==`function`?n(a[e],t):n;a[e]=i}else if(typeof a==`object`&&a)if(i){let e=[];for(let t in a)Object.prototype.hasOwnProperty.call(a,t)&&e.push(t);for(let t of e)delete a[t]}else for(let e in a){let t=[...r,e],i=typeof n==`function`?n(a[e],t):n;a[e]=i}}else d(e,t,n,a,r,i)}function d(e,t,n,r,o,s=!1){let l=t.slice(0,r),d=t.slice(r+1),f=[];function p(e,t){if(t===l.length){if(Array.isArray(e))for(let n=0;n<e.length;n++)f[t]=n.toString(),p(e[n],t+1);else if(typeof e==`object`&&e)for(let n in e)f[t]=n,p(e[n],t+1)}else if(t<l.length){let n=l[t];e&&typeof e==`object`&&e&&n in e&&(f[t]=n,p(e[n],t+1))}else d.includes(`*`)?u(e,d,typeof n==`function`?(e,r)=>n(e,[...f.slice(0,t),...r]):n,o,s):s?a(e,d):i(e,d,typeof n==`function`?n(c(e,d),[...f.slice(0,t),...d]):n)}if(l.length===0)p(e,0);else{let t=e;for(let e=0;e<l.length;e++){let n=l[e];if(typeof t!=`object`||!t||!t)return;t=t[n],f[e]=n}t!=null&&p(t,l.length)}}function f(e){if(e.length===0)return null;let t=new Map;for(let n of e){let e=r(n),i=t;for(let t=0;t<e.length;t++){let n=e[t];i.has(n)||i.set(n,new Map),i=i.get(n)}}return t}function p(e,t){if(!t)return e;function n(e,t,r=0){if(!t||t.size===0||typeof e!=`object`||!e)return e;if(e instanceof Date)return new Date(e.getTime());if(Array.isArray(e)){let r=[];for(let i=0;i<e.length;i++){let a=i.toString();t.has(a)||t.has(`*`)?r[i]=n(e[i],t.get(a)||t.get(`*`)):r[i]=e[i]}return r}let i=Object.create(Object.getPrototypeOf(e));for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&(t.has(r)||t.has(`*`)?i[r]=n(e[r],t.get(r)||t.get(`*`)):i[r]=e[r]);return i}return n(e,t)}function m(e){if(typeof e!=`string`)throw Error(`Paths must be (non-empty) strings`);if(e===``)throw Error(`Invalid redaction path ()`);if(e.includes(`..`)||e.includes(`,`))throw Error(`Invalid redaction path (${e})`);let t=0,n=!1,r=``;for(let i=0;i<e.length;i++){let a=e[i];if((a===`"`||a===`'`)&&t>0)n?a===r&&(n=!1,r=``):(n=!0,r=a);else if(a===`[`&&!n)t++;else if(a===`]`&&!n&&(t--,t<0))throw Error(`Invalid redaction path (${e})`)}if(t!==0)throw Error(`Invalid redaction path (${e})`)}function h(e){if(!Array.isArray(e))throw TypeError(`paths must be an array`);for(let t of e)m(t)}function g(e={}){let{paths:t=[],censor:r=`[REDACTED]`,serialize:i=JSON.stringify,strict:a=!0,remove:o=!1}=e;h(t);let s=f(t);return function(e){if(a&&(typeof e!=`object`||!e)&&(typeof e!=`object`||!e))return i?i(e):e;let c=p(e,s),u=e,d=r;return typeof r==`function`&&(d=r),l(c,t,d,o),i===!1?(c.restore=function(){return n(u)},c):typeof i==`function`?i(c):JSON.stringify(c)}}t.exports=g})),v$=i(((e,t)=>{let n=Symbol(`pino.setLevel`),r=Symbol(`pino.getLevel`),i=Symbol(`pino.levelVal`),a=Symbol(`pino.levelComp`),o=Symbol(`pino.useLevelLabels`),s=Symbol(`pino.useOnlyCustomLevels`),c=Symbol(`pino.mixin`),l=Symbol(`pino.lsCache`),u=Symbol(`pino.chindings`),d=Symbol(`pino.asJson`),f=Symbol(`pino.write`),p=Symbol(`pino.redactFmt`),m=Symbol(`pino.time`),h=Symbol(`pino.timeSliceIndex`),g=Symbol(`pino.stream`),_=Symbol(`pino.stringify`),v=Symbol(`pino.stringifySafe`),y=Symbol(`pino.stringifiers`),b=Symbol(`pino.end`),x=Symbol(`pino.formatOpts`),S=Symbol(`pino.messageKey`),C=Symbol(`pino.errorKey`),w=Symbol(`pino.nestedKey`),T=Symbol(`pino.nestedKeyStr`),E=Symbol(`pino.mixinMergeStrategy`),D=Symbol(`pino.msgPrefix`),ee=Symbol(`pino.wildcardFirst`),te=Symbol.for(`pino.serializers`),ne=Symbol.for(`pino.formatters`),re=Symbol.for(`pino.hooks`);t.exports={setLevelSym:n,getLevelSym:r,levelValSym:i,levelCompSym:a,useLevelLabelsSym:o,mixinSym:c,lsCacheSym:l,chindingsSym:u,asJsonSym:d,writeSym:f,serializersSym:te,redactFmtSym:p,timeSym:m,timeSliceIndexSym:h,streamSym:g,stringifySym:_,stringifySafeSym:v,stringifiersSym:y,endSym:b,formatOptsSym:x,messageKeySym:S,errorKeySym:C,nestedKeySym:w,wildcardFirstSym:ee,needsMetadataGsym:Symbol.for(`pino.metadata`),useOnlyCustomLevelsSym:s,formattersSym:ne,hooksSym:re,nestedKeyStrSym:T,mixinMergeStrategySym:E,msgPrefixSym:D}})),y$=i(((e,t)=>{let n=Hfe(),{redactFmtSym:r,wildcardFirstSym:i}=v$(),a=/[^.[\]]+|\[([^[\]]*?)\]/g,o=`[Redacted]`;function s(e,t){let{paths:o,censor:s,remove:l}=c(e),u=o.reduce((e,t)=>{a.lastIndex=0;let n=a.exec(t),r=a.exec(t),o=n[1]===void 0?n[0]:n[1].replace(/^(?:"|'|`)(.*)(?:"|'|`)$/,`$1`);if(o===`*`&&(o=i),r===null)return e[o]=null,e;if(e[o]===null)return e;let{index:s}=r,c=`${t.substr(s,t.length-1)}`;return e[o]=e[o]||[],o!==i&&e[o].length===0&&e[o].push(...e[i]||[]),o===i&&Object.keys(e).forEach(function(t){e[t]&&e[t].push(c)}),e[o].push(c),e},{}),d={[r]:n({paths:o,censor:s,serialize:t,strict:!1,remove:l})},f=(...e)=>t(typeof s==`function`?s(...e):s);return[...Object.keys(u),...Object.getOwnPropertySymbols(u)].reduce((e,r)=>{if(u[r]===null)e[r]=e=>f(e,[r]);else{let i=typeof s==`function`?(e,t)=>s(e,[r,...t]):s;e[r]=n({paths:u[r],censor:i,serialize:t,strict:!1,remove:l})}return e},d)}function c(e){if(Array.isArray(e))return e={paths:e,censor:o},e;let{paths:t,censor:n=o,remove:r}=e;if(Array.isArray(t)===!1)throw Error(`pino – redact must contain an array of strings`);return r===!0&&(n=void 0),{paths:t,censor:n,remove:r}}t.exports=s})),Ufe=i(((e,t)=>{let n=()=>``,r=()=>`,"time":${Date.now()}`,i=()=>`,"time":${Math.round(Date.now()/1e3)}`,a=()=>`,"time":"${new Date(Date.now()).toISOString()}"`,o=1000000000n,s=BigInt(Date.now())*1000000n,c=process.hrtime.bigint();t.exports={nullTime:n,epochTime:r,unixTime:i,isoTime:a,isoTimeNano:()=>{let e=s+(process.hrtime.bigint()-c),t=e/o,n=e%o,r=Number(t*1000n+n/1000000n),i=new Date(r);return`,"time":"${i.getUTCFullYear()}-${(i.getUTCMonth()+1).toString().padStart(2,`0`)}-${i.getUTCDate().toString().padStart(2,`0`)}T${i.getUTCHours().toString().padStart(2,`0`)}:${i.getUTCMinutes().toString().padStart(2,`0`)}:${i.getUTCSeconds().toString().padStart(2,`0`)}.${n.toString().padStart(9,`0`)}Z"`}}})),Wfe=i(((e,t)=>{function n(e){try{return JSON.stringify(e)}catch{return`"[Circular]"`}}t.exports=r;function r(e,t,r){var i=r&&r.stringify||n,a=1;if(typeof e==`object`&&e){var o=t.length+a;if(o===1)return e;var s=Array(o);s[0]=i(e);for(var c=1;c<o;c++)s[c]=i(t[c]);return s.join(` `)}if(typeof e!=`string`)return e;var l=t.length;if(l===0)return e;for(var u=``,d=1-a,f=-1,p=e&&e.length||0,m=0;m<p;){if(e.charCodeAt(m)===37&&m+1<p){switch(f=f>-1?f:0,e.charCodeAt(m+1)){case 100:case 102:if(d>=l||t[d]==null)break;f<m&&(u+=e.slice(f,m)),u+=Number(t[d]),f=m+2,m++;break;case 105:if(d>=l||t[d]==null)break;f<m&&(u+=e.slice(f,m)),u+=Math.floor(Number(t[d])),f=m+2,m++;break;case 79:case 111:case 106:if(d>=l||t[d]===void 0)break;f<m&&(u+=e.slice(f,m));var h=typeof t[d];if(h===`string`){u+=`'`+t[d]+`'`,f=m+2,m++;break}if(h===`function`){u+=t[d].name||`<anonymous>`,f=m+2,m++;break}u+=i(t[d]),f=m+2,m++;break;case 115:if(d>=l)break;f<m&&(u+=e.slice(f,m)),u+=String(t[d]),f=m+2,m++;break;case 37:f<m&&(u+=e.slice(f,m)),u+=`%`,f=m+2,m++,d--;break}++d}++m}return f===-1?e:(f<p&&(u+=e.slice(f)),u)}})),b$=i(((e,t)=>{if(typeof SharedArrayBuffer<`u`&&typeof Atomics<`u`){let e=new Int32Array(new SharedArrayBuffer(4));function n(t){if(!(t>0&&t<1/0))throw typeof t!=`number`&&typeof t!=`bigint`?TypeError(`sleep: ms must be a number`):RangeError(`sleep: ms must be a number that is greater than 0 but less than Infinity`);Atomics.wait(e,0,0,Number(t))}t.exports=n}else{function e(e){if(!(e>0&&e<1/0))throw typeof e!=`number`&&typeof e!=`bigint`?TypeError(`sleep: ms must be a number`):RangeError(`sleep: ms must be a number that is greater than 0 but less than Infinity`);let t=Date.now()+Number(e);for(;t>Date.now(););}t.exports=e}})),x$=i(((e,n)=>{let r=t(`fs`),i=t(`events`),a=t(`util`).inherits,o=t(`path`),s=b$(),c=t(`assert`),l=Buffer.allocUnsafe(0),u=`buffer`,d=`utf8`,[f,p]=(process.versions.node||`0.0`).split(`.`).map(Number),m=f>=22&&p>=7;function h(e,t){t._opening=!0,t._writing=!0,t._asyncDrainScheduled=!1;function n(n,r){if(n){t._reopening=!1,t._writing=!1,t._opening=!1,t.sync?process.nextTick(()=>{t.listenerCount(`error`)>0&&t.emit(`error`,n)}):t.emit(`error`,n);return}let i=t._reopening;t.fd=r,t.file=e,t._reopening=!1,t._opening=!1,t._writing=!1,t.sync?process.nextTick(()=>t.emit(`ready`)):t.emit(`ready`),!t.destroyed&&(!t._writing&&t._len>t.minLength||t._flushPending?t._actualWrite():i&&process.nextTick(()=>t.emit(`drain`)))}let i=t.append?`a`:`w`,a=t.mode;if(t.sync)try{t.mkdir&&r.mkdirSync(o.dirname(e),{recursive:!0}),n(null,r.openSync(e,i,a))}catch(e){throw n(e),e}else t.mkdir?r.mkdir(o.dirname(e),{recursive:!0},t=>{if(t)return n(t);r.open(e,i,a,n)}):r.open(e,i,a,n)}function g(e){if(!(this instanceof g))return new g(e);let{fd:t,dest:n,minLength:i,maxLength:a,maxWrite:o,periodicFlush:c,sync:f,append:p=!0,mkdir:m,retryEAGAIN:y,fsync:S,contentMode:ne,mode:re}=e||{};t||=n,this._len=0,this.fd=-1,this._bufs=[],this._lens=[],this._writing=!1,this._ending=!1,this._reopening=!1,this._asyncDrainScheduled=!1,this._flushPending=!1,this._hwm=Math.max(i||0,16387),this.file=null,this.destroyed=!1,this.minLength=i||0,this.maxLength=a||0,this.maxWrite=o||16384,this._periodicFlush=c||0,this._periodicFlushTimer=void 0,this.sync=f||!1,this.writable=!0,this._fsync=S||!1,this.append=p||!1,this.mode=re,this.retryEAGAIN=y||(()=>!0),this.mkdir=m||!1;let ie,ae;if(ne===u)this._writingBuf=l,this.write=x,this.flush=w,this.flushSync=E,this._actualWrite=ee,ie=()=>r.writeSync(this.fd,this._writingBuf),ae=()=>r.write(this.fd,this._writingBuf,this.release);else if(ne===void 0||ne===d)this._writingBuf=``,this.write=b,this.flush=C,this.flushSync=T,this._actualWrite=D,ie=()=>Buffer.isBuffer(this._writingBuf)?r.writeSync(this.fd,this._writingBuf):r.writeSync(this.fd,this._writingBuf,`utf8`),ae=()=>Buffer.isBuffer(this._writingBuf)?r.write(this.fd,this._writingBuf,this.release):r.write(this.fd,this._writingBuf,`utf8`,this.release);else throw Error(`SonicBoom supports "${d}" and "${u}", but passed ${ne}`);if(typeof t==`number`)this.fd=t,process.nextTick(()=>this.emit(`ready`));else if(typeof t==`string`)h(t,this);else throw Error(`SonicBoom supports only file descriptors and files`);if(this.minLength>=this.maxWrite)throw Error(`minLength should be smaller than maxWrite (${this.maxWrite})`);this.release=(e,t)=>{if(e){if((e.code===`EAGAIN`||e.code===`EBUSY`)&&this.retryEAGAIN(e,this._writingBuf.length,this._len-this._writingBuf.length))if(this.sync)try{s(100),this.release(void 0,0)}catch(e){this.release(e)}else setTimeout(ae,100);else this._writing=!1,this.emit(`error`,e);return}this.emit(`write`,t);let n=_(this._writingBuf,this._len,t);if(this._len=n.len,this._writingBuf=n.writingBuf,this._writingBuf.length){if(!this.sync){ae();return}try{do{let e=ie(),t=_(this._writingBuf,this._len,e);this._len=t.len,this._writingBuf=t.writingBuf}while(this._writingBuf.length)}catch(e){this.release(e);return}}this._fsync&&r.fsyncSync(this.fd);let i=this._len;this._reopening?(this._writing=!1,this._reopening=!1,this.reopen()):i>this.minLength?this._actualWrite():this._ending?i>0?this._actualWrite():(this._writing=!1,te(this)):(this._writing=!1,this.sync?this._asyncDrainScheduled||(this._asyncDrainScheduled=!0,process.nextTick(v,this)):this.emit(`drain`))},this.on(`newListener`,function(e){e===`drain`&&(this._asyncDrainScheduled=!1)}),this._periodicFlush!==0&&(this._periodicFlushTimer=setInterval(()=>this.flush(null),this._periodicFlush),this._periodicFlushTimer.unref())}function _(e,t,n){return typeof e==`string`&&(e=Buffer.from(e)),t=Math.max(t-n,0),e=e.subarray(n),{writingBuf:e,len:t}}function v(e){e.listenerCount(`drain`)>0&&(e._asyncDrainScheduled=!1,e.emit(`drain`))}a(g,i);function y(e,t){return e.length===0?l:e.length===1?e[0]:Buffer.concat(e,t)}function b(e){if(this.destroyed)throw Error(`SonicBoom destroyed`);e=``+e;let t=Buffer.byteLength(e),n=this._len+t,r=this._bufs;return this.maxLength&&n>this.maxLength?(this.emit(`drop`,e),this._len<this._hwm):(r.length===0||Buffer.byteLength(r[r.length-1])+t>this.maxWrite?r.push(e):r[r.length-1]+=e,this._len=n,!this._writing&&this._len>=this.minLength&&this._actualWrite(),this._len<this._hwm)}function x(e){if(this.destroyed)throw Error(`SonicBoom destroyed`);let t=this._len+e.length,n=this._bufs,r=this._lens;return this.maxLength&&t>this.maxLength?(this.emit(`drop`,e),this._len<this._hwm):(n.length===0||r[r.length-1]+e.length>this.maxWrite?(n.push([e]),r.push(e.length)):(n[n.length-1].push(e),r[r.length-1]+=e.length),this._len=t,!this._writing&&this._len>=this.minLength&&this._actualWrite(),this._len<this._hwm)}function S(e){this._flushPending=!0;let t=()=>{if(this._fsync)this._flushPending=!1,e();else try{r.fsync(this.fd,t=>{this._flushPending=!1,e(t)})}catch(t){e(t)}this.off(`error`,n)},n=n=>{this._flushPending=!1,e(n),this.off(`drain`,t)};this.once(`drain`,t),this.once(`error`,n)}function C(e){if(e!=null&&typeof e!=`function`)throw Error(`flush cb must be a function`);if(this.destroyed){let t=Error(`SonicBoom destroyed`);if(e){e(t);return}throw t}if(this.minLength<=0){e?.();return}e&&S.call(this,e),!this._writing&&(this._bufs.length===0&&this._bufs.push(``),this._actualWrite())}function w(e){if(e!=null&&typeof e!=`function`)throw Error(`flush cb must be a function`);if(this.destroyed){let t=Error(`SonicBoom destroyed`);if(e){e(t);return}throw t}if(this.minLength<=0){e?.();return}e&&S.call(this,e),!this._writing&&(this._bufs.length===0&&(this._bufs.push([]),this._lens.push(0)),this._actualWrite())}g.prototype.reopen=function(e){if(this.destroyed)throw Error(`SonicBoom destroyed`);if(this._opening){this.once(`ready`,()=>{this.reopen(e)});return}if(this._ending)return;if(!this.file)throw Error(`Unable to reopen a file descriptor, you must pass a file to SonicBoom`);if(e&&(this.file=e),this._reopening=!0,this._writing)return;let t=this.fd;this.once(`ready`,()=>{t!==this.fd&&r.close(t,e=>{if(e)return this.emit(`error`,e)})}),h(this.file,this)},g.prototype.end=function(){if(this.destroyed)throw Error(`SonicBoom destroyed`);if(this._opening){this.once(`ready`,()=>{this.end()});return}this._ending||(this._ending=!0,!this._writing&&(this._len>0&&this.fd>=0?this._actualWrite():te(this)))};function T(){if(this.destroyed)throw Error(`SonicBoom destroyed`);if(this.fd<0)throw Error(`sonic boom is not ready yet`);!this._writing&&this._writingBuf.length>0&&(this._bufs.unshift(this._writingBuf),this._writingBuf=``);let e=``;for(;this._bufs.length||e.length;){e.length<=0&&(e=this._bufs[0]);try{let t=Buffer.isBuffer(e)?r.writeSync(this.fd,e):r.writeSync(this.fd,e,`utf8`),n=_(e,this._len,t);e=n.writingBuf,this._len=n.len,e.length<=0&&this._bufs.shift()}catch(t){if((t.code===`EAGAIN`||t.code===`EBUSY`)&&!this.retryEAGAIN(t,e.length,this._len-e.length))throw t;s(100)}}try{r.fsyncSync(this.fd)}catch{}}function E(){if(this.destroyed)throw Error(`SonicBoom destroyed`);if(this.fd<0)throw Error(`sonic boom is not ready yet`);!this._writing&&this._writingBuf.length>0&&(this._bufs.unshift([this._writingBuf]),this._writingBuf=l);let e=l;for(;this._bufs.length||e.length;){e.length<=0&&(e=y(this._bufs[0],this._lens[0]));try{let t=r.writeSync(this.fd,e);e=e.subarray(t),this._len=Math.max(this._len-t,0),e.length<=0&&(this._bufs.shift(),this._lens.shift())}catch(t){if((t.code===`EAGAIN`||t.code===`EBUSY`)&&!this.retryEAGAIN(t,e.length,this._len-e.length))throw t;s(100)}}}g.prototype.destroy=function(){this.destroyed||te(this)};function D(){let e=this.release;if(this._writing=!0,this._writingBuf=this._writingBuf.length?this._writingBuf:this._bufs.shift()||``,this.sync)try{e(null,Buffer.isBuffer(this._writingBuf)?r.writeSync(this.fd,this._writingBuf):r.writeSync(this.fd,this._writingBuf,`utf8`))}catch(t){e(t)}else r.write(this.fd,this._writingBuf,e)}function ee(){let e=this.release;if(this._writing=!0,this._writingBuf=this._writingBuf.length?this._writingBuf:y(this._bufs.shift(),this._lens.shift()),this.sync)try{e(null,r.writeSync(this.fd,this._writingBuf))}catch(t){e(t)}else m&&(this._writingBuf=Buffer.from(this._writingBuf)),r.write(this.fd,this._writingBuf,e)}function te(e){if(e.fd===-1){e.once(`ready`,te.bind(null,e));return}e._periodicFlushTimer!==void 0&&clearInterval(e._periodicFlushTimer),e.destroyed=!0,e._bufs=[],e._lens=[],c(typeof e.fd==`number`,`sonic.fd must be a number, got ${typeof e.fd}`);try{r.fsync(e.fd,t)}catch{}function t(){e.fd!==1&&e.fd!==2?r.close(e.fd,n):n()}function n(t){if(t){e.emit(`error`,t);return}e._ending&&!e._writing&&e.emit(`finish`),e.emit(`close`)}}g.SonicBoom=g,g.default=g,n.exports=g})),S$=i(((e,t)=>{let n={exit:[],beforeExit:[]},r={exit:c,beforeExit:l},i;function a(){i===void 0&&(i=new FinalizationRegistry(d))}function o(e){n[e].length>0||process.on(e,r[e])}function s(e){n[e].length>0||(process.removeListener(e,r[e]),n.exit.length===0&&n.beforeExit.length===0&&(i=void 0))}function c(){u(`exit`)}function l(){u(`beforeExit`)}function u(e){for(let t of n[e]){let n=t.deref(),r=t.fn;n!==void 0&&r(n,e)}n[e]=[]}function d(e){for(let t of[`exit`,`beforeExit`]){let r=n[t].indexOf(e);n[t].splice(r,r+1),s(t)}}function f(e,t,r){if(t===void 0)throw Error(`the object can't be undefined`);o(e);let s=new WeakRef(t);s.fn=r,a(),i.register(t,s),n[e].push(s)}function p(e,t){f(`exit`,e,t)}function m(e,t){f(`beforeExit`,e,t)}function h(e){if(i!==void 0){i.unregister(e);for(let t of[`exit`,`beforeExit`])n[t]=n[t].filter(t=>{let n=t.deref();return n&&n!==e}),s(t)}}t.exports={register:p,registerBeforeExit:m,unregister:h}})),Gfe=i(((e,t)=>{t.exports={name:`thread-stream`,version:`4.2.0`,description:`A streaming way to send data to a Node.js Worker Thread`,main:`index.js`,types:`index.d.ts`,engines:{node:`>=20`},dependencies:{"real-require":`^1.0.0`},devDependencies:{"@types/node":`^25.0.2`,"@yao-pkg/pkg":`^6.0.0`,borp:`^1.0.0`,desm:`^1.3.0`,eslint:`^9.39.1`,fastbench:`^1.0.1`,neostandard:`^0.13.0`,"pino-elasticsearch":`^9.0.0`,"sonic-boom":`^5.0.0`,"ts-node":`^10.8.0`,typescript:`~5.7.3`},scripts:{build:`tsc --noEmit`,lint:`eslint`,test:`npm run lint && npm run build && npm run transpile && borp --pattern "test/*.test.{js,mjs}"`,"test:ci":`npm run lint && npm run transpile && borp --pattern "test/*.test.{js,mjs}"`,"test:yarn":`npm run transpile && borp --pattern "test/*.test.js"`,transpile:`sh ./test/ts/transpile.sh`},repository:{type:`git`,url:`git+https://github.com/mcollina/thread-stream.git`},keywords:[`worker`,`thread`,`threads`,`stream`],author:`Matteo Collina <hello@matteocollina.com>`,license:`MIT`,bugs:{url:`https://github.com/mcollina/thread-stream/issues`},homepage:`https://github.com/mcollina/thread-stream#readme`}})),Kfe=i(((e,t)=>{let n=1e4;function r(e,t,r,i,a){let o=i===1/0?1/0:Date.now()+i,s=()=>{let i=Atomics.load(e,t);if(i===r){a(null,`ok`);return}if(o!==1/0&&Date.now()>o){a(null,`timed-out`);return}let c=o===1/0?n:Math.min(n,Math.max(1,o-Date.now())),l=Atomics.waitAsync(e,t,i,c);l.async?l.value.then(s):setImmediate(s)};s()}function i(e,t,r,i,a){let o=i===1/0?1/0:Date.now()+i,s=()=>{if(Atomics.load(e,t)!==r){a(null,`ok`);return}if(o!==1/0&&Date.now()>o){a(null,`timed-out`);return}let i=o===1/0?n:Math.min(n,Math.max(1,o-Date.now())),c=Atomics.waitAsync(e,t,r,i);c.async?c.value.then(e=>{if(e===`ok`){a(null,`ok`);return}s()}):setImmediate(s)};s()}t.exports={wait:r,waitDiff:i}})),qfe=i(((e,t)=>{t.exports={WRITE_INDEX:4,READ_INDEX:8,SEQ_INDEX:2}})),Jfe=i(((e,n)=>{let{version:r}=Gfe(),{EventEmitter:i}=t(`events`),{Worker:a}=t(`worker_threads`),{join:o}=t(`path`),{pathToFileURL:s}=t(`url`),{wait:c}=Kfe(),{WRITE_INDEX:l,READ_INDEX:u,SEQ_INDEX:d}=qfe(),f=t(`buffer`),p=t(`assert`),m=Symbol(`kImpl`),h=f.constants.MAX_STRING_LENGTH;function g(){}function _(e,t){Atomics.add(e[m].state,d,1),t(),Atomics.add(e[m].state,d,1),Atomics.notify(e[m].state,d)}function v(e){_(e,()=>{Atomics.store(e[m].state,u,0),Atomics.store(e[m].state,l,0)})}var y=class{constructor(e){this._value=e}deref(){return this._value}},b=class{register(){}unregister(){}};let x=process.env.NODE_V8_COVERAGE?b:global.FinalizationRegistry||b,S=process.env.NODE_V8_COVERAGE?y:global.WeakRef||y,C=new x(e=>{e.exited||e.terminate()});function w(e,t){let{filename:n,workerData:i}=t,c=new a((`__bundlerPathsOverrides`in globalThis?globalThis.__bundlerPathsOverrides:{})[`thread-stream-worker`]||o(__dirname,`lib`,`worker.js`),{...t.workerOpts,name:t.workerOpts?.name||`thread-stream`,trackUnmanagedFds:!1,workerData:{filename:n.indexOf(`file://`)===0?n:s(n).href,dataBuf:e[m].dataBuf,stateBuf:e[m].stateBuf,workerData:{$context:{threadStreamVersion:r},...i}}});return c.stream=new y(e),c.on(`message`,D),c.on(`exit`,ee),C.register(e,c),c}function T(e){p(!e[m].sync),e[m].needDrain&&(e[m].needDrain=!1,e.emit(`drain`))}function E(e){for(;;){let t=Atomics.load(e[m].state,l),n=e[m].data.length-t;if(n>0){if(e[m].bufLen===0){e[m].flushing=!1,e[m].ending?O(e):e[m].needDrain&&process.nextTick(T,e);return}ce(e,n,g);continue}if(n===0){if(t===0&&e[m].bufLen===0)return;re(e,()=>{e.destroyed||(v(e),E(e))});return}se(e,Error(`overwritten`));return}}function D(e){let t=this.stream.deref();if(t===void 0){this.exited=!0,this.terminate();return}if(e?.code!=null)switch(e.code){case`READY`:this.stream=new S(t),re(t,()=>{t[m].ready=!0,t.emit(`ready`)});break;case`ERROR`:se(t,e.err);break;case`EVENT`:Array.isArray(e.args)?t.emit(e.name,...e.args):t.emit(e.name,e.args);break;case`FLUSHED`:{if(e.context!==`thread-stream`){se(t,Error(`this should not happen: `+e.code));break}let n=t[m].flushCallbacks.get(e.id);n&&(t[m].flushCallbacks.delete(e.id),process.nextTick(n));break}case`WARNING`:process.emitWarning(e.err);break;default:se(t,Error(`this should not happen: `+e.code))}}function ee(e){let t=this.stream.deref();t!==void 0&&(C.unregister(t),t.worker.exited=!0,t.worker.off(`exit`,ee),se(t,e===0?null:Error(`the worker thread exited`)))}var te=class extends i{constructor(e={}){if(super(),e.bufferSize<4)throw Error(`bufferSize must at least fit a 4-byte utf-8 char`);this[m]={},this[m].stateBuf=new SharedArrayBuffer(128),this[m].state=new Int32Array(this[m].stateBuf),this[m].dataBuf=new SharedArrayBuffer(e.bufferSize||4*1024*1024),this[m].data=Buffer.from(this[m].dataBuf),this[m].sync=e.sync||!1,this[m].ending=!1,this[m].ended=!1,this[m].needDrain=!1,this[m].destroyed=!1,this[m].flushing=!1,this[m].ready=!1,this[m].finished=!1,this[m].errored=null,this[m].closed=!1,this[m].buf=[],this[m].bufHead=0,this[m].bufLen=0,this[m].flushCallbacks=new Map,this[m].nextFlushId=0,this.worker=w(this,e),this.on(`message`,(e,t)=>{this.worker.postMessage(e,t)})}write(e){let t=Buffer.isBuffer(e)?e:Buffer.from(e);if(this[m].destroyed)return oe(this,Error(`the worker has exited`)),!1;if(this[m].ending)return oe(this,Error(`the worker is ending`)),!1;if(this[m].flushing&&this[m].bufLen+t.length>=h)try{le(this),this[m].flushing=!0}catch(e){return se(this,e),!1}if(this[m].buf.push(t),this[m].bufLen+=t.length,this[m].sync)try{return le(this),!0}catch(e){return se(this,e),!1}return this[m].flushing||(this[m].flushing=!0,setImmediate(E,this)),this[m].needDrain=this[m].data.length-this[m].bufLen-Atomics.load(this[m].state,l)<=0,!this[m].needDrain}end(){this[m].destroyed||(this[m].ending=!0,O(this))}flush(e){e=typeof e==`function`?e:g,ne(this,t=>{if(t){process.nextTick(e,t);return}ie(this,e)})}flushSync(){this[m].destroyed||(le(this),ue(this))}unref(){this.worker.unref()}ref(){this.worker.ref()}get ready(){return this[m].ready}get destroyed(){return this[m].destroyed}get closed(){return this[m].closed}get writable(){return!this[m].destroyed&&!this[m].ending}get writableEnded(){return this[m].ending}get writableFinished(){return this[m].finished}get writableNeedDrain(){return this[m].needDrain}get writableObjectMode(){return!1}get writableErrored(){return this[m].errored}};function ne(e,t){if(e[m].destroyed){process.nextTick(t,Error(`the worker has exited`));return}if(!e[m].sync&&(e[m].flushing||e[m].bufLen>0)){setImmediate(ne,e,t);return}re(e,t)}function re(e,t){let n=Atomics.load(e[m].state,l);c(e[m].state,u,n,1/0,(n,r)=>{if(n){se(e,n),t(n);return}if(r!==`ok`){re(e,t);return}t()})}function ie(e,t){if(e[m].destroyed){process.nextTick(t,Error(`the worker has exited`));return}if(!e[m].ready){let n=()=>{i(),ie(e,t)},r=()=>{i(),process.nextTick(t,Error(`the worker has exited`))},i=()=>{e.off(`ready`,n),e.off(`close`,r)};e.once(`ready`,n),e.once(`close`,r);return}let n=++e[m].nextFlushId;e[m].flushCallbacks.set(n,t);try{e.worker.postMessage({code:`FLUSH`,context:`thread-stream`,id:n})}catch(r){e[m].flushCallbacks.delete(n),se(e,r),process.nextTick(t,r)}}function ae(e,t){let n=e[m].flushCallbacks;if(n.size===0)return;let r=t||Error(`the worker has exited`);for(let e of n.values())process.nextTick(e,r);n.clear()}function oe(e,t){setImmediate(()=>{e.emit(`error`,t)})}function se(e,t){e[m].destroyed||(e[m].destroyed=!0,ae(e,t),t&&(e[m].errored=t,oe(e,t)),e.worker.exited?setImmediate(()=>{e[m].closed=!0,e.emit(`close`)}):e.worker.terminate().catch(()=>{}).then(()=>{e[m].closed=!0,e.emit(`close`)}))}function ce(e,t,n){let r=Atomics.load(e[m].state,l),i=t;for(;i>0&&e[m].bufLen!==0;){let t=e[m].bufHead,n=e[m].buf[t];if(n.length<=i){n.copy(e[m].data,r),r+=n.length,i-=n.length,e[m].bufLen-=n.length,e[m].bufHead=t+1,e[m].bufHead===e[m].buf.length?(e[m].buf.length=0,e[m].bufHead=0):e[m].bufHead>=1024&&e[m].bufHead*2>=e[m].buf.length&&(e[m].buf.splice(0,e[m].bufHead),e[m].bufHead=0);continue}n.copy(e[m].data,r,0,i),e[m].buf[t]=n.subarray(i),e[m].bufLen-=i,r+=i,i=0}return _(e,()=>{Atomics.store(e[m].state,l,r)}),n(),!0}function O(e){if(!(e[m].ended||!e[m].ending||e[m].flushing)){e[m].ended=!0;try{e.flushSync();let t=Atomics.load(e[m].state,u);_(e,()=>{Atomics.store(e[m].state,l,-1)});let n=0;for(;t!==-1;){if(Atomics.wait(e[m].state,u,t,1e3),t=Atomics.load(e[m].state,u),t===-2){se(e,Error(`end() failed`));return}if(++n===10){se(e,Error(`end() took too long (10s)`));return}}process.nextTick(()=>{e[m].finished=!0,e.emit(`finish`)})}catch(t){se(e,t)}}}function le(e){let t=()=>{e[m].ending?O(e):e[m].needDrain&&process.nextTick(T,e)};for(e[m].flushing=!1;e[m].bufLen!==0;){let n=Atomics.load(e[m].state,l),r=e[m].data.length-n;if(r===0){ue(e),v(e);continue}else if(r<0)throw Error(`overwritten`);ce(e,r,t)}}function ue(e){if(e[m].flushing)throw Error(`unable to flush while flushing`);let t=Atomics.load(e[m].state,l),n=0;for(;;){let r=Atomics.load(e[m].state,u);if(r===-2)throw Error(`_flushSync failed`);if(r!==t)Atomics.wait(e[m].state,u,r,1e3);else break;if(++n===10)throw Error(`_flushSync took too long (10s)`)}}n.exports=te})),C$=i(((e,n)=>{let{createRequire:r}=t(`module`),{existsSync:i}=t(`node:fs`),a=_$(),{join:o,isAbsolute:s,sep:c}=t(`node:path`),{fileURLToPath:l}=t(`node:url`),u=b$(),d=S$(),f=Jfe();function p(e){d.register(e,y),d.registerBeforeExit(e,b),e.on(`close`,function(){d.unregister(e)})}function m(){let e=process.execArgv;for(let t=0;t<e.length;t++){let n=e[t];if(n===`--import`||n===`--require`||n===`-r`||n.startsWith(`--import=`)||n.startsWith(`--require=`)||n.startsWith(`-r=`))return!0}return!1}function h(e){let t=e.match(/(?:[^\s"']+|"[^"]*"|'[^']*')+/g);if(!t)return e;let n=[],r=!1;for(let e=0;e<t.length;e++){let i=t[e];if(i===`--require`||i===`-r`||i===`--import`){let a=t[e+1];if(a&&g(a)){r=!0,e++;continue}n.push(i),a&&(n.push(a),e++);continue}if((i.startsWith(`--require=`)||i.startsWith(`-r=`)||i.startsWith(`--import=`))&&g(i.slice(i.indexOf(`=`)+1))){r=!0;continue}n.push(i)}return r?n.join(` `):e}function g(e){let t=_(e);if(!t)return!1;let n=t;if(n.startsWith(`file://`))try{n=l(n)}catch{return!1}return s(n)&&!i(n)}function _(e){let t=e[0],n=e[e.length-1];return t===`"`&&n===`"`||t===`'`&&n===`'`?e.slice(1,-1):e}function v(e,n,r,i,a){if(!r.execArgv&&m()&&t.main===void 0&&(r={...r,execArgv:[]}),!r.env&&process.env.NODE_OPTIONS){let e=h(process.env.NODE_OPTIONS);e!==process.env.NODE_OPTIONS&&(r={...r,env:{...process.env,NODE_OPTIONS:e}})}r={...r,name:a};let o=new f({filename:e,workerData:n,workerOpts:r,sync:i});o.on(`ready`,s),o.on(`close`,function(){process.removeListener(`exit`,c)}),process.on(`exit`,c);function s(){process.removeListener(`exit`,c),o.unref(),r.autoEnd!==!1&&p(o)}function c(){o.closed||(o.flushSync(),u(100),o.end())}return o}function y(e){e.ref(),e.flushSync(),e.end(),e.once(`close`,function(){e.unref()})}function b(e){e.flushSync()}function x(e){let{pipeline:t,targets:n,levels:i,dedupe:l,worker:u={},caller:d=a(),sync:f=!1}=e,p={...e.options},m=typeof d==`string`?[d]:d,h=typeof globalThis==`object`&&Object.prototype.hasOwnProperty.call(globalThis,`__bundlerPathsOverrides`)&&globalThis.__bundlerPathsOverrides&&typeof globalThis.__bundlerPathsOverrides==`object`?globalThis.__bundlerPathsOverrides:Object.create(null),g=e.target;if(g&&n)throw Error(`only one of target or targets can be specified`);n?(g=h[`pino-worker`]||o(__dirname,`worker.js`),p.targets=n.filter(e=>e.target).map(e=>({...e,target:y(e.target)})),p.pipelines=n.filter(e=>e.pipeline).map(e=>e.pipeline.map(t=>({...t,level:e.level,target:y(t.target)})))):t&&(g=h[`pino-worker`]||o(__dirname,`worker.js`),p.pipelines=[t.map(e=>({...e,target:y(e.target)}))]),i&&(p.levels=i),l&&(p.dedupe=l),p.pinoWillSendConfig=!0;let _=n||t?`pino.transport`:g;return v(y(g),p,u,f,_);function y(e){if(e=h[e]||e,s(e)||e.indexOf(`file://`)===0)return e;if(e===`pino/file`)return o(__dirname,`..`,`file.js`);let t;for(let n of m)try{t=r(n===`node:repl`?process.cwd()+c:n).resolve(e);break}catch{continue}if(!t)throw Error(`unable to determine transport target for "${e}"`);return t}}n.exports=x})),w$=i(((e,n)=>{let r=t(`node:diagnostics_channel`),i=Wfe(),{mapHttpRequest:a,mapHttpResponse:o}=g$(),s=x$(),c=S$(),{lsCacheSym:l,chindingsSym:u,writeSym:d,serializersSym:f,formatOptsSym:p,endSym:m,stringifiersSym:h,stringifySym:g,stringifySafeSym:_,wildcardFirstSym:v,nestedKeySym:y,formattersSym:b,messageKeySym:x,errorKeySym:S,nestedKeyStrSym:C,msgPrefixSym:w}=v$(),{isMainThread:T}=t(`worker_threads`),E=C$(),[D]=process.versions.node.split(`.`).map(e=>Number(e)),ee=r.tracingChannel(`pino_asJson`),te=D>=25?e=>JSON.stringify(e):ie;function ne(){}function re(e,t){if(!t)return n;return function(...r){t.call(this,r,n,e)};function n(t,...n){if(typeof t==`object`){let r=t;t!==null&&(t.method&&t.headers&&t.socket?t=a(t):typeof t.setHeader==`function`&&(t=o(t)));let s;r===null&&n.length===0?s=[null]:(r=n.shift(),s=n),typeof this[w]==`string`&&r!=null&&(r=this[w]+r),this[d](t,i(r,s,this[p]),e)}else{let r=t===void 0?n.shift():t;typeof this[w]==`string`&&r!=null&&(r=this[w]+r),this[d](null,i(r,n,this[p]),e)}}}function ie(e){let t=``,n=0,r=!1,i=255,a=e.length;if(a>100)return JSON.stringify(e);for(var o=0;o<a&&i>=32;o++)i=e.charCodeAt(o),(i===34||i===92)&&(t+=e.slice(n,o)+`\\`,n=o,r=!0);return r?t+=e.slice(n):t=e,i<32?JSON.stringify(e):`"`+t+`"`}function ae(e,t,n,r){if(ee.hasSubscribers===!1)return oe.call(this,e,t,n,r);let i={instance:this,arguments};return ee.traceSync(oe,i,this,e,t,n,r)}function oe(e,t,n,r){let i=this[g],a=this[_],o=this[h],s=this[m],c=this[u],d=this[f],p=this[b],w=this[x],T=this[S],E=this[l][n]+r;E+=c;let D;p.log&&(e=p.log(e));let ee=o[v],ne=``;for(let t in e)if(D=e[t],Object.prototype.hasOwnProperty.call(e,t)&&D!==void 0){d[t]?D=d[t](D):t===T&&d.err&&(D=d.err(D));let e=o[t]||ee;switch(typeof D){case`undefined`:case`function`:continue;case`number`:Number.isFinite(D)===!1&&(D=null);case`boolean`:e&&(D=e(D));break;case`string`:D=(e||te)(D);break;default:D=(e||i)(D,a)}if(D===void 0)continue;let n=te(t);ne+=`,`+n+`:`+D}let re=``;if(t!==void 0){D=d[w]?d[w](t):t;let e=o[w]||ee;switch(typeof D){case`function`:break;case`number`:Number.isFinite(D)===!1&&(D=null);case`boolean`:e&&(D=e(D)),re=`,"`+w+`":`+D;break;case`string`:D=(e||te)(D),re=`,"`+w+`":`+D;break;default:D=(e||i)(D,a),re=`,"`+w+`":`+D}}return this[y]&&ne?E+this[C]+ne.slice(1)+`}`+re+s:E+ne+re+s}function se(e,t){let n,r=e[u],i=e[g],a=e[_],o=e[h],s=o[v],c=e[f],l=e[b].bindings;t=l(t);for(let e in t)if(n=t[e],((e.length<5||e!==`level`&&e!==`serializers`&&e!==`formatters`&&e!==`customLevels`)&&t.hasOwnProperty(e)&&n!==void 0)===!0){if(n=c[e]?c[e](n):n,n=(o[e]||s||i)(n,a),n===void 0)continue;r+=`,"`+e+`":`+n}return r}function ce(e){return e.write!==e.constructor.prototype.write}function O(e){let t=new s(e);return t.on(`error`,n),!e.sync&&T&&(c.register(t,le),t.on(`close`,function(){c.unregister(t)})),t;function n(e){if(e.code===`EPIPE`){t.write=ne,t.end=ne,t.flushSync=ne,t.destroy=ne;return}t.removeListener(`error`,n),t.emit(`error`,e)}}function le(e,t){e.destroyed||(t===`beforeExit`?(e.flush(),e.on(`drain`,function(){e.end()})):e.flushSync())}function ue(e){return function(t,n,r={},i){if(typeof r==`string`)i=O({dest:r}),r={};else if(typeof i==`string`){if(r&&r.transport)throw Error(`only one of option.transport or stream can be specified`);i=O({dest:i})}else if(r instanceof s||r.writable||r._writableState)i=r,r={};else if(r.transport){if(r.transport instanceof s||r.transport.writable||r.transport._writableState)throw Error(`option.transport do not allow stream, please pass to option directly. e.g. pino(transport)`);if(r.transport.targets&&r.transport.targets.length&&r.formatters&&typeof r.formatters.level==`function`)throw Error(`option.transport.targets do not allow custom level formatters`);let e;r.customLevels&&(e=r.useOnlyCustomLevels?r.customLevels:Object.assign({},r.levels,r.customLevels)),i=E({caller:n,...r.transport,levels:e})}if(r=Object.assign({},e,r),r.serializers=Object.assign({},e.serializers,r.serializers),r.formatters=Object.assign({},e.formatters,r.formatters),r.prettyPrint)throw Error(`prettyPrint option is no longer supported, see the pino-pretty package (https://github.com/pinojs/pino-pretty)`);let{enabled:a,onChild:o}=r;return a===!1&&(r.level=`silent`),o||(r.onChild=ne),i||=ce(process.stdout)?process.stdout:O({fd:process.stdout.fd||1}),{opts:r,stream:i}}}function de(e,t){try{return JSON.stringify(e)}catch{try{return(t||this[_])(e)}catch{return`"[unable to serialize, circular reference is too complex to analyze]"`}}}function k(e,t,n){return{level:e,bindings:t,log:n}}function A(e){let t=Number(e);return typeof e==`string`&&Number.isFinite(t)?t:e===void 0?1:e}n.exports={noop:ne,buildSafeSonicBoom:O,asChindings:se,asJson:ae,genLog:re,createArgsNormalizer:ue,stringify:de,buildFormatters:k,normalizeDestFileDescriptor:A}})),T$=i(((e,t)=>{t.exports={DEFAULT_LEVELS:{trace:10,debug:20,info:30,warn:40,error:50,fatal:60},SORTING_ORDER:{ASC:`ASC`,DESC:`DESC`}}})),E$=i(((e,t)=>{let{lsCacheSym:n,levelValSym:r,useOnlyCustomLevelsSym:i,streamSym:a,formattersSym:o,hooksSym:s,levelCompSym:c}=v$(),{noop:l,genLog:u}=w$(),{DEFAULT_LEVELS:d,SORTING_ORDER:f}=T$(),p={fatal:e=>{let t=u(d.fatal,e);return function(...e){let n=this[a];if(t.call(this,...e),typeof n.flushSync==`function`)try{n.flushSync()}catch{}}},error:e=>u(d.error,e),warn:e=>u(d.warn,e),info:e=>u(d.info,e),debug:e=>u(d.debug,e),trace:e=>u(d.trace,e)},m=Object.keys(d).reduce((e,t)=>(e[d[t]]=t,e),{}),h=Object.keys(m).reduce((e,t)=>(e[t]=`{"level":`+Number(t),e),{});function g(e){let t=e[o].level,{labels:r}=e.levels,i={};for(let e in r){let n=t(r[e],Number(e));i[e]=JSON.stringify(n).slice(0,-1)}return e[n]=i,e}function _(e,t){if(t)return!1;switch(e){case`fatal`:case`error`:case`warn`:case`info`:case`debug`:case`trace`:return!0;default:return!1}}function v(e){let{labels:t,values:n}=this.levels;if(typeof e==`number`){if(t[e]===void 0)throw Error(`unknown level value`+e);e=t[e]}if(n[e]===void 0)throw Error(`unknown level `+e);let a=this[r],o=this[r]=n[e],d=this[i],f=this[c],m=this[s].logMethod;for(let e in n){if(f(n[e],o)===!1){this[e]=l;continue}this[e]=_(e,d)?p[e](m):u(n[e],m)}this.emit(`level-change`,e,o,t[a],a,this)}function y(e){let{levels:t,levelVal:n}=this;return t&&t.labels?t.labels[n]:``}function b(e){let{values:t}=this.levels,n=t[e];return n!==void 0&&this[c](n,this[r])}function x(e,t,n){return e===f.DESC?t<=n:t>=n}function S(e){return typeof e==`string`?x.bind(null,e):e}function C(e=null,t=!1){let n=e?Object.keys(e).reduce((t,n)=>(t[e[n]]=n,t),{}):null;return{labels:Object.assign(Object.create(Object.prototype,{Infinity:{value:`silent`}}),t?null:m,n),values:Object.assign(Object.create(Object.prototype,{silent:{value:1/0}}),t?null:d,e)}}function w(e,t,n){if(typeof e==`number`){if(![].concat(Object.keys(t||{}).map(e=>t[e]),n?[]:Object.keys(m).map(e=>+e),1/0).includes(e))throw Error(`default level:${e} must be included in custom levels`);return}if(!(e in Object.assign(Object.create(Object.prototype,{silent:{value:1/0}}),n?null:d,t)))throw Error(`default level:${e} must be included in custom levels`)}function T(e,t){let{labels:n,values:r}=e;for(let e in t){if(e in r)throw Error(`levels cannot be overridden`);if(t[e]in n)throw Error(`pre-existing level values cannot be used for new levels`)}}function E(e){if(typeof e!=`function`&&!(typeof e==`string`&&Object.values(f).includes(e)))throw Error(`Levels comparison should be one of "ASC", "DESC" or "function" type`)}t.exports={initialLsCache:h,genLsCache:g,levelMethods:p,getLevel:y,setLevel:v,isLevelEnabled:b,mappings:C,assertNoLevelCollisions:T,assertDefaultLevelFound:w,genLevelComparison:S,assertLevelComparison:E}})),D$=i(((e,t)=>{t.exports={version:`10.3.1`}})),Yfe=i(((e,n)=>{let{EventEmitter:r}=t(`node:events`),{lsCacheSym:i,levelValSym:a,setLevelSym:o,getLevelSym:s,chindingsSym:c,mixinSym:l,asJsonSym:u,writeSym:d,mixinMergeStrategySym:f,timeSym:p,timeSliceIndexSym:m,streamSym:h,serializersSym:g,formattersSym:_,errorKeySym:v,messageKeySym:y,useOnlyCustomLevelsSym:b,needsMetadataGsym:x,redactFmtSym:S,stringifySym:C,formatOptsSym:w,stringifiersSym:T,msgPrefixSym:E,hooksSym:D}=v$(),{getLevel:ee,setLevel:te,isLevelEnabled:ne,mappings:re,initialLsCache:ie,genLsCache:ae,assertNoLevelCollisions:oe}=E$(),{asChindings:se,asJson:ce,buildFormatters:O,stringify:le,noop:ue}=w$(),{version:de}=D$(),k=y$(),A={constructor:class{},child:pe,bindings:me,setBindings:he,flush:ge,isLevelEnabled:ne,version:de,get level(){return this[s]()},set level(e){this[o](e)},get levelVal(){return this[a]},set levelVal(e){throw Error(`levelVal is read-only`)},get msgPrefix(){return this[E]},get[Symbol.toStringTag](){return`Pino`},[i]:ie,[d]:M,[u]:ce,[s]:ee,[o]:te};Object.setPrototypeOf(A,r.prototype),n.exports=function(){return Object.create(A)};let fe=e=>e;function pe(e,t){if(!e)throw Error(`missing bindings for child Pino`);let n=this[g],r=this[_],i=Object.create(this);if(t==null)return i[_].bindings!==fe&&(i[_]=O(r.level,fe,r.log)),i[c]=se(i,e),this.onChild!==ue&&this.onChild(i),i;if(t.hasOwnProperty(`serializers`)===!0){i[g]=Object.create(null);for(let e in n)i[g][e]=n[e];let e=Object.getOwnPropertySymbols(n);for(var a=0;a<e.length;a++){let t=e[a];i[g][t]=n[t]}for(let e in t.serializers)i[g][e]=t.serializers[e];let r=Object.getOwnPropertySymbols(t.serializers);for(var s=0;s<r.length;s++){let e=r[s];i[g][e]=t.serializers[e]}}else i[g]=n;if(t.hasOwnProperty(`formatters`)){let{level:e,bindings:n,log:a}=t.formatters;i[_]=O(e||r.level,n||fe,a||r.log)}else i[_]=O(r.level,fe,r.log);if(t.hasOwnProperty(`customLevels`)===!0&&(oe(this.levels,t.customLevels),i.levels=re(t.customLevels,i[b]),ae(i)),typeof t.redact==`object`&&t.redact!==null||Array.isArray(t.redact)){i.redact=t.redact;let e=k(i.redact,le),n={stringify:e[S]};i[C]=le,i[T]=e,i[w]=n}if(typeof t.msgPrefix==`string`&&(i[E]=(this[E]||``)+t.msgPrefix),i[c]=se(i,e),t.level!==void 0&&t.level!==this.level||t.hasOwnProperty(`customLevels`)){let e=t.level||this.level;i[o](e)}return this.onChild(i),i}function me(){let e=`{${this[c].substr(1)}}`,t=JSON.parse(e);return delete t.pid,delete t.hostname,t}function he(e){let t=se(this,e);this[c]=t}function j(e,t){return Object.assign(t,e)}function M(e,t,n){let r=this[p](),i=this[l],a=this[v],o=this[y],s=this[f]||j,c,d=this[D].streamWrite;e==null?c={}:e instanceof Error?(c={[a]:e},t===void 0&&(t=e.message)):(c=e,t===void 0&&e[o]===void 0&&e[a]&&(t=e[a].message)),i&&(c=s(c,i(c,n,this)));let g=this[u](c,t,n,r),_=this[h];_[x]===!0&&(_.lastLevel=n,_.lastObj=c,_.lastMsg=t,_.lastTime=r.slice(this[m]),_.lastLogger=this),_.write(d?d(g):g)}function ge(e){if(e!=null&&typeof e!=`function`)throw Error(`callback must be a function`);let t=this[h];typeof t.flush==`function`?t.flush(e||ue):e&&e()}})),Xfe=i(((e,t)=>{let{hasOwnProperty:n}=Object.prototype,r=_();r.configure=_,r.stringify=r,r.default=r,e.stringify=r,e.configure=_,t.exports=r;let i=/[\u0000-\u001f\u0022\u005c\ud800-\udfff]/;function a(e){return e.length<5e3&&!i.test(e)?`"${e}"`:JSON.stringify(e)}function o(e,t){if(e.length>200||t)return e.sort(t);for(let t=1;t<e.length;t++){let n=e[t],r=t;for(;r!==0&&e[r-1]>n;)e[r]=e[r-1],r--;e[r]=n}return e}let s=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(Object.getPrototypeOf(new Int8Array)),Symbol.toStringTag).get;function c(e){return s.call(e)!==void 0&&e.length!==0}function l(e,t,n){e.length<n&&(n=e.length);let r=t===`,`?``:` `,i=`"0":${r}${e[0]}`;for(let a=1;a<n;a++)i+=`${t}"${a}":${r}${e[a]}`;return i}function u(e){if(n.call(e,`circularValue`)){let t=e.circularValue;if(typeof t==`string`)return`"${t}"`;if(t==null)return t;if(t===Error||t===TypeError)return{toString(){throw TypeError(`Converting circular structure to JSON`)}};throw TypeError(`The "circularValue" argument must be of type string or the value null or undefined`)}return`"[Circular]"`}function d(e){let t;if(n.call(e,`deterministic`)&&(t=e.deterministic,typeof t!=`boolean`&&typeof t!=`function`))throw TypeError(`The "deterministic" argument must be of type boolean or comparator function`);return t===void 0?!0:t}function f(e,t){let r;if(n.call(e,t)&&(r=e[t],typeof r!=`boolean`))throw TypeError(`The "${t}" argument must be of type boolean`);return r===void 0?!0:r}function p(e,t){let r;if(n.call(e,t)){if(r=e[t],typeof r!=`number`)throw TypeError(`The "${t}" argument must be of type number`);if(!Number.isInteger(r))throw TypeError(`The "${t}" argument must be an integer`);if(r<1)throw RangeError(`The "${t}" argument must be >= 1`)}return r===void 0?1/0:r}function m(e){return e===1?`1 item`:`${e} items`}function h(e){let t=new Set;for(let n of e)(typeof n==`string`||typeof n==`number`)&&t.add(String(n));return t}function g(e){if(n.call(e,`strict`)){let t=e.strict;if(typeof t!=`boolean`)throw TypeError(`The "strict" argument must be of type boolean`);if(t)return e=>{let t=`Object can not safely be stringified. Received type ${typeof e}`;throw typeof e!=`function`&&(t+=` (${e.toString()})`),Error(t)}}}function _(e){e={...e};let t=g(e);t&&(e.bigint===void 0&&(e.bigint=!1),`circularValue`in e||(e.circularValue=Error));let n=u(e),r=f(e,`bigint`),i=d(e),s=typeof i==`function`?i:void 0,_=p(e,`maximumDepth`),v=p(e,`maximumBreadth`);function y(e,l,u,d,f,p){let h=l[e];switch(typeof h==`object`&&h&&typeof h.toJSON==`function`&&(h=h.toJSON(e)),h=d.call(l,e,h),typeof h){case`string`:return a(h);case`object`:{if(h===null)return`null`;if(u.indexOf(h)!==-1)return n;let e=``,t=`,`,r=p;if(Array.isArray(h)){if(h.length===0)return`[]`;if(_<u.length+1)return`"[Array]"`;u.push(h),f!==``&&(p+=f,e+=`\n${p}`,t=`,\n${p}`);let n=Math.min(h.length,v),i=0;for(;i<n-1;i++){let n=y(String(i),h,u,d,f,p);e+=n===void 0?`null`:n,e+=t}let a=y(String(i),h,u,d,f,p);if(e+=a===void 0?`null`:a,h.length-1>v){let n=h.length-v-1;e+=`${t}"... ${m(n)} not stringified"`}return f!==``&&(e+=`\n${r}`),u.pop(),`[${e}]`}let l=Object.keys(h),g=l.length;if(g===0)return`{}`;if(_<u.length+1)return`"[Object]"`;let b=``,x=``;f!==``&&(p+=f,t=`,\n${p}`,b=` `);let S=Math.min(g,v);i&&!c(h)&&(l=o(l,s)),u.push(h);for(let n=0;n<S;n++){let r=l[n],i=y(r,h,u,d,f,p);i!==void 0&&(e+=`${x}${a(r)}:${b}${i}`,x=t)}if(g>v){let n=g-v;e+=`${x}"...":${b}"${m(n)} not stringified"`,x=t}return f!==``&&x.length>1&&(e=`\n${p}${e}\n${r}`),u.pop(),`{${e}}`}case`number`:return isFinite(h)?String(h):t?t(h):`null`;case`boolean`:return h===!0?`true`:`false`;case`undefined`:return;case`bigint`:if(r)return String(h);default:return t?t(h):void 0}}function b(e,i,o,s,c,l){switch(typeof i==`object`&&i&&typeof i.toJSON==`function`&&(i=i.toJSON(e)),typeof i){case`string`:return a(i);case`object`:{if(i===null)return`null`;if(o.indexOf(i)!==-1)return n;let e=l,t=``,r=`,`;if(Array.isArray(i)){if(i.length===0)return`[]`;if(_<o.length+1)return`"[Array]"`;o.push(i),c!==``&&(l+=c,t+=`\n${l}`,r=`,\n${l}`);let n=Math.min(i.length,v),a=0;for(;a<n-1;a++){let e=b(String(a),i[a],o,s,c,l);t+=e===void 0?`null`:e,t+=r}let u=b(String(a),i[a],o,s,c,l);if(t+=u===void 0?`null`:u,i.length-1>v){let e=i.length-v-1;t+=`${r}"... ${m(e)} not stringified"`}return c!==``&&(t+=`\n${e}`),o.pop(),`[${t}]`}o.push(i);let u=``;c!==``&&(l+=c,r=`,\n${l}`,u=` `);let d=``;for(let e of s){let n=b(e,i[e],o,s,c,l);n!==void 0&&(t+=`${d}${a(e)}:${u}${n}`,d=r)}return c!==``&&d.length>1&&(t=`\n${l}${t}\n${e}`),o.pop(),`{${t}}`}case`number`:return isFinite(i)?String(i):t?t(i):`null`;case`boolean`:return i===!0?`true`:`false`;case`undefined`:return;case`bigint`:if(r)return String(i);default:return t?t(i):void 0}}function x(e,u,d,f,p){switch(typeof u){case`string`:return a(u);case`object`:{if(u===null)return`null`;if(typeof u.toJSON==`function`){if(u=u.toJSON(e),typeof u!=`object`)return x(e,u,d,f,p);if(u===null)return`null`}if(d.indexOf(u)!==-1)return n;let t=p;if(Array.isArray(u)){if(u.length===0)return`[]`;if(_<d.length+1)return`"[Array]"`;d.push(u),p+=f;let e=`\n${p}`,n=`,\n${p}`,r=Math.min(u.length,v),i=0;for(;i<r-1;i++){let t=x(String(i),u[i],d,f,p);e+=t===void 0?`null`:t,e+=n}let a=x(String(i),u[i],d,f,p);if(e+=a===void 0?`null`:a,u.length-1>v){let t=u.length-v-1;e+=`${n}"... ${m(t)} not stringified"`}return e+=`\n${t}`,d.pop(),`[${e}]`}let r=Object.keys(u),h=r.length;if(h===0)return`{}`;if(_<d.length+1)return`"[Object]"`;p+=f;let g=`,\n${p}`,y=``,b=``,S=Math.min(h,v);c(u)&&(y+=l(u,g,v),r=r.slice(u.length),S-=u.length,b=g),i&&(r=o(r,s)),d.push(u);for(let e=0;e<S;e++){let t=r[e],n=x(t,u[t],d,f,p);n!==void 0&&(y+=`${b}${a(t)}: ${n}`,b=g)}if(h>v){let e=h-v;y+=`${b}"...": "${m(e)} not stringified"`,b=g}return b!==``&&(y=`\n${p}${y}\n${t}`),d.pop(),`{${y}}`}case`number`:return isFinite(u)?String(u):t?t(u):`null`;case`boolean`:return u===!0?`true`:`false`;case`undefined`:return;case`bigint`:if(r)return String(u);default:return t?t(u):void 0}}function S(e,u,d){switch(typeof u){case`string`:return a(u);case`object`:{if(u===null)return`null`;if(typeof u.toJSON==`function`){if(u=u.toJSON(e),typeof u!=`object`)return S(e,u,d);if(u===null)return`null`}if(d.indexOf(u)!==-1)return n;let t=``,r=u.length!==void 0;if(r&&Array.isArray(u)){if(u.length===0)return`[]`;if(_<d.length+1)return`"[Array]"`;d.push(u);let e=Math.min(u.length,v),n=0;for(;n<e-1;n++){let e=S(String(n),u[n],d);t+=e===void 0?`null`:e,t+=`,`}let r=S(String(n),u[n],d);if(t+=r===void 0?`null`:r,u.length-1>v){let e=u.length-v-1;t+=`,"... ${m(e)} not stringified"`}return d.pop(),`[${t}]`}let f=Object.keys(u),p=f.length;if(p===0)return`{}`;if(_<d.length+1)return`"[Object]"`;let h=``,g=Math.min(p,v);r&&c(u)&&(t+=l(u,`,`,v),f=f.slice(u.length),g-=u.length,h=`,`),i&&(f=o(f,s)),d.push(u);for(let e=0;e<g;e++){let n=f[e],r=S(n,u[n],d);r!==void 0&&(t+=`${h}${a(n)}:${r}`,h=`,`)}if(p>v){let e=p-v;t+=`${h}"...":"${m(e)} not stringified"`}return d.pop(),`{${t}}`}case`number`:return isFinite(u)?String(u):t?t(u):`null`;case`boolean`:return u===!0?`true`:`false`;case`undefined`:return;case`bigint`:if(r)return String(u);default:return t?t(u):void 0}}function C(e,t,n){if(arguments.length>1){let r=``;if(typeof n==`number`?r=` `.repeat(Math.min(n,10)):typeof n==`string`&&(r=n.slice(0,10)),t!=null){if(typeof t==`function`)return y(``,{"":e},[],t,r,``);if(Array.isArray(t))return b(``,e,[],h(t),r,``)}if(r.length!==0)return x(``,e,[],r,``)}return S(``,e,[])}return C}})),Zfe=i(((e,t)=>{let n=Symbol.for(`pino.metadata`),{DEFAULT_LEVELS:r}=T$(),i=r.info;function a(e,t){e||=[],t||={dedupe:!1};let a=Object.create(r);a.silent=1/0,t.levels&&typeof t.levels==`object`&&Object.keys(t.levels).forEach(e=>{a[e]=t.levels[e]});let u={write:d,add:m,remove:h,emit:f,flushSync:p,end:g,minLevel:0,lastId:0,streams:[],clone:_,[n]:!0,streamLevels:a};return Array.isArray(e)?e.forEach(m,u):m.call(u,e),e=null,u;function d(e){let r,i=this.lastLevel,{streams:a}=this,o=0,u;for(let d=s(a.length,t.dedupe);l(d,a.length,t.dedupe);d=c(d,t.dedupe))if(r=a[d],r.level<=i){if(o!==0&&o!==r.level)break;if(u=r.stream,u[n]){let{lastTime:e,lastMsg:t,lastObj:n,lastLogger:r}=this;u.lastLevel=i,u.lastTime=e,u.lastMsg=t,u.lastObj=n,u.lastLogger=r}u.write(e),t.dedupe&&(o=r.level)}else if(!t.dedupe)break}function f(...e){for(let{stream:t}of this.streams)typeof t.emit==`function`&&t.emit(...e)}function p(){for(let{stream:e}of this.streams)typeof e.flushSync==`function`&&e.flushSync()}function m(e){if(!e)return u;let t=typeof e.write==`function`||e.stream,n=e.write?e:e.stream;if(!t)throw Error(`stream object needs to implement either StreamEntry or DestinationStream interface`);let{streams:r,streamLevels:a}=this,s;s=typeof e.levelVal==`number`?e.levelVal:typeof e.level==`string`?a[e.level]:typeof e.level==`number`?e.level:i;let c={stream:n,level:s,levelVal:void 0,id:++u.lastId};return r.unshift(c),r.sort(o),this.minLevel=r[0].level,u}function h(e){let{streams:t}=this,n=t.findIndex(t=>t.id===e);return n>=0&&(t.splice(n,1),t.sort(o),this.minLevel=t.length>0?t[0].level:-1),u}function g(){for(let{stream:e}of this.streams)typeof e.flushSync==`function`&&e.flushSync(),e.end()}function _(e){let t=Array(this.streams.length);for(let n=0;n<t.length;n++)t[n]={level:e,stream:this.streams[n].stream};return{write:d,add:m,remove:h,minLevel:e,streams:t,clone:_,emit:f,flushSync:p,[n]:!0}}}function o(e,t){return e.level-t.level}function s(e,t){return t?e-1:0}function c(e,t){return t?e-1:e+1}function l(e,t,n){return n?e>=0:e<t}t.exports=a})),Qfe=i(((e,n)=>{let r=t(`node:os`),i=g$(),a=_$(),o=y$(),s=Ufe(),c=Yfe(),l=v$(),{configure:u}=Xfe(),{assertDefaultLevelFound:d,mappings:f,genLsCache:p,genLevelComparison:m,assertLevelComparison:h}=E$(),{DEFAULT_LEVELS:g,SORTING_ORDER:_}=T$(),{createArgsNormalizer:v,asChindings:y,buildSafeSonicBoom:b,buildFormatters:x,stringify:S,normalizeDestFileDescriptor:C,noop:w}=w$(),{version:T}=D$(),{chindingsSym:E,redactFmtSym:D,serializersSym:ee,timeSym:te,timeSliceIndexSym:ne,streamSym:re,stringifySym:ie,stringifySafeSym:ae,stringifiersSym:oe,setLevelSym:se,endSym:ce,formatOptsSym:O,messageKeySym:le,errorKeySym:ue,nestedKeySym:de,mixinSym:k,levelCompSym:A,useOnlyCustomLevelsSym:fe,formattersSym:pe,hooksSym:me,nestedKeyStrSym:he,mixinMergeStrategySym:j,msgPrefixSym:M}=l,{epochTime:ge,nullTime:_e}=s,{pid:ve}=process,ye=r.hostname(),be=i.err,xe=v({level:`info`,levelComparison:_.ASC,levels:g,messageKey:`msg`,errorKey:`err`,nestedKey:null,enabled:!0,base:{pid:ve,hostname:ye},serializers:Object.assign(Object.create(null),{err:be}),formatters:Object.assign(Object.create(null),{bindings(e){return e},level(e,t){return{level:t}}}),hooks:{logMethod:void 0,streamWrite:void 0},timestamp:ge,name:void 0,redact:null,customLevels:null,useOnlyCustomLevels:!1,depthLimit:5,edgeLimit:100}),Se=Object.assign(Object.create(null),i);function Ce(...e){let t={},{opts:n,stream:r}=xe(t,a(),...e);n.level&&typeof n.level==`string`&&g[n.level.toLowerCase()]!==void 0&&(n.level=n.level.toLowerCase());let{redact:i,crlf:s,serializers:l,timestamp:_,messageKey:v,errorKey:b,nestedKey:C,base:T,name:ve,level:ye,customLevels:be,levelComparison:Se,mixin:Ce,mixinMergeStrategy:we,useOnlyCustomLevels:Te,formatters:Ee,hooks:De,depthLimit:Oe,edgeLimit:ke,onChild:Ae,msgPrefix:je}=n,Me=u({maximumDepth:Oe,maximumBreadth:ke}),Ne=x(Ee.level,Ee.bindings,Ee.log),Pe=S.bind({[ae]:Me}),Fe=i?o(i,Pe):{},Ie=i?{stringify:Fe[D]}:{stringify:Pe},Le=`}`+(s?`\r
416
416
  `:`
417
- `),Re=y.bind(null,{[E]:``,[ee]:l,[oe]:Fe,[ie]:S,[ae]:Me,[pe]:Ne}),ze=``;T!==null&&(ze=Re(ve===void 0?T:Object.assign({},T,{name:ve})));let Be=_ instanceof Function?_:_?ge:_e,Ve=Be().indexOf(`:`)+1;if(Te&&!be)throw Error(`customLevels is required if useOnlyCustomLevels is set true`);if(Ce&&typeof Ce!=`function`)throw Error(`Unknown mixin type "${typeof Ce}" - expected "function"`);if(je&&typeof je!=`string`)throw Error(`Unknown msgPrefix type "${typeof je}" - expected "string"`);d(ye,be,Te);let He=f(be,Te);typeof r.emit==`function`&&r.emit(`message`,{code:`PINO_CONFIG`,config:{levels:He,messageKey:v,errorKey:b}}),h(Se);let Ue=m(Se);return Object.assign(t,{levels:He,[A]:Ue,[fe]:Te,[re]:r,[te]:Be,[ne]:Ve,[ie]:S,[ae]:Me,[oe]:Fe,[ce]:Le,[O]:Ie,[le]:v,[ue]:b,[de]:C,[he]:C?`,${JSON.stringify(C)}:{`:``,[ee]:l,[k]:Ce,[j]:we,[E]:ze,[pe]:Ne,[me]:De,silent:w,onChild:Ae,[M]:je}),Object.setPrototypeOf(t,c()),p(t),t[se](ye),t}n.exports=Ce,n.exports.destination=(e=process.stdout.fd)=>typeof e==`object`?(e.dest=C(e.dest||process.stdout.fd),b(e)):b({dest:C(e),minLength:0}),n.exports.transport=C$(),n.exports.multistream=Xfe(),n.exports.levels=f(),n.exports.stdSerializers=Se,n.exports.stdTimeFunctions=Object.assign({},s),n.exports.symbols=l,n.exports.version=T,n.exports.default=Ce,n.exports.pino=Ce})),O$=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=t(`tty`);function r(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach(function(n){if(n!==`default`){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,Object.freeze(t)}var i=r(n);let{env:a={},argv:o=[],platform:s=``}=typeof process>`u`?{}:process,c=`NO_COLOR`in a||o.includes(`--no-color`),l=`FORCE_COLOR`in a||o.includes(`--color`),u=s===`win32`,d=a.TERM===`dumb`,f=i&&i.isatty&&i.isatty(1)&&a.TERM&&!d,p=`CI`in a&&(`GITHUB_ACTIONS`in a||`GITLAB_CI`in a||`CIRCLECI`in a),m=!c&&(l||u&&!d||f||p),h=(e,t,n,r,i=t.substring(0,e)+r,a=t.substring(e+n.length),o=a.indexOf(n))=>i+(o<0?a:h(o,a,n,r)),g=(e,t,n,r,i)=>e<0?n+t+r:n+h(e,t,r,i)+r,_=(e,t,n=e,r=e.length+1)=>i=>i||!(i===``||i===void 0)?g((``+i).indexOf(t,r),i,e,t,n):``,v=(e,t,n)=>_(`\x1b[${e}m`,`\x1b[${t}m`,n),y={reset:v(0,0),bold:v(1,22,`\x1B[22m\x1B[1m`),dim:v(2,22,`\x1B[22m\x1B[2m`),italic:v(3,23),underline:v(4,24),inverse:v(7,27),hidden:v(8,28),strikethrough:v(9,29),black:v(30,39),red:v(31,39),green:v(32,39),yellow:v(33,39),blue:v(34,39),magenta:v(35,39),cyan:v(36,39),white:v(37,39),gray:v(90,39),bgBlack:v(40,49),bgRed:v(41,49),bgGreen:v(42,49),bgYellow:v(43,49),bgBlue:v(44,49),bgMagenta:v(45,49),bgCyan:v(46,49),bgWhite:v(47,49),blackBright:v(90,39),redBright:v(91,39),greenBright:v(92,39),yellowBright:v(93,39),blueBright:v(94,39),magentaBright:v(95,39),cyanBright:v(96,39),whiteBright:v(97,39),bgBlackBright:v(100,49),bgRedBright:v(101,49),bgGreenBright:v(102,49),bgYellowBright:v(103,49),bgBlueBright:v(104,49),bgMagentaBright:v(105,49),bgCyanBright:v(106,49),bgWhiteBright:v(107,49)},b=({useColor:e=m}={})=>e?y:Object.keys(y).reduce((e,t)=>({...e,[t]:String}),{}),{reset:x,bold:S,dim:C,italic:w,underline:T,inverse:E,hidden:D,strikethrough:ee,black:te,red:ne,green:re,yellow:ie,blue:ae,magenta:oe,cyan:se,white:ce,gray:O,bgBlack:le,bgRed:ue,bgGreen:de,bgYellow:k,bgBlue:A,bgMagenta:fe,bgCyan:pe,bgWhite:me,blackBright:he,redBright:j,greenBright:M,yellowBright:ge,blueBright:_e,magentaBright:ve,cyanBright:ye,whiteBright:be,bgBlackBright:xe,bgRedBright:Se,bgGreenBright:Ce,bgYellowBright:we,bgBlueBright:Te,bgMagentaBright:Ee,bgCyanBright:De,bgWhiteBright:Oe}=b();e.bgBlack=le,e.bgBlackBright=xe,e.bgBlue=A,e.bgBlueBright=Te,e.bgCyan=pe,e.bgCyanBright=De,e.bgGreen=de,e.bgGreenBright=Ce,e.bgMagenta=fe,e.bgMagentaBright=Ee,e.bgRed=ue,e.bgRedBright=Se,e.bgWhite=me,e.bgWhiteBright=Oe,e.bgYellow=k,e.bgYellowBright=we,e.black=te,e.blackBright=he,e.blue=ae,e.blueBright=_e,e.bold=S,e.createColors=b,e.cyan=se,e.cyanBright=ye,e.dim=C,e.gray=O,e.green=re,e.greenBright=M,e.hidden=D,e.inverse=E,e.isColorSupported=m,e.italic=w,e.magenta=oe,e.magentaBright=ve,e.red=ne,e.redBright=j,e.reset=x,e.strikethrough=ee,e.underline=T,e.white=ce,e.whiteBright=be,e.yellow=ie,e.yellowBright=ge})),Qfe=i(((e,t)=>{t.exports=n;function n(e,t){if(e&&t)return n(e)(t);if(typeof e!=`function`)throw TypeError(`need wrapper function`);return Object.keys(e).forEach(function(t){r[t]=e[t]}),r;function r(){for(var t=Array(arguments.length),n=0;n<t.length;n++)t[n]=arguments[n];var r=e.apply(this,t),i=t[t.length-1];return typeof r==`function`&&r!==i&&Object.keys(i).forEach(function(e){r[e]=i[e]}),r}}})),k$=i(((e,t)=>{var n=Qfe();t.exports=n(r),t.exports.strict=n(i),r.proto=r(function(){Object.defineProperty(Function.prototype,`once`,{value:function(){return r(this)},configurable:!0}),Object.defineProperty(Function.prototype,`onceStrict`,{value:function(){return i(this)},configurable:!0})});function r(e){var t=function(){return t.called?t.value:(t.called=!0,t.value=e.apply(this,arguments))};return t.called=!1,t}function i(e){var t=function(){if(t.called)throw Error(t.onceError);return t.called=!0,t.value=e.apply(this,arguments)};return t.onceError=(e.name||"Function wrapped with `once`")+` shouldn't be called more than once`,t.called=!1,t}})),$fe=i(((e,t)=>{var n=k$(),r=function(){},i=global.Bare?queueMicrotask:process.nextTick.bind(process),a=function(e){return e.setHeader&&typeof e.abort==`function`},o=function(e){return e.stdio&&Array.isArray(e.stdio)&&e.stdio.length===3},s=function(e,t,c){if(typeof t==`function`)return s(e,null,t);t||={},c=n(c||r);var l=e._writableState,u=e._readableState,d=t.readable||t.readable!==!1&&e.readable,f=t.writable||t.writable!==!1&&e.writable,p=!1,m=function(){e.writable||h()},h=function(){f=!1,d||c.call(e)},g=function(){d=!1,f||c.call(e)},_=function(t){c.call(e,t?Error(`exited with error code: `+t):null)},v=function(t){c.call(e,t)},y=function(){i(b)},b=function(){if(!p&&(d&&!(u&&u.ended&&!u.destroyed)||f&&!(l&&l.ended&&!l.destroyed)))return c.call(e,Error(`premature close`))},x=function(){e.req.on(`finish`,h)};return a(e)?(e.on(`complete`,h),e.on(`abort`,y),e.req?x():e.on(`request`,x)):f&&!l&&(e.on(`end`,m),e.on(`close`,m)),o(e)&&e.on(`exit`,_),e.on(`end`,g),e.on(`finish`,h),t.error!==!1&&e.on(`error`,v),e.on(`close`,y),function(){p=!0,e.removeListener(`complete`,h),e.removeListener(`abort`,y),e.removeListener(`request`,x),e.req&&e.req.removeListener(`finish`,h),e.removeListener(`end`,m),e.removeListener(`close`,m),e.removeListener(`finish`,h),e.removeListener(`exit`,_),e.removeListener(`end`,g),e.removeListener(`error`,v),e.removeListener(`close`,y)}};t.exports=s})),epe=i(((e,n)=>{var r=k$(),i=$fe(),a;try{a=t(`fs`)}catch{}var o=function(){},s=typeof process>`u`?!1:/^v?\.0/.test(process.version),c=function(e){return typeof e==`function`},l=function(e){return!s||!a?!1:(e instanceof(a.ReadStream||o)||e instanceof(a.WriteStream||o))&&c(e.close)},u=function(e){return e.setHeader&&c(e.abort)},d=function(e,t,n,a){a=r(a);var s=!1;e.on(`close`,function(){s=!0}),i(e,{readable:t,writable:n},function(e){if(e)return a(e);s=!0,a()});var d=!1;return function(t){if(!s&&!d){if(d=!0,l(e))return e.close(o);if(u(e))return e.abort();if(c(e.destroy))return e.destroy();a(t||Error(`stream was destroyed`))}}},f=function(e){e()},p=function(e,t){return e.pipe(t)};n.exports=function(){var e=Array.prototype.slice.call(arguments),t=c(e[e.length-1]||o)&&e.pop()||o;if(Array.isArray(e[0])&&(e=e[0]),e.length<2)throw Error(`pump requires two streams per minimum`);var n,r=e.map(function(i,a){var o=a<e.length-1;return d(i,o,a>0,function(e){n||=e,e&&r.forEach(f),!o&&(r.forEach(f),t(n))})});return e.reduce(p)}})),tpe=i(((e,n)=>{let{Transform:r}=t(`stream`),{StringDecoder:i}=t(`string_decoder`),a=Symbol(`last`),o=Symbol(`decoder`);function s(e,t,n){let r;if(this.overflow){if(r=this[o].write(e).split(this.matcher),r.length===1)return n();r.shift(),this.overflow=!1}else this[a]+=this[o].write(e),r=this[a].split(this.matcher);this[a]=r.pop();for(let e=0;e<r.length;e++)try{l(this,this.mapper(r[e]))}catch(e){return n(e)}if(this.overflow=this[a].length>this.maxLength,this.overflow&&!this.skipOverflow){n(Error(`maximum buffer reached`));return}n()}function c(e){if(this[a]+=this[o].end(),this[a])try{l(this,this.mapper(this[a]))}catch(t){return e(t)}e()}function l(e,t){t!==void 0&&e.push(t)}function u(e){return e}function d(e,t,n){switch(e||=/\r?\n/,t||=u,n||={},arguments.length){case 1:typeof e==`function`?(t=e,e=/\r?\n/):typeof e==`object`&&!(e instanceof RegExp)&&!e[Symbol.split]&&(n=e,e=/\r?\n/);break;case 2:typeof e==`function`?(n=t,t=e,e=/\r?\n/):typeof t==`object`&&(n=t,t=u)}n=Object.assign({},n),n.autoDestroy=!0,n.transform=s,n.flush=c,n.readableObjectMode=!0;let l=new r(n);return l[a]=``,l[o]=new i(`utf8`),l.matcher=e,l.mapper=t,l.maxLength=n.maxLength,l.skipOverflow=n.skipOverflow||!1,l.overflow=!1,l._destroy=function(e,t){this._writableState.errorEmitted=!1,t(e)},l}n.exports=d})),npe=i(((e,n)=>{let r=Symbol.for(`pino.metadata`),i=tpe(),{Duplex:a}=t(`stream`),{parentPort:o,workerData:s}=t(`worker_threads`);function c(){let e,t,n=new Promise((n,r)=>{e=n,t=r});return n.resolve=e,n.reject=t,n}n.exports=function(e,t={}){let n=t.expectPinoConfig===!0&&s?.workerData?.pinoWillSendConfig===!0,u=t.parse===`lines`,d=typeof t.parseLine==`function`?t.parseLine:JSON.parse,f=t.close||l,p=i(function(e){let t;try{t=d(e)}catch(t){this.emit(`unknown`,e,t);return}if(t===null){this.emit(`unknown`,e,`Null value ignored`);return}return typeof t!=`object`&&(t={data:t,time:Date.now()}),p[r]&&(p.lastTime=t.time,p.lastLevel=t.level,p.lastObj=t),u?e:t},{autoDestroy:!0});if(p._destroy=function(e,t){let n=f(e,t);n&&typeof n.then==`function`&&n.then(t,t)},t.expectPinoConfig===!0&&s?.workerData?.pinoWillSendConfig!==!0&&setImmediate(()=>{p.emit(`error`,Error(`This transport is not compatible with the current version of pino. Please upgrade pino to the latest version.`))}),t.metadata!==!1&&(p[r]=!0,p.lastTime=0,p.lastLevel=0,p.lastObj=null),n){let e={},t=c();return o.on(`message`,function n(r){r.code===`PINO_CONFIG`&&(e=r.config,t.resolve(),o.off(`message`,n))}),Object.defineProperties(p,{levels:{get(){return e.levels}},messageKey:{get(){return e.messageKey}},errorKey:{get(){return e.errorKey}}}),t.then(m)}return m();function m(){let n=e(p);if(n&&typeof n.catch==`function`)n.catch(e=>{p.destroy(e)}),n=null;else if(t.enablePipelining&&n)return a.from({writable:p,readable:n});return p}};function l(e,t){process.nextTick(t,e)}})),A$=i(((e,t)=>{t.exports={DATE_FORMAT:`yyyy-mm-dd HH:MM:ss.l o`,DATE_FORMAT_SIMPLE:`HH:MM:ss.l`,ERROR_LIKE_KEYS:[`err`,`error`],MESSAGE_KEY:`msg`,LEVEL_KEY:`level`,LEVEL_LABEL:`levelLabel`,TIMESTAMP_KEY:`time`,LEVELS:{default:`USERLVL`,60:`FATAL`,50:`ERROR`,40:`WARN`,30:`INFO`,20:`DEBUG`,10:`TRACE`},LEVEL_NAMES:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},LOGGER_KEYS:[`pid`,`hostname`,`name`,`level`,`time`,`timestamp`,`caller`]}})),j$=i(((e,t)=>{t.exports=i;let{LEVELS:n,LEVEL_NAMES:r}=A$();function i(e,t,i){let a=e?t||n:Object.assign({},n,t),o=e?i||r:Object.assign({},r,i);return function(e){let t=`default`;return t=Number.isInteger(+e)?Object.prototype.hasOwnProperty.call(a,e)?e:t:Object.prototype.hasOwnProperty.call(o,e.toLowerCase())?o[e.toLowerCase()]:t,[a[t],t]}}})),M$=i(((e,t)=>{let n=e=>e,r={default:n,60:n,50:n,40:n,30:n,20:n,10:n,message:n,greyMessage:n,property:n},{createColors:i}=O$(),a=j$(),o=i({useColor:!0}),{white:s,bgRed:c,red:l,yellow:u,green:d,blue:f,gray:p,cyan:m,magenta:h}=o,g={default:s,60:c,50:l,40:u,30:d,20:f,10:p,message:m,greyMessage:p,property:h};function _(e){return e.reduce(function(e,[t,n]){return e[t]=typeof o[n]==`function`?o[n]:s,e},{default:s,message:m,greyMessage:p,property:h})}function v(e){return function(t,n,{customLevels:r,customLevelNames:i}={}){let[o,s]=a(e,r,i)(t);return Object.prototype.hasOwnProperty.call(n,s)?n[s](o):n.default(o)}}function y(e){let t=v(e),n=function(e,n){return t(e,r,n)};return n.message=r.message,n.greyMessage=r.greyMessage,n.property=r.property,n.colors=i({useColor:!1}),n}function b(e){let t=v(e),n=function(e,n){return t(e,g,n)};return n.message=g.message,n.property=g.property,n.greyMessage=g.greyMessage,n.colors=o,n}function x(e,t){let n=_(e),r=t?n:Object.assign({},g,n),i=v(t),a=function(e,t){return i(e,r,t)};return a.colors=o,a.message=a.message||r.message,a.property=a.property||r.property,a.greyMessage=a.greyMessage||r.greyMessage,a}t.exports=function(e=!1,t,n){return e&&t!==void 0?x(t,n):e?b(n):y(n)}})),N$=i(((e,t)=>{t.exports=function(){}})),rpe=i(((e,n)=>{n.exports=o;let{isMainThread:r}=t(`node:worker_threads`),i=x$(),a=N$();function o(e){let t=new i(e);return t.on(`error`,n),!e.sync&&r&&s(t),t;function n(e){if(e.code===`EPIPE`){t.write=a,t.end=a,t.flushSync=a,t.destroy=a;return}t.removeListener(`error`,n)}}function s(e){if(global.WeakRef&&global.WeakMap&&global.FinalizationRegistry){let t=S$();t.register(e,c),e.on(`close`,function(){t.unregister(e)})}}function c(e,t){e.destroyed||(t===`beforeExit`?(e.flush(),e.on(`drain`,function(){e.end()})):e.flushSync())}})),P$=i(((e,t)=>{t.exports=n;function n(e){return e instanceof Date&&!Number.isNaN(e.getTime())}})),F$=i(((e,t)=>{t.exports=r;let n=P$();function r(e){let t=new Date(e);return n(t)||(t=new Date(+e)),t}})),I$=i(((e,t)=>{t.exports=n;function n(e){let t=[],n=!1,r=``;for(let i=0;i<e.length;i++){let a=e.charAt(i);if(a===`\\`){n=!0;continue}if(n){n=!1,r+=a;continue}if(a===`.`){t.push(r),r=``;continue}r+=a}return r.length&&t.push(r),t}})),L$=i(((e,t)=>{t.exports=r;let n=I$();function r(e,t){let r=Array.isArray(t)?t:n(t);for(let t of r){if(!Object.prototype.hasOwnProperty.call(e,t))return;e=e[t]}return e}})),R$=i(((e,t)=>{t.exports=i;let n=L$(),r=I$();function i(e,t){let i=r(t),a=i.pop();e=n(e,i),typeof e==`object`&&e&&Object.prototype.hasOwnProperty.call(e,a)&&delete e[a]}})),ipe=i((e=>{let t=Function.prototype.toString,n=Object.prototype.toString;function r(e){if(!e)return Object.create(null);let n=e.constructor;if(n===Object)return e===Object.prototype?{}:Object.create(e);if(n&&~t.call(n).indexOf(`[native code]`))try{return new n}catch{}return Object.create(e)}function i(e){let t=e[Symbol.toStringTag];if(t)return t;let r=n.call(e);return r.substring(8,r.length-1)}let{propertyIsEnumerable:a}=Object.prototype;function o(e,t,n,r){let i=Object.getOwnPropertyDescriptor(e,n)||{configurable:!0,enumerable:!0,value:e[n],writable:!0},a=i.get||i.set?i:{configurable:i.configurable,enumerable:i.enumerable,value:r.copier(i.value,r),writable:i.writable};try{Object.defineProperty(t,n,a)}catch{t[n]=a.get?a.get():a.value}}function s(e,t,n){for(let r of Object.getOwnPropertyNames(e))o(e,t,r,n);for(let r of Object.getOwnPropertySymbols(e))o(e,t,r,n);return t}function c(e,t){let n=new t.Constructor;t.cache.set(e,n);for(let r=0;r<e.length;++r)n[r]=t.copier(e[r],t);return n}function l(e,t){let n=new t.Constructor;return t.cache.set(e,n),s(e,n,t)}function u(e,t){return e.slice(0)}function d(e,t){return e.slice(0,e.size,e.type)}function f(e,t){return new t.Constructor(u(e.buffer))}function p(e,t){return new t.Constructor(e.getTime())}function m(e,t){let n=new t.Constructor;t.cache.set(e,n);for(let[r,i]of e)n.set(r,t.copier(i,t));return n}function h(e,t){return s(e,m(e,t),t)}function g(e,t){let n=r(t.prototype);t.cache.set(e,n);for(let r of Object.keys(e))n[r]=t.copier(e[r],t);for(let r of Object.getOwnPropertySymbols(e))a.call(e,r)&&(n[r]=t.copier(e[r],t));return n}function _(e,t){let n=r(t.prototype);return t.cache.set(e,n),s(e,n,t)}function v(e,t){return new t.Constructor(e.valueOf())}function y(e,t){let n=new t.Constructor(e.source,e.flags);return n.lastIndex=e.lastIndex,n}function b(e,t){return e}function x(e,t){let n=new t.Constructor;t.cache.set(e,n);for(let r of e)n.add(t.copier(r,t));return n}function S(e,t){return s(e,x(e,t),t)}function C(){return new WeakMap}function w({createCache:e,methods:t,strict:n}){let r={array:n?l:c,arrayBuffer:u,asyncGenerator:b,blob:d,dataView:f,date:p,error:b,generator:b,map:n?h:m,object:n?_:g,regExp:y,set:n?S:x},i=t?Object.assign(r,t):r,a=T(i),o=e||C;if(!a.Object||!a.Array)throw Error(`An object and array copier must be provided.`);return{createCache:o,copiers:a,methods:i,strict:!!n}}function T(e){return{Arguments:e.object,Array:e.array,ArrayBuffer:e.arrayBuffer,AsyncGenerator:e.asyncGenerator,BigInt64Array:e.arrayBuffer,BigUint64Array:e.arrayBuffer,Blob:e.blob,Boolean:v,DataView:e.dataView,Date:e.date,Error:e.error,Float32Array:e.arrayBuffer,Float64Array:e.arrayBuffer,Generator:e.generator,Int8Array:e.arrayBuffer,Int16Array:e.arrayBuffer,Int32Array:e.arrayBuffer,Map:e.map,Number:v,Object:e.object,Promise:b,RegExp:e.regExp,Set:e.set,String:v,WeakMap:b,WeakSet:b,Uint8Array:e.arrayBuffer,Uint8ClampedArray:e.arrayBuffer,Uint16Array:e.arrayBuffer,Uint32Array:e.arrayBuffer}}function E(e={}){let{createCache:t,copiers:n}=w(e),{Array:r,Object:a}=n;function o(e,t){if(t.prototype=t.Constructor=void 0,!e||typeof e!=`object`)return e;if(t.cache.has(e))return t.cache.get(e);if(t.prototype=Object.getPrototypeOf(e),t.Constructor=t.prototype&&t.prototype.constructor,!t.Constructor||t.Constructor===Object)return a(e,t);if(Array.isArray(e))return r(e,t);let o=n[i(e)];return o?o(e,t):typeof e.then==`function`?e:a(e,t)}return function(e){return o(e,{Constructor:void 0,cache:t(),copier:o,prototype:void 0})}}let D=E({strict:!0});e.copy=E(),e.copyStrict=D,e.createCopier=E})),z$=i(((e,t)=>{t.exports=a;let{createCopier:n}=ipe(),r=n({}),i=R$();function a({log:e,context:t}){let{ignoreKeys:n,includeKeys:a}=t,o=r(e);if(a){let e={};return a.forEach(t=>{e[t]=o[t]}),e}return n.forEach(e=>{i(o,e)}),o}})),ape=i(((e,t)=>{function n(e){"@babel/helpers - typeof";return n=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},n(e)}(function(r){var i=arguments,a=function(){var e=/d{1,4}|D{3,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|W{1,2}|[LlopSZN]|"[^"]*"|'[^']*'/g,t=/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,n=/[^-+\dA-Z]/g;return function(r,d,f,p){if(i.length===1&&u(r)===`string`&&!/\d/.test(r)&&(d=r,r=void 0),r=r||r===0?r:new Date,r instanceof Date||(r=new Date(r)),isNaN(r))throw TypeError(`Invalid date`);d=String(a.masks[d]||d||a.masks.default);var m=d.slice(0,4);(m===`UTC:`||m===`GMT:`)&&(d=d.slice(4),f=!0,m===`GMT:`&&(p=!0));var h=function(){return f?`getUTC`:`get`},g=function(){return r[h()+`Date`]()},_=function(){return r[h()+`Day`]()},v=function(){return r[h()+`Month`]()},y=function(){return r[h()+`FullYear`]()},b=function(){return r[h()+`Hours`]()},x=function(){return r[h()+`Minutes`]()},S=function(){return r[h()+`Seconds`]()},C=function(){return r[h()+`Milliseconds`]()},w=function(){return f?0:r.getTimezoneOffset()},T=function(){return c(r)},E=function(){return l(r)},D={d:function(){return g()},dd:function(){return o(g())},ddd:function(){return a.i18n.dayNames[_()]},DDD:function(){return s({y:y(),m:v(),d:g(),_:h(),dayName:a.i18n.dayNames[_()],short:!0})},dddd:function(){return a.i18n.dayNames[_()+7]},DDDD:function(){return s({y:y(),m:v(),d:g(),_:h(),dayName:a.i18n.dayNames[_()+7]})},m:function(){return v()+1},mm:function(){return o(v()+1)},mmm:function(){return a.i18n.monthNames[v()]},mmmm:function(){return a.i18n.monthNames[v()+12]},yy:function(){return String(y()).slice(2)},yyyy:function(){return o(y(),4)},h:function(){return b()%12||12},hh:function(){return o(b()%12||12)},H:function(){return b()},HH:function(){return o(b())},M:function(){return x()},MM:function(){return o(x())},s:function(){return S()},ss:function(){return o(S())},l:function(){return o(C(),3)},L:function(){return o(Math.floor(C()/10))},t:function(){return b()<12?a.i18n.timeNames[0]:a.i18n.timeNames[1]},tt:function(){return b()<12?a.i18n.timeNames[2]:a.i18n.timeNames[3]},T:function(){return b()<12?a.i18n.timeNames[4]:a.i18n.timeNames[5]},TT:function(){return b()<12?a.i18n.timeNames[6]:a.i18n.timeNames[7]},Z:function(){return p?`GMT`:f?`UTC`:(String(r).match(t)||[``]).pop().replace(n,``).replace(/GMT\+0000/g,`UTC`)},o:function(){return(w()>0?`-`:`+`)+o(Math.floor(Math.abs(w())/60)*100+Math.abs(w())%60,4)},p:function(){return(w()>0?`-`:`+`)+o(Math.floor(Math.abs(w())/60),2)+`:`+o(Math.floor(Math.abs(w())%60),2)},S:function(){return[`th`,`st`,`nd`,`rd`][g()%10>3?0:(g()%100-g()%10!=10)*g()%10]},W:function(){return T()},WW:function(){return o(T())},N:function(){return E()}};return d.replace(e,function(e){return e in D?D[e]():e.slice(1,e.length-1)})}}();a.masks={default:`ddd mmm dd yyyy HH:MM:ss`,shortDate:`m/d/yy`,paddedShortDate:`mm/dd/yyyy`,mediumDate:`mmm d, yyyy`,longDate:`mmmm d, yyyy`,fullDate:`dddd, mmmm d, yyyy`,shortTime:`h:MM TT`,mediumTime:`h:MM:ss TT`,longTime:`h:MM:ss TT Z`,isoDate:`yyyy-mm-dd`,isoTime:`HH:MM:ss`,isoDateTime:`yyyy-mm-dd'T'HH:MM:sso`,isoUtcDateTime:`UTC:yyyy-mm-dd'T'HH:MM:ss'Z'`,expiresHeaderFormat:`ddd, dd mmm yyyy HH:MM:ss Z`},a.i18n={dayNames:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`,`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`],monthNames:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`,`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],timeNames:[`a`,`p`,`am`,`pm`,`A`,`P`,`AM`,`PM`]};var o=function(e,t){for(e=String(e),t||=2;e.length<t;)e=`0`+e;return e},s=function(e){var t=e.y,n=e.m,r=e.d,i=e._,a=e.dayName,o=e.short,s=o===void 0?!1:o,c=new Date,l=new Date;l.setDate(l[i+`Date`]()-1);var u=new Date;return u.setDate(u[i+`Date`]()+1),function(){return c[i+`FullYear`]()}()===t&&function(){return c[i+`Month`]()}()===n&&function(){return c[i+`Date`]()}()===r?s?`Tdy`:`Today`:function(){return l[i+`FullYear`]()}()===t&&function(){return l[i+`Month`]()}()===n&&function(){return l[i+`Date`]()}()===r?s?`Ysd`:`Yesterday`:function(){return u[i+`FullYear`]()}()===t&&function(){return u[i+`Month`]()}()===n&&function(){return u[i+`Date`]()}()===r?s?`Tmw`:`Tomorrow`:a},c=function(e){var t=new Date(e.getFullYear(),e.getMonth(),e.getDate());t.setDate(t.getDate()-(t.getDay()+6)%7+3);var n=new Date(t.getFullYear(),0,4);n.setDate(n.getDate()-(n.getDay()+6)%7+3);var r=t.getTimezoneOffset()-n.getTimezoneOffset();t.setHours(t.getHours()-r);var i=(t-n)/(864e5*7);return 1+Math.floor(i)},l=function(e){var t=e.getDay();return t===0&&(t=7),t},u=function(e){return e===null?`null`:e===void 0?`undefined`:n(e)===`object`?Array.isArray(e)?`array`:{}.toString.call(e).slice(8,-1).toLowerCase():n(e)};typeof define==`function`&&define.amd?define(function(){return a}):(e===void 0?`undefined`:n(e))===`object`?t.exports=a:r.dateFormat=a})(void 0)})),B$=i(((e,t)=>{t.exports=s;let{DATE_FORMAT:n,DATE_FORMAT_SIMPLE:r}=A$(),i=ape(),a=F$(),o=P$();function s(e,t=!1){if(t===!1)return e;let s=a(e);if(!o(s))return e;if(t===!0)return i(s,r);let c=t.toUpperCase();if(c===`SYS:STANDARD`)return i(s,n);let l=c.substr(0,4);return l===`SYS:`||l===`UTC:`?l===`UTC:`?i(s,t):i(s,t.slice(4)):i(s,`UTC:${t}`)}})),V$=i(((e,t)=>{t.exports=n;function n(e){return e?typeof e==`string`?e.split(`,`).reduce((e,t,n)=>{let[r,i=n]=t.split(`:`);return e[r.toLowerCase()]=i,e},{}):Object.prototype.toString.call(e)===`[object Object]`?Object.keys(e).reduce((t,n)=>(t[n.toLowerCase()]=e[n],t),{}):{}:{}}})),H$=i(((e,t)=>{t.exports=n;function n(e){return e?typeof e==`string`?e.split(`,`).reduce((e,t,n)=>{let[r,i=n]=t.split(`:`);return e[i]=r.toUpperCase(),e},{default:`USERLVL`}):Object.prototype.toString.call(e)===`[object Object]`?Object.keys(e).reduce((t,n)=>(t[e[n]]=n.toUpperCase(),t),{default:`USERLVL`}):{}:{}}})),U$=i(((e,t)=>{t.exports=r;let n=L$();function r(e,t){return e=e.replace(/{if (.*?)}(.*?){end}/g,r),e=e.replace(/{if (.*?)}/g,``),e=e.replace(/{end}/g,``),e.replace(/\s+/g,` `).trim();function r(e,r,i){let a=n(t,r);return a&&i.includes(r)?i.replace(RegExp(`{`+r+`}`,`g`),a):``}}})),W$=i(((e,t)=>{t.exports=n;function n(e){return Object.prototype.toString.apply(e)===`[object Object]`}})),G$=i(((e,t)=>{t.exports=n;function n({input:e,ident:t=` `,eol:n=`
418
- `}){let r=e.split(/\r?\n/);for(let e=1;e<r.length;e+=1)r[e]=t+r[e];return r.join(n)}})),ope=i(((e,t)=>{t.exports=s;let{LEVEL_NAMES:n}=A$(),r=M$(),i=H$(),a=V$(),o=j$();function s(e){let t=e.crlf?`\r
417
+ `),Re=y.bind(null,{[E]:``,[ee]:l,[oe]:Fe,[ie]:S,[ae]:Me,[pe]:Ne}),ze=``;T!==null&&(ze=Re(ve===void 0?T:Object.assign({},T,{name:ve})));let Be=_ instanceof Function?_:_?ge:_e,Ve=Be().indexOf(`:`)+1;if(Te&&!be)throw Error(`customLevels is required if useOnlyCustomLevels is set true`);if(Ce&&typeof Ce!=`function`)throw Error(`Unknown mixin type "${typeof Ce}" - expected "function"`);if(je&&typeof je!=`string`)throw Error(`Unknown msgPrefix type "${typeof je}" - expected "string"`);d(ye,be,Te);let He=f(be,Te);typeof r.emit==`function`&&r.emit(`message`,{code:`PINO_CONFIG`,config:{levels:He,messageKey:v,errorKey:b}}),h(Se);let Ue=m(Se);return Object.assign(t,{levels:He,[A]:Ue,[fe]:Te,[re]:r,[te]:Be,[ne]:Ve,[ie]:S,[ae]:Me,[oe]:Fe,[ce]:Le,[O]:Ie,[le]:v,[ue]:b,[de]:C,[he]:C?`,${JSON.stringify(C)}:{`:``,[ee]:l,[k]:Ce,[j]:we,[E]:ze,[pe]:Ne,[me]:De,silent:w,onChild:Ae,[M]:je}),Object.setPrototypeOf(t,c()),p(t),t[se](ye),t}n.exports=Ce,n.exports.destination=(e=process.stdout.fd)=>typeof e==`object`?(e.dest=C(e.dest||process.stdout.fd),b(e)):b({dest:C(e),minLength:0}),n.exports.transport=C$(),n.exports.multistream=Zfe(),n.exports.levels=f(),n.exports.stdSerializers=Se,n.exports.stdTimeFunctions=Object.assign({},s),n.exports.symbols=l,n.exports.version=T,n.exports.default=Ce,n.exports.pino=Ce})),O$=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0});var n=t(`tty`);function r(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach(function(n){if(n!==`default`){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}}),t.default=e,Object.freeze(t)}var i=r(n);let{env:a={},argv:o=[],platform:s=``}=typeof process>`u`?{}:process,c=`NO_COLOR`in a||o.includes(`--no-color`),l=`FORCE_COLOR`in a||o.includes(`--color`),u=s===`win32`,d=a.TERM===`dumb`,f=i&&i.isatty&&i.isatty(1)&&a.TERM&&!d,p=`CI`in a&&(`GITHUB_ACTIONS`in a||`GITLAB_CI`in a||`CIRCLECI`in a),m=!c&&(l||u&&!d||f||p),h=(e,t,n,r,i=t.substring(0,e)+r,a=t.substring(e+n.length),o=a.indexOf(n))=>i+(o<0?a:h(o,a,n,r)),g=(e,t,n,r,i)=>e<0?n+t+r:n+h(e,t,r,i)+r,_=(e,t,n=e,r=e.length+1)=>i=>i||!(i===``||i===void 0)?g((``+i).indexOf(t,r),i,e,t,n):``,v=(e,t,n)=>_(`\x1b[${e}m`,`\x1b[${t}m`,n),y={reset:v(0,0),bold:v(1,22,`\x1B[22m\x1B[1m`),dim:v(2,22,`\x1B[22m\x1B[2m`),italic:v(3,23),underline:v(4,24),inverse:v(7,27),hidden:v(8,28),strikethrough:v(9,29),black:v(30,39),red:v(31,39),green:v(32,39),yellow:v(33,39),blue:v(34,39),magenta:v(35,39),cyan:v(36,39),white:v(37,39),gray:v(90,39),bgBlack:v(40,49),bgRed:v(41,49),bgGreen:v(42,49),bgYellow:v(43,49),bgBlue:v(44,49),bgMagenta:v(45,49),bgCyan:v(46,49),bgWhite:v(47,49),blackBright:v(90,39),redBright:v(91,39),greenBright:v(92,39),yellowBright:v(93,39),blueBright:v(94,39),magentaBright:v(95,39),cyanBright:v(96,39),whiteBright:v(97,39),bgBlackBright:v(100,49),bgRedBright:v(101,49),bgGreenBright:v(102,49),bgYellowBright:v(103,49),bgBlueBright:v(104,49),bgMagentaBright:v(105,49),bgCyanBright:v(106,49),bgWhiteBright:v(107,49)},b=({useColor:e=m}={})=>e?y:Object.keys(y).reduce((e,t)=>({...e,[t]:String}),{}),{reset:x,bold:S,dim:C,italic:w,underline:T,inverse:E,hidden:D,strikethrough:ee,black:te,red:ne,green:re,yellow:ie,blue:ae,magenta:oe,cyan:se,white:ce,gray:O,bgBlack:le,bgRed:ue,bgGreen:de,bgYellow:k,bgBlue:A,bgMagenta:fe,bgCyan:pe,bgWhite:me,blackBright:he,redBright:j,greenBright:M,yellowBright:ge,blueBright:_e,magentaBright:ve,cyanBright:ye,whiteBright:be,bgBlackBright:xe,bgRedBright:Se,bgGreenBright:Ce,bgYellowBright:we,bgBlueBright:Te,bgMagentaBright:Ee,bgCyanBright:De,bgWhiteBright:Oe}=b();e.bgBlack=le,e.bgBlackBright=xe,e.bgBlue=A,e.bgBlueBright=Te,e.bgCyan=pe,e.bgCyanBright=De,e.bgGreen=de,e.bgGreenBright=Ce,e.bgMagenta=fe,e.bgMagentaBright=Ee,e.bgRed=ue,e.bgRedBright=Se,e.bgWhite=me,e.bgWhiteBright=Oe,e.bgYellow=k,e.bgYellowBright=we,e.black=te,e.blackBright=he,e.blue=ae,e.blueBright=_e,e.bold=S,e.createColors=b,e.cyan=se,e.cyanBright=ye,e.dim=C,e.gray=O,e.green=re,e.greenBright=M,e.hidden=D,e.inverse=E,e.isColorSupported=m,e.italic=w,e.magenta=oe,e.magentaBright=ve,e.red=ne,e.redBright=j,e.reset=x,e.strikethrough=ee,e.underline=T,e.white=ce,e.whiteBright=be,e.yellow=ie,e.yellowBright=ge})),$fe=i(((e,t)=>{t.exports=n;function n(e,t){if(e&&t)return n(e)(t);if(typeof e!=`function`)throw TypeError(`need wrapper function`);return Object.keys(e).forEach(function(t){r[t]=e[t]}),r;function r(){for(var t=Array(arguments.length),n=0;n<t.length;n++)t[n]=arguments[n];var r=e.apply(this,t),i=t[t.length-1];return typeof r==`function`&&r!==i&&Object.keys(i).forEach(function(e){r[e]=i[e]}),r}}})),k$=i(((e,t)=>{var n=$fe();t.exports=n(r),t.exports.strict=n(i),r.proto=r(function(){Object.defineProperty(Function.prototype,`once`,{value:function(){return r(this)},configurable:!0}),Object.defineProperty(Function.prototype,`onceStrict`,{value:function(){return i(this)},configurable:!0})});function r(e){var t=function(){return t.called?t.value:(t.called=!0,t.value=e.apply(this,arguments))};return t.called=!1,t}function i(e){var t=function(){if(t.called)throw Error(t.onceError);return t.called=!0,t.value=e.apply(this,arguments)};return t.onceError=(e.name||"Function wrapped with `once`")+` shouldn't be called more than once`,t.called=!1,t}})),epe=i(((e,t)=>{var n=k$(),r=function(){},i=global.Bare?queueMicrotask:process.nextTick.bind(process),a=function(e){return e.setHeader&&typeof e.abort==`function`},o=function(e){return e.stdio&&Array.isArray(e.stdio)&&e.stdio.length===3},s=function(e,t,c){if(typeof t==`function`)return s(e,null,t);t||={},c=n(c||r);var l=e._writableState,u=e._readableState,d=t.readable||t.readable!==!1&&e.readable,f=t.writable||t.writable!==!1&&e.writable,p=!1,m=function(){e.writable||h()},h=function(){f=!1,d||c.call(e)},g=function(){d=!1,f||c.call(e)},_=function(t){c.call(e,t?Error(`exited with error code: `+t):null)},v=function(t){c.call(e,t)},y=function(){i(b)},b=function(){if(!p&&(d&&!(u&&u.ended&&!u.destroyed)||f&&!(l&&l.ended&&!l.destroyed)))return c.call(e,Error(`premature close`))},x=function(){e.req.on(`finish`,h)};return a(e)?(e.on(`complete`,h),e.on(`abort`,y),e.req?x():e.on(`request`,x)):f&&!l&&(e.on(`end`,m),e.on(`close`,m)),o(e)&&e.on(`exit`,_),e.on(`end`,g),e.on(`finish`,h),t.error!==!1&&e.on(`error`,v),e.on(`close`,y),function(){p=!0,e.removeListener(`complete`,h),e.removeListener(`abort`,y),e.removeListener(`request`,x),e.req&&e.req.removeListener(`finish`,h),e.removeListener(`end`,m),e.removeListener(`close`,m),e.removeListener(`finish`,h),e.removeListener(`exit`,_),e.removeListener(`end`,g),e.removeListener(`error`,v),e.removeListener(`close`,y)}};t.exports=s})),tpe=i(((e,n)=>{var r=k$(),i=epe(),a;try{a=t(`fs`)}catch{}var o=function(){},s=typeof process>`u`?!1:/^v?\.0/.test(process.version),c=function(e){return typeof e==`function`},l=function(e){return!s||!a?!1:(e instanceof(a.ReadStream||o)||e instanceof(a.WriteStream||o))&&c(e.close)},u=function(e){return e.setHeader&&c(e.abort)},d=function(e,t,n,a){a=r(a);var s=!1;e.on(`close`,function(){s=!0}),i(e,{readable:t,writable:n},function(e){if(e)return a(e);s=!0,a()});var d=!1;return function(t){if(!s&&!d){if(d=!0,l(e))return e.close(o);if(u(e))return e.abort();if(c(e.destroy))return e.destroy();a(t||Error(`stream was destroyed`))}}},f=function(e){e()},p=function(e,t){return e.pipe(t)};n.exports=function(){var e=Array.prototype.slice.call(arguments),t=c(e[e.length-1]||o)&&e.pop()||o;if(Array.isArray(e[0])&&(e=e[0]),e.length<2)throw Error(`pump requires two streams per minimum`);var n,r=e.map(function(i,a){var o=a<e.length-1;return d(i,o,a>0,function(e){n||=e,e&&r.forEach(f),!o&&(r.forEach(f),t(n))})});return e.reduce(p)}})),npe=i(((e,n)=>{let{Transform:r}=t(`stream`),{StringDecoder:i}=t(`string_decoder`),a=Symbol(`last`),o=Symbol(`decoder`);function s(e,t,n){let r;if(this.overflow){if(r=this[o].write(e).split(this.matcher),r.length===1)return n();r.shift(),this.overflow=!1}else this[a]+=this[o].write(e),r=this[a].split(this.matcher);this[a]=r.pop();for(let e=0;e<r.length;e++)try{l(this,this.mapper(r[e]))}catch(e){return n(e)}if(this.overflow=this[a].length>this.maxLength,this.overflow&&!this.skipOverflow){n(Error(`maximum buffer reached`));return}n()}function c(e){if(this[a]+=this[o].end(),this[a])try{l(this,this.mapper(this[a]))}catch(t){return e(t)}e()}function l(e,t){t!==void 0&&e.push(t)}function u(e){return e}function d(e,t,n){switch(e||=/\r?\n/,t||=u,n||={},arguments.length){case 1:typeof e==`function`?(t=e,e=/\r?\n/):typeof e==`object`&&!(e instanceof RegExp)&&!e[Symbol.split]&&(n=e,e=/\r?\n/);break;case 2:typeof e==`function`?(n=t,t=e,e=/\r?\n/):typeof t==`object`&&(n=t,t=u)}n=Object.assign({},n),n.autoDestroy=!0,n.transform=s,n.flush=c,n.readableObjectMode=!0;let l=new r(n);return l[a]=``,l[o]=new i(`utf8`),l.matcher=e,l.mapper=t,l.maxLength=n.maxLength,l.skipOverflow=n.skipOverflow||!1,l.overflow=!1,l._destroy=function(e,t){this._writableState.errorEmitted=!1,t(e)},l}n.exports=d})),rpe=i(((e,n)=>{let r=Symbol.for(`pino.metadata`),i=npe(),{Duplex:a}=t(`stream`),{parentPort:o,workerData:s}=t(`worker_threads`);function c(){let e,t,n=new Promise((n,r)=>{e=n,t=r});return n.resolve=e,n.reject=t,n}n.exports=function(e,t={}){let n=t.expectPinoConfig===!0&&s?.workerData?.pinoWillSendConfig===!0,u=t.parse===`lines`,d=typeof t.parseLine==`function`?t.parseLine:JSON.parse,f=t.close||l,p=i(function(e){let t;try{t=d(e)}catch(t){this.emit(`unknown`,e,t);return}if(t===null){this.emit(`unknown`,e,`Null value ignored`);return}return typeof t!=`object`&&(t={data:t,time:Date.now()}),p[r]&&(p.lastTime=t.time,p.lastLevel=t.level,p.lastObj=t),u?e:t},{autoDestroy:!0});if(p._destroy=function(e,t){let n=f(e,t);n&&typeof n.then==`function`&&n.then(t,t)},t.expectPinoConfig===!0&&s?.workerData?.pinoWillSendConfig!==!0&&setImmediate(()=>{p.emit(`error`,Error(`This transport is not compatible with the current version of pino. Please upgrade pino to the latest version.`))}),t.metadata!==!1&&(p[r]=!0,p.lastTime=0,p.lastLevel=0,p.lastObj=null),n){let e={},t=c();return o.on(`message`,function n(r){r.code===`PINO_CONFIG`&&(e=r.config,t.resolve(),o.off(`message`,n))}),Object.defineProperties(p,{levels:{get(){return e.levels}},messageKey:{get(){return e.messageKey}},errorKey:{get(){return e.errorKey}}}),t.then(m)}return m();function m(){let n=e(p);if(n&&typeof n.catch==`function`)n.catch(e=>{p.destroy(e)}),n=null;else if(t.enablePipelining&&n)return a.from({writable:p,readable:n});return p}};function l(e,t){process.nextTick(t,e)}})),A$=i(((e,t)=>{t.exports={DATE_FORMAT:`yyyy-mm-dd HH:MM:ss.l o`,DATE_FORMAT_SIMPLE:`HH:MM:ss.l`,ERROR_LIKE_KEYS:[`err`,`error`],MESSAGE_KEY:`msg`,LEVEL_KEY:`level`,LEVEL_LABEL:`levelLabel`,TIMESTAMP_KEY:`time`,LEVELS:{default:`USERLVL`,60:`FATAL`,50:`ERROR`,40:`WARN`,30:`INFO`,20:`DEBUG`,10:`TRACE`},LEVEL_NAMES:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},LOGGER_KEYS:[`pid`,`hostname`,`name`,`level`,`time`,`timestamp`,`caller`]}})),j$=i(((e,t)=>{t.exports=i;let{LEVELS:n,LEVEL_NAMES:r}=A$();function i(e,t,i){let a=e?t||n:Object.assign({},n,t),o=e?i||r:Object.assign({},r,i);return function(e){let t=`default`;return t=Number.isInteger(+e)?Object.prototype.hasOwnProperty.call(a,e)?e:t:Object.prototype.hasOwnProperty.call(o,e.toLowerCase())?o[e.toLowerCase()]:t,[a[t],t]}}})),M$=i(((e,t)=>{let n=e=>e,r={default:n,60:n,50:n,40:n,30:n,20:n,10:n,message:n,greyMessage:n,property:n},{createColors:i}=O$(),a=j$(),o=i({useColor:!0}),{white:s,bgRed:c,red:l,yellow:u,green:d,blue:f,gray:p,cyan:m,magenta:h}=o,g={default:s,60:c,50:l,40:u,30:d,20:f,10:p,message:m,greyMessage:p,property:h};function _(e){return e.reduce(function(e,[t,n]){return e[t]=typeof o[n]==`function`?o[n]:s,e},{default:s,message:m,greyMessage:p,property:h})}function v(e){return function(t,n,{customLevels:r,customLevelNames:i}={}){let[o,s]=a(e,r,i)(t);return Object.prototype.hasOwnProperty.call(n,s)?n[s](o):n.default(o)}}function y(e){let t=v(e),n=function(e,n){return t(e,r,n)};return n.message=r.message,n.greyMessage=r.greyMessage,n.property=r.property,n.colors=i({useColor:!1}),n}function b(e){let t=v(e),n=function(e,n){return t(e,g,n)};return n.message=g.message,n.property=g.property,n.greyMessage=g.greyMessage,n.colors=o,n}function x(e,t){let n=_(e),r=t?n:Object.assign({},g,n),i=v(t),a=function(e,t){return i(e,r,t)};return a.colors=o,a.message=a.message||r.message,a.property=a.property||r.property,a.greyMessage=a.greyMessage||r.greyMessage,a}t.exports=function(e=!1,t,n){return e&&t!==void 0?x(t,n):e?b(n):y(n)}})),N$=i(((e,t)=>{t.exports=function(){}})),ipe=i(((e,n)=>{n.exports=o;let{isMainThread:r}=t(`node:worker_threads`),i=x$(),a=N$();function o(e){let t=new i(e);return t.on(`error`,n),!e.sync&&r&&s(t),t;function n(e){if(e.code===`EPIPE`){t.write=a,t.end=a,t.flushSync=a,t.destroy=a;return}t.removeListener(`error`,n)}}function s(e){if(global.WeakRef&&global.WeakMap&&global.FinalizationRegistry){let t=S$();t.register(e,c),e.on(`close`,function(){t.unregister(e)})}}function c(e,t){e.destroyed||(t===`beforeExit`?(e.flush(),e.on(`drain`,function(){e.end()})):e.flushSync())}})),P$=i(((e,t)=>{t.exports=n;function n(e){return e instanceof Date&&!Number.isNaN(e.getTime())}})),F$=i(((e,t)=>{t.exports=r;let n=P$();function r(e){let t=new Date(e);return n(t)||(t=new Date(+e)),t}})),I$=i(((e,t)=>{t.exports=n;function n(e){let t=[],n=!1,r=``;for(let i=0;i<e.length;i++){let a=e.charAt(i);if(a===`\\`){n=!0;continue}if(n){n=!1,r+=a;continue}if(a===`.`){t.push(r),r=``;continue}r+=a}return r.length&&t.push(r),t}})),L$=i(((e,t)=>{t.exports=r;let n=I$();function r(e,t){let r=Array.isArray(t)?t:n(t);for(let t of r){if(!Object.prototype.hasOwnProperty.call(e,t))return;e=e[t]}return e}})),R$=i(((e,t)=>{t.exports=i;let n=L$(),r=I$();function i(e,t){let i=r(t),a=i.pop();e=n(e,i),typeof e==`object`&&e&&Object.prototype.hasOwnProperty.call(e,a)&&delete e[a]}})),ape=i((e=>{let t=Function.prototype.toString,n=Object.prototype.toString;function r(e){if(!e)return Object.create(null);let n=e.constructor;if(n===Object)return e===Object.prototype?{}:Object.create(e);if(n&&~t.call(n).indexOf(`[native code]`))try{return new n}catch{}return Object.create(e)}function i(e){let t=e[Symbol.toStringTag];if(t)return t;let r=n.call(e);return r.substring(8,r.length-1)}let{propertyIsEnumerable:a}=Object.prototype;function o(e,t,n,r){let i=Object.getOwnPropertyDescriptor(e,n)||{configurable:!0,enumerable:!0,value:e[n],writable:!0},a=i.get||i.set?i:{configurable:i.configurable,enumerable:i.enumerable,value:r.copier(i.value,r),writable:i.writable};try{Object.defineProperty(t,n,a)}catch{t[n]=a.get?a.get():a.value}}function s(e,t,n){for(let r of Object.getOwnPropertyNames(e))o(e,t,r,n);for(let r of Object.getOwnPropertySymbols(e))o(e,t,r,n);return t}function c(e,t){let n=new t.Constructor;t.cache.set(e,n);for(let r=0;r<e.length;++r)n[r]=t.copier(e[r],t);return n}function l(e,t){let n=new t.Constructor;return t.cache.set(e,n),s(e,n,t)}function u(e,t){return e.slice(0)}function d(e,t){return e.slice(0,e.size,e.type)}function f(e,t){return new t.Constructor(u(e.buffer))}function p(e,t){return new t.Constructor(e.getTime())}function m(e,t){let n=new t.Constructor;t.cache.set(e,n);for(let[r,i]of e)n.set(r,t.copier(i,t));return n}function h(e,t){return s(e,m(e,t),t)}function g(e,t){let n=r(t.prototype);t.cache.set(e,n);for(let r of Object.keys(e))n[r]=t.copier(e[r],t);for(let r of Object.getOwnPropertySymbols(e))a.call(e,r)&&(n[r]=t.copier(e[r],t));return n}function _(e,t){let n=r(t.prototype);return t.cache.set(e,n),s(e,n,t)}function v(e,t){return new t.Constructor(e.valueOf())}function y(e,t){let n=new t.Constructor(e.source,e.flags);return n.lastIndex=e.lastIndex,n}function b(e,t){return e}function x(e,t){let n=new t.Constructor;t.cache.set(e,n);for(let r of e)n.add(t.copier(r,t));return n}function S(e,t){return s(e,x(e,t),t)}function C(){return new WeakMap}function w({createCache:e,methods:t,strict:n}){let r={array:n?l:c,arrayBuffer:u,asyncGenerator:b,blob:d,dataView:f,date:p,error:b,generator:b,map:n?h:m,object:n?_:g,regExp:y,set:n?S:x},i=t?Object.assign(r,t):r,a=T(i),o=e||C;if(!a.Object||!a.Array)throw Error(`An object and array copier must be provided.`);return{createCache:o,copiers:a,methods:i,strict:!!n}}function T(e){return{Arguments:e.object,Array:e.array,ArrayBuffer:e.arrayBuffer,AsyncGenerator:e.asyncGenerator,BigInt64Array:e.arrayBuffer,BigUint64Array:e.arrayBuffer,Blob:e.blob,Boolean:v,DataView:e.dataView,Date:e.date,Error:e.error,Float32Array:e.arrayBuffer,Float64Array:e.arrayBuffer,Generator:e.generator,Int8Array:e.arrayBuffer,Int16Array:e.arrayBuffer,Int32Array:e.arrayBuffer,Map:e.map,Number:v,Object:e.object,Promise:b,RegExp:e.regExp,Set:e.set,String:v,WeakMap:b,WeakSet:b,Uint8Array:e.arrayBuffer,Uint8ClampedArray:e.arrayBuffer,Uint16Array:e.arrayBuffer,Uint32Array:e.arrayBuffer}}function E(e={}){let{createCache:t,copiers:n}=w(e),{Array:r,Object:a}=n;function o(e,t){if(t.prototype=t.Constructor=void 0,!e||typeof e!=`object`)return e;if(t.cache.has(e))return t.cache.get(e);if(t.prototype=Object.getPrototypeOf(e),t.Constructor=t.prototype&&t.prototype.constructor,!t.Constructor||t.Constructor===Object)return a(e,t);if(Array.isArray(e))return r(e,t);let o=n[i(e)];return o?o(e,t):typeof e.then==`function`?e:a(e,t)}return function(e){return o(e,{Constructor:void 0,cache:t(),copier:o,prototype:void 0})}}let D=E({strict:!0});e.copy=E(),e.copyStrict=D,e.createCopier=E})),z$=i(((e,t)=>{t.exports=a;let{createCopier:n}=ape(),r=n({}),i=R$();function a({log:e,context:t}){let{ignoreKeys:n,includeKeys:a}=t,o=r(e);if(a){let e={};return a.forEach(t=>{e[t]=o[t]}),e}return n.forEach(e=>{i(o,e)}),o}})),ope=i(((e,t)=>{function n(e){"@babel/helpers - typeof";return n=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},n(e)}(function(r){var i=arguments,a=function(){var e=/d{1,4}|D{3,4}|m{1,4}|yy(?:yy)?|([HhMsTt])\1?|W{1,2}|[LlopSZN]|"[^"]*"|'[^']*'/g,t=/\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,n=/[^-+\dA-Z]/g;return function(r,d,f,p){if(i.length===1&&u(r)===`string`&&!/\d/.test(r)&&(d=r,r=void 0),r=r||r===0?r:new Date,r instanceof Date||(r=new Date(r)),isNaN(r))throw TypeError(`Invalid date`);d=String(a.masks[d]||d||a.masks.default);var m=d.slice(0,4);(m===`UTC:`||m===`GMT:`)&&(d=d.slice(4),f=!0,m===`GMT:`&&(p=!0));var h=function(){return f?`getUTC`:`get`},g=function(){return r[h()+`Date`]()},_=function(){return r[h()+`Day`]()},v=function(){return r[h()+`Month`]()},y=function(){return r[h()+`FullYear`]()},b=function(){return r[h()+`Hours`]()},x=function(){return r[h()+`Minutes`]()},S=function(){return r[h()+`Seconds`]()},C=function(){return r[h()+`Milliseconds`]()},w=function(){return f?0:r.getTimezoneOffset()},T=function(){return c(r)},E=function(){return l(r)},D={d:function(){return g()},dd:function(){return o(g())},ddd:function(){return a.i18n.dayNames[_()]},DDD:function(){return s({y:y(),m:v(),d:g(),_:h(),dayName:a.i18n.dayNames[_()],short:!0})},dddd:function(){return a.i18n.dayNames[_()+7]},DDDD:function(){return s({y:y(),m:v(),d:g(),_:h(),dayName:a.i18n.dayNames[_()+7]})},m:function(){return v()+1},mm:function(){return o(v()+1)},mmm:function(){return a.i18n.monthNames[v()]},mmmm:function(){return a.i18n.monthNames[v()+12]},yy:function(){return String(y()).slice(2)},yyyy:function(){return o(y(),4)},h:function(){return b()%12||12},hh:function(){return o(b()%12||12)},H:function(){return b()},HH:function(){return o(b())},M:function(){return x()},MM:function(){return o(x())},s:function(){return S()},ss:function(){return o(S())},l:function(){return o(C(),3)},L:function(){return o(Math.floor(C()/10))},t:function(){return b()<12?a.i18n.timeNames[0]:a.i18n.timeNames[1]},tt:function(){return b()<12?a.i18n.timeNames[2]:a.i18n.timeNames[3]},T:function(){return b()<12?a.i18n.timeNames[4]:a.i18n.timeNames[5]},TT:function(){return b()<12?a.i18n.timeNames[6]:a.i18n.timeNames[7]},Z:function(){return p?`GMT`:f?`UTC`:(String(r).match(t)||[``]).pop().replace(n,``).replace(/GMT\+0000/g,`UTC`)},o:function(){return(w()>0?`-`:`+`)+o(Math.floor(Math.abs(w())/60)*100+Math.abs(w())%60,4)},p:function(){return(w()>0?`-`:`+`)+o(Math.floor(Math.abs(w())/60),2)+`:`+o(Math.floor(Math.abs(w())%60),2)},S:function(){return[`th`,`st`,`nd`,`rd`][g()%10>3?0:(g()%100-g()%10!=10)*g()%10]},W:function(){return T()},WW:function(){return o(T())},N:function(){return E()}};return d.replace(e,function(e){return e in D?D[e]():e.slice(1,e.length-1)})}}();a.masks={default:`ddd mmm dd yyyy HH:MM:ss`,shortDate:`m/d/yy`,paddedShortDate:`mm/dd/yyyy`,mediumDate:`mmm d, yyyy`,longDate:`mmmm d, yyyy`,fullDate:`dddd, mmmm d, yyyy`,shortTime:`h:MM TT`,mediumTime:`h:MM:ss TT`,longTime:`h:MM:ss TT Z`,isoDate:`yyyy-mm-dd`,isoTime:`HH:MM:ss`,isoDateTime:`yyyy-mm-dd'T'HH:MM:sso`,isoUtcDateTime:`UTC:yyyy-mm-dd'T'HH:MM:ss'Z'`,expiresHeaderFormat:`ddd, dd mmm yyyy HH:MM:ss Z`},a.i18n={dayNames:[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`,`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`],monthNames:[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`,`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],timeNames:[`a`,`p`,`am`,`pm`,`A`,`P`,`AM`,`PM`]};var o=function(e,t){for(e=String(e),t||=2;e.length<t;)e=`0`+e;return e},s=function(e){var t=e.y,n=e.m,r=e.d,i=e._,a=e.dayName,o=e.short,s=o===void 0?!1:o,c=new Date,l=new Date;l.setDate(l[i+`Date`]()-1);var u=new Date;return u.setDate(u[i+`Date`]()+1),function(){return c[i+`FullYear`]()}()===t&&function(){return c[i+`Month`]()}()===n&&function(){return c[i+`Date`]()}()===r?s?`Tdy`:`Today`:function(){return l[i+`FullYear`]()}()===t&&function(){return l[i+`Month`]()}()===n&&function(){return l[i+`Date`]()}()===r?s?`Ysd`:`Yesterday`:function(){return u[i+`FullYear`]()}()===t&&function(){return u[i+`Month`]()}()===n&&function(){return u[i+`Date`]()}()===r?s?`Tmw`:`Tomorrow`:a},c=function(e){var t=new Date(e.getFullYear(),e.getMonth(),e.getDate());t.setDate(t.getDate()-(t.getDay()+6)%7+3);var n=new Date(t.getFullYear(),0,4);n.setDate(n.getDate()-(n.getDay()+6)%7+3);var r=t.getTimezoneOffset()-n.getTimezoneOffset();t.setHours(t.getHours()-r);var i=(t-n)/(864e5*7);return 1+Math.floor(i)},l=function(e){var t=e.getDay();return t===0&&(t=7),t},u=function(e){return e===null?`null`:e===void 0?`undefined`:n(e)===`object`?Array.isArray(e)?`array`:{}.toString.call(e).slice(8,-1).toLowerCase():n(e)};typeof define==`function`&&define.amd?define(function(){return a}):(e===void 0?`undefined`:n(e))===`object`?t.exports=a:r.dateFormat=a})(void 0)})),B$=i(((e,t)=>{t.exports=s;let{DATE_FORMAT:n,DATE_FORMAT_SIMPLE:r}=A$(),i=ope(),a=F$(),o=P$();function s(e,t=!1){if(t===!1)return e;let s=a(e);if(!o(s))return e;if(t===!0)return i(s,r);let c=t.toUpperCase();if(c===`SYS:STANDARD`)return i(s,n);let l=c.substr(0,4);return l===`SYS:`||l===`UTC:`?l===`UTC:`?i(s,t):i(s,t.slice(4)):i(s,`UTC:${t}`)}})),V$=i(((e,t)=>{t.exports=n;function n(e){return e?typeof e==`string`?e.split(`,`).reduce((e,t,n)=>{let[r,i=n]=t.split(`:`);return e[r.toLowerCase()]=i,e},{}):Object.prototype.toString.call(e)===`[object Object]`?Object.keys(e).reduce((t,n)=>(t[n.toLowerCase()]=e[n],t),{}):{}:{}}})),H$=i(((e,t)=>{t.exports=n;function n(e){return e?typeof e==`string`?e.split(`,`).reduce((e,t,n)=>{let[r,i=n]=t.split(`:`);return e[i]=r.toUpperCase(),e},{default:`USERLVL`}):Object.prototype.toString.call(e)===`[object Object]`?Object.keys(e).reduce((t,n)=>(t[e[n]]=n.toUpperCase(),t),{default:`USERLVL`}):{}:{}}})),U$=i(((e,t)=>{t.exports=r;let n=L$();function r(e,t){return e=e.replace(/{if (.*?)}(.*?){end}/g,r),e=e.replace(/{if (.*?)}/g,``),e=e.replace(/{end}/g,``),e.replace(/\s+/g,` `).trim();function r(e,r,i){let a=n(t,r);return a&&i.includes(r)?i.replace(RegExp(`{`+r+`}`,`g`),a):``}}})),W$=i(((e,t)=>{t.exports=n;function n(e){return Object.prototype.toString.apply(e)===`[object Object]`}})),G$=i(((e,t)=>{t.exports=n;function n({input:e,ident:t=` `,eol:n=`
418
+ `}){let r=e.split(/\r?\n/);for(let e=1;e<r.length;e+=1)r[e]=t+r[e];return r.join(n)}})),spe=i(((e,t)=>{t.exports=s;let{LEVEL_NAMES:n}=A$(),r=M$(),i=H$(),a=V$(),o=j$();function s(e){let t=e.crlf?`\r
419
419
  `:`
420
- `,{customPrettifiers:s,errorLikeObjectKeys:c,hideObject:l,levelFirst:u,levelKey:d,levelLabel:f,messageFormat:p,messageKey:m,minimumLevel:h,singleLine:g,timestampKey:_,translateTime:v}=e,y=e.errorProps.split(`,`),b=typeof e.useOnlyCustomProps==`boolean`?e.useOnlyCustomProps:e.useOnlyCustomProps===`true`,x=i(e.customLevels),S=a(e.customLevels),C=o(b,x,S),w;if(e.customColors)if(typeof e.customColors==`string`)w=e.customColors.split(`,`).reduce((t,r)=>{let[i,a]=r.split(`:`),o=(b?e.customLevels:S[i]!==void 0)?S[i]:n[i],s=o===void 0?i:o;return t.push([s,a]),t},[]);else if(typeof e.customColors==`object`)w=Object.keys(e.customColors).reduce((t,r)=>{let[i,a]=[r,e.customColors[r]],o=(b?e.customLevels:S[i]!==void 0)?S[i]:n[i],s=o===void 0?i:o;return t.push([s,a]),t},[]);else throw Error(`options.customColors must be of type string or object.`);let T={customLevels:x,customLevelNames:S};b===!0&&!e.customLevels&&(T.customLevels=void 0,T.customLevelNames=void 0);let E=e.include===void 0?void 0:new Set(e.include.split(`,`)),D=!E&&e.ignore?new Set(e.ignore.split(`,`)):void 0,ee=r(e.colorize,w,b),te=e.colorizeObjects?ee:r(!1,[],!1);return{EOL:t,IDENT:` `,colorizer:ee,customColors:w,customLevelNames:S,customLevels:x,customPrettifiers:s,customProperties:T,errorLikeObjectKeys:c,errorProps:y,getLevelLabelData:C,hideObject:l,ignoreKeys:D,includeKeys:E,levelFirst:u,levelKey:d,levelLabel:f,messageFormat:p,messageKey:m,minimumLevel:h,objectColorizer:te,singleLine:g,timestampKey:_,translateTime:v,useOnlyCustomProps:b}}})),spe=i(((e,t)=>{t.exports=s,s.default=s,s.stable=d,s.stableStringify=d;var n=`[...]`,r=`[Circular]`,i=[],a=[];function o(){return{depthLimit:2**53-1,edgesLimit:2**53-1}}function s(e,t,n,r){r===void 0&&(r=o()),l(e,``,0,[],void 0,0,r);var s;try{s=a.length===0?JSON.stringify(e,t,n):JSON.stringify(e,p(t),n)}catch{return JSON.stringify(`[unable to serialize, circular reference is too complex to analyze]`)}finally{for(;i.length!==0;){var c=i.pop();c.length===4?Object.defineProperty(c[0],c[1],c[3]):c[0][c[1]]=c[2]}}return s}function c(e,t,n,r){var o=Object.getOwnPropertyDescriptor(r,n);o.get===void 0?(r[n]=e,i.push([r,n,t])):o.configurable?(Object.defineProperty(r,n,{value:e}),i.push([r,n,t,o])):a.push([t,n,e])}function l(e,t,i,a,o,s,u){s+=1;var d;if(typeof e==`object`&&e){for(d=0;d<a.length;d++)if(a[d]===e){c(r,e,t,o);return}if(u.depthLimit!==void 0&&s>u.depthLimit){c(n,e,t,o);return}if(u.edgesLimit!==void 0&&i+1>u.edgesLimit){c(n,e,t,o);return}if(a.push(e),Array.isArray(e))for(d=0;d<e.length;d++)l(e[d],d,d,a,e,s,u);else{var f=Object.keys(e);for(d=0;d<f.length;d++){var p=f[d];l(e[p],p,d,a,e,s,u)}}a.pop()}}function u(e,t){return e<t?-1:+(e>t)}function d(e,t,n,r){r===void 0&&(r=o());var s=f(e,``,0,[],void 0,0,r)||e,c;try{c=a.length===0?JSON.stringify(s,t,n):JSON.stringify(s,p(t),n)}catch{return JSON.stringify(`[unable to serialize, circular reference is too complex to analyze]`)}finally{for(;i.length!==0;){var l=i.pop();l.length===4?Object.defineProperty(l[0],l[1],l[3]):l[0][l[1]]=l[2]}}return c}function f(e,t,a,o,s,l,d){l+=1;var p;if(typeof e==`object`&&e){for(p=0;p<o.length;p++)if(o[p]===e){c(r,e,t,s);return}try{if(typeof e.toJSON==`function`)return}catch{return}if(d.depthLimit!==void 0&&l>d.depthLimit){c(n,e,t,s);return}if(d.edgesLimit!==void 0&&a+1>d.edgesLimit){c(n,e,t,s);return}if(o.push(e),Array.isArray(e))for(p=0;p<e.length;p++)f(e[p],p,p,o,e,l,d);else{var m={},h=Object.keys(e).sort(u);for(p=0;p<h.length;p++){var g=h[p];f(e[g],g,p,o,e,l,d),m[g]=e[g]}if(s!==void 0)i.push([s,t,e]),s[t]=m;else return m}o.pop()}}function p(e){return e=e===void 0?function(e,t){return t}:e,function(t,n){if(a.length>0)for(var r=0;r<a.length;r++){var i=a[r];if(i[1]===t&&i[0]===n){n=i[2],a.splice(r,1);break}}return e.call(this,t,n)}}})),K$=i(((e,t)=>{t.exports=r;let n=G$();function r({keyName:e,lines:t,eol:r,ident:i}){let a=``,o=`${i}${e}: ${n({input:t,ident:i,eol:r})}${r}`.split(r);for(let e=0;e<o.length;e+=1){e!==0&&(a+=r);let t=o[e];if(/^\s*"stack"/.test(t)){let e=/^(\s*"stack":)\s*(".*"),?$/.exec(t);if(e&&e.length===3){let n=/^\s*/.exec(t)[0].length+4,i=` `.repeat(n),o=e[2];a+=e[1]+r+i+JSON.parse(o).replace(/\n/g,r+i)}else a+=t}else a+=t}return a}})),q$=i(((e,t)=>{t.exports=o;let{LOGGER_KEYS:n}=A$(),r=spe(),i=G$(),a=K$();function o({log:e,excludeLoggerKeys:t=!0,skipKeys:o=[],context:s}){let{EOL:c,IDENT:l,customPrettifiers:u,errorLikeObjectKeys:d,objectColorizer:f,singleLine:p,colorizer:m}=s,h=[].concat(o);t===!0&&Array.prototype.push.apply(h,n);let g=``,{plain:_,errors:v}=Object.entries(e).reduce(({plain:t,errors:n},[r,i])=>{if(h.includes(r)===!1){let a=typeof u[r]==`function`?u[r](i,r,e,{colors:m.colors}):i;d.includes(r)?n[r]=a:t[r]=a}return{plain:t,errors:n}},{plain:{},errors:{}});return p?(Object.keys(_).length>0&&(g+=f.greyMessage(r(_))),g+=c,g=g.replace(/\\\\/gi,`\\`)):Object.entries(_).forEach(([e,t])=>{let n=typeof u[e]==`function`?t:r(t,null,2);if(n===void 0)return;n=n.replace(/\\\\/gi,`\\`);let a=i({input:n,ident:l,eol:c});g+=`${l}${f.property(e)}:${a.startsWith(c)?``:` `}${a}${c}`}),Object.entries(v).forEach(([e,t])=>{let n=typeof u[e]==`function`?t:r(t,null,2);n!==void 0&&(g+=a({keyName:e,lines:n,eol:c,ident:l}))}),g}})),J$=i(((e,t)=>{t.exports=o;let{LOGGER_KEYS:n}=A$(),r=W$(),i=G$(),a=q$();function o({log:e,context:t}){let{EOL:o,IDENT:s,errorProps:c,messageKey:l}=t,u=e.stack,d=`${s}${i({input:u,ident:s,eol:o})}${o}`;if(c.length>0){let i=n.concat(l,`type`,`stack`),u;u=c[0]===`*`?Object.keys(e).filter(e=>i.includes(e)===!1):c.filter(e=>i.includes(e)===!1);for(let n=0;n<u.length;n+=1){let i=u[n];if(i in e){if(r(e[i])){let n=a({log:e[i],excludeLoggerKeys:!1,context:{...t,IDENT:s+s}});d=`${d}${s}${i}: {${o}${n}${s}}${o}`;continue}d=`${d}${s}${i}: ${e[i]}${o}`}}}return d}})),Y$=i(((e,t)=>{t.exports=r;let n=L$();function r({log:e,context:t}){let{colorizer:r,customLevels:i,customLevelNames:a,levelKey:o,getLevelLabelData:s}=t,c=t.customPrettifiers?.level,l=n(e,o);if(l===void 0)return;let u=r(l,{customLevels:i,customLevelNames:a});if(c){let[t]=s(l);return c(l,o,e,{label:t,labelColorized:u,colors:r.colors})}return u}})),X$=i(((e,t)=>{t.exports=a;let{LEVELS:n}=A$(),r=L$(),i=U$();function a({log:e,context:t}){let{colorizer:a,customLevels:o,levelKey:s,levelLabel:c,messageFormat:l,messageKey:u,useOnlyCustomProps:d}=t;if(l&&typeof l==`string`){let t=i(l,e),u=String(t).replace(/{([^{}]+)}/g,function(t,i){let a;if(i===c&&(a=r(e,s))!==void 0)return(d?o===void 0:o[a]===void 0)?n[a]:o[a];let l=r(e,i);return l===void 0?``:l});return a.message(u)}if(l&&typeof l==`function`){let t=l(e,u,c,{colors:a.colors});return a.message(t)}if(u in e&&!(typeof e[u]!=`string`&&typeof e[u]!=`number`&&typeof e[u]!=`boolean`))return a.message(e[u])}})),Z$=i(((e,t)=>{t.exports=n;function n({log:e,context:t}){let{customPrettifiers:n,colorizer:r}=t,i=``;if(e.name||e.pid||e.hostname){if(i+=`(`,e.name&&(i+=n.name?n.name(e.name,`name`,e,{colors:r.colors}):e.name),e.pid){let t=n.pid?n.pid(e.pid,`pid`,e,{colors:r.colors}):e.pid;e.name&&e.pid?i+=`/`+t:i+=t}if(e.hostname){let t=n.hostname?n.hostname(e.hostname,`hostname`,e,{colors:r.colors}):e.hostname;i+=`${i===`(`?`on`:` on`} ${t}`}i+=`)`}if(e.caller){let t=n.caller?n.caller(e.caller,`caller`,e,{colors:r.colors}):e.caller;i+=`${i===``?``:` `}<${t}>`}if(i!==``)return i}})),Q$=i(((e,t)=>{t.exports=r;let n=B$();function r({log:e,context:t}){let{timestampKey:r,translateTime:i}=t,a=t.customPrettifiers?.time,o=null;if(r in e?o=e[r]:`timestamp`in e&&(o=e.timestamp),o===null)return;let s=i?n(o,i):o;return a?a(s):`[${s}]`}})),cpe=i(((e,t)=>{t.exports={buildSafeSonicBoom:rpe(),createDate:F$(),deleteLogProperty:R$(),filterLog:z$(),formatTime:B$(),getPropertyValue:L$(),handleCustomLevelsNamesOpts:V$(),handleCustomLevelsOpts:H$(),interpretConditionals:U$(),isObject:W$(),isValidDate:P$(),joinLinesWithIndentation:G$(),noop:N$(),parseFactoryOptions:ope(),prettifyErrorLog:J$(),prettifyError:K$(),prettifyLevel:Y$(),prettifyMessage:X$(),prettifyMetadata:Z$(),prettifyObject:q$(),prettifyTime:Q$(),splitPropertyKey:I$(),getLevelLabelData:j$()}})),lpe=i(((e,t)=>{let n=typeof Buffer<`u`,r=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,i=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;function a(e,t,a){a==null&&typeof t==`object`&&t&&(a=t,t=void 0),n&&Buffer.isBuffer(e)&&(e=e.toString()),e&&e.charCodeAt(0)===65279&&(e=e.slice(1));let s=JSON.parse(e,t);if(typeof s!=`object`||!s)return s;let c=a&&a.protoAction||`error`,l=a&&a.constructorAction||`error`;if(c===`ignore`&&l===`ignore`)return s;if(c!==`ignore`&&l!==`ignore`){if(r.test(e)===!1&&i.test(e)===!1)return s}else if(c!==`ignore`&&l===`ignore`){if(r.test(e)===!1)return s}else if(i.test(e)===!1)return s;return o(s,{protoAction:c,constructorAction:l,safe:a&&a.safe})}function o(e,{protoAction:t=`error`,constructorAction:n=`error`,safe:r}={}){let i=[e];for(;i.length;){let e=i;i=[];for(let a of e){if(t!==`ignore`&&Object.prototype.hasOwnProperty.call(a,`__proto__`)){if(r===!0)return null;if(t===`error`)throw SyntaxError(`Object contains forbidden prototype property`);delete a.__proto__}if(n!==`ignore`&&Object.prototype.hasOwnProperty.call(a,`constructor`)&&a.constructor!==null&&typeof a.constructor==`object`&&Object.prototype.hasOwnProperty.call(a.constructor,`prototype`)){if(r===!0)return null;if(n===`error`)throw SyntaxError(`Object contains forbidden prototype property`);delete a.constructor}for(let e in a){let t=a[e];t&&typeof t==`object`&&i.push(t)}}}return e}function s(e,t,n){let{stackTraceLimit:r}=Error;Error.stackTraceLimit=0;try{return a(e,t,n)}finally{Error.stackTraceLimit=r}}function c(e,t){let{stackTraceLimit:n}=Error;Error.stackTraceLimit=0;try{return a(e,t,{safe:!0})}catch{return}finally{Error.stackTraceLimit=n}}t.exports=s,t.exports.default=s,t.exports.parse=s,t.exports.safeParse=c,t.exports.scan=o})),upe=i(((e,t)=>{t.exports=h;let n=lpe(),r=W$(),i=J$(),a=Y$(),o=X$(),s=Z$(),c=q$(),l=Q$(),u=z$(),{LEVELS:d,LEVEL_KEY:f,LEVEL_NAMES:p}=A$(),m=e=>{try{return{value:n.parse(e,{protoAction:`remove`})}}catch(e){return{err:e}}};function h(e){let t;if(r(e))t=e;else{let n=m(e);if(n.err||!r(n.value))return e+this.EOL;t=n.value}if(this.minimumLevel){let e;e=this.useOnlyCustomProps?this.customLevels:this.customLevelNames[this.minimumLevel]!==void 0;let n;if(n=e?this.customLevelNames[this.minimumLevel]:p[this.minimumLevel],n||=typeof this.minimumLevel==`string`?p[this.minimumLevel]:p[d[this.minimumLevel].toLowerCase()],t[this.levelKey===void 0?f:this.levelKey]<n)return}let n=o({log:t,context:this.context});(this.ignoreKeys||this.includeKeys)&&(t=u({log:t,context:this.context}));let h=a({log:t,context:{...this.context,...this.context.customProperties}}),g=s({log:t,context:this.context}),_=l({log:t,context:this.context}),v=``;if(this.levelFirst&&h&&(v=`${h}`),_&&v===``?v=`${_}`:_&&(v=`${v} ${_}`),!this.levelFirst&&h&&(v=v.length>0?`${v} ${h}`:h),g&&(v=v.length>0?`${v} ${g}:`:g),v.endsWith(`:`)===!1&&v!==``&&(v+=`:`),n!==void 0&&(v=v.length>0?`${v} ${n}`:n),v.length>0&&!this.singleLine&&(v+=this.EOL),t.type===`Error`&&typeof t.stack==`string`){let e=i({log:t,context:this.context});this.singleLine&&(v+=this.EOL),v+=e}else if(this.hideObject===!1){let e=[this.messageKey,this.levelKey,this.timestampKey].map(e=>e.replaceAll(/\\/g,``)).filter(e=>typeof t[e]==`string`||typeof t[e]==`number`||typeof t[e]==`boolean`),n=c({log:t,skipKeys:e,context:this.context});this.singleLine&&!/^\s$/.test(n)&&(v+=` `),v+=n}return v}})),dpe=i(((e,n)=>{let{isColorSupported:r}=O$(),i=epe(),{Transform:a}=t(`node:stream`),o=npe(),s=M$(),{ERROR_LIKE_KEYS:c,LEVEL_KEY:l,LEVEL_LABEL:u,MESSAGE_KEY:d,TIMESTAMP_KEY:f}=A$(),{buildSafeSonicBoom:p,parseFactoryOptions:m}=cpe(),h=upe(),g={colorize:r,colorizeObjects:!0,crlf:!1,customColors:null,customLevels:null,customPrettifiers:{},errorLikeObjectKeys:c,errorProps:``,hideObject:!1,ignore:`hostname`,include:void 0,levelFirst:!1,levelKey:l,levelLabel:u,messageFormat:null,messageKey:d,minimumLevel:void 0,outputStream:process.stdout,singleLine:!1,timestampKey:f,translateTime:!0,useOnlyCustomProps:!0};function _(e){let t=m(Object.assign({},g,e));return h.bind({...t,context:t})}function v(e={}){let t=_(e),n;return o(function(r){r.on(`message`,function n(i){!i||i.code!==`PINO_CONFIG`||(Object.assign(e,{messageKey:i.config.messageKey,errorLikeObjectKeys:Array.from(new Set([...e.errorLikeObjectKeys||c,i.config.errorKey])),customLevels:i.config.levels.values}),t=_(e),r.off(`message`,n))});let o=new a({objectMode:!0,autoDestroy:!0,transform(e,n,r){r(null,t(e))}});return n=typeof e.destination==`object`&&typeof e.destination.write==`function`?e.destination:p({dest:e.destination||1,append:e.append,mkdir:e.mkdir,sync:e.sync}),r.on(`unknown`,function(e){n.write(e+`
421
- `)}),i(r,o,n),o},{parse:`lines`,close(e,t){n.on(`close`,()=>{t(e)})}})}n.exports=v,n.exports.build=v,n.exports.PinoPretty=v,n.exports.prettyFactory=_,n.exports.colorizerFactory=s,n.exports.isColorSupported=r,n.exports.default=v})),$$=e(Zfe(),1),fpe=e(dpe(),1);const e1=new Map;function ppe(e){let t=e1.get(e);return t||(t={chain:Promise.resolve(),parentDirEnsured:!1},e1.set(e,t)),t}var mpe=class{#e;#t;#n;#r;constructor(e){this.#e=e.currentPath,this.#t=e.previousPath,this.#n=e.maxBytes,this.#r=ppe(e.currentPath)}append(e){let t=this.#r.chain.catch(()=>void 0).then(()=>this.#i(e));return this.#r.chain=t,t}async drain(){await this.#r.chain.catch(()=>void 0)}async#i(e){this.#r.parentDirEnsured||(await Te(me(this.#e),{recursive:!0}),this.#r.parentDirEnsured=!0),await Oe(this.#e,e,{flag:`a`});let t;try{t=ee(this.#e).size}catch{this.#r.parentDirEnsured=!1;return}if(t>this.#n)try{await De(this.#e,this.#t)}catch(e){if(e?.code!==`ENOENT`)throw e}}};const t1=[`.ok`,`local`,`logs`];function hpe(e){return M(e,...t1,`server-current.jsonl`)}function gpe(e){return M(e,...t1,`server-prev.jsonl`)}var n1=class extends Ae{#e;#t=0;#n=0;constructor(e){super({decodeStrings:!1}),this.#e=new mpe({currentPath:hpe(e.projectDir),previousPath:gpe(e.projectDir),maxBytes:e.maxBytes})}_write(e,t,n){this.#e.append(e).then(()=>n(),e=>{this.#r(e),n()})}#r(e){let t=Date.now();if(t-this.#t<5e3){this.#n++;return}this.#i(e instanceof Error?e.message:String(e),t)}#i(e,t){let n=this.#n;this.#n=0,this.#t=t,console.error(JSON.stringify({event:`pino-file-sink-write-dropped`,error:e,suppressed:n}))}async drain(){await this.#e.drain(),this.#n>0&&this.#i(`flushed at drain`,Date.now())}};function _pe(){let e=Bc.getSpan(Fc.active());if(!e)return{};let t=e.spanContext();return{trace_id:t.traceId,span_id:t.spanId,trace_flags:t.traceFlags}}function vpe(){return process.env.NO_COLOR&&process.env.NO_COLOR!==``?!1:process.stdout.isTTY??!1}const r1=new Set([`fatal`,`error`,`warn`,`info`,`debug`,`trace`,`silent`]);function i1(e){return e===`silent`?1/0:$$.default.levels.values[e]??$$.default.levels.values.info}function a1(e,t){return i1(e)<=i1(t)?e:t}var ype=class{name;transportConfigs=[];fileSinkOpts;redactPaths;activeFileSink;pinoInstance;options;constructor(e,t={}){this.name=e,this.options={name:this.name,level:process.env.LOG_LEVEL||(process.env.NODE_ENV===`test`?`silent`:`info`),serializers:{err:$$.default.stdSerializers.err,error:$$.default.stdSerializers.err},mixin:_pe,...t.options},t.transportConfigs&&(this.transportConfigs=t.transportConfigs),t.fileSink&&(this.fileSinkOpts=t.fileSink),t.redactPaths&&t.redactPaths.length>0&&(this.redactPaths=t.redactPaths,this.options={...this.options,redact:{paths:[...t.redactPaths],censor:`[REDACTED]`}}),this.pinoInstance=this.buildInstance()}resolveStreamLevels(){let e=this.options.level??`info`,t=process.env.OK_FILE_LEVEL?.toLowerCase(),n=t&&r1.has(t)?t:e===`silent`?`silent`:a1(e,`debug`),r=process.env.OK_CONSOLE_LEVEL?.toLowerCase(),i=r&&r1.has(r)?r:e;return{fileLevel:n,consoleLevel:i,instanceLevel:a1(n,i)}}buildInstance(){this.activeFileSink=void 0;let{fileLevel:e,consoleLevel:t,instanceLevel:n}=this.resolveStreamLevels();if(this.transportConfigs.length>0)return(0,$$.default)(this.options,$$.default.transport({targets:this.transportConfigs}));let r;try{r=(0,fpe.default)({colorize:vpe(),translateTime:`HH:MM:ss`,ignore:`pid,hostname`})}catch(r){if(console.warn(`[PinoLogger] pino-pretty failed, falling back to JSON:`,r),this.fileSinkOpts){let t=new n1(this.fileSinkOpts);return this.activeFileSink=t,(0,$$.default)({...this.options,level:n},$$.default.multistream([{stream:t,level:e}]))}return(0,$$.default)({...this.options,level:t})}if(this.fileSinkOpts){let i=new n1(this.fileSinkOpts);return this.activeFileSink=i,(0,$$.default)({...this.options,level:n},$$.default.multistream([{stream:r,level:t},{stream:i,level:e}]))}return(0,$$.default)({...this.options,level:t},r)}recreateInstance(){typeof this.pinoInstance.flush==`function`&&this.pinoInstance.flush(),this.pinoInstance=this.buildInstance()}addTransport(e){this.transportConfigs.push(e),this.recreateInstance()}removeTransport(e){e>=0&&e<this.transportConfigs.length&&(this.transportConfigs.splice(e,1),this.recreateInstance())}getTransports(){return[...this.transportConfigs]}updateOptions(e){this.options={...this.options,...e},this.recreateInstance()}reconfigure(e){e.options&&(this.options={...this.options,...e.options}),e.transportConfigs&&(this.transportConfigs=e.transportConfigs),e.fileSink&&(this.fileSinkOpts=e.fileSink),e.redactPaths&&e.redactPaths.length>0&&(this.redactPaths=e.redactPaths,this.options={...this.options,redact:{paths:[...e.redactPaths],censor:`[REDACTED]`}}),this.recreateInstance()}getPinoInstance(){return this.pinoInstance}async flushFileSink(){this.activeFileSink&&await this.activeFileSink.drain()}error(e,t){this.pinoInstance.error(e,t)}warn(e,t){this.pinoInstance.warn(e,t)}info(e,t){this.pinoInstance.info(e,t)}debug(e,t){this.pinoInstance.debug(e,t)}};const bpe=new class{config={};loggers=new Map;configure(e){if(this.config=e,e.pinoConfig&&!e.defaultLogger&&!e.loggerFactory){for(let t of this.loggers.values())t.reconfigure(e.pinoConfig);return}this.loggers.clear()}getLogger(e){let t=this.loggers.get(e);if(t)return t;let n;return n=this.config.loggerFactory?this.config.loggerFactory(e):this.config.defaultLogger?this.config.defaultLogger:new ype(e,this.config.pinoConfig),this.loggers.set(e,n),n}reset(){this.config={},this.loggers.clear()}async flushAllFileSinks(){let e=[];for(let t of this.loggers.values())e.push(t.flushFileSink());await Promise.all(e)}};function o1(e){return bpe.getLogger(e)}Hc();const xpe=new Set;function s1(e){xpe.add(e)}function Spe(){return Bc.getTracer(`open-knowledge-server`)}async function Cpe(e,t,n){return Spe().startActiveSpan(e,t??{},async e=>{try{let t=await n(e);return e.isRecording(),t}catch(t){throw e.recordException(t),e.setStatus({code:Nc.ERROR,message:t instanceof Error?t.message:String(t)}),t}finally{e.end()}})}o1(`loss-capture`),z({ts:F(),schemaVersion:F(),seq:F(),event:P(),docName:P(),writerId:P().nullable(),site:P().optional(),direction:P().optional(),lostLen:F().optional(),digest:P().optional(),checkpointSha:P().optional()});var wpe=i(((e,t)=>{var n=1e3,r=n*60,i=r*60,a=i*24,o=a*7,s=a*365.25;t.exports=function(e,t){t||={};var n=typeof e;if(n===`string`&&e.length>0)return c(e);if(n===`number`&&isFinite(e))return t.long?u(e):l(e);throw Error(`val is not a non-empty string or a valid number. val=`+JSON.stringify(e))};function c(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var c=parseFloat(t[1]);switch((t[2]||`ms`).toLowerCase()){case`years`:case`year`:case`yrs`:case`yr`:case`y`:return c*s;case`weeks`:case`week`:case`w`:return c*o;case`days`:case`day`:case`d`:return c*a;case`hours`:case`hour`:case`hrs`:case`hr`:case`h`:return c*i;case`minutes`:case`minute`:case`mins`:case`min`:case`m`:return c*r;case`seconds`:case`second`:case`secs`:case`sec`:case`s`:return c*n;case`milliseconds`:case`millisecond`:case`msecs`:case`msec`:case`ms`:return c;default:return}}}}function l(e){var t=Math.abs(e);return t>=a?Math.round(e/a)+`d`:t>=i?Math.round(e/i)+`h`:t>=r?Math.round(e/r)+`m`:t>=n?Math.round(e/n)+`s`:e+`ms`}function u(e){var t=Math.abs(e);return t>=a?d(e,t,a,`day`):t>=i?d(e,t,i,`hour`):t>=r?d(e,t,r,`minute`):t>=n?d(e,t,n,`second`):e+` ms`}function d(e,t,n,r){var i=t>=n*1.5;return Math.round(e/n)+` `+r+(i?`s`:``)}})),c1=i(((e,t)=>{function n(e){n.debug=n,n.default=n,n.coerce=c,n.disable=o,n.enable=i,n.enabled=s,n.humanize=wpe(),n.destroy=l,Object.keys(e).forEach(t=>{n[t]=e[t]}),n.names=[],n.skips=[],n.formatters={};function t(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return n.colors[Math.abs(t)%n.colors.length]}n.selectColor=t;function n(e){let t,i=null,a,o;function s(...e){if(!s.enabled)return;let r=s,i=Number(new Date);r.diff=i-(t||i),r.prev=t,r.curr=i,t=i,e[0]=n.coerce(e[0]),typeof e[0]!=`string`&&e.unshift(`%O`);let a=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,(t,i)=>{if(t===`%%`)return`%`;a++;let o=n.formatters[i];if(typeof o==`function`){let n=e[a];t=o.call(r,n),e.splice(a,1),a--}return t}),n.formatArgs.call(r,e),(r.log||n.log).apply(r,e)}return s.namespace=e,s.useColors=n.useColors(),s.color=n.selectColor(e),s.extend=r,s.destroy=n.destroy,Object.defineProperty(s,`enabled`,{enumerable:!0,configurable:!1,get:()=>i===null?(a!==n.namespaces&&(a=n.namespaces,o=n.enabled(e)),o):i,set:e=>{i=e}}),typeof n.init==`function`&&n.init(s),s}function r(e,t){let r=n(this.namespace+(t===void 0?`:`:t)+e);return r.log=this.log,r}function i(e){n.save(e),n.namespaces=e,n.names=[],n.skips=[];let t=(typeof e==`string`?e:``).trim().replace(/\s+/g,`,`).split(`,`).filter(Boolean);for(let e of t)e[0]===`-`?n.skips.push(e.slice(1)):n.names.push(e)}function a(e,t){let n=0,r=0,i=-1,a=0;for(;n<e.length;)if(r<t.length&&(t[r]===e[n]||t[r]===`*`))t[r]===`*`?(i=r,a=n,r++):(n++,r++);else if(i!==-1)r=i+1,a++,n=a;else return!1;for(;r<t.length&&t[r]===`*`;)r++;return r===t.length}function o(){let e=[...n.names,...n.skips.map(e=>`-`+e)].join(`,`);return n.enable(``),e}function s(e){for(let t of n.skips)if(a(e,t))return!1;for(let t of n.names)if(a(e,t))return!0;return!1}function c(e){return e instanceof Error?e.stack||e.message:e}function l(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return n.enable(n.load()),n}t.exports=n})),Tpe=i(((e,t)=>{e.formatArgs=r,e.save=i,e.load=a,e.useColors=n,e.storage=o(),e.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=`#0000CC.#0000FF.#0033CC.#0033FF.#0066CC.#0066FF.#0099CC.#0099FF.#00CC00.#00CC33.#00CC66.#00CC99.#00CCCC.#00CCFF.#3300CC.#3300FF.#3333CC.#3333FF.#3366CC.#3366FF.#3399CC.#3399FF.#33CC00.#33CC33.#33CC66.#33CC99.#33CCCC.#33CCFF.#6600CC.#6600FF.#6633CC.#6633FF.#66CC00.#66CC33.#9900CC.#9900FF.#9933CC.#9933FF.#99CC00.#99CC33.#CC0000.#CC0033.#CC0066.#CC0099.#CC00CC.#CC00FF.#CC3300.#CC3333.#CC3366.#CC3399.#CC33CC.#CC33FF.#CC6600.#CC6633.#CC9900.#CC9933.#CCCC00.#CCCC33.#FF0000.#FF0033.#FF0066.#FF0099.#FF00CC.#FF00FF.#FF3300.#FF3333.#FF3366.#FF3399.#FF33CC.#FF33FF.#FF6600.#FF6633.#FF9900.#FF9933.#FFCC00.#FFCC33`.split(`.`);function n(){if(typeof window<`u`&&window.process&&(window.process.type===`renderer`||window.process.__nwjs))return!0;if(typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return typeof document<`u`&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<`u`&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<`u`&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function r(e){if(e[0]=(this.useColors?`%c`:``)+this.namespace+(this.useColors?` %c`:` `)+e[0]+(this.useColors?`%c `:` `)+`+`+t.exports.humanize(this.diff),!this.useColors)return;let n=`color: `+this.color;e.splice(1,0,n,`color: inherit`);let r=0,i=0;e[0].replace(/%[a-zA-Z%]/g,e=>{e!==`%%`&&(r++,e===`%c`&&(i=r))}),e.splice(i,0,n)}e.log=console.debug||console.log||(()=>{});function i(t){try{t?e.storage.setItem(`debug`,t):e.storage.removeItem(`debug`)}catch{}}function a(){let t;try{t=e.storage.getItem(`debug`)||e.storage.getItem(`DEBUG`)}catch{}return!t&&typeof process<`u`&&`env`in process&&(t=process.env.DEBUG),t}function o(){try{return localStorage}catch{}}t.exports=c1()(e);let{formatters:s}=t.exports;s.j=function(e){try{return JSON.stringify(e)}catch(e){return`[UnexpectedJSONParseError]: `+e.message}}})),Epe=i(((e,t)=>{t.exports=(e,t=process.argv)=>{let n=e.startsWith(`-`)?``:e.length===1?`-`:`--`,r=t.indexOf(n+e),i=t.indexOf(`--`);return r!==-1&&(i===-1||r<i)}})),Dpe=i(((e,n)=>{let r=t(`os`),i=t(`tty`),a=Epe(),{env:o}=process,s;a(`no-color`)||a(`no-colors`)||a(`color=false`)||a(`color=never`)?s=0:(a(`color`)||a(`colors`)||a(`color=true`)||a(`color=always`))&&(s=1),`FORCE_COLOR`in o&&(s=o.FORCE_COLOR===`true`?1:o.FORCE_COLOR===`false`?0:o.FORCE_COLOR.length===0?1:Math.min(parseInt(o.FORCE_COLOR,10),3));function c(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function l(e,t){if(s===0)return 0;if(a(`color=16m`)||a(`color=full`)||a(`color=truecolor`))return 3;if(a(`color=256`))return 2;if(e&&!t&&s===void 0)return 0;let n=s||0;if(o.TERM===`dumb`)return n;if(process.platform===`win32`){let e=r.release().split(`.`);return Number(e[0])>=10&&Number(e[2])>=10586?Number(e[2])>=14931?3:2:1}if(`CI`in o)return[`TRAVIS`,`CIRCLECI`,`APPVEYOR`,`GITLAB_CI`,`GITHUB_ACTIONS`,`BUILDKITE`].some(e=>e in o)||o.CI_NAME===`codeship`?1:n;if(`TEAMCITY_VERSION`in o)return+!!/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(o.TEAMCITY_VERSION);if(o.COLORTERM===`truecolor`)return 3;if(`TERM_PROGRAM`in o){let e=parseInt((o.TERM_PROGRAM_VERSION||``).split(`.`)[0],10);switch(o.TERM_PROGRAM){case`iTerm.app`:return e>=3?3:2;case`Apple_Terminal`:return 2}}return/-256(color)?$/i.test(o.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(o.TERM)||`COLORTERM`in o?1:n}function u(e){return c(l(e,e&&e.isTTY))}n.exports={supportsColor:u,stdout:c(l(!0,i.isatty(1))),stderr:c(l(!0,i.isatty(2)))}})),Ope=i(((e,n)=>{let r=t(`tty`),i=t(`util`);e.init=d,e.log=c,e.formatArgs=o,e.save=l,e.load=u,e.useColors=a,e.destroy=i.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),e.colors=[6,2,3,4,5,1];try{let t=Dpe();t&&(t.stderr||t).level>=2&&(e.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}e.inspectOpts=Object.keys(process.env).filter(e=>/^debug_/i.test(e)).reduce((e,t)=>{let n=t.substring(6).toLowerCase().replace(/_([a-z])/g,(e,t)=>t.toUpperCase()),r=process.env[t];return r=/^(yes|on|true|enabled)$/i.test(r)?!0:/^(no|off|false|disabled)$/i.test(r)?!1:r===`null`?null:Number(r),e[n]=r,e},{});function a(){return`colors`in e.inspectOpts?!!e.inspectOpts.colors:r.isatty(process.stderr.fd)}function o(e){let{namespace:t,useColors:r}=this;if(r){let r=this.color,i=`\x1B[3`+(r<8?r:`8;5;`+r),a=` ${i};1m${t} \u001B[0m`;e[0]=a+e[0].split(`
420
+ `,{customPrettifiers:s,errorLikeObjectKeys:c,hideObject:l,levelFirst:u,levelKey:d,levelLabel:f,messageFormat:p,messageKey:m,minimumLevel:h,singleLine:g,timestampKey:_,translateTime:v}=e,y=e.errorProps.split(`,`),b=typeof e.useOnlyCustomProps==`boolean`?e.useOnlyCustomProps:e.useOnlyCustomProps===`true`,x=i(e.customLevels),S=a(e.customLevels),C=o(b,x,S),w;if(e.customColors)if(typeof e.customColors==`string`)w=e.customColors.split(`,`).reduce((t,r)=>{let[i,a]=r.split(`:`),o=(b?e.customLevels:S[i]!==void 0)?S[i]:n[i],s=o===void 0?i:o;return t.push([s,a]),t},[]);else if(typeof e.customColors==`object`)w=Object.keys(e.customColors).reduce((t,r)=>{let[i,a]=[r,e.customColors[r]],o=(b?e.customLevels:S[i]!==void 0)?S[i]:n[i],s=o===void 0?i:o;return t.push([s,a]),t},[]);else throw Error(`options.customColors must be of type string or object.`);let T={customLevels:x,customLevelNames:S};b===!0&&!e.customLevels&&(T.customLevels=void 0,T.customLevelNames=void 0);let E=e.include===void 0?void 0:new Set(e.include.split(`,`)),D=!E&&e.ignore?new Set(e.ignore.split(`,`)):void 0,ee=r(e.colorize,w,b),te=e.colorizeObjects?ee:r(!1,[],!1);return{EOL:t,IDENT:` `,colorizer:ee,customColors:w,customLevelNames:S,customLevels:x,customPrettifiers:s,customProperties:T,errorLikeObjectKeys:c,errorProps:y,getLevelLabelData:C,hideObject:l,ignoreKeys:D,includeKeys:E,levelFirst:u,levelKey:d,levelLabel:f,messageFormat:p,messageKey:m,minimumLevel:h,objectColorizer:te,singleLine:g,timestampKey:_,translateTime:v,useOnlyCustomProps:b}}})),cpe=i(((e,t)=>{t.exports=s,s.default=s,s.stable=d,s.stableStringify=d;var n=`[...]`,r=`[Circular]`,i=[],a=[];function o(){return{depthLimit:2**53-1,edgesLimit:2**53-1}}function s(e,t,n,r){r===void 0&&(r=o()),l(e,``,0,[],void 0,0,r);var s;try{s=a.length===0?JSON.stringify(e,t,n):JSON.stringify(e,p(t),n)}catch{return JSON.stringify(`[unable to serialize, circular reference is too complex to analyze]`)}finally{for(;i.length!==0;){var c=i.pop();c.length===4?Object.defineProperty(c[0],c[1],c[3]):c[0][c[1]]=c[2]}}return s}function c(e,t,n,r){var o=Object.getOwnPropertyDescriptor(r,n);o.get===void 0?(r[n]=e,i.push([r,n,t])):o.configurable?(Object.defineProperty(r,n,{value:e}),i.push([r,n,t,o])):a.push([t,n,e])}function l(e,t,i,a,o,s,u){s+=1;var d;if(typeof e==`object`&&e){for(d=0;d<a.length;d++)if(a[d]===e){c(r,e,t,o);return}if(u.depthLimit!==void 0&&s>u.depthLimit){c(n,e,t,o);return}if(u.edgesLimit!==void 0&&i+1>u.edgesLimit){c(n,e,t,o);return}if(a.push(e),Array.isArray(e))for(d=0;d<e.length;d++)l(e[d],d,d,a,e,s,u);else{var f=Object.keys(e);for(d=0;d<f.length;d++){var p=f[d];l(e[p],p,d,a,e,s,u)}}a.pop()}}function u(e,t){return e<t?-1:+(e>t)}function d(e,t,n,r){r===void 0&&(r=o());var s=f(e,``,0,[],void 0,0,r)||e,c;try{c=a.length===0?JSON.stringify(s,t,n):JSON.stringify(s,p(t),n)}catch{return JSON.stringify(`[unable to serialize, circular reference is too complex to analyze]`)}finally{for(;i.length!==0;){var l=i.pop();l.length===4?Object.defineProperty(l[0],l[1],l[3]):l[0][l[1]]=l[2]}}return c}function f(e,t,a,o,s,l,d){l+=1;var p;if(typeof e==`object`&&e){for(p=0;p<o.length;p++)if(o[p]===e){c(r,e,t,s);return}try{if(typeof e.toJSON==`function`)return}catch{return}if(d.depthLimit!==void 0&&l>d.depthLimit){c(n,e,t,s);return}if(d.edgesLimit!==void 0&&a+1>d.edgesLimit){c(n,e,t,s);return}if(o.push(e),Array.isArray(e))for(p=0;p<e.length;p++)f(e[p],p,p,o,e,l,d);else{var m={},h=Object.keys(e).sort(u);for(p=0;p<h.length;p++){var g=h[p];f(e[g],g,p,o,e,l,d),m[g]=e[g]}if(s!==void 0)i.push([s,t,e]),s[t]=m;else return m}o.pop()}}function p(e){return e=e===void 0?function(e,t){return t}:e,function(t,n){if(a.length>0)for(var r=0;r<a.length;r++){var i=a[r];if(i[1]===t&&i[0]===n){n=i[2],a.splice(r,1);break}}return e.call(this,t,n)}}})),K$=i(((e,t)=>{t.exports=r;let n=G$();function r({keyName:e,lines:t,eol:r,ident:i}){let a=``,o=`${i}${e}: ${n({input:t,ident:i,eol:r})}${r}`.split(r);for(let e=0;e<o.length;e+=1){e!==0&&(a+=r);let t=o[e];if(/^\s*"stack"/.test(t)){let e=/^(\s*"stack":)\s*(".*"),?$/.exec(t);if(e&&e.length===3){let n=/^\s*/.exec(t)[0].length+4,i=` `.repeat(n),o=e[2];a+=e[1]+r+i+JSON.parse(o).replace(/\n/g,r+i)}else a+=t}else a+=t}return a}})),q$=i(((e,t)=>{t.exports=o;let{LOGGER_KEYS:n}=A$(),r=cpe(),i=G$(),a=K$();function o({log:e,excludeLoggerKeys:t=!0,skipKeys:o=[],context:s}){let{EOL:c,IDENT:l,customPrettifiers:u,errorLikeObjectKeys:d,objectColorizer:f,singleLine:p,colorizer:m}=s,h=[].concat(o);t===!0&&Array.prototype.push.apply(h,n);let g=``,{plain:_,errors:v}=Object.entries(e).reduce(({plain:t,errors:n},[r,i])=>{if(h.includes(r)===!1){let a=typeof u[r]==`function`?u[r](i,r,e,{colors:m.colors}):i;d.includes(r)?n[r]=a:t[r]=a}return{plain:t,errors:n}},{plain:{},errors:{}});return p?(Object.keys(_).length>0&&(g+=f.greyMessage(r(_))),g+=c,g=g.replace(/\\\\/gi,`\\`)):Object.entries(_).forEach(([e,t])=>{let n=typeof u[e]==`function`?t:r(t,null,2);if(n===void 0)return;n=n.replace(/\\\\/gi,`\\`);let a=i({input:n,ident:l,eol:c});g+=`${l}${f.property(e)}:${a.startsWith(c)?``:` `}${a}${c}`}),Object.entries(v).forEach(([e,t])=>{let n=typeof u[e]==`function`?t:r(t,null,2);n!==void 0&&(g+=a({keyName:e,lines:n,eol:c,ident:l}))}),g}})),J$=i(((e,t)=>{t.exports=o;let{LOGGER_KEYS:n}=A$(),r=W$(),i=G$(),a=q$();function o({log:e,context:t}){let{EOL:o,IDENT:s,errorProps:c,messageKey:l}=t,u=e.stack,d=`${s}${i({input:u,ident:s,eol:o})}${o}`;if(c.length>0){let i=n.concat(l,`type`,`stack`),u;u=c[0]===`*`?Object.keys(e).filter(e=>i.includes(e)===!1):c.filter(e=>i.includes(e)===!1);for(let n=0;n<u.length;n+=1){let i=u[n];if(i in e){if(r(e[i])){let n=a({log:e[i],excludeLoggerKeys:!1,context:{...t,IDENT:s+s}});d=`${d}${s}${i}: {${o}${n}${s}}${o}`;continue}d=`${d}${s}${i}: ${e[i]}${o}`}}}return d}})),Y$=i(((e,t)=>{t.exports=r;let n=L$();function r({log:e,context:t}){let{colorizer:r,customLevels:i,customLevelNames:a,levelKey:o,getLevelLabelData:s}=t,c=t.customPrettifiers?.level,l=n(e,o);if(l===void 0)return;let u=r(l,{customLevels:i,customLevelNames:a});if(c){let[t]=s(l);return c(l,o,e,{label:t,labelColorized:u,colors:r.colors})}return u}})),X$=i(((e,t)=>{t.exports=a;let{LEVELS:n}=A$(),r=L$(),i=U$();function a({log:e,context:t}){let{colorizer:a,customLevels:o,levelKey:s,levelLabel:c,messageFormat:l,messageKey:u,useOnlyCustomProps:d}=t;if(l&&typeof l==`string`){let t=i(l,e),u=String(t).replace(/{([^{}]+)}/g,function(t,i){let a;if(i===c&&(a=r(e,s))!==void 0)return(d?o===void 0:o[a]===void 0)?n[a]:o[a];let l=r(e,i);return l===void 0?``:l});return a.message(u)}if(l&&typeof l==`function`){let t=l(e,u,c,{colors:a.colors});return a.message(t)}if(u in e&&!(typeof e[u]!=`string`&&typeof e[u]!=`number`&&typeof e[u]!=`boolean`))return a.message(e[u])}})),Z$=i(((e,t)=>{t.exports=n;function n({log:e,context:t}){let{customPrettifiers:n,colorizer:r}=t,i=``;if(e.name||e.pid||e.hostname){if(i+=`(`,e.name&&(i+=n.name?n.name(e.name,`name`,e,{colors:r.colors}):e.name),e.pid){let t=n.pid?n.pid(e.pid,`pid`,e,{colors:r.colors}):e.pid;e.name&&e.pid?i+=`/`+t:i+=t}if(e.hostname){let t=n.hostname?n.hostname(e.hostname,`hostname`,e,{colors:r.colors}):e.hostname;i+=`${i===`(`?`on`:` on`} ${t}`}i+=`)`}if(e.caller){let t=n.caller?n.caller(e.caller,`caller`,e,{colors:r.colors}):e.caller;i+=`${i===``?``:` `}<${t}>`}if(i!==``)return i}})),Q$=i(((e,t)=>{t.exports=r;let n=B$();function r({log:e,context:t}){let{timestampKey:r,translateTime:i}=t,a=t.customPrettifiers?.time,o=null;if(r in e?o=e[r]:`timestamp`in e&&(o=e.timestamp),o===null)return;let s=i?n(o,i):o;return a?a(s):`[${s}]`}})),lpe=i(((e,t)=>{t.exports={buildSafeSonicBoom:ipe(),createDate:F$(),deleteLogProperty:R$(),filterLog:z$(),formatTime:B$(),getPropertyValue:L$(),handleCustomLevelsNamesOpts:V$(),handleCustomLevelsOpts:H$(),interpretConditionals:U$(),isObject:W$(),isValidDate:P$(),joinLinesWithIndentation:G$(),noop:N$(),parseFactoryOptions:spe(),prettifyErrorLog:J$(),prettifyError:K$(),prettifyLevel:Y$(),prettifyMessage:X$(),prettifyMetadata:Z$(),prettifyObject:q$(),prettifyTime:Q$(),splitPropertyKey:I$(),getLevelLabelData:j$()}})),upe=i(((e,t)=>{let n=typeof Buffer<`u`,r=/"(?:_|\\u005[Ff])(?:_|\\u005[Ff])(?:p|\\u0070)(?:r|\\u0072)(?:o|\\u006[Ff])(?:t|\\u0074)(?:o|\\u006[Ff])(?:_|\\u005[Ff])(?:_|\\u005[Ff])"\s*:/,i=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/;function a(e,t,a){a==null&&typeof t==`object`&&t&&(a=t,t=void 0),n&&Buffer.isBuffer(e)&&(e=e.toString()),e&&e.charCodeAt(0)===65279&&(e=e.slice(1));let s=JSON.parse(e,t);if(typeof s!=`object`||!s)return s;let c=a&&a.protoAction||`error`,l=a&&a.constructorAction||`error`;if(c===`ignore`&&l===`ignore`)return s;if(c!==`ignore`&&l!==`ignore`){if(r.test(e)===!1&&i.test(e)===!1)return s}else if(c!==`ignore`&&l===`ignore`){if(r.test(e)===!1)return s}else if(i.test(e)===!1)return s;return o(s,{protoAction:c,constructorAction:l,safe:a&&a.safe})}function o(e,{protoAction:t=`error`,constructorAction:n=`error`,safe:r}={}){let i=[e];for(;i.length;){let e=i;i=[];for(let a of e){if(t!==`ignore`&&Object.prototype.hasOwnProperty.call(a,`__proto__`)){if(r===!0)return null;if(t===`error`)throw SyntaxError(`Object contains forbidden prototype property`);delete a.__proto__}if(n!==`ignore`&&Object.prototype.hasOwnProperty.call(a,`constructor`)&&a.constructor!==null&&typeof a.constructor==`object`&&Object.prototype.hasOwnProperty.call(a.constructor,`prototype`)){if(r===!0)return null;if(n===`error`)throw SyntaxError(`Object contains forbidden prototype property`);delete a.constructor}for(let e in a){let t=a[e];t&&typeof t==`object`&&i.push(t)}}}return e}function s(e,t,n){let{stackTraceLimit:r}=Error;Error.stackTraceLimit=0;try{return a(e,t,n)}finally{Error.stackTraceLimit=r}}function c(e,t){let{stackTraceLimit:n}=Error;Error.stackTraceLimit=0;try{return a(e,t,{safe:!0})}catch{return}finally{Error.stackTraceLimit=n}}t.exports=s,t.exports.default=s,t.exports.parse=s,t.exports.safeParse=c,t.exports.scan=o})),dpe=i(((e,t)=>{t.exports=h;let n=upe(),r=W$(),i=J$(),a=Y$(),o=X$(),s=Z$(),c=q$(),l=Q$(),u=z$(),{LEVELS:d,LEVEL_KEY:f,LEVEL_NAMES:p}=A$(),m=e=>{try{return{value:n.parse(e,{protoAction:`remove`})}}catch(e){return{err:e}}};function h(e){let t;if(r(e))t=e;else{let n=m(e);if(n.err||!r(n.value))return e+this.EOL;t=n.value}if(this.minimumLevel){let e;e=this.useOnlyCustomProps?this.customLevels:this.customLevelNames[this.minimumLevel]!==void 0;let n;if(n=e?this.customLevelNames[this.minimumLevel]:p[this.minimumLevel],n||=typeof this.minimumLevel==`string`?p[this.minimumLevel]:p[d[this.minimumLevel].toLowerCase()],t[this.levelKey===void 0?f:this.levelKey]<n)return}let n=o({log:t,context:this.context});(this.ignoreKeys||this.includeKeys)&&(t=u({log:t,context:this.context}));let h=a({log:t,context:{...this.context,...this.context.customProperties}}),g=s({log:t,context:this.context}),_=l({log:t,context:this.context}),v=``;if(this.levelFirst&&h&&(v=`${h}`),_&&v===``?v=`${_}`:_&&(v=`${v} ${_}`),!this.levelFirst&&h&&(v=v.length>0?`${v} ${h}`:h),g&&(v=v.length>0?`${v} ${g}:`:g),v.endsWith(`:`)===!1&&v!==``&&(v+=`:`),n!==void 0&&(v=v.length>0?`${v} ${n}`:n),v.length>0&&!this.singleLine&&(v+=this.EOL),t.type===`Error`&&typeof t.stack==`string`){let e=i({log:t,context:this.context});this.singleLine&&(v+=this.EOL),v+=e}else if(this.hideObject===!1){let e=[this.messageKey,this.levelKey,this.timestampKey].map(e=>e.replaceAll(/\\/g,``)).filter(e=>typeof t[e]==`string`||typeof t[e]==`number`||typeof t[e]==`boolean`),n=c({log:t,skipKeys:e,context:this.context});this.singleLine&&!/^\s$/.test(n)&&(v+=` `),v+=n}return v}})),fpe=i(((e,n)=>{let{isColorSupported:r}=O$(),i=tpe(),{Transform:a}=t(`node:stream`),o=rpe(),s=M$(),{ERROR_LIKE_KEYS:c,LEVEL_KEY:l,LEVEL_LABEL:u,MESSAGE_KEY:d,TIMESTAMP_KEY:f}=A$(),{buildSafeSonicBoom:p,parseFactoryOptions:m}=lpe(),h=dpe(),g={colorize:r,colorizeObjects:!0,crlf:!1,customColors:null,customLevels:null,customPrettifiers:{},errorLikeObjectKeys:c,errorProps:``,hideObject:!1,ignore:`hostname`,include:void 0,levelFirst:!1,levelKey:l,levelLabel:u,messageFormat:null,messageKey:d,minimumLevel:void 0,outputStream:process.stdout,singleLine:!1,timestampKey:f,translateTime:!0,useOnlyCustomProps:!0};function _(e){let t=m(Object.assign({},g,e));return h.bind({...t,context:t})}function v(e={}){let t=_(e),n;return o(function(r){r.on(`message`,function n(i){!i||i.code!==`PINO_CONFIG`||(Object.assign(e,{messageKey:i.config.messageKey,errorLikeObjectKeys:Array.from(new Set([...e.errorLikeObjectKeys||c,i.config.errorKey])),customLevels:i.config.levels.values}),t=_(e),r.off(`message`,n))});let o=new a({objectMode:!0,autoDestroy:!0,transform(e,n,r){r(null,t(e))}});return n=typeof e.destination==`object`&&typeof e.destination.write==`function`?e.destination:p({dest:e.destination||1,append:e.append,mkdir:e.mkdir,sync:e.sync}),r.on(`unknown`,function(e){n.write(e+`
421
+ `)}),i(r,o,n),o},{parse:`lines`,close(e,t){n.on(`close`,()=>{t(e)})}})}n.exports=v,n.exports.build=v,n.exports.PinoPretty=v,n.exports.prettyFactory=_,n.exports.colorizerFactory=s,n.exports.isColorSupported=r,n.exports.default=v})),$$=e(Qfe(),1),ppe=e(fpe(),1);const e1=new Map;function mpe(e){let t=e1.get(e);return t||(t={chain:Promise.resolve(),parentDirEnsured:!1},e1.set(e,t)),t}var hpe=class{#e;#t;#n;#r;constructor(e){this.#e=e.currentPath,this.#t=e.previousPath,this.#n=e.maxBytes,this.#r=mpe(e.currentPath)}append(e){let t=this.#r.chain.catch(()=>void 0).then(()=>this.#i(e));return this.#r.chain=t,t}async drain(){await this.#r.chain.catch(()=>void 0)}async#i(e){this.#r.parentDirEnsured||(await Te(me(this.#e),{recursive:!0}),this.#r.parentDirEnsured=!0),await Oe(this.#e,e,{flag:`a`});let t;try{t=ee(this.#e).size}catch{this.#r.parentDirEnsured=!1;return}if(t>this.#n)try{await De(this.#e,this.#t)}catch(e){if(e?.code!==`ENOENT`)throw e}}};const t1=[`.ok`,`local`,`logs`];function gpe(e){return M(e,...t1,`server-current.jsonl`)}function _pe(e){return M(e,...t1,`server-prev.jsonl`)}var n1=class extends Ae{#e;#t=0;#n=0;constructor(e){super({decodeStrings:!1}),this.#e=new hpe({currentPath:gpe(e.projectDir),previousPath:_pe(e.projectDir),maxBytes:e.maxBytes})}_write(e,t,n){this.#e.append(e).then(()=>n(),e=>{this.#r(e),n()})}#r(e){let t=Date.now();if(t-this.#t<5e3){this.#n++;return}this.#i(e instanceof Error?e.message:String(e),t)}#i(e,t){let n=this.#n;this.#n=0,this.#t=t,console.error(JSON.stringify({event:`pino-file-sink-write-dropped`,error:e,suppressed:n}))}async drain(){await this.#e.drain(),this.#n>0&&this.#i(`flushed at drain`,Date.now())}};function vpe(){let e=Bc.getSpan(Fc.active());if(!e)return{};let t=e.spanContext();return{trace_id:t.traceId,span_id:t.spanId,trace_flags:t.traceFlags}}function ype(){return process.env.NO_COLOR&&process.env.NO_COLOR!==``?!1:process.stdout.isTTY??!1}const r1=new Set([`fatal`,`error`,`warn`,`info`,`debug`,`trace`,`silent`]);function i1(e){return e===`silent`?1/0:$$.default.levels.values[e]??$$.default.levels.values.info}function a1(e,t){return i1(e)<=i1(t)?e:t}var bpe=class{name;transportConfigs=[];fileSinkOpts;redactPaths;activeFileSink;pinoInstance;options;constructor(e,t={}){this.name=e,this.options={name:this.name,level:process.env.LOG_LEVEL||(process.env.NODE_ENV===`test`?`silent`:`info`),serializers:{err:$$.default.stdSerializers.err,error:$$.default.stdSerializers.err},mixin:vpe,...t.options},t.transportConfigs&&(this.transportConfigs=t.transportConfigs),t.fileSink&&(this.fileSinkOpts=t.fileSink),t.redactPaths&&t.redactPaths.length>0&&(this.redactPaths=t.redactPaths,this.options={...this.options,redact:{paths:[...t.redactPaths],censor:`[REDACTED]`}}),this.pinoInstance=this.buildInstance()}resolveStreamLevels(){let e=this.options.level??`info`,t=process.env.OK_FILE_LEVEL?.toLowerCase(),n=t&&r1.has(t)?t:e===`silent`?`silent`:a1(e,`debug`),r=process.env.OK_CONSOLE_LEVEL?.toLowerCase(),i=r&&r1.has(r)?r:e;return{fileLevel:n,consoleLevel:i,instanceLevel:a1(n,i)}}buildInstance(){this.activeFileSink=void 0;let{fileLevel:e,consoleLevel:t,instanceLevel:n}=this.resolveStreamLevels();if(this.transportConfigs.length>0)return(0,$$.default)(this.options,$$.default.transport({targets:this.transportConfigs}));let r;try{r=(0,ppe.default)({colorize:ype(),translateTime:`HH:MM:ss`,ignore:`pid,hostname`})}catch(r){if(console.warn(`[PinoLogger] pino-pretty failed, falling back to JSON:`,r),this.fileSinkOpts){let t=new n1(this.fileSinkOpts);return this.activeFileSink=t,(0,$$.default)({...this.options,level:n},$$.default.multistream([{stream:t,level:e}]))}return(0,$$.default)({...this.options,level:t})}if(this.fileSinkOpts){let i=new n1(this.fileSinkOpts);return this.activeFileSink=i,(0,$$.default)({...this.options,level:n},$$.default.multistream([{stream:r,level:t},{stream:i,level:e}]))}return(0,$$.default)({...this.options,level:t},r)}recreateInstance(){typeof this.pinoInstance.flush==`function`&&this.pinoInstance.flush(),this.pinoInstance=this.buildInstance()}addTransport(e){this.transportConfigs.push(e),this.recreateInstance()}removeTransport(e){e>=0&&e<this.transportConfigs.length&&(this.transportConfigs.splice(e,1),this.recreateInstance())}getTransports(){return[...this.transportConfigs]}updateOptions(e){this.options={...this.options,...e},this.recreateInstance()}reconfigure(e){e.options&&(this.options={...this.options,...e.options}),e.transportConfigs&&(this.transportConfigs=e.transportConfigs),e.fileSink&&(this.fileSinkOpts=e.fileSink),e.redactPaths&&e.redactPaths.length>0&&(this.redactPaths=e.redactPaths,this.options={...this.options,redact:{paths:[...e.redactPaths],censor:`[REDACTED]`}}),this.recreateInstance()}getPinoInstance(){return this.pinoInstance}async flushFileSink(){this.activeFileSink&&await this.activeFileSink.drain()}error(e,t){this.pinoInstance.error(e,t)}warn(e,t){this.pinoInstance.warn(e,t)}info(e,t){this.pinoInstance.info(e,t)}debug(e,t){this.pinoInstance.debug(e,t)}};const xpe=new class{config={};loggers=new Map;configure(e){if(this.config=e,e.pinoConfig&&!e.defaultLogger&&!e.loggerFactory){for(let t of this.loggers.values())t.reconfigure(e.pinoConfig);return}this.loggers.clear()}getLogger(e){let t=this.loggers.get(e);if(t)return t;let n;return n=this.config.loggerFactory?this.config.loggerFactory(e):this.config.defaultLogger?this.config.defaultLogger:new bpe(e,this.config.pinoConfig),this.loggers.set(e,n),n}reset(){this.config={},this.loggers.clear()}async flushAllFileSinks(){let e=[];for(let t of this.loggers.values())e.push(t.flushFileSink());await Promise.all(e)}};function o1(e){return xpe.getLogger(e)}Hc();const Spe=new Set;function s1(e){Spe.add(e)}function Cpe(){return Bc.getTracer(`open-knowledge-server`)}async function wpe(e,t,n){return Cpe().startActiveSpan(e,t??{},async e=>{try{let t=await n(e);return e.isRecording(),t}catch(t){throw e.recordException(t),e.setStatus({code:Nc.ERROR,message:t instanceof Error?t.message:String(t)}),t}finally{e.end()}})}o1(`loss-capture`),z({ts:F(),schemaVersion:F(),seq:F(),event:P(),docName:P(),writerId:P().nullable(),site:P().optional(),direction:P().optional(),lostLen:F().optional(),digest:P().optional(),checkpointSha:P().optional()});var Tpe=i(((e,t)=>{var n=1e3,r=n*60,i=r*60,a=i*24,o=a*7,s=a*365.25;t.exports=function(e,t){t||={};var n=typeof e;if(n===`string`&&e.length>0)return c(e);if(n===`number`&&isFinite(e))return t.long?u(e):l(e);throw Error(`val is not a non-empty string or a valid number. val=`+JSON.stringify(e))};function c(e){if(e=String(e),!(e.length>100)){var t=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(e);if(t){var c=parseFloat(t[1]);switch((t[2]||`ms`).toLowerCase()){case`years`:case`year`:case`yrs`:case`yr`:case`y`:return c*s;case`weeks`:case`week`:case`w`:return c*o;case`days`:case`day`:case`d`:return c*a;case`hours`:case`hour`:case`hrs`:case`hr`:case`h`:return c*i;case`minutes`:case`minute`:case`mins`:case`min`:case`m`:return c*r;case`seconds`:case`second`:case`secs`:case`sec`:case`s`:return c*n;case`milliseconds`:case`millisecond`:case`msecs`:case`msec`:case`ms`:return c;default:return}}}}function l(e){var t=Math.abs(e);return t>=a?Math.round(e/a)+`d`:t>=i?Math.round(e/i)+`h`:t>=r?Math.round(e/r)+`m`:t>=n?Math.round(e/n)+`s`:e+`ms`}function u(e){var t=Math.abs(e);return t>=a?d(e,t,a,`day`):t>=i?d(e,t,i,`hour`):t>=r?d(e,t,r,`minute`):t>=n?d(e,t,n,`second`):e+` ms`}function d(e,t,n,r){var i=t>=n*1.5;return Math.round(e/n)+` `+r+(i?`s`:``)}})),c1=i(((e,t)=>{function n(e){n.debug=n,n.default=n,n.coerce=c,n.disable=o,n.enable=i,n.enabled=s,n.humanize=Tpe(),n.destroy=l,Object.keys(e).forEach(t=>{n[t]=e[t]}),n.names=[],n.skips=[],n.formatters={};function t(e){let t=0;for(let n=0;n<e.length;n++)t=(t<<5)-t+e.charCodeAt(n),t|=0;return n.colors[Math.abs(t)%n.colors.length]}n.selectColor=t;function n(e){let t,i=null,a,o;function s(...e){if(!s.enabled)return;let r=s,i=Number(new Date);r.diff=i-(t||i),r.prev=t,r.curr=i,t=i,e[0]=n.coerce(e[0]),typeof e[0]!=`string`&&e.unshift(`%O`);let a=0;e[0]=e[0].replace(/%([a-zA-Z%])/g,(t,i)=>{if(t===`%%`)return`%`;a++;let o=n.formatters[i];if(typeof o==`function`){let n=e[a];t=o.call(r,n),e.splice(a,1),a--}return t}),n.formatArgs.call(r,e),(r.log||n.log).apply(r,e)}return s.namespace=e,s.useColors=n.useColors(),s.color=n.selectColor(e),s.extend=r,s.destroy=n.destroy,Object.defineProperty(s,`enabled`,{enumerable:!0,configurable:!1,get:()=>i===null?(a!==n.namespaces&&(a=n.namespaces,o=n.enabled(e)),o):i,set:e=>{i=e}}),typeof n.init==`function`&&n.init(s),s}function r(e,t){let r=n(this.namespace+(t===void 0?`:`:t)+e);return r.log=this.log,r}function i(e){n.save(e),n.namespaces=e,n.names=[],n.skips=[];let t=(typeof e==`string`?e:``).trim().replace(/\s+/g,`,`).split(`,`).filter(Boolean);for(let e of t)e[0]===`-`?n.skips.push(e.slice(1)):n.names.push(e)}function a(e,t){let n=0,r=0,i=-1,a=0;for(;n<e.length;)if(r<t.length&&(t[r]===e[n]||t[r]===`*`))t[r]===`*`?(i=r,a=n,r++):(n++,r++);else if(i!==-1)r=i+1,a++,n=a;else return!1;for(;r<t.length&&t[r]===`*`;)r++;return r===t.length}function o(){let e=[...n.names,...n.skips.map(e=>`-`+e)].join(`,`);return n.enable(``),e}function s(e){for(let t of n.skips)if(a(e,t))return!1;for(let t of n.names)if(a(e,t))return!0;return!1}function c(e){return e instanceof Error?e.stack||e.message:e}function l(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")}return n.enable(n.load()),n}t.exports=n})),Epe=i(((e,t)=>{e.formatArgs=r,e.save=i,e.load=a,e.useColors=n,e.storage=o(),e.destroy=(()=>{let e=!1;return()=>{e||(e=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=`#0000CC.#0000FF.#0033CC.#0033FF.#0066CC.#0066FF.#0099CC.#0099FF.#00CC00.#00CC33.#00CC66.#00CC99.#00CCCC.#00CCFF.#3300CC.#3300FF.#3333CC.#3333FF.#3366CC.#3366FF.#3399CC.#3399FF.#33CC00.#33CC33.#33CC66.#33CC99.#33CCCC.#33CCFF.#6600CC.#6600FF.#6633CC.#6633FF.#66CC00.#66CC33.#9900CC.#9900FF.#9933CC.#9933FF.#99CC00.#99CC33.#CC0000.#CC0033.#CC0066.#CC0099.#CC00CC.#CC00FF.#CC3300.#CC3333.#CC3366.#CC3399.#CC33CC.#CC33FF.#CC6600.#CC6633.#CC9900.#CC9933.#CCCC00.#CCCC33.#FF0000.#FF0033.#FF0066.#FF0099.#FF00CC.#FF00FF.#FF3300.#FF3333.#FF3366.#FF3399.#FF33CC.#FF33FF.#FF6600.#FF6633.#FF9900.#FF9933.#FFCC00.#FFCC33`.split(`.`);function n(){if(typeof window<`u`&&window.process&&(window.process.type===`renderer`||window.process.__nwjs))return!0;if(typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/))return!1;let e;return typeof document<`u`&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<`u`&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<`u`&&navigator.userAgent&&(e=navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/))&&parseInt(e[1],10)>=31||typeof navigator<`u`&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function r(e){if(e[0]=(this.useColors?`%c`:``)+this.namespace+(this.useColors?` %c`:` `)+e[0]+(this.useColors?`%c `:` `)+`+`+t.exports.humanize(this.diff),!this.useColors)return;let n=`color: `+this.color;e.splice(1,0,n,`color: inherit`);let r=0,i=0;e[0].replace(/%[a-zA-Z%]/g,e=>{e!==`%%`&&(r++,e===`%c`&&(i=r))}),e.splice(i,0,n)}e.log=console.debug||console.log||(()=>{});function i(t){try{t?e.storage.setItem(`debug`,t):e.storage.removeItem(`debug`)}catch{}}function a(){let t;try{t=e.storage.getItem(`debug`)||e.storage.getItem(`DEBUG`)}catch{}return!t&&typeof process<`u`&&`env`in process&&(t=process.env.DEBUG),t}function o(){try{return localStorage}catch{}}t.exports=c1()(e);let{formatters:s}=t.exports;s.j=function(e){try{return JSON.stringify(e)}catch(e){return`[UnexpectedJSONParseError]: `+e.message}}})),Dpe=i(((e,t)=>{t.exports=(e,t=process.argv)=>{let n=e.startsWith(`-`)?``:e.length===1?`-`:`--`,r=t.indexOf(n+e),i=t.indexOf(`--`);return r!==-1&&(i===-1||r<i)}})),Ope=i(((e,n)=>{let r=t(`os`),i=t(`tty`),a=Dpe(),{env:o}=process,s;a(`no-color`)||a(`no-colors`)||a(`color=false`)||a(`color=never`)?s=0:(a(`color`)||a(`colors`)||a(`color=true`)||a(`color=always`))&&(s=1),`FORCE_COLOR`in o&&(s=o.FORCE_COLOR===`true`?1:o.FORCE_COLOR===`false`?0:o.FORCE_COLOR.length===0?1:Math.min(parseInt(o.FORCE_COLOR,10),3));function c(e){return e===0?!1:{level:e,hasBasic:!0,has256:e>=2,has16m:e>=3}}function l(e,t){if(s===0)return 0;if(a(`color=16m`)||a(`color=full`)||a(`color=truecolor`))return 3;if(a(`color=256`))return 2;if(e&&!t&&s===void 0)return 0;let n=s||0;if(o.TERM===`dumb`)return n;if(process.platform===`win32`){let e=r.release().split(`.`);return Number(e[0])>=10&&Number(e[2])>=10586?Number(e[2])>=14931?3:2:1}if(`CI`in o)return[`TRAVIS`,`CIRCLECI`,`APPVEYOR`,`GITLAB_CI`,`GITHUB_ACTIONS`,`BUILDKITE`].some(e=>e in o)||o.CI_NAME===`codeship`?1:n;if(`TEAMCITY_VERSION`in o)return+!!/^(9\.(0*[1-9]\d*)\.|\d{2,}\.)/.test(o.TEAMCITY_VERSION);if(o.COLORTERM===`truecolor`)return 3;if(`TERM_PROGRAM`in o){let e=parseInt((o.TERM_PROGRAM_VERSION||``).split(`.`)[0],10);switch(o.TERM_PROGRAM){case`iTerm.app`:return e>=3?3:2;case`Apple_Terminal`:return 2}}return/-256(color)?$/i.test(o.TERM)?2:/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(o.TERM)||`COLORTERM`in o?1:n}function u(e){return c(l(e,e&&e.isTTY))}n.exports={supportsColor:u,stdout:c(l(!0,i.isatty(1))),stderr:c(l(!0,i.isatty(2)))}})),kpe=i(((e,n)=>{let r=t(`tty`),i=t(`util`);e.init=d,e.log=c,e.formatArgs=o,e.save=l,e.load=u,e.useColors=a,e.destroy=i.deprecate(()=>{},"Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."),e.colors=[6,2,3,4,5,1];try{let t=Ope();t&&(t.stderr||t).level>=2&&(e.colors=[20,21,26,27,32,33,38,39,40,41,42,43,44,45,56,57,62,63,68,69,74,75,76,77,78,79,80,81,92,93,98,99,112,113,128,129,134,135,148,149,160,161,162,163,164,165,166,167,168,169,170,171,172,173,178,179,184,185,196,197,198,199,200,201,202,203,204,205,206,207,208,209,214,215,220,221])}catch{}e.inspectOpts=Object.keys(process.env).filter(e=>/^debug_/i.test(e)).reduce((e,t)=>{let n=t.substring(6).toLowerCase().replace(/_([a-z])/g,(e,t)=>t.toUpperCase()),r=process.env[t];return r=/^(yes|on|true|enabled)$/i.test(r)?!0:/^(no|off|false|disabled)$/i.test(r)?!1:r===`null`?null:Number(r),e[n]=r,e},{});function a(){return`colors`in e.inspectOpts?!!e.inspectOpts.colors:r.isatty(process.stderr.fd)}function o(e){let{namespace:t,useColors:r}=this;if(r){let r=this.color,i=`\x1B[3`+(r<8?r:`8;5;`+r),a=` ${i};1m${t} \u001B[0m`;e[0]=a+e[0].split(`
422
422
  `).join(`
423
423
  `+a),e.push(i+`m+`+n.exports.humanize(this.diff)+`\x1B[0m`)}else e[0]=s()+t+` `+e[0]}function s(){return e.inspectOpts.hideDate?``:new Date().toISOString()+` `}function c(...t){return process.stderr.write(i.formatWithOptions(e.inspectOpts,...t)+`
424
424
  `)}function l(e){e?process.env.DEBUG=e:delete process.env.DEBUG}function u(){return process.env.DEBUG}function d(t){t.inspectOpts={};let n=Object.keys(e.inspectOpts);for(let r=0;r<n.length;r++)t.inspectOpts[n[r]]=e.inspectOpts[n[r]]}n.exports=c1()(e);let{formatters:f}=n.exports;f.o=function(e){return this.inspectOpts.colors=this.useColors,i.inspect(e,this.inspectOpts).split(`
425
- `).map(e=>e.trim()).join(` `)},f.O=function(e){return this.inspectOpts.colors=this.useColors,i.inspect(e,this.inspectOpts)}})),l1=i(((e,t)=>{typeof process>`u`||process.type===`renderer`||process.browser===!0||process.__nwjs?t.exports=Tpe():t.exports=Ope()})),kpe=i((e=>{var n=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,`__esModule`,{value:!0});let r=t(`fs`),i=n(l1()).default(`@kwsites/file-exists`);function a(e,t,n){i(`checking %s`,e);try{let a=r.statSync(e);return a.isFile()&&t?(i(`[OK] path represents a file`),!0):a.isDirectory()&&n?(i(`[OK] path represents a directory`),!0):(i(`[FAIL] path represents something other than a file or directory`),!1)}catch(e){if(e.code===`ENOENT`)return i(`[FAIL] path is not accessible: %o`,e),!1;throw i(`[FATAL] %o`,e),e}}function o(t,n=e.READABLE){return a(t,(n&e.FILE)>0,(n&e.FOLDER)>0)}e.exists=o,e.FILE=1,e.FOLDER=2,e.READABLE=e.FILE+e.FOLDER})),u1=i((e=>{function t(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}Object.defineProperty(e,`__esModule`,{value:!0}),t(kpe())}))();const d1=new WeakMap;function f1(...e){let t=new String(e);return d1.set(t,e),t}function p1(e){return e instanceof String&&d1.has(e)}var Ape=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.createDeferred=e.deferred=void 0;function t(){let e,t,n=`pending`;return{promise:new Promise((n,r)=>{e=n,t=r}),done(t){n===`pending`&&(n=`resolved`,e(t))},fail(e){n===`pending`&&(n=`rejected`,t(e))},get fulfilled(){return n!==`pending`},get status(){return n}}}e.deferred=t,e.createDeferred=t})),m1=e(l1()),h1=Ape();new Map([[`C`,!0],[`P`,!1],[`h`,!1],[`p`,!1],[`v`,!1],...{short:new Map([[`c`,!0]])}.short.entries()]);function g1(e,t,n=String(e)){let r=typeof e==`string`?RegExp(`\\s*${e.toLowerCase()}`):e;return function(e){if(r.test(e))return{category:t,message:`Configuring ${n} is not permitted without enabling ${t}`}}}function _1(e,t){return g1(RegExp(`\\s*${e.toLowerCase().replace(/\./g,`(..+)?.`)}`),t,e)}g1(`alias`,`allowUnsafeAlias`),g1(`core.askPass`,`allowUnsafeAskPass`),g1(`core.editor`,`allowUnsafeEditor`),g1(`core.fsmonitor`,`allowUnsafeFsMonitor`),g1(`core.gitProxy`,`allowUnsafeGitProxy`),g1(`core.hooksPath`,`allowUnsafeHooksPath`),g1(`core.pager`,`allowUnsafePager`),g1(`core.sshCommand`,`allowUnsafeSshCommand`),_1(`credential.helper`,`allowUnsafeCredentialHelper`),_1(`diff.command`,`allowUnsafeDiffExternal`),g1(`diff.external`,`allowUnsafeDiffExternal`),_1(`diff.textconv`,`allowUnsafeDiffTextConv`),_1(`filter.clean`,`allowUnsafeFilter`),_1(`filter.smudge`,`allowUnsafeFilter`),_1(`gpg.program`,`allowUnsafeGpgProgram`),g1(`init.templateDir`,`allowUnsafeTemplateDir`),_1(`merge.driver`,`allowUnsafeMergeDriver`),_1(`mergetool.path`,`allowUnsafeMergeDriver`),_1(`mergetool.cmd`,`allowUnsafeMergeDriver`),_1(`protocol.allow`,`allowUnsafeProtocolOverride`),_1(`remote.receivepack`,`allowUnsafePack`),_1(`remote.uploadpack`,`allowUnsafePack`),g1(`sequence.editor`,`allowUnsafeEditor`);function v1(e,t,n,r=String(t)){let i=typeof t==`string`?RegExp(`\\s*${t.toLowerCase()}`):t,a=`Use of ${e?`${e} with option `:``}${r} is not permitted without enabling ${n}`;return function(t,r){if((!e||t===e)&&i.test(r))return{category:n,message:a}}}v1(null,/--(upload|receive)-pack/,`allowUnsafePack`,`--upload-pack or --receive-pack`),v1(`clone`,/^-\w*u/,`allowUnsafePack`),v1(`clone`,`--u`,`allowUnsafePack`),v1(`push`,`--exec`,`allowUnsafePack`),v1(null,`--template`,`allowUnsafeTemplateDir`);var y1=Object.defineProperty,jpe=Object.getOwnPropertyDescriptor,b1=Object.getOwnPropertyNames,Mpe=Object.prototype.hasOwnProperty,x1=(e,t)=>function(){return e&&(t=(0,e[b1(e)[0]])(e=0)),t},Npe=(e,t)=>function(){return t||(0,e[b1(e)[0]])((t={exports:{}}).exports,t),t.exports},S1=(e,t)=>{for(var n in t)y1(e,n,{get:t[n],enumerable:!0})},Ppe=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let i of b1(t))!Mpe.call(e,i)&&i!==n&&y1(e,i,{get:()=>t[i],enumerable:!(r=jpe(t,i))||r.enumerable});return e},C1=e=>Ppe(y1({},`__esModule`,{value:!0}),e),w1,T1=x1({"src/lib/errors/git-error.ts"(){w1=class extends Error{constructor(e,t){super(t),this.task=e,Object.setPrototypeOf(this,new.target.prototype)}}}}),E1,D1=x1({"src/lib/errors/git-response-error.ts"(){T1(),E1=class extends w1{constructor(e,t){super(void 0,t||String(e)),this.git=e}}}}),O1,k1=x1({"src/lib/errors/task-configuration-error.ts"(){T1(),O1=class extends w1{constructor(e){super(void 0,e)}}}});function A1(e){return typeof e==`function`?e:Y1}function j1(e){return typeof e==`function`&&e!==Y1}function M1(e,t){let n=e.indexOf(t);return n<=0?[e,``]:[e.substr(0,n),e.substr(n+1)]}function N1(e,t=0){return F1(e)&&e.length>t?e[t]:void 0}function P1(e,t=0){if(F1(e)&&e.length>t)return e[e.length-1-t]}function F1(e){return o0(e)}function I1(e=``,t=!0,n=`
426
- `){return e.split(n).reduce((e,n)=>{let r=t?n.trim():n;return r&&e.push(r),e},[])}function L1(e,t){return I1(e,!0).map(e=>t(e))}function R1(e){return(0,u1.exists)(e,u1.FOLDER)}function z1(e,t){return Array.isArray(e)?e.includes(t)||e.push(t):e.add(t),t}function Fpe(e,t){return Array.isArray(e)&&!e.includes(t)&&e.push(t),e}function B1(e,t){if(Array.isArray(e)){let n=e.indexOf(t);n>=0&&e.splice(n,1)}else e.delete(t);return t}function V1(e){return Array.isArray(e)?e:[e]}function H1(e){return e.replace(/[\s-]+(.)/g,(e,t)=>t.toUpperCase())}function U1(e){return V1(e).map(e=>e instanceof String?e:String(e))}function W1(e,t=0){if(e==null)return t;let n=parseInt(e,10);return Number.isNaN(n)?t:n}function G1(e,t){let n=[];for(let r=0,i=e.length;r<i;r++)n.push(t,e[r]);return n}function K1(e){return(Array.isArray(e)?Buffer.concat(e):e).toString(`utf-8`)}function Ipe(e,t){let n={};return t.forEach(t=>{e[t]!==void 0&&(n[t]=e[t])}),n}function Lpe(e=0){return new Promise(t=>setTimeout(t,e))}function q1(e){if(e!==!1)return e}var J1,Y1,X1,Z1=x1({"src/lib/utils/util.ts"(){s0(),J1=`\0`,Y1=()=>{},X1=Object.prototype.toString.call.bind(Object.prototype.toString)}});function Q1(e,t,n){return t(e)?e:arguments.length>2?n:void 0}function $1(e,t){let n=p1(e)?`string`:typeof e;return/number|string|boolean/.test(n)&&(!t||!t.includes(n))}function e0(e){return!!e&&X1(e)===`[object Object]`}function t0(e){return typeof e==`function`}var n0,r0,i0,a0,o0,s0=x1({"src/lib/utils/argument-filters.ts"(){Z1(),n0=e=>Array.isArray(e),r0=e=>typeof e==`number`,i0=e=>typeof e==`string`||p1(e),a0=e=>i0(e)||Array.isArray(e)&&e.every(i0),o0=e=>e==null||`number|boolean|function`.includes(typeof e)?!1:typeof e.length==`number`}}),c0,Rpe=x1({"src/lib/utils/exit-codes.ts"(){c0=(e=>(e[e.SUCCESS=0]=`SUCCESS`,e[e.ERROR=1]=`ERROR`,e[e.NOT_FOUND=-2]=`NOT_FOUND`,e[e.UNCLEAN=128]=`UNCLEAN`,e))(c0||{})}}),l0,zpe=x1({"src/lib/utils/git-output-streams.ts"(){l0=class e{constructor(e,t){this.stdOut=e,this.stdErr=t}asStrings(){return new e(this.stdOut.toString(`utf8`),this.stdErr.toString(`utf8`))}}}});function Bpe(){throw Error(`LineParser:useMatches not implemented`)}var u0,d0,Vpe=x1({"src/lib/utils/line-parser.ts"(){u0=class{constructor(e,t){this.matches=[],this.useMatches=Bpe,this.parse=(e,t)=>(this.resetMatches(),this._regExp.every((t,n)=>this.addMatch(t,n,e(n)))?this.useMatches(t,this.prepareMatches())!==!1:!1),this._regExp=Array.isArray(e)?e:[e],t&&(this.useMatches=t)}resetMatches(){this.matches.length=0}prepareMatches(){return this.matches}addMatch(e,t,n){let r=n&&e.exec(n);return r&&this.pushMatch(t,r),!!r}pushMatch(e,t){this.matches.push(...t.slice(1))}},d0=class extends u0{addMatch(e,t,n){return/^remote:\s/.test(String(n))&&super.addMatch(e,t,n)}pushMatch(e,t){(e>0||t.length>1)&&super.pushMatch(e,t)}}}});function Hpe(...e){let t=process.cwd(),n=Object.assign({baseDir:t,...f0},...e.filter(e=>typeof e==`object`&&e));return n.baseDir=n.baseDir||t,n.trimmed=n.trimmed===!0,n}var f0,Upe=x1({"src/lib/utils/simple-git-options.ts"(){f0={binary:`git`,maxConcurrentProcesses:5,config:[],trimmed:!1}}});function p0(e,t=[]){return e0(e)?Object.keys(e).reduce((t,n)=>{let r=e[n];if(p1(r))t.push(r);else if($1(r,[`boolean`]))t.push(n+`=`+r);else if(Array.isArray(r))for(let e of r)$1(e,[`string`,`number`])||t.push(n+`=`+e);else t.push(n);return t},t):t}function m0(e,t=0,n=!1){let r=[];for(let n=0,i=t<0?e.length:t;n<i;n++)`string|number`.includes(typeof e[n])&&r.push(String(e[n]));return p0(h0(e),r),n||r.push(...Wpe(e)),r}function Wpe(e){return U1(Q1(P1(e,+(typeof P1(e)==`function`)),n0,[]))}function h0(e){return Q1(P1(e,+!!t0(P1(e))),e0)}function g0(e,t=!0){let n=A1(P1(e));return t||j1(n)?n:void 0}var Gpe=x1({"src/lib/utils/task-options.ts"(){s0(),Z1()}});function _0(e,t){return e(t.stdOut,t.stdErr)}function v0(e,t,n,r=!0){return V1(n).forEach(n=>{for(let i=I1(n,r),a=0,o=i.length;a<o;a++){let n=(e=0)=>{if(!(a+e>=o))return i[a+e]};t.some(({parse:t})=>t(n,e))}}),e}var Kpe=x1({"src/lib/utils/task-parser.ts"(){Z1()}}),y0={};S1(y0,{ExitCodes:()=>c0,GitOutputStreams:()=>l0,LineParser:()=>u0,NOOP:()=>Y1,NULL:()=>J1,RemoteLineParser:()=>d0,append:()=>z1,appendTaskOptions:()=>p0,asArray:()=>V1,asCamelCase:()=>H1,asFunction:()=>A1,asNumber:()=>W1,asStringArray:()=>U1,bufferToString:()=>K1,callTaskParser:()=>_0,createInstanceConfig:()=>Hpe,delay:()=>Lpe,filterArray:()=>n0,filterFunction:()=>t0,filterHasLength:()=>o0,filterNumber:()=>r0,filterPlainObject:()=>e0,filterPrimitives:()=>$1,filterString:()=>i0,filterStringOrStringArray:()=>a0,filterType:()=>Q1,first:()=>N1,folderExists:()=>R1,forEachLineWithContent:()=>L1,getTrailingOptions:()=>m0,including:()=>Fpe,isUserFunction:()=>j1,last:()=>P1,objectToString:()=>X1,orVoid:()=>q1,parseStringResponse:()=>v0,pick:()=>Ipe,prefixedArray:()=>G1,remove:()=>B1,splitOn:()=>M1,toLinesWithContent:()=>I1,trailingFunctionArgument:()=>g0,trailingOptionsArgument:()=>h0});var b0=x1({"src/lib/utils/index.ts"(){s0(),Rpe(),zpe(),Vpe(),Upe(),Gpe(),Kpe(),Z1()}}),x0={};S1(x0,{CheckRepoActions:()=>w0,checkIsBareRepoTask:()=>C0,checkIsRepoRootTask:()=>S0,checkIsRepoTask:()=>qpe});function qpe(e){switch(e){case`bare`:return C0();case`root`:return S0()}return{commands:[`rev-parse`,`--is-inside-work-tree`],format:`utf-8`,onError:T0,parser:E0}}function S0(){return{commands:[`rev-parse`,`--git-dir`],format:`utf-8`,onError:T0,parser(e){return/^\.(git)?$/.test(e.trim())}}}function C0(){return{commands:[`rev-parse`,`--is-bare-repository`],format:`utf-8`,onError:T0,parser:E0}}function Jpe(e){return/(Not a git repository|Kein Git-Repository)/i.test(String(e))}var w0,T0,E0,D0=x1({"src/lib/tasks/check-is-repo.ts"(){b0(),w0=(e=>(e.BARE=`bare`,e.IN_TREE=`tree`,e.IS_REPO_ROOT=`root`,e))(w0||{}),T0=({exitCode:e},t,n,r)=>{if(e===128&&Jpe(t))return n(Buffer.from(`false`));r(t)},E0=e=>e.trim()===`true`}});function Ype(e,t){let n=new O0(e),r=e?A0:k0;return I1(t).forEach(e=>{let t=e.replace(r,``);n.paths.push(t),(j0.test(t)?n.folders:n.files).push(t)}),n}var O0,k0,A0,j0,Xpe=x1({"src/lib/responses/CleanSummary.ts"(){b0(),O0=class{constructor(e){this.dryRun=e,this.paths=[],this.files=[],this.folders=[]}},k0=/^[a-z]+\s*/i,A0=/^[a-z]+\s+[a-z]+\s*/i,j0=/\/$/}}),M0={};S1(M0,{EMPTY_COMMANDS:()=>z0,adhocExecTask:()=>N0,configurationErrorTask:()=>P0,isBufferTask:()=>L0,isEmptyTask:()=>R0,straightThroughBufferTask:()=>I0,straightThroughStringTask:()=>F0});function N0(e){return{commands:z0,format:`empty`,parser:e}}function P0(e){return{commands:z0,format:`empty`,parser(){throw typeof e==`string`?new O1(e):e}}}function F0(e,t=!1){return{commands:e,format:`utf-8`,parser(e){return t?String(e).trim():e}}}function I0(e){return{commands:e,format:`buffer`,parser(e){return e}}}function L0(e){return e.format===`buffer`}function R0(e){return e.format===`empty`||!e.commands.length}var z0,B0=x1({"src/lib/tasks/task.ts"(){k1(),z0=[]}}),V0={};S1(V0,{CONFIG_ERROR_INTERACTIVE_MODE:()=>U0,CONFIG_ERROR_MODE_REQUIRED:()=>W0,CONFIG_ERROR_UNKNOWN_OPTION:()=>G0,CleanOptions:()=>K0,cleanTask:()=>H0,cleanWithOptionsTask:()=>Zpe,isCleanOptionsArray:()=>Qpe});function Zpe(e,t){let{cleanMode:n,options:r,valid:i}=$pe(e);return n?i.options?(r.push(...t),r.some(nme)?P0(U0):H0(n,r)):P0(G0+JSON.stringify(e)):P0(W0)}function H0(e,t){return{commands:[`clean`,`-${e}`,...t],format:`utf-8`,parser(t){return Ype(e===`n`,t)}}}function Qpe(e){return Array.isArray(e)&&e.every(e=>q0.has(e))}function $pe(e){let t,n=[],r={cleanMode:!1,options:!0};return e.replace(/[^a-z]i/g,``).split(``).forEach(e=>{eme(e)?(t=e,r.cleanMode=!0):r.options=r.options&&tme(n[n.length]=`-${e}`)}),{cleanMode:t,options:n,valid:r}}function eme(e){return e===`f`||e===`n`}function tme(e){return/^-[a-z]$/i.test(e)&&q0.has(e.charAt(1))}function nme(e){return/^-[^\-]/.test(e)?e.indexOf(`i`)>0:e===`--interactive`}var U0,W0,G0,K0,q0,J0=x1({"src/lib/tasks/clean.ts"(){Xpe(),b0(),B0(),U0=`Git clean interactive mode is not supported`,W0=`Git clean mode parameter ("n" or "f") is required`,G0=`Git clean unknown option found in: `,K0=(e=>(e.DRY_RUN=`n`,e.FORCE=`f`,e.IGNORED_INCLUDED=`x`,e.IGNORED_ONLY=`X`,e.EXCLUDING=`e`,e.QUIET=`q`,e.RECURSIVE=`d`,e))(K0||{}),q0=new Set([`i`,...U1(Object.values(K0))])}});function rme(e){let t=new X0;for(let n of Y0(e))t.addValue(n.file,String(n.key),n.value);return t}function ime(e,t){let n=null,r=[],i=new Map;for(let a of Y0(e,t))a.key===t&&(r.push(n=a.value),i.has(a.file)||i.set(a.file,[]),i.get(a.file).push(n));return{key:t,paths:Array.from(i.keys()),scopes:i,value:n,values:r}}function ame(e){return e.replace(/^(file):/,``)}function*Y0(e,t=null){let n=e.split(`\0`);for(let e=0,r=n.length-1;e<r;){let r=ame(n[e++]),i=n[e++],a=t;if(i.includes(`
425
+ `).map(e=>e.trim()).join(` `)},f.O=function(e){return this.inspectOpts.colors=this.useColors,i.inspect(e,this.inspectOpts)}})),l1=i(((e,t)=>{typeof process>`u`||process.type===`renderer`||process.browser===!0||process.__nwjs?t.exports=Epe():t.exports=kpe()})),Ape=i((e=>{var n=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,`__esModule`,{value:!0});let r=t(`fs`),i=n(l1()).default(`@kwsites/file-exists`);function a(e,t,n){i(`checking %s`,e);try{let a=r.statSync(e);return a.isFile()&&t?(i(`[OK] path represents a file`),!0):a.isDirectory()&&n?(i(`[OK] path represents a directory`),!0):(i(`[FAIL] path represents something other than a file or directory`),!1)}catch(e){if(e.code===`ENOENT`)return i(`[FAIL] path is not accessible: %o`,e),!1;throw i(`[FATAL] %o`,e),e}}function o(t,n=e.READABLE){return a(t,(n&e.FILE)>0,(n&e.FOLDER)>0)}e.exists=o,e.FILE=1,e.FOLDER=2,e.READABLE=e.FILE+e.FOLDER})),u1=i((e=>{function t(t){for(var n in t)e.hasOwnProperty(n)||(e[n]=t[n])}Object.defineProperty(e,`__esModule`,{value:!0}),t(Ape())}))();const d1=new WeakMap;function f1(...e){let t=new String(e);return d1.set(t,e),t}function p1(e){return e instanceof String&&d1.has(e)}var jpe=i((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.createDeferred=e.deferred=void 0;function t(){let e,t,n=`pending`;return{promise:new Promise((n,r)=>{e=n,t=r}),done(t){n===`pending`&&(n=`resolved`,e(t))},fail(e){n===`pending`&&(n=`rejected`,t(e))},get fulfilled(){return n!==`pending`},get status(){return n}}}e.deferred=t,e.createDeferred=t})),m1=e(l1()),h1=jpe();new Map([[`C`,!0],[`P`,!1],[`h`,!1],[`p`,!1],[`v`,!1],...{short:new Map([[`c`,!0]])}.short.entries()]);function g1(e,t,n=String(e)){let r=typeof e==`string`?RegExp(`\\s*${e.toLowerCase()}`):e;return function(e){if(r.test(e))return{category:t,message:`Configuring ${n} is not permitted without enabling ${t}`}}}function _1(e,t){return g1(RegExp(`\\s*${e.toLowerCase().replace(/\./g,`(..+)?.`)}`),t,e)}g1(`alias`,`allowUnsafeAlias`),g1(`core.askPass`,`allowUnsafeAskPass`),g1(`core.editor`,`allowUnsafeEditor`),g1(`core.fsmonitor`,`allowUnsafeFsMonitor`),g1(`core.gitProxy`,`allowUnsafeGitProxy`),g1(`core.hooksPath`,`allowUnsafeHooksPath`),g1(`core.pager`,`allowUnsafePager`),g1(`core.sshCommand`,`allowUnsafeSshCommand`),_1(`credential.helper`,`allowUnsafeCredentialHelper`),_1(`diff.command`,`allowUnsafeDiffExternal`),g1(`diff.external`,`allowUnsafeDiffExternal`),_1(`diff.textconv`,`allowUnsafeDiffTextConv`),_1(`filter.clean`,`allowUnsafeFilter`),_1(`filter.smudge`,`allowUnsafeFilter`),_1(`gpg.program`,`allowUnsafeGpgProgram`),g1(`init.templateDir`,`allowUnsafeTemplateDir`),_1(`merge.driver`,`allowUnsafeMergeDriver`),_1(`mergetool.path`,`allowUnsafeMergeDriver`),_1(`mergetool.cmd`,`allowUnsafeMergeDriver`),_1(`protocol.allow`,`allowUnsafeProtocolOverride`),_1(`remote.receivepack`,`allowUnsafePack`),_1(`remote.uploadpack`,`allowUnsafePack`),g1(`sequence.editor`,`allowUnsafeEditor`);function v1(e,t,n,r=String(t)){let i=typeof t==`string`?RegExp(`\\s*${t.toLowerCase()}`):t,a=`Use of ${e?`${e} with option `:``}${r} is not permitted without enabling ${n}`;return function(t,r){if((!e||t===e)&&i.test(r))return{category:n,message:a}}}v1(null,/--(upload|receive)-pack/,`allowUnsafePack`,`--upload-pack or --receive-pack`),v1(`clone`,/^-\w*u/,`allowUnsafePack`),v1(`clone`,`--u`,`allowUnsafePack`),v1(`push`,`--exec`,`allowUnsafePack`),v1(null,`--template`,`allowUnsafeTemplateDir`);var y1=Object.defineProperty,Mpe=Object.getOwnPropertyDescriptor,b1=Object.getOwnPropertyNames,Npe=Object.prototype.hasOwnProperty,x1=(e,t)=>function(){return e&&(t=(0,e[b1(e)[0]])(e=0)),t},Ppe=(e,t)=>function(){return t||(0,e[b1(e)[0]])((t={exports:{}}).exports,t),t.exports},S1=(e,t)=>{for(var n in t)y1(e,n,{get:t[n],enumerable:!0})},Fpe=(e,t,n,r)=>{if(t&&typeof t==`object`||typeof t==`function`)for(let i of b1(t))!Npe.call(e,i)&&i!==n&&y1(e,i,{get:()=>t[i],enumerable:!(r=Mpe(t,i))||r.enumerable});return e},C1=e=>Fpe(y1({},`__esModule`,{value:!0}),e),w1,T1=x1({"src/lib/errors/git-error.ts"(){w1=class extends Error{constructor(e,t){super(t),this.task=e,Object.setPrototypeOf(this,new.target.prototype)}}}}),E1,D1=x1({"src/lib/errors/git-response-error.ts"(){T1(),E1=class extends w1{constructor(e,t){super(void 0,t||String(e)),this.git=e}}}}),O1,k1=x1({"src/lib/errors/task-configuration-error.ts"(){T1(),O1=class extends w1{constructor(e){super(void 0,e)}}}});function A1(e){return typeof e==`function`?e:Y1}function j1(e){return typeof e==`function`&&e!==Y1}function M1(e,t){let n=e.indexOf(t);return n<=0?[e,``]:[e.substr(0,n),e.substr(n+1)]}function N1(e,t=0){return F1(e)&&e.length>t?e[t]:void 0}function P1(e,t=0){if(F1(e)&&e.length>t)return e[e.length-1-t]}function F1(e){return o0(e)}function I1(e=``,t=!0,n=`
426
+ `){return e.split(n).reduce((e,n)=>{let r=t?n.trim():n;return r&&e.push(r),e},[])}function L1(e,t){return I1(e,!0).map(e=>t(e))}function R1(e){return(0,u1.exists)(e,u1.FOLDER)}function z1(e,t){return Array.isArray(e)?e.includes(t)||e.push(t):e.add(t),t}function Ipe(e,t){return Array.isArray(e)&&!e.includes(t)&&e.push(t),e}function B1(e,t){if(Array.isArray(e)){let n=e.indexOf(t);n>=0&&e.splice(n,1)}else e.delete(t);return t}function V1(e){return Array.isArray(e)?e:[e]}function H1(e){return e.replace(/[\s-]+(.)/g,(e,t)=>t.toUpperCase())}function U1(e){return V1(e).map(e=>e instanceof String?e:String(e))}function W1(e,t=0){if(e==null)return t;let n=parseInt(e,10);return Number.isNaN(n)?t:n}function G1(e,t){let n=[];for(let r=0,i=e.length;r<i;r++)n.push(t,e[r]);return n}function K1(e){return(Array.isArray(e)?Buffer.concat(e):e).toString(`utf-8`)}function Lpe(e,t){let n={};return t.forEach(t=>{e[t]!==void 0&&(n[t]=e[t])}),n}function Rpe(e=0){return new Promise(t=>setTimeout(t,e))}function q1(e){if(e!==!1)return e}var J1,Y1,X1,Z1=x1({"src/lib/utils/util.ts"(){s0(),J1=`\0`,Y1=()=>{},X1=Object.prototype.toString.call.bind(Object.prototype.toString)}});function Q1(e,t,n){return t(e)?e:arguments.length>2?n:void 0}function $1(e,t){let n=p1(e)?`string`:typeof e;return/number|string|boolean/.test(n)&&(!t||!t.includes(n))}function e0(e){return!!e&&X1(e)===`[object Object]`}function t0(e){return typeof e==`function`}var n0,r0,i0,a0,o0,s0=x1({"src/lib/utils/argument-filters.ts"(){Z1(),n0=e=>Array.isArray(e),r0=e=>typeof e==`number`,i0=e=>typeof e==`string`||p1(e),a0=e=>i0(e)||Array.isArray(e)&&e.every(i0),o0=e=>e==null||`number|boolean|function`.includes(typeof e)?!1:typeof e.length==`number`}}),c0,zpe=x1({"src/lib/utils/exit-codes.ts"(){c0=(e=>(e[e.SUCCESS=0]=`SUCCESS`,e[e.ERROR=1]=`ERROR`,e[e.NOT_FOUND=-2]=`NOT_FOUND`,e[e.UNCLEAN=128]=`UNCLEAN`,e))(c0||{})}}),l0,Bpe=x1({"src/lib/utils/git-output-streams.ts"(){l0=class e{constructor(e,t){this.stdOut=e,this.stdErr=t}asStrings(){return new e(this.stdOut.toString(`utf8`),this.stdErr.toString(`utf8`))}}}});function Vpe(){throw Error(`LineParser:useMatches not implemented`)}var u0,d0,Hpe=x1({"src/lib/utils/line-parser.ts"(){u0=class{constructor(e,t){this.matches=[],this.useMatches=Vpe,this.parse=(e,t)=>(this.resetMatches(),this._regExp.every((t,n)=>this.addMatch(t,n,e(n)))?this.useMatches(t,this.prepareMatches())!==!1:!1),this._regExp=Array.isArray(e)?e:[e],t&&(this.useMatches=t)}resetMatches(){this.matches.length=0}prepareMatches(){return this.matches}addMatch(e,t,n){let r=n&&e.exec(n);return r&&this.pushMatch(t,r),!!r}pushMatch(e,t){this.matches.push(...t.slice(1))}},d0=class extends u0{addMatch(e,t,n){return/^remote:\s/.test(String(n))&&super.addMatch(e,t,n)}pushMatch(e,t){(e>0||t.length>1)&&super.pushMatch(e,t)}}}});function Upe(...e){let t=process.cwd(),n=Object.assign({baseDir:t,...f0},...e.filter(e=>typeof e==`object`&&e));return n.baseDir=n.baseDir||t,n.trimmed=n.trimmed===!0,n}var f0,Wpe=x1({"src/lib/utils/simple-git-options.ts"(){f0={binary:`git`,maxConcurrentProcesses:5,config:[],trimmed:!1}}});function p0(e,t=[]){return e0(e)?Object.keys(e).reduce((t,n)=>{let r=e[n];if(p1(r))t.push(r);else if($1(r,[`boolean`]))t.push(n+`=`+r);else if(Array.isArray(r))for(let e of r)$1(e,[`string`,`number`])||t.push(n+`=`+e);else t.push(n);return t},t):t}function m0(e,t=0,n=!1){let r=[];for(let n=0,i=t<0?e.length:t;n<i;n++)`string|number`.includes(typeof e[n])&&r.push(String(e[n]));return p0(h0(e),r),n||r.push(...Gpe(e)),r}function Gpe(e){return U1(Q1(P1(e,+(typeof P1(e)==`function`)),n0,[]))}function h0(e){return Q1(P1(e,+!!t0(P1(e))),e0)}function g0(e,t=!0){let n=A1(P1(e));return t||j1(n)?n:void 0}var Kpe=x1({"src/lib/utils/task-options.ts"(){s0(),Z1()}});function _0(e,t){return e(t.stdOut,t.stdErr)}function v0(e,t,n,r=!0){return V1(n).forEach(n=>{for(let i=I1(n,r),a=0,o=i.length;a<o;a++){let n=(e=0)=>{if(!(a+e>=o))return i[a+e]};t.some(({parse:t})=>t(n,e))}}),e}var qpe=x1({"src/lib/utils/task-parser.ts"(){Z1()}}),y0={};S1(y0,{ExitCodes:()=>c0,GitOutputStreams:()=>l0,LineParser:()=>u0,NOOP:()=>Y1,NULL:()=>J1,RemoteLineParser:()=>d0,append:()=>z1,appendTaskOptions:()=>p0,asArray:()=>V1,asCamelCase:()=>H1,asFunction:()=>A1,asNumber:()=>W1,asStringArray:()=>U1,bufferToString:()=>K1,callTaskParser:()=>_0,createInstanceConfig:()=>Upe,delay:()=>Rpe,filterArray:()=>n0,filterFunction:()=>t0,filterHasLength:()=>o0,filterNumber:()=>r0,filterPlainObject:()=>e0,filterPrimitives:()=>$1,filterString:()=>i0,filterStringOrStringArray:()=>a0,filterType:()=>Q1,first:()=>N1,folderExists:()=>R1,forEachLineWithContent:()=>L1,getTrailingOptions:()=>m0,including:()=>Ipe,isUserFunction:()=>j1,last:()=>P1,objectToString:()=>X1,orVoid:()=>q1,parseStringResponse:()=>v0,pick:()=>Lpe,prefixedArray:()=>G1,remove:()=>B1,splitOn:()=>M1,toLinesWithContent:()=>I1,trailingFunctionArgument:()=>g0,trailingOptionsArgument:()=>h0});var b0=x1({"src/lib/utils/index.ts"(){s0(),zpe(),Bpe(),Hpe(),Wpe(),Kpe(),qpe(),Z1()}}),x0={};S1(x0,{CheckRepoActions:()=>w0,checkIsBareRepoTask:()=>C0,checkIsRepoRootTask:()=>S0,checkIsRepoTask:()=>Jpe});function Jpe(e){switch(e){case`bare`:return C0();case`root`:return S0()}return{commands:[`rev-parse`,`--is-inside-work-tree`],format:`utf-8`,onError:T0,parser:E0}}function S0(){return{commands:[`rev-parse`,`--git-dir`],format:`utf-8`,onError:T0,parser(e){return/^\.(git)?$/.test(e.trim())}}}function C0(){return{commands:[`rev-parse`,`--is-bare-repository`],format:`utf-8`,onError:T0,parser:E0}}function Ype(e){return/(Not a git repository|Kein Git-Repository)/i.test(String(e))}var w0,T0,E0,D0=x1({"src/lib/tasks/check-is-repo.ts"(){b0(),w0=(e=>(e.BARE=`bare`,e.IN_TREE=`tree`,e.IS_REPO_ROOT=`root`,e))(w0||{}),T0=({exitCode:e},t,n,r)=>{if(e===128&&Ype(t))return n(Buffer.from(`false`));r(t)},E0=e=>e.trim()===`true`}});function Xpe(e,t){let n=new O0(e),r=e?A0:k0;return I1(t).forEach(e=>{let t=e.replace(r,``);n.paths.push(t),(j0.test(t)?n.folders:n.files).push(t)}),n}var O0,k0,A0,j0,Zpe=x1({"src/lib/responses/CleanSummary.ts"(){b0(),O0=class{constructor(e){this.dryRun=e,this.paths=[],this.files=[],this.folders=[]}},k0=/^[a-z]+\s*/i,A0=/^[a-z]+\s+[a-z]+\s*/i,j0=/\/$/}}),M0={};S1(M0,{EMPTY_COMMANDS:()=>z0,adhocExecTask:()=>N0,configurationErrorTask:()=>P0,isBufferTask:()=>L0,isEmptyTask:()=>R0,straightThroughBufferTask:()=>I0,straightThroughStringTask:()=>F0});function N0(e){return{commands:z0,format:`empty`,parser:e}}function P0(e){return{commands:z0,format:`empty`,parser(){throw typeof e==`string`?new O1(e):e}}}function F0(e,t=!1){return{commands:e,format:`utf-8`,parser(e){return t?String(e).trim():e}}}function I0(e){return{commands:e,format:`buffer`,parser(e){return e}}}function L0(e){return e.format===`buffer`}function R0(e){return e.format===`empty`||!e.commands.length}var z0,B0=x1({"src/lib/tasks/task.ts"(){k1(),z0=[]}}),V0={};S1(V0,{CONFIG_ERROR_INTERACTIVE_MODE:()=>U0,CONFIG_ERROR_MODE_REQUIRED:()=>W0,CONFIG_ERROR_UNKNOWN_OPTION:()=>G0,CleanOptions:()=>K0,cleanTask:()=>H0,cleanWithOptionsTask:()=>Qpe,isCleanOptionsArray:()=>$pe});function Qpe(e,t){let{cleanMode:n,options:r,valid:i}=eme(e);return n?i.options?(r.push(...t),r.some(rme)?P0(U0):H0(n,r)):P0(G0+JSON.stringify(e)):P0(W0)}function H0(e,t){return{commands:[`clean`,`-${e}`,...t],format:`utf-8`,parser(t){return Xpe(e===`n`,t)}}}function $pe(e){return Array.isArray(e)&&e.every(e=>q0.has(e))}function eme(e){let t,n=[],r={cleanMode:!1,options:!0};return e.replace(/[^a-z]i/g,``).split(``).forEach(e=>{tme(e)?(t=e,r.cleanMode=!0):r.options=r.options&&nme(n[n.length]=`-${e}`)}),{cleanMode:t,options:n,valid:r}}function tme(e){return e===`f`||e===`n`}function nme(e){return/^-[a-z]$/i.test(e)&&q0.has(e.charAt(1))}function rme(e){return/^-[^\-]/.test(e)?e.indexOf(`i`)>0:e===`--interactive`}var U0,W0,G0,K0,q0,J0=x1({"src/lib/tasks/clean.ts"(){Zpe(),b0(),B0(),U0=`Git clean interactive mode is not supported`,W0=`Git clean mode parameter ("n" or "f") is required`,G0=`Git clean unknown option found in: `,K0=(e=>(e.DRY_RUN=`n`,e.FORCE=`f`,e.IGNORED_INCLUDED=`x`,e.IGNORED_ONLY=`X`,e.EXCLUDING=`e`,e.QUIET=`q`,e.RECURSIVE=`d`,e))(K0||{}),q0=new Set([`i`,...U1(Object.values(K0))])}});function ime(e){let t=new X0;for(let n of Y0(e))t.addValue(n.file,String(n.key),n.value);return t}function ame(e,t){let n=null,r=[],i=new Map;for(let a of Y0(e,t))a.key===t&&(r.push(n=a.value),i.has(a.file)||i.set(a.file,[]),i.get(a.file).push(n));return{key:t,paths:Array.from(i.keys()),scopes:i,value:n,values:r}}function ome(e){return e.replace(/^(file):/,``)}function*Y0(e,t=null){let n=e.split(`\0`);for(let e=0,r=n.length-1;e<r;){let r=ome(n[e++]),i=n[e++],a=t;if(i.includes(`
427
427
  `)){let e=M1(i,`
428
- `);a=e[0],i=e[1]}yield{file:r,key:a,value:i}}}var X0,ome=x1({"src/lib/responses/ConfigList.ts"(){b0(),X0=class{constructor(){this.files=[],this.values=Object.create(null)}get all(){return this._all||=this.files.reduce((e,t)=>Object.assign(e,this.values[t]),{}),this._all}addFile(e){if(!(e in this.values)){let t=P1(this.files);this.values[e]=t?Object.create(this.values[t]):{},this.files.push(e)}return this.values[e]}addValue(e,t,n){let r=this.addFile(e);Object.hasOwn(r,t)?Array.isArray(r[t])?r[t].push(n):r[t]=[r[t],n]:r[t]=n,this._all=void 0}}}});function Z0(e,t){return typeof e==`string`&&Object.hasOwn(Q0,e)?e:t}function sme(e,t,n,r){let i=[`config`,`--${r}`];return n&&i.push(`--add`),i.push(e,t),{commands:i,format:`utf-8`,parser(e){return e}}}function cme(e,t){let n=[`config`,`--null`,`--show-origin`,`--get-all`,e];return t&&n.splice(1,0,`--${t}`),{commands:n,format:`utf-8`,parser(t){return ime(t,e)}}}function lme(e){let t=[`config`,`--list`,`--show-origin`,`--null`];return e&&t.push(`--${e}`),{commands:t,format:`utf-8`,parser(e){return rme(e)}}}function ume(){return{addConfig(e,t,...n){return this._runTask(sme(e,t,n[0]===!0,Z0(n[1],`local`)),g0(arguments))},getConfig(e,t){return this._runTask(cme(e,Z0(t,void 0)),g0(arguments))},listConfig(...e){return this._runTask(lme(Z0(e[0],void 0)),g0(arguments))}}}var Q0,$0=x1({"src/lib/tasks/config.ts"(){ome(),b0(),Q0=(e=>(e.system=`system`,e.global=`global`,e.local=`local`,e.worktree=`worktree`,e))(Q0||{})}});function dme(e){return t2.has(e)}var e2,t2,n2=x1({"src/lib/tasks/diff-name-status.ts"(){e2=(e=>(e.ADDED=`A`,e.COPIED=`C`,e.DELETED=`D`,e.MODIFIED=`M`,e.RENAMED=`R`,e.CHANGED=`T`,e.UNMERGED=`U`,e.UNKNOWN=`X`,e.BROKEN=`B`,e))(e2||{}),t2=new Set(Object.values(e2))}});function fme(...e){return new o2().param(...e)}function pme(e){let t=new Set,n={};return L1(e,e=>{let[r,i,a]=e.split(J1);t.add(r),(n[r]=n[r]||[]).push({line:W1(i),path:r,preview:a})}),{paths:t,results:n}}function mme(){return{grep(e){let t=g0(arguments),n=m0(arguments);for(let e of r2)if(n.includes(e))return this._runTask(P0(`git.grep: use of "${e}" is not supported.`),t);typeof e==`string`&&(e=fme().param(e));let r=[`grep`,`--null`,`-n`,`--full-name`,...n,...e];return this._runTask({commands:r,format:`utf-8`,parser(e){return pme(e)}},t)}}}var r2,i2,a2,o2,s2=x1({"src/lib/tasks/grep.ts"(){b0(),B0(),r2=[`-h`],i2=Symbol(`grepQuery`),o2=class{constructor(){this[a2]=[]}*[(a2=i2,Symbol.iterator)](){for(let e of this[i2])yield e}and(...e){return e.length&&this[i2].push(`--and`,`(`,...G1(e,`-e`),`)`),this}param(...e){return this[i2].push(...G1(e,`-e`)),this}}}}),c2={};S1(c2,{ResetMode:()=>u2,getResetMode:()=>gme,resetTask:()=>hme});function hme(e,t){let n=[`reset`];return l2(e)&&n.push(`--${e}`),n.push(...t),F0(n)}function gme(e){if(l2(e))return e;switch(typeof e){case`string`:case`undefined`:return`soft`}}function l2(e){return typeof e==`string`&&d2.includes(e)}var u2,d2,f2=x1({"src/lib/tasks/reset.ts"(){b0(),B0(),u2=(e=>(e.MIXED=`mixed`,e.SOFT=`soft`,e.HARD=`hard`,e.MERGE=`merge`,e.KEEP=`keep`,e))(u2||{}),d2=U1(Object.values(u2))}});function _me(){return(0,m1.default)(`simple-git`)}function p2(e,t,n){return!t||!String(t).replace(/\s*/,``)?n?(t,...r)=>{e(t,...r),n(t,...r)}:e:(r,...i)=>{e(`%s ${r}`,t,...i),n&&n(r,...i)}}function vme(e,t,{namespace:n}){if(typeof e==`string`)return e;let r=t&&t.namespace||``;return r.startsWith(n)?r.substr(n.length+1):r||n}function m2(e,t,n,r=_me()){let i=e&&`[${e}]`||``,a=[],o=typeof t==`string`?r.extend(t):t,s=vme(Q1(t,i0),o,r);return l(n);function c(t,n){return z1(a,m2(e,s.replace(/^[^:]+/,t),n,r))}function l(t){let n=t&&`[${t}]`||``,a=o&&p2(o,n)||Y1,s=p2(r,`${i} ${n}`,a);return Object.assign(o?a:s,{label:e,sibling:c,info:s,step:l})}}var h2=x1({"src/lib/git-logger.ts"(){b0(),m1.default.formatters.L=e=>String(o0(e)?e.length:`-`),m1.default.formatters.B=e=>Buffer.isBuffer(e)?e.toString(`utf8`):X1(e)}}),g2,yme=x1({"src/lib/runners/tasks-pending-queue.ts"(){T1(),h2(),g2=class e{constructor(e=`GitExecutor`){this.logLabel=e,this._queue=new Map}withProgress(e){return this._queue.get(e)}createProgress(t){let n=e.getName(t.commands[0]);return{task:t,logger:m2(this.logLabel,n),name:n}}push(e){let t=this.createProgress(e);return t.logger(`Adding task to the queue, commands = %o`,e.commands),this._queue.set(e,t),t}fatal(e){for(let[t,{logger:n}]of Array.from(this._queue.entries()))t===e.task?(n.info(`Failed %o`,e),n(`Fatal exception, any as-yet un-started tasks run through this executor will not be attempted`)):n.info(`A fatal exception occurred in a previous task, the queue has been purged: %o`,e.message),this.complete(t);if(this._queue.size!==0)throw Error(`Queue size should be zero after fatal: ${this._queue.size}`)}complete(e){this.withProgress(e)&&this._queue.delete(e)}attempt(e){let t=this.withProgress(e);if(!t)throw new w1(void 0,`TasksPendingQueue: attempt called for an unknown task`);return t.logger(`Starting task`),t}static getName(t=`empty`){return`task:${t}:${++e.counter}`}static{this.counter=0}}}});function _2(e,t){return{method:N1(e.commands)||``,commands:t}}function bme(e,t){return n=>{t(`[ERROR] child process exception %o`,n),e.push(Buffer.from(String(n.stack),`ascii`))}}function v2(e,t,n,r){return i=>{n(`%s received %L bytes`,t,i),r(`%B`,i),e.push(i)}}var y2,xme=x1({"src/lib/runners/git-executor-chain.ts"(){T1(),B0(),b0(),yme(),y2=class{constructor(e,t,n){this._executor=e,this._scheduler=t,this._plugins=n,this._chain=Promise.resolve(),this._queue=new g2}get cwd(){return this._cwd||this._executor.cwd}set cwd(e){this._cwd=e}get env(){return this._executor.env}get outputHandler(){return this._executor.outputHandler}chain(){return this}push(e){return this._queue.push(e),this._chain=this._chain.then(()=>this.attemptTask(e))}async attemptTask(e){let t=await this._scheduler.next(),n=()=>this._queue.complete(e);try{let{logger:t}=this._queue.attempt(e);return await(R0(e)?this.attemptEmptyTask(e,t):this.attemptRemoteTask(e,t))}catch(t){throw this.onFatalException(e,t)}finally{n(),t()}}onFatalException(e,t){let n=t instanceof w1?Object.assign(t,{task:e}):new w1(e,t&&String(t));return this._chain=Promise.resolve(),this._queue.fatal(n),n}async attemptRemoteTask(e,t){let n=this._plugins.exec(`spawn.binary`,``,_2(e,e.commands)),r=this._plugins.exec(`spawn.args`,[...e.commands],{..._2(e,e.commands),env:{...this.env}}),i=await this.gitResponse(e,n,r,this.outputHandler,t.step(`SPAWN`)),a=await this.handleTaskData(e,r,i,t.step(`HANDLE`));return t(`passing response to task's parser as a %s`,e.format),L0(e)?_0(e.parser,a):_0(e.parser,a.asStrings())}async attemptEmptyTask(e,t){return t(`empty task bypassing child process to call to task's parser`),e.parser(this)}handleTaskData(e,t,n,r){let{exitCode:i,rejection:a,stdOut:o,stdErr:s}=n;return new Promise((c,l)=>{r(`Preparing to handle process response exitCode=%d stdOut=`,i);let{error:u}=this._plugins.exec(`task.error`,{error:a},{..._2(e,t),...n});if(u&&e.onError)return r.info(`exitCode=%s handling with custom error handler`),e.onError(n,u,e=>{r.info(`custom error handler treated as success`),r(`custom error returned a %s`,X1(e)),c(new l0(Array.isArray(e)?Buffer.concat(e):e,Buffer.concat(s)))},l);if(u)return r.info(`handling as error: exitCode=%s stdErr=%s rejection=%o`,i,s.length,a),l(u);r.info(`retrieving task output complete`),c(new l0(Buffer.concat(o),Buffer.concat(s)))})}async gitResponse(e,t,n,r,i){let a=i.sibling(`output`),o=this._plugins.exec(`spawn.options`,{cwd:this.cwd,env:this.env,windowsHide:!0},_2(e,e.commands));return new Promise(s=>{let c=[],l=[];i.info(`%s %o`,t,n),i(`%O`,o);let u=this._beforeSpawn(e,n);if(u)return s({stdOut:c,stdErr:l,exitCode:9901,rejection:u});this._plugins.exec(`spawn.before`,void 0,{..._2(e,n),kill(e){u=e||u}});let d=Fe(t,n,o);d.stdout.on(`data`,v2(c,`stdOut`,i,a.step(`stdOut`))),d.stderr.on(`data`,v2(l,`stdErr`,i,a.step(`stdErr`))),d.on(`error`,bme(l,i)),r&&(i(`Passing child process stdOut/stdErr to custom outputHandler`),r(t,d.stdout,d.stderr,[...n])),this._plugins.exec(`spawn.after`,void 0,{..._2(e,n),spawned:d,close(e,t){s({stdOut:c,stdErr:l,exitCode:e,rejection:u||t})},kill(e){d.killed||(u=e,d.kill(`SIGINT`))}})})}_beforeSpawn(e,t){let n;return this._plugins.exec(`spawn.before`,void 0,{..._2(e,t),kill(e){n=e||n}}),n}}}}),b2={};S1(b2,{GitExecutor:()=>x2});var x2,Sme=x1({"src/lib/runners/git-executor.ts"(){xme(),x2=class{constructor(e,t,n){this.cwd=e,this._scheduler=t,this._plugins=n,this._chain=new y2(this,this._scheduler,this._plugins)}chain(){return new y2(this,this._scheduler,this._plugins)}push(e){return this._chain.push(e)}}}});function Cme(e,t,n=Y1){t.then(e=>{n(null,e)},t=>{t?.task===e&&n(t instanceof E1?wme(t):t,void 0)})}function wme(e){let t=e=>{console.warn(`simple-git deprecation notice: accessing GitResponseError.${e} should be GitResponseError.git.${e}, this will no longer be available in version 3`),t=Y1};return Object.create(e,Object.getOwnPropertyNames(e.git).reduce(n,{}));function n(n,r){return r in e||(n[r]={enumerable:!1,configurable:!1,get(){return t(r),e.git[r]}}),n}}var Tme=x1({"src/lib/task-callback.ts"(){D1(),b0()}});function S2(e,t){return N0(n=>{if(!R1(e))throw Error(`Git.cwd: cannot change to non-directory "${e}"`);return(t||n).cwd=e})}var Eme=x1({"src/lib/tasks/change-working-directory.ts"(){b0(),B0()}});function C2(e){let t=[`checkout`,...e];return t[1]===`-b`&&t.includes(`-B`)&&(t[1]=B1(t,`-B`)),F0(t)}function Dme(){return{checkout(){return this._runTask(C2(m0(arguments,1)),g0(arguments))},checkoutBranch(e,t){return this._runTask(C2([`-b`,e,t,...m0(arguments)]),g0(arguments))},checkoutLocalBranch(e){return this._runTask(C2([`-b`,e,...m0(arguments)]),g0(arguments))}}}var Ome=x1({"src/lib/tasks/checkout.ts"(){b0(),B0()}});function kme(){return{count:0,garbage:0,inPack:0,packs:0,prunePackable:0,size:0,sizeGarbage:0,sizePack:0}}function Ame(){return{countObjects(){return this._runTask({commands:[`count-objects`,`--verbose`],format:`utf-8`,parser(e){return v0(kme(),[w2],e)}})}}}var w2,jme=x1({"src/lib/tasks/count-objects.ts"(){b0(),w2=new u0(/([a-z-]+): (\d+)$/,(e,[t,n])=>{let r=H1(t);Object.hasOwn(e,r)&&(e[r]=W1(n))})}});function Mme(e){return v0({author:null,branch:``,commit:``,root:!1,summary:{changes:0,insertions:0,deletions:0}},T2,e)}var T2,Nme=x1({"src/lib/parsers/parse-commit.ts"(){b0(),T2=[new u0(/^\[([^\s]+)( \([^)]+\))? ([^\]]+)/,(e,[t,n,r])=>{e.branch=t,e.commit=r,e.root=!!n}),new u0(/\s*Author:\s(.+)/i,(e,[t])=>{let n=t.split(`<`),r=n.pop();!r||!r.includes(`@`)||(e.author={email:r.substr(0,r.length-1),name:n.join(`<`).trim()})}),new u0(/(\d+)[^,]*(?:,\s*(\d+)[^,]*)(?:,\s*(\d+))/g,(e,[t,n,r])=>{e.summary.changes=parseInt(t,10)||0,e.summary.insertions=parseInt(n,10)||0,e.summary.deletions=parseInt(r,10)||0}),new u0(/^(\d+)[^,]*(?:,\s*(\d+)[^(]+\(([+-]))?/,(e,[t,n,r])=>{e.summary.changes=parseInt(t,10)||0;let i=parseInt(n,10)||0;r===`-`?e.summary.deletions=i:r===`+`&&(e.summary.insertions=i)})]}});function Pme(e,t,n){return{commands:[`-c`,`core.abbrev=40`,`commit`,...G1(e,`-m`),...t,...n],format:`utf-8`,parser:Mme}}function Fme(){return{commit(t,...n){let r=g0(arguments),i=e(t)||Pme(V1(t),V1(Q1(n[0],a0,[])),[...U1(Q1(n[1],n0,[])),...m0(arguments,0,!0)]);return this._runTask(i,r)}};function e(e){return!a0(e)&&P0(`git.commit: requires the commit message to be supplied as a string/string[]`)}}var Ime=x1({"src/lib/tasks/commit.ts"(){Nme(),b0(),B0()}});function Lme(){return{firstCommit(){return this._runTask(F0([`rev-list`,`--max-parents=0`,`HEAD`],!0),g0(arguments))}}}var Rme=x1({"src/lib/tasks/first-commit.ts"(){b0(),B0()}});function zme(e,t){let n=[`hash-object`,e];return t&&n.push(`-w`),F0(n,!0)}var Bme=x1({"src/lib/tasks/hash-object.ts"(){B0()}});function Vme(e,t,n){let r=String(n).trim(),i;if(i=D2.exec(r))return new E2(e,t,!1,i[1]);if(i=O2.exec(r))return new E2(e,t,!0,i[1]);let a=``,o=r.split(` `);for(;o.length;)if(o.shift()===`in`){a=o.join(` `);break}return new E2(e,t,/^re/i.test(r),a)}var E2,D2,O2,Hme=x1({"src/lib/responses/InitSummary.ts"(){E2=class{constructor(e,t,n,r){this.bare=e,this.path=t,this.existing=n,this.gitDir=r}},D2=/^Init.+ repository in (.+)$/,O2=/^Rein.+ in (.+)$/}});function Ume(e){return e.includes(k2)}function Wme(e=!1,t,n){let r=[`init`,...n];return e&&!Ume(r)&&r.splice(1,0,k2),{commands:r,format:`utf-8`,parser(e){return Vme(r.includes(`--bare`),t,e)}}}var k2,Gme=x1({"src/lib/tasks/init.ts"(){Hme(),k2=`--bare`}});function A2(e){for(let t=0;t<e.length;t++){let n=j2.exec(e[t]);if(n)return`--${n[1]}`}return``}function Kme(e){return j2.test(e)}var j2,M2=x1({"src/lib/args/log-format.ts"(){j2=/^--(stat|numstat|name-only|name-status)(=|$)/}}),N2,qme=x1({"src/lib/responses/DiffSummary.ts"(){N2=class{constructor(){this.changed=0,this.deletions=0,this.insertions=0,this.files=[]}}}});function P2(e=``){let t=z2[e];return e=>v0(new N2,t,e,!1)}var F2,I2,L2,R2,z2,B2=x1({"src/lib/parsers/parse-diff-summary.ts"(){M2(),qme(),n2(),b0(),F2=[new u0(/^(.+)\s+\|\s+(\d+)(\s+[+\-]+)?$/,(e,[t,n,r=``])=>{e.files.push({file:t.trim(),changes:W1(n),insertions:r.replace(/[^+]/g,``).length,deletions:r.replace(/[^-]/g,``).length,binary:!1})}),new u0(/^(.+) \|\s+Bin ([0-9.]+) -> ([0-9.]+) ([a-z]+)/,(e,[t,n,r])=>{e.files.push({file:t.trim(),before:W1(n),after:W1(r),binary:!0})}),new u0(/(\d+) files? changed\s*((?:, \d+ [^,]+){0,2})/,(e,[t,n])=>{let r=/(\d+) i/.exec(n),i=/(\d+) d/.exec(n);e.changed=W1(t),e.insertions=W1(r?.[1]),e.deletions=W1(i?.[1])})],I2=[new u0(/(\d+)\t(\d+)\t(.+)$/,(e,[t,n,r])=>{let i=W1(t),a=W1(n);e.changed++,e.insertions+=i,e.deletions+=a,e.files.push({file:r,changes:i+a,insertions:i,deletions:a,binary:!1})}),new u0(/-\t-\t(.+)$/,(e,[t])=>{e.changed++,e.files.push({file:t,after:0,before:0,binary:!0})})],L2=[new u0(/(.+)$/,(e,[t])=>{e.changed++,e.files.push({file:t,changes:0,insertions:0,deletions:0,binary:!1})})],R2=[new u0(/([ACDMRTUXB])([0-9]{0,3})\t(.[^\t]*)(\t(.[^\t]*))?$/,(e,[t,n,r,i,a])=>{e.changed++,e.files.push({file:a??r,changes:0,insertions:0,deletions:0,binary:!1,status:q1(dme(t)&&t),from:q1(!!a&&r!==a&&r),similarity:W1(n)})})],z2={"":F2,"--stat":F2,"--numstat":I2,"--name-status":R2,"--name-only":L2}}});function Jme(e,t){return t.reduce((t,n,r)=>(t[n]=e[r]||``,t),Object.create({diff:null}))}function V2(e=W2,t=G2,n=``){let r=P2(n);return function(n){let i=I1(n.trim(),!1,H2).map(function(n){let i=n.split(U2),a=Jme(i[0].split(e),t);return i.length>1&&i[1].trim()&&(a.diff=r(i[1])),a});return{all:i,latest:i.length&&i[0]||null,total:i.length}}}var H2,U2,W2,G2,K2=x1({"src/lib/parsers/parse-list-log-summary.ts"(){b0(),B2(),M2(),H2=`òòòòòò `,U2=` òò`,W2=` ò `,G2=[`hash`,`date`,`message`,`refs`,`author_name`,`author_email`]}}),q2={};S1(q2,{diffSummaryTask:()=>Yme,validateLogFormatConfig:()=>J2});function Yme(e){let t=A2(e),n=[`diff`];return t===``&&(t=`--stat`,n.push(`--stat=4096`)),n.push(...e),J2(n)||{commands:n,format:`utf-8`,parser:P2(t)}}function J2(e){let t=e.filter(Kme);if(t.length>1)return P0(`Summary flags are mutually exclusive - pick one of ${t.join(`,`)}`);if(t.length&&e.includes(`-z`))return P0(`Summary flag ${t} parsing is not compatible with null termination option '-z'`)}var Y2=x1({"src/lib/tasks/diff.ts"(){M2(),B2(),B0()}});function Xme(e,t){let n=[],r=[];return Object.keys(e).forEach(t=>{n.push(t),r.push(String(e[t]))}),[n,r.join(t)]}function Zme(e){return Object.keys(e).reduce((t,n)=>(n in Z2||(t[n]=e[n]),t),{})}function X2(e={},t=[]){let n=Q1(e.splitter,i0,W2),[r,i]=Xme(e0(e.format)?e.format:{hash:`%H`,date:e.strictDate===!1?`%ai`:`%aI`,message:`%s`,refs:`%D`,body:e.multiLine?`%B`:`%b`,author_name:e.mailMap===!1?`%an`:`%aN`,author_email:e.mailMap===!1?`%ae`:`%aE`},n),a=[],o=[`--pretty=format:${H2}${i}${U2}`,...t],s=e.n||e[`max-count`]||e.maxCount;if(s&&o.push(`--max-count=${s}`),e.from||e.to){let t=e.symmetric===!1?`..`:`...`;a.push(`${e.from||``}${t}${e.to||``}`)}return i0(e.file)&&o.push(`--follow`,f1(e.file)),p0(Zme(e),o),{fields:r,splitter:n,commands:[...o,...a]}}function Qme(e,t,n){let r=V2(e,t,A2(n));return{commands:[`log`,...n],format:`utf-8`,parser:r}}function $me(){return{log(...n){let r=g0(arguments),i=X2(h0(arguments),U1(Q1(arguments[0],n0,[]))),a=t(...n)||J2(i.commands)||e(i);return this._runTask(a,r)}};function e(e){return Qme(e.splitter,e.fields,e.commands)}function t(e,t){return i0(e)&&i0(t)&&P0(`git.log(string, string) should be replaced with git.log({ from: string, to: string })`)}}var Z2,Q2=x1({"src/lib/tasks/log.ts"(){M2(),K2(),b0(),B0(),Y2(),Z2=(e=>(e[e[`--pretty`]=0]=`--pretty`,e[e[`max-count`]=1]=`max-count`,e[e.maxCount=2]=`maxCount`,e[e.n=3]=`n`,e[e.file=4]=`file`,e[e.format=5]=`format`,e[e.from=6]=`from`,e[e.to=7]=`to`,e[e.splitter=8]=`splitter`,e[e.symmetric=9]=`symmetric`,e[e.mailMap=10]=`mailMap`,e[e.multiLine=11]=`multiLine`,e[e.strictDate=12]=`strictDate`,e))(Z2||{})}}),$2,e4,ehe=x1({"src/lib/responses/MergeSummary.ts"(){$2=class{constructor(e,t=null,n){this.reason=e,this.file=t,this.meta=n}toString(){return`${this.file}:${this.reason}`}},e4=class{constructor(){this.conflicts=[],this.merges=[],this.result=`success`}get failed(){return this.conflicts.length>0}get reason(){return this.result}toString(){return this.conflicts.length?`CONFLICTS: ${this.conflicts.join(`, `)}`:`OK`}}}}),t4,n4,the=x1({"src/lib/responses/PullSummary.ts"(){t4=class{constructor(){this.remoteMessages={all:[]},this.created=[],this.deleted=[],this.files=[],this.deletions={},this.insertions={},this.summary={changes:0,deletions:0,insertions:0}}},n4=class{constructor(){this.remote=``,this.hash={local:``,remote:``},this.branch={local:``,remote:``},this.message=``}toString(){return this.message}}}});function r4(e){return e.objects=e.objects||{compressing:0,counting:0,enumerating:0,packReused:0,reused:{count:0,delta:0},total:{count:0,delta:0}}}function i4(e){let t=/^\s*(\d+)/.exec(e),n=/delta (\d+)/i.exec(e);return{count:W1(t&&t[1]||`0`),delta:W1(n&&n[1]||`0`)}}var a4,nhe=x1({"src/lib/parsers/parse-remote-objects.ts"(){b0(),a4=[new d0(/^remote:\s*(enumerating|counting|compressing) objects: (\d+),/i,(e,[t,n])=>{let r=t.toLowerCase(),i=r4(e.remoteMessages);Object.assign(i,{[r]:W1(n)})}),new d0(/^remote:\s*(enumerating|counting|compressing) objects: \d+% \(\d+\/(\d+)\),/i,(e,[t,n])=>{let r=t.toLowerCase(),i=r4(e.remoteMessages);Object.assign(i,{[r]:W1(n)})}),new d0(/total ([^,]+), reused ([^,]+), pack-reused (\d+)/i,(e,[t,n,r])=>{let i=r4(e.remoteMessages);i.total=i4(t),i.reused=i4(n),i.packReused=W1(r)})]}});function o4(e,t){return v0({remoteMessages:new c4},s4,t)}var s4,c4,l4=x1({"src/lib/parsers/parse-remote-messages.ts"(){b0(),nhe(),s4=[new d0(/^remote:\s*(.+)$/,(e,[t])=>(e.remoteMessages.all.push(t.trim()),!1)),...a4,new d0([/create a (?:pull|merge) request/i,/\s(https?:\/\/\S+)$/],(e,[t])=>{e.remoteMessages.pullRequestUrl=t}),new d0([/found (\d+) vulnerabilities.+\(([^)]+)\)/i,/\s(https?:\/\/\S+)$/],(e,[t,n,r])=>{e.remoteMessages.vulnerabilities={count:W1(t),summary:n,url:r}})],c4=class{constructor(){this.all=[]}}}});function rhe(e,t){let n=v0(new n4,m4,[e,t]);return n.message&&n}var u4,d4,f4,p4,m4,h4,g4,_4=x1({"src/lib/parsers/parse-pull.ts"(){the(),b0(),l4(),u4=/^\s*(.+?)\s+\|\s+\d+\s*(\+*)(-*)/,d4=/(\d+)\D+((\d+)\D+\(\+\))?(\D+(\d+)\D+\(-\))?/,f4=/^(create|delete) mode \d+ (.+)/,p4=[new u0(u4,(e,[t,n,r])=>{e.files.push(t),n&&(e.insertions[t]=n.length),r&&(e.deletions[t]=r.length)}),new u0(d4,(e,[t,,n,,r])=>n!==void 0||r!==void 0?(e.summary.changes=+t||0,e.summary.insertions=+n||0,e.summary.deletions=+r||0,!0):!1),new u0(f4,(e,[t,n])=>{z1(e.files,n),z1(t===`create`?e.created:e.deleted,n)})],m4=[new u0(/^from\s(.+)$/i,(e,[t])=>void(e.remote=t)),new u0(/^fatal:\s(.+)$/,(e,[t])=>void(e.message=t)),new u0(/([a-z0-9]+)\.\.([a-z0-9]+)\s+(\S+)\s+->\s+(\S+)$/,(e,[t,n,r,i])=>{e.branch.local=r,e.hash.local=t,e.branch.remote=i,e.hash.remote=n})],h4=(e,t)=>v0(new t4,p4,[e,t]),g4=(e,t)=>Object.assign(new t4,h4(e,t),o4(e,t))}}),v4,y4,b4,ihe=x1({"src/lib/parsers/parse-merge.ts"(){ehe(),b0(),_4(),v4=[new u0(/^Auto-merging\s+(.+)$/,(e,[t])=>{e.merges.push(t)}),new u0(/^CONFLICT\s+\((.+)\): Merge conflict in (.+)$/,(e,[t,n])=>{e.conflicts.push(new $2(t,n))}),new u0(/^CONFLICT\s+\((.+\/delete)\): (.+) deleted in (.+) and/,(e,[t,n,r])=>{e.conflicts.push(new $2(t,n,{deleteRef:r}))}),new u0(/^CONFLICT\s+\((.+)\):/,(e,[t])=>{e.conflicts.push(new $2(t,null))}),new u0(/^Automatic merge failed;\s+(.+)$/,(e,[t])=>{e.result=t})],y4=(e,t)=>Object.assign(b4(e,t),g4(e,t)),b4=e=>v0(new e4,v4,e)}});function x4(e){return e.length?{commands:[`merge`,...e],format:`utf-8`,parser(e,t){let n=y4(e,t);if(n.failed)throw new E1(n);return n}}:P0(`Git.merge requires at least one option`)}var ahe=x1({"src/lib/tasks/merge.ts"(){D1(),ihe(),B0()}});function ohe(e,t,n){let r=n.includes(`deleted`),i=n.includes(`tag`)||/^refs\/tags/.test(e),a=!n.includes(`new`);return{deleted:r,tag:i,branch:!i,new:!a,alreadyUpdated:a,local:e,remote:t}}var S4,C4,w4,she=x1({"src/lib/parsers/parse-push.ts"(){b0(),l4(),S4=[new u0(/^Pushing to (.+)$/,(e,[t])=>{e.repo=t}),new u0(/^updating local tracking ref '(.+)'/,(e,[t])=>{e.ref={...e.ref||{},local:t}}),new u0(/^[=*-]\s+([^:]+):(\S+)\s+\[(.+)]$/,(e,[t,n,r])=>{e.pushed.push(ohe(t,n,r))}),new u0(/^Branch '([^']+)' set up to track remote branch '([^']+)' from '([^']+)'/,(e,[t,n,r])=>{e.branch={...e.branch||{},local:t,remote:n,remoteName:r}}),new u0(/^([^:]+):(\S+)\s+([a-z0-9]+)\.\.([a-z0-9]+)$/,(e,[t,n,r,i])=>{e.update={head:{local:t,remote:n},hash:{from:r,to:i}}})],C4=(e,t)=>{let n=w4(e,t),r=o4(e,t);return{...n,...r}},w4=(e,t)=>v0({pushed:[]},S4,[e,t])}}),T4={};S1(T4,{pushTagsTask:()=>che,pushTask:()=>E4});function che(e={},t){return z1(t,`--tags`),E4(e,t)}function E4(e={},t){let n=[`push`,...t];return e.branch&&n.splice(1,0,e.branch),e.remote&&n.splice(1,0,e.remote),B1(n,`-v`),z1(n,`--verbose`),z1(n,`--porcelain`),{commands:n,format:`utf-8`,parser:C4}}var D4=x1({"src/lib/tasks/push.ts"(){she(),b0()}});function lhe(){return{showBuffer(){let e=[`show`,...m0(arguments,1)];return e.includes(`--binary`)||e.splice(1,0,`--binary`),this._runTask(I0(e),g0(arguments))},show(){let e=[`show`,...m0(arguments,1)];return this._runTask(F0(e),g0(arguments))}}}var uhe=x1({"src/lib/tasks/show.ts"(){b0(),B0()}}),O4,k4,dhe=x1({"src/lib/responses/FileStatusSummary.ts"(){O4=/^(.+)\0(.+)$/,k4=class{constructor(e,t,n){if(this.path=e,this.index=t,this.working_dir=n,t===`R`||n===`R`){let t=O4.exec(e)||[null,e,e];this.from=t[2]||``,this.path=t[1]||``}}}}});function A4(e){let[t,n]=e.split(J1);return{from:n||t,to:t}}function j4(e,t,n){return[`${e}${t}`,n]}function M4(e,...t){return t.map(t=>j4(e,t,(e,t)=>e.conflicted.push(t)))}function fhe(e,t){let n=t.trim();switch(` `){case n.charAt(2):return r(n.charAt(0),n.charAt(1),n.slice(3));case n.charAt(1):return r(` `,n.charAt(0),n.slice(2));default:return}function r(t,n,r){let i=`${t}${n}`,a=P4.get(i);a&&a(e,r),i!==`##`&&i!==`!!`&&e.files.push(new k4(r,t,n))}}var N4,P4,F4,phe=x1({"src/lib/responses/StatusSummary.ts"(){b0(),dhe(),N4=class{constructor(){this.not_added=[],this.conflicted=[],this.created=[],this.deleted=[],this.ignored=void 0,this.modified=[],this.renamed=[],this.files=[],this.staged=[],this.ahead=0,this.behind=0,this.current=null,this.tracking=null,this.detached=!1,this.isClean=()=>!this.files.length}},P4=new Map([j4(` `,`A`,(e,t)=>e.created.push(t)),j4(` `,`D`,(e,t)=>e.deleted.push(t)),j4(` `,`M`,(e,t)=>e.modified.push(t)),j4(`A`,` `,(e,t)=>{e.created.push(t),e.staged.push(t)}),j4(`A`,`M`,(e,t)=>{e.created.push(t),e.staged.push(t),e.modified.push(t)}),j4(`D`,` `,(e,t)=>{e.deleted.push(t),e.staged.push(t)}),j4(`M`,` `,(e,t)=>{e.modified.push(t),e.staged.push(t)}),j4(`M`,`M`,(e,t)=>{e.modified.push(t),e.staged.push(t)}),j4(`R`,` `,(e,t)=>{e.renamed.push(A4(t))}),j4(`R`,`M`,(e,t)=>{let n=A4(t);e.renamed.push(n),e.modified.push(n.to)}),j4(`!`,`!`,(e,t)=>{(e.ignored=e.ignored||[]).push(t)}),j4(`?`,`?`,(e,t)=>e.not_added.push(t)),...M4(`A`,`A`,`U`),...M4(`D`,`D`,`U`),...M4(`U`,`A`,`D`,`U`),[`##`,(e,t)=>{let n=/ahead (\d+)/,r=/behind (\d+)/,i=/^(.+?(?=(?:\.{3}|\s|$)))/,a=/\.{3}(\S*)/,o=/\son\s(\S+?)(?=\.{3}|$)/,s=n.exec(t);e.ahead=s&&+s[1]||0,s=r.exec(t),e.behind=s&&+s[1]||0,s=i.exec(t),e.current=Q1(s?.[1],i0,null),s=a.exec(t),e.tracking=Q1(s?.[1],i0,null),s=o.exec(t),s&&(e.current=Q1(s?.[1],i0,e.current)),e.detached=/\(no branch\)/.test(t)}]]),F4=function(e){let t=e.split(J1),n=new N4;for(let e=0,r=t.length;e<r;){let r=t[e++].trim();r&&(r.charAt(0)===`R`&&(r+=J1+(t[e++]||``)),fhe(n,r))}return n}}});function mhe(e){return{format:`utf-8`,commands:[`status`,`--porcelain`,`-b`,`-u`,`--null`,...e.filter(e=>!I4.includes(e))],parser(e){return F4(e)}}}var I4,hhe=x1({"src/lib/tasks/status.ts"(){phe(),I4=[`--null`,`-z`]}});function L4(e=0,t=0,n=0,r=``,i=!0){return Object.defineProperty({major:e,minor:t,patch:n,agent:r,installed:i},`toString`,{value(){return`${this.major}.${this.minor}.${this.patch}`},configurable:!1,enumerable:!1})}function ghe(){return L4(0,0,0,``,!1)}function _he(){return{version(){return this._runTask({commands:[`--version`],format:`utf-8`,parser:vhe,onError(e,t,n,r){if(e.exitCode===-2)return n(Buffer.from(R4));r(t)}})}}}function vhe(e){return e===R4?ghe():v0(L4(0,0,0,e),z4,e)}var R4,z4,yhe=x1({"src/lib/tasks/version.ts"(){b0(),R4=`installed=false`,z4=[new u0(/version (\d+)\.(\d+)\.(\d+)(?:\s*\((.+)\))?/,(e,[t,n,r,i=``])=>{Object.assign(e,L4(W1(t),W1(n),W1(r),i))}),new u0(/version (\d+)\.(\d+)\.(\D+)(.+)?$/,(e,[t,n,r,i=``])=>{Object.assign(e,L4(W1(t),W1(n),r,i))})]}});function B4(e,t,n,...r){return i0(n)?t(n,Q1(r[0],i0),m0(arguments)):P0(`git.${e}() requires a string 'repoPath'`)}function bhe(){return{clone(e,...t){return this._runTask(B4(`clone`,V4,Q1(e,i0),...t),g0(arguments))},mirror(e,...t){return this._runTask(B4(`mirror`,H4,Q1(e,i0),...t),g0(arguments))}}}var V4,H4,xhe=x1({"src/lib/tasks/clone.ts"(){B0(),b0(),V4=(e,t,n)=>{let r=[`clone`,...n];return i0(e)&&r.push(f1(e)),i0(t)&&r.push(f1(t)),F0(r)},H4=(e,t,n)=>(z1(n,`--mirror`),V4(e,t,n))}}),U4={};S1(U4,{SimpleGitApi:()=>W4});var W4,She=x1({"src/lib/simple-git-api.ts"(){Tme(),Eme(),Ome(),jme(),Ime(),$0(),Rme(),s2(),Bme(),Gme(),Q2(),ahe(),D4(),uhe(),hhe(),B0(),yhe(),b0(),xhe(),W4=class{constructor(e){this._executor=e}_runTask(e,t){let n=this._executor.chain(),r=n.push(e);return t&&Cme(e,r,t),Object.create(this,{then:{value:r.then.bind(r)},catch:{value:r.catch.bind(r)},_executor:{value:n}})}add(e){return this._runTask(F0([`add`,...V1(e)]),g0(arguments))}cwd(e){let t=g0(arguments);return typeof e==`string`?this._runTask(S2(e,this._executor),t):typeof e?.path==`string`?this._runTask(S2(e.path,e.root&&this._executor||void 0),t):this._runTask(P0(`Git.cwd: workingDirectory must be supplied as a string`),t)}hashObject(e,t){return this._runTask(zme(e,t===!0),g0(arguments))}init(e){return this._runTask(Wme(e===!0,this._executor.cwd,m0(arguments)),g0(arguments))}merge(){return this._runTask(x4(m0(arguments)),g0(arguments))}mergeFromTo(e,t){return i0(e)&&i0(t)?this._runTask(x4([e,t,...m0(arguments)]),g0(arguments,!1)):this._runTask(P0(`Git.mergeFromTo requires that the 'remote' and 'branch' arguments are supplied as strings`))}outputHandler(e){return this._executor.outputHandler=e,this}push(){let e=E4({remote:Q1(arguments[0],i0),branch:Q1(arguments[1],i0)},m0(arguments));return this._runTask(e,g0(arguments))}stash(){return this._runTask(F0([`stash`,...m0(arguments)]),g0(arguments))}status(){return this._runTask(mhe(m0(arguments)),g0(arguments))}},Object.assign(W4.prototype,Dme(),bhe(),Fme(),ume(),Ame(),Lme(),mme(),$me(),lhe(),_he())}}),G4={};S1(G4,{Scheduler:()=>q4});var K4,q4,Che=x1({"src/lib/runners/scheduler.ts"(){b0(),h2(),K4=(()=>{let e=0;return()=>{e++;let{promise:t,done:n}=(0,h1.createDeferred)();return{promise:t,done:n,id:e}}})(),q4=class{constructor(e=2){this.concurrency=e,this.logger=m2(``,`scheduler`),this.pending=[],this.running=[],this.logger(`Constructed, concurrency=%s`,e)}schedule(){if(!this.pending.length||this.running.length>=this.concurrency){this.logger(`Schedule attempt ignored, pending=%s running=%s concurrency=%s`,this.pending.length,this.running.length,this.concurrency);return}let e=z1(this.running,this.pending.shift());this.logger(`Attempting id=%s`,e.id),e.done(()=>{this.logger(`Completing id=`,e.id),B1(this.running,e),this.schedule()})}next(){let{promise:e,id:t}=z1(this.pending,K4());return this.logger(`Scheduling id=%s`,t),this.schedule(),e}}}}),J4={};S1(J4,{applyPatchTask:()=>whe});function whe(e,t){return F0([`apply`,...t,...e])}var The=x1({"src/lib/tasks/apply-patch.ts"(){B0()}});function Ehe(e,t){return{branch:e,hash:t,success:!0}}function Dhe(e){return{branch:e,hash:null,success:!1}}var Y4,Ohe=x1({"src/lib/responses/BranchDeleteSummary.ts"(){Y4=class{constructor(){this.all=[],this.branches={},this.errors=[]}get success(){return!this.errors.length}}}});function X4(e,t){return t===1&&Q4.test(e)}var Z4,Q4,$4,e3,khe=x1({"src/lib/parsers/parse-branch-delete.ts"(){Ohe(),b0(),Z4=/(\S+)\s+\(\S+\s([^)]+)\)/,Q4=/^error[^']+'([^']+)'/m,$4=[new u0(Z4,(e,[t,n])=>{let r=Ehe(t,n);e.all.push(r),e.branches[t]=r}),new u0(Q4,(e,[t])=>{let n=Dhe(t);e.errors.push(n),e.all.push(n),e.branches[t]=n})],e3=(e,t)=>v0(new Y4,$4,[e,t])}}),t3,Ahe=x1({"src/lib/responses/BranchSummary.ts"(){t3=class{constructor(){this.all=[],this.branches={},this.current=``,this.detached=!1}push(e,t,n,r,i){e===`*`&&(this.detached=t,this.current=n),this.all.push(n),this.branches[n]={current:e===`*`,linkedWorkTree:e===`+`,name:n,commit:r,label:i}}}}});function n3(e){return e?e.charAt(0):``}function r3(e,t=!1){return v0(new t3,t?[a3]:i3,e)}var i3,a3,jhe=x1({"src/lib/parsers/parse-branch.ts"(){Ahe(),b0(),i3=[new u0(/^([*+]\s)?\((?:HEAD )?detached (?:from|at) (\S+)\)\s+([a-z0-9]+)\s(.*)$/,(e,[t,n,r,i])=>{e.push(n3(t),!0,n,r,i)}),new u0(/^([*+]\s)?(\S+)\s+([a-z0-9]+)\s?(.*)$/s,(e,[t,n,r,i])=>{e.push(n3(t),!1,n,r,i)})],a3=new u0(/^(\S+)$/s,(e,[t])=>{e.push(`*`,!1,t,``,``)})}}),o3={};S1(o3,{branchLocalTask:()=>Nhe,branchTask:()=>Mhe,containsDeleteBranchCommand:()=>s3,deleteBranchTask:()=>Fhe,deleteBranchesTask:()=>Phe});function s3(e){let t=[`-d`,`-D`,`--delete`];return e.some(e=>t.includes(e))}function Mhe(e){let t=s3(e),n=e.includes(`--show-current`),r=[`branch`,...e];return r.length===1&&r.push(`-a`),r.includes(`-v`)||r.splice(1,0,`-v`),{format:`utf-8`,commands:r,parser(e,r){return t?e3(e,r).all[0]:r3(e,n)}}}function Nhe(){return{format:`utf-8`,commands:[`branch`,`-v`],parser(e){return r3(e)}}}function Phe(e,t=!1){return{format:`utf-8`,commands:[`branch`,`-v`,t?`-D`:`-d`,...e],parser(e,t){return e3(e,t)},onError({exitCode:e,stdOut:t},n,r,i){if(!X4(String(n),e))return i(n);r(t)}}}function Fhe(e,t=!1){let n={format:`utf-8`,commands:[`branch`,`-v`,t?`-D`:`-d`,e],parser(t,n){return e3(t,n).branches[e]},onError({exitCode:e,stdErr:t,stdOut:r},i,a,o){if(!X4(String(i),e))return o(i);throw new E1(n.parser(K1(r),K1(t)),String(i))}};return n}var Ihe=x1({"src/lib/tasks/branch.ts"(){D1(),khe(),jhe(),b0()}});function Lhe(e){let t=e.trim().replace(/^["']|["']$/g,``);return t&&ge(t)}var c3,Rhe=x1({"src/lib/responses/CheckIgnore.ts"(){c3=e=>e.split(/\n/g).map(Lhe).filter(Boolean)}}),l3={};S1(l3,{checkIgnoreTask:()=>zhe});function zhe(e){return{commands:[`check-ignore`,...e],format:`utf-8`,parser:c3}}var Bhe=x1({"src/lib/tasks/check-ignore.ts"(){Rhe()}});function Vhe(e,t){return v0({raw:e,remote:null,branches:[],tags:[],updated:[],deleted:[]},u3,[e,t])}var u3,Hhe=x1({"src/lib/parsers/parse-fetch.ts"(){b0(),u3=[new u0(/From (.+)$/,(e,[t])=>{e.remote=t}),new u0(/\* \[new branch]\s+(\S+)\s*-> (.+)$/,(e,[t,n])=>{e.branches.push({name:t,tracking:n})}),new u0(/\* \[new tag]\s+(\S+)\s*-> (.+)$/,(e,[t,n])=>{e.tags.push({name:t,tracking:n})}),new u0(/- \[deleted]\s+\S+\s*-> (.+)$/,(e,[t])=>{e.deleted.push({tracking:t})}),new u0(/\s*([^.]+)\.\.(\S+)\s+(\S+)\s*-> (.+)$/,(e,[t,n,r,i])=>{e.updated.push({name:r,tracking:i,to:n,from:t})})]}}),d3={};S1(d3,{fetchTask:()=>Whe});function Uhe(e){return/^--upload-pack(=|$)/.test(e)}function Whe(e,t,n){let r=[`fetch`,...n];return e&&t&&r.push(e,t),r.find(Uhe)?P0(`git.fetch: potential exploit argument blocked.`):{commands:r,format:`utf-8`,parser:Vhe}}var Ghe=x1({"src/lib/tasks/fetch.ts"(){Hhe(),B0()}});function Khe(e){return v0({moves:[]},f3,e)}var f3,qhe=x1({"src/lib/parsers/parse-move.ts"(){b0(),f3=[new u0(/^Renaming (.+) to (.+)$/,(e,[t,n])=>{e.moves.push({from:t,to:n})})]}}),p3={};S1(p3,{moveTask:()=>Jhe});function Jhe(e,t){return{commands:[`mv`,`-v`,...V1(e),t],format:`utf-8`,parser:Khe}}var Yhe=x1({"src/lib/tasks/move.ts"(){qhe(),b0()}}),m3={};S1(m3,{pullTask:()=>Xhe});function Xhe(e,t,n){let r=[`pull`,...n];return e&&t&&r.splice(1,0,e,t),{commands:r,format:`utf-8`,parser(e,t){return g4(e,t)},onError(e,t,n,r){let i=rhe(K1(e.stdOut),K1(e.stdErr));if(i)return r(new E1(i));r(t)}}}var Zhe=x1({"src/lib/tasks/pull.ts"(){D1(),_4(),b0()}});function Qhe(e){let t={};return h3(e,([e])=>t[e]={name:e}),Object.values(t)}function $he(e){let t={};return h3(e,([e,n,r])=>{Object.hasOwn(t,e)||(t[e]={name:e,refs:{fetch:``,push:``}}),r&&n&&(t[e].refs[r.replace(/[^a-z]/g,``)]=n)}),Object.values(t)}function h3(e,t){L1(e,e=>t(e.split(/\s+/)))}var ege=x1({"src/lib/responses/GetRemoteSummary.ts"(){b0()}}),g3={};S1(g3,{addRemoteTask:()=>tge,getRemotesTask:()=>nge,listRemotesTask:()=>rge,remoteTask:()=>ige,removeRemoteTask:()=>age});function tge(e,t,n){return F0([`remote`,`add`,...n,e,t])}function nge(e){let t=[`remote`];return e&&t.push(`-v`),{commands:t,format:`utf-8`,parser:e?$he:Qhe}}function rge(e){let t=[...e];return t[0]!==`ls-remote`&&t.unshift(`ls-remote`),F0(t)}function ige(e){let t=[...e];return t[0]!==`remote`&&t.unshift(`remote`),F0(t)}function age(e){return F0([`remote`,`remove`,e])}var oge=x1({"src/lib/tasks/remote.ts"(){ege(),B0()}}),_3={};S1(_3,{stashListTask:()=>sge});function sge(e={},t){let n=X2(e),r=[`stash`,`list`,...n.commands,...t],i=V2(n.splitter,n.fields,A2(r));return J2(r)||{commands:r,format:`utf-8`,parser:i}}var cge=x1({"src/lib/tasks/stash-list.ts"(){M2(),K2(),Y2(),Q2()}}),v3={};S1(v3,{addSubModuleTask:()=>lge,initSubModuleTask:()=>uge,subModuleTask:()=>y3,updateSubModuleTask:()=>dge});function lge(e,t){return y3([`add`,e,t])}function uge(e){return y3([`init`,...e])}function y3(e){let t=[...e];return t[0]!==`submodule`&&t.unshift(`submodule`),F0(t)}function dge(e){return y3([`update`,...e])}var fge=x1({"src/lib/tasks/sub-module.ts"(){B0()}});function pge(e,t){let n=Number.isNaN(e);return n===Number.isNaN(t)?n?b3(e,t):0:n?1:-1}function b3(e,t){return e===t?0:e>t?1:-1}function mge(e){return e.trim()}function x3(e){return typeof e==`string`&&parseInt(e.replace(/^\D+/g,``),10)||0}var S3,C3,hge=x1({"src/lib/responses/TagList.ts"(){S3=class{constructor(e,t){this.all=e,this.latest=t}},C3=function(e,t=!1){let n=e.split(`
429
- `).map(mge).filter(Boolean);t||n.sort(function(e,t){let n=e.split(`.`),r=t.split(`.`);if(n.length===1||r.length===1)return pge(x3(n[0]),x3(r[0]));for(let e=0,t=Math.max(n.length,r.length);e<t;e++){let t=b3(x3(n[e]),x3(r[e]));if(t)return t}return 0});let r=t?n[0]:[...n].reverse().find(e=>e.indexOf(`.`)>=0);return new S3(n,r)}}}),w3={};S1(w3,{addAnnotatedTagTask:()=>vge,addTagTask:()=>_ge,tagListTask:()=>gge});function gge(e=[]){let t=e.some(e=>/^--sort=/.test(e));return{format:`utf-8`,commands:[`tag`,`-l`,...e],parser(e){return C3(e,t)}}}function _ge(e){return{format:`utf-8`,commands:[`tag`,e],parser(){return{name:e}}}}function vge(e,t){return{format:`utf-8`,commands:[`tag`,`-a`,`-m`,t,e],parser(){return{name:e}}}}var yge=x1({"src/lib/tasks/tag.ts"(){hge()}}),bge=Npe({"src/git.js"(e,t){var{GitExecutor:n}=(Sme(),C1(b2)),{SimpleGitApi:r}=(She(),C1(U4)),{Scheduler:i}=(Che(),C1(G4)),{adhocExecTask:a,configurationErrorTask:o}=(B0(),C1(M0)),{asArray:s,filterArray:c,filterPrimitives:l,filterString:u,filterStringOrStringArray:d,filterType:f,getTrailingOptions:p,trailingFunctionArgument:m,trailingOptionsArgument:h}=(b0(),C1(y0)),{applyPatchTask:g}=(The(),C1(J4)),{branchTask:_,branchLocalTask:v,deleteBranchesTask:y,deleteBranchTask:b}=(Ihe(),C1(o3)),{checkIgnoreTask:x}=(Bhe(),C1(l3)),{checkIsRepoTask:S}=(D0(),C1(x0)),{cleanWithOptionsTask:C,isCleanOptionsArray:w}=(J0(),C1(V0)),{diffSummaryTask:T}=(Y2(),C1(q2)),{fetchTask:E}=(Ghe(),C1(d3)),{moveTask:D}=(Yhe(),C1(p3)),{pullTask:ee}=(Zhe(),C1(m3)),{pushTagsTask:te}=(D4(),C1(T4)),{addRemoteTask:ne,getRemotesTask:re,listRemotesTask:ie,remoteTask:ae,removeRemoteTask:oe}=(oge(),C1(g3)),{getResetMode:se,resetTask:ce}=(f2(),C1(c2)),{stashListTask:O}=(cge(),C1(_3)),{addSubModuleTask:le,initSubModuleTask:ue,subModuleTask:de,updateSubModuleTask:k}=(fge(),C1(v3)),{addAnnotatedTagTask:A,addTagTask:fe,tagListTask:pe}=(yge(),C1(w3)),{straightThroughBufferTask:me,straightThroughStringTask:he}=(B0(),C1(M0));function j(e,t){this._plugins=t,this._executor=new n(e.baseDir,new i(e.maxConcurrentProcesses),t),this._trimmed=e.trimmed}(j.prototype=Object.create(r.prototype)).constructor=j,j.prototype.customBinary=function(e){return this._plugins.reconfigure(`binary`,e),this},j.prototype.env=function(e,t){return arguments.length===1&&typeof e==`object`?this._executor.env=e:(this._executor.env=this._executor.env||{})[e]=t,this},j.prototype.stashList=function(e){return this._runTask(O(h(arguments)||{},c(e)&&e||[]),m(arguments))},j.prototype.mv=function(e,t){return this._runTask(D(e,t),m(arguments))},j.prototype.checkoutLatestTag=function(e){var t=this;return this.pull(function(){t.tags(function(n,r){t.checkout(r.latest,e)})})},j.prototype.pull=function(e,t,n,r){return this._runTask(ee(f(e,u),f(t,u),p(arguments)),m(arguments))},j.prototype.fetch=function(e,t){return this._runTask(E(f(e,u),f(t,u),p(arguments)),m(arguments))},j.prototype.silent=function(e){return this._runTask(a(()=>console.warn("simple-git deprecation notice: git.silent: logging should be configured using the `debug` library / `DEBUG` environment variable, this method will be removed.")))},j.prototype.tags=function(e,t){return this._runTask(pe(p(arguments)),m(arguments))},j.prototype.rebase=function(){return this._runTask(he([`rebase`,...p(arguments)]),m(arguments))},j.prototype.reset=function(e){return this._runTask(ce(se(e),p(arguments)),m(arguments))},j.prototype.revert=function(e){let t=m(arguments);return typeof e==`string`?this._runTask(he([`revert`,...p(arguments,0,!0),e]),t):this._runTask(o(`Commit must be a string`),t)},j.prototype.addTag=function(e){let t=typeof e==`string`?fe(e):o(`Git.addTag requires a tag name`);return this._runTask(t,m(arguments))},j.prototype.addAnnotatedTag=function(e,t){return this._runTask(A(e,t),m(arguments))},j.prototype.deleteLocalBranch=function(e,t,n){return this._runTask(b(e,typeof t==`boolean`?t:!1),m(arguments))},j.prototype.deleteLocalBranches=function(e,t,n){return this._runTask(y(e,typeof t==`boolean`?t:!1),m(arguments))},j.prototype.branch=function(e,t){return this._runTask(_(p(arguments)),m(arguments))},j.prototype.branchLocal=function(e){return this._runTask(v(),m(arguments))},j.prototype.raw=function(e){let t=!Array.isArray(e),n=[].slice.call(t?arguments:e,0);for(let e=0;e<n.length&&t;e++)if(!l(n[e])){n.splice(e,n.length-e);break}n.push(...p(arguments,0,!0));var r=m(arguments);return n.length?this._runTask(he(n,this._trimmed),r):this._runTask(o(`Raw: must supply one or more command to execute`),r)},j.prototype.submoduleAdd=function(e,t,n){return this._runTask(le(e,t),m(arguments))},j.prototype.submoduleUpdate=function(e,t){return this._runTask(k(p(arguments,!0)),m(arguments))},j.prototype.submoduleInit=function(e,t){return this._runTask(ue(p(arguments,!0)),m(arguments))},j.prototype.subModule=function(e,t){return this._runTask(de(p(arguments)),m(arguments))},j.prototype.listRemote=function(){return this._runTask(ie(p(arguments)),m(arguments))},j.prototype.addRemote=function(e,t,n){return this._runTask(ne(e,t,p(arguments)),m(arguments))},j.prototype.removeRemote=function(e,t){return this._runTask(oe(e),m(arguments))},j.prototype.getRemotes=function(e,t){return this._runTask(re(e===!0),m(arguments))},j.prototype.remote=function(e,t){return this._runTask(ae(p(arguments)),m(arguments))},j.prototype.tag=function(e,t){let n=p(arguments);return n[0]!==`tag`&&n.unshift(`tag`),this._runTask(he(n),m(arguments))},j.prototype.updateServerInfo=function(e){return this._runTask(he([`update-server-info`]),m(arguments))},j.prototype.pushTags=function(e,t){let n=te({remote:f(e,u)},p(arguments));return this._runTask(n,m(arguments))},j.prototype.rm=function(e){return this._runTask(he([`rm`,`-f`,...s(e)]),m(arguments))},j.prototype.rmKeepLocal=function(e){return this._runTask(he([`rm`,`--cached`,...s(e)]),m(arguments))},j.prototype.catFile=function(e,t){return this._catFile(`utf-8`,arguments)},j.prototype.binaryCatFile=function(){return this._catFile(`buffer`,arguments)},j.prototype._catFile=function(e,t){var n=m(t),r=[`cat-file`],i=t[0];if(typeof i==`string`)return this._runTask(o(`Git.catFile: options must be supplied as an array of strings`),n);Array.isArray(i)&&r.push.apply(r,i);let a=e===`buffer`?me(r):he(r);return this._runTask(a,n)},j.prototype.diff=function(e,t){let n=u(e)?o(`git.diff: supplying options as a single string is no longer supported, switch to an array of strings`):he([`diff`,...p(arguments)]);return this._runTask(n,m(arguments))},j.prototype.diffSummary=function(){return this._runTask(T(p(arguments,1)),m(arguments))},j.prototype.applyPatch=function(e){let t=d(e)?g(s(e),p([].slice.call(arguments,1))):o(`git.applyPatch requires one or more string patches as the first argument`);return this._runTask(t,m(arguments))},j.prototype.revparse=function(){let e=[`rev-parse`,...p(arguments,!0)];return this._runTask(he(e,!0),m(arguments))},j.prototype.clean=function(e,t,n){let r=w(e),i=r&&e.join(``)||f(e,u)||``,a=p([].slice.call(arguments,+!!r));return this._runTask(C(i,a),m(arguments))},j.prototype.exec=function(e){return this._runTask({commands:[],format:`utf-8`,parser(){typeof e==`function`&&e()}})},j.prototype.clearQueue=function(){return this._runTask(a(()=>console.warn(`simple-git deprecation notice: clearQueue() is deprecated and will be removed, switch to using the abortPlugin instead.`)))},j.prototype.checkIgnore=function(e,t){return this._runTask(x(s(f(e,d,[]))),m(arguments))},j.prototype.checkIsRepo=function(e,t){return this._runTask(S(f(e,u)),m(arguments))},t.exports=j}});T1(),T1(),T1(),D1(),k1(),D0(),J0(),$0(),n2(),s2(),f2(),b0(),b0(),(0,h1.deferred)().promise,b0(),T1(),b0(),b0(),b0(),b0(),bge(),D1(),o1(`checkpoint-chain`);function T3(e){try{return process.kill(e,0),!0}catch(e){return!!(e&&typeof e==`object`&&`code`in e&&e.code===`EPERM`)}}function xge(e){return!(typeof e!=`number`||!Number.isInteger(e)||e<2||e>2147483647)}o1(`shadow-lock`),o1(`shadow-op-gate`),o1(`shadow-repo`),(()=>{let e=process.env.OK_GIT_TIMEOUT_MS;if(!e)return 3e4;let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:3e4})(),(()=>{let e=process.env.OK_SHADOW_MAINTENANCE_GC_TIMEOUT_MS;if(!e)return 6e5;let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:6e5})(),o1(`bridge-loss-detector`),o1(`checkpoint`);function E3(e){let t=he(e).toLowerCase();return yl.includes(t)}function Sge(e){let t=e.toLowerCase();for(let n of yl)if(t.endsWith(n))return e.slice(0,-n.length);return e}function Cge(e){return e===`__system__`}const wge=new Set(hl);function Tge(e){return wge.has(e)}function Ege(e){return _l(e)}function Dge(e){return Cge(e)||Tge(e)||Ege(e)}o1(`parse-pool`),Math.max(1,Math.min(4,ae()-1)),s1(()=>{}),o1(`bridge-watchdog`),s1(()=>{}),o1(`server-observers`),o1(`server-observers`),o1(`agent-sessions`),RegExp(`^(?:${`do you mind.i would like you to.i'd like you to.i want you to.i need you to.i would like to.i'd like to.i want to.i need to.we need to.we want to.we should.go ahead and.take a look at.have a look at.look into.look at.help me with.help me to.help me.can you.could you.would you.will you.can we.could we.should we.let's.lets.try to.please.kindly.hello.alright.actually.anyway.also.okay.hey.hi.yo.ok.so.pls.plz.just.maybe`.split(`.`).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`)})\\b(?:[\\s,:;!.\\-–—]+|$)`,`i`),Ie(s);const Oge=bo({source:P(),pluginProvider:P().optional(),skill:P().optional(),ref:P().optional(),contentHash:P(),files:R(P()).optional(),localHash:P().optional(),baselineRef:P().optional(),publisher:P().optional(),importedAt:Fa(),autoUpdate:I().optional()});bo({schema:H(1),skills:B(P(),Oge).default({})}),new Set(Object.values(Ml)),new Set([...new Set([`.git`,`node_modules`]),`scripts`,`references`]);const D3=[`agents`,`claude`,`cursor`,`codex`,`opencode`,`pi`,`copilot`];var O3=i(((e,t)=>{function n(e){if(e.length===0)return;let t=Object.create(null),n=0;for(;n<e.length;++n){let t=e.charCodeAt(n);if(u[t]!==1){if(t!==47||n===0)return;break}}if(n===e.length)return;let i=e.slice(0,n).toLowerCase(),a=++n;for(;n<e.length;++n)if(u[e.charCodeAt(n)]!==1){if(n===a||r(e,n,t)===void 0)return;break}if(n!==a)return{type:i,subtype:e.slice(a,n).toLowerCase(),params:t}}function r(e,t,n){for(;t<e.length;){for(;t<e.length;++t){let n=e.charCodeAt(t);if(n!==32&&n!==9)break}if(t===e.length)break;if(e.charCodeAt(t++)!==59)return;for(;t<e.length;++t){let n=e.charCodeAt(t);if(n!==32&&n!==9)break}if(t===e.length)return;let r,i=t;for(;t<e.length;++t){let n=e.charCodeAt(t);if(u[n]!==1){if(n!==61)return;break}}if(t===e.length||(r=e.slice(i,t),++t,t===e.length))return;let a=``,o;if(e.charCodeAt(t)===34){o=++t;let n=!1;for(;t<e.length;++t){let r=e.charCodeAt(t);if(r===92){n?(o=t,n=!1):(a+=e.slice(o,t),n=!0);continue}if(r===34){if(n){o=t,n=!1;continue}a+=e.slice(o,t);break}if(n&&=(o=t-1,!1),d[r]!==1)return}if(t===e.length)return;++t}else{for(o=t;t<e.length;++t)if(u[e.charCodeAt(t)]!==1){if(t===o)return;break}a=e.slice(o,t)}r=r.toLowerCase(),n[r]===void 0&&(n[r]=a)}return n}function i(e,t){if(e.length===0)return;let n=Object.create(null),r=0;for(;r<e.length;++r)if(u[e.charCodeAt(r)]!==1){if(a(e,r,n,t)===void 0)return;break}return{type:e.slice(0,r).toLowerCase(),params:n}}function a(e,t,n,r){for(;t<e.length;){for(;t<e.length;++t){let n=e.charCodeAt(t);if(n!==32&&n!==9)break}if(t===e.length)break;if(e.charCodeAt(t++)!==59)return;for(;t<e.length;++t){let n=e.charCodeAt(t);if(n!==32&&n!==9)break}if(t===e.length)return;let i,a=t;for(;t<e.length;++t){let n=e.charCodeAt(t);if(u[n]!==1){if(n===61)break;return}}if(t===e.length)return;let o=``,s,l;if(i=e.slice(a,t),i.charCodeAt(i.length-1)===42){let n=++t;for(;t<e.length;++t){let n=e.charCodeAt(t);if(f[n]!==1){if(n!==39)return;break}}if(t===e.length)return;for(l=e.slice(n,t),++t;t<e.length&&e.charCodeAt(t)!==39;++t);if(t===e.length||(++t,t===e.length))return;s=t;let r=0;for(;t<e.length;++t){let n=e.charCodeAt(t);if(p[n]!==1){if(n===37){let n,i;if(t+2<e.length&&(n=m[e.charCodeAt(t+1)])!==-1&&(i=m[e.charCodeAt(t+2)])!==-1){let a=(n<<4)+i;o+=e.slice(s,t),o+=String.fromCharCode(a),t+=2,s=t+1,a>=128?r=2:r===0&&(r=1);continue}return}break}}if(o+=e.slice(s,t),o=c(o,l,r),o===void 0)return}else{if(++t,t===e.length)return;if(e.charCodeAt(t)===34){s=++t;let n=!1;for(;t<e.length;++t){let r=e.charCodeAt(t);if(r===92){n?(s=t,n=!1):(o+=e.slice(s,t),n=!0);continue}if(r===34){if(n){s=t,n=!1;continue}o+=e.slice(s,t);break}if(n&&=(s=t-1,!1),d[r]!==1)return}if(t===e.length)return;++t}else{for(s=t;t<e.length;++t)if(u[e.charCodeAt(t)]!==1){if(t===s)return;break}o=e.slice(s,t)}if(o=r(o,2),o===void 0)return}i=i.toLowerCase(),n[i]===void 0&&(n[i]=o)}return n}function o(e){let t;for(;;)switch(e){case`utf-8`:case`utf8`:return s.utf8;case`latin1`:case`ascii`:case`us-ascii`:case`iso-8859-1`:case`iso8859-1`:case`iso88591`:case`iso_8859-1`:case`windows-1252`:case`iso_8859-1:1987`:case`cp1252`:case`x-cp1252`:return s.latin1;case`utf16le`:case`utf-16le`:case`ucs2`:case`ucs-2`:return s.utf16le;case`base64`:return s.base64;default:if(t===void 0){t=!0,e=e.toLowerCase();continue}return s.other.bind(e)}}let s={utf8:(e,t)=>{if(e.length===0)return``;if(typeof e==`string`){if(t<2)return e;e=Buffer.from(e,`latin1`)}return e.utf8Slice(0,e.length)},latin1:(e,t)=>e.length===0?``:typeof e==`string`?e:e.latin1Slice(0,e.length),utf16le:(e,t)=>e.length===0?``:(typeof e==`string`&&(e=Buffer.from(e,`latin1`)),e.ucs2Slice(0,e.length)),base64:(e,t)=>e.length===0?``:(typeof e==`string`&&(e=Buffer.from(e,`latin1`)),e.base64Slice(0,e.length)),other:(t,n)=>{if(t.length===0)return``;typeof t==`string`&&(t=Buffer.from(t,`latin1`));try{return new TextDecoder(e).decode(t)}catch{}}};function c(e,t,n){let r=o(t);if(r)return r(e,n)}function l(e){if(typeof e!=`string`)return``;for(let t=e.length-1;t>=0;--t)switch(e.charCodeAt(t)){case 47:case 92:return e=e.slice(t+1),e===`..`||e===`.`?``:e}return e===`..`||e===`.`?``:e}let u=[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,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,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,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,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],d=[0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,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,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,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,1,1,1,1,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,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,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,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,1,1,1,1,1,1,1,1,1,1,1,1],f=[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,0,0,0,0,1,0,1,0,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,1,0,1,1,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,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,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,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],p=[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,0,1,0,0,0,0,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,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,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,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,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],m=[-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,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,-1,-1,-1,-1,-1,-1,-1,10,11,12,13,14,15,-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,10,11,12,13,14,15,-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,-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,-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,-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,-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,-1,-1,-1,-1,-1,-1,-1,-1];t.exports={basename:l,convertToUTF8:c,getDecoder:o,parseContentType:n,parseDisposition:i}})),kge=i(((e,t)=>{function n(e,t,n,r,i){for(let a=0;a<i;++a)if(e[t+a]!==n[r+a])return!1;return!0}var r=class{constructor(e,t){if(typeof t!=`function`)throw Error(`Missing match callback`);if(typeof e==`string`)e=Buffer.from(e);else if(!Buffer.isBuffer(e))throw Error(`Expected Buffer for needle, got ${typeof e}`);let n=e.length;if(this.maxMatches=1/0,this.matches=0,this._cb=t,this._lookbehindSize=0,this._needle=e,this._bufPos=0,this._lookbehind=Buffer.allocUnsafe(n),this._occ=[n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n],n>1)for(let t=0;t<n-1;++t)this._occ[e[t]]=n-1-t}reset(){this.matches=0,this._lookbehindSize=0,this._bufPos=0}push(e,t){let n;Buffer.isBuffer(e)||(e=Buffer.from(e,`latin1`));let r=e.length;for(this._bufPos=t||0;n!==r&&this.matches<this.maxMatches;)n=i(this,e);return n}destroy(){let e=this._lookbehindSize;e&&this._cb(!1,this._lookbehind,0,e,!1),this.reset()}};function i(e,t){let r=t.length,i=e._needle,o=i.length,s=-e._lookbehindSize,c=o-1,l=i[c],u=r-o,d=e._occ,f=e._lookbehind;if(s<0){for(;s<0&&s<=u;){let n=s+c,r=n<0?f[e._lookbehindSize+n]:t[n];if(r===l&&a(e,t,s,c))return e._lookbehindSize=0,++e.matches,s>-e._lookbehindSize?e._cb(!0,f,0,e._lookbehindSize+s,!1):e._cb(!0,void 0,0,0,!0),e._bufPos=s+o;s+=d[r]}for(;s<0&&!a(e,t,s,r-s);)++s;if(s<0){let n=e._lookbehindSize+s;return n>0&&e._cb(!1,f,0,n,!1),e._lookbehindSize-=n,f.copy(f,0,n,e._lookbehindSize),f.set(t,e._lookbehindSize),e._lookbehindSize+=r,e._bufPos=r,r}e._cb(!1,f,0,e._lookbehindSize,!1),e._lookbehindSize=0}s+=e._bufPos;let p=i[0];for(;s<=u;){let r=t[s+c];if(r===l&&t[s]===p&&n(i,0,t,s,c))return++e.matches,s>0?e._cb(!0,t,e._bufPos,s,!0):e._cb(!0,void 0,0,0,!0),e._bufPos=s+o;s+=d[r]}for(;s<r;){if(t[s]!==p||!n(t,s,i,0,r-s)){++s;continue}t.copy(f,0,s,r),e._lookbehindSize=r-s;break}return s>0&&e._cb(!1,t,e._bufPos,s<r?s:r,!0),e._bufPos=r,r}function a(e,t,n,r){let i=e._lookbehind,a=e._lookbehindSize,o=e._needle;for(let e=0;e<r;++e,++n)if((n<0?i[a+n]:t[n])!==o[e])return!1;return!0}t.exports=r})),Age=i(((e,n)=>{let{Readable:r,Writable:i}=t(`stream`),a=kge(),{basename:o,convertToUTF8:s,getDecoder:c,parseContentType:l,parseDisposition:u}=O3(),d=Buffer.from(`\r
430
- `),f=Buffer.from(`\r`),p=Buffer.from(`-`);function m(){}let h=16*1024;var g=class{constructor(e){this.header=Object.create(null),this.pairCount=0,this.byteCount=0,this.state=0,this.name=``,this.value=``,this.crlf=0,this.cb=e}reset(){this.header=Object.create(null),this.pairCount=0,this.byteCount=0,this.state=0,this.name=``,this.value=``,this.crlf=0}push(e,t,n){let r=t;for(;t<n;)switch(this.state){case 0:{let i=!1;for(;t<n;++t){if(this.byteCount===h)return-1;++this.byteCount;let n=e[t];if(w[n]!==1){if(n!==58||(this.name+=e.latin1Slice(r,t),this.name.length===0))return-1;++t,i=!0,this.state=1;break}}if(!i){this.name+=e.latin1Slice(r,t);break}}case 1:{let i=!1;for(;t<n;++t){if(this.byteCount===h)return-1;++this.byteCount;let n=e[t];if(n!==32&&n!==9){r=t,i=!0,this.state=2;break}}if(!i)break}case 2:switch(this.crlf){case 0:for(;t<n;++t){if(this.byteCount===h)return-1;++this.byteCount;let n=e[t];if(T[n]!==1){if(n!==13)return-1;++this.crlf;break}}this.value+=e.latin1Slice(r,t++);break;case 1:if(this.byteCount===h||(++this.byteCount,e[t++]!==10))return-1;++this.crlf;break;case 2:{if(this.byteCount===h)return-1;++this.byteCount;let n=e[t];n===32||n===9?(r=t,this.crlf=0):(++this.pairCount<2e3&&(this.name=this.name.toLowerCase(),this.header[this.name]===void 0?this.header[this.name]=[this.value]:this.header[this.name].push(this.value)),n===13?(++this.crlf,++t):(r=t,this.crlf=0,this.state=0,this.name=``,this.value=``));break}case 3:{if(this.byteCount===h||(++this.byteCount,e[t++]!==10))return-1;let n=this.header;return this.reset(),this.cb(n),t}}break}return t}},_=class extends r{constructor(e,t){super(e),this.truncated=!1,this._readcb=null,this.once(`end`,()=>{if(this._read(),--t._fileEndsLeft===0&&t._finalcb){let e=t._finalcb;t._finalcb=null,process.nextTick(e)}})}_read(e){let t=this._readcb;t&&(this._readcb=null,t())}};let v={push:(e,t)=>{},destroy:()=>{}};function y(e,t){let n=e._writecb;e._writecb=null,t?e.destroy(t):n&&n()}function b(e,t){return e}var x=class extends i{constructor(e){let t={autoDestroy:!0,emitClose:!0,highWaterMark:typeof e.highWaterMark==`number`?e.highWaterMark:void 0};if(super(t),!e.conType.params||typeof e.conType.params.boundary!=`string`)throw Error(`Multipart: Boundary not found`);let n=e.conType.params.boundary,r=typeof e.defParamCharset==`string`&&e.defParamCharset?c(e.defParamCharset):b,i=e.defCharset||`utf8`,h=e.preservePath,y={autoDestroy:!0,emitClose:!0,highWaterMark:typeof e.fileHwm==`number`?e.fileHwm:void 0},x=e.limits,S=x&&typeof x.fieldSize==`number`?x.fieldSize:1*1024*1024,C=x&&typeof x.fileSize==`number`?x.fileSize:1/0,w=x&&typeof x.files==`number`?x.files:1/0,T=x&&typeof x.fields==`number`?x.fields:1/0,E=x&&typeof x.parts==`number`?x.parts:1/0,D=-1,ee=0,te=0,ne=!1;this._fileEndsLeft=0,this._fileStream=void 0,this._complete=!1;let re=0,ie,ae=0,oe,se,ce,O,le=!1,ue=!1,de=!1;this._hparser=null;let k=new g(e=>{this._hparser=null,ne=!1,ce=`text/plain`,oe=i,se=`7bit`,O=void 0,le=!1;let t;if(!e[`content-disposition`]){ne=!0;return}let n=u(e[`content-disposition`][0],r);if(!n||n.type!==`form-data`){ne=!0;return}if(n.params&&(n.params.name&&(O=n.params.name),n.params[`filename*`]?t=n.params[`filename*`]:n.params.filename&&(t=n.params.filename),t!==void 0&&!h&&(t=o(t))),e[`content-type`]){let t=l(e[`content-type`][0]);t&&(ce=`${t.type}/${t.subtype}`,t.params&&typeof t.params.charset==`string`&&(oe=t.params.charset.toLowerCase()))}if(e[`content-transfer-encoding`]&&(se=e[`content-transfer-encoding`][0].toLowerCase()),ce===`application/octet-stream`||t!==void 0){if(te===w){ue||(ue=!0,this.emit(`filesLimit`)),ne=!0;return}if(++te,this.listenerCount(`file`)===0){ne=!0;return}re=0,this._fileStream=new _(y,this),++this._fileEndsLeft,this.emit(`file`,O,this._fileStream,{filename:t,encoding:se,mimeType:ce})}else{if(ee===T){de||(de=!0,this.emit(`fieldsLimit`)),ne=!0;return}if(++ee,this.listenerCount(`field`)===0){ne=!0;return}ie=[],ae=0}}),A=0,fe=(e,t,n,r,i)=>{retrydata:for(;t;){if(this._hparser!==null){let e=this._hparser.push(t,n,r);if(e===-1){this._hparser=null,k.reset(),this.emit(`error`,Error(`Malformed part header`));break}n=e}if(n===r)break;if(A!==0){if(A===1){switch(t[n]){case 45:A=2,++n;break;case 13:A=3,++n;break;default:A=0}if(n===r)return}if(A===2){if(A=0,t[n]===45){this._complete=!0,this._bparser=v;return}let e=this._writecb;this._writecb=m,fe(!1,p,0,1,!1),this._writecb=e}else if(A===3)if(A=0,t[n]===10){if(++n,D>=E||(this._hparser=k,n===r))break;continue retrydata}else{let e=this._writecb;this._writecb=m,fe(!1,f,0,1,!1),this._writecb=e}}if(!ne){if(this._fileStream){let e,a=Math.min(r-n,C-re);i?e=t.slice(n,n+a):(e=Buffer.allocUnsafe(a),t.copy(e,0,n,n+a)),re+=e.length,re===C?(e.length>0&&this._fileStream.push(e),this._fileStream.emit(`limit`),this._fileStream.truncated=!0,ne=!0):this._fileStream.push(e)||(this._writecb&&(this._fileStream._readcb=this._writecb),this._writecb=null)}else if(ie!==void 0){let e,a=Math.min(r-n,S-ae);i?e=t.slice(n,n+a):(e=Buffer.allocUnsafe(a),t.copy(e,0,n,n+a)),ae+=a,ie.push(e),ae===S&&(ne=!0,le=!0)}}break}if(e){if(A=1,this._fileStream)this._fileStream.push(null),this._fileStream=null;else if(ie!==void 0){let e;switch(ie.length){case 0:e=``;break;case 1:e=s(ie[0],oe,0);break;default:e=s(Buffer.concat(ie,ae),oe,0)}ie=void 0,ae=0,this.emit(`field`,O,e,{nameTruncated:!1,valueTruncated:le,encoding:se,mimeType:ce})}++D===E&&this.emit(`partsLimit`)}};this._bparser=new a(`\r\n--${n}`,fe),this._writecb=null,this._finalcb=null,this.write(d)}static detect(e){return e.type===`multipart`&&e.subtype===`form-data`}_write(e,t,n){this._writecb=n,this._bparser.push(e,0),this._writecb&&y(this)}_destroy(e,t){this._hparser=null,this._bparser=v,e||=C(this);let n=this._fileStream;n&&(this._fileStream=null,n.destroy(e)),t(e)}_final(e){if(this._bparser.destroy(),!this._complete)return e(Error(`Unexpected end of form`));this._fileEndsLeft?this._finalcb=S.bind(null,this,e):S(this,e)}};function S(e,t,n){if(n)return t(n);n=C(e),t(n)}function C(e){if(e._hparser)return Error(`Malformed part header`);let t=e._fileStream;if(t&&(e._fileStream=null,t.destroy(Error(`Unexpected end of file`))),!e._complete)return Error(`Unexpected end of form`)}let w=[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,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,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,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,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],T=[0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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,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,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,1,1,1,1,1,1,1,1,1,1,1,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,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,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,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,1,1,1,1,1,1,1,1,1,1,1,1];n.exports=x})),jge=i(((e,n)=>{let{Writable:r}=t(`stream`),{getDecoder:i}=O3();var a=class extends r{constructor(e){let t={autoDestroy:!0,emitClose:!0,highWaterMark:typeof e.highWaterMark==`number`?e.highWaterMark:void 0};super(t);let n=e.defCharset||`utf8`;e.conType.params&&typeof e.conType.params.charset==`string`&&(n=e.conType.params.charset),this.charset=n;let r=e.limits;this.fieldSizeLimit=r&&typeof r.fieldSize==`number`?r.fieldSize:1*1024*1024,this.fieldsLimit=r&&typeof r.fields==`number`?r.fields:1/0,this.fieldNameSizeLimit=r&&typeof r.fieldNameSize==`number`?r.fieldNameSize:100,this._inKey=!0,this._keyTrunc=!1,this._valTrunc=!1,this._bytesKey=0,this._bytesVal=0,this._fields=0,this._key=``,this._val=``,this._byte=-2,this._lastPos=0,this._encode=0,this._decoder=i(n)}static detect(e){return e.type===`application`&&e.subtype===`x-www-form-urlencoded`}_write(e,t,n){if(this._fields>=this.fieldsLimit)return n();let r=0,i=e.length;if(this._lastPos=0,this._byte!==-2){if(r=o(this,e,r,i),r===-1)return n(Error(`Malformed urlencoded form`));if(r>=i)return n();this._inKey?++this._bytesKey:++this._bytesVal}main:for(;r<i;)if(this._inKey){for(r=s(this,e,r,i);r<i;){switch(e[r]){case 61:this._lastPos<r&&(this._key+=e.latin1Slice(this._lastPos,r)),this._lastPos=++r,this._key=this._decoder(this._key,this._encode),this._encode=0,this._inKey=!1;continue main;case 38:if(this._lastPos<r&&(this._key+=e.latin1Slice(this._lastPos,r)),this._lastPos=++r,this._key=this._decoder(this._key,this._encode),this._encode=0,this._bytesKey>0&&this.emit(`field`,this._key,``,{nameTruncated:this._keyTrunc,valueTruncated:!1,encoding:this.charset,mimeType:`text/plain`}),this._key=``,this._val=``,this._keyTrunc=!1,this._valTrunc=!1,this._bytesKey=0,this._bytesVal=0,++this._fields>=this.fieldsLimit)return this.emit(`fieldsLimit`),n();continue;case 43:this._lastPos<r&&(this._key+=e.latin1Slice(this._lastPos,r)),this._key+=` `,this._lastPos=r+1;break;case 37:if(this._encode===0&&(this._encode=1),this._lastPos<r&&(this._key+=e.latin1Slice(this._lastPos,r)),this._lastPos=r+1,this._byte=-1,r=o(this,e,r+1,i),r===-1)return n(Error(`Malformed urlencoded form`));if(r>=i)return n();++this._bytesKey,r=s(this,e,r,i);continue}++r,++this._bytesKey,r=s(this,e,r,i)}this._lastPos<r&&(this._key+=e.latin1Slice(this._lastPos,r))}else{for(r=c(this,e,r,i);r<i;){switch(e[r]){case 38:if(this._lastPos<r&&(this._val+=e.latin1Slice(this._lastPos,r)),this._lastPos=++r,this._inKey=!0,this._val=this._decoder(this._val,this._encode),this._encode=0,(this._bytesKey>0||this._bytesVal>0)&&this.emit(`field`,this._key,this._val,{nameTruncated:this._keyTrunc,valueTruncated:this._valTrunc,encoding:this.charset,mimeType:`text/plain`}),this._key=``,this._val=``,this._keyTrunc=!1,this._valTrunc=!1,this._bytesKey=0,this._bytesVal=0,++this._fields>=this.fieldsLimit)return this.emit(`fieldsLimit`),n();continue main;case 43:this._lastPos<r&&(this._val+=e.latin1Slice(this._lastPos,r)),this._val+=` `,this._lastPos=r+1;break;case 37:if(this._encode===0&&(this._encode=1),this._lastPos<r&&(this._val+=e.latin1Slice(this._lastPos,r)),this._lastPos=r+1,this._byte=-1,r=o(this,e,r+1,i),r===-1)return n(Error(`Malformed urlencoded form`));if(r>=i)return n();++this._bytesVal,r=c(this,e,r,i);continue}++r,++this._bytesVal,r=c(this,e,r,i)}this._lastPos<r&&(this._val+=e.latin1Slice(this._lastPos,r))}n()}_final(e){if(this._byte!==-2)return e(Error(`Malformed urlencoded form`));(!this._inKey||this._bytesKey>0||this._bytesVal>0)&&(this._inKey?this._key=this._decoder(this._key,this._encode):this._val=this._decoder(this._val,this._encode),this.emit(`field`,this._key,this._val,{nameTruncated:this._keyTrunc,valueTruncated:this._valTrunc,encoding:this.charset,mimeType:`text/plain`})),e()}};function o(e,t,n,r){if(n>=r)return r;if(e._byte===-1){let i=l[t[n++]];if(i===-1)return-1;if(i>=8&&(e._encode=2),n<r){let r=l[t[n++]];if(r===-1)return-1;e._inKey?e._key+=String.fromCharCode((i<<4)+r):e._val+=String.fromCharCode((i<<4)+r),e._byte=-2,e._lastPos=n}else e._byte=i}else{let r=l[t[n++]];if(r===-1)return-1;e._inKey?e._key+=String.fromCharCode((e._byte<<4)+r):e._val+=String.fromCharCode((e._byte<<4)+r),e._byte=-2,e._lastPos=n}return n}function s(e,t,n,r){if(e._bytesKey>e.fieldNameSizeLimit){for(e._keyTrunc||e._lastPos<n&&(e._key+=t.latin1Slice(e._lastPos,n-1)),e._keyTrunc=!0;n<r;++n){let r=t[n];if(r===61||r===38)break;++e._bytesKey}e._lastPos=n}return n}function c(e,t,n,r){if(e._bytesVal>e.fieldSizeLimit){for(e._valTrunc||e._lastPos<n&&(e._val+=t.latin1Slice(e._lastPos,n-1)),e._valTrunc=!0;n<r&&t[n]!==38;++n)++e._bytesVal;e._lastPos=n}return n}let l=[-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,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,-1,-1,-1,-1,-1,-1,-1,10,11,12,13,14,15,-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,10,11,12,13,14,15,-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,-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,-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,-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,-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,-1,-1,-1,-1,-1,-1,-1,-1];n.exports=a})),Mge=i(((e,t)=>{let{parseContentType:n}=O3();function r(e){let t=e.headers,r=n(t[`content-type`]);if(!r)throw Error(`Malformed content type`);for(let n of i){if(!n.detect(r))continue;let i={limits:e.limits,headers:t,conType:r,highWaterMark:void 0,fileHwm:void 0,defCharset:void 0,defParamCharset:void 0,preservePath:!1};return e.highWaterMark&&(i.highWaterMark=e.highWaterMark),e.fileHwm&&(i.fileHwm=e.fileHwm),i.defCharset=e.defCharset,i.defParamCharset=e.defParamCharset,i.preservePath=e.preservePath,new n(i)}throw Error(`Unsupported content type: ${t[`content-type`]}`)}let i=[Age(),jge()].filter(function(e){return typeof e.detect==`function`});t.exports=e=>{if((typeof e!=`object`||!e)&&(e={}),typeof e.headers!=`object`||e.headers===null||typeof e.headers[`content-type`]!=`string`)throw Error(`Missing Content-Type`);return r(e)}})),Nge=i(((e,t)=>{t.exports=n;function n(){this.pending=0,this.max=1/0,this.listeners=[],this.waiting=[],this.error=null}n.prototype.go=function(e){this.pending<this.max?i(this,e):this.waiting.push(e)},n.prototype.wait=function(e){this.pending===0?e(this.error):this.listeners.push(e)},n.prototype.hold=function(){return r(this)};function r(e){e.pending+=1;var t=!1;return n;function n(n){if(t)throw Error(`callback called twice`);if(t=!0,e.error=e.error||n,--e.pending,e.waiting.length>0&&e.pending<e.max)i(e,e.waiting.shift());else if(e.pending===0){var a=e.listeners;e.listeners=[],a.forEach(r)}}function r(t){t(e.error)}}function i(e,t){t(r(e))}})),Pge=i((e=>{var n=t(`fs`),r=t(`util`),i=t(`stream`),a=i.Readable,o=i.PassThrough,s=Nge(),c=t(`events`).EventEmitter;e.BufferSlicer=d,e.FdSlicer=l,r.inherits(l,c);function l(e){c.call(this),this.fd=e,this.pend=new s,this.pend.max=1,this.refCount=0}l.prototype.read=function(e,t,r,i,a){var o=this;o.pend.go(function(s){n.read(o.fd,e,t,r,i,function(e,t,n){s(),a(e,t,n)})})},l.prototype.createReadStream=function(e){return new u(this,e)},l.prototype.ref=function(){this.refCount+=1},l.prototype.unref=function(){var e=this;if(--e.refCount,e.refCount<0)throw Error(`invalid unref`);if(e.refCount>0)return;n.close(e.fd,t);function t(t){t?e.emit(`error`,t):e.emit(`close`)}},r.inherits(u,a);function u(e,t){t||={},a.call(this,t),this.context=e,this.context.ref(),this.start=t.start||0,this.endOffset=t.end,this.pos=this.start}u.prototype._read=function(e){var t=this,r=Math.min(t._readableState.highWaterMark,e);if(t.endOffset!=null&&(r=Math.min(r,t.endOffset-t.pos)),r<=0){t.push(null),this._cleanup();return}t.context.pend.go(function(e){var i=Buffer.allocUnsafe(r);n.read(t.context.fd,i,0,r,t.pos,function(n,r){n?t.destroy(n):r===0?(t.push(null),t._cleanup()):(t.pos+=r,t.push(i.slice(0,r))),e()})})},u.prototype._destroy=function(e,t){this._cleanup(),t(e)},u.prototype._cleanup=function(){this.context!=null&&(this.context.unref(),this.context=null)},r.inherits(d,c);function d(e){c.call(this),this.refCount=0,this.buffer=e}d.prototype.read=function(e,t,n,r,i){if(!(0<=t&&t<=e.length))throw RangeError(`offset outside buffer: 0 <= `+t+` <= `+e.length);if(r<0)throw RangeError(`position is negative: `+r);if(t+n>e.length&&(n=e.length-t),r+n>this.buffer.length&&(n=this.buffer.length-r),n<=0){setImmediate(function(){i(null,0)});return}this.buffer.copy(e,t,r,r+n),setImmediate(function(){i(null,n)})},d.prototype.createReadStream=function(e){e||={};var t=new o(e);t.start=e.start||0,t.endOffset=e.end,t.pos=t.endOffset||this.buffer.length;for(var n=this.buffer.slice(t.start,t.pos),r=65536,i=0;;){var a=i+r;if(a>=n.length){i<n.length&&t.write(n.slice(i,n.length));break}t.write(n.slice(i,a)),i=a}return t.end(),t},d.prototype.ref=function(){this.refCount+=1},d.prototype.unref=function(){if(--this.refCount,this.refCount<0)throw Error(`invalid unref`)}})),Fge=i(((e,t)=>{let n=new Int32Array([0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117]);function r(e){let t=-1;for(let r of e)t=n[(t^r)&255]^t>>>8;return(t^-1)>>>0}t.exports=r})),Ige=i((e=>{t(`fs`);var n=t(`zlib`);Pge();var r=t(`util`),i=t(`events`).EventEmitter,a=t(`stream`).Transform,o=t(`stream`).PassThrough,s=t(`stream`).Writable;let c=typeof n.crc32==`function`?n.crc32:Fge();r.inherits(l,i);function l(e,t,n,r,a,o,s,c,l,u){var f=this;i.call(f),f.reader=e,f.reader.on(`error`,function(e){d(f,e)}),f.reader.once(`close`,function(){f.emit(`close`)}),f.readEntryCursor=t,f.fileSize=n,f.entryCount=r,f.comment=a,f.entriesRead=0,f.autoClose=!!o,f.lazyEntries=!!s,f.decodeStrings=!!c,f.validateEntrySizes=!!l,f.strictFileNames=!!u,f.isOpen=!0,f.emittedError=!1,f.hasEachEntryBeenCalled=!1,f.lazyEntries||f._readEntry()}l.prototype.close=function(){this.isOpen&&(this.isOpen=!1,this.reader.unref())};function u(e,t){e.autoClose&&e.close(),d(e,t)}function d(e,t){e.emittedError||(e.emittedError=!0,e.emit(`error`,t))}l.prototype.readEntry=function(){if(!this.lazyEntries)throw Error(`readEntry() called without lazyEntries:true`);this._readEntry()},l.prototype._readEntry=function(){var e=this;if(e.entryCount===e.entriesRead){setImmediate(function(){e.autoClose&&e.close(),!e.emittedError&&e.emit(`end`)});return}if(!e.emittedError){var t=T(46);v(e.reader,t,0,t.length,e.readEntryCursor,function(n){if(n)return u(e,n);if(!e.emittedError){var r=new f,i=t.readUInt32LE(0);if(i!==33639248)return u(e,Error(`invalid central directory file header signature: 0x`+i.toString(16)));if(r.versionMadeBy=t.readUInt16LE(4),r.versionNeededToExtract=t.readUInt16LE(6),r.generalPurposeBitFlag=t.readUInt16LE(8),r.compressionMethod=t.readUInt16LE(10),r.lastModFileTime=t.readUInt16LE(12),r.lastModFileDate=t.readUInt16LE(14),r.crc32=t.readUInt32LE(16),r.compressedSize=t.readUInt32LE(20),r.uncompressedSize=t.readUInt32LE(24),r.fileNameLength=t.readUInt16LE(28),r.extraFieldLength=t.readUInt16LE(30),r.fileCommentLength=t.readUInt16LE(32),r.internalFileAttributes=t.readUInt16LE(36),r.externalFileAttributes=t.readUInt32LE(38),r.relativeOffsetOfLocalHeader=t.readUInt32LE(42),r.generalPurposeBitFlag&64)return u(e,Error(`strong encryption is not supported`));e.readEntryCursor+=46,t=T(r.fileNameLength+r.extraFieldLength+r.fileCommentLength),v(e.reader,t,0,t.length,e.readEntryCursor,function(n){if(n)return u(e,n);if(!e.emittedError){r.fileNameRaw=t.subarray(0,r.fileNameLength);var i=r.fileNameLength+r.extraFieldLength;r.extraFieldRaw=t.subarray(r.fileNameLength,i),r.fileCommentRaw=t.subarray(i,i+r.fileCommentLength);try{r.extraFields=_(r.extraFieldRaw)}catch(t){return u(e,t)}if(e.decodeStrings){var a=(r.generalPurposeBitFlag&2048)!=0;r.fileComment=C(r.fileCommentRaw,a),r.fileName=h(r.generalPurposeBitFlag,r.fileNameRaw,r.extraFields,e.strictFileNames);var o=g(r.fileName);if(o!=null)return u(e,Error(o))}else r.fileComment=r.fileCommentRaw,r.fileName=r.fileNameRaw;r.comment=r.fileComment,e.readEntryCursor+=t.length,e.entriesRead+=1;for(var s=0;s<r.extraFields.length;s++){var c=r.extraFields[s];if(c.id===1){var l=c.data,d=0;if(r.uncompressedSize===4294967295){if(d+8>l.length)return u(e,Error(`zip64 extended information extra field does not include uncompressed size`));r.uncompressedSize=w(l,d),d+=8}if(r.compressedSize===4294967295){if(d+8>l.length)return u(e,Error(`zip64 extended information extra field does not include compressed size`));r.compressedSize=w(l,d),d+=8}if(r.relativeOffsetOfLocalHeader===4294967295){if(d+8>l.length)return u(e,Error(`zip64 extended information extra field does not include relative header offset`));r.relativeOffsetOfLocalHeader=w(l,d),d+=8}break}}if(e.validateEntrySizes&&r.compressionMethod===0){var f=r.uncompressedSize;if(r.isEncrypted()&&(f+=12),r.compressedSize!==f){var p=`compressed/uncompressed size mismatch for stored file: `+r.compressedSize+` != `+r.uncompressedSize;return u(e,Error(p))}}e.emit(`entry`,r),e.lazyEntries||e._readEntry()}})}})}},l.prototype.eachEntry=function(){let e=this;if(!e.lazyEntries)throw Error(`eachEntry() requires lazyEntries: true`);if(e.hasEachEntryBeenCalled)throw Error(`eachEntry() must only be called once per ZipFile`);e.hasEachEntryBeenCalled=!0;let t=null;e.on(`entry`,r),e.on(`end`,i),e.on(`error`,a);function n(){e.removeListener(`entry`,r),e.removeListener(`end`,i),e.removeListener(`error`,a),e.autoClose&&e.close()}function r(e){let{resolve:n}=t;t=null,n({value:e})}function i(){let{resolve:e}=t;t=null,n(),e({done:!0})}function a(e){let{reject:r}=t;t=null,n(),r(e)}return{[Symbol.asyncIterator](){return this},next(){let n=new Promise((e,n)=>{if(t!=null)throw Error(`next() called before previous Promise was resolved.`);t={resolve:e,reject:n}});return e.readEntry(),n},return(e){return n(),Promise.resolve({done:!0,value:e})},throw(e){return n(),Promise.reject(e)}}},l.prototype.openReadStream=function(e,t,n){var r=this,i=0,a=e.compressedSize;if(n??(n=t,t=null),t==null)t={};else{if(t.decodeFileData===!1){if(t.decrypt!=null)throw Error(`cannot use options.decrypt when options.decodeFileData === false`);if(t.decompress!=null)throw Error(`cannot use options.decompress when options.decodeFileData === false`)}else{if(t.decrypt!=null){if(!e.isEncrypted())throw Error(`options.decrypt can only be specified for encrypted entries. See also option decodeFileData.`);if(t.decrypt!==!1)throw Error(`invalid options.decrypt value: `+t.decrypt);if(e.isCompressed()&&t.decompress!==!1)throw Error(`entry is encrypted and compressed, and options.decompress !== false. See also option decodeFileData.`)}if(t.decompress!=null){if(!e.isCompressed())throw Error(`options.decompress can only be specified for compressed entries. See also option decodeFileData.`);if(!(t.decompress===!1||t.decompress===!0))throw Error(`invalid options.decompress value: `+t.decompress);s=t.decompress}}if(t.start!=null){if(i=t.start,i<0)throw Error(`options.start < 0`);if(i>e.compressedSize)throw Error(`options.start > entry.compressedSize`)}if(t.end!=null){if(a=t.end,a<0)throw Error(`options.end < 0`);if(a>e.compressedSize)throw Error(`options.end > entry.compressedSize`);if(a<i)throw Error(`options.end < options.start`)}}var o=t.decodeFileData===!1||(e.compressionMethod===0||e.compressionMethod===8&&t.decompress===!1)&&(!e.isEncrypted()||t.decrypt===!1);if((t.start!=null||t.end!=null)&&!o)throw Error(`start/end range require options.decodeFileData === false for non-trivial encoded entries.`);if(!r.isOpen)return n(Error(`closed`));if(e.isEncrypted()&&!o&&t.decrypt!==!1)return n(Error(`entry is encrypted, and options.decodeFileData !== false`));var s;if(o)s=!1;else if(e.compressionMethod===8)s=t.decodeFileData!==!0;else return n(Error(`unsupported compression method: `+e.compressionMethod));r.readLocalFileHeader(e,{minimal:!0},function(t,o){if(t)return n(t);r.openReadStreamLowLevel(o.fileDataStart,e.compressedSize,i,a,s,e.uncompressedSize,n)})},l.prototype.openReadStreamLowLevel=function(e,t,r,i,a,o,s){var c=this;e+t;var l=c.reader.createReadStream({start:e+r,end:e+i}),u=l;if(a){var d=!1,f=n.createInflateRaw();l.on(`error`,function(e){setImmediate(function(){d||f.emit(`error`,e)})}),l.pipe(f),c.validateEntrySizes?(u=new y(o),f.on(`error`,function(e){setImmediate(function(){d||u.emit(`error`,e)})}),f.pipe(u)):u=f,E(u,function(){d=!0,f!==u&&f.unpipe(u),l.unpipe(f),l.destroy()})}s(null,u)},l.prototype.readLocalFileHeader=function(e,t,n){var r=this;n??(n=t,t=null),t??={},r.reader.ref();var i=T(30);v(r.reader,i,0,i.length,e.relativeOffsetOfLocalHeader,function(a){try{if(a)return n(a);var o=i.readUInt32LE(0);if(o!==67324752)return n(Error(`invalid local file header signature: 0x`+o.toString(16)));var s=i.readUInt16LE(26),c=i.readUInt16LE(28),l=e.relativeOffsetOfLocalHeader+30+s+c;if(l+e.compressedSize>r.fileSize)return n(Error(`file data overflows file bounds: `+l+` + `+e.compressedSize+` > `+r.fileSize));if(t.minimal)return n(null,{fileDataStart:l});var u=new p;u.fileDataStart=l,u.versionNeededToExtract=i.readUInt16LE(4),u.generalPurposeBitFlag=i.readUInt16LE(6),u.compressionMethod=i.readUInt16LE(8),u.lastModFileTime=i.readUInt16LE(10),u.lastModFileDate=i.readUInt16LE(12),u.crc32=i.readUInt32LE(14),u.compressedSize=i.readUInt32LE(18),u.uncompressedSize=i.readUInt32LE(22),u.fileNameLength=s,u.extraFieldLength=c,i=T(s+c),r.reader.ref(),v(r.reader,i,0,i.length,e.relativeOffsetOfLocalHeader+30,function(e){try{return e?n(e):(u.fileName=i.subarray(0,s),u.extraField=i.subarray(s),n(null,u))}finally{r.reader.unref()}})}finally{r.reader.unref()}})},l.prototype.openReadStreamPromise=function(e,t){return new Promise((n,r)=>{this.openReadStream(e,t,function(e,t){if(e)return r(e);n(t)})})},l.prototype.openReadStreamLowLevelPromise=function(e,t,n,r,i,a){return new Promise((o,s)=>{this.openReadStream(e,t,n,r,i,a,function(e,t){if(e)return s(e);o(t)})})},l.prototype.readLocalFileHeaderPromise=function(e,t){return new Promise((n,r)=>{this.readLocalFileHeader(e,t,function(e,t){if(e)return r(e);n(t)})})};function f(){}f.prototype.getLastModDate=function(e){if(e??={},!e.forceDosFormat)for(var t=0;t<this.extraFields.length;t++){var n=this.extraFields[t];if(n.id===21589){var r=n.data;if(r.length<5||!(r[0]&1))continue;var i=r.readInt32LE(1);return new Date(i*1e3)}else if(n.id===10){var r=n.data;if(r.length!==32||r.readUInt16LE(4)!==1||r.readUInt16LE(6)!==24)continue;var a=(r.readUInt32LE(8)+4294967296*r.readInt32LE(12))/1e4-0xa9730b66800;return new Date(a)}}return m(this.lastModFileDate,this.lastModFileTime,e.timezone)},f.prototype.canDecodeFileData=function(){return!this.isEncrypted()&&(this.compressionMethod===0||this.compressionMethod===8)},f.prototype.isEncrypted=function(){return(this.generalPurposeBitFlag&1)!=0},f.prototype.isCompressed=function(){return this.compressionMethod===8};function p(){}function m(e,t,n){var r=e&31,i=(e>>5&15)-1,a=(e>>9&127)+1980,o=0,s=(t&31)*2,c=t>>5&63,l=t>>11&31;if(n==null||n===`local`)return new Date(a,i,r,l,c,s,o);if(n===`UTC`)return new Date(Date.UTC(a,i,r,l,c,s,o));throw Error(`unrecognized options.timezone: `+options.timezone)}function h(e,t,n,r){for(var i=null,a=0;a<n.length;a++){var o=n[a];if(o.id===28789){if(o.data.length<6||o.data.readUInt8(0)!==1)continue;var s=o.data.readUInt32LE(1);if(c(t)!==s)continue;i=C(o.data.subarray(5),!0);break}}return i??=C(t,(e&2048)!=0),r||(i=i.replace(/\\/g,`/`)),i}function g(e){return e.indexOf(`\\`)===-1?/^[a-zA-Z]:/.test(e)||/^\//.test(e)?`absolute path: `+e:e.split(`/`).indexOf(`..`)===-1?null:`invalid relative path: `+e:`invalid characters in fileName: `+e}function _(e){for(var t=[],n=0;n<e.length-3;){var r=e.readUInt16LE(n+0),i=e.readUInt16LE(n+2),a=n+4,o=a+i;if(o>e.length)throw Error(`extra field length exceeds extra field buffer size`);var s=e.subarray(a,o);t.push({id:r,data:s}),n=o}return t}function v(e,t,n,r,i,a){if(r===0)return setImmediate(function(){a(null,T(0))});e.read(t,n,r,i,function(e,t){if(e)return a(e);if(t<r)return a(Error(`unexpected EOF`));a()})}r.inherits(y,a);function y(e){a.call(this),this.actualByteCount=0,this.expectedByteCount=e}y.prototype._transform=function(e,t,n){if(this.actualByteCount+=e.length,this.actualByteCount>this.expectedByteCount){var r=`too many bytes in the stream. expected `+this.expectedByteCount+`. got at least `+this.actualByteCount;return n(Error(r))}n(null,e)},y.prototype._flush=function(e){if(this.actualByteCount<this.expectedByteCount){var t=`not enough bytes in the stream. expected `+this.expectedByteCount+`. got only `+this.actualByteCount;return e(Error(t))}e()},r.inherits(b,i);function b(){i.call(this),this.refCount=0}b.prototype.ref=function(){this.refCount+=1},b.prototype.unref=function(){var e=this;if(--e.refCount,e.refCount>0)return;if(e.refCount<0)throw Error(`invalid unref`);e.close(t);function t(t){if(t)return e.emit(`error`,t);e.emit(`close`)}},b.prototype.createReadStream=function(e){e??={};var t=e.start,n=e.end;if(t===n){var r=new o;return setImmediate(function(){r.end()}),r}var i=this._readStreamForRange(t,n),a=!1,s=new x(this);i.on(`error`,function(e){setImmediate(function(){a||s.emit(`error`,e)})}),E(s,function(){i.unpipe(s),s.unref(),i.destroy()});var c=new y(n-t);return s.on(`error`,function(e){setImmediate(function(){a||c.emit(`error`,e)})}),E(c,function(){a=!0,s.unpipe(c),s.destroy()}),i.pipe(s).pipe(c)},b.prototype._readStreamForRange=function(e,t){throw Error(`not implemented`)},b.prototype.read=function(e,t,n,r,i){var a=this.createReadStream({start:r,end:r+n}),o=new s,c=0;o._write=function(n,r,i){n.copy(e,t+c,0,n.length),c+=n.length,i()},o.on(`finish`,i),a.on(`error`,function(e){i(e)}),a.pipe(o)},b.prototype.close=function(e){setImmediate(e)},r.inherits(x,o);function x(e){o.call(this),this.context=e,this.context.ref(),this.unreffedYet=!1}x.prototype._flush=function(e){this.unref(),e()},x.prototype.unref=function(e){this.unreffedYet||(this.unreffedYet=!0,this.context.unref())};var S=`\0☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_\`abcdefghijklmnopqrstuvwxyz{|}~⌂ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■\xA0`;function C(e,t){if(t)return e.toString(`utf8`);for(var n=``,r=0;r<e.length;r++)n+=S[e[r]];return n}function w(e,t){var n=e.readUInt32LE(t);return e.readUInt32LE(t+4)*4294967296+n}var T=typeof Buffer.allocUnsafe==`function`?function(e){return Buffer.allocUnsafe(e)}:function(e){return new Buffer(e)};function E(e,t){typeof e.destroy==`function`?e._destroy=function(e,n){t(),n?.(e)}:e.destroy=t}}));Mge(),Ige(),Object.freeze({source:`local`,skipStoreHooks:!0,context:Object.freeze({origin:`effect-capture`,paired:!1})});const k3={start:F().int().nonnegative().optional(),end:F().int().nonnegative().optional(),quote:P().min(1).optional(),prefix:P().max(1e3).optional(),suffix:P().max(1e3).optional()};z({docName:P().min(1),...k3,propertyKey:P().min(1).optional(),propertyPath:R(So([P(),F().int().nonnegative()])).optional(),body:P(),queue:I().optional(),summary:P().optional()});const A3=uo();Co(`action`,[z({action:H(`edit`),id:A3,body:P(),summary:P().optional()}),z({action:H(`resolve`),id:A3,summary:P().optional()}),z({action:H(`reopen`),id:A3,summary:P().optional()}),z({action:H(`replace`),id:A3,...k3,summary:P().optional()}),z({action:H(`queue`),id:A3,summary:P().optional()}),z({action:H(`unqueue`),id:A3,summary:P().optional()}),z({action:H(`dispatch-prepare`),id:A3,summary:P().optional()}),z({action:H(`dispatch-complete`),id:A3,summary:P().optional()}),z({action:H(`dispatch-prepare-batch`),ids:R(A3).min(1).max(200),summary:P().optional()}),z({action:H(`dispatch-complete-batch`),ids:R(A3).min(1).max(200),summary:P().optional()})]);const j3="Absolute host path inside the target OpenKnowledge project. Required when the MCP server is registered globally (e.g. `npx @inkeep/open-knowledge mcp` once at the host level, routing per call), unless the MCP client advertises exactly one root via the `roots` capability — that single root is then used as the implicit `cwd`. Optional when the server is anchored to a single project (the per-project HTTP MCP server defaults to its configured project root).";P().max(200).optional().describe(`Optional one-line user-outcome description (≤80 chars). Appears as a bullet in the timeline.`),P().length(40).regex(/^[0-9a-f]+$/i).describe("A 40-character commit SHA identifying a saved version. Produced by `checkpoint`, listed by `history` as `entries[].version`, and consumed here — the same `version` field name across all three."),P().nullable().describe("Route-only preview URL (`/#/<doc>`, no host:port), or null when no UI is running."),P().optional().describe(`How the previewUrl was resolved (e.g. the UI lock).`),P().optional().describe(`Route of the prior/removed path, for closing a stale preview tab.`);const Lge=z({value:P(),truncatedFrom:F().optional(),hint:P().optional()}).describe(`Normalized change-note summary, when one was recorded.`),Rge=R(B(P(),L()));B(P(),L()).optional().describe("Preview-attach hint (`{ action, previewUrl?, message? }`) when relevant."),R($q).describe('Outbound internal links in the just-written doc that do not resolve. Always present — `[]` means every link resolves. Each: `{ href (as written), resolvedTo (the docName or content-root file path it pointed at, or null), reason: "no-such-doc" | "no-such-file" | "unresolvable" }`. Report-only — the write landed regardless; fix in a follow-up edit.'),Lge.optional(),R(Zq).min(1).optional().describe("Advisory entries discriminated by `kind`. Write-integrity kinds — `content-divergence` (converged Y.Text didn't byte-match what you composed) and `disk-edit-reconciled` (an out-of-band disk edit was folded in before your write) — mean re-read the doc. The renderability kind `mermaid-parse-error` means the write landed but that fence will not render — fix it and re-edit."),R(z({name:P(),description:P().optional()})).min(1).optional().describe("Templates the parent folder offers, present only when a create passed no `template`. A nudge — the write already landed; pass `template` next time to match the folder's shape.");const zge=P().optional().describe("Auto-duplicated body text. `textPlusStructured` mirrors the visible body here as a Claude / Claude Desktop client-quirk workaround (those clients hide `content[]` when `structuredContent` is present). Internal — programmatic consumers should prefer the `content[0].text` channel.");function M3(e){return{text:zge,...e}}new class{capacity;store;writeIndex=0;filled=!1;constructor(e){if(!Number.isInteger(e)||e<=0)throw RangeError(`RingBuffer capacity must be a positive integer, got ${e}`);this.capacity=e,this.store=Array(e)}push(e){this.store[this.writeIndex]=e,this.writeIndex=(this.writeIndex+1)%this.capacity,this.writeIndex===0&&(this.filled=!0)}read(){let e=[],t=this.filled?this.capacity:this.writeIndex;for(let n=1;n<=t;n++){let t=(this.writeIndex-n+this.capacity)%this.capacity,r=this.store[t];r!==void 0&&e.push(r)}return e}get size(){return this.filled?this.capacity:this.writeIndex}}(256),Dl.cursor,Dl.codex,Dl[`claude-desktop`],o1(`embeddings`),o1(`embeddings`);function Bge(e){try{let t=new URL(e),n=t.pathname.replace(/\/+$/,``);return`${t.protocol}//${t.host.toLowerCase()}${n}`}catch{return e.trim().replace(/\/+$/,``)}}Bge(Cs),o1(`embeddings`),o1(`embeddings`);const Vge=String.raw`\[\[([^\n#[\]|]+)(?:#([^\n[\]|]+))?(?:\|([^\n[\]]+))?\]\]`,Hge=String.raw`\((<[^>\n]+>|[^)\s\n]+)((?:\s+(?:"[^"\n]*"|'[^'\n]*'|\([^)\n]*\)))?)\)`,N3=String.raw`([^\]\n]*)`,Uge=String.raw`([^\]\n]*(?:\][^[\]\n]*)?)`,P3=e=>RegExp(`(!?)${Vge}`,e),F3=(e,t)=>RegExp(`(!?)\\[${e}\\]${Hge}`,t);P3(`y`),P3(`g`),F3(N3,`y`),F3(N3,`g`),F3(Uge,`g`);function I3(e){return e.replace(/\\/g,`/`)}function L3(e){return{...e,windowsHide:!0}}z({target:V(Object.keys({"claude-cowork":{type:`app-bundle`,appName:`Claude`,urlScheme:`claude:`,probeScheme:`claude`,quitFirst:!1},"claude-code":{type:`app-bundle`,appName:`Claude`,urlScheme:`claude:`,probeScheme:`claude`,quitFirst:!1},codex:{type:`app-bundle`,appName:`Codex`,urlScheme:`codex:`,probeScheme:`codex`,quitFirst:!0},cursor:{type:`cli-binary`,binaryName:`cursor`,urlScheme:`cursor:`}})),url:P().min(1).max(4096),workspacePath:P().optional()}),z({}).loose(),o1(`installed-skills-marker`);var R3=e(i(((e,t)=>{function n(e){return Array.isArray(e)?e:[e]}let r=/^\s+$/,i=/(?:[^\\]|^)\\$/,a=/^\\!/,o=/^\\#/,s=/\r?\n/g,c=/^\.*\/|^\.+$/,l=`node-ignore`;typeof Symbol<`u`&&(l=Symbol.for(`node-ignore`));let u=l,d=(e,t,n)=>Object.defineProperty(e,t,{value:n}),f=/([0-z])-([0-z])/g,p=()=>!1,m=e=>e.replace(f,(e,t,n)=>t.charCodeAt(0)<=n.charCodeAt(0)?e:``),h=e=>{let{length:t}=e;return e.slice(0,t-t%2)},g=[[/^\uFEFF/,()=>``],[/((?:\\\\)*?)(\\?\s+)$/,(e,t,n)=>t+(n.indexOf(`\\`)===0?` `:``)],[/(\\+?)\s/g,(e,t)=>{let{length:n}=t;return t.slice(0,n-n%2)+` `}],[/[\\$.|*+(){^]/g,e=>`\\${e}`],[/(?!\\)\?/g,()=>`[^/]`],[/^\//,()=>`^`],[/\//g,()=>`\\/`],[/^\^*\\\*\\\*\\\//,()=>`^(?:.*\\/)?`],[/^(?=[^^])/,function(){return/\/(?!$)/.test(this)?`^`:`(?:^|\\/)`}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(e,t,n)=>t+6<n.length?`(?:\\/[^\\/]+)*`:`\\/.+`],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(e,t,n)=>t+n.replace(/\\\*/g,`[^\\/]*`)],[/\\\\\\(?=[$.|*+(){^])/g,()=>`\\`],[/\\\\/g,()=>`\\`],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(e,t,n,r,i)=>t===`\\`?`\\[${n}${h(r)}${i}`:i===`]`&&r.length%2==0?`[${m(n)}${r}]`:`[]`],[/(?:[^*])$/,e=>/\/$/.test(e)?`${e}$`:`${e}(?=$|\\/$)`],[/(\^|\\\/)?\\\*$/,(e,t)=>`${t?`${t}[^/]+`:`[^/]*`}(?=$|\\/$)`]],_=Object.create(null),v=(e,t)=>{let n=_[e];return n||(n=g.reduce((t,[n,r])=>t.replace(n,r.bind(e)),e),_[e]=n),t?new RegExp(n,`i`):new RegExp(n)},y=e=>typeof e==`string`,b=e=>e&&y(e)&&!r.test(e)&&!i.test(e)&&e.indexOf(`#`)!==0,x=e=>e.split(s);var S=class{constructor(e,t,n,r){this.origin=e,this.pattern=t,this.negative=n,this.regex=r}};let C=(e,t)=>{let n=e,r=!1;e.indexOf(`!`)===0&&(r=!0,e=e.substr(1)),e=e.replace(a,`!`).replace(o,`#`);let i=v(e,t);return new S(n,e,r,i)},w=(e,t)=>{throw new t(e)},T=(e,t,n)=>y(e)?e?T.isNotRelative(e)?n(`path should be a \`path.relative()\`d string, but got "${t}"`,RangeError):!0:n(`path must not be empty`,TypeError):n(`path must be a string, but got \`${t}\``,TypeError),E=e=>c.test(e);T.isNotRelative=E,T.convert=e=>e;var D=class{constructor({ignorecase:e=!0,ignoreCase:t=e,allowRelativePaths:n=!1}={}){d(this,u,!0),this._rules=[],this._ignoreCase=t,this._allowRelativePaths=n,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}_addPattern(e){if(e&&e[u]){this._rules=this._rules.concat(e._rules),this._added=!0;return}if(b(e)){let t=C(e,this._ignoreCase);this._added=!0,this._rules.push(t)}}add(e){return this._added=!1,n(y(e)?x(e):e).forEach(this._addPattern,this),this._added&&this._initCache(),this}addPattern(e){return this.add(e)}_testOne(e,t){let n=!1,r=!1;return this._rules.forEach(i=>{let{negative:a}=i;r===a&&n!==r||a&&!n&&!r&&!t||i.regex.test(e)&&(n=!a,r=a)}),{ignored:n,unignored:r}}_test(e,t,n,r){let i=e&&T.convert(e);return T(i,e,this._allowRelativePaths?p:w),this._t(i,t,n,r)}_t(e,t,n,r){if(e in t)return t[e];if(r||=e.split(`/`),r.pop(),!r.length)return t[e]=this._testOne(e,n);let i=this._t(r.join(`/`)+`/`,t,n,r);return t[e]=i.ignored?i:this._testOne(e,n)}ignores(e){return this._test(e,this._ignoreCache,!1).ignored}createFilter(){return e=>!this.ignores(e)}filter(e){return n(e).filter(this.createFilter())}test(e){return this._test(e,this._testCache,!0)}};let ee=e=>new D(e);if(ee.isPathValid=e=>T(e&&T.convert(e),e,p),ee.default=ee,t.exports=ee,typeof process<`u`&&(process.env&&process.env.IGNORE_TEST_WIN32||process.platform===`win32`)){T.convert=e=>/^\\\\\?\\/.test(e)||/["<>|\u0000-\u001F]+/u.test(e)?e:e.replace(/\\/g,`/`);let e=/^[a-z]:\//i;T.isNotRelative=t=>e.test(t)||E(t)}}))(),1);const z3=o1(`content-filter`);Ie(s);const B3=new Set(`node_modules,.venv,venv,env,__pycache__,vendor,dist,build,out,output,.next,.nuxt,.svelte-kit,.astro,.turbo,.cache,.parcel-cache,coverage,.git,.ok,.open-knowledge,.openknowledge,.claude,.cursor,.codex,.agents,.opencode,.pi,Library,Applications,.Trash`.split(`,`)),Wge=new Set([`.git`,`node_modules`,`.ok`,`.open-knowledge`,`.openknowledge`,`.claude`,`.cursor`,`.codex`,`.agents`,`.opencode`,`.pi`]),Gge=new Set([`worktrees`,`local`]);function V3(e,t){let n=e.split(`/`);for(let e=0;e<n.length;e++){let r=n[e];if(Wge.has(r)&&!(t&&r===`.ok`&&!Gge.has((n[e+1]??``).toLowerCase())))return!0}return!1}function H3(e){return e.startsWith(`${vl}/`)}function Kge(e){return e===`.ok`||e===`.ok/skills`||e.startsWith(`.ok/skills/`)}function qge(e){let t=e.replace(/^\/+/,``).replace(/\/+$/,``).trim();return t===`.ok`||t===`.ok/**`||t===`**/.ok`||t===`**/.ok/**`}function U3(e,t){for(let n=0;n<t;n++)if(B3.has(e[n]))return!0;return!1}function W3(e){let t=e.split(`/`),n=t.length;return n<3||t[n-3]!==`.ok`||t[n-2]!==`templates`||he(t[n-1])!==`.md`?!1:!U3(t,n-3)}function Jge(e){let t=e.split(`/`),n=t.length;return t[n-1]===`.ok`?!U3(t,n-1):n>=2&&t[n-1]===`templates`&&t[n-2]===`.ok`?!U3(t,n-2):!1}function G3(e,t){if(t.size===0)return!1;for(let n of t)if(e.startsWith(`${n}/`))return!0;return!1}function Yge(e,t){if(t.size===0)return!1;for(let n of t)if(n===e||n.startsWith(`${e}/`)||e.startsWith(`${n}/`))return!0;return!1}const Xge=new Set([`.DS_Store`,`.localized`]);function K3(e){return Xge.has(e.slice(e.lastIndexOf(`/`)+1))}const Zge=new Set([`.ssh`,`.aws`,`.gnupg`,`.kube`,`.docker`]);function q3(e){for(let t of e.split(`/`))if(Zge.has(t.toLowerCase()))return!0;return!1}const Qge=new Set([`credentials`,`.netrc`,`.npmrc`,`.pgpass`,`.git-credentials`]),$ge=[`.pem`,`.key`,`.p12`,`.pfx`,`.keystore`,`.jks`,`.ppk`];function J3(e){let t=e.slice(e.lastIndexOf(`/`)+1).toLowerCase();if(t===`.env`||t.startsWith(`.env.`)||Qge.has(t)||t.startsWith(`id_rsa`)||t.startsWith(`id_ed25519`)||t.startsWith(`id_ecdsa`)||t.startsWith(`id_dsa`))return!0;for(let e of $ge)if(t.endsWith(e))return!0;return!1}function e_e(e,t){return t===e||t.startsWith(`${e}/`)}const Y3=[`.gitignore`,`.okignore`];function t_e(e,t){let n=n_e(e);if(n===null)return[];let r=[];X3(M(n,`info`,`exclude`),t,r,`info/exclude`);let i=r_e(e);return i&&X3(i,t,r,`global excludesfile`),r}function n_e(e){let t=u(`git`,[`rev-parse`,`--git-common-dir`],L3({cwd:e,encoding:`utf-8`,timeout:5e3}));return t.status!==0||!t.stdout?null:ye(e,t.stdout.trim())}function r_e(e){let t=u(`git`,[`config`,`--get`,`--type=path`,`core.excludesfile`],L3({cwd:e,encoding:`utf-8`,timeout:5e3}));if(t.status===0&&t.stdout){let e=t.stdout.trim();if(e)return e}return i_e()}function i_e(){let e=process.env.XDG_CONFIG_HOME?.trim();return M(e&&e.length>0?e:M(se(),`.config`),`git`,`ignore`)}function X3(e,t,n,r){if(g(e))try{let r=S(e,`utf-8`);t.value+=r.length,n.push(...Q3(r))}catch(t){z3.warn({path:e,err:t},`Failed to read ${r} at ${e}`)}}function a_e(e){let{projectDir:t,contentDir:n,onAfterRebuild:r,singleDocRelPath:i}=e,a=e.inPlaceSkillDirs??new Set,o=I3(ve(t,n)),s=o.startsWith(`..`),c,l,u,d,f=0,p=0,m=0;function h(){let e=(0,R3.default)(),r=(0,R3.default)();e.add(`.git`);let i=[],a=0,h=0;for(let n of Y3){let o=M(t,n);if(g(o))try{let t=S(o,`utf-8`);a+=t.length;let s=Q3(t);i.push(...s),e.add(s),n===`.okignore`&&r.add(s)}catch(e){z3.warn({path:o,err:e},`Failed to read ${n} at ${o}`)}}if(o&&!s)for(let t of Y3){let i=M(n,t);if(g(i))try{let n=S(i,`utf-8`);a+=n.length,h++;let s=Q3(n).map(e=>$3(e,o));e.add(s),t===`.okignore`&&r.add(s)}catch(e){z3.warn({path:i,err:e},`Failed to read ${t} at ${i}`)}}let _={value:a};h+=e6(n,t,e,r,_),a=_.value;let v=t_e(t,_);a=_.value,v.length>0&&(i.push(...v),e.add(v));let y=i.filter(e=>e.length>0&&!e.startsWith(`!`)&&!e.startsWith(`#`)&&!qge(e));return c=e,l=r,u=i,d=y,f=i.length,p=h,m=a,{patternCount:f,nestedFileCount:p,bytes:m}}h();let _=new Map;function v(e){if(s)return!1;let t=o?`${o}/${e}`:e;return c.ignores(t)}function y(e){if(s)return!1;let t=o?`${o}/${e}`:e;return l.ignores(t)}let b=()=>{i===void 0&&Z3(n,``,v,_)};b();function x(e){return Dge(Sge(e))}function C(e){for(let t of e.split(`/`))if(B3.has(t))return!0;return s?!1:v(e)}return{isExcluded(e,t){if(x(e)||J3(e)||q3(e))return!0;if(!t?.bypassFilters&&(H3(e)||G3(e,a)&&!v(e))){if(i!==void 0)return e!==i;if(E3(e))return!1;let t=he(e).slice(1).toLowerCase();return!ss.has(t)}if(!t?.bypassFilters&&W3(e))return i===void 0?!1:e!==i;if(V3(e,t?.showOk)||K3(e))return!0;if(i!==void 0)return e!==i;if(t?.bypassFilters)return t.respectOkignore===!0&&y(e);if(C(e))return!0;if(E3(e))return!1;let n=he(e).slice(1).toLowerCase();if(ss.has(n)){let t=me(e),n=t===`.`?``:t;if((_.get(n)??0)>0)return!1}return!0},isDirExcluded(e,t){if(q3(e))return!0;if(!t?.bypassFilters&&(Kge(e)||Jge(e)||Yge(e,a)))return!1;if(V3(e,t?.showOk))return!0;if(i!==void 0)return!e_e(e,i);if(t?.bypassFilters)return t.respectOkignore===!0&&(y(e)||y(`${e}/`));for(let t of e.split(`/`))if(B3.has(t))return!0;if(s)return!1;let n=o?`${o}/${e}`:e;return c.ignores(n)||c.ignores(`${n}/`)},isPathIgnored(e,t){return x(e)||J3(e)||q3(e)?!0:H3(e)||G3(e,a)&&!v(e)||W3(e)?!1:V3(e)||K3(e)?!0:t?.bypassFilters?!1:C(e)},getWatcherIgnoreGlobs(){return d},incrementMdDir(e){let t=e===`.`?``:e;_.set(t,(_.get(t)??0)+1)},decrementMdDir(e){let t=e===`.`?``:e,n=_.get(t)??0;n<=1?_.delete(t):_.set(t,n-1)},rebuildDirCount(){let e=new Map(_);_.clear();try{b()}catch(t){for(let[t,n]of e)_.set(t,n);z3.warn({err:t instanceof Error?t:Error(String(t))},`content-filter rebuildDirCount walk failed — retaining previous counts`)}},async rebuildIgnorePatterns(){if(e.rescanInPlaceSkillDirs)try{a=e.rescanInPlaceSkillDirs()}catch(e){z3.warn({err:e},`in-place skill re-scan failed — keeping previous allow-list`)}let t=c,n=l,i=u,o=d,s=f,g=p,v=m,y=Date.now();return Cpe(`config.ignore.rebuild`,{attributes:{}},async e=>{try{let t=h();_.clear(),b();let n=Date.now()-y;if(e.setAttributes({"ok.ignore.pattern_count":t.patternCount,"ok.ignore.nested_file_count":t.nestedFileCount,"ok.ignore.bytes":t.bytes}),z3.info({patternCount:t.patternCount,nestedFileCount:t.nestedFileCount,bytes:t.bytes,durationMs:n},`content-filter rebuild succeeded`),r)try{r()}catch(e){z3.warn({err:e instanceof Error?e:Error(String(e))},`content-filter onAfterRebuild callback threw — derived views may be stale`)}return{ok:!0,patternCount:t.patternCount,nestedFileCount:t.nestedFileCount,bytes:t.bytes,durationMs:n}}catch(e){c=t,l=n,u=i,d=o,f=s,p=g,m=v,_.clear();try{b()}catch(e){z3.warn({err:e instanceof Error?e:Error(String(e))},`content-filter rollback dirCount re-walk failed — sibling-asset counts may be stale until next rebuild`)}let r=e instanceof Error?e.message:String(e);return z3.warn({err:e instanceof Error?e:Error(r)},`content-filter rebuild failed — rolled back to previous state`),{ok:!1,error:{message:r}}}})}}}function Z3(e,t,n,r){let i;try{i=C(e,{withFileTypes:!0})}catch(t){z3.warn({dir:e,err:t},`Failed to read directory for dir-count: ${e}`);return}for(let a of i){let i=t?`${t}/${a.name}`:a.name;if(a.isDirectory()){if(B3.has(a.name)||n(i)||n(`${i}/`))continue;Z3(M(e,a.name),i,n,r)}else a.isFile()&&E3(a.name)&&!n(i)&&r.set(t,(r.get(t)??0)+1)}}function Q3(e){return e.split(`
428
+ `);a=e[0],i=e[1]}yield{file:r,key:a,value:i}}}var X0,sme=x1({"src/lib/responses/ConfigList.ts"(){b0(),X0=class{constructor(){this.files=[],this.values=Object.create(null)}get all(){return this._all||=this.files.reduce((e,t)=>Object.assign(e,this.values[t]),{}),this._all}addFile(e){if(!(e in this.values)){let t=P1(this.files);this.values[e]=t?Object.create(this.values[t]):{},this.files.push(e)}return this.values[e]}addValue(e,t,n){let r=this.addFile(e);Object.hasOwn(r,t)?Array.isArray(r[t])?r[t].push(n):r[t]=[r[t],n]:r[t]=n,this._all=void 0}}}});function Z0(e,t){return typeof e==`string`&&Object.hasOwn(Q0,e)?e:t}function cme(e,t,n,r){let i=[`config`,`--${r}`];return n&&i.push(`--add`),i.push(e,t),{commands:i,format:`utf-8`,parser(e){return e}}}function lme(e,t){let n=[`config`,`--null`,`--show-origin`,`--get-all`,e];return t&&n.splice(1,0,`--${t}`),{commands:n,format:`utf-8`,parser(t){return ame(t,e)}}}function ume(e){let t=[`config`,`--list`,`--show-origin`,`--null`];return e&&t.push(`--${e}`),{commands:t,format:`utf-8`,parser(e){return ime(e)}}}function dme(){return{addConfig(e,t,...n){return this._runTask(cme(e,t,n[0]===!0,Z0(n[1],`local`)),g0(arguments))},getConfig(e,t){return this._runTask(lme(e,Z0(t,void 0)),g0(arguments))},listConfig(...e){return this._runTask(ume(Z0(e[0],void 0)),g0(arguments))}}}var Q0,$0=x1({"src/lib/tasks/config.ts"(){sme(),b0(),Q0=(e=>(e.system=`system`,e.global=`global`,e.local=`local`,e.worktree=`worktree`,e))(Q0||{})}});function fme(e){return t2.has(e)}var e2,t2,n2=x1({"src/lib/tasks/diff-name-status.ts"(){e2=(e=>(e.ADDED=`A`,e.COPIED=`C`,e.DELETED=`D`,e.MODIFIED=`M`,e.RENAMED=`R`,e.CHANGED=`T`,e.UNMERGED=`U`,e.UNKNOWN=`X`,e.BROKEN=`B`,e))(e2||{}),t2=new Set(Object.values(e2))}});function pme(...e){return new o2().param(...e)}function mme(e){let t=new Set,n={};return L1(e,e=>{let[r,i,a]=e.split(J1);t.add(r),(n[r]=n[r]||[]).push({line:W1(i),path:r,preview:a})}),{paths:t,results:n}}function hme(){return{grep(e){let t=g0(arguments),n=m0(arguments);for(let e of r2)if(n.includes(e))return this._runTask(P0(`git.grep: use of "${e}" is not supported.`),t);typeof e==`string`&&(e=pme().param(e));let r=[`grep`,`--null`,`-n`,`--full-name`,...n,...e];return this._runTask({commands:r,format:`utf-8`,parser(e){return mme(e)}},t)}}}var r2,i2,a2,o2,s2=x1({"src/lib/tasks/grep.ts"(){b0(),B0(),r2=[`-h`],i2=Symbol(`grepQuery`),o2=class{constructor(){this[a2]=[]}*[(a2=i2,Symbol.iterator)](){for(let e of this[i2])yield e}and(...e){return e.length&&this[i2].push(`--and`,`(`,...G1(e,`-e`),`)`),this}param(...e){return this[i2].push(...G1(e,`-e`)),this}}}}),c2={};S1(c2,{ResetMode:()=>u2,getResetMode:()=>_me,resetTask:()=>gme});function gme(e,t){let n=[`reset`];return l2(e)&&n.push(`--${e}`),n.push(...t),F0(n)}function _me(e){if(l2(e))return e;switch(typeof e){case`string`:case`undefined`:return`soft`}}function l2(e){return typeof e==`string`&&d2.includes(e)}var u2,d2,f2=x1({"src/lib/tasks/reset.ts"(){b0(),B0(),u2=(e=>(e.MIXED=`mixed`,e.SOFT=`soft`,e.HARD=`hard`,e.MERGE=`merge`,e.KEEP=`keep`,e))(u2||{}),d2=U1(Object.values(u2))}});function vme(){return(0,m1.default)(`simple-git`)}function p2(e,t,n){return!t||!String(t).replace(/\s*/,``)?n?(t,...r)=>{e(t,...r),n(t,...r)}:e:(r,...i)=>{e(`%s ${r}`,t,...i),n&&n(r,...i)}}function yme(e,t,{namespace:n}){if(typeof e==`string`)return e;let r=t&&t.namespace||``;return r.startsWith(n)?r.substr(n.length+1):r||n}function m2(e,t,n,r=vme()){let i=e&&`[${e}]`||``,a=[],o=typeof t==`string`?r.extend(t):t,s=yme(Q1(t,i0),o,r);return l(n);function c(t,n){return z1(a,m2(e,s.replace(/^[^:]+/,t),n,r))}function l(t){let n=t&&`[${t}]`||``,a=o&&p2(o,n)||Y1,s=p2(r,`${i} ${n}`,a);return Object.assign(o?a:s,{label:e,sibling:c,info:s,step:l})}}var h2=x1({"src/lib/git-logger.ts"(){b0(),m1.default.formatters.L=e=>String(o0(e)?e.length:`-`),m1.default.formatters.B=e=>Buffer.isBuffer(e)?e.toString(`utf8`):X1(e)}}),g2,bme=x1({"src/lib/runners/tasks-pending-queue.ts"(){T1(),h2(),g2=class e{constructor(e=`GitExecutor`){this.logLabel=e,this._queue=new Map}withProgress(e){return this._queue.get(e)}createProgress(t){let n=e.getName(t.commands[0]);return{task:t,logger:m2(this.logLabel,n),name:n}}push(e){let t=this.createProgress(e);return t.logger(`Adding task to the queue, commands = %o`,e.commands),this._queue.set(e,t),t}fatal(e){for(let[t,{logger:n}]of Array.from(this._queue.entries()))t===e.task?(n.info(`Failed %o`,e),n(`Fatal exception, any as-yet un-started tasks run through this executor will not be attempted`)):n.info(`A fatal exception occurred in a previous task, the queue has been purged: %o`,e.message),this.complete(t);if(this._queue.size!==0)throw Error(`Queue size should be zero after fatal: ${this._queue.size}`)}complete(e){this.withProgress(e)&&this._queue.delete(e)}attempt(e){let t=this.withProgress(e);if(!t)throw new w1(void 0,`TasksPendingQueue: attempt called for an unknown task`);return t.logger(`Starting task`),t}static getName(t=`empty`){return`task:${t}:${++e.counter}`}static{this.counter=0}}}});function _2(e,t){return{method:N1(e.commands)||``,commands:t}}function xme(e,t){return n=>{t(`[ERROR] child process exception %o`,n),e.push(Buffer.from(String(n.stack),`ascii`))}}function v2(e,t,n,r){return i=>{n(`%s received %L bytes`,t,i),r(`%B`,i),e.push(i)}}var y2,Sme=x1({"src/lib/runners/git-executor-chain.ts"(){T1(),B0(),b0(),bme(),y2=class{constructor(e,t,n){this._executor=e,this._scheduler=t,this._plugins=n,this._chain=Promise.resolve(),this._queue=new g2}get cwd(){return this._cwd||this._executor.cwd}set cwd(e){this._cwd=e}get env(){return this._executor.env}get outputHandler(){return this._executor.outputHandler}chain(){return this}push(e){return this._queue.push(e),this._chain=this._chain.then(()=>this.attemptTask(e))}async attemptTask(e){let t=await this._scheduler.next(),n=()=>this._queue.complete(e);try{let{logger:t}=this._queue.attempt(e);return await(R0(e)?this.attemptEmptyTask(e,t):this.attemptRemoteTask(e,t))}catch(t){throw this.onFatalException(e,t)}finally{n(),t()}}onFatalException(e,t){let n=t instanceof w1?Object.assign(t,{task:e}):new w1(e,t&&String(t));return this._chain=Promise.resolve(),this._queue.fatal(n),n}async attemptRemoteTask(e,t){let n=this._plugins.exec(`spawn.binary`,``,_2(e,e.commands)),r=this._plugins.exec(`spawn.args`,[...e.commands],{..._2(e,e.commands),env:{...this.env}}),i=await this.gitResponse(e,n,r,this.outputHandler,t.step(`SPAWN`)),a=await this.handleTaskData(e,r,i,t.step(`HANDLE`));return t(`passing response to task's parser as a %s`,e.format),L0(e)?_0(e.parser,a):_0(e.parser,a.asStrings())}async attemptEmptyTask(e,t){return t(`empty task bypassing child process to call to task's parser`),e.parser(this)}handleTaskData(e,t,n,r){let{exitCode:i,rejection:a,stdOut:o,stdErr:s}=n;return new Promise((c,l)=>{r(`Preparing to handle process response exitCode=%d stdOut=`,i);let{error:u}=this._plugins.exec(`task.error`,{error:a},{..._2(e,t),...n});if(u&&e.onError)return r.info(`exitCode=%s handling with custom error handler`),e.onError(n,u,e=>{r.info(`custom error handler treated as success`),r(`custom error returned a %s`,X1(e)),c(new l0(Array.isArray(e)?Buffer.concat(e):e,Buffer.concat(s)))},l);if(u)return r.info(`handling as error: exitCode=%s stdErr=%s rejection=%o`,i,s.length,a),l(u);r.info(`retrieving task output complete`),c(new l0(Buffer.concat(o),Buffer.concat(s)))})}async gitResponse(e,t,n,r,i){let a=i.sibling(`output`),o=this._plugins.exec(`spawn.options`,{cwd:this.cwd,env:this.env,windowsHide:!0},_2(e,e.commands));return new Promise(s=>{let c=[],l=[];i.info(`%s %o`,t,n),i(`%O`,o);let u=this._beforeSpawn(e,n);if(u)return s({stdOut:c,stdErr:l,exitCode:9901,rejection:u});this._plugins.exec(`spawn.before`,void 0,{..._2(e,n),kill(e){u=e||u}});let d=Fe(t,n,o);d.stdout.on(`data`,v2(c,`stdOut`,i,a.step(`stdOut`))),d.stderr.on(`data`,v2(l,`stdErr`,i,a.step(`stdErr`))),d.on(`error`,xme(l,i)),r&&(i(`Passing child process stdOut/stdErr to custom outputHandler`),r(t,d.stdout,d.stderr,[...n])),this._plugins.exec(`spawn.after`,void 0,{..._2(e,n),spawned:d,close(e,t){s({stdOut:c,stdErr:l,exitCode:e,rejection:u||t})},kill(e){d.killed||(u=e,d.kill(`SIGINT`))}})})}_beforeSpawn(e,t){let n;return this._plugins.exec(`spawn.before`,void 0,{..._2(e,t),kill(e){n=e||n}}),n}}}}),b2={};S1(b2,{GitExecutor:()=>x2});var x2,Cme=x1({"src/lib/runners/git-executor.ts"(){Sme(),x2=class{constructor(e,t,n){this.cwd=e,this._scheduler=t,this._plugins=n,this._chain=new y2(this,this._scheduler,this._plugins)}chain(){return new y2(this,this._scheduler,this._plugins)}push(e){return this._chain.push(e)}}}});function wme(e,t,n=Y1){t.then(e=>{n(null,e)},t=>{t?.task===e&&n(t instanceof E1?Tme(t):t,void 0)})}function Tme(e){let t=e=>{console.warn(`simple-git deprecation notice: accessing GitResponseError.${e} should be GitResponseError.git.${e}, this will no longer be available in version 3`),t=Y1};return Object.create(e,Object.getOwnPropertyNames(e.git).reduce(n,{}));function n(n,r){return r in e||(n[r]={enumerable:!1,configurable:!1,get(){return t(r),e.git[r]}}),n}}var Eme=x1({"src/lib/task-callback.ts"(){D1(),b0()}});function S2(e,t){return N0(n=>{if(!R1(e))throw Error(`Git.cwd: cannot change to non-directory "${e}"`);return(t||n).cwd=e})}var Dme=x1({"src/lib/tasks/change-working-directory.ts"(){b0(),B0()}});function C2(e){let t=[`checkout`,...e];return t[1]===`-b`&&t.includes(`-B`)&&(t[1]=B1(t,`-B`)),F0(t)}function Ome(){return{checkout(){return this._runTask(C2(m0(arguments,1)),g0(arguments))},checkoutBranch(e,t){return this._runTask(C2([`-b`,e,t,...m0(arguments)]),g0(arguments))},checkoutLocalBranch(e){return this._runTask(C2([`-b`,e,...m0(arguments)]),g0(arguments))}}}var kme=x1({"src/lib/tasks/checkout.ts"(){b0(),B0()}});function Ame(){return{count:0,garbage:0,inPack:0,packs:0,prunePackable:0,size:0,sizeGarbage:0,sizePack:0}}function jme(){return{countObjects(){return this._runTask({commands:[`count-objects`,`--verbose`],format:`utf-8`,parser(e){return v0(Ame(),[w2],e)}})}}}var w2,Mme=x1({"src/lib/tasks/count-objects.ts"(){b0(),w2=new u0(/([a-z-]+): (\d+)$/,(e,[t,n])=>{let r=H1(t);Object.hasOwn(e,r)&&(e[r]=W1(n))})}});function Nme(e){return v0({author:null,branch:``,commit:``,root:!1,summary:{changes:0,insertions:0,deletions:0}},T2,e)}var T2,Pme=x1({"src/lib/parsers/parse-commit.ts"(){b0(),T2=[new u0(/^\[([^\s]+)( \([^)]+\))? ([^\]]+)/,(e,[t,n,r])=>{e.branch=t,e.commit=r,e.root=!!n}),new u0(/\s*Author:\s(.+)/i,(e,[t])=>{let n=t.split(`<`),r=n.pop();!r||!r.includes(`@`)||(e.author={email:r.substr(0,r.length-1),name:n.join(`<`).trim()})}),new u0(/(\d+)[^,]*(?:,\s*(\d+)[^,]*)(?:,\s*(\d+))/g,(e,[t,n,r])=>{e.summary.changes=parseInt(t,10)||0,e.summary.insertions=parseInt(n,10)||0,e.summary.deletions=parseInt(r,10)||0}),new u0(/^(\d+)[^,]*(?:,\s*(\d+)[^(]+\(([+-]))?/,(e,[t,n,r])=>{e.summary.changes=parseInt(t,10)||0;let i=parseInt(n,10)||0;r===`-`?e.summary.deletions=i:r===`+`&&(e.summary.insertions=i)})]}});function Fme(e,t,n){return{commands:[`-c`,`core.abbrev=40`,`commit`,...G1(e,`-m`),...t,...n],format:`utf-8`,parser:Nme}}function Ime(){return{commit(t,...n){let r=g0(arguments),i=e(t)||Fme(V1(t),V1(Q1(n[0],a0,[])),[...U1(Q1(n[1],n0,[])),...m0(arguments,0,!0)]);return this._runTask(i,r)}};function e(e){return!a0(e)&&P0(`git.commit: requires the commit message to be supplied as a string/string[]`)}}var Lme=x1({"src/lib/tasks/commit.ts"(){Pme(),b0(),B0()}});function Rme(){return{firstCommit(){return this._runTask(F0([`rev-list`,`--max-parents=0`,`HEAD`],!0),g0(arguments))}}}var zme=x1({"src/lib/tasks/first-commit.ts"(){b0(),B0()}});function Bme(e,t){let n=[`hash-object`,e];return t&&n.push(`-w`),F0(n,!0)}var Vme=x1({"src/lib/tasks/hash-object.ts"(){B0()}});function Hme(e,t,n){let r=String(n).trim(),i;if(i=D2.exec(r))return new E2(e,t,!1,i[1]);if(i=O2.exec(r))return new E2(e,t,!0,i[1]);let a=``,o=r.split(` `);for(;o.length;)if(o.shift()===`in`){a=o.join(` `);break}return new E2(e,t,/^re/i.test(r),a)}var E2,D2,O2,Ume=x1({"src/lib/responses/InitSummary.ts"(){E2=class{constructor(e,t,n,r){this.bare=e,this.path=t,this.existing=n,this.gitDir=r}},D2=/^Init.+ repository in (.+)$/,O2=/^Rein.+ in (.+)$/}});function Wme(e){return e.includes(k2)}function Gme(e=!1,t,n){let r=[`init`,...n];return e&&!Wme(r)&&r.splice(1,0,k2),{commands:r,format:`utf-8`,parser(e){return Hme(r.includes(`--bare`),t,e)}}}var k2,Kme=x1({"src/lib/tasks/init.ts"(){Ume(),k2=`--bare`}});function A2(e){for(let t=0;t<e.length;t++){let n=j2.exec(e[t]);if(n)return`--${n[1]}`}return``}function qme(e){return j2.test(e)}var j2,M2=x1({"src/lib/args/log-format.ts"(){j2=/^--(stat|numstat|name-only|name-status)(=|$)/}}),N2,Jme=x1({"src/lib/responses/DiffSummary.ts"(){N2=class{constructor(){this.changed=0,this.deletions=0,this.insertions=0,this.files=[]}}}});function P2(e=``){let t=z2[e];return e=>v0(new N2,t,e,!1)}var F2,I2,L2,R2,z2,B2=x1({"src/lib/parsers/parse-diff-summary.ts"(){M2(),Jme(),n2(),b0(),F2=[new u0(/^(.+)\s+\|\s+(\d+)(\s+[+\-]+)?$/,(e,[t,n,r=``])=>{e.files.push({file:t.trim(),changes:W1(n),insertions:r.replace(/[^+]/g,``).length,deletions:r.replace(/[^-]/g,``).length,binary:!1})}),new u0(/^(.+) \|\s+Bin ([0-9.]+) -> ([0-9.]+) ([a-z]+)/,(e,[t,n,r])=>{e.files.push({file:t.trim(),before:W1(n),after:W1(r),binary:!0})}),new u0(/(\d+) files? changed\s*((?:, \d+ [^,]+){0,2})/,(e,[t,n])=>{let r=/(\d+) i/.exec(n),i=/(\d+) d/.exec(n);e.changed=W1(t),e.insertions=W1(r?.[1]),e.deletions=W1(i?.[1])})],I2=[new u0(/(\d+)\t(\d+)\t(.+)$/,(e,[t,n,r])=>{let i=W1(t),a=W1(n);e.changed++,e.insertions+=i,e.deletions+=a,e.files.push({file:r,changes:i+a,insertions:i,deletions:a,binary:!1})}),new u0(/-\t-\t(.+)$/,(e,[t])=>{e.changed++,e.files.push({file:t,after:0,before:0,binary:!0})})],L2=[new u0(/(.+)$/,(e,[t])=>{e.changed++,e.files.push({file:t,changes:0,insertions:0,deletions:0,binary:!1})})],R2=[new u0(/([ACDMRTUXB])([0-9]{0,3})\t(.[^\t]*)(\t(.[^\t]*))?$/,(e,[t,n,r,i,a])=>{e.changed++,e.files.push({file:a??r,changes:0,insertions:0,deletions:0,binary:!1,status:q1(fme(t)&&t),from:q1(!!a&&r!==a&&r),similarity:W1(n)})})],z2={"":F2,"--stat":F2,"--numstat":I2,"--name-status":R2,"--name-only":L2}}});function Yme(e,t){return t.reduce((t,n,r)=>(t[n]=e[r]||``,t),Object.create({diff:null}))}function V2(e=W2,t=G2,n=``){let r=P2(n);return function(n){let i=I1(n.trim(),!1,H2).map(function(n){let i=n.split(U2),a=Yme(i[0].split(e),t);return i.length>1&&i[1].trim()&&(a.diff=r(i[1])),a});return{all:i,latest:i.length&&i[0]||null,total:i.length}}}var H2,U2,W2,G2,K2=x1({"src/lib/parsers/parse-list-log-summary.ts"(){b0(),B2(),M2(),H2=`òòòòòò `,U2=` òò`,W2=` ò `,G2=[`hash`,`date`,`message`,`refs`,`author_name`,`author_email`]}}),q2={};S1(q2,{diffSummaryTask:()=>Xme,validateLogFormatConfig:()=>J2});function Xme(e){let t=A2(e),n=[`diff`];return t===``&&(t=`--stat`,n.push(`--stat=4096`)),n.push(...e),J2(n)||{commands:n,format:`utf-8`,parser:P2(t)}}function J2(e){let t=e.filter(qme);if(t.length>1)return P0(`Summary flags are mutually exclusive - pick one of ${t.join(`,`)}`);if(t.length&&e.includes(`-z`))return P0(`Summary flag ${t} parsing is not compatible with null termination option '-z'`)}var Y2=x1({"src/lib/tasks/diff.ts"(){M2(),B2(),B0()}});function Zme(e,t){let n=[],r=[];return Object.keys(e).forEach(t=>{n.push(t),r.push(String(e[t]))}),[n,r.join(t)]}function Qme(e){return Object.keys(e).reduce((t,n)=>(n in Z2||(t[n]=e[n]),t),{})}function X2(e={},t=[]){let n=Q1(e.splitter,i0,W2),[r,i]=Zme(e0(e.format)?e.format:{hash:`%H`,date:e.strictDate===!1?`%ai`:`%aI`,message:`%s`,refs:`%D`,body:e.multiLine?`%B`:`%b`,author_name:e.mailMap===!1?`%an`:`%aN`,author_email:e.mailMap===!1?`%ae`:`%aE`},n),a=[],o=[`--pretty=format:${H2}${i}${U2}`,...t],s=e.n||e[`max-count`]||e.maxCount;if(s&&o.push(`--max-count=${s}`),e.from||e.to){let t=e.symmetric===!1?`..`:`...`;a.push(`${e.from||``}${t}${e.to||``}`)}return i0(e.file)&&o.push(`--follow`,f1(e.file)),p0(Qme(e),o),{fields:r,splitter:n,commands:[...o,...a]}}function $me(e,t,n){let r=V2(e,t,A2(n));return{commands:[`log`,...n],format:`utf-8`,parser:r}}function ehe(){return{log(...n){let r=g0(arguments),i=X2(h0(arguments),U1(Q1(arguments[0],n0,[]))),a=t(...n)||J2(i.commands)||e(i);return this._runTask(a,r)}};function e(e){return $me(e.splitter,e.fields,e.commands)}function t(e,t){return i0(e)&&i0(t)&&P0(`git.log(string, string) should be replaced with git.log({ from: string, to: string })`)}}var Z2,Q2=x1({"src/lib/tasks/log.ts"(){M2(),K2(),b0(),B0(),Y2(),Z2=(e=>(e[e[`--pretty`]=0]=`--pretty`,e[e[`max-count`]=1]=`max-count`,e[e.maxCount=2]=`maxCount`,e[e.n=3]=`n`,e[e.file=4]=`file`,e[e.format=5]=`format`,e[e.from=6]=`from`,e[e.to=7]=`to`,e[e.splitter=8]=`splitter`,e[e.symmetric=9]=`symmetric`,e[e.mailMap=10]=`mailMap`,e[e.multiLine=11]=`multiLine`,e[e.strictDate=12]=`strictDate`,e))(Z2||{})}}),$2,e4,the=x1({"src/lib/responses/MergeSummary.ts"(){$2=class{constructor(e,t=null,n){this.reason=e,this.file=t,this.meta=n}toString(){return`${this.file}:${this.reason}`}},e4=class{constructor(){this.conflicts=[],this.merges=[],this.result=`success`}get failed(){return this.conflicts.length>0}get reason(){return this.result}toString(){return this.conflicts.length?`CONFLICTS: ${this.conflicts.join(`, `)}`:`OK`}}}}),t4,n4,nhe=x1({"src/lib/responses/PullSummary.ts"(){t4=class{constructor(){this.remoteMessages={all:[]},this.created=[],this.deleted=[],this.files=[],this.deletions={},this.insertions={},this.summary={changes:0,deletions:0,insertions:0}}},n4=class{constructor(){this.remote=``,this.hash={local:``,remote:``},this.branch={local:``,remote:``},this.message=``}toString(){return this.message}}}});function r4(e){return e.objects=e.objects||{compressing:0,counting:0,enumerating:0,packReused:0,reused:{count:0,delta:0},total:{count:0,delta:0}}}function i4(e){let t=/^\s*(\d+)/.exec(e),n=/delta (\d+)/i.exec(e);return{count:W1(t&&t[1]||`0`),delta:W1(n&&n[1]||`0`)}}var a4,rhe=x1({"src/lib/parsers/parse-remote-objects.ts"(){b0(),a4=[new d0(/^remote:\s*(enumerating|counting|compressing) objects: (\d+),/i,(e,[t,n])=>{let r=t.toLowerCase(),i=r4(e.remoteMessages);Object.assign(i,{[r]:W1(n)})}),new d0(/^remote:\s*(enumerating|counting|compressing) objects: \d+% \(\d+\/(\d+)\),/i,(e,[t,n])=>{let r=t.toLowerCase(),i=r4(e.remoteMessages);Object.assign(i,{[r]:W1(n)})}),new d0(/total ([^,]+), reused ([^,]+), pack-reused (\d+)/i,(e,[t,n,r])=>{let i=r4(e.remoteMessages);i.total=i4(t),i.reused=i4(n),i.packReused=W1(r)})]}});function o4(e,t){return v0({remoteMessages:new c4},s4,t)}var s4,c4,l4=x1({"src/lib/parsers/parse-remote-messages.ts"(){b0(),rhe(),s4=[new d0(/^remote:\s*(.+)$/,(e,[t])=>(e.remoteMessages.all.push(t.trim()),!1)),...a4,new d0([/create a (?:pull|merge) request/i,/\s(https?:\/\/\S+)$/],(e,[t])=>{e.remoteMessages.pullRequestUrl=t}),new d0([/found (\d+) vulnerabilities.+\(([^)]+)\)/i,/\s(https?:\/\/\S+)$/],(e,[t,n,r])=>{e.remoteMessages.vulnerabilities={count:W1(t),summary:n,url:r}})],c4=class{constructor(){this.all=[]}}}});function ihe(e,t){let n=v0(new n4,m4,[e,t]);return n.message&&n}var u4,d4,f4,p4,m4,h4,g4,_4=x1({"src/lib/parsers/parse-pull.ts"(){nhe(),b0(),l4(),u4=/^\s*(.+?)\s+\|\s+\d+\s*(\+*)(-*)/,d4=/(\d+)\D+((\d+)\D+\(\+\))?(\D+(\d+)\D+\(-\))?/,f4=/^(create|delete) mode \d+ (.+)/,p4=[new u0(u4,(e,[t,n,r])=>{e.files.push(t),n&&(e.insertions[t]=n.length),r&&(e.deletions[t]=r.length)}),new u0(d4,(e,[t,,n,,r])=>n!==void 0||r!==void 0?(e.summary.changes=+t||0,e.summary.insertions=+n||0,e.summary.deletions=+r||0,!0):!1),new u0(f4,(e,[t,n])=>{z1(e.files,n),z1(t===`create`?e.created:e.deleted,n)})],m4=[new u0(/^from\s(.+)$/i,(e,[t])=>void(e.remote=t)),new u0(/^fatal:\s(.+)$/,(e,[t])=>void(e.message=t)),new u0(/([a-z0-9]+)\.\.([a-z0-9]+)\s+(\S+)\s+->\s+(\S+)$/,(e,[t,n,r,i])=>{e.branch.local=r,e.hash.local=t,e.branch.remote=i,e.hash.remote=n})],h4=(e,t)=>v0(new t4,p4,[e,t]),g4=(e,t)=>Object.assign(new t4,h4(e,t),o4(e,t))}}),v4,y4,b4,ahe=x1({"src/lib/parsers/parse-merge.ts"(){the(),b0(),_4(),v4=[new u0(/^Auto-merging\s+(.+)$/,(e,[t])=>{e.merges.push(t)}),new u0(/^CONFLICT\s+\((.+)\): Merge conflict in (.+)$/,(e,[t,n])=>{e.conflicts.push(new $2(t,n))}),new u0(/^CONFLICT\s+\((.+\/delete)\): (.+) deleted in (.+) and/,(e,[t,n,r])=>{e.conflicts.push(new $2(t,n,{deleteRef:r}))}),new u0(/^CONFLICT\s+\((.+)\):/,(e,[t])=>{e.conflicts.push(new $2(t,null))}),new u0(/^Automatic merge failed;\s+(.+)$/,(e,[t])=>{e.result=t})],y4=(e,t)=>Object.assign(b4(e,t),g4(e,t)),b4=e=>v0(new e4,v4,e)}});function x4(e){return e.length?{commands:[`merge`,...e],format:`utf-8`,parser(e,t){let n=y4(e,t);if(n.failed)throw new E1(n);return n}}:P0(`Git.merge requires at least one option`)}var ohe=x1({"src/lib/tasks/merge.ts"(){D1(),ahe(),B0()}});function she(e,t,n){let r=n.includes(`deleted`),i=n.includes(`tag`)||/^refs\/tags/.test(e),a=!n.includes(`new`);return{deleted:r,tag:i,branch:!i,new:!a,alreadyUpdated:a,local:e,remote:t}}var S4,C4,w4,che=x1({"src/lib/parsers/parse-push.ts"(){b0(),l4(),S4=[new u0(/^Pushing to (.+)$/,(e,[t])=>{e.repo=t}),new u0(/^updating local tracking ref '(.+)'/,(e,[t])=>{e.ref={...e.ref||{},local:t}}),new u0(/^[=*-]\s+([^:]+):(\S+)\s+\[(.+)]$/,(e,[t,n,r])=>{e.pushed.push(she(t,n,r))}),new u0(/^Branch '([^']+)' set up to track remote branch '([^']+)' from '([^']+)'/,(e,[t,n,r])=>{e.branch={...e.branch||{},local:t,remote:n,remoteName:r}}),new u0(/^([^:]+):(\S+)\s+([a-z0-9]+)\.\.([a-z0-9]+)$/,(e,[t,n,r,i])=>{e.update={head:{local:t,remote:n},hash:{from:r,to:i}}})],C4=(e,t)=>{let n=w4(e,t),r=o4(e,t);return{...n,...r}},w4=(e,t)=>v0({pushed:[]},S4,[e,t])}}),T4={};S1(T4,{pushTagsTask:()=>lhe,pushTask:()=>E4});function lhe(e={},t){return z1(t,`--tags`),E4(e,t)}function E4(e={},t){let n=[`push`,...t];return e.branch&&n.splice(1,0,e.branch),e.remote&&n.splice(1,0,e.remote),B1(n,`-v`),z1(n,`--verbose`),z1(n,`--porcelain`),{commands:n,format:`utf-8`,parser:C4}}var D4=x1({"src/lib/tasks/push.ts"(){che(),b0()}});function uhe(){return{showBuffer(){let e=[`show`,...m0(arguments,1)];return e.includes(`--binary`)||e.splice(1,0,`--binary`),this._runTask(I0(e),g0(arguments))},show(){let e=[`show`,...m0(arguments,1)];return this._runTask(F0(e),g0(arguments))}}}var dhe=x1({"src/lib/tasks/show.ts"(){b0(),B0()}}),O4,k4,fhe=x1({"src/lib/responses/FileStatusSummary.ts"(){O4=/^(.+)\0(.+)$/,k4=class{constructor(e,t,n){if(this.path=e,this.index=t,this.working_dir=n,t===`R`||n===`R`){let t=O4.exec(e)||[null,e,e];this.from=t[2]||``,this.path=t[1]||``}}}}});function A4(e){let[t,n]=e.split(J1);return{from:n||t,to:t}}function j4(e,t,n){return[`${e}${t}`,n]}function M4(e,...t){return t.map(t=>j4(e,t,(e,t)=>e.conflicted.push(t)))}function phe(e,t){let n=t.trim();switch(` `){case n.charAt(2):return r(n.charAt(0),n.charAt(1),n.slice(3));case n.charAt(1):return r(` `,n.charAt(0),n.slice(2));default:return}function r(t,n,r){let i=`${t}${n}`,a=P4.get(i);a&&a(e,r),i!==`##`&&i!==`!!`&&e.files.push(new k4(r,t,n))}}var N4,P4,F4,mhe=x1({"src/lib/responses/StatusSummary.ts"(){b0(),fhe(),N4=class{constructor(){this.not_added=[],this.conflicted=[],this.created=[],this.deleted=[],this.ignored=void 0,this.modified=[],this.renamed=[],this.files=[],this.staged=[],this.ahead=0,this.behind=0,this.current=null,this.tracking=null,this.detached=!1,this.isClean=()=>!this.files.length}},P4=new Map([j4(` `,`A`,(e,t)=>e.created.push(t)),j4(` `,`D`,(e,t)=>e.deleted.push(t)),j4(` `,`M`,(e,t)=>e.modified.push(t)),j4(`A`,` `,(e,t)=>{e.created.push(t),e.staged.push(t)}),j4(`A`,`M`,(e,t)=>{e.created.push(t),e.staged.push(t),e.modified.push(t)}),j4(`D`,` `,(e,t)=>{e.deleted.push(t),e.staged.push(t)}),j4(`M`,` `,(e,t)=>{e.modified.push(t),e.staged.push(t)}),j4(`M`,`M`,(e,t)=>{e.modified.push(t),e.staged.push(t)}),j4(`R`,` `,(e,t)=>{e.renamed.push(A4(t))}),j4(`R`,`M`,(e,t)=>{let n=A4(t);e.renamed.push(n),e.modified.push(n.to)}),j4(`!`,`!`,(e,t)=>{(e.ignored=e.ignored||[]).push(t)}),j4(`?`,`?`,(e,t)=>e.not_added.push(t)),...M4(`A`,`A`,`U`),...M4(`D`,`D`,`U`),...M4(`U`,`A`,`D`,`U`),[`##`,(e,t)=>{let n=/ahead (\d+)/,r=/behind (\d+)/,i=/^(.+?(?=(?:\.{3}|\s|$)))/,a=/\.{3}(\S*)/,o=/\son\s(\S+?)(?=\.{3}|$)/,s=n.exec(t);e.ahead=s&&+s[1]||0,s=r.exec(t),e.behind=s&&+s[1]||0,s=i.exec(t),e.current=Q1(s?.[1],i0,null),s=a.exec(t),e.tracking=Q1(s?.[1],i0,null),s=o.exec(t),s&&(e.current=Q1(s?.[1],i0,e.current)),e.detached=/\(no branch\)/.test(t)}]]),F4=function(e){let t=e.split(J1),n=new N4;for(let e=0,r=t.length;e<r;){let r=t[e++].trim();r&&(r.charAt(0)===`R`&&(r+=J1+(t[e++]||``)),phe(n,r))}return n}}});function hhe(e){return{format:`utf-8`,commands:[`status`,`--porcelain`,`-b`,`-u`,`--null`,...e.filter(e=>!I4.includes(e))],parser(e){return F4(e)}}}var I4,ghe=x1({"src/lib/tasks/status.ts"(){mhe(),I4=[`--null`,`-z`]}});function L4(e=0,t=0,n=0,r=``,i=!0){return Object.defineProperty({major:e,minor:t,patch:n,agent:r,installed:i},`toString`,{value(){return`${this.major}.${this.minor}.${this.patch}`},configurable:!1,enumerable:!1})}function _he(){return L4(0,0,0,``,!1)}function vhe(){return{version(){return this._runTask({commands:[`--version`],format:`utf-8`,parser:yhe,onError(e,t,n,r){if(e.exitCode===-2)return n(Buffer.from(R4));r(t)}})}}}function yhe(e){return e===R4?_he():v0(L4(0,0,0,e),z4,e)}var R4,z4,bhe=x1({"src/lib/tasks/version.ts"(){b0(),R4=`installed=false`,z4=[new u0(/version (\d+)\.(\d+)\.(\d+)(?:\s*\((.+)\))?/,(e,[t,n,r,i=``])=>{Object.assign(e,L4(W1(t),W1(n),W1(r),i))}),new u0(/version (\d+)\.(\d+)\.(\D+)(.+)?$/,(e,[t,n,r,i=``])=>{Object.assign(e,L4(W1(t),W1(n),r,i))})]}});function B4(e,t,n,...r){return i0(n)?t(n,Q1(r[0],i0),m0(arguments)):P0(`git.${e}() requires a string 'repoPath'`)}function xhe(){return{clone(e,...t){return this._runTask(B4(`clone`,V4,Q1(e,i0),...t),g0(arguments))},mirror(e,...t){return this._runTask(B4(`mirror`,H4,Q1(e,i0),...t),g0(arguments))}}}var V4,H4,She=x1({"src/lib/tasks/clone.ts"(){B0(),b0(),V4=(e,t,n)=>{let r=[`clone`,...n];return i0(e)&&r.push(f1(e)),i0(t)&&r.push(f1(t)),F0(r)},H4=(e,t,n)=>(z1(n,`--mirror`),V4(e,t,n))}}),U4={};S1(U4,{SimpleGitApi:()=>W4});var W4,Che=x1({"src/lib/simple-git-api.ts"(){Eme(),Dme(),kme(),Mme(),Lme(),$0(),zme(),s2(),Vme(),Kme(),Q2(),ohe(),D4(),dhe(),ghe(),B0(),bhe(),b0(),She(),W4=class{constructor(e){this._executor=e}_runTask(e,t){let n=this._executor.chain(),r=n.push(e);return t&&wme(e,r,t),Object.create(this,{then:{value:r.then.bind(r)},catch:{value:r.catch.bind(r)},_executor:{value:n}})}add(e){return this._runTask(F0([`add`,...V1(e)]),g0(arguments))}cwd(e){let t=g0(arguments);return typeof e==`string`?this._runTask(S2(e,this._executor),t):typeof e?.path==`string`?this._runTask(S2(e.path,e.root&&this._executor||void 0),t):this._runTask(P0(`Git.cwd: workingDirectory must be supplied as a string`),t)}hashObject(e,t){return this._runTask(Bme(e,t===!0),g0(arguments))}init(e){return this._runTask(Gme(e===!0,this._executor.cwd,m0(arguments)),g0(arguments))}merge(){return this._runTask(x4(m0(arguments)),g0(arguments))}mergeFromTo(e,t){return i0(e)&&i0(t)?this._runTask(x4([e,t,...m0(arguments)]),g0(arguments,!1)):this._runTask(P0(`Git.mergeFromTo requires that the 'remote' and 'branch' arguments are supplied as strings`))}outputHandler(e){return this._executor.outputHandler=e,this}push(){let e=E4({remote:Q1(arguments[0],i0),branch:Q1(arguments[1],i0)},m0(arguments));return this._runTask(e,g0(arguments))}stash(){return this._runTask(F0([`stash`,...m0(arguments)]),g0(arguments))}status(){return this._runTask(hhe(m0(arguments)),g0(arguments))}},Object.assign(W4.prototype,Ome(),xhe(),Ime(),dme(),jme(),Rme(),hme(),ehe(),uhe(),vhe())}}),G4={};S1(G4,{Scheduler:()=>q4});var K4,q4,whe=x1({"src/lib/runners/scheduler.ts"(){b0(),h2(),K4=(()=>{let e=0;return()=>{e++;let{promise:t,done:n}=(0,h1.createDeferred)();return{promise:t,done:n,id:e}}})(),q4=class{constructor(e=2){this.concurrency=e,this.logger=m2(``,`scheduler`),this.pending=[],this.running=[],this.logger(`Constructed, concurrency=%s`,e)}schedule(){if(!this.pending.length||this.running.length>=this.concurrency){this.logger(`Schedule attempt ignored, pending=%s running=%s concurrency=%s`,this.pending.length,this.running.length,this.concurrency);return}let e=z1(this.running,this.pending.shift());this.logger(`Attempting id=%s`,e.id),e.done(()=>{this.logger(`Completing id=`,e.id),B1(this.running,e),this.schedule()})}next(){let{promise:e,id:t}=z1(this.pending,K4());return this.logger(`Scheduling id=%s`,t),this.schedule(),e}}}}),J4={};S1(J4,{applyPatchTask:()=>The});function The(e,t){return F0([`apply`,...t,...e])}var Ehe=x1({"src/lib/tasks/apply-patch.ts"(){B0()}});function Dhe(e,t){return{branch:e,hash:t,success:!0}}function Ohe(e){return{branch:e,hash:null,success:!1}}var Y4,khe=x1({"src/lib/responses/BranchDeleteSummary.ts"(){Y4=class{constructor(){this.all=[],this.branches={},this.errors=[]}get success(){return!this.errors.length}}}});function X4(e,t){return t===1&&Q4.test(e)}var Z4,Q4,$4,e3,Ahe=x1({"src/lib/parsers/parse-branch-delete.ts"(){khe(),b0(),Z4=/(\S+)\s+\(\S+\s([^)]+)\)/,Q4=/^error[^']+'([^']+)'/m,$4=[new u0(Z4,(e,[t,n])=>{let r=Dhe(t,n);e.all.push(r),e.branches[t]=r}),new u0(Q4,(e,[t])=>{let n=Ohe(t);e.errors.push(n),e.all.push(n),e.branches[t]=n})],e3=(e,t)=>v0(new Y4,$4,[e,t])}}),t3,jhe=x1({"src/lib/responses/BranchSummary.ts"(){t3=class{constructor(){this.all=[],this.branches={},this.current=``,this.detached=!1}push(e,t,n,r,i){e===`*`&&(this.detached=t,this.current=n),this.all.push(n),this.branches[n]={current:e===`*`,linkedWorkTree:e===`+`,name:n,commit:r,label:i}}}}});function n3(e){return e?e.charAt(0):``}function r3(e,t=!1){return v0(new t3,t?[a3]:i3,e)}var i3,a3,Mhe=x1({"src/lib/parsers/parse-branch.ts"(){jhe(),b0(),i3=[new u0(/^([*+]\s)?\((?:HEAD )?detached (?:from|at) (\S+)\)\s+([a-z0-9]+)\s(.*)$/,(e,[t,n,r,i])=>{e.push(n3(t),!0,n,r,i)}),new u0(/^([*+]\s)?(\S+)\s+([a-z0-9]+)\s?(.*)$/s,(e,[t,n,r,i])=>{e.push(n3(t),!1,n,r,i)})],a3=new u0(/^(\S+)$/s,(e,[t])=>{e.push(`*`,!1,t,``,``)})}}),o3={};S1(o3,{branchLocalTask:()=>Phe,branchTask:()=>Nhe,containsDeleteBranchCommand:()=>s3,deleteBranchTask:()=>Ihe,deleteBranchesTask:()=>Fhe});function s3(e){let t=[`-d`,`-D`,`--delete`];return e.some(e=>t.includes(e))}function Nhe(e){let t=s3(e),n=e.includes(`--show-current`),r=[`branch`,...e];return r.length===1&&r.push(`-a`),r.includes(`-v`)||r.splice(1,0,`-v`),{format:`utf-8`,commands:r,parser(e,r){return t?e3(e,r).all[0]:r3(e,n)}}}function Phe(){return{format:`utf-8`,commands:[`branch`,`-v`],parser(e){return r3(e)}}}function Fhe(e,t=!1){return{format:`utf-8`,commands:[`branch`,`-v`,t?`-D`:`-d`,...e],parser(e,t){return e3(e,t)},onError({exitCode:e,stdOut:t},n,r,i){if(!X4(String(n),e))return i(n);r(t)}}}function Ihe(e,t=!1){let n={format:`utf-8`,commands:[`branch`,`-v`,t?`-D`:`-d`,e],parser(t,n){return e3(t,n).branches[e]},onError({exitCode:e,stdErr:t,stdOut:r},i,a,o){if(!X4(String(i),e))return o(i);throw new E1(n.parser(K1(r),K1(t)),String(i))}};return n}var Lhe=x1({"src/lib/tasks/branch.ts"(){D1(),Ahe(),Mhe(),b0()}});function Rhe(e){let t=e.trim().replace(/^["']|["']$/g,``);return t&&ge(t)}var c3,zhe=x1({"src/lib/responses/CheckIgnore.ts"(){c3=e=>e.split(/\n/g).map(Rhe).filter(Boolean)}}),l3={};S1(l3,{checkIgnoreTask:()=>Bhe});function Bhe(e){return{commands:[`check-ignore`,...e],format:`utf-8`,parser:c3}}var Vhe=x1({"src/lib/tasks/check-ignore.ts"(){zhe()}});function Hhe(e,t){return v0({raw:e,remote:null,branches:[],tags:[],updated:[],deleted:[]},u3,[e,t])}var u3,Uhe=x1({"src/lib/parsers/parse-fetch.ts"(){b0(),u3=[new u0(/From (.+)$/,(e,[t])=>{e.remote=t}),new u0(/\* \[new branch]\s+(\S+)\s*-> (.+)$/,(e,[t,n])=>{e.branches.push({name:t,tracking:n})}),new u0(/\* \[new tag]\s+(\S+)\s*-> (.+)$/,(e,[t,n])=>{e.tags.push({name:t,tracking:n})}),new u0(/- \[deleted]\s+\S+\s*-> (.+)$/,(e,[t])=>{e.deleted.push({tracking:t})}),new u0(/\s*([^.]+)\.\.(\S+)\s+(\S+)\s*-> (.+)$/,(e,[t,n,r,i])=>{e.updated.push({name:r,tracking:i,to:n,from:t})})]}}),d3={};S1(d3,{fetchTask:()=>Ghe});function Whe(e){return/^--upload-pack(=|$)/.test(e)}function Ghe(e,t,n){let r=[`fetch`,...n];return e&&t&&r.push(e,t),r.find(Whe)?P0(`git.fetch: potential exploit argument blocked.`):{commands:r,format:`utf-8`,parser:Hhe}}var Khe=x1({"src/lib/tasks/fetch.ts"(){Uhe(),B0()}});function qhe(e){return v0({moves:[]},f3,e)}var f3,Jhe=x1({"src/lib/parsers/parse-move.ts"(){b0(),f3=[new u0(/^Renaming (.+) to (.+)$/,(e,[t,n])=>{e.moves.push({from:t,to:n})})]}}),p3={};S1(p3,{moveTask:()=>Yhe});function Yhe(e,t){return{commands:[`mv`,`-v`,...V1(e),t],format:`utf-8`,parser:qhe}}var Xhe=x1({"src/lib/tasks/move.ts"(){Jhe(),b0()}}),m3={};S1(m3,{pullTask:()=>Zhe});function Zhe(e,t,n){let r=[`pull`,...n];return e&&t&&r.splice(1,0,e,t),{commands:r,format:`utf-8`,parser(e,t){return g4(e,t)},onError(e,t,n,r){let i=ihe(K1(e.stdOut),K1(e.stdErr));if(i)return r(new E1(i));r(t)}}}var Qhe=x1({"src/lib/tasks/pull.ts"(){D1(),_4(),b0()}});function $he(e){let t={};return h3(e,([e])=>t[e]={name:e}),Object.values(t)}function ege(e){let t={};return h3(e,([e,n,r])=>{Object.hasOwn(t,e)||(t[e]={name:e,refs:{fetch:``,push:``}}),r&&n&&(t[e].refs[r.replace(/[^a-z]/g,``)]=n)}),Object.values(t)}function h3(e,t){L1(e,e=>t(e.split(/\s+/)))}var tge=x1({"src/lib/responses/GetRemoteSummary.ts"(){b0()}}),g3={};S1(g3,{addRemoteTask:()=>nge,getRemotesTask:()=>rge,listRemotesTask:()=>ige,remoteTask:()=>age,removeRemoteTask:()=>oge});function nge(e,t,n){return F0([`remote`,`add`,...n,e,t])}function rge(e){let t=[`remote`];return e&&t.push(`-v`),{commands:t,format:`utf-8`,parser:e?ege:$he}}function ige(e){let t=[...e];return t[0]!==`ls-remote`&&t.unshift(`ls-remote`),F0(t)}function age(e){let t=[...e];return t[0]!==`remote`&&t.unshift(`remote`),F0(t)}function oge(e){return F0([`remote`,`remove`,e])}var sge=x1({"src/lib/tasks/remote.ts"(){tge(),B0()}}),_3={};S1(_3,{stashListTask:()=>cge});function cge(e={},t){let n=X2(e),r=[`stash`,`list`,...n.commands,...t],i=V2(n.splitter,n.fields,A2(r));return J2(r)||{commands:r,format:`utf-8`,parser:i}}var lge=x1({"src/lib/tasks/stash-list.ts"(){M2(),K2(),Y2(),Q2()}}),v3={};S1(v3,{addSubModuleTask:()=>uge,initSubModuleTask:()=>dge,subModuleTask:()=>y3,updateSubModuleTask:()=>fge});function uge(e,t){return y3([`add`,e,t])}function dge(e){return y3([`init`,...e])}function y3(e){let t=[...e];return t[0]!==`submodule`&&t.unshift(`submodule`),F0(t)}function fge(e){return y3([`update`,...e])}var pge=x1({"src/lib/tasks/sub-module.ts"(){B0()}});function mge(e,t){let n=Number.isNaN(e);return n===Number.isNaN(t)?n?b3(e,t):0:n?1:-1}function b3(e,t){return e===t?0:e>t?1:-1}function hge(e){return e.trim()}function x3(e){return typeof e==`string`&&parseInt(e.replace(/^\D+/g,``),10)||0}var S3,C3,gge=x1({"src/lib/responses/TagList.ts"(){S3=class{constructor(e,t){this.all=e,this.latest=t}},C3=function(e,t=!1){let n=e.split(`
429
+ `).map(hge).filter(Boolean);t||n.sort(function(e,t){let n=e.split(`.`),r=t.split(`.`);if(n.length===1||r.length===1)return mge(x3(n[0]),x3(r[0]));for(let e=0,t=Math.max(n.length,r.length);e<t;e++){let t=b3(x3(n[e]),x3(r[e]));if(t)return t}return 0});let r=t?n[0]:[...n].reverse().find(e=>e.indexOf(`.`)>=0);return new S3(n,r)}}}),w3={};S1(w3,{addAnnotatedTagTask:()=>yge,addTagTask:()=>vge,tagListTask:()=>_ge});function _ge(e=[]){let t=e.some(e=>/^--sort=/.test(e));return{format:`utf-8`,commands:[`tag`,`-l`,...e],parser(e){return C3(e,t)}}}function vge(e){return{format:`utf-8`,commands:[`tag`,e],parser(){return{name:e}}}}function yge(e,t){return{format:`utf-8`,commands:[`tag`,`-a`,`-m`,t,e],parser(){return{name:e}}}}var bge=x1({"src/lib/tasks/tag.ts"(){gge()}}),xge=Ppe({"src/git.js"(e,t){var{GitExecutor:n}=(Cme(),C1(b2)),{SimpleGitApi:r}=(Che(),C1(U4)),{Scheduler:i}=(whe(),C1(G4)),{adhocExecTask:a,configurationErrorTask:o}=(B0(),C1(M0)),{asArray:s,filterArray:c,filterPrimitives:l,filterString:u,filterStringOrStringArray:d,filterType:f,getTrailingOptions:p,trailingFunctionArgument:m,trailingOptionsArgument:h}=(b0(),C1(y0)),{applyPatchTask:g}=(Ehe(),C1(J4)),{branchTask:_,branchLocalTask:v,deleteBranchesTask:y,deleteBranchTask:b}=(Lhe(),C1(o3)),{checkIgnoreTask:x}=(Vhe(),C1(l3)),{checkIsRepoTask:S}=(D0(),C1(x0)),{cleanWithOptionsTask:C,isCleanOptionsArray:w}=(J0(),C1(V0)),{diffSummaryTask:T}=(Y2(),C1(q2)),{fetchTask:E}=(Khe(),C1(d3)),{moveTask:D}=(Xhe(),C1(p3)),{pullTask:ee}=(Qhe(),C1(m3)),{pushTagsTask:te}=(D4(),C1(T4)),{addRemoteTask:ne,getRemotesTask:re,listRemotesTask:ie,remoteTask:ae,removeRemoteTask:oe}=(sge(),C1(g3)),{getResetMode:se,resetTask:ce}=(f2(),C1(c2)),{stashListTask:O}=(lge(),C1(_3)),{addSubModuleTask:le,initSubModuleTask:ue,subModuleTask:de,updateSubModuleTask:k}=(pge(),C1(v3)),{addAnnotatedTagTask:A,addTagTask:fe,tagListTask:pe}=(bge(),C1(w3)),{straightThroughBufferTask:me,straightThroughStringTask:he}=(B0(),C1(M0));function j(e,t){this._plugins=t,this._executor=new n(e.baseDir,new i(e.maxConcurrentProcesses),t),this._trimmed=e.trimmed}(j.prototype=Object.create(r.prototype)).constructor=j,j.prototype.customBinary=function(e){return this._plugins.reconfigure(`binary`,e),this},j.prototype.env=function(e,t){return arguments.length===1&&typeof e==`object`?this._executor.env=e:(this._executor.env=this._executor.env||{})[e]=t,this},j.prototype.stashList=function(e){return this._runTask(O(h(arguments)||{},c(e)&&e||[]),m(arguments))},j.prototype.mv=function(e,t){return this._runTask(D(e,t),m(arguments))},j.prototype.checkoutLatestTag=function(e){var t=this;return this.pull(function(){t.tags(function(n,r){t.checkout(r.latest,e)})})},j.prototype.pull=function(e,t,n,r){return this._runTask(ee(f(e,u),f(t,u),p(arguments)),m(arguments))},j.prototype.fetch=function(e,t){return this._runTask(E(f(e,u),f(t,u),p(arguments)),m(arguments))},j.prototype.silent=function(e){return this._runTask(a(()=>console.warn("simple-git deprecation notice: git.silent: logging should be configured using the `debug` library / `DEBUG` environment variable, this method will be removed.")))},j.prototype.tags=function(e,t){return this._runTask(pe(p(arguments)),m(arguments))},j.prototype.rebase=function(){return this._runTask(he([`rebase`,...p(arguments)]),m(arguments))},j.prototype.reset=function(e){return this._runTask(ce(se(e),p(arguments)),m(arguments))},j.prototype.revert=function(e){let t=m(arguments);return typeof e==`string`?this._runTask(he([`revert`,...p(arguments,0,!0),e]),t):this._runTask(o(`Commit must be a string`),t)},j.prototype.addTag=function(e){let t=typeof e==`string`?fe(e):o(`Git.addTag requires a tag name`);return this._runTask(t,m(arguments))},j.prototype.addAnnotatedTag=function(e,t){return this._runTask(A(e,t),m(arguments))},j.prototype.deleteLocalBranch=function(e,t,n){return this._runTask(b(e,typeof t==`boolean`?t:!1),m(arguments))},j.prototype.deleteLocalBranches=function(e,t,n){return this._runTask(y(e,typeof t==`boolean`?t:!1),m(arguments))},j.prototype.branch=function(e,t){return this._runTask(_(p(arguments)),m(arguments))},j.prototype.branchLocal=function(e){return this._runTask(v(),m(arguments))},j.prototype.raw=function(e){let t=!Array.isArray(e),n=[].slice.call(t?arguments:e,0);for(let e=0;e<n.length&&t;e++)if(!l(n[e])){n.splice(e,n.length-e);break}n.push(...p(arguments,0,!0));var r=m(arguments);return n.length?this._runTask(he(n,this._trimmed),r):this._runTask(o(`Raw: must supply one or more command to execute`),r)},j.prototype.submoduleAdd=function(e,t,n){return this._runTask(le(e,t),m(arguments))},j.prototype.submoduleUpdate=function(e,t){return this._runTask(k(p(arguments,!0)),m(arguments))},j.prototype.submoduleInit=function(e,t){return this._runTask(ue(p(arguments,!0)),m(arguments))},j.prototype.subModule=function(e,t){return this._runTask(de(p(arguments)),m(arguments))},j.prototype.listRemote=function(){return this._runTask(ie(p(arguments)),m(arguments))},j.prototype.addRemote=function(e,t,n){return this._runTask(ne(e,t,p(arguments)),m(arguments))},j.prototype.removeRemote=function(e,t){return this._runTask(oe(e),m(arguments))},j.prototype.getRemotes=function(e,t){return this._runTask(re(e===!0),m(arguments))},j.prototype.remote=function(e,t){return this._runTask(ae(p(arguments)),m(arguments))},j.prototype.tag=function(e,t){let n=p(arguments);return n[0]!==`tag`&&n.unshift(`tag`),this._runTask(he(n),m(arguments))},j.prototype.updateServerInfo=function(e){return this._runTask(he([`update-server-info`]),m(arguments))},j.prototype.pushTags=function(e,t){let n=te({remote:f(e,u)},p(arguments));return this._runTask(n,m(arguments))},j.prototype.rm=function(e){return this._runTask(he([`rm`,`-f`,...s(e)]),m(arguments))},j.prototype.rmKeepLocal=function(e){return this._runTask(he([`rm`,`--cached`,...s(e)]),m(arguments))},j.prototype.catFile=function(e,t){return this._catFile(`utf-8`,arguments)},j.prototype.binaryCatFile=function(){return this._catFile(`buffer`,arguments)},j.prototype._catFile=function(e,t){var n=m(t),r=[`cat-file`],i=t[0];if(typeof i==`string`)return this._runTask(o(`Git.catFile: options must be supplied as an array of strings`),n);Array.isArray(i)&&r.push.apply(r,i);let a=e===`buffer`?me(r):he(r);return this._runTask(a,n)},j.prototype.diff=function(e,t){let n=u(e)?o(`git.diff: supplying options as a single string is no longer supported, switch to an array of strings`):he([`diff`,...p(arguments)]);return this._runTask(n,m(arguments))},j.prototype.diffSummary=function(){return this._runTask(T(p(arguments,1)),m(arguments))},j.prototype.applyPatch=function(e){let t=d(e)?g(s(e),p([].slice.call(arguments,1))):o(`git.applyPatch requires one or more string patches as the first argument`);return this._runTask(t,m(arguments))},j.prototype.revparse=function(){let e=[`rev-parse`,...p(arguments,!0)];return this._runTask(he(e,!0),m(arguments))},j.prototype.clean=function(e,t,n){let r=w(e),i=r&&e.join(``)||f(e,u)||``,a=p([].slice.call(arguments,+!!r));return this._runTask(C(i,a),m(arguments))},j.prototype.exec=function(e){return this._runTask({commands:[],format:`utf-8`,parser(){typeof e==`function`&&e()}})},j.prototype.clearQueue=function(){return this._runTask(a(()=>console.warn(`simple-git deprecation notice: clearQueue() is deprecated and will be removed, switch to using the abortPlugin instead.`)))},j.prototype.checkIgnore=function(e,t){return this._runTask(x(s(f(e,d,[]))),m(arguments))},j.prototype.checkIsRepo=function(e,t){return this._runTask(S(f(e,u)),m(arguments))},t.exports=j}});T1(),T1(),T1(),D1(),k1(),D0(),J0(),$0(),n2(),s2(),f2(),b0(),b0(),(0,h1.deferred)().promise,b0(),T1(),b0(),b0(),b0(),b0(),xge(),D1(),o1(`checkpoint-chain`);function T3(e){try{return process.kill(e,0),!0}catch(e){return!!(e&&typeof e==`object`&&`code`in e&&e.code===`EPERM`)}}function Sge(e){return!(typeof e!=`number`||!Number.isInteger(e)||e<2||e>2147483647)}o1(`shadow-lock`),o1(`shadow-op-gate`),o1(`shadow-repo`),(()=>{let e=process.env.OK_GIT_TIMEOUT_MS;if(!e)return 3e4;let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:3e4})(),(()=>{let e=process.env.OK_SHADOW_MAINTENANCE_GC_TIMEOUT_MS;if(!e)return 6e5;let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:6e5})(),o1(`bridge-loss-detector`),o1(`checkpoint`);function E3(e){let t=he(e).toLowerCase();return yl.includes(t)}function Cge(e){let t=e.toLowerCase();for(let n of yl)if(t.endsWith(n))return e.slice(0,-n.length);return e}function wge(e){return e===`__system__`}const Tge=new Set(hl);function Ege(e){return Tge.has(e)}function Dge(e){return _l(e)}function Oge(e){return wge(e)||Ege(e)||Dge(e)}o1(`parse-pool`),Math.max(1,Math.min(4,ae()-1)),s1(()=>{}),o1(`bridge-watchdog`),s1(()=>{}),o1(`server-observers`),o1(`server-observers`),o1(`agent-sessions`),RegExp(`^(?:${`do you mind.i would like you to.i'd like you to.i want you to.i need you to.i would like to.i'd like to.i want to.i need to.we need to.we want to.we should.go ahead and.take a look at.have a look at.look into.look at.help me with.help me to.help me.can you.could you.would you.will you.can we.could we.should we.let's.lets.try to.please.kindly.hello.alright.actually.anyway.also.okay.hey.hi.yo.ok.so.pls.plz.just.maybe`.split(`.`).map(e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)).join(`|`)})\\b(?:[\\s,:;!.\\-–—]+|$)`,`i`),Ie(s);const kge=bo({source:P(),pluginProvider:P().optional(),skill:P().optional(),ref:P().optional(),contentHash:P(),files:R(P()).optional(),localHash:P().optional(),baselineRef:P().optional(),publisher:P().optional(),importedAt:Pa(),autoUpdate:I().optional()});bo({schema:H(1),skills:B(P(),kge).default({})}),new Set(Object.values(Ml)),new Set([...new Set([`.git`,`node_modules`]),`scripts`,`references`]);const D3=[`agents`,`claude`,`cursor`,`codex`,`opencode`,`pi`,`copilot`];var O3=i(((e,t)=>{function n(e){if(e.length===0)return;let t=Object.create(null),n=0;for(;n<e.length;++n){let t=e.charCodeAt(n);if(u[t]!==1){if(t!==47||n===0)return;break}}if(n===e.length)return;let i=e.slice(0,n).toLowerCase(),a=++n;for(;n<e.length;++n)if(u[e.charCodeAt(n)]!==1){if(n===a||r(e,n,t)===void 0)return;break}if(n!==a)return{type:i,subtype:e.slice(a,n).toLowerCase(),params:t}}function r(e,t,n){for(;t<e.length;){for(;t<e.length;++t){let n=e.charCodeAt(t);if(n!==32&&n!==9)break}if(t===e.length)break;if(e.charCodeAt(t++)!==59)return;for(;t<e.length;++t){let n=e.charCodeAt(t);if(n!==32&&n!==9)break}if(t===e.length)return;let r,i=t;for(;t<e.length;++t){let n=e.charCodeAt(t);if(u[n]!==1){if(n!==61)return;break}}if(t===e.length||(r=e.slice(i,t),++t,t===e.length))return;let a=``,o;if(e.charCodeAt(t)===34){o=++t;let n=!1;for(;t<e.length;++t){let r=e.charCodeAt(t);if(r===92){n?(o=t,n=!1):(a+=e.slice(o,t),n=!0);continue}if(r===34){if(n){o=t,n=!1;continue}a+=e.slice(o,t);break}if(n&&=(o=t-1,!1),d[r]!==1)return}if(t===e.length)return;++t}else{for(o=t;t<e.length;++t)if(u[e.charCodeAt(t)]!==1){if(t===o)return;break}a=e.slice(o,t)}r=r.toLowerCase(),n[r]===void 0&&(n[r]=a)}return n}function i(e,t){if(e.length===0)return;let n=Object.create(null),r=0;for(;r<e.length;++r)if(u[e.charCodeAt(r)]!==1){if(a(e,r,n,t)===void 0)return;break}return{type:e.slice(0,r).toLowerCase(),params:n}}function a(e,t,n,r){for(;t<e.length;){for(;t<e.length;++t){let n=e.charCodeAt(t);if(n!==32&&n!==9)break}if(t===e.length)break;if(e.charCodeAt(t++)!==59)return;for(;t<e.length;++t){let n=e.charCodeAt(t);if(n!==32&&n!==9)break}if(t===e.length)return;let i,a=t;for(;t<e.length;++t){let n=e.charCodeAt(t);if(u[n]!==1){if(n===61)break;return}}if(t===e.length)return;let o=``,s,l;if(i=e.slice(a,t),i.charCodeAt(i.length-1)===42){let n=++t;for(;t<e.length;++t){let n=e.charCodeAt(t);if(f[n]!==1){if(n!==39)return;break}}if(t===e.length)return;for(l=e.slice(n,t),++t;t<e.length&&e.charCodeAt(t)!==39;++t);if(t===e.length||(++t,t===e.length))return;s=t;let r=0;for(;t<e.length;++t){let n=e.charCodeAt(t);if(p[n]!==1){if(n===37){let n,i;if(t+2<e.length&&(n=m[e.charCodeAt(t+1)])!==-1&&(i=m[e.charCodeAt(t+2)])!==-1){let a=(n<<4)+i;o+=e.slice(s,t),o+=String.fromCharCode(a),t+=2,s=t+1,a>=128?r=2:r===0&&(r=1);continue}return}break}}if(o+=e.slice(s,t),o=c(o,l,r),o===void 0)return}else{if(++t,t===e.length)return;if(e.charCodeAt(t)===34){s=++t;let n=!1;for(;t<e.length;++t){let r=e.charCodeAt(t);if(r===92){n?(s=t,n=!1):(o+=e.slice(s,t),n=!0);continue}if(r===34){if(n){s=t,n=!1;continue}o+=e.slice(s,t);break}if(n&&=(s=t-1,!1),d[r]!==1)return}if(t===e.length)return;++t}else{for(s=t;t<e.length;++t)if(u[e.charCodeAt(t)]!==1){if(t===s)return;break}o=e.slice(s,t)}if(o=r(o,2),o===void 0)return}i=i.toLowerCase(),n[i]===void 0&&(n[i]=o)}return n}function o(e){let t;for(;;)switch(e){case`utf-8`:case`utf8`:return s.utf8;case`latin1`:case`ascii`:case`us-ascii`:case`iso-8859-1`:case`iso8859-1`:case`iso88591`:case`iso_8859-1`:case`windows-1252`:case`iso_8859-1:1987`:case`cp1252`:case`x-cp1252`:return s.latin1;case`utf16le`:case`utf-16le`:case`ucs2`:case`ucs-2`:return s.utf16le;case`base64`:return s.base64;default:if(t===void 0){t=!0,e=e.toLowerCase();continue}return s.other.bind(e)}}let s={utf8:(e,t)=>{if(e.length===0)return``;if(typeof e==`string`){if(t<2)return e;e=Buffer.from(e,`latin1`)}return e.utf8Slice(0,e.length)},latin1:(e,t)=>e.length===0?``:typeof e==`string`?e:e.latin1Slice(0,e.length),utf16le:(e,t)=>e.length===0?``:(typeof e==`string`&&(e=Buffer.from(e,`latin1`)),e.ucs2Slice(0,e.length)),base64:(e,t)=>e.length===0?``:(typeof e==`string`&&(e=Buffer.from(e,`latin1`)),e.base64Slice(0,e.length)),other:(t,n)=>{if(t.length===0)return``;typeof t==`string`&&(t=Buffer.from(t,`latin1`));try{return new TextDecoder(e).decode(t)}catch{}}};function c(e,t,n){let r=o(t);if(r)return r(e,n)}function l(e){if(typeof e!=`string`)return``;for(let t=e.length-1;t>=0;--t)switch(e.charCodeAt(t)){case 47:case 92:return e=e.slice(t+1),e===`..`||e===`.`?``:e}return e===`..`||e===`.`?``:e}let u=[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,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,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,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,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],d=[0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,1,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,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,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,1,1,1,1,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,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,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,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,1,1,1,1,1,1,1,1,1,1,1,1],f=[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,0,0,0,0,1,0,1,0,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,1,0,1,1,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,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,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,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],p=[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,0,1,0,0,0,0,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,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,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,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,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],m=[-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,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,-1,-1,-1,-1,-1,-1,-1,10,11,12,13,14,15,-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,10,11,12,13,14,15,-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,-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,-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,-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,-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,-1,-1,-1,-1,-1,-1,-1,-1];t.exports={basename:l,convertToUTF8:c,getDecoder:o,parseContentType:n,parseDisposition:i}})),Age=i(((e,t)=>{function n(e,t,n,r,i){for(let a=0;a<i;++a)if(e[t+a]!==n[r+a])return!1;return!0}var r=class{constructor(e,t){if(typeof t!=`function`)throw Error(`Missing match callback`);if(typeof e==`string`)e=Buffer.from(e);else if(!Buffer.isBuffer(e))throw Error(`Expected Buffer for needle, got ${typeof e}`);let n=e.length;if(this.maxMatches=1/0,this.matches=0,this._cb=t,this._lookbehindSize=0,this._needle=e,this._bufPos=0,this._lookbehind=Buffer.allocUnsafe(n),this._occ=[n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n],n>1)for(let t=0;t<n-1;++t)this._occ[e[t]]=n-1-t}reset(){this.matches=0,this._lookbehindSize=0,this._bufPos=0}push(e,t){let n;Buffer.isBuffer(e)||(e=Buffer.from(e,`latin1`));let r=e.length;for(this._bufPos=t||0;n!==r&&this.matches<this.maxMatches;)n=i(this,e);return n}destroy(){let e=this._lookbehindSize;e&&this._cb(!1,this._lookbehind,0,e,!1),this.reset()}};function i(e,t){let r=t.length,i=e._needle,o=i.length,s=-e._lookbehindSize,c=o-1,l=i[c],u=r-o,d=e._occ,f=e._lookbehind;if(s<0){for(;s<0&&s<=u;){let n=s+c,r=n<0?f[e._lookbehindSize+n]:t[n];if(r===l&&a(e,t,s,c))return e._lookbehindSize=0,++e.matches,s>-e._lookbehindSize?e._cb(!0,f,0,e._lookbehindSize+s,!1):e._cb(!0,void 0,0,0,!0),e._bufPos=s+o;s+=d[r]}for(;s<0&&!a(e,t,s,r-s);)++s;if(s<0){let n=e._lookbehindSize+s;return n>0&&e._cb(!1,f,0,n,!1),e._lookbehindSize-=n,f.copy(f,0,n,e._lookbehindSize),f.set(t,e._lookbehindSize),e._lookbehindSize+=r,e._bufPos=r,r}e._cb(!1,f,0,e._lookbehindSize,!1),e._lookbehindSize=0}s+=e._bufPos;let p=i[0];for(;s<=u;){let r=t[s+c];if(r===l&&t[s]===p&&n(i,0,t,s,c))return++e.matches,s>0?e._cb(!0,t,e._bufPos,s,!0):e._cb(!0,void 0,0,0,!0),e._bufPos=s+o;s+=d[r]}for(;s<r;){if(t[s]!==p||!n(t,s,i,0,r-s)){++s;continue}t.copy(f,0,s,r),e._lookbehindSize=r-s;break}return s>0&&e._cb(!1,t,e._bufPos,s<r?s:r,!0),e._bufPos=r,r}function a(e,t,n,r){let i=e._lookbehind,a=e._lookbehindSize,o=e._needle;for(let e=0;e<r;++e,++n)if((n<0?i[a+n]:t[n])!==o[e])return!1;return!0}t.exports=r})),jge=i(((e,n)=>{let{Readable:r,Writable:i}=t(`stream`),a=Age(),{basename:o,convertToUTF8:s,getDecoder:c,parseContentType:l,parseDisposition:u}=O3(),d=Buffer.from(`\r
430
+ `),f=Buffer.from(`\r`),p=Buffer.from(`-`);function m(){}let h=16*1024;var g=class{constructor(e){this.header=Object.create(null),this.pairCount=0,this.byteCount=0,this.state=0,this.name=``,this.value=``,this.crlf=0,this.cb=e}reset(){this.header=Object.create(null),this.pairCount=0,this.byteCount=0,this.state=0,this.name=``,this.value=``,this.crlf=0}push(e,t,n){let r=t;for(;t<n;)switch(this.state){case 0:{let i=!1;for(;t<n;++t){if(this.byteCount===h)return-1;++this.byteCount;let n=e[t];if(w[n]!==1){if(n!==58||(this.name+=e.latin1Slice(r,t),this.name.length===0))return-1;++t,i=!0,this.state=1;break}}if(!i){this.name+=e.latin1Slice(r,t);break}}case 1:{let i=!1;for(;t<n;++t){if(this.byteCount===h)return-1;++this.byteCount;let n=e[t];if(n!==32&&n!==9){r=t,i=!0,this.state=2;break}}if(!i)break}case 2:switch(this.crlf){case 0:for(;t<n;++t){if(this.byteCount===h)return-1;++this.byteCount;let n=e[t];if(T[n]!==1){if(n!==13)return-1;++this.crlf;break}}this.value+=e.latin1Slice(r,t++);break;case 1:if(this.byteCount===h||(++this.byteCount,e[t++]!==10))return-1;++this.crlf;break;case 2:{if(this.byteCount===h)return-1;++this.byteCount;let n=e[t];n===32||n===9?(r=t,this.crlf=0):(++this.pairCount<2e3&&(this.name=this.name.toLowerCase(),this.header[this.name]===void 0?this.header[this.name]=[this.value]:this.header[this.name].push(this.value)),n===13?(++this.crlf,++t):(r=t,this.crlf=0,this.state=0,this.name=``,this.value=``));break}case 3:{if(this.byteCount===h||(++this.byteCount,e[t++]!==10))return-1;let n=this.header;return this.reset(),this.cb(n),t}}break}return t}},_=class extends r{constructor(e,t){super(e),this.truncated=!1,this._readcb=null,this.once(`end`,()=>{if(this._read(),--t._fileEndsLeft===0&&t._finalcb){let e=t._finalcb;t._finalcb=null,process.nextTick(e)}})}_read(e){let t=this._readcb;t&&(this._readcb=null,t())}};let v={push:(e,t)=>{},destroy:()=>{}};function y(e,t){let n=e._writecb;e._writecb=null,t?e.destroy(t):n&&n()}function b(e,t){return e}var x=class extends i{constructor(e){let t={autoDestroy:!0,emitClose:!0,highWaterMark:typeof e.highWaterMark==`number`?e.highWaterMark:void 0};if(super(t),!e.conType.params||typeof e.conType.params.boundary!=`string`)throw Error(`Multipart: Boundary not found`);let n=e.conType.params.boundary,r=typeof e.defParamCharset==`string`&&e.defParamCharset?c(e.defParamCharset):b,i=e.defCharset||`utf8`,h=e.preservePath,y={autoDestroy:!0,emitClose:!0,highWaterMark:typeof e.fileHwm==`number`?e.fileHwm:void 0},x=e.limits,S=x&&typeof x.fieldSize==`number`?x.fieldSize:1*1024*1024,C=x&&typeof x.fileSize==`number`?x.fileSize:1/0,w=x&&typeof x.files==`number`?x.files:1/0,T=x&&typeof x.fields==`number`?x.fields:1/0,E=x&&typeof x.parts==`number`?x.parts:1/0,D=-1,ee=0,te=0,ne=!1;this._fileEndsLeft=0,this._fileStream=void 0,this._complete=!1;let re=0,ie,ae=0,oe,se,ce,O,le=!1,ue=!1,de=!1;this._hparser=null;let k=new g(e=>{this._hparser=null,ne=!1,ce=`text/plain`,oe=i,se=`7bit`,O=void 0,le=!1;let t;if(!e[`content-disposition`]){ne=!0;return}let n=u(e[`content-disposition`][0],r);if(!n||n.type!==`form-data`){ne=!0;return}if(n.params&&(n.params.name&&(O=n.params.name),n.params[`filename*`]?t=n.params[`filename*`]:n.params.filename&&(t=n.params.filename),t!==void 0&&!h&&(t=o(t))),e[`content-type`]){let t=l(e[`content-type`][0]);t&&(ce=`${t.type}/${t.subtype}`,t.params&&typeof t.params.charset==`string`&&(oe=t.params.charset.toLowerCase()))}if(e[`content-transfer-encoding`]&&(se=e[`content-transfer-encoding`][0].toLowerCase()),ce===`application/octet-stream`||t!==void 0){if(te===w){ue||(ue=!0,this.emit(`filesLimit`)),ne=!0;return}if(++te,this.listenerCount(`file`)===0){ne=!0;return}re=0,this._fileStream=new _(y,this),++this._fileEndsLeft,this.emit(`file`,O,this._fileStream,{filename:t,encoding:se,mimeType:ce})}else{if(ee===T){de||(de=!0,this.emit(`fieldsLimit`)),ne=!0;return}if(++ee,this.listenerCount(`field`)===0){ne=!0;return}ie=[],ae=0}}),A=0,fe=(e,t,n,r,i)=>{retrydata:for(;t;){if(this._hparser!==null){let e=this._hparser.push(t,n,r);if(e===-1){this._hparser=null,k.reset(),this.emit(`error`,Error(`Malformed part header`));break}n=e}if(n===r)break;if(A!==0){if(A===1){switch(t[n]){case 45:A=2,++n;break;case 13:A=3,++n;break;default:A=0}if(n===r)return}if(A===2){if(A=0,t[n]===45){this._complete=!0,this._bparser=v;return}let e=this._writecb;this._writecb=m,fe(!1,p,0,1,!1),this._writecb=e}else if(A===3)if(A=0,t[n]===10){if(++n,D>=E||(this._hparser=k,n===r))break;continue retrydata}else{let e=this._writecb;this._writecb=m,fe(!1,f,0,1,!1),this._writecb=e}}if(!ne){if(this._fileStream){let e,a=Math.min(r-n,C-re);i?e=t.slice(n,n+a):(e=Buffer.allocUnsafe(a),t.copy(e,0,n,n+a)),re+=e.length,re===C?(e.length>0&&this._fileStream.push(e),this._fileStream.emit(`limit`),this._fileStream.truncated=!0,ne=!0):this._fileStream.push(e)||(this._writecb&&(this._fileStream._readcb=this._writecb),this._writecb=null)}else if(ie!==void 0){let e,a=Math.min(r-n,S-ae);i?e=t.slice(n,n+a):(e=Buffer.allocUnsafe(a),t.copy(e,0,n,n+a)),ae+=a,ie.push(e),ae===S&&(ne=!0,le=!0)}}break}if(e){if(A=1,this._fileStream)this._fileStream.push(null),this._fileStream=null;else if(ie!==void 0){let e;switch(ie.length){case 0:e=``;break;case 1:e=s(ie[0],oe,0);break;default:e=s(Buffer.concat(ie,ae),oe,0)}ie=void 0,ae=0,this.emit(`field`,O,e,{nameTruncated:!1,valueTruncated:le,encoding:se,mimeType:ce})}++D===E&&this.emit(`partsLimit`)}};this._bparser=new a(`\r\n--${n}`,fe),this._writecb=null,this._finalcb=null,this.write(d)}static detect(e){return e.type===`multipart`&&e.subtype===`form-data`}_write(e,t,n){this._writecb=n,this._bparser.push(e,0),this._writecb&&y(this)}_destroy(e,t){this._hparser=null,this._bparser=v,e||=C(this);let n=this._fileStream;n&&(this._fileStream=null,n.destroy(e)),t(e)}_final(e){if(this._bparser.destroy(),!this._complete)return e(Error(`Unexpected end of form`));this._fileEndsLeft?this._finalcb=S.bind(null,this,e):S(this,e)}};function S(e,t,n){if(n)return t(n);n=C(e),t(n)}function C(e){if(e._hparser)return Error(`Malformed part header`);let t=e._fileStream;if(t&&(e._fileStream=null,t.destroy(Error(`Unexpected end of file`))),!e._complete)return Error(`Unexpected end of form`)}let w=[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,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,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,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,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],T=[0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,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,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,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,1,1,1,1,1,1,1,1,1,1,1,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,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,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,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,1,1,1,1,1,1,1,1,1,1,1,1];n.exports=x})),Mge=i(((e,n)=>{let{Writable:r}=t(`stream`),{getDecoder:i}=O3();var a=class extends r{constructor(e){let t={autoDestroy:!0,emitClose:!0,highWaterMark:typeof e.highWaterMark==`number`?e.highWaterMark:void 0};super(t);let n=e.defCharset||`utf8`;e.conType.params&&typeof e.conType.params.charset==`string`&&(n=e.conType.params.charset),this.charset=n;let r=e.limits;this.fieldSizeLimit=r&&typeof r.fieldSize==`number`?r.fieldSize:1*1024*1024,this.fieldsLimit=r&&typeof r.fields==`number`?r.fields:1/0,this.fieldNameSizeLimit=r&&typeof r.fieldNameSize==`number`?r.fieldNameSize:100,this._inKey=!0,this._keyTrunc=!1,this._valTrunc=!1,this._bytesKey=0,this._bytesVal=0,this._fields=0,this._key=``,this._val=``,this._byte=-2,this._lastPos=0,this._encode=0,this._decoder=i(n)}static detect(e){return e.type===`application`&&e.subtype===`x-www-form-urlencoded`}_write(e,t,n){if(this._fields>=this.fieldsLimit)return n();let r=0,i=e.length;if(this._lastPos=0,this._byte!==-2){if(r=o(this,e,r,i),r===-1)return n(Error(`Malformed urlencoded form`));if(r>=i)return n();this._inKey?++this._bytesKey:++this._bytesVal}main:for(;r<i;)if(this._inKey){for(r=s(this,e,r,i);r<i;){switch(e[r]){case 61:this._lastPos<r&&(this._key+=e.latin1Slice(this._lastPos,r)),this._lastPos=++r,this._key=this._decoder(this._key,this._encode),this._encode=0,this._inKey=!1;continue main;case 38:if(this._lastPos<r&&(this._key+=e.latin1Slice(this._lastPos,r)),this._lastPos=++r,this._key=this._decoder(this._key,this._encode),this._encode=0,this._bytesKey>0&&this.emit(`field`,this._key,``,{nameTruncated:this._keyTrunc,valueTruncated:!1,encoding:this.charset,mimeType:`text/plain`}),this._key=``,this._val=``,this._keyTrunc=!1,this._valTrunc=!1,this._bytesKey=0,this._bytesVal=0,++this._fields>=this.fieldsLimit)return this.emit(`fieldsLimit`),n();continue;case 43:this._lastPos<r&&(this._key+=e.latin1Slice(this._lastPos,r)),this._key+=` `,this._lastPos=r+1;break;case 37:if(this._encode===0&&(this._encode=1),this._lastPos<r&&(this._key+=e.latin1Slice(this._lastPos,r)),this._lastPos=r+1,this._byte=-1,r=o(this,e,r+1,i),r===-1)return n(Error(`Malformed urlencoded form`));if(r>=i)return n();++this._bytesKey,r=s(this,e,r,i);continue}++r,++this._bytesKey,r=s(this,e,r,i)}this._lastPos<r&&(this._key+=e.latin1Slice(this._lastPos,r))}else{for(r=c(this,e,r,i);r<i;){switch(e[r]){case 38:if(this._lastPos<r&&(this._val+=e.latin1Slice(this._lastPos,r)),this._lastPos=++r,this._inKey=!0,this._val=this._decoder(this._val,this._encode),this._encode=0,(this._bytesKey>0||this._bytesVal>0)&&this.emit(`field`,this._key,this._val,{nameTruncated:this._keyTrunc,valueTruncated:this._valTrunc,encoding:this.charset,mimeType:`text/plain`}),this._key=``,this._val=``,this._keyTrunc=!1,this._valTrunc=!1,this._bytesKey=0,this._bytesVal=0,++this._fields>=this.fieldsLimit)return this.emit(`fieldsLimit`),n();continue main;case 43:this._lastPos<r&&(this._val+=e.latin1Slice(this._lastPos,r)),this._val+=` `,this._lastPos=r+1;break;case 37:if(this._encode===0&&(this._encode=1),this._lastPos<r&&(this._val+=e.latin1Slice(this._lastPos,r)),this._lastPos=r+1,this._byte=-1,r=o(this,e,r+1,i),r===-1)return n(Error(`Malformed urlencoded form`));if(r>=i)return n();++this._bytesVal,r=c(this,e,r,i);continue}++r,++this._bytesVal,r=c(this,e,r,i)}this._lastPos<r&&(this._val+=e.latin1Slice(this._lastPos,r))}n()}_final(e){if(this._byte!==-2)return e(Error(`Malformed urlencoded form`));(!this._inKey||this._bytesKey>0||this._bytesVal>0)&&(this._inKey?this._key=this._decoder(this._key,this._encode):this._val=this._decoder(this._val,this._encode),this.emit(`field`,this._key,this._val,{nameTruncated:this._keyTrunc,valueTruncated:this._valTrunc,encoding:this.charset,mimeType:`text/plain`})),e()}};function o(e,t,n,r){if(n>=r)return r;if(e._byte===-1){let i=l[t[n++]];if(i===-1)return-1;if(i>=8&&(e._encode=2),n<r){let r=l[t[n++]];if(r===-1)return-1;e._inKey?e._key+=String.fromCharCode((i<<4)+r):e._val+=String.fromCharCode((i<<4)+r),e._byte=-2,e._lastPos=n}else e._byte=i}else{let r=l[t[n++]];if(r===-1)return-1;e._inKey?e._key+=String.fromCharCode((e._byte<<4)+r):e._val+=String.fromCharCode((e._byte<<4)+r),e._byte=-2,e._lastPos=n}return n}function s(e,t,n,r){if(e._bytesKey>e.fieldNameSizeLimit){for(e._keyTrunc||e._lastPos<n&&(e._key+=t.latin1Slice(e._lastPos,n-1)),e._keyTrunc=!0;n<r;++n){let r=t[n];if(r===61||r===38)break;++e._bytesKey}e._lastPos=n}return n}function c(e,t,n,r){if(e._bytesVal>e.fieldSizeLimit){for(e._valTrunc||e._lastPos<n&&(e._val+=t.latin1Slice(e._lastPos,n-1)),e._valTrunc=!0;n<r&&t[n]!==38;++n)++e._bytesVal;e._lastPos=n}return n}let l=[-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,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,-1,-1,-1,-1,-1,-1,-1,10,11,12,13,14,15,-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,10,11,12,13,14,15,-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,-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,-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,-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,-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,-1,-1,-1,-1,-1,-1,-1,-1];n.exports=a})),Nge=i(((e,t)=>{let{parseContentType:n}=O3();function r(e){let t=e.headers,r=n(t[`content-type`]);if(!r)throw Error(`Malformed content type`);for(let n of i){if(!n.detect(r))continue;let i={limits:e.limits,headers:t,conType:r,highWaterMark:void 0,fileHwm:void 0,defCharset:void 0,defParamCharset:void 0,preservePath:!1};return e.highWaterMark&&(i.highWaterMark=e.highWaterMark),e.fileHwm&&(i.fileHwm=e.fileHwm),i.defCharset=e.defCharset,i.defParamCharset=e.defParamCharset,i.preservePath=e.preservePath,new n(i)}throw Error(`Unsupported content type: ${t[`content-type`]}`)}let i=[jge(),Mge()].filter(function(e){return typeof e.detect==`function`});t.exports=e=>{if((typeof e!=`object`||!e)&&(e={}),typeof e.headers!=`object`||e.headers===null||typeof e.headers[`content-type`]!=`string`)throw Error(`Missing Content-Type`);return r(e)}})),Pge=i(((e,t)=>{t.exports=n;function n(){this.pending=0,this.max=1/0,this.listeners=[],this.waiting=[],this.error=null}n.prototype.go=function(e){this.pending<this.max?i(this,e):this.waiting.push(e)},n.prototype.wait=function(e){this.pending===0?e(this.error):this.listeners.push(e)},n.prototype.hold=function(){return r(this)};function r(e){e.pending+=1;var t=!1;return n;function n(n){if(t)throw Error(`callback called twice`);if(t=!0,e.error=e.error||n,--e.pending,e.waiting.length>0&&e.pending<e.max)i(e,e.waiting.shift());else if(e.pending===0){var a=e.listeners;e.listeners=[],a.forEach(r)}}function r(t){t(e.error)}}function i(e,t){t(r(e))}})),Fge=i((e=>{var n=t(`fs`),r=t(`util`),i=t(`stream`),a=i.Readable,o=i.PassThrough,s=Pge(),c=t(`events`).EventEmitter;e.BufferSlicer=d,e.FdSlicer=l,r.inherits(l,c);function l(e){c.call(this),this.fd=e,this.pend=new s,this.pend.max=1,this.refCount=0}l.prototype.read=function(e,t,r,i,a){var o=this;o.pend.go(function(s){n.read(o.fd,e,t,r,i,function(e,t,n){s(),a(e,t,n)})})},l.prototype.createReadStream=function(e){return new u(this,e)},l.prototype.ref=function(){this.refCount+=1},l.prototype.unref=function(){var e=this;if(--e.refCount,e.refCount<0)throw Error(`invalid unref`);if(e.refCount>0)return;n.close(e.fd,t);function t(t){t?e.emit(`error`,t):e.emit(`close`)}},r.inherits(u,a);function u(e,t){t||={},a.call(this,t),this.context=e,this.context.ref(),this.start=t.start||0,this.endOffset=t.end,this.pos=this.start}u.prototype._read=function(e){var t=this,r=Math.min(t._readableState.highWaterMark,e);if(t.endOffset!=null&&(r=Math.min(r,t.endOffset-t.pos)),r<=0){t.push(null),this._cleanup();return}t.context.pend.go(function(e){var i=Buffer.allocUnsafe(r);n.read(t.context.fd,i,0,r,t.pos,function(n,r){n?t.destroy(n):r===0?(t.push(null),t._cleanup()):(t.pos+=r,t.push(i.slice(0,r))),e()})})},u.prototype._destroy=function(e,t){this._cleanup(),t(e)},u.prototype._cleanup=function(){this.context!=null&&(this.context.unref(),this.context=null)},r.inherits(d,c);function d(e){c.call(this),this.refCount=0,this.buffer=e}d.prototype.read=function(e,t,n,r,i){if(!(0<=t&&t<=e.length))throw RangeError(`offset outside buffer: 0 <= `+t+` <= `+e.length);if(r<0)throw RangeError(`position is negative: `+r);if(t+n>e.length&&(n=e.length-t),r+n>this.buffer.length&&(n=this.buffer.length-r),n<=0){setImmediate(function(){i(null,0)});return}this.buffer.copy(e,t,r,r+n),setImmediate(function(){i(null,n)})},d.prototype.createReadStream=function(e){e||={};var t=new o(e);t.start=e.start||0,t.endOffset=e.end,t.pos=t.endOffset||this.buffer.length;for(var n=this.buffer.slice(t.start,t.pos),r=65536,i=0;;){var a=i+r;if(a>=n.length){i<n.length&&t.write(n.slice(i,n.length));break}t.write(n.slice(i,a)),i=a}return t.end(),t},d.prototype.ref=function(){this.refCount+=1},d.prototype.unref=function(){if(--this.refCount,this.refCount<0)throw Error(`invalid unref`)}})),Ige=i(((e,t)=>{let n=new Int32Array([0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117]);function r(e){let t=-1;for(let r of e)t=n[(t^r)&255]^t>>>8;return(t^-1)>>>0}t.exports=r})),Lge=i((e=>{t(`fs`);var n=t(`zlib`);Fge();var r=t(`util`),i=t(`events`).EventEmitter,a=t(`stream`).Transform,o=t(`stream`).PassThrough,s=t(`stream`).Writable;let c=typeof n.crc32==`function`?n.crc32:Ige();r.inherits(l,i);function l(e,t,n,r,a,o,s,c,l,u){var f=this;i.call(f),f.reader=e,f.reader.on(`error`,function(e){d(f,e)}),f.reader.once(`close`,function(){f.emit(`close`)}),f.readEntryCursor=t,f.fileSize=n,f.entryCount=r,f.comment=a,f.entriesRead=0,f.autoClose=!!o,f.lazyEntries=!!s,f.decodeStrings=!!c,f.validateEntrySizes=!!l,f.strictFileNames=!!u,f.isOpen=!0,f.emittedError=!1,f.hasEachEntryBeenCalled=!1,f.lazyEntries||f._readEntry()}l.prototype.close=function(){this.isOpen&&(this.isOpen=!1,this.reader.unref())};function u(e,t){e.autoClose&&e.close(),d(e,t)}function d(e,t){e.emittedError||(e.emittedError=!0,e.emit(`error`,t))}l.prototype.readEntry=function(){if(!this.lazyEntries)throw Error(`readEntry() called without lazyEntries:true`);this._readEntry()},l.prototype._readEntry=function(){var e=this;if(e.entryCount===e.entriesRead){setImmediate(function(){e.autoClose&&e.close(),!e.emittedError&&e.emit(`end`)});return}if(!e.emittedError){var t=T(46);v(e.reader,t,0,t.length,e.readEntryCursor,function(n){if(n)return u(e,n);if(!e.emittedError){var r=new f,i=t.readUInt32LE(0);if(i!==33639248)return u(e,Error(`invalid central directory file header signature: 0x`+i.toString(16)));if(r.versionMadeBy=t.readUInt16LE(4),r.versionNeededToExtract=t.readUInt16LE(6),r.generalPurposeBitFlag=t.readUInt16LE(8),r.compressionMethod=t.readUInt16LE(10),r.lastModFileTime=t.readUInt16LE(12),r.lastModFileDate=t.readUInt16LE(14),r.crc32=t.readUInt32LE(16),r.compressedSize=t.readUInt32LE(20),r.uncompressedSize=t.readUInt32LE(24),r.fileNameLength=t.readUInt16LE(28),r.extraFieldLength=t.readUInt16LE(30),r.fileCommentLength=t.readUInt16LE(32),r.internalFileAttributes=t.readUInt16LE(36),r.externalFileAttributes=t.readUInt32LE(38),r.relativeOffsetOfLocalHeader=t.readUInt32LE(42),r.generalPurposeBitFlag&64)return u(e,Error(`strong encryption is not supported`));e.readEntryCursor+=46,t=T(r.fileNameLength+r.extraFieldLength+r.fileCommentLength),v(e.reader,t,0,t.length,e.readEntryCursor,function(n){if(n)return u(e,n);if(!e.emittedError){r.fileNameRaw=t.subarray(0,r.fileNameLength);var i=r.fileNameLength+r.extraFieldLength;r.extraFieldRaw=t.subarray(r.fileNameLength,i),r.fileCommentRaw=t.subarray(i,i+r.fileCommentLength);try{r.extraFields=_(r.extraFieldRaw)}catch(t){return u(e,t)}if(e.decodeStrings){var a=(r.generalPurposeBitFlag&2048)!=0;r.fileComment=C(r.fileCommentRaw,a),r.fileName=h(r.generalPurposeBitFlag,r.fileNameRaw,r.extraFields,e.strictFileNames);var o=g(r.fileName);if(o!=null)return u(e,Error(o))}else r.fileComment=r.fileCommentRaw,r.fileName=r.fileNameRaw;r.comment=r.fileComment,e.readEntryCursor+=t.length,e.entriesRead+=1;for(var s=0;s<r.extraFields.length;s++){var c=r.extraFields[s];if(c.id===1){var l=c.data,d=0;if(r.uncompressedSize===4294967295){if(d+8>l.length)return u(e,Error(`zip64 extended information extra field does not include uncompressed size`));r.uncompressedSize=w(l,d),d+=8}if(r.compressedSize===4294967295){if(d+8>l.length)return u(e,Error(`zip64 extended information extra field does not include compressed size`));r.compressedSize=w(l,d),d+=8}if(r.relativeOffsetOfLocalHeader===4294967295){if(d+8>l.length)return u(e,Error(`zip64 extended information extra field does not include relative header offset`));r.relativeOffsetOfLocalHeader=w(l,d),d+=8}break}}if(e.validateEntrySizes&&r.compressionMethod===0){var f=r.uncompressedSize;if(r.isEncrypted()&&(f+=12),r.compressedSize!==f){var p=`compressed/uncompressed size mismatch for stored file: `+r.compressedSize+` != `+r.uncompressedSize;return u(e,Error(p))}}e.emit(`entry`,r),e.lazyEntries||e._readEntry()}})}})}},l.prototype.eachEntry=function(){let e=this;if(!e.lazyEntries)throw Error(`eachEntry() requires lazyEntries: true`);if(e.hasEachEntryBeenCalled)throw Error(`eachEntry() must only be called once per ZipFile`);e.hasEachEntryBeenCalled=!0;let t=null;e.on(`entry`,r),e.on(`end`,i),e.on(`error`,a);function n(){e.removeListener(`entry`,r),e.removeListener(`end`,i),e.removeListener(`error`,a),e.autoClose&&e.close()}function r(e){let{resolve:n}=t;t=null,n({value:e})}function i(){let{resolve:e}=t;t=null,n(),e({done:!0})}function a(e){let{reject:r}=t;t=null,n(),r(e)}return{[Symbol.asyncIterator](){return this},next(){let n=new Promise((e,n)=>{if(t!=null)throw Error(`next() called before previous Promise was resolved.`);t={resolve:e,reject:n}});return e.readEntry(),n},return(e){return n(),Promise.resolve({done:!0,value:e})},throw(e){return n(),Promise.reject(e)}}},l.prototype.openReadStream=function(e,t,n){var r=this,i=0,a=e.compressedSize;if(n??(n=t,t=null),t==null)t={};else{if(t.decodeFileData===!1){if(t.decrypt!=null)throw Error(`cannot use options.decrypt when options.decodeFileData === false`);if(t.decompress!=null)throw Error(`cannot use options.decompress when options.decodeFileData === false`)}else{if(t.decrypt!=null){if(!e.isEncrypted())throw Error(`options.decrypt can only be specified for encrypted entries. See also option decodeFileData.`);if(t.decrypt!==!1)throw Error(`invalid options.decrypt value: `+t.decrypt);if(e.isCompressed()&&t.decompress!==!1)throw Error(`entry is encrypted and compressed, and options.decompress !== false. See also option decodeFileData.`)}if(t.decompress!=null){if(!e.isCompressed())throw Error(`options.decompress can only be specified for compressed entries. See also option decodeFileData.`);if(!(t.decompress===!1||t.decompress===!0))throw Error(`invalid options.decompress value: `+t.decompress);s=t.decompress}}if(t.start!=null){if(i=t.start,i<0)throw Error(`options.start < 0`);if(i>e.compressedSize)throw Error(`options.start > entry.compressedSize`)}if(t.end!=null){if(a=t.end,a<0)throw Error(`options.end < 0`);if(a>e.compressedSize)throw Error(`options.end > entry.compressedSize`);if(a<i)throw Error(`options.end < options.start`)}}var o=t.decodeFileData===!1||(e.compressionMethod===0||e.compressionMethod===8&&t.decompress===!1)&&(!e.isEncrypted()||t.decrypt===!1);if((t.start!=null||t.end!=null)&&!o)throw Error(`start/end range require options.decodeFileData === false for non-trivial encoded entries.`);if(!r.isOpen)return n(Error(`closed`));if(e.isEncrypted()&&!o&&t.decrypt!==!1)return n(Error(`entry is encrypted, and options.decodeFileData !== false`));var s;if(o)s=!1;else if(e.compressionMethod===8)s=t.decodeFileData!==!0;else return n(Error(`unsupported compression method: `+e.compressionMethod));r.readLocalFileHeader(e,{minimal:!0},function(t,o){if(t)return n(t);r.openReadStreamLowLevel(o.fileDataStart,e.compressedSize,i,a,s,e.uncompressedSize,n)})},l.prototype.openReadStreamLowLevel=function(e,t,r,i,a,o,s){var c=this;e+t;var l=c.reader.createReadStream({start:e+r,end:e+i}),u=l;if(a){var d=!1,f=n.createInflateRaw();l.on(`error`,function(e){setImmediate(function(){d||f.emit(`error`,e)})}),l.pipe(f),c.validateEntrySizes?(u=new y(o),f.on(`error`,function(e){setImmediate(function(){d||u.emit(`error`,e)})}),f.pipe(u)):u=f,E(u,function(){d=!0,f!==u&&f.unpipe(u),l.unpipe(f),l.destroy()})}s(null,u)},l.prototype.readLocalFileHeader=function(e,t,n){var r=this;n??(n=t,t=null),t??={},r.reader.ref();var i=T(30);v(r.reader,i,0,i.length,e.relativeOffsetOfLocalHeader,function(a){try{if(a)return n(a);var o=i.readUInt32LE(0);if(o!==67324752)return n(Error(`invalid local file header signature: 0x`+o.toString(16)));var s=i.readUInt16LE(26),c=i.readUInt16LE(28),l=e.relativeOffsetOfLocalHeader+30+s+c;if(l+e.compressedSize>r.fileSize)return n(Error(`file data overflows file bounds: `+l+` + `+e.compressedSize+` > `+r.fileSize));if(t.minimal)return n(null,{fileDataStart:l});var u=new p;u.fileDataStart=l,u.versionNeededToExtract=i.readUInt16LE(4),u.generalPurposeBitFlag=i.readUInt16LE(6),u.compressionMethod=i.readUInt16LE(8),u.lastModFileTime=i.readUInt16LE(10),u.lastModFileDate=i.readUInt16LE(12),u.crc32=i.readUInt32LE(14),u.compressedSize=i.readUInt32LE(18),u.uncompressedSize=i.readUInt32LE(22),u.fileNameLength=s,u.extraFieldLength=c,i=T(s+c),r.reader.ref(),v(r.reader,i,0,i.length,e.relativeOffsetOfLocalHeader+30,function(e){try{return e?n(e):(u.fileName=i.subarray(0,s),u.extraField=i.subarray(s),n(null,u))}finally{r.reader.unref()}})}finally{r.reader.unref()}})},l.prototype.openReadStreamPromise=function(e,t){return new Promise((n,r)=>{this.openReadStream(e,t,function(e,t){if(e)return r(e);n(t)})})},l.prototype.openReadStreamLowLevelPromise=function(e,t,n,r,i,a){return new Promise((o,s)=>{this.openReadStream(e,t,n,r,i,a,function(e,t){if(e)return s(e);o(t)})})},l.prototype.readLocalFileHeaderPromise=function(e,t){return new Promise((n,r)=>{this.readLocalFileHeader(e,t,function(e,t){if(e)return r(e);n(t)})})};function f(){}f.prototype.getLastModDate=function(e){if(e??={},!e.forceDosFormat)for(var t=0;t<this.extraFields.length;t++){var n=this.extraFields[t];if(n.id===21589){var r=n.data;if(r.length<5||!(r[0]&1))continue;var i=r.readInt32LE(1);return new Date(i*1e3)}else if(n.id===10){var r=n.data;if(r.length!==32||r.readUInt16LE(4)!==1||r.readUInt16LE(6)!==24)continue;var a=(r.readUInt32LE(8)+4294967296*r.readInt32LE(12))/1e4-0xa9730b66800;return new Date(a)}}return m(this.lastModFileDate,this.lastModFileTime,e.timezone)},f.prototype.canDecodeFileData=function(){return!this.isEncrypted()&&(this.compressionMethod===0||this.compressionMethod===8)},f.prototype.isEncrypted=function(){return(this.generalPurposeBitFlag&1)!=0},f.prototype.isCompressed=function(){return this.compressionMethod===8};function p(){}function m(e,t,n){var r=e&31,i=(e>>5&15)-1,a=(e>>9&127)+1980,o=0,s=(t&31)*2,c=t>>5&63,l=t>>11&31;if(n==null||n===`local`)return new Date(a,i,r,l,c,s,o);if(n===`UTC`)return new Date(Date.UTC(a,i,r,l,c,s,o));throw Error(`unrecognized options.timezone: `+options.timezone)}function h(e,t,n,r){for(var i=null,a=0;a<n.length;a++){var o=n[a];if(o.id===28789){if(o.data.length<6||o.data.readUInt8(0)!==1)continue;var s=o.data.readUInt32LE(1);if(c(t)!==s)continue;i=C(o.data.subarray(5),!0);break}}return i??=C(t,(e&2048)!=0),r||(i=i.replace(/\\/g,`/`)),i}function g(e){return e.indexOf(`\\`)===-1?/^[a-zA-Z]:/.test(e)||/^\//.test(e)?`absolute path: `+e:e.split(`/`).indexOf(`..`)===-1?null:`invalid relative path: `+e:`invalid characters in fileName: `+e}function _(e){for(var t=[],n=0;n<e.length-3;){var r=e.readUInt16LE(n+0),i=e.readUInt16LE(n+2),a=n+4,o=a+i;if(o>e.length)throw Error(`extra field length exceeds extra field buffer size`);var s=e.subarray(a,o);t.push({id:r,data:s}),n=o}return t}function v(e,t,n,r,i,a){if(r===0)return setImmediate(function(){a(null,T(0))});e.read(t,n,r,i,function(e,t){if(e)return a(e);if(t<r)return a(Error(`unexpected EOF`));a()})}r.inherits(y,a);function y(e){a.call(this),this.actualByteCount=0,this.expectedByteCount=e}y.prototype._transform=function(e,t,n){if(this.actualByteCount+=e.length,this.actualByteCount>this.expectedByteCount){var r=`too many bytes in the stream. expected `+this.expectedByteCount+`. got at least `+this.actualByteCount;return n(Error(r))}n(null,e)},y.prototype._flush=function(e){if(this.actualByteCount<this.expectedByteCount){var t=`not enough bytes in the stream. expected `+this.expectedByteCount+`. got only `+this.actualByteCount;return e(Error(t))}e()},r.inherits(b,i);function b(){i.call(this),this.refCount=0}b.prototype.ref=function(){this.refCount+=1},b.prototype.unref=function(){var e=this;if(--e.refCount,e.refCount>0)return;if(e.refCount<0)throw Error(`invalid unref`);e.close(t);function t(t){if(t)return e.emit(`error`,t);e.emit(`close`)}},b.prototype.createReadStream=function(e){e??={};var t=e.start,n=e.end;if(t===n){var r=new o;return setImmediate(function(){r.end()}),r}var i=this._readStreamForRange(t,n),a=!1,s=new x(this);i.on(`error`,function(e){setImmediate(function(){a||s.emit(`error`,e)})}),E(s,function(){i.unpipe(s),s.unref(),i.destroy()});var c=new y(n-t);return s.on(`error`,function(e){setImmediate(function(){a||c.emit(`error`,e)})}),E(c,function(){a=!0,s.unpipe(c),s.destroy()}),i.pipe(s).pipe(c)},b.prototype._readStreamForRange=function(e,t){throw Error(`not implemented`)},b.prototype.read=function(e,t,n,r,i){var a=this.createReadStream({start:r,end:r+n}),o=new s,c=0;o._write=function(n,r,i){n.copy(e,t+c,0,n.length),c+=n.length,i()},o.on(`finish`,i),a.on(`error`,function(e){i(e)}),a.pipe(o)},b.prototype.close=function(e){setImmediate(e)},r.inherits(x,o);function x(e){o.call(this),this.context=e,this.context.ref(),this.unreffedYet=!1}x.prototype._flush=function(e){this.unref(),e()},x.prototype.unref=function(e){this.unreffedYet||(this.unreffedYet=!0,this.context.unref())};var S=`\0☺☻♥♦♣♠•◘○◙♂♀♪♫☼►◄↕‼¶§▬↨↑↓→←∟↔▲▼ !"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_\`abcdefghijklmnopqrstuvwxyz{|}~⌂ÇüéâäàåçêëèïîìÄÅÉæÆôöòûùÿÖÜ¢£¥₧ƒáíóúñѪº¿⌐¬½¼¡«»░▒▓│┤╡╢╖╕╣║╗╝╜╛┐└┴┬├─┼╞╟╚╔╩╦╠═╬╧╨╤╥╙╘╒╓╫╪┘┌█▄▌▐▀αßΓπΣσµτΦΘΩδ∞φε∩≡±≥≤⌠⌡÷≈°∙·√ⁿ²■\xA0`;function C(e,t){if(t)return e.toString(`utf8`);for(var n=``,r=0;r<e.length;r++)n+=S[e[r]];return n}function w(e,t){var n=e.readUInt32LE(t);return e.readUInt32LE(t+4)*4294967296+n}var T=typeof Buffer.allocUnsafe==`function`?function(e){return Buffer.allocUnsafe(e)}:function(e){return new Buffer(e)};function E(e,t){typeof e.destroy==`function`?e._destroy=function(e,n){t(),n?.(e)}:e.destroy=t}}));Nge(),Lge(),Object.freeze({source:`local`,skipStoreHooks:!0,context:Object.freeze({origin:`effect-capture`,paired:!1})});const k3={start:F().int().nonnegative().optional(),end:F().int().nonnegative().optional(),quote:P().min(1).optional(),prefix:P().max(1e3).optional(),suffix:P().max(1e3).optional()};z({docName:P().min(1),...k3,propertyKey:P().min(1).optional(),propertyPath:R(So([P(),F().int().nonnegative()])).optional(),body:P(),queue:I().optional(),summary:P().optional()});const A3=lo();Co(`action`,[z({action:H(`edit`),id:A3,body:P(),summary:P().optional()}),z({action:H(`resolve`),id:A3,summary:P().optional()}),z({action:H(`reopen`),id:A3,summary:P().optional()}),z({action:H(`replace`),id:A3,...k3,summary:P().optional()}),z({action:H(`queue`),id:A3,summary:P().optional()}),z({action:H(`unqueue`),id:A3,summary:P().optional()}),z({action:H(`dispatch-prepare`),id:A3,summary:P().optional()}),z({action:H(`dispatch-complete`),id:A3,summary:P().optional()}),z({action:H(`dispatch-prepare-batch`),ids:R(A3).min(1).max(200),summary:P().optional()}),z({action:H(`dispatch-complete-batch`),ids:R(A3).min(1).max(200),summary:P().optional()})]);const j3="Absolute host path inside the target OpenKnowledge project. Required when the MCP server is registered globally (e.g. `npx @inkeep/open-knowledge mcp` once at the host level, routing per call), unless the MCP client advertises exactly one root via the `roots` capability — that single root is then used as the implicit `cwd`. Optional when the server is anchored to a single project (the per-project HTTP MCP server defaults to its configured project root).";P().max(200).optional().describe(`Optional one-line user-outcome description (≤80 chars). Appears as a bullet in the timeline.`),P().length(40).regex(/^[0-9a-f]+$/i).describe("A 40-character commit SHA identifying a saved version. Produced by `checkpoint`, listed by `history` as `entries[].version`, and consumed here — the same `version` field name across all three."),P().nullable().describe("Route-only preview URL (`/#/<doc>`, no host:port), or null when no UI is running."),P().optional().describe(`How the previewUrl was resolved (e.g. the UI lock).`),P().optional().describe(`Route of the prior/removed path, for closing a stale preview tab.`);const Rge=z({value:P(),truncatedFrom:F().optional(),hint:P().optional()}).describe(`Normalized change-note summary, when one was recorded.`),zge=R(B(P(),L()));B(P(),L()).optional().describe("Preview-attach hint (`{ action, previewUrl?, message? }`) when relevant."),R($q).describe('Outbound internal links in the just-written doc that do not resolve. Always present — `[]` means every link resolves. Each: `{ href (as written), resolvedTo (the docName or content-root file path it pointed at, or null), reason: "no-such-doc" | "no-such-file" | "unresolvable" }`. Report-only — the write landed regardless; fix in a follow-up edit.'),Rge.optional(),R(Zq).min(1).optional().describe("Advisory entries discriminated by `kind`. Write-integrity kinds — `content-divergence` (converged Y.Text didn't byte-match what you composed) and `disk-edit-reconciled` (an out-of-band disk edit was folded in before your write) — mean re-read the doc. The renderability kind `mermaid-parse-error` means the write landed but that fence will not render — fix it and re-edit."),R(z({name:P(),description:P().optional()})).min(1).optional().describe("Templates the parent folder offers, present only when a create passed no `template`. A nudge — the write already landed; pass `template` next time to match the folder's shape.");const Bge=P().optional().describe("Auto-duplicated body text. `textPlusStructured` mirrors the visible body here as a Claude / Claude Desktop client-quirk workaround (those clients hide `content[]` when `structuredContent` is present). Internal — programmatic consumers should prefer the `content[0].text` channel.");function M3(e){return{text:Bge,...e}}new class{capacity;store;writeIndex=0;filled=!1;constructor(e){if(!Number.isInteger(e)||e<=0)throw RangeError(`RingBuffer capacity must be a positive integer, got ${e}`);this.capacity=e,this.store=Array(e)}push(e){this.store[this.writeIndex]=e,this.writeIndex=(this.writeIndex+1)%this.capacity,this.writeIndex===0&&(this.filled=!0)}read(){let e=[],t=this.filled?this.capacity:this.writeIndex;for(let n=1;n<=t;n++){let t=(this.writeIndex-n+this.capacity)%this.capacity,r=this.store[t];r!==void 0&&e.push(r)}return e}get size(){return this.filled?this.capacity:this.writeIndex}}(256),Dl.cursor,Dl.codex,Dl[`claude-desktop`],o1(`embeddings`),o1(`embeddings`);function Vge(e){try{let t=new URL(e),n=t.pathname.replace(/\/+$/,``);return`${t.protocol}//${t.host.toLowerCase()}${n}`}catch{return e.trim().replace(/\/+$/,``)}}Vge(Cs),o1(`embeddings`),o1(`embeddings`);const Hge=String.raw`\[\[([^\n#[\]|]+)(?:#([^\n[\]|]+))?(?:\|([^\n[\]]+))?\]\]`,Uge=String.raw`\((<[^>\n]+>|[^)\s\n]+)((?:\s+(?:"[^"\n]*"|'[^'\n]*'|\([^)\n]*\)))?)\)`,N3=String.raw`([^\]\n]*)`,Wge=String.raw`([^\]\n]*(?:\][^[\]\n]*)?)`,P3=e=>RegExp(`(!?)${Hge}`,e),F3=(e,t)=>RegExp(`(!?)\\[${e}\\]${Uge}`,t);P3(`y`),P3(`g`),F3(N3,`y`),F3(N3,`g`),F3(Wge,`g`);function I3(e){return e.replace(/\\/g,`/`)}function L3(e){return{...e,windowsHide:!0}}z({target:V(Object.keys({"claude-cowork":{type:`app-bundle`,appName:`Claude`,urlScheme:`claude:`,probeScheme:`claude`,quitFirst:!1},"claude-code":{type:`app-bundle`,appName:`Claude`,urlScheme:`claude:`,probeScheme:`claude`,quitFirst:!1},codex:{type:`app-bundle`,appName:`Codex`,urlScheme:`codex:`,probeScheme:`codex`,quitFirst:!0},cursor:{type:`cli-binary`,binaryName:`cursor`,urlScheme:`cursor:`}})),url:P().min(1).max(4096),workspacePath:P().optional()}),z({}).loose(),o1(`installed-skills-marker`);var R3=e(i(((e,t)=>{function n(e){return Array.isArray(e)?e:[e]}let r=/^\s+$/,i=/(?:[^\\]|^)\\$/,a=/^\\!/,o=/^\\#/,s=/\r?\n/g,c=/^\.*\/|^\.+$/,l=`node-ignore`;typeof Symbol<`u`&&(l=Symbol.for(`node-ignore`));let u=l,d=(e,t,n)=>Object.defineProperty(e,t,{value:n}),f=/([0-z])-([0-z])/g,p=()=>!1,m=e=>e.replace(f,(e,t,n)=>t.charCodeAt(0)<=n.charCodeAt(0)?e:``),h=e=>{let{length:t}=e;return e.slice(0,t-t%2)},g=[[/^\uFEFF/,()=>``],[/((?:\\\\)*?)(\\?\s+)$/,(e,t,n)=>t+(n.indexOf(`\\`)===0?` `:``)],[/(\\+?)\s/g,(e,t)=>{let{length:n}=t;return t.slice(0,n-n%2)+` `}],[/[\\$.|*+(){^]/g,e=>`\\${e}`],[/(?!\\)\?/g,()=>`[^/]`],[/^\//,()=>`^`],[/\//g,()=>`\\/`],[/^\^*\\\*\\\*\\\//,()=>`^(?:.*\\/)?`],[/^(?=[^^])/,function(){return/\/(?!$)/.test(this)?`^`:`(?:^|\\/)`}],[/\\\/\\\*\\\*(?=\\\/|$)/g,(e,t,n)=>t+6<n.length?`(?:\\/[^\\/]+)*`:`\\/.+`],[/(^|[^\\]+)(\\\*)+(?=.+)/g,(e,t,n)=>t+n.replace(/\\\*/g,`[^\\/]*`)],[/\\\\\\(?=[$.|*+(){^])/g,()=>`\\`],[/\\\\/g,()=>`\\`],[/(\\)?\[([^\]/]*?)(\\*)($|\])/g,(e,t,n,r,i)=>t===`\\`?`\\[${n}${h(r)}${i}`:i===`]`&&r.length%2==0?`[${m(n)}${r}]`:`[]`],[/(?:[^*])$/,e=>/\/$/.test(e)?`${e}$`:`${e}(?=$|\\/$)`],[/(\^|\\\/)?\\\*$/,(e,t)=>`${t?`${t}[^/]+`:`[^/]*`}(?=$|\\/$)`]],_=Object.create(null),v=(e,t)=>{let n=_[e];return n||(n=g.reduce((t,[n,r])=>t.replace(n,r.bind(e)),e),_[e]=n),t?new RegExp(n,`i`):new RegExp(n)},y=e=>typeof e==`string`,b=e=>e&&y(e)&&!r.test(e)&&!i.test(e)&&e.indexOf(`#`)!==0,x=e=>e.split(s);var S=class{constructor(e,t,n,r){this.origin=e,this.pattern=t,this.negative=n,this.regex=r}};let C=(e,t)=>{let n=e,r=!1;e.indexOf(`!`)===0&&(r=!0,e=e.substr(1)),e=e.replace(a,`!`).replace(o,`#`);let i=v(e,t);return new S(n,e,r,i)},w=(e,t)=>{throw new t(e)},T=(e,t,n)=>y(e)?e?T.isNotRelative(e)?n(`path should be a \`path.relative()\`d string, but got "${t}"`,RangeError):!0:n(`path must not be empty`,TypeError):n(`path must be a string, but got \`${t}\``,TypeError),E=e=>c.test(e);T.isNotRelative=E,T.convert=e=>e;var D=class{constructor({ignorecase:e=!0,ignoreCase:t=e,allowRelativePaths:n=!1}={}){d(this,u,!0),this._rules=[],this._ignoreCase=t,this._allowRelativePaths=n,this._initCache()}_initCache(){this._ignoreCache=Object.create(null),this._testCache=Object.create(null)}_addPattern(e){if(e&&e[u]){this._rules=this._rules.concat(e._rules),this._added=!0;return}if(b(e)){let t=C(e,this._ignoreCase);this._added=!0,this._rules.push(t)}}add(e){return this._added=!1,n(y(e)?x(e):e).forEach(this._addPattern,this),this._added&&this._initCache(),this}addPattern(e){return this.add(e)}_testOne(e,t){let n=!1,r=!1;return this._rules.forEach(i=>{let{negative:a}=i;r===a&&n!==r||a&&!n&&!r&&!t||i.regex.test(e)&&(n=!a,r=a)}),{ignored:n,unignored:r}}_test(e,t,n,r){let i=e&&T.convert(e);return T(i,e,this._allowRelativePaths?p:w),this._t(i,t,n,r)}_t(e,t,n,r){if(e in t)return t[e];if(r||=e.split(`/`),r.pop(),!r.length)return t[e]=this._testOne(e,n);let i=this._t(r.join(`/`)+`/`,t,n,r);return t[e]=i.ignored?i:this._testOne(e,n)}ignores(e){return this._test(e,this._ignoreCache,!1).ignored}createFilter(){return e=>!this.ignores(e)}filter(e){return n(e).filter(this.createFilter())}test(e){return this._test(e,this._testCache,!0)}};let ee=e=>new D(e);if(ee.isPathValid=e=>T(e&&T.convert(e),e,p),ee.default=ee,t.exports=ee,typeof process<`u`&&(process.env&&process.env.IGNORE_TEST_WIN32||process.platform===`win32`)){T.convert=e=>/^\\\\\?\\/.test(e)||/["<>|\u0000-\u001F]+/u.test(e)?e:e.replace(/\\/g,`/`);let e=/^[a-z]:\//i;T.isNotRelative=t=>e.test(t)||E(t)}}))(),1);const z3=o1(`content-filter`);Ie(s);const B3=new Set(`node_modules,.venv,venv,env,__pycache__,vendor,dist,build,out,output,.next,.nuxt,.svelte-kit,.astro,.turbo,.cache,.parcel-cache,coverage,.git,.ok,.open-knowledge,.openknowledge,.claude,.cursor,.codex,.agents,.opencode,.pi,Library,Applications,.Trash`.split(`,`)),Gge=new Set([`.git`,`node_modules`,`.ok`,`.open-knowledge`,`.openknowledge`,`.claude`,`.cursor`,`.codex`,`.agents`,`.opencode`,`.pi`]),Kge=new Set([`worktrees`,`local`]);function V3(e,t){let n=e.split(`/`);for(let e=0;e<n.length;e++){let r=n[e];if(Gge.has(r)&&!(t&&r===`.ok`&&!Kge.has((n[e+1]??``).toLowerCase())))return!0}return!1}function H3(e){return e.startsWith(`${vl}/`)}function qge(e){return e===`.ok`||e===`.ok/skills`||e.startsWith(`.ok/skills/`)}function Jge(e){let t=e.replace(/^\/+/,``).replace(/\/+$/,``).trim();return t===`.ok`||t===`.ok/**`||t===`**/.ok`||t===`**/.ok/**`}function U3(e,t){for(let n=0;n<t;n++)if(B3.has(e[n]))return!0;return!1}function W3(e){let t=e.split(`/`),n=t.length;return n<3||t[n-3]!==`.ok`||t[n-2]!==`templates`||he(t[n-1])!==`.md`?!1:!U3(t,n-3)}function Yge(e){let t=e.split(`/`),n=t.length;return t[n-1]===`.ok`?!U3(t,n-1):n>=2&&t[n-1]===`templates`&&t[n-2]===`.ok`?!U3(t,n-2):!1}function G3(e,t){if(t.size===0)return!1;for(let n of t)if(e.startsWith(`${n}/`))return!0;return!1}function Xge(e,t){if(t.size===0)return!1;for(let n of t)if(n===e||n.startsWith(`${e}/`)||e.startsWith(`${n}/`))return!0;return!1}const Zge=new Set([`.DS_Store`,`.localized`]);function K3(e){return Zge.has(e.slice(e.lastIndexOf(`/`)+1))}const Qge=new Set([`.ssh`,`.aws`,`.gnupg`,`.kube`,`.docker`]);function q3(e){for(let t of e.split(`/`))if(Qge.has(t.toLowerCase()))return!0;return!1}const $ge=new Set([`credentials`,`.netrc`,`.npmrc`,`.pgpass`,`.git-credentials`]),e_e=[`.pem`,`.key`,`.p12`,`.pfx`,`.keystore`,`.jks`,`.ppk`];function J3(e){let t=e.slice(e.lastIndexOf(`/`)+1).toLowerCase();if(t===`.env`||t.startsWith(`.env.`)||$ge.has(t)||t.startsWith(`id_rsa`)||t.startsWith(`id_ed25519`)||t.startsWith(`id_ecdsa`)||t.startsWith(`id_dsa`))return!0;for(let e of e_e)if(t.endsWith(e))return!0;return!1}function t_e(e,t){return t===e||t.startsWith(`${e}/`)}const Y3=[`.gitignore`,`.okignore`];function n_e(e,t){let n=r_e(e);if(n===null)return[];let r=[];X3(M(n,`info`,`exclude`),t,r,`info/exclude`);let i=i_e(e);return i&&X3(i,t,r,`global excludesfile`),r}function r_e(e){let t=u(`git`,[`rev-parse`,`--git-common-dir`],L3({cwd:e,encoding:`utf-8`,timeout:5e3}));return t.status!==0||!t.stdout?null:ye(e,t.stdout.trim())}function i_e(e){let t=u(`git`,[`config`,`--get`,`--type=path`,`core.excludesfile`],L3({cwd:e,encoding:`utf-8`,timeout:5e3}));if(t.status===0&&t.stdout){let e=t.stdout.trim();if(e)return e}return a_e()}function a_e(){let e=process.env.XDG_CONFIG_HOME?.trim();return M(e&&e.length>0?e:M(se(),`.config`),`git`,`ignore`)}function X3(e,t,n,r){if(g(e))try{let r=S(e,`utf-8`);t.value+=r.length,n.push(...Q3(r))}catch(t){z3.warn({path:e,err:t},`Failed to read ${r} at ${e}`)}}function o_e(e){let{projectDir:t,contentDir:n,onAfterRebuild:r,singleDocRelPath:i}=e,a=e.inPlaceSkillDirs??new Set,o=I3(ve(t,n)),s=o.startsWith(`..`),c,l,u,d,f=0,p=0,m=0;function h(){let e=(0,R3.default)(),r=(0,R3.default)();e.add(`.git`);let i=[],a=0,h=0;for(let n of Y3){let o=M(t,n);if(g(o))try{let t=S(o,`utf-8`);a+=t.length;let s=Q3(t);i.push(...s),e.add(s),n===`.okignore`&&r.add(s)}catch(e){z3.warn({path:o,err:e},`Failed to read ${n} at ${o}`)}}if(o&&!s)for(let t of Y3){let i=M(n,t);if(g(i))try{let n=S(i,`utf-8`);a+=n.length,h++;let s=Q3(n).map(e=>$3(e,o));e.add(s),t===`.okignore`&&r.add(s)}catch(e){z3.warn({path:i,err:e},`Failed to read ${t} at ${i}`)}}let _={value:a};h+=e6(n,t,e,r,_),a=_.value;let v=n_e(t,_);a=_.value,v.length>0&&(i.push(...v),e.add(v));let y=i.filter(e=>e.length>0&&!e.startsWith(`!`)&&!e.startsWith(`#`)&&!Jge(e));return c=e,l=r,u=i,d=y,f=i.length,p=h,m=a,{patternCount:f,nestedFileCount:p,bytes:m}}h();let _=new Map;function v(e){if(s)return!1;let t=o?`${o}/${e}`:e;return c.ignores(t)}function y(e){if(s)return!1;let t=o?`${o}/${e}`:e;return l.ignores(t)}let b=()=>{i===void 0&&Z3(n,``,v,_)};b();function x(e){return Oge(Cge(e))}function C(e){for(let t of e.split(`/`))if(B3.has(t))return!0;return s?!1:v(e)}return{isExcluded(e,t){if(x(e)||J3(e)||q3(e))return!0;if(!t?.bypassFilters&&(H3(e)||G3(e,a)&&!v(e))){if(i!==void 0)return e!==i;if(E3(e))return!1;let t=he(e).slice(1).toLowerCase();return!ss.has(t)}if(!t?.bypassFilters&&W3(e))return i===void 0?!1:e!==i;if(V3(e,t?.showOk)||K3(e))return!0;if(i!==void 0)return e!==i;if(t?.bypassFilters)return t.respectOkignore===!0&&y(e);if(C(e))return!0;if(E3(e))return!1;let n=he(e).slice(1).toLowerCase();if(ss.has(n)){let t=me(e),n=t===`.`?``:t;if((_.get(n)??0)>0)return!1}return!0},isDirExcluded(e,t){if(q3(e))return!0;if(!t?.bypassFilters&&(qge(e)||Yge(e)||Xge(e,a)))return!1;if(V3(e,t?.showOk))return!0;if(i!==void 0)return!t_e(e,i);if(t?.bypassFilters)return t.respectOkignore===!0&&(y(e)||y(`${e}/`));for(let t of e.split(`/`))if(B3.has(t))return!0;if(s)return!1;let n=o?`${o}/${e}`:e;return c.ignores(n)||c.ignores(`${n}/`)},isPathIgnored(e,t){return x(e)||J3(e)||q3(e)?!0:H3(e)||G3(e,a)&&!v(e)||W3(e)?!1:V3(e)||K3(e)?!0:t?.bypassFilters?!1:C(e)},getWatcherIgnoreGlobs(){return d},incrementMdDir(e){let t=e===`.`?``:e;_.set(t,(_.get(t)??0)+1)},decrementMdDir(e){let t=e===`.`?``:e,n=_.get(t)??0;n<=1?_.delete(t):_.set(t,n-1)},rebuildDirCount(){let e=new Map(_);_.clear();try{b()}catch(t){for(let[t,n]of e)_.set(t,n);z3.warn({err:t instanceof Error?t:Error(String(t))},`content-filter rebuildDirCount walk failed — retaining previous counts`)}},async rebuildIgnorePatterns(){if(e.rescanInPlaceSkillDirs)try{a=e.rescanInPlaceSkillDirs()}catch(e){z3.warn({err:e},`in-place skill re-scan failed — keeping previous allow-list`)}let t=c,n=l,i=u,o=d,s=f,g=p,v=m,y=Date.now();return wpe(`config.ignore.rebuild`,{attributes:{}},async e=>{try{let t=h();_.clear(),b();let n=Date.now()-y;if(e.setAttributes({"ok.ignore.pattern_count":t.patternCount,"ok.ignore.nested_file_count":t.nestedFileCount,"ok.ignore.bytes":t.bytes}),z3.info({patternCount:t.patternCount,nestedFileCount:t.nestedFileCount,bytes:t.bytes,durationMs:n},`content-filter rebuild succeeded`),r)try{r()}catch(e){z3.warn({err:e instanceof Error?e:Error(String(e))},`content-filter onAfterRebuild callback threw — derived views may be stale`)}return{ok:!0,patternCount:t.patternCount,nestedFileCount:t.nestedFileCount,bytes:t.bytes,durationMs:n}}catch(e){c=t,l=n,u=i,d=o,f=s,p=g,m=v,_.clear();try{b()}catch(e){z3.warn({err:e instanceof Error?e:Error(String(e))},`content-filter rollback dirCount re-walk failed — sibling-asset counts may be stale until next rebuild`)}let r=e instanceof Error?e.message:String(e);return z3.warn({err:e instanceof Error?e:Error(r)},`content-filter rebuild failed — rolled back to previous state`),{ok:!1,error:{message:r}}}})}}}function Z3(e,t,n,r){let i;try{i=C(e,{withFileTypes:!0})}catch(t){z3.warn({dir:e,err:t},`Failed to read directory for dir-count: ${e}`);return}for(let a of i){let i=t?`${t}/${a.name}`:a.name;if(a.isDirectory()){if(B3.has(a.name)||n(i)||n(`${i}/`))continue;Z3(M(e,a.name),i,n,r)}else a.isFile()&&E3(a.name)&&!n(i)&&r.set(t,(r.get(t)??0)+1)}}function Q3(e){return e.split(`
431
431
  `).map(e=>e.trim()).filter(e=>e.length>0&&!e.startsWith(`#`))}function $3(e,t){let n=e.startsWith(`!`),r=n?e.slice(1):e,i=r.startsWith(`/`)?r.slice(1):r,a=i.endsWith(`/`)?i.slice(0,-1):i,o=r.startsWith(`/`)||a.includes(`/`)?`${t}/${i}`:`${t}/**/${i}`;return n?`!${o}`:o}function e6(e,t,n,r,i){let a;try{a=C(e,{withFileTypes:!0})}catch(t){return z3.warn({dir:e,err:t},`Failed to read directory ${e}`),0}let o=0;for(let s of a){if(!s.isDirectory()||B3.has(s.name))continue;let a=M(e,s.name),c=I3(ve(t,a));if(!c.startsWith(`..`)&&!(n.ignores(c)||n.ignores(`${c}/`))){for(let e of Y3){let t=M(a,e);if(g(t))try{let a=S(t,`utf-8`);i.value+=a.length;let s=Q3(a).map(e=>$3(e,c));n.add(s),e===`.okignore`&&r.add(s),o++}catch(n){z3.warn({path:t,err:n},`Failed to read nested ${e} at ${t}`)}}o+=e6(a,t,n,r,i)}}return o}function t6(e,t=!1){let n=e.length,r=0,i=``,a=0,o=16,s=0,c=0,l=0,u=0,d=0;function f(t,n){let i=0,a=0;for(;i<t||!n;){let t=e.charCodeAt(r);if(t>=48&&t<=57)a=a*16+t-48;else if(t>=65&&t<=70)a=a*16+t-65+10;else if(t>=97&&t<=102)a=a*16+t-97+10;else break;r++,i++}return i<t&&(a=-1),a}function p(e){r=e,i=``,a=0,o=16,d=0}function m(){let t=r;if(e.charCodeAt(r)===48)r++;else for(r++;r<e.length&&i6(e.charCodeAt(r));)r++;if(r<e.length&&e.charCodeAt(r)===46)if(r++,r<e.length&&i6(e.charCodeAt(r)))for(r++;r<e.length&&i6(e.charCodeAt(r));)r++;else return d=3,e.substring(t,r);let n=r;if(r<e.length&&(e.charCodeAt(r)===69||e.charCodeAt(r)===101))if(r++,(r<e.length&&e.charCodeAt(r)===43||e.charCodeAt(r)===45)&&r++,r<e.length&&i6(e.charCodeAt(r))){for(r++;r<e.length&&i6(e.charCodeAt(r));)r++;n=r}else d=3;return e.substring(t,n)}function h(){let t=``,i=r;for(;;){if(r>=n){t+=e.substring(i,r),d=2;break}let a=e.charCodeAt(r);if(a===34){t+=e.substring(i,r),r++;break}if(a===92){if(t+=e.substring(i,r),r++,r>=n){d=2;break}switch(e.charCodeAt(r++)){case 34:t+=`"`;break;case 92:t+=`\\`;break;case 47:t+=`/`;break;case 98:t+=`\b`;break;case 102:t+=`\f`;break;case 110:t+=`
432
432
  `;break;case 114:t+=`\r`;break;case 116:t+=` `;break;case 117:let e=f(4,!0);e>=0?t+=String.fromCharCode(e):d=4;break;default:d=5}i=r;continue}if(a>=0&&a<=31)if(r6(a)){t+=e.substring(i,r),d=2;break}else d=6;r++}return t}function g(){if(i=``,d=0,a=r,c=s,u=l,r>=n)return a=n,o=17;let t=e.charCodeAt(r);if(n6(t)){do r++,i+=String.fromCharCode(t),t=e.charCodeAt(r);while(n6(t));return o=15}if(r6(t))return r++,i+=String.fromCharCode(t),t===13&&e.charCodeAt(r)===10&&(r++,i+=`
433
- `),s++,l=r,o=14;switch(t){case 123:return r++,o=1;case 125:return r++,o=2;case 91:return r++,o=3;case 93:return r++,o=4;case 58:return r++,o=6;case 44:return r++,o=5;case 34:return r++,i=h(),o=10;case 47:let c=r-1;if(e.charCodeAt(r+1)===47){for(r+=2;r<n&&!r6(e.charCodeAt(r));)r++;return i=e.substring(c,r),o=12}if(e.charCodeAt(r+1)===42){r+=2;let t=n-1,a=!1;for(;r<t;){let t=e.charCodeAt(r);if(t===42&&e.charCodeAt(r+1)===47){r+=2,a=!0;break}r++,r6(t)&&(t===13&&e.charCodeAt(r)===10&&r++,s++,l=r)}return a||(r++,d=1),i=e.substring(c,r),o=13}return i+=String.fromCharCode(t),r++,o=16;case 45:if(i+=String.fromCharCode(t),r++,r===n||!i6(e.charCodeAt(r)))return o=16;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return i+=m(),o=11;default:for(;r<n&&_(t);)r++,t=e.charCodeAt(r);if(a!==r){switch(i=e.substring(a,r),i){case`true`:return o=8;case`false`:return o=9;case`null`:return o=7}return o=16}return i+=String.fromCharCode(t),r++,o=16}}function _(e){if(n6(e)||r6(e))return!1;switch(e){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return!1}return!0}function v(){let e;do e=g();while(e>=12&&e<=15);return e}return{setPosition:p,getPosition:()=>r,scan:t?v:g,getToken:()=>o,getTokenValue:()=>i,getTokenOffset:()=>a,getTokenLength:()=>r-a,getTokenStartLine:()=>c,getTokenStartCharacter:()=>a-u,getTokenError:()=>d}}function n6(e){return e===32||e===9}function r6(e){return e===10||e===13}function i6(e){return e>=48&&e<=57}var o_e;(function(e){e[e.lineFeed=10]=`lineFeed`,e[e.carriageReturn=13]=`carriageReturn`,e[e.space=32]=`space`,e[e._0=48]=`_0`,e[e._1=49]=`_1`,e[e._2=50]=`_2`,e[e._3=51]=`_3`,e[e._4=52]=`_4`,e[e._5=53]=`_5`,e[e._6=54]=`_6`,e[e._7=55]=`_7`,e[e._8=56]=`_8`,e[e._9=57]=`_9`,e[e.a=97]=`a`,e[e.b=98]=`b`,e[e.c=99]=`c`,e[e.d=100]=`d`,e[e.e=101]=`e`,e[e.f=102]=`f`,e[e.g=103]=`g`,e[e.h=104]=`h`,e[e.i=105]=`i`,e[e.j=106]=`j`,e[e.k=107]=`k`,e[e.l=108]=`l`,e[e.m=109]=`m`,e[e.n=110]=`n`,e[e.o=111]=`o`,e[e.p=112]=`p`,e[e.q=113]=`q`,e[e.r=114]=`r`,e[e.s=115]=`s`,e[e.t=116]=`t`,e[e.u=117]=`u`,e[e.v=118]=`v`,e[e.w=119]=`w`,e[e.x=120]=`x`,e[e.y=121]=`y`,e[e.z=122]=`z`,e[e.A=65]=`A`,e[e.B=66]=`B`,e[e.C=67]=`C`,e[e.D=68]=`D`,e[e.E=69]=`E`,e[e.F=70]=`F`,e[e.G=71]=`G`,e[e.H=72]=`H`,e[e.I=73]=`I`,e[e.J=74]=`J`,e[e.K=75]=`K`,e[e.L=76]=`L`,e[e.M=77]=`M`,e[e.N=78]=`N`,e[e.O=79]=`O`,e[e.P=80]=`P`,e[e.Q=81]=`Q`,e[e.R=82]=`R`,e[e.S=83]=`S`,e[e.T=84]=`T`,e[e.U=85]=`U`,e[e.V=86]=`V`,e[e.W=87]=`W`,e[e.X=88]=`X`,e[e.Y=89]=`Y`,e[e.Z=90]=`Z`,e[e.asterisk=42]=`asterisk`,e[e.backslash=92]=`backslash`,e[e.closeBrace=125]=`closeBrace`,e[e.closeBracket=93]=`closeBracket`,e[e.colon=58]=`colon`,e[e.comma=44]=`comma`,e[e.dot=46]=`dot`,e[e.doubleQuote=34]=`doubleQuote`,e[e.minus=45]=`minus`,e[e.openBrace=123]=`openBrace`,e[e.openBracket=91]=`openBracket`,e[e.plus=43]=`plus`,e[e.slash=47]=`slash`,e[e.formFeed=12]=`formFeed`,e[e.tab=9]=`tab`})(o_e||={});const a6=Array(20).fill(0).map((e,t)=>` `.repeat(t)),o6={" ":{"\n":Array(200).fill(0).map((e,t)=>`
433
+ `),s++,l=r,o=14;switch(t){case 123:return r++,o=1;case 125:return r++,o=2;case 91:return r++,o=3;case 93:return r++,o=4;case 58:return r++,o=6;case 44:return r++,o=5;case 34:return r++,i=h(),o=10;case 47:let c=r-1;if(e.charCodeAt(r+1)===47){for(r+=2;r<n&&!r6(e.charCodeAt(r));)r++;return i=e.substring(c,r),o=12}if(e.charCodeAt(r+1)===42){r+=2;let t=n-1,a=!1;for(;r<t;){let t=e.charCodeAt(r);if(t===42&&e.charCodeAt(r+1)===47){r+=2,a=!0;break}r++,r6(t)&&(t===13&&e.charCodeAt(r)===10&&r++,s++,l=r)}return a||(r++,d=1),i=e.substring(c,r),o=13}return i+=String.fromCharCode(t),r++,o=16;case 45:if(i+=String.fromCharCode(t),r++,r===n||!i6(e.charCodeAt(r)))return o=16;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return i+=m(),o=11;default:for(;r<n&&_(t);)r++,t=e.charCodeAt(r);if(a!==r){switch(i=e.substring(a,r),i){case`true`:return o=8;case`false`:return o=9;case`null`:return o=7}return o=16}return i+=String.fromCharCode(t),r++,o=16}}function _(e){if(n6(e)||r6(e))return!1;switch(e){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return!1}return!0}function v(){let e;do e=g();while(e>=12&&e<=15);return e}return{setPosition:p,getPosition:()=>r,scan:t?v:g,getToken:()=>o,getTokenValue:()=>i,getTokenOffset:()=>a,getTokenLength:()=>r-a,getTokenStartLine:()=>c,getTokenStartCharacter:()=>a-u,getTokenError:()=>d}}function n6(e){return e===32||e===9}function r6(e){return e===10||e===13}function i6(e){return e>=48&&e<=57}var s_e;(function(e){e[e.lineFeed=10]=`lineFeed`,e[e.carriageReturn=13]=`carriageReturn`,e[e.space=32]=`space`,e[e._0=48]=`_0`,e[e._1=49]=`_1`,e[e._2=50]=`_2`,e[e._3=51]=`_3`,e[e._4=52]=`_4`,e[e._5=53]=`_5`,e[e._6=54]=`_6`,e[e._7=55]=`_7`,e[e._8=56]=`_8`,e[e._9=57]=`_9`,e[e.a=97]=`a`,e[e.b=98]=`b`,e[e.c=99]=`c`,e[e.d=100]=`d`,e[e.e=101]=`e`,e[e.f=102]=`f`,e[e.g=103]=`g`,e[e.h=104]=`h`,e[e.i=105]=`i`,e[e.j=106]=`j`,e[e.k=107]=`k`,e[e.l=108]=`l`,e[e.m=109]=`m`,e[e.n=110]=`n`,e[e.o=111]=`o`,e[e.p=112]=`p`,e[e.q=113]=`q`,e[e.r=114]=`r`,e[e.s=115]=`s`,e[e.t=116]=`t`,e[e.u=117]=`u`,e[e.v=118]=`v`,e[e.w=119]=`w`,e[e.x=120]=`x`,e[e.y=121]=`y`,e[e.z=122]=`z`,e[e.A=65]=`A`,e[e.B=66]=`B`,e[e.C=67]=`C`,e[e.D=68]=`D`,e[e.E=69]=`E`,e[e.F=70]=`F`,e[e.G=71]=`G`,e[e.H=72]=`H`,e[e.I=73]=`I`,e[e.J=74]=`J`,e[e.K=75]=`K`,e[e.L=76]=`L`,e[e.M=77]=`M`,e[e.N=78]=`N`,e[e.O=79]=`O`,e[e.P=80]=`P`,e[e.Q=81]=`Q`,e[e.R=82]=`R`,e[e.S=83]=`S`,e[e.T=84]=`T`,e[e.U=85]=`U`,e[e.V=86]=`V`,e[e.W=87]=`W`,e[e.X=88]=`X`,e[e.Y=89]=`Y`,e[e.Z=90]=`Z`,e[e.asterisk=42]=`asterisk`,e[e.backslash=92]=`backslash`,e[e.closeBrace=125]=`closeBrace`,e[e.closeBracket=93]=`closeBracket`,e[e.colon=58]=`colon`,e[e.comma=44]=`comma`,e[e.dot=46]=`dot`,e[e.doubleQuote=34]=`doubleQuote`,e[e.minus=45]=`minus`,e[e.openBrace=123]=`openBrace`,e[e.openBracket=91]=`openBracket`,e[e.plus=43]=`plus`,e[e.slash=47]=`slash`,e[e.formFeed=12]=`formFeed`,e[e.tab=9]=`tab`})(s_e||={});const a6=Array(20).fill(0).map((e,t)=>` `.repeat(t)),o6={" ":{"\n":Array(200).fill(0).map((e,t)=>`
434
434
  `+` `.repeat(t)),"\r":Array(200).fill(0).map((e,t)=>`\r`+` `.repeat(t)),"\r\n":Array(200).fill(0).map((e,t)=>`\r
435
435
  `+` `.repeat(t))}," ":{"\n":Array(200).fill(0).map((e,t)=>`
436
436
  `+` `.repeat(t)),"\r":Array(200).fill(0).map((e,t)=>`\r`+` `.repeat(t)),"\r\n":Array(200).fill(0).map((e,t)=>`\r
437
- `+` `.repeat(t))}},s_e=[`
437
+ `+` `.repeat(t))}},c_e=[`
438
438
  `,`\r`,`\r
439
- `];function c_e(e,t,n){let r,i,a,o,s;if(t){for(o=t.offset,s=o+t.length,a=o;a>0&&!c6(e,a-1);)a--;let c=s;for(;c<e.length&&!c6(e,c);)c++;i=e.substring(a,c),r=l_e(i,n)}else i=e,r=0,a=0,o=0,s=e.length;let c=u_e(n,e),l=s_e.includes(c),u=0,d=0,f;f=n.insertSpaces?a6[n.tabSize||4]??s6(a6[1],n.tabSize||4):` `;let p=f===` `?` `:` `,m=t6(i,!1),h=!1;function g(){if(u>1)return s6(c,u)+s6(f,r+d);let e=f.length*(r+d);return!l||e>o6[p][c].length?c+s6(f,r+d):e<=0?c:o6[p][c][e]}function _(){let e=m.scan();for(u=0;e===15||e===14;)e===14&&n.keepLines?u+=1:e===14&&(u=1),e=m.scan();return h=e===16||m.getTokenError()!==0,e}let v=[];function y(n,r,i){!h&&(!t||r<s&&i>o)&&e.substring(r,i)!==n&&v.push({offset:r,length:i-r,content:n})}let b=_();if(n.keepLines&&u>0&&y(s6(c,u),0,0),b!==17){let e=m.getTokenOffset()+a;y(f.length*r<20&&n.insertSpaces?a6[f.length*r]:s6(f,r),a,e)}for(;b!==17;){let e=m.getTokenOffset()+m.getTokenLength()+a,t=_(),r=``,i=!1;for(;u===0&&(t===12||t===13);){let n=m.getTokenOffset()+a;y(a6[1],e,n),e=m.getTokenOffset()+m.getTokenLength()+a,i=t===12,r=i?g():``,t=_()}if(t===2)b!==1&&d--,n.keepLines&&u>0||!n.keepLines&&b!==1?r=g():n.keepLines&&(r=a6[1]);else if(t===4)b!==3&&d--,n.keepLines&&u>0||!n.keepLines&&b!==3?r=g():n.keepLines&&(r=a6[1]);else{switch(b){case 3:case 1:d++,r=n.keepLines&&u>0||!n.keepLines?g():a6[1];break;case 5:r=n.keepLines&&u>0||!n.keepLines?g():a6[1];break;case 12:r=g();break;case 13:u>0?r=g():i||(r=a6[1]);break;case 6:n.keepLines&&u>0?r=g():i||(r=a6[1]);break;case 10:n.keepLines&&u>0?r=g():t===6&&!i&&(r=``);break;case 7:case 8:case 9:case 11:case 2:case 4:n.keepLines&&u>0?r=g():(t===12||t===13)&&!i?r=a6[1]:t!==5&&t!==17&&(h=!0);break;case 16:h=!0;break}u>0&&(t===12||t===13)&&(r=g())}t===17&&(r=n.keepLines&&u>0?g():n.insertFinalNewline?c:``);let o=m.getTokenOffset()+a;y(r,e,o),b=t}return v}function s6(e,t){let n=``;for(let r=0;r<t;r++)n+=e;return n}function l_e(e,t){let n=0,r=0,i=t.tabSize||4;for(;n<e.length;){let t=e.charAt(n);if(t===a6[1])r++;else if(t===` `)r+=i;else break;n++}return Math.floor(r/i)}function u_e(e,t){for(let e=0;e<t.length;e++){let n=t.charAt(e);if(n===`\r`)return e+1<t.length&&t.charAt(e+1)===`
439
+ `];function l_e(e,t,n){let r,i,a,o,s;if(t){for(o=t.offset,s=o+t.length,a=o;a>0&&!c6(e,a-1);)a--;let c=s;for(;c<e.length&&!c6(e,c);)c++;i=e.substring(a,c),r=u_e(i,n)}else i=e,r=0,a=0,o=0,s=e.length;let c=d_e(n,e),l=c_e.includes(c),u=0,d=0,f;f=n.insertSpaces?a6[n.tabSize||4]??s6(a6[1],n.tabSize||4):` `;let p=f===` `?` `:` `,m=t6(i,!1),h=!1;function g(){if(u>1)return s6(c,u)+s6(f,r+d);let e=f.length*(r+d);return!l||e>o6[p][c].length?c+s6(f,r+d):e<=0?c:o6[p][c][e]}function _(){let e=m.scan();for(u=0;e===15||e===14;)e===14&&n.keepLines?u+=1:e===14&&(u=1),e=m.scan();return h=e===16||m.getTokenError()!==0,e}let v=[];function y(n,r,i){!h&&(!t||r<s&&i>o)&&e.substring(r,i)!==n&&v.push({offset:r,length:i-r,content:n})}let b=_();if(n.keepLines&&u>0&&y(s6(c,u),0,0),b!==17){let e=m.getTokenOffset()+a;y(f.length*r<20&&n.insertSpaces?a6[f.length*r]:s6(f,r),a,e)}for(;b!==17;){let e=m.getTokenOffset()+m.getTokenLength()+a,t=_(),r=``,i=!1;for(;u===0&&(t===12||t===13);){let n=m.getTokenOffset()+a;y(a6[1],e,n),e=m.getTokenOffset()+m.getTokenLength()+a,i=t===12,r=i?g():``,t=_()}if(t===2)b!==1&&d--,n.keepLines&&u>0||!n.keepLines&&b!==1?r=g():n.keepLines&&(r=a6[1]);else if(t===4)b!==3&&d--,n.keepLines&&u>0||!n.keepLines&&b!==3?r=g():n.keepLines&&(r=a6[1]);else{switch(b){case 3:case 1:d++,r=n.keepLines&&u>0||!n.keepLines?g():a6[1];break;case 5:r=n.keepLines&&u>0||!n.keepLines?g():a6[1];break;case 12:r=g();break;case 13:u>0?r=g():i||(r=a6[1]);break;case 6:n.keepLines&&u>0?r=g():i||(r=a6[1]);break;case 10:n.keepLines&&u>0?r=g():t===6&&!i&&(r=``);break;case 7:case 8:case 9:case 11:case 2:case 4:n.keepLines&&u>0?r=g():(t===12||t===13)&&!i?r=a6[1]:t!==5&&t!==17&&(h=!0);break;case 16:h=!0;break}u>0&&(t===12||t===13)&&(r=g())}t===17&&(r=n.keepLines&&u>0?g():n.insertFinalNewline?c:``);let o=m.getTokenOffset()+a;y(r,e,o),b=t}return v}function s6(e,t){let n=``;for(let r=0;r<t;r++)n+=e;return n}function u_e(e,t){let n=0,r=0,i=t.tabSize||4;for(;n<e.length;){let t=e.charAt(n);if(t===a6[1])r++;else if(t===` `)r+=i;else break;n++}return Math.floor(r/i)}function d_e(e,t){for(let e=0;e<t.length;e++){let n=t.charAt(e);if(n===`\r`)return e+1<t.length&&t.charAt(e+1)===`
440
440
  `?`\r
441
441
  `:`\r`;if(n===`
442
442
  `)return`
443
443
  `}return e&&e.eol||`
444
444
  `}function c6(e,t){return`\r
445
- `.indexOf(e.charAt(t))!==-1}var l6;(function(e){e.DEFAULT={allowTrailingComma:!1}})(l6||={});function d_e(e,t=[],n=l6.DEFAULT){let r=null,i=[],a=[];function o(e){Array.isArray(i)?i.push(e):r!==null&&(i[r]=e)}return p6(e,{onObjectBegin:()=>{let e={};o(e),a.push(i),i=e,r=null},onObjectProperty:e=>{r=e},onObjectEnd:()=>{i=a.pop()},onArrayBegin:()=>{let e=[];o(e),a.push(i),i=e,r=null},onArrayEnd:()=>{i=a.pop()},onLiteralValue:o,onError:(e,n,r)=>{t.push({error:e,offset:n,length:r})}},n),i[0]}function u6(e,t=[],n=l6.DEFAULT){let r={type:`array`,offset:-1,length:-1,children:[],parent:void 0};function i(e){r.type===`property`&&(r.length=e-r.offset,r=r.parent)}function a(e){return r.children.push(e),e}p6(e,{onObjectBegin:e=>{r=a({type:`object`,offset:e,length:-1,parent:r,children:[]})},onObjectProperty:(e,t,n)=>{r=a({type:`property`,offset:t,length:-1,parent:r,children:[]}),r.children.push({type:`string`,value:e,offset:t,length:n,parent:r})},onObjectEnd:(e,t)=>{i(e+t),r.length=e+t-r.offset,r=r.parent,i(e+t)},onArrayBegin:(e,t)=>{r=a({type:`array`,offset:e,length:-1,parent:r,children:[]})},onArrayEnd:(e,t)=>{r.length=e+t-r.offset,r=r.parent,i(e+t)},onLiteralValue:(e,t,n)=>{a({type:f_e(e),offset:t,length:n,parent:r,value:e}),i(t+n)},onSeparator:(e,t,n)=>{r.type===`property`&&(e===`:`?r.colonOffset=t:e===`,`&&i(t))},onError:(e,n,r)=>{t.push({error:e,offset:n,length:r})}},n);let o=r.children[0];return o&&delete o.parent,o}function d6(e,t){if(!e)return;let n=e;for(let e of t)if(typeof e==`string`){if(n.type!==`object`||!Array.isArray(n.children))return;let t=!1;for(let r of n.children)if(Array.isArray(r.children)&&r.children[0].value===e&&r.children.length===2){n=r.children[1],t=!0;break}if(!t)return}else{let t=e;if(n.type!==`array`||t<0||!Array.isArray(n.children)||t>=n.children.length)return;n=n.children[t]}return n}function f6(e){switch(e.type){case`array`:return e.children.map(f6);case`object`:let t=Object.create(null);for(let n of e.children){let e=n.children[1];e&&(t[n.children[0].value]=f6(e))}return t;case`null`:case`string`:case`number`:case`boolean`:return e.value;default:return}}function p6(e,t,n=l6.DEFAULT){let r=t6(e,!1),i=[],a=0;function o(e){return e?()=>a===0&&e(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter()):()=>!0}function s(e){return e?t=>a===0&&e(t,r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter()):()=>!0}function c(e){return e?t=>a===0&&e(t,r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter(),()=>i.slice()):()=>!0}function l(e){return e?()=>{a>0?a++:e(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter(),()=>i.slice())===!1&&(a=1)}:()=>!0}function u(e){return e?()=>{a>0&&a--,a===0&&e(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter())}:()=>!0}let d=l(t.onObjectBegin),f=c(t.onObjectProperty),p=u(t.onObjectEnd),m=l(t.onArrayBegin),h=u(t.onArrayEnd),g=c(t.onLiteralValue),_=s(t.onSeparator),v=o(t.onComment),y=s(t.onError),b=n&&n.disallowComments,x=n&&n.allowTrailingComma;function S(){for(;;){let e=r.scan();switch(r.getTokenError()){case 4:C(14);break;case 5:C(15);break;case 3:C(13);break;case 1:b||C(11);break;case 2:C(12);break;case 6:C(16);break}switch(e){case 12:case 13:b?C(10):v();break;case 16:C(1);break;case 15:case 14:break;default:return e}}}function C(e,t=[],n=[]){if(y(e),t.length+n.length>0){let e=r.getToken();for(;e!==17;){if(t.indexOf(e)!==-1){S();break}else if(n.indexOf(e)!==-1)break;e=S()}}}function w(e){let t=r.getTokenValue();return e?g(t):(f(t),i.push(t)),S(),!0}function T(){switch(r.getToken()){case 11:let e=r.getTokenValue(),t=Number(e);isNaN(t)&&(C(2),t=0),g(t);break;case 7:g(null);break;case 8:g(!0);break;case 9:g(!1);break;default:return!1}return S(),!0}function E(){return r.getToken()===10?(w(!1),r.getToken()===6?(_(`:`),S(),te()||C(4,[],[2,5])):C(5,[],[2,5]),i.pop(),!0):(C(3,[],[2,5]),!1)}function D(){d(),S();let e=!1;for(;r.getToken()!==2&&r.getToken()!==17;){if(r.getToken()===5){if(e||C(4,[],[]),_(`,`),S(),r.getToken()===2&&x)break}else e&&C(6,[],[]);E()||C(4,[],[2,5]),e=!0}return p(),r.getToken()===2?S():C(7,[2],[]),!0}function ee(){m(),S();let e=!0,t=!1;for(;r.getToken()!==4&&r.getToken()!==17;){if(r.getToken()===5){if(t||C(4,[],[]),_(`,`),S(),r.getToken()===4&&x)break}else t&&C(6,[],[]);e?(i.push(0),e=!1):i[i.length-1]++,te()||C(4,[],[4,5]),t=!0}return h(),e||i.pop(),r.getToken()===4?S():C(8,[4],[]),!0}function te(){switch(r.getToken()){case 3:return ee();case 1:return D();case 10:return w(!0);default:return T()}}return S(),r.getToken()===17?n.allowEmptyContent?!0:(C(4,[],[]),!1):te()?(r.getToken()!==17&&C(9,[],[]),!0):(C(4,[],[]),!1)}function f_e(e){switch(typeof e){case`boolean`:return`boolean`;case`number`:return`number`;case`string`:return`string`;case`object`:return e?Array.isArray(e)?`array`:`object`:`null`;default:return`null`}}function p_e(e,t,n,r){let i=t.slice(),a=u6(e,[]),o,s;for(;i.length>0&&(s=i.pop(),o=d6(a,i),o===void 0&&n!==void 0);)n=typeof s==`string`?{[s]:n}:[n];if(!o){if(n===void 0)throw Error(`Can not delete in empty document`);return m6(e,{offset:a?a.offset:0,length:a?a.length:0,content:JSON.stringify(n)},r)}else if(o.type===`object`&&typeof s==`string`&&Array.isArray(o.children)){let t=d6(o,[s]);if(t!==void 0)if(n===void 0){if(!t.parent)throw Error(`Malformed AST`);let n=o.children.indexOf(t.parent),i,a=t.parent.offset+t.parent.length;if(n>0){let e=o.children[n-1];i=e.offset+e.length}else i=o.offset+1,o.children.length>1&&(a=o.children[1].offset);return m6(e,{offset:i,length:a-i,content:``},r)}else return m6(e,{offset:t.offset,length:t.length,content:JSON.stringify(n)},r);else{if(n===void 0)return[];let t=`${JSON.stringify(s)}: ${JSON.stringify(n)}`,i=r.getInsertionIndex?r.getInsertionIndex(o.children.map(e=>e.children[0].value)):o.children.length,a;if(i>0){let e=o.children[i-1];a={offset:e.offset+e.length,length:0,content:`,`+t}}else a=o.children.length===0?{offset:o.offset+1,length:0,content:t}:{offset:o.offset+1,length:0,content:t+`,`};return m6(e,a,r)}}else if(o.type===`array`&&typeof s==`number`&&Array.isArray(o.children)){let t=s;if(t===-1){let t=`${JSON.stringify(n)}`,i;if(o.children.length===0)i={offset:o.offset+1,length:0,content:t};else{let e=o.children[o.children.length-1];i={offset:e.offset+e.length,length:0,content:`,`+t}}return m6(e,i,r)}else if(n===void 0&&o.children.length>=0){let t=s,n=o.children[t],i;if(o.children.length===1)i={offset:o.offset+1,length:o.length-2,content:``};else if(o.children.length-1===t){let e=o.children[t-1],n=e.offset+e.length;i={offset:n,length:o.offset+o.length-2-n,content:``}}else i={offset:n.offset,length:o.children[t+1].offset-n.offset,content:``};return m6(e,i,r)}else if(n!==void 0){let t,i=`${JSON.stringify(n)}`;if(!r.isArrayInsertion&&o.children.length>s){let e=o.children[s];t={offset:e.offset,length:e.length,content:i}}else if(o.children.length===0||s===0)t={offset:o.offset+1,length:0,content:o.children.length===0?i:i+`,`};else{let e=s>o.children.length?o.children.length:s,n=o.children[e-1];t={offset:n.offset+n.length,length:0,content:`,`+i}}return m6(e,t,r)}else throw Error(`Can not ${n===void 0?`remove`:r.isArrayInsertion?`insert`:`modify`} Array index ${t} as length is not sufficient`)}else throw Error(`Can not add ${typeof s==`number`?`property`:`index`} to parent of type ${o.type}`)}function m6(e,t,n){if(!n.formattingOptions)return[t];let r=h6(e,t),i=t.offset,a=t.offset+t.content.length;if(t.length===0||t.content.length===0){for(;i>0&&!c6(r,i-1);)i--;for(;a<r.length&&!c6(r,a);)a++}let o=c_e(r,{offset:i,length:a-i},{...n.formattingOptions,keepLines:!1});for(let e=o.length-1;e>=0;e--){let t=o[e];r=h6(r,t),i=Math.min(i,t.offset),a=Math.max(a,t.offset+t.length),a+=t.content.length-t.length}let s=e.length-(r.length-a)-i;return[{offset:i,length:s,content:r.substring(i,a)}]}function h6(e,t){return e.substring(0,t.offset)+t.content+e.substring(t.offset+t.length)}var m_e;(function(e){e[e.None=0]=`None`,e[e.UnexpectedEndOfComment=1]=`UnexpectedEndOfComment`,e[e.UnexpectedEndOfString=2]=`UnexpectedEndOfString`,e[e.UnexpectedEndOfNumber=3]=`UnexpectedEndOfNumber`,e[e.InvalidUnicode=4]=`InvalidUnicode`,e[e.InvalidEscapeCharacter=5]=`InvalidEscapeCharacter`,e[e.InvalidCharacter=6]=`InvalidCharacter`})(m_e||={});var h_e;(function(e){e[e.OpenBraceToken=1]=`OpenBraceToken`,e[e.CloseBraceToken=2]=`CloseBraceToken`,e[e.OpenBracketToken=3]=`OpenBracketToken`,e[e.CloseBracketToken=4]=`CloseBracketToken`,e[e.CommaToken=5]=`CommaToken`,e[e.ColonToken=6]=`ColonToken`,e[e.NullKeyword=7]=`NullKeyword`,e[e.TrueKeyword=8]=`TrueKeyword`,e[e.FalseKeyword=9]=`FalseKeyword`,e[e.StringLiteral=10]=`StringLiteral`,e[e.NumericLiteral=11]=`NumericLiteral`,e[e.LineCommentTrivia=12]=`LineCommentTrivia`,e[e.BlockCommentTrivia=13]=`BlockCommentTrivia`,e[e.LineBreakTrivia=14]=`LineBreakTrivia`,e[e.Trivia=15]=`Trivia`,e[e.Unknown=16]=`Unknown`,e[e.EOF=17]=`EOF`})(h_e||={});const g_e=d_e,__e=u6,g6=f6;var v_e;(function(e){e[e.InvalidSymbol=1]=`InvalidSymbol`,e[e.InvalidNumberFormat=2]=`InvalidNumberFormat`,e[e.PropertyNameExpected=3]=`PropertyNameExpected`,e[e.ValueExpected=4]=`ValueExpected`,e[e.ColonExpected=5]=`ColonExpected`,e[e.CommaExpected=6]=`CommaExpected`,e[e.CloseBraceExpected=7]=`CloseBraceExpected`,e[e.CloseBracketExpected=8]=`CloseBracketExpected`,e[e.EndOfFileExpected=9]=`EndOfFileExpected`,e[e.InvalidCommentToken=10]=`InvalidCommentToken`,e[e.UnexpectedEndOfComment=11]=`UnexpectedEndOfComment`,e[e.UnexpectedEndOfString=12]=`UnexpectedEndOfString`,e[e.UnexpectedEndOfNumber=13]=`UnexpectedEndOfNumber`,e[e.InvalidUnicode=14]=`InvalidUnicode`,e[e.InvalidEscapeCharacter=15]=`InvalidEscapeCharacter`,e[e.InvalidCharacter=16]=`InvalidCharacter`})(v_e||={});function _6(e,t,n,r){return p_e(e,t,n,r)}function v6(e,t){let n=t.slice(0).sort((e,t)=>{let n=e.offset-t.offset;return n===0?e.length-t.length:n}),r=e.length;for(let t=n.length-1;t>=0;t--){let i=n[t];if(i.offset+i.length<=r)e=h6(e,i);else throw Error(`Overlapping edit`);r=i.offset}return e}o1(`mermaid-validator`);const y_e=/^[A-Za-z0-9-]{8,64}$/;let y6=null;function b_e(e){return M(e??se(),`.ok`,`machine-id`)}function x_e(e){if(e===void 0&&y6!==null)return y6;let t=b_e(e),n=null;try{let e=S(t,`utf-8`).trim();y_e.test(e)&&(n=e)}catch{}if(n===null){n=Me();try{v(me(t),{recursive:!0}),ne(t,`${n}\n`,{encoding:`utf-8`,mode:384})}catch(e){o1(`machine-id`).warn({path:t,err:e},`Failed to persist ${t} — using an ephemeral per-process id; lock ownership checks will fail closed (collision) instead of recognizing this machine: ${e instanceof Error?e.message:String(e)}`)}}return e===void 0&&(y6=n),n}function S_e(){try{let e=ye(me(Ce(import.meta.url)),`..`,`package.json`),t=JSON.parse(S(e,`utf-8`));if(typeof t.version==`string`&&t.version.length>0)return t.version}catch{}return`0.0.0-unknown`}S_e(),o1(`process-lock`);function C_e(e,t){return ye(e,`${t}.lock`)}new class{_tail=Promise.resolve();enqueue(e){let t=this._tail.then(()=>e());return this._tail=t.catch(()=>void 0),t}},o1(`git-context`);const b6={discovery:`open-knowledge-discovery`,project:`open-knowledge`,"write-skill":`open-knowledge-write-skill`};new Set(Object.values(b6));const w_e=Object.keys(b6),T_e={discovery:`user`,project:`project`,"write-skill":`user`},x6=w_e.filter(e=>T_e[e]===`user`);var E_e=e(a(),1);const S6=`OpenKnowledge.app/Contents/Resources/cli/dist/assets/skills`;function D_e(e,t={}){let n=t.platform??process.platform,r=t.checkDesktop??!1,i=t.home??se(),a=[],o=process.env.NODE_ENV===`test`;r&&n===`darwin`&&(o||a.push(M(`/Applications`,S6,e)),(!o||t.home!==void 0)&&a.push(M(i,`Applications`,S6,e))),a.push(Ce(new URL(`../dist/assets/skills/${e}`,import.meta.url))),a.push(Ce(new URL(`../assets/skills/${e}`,import.meta.url))),a.push(Ce(new URL(`./assets/skills/${e}`,import.meta.url)));for(let e of a)if(g(e))return e;throw Error(`Bundled skill asset directory not found for bundle '${e}'. Tried: ${a.join(`, `)}. This usually means the CLI build did not copy packages/server/assets into dist/assets. Run \`cd packages/cli && bun run build\` before publishing.`)}Ie(x),[...wl];function C6(e,t){return[...Object.entries(e).filter(e=>e[1]!==null).map(([e,t])=>({editor:e,root:t})),{editor:`agents`,root:t}]}C6(Sl,`.agents/skills`),[...C6(Cl,`.agents/skills`)].sort((e,t)=>{let n=D3.indexOf(e.editor),r=D3.indexOf(t.editor);return(n===-1?D3.length:n)-(r===-1?D3.length:r)||e.editor.localeCompare(t.editor)}),o1(`upload-streaming`),o1(`backlinks`),o1(`tag-index`),o1(`derived-document-index`),o1(`file-watcher`);function O_e(e){try{return ee(ye(e,`.ok/config.yml`)).isFile()}catch(e){let t=e?.code;if(t===`ENOENT`||t===`ENOTDIR`)return!1;throw e}}o1(`git-checkout`),s1(()=>{}),o1(`asset-references`);const k_e=global.Request;var w6=class extends k_e{constructor(e,t){if(typeof e==`object`&&M6 in e){let n=t!==void 0&&`body`in t&&t.body!=null;if(e[V6]&&!n)throw TypeError(`Cannot construct a Request with a Request object that has already been used.`);e=e[M6]()}t?.body?.getReader!==void 0&&(t.duplex??=`half`),super(e,t)}};const T6=e=>{let t=[],n=e.rawHeaders;for(let e=0,r=n.length;e<r;e+=2){let r=n[e];r.charCodeAt(0)!==58&&t.push([r,n[e+1]])}return new Headers(t)},A_e=Symbol(`wrapBodyStream`),j_e=new Set([`latin1`,`binary`,`hex`,`base64`,`base64url`]),M_e=e=>e===null||j_e.has(e),E6=Symbol(`bodyBufferedBeforeDisconnect`),D6=Symbol(`bodyBufferedLengthBeforeDisconnect`),O6=(e,t)=>Buffer.isBuffer(e)?e:Buffer.from(e,t??`utf8`),k6=e=>!(e instanceof Le)&&!!e.complete&&!!e.readableAborted&&typeof e.read==`function`&&M_e(e.readableEncoding),A6=(e,t)=>{if(e.readableDidRead&&!t||!k6(e))return;let n=e;if(n[E6]!==void 0)return n[E6];let r,i=e.errored;if(i&&i.code!==`ECONNRESET`)r=i;else if(n[D6]!==void 0&&e.readableLength!==n[D6])r=W6();else{let n=t??[],i=e.read();i!==null&&n.push(O6(i,e.readableEncoding));let a=n.length===1?n[0]:Buffer.concat(n);r=a;let o=e.headers[`content-length`];if(typeof o==`string`&&/^\d+$/.test(o)){let e=Number(o);Number.isSafeInteger(e)&&a.length!==e&&(r=W6())}}return n[E6]=r,r},j6=(e,t)=>{if(t instanceof Error){e.error(t);return}t.length>0&&e.enqueue(t),e.close()},N_e=(e,t,n,r,i)=>{let a={method:e,headers:n,signal:i.signal};if(e===`TRACE`){a.method=`GET`;let e=new w6(t,a);return Object.defineProperty(e,`method`,{get(){return`TRACE`}}),e}if(!(e===`GET`||e===`HEAD`))if(`rawBody`in r&&r.rawBody instanceof Buffer)a.body=new ReadableStream({start(e){e.enqueue(r.rawBody),e.close()}});else if(r[A_e]){let e;a.body=new ReadableStream({async pull(t){try{if(!e){let e=A6(r);if(e!==void 0){j6(t,e);return}}e||=ke.toWeb(r).getReader();let{done:n,value:i}=await e.read();n?t.close():t.enqueue(i)}catch(e){t.error(e)}}})}else{let e=A6(r);e===void 0?a.body=ke.toWeb(r):a.body=new ReadableStream({start(t){j6(t,e)}})}return new w6(t,a)},M6=Symbol(`getRequestCache`),N6=Symbol(`requestCache`),P6=Symbol(`incomingKey`),F6=Symbol(`urlKey`),P_e=Symbol(`methodKey`),I6=Symbol(`headersKey`),L6=Symbol(`abortControllerKey`),R6=Symbol(`getAbortController`),F_e=Symbol(`abortRequest`),z6=Symbol(`bodyBuffer`),B6=Symbol(`bodyReadPromise`),V6=Symbol(`bodyConsumedDirectly`),H6=Symbol(`bodyLockReader`),U6=Symbol(`abortReason`),W6=()=>TypeError(`Body is unusable`),G6=()=>Promise.reject(W6()),I_e=new TextDecoder,L_e=e=>{if(e[V6])return G6();e[V6]=!0},R_e=e=>e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength),z_e=e=>(e[I6]||=T6(e[P6])).get(`content-type`)||``,B_e=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,V_e=e=>{if(!B_e.test(e))return TypeError(`'${e}' is not a valid HTTP method.`);let t=e.toUpperCase();if(t===`CONNECT`||t===`TRACK`||t===`TRACE`&&e!==`TRACE`)return TypeError(`'${e}' HTTP method is unsupported.`)},K6=(e,t,n)=>{if(e[V6])return G6();let r=e.method;if(r===`GET`||r===`HEAD`)return e[M6]()[t]();let i=V_e(r);if(i)return Promise.reject(i);if(e[N6]&&r!==`TRACE`)return e[N6][t]();let a=L_e(e);if(a)return a;let o=H_e(e);if(o){let t=Promise.resolve(n(o,e));return e[z6]=void 0,t}return U_e(e).then(t=>{let r=n(t,e);return e[z6]=void 0,r})},H_e=e=>{let t=e[P6];if(`rawBody`in t&&t.rawBody instanceof Buffer)return t.rawBody},q6=(e,t)=>{if(t.errored)return t.errored;let n=e[U6];return n===void 0?Error(`Client connection prematurely closed.`):n instanceof Error?n:Error(String(n))},U_e=e=>{if(e[z6])return Promise.resolve(e[z6]);if(e[B6])return e[B6];let t=e[P6];if(t.readableDidRead)return G6();let n=A6(t);if(n!==void 0)return n instanceof Error?Promise.reject(n):(e[z6]=n,Promise.resolve(n));let r=new Promise((n,r)=>{let i=[],a=!1,o=e=>{a||(a=!0,f(),e())},s=a=>{let s=t.errored??a;return!k6(t)||s&&s.code!==`ECONNRESET`?!1:(o(()=>{let o=A6(t,i);o instanceof Error?r(o):o===void 0?r(a??q6(e,t)):(e[z6]=o,n(o))}),!0)},c=e=>{i.push(O6(e,t.readableEncoding))},l=()=>{o(()=>{let t=i.length===1?i[0]:Buffer.concat(i);e[z6]=t,n(t)})},u=e=>{s(e)||o(()=>{r(e)})},d=()=>{if(t.readableEnded){l();return}s()||o(()=>{r(q6(e,t))})},f=()=>{t.off(`data`,c),t.off(`end`,l),t.off(`error`,u),t.off(`close`,d),e[B6]=void 0};t.on(`data`,c),t.on(`end`,l),t.on(`error`,u),t.on(`close`,d),queueMicrotask(()=>{a||(t.readableEnded?l():t.errored?u(t.errored):t.destroyed&&d())})});return e[B6]=r,r},J6={get method(){return this[P_e]},get url(){return this[F6]},get headers(){return this[I6]||=T6(this[P6])},[F_e](e){this[U6]===void 0&&(this[U6]=e);let t=this[L6];t&&!t.signal.aborted&&t.abort(e)},[R6](){return this[L6]||=new AbortController,this[U6]!==void 0&&!this[L6].signal.aborted&&this[L6].abort(this[U6]),this[L6]},[M6](){let e=this[R6]();if(this[N6])return this[N6];let t=this.method;if(this[V6]&&!(t===`GET`||t===`HEAD`)){this[z6]=void 0;let n={method:t===`TRACE`?`GET`:t,headers:this.headers,signal:e.signal};t!==`TRACE`&&(n.body=new ReadableStream({start(e){e.close()}}),n.duplex=`half`);let r=new w6(this[F6],n);return t===`TRACE`&&Object.defineProperty(r,`method`,{get(){return`TRACE`}}),this[N6]=r}return this[N6]=N_e(this.method,this[F6],this.headers,this[P6],e)},get body(){if(!this[V6])return this[M6]().body;let e=this[M6]();return!this[H6]&&e.body&&(this[H6]=e.body.getReader()),e.body},get bodyUsed(){return this[V6]?!0:this[N6]?this[N6].bodyUsed:!1}};Object.defineProperty(J6,`signal`,{get(){return this[R6]().signal}}),[`cache`,`credentials`,`destination`,`integrity`,`mode`,`redirect`,`referrer`,`referrerPolicy`,`keepalive`].forEach(e=>{Object.defineProperty(J6,e,{get(){return this[M6]()[e]}})}),[`clone`,`formData`].forEach(e=>{Object.defineProperty(J6,e,{value:function(){if(this[V6]){if(e===`clone`)throw W6();return G6()}return this[M6]()[e]()}})}),Object.defineProperty(J6,`text`,{value:function(){return K6(this,`text`,e=>I_e.decode(e))}}),Object.defineProperty(J6,`arrayBuffer`,{value:function(){return K6(this,`arrayBuffer`,e=>R_e(e))}}),Object.defineProperty(J6,`blob`,{value:function(){return K6(this,`blob`,(e,t)=>{let n=z_e(t);return new Response(e,n?{headers:{"content-type":n}}:void 0).blob()})}}),Object.defineProperty(J6,`json`,{value:function(){return this[V6]?G6():this.text().then(JSON.parse)}}),Object.defineProperty(J6,Symbol.for(`nodejs.util.inspect.custom`),{value:function(e,t,n){return`Request (lightweight) ${n({method:this.method,url:this.url,headers:this.headers,nativeRequest:this[N6]},{...t,depth:e==null?null:e-1})}`}}),Object.setPrototypeOf(J6,w6.prototype);const Y6=Symbol(`responseCache`),X6=Symbol(`getResponseCache`),Z6=Symbol(`cache`),Q6=global.Response;var $6=class e{#e;#t;[X6](){let e=this[Z6],t=e&&e[2]instanceof Headers?e[2]:void 0;return delete this[Z6],this[Y6]||=new Q6(this.#e,t?{status:this.#t?.status,statusText:this.#t?.statusText,headers:t}:this.#t)}constructor(t,n){let r;if(this.#e=t,n instanceof Q6){let t=n[Y6];if(t){this.#t=t,this[X6]();return}this.#t=n instanceof e?n.#t:n,r=new Headers(n.headers)}else this.#t=n;(t==null||typeof t==`string`||t?.getReader!==void 0||t instanceof Blob||t instanceof Uint8Array)&&(this[Z6]=[n?.status||200,t??null,r||n?.headers])}get headers(){let e=this[Z6];return e?(e[2]instanceof Headers||(e[2]=new Headers(e[2]||(e[1]===null?void 0:{"content-type":`text/plain; charset=UTF-8`}))),e[2]):this[X6]().headers}get status(){return this[Z6]?.[0]??this[X6]().status}get ok(){let e=this.status;return e>=200&&e<300}};[`body`,`bodyUsed`,`redirected`,`statusText`,`trailers`,`type`,`url`].forEach(e=>{Object.defineProperty($6.prototype,e,{get(){return this[X6]()[e]}})}),[`arrayBuffer`,`blob`,`clone`,`formData`,`json`,`text`].forEach(e=>{Object.defineProperty($6.prototype,e,{value:function(){return this[X6]()[e]()}})}),Object.defineProperty($6.prototype,Symbol.for(`nodejs.util.inspect.custom`),{value:function(e,t,n){return`Response (lightweight) ${n({status:this.status,headers:this.headers,ok:this.ok,nativeResponse:this[Y6]},{...t,depth:e==null?null:e-1})}`}}),Object.setPrototypeOf($6,Q6),Object.setPrototypeOf($6.prototype,Q6.prototype);const W_e=/^https?:\/\/[!#-;=?-[\]_a-z~A-Z]+$/,G_e=e=>e instanceof URL?e.href:W_e.test(e)?e:new URL(e).href,K_e=new Set([301,302,303,307,308]);Object.defineProperty($6,`redirect`,{value:function(e,t=302){if(!K_e.has(t))throw RangeError(`Invalid status code`);return new $6(null,{status:t,headers:{location:G_e(e)}})},writable:!0,configurable:!0}),Object.defineProperty($6,`json`,{value:function(e,t){let n=JSON.stringify(e);if(n===void 0)throw TypeError(`The data is not JSON serializable`);let r=t?.headers,i;return r?(i=new Headers(r),i.has(`content-type`)||i.set(`content-type`,`application/json`)):i={"content-type":`application/json`},new $6(n,{status:t?.status??200,statusText:t?.statusText,headers:i})},writable:!0,configurable:!0}),globalThis.CloseEvent,globalThis.ErrorEvent,new Response(null,{headers:{"x-hono-already-sent":`true`}}),o1(`suggest-links`),`${jl}`,`${Tl.join(`
445
+ `.indexOf(e.charAt(t))!==-1}var l6;(function(e){e.DEFAULT={allowTrailingComma:!1}})(l6||={});function f_e(e,t=[],n=l6.DEFAULT){let r=null,i=[],a=[];function o(e){Array.isArray(i)?i.push(e):r!==null&&(i[r]=e)}return p6(e,{onObjectBegin:()=>{let e={};o(e),a.push(i),i=e,r=null},onObjectProperty:e=>{r=e},onObjectEnd:()=>{i=a.pop()},onArrayBegin:()=>{let e=[];o(e),a.push(i),i=e,r=null},onArrayEnd:()=>{i=a.pop()},onLiteralValue:o,onError:(e,n,r)=>{t.push({error:e,offset:n,length:r})}},n),i[0]}function u6(e,t=[],n=l6.DEFAULT){let r={type:`array`,offset:-1,length:-1,children:[],parent:void 0};function i(e){r.type===`property`&&(r.length=e-r.offset,r=r.parent)}function a(e){return r.children.push(e),e}p6(e,{onObjectBegin:e=>{r=a({type:`object`,offset:e,length:-1,parent:r,children:[]})},onObjectProperty:(e,t,n)=>{r=a({type:`property`,offset:t,length:-1,parent:r,children:[]}),r.children.push({type:`string`,value:e,offset:t,length:n,parent:r})},onObjectEnd:(e,t)=>{i(e+t),r.length=e+t-r.offset,r=r.parent,i(e+t)},onArrayBegin:(e,t)=>{r=a({type:`array`,offset:e,length:-1,parent:r,children:[]})},onArrayEnd:(e,t)=>{r.length=e+t-r.offset,r=r.parent,i(e+t)},onLiteralValue:(e,t,n)=>{a({type:p_e(e),offset:t,length:n,parent:r,value:e}),i(t+n)},onSeparator:(e,t,n)=>{r.type===`property`&&(e===`:`?r.colonOffset=t:e===`,`&&i(t))},onError:(e,n,r)=>{t.push({error:e,offset:n,length:r})}},n);let o=r.children[0];return o&&delete o.parent,o}function d6(e,t){if(!e)return;let n=e;for(let e of t)if(typeof e==`string`){if(n.type!==`object`||!Array.isArray(n.children))return;let t=!1;for(let r of n.children)if(Array.isArray(r.children)&&r.children[0].value===e&&r.children.length===2){n=r.children[1],t=!0;break}if(!t)return}else{let t=e;if(n.type!==`array`||t<0||!Array.isArray(n.children)||t>=n.children.length)return;n=n.children[t]}return n}function f6(e){switch(e.type){case`array`:return e.children.map(f6);case`object`:let t=Object.create(null);for(let n of e.children){let e=n.children[1];e&&(t[n.children[0].value]=f6(e))}return t;case`null`:case`string`:case`number`:case`boolean`:return e.value;default:return}}function p6(e,t,n=l6.DEFAULT){let r=t6(e,!1),i=[],a=0;function o(e){return e?()=>a===0&&e(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter()):()=>!0}function s(e){return e?t=>a===0&&e(t,r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter()):()=>!0}function c(e){return e?t=>a===0&&e(t,r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter(),()=>i.slice()):()=>!0}function l(e){return e?()=>{a>0?a++:e(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter(),()=>i.slice())===!1&&(a=1)}:()=>!0}function u(e){return e?()=>{a>0&&a--,a===0&&e(r.getTokenOffset(),r.getTokenLength(),r.getTokenStartLine(),r.getTokenStartCharacter())}:()=>!0}let d=l(t.onObjectBegin),f=c(t.onObjectProperty),p=u(t.onObjectEnd),m=l(t.onArrayBegin),h=u(t.onArrayEnd),g=c(t.onLiteralValue),_=s(t.onSeparator),v=o(t.onComment),y=s(t.onError),b=n&&n.disallowComments,x=n&&n.allowTrailingComma;function S(){for(;;){let e=r.scan();switch(r.getTokenError()){case 4:C(14);break;case 5:C(15);break;case 3:C(13);break;case 1:b||C(11);break;case 2:C(12);break;case 6:C(16);break}switch(e){case 12:case 13:b?C(10):v();break;case 16:C(1);break;case 15:case 14:break;default:return e}}}function C(e,t=[],n=[]){if(y(e),t.length+n.length>0){let e=r.getToken();for(;e!==17;){if(t.indexOf(e)!==-1){S();break}else if(n.indexOf(e)!==-1)break;e=S()}}}function w(e){let t=r.getTokenValue();return e?g(t):(f(t),i.push(t)),S(),!0}function T(){switch(r.getToken()){case 11:let e=r.getTokenValue(),t=Number(e);isNaN(t)&&(C(2),t=0),g(t);break;case 7:g(null);break;case 8:g(!0);break;case 9:g(!1);break;default:return!1}return S(),!0}function E(){return r.getToken()===10?(w(!1),r.getToken()===6?(_(`:`),S(),te()||C(4,[],[2,5])):C(5,[],[2,5]),i.pop(),!0):(C(3,[],[2,5]),!1)}function D(){d(),S();let e=!1;for(;r.getToken()!==2&&r.getToken()!==17;){if(r.getToken()===5){if(e||C(4,[],[]),_(`,`),S(),r.getToken()===2&&x)break}else e&&C(6,[],[]);E()||C(4,[],[2,5]),e=!0}return p(),r.getToken()===2?S():C(7,[2],[]),!0}function ee(){m(),S();let e=!0,t=!1;for(;r.getToken()!==4&&r.getToken()!==17;){if(r.getToken()===5){if(t||C(4,[],[]),_(`,`),S(),r.getToken()===4&&x)break}else t&&C(6,[],[]);e?(i.push(0),e=!1):i[i.length-1]++,te()||C(4,[],[4,5]),t=!0}return h(),e||i.pop(),r.getToken()===4?S():C(8,[4],[]),!0}function te(){switch(r.getToken()){case 3:return ee();case 1:return D();case 10:return w(!0);default:return T()}}return S(),r.getToken()===17?n.allowEmptyContent?!0:(C(4,[],[]),!1):te()?(r.getToken()!==17&&C(9,[],[]),!0):(C(4,[],[]),!1)}function p_e(e){switch(typeof e){case`boolean`:return`boolean`;case`number`:return`number`;case`string`:return`string`;case`object`:return e?Array.isArray(e)?`array`:`object`:`null`;default:return`null`}}function m_e(e,t,n,r){let i=t.slice(),a=u6(e,[]),o,s;for(;i.length>0&&(s=i.pop(),o=d6(a,i),o===void 0&&n!==void 0);)n=typeof s==`string`?{[s]:n}:[n];if(!o){if(n===void 0)throw Error(`Can not delete in empty document`);return m6(e,{offset:a?a.offset:0,length:a?a.length:0,content:JSON.stringify(n)},r)}else if(o.type===`object`&&typeof s==`string`&&Array.isArray(o.children)){let t=d6(o,[s]);if(t!==void 0)if(n===void 0){if(!t.parent)throw Error(`Malformed AST`);let n=o.children.indexOf(t.parent),i,a=t.parent.offset+t.parent.length;if(n>0){let e=o.children[n-1];i=e.offset+e.length}else i=o.offset+1,o.children.length>1&&(a=o.children[1].offset);return m6(e,{offset:i,length:a-i,content:``},r)}else return m6(e,{offset:t.offset,length:t.length,content:JSON.stringify(n)},r);else{if(n===void 0)return[];let t=`${JSON.stringify(s)}: ${JSON.stringify(n)}`,i=r.getInsertionIndex?r.getInsertionIndex(o.children.map(e=>e.children[0].value)):o.children.length,a;if(i>0){let e=o.children[i-1];a={offset:e.offset+e.length,length:0,content:`,`+t}}else a=o.children.length===0?{offset:o.offset+1,length:0,content:t}:{offset:o.offset+1,length:0,content:t+`,`};return m6(e,a,r)}}else if(o.type===`array`&&typeof s==`number`&&Array.isArray(o.children)){let t=s;if(t===-1){let t=`${JSON.stringify(n)}`,i;if(o.children.length===0)i={offset:o.offset+1,length:0,content:t};else{let e=o.children[o.children.length-1];i={offset:e.offset+e.length,length:0,content:`,`+t}}return m6(e,i,r)}else if(n===void 0&&o.children.length>=0){let t=s,n=o.children[t],i;if(o.children.length===1)i={offset:o.offset+1,length:o.length-2,content:``};else if(o.children.length-1===t){let e=o.children[t-1],n=e.offset+e.length;i={offset:n,length:o.offset+o.length-2-n,content:``}}else i={offset:n.offset,length:o.children[t+1].offset-n.offset,content:``};return m6(e,i,r)}else if(n!==void 0){let t,i=`${JSON.stringify(n)}`;if(!r.isArrayInsertion&&o.children.length>s){let e=o.children[s];t={offset:e.offset,length:e.length,content:i}}else if(o.children.length===0||s===0)t={offset:o.offset+1,length:0,content:o.children.length===0?i:i+`,`};else{let e=s>o.children.length?o.children.length:s,n=o.children[e-1];t={offset:n.offset+n.length,length:0,content:`,`+i}}return m6(e,t,r)}else throw Error(`Can not ${n===void 0?`remove`:r.isArrayInsertion?`insert`:`modify`} Array index ${t} as length is not sufficient`)}else throw Error(`Can not add ${typeof s==`number`?`property`:`index`} to parent of type ${o.type}`)}function m6(e,t,n){if(!n.formattingOptions)return[t];let r=h6(e,t),i=t.offset,a=t.offset+t.content.length;if(t.length===0||t.content.length===0){for(;i>0&&!c6(r,i-1);)i--;for(;a<r.length&&!c6(r,a);)a++}let o=l_e(r,{offset:i,length:a-i},{...n.formattingOptions,keepLines:!1});for(let e=o.length-1;e>=0;e--){let t=o[e];r=h6(r,t),i=Math.min(i,t.offset),a=Math.max(a,t.offset+t.length),a+=t.content.length-t.length}let s=e.length-(r.length-a)-i;return[{offset:i,length:s,content:r.substring(i,a)}]}function h6(e,t){return e.substring(0,t.offset)+t.content+e.substring(t.offset+t.length)}var h_e;(function(e){e[e.None=0]=`None`,e[e.UnexpectedEndOfComment=1]=`UnexpectedEndOfComment`,e[e.UnexpectedEndOfString=2]=`UnexpectedEndOfString`,e[e.UnexpectedEndOfNumber=3]=`UnexpectedEndOfNumber`,e[e.InvalidUnicode=4]=`InvalidUnicode`,e[e.InvalidEscapeCharacter=5]=`InvalidEscapeCharacter`,e[e.InvalidCharacter=6]=`InvalidCharacter`})(h_e||={});var g_e;(function(e){e[e.OpenBraceToken=1]=`OpenBraceToken`,e[e.CloseBraceToken=2]=`CloseBraceToken`,e[e.OpenBracketToken=3]=`OpenBracketToken`,e[e.CloseBracketToken=4]=`CloseBracketToken`,e[e.CommaToken=5]=`CommaToken`,e[e.ColonToken=6]=`ColonToken`,e[e.NullKeyword=7]=`NullKeyword`,e[e.TrueKeyword=8]=`TrueKeyword`,e[e.FalseKeyword=9]=`FalseKeyword`,e[e.StringLiteral=10]=`StringLiteral`,e[e.NumericLiteral=11]=`NumericLiteral`,e[e.LineCommentTrivia=12]=`LineCommentTrivia`,e[e.BlockCommentTrivia=13]=`BlockCommentTrivia`,e[e.LineBreakTrivia=14]=`LineBreakTrivia`,e[e.Trivia=15]=`Trivia`,e[e.Unknown=16]=`Unknown`,e[e.EOF=17]=`EOF`})(g_e||={});const __e=f_e,v_e=u6,g6=f6;var y_e;(function(e){e[e.InvalidSymbol=1]=`InvalidSymbol`,e[e.InvalidNumberFormat=2]=`InvalidNumberFormat`,e[e.PropertyNameExpected=3]=`PropertyNameExpected`,e[e.ValueExpected=4]=`ValueExpected`,e[e.ColonExpected=5]=`ColonExpected`,e[e.CommaExpected=6]=`CommaExpected`,e[e.CloseBraceExpected=7]=`CloseBraceExpected`,e[e.CloseBracketExpected=8]=`CloseBracketExpected`,e[e.EndOfFileExpected=9]=`EndOfFileExpected`,e[e.InvalidCommentToken=10]=`InvalidCommentToken`,e[e.UnexpectedEndOfComment=11]=`UnexpectedEndOfComment`,e[e.UnexpectedEndOfString=12]=`UnexpectedEndOfString`,e[e.UnexpectedEndOfNumber=13]=`UnexpectedEndOfNumber`,e[e.InvalidUnicode=14]=`InvalidUnicode`,e[e.InvalidEscapeCharacter=15]=`InvalidEscapeCharacter`,e[e.InvalidCharacter=16]=`InvalidCharacter`})(y_e||={});function _6(e,t,n,r){return m_e(e,t,n,r)}function v6(e,t){let n=t.slice(0).sort((e,t)=>{let n=e.offset-t.offset;return n===0?e.length-t.length:n}),r=e.length;for(let t=n.length-1;t>=0;t--){let i=n[t];if(i.offset+i.length<=r)e=h6(e,i);else throw Error(`Overlapping edit`);r=i.offset}return e}o1(`mermaid-validator`);const b_e=/^[A-Za-z0-9-]{8,64}$/;let y6=null;function x_e(e){return M(e??se(),`.ok`,`machine-id`)}function S_e(e){if(e===void 0&&y6!==null)return y6;let t=x_e(e),n=null;try{let e=S(t,`utf-8`).trim();b_e.test(e)&&(n=e)}catch{}if(n===null){n=Me();try{v(me(t),{recursive:!0}),ne(t,`${n}\n`,{encoding:`utf-8`,mode:384})}catch(e){o1(`machine-id`).warn({path:t,err:e},`Failed to persist ${t} — using an ephemeral per-process id; lock ownership checks will fail closed (collision) instead of recognizing this machine: ${e instanceof Error?e.message:String(e)}`)}}return e===void 0&&(y6=n),n}function C_e(){try{let e=ye(me(Ce(import.meta.url)),`..`,`package.json`),t=JSON.parse(S(e,`utf-8`));if(typeof t.version==`string`&&t.version.length>0)return t.version}catch{}return`0.0.0-unknown`}C_e(),o1(`process-lock`);function w_e(e,t){return ye(e,`${t}.lock`)}new class{_tail=Promise.resolve();enqueue(e){let t=this._tail.then(()=>e());return this._tail=t.catch(()=>void 0),t}},o1(`git-context`);const b6={discovery:`open-knowledge-discovery`,project:`open-knowledge`,"write-skill":`open-knowledge-write-skill`};new Set(Object.values(b6));const T_e=Object.keys(b6),E_e={discovery:`user`,project:`project`,"write-skill":`user`},x6=T_e.filter(e=>E_e[e]===`user`);var D_e=e(a(),1);const S6=`OpenKnowledge.app/Contents/Resources/cli/dist/assets/skills`;function O_e(e,t={}){let n=t.platform??process.platform,r=t.checkDesktop??!1,i=t.home??se(),a=[],o=process.env.NODE_ENV===`test`;r&&n===`darwin`&&(o||a.push(M(`/Applications`,S6,e)),(!o||t.home!==void 0)&&a.push(M(i,`Applications`,S6,e))),a.push(Ce(new URL(`../dist/assets/skills/${e}`,import.meta.url))),a.push(Ce(new URL(`../assets/skills/${e}`,import.meta.url))),a.push(Ce(new URL(`./assets/skills/${e}`,import.meta.url)));for(let e of a)if(g(e))return e;throw Error(`Bundled skill asset directory not found for bundle '${e}'. Tried: ${a.join(`, `)}. This usually means the CLI build did not copy packages/server/assets into dist/assets. Run \`cd packages/cli && bun run build\` before publishing.`)}Ie(x),[...wl];function C6(e,t){return[...Object.entries(e).filter(e=>e[1]!==null).map(([e,t])=>({editor:e,root:t})),{editor:`agents`,root:t}]}C6(Sl,`.agents/skills`),[...C6(Cl,`.agents/skills`)].sort((e,t)=>{let n=D3.indexOf(e.editor),r=D3.indexOf(t.editor);return(n===-1?D3.length:n)-(r===-1?D3.length:r)||e.editor.localeCompare(t.editor)}),o1(`upload-streaming`),o1(`backlinks`),o1(`tag-index`),o1(`derived-document-index`),o1(`file-watcher`);function k_e(e){try{return ee(ye(e,`.ok/config.yml`)).isFile()}catch(e){let t=e?.code;if(t===`ENOENT`||t===`ENOTDIR`)return!1;throw e}}o1(`git-checkout`),s1(()=>{}),o1(`asset-references`);const A_e=global.Request;var w6=class extends A_e{constructor(e,t){if(typeof e==`object`&&M6 in e){let n=t!==void 0&&`body`in t&&t.body!=null;if(e[V6]&&!n)throw TypeError(`Cannot construct a Request with a Request object that has already been used.`);e=e[M6]()}t?.body?.getReader!==void 0&&(t.duplex??=`half`),super(e,t)}};const T6=e=>{let t=[],n=e.rawHeaders;for(let e=0,r=n.length;e<r;e+=2){let r=n[e];r.charCodeAt(0)!==58&&t.push([r,n[e+1]])}return new Headers(t)},j_e=Symbol(`wrapBodyStream`),M_e=new Set([`latin1`,`binary`,`hex`,`base64`,`base64url`]),N_e=e=>e===null||M_e.has(e),E6=Symbol(`bodyBufferedBeforeDisconnect`),D6=Symbol(`bodyBufferedLengthBeforeDisconnect`),O6=(e,t)=>Buffer.isBuffer(e)?e:Buffer.from(e,t??`utf8`),k6=e=>!(e instanceof Le)&&!!e.complete&&!!e.readableAborted&&typeof e.read==`function`&&N_e(e.readableEncoding),A6=(e,t)=>{if(e.readableDidRead&&!t||!k6(e))return;let n=e;if(n[E6]!==void 0)return n[E6];let r,i=e.errored;if(i&&i.code!==`ECONNRESET`)r=i;else if(n[D6]!==void 0&&e.readableLength!==n[D6])r=W6();else{let n=t??[],i=e.read();i!==null&&n.push(O6(i,e.readableEncoding));let a=n.length===1?n[0]:Buffer.concat(n);r=a;let o=e.headers[`content-length`];if(typeof o==`string`&&/^\d+$/.test(o)){let e=Number(o);Number.isSafeInteger(e)&&a.length!==e&&(r=W6())}}return n[E6]=r,r},j6=(e,t)=>{if(t instanceof Error){e.error(t);return}t.length>0&&e.enqueue(t),e.close()},P_e=(e,t,n,r,i)=>{let a={method:e,headers:n,signal:i.signal};if(e===`TRACE`){a.method=`GET`;let e=new w6(t,a);return Object.defineProperty(e,`method`,{get(){return`TRACE`}}),e}if(!(e===`GET`||e===`HEAD`))if(`rawBody`in r&&r.rawBody instanceof Buffer)a.body=new ReadableStream({start(e){e.enqueue(r.rawBody),e.close()}});else if(r[j_e]){let e;a.body=new ReadableStream({async pull(t){try{if(!e){let e=A6(r);if(e!==void 0){j6(t,e);return}}e||=ke.toWeb(r).getReader();let{done:n,value:i}=await e.read();n?t.close():t.enqueue(i)}catch(e){t.error(e)}}})}else{let e=A6(r);e===void 0?a.body=ke.toWeb(r):a.body=new ReadableStream({start(t){j6(t,e)}})}return new w6(t,a)},M6=Symbol(`getRequestCache`),N6=Symbol(`requestCache`),P6=Symbol(`incomingKey`),F6=Symbol(`urlKey`),F_e=Symbol(`methodKey`),I6=Symbol(`headersKey`),L6=Symbol(`abortControllerKey`),R6=Symbol(`getAbortController`),I_e=Symbol(`abortRequest`),z6=Symbol(`bodyBuffer`),B6=Symbol(`bodyReadPromise`),V6=Symbol(`bodyConsumedDirectly`),H6=Symbol(`bodyLockReader`),U6=Symbol(`abortReason`),W6=()=>TypeError(`Body is unusable`),G6=()=>Promise.reject(W6()),L_e=new TextDecoder,R_e=e=>{if(e[V6])return G6();e[V6]=!0},z_e=e=>e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength),B_e=e=>(e[I6]||=T6(e[P6])).get(`content-type`)||``,V_e=/^[!#$%&'*+\-.^_`|~0-9A-Za-z]+$/,H_e=e=>{if(!V_e.test(e))return TypeError(`'${e}' is not a valid HTTP method.`);let t=e.toUpperCase();if(t===`CONNECT`||t===`TRACK`||t===`TRACE`&&e!==`TRACE`)return TypeError(`'${e}' HTTP method is unsupported.`)},K6=(e,t,n)=>{if(e[V6])return G6();let r=e.method;if(r===`GET`||r===`HEAD`)return e[M6]()[t]();let i=H_e(r);if(i)return Promise.reject(i);if(e[N6]&&r!==`TRACE`)return e[N6][t]();let a=R_e(e);if(a)return a;let o=U_e(e);if(o){let t=Promise.resolve(n(o,e));return e[z6]=void 0,t}return W_e(e).then(t=>{let r=n(t,e);return e[z6]=void 0,r})},U_e=e=>{let t=e[P6];if(`rawBody`in t&&t.rawBody instanceof Buffer)return t.rawBody},q6=(e,t)=>{if(t.errored)return t.errored;let n=e[U6];return n===void 0?Error(`Client connection prematurely closed.`):n instanceof Error?n:Error(String(n))},W_e=e=>{if(e[z6])return Promise.resolve(e[z6]);if(e[B6])return e[B6];let t=e[P6];if(t.readableDidRead)return G6();let n=A6(t);if(n!==void 0)return n instanceof Error?Promise.reject(n):(e[z6]=n,Promise.resolve(n));let r=new Promise((n,r)=>{let i=[],a=!1,o=e=>{a||(a=!0,f(),e())},s=a=>{let s=t.errored??a;return!k6(t)||s&&s.code!==`ECONNRESET`?!1:(o(()=>{let o=A6(t,i);o instanceof Error?r(o):o===void 0?r(a??q6(e,t)):(e[z6]=o,n(o))}),!0)},c=e=>{i.push(O6(e,t.readableEncoding))},l=()=>{o(()=>{let t=i.length===1?i[0]:Buffer.concat(i);e[z6]=t,n(t)})},u=e=>{s(e)||o(()=>{r(e)})},d=()=>{if(t.readableEnded){l();return}s()||o(()=>{r(q6(e,t))})},f=()=>{t.off(`data`,c),t.off(`end`,l),t.off(`error`,u),t.off(`close`,d),e[B6]=void 0};t.on(`data`,c),t.on(`end`,l),t.on(`error`,u),t.on(`close`,d),queueMicrotask(()=>{a||(t.readableEnded?l():t.errored?u(t.errored):t.destroyed&&d())})});return e[B6]=r,r},J6={get method(){return this[F_e]},get url(){return this[F6]},get headers(){return this[I6]||=T6(this[P6])},[I_e](e){this[U6]===void 0&&(this[U6]=e);let t=this[L6];t&&!t.signal.aborted&&t.abort(e)},[R6](){return this[L6]||=new AbortController,this[U6]!==void 0&&!this[L6].signal.aborted&&this[L6].abort(this[U6]),this[L6]},[M6](){let e=this[R6]();if(this[N6])return this[N6];let t=this.method;if(this[V6]&&!(t===`GET`||t===`HEAD`)){this[z6]=void 0;let n={method:t===`TRACE`?`GET`:t,headers:this.headers,signal:e.signal};t!==`TRACE`&&(n.body=new ReadableStream({start(e){e.close()}}),n.duplex=`half`);let r=new w6(this[F6],n);return t===`TRACE`&&Object.defineProperty(r,`method`,{get(){return`TRACE`}}),this[N6]=r}return this[N6]=P_e(this.method,this[F6],this.headers,this[P6],e)},get body(){if(!this[V6])return this[M6]().body;let e=this[M6]();return!this[H6]&&e.body&&(this[H6]=e.body.getReader()),e.body},get bodyUsed(){return this[V6]?!0:this[N6]?this[N6].bodyUsed:!1}};Object.defineProperty(J6,`signal`,{get(){return this[R6]().signal}}),[`cache`,`credentials`,`destination`,`integrity`,`mode`,`redirect`,`referrer`,`referrerPolicy`,`keepalive`].forEach(e=>{Object.defineProperty(J6,e,{get(){return this[M6]()[e]}})}),[`clone`,`formData`].forEach(e=>{Object.defineProperty(J6,e,{value:function(){if(this[V6]){if(e===`clone`)throw W6();return G6()}return this[M6]()[e]()}})}),Object.defineProperty(J6,`text`,{value:function(){return K6(this,`text`,e=>L_e.decode(e))}}),Object.defineProperty(J6,`arrayBuffer`,{value:function(){return K6(this,`arrayBuffer`,e=>z_e(e))}}),Object.defineProperty(J6,`blob`,{value:function(){return K6(this,`blob`,(e,t)=>{let n=B_e(t);return new Response(e,n?{headers:{"content-type":n}}:void 0).blob()})}}),Object.defineProperty(J6,`json`,{value:function(){return this[V6]?G6():this.text().then(JSON.parse)}}),Object.defineProperty(J6,Symbol.for(`nodejs.util.inspect.custom`),{value:function(e,t,n){return`Request (lightweight) ${n({method:this.method,url:this.url,headers:this.headers,nativeRequest:this[N6]},{...t,depth:e==null?null:e-1})}`}}),Object.setPrototypeOf(J6,w6.prototype);const Y6=Symbol(`responseCache`),X6=Symbol(`getResponseCache`),Z6=Symbol(`cache`),Q6=global.Response;var $6=class e{#e;#t;[X6](){let e=this[Z6],t=e&&e[2]instanceof Headers?e[2]:void 0;return delete this[Z6],this[Y6]||=new Q6(this.#e,t?{status:this.#t?.status,statusText:this.#t?.statusText,headers:t}:this.#t)}constructor(t,n){let r;if(this.#e=t,n instanceof Q6){let t=n[Y6];if(t){this.#t=t,this[X6]();return}this.#t=n instanceof e?n.#t:n,r=new Headers(n.headers)}else this.#t=n;(t==null||typeof t==`string`||t?.getReader!==void 0||t instanceof Blob||t instanceof Uint8Array)&&(this[Z6]=[n?.status||200,t??null,r||n?.headers])}get headers(){let e=this[Z6];return e?(e[2]instanceof Headers||(e[2]=new Headers(e[2]||(e[1]===null?void 0:{"content-type":`text/plain; charset=UTF-8`}))),e[2]):this[X6]().headers}get status(){return this[Z6]?.[0]??this[X6]().status}get ok(){let e=this.status;return e>=200&&e<300}};[`body`,`bodyUsed`,`redirected`,`statusText`,`trailers`,`type`,`url`].forEach(e=>{Object.defineProperty($6.prototype,e,{get(){return this[X6]()[e]}})}),[`arrayBuffer`,`blob`,`clone`,`formData`,`json`,`text`].forEach(e=>{Object.defineProperty($6.prototype,e,{value:function(){return this[X6]()[e]()}})}),Object.defineProperty($6.prototype,Symbol.for(`nodejs.util.inspect.custom`),{value:function(e,t,n){return`Response (lightweight) ${n({status:this.status,headers:this.headers,ok:this.ok,nativeResponse:this[Y6]},{...t,depth:e==null?null:e-1})}`}}),Object.setPrototypeOf($6,Q6),Object.setPrototypeOf($6.prototype,Q6.prototype);const G_e=/^https?:\/\/[!#-;=?-[\]_a-z~A-Z]+$/,K_e=e=>e instanceof URL?e.href:G_e.test(e)?e:new URL(e).href,q_e=new Set([301,302,303,307,308]);Object.defineProperty($6,`redirect`,{value:function(e,t=302){if(!q_e.has(t))throw RangeError(`Invalid status code`);return new $6(null,{status:t,headers:{location:K_e(e)}})},writable:!0,configurable:!0}),Object.defineProperty($6,`json`,{value:function(e,t){let n=JSON.stringify(e);if(n===void 0)throw TypeError(`The data is not JSON serializable`);let r=t?.headers,i;return r?(i=new Headers(r),i.has(`content-type`)||i.set(`content-type`,`application/json`)):i={"content-type":`application/json`},new $6(n,{status:t?.status??200,statusText:t?.statusText,headers:i})},writable:!0,configurable:!0}),globalThis.CloseEvent,globalThis.ErrorEvent,new Response(null,{headers:{"x-hono-already-sent":`true`}}),o1(`suggest-links`),`${jl}`,`${Tl.join(`
446
446
  `)}`,i(((e,t)=>{(function(e){let n=`(0?\\d+|0x[a-f0-9]+)`,r={fourOctet:RegExp(`^${n}\\.${n}\\.${n}\\.${n}$`,`i`),threeOctet:RegExp(`^${n}\\.${n}\\.${n}$`,`i`),twoOctet:RegExp(`^${n}\\.${n}$`,`i`),longValue:RegExp(`^${n}$`,`i`)},i=RegExp(`^0[0-7]+$`,`i`),a=RegExp(`^0x[a-f0-9]+$`,`i`),o=`%[0-9a-z]{1,}`,s=`(?:[0-9a-f]+::?)+`,c={zoneIndex:new RegExp(o,`i`),native:RegExp(`^(::)?(${s})?([0-9a-f]+)?(::)?(${o})?$`,`i`),deprecatedTransitional:RegExp(`^(?:::)(${n}\\.${n}\\.${n}\\.${n}(${o})?)$`,`i`),transitional:RegExp(`^((?:${s})|(?:::)(?:${s})?)${n}\\.${n}\\.${n}\\.${n}(${o})?$`,`i`)};function l(e,t){if(e.indexOf(`::`)!==e.lastIndexOf(`::`))return null;let n=0,r=-1,i=(e.match(c.zoneIndex)||[])[0],a,o;for(i&&(i=i.substring(1),e=e.replace(/%.+$/,``));(r=e.indexOf(`:`,r+1))>=0;)n++;if(e.substr(0,2)===`::`&&n--,e.substr(-2,2)===`::`&&n--,n>t)return null;for(o=t-n,a=`:`;o--;)a+=`0:`;return e=e.replace(`::`,a),e[0]===`:`&&(e=e.slice(1)),e[e.length-1]===`:`&&(e=e.slice(0,-1)),t=(function(){let t=e.split(`:`),n=[];for(let e=0;e<t.length;e++)n.push(parseInt(t[e],16));return n})(),{parts:t,zoneId:i}}function u(e,t,n,r){if(e.length!==t.length)throw Error(`ipaddr: cannot match CIDR for objects with different lengths`);let i=0,a;for(;r>0;){if(a=n-r,a<0&&(a=0),e[i]>>a!==t[i]>>a)return!1;r-=n,i+=1}return!0}function d(e){if(a.test(e))return parseInt(e,16);if(e[0]===`0`&&!isNaN(parseInt(e[1],10))){if(i.test(e))return parseInt(e,8);throw Error(`ipaddr: cannot parse ${e} as octal`)}return parseInt(e,10)}function f(e,t){for(;e.length<t;)e=`0${e}`;return e}let p={};p.IPv4=(function(){function e(e){if(e.length!==4)throw Error(`ipaddr: ipv4 octet count should be 4`);let t,n;for(t=0;t<e.length;t++)if(n=e[t],!(0<=n&&n<=255))throw Error(`ipaddr: ipv4 octet should fit in 8 bits`);this.octets=e}return e.prototype.SpecialRanges={unspecified:[[new e([0,0,0,0]),8]],broadcast:[[new e([255,255,255,255]),32]],multicast:[[new e([224,0,0,0]),4]],linkLocal:[[new e([169,254,0,0]),16]],loopback:[[new e([127,0,0,0]),8]],carrierGradeNat:[[new e([100,64,0,0]),10]],private:[[new e([10,0,0,0]),8],[new e([172,16,0,0]),12],[new e([192,168,0,0]),16]],reserved:[[new e([192,0,0,0]),24],[new e([192,0,2,0]),24],[new e([192,88,99,0]),24],[new e([198,18,0,0]),15],[new e([198,51,100,0]),24],[new e([203,0,113,0]),24],[new e([240,0,0,0]),4]],as112:[[new e([192,175,48,0]),24],[new e([192,31,196,0]),24]],amt:[[new e([192,52,193,0]),24]]},e.prototype.kind=function(){return`ipv4`},e.prototype.match=function(e,t){let n;if(t===void 0&&(n=e,e=n[0],t=n[1]),e.kind()!==`ipv4`)throw Error(`ipaddr: cannot match ipv4 address with non-ipv4 one`);return u(this.octets,e.octets,8,t)},e.prototype.prefixLengthFromSubnetMask=function(){let e=0,t=!1,n={0:8,128:7,192:6,224:5,240:4,248:3,252:2,254:1,255:0},r,i,a;for(r=3;r>=0;--r)if(i=this.octets[r],i in n){if(a=n[i],t&&a!==0)return null;a!==8&&(t=!0),e+=a}else return null;return 32-e},e.prototype.range=function(){return p.subnetMatch(this,this.SpecialRanges)},e.prototype.toByteArray=function(){return this.octets.slice(0)},e.prototype.toIPv4MappedAddress=function(){return p.IPv6.parse(`::ffff:${this.toString()}`)},e.prototype.toNormalizedString=function(){return this.toString()},e.prototype.toString=function(){return this.octets.join(`.`)},e})(),p.IPv4.broadcastAddressFromCIDR=function(e){try{let t=this.parseCIDR(e),n=t[0].toByteArray(),r=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[],a=0;for(;a<4;)i.push(parseInt(n[a],10)|parseInt(r[a],10)^255),a++;return new this(i)}catch{throw Error(`ipaddr: the address does not have IPv4 CIDR format`)}},p.IPv4.isIPv4=function(e){return this.parser(e)!==null},p.IPv4.isValid=function(e){try{return new this(this.parser(e)),!0}catch{return!1}},p.IPv4.isValidCIDR=function(e){try{return this.parseCIDR(e),!0}catch{return!1}},p.IPv4.isValidFourPartDecimal=function(e){return!!(p.IPv4.isValid(e)&&e.match(/^(0|[1-9]\d*)(\.(0|[1-9]\d*)){3}$/))},p.IPv4.isValidCIDRFourPartDecimal=function(e){let t=e.match(/^(.+)\/(\d+)$/);return!p.IPv4.isValidCIDR(e)||!t?!1:p.IPv4.isValidFourPartDecimal(t[1])},p.IPv4.networkAddressFromCIDR=function(e){let t,n,r,i,a;try{for(t=this.parseCIDR(e),r=t[0].toByteArray(),a=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[],n=0;n<4;)i.push(parseInt(r[n],10)&parseInt(a[n],10)),n++;return new this(i)}catch{throw Error(`ipaddr: the address does not have IPv4 CIDR format`)}},p.IPv4.parse=function(e){let t=this.parser(e);if(t===null)throw Error(`ipaddr: string is not formatted like an IPv4 Address`);return new this(t)},p.IPv4.parseCIDR=function(e){let t;if(t=e.match(/^(.+)\/(\d+)$/)){let e=parseInt(t[2]);if(e>=0&&e<=32){let n=[this.parse(t[1]),e];return Object.defineProperty(n,`toString`,{value:function(){return this.join(`/`)}}),n}}throw Error(`ipaddr: string is not formatted like an IPv4 CIDR range`)},p.IPv4.parser=function(e){let t,n,i;if(t=e.match(r.fourOctet))return(function(){let e=t.slice(1,6),r=[];for(let t=0;t<e.length;t++)n=e[t],r.push(d(n));return r})();if(t=e.match(r.longValue)){if(i=d(t[1]),i>4294967295||i<0)throw Error(`ipaddr: address outside defined range`);return(function(){let e=[],t;for(t=0;t<=24;t+=8)e.push(i>>t&255);return e})().reverse()}else if(t=e.match(r.twoOctet))return(function(){let e=t.slice(1,4),n=[];if(i=d(e[1]),i>16777215||i<0)throw Error(`ipaddr: address outside defined range`);return n.push(d(e[0])),n.push(i>>16&255),n.push(i>>8&255),n.push(i&255),n})();else if(t=e.match(r.threeOctet))return(function(){let e=t.slice(1,5),n=[];if(i=d(e[2]),i>65535||i<0)throw Error(`ipaddr: address outside defined range`);return n.push(d(e[0])),n.push(d(e[1])),n.push(i>>8&255),n.push(i&255),n})();else return null},p.IPv4.subnetMaskFromPrefixLength=function(e){if(e=parseInt(e),e<0||e>32)throw Error(`ipaddr: invalid IPv4 prefix length`);let t=[0,0,0,0],n=0,r=Math.floor(e/8);for(;n<r;)t[n]=255,n++;return r<4&&(t[r]=2**(e%8)-1<<8-e%8),new this(t)},p.IPv6=(function(){function e(e,t){let n,r;if(e.length===16)for(this.parts=[],n=0;n<=14;n+=2)this.parts.push(e[n]<<8|e[n+1]);else if(e.length===8)this.parts=e;else throw Error(`ipaddr: ipv6 part count should be 8 or 16`);for(n=0;n<this.parts.length;n++)if(r=this.parts[n],!(0<=r&&r<=65535))throw Error(`ipaddr: ipv6 part should fit in 16 bits`);t&&(this.zoneId=t)}return e.prototype.SpecialRanges={unspecified:[new e([0,0,0,0,0,0,0,0]),128],linkLocal:[new e([65152,0,0,0,0,0,0,0]),10],multicast:[new e([65280,0,0,0,0,0,0,0]),8],loopback:[new e([0,0,0,0,0,0,0,1]),128],uniqueLocal:[new e([64512,0,0,0,0,0,0,0]),7],ipv4Mapped:[new e([0,0,0,0,0,65535,0,0]),96],deprecatedSiteLocal:[new e([65216,0,0,0,0,0,0,0]),10],discard:[new e([256,0,0,0,0,0,0,0]),64],rfc6145:[new e([0,0,0,0,65535,0,0,0]),96],rfc6052:[[new e([100,65435,0,0,0,0,0,0]),96],[new e([100,65435,1,0,0,0,0,0]),48]],"6to4":[new e([8194,0,0,0,0,0,0,0]),16],teredo:[new e([8193,0,0,0,0,0,0,0]),32],benchmarking:[new e([8193,2,0,0,0,0,0,0]),48],amt:[new e([8193,3,0,0,0,0,0,0]),32],as112v6:[[new e([8193,4,274,0,0,0,0,0]),48],[new e([9760,79,32768,0,0,0,0,0]),48]],deprecatedOrchid:[new e([8193,16,0,0,0,0,0,0]),28],orchid2:[new e([8193,32,0,0,0,0,0,0]),28],droneRemoteIdProtocolEntityTags:[new e([8193,48,0,0,0,0,0,0]),28],segmentRouting:[new e([24320,0,0,0,0,0,0,0]),16],reserved:[[new e([8193,0,0,0,0,0,0,0]),23],[new e([8193,3512,0,0,0,0,0,0]),32],[new e([16383,0,0,0,0,0,0,0]),20]]},e.prototype.isIPv4MappedAddress=function(){return this.range()===`ipv4Mapped`},e.prototype.kind=function(){return`ipv6`},e.prototype.match=function(e,t){let n;if(t===void 0&&(n=e,e=n[0],t=n[1]),e.kind()!==`ipv6`)throw Error(`ipaddr: cannot match ipv6 address with non-ipv6 one`);return u(this.parts,e.parts,16,t)},e.prototype.prefixLengthFromSubnetMask=function(){let e=0,t=!1,n={0:16,32768:15,49152:14,57344:13,61440:12,63488:11,64512:10,65024:9,65280:8,65408:7,65472:6,65504:5,65520:4,65528:3,65532:2,65534:1,65535:0},r,i;for(let a=7;a>=0;--a)if(r=this.parts[a],r in n){if(i=n[r],t&&i!==0)return null;i!==16&&(t=!0),e+=i}else return null;return 128-e},e.prototype.range=function(){return p.subnetMatch(this,this.SpecialRanges)},e.prototype.toByteArray=function(){let e,t=[],n=this.parts;for(let r=0;r<n.length;r++)e=n[r],t.push(e>>8),t.push(e&255);return t},e.prototype.toFixedLengthString=function(){let e=(function(){let e=[];for(let t=0;t<this.parts.length;t++)e.push(f(this.parts[t].toString(16),4));return e}).call(this).join(`:`),t=``;return this.zoneId&&(t=`%${this.zoneId}`),e+t},e.prototype.toIPv4Address=function(){if(!this.isIPv4MappedAddress())throw Error(`ipaddr: trying to convert a generic ipv6 address to ipv4`);let e=this.parts.slice(-2),t=e[0],n=e[1];return new p.IPv4([t>>8,t&255,n>>8,n&255])},e.prototype.toNormalizedString=function(){let e=(function(){let e=[];for(let t=0;t<this.parts.length;t++)e.push(this.parts[t].toString(16));return e}).call(this).join(`:`),t=``;return this.zoneId&&(t=`%${this.zoneId}`),e+t},e.prototype.toRFC5952String=function(){let e=/((^|:)(0(:|$)){2,})/g,t=this.toNormalizedString(),n=0,r=-1,i;for(;i=e.exec(t);)i[0].length>r&&(n=i.index,r=i[0].length);return r<0?t:`${t.substring(0,n)}::${t.substring(n+r)}`},e.prototype.toString=function(){return this.toRFC5952String()},e})(),p.IPv6.broadcastAddressFromCIDR=function(e){try{let t=this.parseCIDR(e),n=t[0].toByteArray(),r=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[],a=0;for(;a<16;)i.push(parseInt(n[a],10)|parseInt(r[a],10)^255),a++;return new this(i)}catch(e){throw Error(`ipaddr: the address does not have IPv6 CIDR format (${e})`)}},p.IPv6.isIPv6=function(e){return this.parser(e)!==null},p.IPv6.isValid=function(e){if(typeof e==`string`&&e.indexOf(`:`)===-1)return!1;try{let t=this.parser(e);return new this(t.parts,t.zoneId),!0}catch{return!1}},p.IPv6.isValidCIDR=function(e){if(typeof e==`string`&&e.indexOf(`:`)===-1)return!1;try{return this.parseCIDR(e),!0}catch{return!1}},p.IPv6.networkAddressFromCIDR=function(e){let t,n,r,i,a;try{for(t=this.parseCIDR(e),r=t[0].toByteArray(),a=this.subnetMaskFromPrefixLength(t[1]).toByteArray(),i=[],n=0;n<16;)i.push(parseInt(r[n],10)&parseInt(a[n],10)),n++;return new this(i)}catch(e){throw Error(`ipaddr: the address does not have IPv6 CIDR format (${e})`)}},p.IPv6.parse=function(e){let t=this.parser(e);if(t.parts===null)throw Error(`ipaddr: string is not formatted like an IPv6 Address`);return new this(t.parts,t.zoneId)},p.IPv6.parseCIDR=function(e){let t,n,r;if((n=e.match(/^(.+)\/(\d+)$/))&&(t=parseInt(n[2]),t>=0&&t<=128))return r=[this.parse(n[1]),t],Object.defineProperty(r,`toString`,{value:function(){return this.join(`/`)}}),r;throw Error(`ipaddr: string is not formatted like an IPv6 CIDR range`)},p.IPv6.parser=function(e){let t,n,r,i,a,o;if(r=e.match(c.deprecatedTransitional))return this.parser(`::ffff:${r[1]}`);if(c.native.test(e))return l(e,8);if((r=e.match(c.transitional))&&(o=r[6]||``,t=r[1],r[1].endsWith(`::`)||(t=t.slice(0,-1)),t=l(t+o,6),t.parts)){for(a=[parseInt(r[2]),parseInt(r[3]),parseInt(r[4]),parseInt(r[5])],n=0;n<a.length;n++)if(i=a[n],!(0<=i&&i<=255))return null;return t.parts.push(a[0]<<8|a[1]),t.parts.push(a[2]<<8|a[3]),{parts:t.parts,zoneId:t.zoneId}}return null},p.IPv6.subnetMaskFromPrefixLength=function(e){if(e=parseInt(e),e<0||e>128)throw Error(`ipaddr: invalid IPv6 prefix length`);let t=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0],n=0,r=Math.floor(e/8);for(;n<r;)t[n]=255,n++;return r<16&&(t[r]=2**(e%8)-1<<8-e%8),new this(t)},p.fromByteArray=function(e){let t=e.length;if(t===4)return new p.IPv4(e);if(t===16)return new p.IPv6(e);throw Error(`ipaddr: the binary input is neither an IPv6 nor IPv4 address`)},p.isValid=function(e){return p.IPv6.isValid(e)||p.IPv4.isValid(e)},p.isValidCIDR=function(e){return p.IPv6.isValidCIDR(e)||p.IPv4.isValidCIDR(e)},p.parse=function(e){if(p.IPv6.isValid(e))return p.IPv6.parse(e);if(p.IPv4.isValid(e))return p.IPv4.parse(e);throw Error(`ipaddr: the address has neither IPv6 nor IPv4 format`)},p.parseCIDR=function(e){try{return p.IPv6.parseCIDR(e)}catch{try{return p.IPv4.parseCIDR(e)}catch{throw Error(`ipaddr: the address has neither IPv6 nor IPv4 CIDR format`)}}},p.process=function(e){let t=this.parse(e);return t.kind()===`ipv6`&&t.isIPv4MappedAddress()?t.toIPv4Address():t},p.subnetMatch=function(e,t,n){let r,i,a,o;for(i in n??=`unicast`,t)if(Object.prototype.hasOwnProperty.call(t,i)){for(a=t[i],a[0]&&!(a[0]instanceof Array)&&(a=[a]),r=0;r<a.length;r++)if(o=a[r],e.kind()===o[0].kind()&&e.match.apply(e,o))return i}return n},t!==void 0&&t.exports?t.exports=p:e.ipaddr=p})(e)}))(),o1(`link-preview.guarded-fetch`),o1(`link-preview.cache`),o1(`local-op-security`),o1(`clone-flow`),Ie(s),o1(`managed-artifact-persistence`),o1(`managed-rename`),o1(`rename-log`),b6.project,Object.fromEntries(Object.entries(Ml).map(([e,t])=>[t,e])),[`These are patterns to adapt to your domain, not a layout to copy verbatim.`,"To build a variant: create your own folders (via `write` or your editor) and reuse only the ideas that fit.","To adopt this pack as-is: re-run without `--dry-run`."].join(`
447
- `),Object.assign({"3g2":`video/3gpp2`,"3gp":`video/3gpp`,"3gpp":`video/3gpp`,"3mf":`model/3mf`,aac:`audio/aac`,ac:`application/pkix-attr-cert`,adp:`audio/adpcm`,adts:`audio/aac`,ai:`application/postscript`,aml:`application/automationml-aml+xml`,amlx:`application/automationml-amlx+zip`,amr:`audio/amr`,apng:`image/apng`,appcache:`text/cache-manifest`,appinstaller:`application/appinstaller`,appx:`application/appx`,appxbundle:`application/appxbundle`,asc:`application/pgp-keys`,atom:`application/atom+xml`,atomcat:`application/atomcat+xml`,atomdeleted:`application/atomdeleted+xml`,atomsvc:`application/atomsvc+xml`,au:`audio/basic`,avci:`image/avci`,avcs:`image/avcs`,avif:`image/avif`,aw:`application/applixware`,bdoc:`application/bdoc`,bin:`application/octet-stream`,bmp:`image/bmp`,bpk:`application/octet-stream`,btf:`image/prs.btif`,btif:`image/prs.btif`,buffer:`application/octet-stream`,ccxml:`application/ccxml+xml`,cdfx:`application/cdfx+xml`,cdmia:`application/cdmi-capability`,cdmic:`application/cdmi-container`,cdmid:`application/cdmi-domain`,cdmio:`application/cdmi-object`,cdmiq:`application/cdmi-queue`,cer:`application/pkix-cert`,cgm:`image/cgm`,cjs:`application/node`,class:`application/java-vm`,coffee:`text/coffeescript`,conf:`text/plain`,cpl:`application/cpl+xml`,cpt:`application/mac-compactpro`,crl:`application/pkix-crl`,css:`text/css`,csv:`text/csv`,cu:`application/cu-seeme`,cwl:`application/cwl`,cww:`application/prs.cww`,davmount:`application/davmount+xml`,dbk:`application/docbook+xml`,deb:`application/octet-stream`,def:`text/plain`,deploy:`application/octet-stream`,dib:`image/bmp`,"disposition-notification":`message/disposition-notification`,dist:`application/octet-stream`,distz:`application/octet-stream`,dll:`application/octet-stream`,dmg:`application/octet-stream`,dms:`application/octet-stream`,doc:`application/msword`,dot:`application/msword`,dpx:`image/dpx`,drle:`image/dicom-rle`,dsc:`text/prs.lines.tag`,dssc:`application/dssc+der`,dtd:`application/xml-dtd`,dump:`application/octet-stream`,dwd:`application/atsc-dwd+xml`,ear:`application/java-archive`,ecma:`application/ecmascript`,elc:`application/octet-stream`,emf:`image/emf`,eml:`message/rfc822`,emma:`application/emma+xml`,emotionml:`application/emotionml+xml`,eps:`application/postscript`,epub:`application/epub+zip`,exe:`application/octet-stream`,exi:`application/exi`,exp:`application/express`,exr:`image/aces`,ez:`application/andrew-inset`,fdf:`application/fdf`,fdt:`application/fdt+xml`,fits:`image/fits`,g3:`image/g3fax`,gbr:`application/rpki-ghostbusters`,geojson:`application/geo+json`,gif:`image/gif`,glb:`model/gltf-binary`,gltf:`model/gltf+json`,gml:`application/gml+xml`,gpx:`application/gpx+xml`,gram:`application/srgs`,grxml:`application/srgs+xml`,gxf:`application/gxf`,gz:`application/gzip`,h261:`video/h261`,h263:`video/h263`,h264:`video/h264`,heic:`image/heic`,heics:`image/heic-sequence`,heif:`image/heif`,heifs:`image/heif-sequence`,hej2:`image/hej2k`,held:`application/atsc-held+xml`,hjson:`application/hjson`,hlp:`application/winhlp`,hqx:`application/mac-binhex40`,hsj2:`image/hsj2`,htm:`text/html`,html:`text/html`,ics:`text/calendar`,ief:`image/ief`,ifb:`text/calendar`,iges:`model/iges`,igs:`model/iges`,img:`application/octet-stream`,in:`text/plain`,ini:`text/plain`,ink:`application/inkml+xml`,inkml:`application/inkml+xml`,ipfix:`application/ipfix`,iso:`application/octet-stream`,its:`application/its+xml`,jade:`text/jade`,jar:`application/java-archive`,jhc:`image/jphc`,jls:`image/jls`,jp2:`image/jp2`,jpe:`image/jpeg`,jpeg:`image/jpeg`,jpf:`image/jpx`,jpg:`image/jpeg`,jpg2:`image/jp2`,jpgm:`image/jpm`,jpgv:`video/jpeg`,jph:`image/jph`,jpm:`image/jpm`,jpx:`image/jpx`,js:`text/javascript`,json:`application/json`,json5:`application/json5`,jsonld:`application/ld+json`,jsonml:`application/jsonml+json`,jsx:`text/jsx`,jt:`model/jt`,jxl:`image/jxl`,jxr:`image/jxr`,jxra:`image/jxra`,jxrs:`image/jxrs`,jxs:`image/jxs`,jxsc:`image/jxsc`,jxsi:`image/jxsi`,jxss:`image/jxss`,kar:`audio/midi`,ktx:`image/ktx`,ktx2:`image/ktx2`,less:`text/less`,lgr:`application/lgr+xml`,list:`text/plain`,litcoffee:`text/coffeescript`,log:`text/plain`,lostxml:`application/lost+xml`,lrf:`application/octet-stream`,m1v:`video/mpeg`,m21:`application/mp21`,m2a:`audio/mpeg`,m2t:`video/mp2t`,m2ts:`video/mp2t`,m2v:`video/mpeg`,m3a:`audio/mpeg`,m4a:`audio/mp4`,m4p:`application/mp4`,m4s:`video/iso.segment`,ma:`application/mathematica`,mads:`application/mads+xml`,maei:`application/mmt-aei+xml`,man:`text/troff`,manifest:`text/cache-manifest`,map:`application/json`,mar:`application/octet-stream`,markdown:`text/markdown`,mathml:`application/mathml+xml`,mb:`application/mathematica`,mbox:`application/mbox`,md:`text/markdown`,mdx:`text/mdx`,me:`text/troff`,mesh:`model/mesh`,meta4:`application/metalink4+xml`,metalink:`application/metalink+xml`,mets:`application/mets+xml`,mft:`application/rpki-manifest`,mid:`audio/midi`,midi:`audio/midi`,mime:`message/rfc822`,mj2:`video/mj2`,mjp2:`video/mj2`,mjs:`text/javascript`,mml:`text/mathml`,mods:`application/mods+xml`,mov:`video/quicktime`,mp2:`audio/mpeg`,mp21:`application/mp21`,mp2a:`audio/mpeg`,mp3:`audio/mpeg`,mp4:`video/mp4`,mp4a:`audio/mp4`,mp4s:`application/mp4`,mp4v:`video/mp4`,mpd:`application/dash+xml`,mpe:`video/mpeg`,mpeg:`video/mpeg`,mpf:`application/media-policy-dataset+xml`,mpg:`video/mpeg`,mpg4:`video/mp4`,mpga:`audio/mpeg`,mpp:`application/dash-patch+xml`,mrc:`application/marc`,mrcx:`application/marcxml+xml`,ms:`text/troff`,mscml:`application/mediaservercontrol+xml`,msh:`model/mesh`,msi:`application/octet-stream`,msix:`application/msix`,msixbundle:`application/msixbundle`,msm:`application/octet-stream`,msp:`application/octet-stream`,mtl:`model/mtl`,mts:`video/mp2t`,musd:`application/mmt-usd+xml`,mxf:`application/mxf`,mxmf:`audio/mobile-xmf`,mxml:`application/xv+xml`,n3:`text/n3`,nb:`application/mathematica`,nq:`application/n-quads`,nt:`application/n-triples`,obj:`model/obj`,oda:`application/oda`,oga:`audio/ogg`,ogg:`audio/ogg`,ogv:`video/ogg`,ogx:`application/ogg`,omdoc:`application/omdoc+xml`,onepkg:`application/onenote`,onetmp:`application/onenote`,onetoc:`application/onenote`,onetoc2:`application/onenote`,opf:`application/oebps-package+xml`,opus:`audio/ogg`,otf:`font/otf`,owl:`application/rdf+xml`,oxps:`application/oxps`,p10:`application/pkcs10`,p7c:`application/pkcs7-mime`,p7m:`application/pkcs7-mime`,p7s:`application/pkcs7-signature`,p8:`application/pkcs8`,pdf:`application/pdf`,pfr:`application/font-tdpfr`,pgp:`application/pgp-encrypted`,pkg:`application/octet-stream`,pki:`application/pkixcmp`,pkipath:`application/pkix-pkipath`,pls:`application/pls+xml`,png:`image/png`,prc:`model/prc`,prf:`application/pics-rules`,provx:`application/provenance+xml`,ps:`application/postscript`,pskcxml:`application/pskc+xml`,pti:`image/prs.pti`,qt:`video/quicktime`,raml:`application/raml+yaml`,rapd:`application/route-apd+xml`,rdf:`application/rdf+xml`,relo:`application/p2p-overlay+xml`,rif:`application/reginfo+xml`,rl:`application/resource-lists+xml`,rld:`application/resource-lists-diff+xml`,rmi:`audio/midi`,rnc:`application/relax-ng-compact-syntax`,rng:`application/xml`,roa:`application/rpki-roa`,roff:`text/troff`,rq:`application/sparql-query`,rs:`application/rls-services+xml`,rsat:`application/atsc-rsat+xml`,rsd:`application/rsd+xml`,rsheet:`application/urc-ressheet+xml`,rss:`application/rss+xml`,rtf:`text/rtf`,rtx:`text/richtext`,rusd:`application/route-usd+xml`,s3m:`audio/s3m`,sbml:`application/sbml+xml`,scq:`application/scvp-cv-request`,scs:`application/scvp-cv-response`,sdp:`application/sdp`,senmlx:`application/senml+xml`,sensmlx:`application/sensml+xml`,ser:`application/java-serialized-object`,setpay:`application/set-payment-initiation`,setreg:`application/set-registration-initiation`,sgi:`image/sgi`,sgm:`text/sgml`,sgml:`text/sgml`,shex:`text/shex`,shf:`application/shf+xml`,shtml:`text/html`,sieve:`application/sieve`,sig:`application/pgp-signature`,sil:`audio/silk`,silo:`model/mesh`,siv:`application/sieve`,slim:`text/slim`,slm:`text/slim`,sls:`application/route-s-tsid+xml`,smi:`application/smil+xml`,smil:`application/smil+xml`,snd:`audio/basic`,so:`application/octet-stream`,spdx:`text/spdx`,spp:`application/scvp-vp-response`,spq:`application/scvp-vp-request`,spx:`audio/ogg`,sql:`application/sql`,sru:`application/sru+xml`,srx:`application/sparql-results+xml`,ssdl:`application/ssdl+xml`,ssml:`application/ssml+xml`,stk:`application/hyperstudio`,stl:`model/stl`,stpx:`model/step+xml`,stpxz:`model/step-xml+zip`,stpz:`model/step+zip`,styl:`text/stylus`,stylus:`text/stylus`,svg:`image/svg+xml`,svgz:`image/svg+xml`,swidtag:`application/swid+xml`,t:`text/troff`,t38:`image/t38`,td:`application/urc-targetdesc+xml`,tei:`application/tei+xml`,teicorpus:`application/tei+xml`,text:`text/plain`,tfi:`application/thraud+xml`,tfx:`image/tiff-fx`,tif:`image/tiff`,tiff:`image/tiff`,toml:`application/toml`,tr:`text/troff`,trig:`application/trig`,ts:`video/mp2t`,tsd:`application/timestamped-data`,tsv:`text/tab-separated-values`,ttc:`font/collection`,ttf:`font/ttf`,ttl:`text/turtle`,ttml:`application/ttml+xml`,txt:`text/plain`,u3d:`model/u3d`,u8dsn:`message/global-delivery-status`,u8hdr:`message/global-headers`,u8mdn:`message/global-disposition-notification`,u8msg:`message/global`,ubj:`application/ubjson`,uri:`text/uri-list`,uris:`text/uri-list`,urls:`text/uri-list`,vcard:`text/vcard`,vrml:`model/vrml`,vtt:`text/vtt`,vxml:`application/voicexml+xml`,war:`application/java-archive`,wasm:`application/wasm`,wav:`audio/wav`,weba:`audio/webm`,webm:`video/webm`,webmanifest:`application/manifest+json`,webp:`image/webp`,wgsl:`text/wgsl`,wgt:`application/widget`,wif:`application/watcherinfo+xml`,wmf:`image/wmf`,woff:`font/woff`,woff2:`font/woff2`,wrl:`model/vrml`,wsdl:`application/wsdl+xml`,wspolicy:`application/wspolicy+xml`,x3d:`model/x3d+xml`,x3db:`model/x3d+fastinfoset`,x3dbz:`model/x3d+binary`,x3dv:`model/x3d-vrml`,x3dvz:`model/x3d+vrml`,x3dz:`model/x3d+xml`,xaml:`application/xaml+xml`,xav:`application/xcap-att+xml`,xca:`application/xcap-caps+xml`,xcs:`application/calendar+xml`,xdf:`application/xcap-diff+xml`,xdssc:`application/dssc+xml`,xel:`application/xcap-el+xml`,xenc:`application/xenc+xml`,xer:`application/patch-ops-error+xml`,xfdf:`application/xfdf`,xht:`application/xhtml+xml`,xhtml:`application/xhtml+xml`,xhvml:`application/xv+xml`,xlf:`application/xliff+xml`,xm:`audio/xm`,xml:`text/xml`,xns:`application/xcap-ns+xml`,xop:`application/xop+xml`,xpl:`application/xproc+xml`,xsd:`application/xml`,xsf:`application/prs.xsf+xml`,xsl:`application/xml`,xslt:`application/xml`,xspf:`application/xspf+xml`,xvm:`application/xv+xml`,xvml:`application/xv+xml`,yaml:`text/yaml`,yang:`application/yang`,yin:`application/yin+xml`,yml:`text/yaml`,zip:`application/zip`},{m4v:`video/mp4`,mkv:`video/x-matroska`,flac:`audio/flac`,toml:`application/toml`,lock:`text/plain`,"7z":`application/x-7z-compressed`,tar:`application/x-tar`,rar:`application/vnd.rar`,xls:`application/vnd.ms-excel`,ppt:`application/vnd.ms-powerpoint`,odt:`application/vnd.oasis.opendocument.text`,ods:`application/vnd.oasis.opendocument.spreadsheet`,odp:`application/vnd.oasis.opendocument.presentation`,pages:`application/vnd.apple.pages`,numbers:`application/vnd.apple.numbers`,key:`application/vnd.apple.keynote`,mobi:`application/x-mobipocket-ebook`}),o1(`file-ops`),o1(`search`),o1(`skill-import`),o1(`skill-install`),o1(`history`),o1(`skills-leaderboard`),o1(`timeline`),o1(`api`),z({principalId:P().optional(),tabSessionId:P().optional(),expectedServerInstanceId:P().optional(),expectedBranch:P().optional(),expectedDocLineageEpoch:P().optional(),clientProtocolVersion:F().optional(),clientRuntimeVersion:P().optional(),clientKind:P().optional()}).loose(),o1(`conflict-storage`);const e8=Io(e=>e!==null&&(typeof e==`object`||typeof e==`function`)),t8=So([P(),F().int()]),n8=P();bo({ttl:F().optional(),pollInterval:F().optional()});const q_e=z({ttl:F().optional()}),J_e=z({taskId:P()}),r8=bo({progressToken:t8.optional(),"io.modelcontextprotocol/related-task":J_e.optional()}),i8=z({_meta:r8.optional()}),a8=i8.extend({task:q_e.optional()}),o8=z({method:P(),params:i8.loose().optional()}),s8=z({_meta:r8.optional()}),c8=z({method:P(),params:s8.loose().optional()}),l8=bo({_meta:r8.optional()}),u8=So([P(),F().int()]),Y_e=z({jsonrpc:H(`2.0`),id:u8,...o8.shape}).strict(),X_e=z({jsonrpc:H(`2.0`),...c8.shape}).strict(),d8=z({jsonrpc:H(`2.0`),id:u8,result:l8}).strict();var Z_e;(function(e){e[e.ConnectionClosed=-32e3]=`ConnectionClosed`,e[e.RequestTimeout=-32001]=`RequestTimeout`,e[e.ParseError=-32700]=`ParseError`,e[e.InvalidRequest=-32600]=`InvalidRequest`,e[e.MethodNotFound=-32601]=`MethodNotFound`,e[e.InvalidParams=-32602]=`InvalidParams`,e[e.InternalError=-32603]=`InternalError`,e[e.UrlElicitationRequired=-32042]=`UrlElicitationRequired`})(Z_e||={});const f8=z({jsonrpc:H(`2.0`),id:u8.optional(),error:z({code:F().int(),message:P(),data:L().optional()})}).strict();So([Y_e,X_e,d8,f8]),So([d8,f8]);const p8=l8.strict(),Q_e=s8.extend({requestId:u8.optional(),reason:P().optional()}),m8=c8.extend({method:H(`notifications/cancelled`),params:Q_e}),h8=z({icons:R(z({src:P(),mimeType:P().optional(),sizes:R(P()).optional(),theme:V([`light`,`dark`]).optional()})).optional()}),g8=z({name:P(),title:P().optional()}),_8=g8.extend({...g8.shape,...h8.shape,version:P(),websiteUrl:P().optional(),description:P().optional()}),$_e=Lo(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,wo(z({form:wo(z({applyDefaults:I().optional()}),B(P(),L())).optional(),url:e8.optional()}),B(P(),L()).optional())),eve=bo({list:e8.optional(),cancel:e8.optional(),requests:bo({sampling:bo({createMessage:e8.optional()}).optional(),elicitation:bo({create:e8.optional()}).optional()}).optional()}),tve=bo({list:e8.optional(),cancel:e8.optional(),requests:bo({tools:bo({call:e8.optional()}).optional()}).optional()}),nve=z({experimental:B(P(),e8).optional(),sampling:z({context:e8.optional(),tools:e8.optional()}).optional(),elicitation:$_e.optional(),roots:z({listChanged:I().optional()}).optional(),tasks:eve.optional(),extensions:B(P(),e8).optional()}),rve=i8.extend({protocolVersion:P(),capabilities:nve,clientInfo:_8}),ive=o8.extend({method:H(`initialize`),params:rve}),ave=z({experimental:B(P(),e8).optional(),logging:e8.optional(),completions:e8.optional(),prompts:z({listChanged:I().optional()}).optional(),resources:z({subscribe:I().optional(),listChanged:I().optional()}).optional(),tools:z({listChanged:I().optional()}).optional(),tasks:tve.optional(),extensions:B(P(),e8).optional()}),ove=l8.extend({protocolVersion:P(),capabilities:ave,serverInfo:_8,instructions:P().optional()}),sve=c8.extend({method:H(`notifications/initialized`),params:s8.optional()}),v8=o8.extend({method:H(`ping`),params:i8.optional()}),cve=z({progress:F(),total:ko(F()),message:ko(P())}),lve=z({...s8.shape,...cve.shape,progressToken:t8}),y8=c8.extend({method:H(`notifications/progress`),params:lve}),uve=i8.extend({cursor:n8.optional()}),b8=o8.extend({params:uve.optional()}),x8=l8.extend({nextCursor:n8.optional()}),dve=V([`working`,`input_required`,`completed`,`failed`,`cancelled`]),S8=z({taskId:P(),status:dve,ttl:So([F(),vo()]),createdAt:P(),lastUpdatedAt:P(),pollInterval:ko(F()),statusMessage:ko(P())}),C8=l8.extend({task:S8}),fve=s8.merge(S8),w8=c8.extend({method:H(`notifications/tasks/status`),params:fve}),T8=o8.extend({method:H(`tasks/get`),params:i8.extend({taskId:P()})}),E8=l8.merge(S8),D8=o8.extend({method:H(`tasks/result`),params:i8.extend({taskId:P()})});l8.loose();const O8=b8.extend({method:H(`tasks/list`)}),k8=x8.extend({tasks:R(S8)}),A8=o8.extend({method:H(`tasks/cancel`),params:i8.extend({taskId:P()})});l8.merge(S8);const j8=z({uri:P(),mimeType:ko(P()),_meta:B(P(),L()).optional()}),M8=j8.extend({text:P()}),N8=P().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),P8=j8.extend({blob:N8}),F8=V([`user`,`assistant`]),I8=z({audience:R(F8).optional(),priority:F().min(0).max(1).optional(),lastModified:Fa({offset:!0}).optional()}),L8=z({...g8.shape,...h8.shape,uri:P(),description:ko(P()),mimeType:ko(P()),size:ko(F()),annotations:I8.optional(),_meta:ko(bo({}))}),pve=z({...g8.shape,...h8.shape,uriTemplate:P(),description:ko(P()),mimeType:ko(P()),annotations:I8.optional(),_meta:ko(bo({}))}),mve=b8.extend({method:H(`resources/list`)}),hve=x8.extend({resources:R(L8)}),gve=b8.extend({method:H(`resources/templates/list`)}),_ve=x8.extend({resourceTemplates:R(pve)}),R8=i8.extend({uri:P()}),vve=R8,yve=o8.extend({method:H(`resources/read`),params:vve}),bve=l8.extend({contents:R(So([M8,P8]))}),xve=c8.extend({method:H(`notifications/resources/list_changed`),params:s8.optional()}),Sve=R8,Cve=o8.extend({method:H(`resources/subscribe`),params:Sve}),wve=R8,Tve=o8.extend({method:H(`resources/unsubscribe`),params:wve}),Eve=s8.extend({uri:P()}),Dve=c8.extend({method:H(`notifications/resources/updated`),params:Eve}),Ove=z({name:P(),description:ko(P()),required:ko(I())}),kve=z({...g8.shape,...h8.shape,description:ko(P()),arguments:ko(R(Ove)),_meta:ko(bo({}))}),Ave=b8.extend({method:H(`prompts/list`)}),jve=x8.extend({prompts:R(kve)}),Mve=i8.extend({name:P(),arguments:B(P(),P()).optional()}),Nve=o8.extend({method:H(`prompts/get`),params:Mve}),z8=z({type:H(`text`),text:P(),annotations:I8.optional(),_meta:B(P(),L()).optional()}),B8=z({type:H(`image`),data:N8,mimeType:P(),annotations:I8.optional(),_meta:B(P(),L()).optional()}),V8=z({type:H(`audio`),data:N8,mimeType:P(),annotations:I8.optional(),_meta:B(P(),L()).optional()}),Pve=z({type:H(`tool_use`),name:P(),id:P(),input:B(P(),L()),_meta:B(P(),L()).optional()}),Fve=z({type:H(`resource`),resource:So([M8,P8]),annotations:I8.optional(),_meta:B(P(),L()).optional()}),H8=So([z8,B8,V8,L8.extend({type:H(`resource_link`)}),Fve]),Ive=z({role:F8,content:H8}),Lve=l8.extend({description:P().optional(),messages:R(Ive)}),Rve=c8.extend({method:H(`notifications/prompts/list_changed`),params:s8.optional()}),zve=z({title:P().optional(),readOnlyHint:I().optional(),destructiveHint:I().optional(),idempotentHint:I().optional(),openWorldHint:I().optional()}),Bve=z({taskSupport:V([`required`,`optional`,`forbidden`]).optional()}),U8=z({...g8.shape,...h8.shape,description:P().optional(),inputSchema:z({type:H(`object`),properties:B(P(),e8).optional(),required:R(P()).optional()}).catchall(L()),outputSchema:z({type:H(`object`),properties:B(P(),e8).optional(),required:R(P()).optional()}).catchall(L()).optional(),annotations:zve.optional(),execution:Bve.optional(),_meta:B(P(),L()).optional()}),Vve=b8.extend({method:H(`tools/list`)}),Hve=x8.extend({tools:R(U8)}),W8=l8.extend({content:R(H8).default([]),structuredContent:B(P(),L()).optional(),isError:I().optional()});W8.or(l8.extend({toolResult:L()}));const Uve=a8.extend({name:P(),arguments:B(P(),L()).optional()}),Wve=o8.extend({method:H(`tools/call`),params:Uve}),Gve=c8.extend({method:H(`notifications/tools/list_changed`),params:s8.optional()});z({autoRefresh:I().default(!0),debounceMs:F().int().nonnegative().default(300)});const G8=V([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),Kve=i8.extend({level:G8}),qve=o8.extend({method:H(`logging/setLevel`),params:Kve}),Jve=s8.extend({level:G8,logger:P().optional(),data:L()}),Yve=c8.extend({method:H(`notifications/message`),params:Jve}),Xve=z({hints:R(z({name:P().optional()})).optional(),costPriority:F().min(0).max(1).optional(),speedPriority:F().min(0).max(1).optional(),intelligencePriority:F().min(0).max(1).optional()}),Zve=z({mode:V([`auto`,`required`,`none`]).optional()}),Qve=z({type:H(`tool_result`),toolUseId:P().describe(`The unique identifier for the corresponding tool call.`),content:R(H8).default([]),structuredContent:z({}).loose().optional(),isError:I().optional(),_meta:B(P(),L()).optional()}),$ve=Co(`type`,[z8,B8,V8]),K8=Co(`type`,[z8,B8,V8,Pve,Qve]),eye=z({role:F8,content:So([K8,R(K8)]),_meta:B(P(),L()).optional()}),tye=a8.extend({messages:R(eye),modelPreferences:Xve.optional(),systemPrompt:P().optional(),includeContext:V([`none`,`thisServer`,`allServers`]).optional(),temperature:F().optional(),maxTokens:F().int(),stopSequences:R(P()).optional(),metadata:e8.optional(),tools:R(U8).optional(),toolChoice:Zve.optional()}),nye=o8.extend({method:H(`sampling/createMessage`),params:tye}),rye=l8.extend({model:P(),stopReason:ko(V([`endTurn`,`stopSequence`,`maxTokens`]).or(P())),role:F8,content:$ve}),iye=l8.extend({model:P(),stopReason:ko(V([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(P())),role:F8,content:So([K8,R(K8)])}),aye=z({type:H(`boolean`),title:P().optional(),description:P().optional(),default:I().optional()}),oye=z({type:H(`string`),title:P().optional(),description:P().optional(),minLength:F().optional(),maxLength:F().optional(),format:V([`email`,`uri`,`date`,`date-time`]).optional(),default:P().optional()}),sye=z({type:V([`number`,`integer`]),title:P().optional(),description:P().optional(),minimum:F().optional(),maximum:F().optional(),default:F().optional()}),cye=z({type:H(`string`),title:P().optional(),description:P().optional(),enum:R(P()),default:P().optional()}),lye=z({type:H(`string`),title:P().optional(),description:P().optional(),oneOf:R(z({const:P(),title:P()})),default:P().optional()}),uye=So([So([z({type:H(`string`),title:P().optional(),description:P().optional(),enum:R(P()),enumNames:R(P()).optional(),default:P().optional()}),So([cye,lye]),So([z({type:H(`array`),title:P().optional(),description:P().optional(),minItems:F().optional(),maxItems:F().optional(),items:z({type:H(`string`),enum:R(P())}),default:R(P()).optional()}),z({type:H(`array`),title:P().optional(),description:P().optional(),minItems:F().optional(),maxItems:F().optional(),items:z({anyOf:R(z({const:P(),title:P()}))}),default:R(P()).optional()})])]),aye,oye,sye]),dye=So([a8.extend({mode:H(`form`).optional(),message:P(),requestedSchema:z({type:H(`object`),properties:B(P(),uye),required:R(P()).optional()})}),a8.extend({mode:H(`url`),message:P(),elicitationId:P(),url:P().url()})]),fye=o8.extend({method:H(`elicitation/create`),params:dye}),pye=s8.extend({elicitationId:P()}),mye=c8.extend({method:H(`notifications/elicitation/complete`),params:pye}),hye=l8.extend({action:V([`accept`,`decline`,`cancel`]),content:Lo(e=>e===null?void 0:e,B(P(),So([P(),F(),I(),R(P())])).optional())}),gye=z({type:H(`ref/resource`),uri:P()}),_ye=z({type:H(`ref/prompt`),name:P()}),vye=i8.extend({ref:So([_ye,gye]),argument:z({name:P(),value:P()}),context:z({arguments:B(P(),P()).optional()}).optional()}),yye=o8.extend({method:H(`completion/complete`),params:vye}),bye=l8.extend({completion:bo({values:R(P()).max(100),total:ko(F().int()),hasMore:ko(I())})}),xye=z({uri:P().startsWith(`file://`),name:P().optional(),_meta:B(P(),L()).optional()}),Sye=o8.extend({method:H(`roots/list`),params:i8.optional()}),Cye=l8.extend({roots:R(xye)}),wye=c8.extend({method:H(`notifications/roots/list_changed`),params:s8.optional()});So([v8,ive,yye,qve,Nve,Ave,mve,gve,yve,Cve,Tve,Wve,Vve,T8,D8,O8,A8]),So([m8,y8,sve,wye,w8]),So([p8,rye,iye,hye,Cye,E8,k8,C8]),So([v8,nye,fye,Sye,T8,D8,O8,A8]),So([m8,y8,Yve,Dve,xve,Gve,Rve,w8,mye]),So([p8,ove,bye,Lve,jve,hve,_ve,bve,W8,Hve,E8,k8,C8]);var Tye;(function(e){e.Completable=`McpCompletable`})(Tye||={});var Eye=global.Request,q8=class extends Eye{constructor(e,t){typeof e==`object`&&J8 in e&&(e=e[J8]()),t?.body?.getReader!==void 0&&(t.duplex??=`half`),super(e,t)}},Dye=e=>{let t=[],n=e.rawHeaders;for(let e=0;e<n.length;e+=2){let{[e]:r,[e+1]:i}=n;r.charCodeAt(0)!==58&&t.push([r,i])}return new Headers(t)},Oye=Symbol(`wrapBodyStream`),kye=(e,t,n,r,i)=>{let a={method:e,headers:n,signal:i.signal};if(e===`TRACE`){a.method=`GET`;let e=new q8(t,a);return Object.defineProperty(e,`method`,{get(){return`TRACE`}}),e}if(!(e===`GET`||e===`HEAD`))if(`rawBody`in r&&r.rawBody instanceof Buffer)a.body=new ReadableStream({start(e){e.enqueue(r.rawBody),e.close()}});else if(r[Oye]){let e;a.body=new ReadableStream({async pull(t){try{e||=Pe.toWeb(r).getReader();let{done:n,value:i}=await e.read();n?t.close():t.enqueue(i)}catch(e){t.error(e)}}})}else a.body=Pe.toWeb(r);return new q8(t,a)},J8=Symbol(`getRequestCache`),Y8=Symbol(`requestCache`),X8=Symbol(`incomingKey`),Z8=Symbol(`urlKey`),Aye=Symbol(`headersKey`),Q8=Symbol(`abortControllerKey`),$8={get method(){return this[X8].method||`GET`},get url(){return this[Z8]},get headers(){return this[Aye]||=Dye(this[X8])},[Symbol(`getAbortController`)](){return this[J8](),this[Q8]},[J8](){return this[Q8]||=new AbortController,this[Y8]||=kye(this.method,this[Z8],this.headers,this[X8],this[Q8])}};[`body`,`bodyUsed`,`cache`,`credentials`,`destination`,`integrity`,`mode`,`redirect`,`referrer`,`referrerPolicy`,`signal`,`keepalive`].forEach(e=>{Object.defineProperty($8,e,{get(){return this[J8]()[e]}})}),[`arrayBuffer`,`blob`,`clone`,`formData`,`json`,`text`].forEach(e=>{Object.defineProperty($8,e,{value:function(){return this[J8]()[e]()}})}),Object.defineProperty($8,Symbol.for(`nodejs.util.inspect.custom`),{value:function(e,t,n){return`Request (lightweight) ${n({method:this.method,url:this.url,headers:this.headers,nativeRequest:this[Y8]},{...t,depth:e==null?null:e-1})}`}}),Object.setPrototypeOf($8,q8.prototype);var e5=Symbol(`responseCache`),t5=Symbol(`getResponseCache`),n5=Symbol(`cache`),r5=global.Response,i5=class e{#e;#t;[t5](){return delete this[n5],this[e5]||=new r5(this.#e,this.#t)}constructor(t,n){let r;if(this.#e=t,n instanceof e){let e=n[e5];if(e){this.#t=e,this[t5]();return}else this.#t=n.#t,r=new Headers(n.#t.headers)}else this.#t=n;(typeof t==`string`||t?.getReader!==void 0||t instanceof Blob||t instanceof Uint8Array)&&(this[n5]=[n?.status||200,t,r||n?.headers])}get headers(){let e=this[n5];return e?(e[2]instanceof Headers||(e[2]=new Headers(e[2]||{"content-type":`text/plain; charset=UTF-8`})),e[2]):this[t5]().headers}get status(){return this[n5]?.[0]??this[t5]().status}get ok(){let e=this.status;return e>=200&&e<300}};[`body`,`bodyUsed`,`redirected`,`statusText`,`trailers`,`type`,`url`].forEach(e=>{Object.defineProperty(i5.prototype,e,{get(){return this[t5]()[e]}})}),[`arrayBuffer`,`blob`,`clone`,`formData`,`json`,`text`].forEach(e=>{Object.defineProperty(i5.prototype,e,{value:function(){return this[t5]()[e]()}})}),Object.defineProperty(i5.prototype,Symbol.for(`nodejs.util.inspect.custom`),{value:function(e,t,n){return`Response (lightweight) ${n({status:this.status,headers:this.headers,ok:this.ok,nativeResponse:this[e5]},{...t,depth:e==null?null:e-1})}`}}),Object.setPrototypeOf(i5,r5),Object.setPrototypeOf(i5.prototype,r5.prototype),global.crypto===void 0&&(global.crypto=Ne),new Re,s1(()=>{}),[`[Requires: Hocuspocus server] Unified validation audit: every content problem — markdown-lint violations AND broken internal links — in one read-only call, grouped by the file to fix.`,``,"- No args → audit every in-scope `.md`/`.mdx` doc; pass `path` to scope to a folder or a single file.","- To CHECK whether links resolve, use this tool: each broken link is reported under the SOURCE doc that contains it, at the offending line. (The `links` tool is the navigation/graph reader — backlinks, forward links, orphans, hubs — not the validation surface.)",``,"Each diagnostic carries a `source` naming the validator ('markdownlint' rule violations; 'links' broken internal links), a `code` (e.g. MD010, dead-link), `message`, a 0-based LSP `range` (for links: line exact, column approximate), and `severity` ('error' | 'warning' — broken links default to warnings; the project's `validation.links` setting can raise them to errors or hide them). Only files with at least one problem are listed, plus `fileCount`/`errorCount`/`warningCount` totals. Output (text and structured) is capped at 10 files × 10 diagnostics per file, with explicit '… and N more' indicators; the counts always reflect the full scan — re-run with `path` scoped to a folder or file to see what was omitted.",``,"Read-only: nothing is modified. Auto-fix fixable lint findings with `lint({ document, fix: true })`; broken links need content edits via `edit`/`write`."].join(`
447
+ `),Object.assign({"3g2":`video/3gpp2`,"3gp":`video/3gpp`,"3gpp":`video/3gpp`,"3mf":`model/3mf`,aac:`audio/aac`,ac:`application/pkix-attr-cert`,adp:`audio/adpcm`,adts:`audio/aac`,ai:`application/postscript`,aml:`application/automationml-aml+xml`,amlx:`application/automationml-amlx+zip`,amr:`audio/amr`,apng:`image/apng`,appcache:`text/cache-manifest`,appinstaller:`application/appinstaller`,appx:`application/appx`,appxbundle:`application/appxbundle`,asc:`application/pgp-keys`,atom:`application/atom+xml`,atomcat:`application/atomcat+xml`,atomdeleted:`application/atomdeleted+xml`,atomsvc:`application/atomsvc+xml`,au:`audio/basic`,avci:`image/avci`,avcs:`image/avcs`,avif:`image/avif`,aw:`application/applixware`,bdoc:`application/bdoc`,bin:`application/octet-stream`,bmp:`image/bmp`,bpk:`application/octet-stream`,btf:`image/prs.btif`,btif:`image/prs.btif`,buffer:`application/octet-stream`,ccxml:`application/ccxml+xml`,cdfx:`application/cdfx+xml`,cdmia:`application/cdmi-capability`,cdmic:`application/cdmi-container`,cdmid:`application/cdmi-domain`,cdmio:`application/cdmi-object`,cdmiq:`application/cdmi-queue`,cer:`application/pkix-cert`,cgm:`image/cgm`,cjs:`application/node`,class:`application/java-vm`,coffee:`text/coffeescript`,conf:`text/plain`,cpl:`application/cpl+xml`,cpt:`application/mac-compactpro`,crl:`application/pkix-crl`,css:`text/css`,csv:`text/csv`,cu:`application/cu-seeme`,cwl:`application/cwl`,cww:`application/prs.cww`,davmount:`application/davmount+xml`,dbk:`application/docbook+xml`,deb:`application/octet-stream`,def:`text/plain`,deploy:`application/octet-stream`,dib:`image/bmp`,"disposition-notification":`message/disposition-notification`,dist:`application/octet-stream`,distz:`application/octet-stream`,dll:`application/octet-stream`,dmg:`application/octet-stream`,dms:`application/octet-stream`,doc:`application/msword`,dot:`application/msword`,dpx:`image/dpx`,drle:`image/dicom-rle`,dsc:`text/prs.lines.tag`,dssc:`application/dssc+der`,dtd:`application/xml-dtd`,dump:`application/octet-stream`,dwd:`application/atsc-dwd+xml`,ear:`application/java-archive`,ecma:`application/ecmascript`,elc:`application/octet-stream`,emf:`image/emf`,eml:`message/rfc822`,emma:`application/emma+xml`,emotionml:`application/emotionml+xml`,eps:`application/postscript`,epub:`application/epub+zip`,exe:`application/octet-stream`,exi:`application/exi`,exp:`application/express`,exr:`image/aces`,ez:`application/andrew-inset`,fdf:`application/fdf`,fdt:`application/fdt+xml`,fits:`image/fits`,g3:`image/g3fax`,gbr:`application/rpki-ghostbusters`,geojson:`application/geo+json`,gif:`image/gif`,glb:`model/gltf-binary`,gltf:`model/gltf+json`,gml:`application/gml+xml`,gpx:`application/gpx+xml`,gram:`application/srgs`,grxml:`application/srgs+xml`,gxf:`application/gxf`,gz:`application/gzip`,h261:`video/h261`,h263:`video/h263`,h264:`video/h264`,heic:`image/heic`,heics:`image/heic-sequence`,heif:`image/heif`,heifs:`image/heif-sequence`,hej2:`image/hej2k`,held:`application/atsc-held+xml`,hjson:`application/hjson`,hlp:`application/winhlp`,hqx:`application/mac-binhex40`,hsj2:`image/hsj2`,htm:`text/html`,html:`text/html`,ics:`text/calendar`,ief:`image/ief`,ifb:`text/calendar`,iges:`model/iges`,igs:`model/iges`,img:`application/octet-stream`,in:`text/plain`,ini:`text/plain`,ink:`application/inkml+xml`,inkml:`application/inkml+xml`,ipfix:`application/ipfix`,iso:`application/octet-stream`,its:`application/its+xml`,jade:`text/jade`,jar:`application/java-archive`,jhc:`image/jphc`,jls:`image/jls`,jp2:`image/jp2`,jpe:`image/jpeg`,jpeg:`image/jpeg`,jpf:`image/jpx`,jpg:`image/jpeg`,jpg2:`image/jp2`,jpgm:`image/jpm`,jpgv:`video/jpeg`,jph:`image/jph`,jpm:`image/jpm`,jpx:`image/jpx`,js:`text/javascript`,json:`application/json`,json5:`application/json5`,jsonld:`application/ld+json`,jsonml:`application/jsonml+json`,jsx:`text/jsx`,jt:`model/jt`,jxl:`image/jxl`,jxr:`image/jxr`,jxra:`image/jxra`,jxrs:`image/jxrs`,jxs:`image/jxs`,jxsc:`image/jxsc`,jxsi:`image/jxsi`,jxss:`image/jxss`,kar:`audio/midi`,ktx:`image/ktx`,ktx2:`image/ktx2`,less:`text/less`,lgr:`application/lgr+xml`,list:`text/plain`,litcoffee:`text/coffeescript`,log:`text/plain`,lostxml:`application/lost+xml`,lrf:`application/octet-stream`,m1v:`video/mpeg`,m21:`application/mp21`,m2a:`audio/mpeg`,m2t:`video/mp2t`,m2ts:`video/mp2t`,m2v:`video/mpeg`,m3a:`audio/mpeg`,m4a:`audio/mp4`,m4p:`application/mp4`,m4s:`video/iso.segment`,ma:`application/mathematica`,mads:`application/mads+xml`,maei:`application/mmt-aei+xml`,man:`text/troff`,manifest:`text/cache-manifest`,map:`application/json`,mar:`application/octet-stream`,markdown:`text/markdown`,mathml:`application/mathml+xml`,mb:`application/mathematica`,mbox:`application/mbox`,md:`text/markdown`,mdx:`text/mdx`,me:`text/troff`,mesh:`model/mesh`,meta4:`application/metalink4+xml`,metalink:`application/metalink+xml`,mets:`application/mets+xml`,mft:`application/rpki-manifest`,mid:`audio/midi`,midi:`audio/midi`,mime:`message/rfc822`,mj2:`video/mj2`,mjp2:`video/mj2`,mjs:`text/javascript`,mml:`text/mathml`,mods:`application/mods+xml`,mov:`video/quicktime`,mp2:`audio/mpeg`,mp21:`application/mp21`,mp2a:`audio/mpeg`,mp3:`audio/mpeg`,mp4:`video/mp4`,mp4a:`audio/mp4`,mp4s:`application/mp4`,mp4v:`video/mp4`,mpd:`application/dash+xml`,mpe:`video/mpeg`,mpeg:`video/mpeg`,mpf:`application/media-policy-dataset+xml`,mpg:`video/mpeg`,mpg4:`video/mp4`,mpga:`audio/mpeg`,mpp:`application/dash-patch+xml`,mrc:`application/marc`,mrcx:`application/marcxml+xml`,ms:`text/troff`,mscml:`application/mediaservercontrol+xml`,msh:`model/mesh`,msi:`application/octet-stream`,msix:`application/msix`,msixbundle:`application/msixbundle`,msm:`application/octet-stream`,msp:`application/octet-stream`,mtl:`model/mtl`,mts:`video/mp2t`,musd:`application/mmt-usd+xml`,mxf:`application/mxf`,mxmf:`audio/mobile-xmf`,mxml:`application/xv+xml`,n3:`text/n3`,nb:`application/mathematica`,nq:`application/n-quads`,nt:`application/n-triples`,obj:`model/obj`,oda:`application/oda`,oga:`audio/ogg`,ogg:`audio/ogg`,ogv:`video/ogg`,ogx:`application/ogg`,omdoc:`application/omdoc+xml`,onepkg:`application/onenote`,onetmp:`application/onenote`,onetoc:`application/onenote`,onetoc2:`application/onenote`,opf:`application/oebps-package+xml`,opus:`audio/ogg`,otf:`font/otf`,owl:`application/rdf+xml`,oxps:`application/oxps`,p10:`application/pkcs10`,p7c:`application/pkcs7-mime`,p7m:`application/pkcs7-mime`,p7s:`application/pkcs7-signature`,p8:`application/pkcs8`,pdf:`application/pdf`,pfr:`application/font-tdpfr`,pgp:`application/pgp-encrypted`,pkg:`application/octet-stream`,pki:`application/pkixcmp`,pkipath:`application/pkix-pkipath`,pls:`application/pls+xml`,png:`image/png`,prc:`model/prc`,prf:`application/pics-rules`,provx:`application/provenance+xml`,ps:`application/postscript`,pskcxml:`application/pskc+xml`,pti:`image/prs.pti`,qt:`video/quicktime`,raml:`application/raml+yaml`,rapd:`application/route-apd+xml`,rdf:`application/rdf+xml`,relo:`application/p2p-overlay+xml`,rif:`application/reginfo+xml`,rl:`application/resource-lists+xml`,rld:`application/resource-lists-diff+xml`,rmi:`audio/midi`,rnc:`application/relax-ng-compact-syntax`,rng:`application/xml`,roa:`application/rpki-roa`,roff:`text/troff`,rq:`application/sparql-query`,rs:`application/rls-services+xml`,rsat:`application/atsc-rsat+xml`,rsd:`application/rsd+xml`,rsheet:`application/urc-ressheet+xml`,rss:`application/rss+xml`,rtf:`text/rtf`,rtx:`text/richtext`,rusd:`application/route-usd+xml`,s3m:`audio/s3m`,sbml:`application/sbml+xml`,scq:`application/scvp-cv-request`,scs:`application/scvp-cv-response`,sdp:`application/sdp`,senmlx:`application/senml+xml`,sensmlx:`application/sensml+xml`,ser:`application/java-serialized-object`,setpay:`application/set-payment-initiation`,setreg:`application/set-registration-initiation`,sgi:`image/sgi`,sgm:`text/sgml`,sgml:`text/sgml`,shex:`text/shex`,shf:`application/shf+xml`,shtml:`text/html`,sieve:`application/sieve`,sig:`application/pgp-signature`,sil:`audio/silk`,silo:`model/mesh`,siv:`application/sieve`,slim:`text/slim`,slm:`text/slim`,sls:`application/route-s-tsid+xml`,smi:`application/smil+xml`,smil:`application/smil+xml`,snd:`audio/basic`,so:`application/octet-stream`,spdx:`text/spdx`,spp:`application/scvp-vp-response`,spq:`application/scvp-vp-request`,spx:`audio/ogg`,sql:`application/sql`,sru:`application/sru+xml`,srx:`application/sparql-results+xml`,ssdl:`application/ssdl+xml`,ssml:`application/ssml+xml`,stk:`application/hyperstudio`,stl:`model/stl`,stpx:`model/step+xml`,stpxz:`model/step-xml+zip`,stpz:`model/step+zip`,styl:`text/stylus`,stylus:`text/stylus`,svg:`image/svg+xml`,svgz:`image/svg+xml`,swidtag:`application/swid+xml`,t:`text/troff`,t38:`image/t38`,td:`application/urc-targetdesc+xml`,tei:`application/tei+xml`,teicorpus:`application/tei+xml`,text:`text/plain`,tfi:`application/thraud+xml`,tfx:`image/tiff-fx`,tif:`image/tiff`,tiff:`image/tiff`,toml:`application/toml`,tr:`text/troff`,trig:`application/trig`,ts:`video/mp2t`,tsd:`application/timestamped-data`,tsv:`text/tab-separated-values`,ttc:`font/collection`,ttf:`font/ttf`,ttl:`text/turtle`,ttml:`application/ttml+xml`,txt:`text/plain`,u3d:`model/u3d`,u8dsn:`message/global-delivery-status`,u8hdr:`message/global-headers`,u8mdn:`message/global-disposition-notification`,u8msg:`message/global`,ubj:`application/ubjson`,uri:`text/uri-list`,uris:`text/uri-list`,urls:`text/uri-list`,vcard:`text/vcard`,vrml:`model/vrml`,vtt:`text/vtt`,vxml:`application/voicexml+xml`,war:`application/java-archive`,wasm:`application/wasm`,wav:`audio/wav`,weba:`audio/webm`,webm:`video/webm`,webmanifest:`application/manifest+json`,webp:`image/webp`,wgsl:`text/wgsl`,wgt:`application/widget`,wif:`application/watcherinfo+xml`,wmf:`image/wmf`,woff:`font/woff`,woff2:`font/woff2`,wrl:`model/vrml`,wsdl:`application/wsdl+xml`,wspolicy:`application/wspolicy+xml`,x3d:`model/x3d+xml`,x3db:`model/x3d+fastinfoset`,x3dbz:`model/x3d+binary`,x3dv:`model/x3d-vrml`,x3dvz:`model/x3d+vrml`,x3dz:`model/x3d+xml`,xaml:`application/xaml+xml`,xav:`application/xcap-att+xml`,xca:`application/xcap-caps+xml`,xcs:`application/calendar+xml`,xdf:`application/xcap-diff+xml`,xdssc:`application/dssc+xml`,xel:`application/xcap-el+xml`,xenc:`application/xenc+xml`,xer:`application/patch-ops-error+xml`,xfdf:`application/xfdf`,xht:`application/xhtml+xml`,xhtml:`application/xhtml+xml`,xhvml:`application/xv+xml`,xlf:`application/xliff+xml`,xm:`audio/xm`,xml:`text/xml`,xns:`application/xcap-ns+xml`,xop:`application/xop+xml`,xpl:`application/xproc+xml`,xsd:`application/xml`,xsf:`application/prs.xsf+xml`,xsl:`application/xml`,xslt:`application/xml`,xspf:`application/xspf+xml`,xvm:`application/xv+xml`,xvml:`application/xv+xml`,yaml:`text/yaml`,yang:`application/yang`,yin:`application/yin+xml`,yml:`text/yaml`,zip:`application/zip`},{m4v:`video/mp4`,mkv:`video/x-matroska`,flac:`audio/flac`,toml:`application/toml`,lock:`text/plain`,"7z":`application/x-7z-compressed`,tar:`application/x-tar`,rar:`application/vnd.rar`,xls:`application/vnd.ms-excel`,ppt:`application/vnd.ms-powerpoint`,odt:`application/vnd.oasis.opendocument.text`,ods:`application/vnd.oasis.opendocument.spreadsheet`,odp:`application/vnd.oasis.opendocument.presentation`,pages:`application/vnd.apple.pages`,numbers:`application/vnd.apple.numbers`,key:`application/vnd.apple.keynote`,mobi:`application/x-mobipocket-ebook`}),o1(`file-ops`),o1(`search`),o1(`skill-import`),o1(`skill-install`),o1(`history`),o1(`skills-leaderboard`),o1(`timeline`),o1(`api`),z({principalId:P().optional(),tabSessionId:P().optional(),expectedServerInstanceId:P().optional(),expectedBranch:P().optional(),expectedDocLineageEpoch:P().optional(),clientProtocolVersion:F().optional(),clientRuntimeVersion:P().optional(),clientKind:P().optional()}).loose(),o1(`conflict-storage`);const e8=Io(e=>e!==null&&(typeof e==`object`||typeof e==`function`)),t8=So([P(),F().int()]),n8=P();bo({ttl:F().optional(),pollInterval:F().optional()});const J_e=z({ttl:F().optional()}),Y_e=z({taskId:P()}),r8=bo({progressToken:t8.optional(),"io.modelcontextprotocol/related-task":Y_e.optional()}),i8=z({_meta:r8.optional()}),a8=i8.extend({task:J_e.optional()}),o8=z({method:P(),params:i8.loose().optional()}),s8=z({_meta:r8.optional()}),c8=z({method:P(),params:s8.loose().optional()}),l8=bo({_meta:r8.optional()}),u8=So([P(),F().int()]),X_e=z({jsonrpc:H(`2.0`),id:u8,...o8.shape}).strict(),Z_e=z({jsonrpc:H(`2.0`),...c8.shape}).strict(),d8=z({jsonrpc:H(`2.0`),id:u8,result:l8}).strict();var Q_e;(function(e){e[e.ConnectionClosed=-32e3]=`ConnectionClosed`,e[e.RequestTimeout=-32001]=`RequestTimeout`,e[e.ParseError=-32700]=`ParseError`,e[e.InvalidRequest=-32600]=`InvalidRequest`,e[e.MethodNotFound=-32601]=`MethodNotFound`,e[e.InvalidParams=-32602]=`InvalidParams`,e[e.InternalError=-32603]=`InternalError`,e[e.UrlElicitationRequired=-32042]=`UrlElicitationRequired`})(Q_e||={});const f8=z({jsonrpc:H(`2.0`),id:u8.optional(),error:z({code:F().int(),message:P(),data:L().optional()})}).strict();So([X_e,Z_e,d8,f8]),So([d8,f8]);const p8=l8.strict(),$_e=s8.extend({requestId:u8.optional(),reason:P().optional()}),m8=c8.extend({method:H(`notifications/cancelled`),params:$_e}),h8=z({icons:R(z({src:P(),mimeType:P().optional(),sizes:R(P()).optional(),theme:V([`light`,`dark`]).optional()})).optional()}),g8=z({name:P(),title:P().optional()}),_8=g8.extend({...g8.shape,...h8.shape,version:P(),websiteUrl:P().optional(),description:P().optional()}),eve=Lo(e=>e&&typeof e==`object`&&!Array.isArray(e)&&Object.keys(e).length===0?{form:{}}:e,wo(z({form:wo(z({applyDefaults:I().optional()}),B(P(),L())).optional(),url:e8.optional()}),B(P(),L()).optional())),tve=bo({list:e8.optional(),cancel:e8.optional(),requests:bo({sampling:bo({createMessage:e8.optional()}).optional(),elicitation:bo({create:e8.optional()}).optional()}).optional()}),nve=bo({list:e8.optional(),cancel:e8.optional(),requests:bo({tools:bo({call:e8.optional()}).optional()}).optional()}),rve=z({experimental:B(P(),e8).optional(),sampling:z({context:e8.optional(),tools:e8.optional()}).optional(),elicitation:eve.optional(),roots:z({listChanged:I().optional()}).optional(),tasks:tve.optional(),extensions:B(P(),e8).optional()}),ive=i8.extend({protocolVersion:P(),capabilities:rve,clientInfo:_8}),ave=o8.extend({method:H(`initialize`),params:ive}),ove=z({experimental:B(P(),e8).optional(),logging:e8.optional(),completions:e8.optional(),prompts:z({listChanged:I().optional()}).optional(),resources:z({subscribe:I().optional(),listChanged:I().optional()}).optional(),tools:z({listChanged:I().optional()}).optional(),tasks:nve.optional(),extensions:B(P(),e8).optional()}),sve=l8.extend({protocolVersion:P(),capabilities:ove,serverInfo:_8,instructions:P().optional()}),cve=c8.extend({method:H(`notifications/initialized`),params:s8.optional()}),v8=o8.extend({method:H(`ping`),params:i8.optional()}),lve=z({progress:F(),total:ko(F()),message:ko(P())}),uve=z({...s8.shape,...lve.shape,progressToken:t8}),y8=c8.extend({method:H(`notifications/progress`),params:uve}),dve=i8.extend({cursor:n8.optional()}),b8=o8.extend({params:dve.optional()}),x8=l8.extend({nextCursor:n8.optional()}),fve=V([`working`,`input_required`,`completed`,`failed`,`cancelled`]),S8=z({taskId:P(),status:fve,ttl:So([F(),vo()]),createdAt:P(),lastUpdatedAt:P(),pollInterval:ko(F()),statusMessage:ko(P())}),C8=l8.extend({task:S8}),pve=s8.merge(S8),w8=c8.extend({method:H(`notifications/tasks/status`),params:pve}),T8=o8.extend({method:H(`tasks/get`),params:i8.extend({taskId:P()})}),E8=l8.merge(S8),D8=o8.extend({method:H(`tasks/result`),params:i8.extend({taskId:P()})});l8.loose();const O8=b8.extend({method:H(`tasks/list`)}),k8=x8.extend({tasks:R(S8)}),A8=o8.extend({method:H(`tasks/cancel`),params:i8.extend({taskId:P()})});l8.merge(S8);const j8=z({uri:P(),mimeType:ko(P()),_meta:B(P(),L()).optional()}),M8=j8.extend({text:P()}),N8=P().refine(e=>{try{return atob(e),!0}catch{return!1}},{message:`Invalid Base64 string`}),P8=j8.extend({blob:N8}),F8=V([`user`,`assistant`]),I8=z({audience:R(F8).optional(),priority:F().min(0).max(1).optional(),lastModified:Pa({offset:!0}).optional()}),L8=z({...g8.shape,...h8.shape,uri:P(),description:ko(P()),mimeType:ko(P()),size:ko(F()),annotations:I8.optional(),_meta:ko(bo({}))}),mve=z({...g8.shape,...h8.shape,uriTemplate:P(),description:ko(P()),mimeType:ko(P()),annotations:I8.optional(),_meta:ko(bo({}))}),hve=b8.extend({method:H(`resources/list`)}),gve=x8.extend({resources:R(L8)}),_ve=b8.extend({method:H(`resources/templates/list`)}),vve=x8.extend({resourceTemplates:R(mve)}),R8=i8.extend({uri:P()}),yve=R8,bve=o8.extend({method:H(`resources/read`),params:yve}),xve=l8.extend({contents:R(So([M8,P8]))}),Sve=c8.extend({method:H(`notifications/resources/list_changed`),params:s8.optional()}),Cve=R8,wve=o8.extend({method:H(`resources/subscribe`),params:Cve}),Tve=R8,Eve=o8.extend({method:H(`resources/unsubscribe`),params:Tve}),Dve=s8.extend({uri:P()}),Ove=c8.extend({method:H(`notifications/resources/updated`),params:Dve}),kve=z({name:P(),description:ko(P()),required:ko(I())}),Ave=z({...g8.shape,...h8.shape,description:ko(P()),arguments:ko(R(kve)),_meta:ko(bo({}))}),jve=b8.extend({method:H(`prompts/list`)}),Mve=x8.extend({prompts:R(Ave)}),Nve=i8.extend({name:P(),arguments:B(P(),P()).optional()}),Pve=o8.extend({method:H(`prompts/get`),params:Nve}),z8=z({type:H(`text`),text:P(),annotations:I8.optional(),_meta:B(P(),L()).optional()}),B8=z({type:H(`image`),data:N8,mimeType:P(),annotations:I8.optional(),_meta:B(P(),L()).optional()}),V8=z({type:H(`audio`),data:N8,mimeType:P(),annotations:I8.optional(),_meta:B(P(),L()).optional()}),Fve=z({type:H(`tool_use`),name:P(),id:P(),input:B(P(),L()),_meta:B(P(),L()).optional()}),Ive=z({type:H(`resource`),resource:So([M8,P8]),annotations:I8.optional(),_meta:B(P(),L()).optional()}),H8=So([z8,B8,V8,L8.extend({type:H(`resource_link`)}),Ive]),Lve=z({role:F8,content:H8}),Rve=l8.extend({description:P().optional(),messages:R(Lve)}),zve=c8.extend({method:H(`notifications/prompts/list_changed`),params:s8.optional()}),Bve=z({title:P().optional(),readOnlyHint:I().optional(),destructiveHint:I().optional(),idempotentHint:I().optional(),openWorldHint:I().optional()}),Vve=z({taskSupport:V([`required`,`optional`,`forbidden`]).optional()}),U8=z({...g8.shape,...h8.shape,description:P().optional(),inputSchema:z({type:H(`object`),properties:B(P(),e8).optional(),required:R(P()).optional()}).catchall(L()),outputSchema:z({type:H(`object`),properties:B(P(),e8).optional(),required:R(P()).optional()}).catchall(L()).optional(),annotations:Bve.optional(),execution:Vve.optional(),_meta:B(P(),L()).optional()}),Hve=b8.extend({method:H(`tools/list`)}),Uve=x8.extend({tools:R(U8)}),W8=l8.extend({content:R(H8).default([]),structuredContent:B(P(),L()).optional(),isError:I().optional()});W8.or(l8.extend({toolResult:L()}));const Wve=a8.extend({name:P(),arguments:B(P(),L()).optional()}),Gve=o8.extend({method:H(`tools/call`),params:Wve}),Kve=c8.extend({method:H(`notifications/tools/list_changed`),params:s8.optional()});z({autoRefresh:I().default(!0),debounceMs:F().int().nonnegative().default(300)});const G8=V([`debug`,`info`,`notice`,`warning`,`error`,`critical`,`alert`,`emergency`]),qve=i8.extend({level:G8}),Jve=o8.extend({method:H(`logging/setLevel`),params:qve}),Yve=s8.extend({level:G8,logger:P().optional(),data:L()}),Xve=c8.extend({method:H(`notifications/message`),params:Yve}),Zve=z({hints:R(z({name:P().optional()})).optional(),costPriority:F().min(0).max(1).optional(),speedPriority:F().min(0).max(1).optional(),intelligencePriority:F().min(0).max(1).optional()}),Qve=z({mode:V([`auto`,`required`,`none`]).optional()}),$ve=z({type:H(`tool_result`),toolUseId:P().describe(`The unique identifier for the corresponding tool call.`),content:R(H8).default([]),structuredContent:z({}).loose().optional(),isError:I().optional(),_meta:B(P(),L()).optional()}),eye=Co(`type`,[z8,B8,V8]),K8=Co(`type`,[z8,B8,V8,Fve,$ve]),tye=z({role:F8,content:So([K8,R(K8)]),_meta:B(P(),L()).optional()}),nye=a8.extend({messages:R(tye),modelPreferences:Zve.optional(),systemPrompt:P().optional(),includeContext:V([`none`,`thisServer`,`allServers`]).optional(),temperature:F().optional(),maxTokens:F().int(),stopSequences:R(P()).optional(),metadata:e8.optional(),tools:R(U8).optional(),toolChoice:Qve.optional()}),rye=o8.extend({method:H(`sampling/createMessage`),params:nye}),iye=l8.extend({model:P(),stopReason:ko(V([`endTurn`,`stopSequence`,`maxTokens`]).or(P())),role:F8,content:eye}),aye=l8.extend({model:P(),stopReason:ko(V([`endTurn`,`stopSequence`,`maxTokens`,`toolUse`]).or(P())),role:F8,content:So([K8,R(K8)])}),oye=z({type:H(`boolean`),title:P().optional(),description:P().optional(),default:I().optional()}),sye=z({type:H(`string`),title:P().optional(),description:P().optional(),minLength:F().optional(),maxLength:F().optional(),format:V([`email`,`uri`,`date`,`date-time`]).optional(),default:P().optional()}),cye=z({type:V([`number`,`integer`]),title:P().optional(),description:P().optional(),minimum:F().optional(),maximum:F().optional(),default:F().optional()}),lye=z({type:H(`string`),title:P().optional(),description:P().optional(),enum:R(P()),default:P().optional()}),uye=z({type:H(`string`),title:P().optional(),description:P().optional(),oneOf:R(z({const:P(),title:P()})),default:P().optional()}),dye=So([So([z({type:H(`string`),title:P().optional(),description:P().optional(),enum:R(P()),enumNames:R(P()).optional(),default:P().optional()}),So([lye,uye]),So([z({type:H(`array`),title:P().optional(),description:P().optional(),minItems:F().optional(),maxItems:F().optional(),items:z({type:H(`string`),enum:R(P())}),default:R(P()).optional()}),z({type:H(`array`),title:P().optional(),description:P().optional(),minItems:F().optional(),maxItems:F().optional(),items:z({anyOf:R(z({const:P(),title:P()}))}),default:R(P()).optional()})])]),oye,sye,cye]),fye=So([a8.extend({mode:H(`form`).optional(),message:P(),requestedSchema:z({type:H(`object`),properties:B(P(),dye),required:R(P()).optional()})}),a8.extend({mode:H(`url`),message:P(),elicitationId:P(),url:P().url()})]),pye=o8.extend({method:H(`elicitation/create`),params:fye}),mye=s8.extend({elicitationId:P()}),hye=c8.extend({method:H(`notifications/elicitation/complete`),params:mye}),gye=l8.extend({action:V([`accept`,`decline`,`cancel`]),content:Lo(e=>e===null?void 0:e,B(P(),So([P(),F(),I(),R(P())])).optional())}),_ye=z({type:H(`ref/resource`),uri:P()}),vye=z({type:H(`ref/prompt`),name:P()}),yye=i8.extend({ref:So([vye,_ye]),argument:z({name:P(),value:P()}),context:z({arguments:B(P(),P()).optional()}).optional()}),bye=o8.extend({method:H(`completion/complete`),params:yye}),xye=l8.extend({completion:bo({values:R(P()).max(100),total:ko(F().int()),hasMore:ko(I())})}),Sye=z({uri:P().startsWith(`file://`),name:P().optional(),_meta:B(P(),L()).optional()}),Cye=o8.extend({method:H(`roots/list`),params:i8.optional()}),wye=l8.extend({roots:R(Sye)}),Tye=c8.extend({method:H(`notifications/roots/list_changed`),params:s8.optional()});So([v8,ave,bye,Jve,Pve,jve,hve,_ve,bve,wve,Eve,Gve,Hve,T8,D8,O8,A8]),So([m8,y8,cve,Tye,w8]),So([p8,iye,aye,gye,wye,E8,k8,C8]),So([v8,rye,pye,Cye,T8,D8,O8,A8]),So([m8,y8,Xve,Ove,Sve,Kve,zve,w8,hye]),So([p8,sve,xye,Rve,Mve,gve,vve,xve,W8,Uve,E8,k8,C8]);var Eye;(function(e){e.Completable=`McpCompletable`})(Eye||={});var Dye=global.Request,q8=class extends Dye{constructor(e,t){typeof e==`object`&&J8 in e&&(e=e[J8]()),t?.body?.getReader!==void 0&&(t.duplex??=`half`),super(e,t)}},Oye=e=>{let t=[],n=e.rawHeaders;for(let e=0;e<n.length;e+=2){let{[e]:r,[e+1]:i}=n;r.charCodeAt(0)!==58&&t.push([r,i])}return new Headers(t)},kye=Symbol(`wrapBodyStream`),Aye=(e,t,n,r,i)=>{let a={method:e,headers:n,signal:i.signal};if(e===`TRACE`){a.method=`GET`;let e=new q8(t,a);return Object.defineProperty(e,`method`,{get(){return`TRACE`}}),e}if(!(e===`GET`||e===`HEAD`))if(`rawBody`in r&&r.rawBody instanceof Buffer)a.body=new ReadableStream({start(e){e.enqueue(r.rawBody),e.close()}});else if(r[kye]){let e;a.body=new ReadableStream({async pull(t){try{e||=Pe.toWeb(r).getReader();let{done:n,value:i}=await e.read();n?t.close():t.enqueue(i)}catch(e){t.error(e)}}})}else a.body=Pe.toWeb(r);return new q8(t,a)},J8=Symbol(`getRequestCache`),Y8=Symbol(`requestCache`),X8=Symbol(`incomingKey`),Z8=Symbol(`urlKey`),jye=Symbol(`headersKey`),Q8=Symbol(`abortControllerKey`),$8={get method(){return this[X8].method||`GET`},get url(){return this[Z8]},get headers(){return this[jye]||=Oye(this[X8])},[Symbol(`getAbortController`)](){return this[J8](),this[Q8]},[J8](){return this[Q8]||=new AbortController,this[Y8]||=Aye(this.method,this[Z8],this.headers,this[X8],this[Q8])}};[`body`,`bodyUsed`,`cache`,`credentials`,`destination`,`integrity`,`mode`,`redirect`,`referrer`,`referrerPolicy`,`signal`,`keepalive`].forEach(e=>{Object.defineProperty($8,e,{get(){return this[J8]()[e]}})}),[`arrayBuffer`,`blob`,`clone`,`formData`,`json`,`text`].forEach(e=>{Object.defineProperty($8,e,{value:function(){return this[J8]()[e]()}})}),Object.defineProperty($8,Symbol.for(`nodejs.util.inspect.custom`),{value:function(e,t,n){return`Request (lightweight) ${n({method:this.method,url:this.url,headers:this.headers,nativeRequest:this[Y8]},{...t,depth:e==null?null:e-1})}`}}),Object.setPrototypeOf($8,q8.prototype);var e5=Symbol(`responseCache`),t5=Symbol(`getResponseCache`),n5=Symbol(`cache`),r5=global.Response,i5=class e{#e;#t;[t5](){return delete this[n5],this[e5]||=new r5(this.#e,this.#t)}constructor(t,n){let r;if(this.#e=t,n instanceof e){let e=n[e5];if(e){this.#t=e,this[t5]();return}else this.#t=n.#t,r=new Headers(n.#t.headers)}else this.#t=n;(typeof t==`string`||t?.getReader!==void 0||t instanceof Blob||t instanceof Uint8Array)&&(this[n5]=[n?.status||200,t,r||n?.headers])}get headers(){let e=this[n5];return e?(e[2]instanceof Headers||(e[2]=new Headers(e[2]||{"content-type":`text/plain; charset=UTF-8`})),e[2]):this[t5]().headers}get status(){return this[n5]?.[0]??this[t5]().status}get ok(){let e=this.status;return e>=200&&e<300}};[`body`,`bodyUsed`,`redirected`,`statusText`,`trailers`,`type`,`url`].forEach(e=>{Object.defineProperty(i5.prototype,e,{get(){return this[t5]()[e]}})}),[`arrayBuffer`,`blob`,`clone`,`formData`,`json`,`text`].forEach(e=>{Object.defineProperty(i5.prototype,e,{value:function(){return this[t5]()[e]()}})}),Object.defineProperty(i5.prototype,Symbol.for(`nodejs.util.inspect.custom`),{value:function(e,t,n){return`Response (lightweight) ${n({status:this.status,headers:this.headers,ok:this.ok,nativeResponse:this[e5]},{...t,depth:e==null?null:e-1})}`}}),Object.setPrototypeOf(i5,r5),Object.setPrototypeOf(i5.prototype,r5.prototype),global.crypto===void 0&&(global.crypto=Ne),new Re,s1(()=>{}),[`[Requires: Hocuspocus server] Unified validation audit: every content problem — markdown-lint violations AND broken internal links — in one read-only call, grouped by the file to fix.`,``,"- No args → audit every in-scope `.md`/`.mdx` doc; pass `path` to scope to a folder or a single file.","- To CHECK whether links resolve, use this tool: each broken link is reported under the SOURCE doc that contains it, at the offending line. (The `links` tool is the navigation/graph reader — backlinks, forward links, orphans, hubs — not the validation surface.)",``,"Each diagnostic carries a `source` naming the validator ('markdownlint' rule violations; 'links' broken internal links), a `code` (e.g. MD010, dead-link), `message`, a 0-based LSP `range` (for links: line exact, column approximate), and `severity` ('error' | 'warning' — broken links default to warnings; the project's `validation.links` setting can raise them to errors or hide them). Only files with at least one problem are listed, plus `fileCount`/`errorCount`/`warningCount` totals. Output (text and structured) is capped at 10 files × 10 diagnostics per file, with explicit '… and N more' indicators; the counts always reflect the full scan — re-run with `path` scoped to a folder or file to see what was omitted.",``,"Read-only: nothing is modified. Auto-fix fixable lint findings with `lint({ document, fix: true })`; broken links need content edits via `edit`/`write`."].join(`
448
448
  `),[`[Requires: Hocuspocus server] Save a project-wide checkpoint of every document — a single restore point you can return to.`,``,`**Parameters:**`,'- `summary` — Optional one-line label for the checkpoint (≤80 chars). Defaults to "Checkpoint version". Appears as the checkpoint subject in `history`. Avoid secrets or PII — persisted to git history.',``,"Returns `{ version }` — the 40-char checkpoint SHA. Find checkpoints later via `history`; restore a single doc with `restore_version({ document, version })`."].join(`
449
449
  `),[`[Operates on disk; no running OK server required] Read the effective merged OpenKnowledge config (defaults → user → project).`,``,`Use this when you need to inspect the config mid-session — e.g., after a write that may have changed disk state, or to re-confirm the value of a field before reading it again.`,``,"Read returns the FULL merged config or a sub-tree when `key` is provided. There is no allowlist on reads — every field is readable.",``,"Note: the `server.*`, `mcp.*`, and `github.*` config sub-trees, plus `preview.baseUrl` and `preview.scriptSrc`, were removed; their values are now built-in constants in `@inkeep/open-knowledge-core` (or, for the preview iframe, a fixed open network policy). Reading those keys returns `exists: false`. (`appearance.preview.autoOpen` is still a live key.)",``,"This tool is a pure READ. Folder-level skill topology (link / unlink / add-root) moved to the `install` tool's `skillFolders` argument, so this one keeps its read-only annotation and stays auto-approvable.",``,`**Parameters:**`,'- `key` (optional) — Dotted config key. `"content"` returns the content sub-tree; `"appearance.theme"` returns just that leaf. Omit for full config.',"- `cwd` (optional) — Project root (see `cwd` description below)."].join(`
450
450
  `),P().optional().describe(`Dotted config key (e.g. "appearance.theme"). Omit to return the full merged config.`),P().optional().describe(j3),M3({value:L().describe(`Resolved config value at the requested path (or full config).`),exists:I().optional().describe('Whether the requested path resolved to a value. `false` distinguishes "path absent" from "path explicitly set to null". Always emitted — `true` on a full-config read.'),key:P().optional().describe(`Echo of the requested dotted key (absent when reading the full config).`)}),["[Requires: Hocuspocus server] Read GitHub-sync merge conflicts. Dispatches on `kind`:",``,'- `kind: "list"` — enumerate every doc currently tracked in a merge-conflict state. Returns `{ list: [{ file, detectedAt, ... }] }` (empty when none). The entry point to the resolve flow.','- `kind: "content"` — fetch the three merge stages for one `file`. Returns `{ content: { file, base, ours, theirs, shape, lifecycleStatus } }`. `ours` reflects the live Y.Text (what the human sees) when the doc is loaded server-side.',``,`**Parameters:**`,"- `kind` — `list` | `content`.",'- `file` — Required for `kind: "content"`. Relative path WITH the `.md`/`.mdx` extension (e.g. `notes/sso.md`) — git stages key on the exact path, so do NOT strip the extension.',``,"The `shape` field discriminates the conflict: `both-modified` (both sides edited), `delete-modify` (you deleted, they edited — `ours` empty), or `modify-delete` (you edited, they deleted — `theirs` empty). Use it to pick the `resolve_conflict` strategy."].join(`
451
- `);const jye=[`lock`],Mye=So([Uq,vo()]),Nye=So([P(),F(),I(),R(L()),B(P(),L()),vo()]);B(P(),Nye).superRefine((e,t)=>{for(let[n,r]of Object.entries(e))Mye.safeParse(r).success||t.addIssue({code:`custom`,path:[n],message:`invalid frontmatter value — allowed: a scalar (string | number | boolean), a scalar array, a nested object, or an array of objects; a top-level key may be null to delete it, but nested null is not allowed`})}).describe(`Metadata as a key→value map. Values may be a scalar (string | number | boolean), a scalar array, a nested object, or an array of objects. Merge-patch: include a top-level key to set it, set a top-level key to null to delete it; keys you omit are unchanged. A nested object REPLACES the existing subtree at that key (send the full subtree you want). Example: { title: "Q3 Planning", tags: ["planning"], metadata: { version: "1.0", author: "Inkeep" } }.`),V([`append`,`prepend`,`replace`]).describe(`Where content lands. replace = overwrite the whole body (default for a new doc; required for an existing doc). append / prepend = add to the end / start.`),V(yl).describe("File format for a NEW doc: `.md` (default) or `.mdx` (Markdown + JSX components). Honored only on create — an existing doc keeps its on-disk extension. Takes precedence over an extension typed into `path`."),V(gl).describe(`Level: "project" (default — a Project skill: lives in this KB wherever its folder is, shared with teammates via git) or "global" (a Global skill: lives under your user home, available in every project on this machine — not shared, not version-tracked). Pass the literal value "global" for a Global skill.`),["Delete one thing. Pass EXACTLY ONE of `document`, `folder`, `template`, `skill`, or `asset`.",``,"- `document` — Doc path(s) to delete (a single path or an array). Inbound links become redlinks. Irreversible. [Requires: Hocuspocus server]","- `folder` — Folder path to delete (recursive). [Requires: Hocuspocus server]",'- `template` — `{ path: "<folder>/<name>" }` — a template to delete (server-routed, attributed; auto-cleans empty `.ok/`). [Requires: Hocuspocus server]','- `skill` — `{ name }` deletes a whole SKILL; `{ name, files: ["references/x.md"] }` deletes specific bundle files (server-routed, attributed; auto-cleans empty `.ok/`). [Requires: Hocuspocus server]','- `asset` — `{ path: "<folder>/<file.ext>" }` — a binary asset to delete. [Requires: Hocuspocus server]',``,'Call `links({ kind: "backlinks", document })` BEFORE deleting a doc to see what links here.'].join(`
451
+ `);const Mye=[`lock`],Nye=So([Uq,vo()]),Pye=So([P(),F(),I(),R(L()),B(P(),L()),vo()]);B(P(),Pye).superRefine((e,t)=>{for(let[n,r]of Object.entries(e))Nye.safeParse(r).success||t.addIssue({code:`custom`,path:[n],message:`invalid frontmatter value — allowed: a scalar (string | number | boolean), a scalar array, a nested object, or an array of objects; a top-level key may be null to delete it, but nested null is not allowed`})}).describe(`Metadata as a key→value map. Values may be a scalar (string | number | boolean), a scalar array, a nested object, or an array of objects. Merge-patch: include a top-level key to set it, set a top-level key to null to delete it; keys you omit are unchanged. A nested object REPLACES the existing subtree at that key (send the full subtree you want). Example: { title: "Q3 Planning", tags: ["planning"], metadata: { version: "1.0", author: "Inkeep" } }.`),V([`append`,`prepend`,`replace`]).describe(`Where content lands. replace = overwrite the whole body (default for a new doc; required for an existing doc). append / prepend = add to the end / start.`),V(yl).describe("File format for a NEW doc: `.md` (default) or `.mdx` (Markdown + JSX components). Honored only on create — an existing doc keeps its on-disk extension. Takes precedence over an extension typed into `path`."),V(gl).describe(`Level: "project" (default — a Project skill: lives in this KB wherever its folder is, shared with teammates via git) or "global" (a Global skill: lives under your user home, available in every project on this machine — not shared, not version-tracked). Pass the literal value "global" for a Global skill.`),["Delete one thing. Pass EXACTLY ONE of `document`, `folder`, `template`, `skill`, or `asset`.",``,"- `document` — Doc path(s) to delete (a single path or an array). Inbound links become redlinks. Irreversible. [Requires: Hocuspocus server]","- `folder` — Folder path to delete (recursive). [Requires: Hocuspocus server]",'- `template` — `{ path: "<folder>/<name>" }` — a template to delete (server-routed, attributed; auto-cleans empty `.ok/`). [Requires: Hocuspocus server]','- `skill` — `{ name }` deletes a whole SKILL; `{ name, files: ["references/x.md"] }` deletes specific bundle files (server-routed, attributed; auto-cleans empty `.ok/`). [Requires: Hocuspocus server]','- `asset` — `{ path: "<folder>/<file.ext>" }` — a binary asset to delete. [Requires: Hocuspocus server]',``,'Call `links({ kind: "backlinks", document })` BEFORE deleting a doc to see what links here.'].join(`
452
452
  `),`${["Edit one thing in place. Pass EXACTLY ONE of `document`, `folder`, `template`, or `skill`. Within each: a body edit (`find` + `replace`) OR a metadata patch — not both in one call.",``,"- `document` — Edit a doc [Requires: Hocuspocus server]. Body: `{ path, find, replace, occurrence? }` (occurrence = which match, 1 = first). Metadata: `{ path, frontmatter }` (merge-patch; `null` deletes a key). Body find/replace is body-only; frontmatter-intersecting finds are rejected.","- `folder` — Edit a folder (folders have no body): `{ path, frontmatter }` (merge-patch).",'- `template` — Edit a template: `{ path: "<folder>/<name>", ... }`; body `find`/`replace`/`occurrence?` or metadata `frontmatter`.',"- `skill` — Edit a SKILL: `{ name, ... }`; body `find`/`replace`/`occurrence?` OR a `description` change (a skill's only metadata leaf). Every recorded copy re-syncs from the source, so there is nothing to re-install.","- `summary` — Optional one-line user-outcome (≤80 chars) recorded in the timeline for any `document`, `folder`, `template`, or `skill` edit. Avoid secrets or PII — persisted to git history.",``,'Responses may include `structuredContent.document.warnings` — advisory entries discriminated by `kind`: `content-divergence` / `disk-edit-reconciled` (write-integrity — re-read the doc with `exec("cat <path>")`) and `mermaid-parse-error` (the edit landed but that fence will not render — fix it and re-edit).'].join(`
453
453
  `)}${Rq()}`;var a5;(function(e){e.EOF=`EOF`,e.NEWLINE=`NEWLINE`,e.SEMICOLON=`SEMICOLON`,e.AMP=`AMP`,e.PIPE=`PIPE`,e.PIPE_AMP=`PIPE_AMP`,e.AND_AND=`AND_AND`,e.OR_OR=`OR_OR`,e.BANG=`BANG`,e.LESS=`LESS`,e.GREAT=`GREAT`,e.DLESS=`DLESS`,e.DGREAT=`DGREAT`,e.LESSAND=`LESSAND`,e.GREATAND=`GREATAND`,e.LESSGREAT=`LESSGREAT`,e.DLESSDASH=`DLESSDASH`,e.CLOBBER=`CLOBBER`,e.TLESS=`TLESS`,e.AND_GREAT=`AND_GREAT`,e.AND_DGREAT=`AND_DGREAT`,e.LPAREN=`LPAREN`,e.RPAREN=`RPAREN`,e.LBRACE=`LBRACE`,e.RBRACE=`RBRACE`,e.DSEMI=`DSEMI`,e.SEMI_AND=`SEMI_AND`,e.SEMI_SEMI_AND=`SEMI_SEMI_AND`,e.DBRACK_START=`DBRACK_START`,e.DBRACK_END=`DBRACK_END`,e.DPAREN_START=`DPAREN_START`,e.DPAREN_END=`DPAREN_END`,e.IF=`IF`,e.THEN=`THEN`,e.ELSE=`ELSE`,e.ELIF=`ELIF`,e.FI=`FI`,e.FOR=`FOR`,e.WHILE=`WHILE`,e.UNTIL=`UNTIL`,e.DO=`DO`,e.DONE=`DONE`,e.CASE=`CASE`,e.ESAC=`ESAC`,e.IN=`IN`,e.FUNCTION=`FUNCTION`,e.SELECT=`SELECT`,e.TIME=`TIME`,e.COPROC=`COPROC`,e.WORD=`WORD`,e.NAME=`NAME`,e.NUMBER=`NUMBER`,e.ASSIGNMENT_WORD=`ASSIGNMENT_WORD`,e.FD_VARIABLE=`FD_VARIABLE`,e.COMMENT=`COMMENT`,e.HEREDOC_CONTENT=`HEREDOC_CONTENT`})(a5||={}),new Map([[`if`,a5.IF],[`then`,a5.THEN],[`else`,a5.ELSE],[`elif`,a5.ELIF],[`fi`,a5.FI],[`for`,a5.FOR],[`while`,a5.WHILE],[`until`,a5.UNTIL],[`do`,a5.DO],[`done`,a5.DONE],[`case`,a5.CASE],[`esac`,a5.ESAC],[`in`,a5.IN],[`function`,a5.FUNCTION],[`select`,a5.SELECT],[`time`,a5.TIME],[`coproc`,a5.COPROC]]),a5.SEMI_SEMI_AND,a5.TLESS,a5.AND_DGREAT,a5.DBRACK_START,a5.DBRACK_END,a5.DPAREN_START,a5.DPAREN_END,a5.AND_AND,a5.OR_OR,a5.DSEMI,a5.SEMI_AND,a5.PIPE_AMP,a5.DGREAT,a5.LESSAND,a5.GREATAND,a5.LESSGREAT,a5.CLOBBER,a5.AND_GREAT,new Map([[`|`,a5.PIPE],[`&`,a5.AMP],[`;`,a5.SEMICOLON],[`(`,a5.LPAREN],[`)`,a5.RPAREN],[`<`,a5.LESS],[`>`,a5.GREAT]]),new Set([a5.LESS,a5.GREAT,a5.DLESS,a5.DGREAT,a5.LESSAND,a5.GREATAND,a5.LESSGREAT,a5.DLESSDASH,a5.CLOBBER,a5.TLESS,a5.AND_GREAT,a5.AND_DGREAT]),new Set([a5.LESS,a5.GREAT,a5.DLESS,a5.DGREAT,a5.LESSAND,a5.GREATAND,a5.LESSGREAT,a5.DLESSDASH,a5.CLOBBER,a5.TLESS]),new Set([a5.LESS,a5.GREAT,a5.DLESS,a5.DGREAT,a5.LESSAND,a5.GREATAND,a5.LESSGREAT,a5.DLESSDASH,a5.CLOBBER,a5.TLESS,a5.AND_GREAT,a5.AND_DGREAT]),new Set([a5.AMP,a5.PIPE,a5.PIPE_AMP,a5.SEMICOLON,a5.AND_AND,a5.OR_OR,a5.DSEMI,a5.SEMI_AND,a5.SEMI_SEMI_AND]);var o5=[{name:`echo`,load:async()=>(await import(`./echo-O45JWWI2-gk6mEMAU.mjs`)).echoCommand},{name:`cat`,load:async()=>(await import(`./cat-RDUMLXKC-D1H4LA3Z.mjs`)).catCommand},{name:`printf`,load:async()=>(await import(`./printf-CX64KX2P-B_vWcqAL.mjs`)).printfCommand},{name:`ls`,load:async()=>(await import(`./ls-KSXFZCWH-GOWXktO9.mjs`)).lsCommand},{name:`mkdir`,load:async()=>(await import(`./mkdir-TDEMSB6C-BVcgITXm.mjs`)).mkdirCommand},{name:`rmdir`,load:async()=>(await import(`./rmdir-XTQXT7RK-DZfv6Zfz.mjs`)).rmdirCommand},{name:`touch`,load:async()=>(await import(`./touch-DX2IJOQ4-CRX6GYeb.mjs`)).touchCommand},{name:`rm`,load:async()=>(await import(`./rm-RTZG23RL-sCMTtbxP.mjs`)).rmCommand},{name:`cp`,load:async()=>(await import(`./cp-XOYR4ABJ-CpnwcT2f.mjs`)).cpCommand},{name:`mv`,load:async()=>(await import(`./mv-Z6MORUFL-El0zMsEA.mjs`)).mvCommand},{name:`ln`,load:async()=>(await import(`./ln-4TRFBYAT-DGrhTL40.mjs`)).lnCommand},{name:`chmod`,load:async()=>(await import(`./chmod-SYMGL4JA-lEGJICyB.mjs`)).chmodCommand},{name:`pwd`,load:async()=>(await import(`./pwd-D4OZ7N27-NYST_A3S.mjs`)).pwdCommand},{name:`readlink`,load:async()=>(await import(`./readlink-MI4GCHJF-Dl1Uxmrf.mjs`)).readlinkCommand},{name:`head`,load:async()=>(await import(`./head-HT2B6D2J-B5ybc-my.mjs`)).headCommand},{name:`tail`,load:async()=>(await import(`./tail-S5ULNTJU-Cfa1pDQZ.mjs`)).tailCommand},{name:`wc`,load:async()=>(await import(`./wc-TQB3VNOX-DqHFY4jy.mjs`)).wcCommand},{name:`stat`,load:async()=>(await import(`./stat-BT5A227F-CEZPXJ9_.mjs`)).statCommand},{name:`grep`,load:async()=>(await import(`./grep-2HUTXO5U-9G7xEEms.mjs`)).grepCommand},{name:`fgrep`,load:async()=>(await import(`./grep-2HUTXO5U-9G7xEEms.mjs`)).fgrepCommand},{name:`egrep`,load:async()=>(await import(`./grep-2HUTXO5U-9G7xEEms.mjs`)).egrepCommand},{name:`rg`,load:async()=>(await import(`./rg-XNF3R3II-vKB7djPZ.mjs`)).rgCommand},{name:`sed`,load:async()=>(await import(`./sed-JAPPVBEU-C7wh6RxT.mjs`)).sedCommand},{name:`awk`,load:async()=>(await import(`./awk2-BBAGSFUB-ClUuupKf.mjs`)).awkCommand2},{name:`sort`,load:async()=>(await import(`./sort-DCNRDA7U-vT57Mw8o.mjs`)).sortCommand},{name:`uniq`,load:async()=>(await import(`./uniq-SUNANL47-DBRSkw7j.mjs`)).uniqCommand},{name:`comm`,load:async()=>(await import(`./comm-5SLSESQG-0igXzBnl.mjs`)).commCommand},{name:`cut`,load:async()=>(await import(`./cut-OPC3VAGB-nJAw1cEp.mjs`)).cutCommand},{name:`paste`,load:async()=>(await import(`./paste-7N6AFSDS-BnqApCW_.mjs`)).pasteCommand},{name:`tr`,load:async()=>(await import(`./tr-2HXZRDSW-ByYmbFae.mjs`)).trCommand},{name:`rev`,load:async()=>(await import(`./rev-XOSYPP45-D6eJxPKd.mjs`)).rev},{name:`nl`,load:async()=>(await import(`./nl-U5YJDM32-Y_hGSMac.mjs`)).nl},{name:`fold`,load:async()=>(await import(`./fold-LDSORVYE-Dhx0k6vg.mjs`)).fold},{name:`expand`,load:async()=>(await import(`./expand-DTNXU4LQ-D2bEx87V.mjs`)).expand},{name:`unexpand`,load:async()=>(await import(`./unexpand-RGTMIGZM-BL5sZ5_Z.mjs`)).unexpand},{name:`strings`,load:async()=>(await import(`./strings-7PLOGTPD-CiVw0Uh4.mjs`)).strings},{name:`split`,load:async()=>(await import(`./split-SITCSYCZ-Ci_IfVPT.mjs`)).split},{name:`column`,load:async()=>(await import(`./column-WLPMMSTS-Do8HgL6q.mjs`)).column},{name:`join`,load:async()=>(await import(`./join-GG2LDHE5-7k4Syl20.mjs`)).join},{name:`tee`,load:async()=>(await import(`./tee-O7VXZDCO-D95l5L5Z.mjs`)).teeCommand},{name:`find`,load:async()=>(await import(`./find-DH2ALKQS-B6bMjuwo.mjs`)).findCommand},{name:`basename`,load:async()=>(await import(`./basename-AA2KJYZQ-CEdH80GO.mjs`)).basenameCommand},{name:`dirname`,load:async()=>(await import(`./dirname-LEMTZZFS-Dg3ijqjM.mjs`)).dirnameCommand},{name:`tree`,load:async()=>(await import(`./tree-LYXBS7DC-Dq6aWetx.mjs`)).treeCommand},{name:`du`,load:async()=>(await import(`./du-WO2ENHXQ-jqWYqk_n.mjs`)).duCommand},{name:`env`,load:async()=>(await import(`./env-5EPCWSXR-BU5zTNDV.mjs`)).envCommand},{name:`printenv`,load:async()=>(await import(`./env-5EPCWSXR-BU5zTNDV.mjs`)).printenvCommand},{name:`alias`,load:async()=>(await import(`./alias-JE7RI5QX-BLuOrjl2.mjs`)).aliasCommand},{name:`unalias`,load:async()=>(await import(`./alias-JE7RI5QX-BLuOrjl2.mjs`)).unaliasCommand},{name:`history`,load:async()=>(await import(`./history-J4QRNGRO-DesXbqi2.mjs`)).historyCommand},{name:`xargs`,load:async()=>(await import(`./xargs-I6EZUCYF-C_ZtmUCd.mjs`)).xargsCommand},{name:`true`,load:async()=>(await import(`./true-WHJNXCHG-XC4ZnbBw.mjs`)).trueCommand},{name:`false`,load:async()=>(await import(`./true-WHJNXCHG-XC4ZnbBw.mjs`)).falseCommand},{name:`clear`,load:async()=>(await import(`./clear-5CZ5X4YR-9EZyt4MH.mjs`)).clearCommand},{name:`bash`,load:async()=>(await import(`./bash-IJWYRKFO-BDtU-lTC.mjs`)).bashCommand},{name:`sh`,load:async()=>(await import(`./bash-IJWYRKFO-BDtU-lTC.mjs`)).shCommand},{name:`jq`,load:async()=>(await import(`./jq-LYZFFBZB-BZ4XP29I.mjs`)).jqCommand},{name:`base64`,load:async()=>(await import(`./base64-4YMZCVJ5-CtkujsXK.mjs`)).base64Command},{name:`diff`,load:async()=>(await import(`./diff-HJF2MPDN-EjmLU95d.mjs`)).diffCommand},{name:`date`,load:async()=>(await import(`./date-DD7FVA2V-W_sbdO4n.mjs`)).dateCommand},{name:`sleep`,load:async()=>(await import(`./sleep-VZFPZFWA-CBARUnrz.mjs`)).sleepCommand},{name:`timeout`,load:async()=>(await import(`./timeout-VRKMCG72-DFU5EkCe.mjs`)).timeoutCommand},{name:`time`,load:async()=>(await import(`./time-DEUO3QV2-DwnT4FOS.mjs`)).timeCommand},{name:`seq`,load:async()=>(await import(`./seq-RN5ZUASB-R5HjEVux.mjs`)).seqCommand},{name:`expr`,load:async()=>(await import(`./expr-YYCVMXE3-wI0boF3e.mjs`)).exprCommand},{name:`md5sum`,load:async()=>(await import(`./md5sum-INMIK4DX-BlgGpdCD.mjs`)).md5sumCommand},{name:`sha1sum`,load:async()=>(await import(`./sha1sum-VJPNLNU6-DfzpfxJ-.mjs`)).sha1sumCommand},{name:`sha256sum`,load:async()=>(await import(`./sha256sum-PI32XWXY-DrKtnAPK.mjs`)).sha256sumCommand},{name:`file`,load:async()=>(await import(`./file-IGDTDPLG-DkYMcmTl.mjs`)).fileCommand},{name:`html-to-markdown`,load:async()=>(await import(`./html-to-markdown-TFCECAGV-DLUGt6pW.mjs`)).htmlToMarkdownCommand},{name:`help`,load:async()=>(await import(`./help-VVWX7SA5-Bb8T3djf.mjs`)).helpCommand},{name:`which`,load:async()=>(await import(`./which-XZHEH76L-CbmRVw8E.mjs`)).whichCommand},{name:`tac`,load:async()=>(await import(`./tac-SJGXQ4T2-BL4Xd7y6.mjs`)).tac},{name:`hostname`,load:async()=>(await import(`./hostname-BK6HG2DE-DTiGP5th.mjs`)).hostname},{name:`whoami`,load:async()=>(await import(`./whoami-DGKU3D2X-BDJh39KM.mjs`)).whoami},{name:`od`,load:async()=>(await import(`./od-VJEF2UR5-CueTpZ68.mjs`)).od},{name:`gzip`,load:async()=>(await import(`./gzip-AQXSGOVS-BcGYw5wM.mjs`)).gzipCommand},{name:`gunzip`,load:async()=>(await import(`./gzip-AQXSGOVS-BcGYw5wM.mjs`)).gunzipCommand},{name:`zcat`,load:async()=>(await import(`./gzip-AQXSGOVS-BcGYw5wM.mjs`)).zcatCommand}];(typeof __BROWSER__>`u`||!__BROWSER__)&&(o5.push({name:`tar`,load:async()=>(await import(`./tar-MZQD7NO4-HJsWmzu9.mjs`)).tarCommand}),o5.push({name:`yq`,load:async()=>(await import(`./yq-OAKYHSXH-COzSqY4J.mjs`)).yqCommand}),o5.push({name:`xan`,load:async()=>(await import(`./xan-UD7JYIL2-DQo9f-1a.mjs`)).xanCommand}),o5.push({name:`sqlite3`,load:async()=>(await import(`./sqlite3-TE5AIOTF-BhXSdz7U.mjs`)).sqlite3Command}));var s5=[];(typeof __BROWSER__>`u`||!__BROWSER__)&&(s5.push({name:`python3`,load:async()=>(await import(`./python3-DNGS4G3E-DaBJervu.mjs`)).python3Command}),s5.push({name:`python`,load:async()=>(await import(`./python3-DNGS4G3E-DaBJervu.mjs`)).pythonCommand}));var c5=[];(typeof __BROWSER__>`u`||!__BROWSER__)&&(c5.push({name:`js-exec`,load:async()=>(await import(`./js-exec-VXN6TZ7U-Ds5SsewK.mjs`)).jsExecCommand}),c5.push({name:`node`,load:async()=>(await import(`./js-exec-VXN6TZ7U-Ds5SsewK.mjs`)).nodeStubCommand})),new TextEncoder,Object.freeze({stdout:``,stderr:``,exitCode:0}),[...new Map([[`:`,[`: [arguments]`,`Null command.
454
454
  No effect; the command does nothing.
@@ -797,12 +797,12 @@ caused by: `+i(o,t)):a},a=e=>i(e,new Set),o=(e,t,i)=>{if(!n(e))return``;let a=i?
797
797
  job specification, and reports its termination status.
798
798
  Exit Status:
799
799
  Returns the status of the last ID; fails if ID is invalid or an invalid
800
- option is given.`]]]).keys()].sort(),new TextDecoder(`utf-8`,{fatal:!0});var Pye=i(((e,t)=>{var n=[`||`,`&&`,`;;`,`|&`,`<(`,`<<<`,`>>`,`>&`,`<&`,`&`,`;`,`(`,`)`,`|`,`<`,`>`],r=/[\n\r\u2028\u2029]/,i=/[\s#!"$&'():;<=>@\\^`|]/g;t.exports=function(e){return e.map(function(e){if(e===``)return`''`;if(e&&typeof e==`object`){if(`op`in e&&e.op===`glob`){if(typeof e.pattern!=`string`)throw TypeError("glob token requires a string `pattern`");if(r.test(e.pattern))throw TypeError("glob `pattern` must not contain line terminators");return e.pattern.replace(i,`\\$&`)}if(`op`in e&&typeof e.op==`string`){if(n.indexOf(e.op)<0)throw TypeError("invalid `op` value: "+JSON.stringify(e.op));return e.op.replace(/[\s\S]/g,`\\$&`)}if(`comment`in e&&typeof e.comment==`string`){if(r.test(e.comment))throw TypeError("`comment` must not contain line terminators");return`#`+e.comment}throw TypeError(`unrecognized object token shape`)}return/["\s\\]/.test(e)&&!/'/.test(e)?`'`+e.replace(/(['])/g,`\\$1`)+`'`:/["'\s]/.test(e)?`"`+e.replace(/(["\\$`!])/g,`\\$1`)+`"`:String(e).replace(/([A-Za-z]:)?([#!"$&'()*,:;<=>?@[\\\]^`{|}~])/g,`$1\\$2`)}).join(` `)}})),Fye=i(((e,t)=>{for(var n=`(?:`+[`\\|\\|`,`\\&\\&`,`;;`,`\\|\\&`,`\\<\\(`,`\\<\\<\\<`,`>>`,`>\\&`,`<\\&`,`[&;()|<>]`].join(`|`)+`)`,r=RegExp(`^`+n+`$`),i=`|&;()<> \\t`,a=`'([^']*?)'`,o=`"((\\\\"|[^"])*?)"`,s=/^#$/,c=`'`,l=`"`,u=`$`,d=``,f=4294967296,p=0;p<4;p++)d+=(f*Math.random()).toString(16);var m=RegExp(`^`+d);function h(e,t){for(var n=t.lastIndex,r=[],i;i=t.exec(e);)r[r.length]=i,t.lastIndex===i.index&&(t.lastIndex+=1);return t.lastIndex=n,r}function g(e,t,n){var r=typeof e==`function`?e(n):e[n];return r===void 0&&n!=``?r=``:r===void 0&&(r=`$`),typeof r==`object`?t+d+JSON.stringify(r)+d:t+r}function _(e,t,d){d||={};var f=d.escape||`\\`,p=d.splitUnquoted===!0?`
800
+ option is given.`]]]).keys()].sort(),new TextDecoder(`utf-8`,{fatal:!0});var Fye=i(((e,t)=>{var n=[`||`,`&&`,`;;`,`|&`,`<(`,`<<<`,`>>`,`>&`,`<&`,`&`,`;`,`(`,`)`,`|`,`<`,`>`],r=/[\n\r\u2028\u2029]/,i=/[\s#!"$&'():;<=>@\\^`|]/g;t.exports=function(e){return e.map(function(e){if(e===``)return`''`;if(e&&typeof e==`object`){if(`op`in e&&e.op===`glob`){if(typeof e.pattern!=`string`)throw TypeError("glob token requires a string `pattern`");if(r.test(e.pattern))throw TypeError("glob `pattern` must not contain line terminators");return e.pattern.replace(i,`\\$&`)}if(`op`in e&&typeof e.op==`string`){if(n.indexOf(e.op)<0)throw TypeError("invalid `op` value: "+JSON.stringify(e.op));return e.op.replace(/[\s\S]/g,`\\$&`)}if(`comment`in e&&typeof e.comment==`string`){if(r.test(e.comment))throw TypeError("`comment` must not contain line terminators");return`#`+e.comment}throw TypeError(`unrecognized object token shape`)}return/["\s\\]/.test(e)&&!/'/.test(e)?`'`+e.replace(/(['])/g,`\\$1`)+`'`:/["'\s]/.test(e)?`"`+e.replace(/(["\\$`!])/g,`\\$1`)+`"`:String(e).replace(/([A-Za-z]:)?([#!"$&'()*,:;<=>?@[\\\]^`{|}~])/g,`$1\\$2`)}).join(` `)}})),Iye=i(((e,t)=>{for(var n=`(?:`+[`\\|\\|`,`\\&\\&`,`;;`,`\\|\\&`,`\\<\\(`,`\\<\\<\\<`,`>>`,`>\\&`,`<\\&`,`[&;()|<>]`].join(`|`)+`)`,r=RegExp(`^`+n+`$`),i=`|&;()<> \\t`,a=`'([^']*?)'`,o=`"((\\\\"|[^"])*?)"`,s=/^#$/,c=`'`,l=`"`,u=`$`,d=``,f=4294967296,p=0;p<4;p++)d+=(f*Math.random()).toString(16);var m=RegExp(`^`+d);function h(e,t){for(var n=t.lastIndex,r=[],i;i=t.exec(e);)r[r.length]=i,t.lastIndex===i.index&&(t.lastIndex+=1);return t.lastIndex=n,r}function g(e,t,n){var r=typeof e==`function`?e(n):e[n];return r===void 0&&n!=``?r=``:r===void 0&&(r=`$`),typeof r==`object`?t+d+JSON.stringify(r)+d:t+r}function _(e,t,d){d||={};var f=d.escape||`\\`,p=d.splitUnquoted===!0?`
801
801
  `:typeof d.splitUnquoted==`string`?d.splitUnquoted:``,m=`(\\`+f+`['"`+i+`]|[^\\s'"`+i+`])+`,_=h(e,new RegExp([`(`+n+`)`,`(`+m+`|`+o+`|`+a+`)+`].join(`|`),`g`));if(_.length===0)return[];t||={};var v=!1;return _.map(function(n){var i=n[0];if(!i||v)return;if(r.test(i))return{op:i};var a=!1,o=!1,d=``,m=[],h=!1,_=null,y=!1,b;function x(){b+=1;var e,n,r=i.charAt(b);if(r===`{`){if(b+=1,i.charAt(b)===`}`)throw Error(`Bad substitution: `+i.slice(b-2,b+1));var a=1;for(e=b;a>0&&e<i.length;)i.charAt(e)===`{`&&i.charAt(e-1)===`$`?a+=1:i.charAt(e)===`}`&&--a,e+=1;if(a!==0)throw Error(`Bad substitution: `+i.slice(b));--e,n=i.slice(b,e),b=e}else if(/[*@#?$!_-]/.test(r))n=r,b+=1;else{var o=i.slice(b);e=o.match(/[^\w\d_]/),e?(n=o.slice(0,e.index),b+=e.index-1):(n=o,b=i.length)}return g(t,``,n)}function S(){if(_!==null){if(_===0)d!==``&&(m[m.length]=d,d=``);else{m[m.length]=d,d=``;for(var e=1;e<_;e+=1)m[m.length]=``}_=null}}for(b=0;b<i.length;b++){var C=i.charAt(b);if(p&&C!==u&&S(),y||=!a&&(C===`*`||C===`?`),o)d+=C,o=!1;else if(a)C===a?a=!1:a==c?d+=C:C===f?(b+=1,C=i.charAt(b),C===l||C===f||C===u?d+=C:d+=f+C):C===u?d+=x():d+=C;else if(C===l||C===c)a=C,h=!0;else if(r.test(C))return{op:i};else if(s.test(C)){v=!0;var w={comment:e.slice(n.index+b+1)};return d.length?[d,w]:[w]}else if(C===f)o=!0;else if(C===u){var T=x();if(!p)d+=T;else for(var E=0;E<T.length;E+=1){var D=T.charAt(E);p.indexOf(D)<0?(S(),d+=D):_===null?_=D===` `||D===` `||D===`
802
802
  `?0:1:D!==` `&&D!==` `&&D!==`
803
- `&&(_+=1)}}else d+=C}if(y)return{op:`glob`,pattern:d};if(p){if(_!==null&&_>0){m[m.length]=d,d=``;for(var ee=1;ee<_;ee+=1)m[m.length]=``}return(d!==``||h&&m.length===0)&&(m[m.length]=d),m}return d}).reduce(function(e,t){return t===void 0||[].concat(t).forEach(function(t){e[e.length]=t}),e},[])}t.exports=function(e,t,n){var r=_(e,t,n);return typeof t==`function`?r.reduce(function(e,t){if(typeof t==`object`)return e[e.length]=t,e;var n=t.split(RegExp(`(`+d+`.*?`+d+`)`,`g`));return n.length===1?(e[e.length]=n[0],e):(n.filter(Boolean).forEach(function(t){e[e.length]=m.test(t)?JSON.parse(t.split(d)[1]):t}),e)},[]):r}}));i((e=>{e.quote=Pye(),e.parse=Fye()}))(),["**STOP — when the project has `.ok/`, do NOT use native `Read`/`Grep`/`Glob` on in-scope `.md`/`.mdx`; use `exec` (this tool).** Native tools skip the frontmatter, backlinks, unresolved comments, shadow-repo activity, and git history `exec` returns per wiki file. Reserve native tools for source code, non-markdown, and projects without `.ok/`. (Full rule + escape hatch: the `open-knowledge` skill.)",``,`Run a read-only bash-like command against the project content directory. Returns raw stdout plus enriched metadata for every wiki file referenced (frontmatter, backlink/forward-link counts, shadow-repo activity with agent/human attribution).`,``,"`⚠ N unresolved comment(s)` = open human review requests — factor in before editing, and report them.",``,"Allowlist: cat, ls, grep, find, head, tail, wc, sort, uniq, cut. One command or a pipe (|) per call — NOT a shell: `&&`, `;`, redirections, subshells, and writes are rejected. To do several things, make separate exec calls or pass multiple paths to one command (e.g. `ls -A a b c`, `cat a b c`).",``,"cwd: the command runs in the explicit absolute `cwd` you pass, or in the MCP client's only advertised root when there is exactly one. If the client has zero or multiple roots, pass `cwd` explicitly. Paths inside the command resolve relative to that cwd; traversal above it is rejected.",``,"Stdout provenance headers (GNU-style): `ls <dir>/` prepends `<dir>/:`, single-file `cat`/`head`/`tail` prepends `==> <path> <==`, so the subject of the command is visible in raw output. Multi-file `cat a b` emits no header — the `enrichedPaths` array still lists every file. `head`/`tail` used as pipe trimmers (no file arg) defer to the upstream producer.",``,`Examples:`,'- `exec({ command: "cat articles/auth.md" })` — file contents + full enrichment','- `exec({ command: "ls articles/" })` — listing + per-file enrichment (slim)','- `exec({ command: "grep -rn oauth articles/ | head -5" })` — pipe with enrichment on matched files','- `exec({ command: "ls", cwd: "/abs/path/to/other-repo" })` — run in a different project'].join(`
803
+ `&&(_+=1)}}else d+=C}if(y)return{op:`glob`,pattern:d};if(p){if(_!==null&&_>0){m[m.length]=d,d=``;for(var ee=1;ee<_;ee+=1)m[m.length]=``}return(d!==``||h&&m.length===0)&&(m[m.length]=d),m}return d}).reduce(function(e,t){return t===void 0||[].concat(t).forEach(function(t){e[e.length]=t}),e},[])}t.exports=function(e,t,n){var r=_(e,t,n);return typeof t==`function`?r.reduce(function(e,t){if(typeof t==`object`)return e[e.length]=t,e;var n=t.split(RegExp(`(`+d+`.*?`+d+`)`,`g`));return n.length===1?(e[e.length]=n[0],e):(n.filter(Boolean).forEach(function(t){e[e.length]=m.test(t)?JSON.parse(t.split(d)[1]):t}),e)},[]):r}}));i((e=>{e.quote=Fye(),e.parse=Iye()}))(),["**STOP — when the project has `.ok/`, do NOT use native `Read`/`Grep`/`Glob` on in-scope `.md`/`.mdx`; use `exec` (this tool).** Native tools skip the frontmatter, backlinks, unresolved comments, shadow-repo activity, and git history `exec` returns per wiki file. Reserve native tools for source code, non-markdown, and projects without `.ok/`. (Full rule + escape hatch: the `open-knowledge` skill.)",``,`Run a read-only bash-like command against the project content directory. Returns raw stdout plus enriched metadata for every wiki file referenced (frontmatter, backlink/forward-link counts, shadow-repo activity with agent/human attribution).`,``,"`⚠ N unresolved comment(s)` = open human review requests — factor in before editing, and report them.",``,"Allowlist: cat, ls, grep, find, head, tail, wc, sort, uniq, cut. One command or a pipe (|) per call — NOT a shell: `&&`, `;`, redirections, subshells, and writes are rejected. To do several things, make separate exec calls or pass multiple paths to one command (e.g. `ls -A a b c`, `cat a b c`).",``,"cwd: the command runs in the explicit absolute `cwd` you pass, or in the MCP client's only advertised root when there is exactly one. If the client has zero or multiple roots, pass `cwd` explicitly. Paths inside the command resolve relative to that cwd; traversal above it is rejected.",``,"Stdout provenance headers (GNU-style): `ls <dir>/` prepends `<dir>/:`, single-file `cat`/`head`/`tail` prepends `==> <path> <==`, so the subject of the command is visible in raw output. Multi-file `cat a b` emits no header — the `enrichedPaths` array still lists every file. `head`/`tail` used as pipe trimmers (no file arg) defer to the upstream producer.",``,`Examples:`,'- `exec({ command: "cat articles/auth.md" })` — file contents + full enrichment','- `exec({ command: "ls articles/" })` — listing + per-file enrichment (slim)','- `exec({ command: "grep -rn oauth articles/ | head -5" })` — pipe with enrichment on matched files','- `exec({ command: "ls", cwd: "/abs/path/to/other-repo" })` — run in a different project'].join(`
804
804
  `),["Resolve the browser-reachable preview URL for an OpenKnowledge project (optionally for a specific doc). Opening a preview counts as demand: when no OK server is running for the project, this call auto-starts one (same `OK_MCP_AUTOSTART` gate and spawn timeout as the read/write tools) and waits briefly for the preview UI to bind — a cold first call can take a few seconds; calls against a running system answer immediately.",``,"Per-response `previewUrl` fields on read/write tools are ROUTE-ONLY (`/#/<doc>`, no host:port) — they identify which doc to preview, not a URL to open by itself. Call this tool to get the full, openable URL.",``,"This is THE way to open a doc OR a loose file in a browser, and the only way to force a browser when the OK Desktop app is installed (the `ok open` CLI prefers Desktop). Use it when YOUR host opens the URL itself: navigate your in-app / embedded browser to the returned `url`, or — only on a stdio host with no browser tool — `open` it in the system browser. Do not hunt for the URL via `ok ps`/`ok status` or by guessing a port — this tool returns it. Claude Code Desktop opens its in-app Browser pane with `preview_start({url})` then `navigate({url})` to move; a pure stdio CLI with no browser uses `ok open <doc>` to open in the OK Desktop app.",``,"If you are running INSIDE an OpenKnowledge surface — the desktop app’s built-in terminal or its in-app agent panel — the response leads with an `ok open …` steer and returns it as `okOpenCommand`. Run that instead: the user is already looking at the app, so a localhost URL in your reply is noise at best and a dead link at worst. Never paste `url` into your answer in that case.",``,"Returns `{ url: null, baseUrl: null, running: false, autoOpen }` + a recovery hint only when no UI could be reached (auto-start disabled via `OK_MCP_AUTOSTART=0`, no spawn authority in this registration, or the UI did not bind in time) — the hint names the right command for the actual state.",``,"To open a single markdown file that may live OUTSIDE any Open Knowledge project (a loose file, or a doc in a different git worktree), pass `file` with an absolute path: the tool finds the running session whose content directory contains it and returns that session’s URL, then navigate your in-app browser there. `document`/`folder` are for a doc in the current project; `file` is the out-of-project form.",``,`**Parameters:**`,"- `document` (optional) — Extension-less doc path in the current project (e.g. `specs/foo/SPEC`). Omit for the UI root URL.","- `folder` (optional) — Folder path in the current project (e.g. `specs/foo`); returns the `…/#/<folder>/` route. Mutually exclusive with `document`.","- `skill` (optional) — A skill to open in the editor: `{ name, scope? }` (scope `project` default). Returns the `…/#/__skill__/<scope>/<name>` route. Mutually exclusive with `document`/`folder`/`file`.","- `file` (optional) — Absolute path to a single markdown file, including one outside any project. Resolves to the running single-file / worktree session serving it. Mutually exclusive with `document`/`folder`/`skill`; `cwd` is ignored when set.","- `cwd` (optional) — Project root (see `cwd` description below)."].join(`
805
- `),P().optional().describe(`Extension-less doc path to resolve a preview URL for (e.g. "specs/foo/SPEC"). Omit to get the UI root URL.`),P().min(1).optional().describe('Folder path to resolve a folder-route preview URL for (e.g. "specs/foo"); returns the `…/#/<folder>/` route. Mutually exclusive with `document`.'),z({name:P().min(1).regex(GJ,`Skill name must be lowercase letters, digits, and hyphens only.`).describe(`Skill name (the bundle-dir identity, wherever the skill lives).`),scope:V(gl).optional().describe("Skill scope; defaults to `project`.")}).optional().describe("Skill to resolve an editor preview URL for; returns the `…/#/__skill__/<scope>/<name>` route. Mutually exclusive with `document`/`folder`/`file`."),P().optional().describe("Absolute path to a single markdown file to open, including one OUTSIDE any Open Knowledge project. Resolves to the running single-file (or worktree) session whose content directory contains it and returns that session’s `url`. Mutually exclusive with `document` / `folder` / `skill`. When `file` is set, `cwd` is ignored."),P().optional().describe(j3),M3({url:P().nullable().describe("Browser-reachable URL — the UI base joined with the doc route when `document` is given, else the UI root. `null` when no UI is running."),baseUrl:P().nullable().describe("Browser-reachable origin of the running UI (e.g. `http://localhost:5173`). `null` when no UI is running."),running:I().describe(`Whether a UI is running for the project.`),autoOpen:I().describe("User-scoped preview-auto-open preference (`appearance.preview.autoOpen`). When `true`, the agent should route the preview using capability-based routing (in-app browser if available, system browser as fallback). When `false`, the user is managing their own preview view (OK Desktop window, a browser tab they opened, etc.) — the agent must NOT open or refresh any preview UI, and should surface this URL only on direct user ask. Resolved fresh on every call; defaults to `true`."),okOpenCommand:P().nullable().optional().describe("Machine-readable form of the hosted-agent steer: when the calling agent runs inside an OpenKnowledge surface (the desktop app’s built-in terminal, or its in-app agent panel) AND a doc/folder/skill target was given, the exact `ok open …` command to run to bring it up for the user. Run it INSTEAD of navigating `url`, and do not paste `url` into your reply — the user is already in the app it points at. `null`/absent in every other context (navigate `url` per your host instead).")}),z({version:P().describe("40-char commit SHA for this entry — pass to `restore_version({ document, version })`."),timestamp:P().describe(`ISO timestamp of the entry.`),author:P().describe(`Author display name.`),authorEmail:P().describe(`Author email.`),kind:V([`checkpoint`,`wip`,`upstream`]).describe(`Entry kind: checkpoint / wip / upstream.`),message:P().describe(`Commit subject (the checkpoint summary, when one was set).`),contributors:Rge.describe(`Per-contributor records parsed from the commit (writer id, name, docs, summaries).`),checkpoint:L().nullable().describe(`Checkpoint metadata when this entry is a checkpoint, else null.`)}),[`[Requires: Hocuspocus server] List version history for a document, or the activity timeline for a folder.`,`Returns timeline entries from the shadow repo, sorted by timestamp descending.`,"Each entry carries a `version` (40-char commit SHA) you pass straight to `restore_version({ document, version })` — same field name on both sides.",``,"**Parameters (pass EXACTLY ONE of `document` / `folder` / `skill`):**","- `document` — Document name to query history for, typically without extension. A trailing `.md` or `.mdx` is stripped automatically.",'- `folder` — Folder path for the FOLDER timeline: attributed activity over the folder\'s `.ok/` artifacts (templates + frontmatter) — who created / edited / renamed / moved / deleted them, when. `""` = project root.',"- `skill` — Skill NAME to query version history for (the skill folder's attributed versions). PROJECT-scope skills only — global skills are unversioned. Pass an entry's `version` to `restore_version({ skill, version })`.","- `branch` (optional) — Branch name (default: current branch)","- `limit` (optional) — Maximum entries to return (default 50, max 200)","- `offset` (optional) — Number of entries to skip for pagination (default 0)",'- `kind` (optional) — Filter by entry type: "checkpoint", "upstream", or "wip"',"- `author` (optional) — Filter to entries by this author name or email","- `excludeAuthor` (optional) — Exclude entries by this author name or email"].join(`
805
+ `),P().optional().describe(`Extension-less doc path to resolve a preview URL for (e.g. "specs/foo/SPEC"). Omit to get the UI root URL.`),P().min(1).optional().describe('Folder path to resolve a folder-route preview URL for (e.g. "specs/foo"); returns the `…/#/<folder>/` route. Mutually exclusive with `document`.'),z({name:P().min(1).regex(GJ,`Skill name must be lowercase letters, digits, and hyphens only.`).describe(`Skill name (the bundle-dir identity, wherever the skill lives).`),scope:V(gl).optional().describe("Skill scope; defaults to `project`.")}).optional().describe("Skill to resolve an editor preview URL for; returns the `…/#/__skill__/<scope>/<name>` route. Mutually exclusive with `document`/`folder`/`file`."),P().optional().describe("Absolute path to a single markdown file to open, including one OUTSIDE any Open Knowledge project. Resolves to the running single-file (or worktree) session whose content directory contains it and returns that session’s `url`. Mutually exclusive with `document` / `folder` / `skill`. When `file` is set, `cwd` is ignored."),P().optional().describe(j3),M3({url:P().nullable().describe("Browser-reachable URL — the UI base joined with the doc route when `document` is given, else the UI root. `null` when no UI is running."),baseUrl:P().nullable().describe("Browser-reachable origin of the running UI (e.g. `http://localhost:5173`). `null` when no UI is running."),running:I().describe(`Whether a UI is running for the project.`),autoOpen:I().describe("User-scoped preview-auto-open preference (`appearance.preview.autoOpen`). When `true`, the agent should route the preview using capability-based routing (in-app browser if available, system browser as fallback). When `false`, the user is managing their own preview view (OK Desktop window, a browser tab they opened, etc.) — the agent must NOT open or refresh any preview UI, and should surface this URL only on direct user ask. Resolved fresh on every call; defaults to `true`."),okOpenCommand:P().nullable().optional().describe("Machine-readable form of the hosted-agent steer: when the calling agent runs inside an OpenKnowledge surface (the desktop app’s built-in terminal, or its in-app agent panel) AND a doc/folder/skill target was given, the exact `ok open …` command to run to bring it up for the user. Run it INSTEAD of navigating `url`, and do not paste `url` into your reply — the user is already in the app it points at. `null`/absent in every other context (navigate `url` per your host instead).")}),z({version:P().describe("40-char commit SHA for this entry — pass to `restore_version({ document, version })`."),timestamp:P().describe(`ISO timestamp of the entry.`),author:P().describe(`Author display name.`),authorEmail:P().describe(`Author email.`),kind:V([`checkpoint`,`wip`,`upstream`]).describe(`Entry kind: checkpoint / wip / upstream.`),message:P().describe(`Commit subject (the checkpoint summary, when one was set).`),contributors:zge.describe(`Per-contributor records parsed from the commit (writer id, name, docs, summaries).`),checkpoint:L().nullable().describe(`Checkpoint metadata when this entry is a checkpoint, else null.`)}),[`[Requires: Hocuspocus server] List version history for a document, or the activity timeline for a folder.`,`Returns timeline entries from the shadow repo, sorted by timestamp descending.`,"Each entry carries a `version` (40-char commit SHA) you pass straight to `restore_version({ document, version })` — same field name on both sides.",``,"**Parameters (pass EXACTLY ONE of `document` / `folder` / `skill`):**","- `document` — Document name to query history for, typically without extension. A trailing `.md` or `.mdx` is stripped automatically.",'- `folder` — Folder path for the FOLDER timeline: attributed activity over the folder\'s `.ok/` artifacts (templates + frontmatter) — who created / edited / renamed / moved / deleted them, when. `""` = project root.',"- `skill` — Skill NAME to query version history for (the skill folder's attributed versions). PROJECT-scope skills only — global skills are unversioned. Pass an entry's `version` to `restore_version({ skill, version })`.","- `branch` (optional) — Branch name (default: current branch)","- `limit` (optional) — Maximum entries to return (default 50, max 200)","- `offset` (optional) — Number of entries to skip for pagination (default 0)",'- `kind` (optional) — Filter by entry type: "checkpoint", "upstream", or "wip"',"- `author` (optional) — Filter to entries by this author name or email","- `excludeAuthor` (optional) — Exclude entries by this author name or email"].join(`
806
806
  `),[`[Requires: Hocuspocus server] Import a skill into this project as versioned content.`,``,"Fetches an agentskills.io / skills.sh skill-dir from a `source` and writes it into the vendor-neutral `.agents/skills/<name>/` hub — where it gains history, search, attribution, and cross-harness projection (via `install`) for free. Provenance (source, commit, content hash, publisher) is recorded in `.ok/skills-lock.json`. Scripts are imported as content and are NEVER executed. `add` says where it goes — an import always places the skill somewhere, so `install` afterwards is only for changing WHERE it lives (add/remove/convert/source).",``,`**Parameters:**`,"- `source` — paste the full skills.sh skill-page URL (`https://www.skills.sh/<owner>/<repo>/<skill>`, or `https://www.skills.sh/site/<hostname>/<skill>` for a website catalog), or pass `owner/repo[/subpath]` (GitHub), a git URL, or a local / `file://` path.","- `skill` — Pick ONE skill when the source bundles several.","- `scope` — `project` (default, versioned + shared) or `global` (user-global, unversioned).",``,"On a name collision with an existing skill the import lands under `<name>-imported` (never overwrites). An identical re-import (same content hash) is a no-op."].join(`
807
807
  `),['[Requires: Hocuspocus server] Manage WHERE a skill is available. A skill is ONE real folder (its SOURCE — the skill itself) plus managed copies/symlinks at other locations. `add`/`remove` change the other locations; `mode` flips copies↔symlinks; `source` moves the real folder. There is NO "uninstall everywhere" and no draft state — a skill with no extra locations still lives (and loads) at its source folder; to make a skill stop existing, use `delete`.',``,"Location ids: editor host ids (`claude` | `cursor` | `codex` | `copilot` | `opencode` | `pi`), `agents` (the vendor-neutral `.agents/skills` hub), or a base-relative custom root path containing `/` (e.g. `.team/skills`; home-relative at global scope). The source is validated FIRST — a SKILL.md with git conflict markers, missing/invalid frontmatter, XML tags in name/description, or a reserved `open-knowledge*` name is refused (never fanned into your agent context).",``,`**Parameters:**`,'- `name` — Skill name — the skill\'s identity AND its bundle-dir name, wherever the skill lives (e.g. `.agents/skills/<name>/`). Lowercase letters, digits, hyphens only (≤64 chars; no slashes, dots, spaces, or uppercase). Example: "trip-log".',"- `add` — Locations to ADD the skill to (everything else untouched). Editor ids fan out a copy/symlink; a custom root path places the bundle there. Omitting both `add` and `remove` installs into the project-configured editors.","- `remove` — Locations to REMOVE it from (lossless only: a hand-edited fork is refused, never deleted). Works however the agent gets the skill: removing an editor that reads it through a folder alias (its skills folder symlinked into a shared root) automatically unfollows that folder from the root MINUS this skill — the editor keeps its other skills. The SOURCE cannot be removed — its folder is the skill; move it with `source` or use `delete`.",'- `mode` — `"link"`: a live symlink to the source. `"copy"`: an independent folder, auto-refreshed from the source until hand-edited (a hand-edit forks that copy). Applies ONLY to the locations this call names — the ones in `add`, or the ones in `convert` — and sets no skill-wide default. Omit it on `add` and the new location takes the form the skill already uses.',"- `convert` — Existing locations to change the FORM of, leaving membership alone. Requires `mode`. Pass every location to make them uniform. Lossless both ways; a hand-edited copy is refused rather than overwritten.","- `source` — Move the skill's REAL folder to this location; the old source becomes a symlink to it. Run alone (not with add/remove).","- `scope` — `project` (default, shared via git) or `global` (user-level, every project on this machine).",``,"- `skillFolders` — Folder-level topology instead of one skill (the Settings → Folders surface). Run alone; `name` is not used with it. One action per call:",' - `{ action: "link", scope, root, target }` — merge the skills folder `root` into `target` and replace `root` with a symlink, so its agent reads everything placed in `target`. Same-content entries drop; a DIFFERENT skill in both folders aborts with a conflict list; an interrupted merge is resumable by re-running. `target` is required — nothing is ever assumed.',' - `{ action: "unlink", scope, root, exclude? }` — turn a linked folder back into a real directory holding one per-skill symlink per skill it sees (lossless, reversible). `exclude: ["<skill>"]` leaves named skills out — "this agent should not get that skill": the folder keeps everything else but stops following the root.',' - `{ action: "add-root", scope, root }` — declare a NEW custom skills root (base-relative, e.g. ".team/skills"); it becomes a folder row and an install/link target immediately.',``,"Copies auto-refresh when the source changes — you do NOT need to re-run install after editing a skill. After `delete({skill})` every location is removed with the source."].join(`
808
808
  `),["[Requires: Hocuspocus server] Read the wiki-link graph. `kind` takes one value, or an array for a one-call audit — results merge into a single payload; any per-kind failure lands in an `errors` map.",``,'- `backlinks` / `forward` / `suggest` — operate on one page; require `document`. `suggest` finds prose mentions of the page not yet wrapped in link syntax. Each mention returns an `excerpt` (a normalized, `…`-trimmed snippet for context — NOT an edit-ready literal) plus an `offset`. To wrap one: re-read the doc (`exec("cat …")`), find the real mention text, and `edit` it into a `[[wiki-link]]`.',"- `dead` — missing internal link targets corpus-wide; optional `sourceDocuments` filter (OR semantics).","- `orphans` — disconnected pages; optional `mode`: `incoming` | `outgoing` | `both`.","- `hubs` — most-linked pages; optional `limit` (default 20)."].join(`
@@ -812,20 +812,20 @@ caused by: `+i(o,t)):a},a=e=>i(e,new Set),o=(e,t,i)=>{if(!n(e))return``;let a=i?
812
812
  `),R(P().min(1)).max(32).optional().describe("Canonical ids to expand to full JSX-form detail (max 32, case-sensitive). Returns `componentDetails` + `notFound`."),P().optional().describe(j3),M3({version:H(1).describe(`Schema version stamp — bump for breaking shape changes.`),components:R(z({id:P(),displayName:P(),description:P(),authoring:V([`markdown`,`jsx`]).describe("`markdown` — write the markdown-native form OK auto-promotes; `jsx` — write the JSX tag directly (no markdown-native form exists)."),example:P().describe(`Copy-ready source for the authoring form.`),guidance:P().describe(`One line on when / how to use this construct.`)})).describe(`Canonical authoring constructs, keyed by the form an agent should write.`),embedPatterns:R(z({id:P(),title:P(),description:P(),snippet:P().describe("A complete, theme-wired ```html preview fenced block.")})).describe("Copy-ready themed `html preview` starters."),tokens:R(z({name:P().describe("CSS custom-property name, e.g. `--chart-1`."),light:P(),dark:P()})).describe("Theme tokens injected into every preview iframe — reference with `var(--name)`."),componentDetails:R(B(P(),L())).optional().describe("Full JSX-form prop schema for the requested `components` ids (when provided)."),notFound:R(P()).optional().describe("Requested `components` ids that did not match any canonical.")}),[`[Requires: Hocuspocus server] Resolve a tracked merge conflict by writing the chosen content to disk and committing.`,``,`Strategy:`,"- `mine` — runs `git checkout --ours -- <file>` then `git add` (your committed ours stage, stage 2). Fails on delete-modify (DU) conflicts where stage 2 is missing — use `delete` instead.","- `theirs` — runs `git checkout --theirs -- <file>` then `git add` (their committed stage 3). Fails on modify-delete (UD) conflicts where stage 3 is missing — use `delete` instead.",'- `content` — writes the provided `content` argument (e.g. a per-hunk merged result, or the live Y.Text bytes the user sees in the DiffView). The provided string must be non-empty — use `delete` to remove the file entirely (an agent constructing a per-hunk merge that happens to land on `""` gets a 400 at the Zod boundary rather than a misleading 500).','- `delete` — runs `git rm <file>` then commits the deletion. Honors deletion intent for delete-modify (DU: "keep deletion") and modify-delete (UD: "accept their deletion") shapes. Inspect the `shape` field on `conflicts({ kind: "content" })` to pick the right strategy for the conflict shape.',``,'Returns 200 on success; 500 indicates commit failure (re-call `conflicts({ kind: "list" })` to confirm post-state — the resolve API is best-effort, non-atomic, and the file may have been resolved by another session).',``,`**DESTRUCTIVE:** this modifies the working tree and creates a git commit.`,``,`**Parameters:**`,"- `file` — Relative-to-projectDir path WITH .md extension (e.g. `notes/sso.md`).","- `strategy` — One of `mine` | `theirs` | `content` | `delete`.",'- `content` — Required (non-empty) when `strategy === "content"`; ignored otherwise.'].join(`
813
813
  `),M3({ok:I(),file:P()}),["[Requires: Hocuspocus server] Restore a DOCUMENT (CRDT, append-only) or a SKILL (fs-direct) to a historical version. Pass EXACTLY ONE of `document` or `skill`.",``,`**Parameters:**`,"- `document` — The document to restore (path, no extension; trailing `.md`/`.mdx` is stripped). Append-only via the CRDT layer; all connected editors see the change live.","- `skill` — The skill NAME to restore (PROJECT-scope skills only — global skills are unversioned). Rewrites the skill folder to the target version (fs-direct); every recorded copy re-syncs from it, so there is nothing to re-install.","- `version` — The 40-character commit SHA to restore to. Copy it from the `history` tool (same field name there).","- `summary` — Optional one-line summary (≤80 chars). Avoid secrets or PII — persisted to git history.",``,'A response may include `structuredContent.warnings` (kind `content-divergence`) when the restored `Y.Text` does not byte-match the target-version bytes. The restore still landed; re-read the doc with `exec("cat <document>")` to see what converged.'].join(`
814
814
  `),["[Requires: Hocuspocus server] Ranked retrieval across ALL non-ignored files (markdown by title/body, other file types by name/path, plus folders) — pair with `exec` `grep` for exhaustive content search. The cmd-K engine (title boost + body BM25 + recency).",``,"NAMES/paths are indexed for all files; BODY content for markdown only. Two-tier agent model: run this fast indexed `search` (all files by name/path + markdown content) IN PARALLEL with `exec` (`grep`) for exhaustive literal-string content search across every file — instant ranked hits plus full content coverage. Reach for `exec` grep when you need to match content inside code/config/data files.",``,"When semantic search is enabled for the workspace (an opt-in setting with an API key), an embeddings signal is additionally fused into `full_text` ranking, surfacing conceptually-related pages that share no keywords. This tool opts in by default; the `semantic` block in the response reports coverage. Note: with semantic enabled, the query and matching page content are sent to the configured embeddings provider (content egress). Set `semantic: false` to force pure-lexical ranking for a call.",``,"Returns scored `page`, `folder`, and name-only `file` hits, each with a `signals` breakdown (lexical / fullText / recency / vector); markdown `page` hits also carry a body snippet (`file` hits never do — name-only).",``,'Cold start: right after the server boots, the response may carry `ready: false` with an empty `results` while the index is still building. That empty set is NOT authoritative — wait ~2-3 seconds, then retry (agents have no built-in delay, so do not retry in immediate succession). If it is still `ready: false` after 2-3 retries (e.g. a very large workspace), fall back to `exec("grep ...")` rather than polling further. Once `ready` is true/omitted the results are complete.',``,`**Parameters:**`,"- `query` — Free-form; tokenized across title, name, path segments, and (with `full_text`) body.","- `intent` (optional) — `omnibar` searches title/path/folders only (fast); `full_text` includes body. Default `full_text`.","- `scopes` (optional) — Result scope: `page` | `folder` | `file` | `content`. Defaults derive from `intent`.","- `limit` (optional) — Max rows; default 20, max 100.","- `semantic` (optional) — Set `false` to force pure-lexical ranking even when semantic search is enabled. Omit to use semantic when available.",``,'If the server is down, the tool returns a recovery hint — use `exec("grep ...")` as the server-free fallback.'].join(`
815
- `),P().describe(`Search query — title, path, or body terms.`),V([`omnibar`,`full_text`]).optional().describe(`'omnibar' for title/path/folder only (fast); 'full_text' includes body content. Default 'full_text'.`),R(V([`page`,`folder`,`content`,`file`])).optional().describe(`Override the default scope set. Members: 'page', 'folder', 'file', 'content'. Defaults derive from intent.`),F().int().min(1).max(100).optional().describe(`Max rows; default 20, max 100.`),I().optional().describe(`Set false to force pure-lexical ranking for this call even when semantic search is enabled. Omit to use semantic when available.`),P().optional().describe(j3);const Iye=z({kind:V([`page`,`folder`,`file`]),path:P(),docName:P(),title:P().nullable(),score:F(),signals:z({lexical:F(),fullText:F(),recency:F(),vector:F().optional()}),snippet:P().optional(),previewUrl:P().nullable(),previewUrlSource:V(jye).optional()}),Lye=z({capable:I(),applied:I(),coverage:z({embedded:F().int(),total:F().int()})});M3({cwd:P(),query:P(),intent:P(),resultCount:F().int(),results:R(Iye),elapsedMs:F().nullable(),semantic:Lye.optional(),ready:H(!1).optional()}),["[Requires: Hocuspocus server] Build a shareable GitHub-substrate URL (`https://openknowledge.ai/d/...`) pinned to the project's current branch + the focused target (a doc or a folder). Read-only against the working tree — no commits, no pushes, no `git fetch`.",``,`Use this when the user asks for a share link / shareable link / URL to send to a teammate. Recipients open the link to receive the doc (or folder subtree) into their own OpenKnowledge install.`,``,"**Publishing is a user act.** Agents do NOT publish projects to GitHub from this tool. When the project has no GitHub remote, this tool returns an error pointing the user at the Share wizard (or `gh repo create` + `git push`) — it does not run those steps itself.",``,`**Parameters:**`,'- `path` — Content-dir-relative target. For a doc, extension-less (trailing `.md`/`.mdx` is stripped; the on-disk file is probed automatically). For a folder, the directory path. The empty string `""` is the content-root sentinel (folder-only).',"- `kind` (optional) — `'doc'` or `'folder'`. Omit to auto-probe disk (`.mdx` → `.md` → directory, first hit wins). REQUIRED when `path` is empty (`\"\"`), since auto-probe cannot disambiguate the root.","- `cwd` (optional) — Project root (see `cwd` description below).",``,"**Preconditions:** project on a named branch (not detached HEAD); origin set to a GitHub remote (`github.com` or a GitHub Enterprise Server host); the branch already pushed to origin."].join(`
816
- `),M3({ok:I().describe(`Success discriminator.`),shareUrl:P().optional().describe(`Marketing share URL (success only).`),sharedUrl:P().optional().describe(`Unencoded GitHub blob/tree URL (success only).`),branch:P().optional().describe(`Branch the share URL pins to (success only).`),resolvedKind:V([`doc`,`folder`]).optional().describe(`Kind the target resolved to (success only).`),freshness:Sw.optional().describe(`Whether the shared target matches origin (success only): current, stale (unpushed edits), absent (not on origin, a push fixes it), or empty (a folder holding nothing git can track, which no push fixes). Omitted when the probe could not run.`),error:V([`no-remote`,`detached-head`,`branch-not-on-origin`,`non-github-remote`,`invalid-path`,`target-not-found`,`kind-mismatch`,`unknown`]).optional().describe(`Failure code (error path only).`),message:P().optional().describe(`Agent-actionable error message (error path only).`),previewUrl:P().nullable().optional().describe("Route-only preview URL (no host:port): `/#/<doc>` for a doc, `/#/<folder>/` for a folder, `/#/` for the content root. `null` when no UI is running."),previewUrlSource:P().optional().describe(`Internal: preview-URL provenance.`)});const l5="Which level the skill lives at. `project` = lives in this KB (wherever its folder is; shared via git); `global` = user-level under your home dir (available in every project on this machine, not shared).",Rye=z({id:P().describe("Location id — editor host id, `agents`, or a custom root path. Pass to `install`."),path:P().describe('Base-relative bundle dir (e.g. ".claude/skills/x"). INFORMATIONAL — for showing a user where a location lives. Skills are addressed by `name` + `scope`: pass `id` to `install`, and read bundle files with `skills({ name, file })`, never by handing this path to `exec` or a native file tool.'),role:V([`source`,`copy`,`symlink`]).describe(`source = the REAL folder (the skill itself); copy = independent folder, auto-refreshed from the source until hand-edited (then it forks); symlink = live link to the source.`),audience:R(P()).optional().describe(`Folders that RESOLVE INTO this location (folder-level symlinks) — their agents read what lands here.`),drift:I().optional().describe(`Something outside OK rewrote this path since OK last wrote it.`)});z({name:P().describe("Skill name (its identity; pass to `edit`/`move`/`delete`/`install`)."),scope:V([`project`,`global`]).describe(l5),description:P().optional().describe(`The skill's one-line description (when present).`),installed:I().describe('Always true for a managed skill — its source folder IS the skill, so it is never "not installed". Read `locations[]` for where it actually lives.'),hosts:R(P()).describe(`Flat location ids (locations[].id), SOURCE first — legacy projection.`),locations:R(Rye).describe("Everywhere the skill lives. Exactly one `source` (the skill's real folder); every other entry is a managed copy or symlink of it."),mode:V([`copy`,`link`]).describe("The form a NEW location would take, derived from the ones the skill already uses. Not a stored preference and not a claim about existing locations — read `locations[].role` for those."),conflicts:R(P()).optional().describe(`Host ids where a DIFFERENT skill with this name occupies the slot.`)});const zye=z({path:P().describe(`Skill-relative path (e.g. "references/tiers.md").`),kind:V([`reference`,`script`]).describe("`script` for anything under scripts/; `reference` for every other bundle file.")});z({name:P().describe(`Skill name (its identity).`),scope:V([`project`,`global`]).describe(l5),description:P().describe(`The skill's one-line description (empty if none).`),body:P().describe(`The SKILL.md body (markdown, frontmatter stripped).`),files:R(zye).describe("Bundle files beside SKILL.md (path + kind, no inline text). Read one via `file`.")}),z({path:P().describe(`Skill-relative path read.`),kind:V([`reference`,`script`]).describe("`reference` or `script`."),text:P().describe(`Full text of the bundle file.`)}),z({name:P().describe("Skill name to pass as `skill` to `import`."),source:P().describe("Import-ready repository coordinates or website hostname. Pass this exact value to `import`."),description:P().describe(`Marketplace description for deciding whether the skill matches the task.`),installs:F().int().nonnegative().nullable().describe(`skills.sh install count, if known.`),publisher:P().nullable().describe(`Publisher, website, or GitHub owner, if known.`)}),["[Requires: Hocuspocus server] Read-only discovery for SKILLS — the read half of the skill vocabulary (`write`/`edit`/`delete`/`move`/`install` are the mutate half).",``,"This is how you search the marketplace, list managed skills, and read managed skill content. Managed skills are addressed by `name` + `scope`, NOT by path — do NOT `ls`/`cat` `.ok/skills/` or pass raw `.ok/...` paths; `.ok/` is opaque internal state.",``,"Marketplace rows are external candidates; they are NOT managed content until you call `import({ source, skill: name })`, and they are NOT active in editors until `install` projects them.",``,"OpenKnowledge's own built-in `open-knowledge*` skills (e.g. the `open-knowledge` project skill) are runtime skills already loaded in your skill list — they are NOT here, and you never fetch them through this tool.",``,`**Four modes:**`,"- **Marketplace search** (pass `query`): search skills.sh and return import-ready rows (`name`, `source`, `description`, `publisher`, installs). Use when a user asks to find/browse/add an external skill. Then call `import({ source, skill: name })` on the chosen row.","- **List** (omit `name`): every skill across BOTH levels — Project (this KB) and Global (user-level). Returns name, scope, description, installed/hosts.","- **Read skill** (pass `name`): that skill's description + body + a `files` list (`{ path, kind }`, no inline text) of its bundle files (`references/**`, `scripts/**`, and any other file the skill ships). `scope` optional — omitted, it resolves by name (preferring Project when a name exists at both levels).","- **Read file** (pass `name` + `file`): one bundle file's text — the universal read path for references + scripts (no native `cat`)."].join(`
815
+ `),P().describe(`Search query — title, path, or body terms.`),V([`omnibar`,`full_text`]).optional().describe(`'omnibar' for title/path/folder only (fast); 'full_text' includes body content. Default 'full_text'.`),R(V([`page`,`folder`,`content`,`file`])).optional().describe(`Override the default scope set. Members: 'page', 'folder', 'file', 'content'. Defaults derive from intent.`),F().int().min(1).max(100).optional().describe(`Max rows; default 20, max 100.`),I().optional().describe(`Set false to force pure-lexical ranking for this call even when semantic search is enabled. Omit to use semantic when available.`),P().optional().describe(j3);const Lye=z({kind:V([`page`,`folder`,`file`]),path:P(),docName:P(),title:P().nullable(),score:F(),signals:z({lexical:F(),fullText:F(),recency:F(),vector:F().optional()}),snippet:P().optional(),previewUrl:P().nullable(),previewUrlSource:V(Mye).optional()}),Rye=z({capable:I(),applied:I(),coverage:z({embedded:F().int(),total:F().int()})});M3({cwd:P(),query:P(),intent:P(),resultCount:F().int(),results:R(Lye),elapsedMs:F().nullable(),semantic:Rye.optional(),ready:H(!1).optional()}),["[Requires: Hocuspocus server] Build a shareable GitHub-substrate URL (`https://openknowledge.ai/d/...`) pinned to the project's current branch + the focused target (a doc or a folder). Read-only against the working tree — no commits, no pushes, no `git fetch`.",``,`Use this when the user asks for a share link / shareable link / URL to send to a teammate. Recipients open the link to receive the doc (or folder subtree) into their own OpenKnowledge install.`,``,"**Publishing is a user act.** Agents do NOT publish projects to GitHub from this tool. When the project has no GitHub remote, this tool returns an error pointing the user at the Share wizard (or `gh repo create` + `git push`) — it does not run those steps itself.",``,`**Parameters:**`,'- `path` — Content-dir-relative target. For a doc, extension-less (trailing `.md`/`.mdx` is stripped; the on-disk file is probed automatically). For a folder, the directory path. The empty string `""` is the content-root sentinel (folder-only).',"- `kind` (optional) — `'doc'` or `'folder'`. Omit to auto-probe disk (`.mdx` → `.md` → directory, first hit wins). REQUIRED when `path` is empty (`\"\"`), since auto-probe cannot disambiguate the root.","- `cwd` (optional) — Project root (see `cwd` description below).",``,"**Preconditions:** project on a named branch (not detached HEAD); origin set to a GitHub remote (`github.com` or a GitHub Enterprise Server host); the branch already pushed to origin."].join(`
816
+ `),M3({ok:I().describe(`Success discriminator.`),shareUrl:P().optional().describe(`Marketing share URL (success only).`),sharedUrl:P().optional().describe(`Unencoded GitHub blob/tree URL (success only).`),branch:P().optional().describe(`Branch the share URL pins to (success only).`),resolvedKind:V([`doc`,`folder`]).optional().describe(`Kind the target resolved to (success only).`),freshness:Sw.optional().describe(`Whether the shared target matches origin (success only): current, stale (unpushed edits), absent (not on origin, a push fixes it), or empty (a folder holding nothing git can track, which no push fixes). Omitted when the probe could not run.`),error:V([`no-remote`,`detached-head`,`branch-not-on-origin`,`non-github-remote`,`invalid-path`,`target-not-found`,`kind-mismatch`,`unknown`]).optional().describe(`Failure code (error path only).`),message:P().optional().describe(`Agent-actionable error message (error path only).`),previewUrl:P().nullable().optional().describe("Route-only preview URL (no host:port): `/#/<doc>` for a doc, `/#/<folder>/` for a folder, `/#/` for the content root. `null` when no UI is running."),previewUrlSource:P().optional().describe(`Internal: preview-URL provenance.`)});const l5="Which level the skill lives at. `project` = lives in this KB (wherever its folder is; shared via git); `global` = user-level under your home dir (available in every project on this machine, not shared).",zye=z({id:P().describe("Location id — editor host id, `agents`, or a custom root path. Pass to `install`."),path:P().describe('Base-relative bundle dir (e.g. ".claude/skills/x"). INFORMATIONAL — for showing a user where a location lives. Skills are addressed by `name` + `scope`: pass `id` to `install`, and read bundle files with `skills({ name, file })`, never by handing this path to `exec` or a native file tool.'),role:V([`source`,`copy`,`symlink`]).describe(`source = the REAL folder (the skill itself); copy = independent folder, auto-refreshed from the source until hand-edited (then it forks); symlink = live link to the source.`),audience:R(P()).optional().describe(`Folders that RESOLVE INTO this location (folder-level symlinks) — their agents read what lands here.`),drift:I().optional().describe(`Something outside OK rewrote this path since OK last wrote it.`)});z({name:P().describe("Skill name (its identity; pass to `edit`/`move`/`delete`/`install`)."),scope:V([`project`,`global`]).describe(l5),description:P().optional().describe(`The skill's one-line description (when present).`),installed:I().describe('Always true for a managed skill — its source folder IS the skill, so it is never "not installed". Read `locations[]` for where it actually lives.'),hosts:R(P()).describe(`Flat location ids (locations[].id), SOURCE first — legacy projection.`),locations:R(zye).describe("Everywhere the skill lives. Exactly one `source` (the skill's real folder); every other entry is a managed copy or symlink of it."),mode:V([`copy`,`link`]).describe("The form a NEW location would take, derived from the ones the skill already uses. Not a stored preference and not a claim about existing locations — read `locations[].role` for those."),conflicts:R(P()).optional().describe(`Host ids where a DIFFERENT skill with this name occupies the slot.`)});const Bye=z({path:P().describe(`Skill-relative path (e.g. "references/tiers.md").`),kind:V([`reference`,`script`]).describe("`script` for anything under scripts/; `reference` for every other bundle file.")});z({name:P().describe(`Skill name (its identity).`),scope:V([`project`,`global`]).describe(l5),description:P().describe(`The skill's one-line description (empty if none).`),body:P().describe(`The SKILL.md body (markdown, frontmatter stripped).`),files:R(Bye).describe("Bundle files beside SKILL.md (path + kind, no inline text). Read one via `file`.")}),z({path:P().describe(`Skill-relative path read.`),kind:V([`reference`,`script`]).describe("`reference` or `script`."),text:P().describe(`Full text of the bundle file.`)}),z({name:P().describe("Skill name to pass as `skill` to `import`."),source:P().describe("Import-ready repository coordinates or website hostname. Pass this exact value to `import`."),description:P().describe(`Marketplace description for deciding whether the skill matches the task.`),installs:F().int().nonnegative().nullable().describe(`skills.sh install count, if known.`),publisher:P().nullable().describe(`Publisher, website, or GitHub owner, if known.`)}),["[Requires: Hocuspocus server] Read-only discovery for SKILLS — the read half of the skill vocabulary (`write`/`edit`/`delete`/`move`/`install` are the mutate half).",``,"This is how you search the marketplace, list managed skills, and read managed skill content. Managed skills are addressed by `name` + `scope`, NOT by path — do NOT `ls`/`cat` `.ok/skills/` or pass raw `.ok/...` paths; `.ok/` is opaque internal state.",``,"Marketplace rows are external candidates; they are NOT managed content until you call `import({ source, skill: name })`, and they are NOT active in editors until `install` projects them.",``,"OpenKnowledge's own built-in `open-knowledge*` skills (e.g. the `open-knowledge` project skill) are runtime skills already loaded in your skill list — they are NOT here, and you never fetch them through this tool.",``,`**Four modes:**`,"- **Marketplace search** (pass `query`): search skills.sh and return import-ready rows (`name`, `source`, `description`, `publisher`, installs). Use when a user asks to find/browse/add an external skill. Then call `import({ source, skill: name })` on the chosen row.","- **List** (omit `name`): every skill across BOTH levels — Project (this KB) and Global (user-level). Returns name, scope, description, installed/hosts.","- **Read skill** (pass `name`): that skill's description + body + a `files` list (`{ path, kind }`, no inline text) of its bundle files (`references/**`, `scripts/**`, and any other file the skill ships). `scope` optional — omitted, it resolves by name (preferring Project when a name exists at both levels).","- **Read file** (pass `name` + `file`): one bundle file's text — the universal read path for references + scripts (no native `cat`)."].join(`
817
817
  `),`${["Create or replace one thing. Pass EXACTLY ONE of `document`, `folder`, `template`, `skill`, or `asset` (or `documents` for a batch of docs).",``,'- `document` — Create or overwrite a doc via the CRDT layer [Requires: Hocuspocus server]. `{ path, content }`, or `{ path, template }` to instantiate from a folder template (mutually exclusive with `content`). Optional `frontmatter` (its own YAML) and `position` (`replace` default for a new doc; required for an existing one) — note supplying `frontmatter` alongside literal `content` forces `position: replace` (the only position that persists a YAML block), overriding an explicit `append`/`prepend`. Example: `{ document: { path: "meetings/standup", content: "# Standup\\n..." } }`.','- `folder` — Create a NEW folder (optionally with its own properties) [Requires: Hocuspocus server]. `{ path, frontmatter? }`. To change an EXISTING folder use `edit`. Example: `{ folder: { path: "ideas" } }`.','- `template` — Create a reusable starting shape for new docs in a folder. `{ path: "<folder>/<name>", content, frontmatter: { title, description?, tags? } }`.','- `skill` — Create or overwrite an agent SKILL: reusable agent guidance you author in OK and `install` into your editors. A NEW skill lands at the project\'s default skill home (e.g. `.agents/skills/<name>/`); an existing one is edited at its real folder. `{ name, description, body, scope? }`. `name` is the identity (lowercase-hyphen); `description` is the trigger (when to use it). Example: `{ skill: { name: "trip-log", description: "Use when logging a fishing trip.", body: "# Steps\\n..." } }`.','- `asset` — Upload a binary (image/file) via the media route [Requires: Hocuspocus server]. `{ path: "<folder>/<file.ext>", content(base64) | source(local path) }`.',"- `documents` — Batch: `[{ path, content?|template?, frontmatter?, position?, summary? }, ...]` written in order; the response reports each.","- `summary` — Optional one-line user-outcome (≤80 chars) for the timeline, for a single `document`/`folder`/`template`/`asset` write. For a `documents` batch, give each entry its own `summary` instead (a top-level `summary` is ignored on the batch path). Avoid secrets or PII — persisted to git history.",``,"Responses may include `structuredContent.document.warnings` (batch: per-entry under `documents[]`) — advisory entries discriminated by `kind`: `content-divergence` / `disk-edit-reconciled` (write-integrity — re-read the doc) and `mermaid-parse-error` (the write landed but that fence will not render — fix it and re-edit)."].join(`
818
- `)}${zq()}`;var u5=i(((e,t)=>{let n=[`nodebuffer`,`arraybuffer`,`fragments`],r=typeof Blob<`u`;r&&n.push(`blob`),t.exports={BINARY_TYPES:n,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:`258EAFA5-E914-47DA-95CA-C5AB0DC85B11`,hasBlob:r,kForOnEventAttribute:Symbol(`kIsForOnEventAttribute`),kListener:Symbol(`kListener`),kStatusCode:Symbol(`status-code`),kWebSocket:Symbol(`websocket`),NOOP:()=>{}}})),d5=i(((e,n)=>{let{EMPTY_BUFFER:r}=u5(),i=Buffer[Symbol.species];function a(e,t){if(e.length===0)return r;if(e.length===1)return e[0];let n=Buffer.allocUnsafe(t),a=0;for(let t=0;t<e.length;t++){let r=e[t];n.set(r,a),a+=r.length}return a<t?new i(n.buffer,n.byteOffset,a):n}function o(e,t,n,r,i){for(let a=0;a<i;a++)n[r+a]=e[a]^t[a&3]}function s(e,t){for(let n=0;n<e.length;n++)e[n]^=t[n&3]}function c(e){return e.length===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.length)}function l(e){if(l.readOnly=!0,Buffer.isBuffer(e))return e;let t;return e instanceof ArrayBuffer?t=new i(e):ArrayBuffer.isView(e)?t=new i(e.buffer,e.byteOffset,e.byteLength):(t=Buffer.from(e),l.readOnly=!1),t}if(n.exports={concat:a,mask:o,toArrayBuffer:c,toBuffer:l,unmask:s},!process.env.WS_NO_BUFFER_UTIL)try{let e=t(`bufferutil`);n.exports.mask=function(t,n,r,i,a){a<48?o(t,n,r,i,a):e.mask(t,n,r,i,a)},n.exports.unmask=function(t,n){t.length<32?s(t,n):e.unmask(t,n)}}catch{}})),Bye=i(((e,t)=>{let n=Symbol(`kDone`),r=Symbol(`kRun`);t.exports=class{constructor(e){this[n]=()=>{this.pending--,this[r]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[r]()}[r](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[n])}}}})),f5=i(((e,n)=>{let r=t(`zlib`),i=d5(),a=Bye(),{kStatusCode:o}=u5(),s=Buffer[Symbol.species],c=Buffer.from([0,0,255,255]),l=Symbol(`permessage-deflate`),u=Symbol(`total-length`),d=Symbol(`callback`),f=Symbol(`buffers`),p=Symbol(`error`),m;n.exports=class{constructor(e){this._options=e||{},this._threshold=this._options.threshold===void 0?1024:this._options.threshold,this._maxPayload=this._options.maxPayload|0,this._isServer=!!this._options.isServer,this._deflate=null,this._inflate=null,this.params=null,m||=new a(this._options.concurrencyLimit===void 0?10:this._options.concurrencyLimit)}static get extensionName(){return`permessage-deflate`}offer(){let e={};return this._options.serverNoContextTakeover&&(e.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(e.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(e.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?e.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits??(e.client_max_window_bits=!0),e}accept(e){return e=this.normalizeParams(e),this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e),this.params}cleanup(){if(this._inflate&&=(this._inflate.close(),null),this._deflate){let e=this._deflate[d];this._deflate.close(),this._deflate=null,e&&e(Error(`The deflate stream was closed while data was being processed`))}}acceptAsServer(e){let t=this._options,n=e.find(e=>!(t.serverNoContextTakeover===!1&&e.server_no_context_takeover||e.server_max_window_bits&&(t.serverMaxWindowBits===!1||typeof t.serverMaxWindowBits==`number`&&t.serverMaxWindowBits>e.server_max_window_bits)||typeof t.clientMaxWindowBits==`number`&&!e.client_max_window_bits));if(!n)throw Error(`None of the extension offers can be accepted`);return t.serverNoContextTakeover&&(n.server_no_context_takeover=!0),t.clientNoContextTakeover&&(n.client_no_context_takeover=!0),typeof t.serverMaxWindowBits==`number`&&(n.server_max_window_bits=t.serverMaxWindowBits),typeof t.clientMaxWindowBits==`number`?n.client_max_window_bits=t.clientMaxWindowBits:(n.client_max_window_bits===!0||t.clientMaxWindowBits===!1)&&delete n.client_max_window_bits,n}acceptAsClient(e){let t=e[0];if(this._options.clientNoContextTakeover===!1&&t.client_no_context_takeover)throw Error(`Unexpected parameter "client_no_context_takeover"`);if(!t.client_max_window_bits)typeof this._options.clientMaxWindowBits==`number`&&(t.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits==`number`&&t.client_max_window_bits>this._options.clientMaxWindowBits)throw Error(`Unexpected or invalid parameter "client_max_window_bits"`);return t}normalizeParams(e){return e.forEach(e=>{Object.keys(e).forEach(t=>{let n=e[t];if(n.length>1)throw Error(`Parameter "${t}" must have only a single value`);if(n=n[0],t===`client_max_window_bits`){if(n!==!0){let e=+n;if(!Number.isInteger(e)||e<8||e>15)throw TypeError(`Invalid value for parameter "${t}": ${n}`);n=e}else if(!this._isServer)throw TypeError(`Invalid value for parameter "${t}": ${n}`)}else if(t===`server_max_window_bits`){let e=+n;if(!Number.isInteger(e)||e<8||e>15)throw TypeError(`Invalid value for parameter "${t}": ${n}`);n=e}else if(t===`client_no_context_takeover`||t===`server_no_context_takeover`){if(n!==!0)throw TypeError(`Invalid value for parameter "${t}": ${n}`)}else throw Error(`Unknown parameter "${t}"`);e[t]=n})}),e}decompress(e,t,n){m.add(r=>{this._decompress(e,t,(e,t)=>{r(),n(e,t)})})}compress(e,t,n){m.add(r=>{this._compress(e,t,(e,t)=>{r(),n(e,t)})})}_decompress(e,t,n){let a=this._isServer?`client`:`server`;if(!this._inflate){let e=`${a}_max_window_bits`,t=typeof this.params[e]==`number`?this.params[e]:r.Z_DEFAULT_WINDOWBITS;this._inflate=r.createInflateRaw({...this._options.zlibInflateOptions,windowBits:t}),this._inflate[l]=this,this._inflate[u]=0,this._inflate[f]=[],this._inflate.on(`error`,_),this._inflate.on(`data`,g)}this._inflate[d]=n,this._inflate.write(e),t&&this._inflate.write(c),this._inflate.flush(()=>{let e=this._inflate[p];if(e){this._inflate.close(),this._inflate=null,n(e);return}let r=i.concat(this._inflate[f],this._inflate[u]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[u]=0,this._inflate[f]=[],t&&this.params[`${a}_no_context_takeover`]&&this._inflate.reset()),n(null,r)})}_compress(e,t,n){let a=this._isServer?`server`:`client`;if(!this._deflate){let e=`${a}_max_window_bits`,t=typeof this.params[e]==`number`?this.params[e]:r.Z_DEFAULT_WINDOWBITS;this._deflate=r.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:t}),this._deflate[u]=0,this._deflate[f]=[],this._deflate.on(`data`,h)}this._deflate[d]=n,this._deflate.write(e),this._deflate.flush(r.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let e=i.concat(this._deflate[f],this._deflate[u]);t&&(e=new s(e.buffer,e.byteOffset,e.length-4)),this._deflate[d]=null,this._deflate[u]=0,this._deflate[f]=[],t&&this.params[`${a}_no_context_takeover`]&&this._deflate.reset(),n(null,e)})}};function h(e){this[f].push(e),this[u]+=e.length}function g(e){if(this[u]+=e.length,this[l]._maxPayload<1||this[u]<=this[l]._maxPayload){this[f].push(e);return}this[p]=RangeError(`Max payload size exceeded`),this[p].code=`WS_ERR_UNSUPPORTED_MESSAGE_LENGTH`,this[p][o]=1009,this.removeListener(`data`,g),this.reset()}function _(e){if(this[l]._inflate=null,this[p]){this[d](this[p]);return}e[o]=1007,this[d](e)}})),p5=i(((e,n)=>{let{isUtf8:r}=t(`buffer`),{hasBlob:i}=u5(),a=[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 o(e){return e>=1e3&&e<=1014&&e!==1004&&e!==1005&&e!==1006||e>=3e3&&e<=4999}function s(e){let t=e.length,n=0;for(;n<t;)if(!(e[n]&128))n++;else if((e[n]&224)==192){if(n+1===t||(e[n+1]&192)!=128||(e[n]&254)==192)return!1;n+=2}else if((e[n]&240)==224){if(n+2>=t||(e[n+1]&192)!=128||(e[n+2]&192)!=128||e[n]===224&&(e[n+1]&224)==128||e[n]===237&&(e[n+1]&224)==160)return!1;n+=3}else if((e[n]&248)==240){if(n+3>=t||(e[n+1]&192)!=128||(e[n+2]&192)!=128||(e[n+3]&192)!=128||e[n]===240&&(e[n+1]&240)==128||e[n]===244&&e[n+1]>143||e[n]>244)return!1;n+=4}else return!1;return!0}function c(e){return i&&typeof e==`object`&&typeof e.arrayBuffer==`function`&&typeof e.type==`string`&&typeof e.stream==`function`&&(e[Symbol.toStringTag]===`Blob`||e[Symbol.toStringTag]===`File`)}if(n.exports={isBlob:c,isValidStatusCode:o,isValidUTF8:s,tokenChars:a},r)n.exports.isValidUTF8=function(e){return e.length<24?s(e):r(e)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let e=t(`utf-8-validate`);n.exports.isValidUTF8=function(t){return t.length<32?s(t):e(t)}}catch{}})),m5=i(((e,n)=>{let{Writable:r}=t(`stream`),i=f5(),{BINARY_TYPES:a,EMPTY_BUFFER:o,kStatusCode:s,kWebSocket:c}=u5(),{concat:l,toArrayBuffer:u,unmask:d}=d5(),{isValidStatusCode:f,isValidUTF8:p}=p5(),m=Buffer[Symbol.species];n.exports=class extends r{constructor(e={}){super(),this._allowSynchronousEvents=e.allowSynchronousEvents===void 0?!0:e.allowSynchronousEvents,this._binaryType=e.binaryType||a[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxBufferedChunks=e.maxBufferedChunks|0,this._maxFragments=e.maxFragments|0,this._maxPayload=e.maxPayload|0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[c]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=0}_write(e,t,n){if(this._opcode===8&&this._state==0)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+=e.length,this._buffers.push(e),this.startLoop(n)}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){let t=this._buffers[0];return this._buffers[0]=new m(t.buffer,t.byteOffset+e,t.length-e),new m(t.buffer,t.byteOffset,e)}let t=Buffer.allocUnsafe(e);do{let n=this._buffers[0],r=t.length-e;e>=n.length?t.set(this._buffers.shift(),r):(t.set(new Uint8Array(n.buffer,n.byteOffset,e),r),this._buffers[0]=new m(n.buffer,n.byteOffset+e,n.length-e)),e-=n.length}while(e>0);return t}startLoop(e){this._loop=!0;do switch(this._state){case 0:this.getInfo(e);break;case 1:this.getPayloadLength16(e);break;case 2:this.getPayloadLength64(e);break;case 3:this.getMask();break;case 4:this.getData(e);break;case 5:case 6:this._loop=!1;return}while(this._loop);this._errored||e()}getInfo(e){if(this._bufferedBytes<2){this._loop=!1;return}let t=this.consume(2);if(t[0]&48){e(this.createError(RangeError,`RSV2 and RSV3 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_2_3`));return}let n=(t[0]&64)==64;if(n&&!this._extensions[i.extensionName]){e(this.createError(RangeError,`RSV1 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_1`));return}if(this._fin=(t[0]&128)==128,this._opcode=t[0]&15,this._payloadLength=t[1]&127,this._opcode===0){if(n){e(this.createError(RangeError,`RSV1 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_1`));return}if(!this._fragmented){e(this.createError(RangeError,`invalid opcode 0`,!0,1002,`WS_ERR_INVALID_OPCODE`));return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){e(this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,`WS_ERR_INVALID_OPCODE`));return}this._compressed=n}else if(this._opcode>7&&this._opcode<11){if(!this._fin){e(this.createError(RangeError,`FIN must be set`,!0,1002,`WS_ERR_EXPECTED_FIN`));return}if(n){e(this.createError(RangeError,`RSV1 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_1`));return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){e(this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,`WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH`));return}}else{e(this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,`WS_ERR_INVALID_OPCODE`));return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(t[1]&128)==128,this._isServer){if(!this._masked){e(this.createError(RangeError,`MASK must be set`,!0,1002,`WS_ERR_EXPECTED_MASK`));return}}else if(this._masked){e(this.createError(RangeError,`MASK must be clear`,!0,1002,`WS_ERR_UNEXPECTED_MASK`));return}this._payloadLength===126?this._state=1:this._payloadLength===127?this._state=2:this.haveLength(e)}getPayloadLength16(e){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(e)}getPayloadLength64(e){if(this._bufferedBytes<8){this._loop=!1;return}let t=this.consume(8),n=t.readUInt32BE(0);if(n>2**21-1){e(this.createError(RangeError,`Unsupported WebSocket frame: payload length > 2^53 - 1`,!1,1009,`WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH`));return}this._payloadLength=n*2**32+t.readUInt32BE(4),this.haveLength(e)}haveLength(e){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)){e(this.createError(RangeError,`Max payload size exceeded`,!1,1009,`WS_ERR_UNSUPPORTED_MESSAGE_LENGTH`));return}this._masked?this._state=3:this._state=4}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=4}getData(e){let t=o;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}t=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0&&d(t,this._mask)}if(this._opcode>7){this.controlMessage(t,e);return}if(this._compressed){this._state=5,this.decompress(t,e);return}if(t.length){if(this._maxFragments>0&&this._fragments.length>=this._maxFragments){e(this.createError(RangeError,`Too many message fragments`,!1,1008,`WS_ERR_TOO_MANY_BUFFERED_PARTS`));return}this._messageLength=this._totalPayloadLength,this._fragments.push(t)}this.dataMessage(e)}decompress(e,t){this._extensions[i.extensionName].decompress(e,this._fin,(e,n)=>{if(e)return t(e);if(n.length){if(this._messageLength+=n.length,this._messageLength>this._maxPayload&&this._maxPayload>0){t(this.createError(RangeError,`Max payload size exceeded`,!1,1009,`WS_ERR_UNSUPPORTED_MESSAGE_LENGTH`));return}if(this._maxFragments>0&&this._fragments.length>=this._maxFragments){t(this.createError(RangeError,`Too many message fragments`,!1,1008,`WS_ERR_TOO_MANY_BUFFERED_PARTS`));return}this._fragments.push(n)}this.dataMessage(t),this._state===0&&this.startLoop(t)})}dataMessage(e){if(!this._fin){this._state=0;return}let t=this._messageLength,n=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let r;r=this._binaryType===`nodebuffer`?l(n,t):this._binaryType===`arraybuffer`?u(l(n,t)):this._binaryType===`blob`?new Blob(n):n,this._allowSynchronousEvents?(this.emit(`message`,r,!0),this._state=0):(this._state=6,setImmediate(()=>{this.emit(`message`,r,!0),this._state=0,this.startLoop(e)}))}else{let r=l(n,t);if(!this._skipUTF8Validation&&!p(r)){e(this.createError(Error,`invalid UTF-8 sequence`,!0,1007,`WS_ERR_INVALID_UTF8`));return}this._state===5||this._allowSynchronousEvents?(this.emit(`message`,r,!1),this._state=0):(this._state=6,setImmediate(()=>{this.emit(`message`,r,!1),this._state=0,this.startLoop(e)}))}}controlMessage(e,t){if(this._opcode===8){if(e.length===0)this._loop=!1,this.emit(`conclude`,1005,o),this.end();else{let n=e.readUInt16BE(0);if(!f(n)){t(this.createError(RangeError,`invalid status code ${n}`,!0,1002,`WS_ERR_INVALID_CLOSE_CODE`));return}let r=new m(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!p(r)){t(this.createError(Error,`invalid UTF-8 sequence`,!0,1007,`WS_ERR_INVALID_UTF8`));return}this._loop=!1,this.emit(`conclude`,n,r),this.end()}this._state=0;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?`ping`:`pong`,e),this._state=0):(this._state=6,setImmediate(()=>{this.emit(this._opcode===9?`ping`:`pong`,e),this._state=0,this.startLoop(t)}))}createError(e,t,n,r,i){this._loop=!1,this._errored=!0;let a=new e(n?`Invalid WebSocket frame: ${t}`:t);return Error.captureStackTrace(a,this.createError),a.code=i,a[s]=r,a}}})),h5=i(((e,n)=>{let{Duplex:r}=t(`stream`),{randomFillSync:i}=t(`crypto`),{types:{isUint8Array:a}}=t(`util`),o=f5(),{EMPTY_BUFFER:s,kWebSocket:c,NOOP:l}=u5(),{isBlob:u,isValidStatusCode:d}=p5(),{mask:f,toBuffer:p}=d5(),m=Symbol(`kByteLength`),h=Buffer.alloc(4),g=8*1024,_,v=g;n.exports=class e{constructor(e,t,n){this._extensions=t||{},n&&(this._generateMask=n,this._maskBuffer=Buffer.alloc(4)),this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=0,this.onerror=l,this[c]=void 0}static frame(e,t){let n,r=!1,a=2,o=!1;t.mask&&(n=t.maskBuffer||h,t.generateMask?t.generateMask(n):(v===g&&(_===void 0&&(_=Buffer.alloc(g)),i(_,0,g),v=0),n[0]=_[v++],n[1]=_[v++],n[2]=_[v++],n[3]=_[v++]),o=(n[0]|n[1]|n[2]|n[3])===0,a=6);let s;typeof e==`string`?(!t.mask||o)&&t[m]!==void 0?s=t[m]:(e=Buffer.from(e),s=e.length):(s=e.length,r=t.mask&&t.readOnly&&!o);let c=s;s>=65536?(a+=8,c=127):s>125&&(a+=2,c=126);let l=Buffer.allocUnsafe(r?s+a:a);return l[0]=t.fin?t.opcode|128:t.opcode,t.rsv1&&(l[0]|=64),l[1]=c,c===126?l.writeUInt16BE(s,2):c===127&&(l[2]=l[3]=0,l.writeUIntBE(s,4,6)),!t.mask||(l[1]|=128,l[a-4]=n[0],l[a-3]=n[1],l[a-2]=n[2],l[a-1]=n[3],o)?[l,e]:r?(f(e,n,l,a,s),[l]):(f(e,n,e,0,s),[l,e])}close(t,n,r,i){let o;if(t===void 0)o=s;else if(typeof t!=`number`||!d(t))throw TypeError(`First argument must be a valid error code number`);else if(n===void 0||!n.length)o=Buffer.allocUnsafe(2),o.writeUInt16BE(t,0);else{let e=Buffer.byteLength(n);if(e>123)throw RangeError(`The message must not be greater than 123 bytes`);if(o=Buffer.allocUnsafe(2+e),o.writeUInt16BE(t,0),typeof n==`string`)o.write(n,2);else if(a(n))o.set(n,2);else throw TypeError(`Second argument must be a string or a Uint8Array`)}let c={[m]:o.length,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state===0?this.sendFrame(e.frame(o,c),i):this.enqueue([this.dispatch,o,!1,c,i])}ping(t,n,r){let i,a;if(typeof t==`string`?(i=Buffer.byteLength(t),a=!1):u(t)?(i=t.size,a=!1):(t=p(t),i=t.length,a=p.readOnly),i>125)throw RangeError(`The data size must not be greater than 125 bytes`);let o={[m]:i,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:9,readOnly:a,rsv1:!1};u(t)?this._state===0?this.getBlobData(t,!1,o,r):this.enqueue([this.getBlobData,t,!1,o,r]):this._state===0?this.sendFrame(e.frame(t,o),r):this.enqueue([this.dispatch,t,!1,o,r])}pong(t,n,r){let i,a;if(typeof t==`string`?(i=Buffer.byteLength(t),a=!1):u(t)?(i=t.size,a=!1):(t=p(t),i=t.length,a=p.readOnly),i>125)throw RangeError(`The data size must not be greater than 125 bytes`);let o={[m]:i,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:10,readOnly:a,rsv1:!1};u(t)?this._state===0?this.getBlobData(t,!1,o,r):this.enqueue([this.getBlobData,t,!1,o,r]):this._state===0?this.sendFrame(e.frame(t,o),r):this.enqueue([this.dispatch,t,!1,o,r])}send(e,t,n){let r=this._extensions[o.extensionName],i=t.binary?2:1,a=t.compress,s,c;typeof e==`string`?(s=Buffer.byteLength(e),c=!1):u(e)?(s=e.size,c=!1):(e=p(e),s=e.length,c=p.readOnly),this._firstFragment?(this._firstFragment=!1,a&&r&&r.params[r._isServer?`server_no_context_takeover`:`client_no_context_takeover`]&&(a=s>=r._threshold),this._compress=a):(a=!1,i=0),t.fin&&(this._firstFragment=!0);let l={[m]:s,fin:t.fin,generateMask:this._generateMask,mask:t.mask,maskBuffer:this._maskBuffer,opcode:i,readOnly:c,rsv1:a};u(e)?this._state===0?this.getBlobData(e,this._compress,l,n):this.enqueue([this.getBlobData,e,this._compress,l,n]):this._state===0?this.dispatch(e,this._compress,l,n):this.enqueue([this.dispatch,e,this._compress,l,n])}getBlobData(t,n,r,i){this._bufferedBytes+=r[m],this._state=2,t.arrayBuffer().then(t=>{if(this._socket.destroyed){let e=Error(`The socket was closed while the blob was being read`);process.nextTick(y,this,e,i);return}this._bufferedBytes-=r[m];let a=p(t);n?this.dispatch(a,n,r,i):(this._state=0,this.sendFrame(e.frame(a,r),i),this.dequeue())}).catch(e=>{process.nextTick(b,this,e,i)})}dispatch(t,n,r,i){if(!n){this.sendFrame(e.frame(t,r),i);return}let a=this._extensions[o.extensionName];this._bufferedBytes+=r[m],this._state=1,a.compress(t,r.fin,(t,n)=>{if(this._socket.destroyed){let e=Error(`The socket was closed while data was being compressed`);y(this,e,i);return}this._bufferedBytes-=r[m],this._state=0,r.readOnly=!1,this.sendFrame(e.frame(n,r),i),this.dequeue()})}dequeue(){for(;this._state===0&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[3][m],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][m],this._queue.push(e)}sendFrame(e,t){e.length===2?(this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],t),this._socket.uncork()):this._socket.write(e[0],t)}};function y(e,t,n){typeof n==`function`&&n(t);for(let n=0;n<e._queue.length;n++){let r=e._queue[n],i=r[r.length-1];typeof i==`function`&&i(t)}}function b(e,t,n){y(e,t,n),e.onerror(t)}})),Vye=i(((e,t)=>{let{kForOnEventAttribute:n,kListener:r}=u5(),i=Symbol(`kCode`),a=Symbol(`kData`),o=Symbol(`kError`),s=Symbol(`kMessage`),c=Symbol(`kReason`),l=Symbol(`kTarget`),u=Symbol(`kType`),d=Symbol(`kWasClean`);var f=class{constructor(e){this[l]=null,this[u]=e}get target(){return this[l]}get type(){return this[u]}};Object.defineProperty(f.prototype,`target`,{enumerable:!0}),Object.defineProperty(f.prototype,`type`,{enumerable:!0});var p=class extends f{constructor(e,t={}){super(e),this[i]=t.code===void 0?0:t.code,this[c]=t.reason===void 0?``:t.reason,this[d]=t.wasClean===void 0?!1:t.wasClean}get code(){return this[i]}get reason(){return this[c]}get wasClean(){return this[d]}};Object.defineProperty(p.prototype,`code`,{enumerable:!0}),Object.defineProperty(p.prototype,`reason`,{enumerable:!0}),Object.defineProperty(p.prototype,`wasClean`,{enumerable:!0});var m=class extends f{constructor(e,t={}){super(e),this[o]=t.error===void 0?null:t.error,this[s]=t.message===void 0?``:t.message}get error(){return this[o]}get message(){return this[s]}};Object.defineProperty(m.prototype,`error`,{enumerable:!0}),Object.defineProperty(m.prototype,`message`,{enumerable:!0});var h=class extends f{constructor(e,t={}){super(e),this[a]=t.data===void 0?null:t.data}get data(){return this[a]}};Object.defineProperty(h.prototype,`data`,{enumerable:!0}),t.exports={CloseEvent:p,ErrorEvent:m,Event:f,EventTarget:{addEventListener(e,t,i={}){for(let a of this.listeners(e))if(!i[n]&&a[r]===t&&!a[n])return;let a;if(e===`message`)a=function(e,n){let r=new h(`message`,{data:n?e:e.toString()});r[l]=this,g(t,this,r)};else if(e===`close`)a=function(e,n){let r=new p(`close`,{code:e,reason:n.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});r[l]=this,g(t,this,r)};else if(e===`error`)a=function(e){let n=new m(`error`,{error:e,message:e.message});n[l]=this,g(t,this,n)};else if(e===`open`)a=function(){let e=new f(`open`);e[l]=this,g(t,this,e)};else return;a[n]=!!i[n],a[r]=t,i.once?this.once(e,a):this.on(e,a)},removeEventListener(e,t){for(let i of this.listeners(e))if(i[r]===t&&!i[n]){this.removeListener(e,i);break}}},MessageEvent:h};function g(e,t,n){typeof e==`object`&&e.handleEvent?e.handleEvent.call(e,n):e.call(t,n)}})),g5=i(((e,t)=>{let{tokenChars:n}=p5();function r(e,t,n){e[t]===void 0?e[t]=[n]:e[t].push(n)}function i(e){let t=Object.create(null),i=Object.create(null),a=!1,o=!1,s=!1,c,l,u=-1,d=-1,f=-1,p=0;for(;p<e.length;p++)if(d=e.charCodeAt(p),c===void 0)if(f===-1&&n[d]===1)u===-1&&(u=p);else if(p!==0&&(d===32||d===9))f===-1&&u!==-1&&(f=p);else if(d===59||d===44){if(u===-1)throw SyntaxError(`Unexpected character at index ${p}`);f===-1&&(f=p);let n=e.slice(u,f);d===44?(r(t,n,i),i=Object.create(null)):c=n,u=f=-1}else throw SyntaxError(`Unexpected character at index ${p}`);else if(l===void 0)if(f===-1&&n[d]===1)u===-1&&(u=p);else if(d===32||d===9)f===-1&&u!==-1&&(f=p);else if(d===59||d===44){if(u===-1)throw SyntaxError(`Unexpected character at index ${p}`);f===-1&&(f=p),r(i,e.slice(u,f),!0),d===44&&(r(t,c,i),i=Object.create(null),c=void 0),u=f=-1}else if(d===61&&u!==-1&&f===-1)l=e.slice(u,p),u=f=-1;else throw SyntaxError(`Unexpected character at index ${p}`);else if(o){if(n[d]!==1)throw SyntaxError(`Unexpected character at index ${p}`);u===-1?u=p:a||=!0,o=!1}else if(s)if(n[d]===1)u===-1&&(u=p);else if(d===34&&u!==-1)s=!1,f=p;else if(d===92)o=!0;else throw SyntaxError(`Unexpected character at index ${p}`);else if(d===34&&e.charCodeAt(p-1)===61)s=!0;else if(f===-1&&n[d]===1)u===-1&&(u=p);else if(u!==-1&&(d===32||d===9))f===-1&&(f=p);else if(d===59||d===44){if(u===-1)throw SyntaxError(`Unexpected character at index ${p}`);f===-1&&(f=p);let n=e.slice(u,f);a&&=(n=n.replace(/\\/g,``),!1),r(i,l,n),d===44&&(r(t,c,i),i=Object.create(null),c=void 0),l=void 0,u=f=-1}else throw SyntaxError(`Unexpected character at index ${p}`);if(u===-1||s||d===32||d===9)throw SyntaxError(`Unexpected end of input`);f===-1&&(f=p);let m=e.slice(u,f);return c===void 0?r(t,m,i):(l===void 0?r(i,m,!0):a?r(i,l,m.replace(/\\/g,``)):r(i,l,m),r(t,c,i)),t}function a(e){return Object.keys(e).map(t=>{let n=e[t];return Array.isArray(n)||(n=[n]),n.map(e=>[t].concat(Object.keys(e).map(t=>{let n=e[t];return Array.isArray(n)||(n=[n]),n.map(e=>e===!0?t:`${t}=${e}`).join(`; `)})).join(`; `)).join(`, `)}).join(`, `)}t.exports={format:a,parse:i}})),_5=i(((e,n)=>{let r=t(`events`),i=t(`https`),a=t(`http`),o=t(`net`),s=t(`tls`),{randomBytes:c,createHash:l}=t(`crypto`),{Duplex:u,Readable:d}=t(`stream`),{URL:f}=t(`url`),p=f5(),m=m5(),h=h5(),{isBlob:g}=p5(),{BINARY_TYPES:_,CLOSE_TIMEOUT:v,EMPTY_BUFFER:y,GUID:b,kForOnEventAttribute:x,kListener:S,kStatusCode:C,kWebSocket:w,NOOP:T}=u5(),{EventTarget:{addEventListener:E,removeEventListener:D}}=Vye(),{format:ee,parse:te}=g5(),{toBuffer:ne}=d5(),re=Symbol(`kAborted`),ie=[8,13],ae=[`CONNECTING`,`OPEN`,`CLOSING`,`CLOSED`],oe=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;var se=class e extends r{constructor(t,n,r){super(),this._binaryType=_[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=y,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._autoPong=r.autoPong,this._closeTimeout=r.closeTimeout,this._isServer=!0):(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,n===void 0?n=[]:Array.isArray(n)||(typeof n==`object`&&n?(r=n,n=[]):n=[n]),ce(this,t,n,r))}get binaryType(){return this._binaryType}set binaryType(e){_.includes(e)&&(this._binaryType=e,this._receiver&&(this._receiver._binaryType=e))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(t,n,r){let i=new m({allowSynchronousEvents:r.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxBufferedChunks:r.maxBufferedChunks,maxFragments:r.maxFragments,maxPayload:r.maxPayload,skipUTF8Validation:r.skipUTF8Validation}),a=new h(t,this._extensions,r.generateMask);this._receiver=i,this._sender=a,this._socket=t,i[w]=this,a[w]=this,t[w]=this,i.on(`conclude`,A),i.on(`drain`,fe),i.on(`error`,pe),i.on(`message`,he),i.on(`ping`,j),i.on(`pong`,M),a.onerror=_e,t.setTimeout&&t.setTimeout(0),t.setNoDelay&&t.setNoDelay(),n.length>0&&t.unshift(n),t.on(`close`,ye),t.on(`data`,be),t.on(`end`,xe),t.on(`error`,Se),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[p.extensionName]&&this._extensions[p.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=e.CLOSED,this.emit(`close`,this._closeCode,this._closeMessage)}close(t,n){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){de(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,n,!this._isServer,e=>{e||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),ve(this)}}pause(){this.readyState===e.CONNECTING||this.readyState===e.CLOSED||(this._paused=!0,this._socket.pause())}ping(t,n,r){if(this.readyState===e.CONNECTING)throw Error(`WebSocket is not open: readyState 0 (CONNECTING)`);if(typeof t==`function`?(r=t,t=n=void 0):typeof n==`function`&&(r=n,n=void 0),typeof t==`number`&&(t=t.toString()),this.readyState!==e.OPEN){k(this,t,r);return}n===void 0&&(n=!this._isServer),this._sender.ping(t||y,n,r)}pong(t,n,r){if(this.readyState===e.CONNECTING)throw Error(`WebSocket is not open: readyState 0 (CONNECTING)`);if(typeof t==`function`?(r=t,t=n=void 0):typeof n==`function`&&(r=n,n=void 0),typeof t==`number`&&(t=t.toString()),this.readyState!==e.OPEN){k(this,t,r);return}n===void 0&&(n=!this._isServer),this._sender.pong(t||y,n,r)}resume(){this.readyState===e.CONNECTING||this.readyState===e.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(t,n,r){if(this.readyState===e.CONNECTING)throw Error(`WebSocket is not open: readyState 0 (CONNECTING)`);if(typeof n==`function`&&(r=n,n={}),typeof t==`number`&&(t=t.toString()),this.readyState!==e.OPEN){k(this,t,r);return}let i={binary:typeof t!=`string`,mask:!this._isServer,compress:!0,fin:!0,...n};this._extensions[p.extensionName]||(i.compress=!1),this._sender.send(t||y,i,r)}terminate(){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){de(this,this._req,`WebSocket was closed before the connection was established`);return}this._socket&&(this._readyState=e.CLOSING,this._socket.destroy())}}};Object.defineProperty(se,`CONNECTING`,{enumerable:!0,value:ae.indexOf(`CONNECTING`)}),Object.defineProperty(se.prototype,`CONNECTING`,{enumerable:!0,value:ae.indexOf(`CONNECTING`)}),Object.defineProperty(se,`OPEN`,{enumerable:!0,value:ae.indexOf(`OPEN`)}),Object.defineProperty(se.prototype,`OPEN`,{enumerable:!0,value:ae.indexOf(`OPEN`)}),Object.defineProperty(se,`CLOSING`,{enumerable:!0,value:ae.indexOf(`CLOSING`)}),Object.defineProperty(se.prototype,`CLOSING`,{enumerable:!0,value:ae.indexOf(`CLOSING`)}),Object.defineProperty(se,`CLOSED`,{enumerable:!0,value:ae.indexOf(`CLOSED`)}),Object.defineProperty(se.prototype,`CLOSED`,{enumerable:!0,value:ae.indexOf(`CLOSED`)}),[`binaryType`,`bufferedAmount`,`extensions`,`isPaused`,`protocol`,`readyState`,`url`].forEach(e=>{Object.defineProperty(se.prototype,e,{enumerable:!0})}),[`open`,`error`,`close`,`message`].forEach(e=>{Object.defineProperty(se.prototype,`on${e}`,{enumerable:!0,get(){for(let t of this.listeners(e))if(t[x])return t[S];return null},set(t){for(let t of this.listeners(e))if(t[x]){this.removeListener(e,t);break}typeof t==`function`&&this.addEventListener(e,t,{[x]:!0})}})}),se.prototype.addEventListener=E,se.prototype.removeEventListener=D,n.exports=se;function ce(e,t,n,r){let o={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:v,protocolVersion:ie[1],maxBufferedChunks:1024*1024,maxFragments:128*1024,maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...r,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,!ie.includes(o.protocolVersion))throw RangeError(`Unsupported protocol version: ${o.protocolVersion} (supported versions: ${ie.join(`, `)})`);let s;if(t instanceof f)s=t;else try{s=new f(t)}catch{throw SyntaxError(`Invalid URL: ${t}`)}s.protocol===`http:`?s.protocol=`ws:`:s.protocol===`https:`&&(s.protocol=`wss:`),e._url=s.href;let u=s.protocol===`wss:`,d=s.protocol===`ws+unix:`,m;if(s.protocol!==`ws:`&&!u&&!d?m=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:d&&!s.pathname?m=`The URL's pathname is empty`:s.hash&&(m=`The URL contains a fragment identifier`),m){let t=SyntaxError(m);if(e._redirects===0)throw t;O(e,t);return}let h=u?443:80,g=c(16).toString(`base64`),_=u?i.request:a.request,y=new Set,x;if(o.createConnection=o.createConnection||(u?ue:le),o.defaultPort=o.defaultPort||h,o.port=s.port||h,o.host=s.hostname.startsWith(`[`)?s.hostname.slice(1,-1):s.hostname,o.headers={...o.headers,"Sec-WebSocket-Version":o.protocolVersion,"Sec-WebSocket-Key":g,Connection:`Upgrade`,Upgrade:`websocket`},o.path=s.pathname+s.search,o.timeout=o.handshakeTimeout,o.perMessageDeflate&&(x=new p({...o.perMessageDeflate,isServer:!1,maxPayload:o.maxPayload}),o.headers[`Sec-WebSocket-Extensions`]=ee({[p.extensionName]:x.offer()})),n.length){for(let e of n){if(typeof e!=`string`||!oe.test(e)||y.has(e))throw SyntaxError(`An invalid or duplicated subprotocol was specified`);y.add(e)}o.headers[`Sec-WebSocket-Protocol`]=n.join(`,`)}if(o.origin&&(o.protocolVersion<13?o.headers[`Sec-WebSocket-Origin`]=o.origin:o.headers.Origin=o.origin),(s.username||s.password)&&(o.auth=`${s.username}:${s.password}`),d){let e=o.path.split(`:`);o.socketPath=e[0],o.path=e[1]}let S;if(o.followRedirects){if(e._redirects===0){e._originalIpc=d,e._originalSecure=u,e._originalHostOrSocketPath=d?o.socketPath:s.host;let t=r&&r.headers;if(r={...r,headers:{}},t)for(let[e,n]of Object.entries(t))r.headers[e.toLowerCase()]=n}else if(e.listenerCount(`redirect`)===0){let t=d?e._originalIpc?o.socketPath===e._originalHostOrSocketPath:!1:e._originalIpc?!1:s.host===e._originalHostOrSocketPath;(!t||e._originalSecure&&!u)&&(delete o.headers.authorization,delete o.headers.cookie,t||delete o.headers.host,o.auth=void 0)}o.auth&&!r.headers.authorization&&(r.headers.authorization=`Basic `+Buffer.from(o.auth).toString(`base64`)),S=e._req=_(o),e._redirects&&e.emit(`redirect`,e.url,S)}else S=e._req=_(o);o.timeout&&S.on(`timeout`,()=>{de(e,S,`Opening handshake has timed out`)}),S.on(`error`,t=>{S===null||S[re]||(S=e._req=null,O(e,t))}),S.on(`response`,i=>{let a=i.headers.location,s=i.statusCode;if(a&&o.followRedirects&&s>=300&&s<400){if(++e._redirects>o.maxRedirects){de(e,S,`Maximum redirects exceeded`);return}S.abort();let i;try{i=new f(a,t)}catch{O(e,SyntaxError(`Invalid URL: ${a}`));return}ce(e,i,n,r)}else e.emit(`unexpected-response`,S,i)||de(e,S,`Unexpected server response: ${i.statusCode}`)}),S.on(`upgrade`,(t,n,r)=>{if(e.emit(`upgrade`,t),e.readyState!==se.CONNECTING)return;S=e._req=null;let i=t.headers.upgrade;if(i===void 0||i.toLowerCase()!==`websocket`){de(e,n,`Invalid Upgrade header`);return}let a=l(`sha1`).update(g+b).digest(`base64`);if(t.headers[`sec-websocket-accept`]!==a){de(e,n,`Invalid Sec-WebSocket-Accept header`);return}let s=t.headers[`sec-websocket-protocol`],c;if(s===void 0?y.size&&(c=`Server sent no subprotocol`):y.size?y.has(s)||(c=`Server sent an invalid subprotocol`):c=`Server sent a subprotocol but none was requested`,c){de(e,n,c);return}s&&(e._protocol=s);let u=t.headers[`sec-websocket-extensions`];if(u!==void 0){if(!x){de(e,n,`Server sent a Sec-WebSocket-Extensions header but no extension was requested`);return}let t;try{t=te(u)}catch{de(e,n,`Invalid Sec-WebSocket-Extensions header`);return}let r=Object.keys(t);if(r.length!==1||r[0]!==p.extensionName){de(e,n,`Server indicated an extension that was not requested`);return}try{x.accept(t[p.extensionName])}catch{de(e,n,`Invalid Sec-WebSocket-Extensions header`);return}e._extensions[p.extensionName]=x}e.setSocket(n,r,{allowSynchronousEvents:o.allowSynchronousEvents,generateMask:o.generateMask,maxBufferedChunks:o.maxBufferedChunks,maxFragments:o.maxFragments,maxPayload:o.maxPayload,skipUTF8Validation:o.skipUTF8Validation})}),o.finishRequest?o.finishRequest(S,e):S.end()}function O(e,t){e._readyState=se.CLOSING,e._errorEmitted=!0,e.emit(`error`,t),e.emitClose()}function le(e){return e.path=e.socketPath,o.connect(e)}function ue(e){return e.path=void 0,!e.servername&&e.servername!==``&&(e.servername=o.isIP(e.host)?``:e.host),s.connect(e)}function de(e,t,n){e._readyState=se.CLOSING;let r=Error(n);Error.captureStackTrace(r,de),t.setHeader?(t[re]=!0,t.abort(),t.socket&&!t.socket.destroyed&&t.socket.destroy(),process.nextTick(O,e,r)):(t.destroy(r),t.once(`error`,e.emit.bind(e,`error`)),t.once(`close`,e.emitClose.bind(e)))}function k(e,t,n){if(t){let n=g(t)?t.size:ne(t).length;e._socket?e._sender._bufferedBytes+=n:e._bufferedAmount+=n}if(n){let t=Error(`WebSocket is not open: readyState ${e.readyState} (${ae[e.readyState]})`);process.nextTick(n,t)}}function A(e,t){let n=this[w];n._closeFrameReceived=!0,n._closeMessage=t,n._closeCode=e,n._socket[w]!==void 0&&(n._socket.removeListener(`data`,be),process.nextTick(ge,n._socket),e===1005?n.close():n.close(e,t))}function fe(){let e=this[w];e.isPaused||e._socket.resume()}function pe(e){let t=this[w];t._socket[w]!==void 0&&(t._socket.removeListener(`data`,be),process.nextTick(ge,t._socket),t.close(e[C])),t._errorEmitted||(t._errorEmitted=!0,t.emit(`error`,e))}function me(){this[w].emitClose()}function he(e,t){this[w].emit(`message`,e,t)}function j(e){let t=this[w];t._autoPong&&t.pong(e,!this._isServer,T),t.emit(`ping`,e)}function M(e){this[w].emit(`pong`,e)}function ge(e){e.resume()}function _e(e){let t=this[w];t.readyState!==se.CLOSED&&(t.readyState===se.OPEN&&(t._readyState=se.CLOSING,ve(t)),this._socket.end(),t._errorEmitted||(t._errorEmitted=!0,t.emit(`error`,e)))}function ve(e){e._closeTimer=setTimeout(e._socket.destroy.bind(e._socket),e._closeTimeout)}function ye(){let e=this[w];if(this.removeListener(`close`,ye),this.removeListener(`data`,be),this.removeListener(`end`,xe),e._readyState=se.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[w]=void 0,clearTimeout(e._closeTimer),e._receiver._writableState.finished||e._receiver._writableState.errorEmitted?e.emitClose():(e._receiver.on(`error`,me),e._receiver.on(`finish`,me))}function be(e){this[w]._receiver.write(e)||this.pause()}function xe(){let e=this[w];e._readyState=se.CLOSING,e._receiver.end(),this.end()}function Se(){let e=this[w];this.removeListener(`error`,Se),this.on(`error`,T),e&&(e._readyState=se.CLOSING,this.destroy())}})),Hye=i(((e,n)=>{_5();let{Duplex:r}=t(`stream`);function i(e){e.emit(`close`)}function a(){!this.destroyed&&this._writableState.finished&&this.destroy()}function o(e){this.removeListener(`error`,o),this.destroy(),this.listenerCount(`error`)===0&&this.emit(`error`,e)}function s(e,t){let n=!0,s=new r({...t,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return e.on(`message`,function(t,n){let r=!n&&s._readableState.objectMode?t.toString():t;s.push(r)||e.pause()}),e.once(`error`,function(e){s.destroyed||(n=!1,s.destroy(e))}),e.once(`close`,function(){s.destroyed||s.push(null)}),s._destroy=function(t,r){if(e.readyState===e.CLOSED){r(t),process.nextTick(i,s);return}let a=!1;e.once(`error`,function(e){a=!0,r(e)}),e.once(`close`,function(){a||r(t),process.nextTick(i,s)}),n&&e.terminate()},s._final=function(t){if(e.readyState===e.CONNECTING){e.once(`open`,function(){s._final(t)});return}e._socket!==null&&(e._socket._writableState.finished?(t(),s._readableState.endEmitted&&s.destroy()):(e._socket.once(`finish`,function(){t()}),e.close()))},s._read=function(){e.isPaused&&e.resume()},s._write=function(t,n,r){if(e.readyState===e.CONNECTING){e.once(`open`,function(){s._write(t,n,r)});return}e.send(t,r)},s.on(`end`,a),s.on(`error`,o),s}n.exports=s})),v5=i(((e,t)=>{let{tokenChars:n}=p5();function r(e){let t=new Set,r=-1,i=-1,a=0;for(;a<e.length;a++){let o=e.charCodeAt(a);if(i===-1&&n[o]===1)r===-1&&(r=a);else if(a!==0&&(o===32||o===9))i===-1&&r!==-1&&(i=a);else if(o===44){if(r===-1)throw SyntaxError(`Unexpected character at index ${a}`);i===-1&&(i=a);let n=e.slice(r,i);if(t.has(n))throw SyntaxError(`The "${n}" subprotocol is duplicated`);t.add(n),r=i=-1}else throw SyntaxError(`Unexpected character at index ${a}`)}if(r===-1||i!==-1)throw SyntaxError(`Unexpected end of input`);let o=e.slice(r,a);if(t.has(o))throw SyntaxError(`The "${o}" subprotocol is duplicated`);return t.add(o),t}t.exports={parse:r}})),Uye=i(((e,n)=>{let r=t(`events`),i=t(`http`),{Duplex:a}=t(`stream`),{createHash:o}=t(`crypto`),s=g5(),c=f5(),l=v5(),u=_5(),{CLOSE_TIMEOUT:d,GUID:f,kWebSocket:p}=u5(),m=/^[+/0-9A-Za-z]{22}==$/;n.exports=class extends r{constructor(e,t){if(super(),e={allowSynchronousEvents:!0,autoPong:!0,maxBufferedChunks:1024*1024,maxFragments:128*1024,maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:d,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:u,...e},e.port==null&&!e.server&&!e.noServer||e.port!=null&&(e.server||e.noServer)||e.server&&e.noServer)throw TypeError(`One and only one of the "port", "server", or "noServer" options must be specified`);if(e.port==null?e.server&&(this._server=e.server):(this._server=i.createServer((e,t)=>{let n=i.STATUS_CODES[426];t.writeHead(426,{"Content-Length":n.length,"Content-Type":`text/plain`}),t.end(n)}),this._server.listen(e.port,e.host,e.backlog,t)),this._server){let e=this.emit.bind(this,`connection`);this._removeListeners=h(this._server,{listening:this.emit.bind(this,`listening`),error:this.emit.bind(this,`error`),upgrade:(t,n,r)=>{this.handleUpgrade(t,n,r,e)}})}e.perMessageDeflate===!0&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=0}address(){if(this.options.noServer)throw Error(`The server is operating in "noServer" mode`);return this._server?this._server.address():null}close(e){if(this._state===2){e&&this.once(`close`,()=>{e(Error(`The server is not running`))}),process.nextTick(g,this);return}if(e&&this.once(`close`,e),this._state!==1)if(this._state=1,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(g,this);else{let e=this._server;this._removeListeners(),this._removeListeners=this._server=null,e.close(()=>{g(this)})}}shouldHandle(e){if(this.options.path){let t=e.url.indexOf(`?`);if((t===-1?e.url:e.url.slice(0,t))!==this.options.path)return!1}return!0}handleUpgrade(e,t,n,r){t.on(`error`,_);let i=e.headers[`sec-websocket-key`],a=e.headers.upgrade,o=+e.headers[`sec-websocket-version`];if(e.method!==`GET`){y(this,e,t,405,`Invalid HTTP method`);return}if(a===void 0||a.toLowerCase()!==`websocket`){y(this,e,t,400,`Invalid Upgrade header`);return}if(i===void 0||!m.test(i)){y(this,e,t,400,`Missing or invalid Sec-WebSocket-Key header`);return}if(o!==13&&o!==8){y(this,e,t,400,`Missing or invalid Sec-WebSocket-Version header`,{"Sec-WebSocket-Version":`13, 8`});return}if(!this.shouldHandle(e)){v(t,400);return}let u=e.headers[`sec-websocket-protocol`],d=new Set;if(u!==void 0)try{d=l.parse(u)}catch{y(this,e,t,400,`Invalid Sec-WebSocket-Protocol header`);return}let f=e.headers[`sec-websocket-extensions`],p={};if(this.options.perMessageDeflate&&f!==void 0){let n=new c({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let e=s.parse(f);e[c.extensionName]&&(n.accept(e[c.extensionName]),p[c.extensionName]=n)}catch{y(this,e,t,400,`Invalid or unacceptable Sec-WebSocket-Extensions header`);return}}if(this.options.verifyClient){let a={origin:e.headers[`${o===8?`sec-websocket-origin`:`origin`}`],secure:!!(e.socket.authorized||e.socket.encrypted),req:e};if(this.options.verifyClient.length===2){this.options.verifyClient(a,(a,o,s,c)=>{if(!a)return v(t,o||401,s,c);this.completeUpgrade(p,i,d,e,t,n,r)});return}if(!this.options.verifyClient(a))return v(t,401)}this.completeUpgrade(p,i,d,e,t,n,r)}completeUpgrade(e,t,n,r,i,a,l){if(!i.readable||!i.writable)return i.destroy();if(i[p])throw Error(`server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration`);if(this._state>0)return v(i,503);let u=[`HTTP/1.1 101 Switching Protocols`,`Upgrade: websocket`,`Connection: Upgrade`,`Sec-WebSocket-Accept: ${o(`sha1`).update(t+f).digest(`base64`)}`],d=new this.options.WebSocket(null,void 0,this.options);if(n.size){let e=this.options.handleProtocols?this.options.handleProtocols(n,r):n.values().next().value;e&&(u.push(`Sec-WebSocket-Protocol: ${e}`),d._protocol=e)}if(e[c.extensionName]){let t=e[c.extensionName].params,n=s.format({[c.extensionName]:[t]});u.push(`Sec-WebSocket-Extensions: ${n}`),d._extensions=e}this.emit(`headers`,u,r),i.write(u.concat(`\r
818
+ `)}${zq()}`;var u5=i(((e,t)=>{let n=[`nodebuffer`,`arraybuffer`,`fragments`],r=typeof Blob<`u`;r&&n.push(`blob`),t.exports={BINARY_TYPES:n,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:`258EAFA5-E914-47DA-95CA-C5AB0DC85B11`,hasBlob:r,kForOnEventAttribute:Symbol(`kIsForOnEventAttribute`),kListener:Symbol(`kListener`),kStatusCode:Symbol(`status-code`),kWebSocket:Symbol(`websocket`),NOOP:()=>{}}})),d5=i(((e,n)=>{let{EMPTY_BUFFER:r}=u5(),i=Buffer[Symbol.species];function a(e,t){if(e.length===0)return r;if(e.length===1)return e[0];let n=Buffer.allocUnsafe(t),a=0;for(let t=0;t<e.length;t++){let r=e[t];n.set(r,a),a+=r.length}return a<t?new i(n.buffer,n.byteOffset,a):n}function o(e,t,n,r,i){for(let a=0;a<i;a++)n[r+a]=e[a]^t[a&3]}function s(e,t){for(let n=0;n<e.length;n++)e[n]^=t[n&3]}function c(e){return e.length===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.length)}function l(e){if(l.readOnly=!0,Buffer.isBuffer(e))return e;let t;return e instanceof ArrayBuffer?t=new i(e):ArrayBuffer.isView(e)?t=new i(e.buffer,e.byteOffset,e.byteLength):(t=Buffer.from(e),l.readOnly=!1),t}if(n.exports={concat:a,mask:o,toArrayBuffer:c,toBuffer:l,unmask:s},!process.env.WS_NO_BUFFER_UTIL)try{let e=t(`bufferutil`);n.exports.mask=function(t,n,r,i,a){a<48?o(t,n,r,i,a):e.mask(t,n,r,i,a)},n.exports.unmask=function(t,n){t.length<32?s(t,n):e.unmask(t,n)}}catch{}})),Vye=i(((e,t)=>{let n=Symbol(`kDone`),r=Symbol(`kRun`);t.exports=class{constructor(e){this[n]=()=>{this.pending--,this[r]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[r]()}[r](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[n])}}}})),f5=i(((e,n)=>{let r=t(`zlib`),i=d5(),a=Vye(),{kStatusCode:o}=u5(),s=Buffer[Symbol.species],c=Buffer.from([0,0,255,255]),l=Symbol(`permessage-deflate`),u=Symbol(`total-length`),d=Symbol(`callback`),f=Symbol(`buffers`),p=Symbol(`error`),m;n.exports=class{constructor(e){this._options=e||{},this._threshold=this._options.threshold===void 0?1024:this._options.threshold,this._maxPayload=this._options.maxPayload|0,this._isServer=!!this._options.isServer,this._deflate=null,this._inflate=null,this.params=null,m||=new a(this._options.concurrencyLimit===void 0?10:this._options.concurrencyLimit)}static get extensionName(){return`permessage-deflate`}offer(){let e={};return this._options.serverNoContextTakeover&&(e.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(e.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(e.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?e.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits??(e.client_max_window_bits=!0),e}accept(e){return e=this.normalizeParams(e),this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e),this.params}cleanup(){if(this._inflate&&=(this._inflate.close(),null),this._deflate){let e=this._deflate[d];this._deflate.close(),this._deflate=null,e&&e(Error(`The deflate stream was closed while data was being processed`))}}acceptAsServer(e){let t=this._options,n=e.find(e=>!(t.serverNoContextTakeover===!1&&e.server_no_context_takeover||e.server_max_window_bits&&(t.serverMaxWindowBits===!1||typeof t.serverMaxWindowBits==`number`&&t.serverMaxWindowBits>e.server_max_window_bits)||typeof t.clientMaxWindowBits==`number`&&!e.client_max_window_bits));if(!n)throw Error(`None of the extension offers can be accepted`);return t.serverNoContextTakeover&&(n.server_no_context_takeover=!0),t.clientNoContextTakeover&&(n.client_no_context_takeover=!0),typeof t.serverMaxWindowBits==`number`&&(n.server_max_window_bits=t.serverMaxWindowBits),typeof t.clientMaxWindowBits==`number`?n.client_max_window_bits=t.clientMaxWindowBits:(n.client_max_window_bits===!0||t.clientMaxWindowBits===!1)&&delete n.client_max_window_bits,n}acceptAsClient(e){let t=e[0];if(this._options.clientNoContextTakeover===!1&&t.client_no_context_takeover)throw Error(`Unexpected parameter "client_no_context_takeover"`);if(!t.client_max_window_bits)typeof this._options.clientMaxWindowBits==`number`&&(t.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits==`number`&&t.client_max_window_bits>this._options.clientMaxWindowBits)throw Error(`Unexpected or invalid parameter "client_max_window_bits"`);return t}normalizeParams(e){return e.forEach(e=>{Object.keys(e).forEach(t=>{let n=e[t];if(n.length>1)throw Error(`Parameter "${t}" must have only a single value`);if(n=n[0],t===`client_max_window_bits`){if(n!==!0){let e=+n;if(!Number.isInteger(e)||e<8||e>15)throw TypeError(`Invalid value for parameter "${t}": ${n}`);n=e}else if(!this._isServer)throw TypeError(`Invalid value for parameter "${t}": ${n}`)}else if(t===`server_max_window_bits`){let e=+n;if(!Number.isInteger(e)||e<8||e>15)throw TypeError(`Invalid value for parameter "${t}": ${n}`);n=e}else if(t===`client_no_context_takeover`||t===`server_no_context_takeover`){if(n!==!0)throw TypeError(`Invalid value for parameter "${t}": ${n}`)}else throw Error(`Unknown parameter "${t}"`);e[t]=n})}),e}decompress(e,t,n){m.add(r=>{this._decompress(e,t,(e,t)=>{r(),n(e,t)})})}compress(e,t,n){m.add(r=>{this._compress(e,t,(e,t)=>{r(),n(e,t)})})}_decompress(e,t,n){let a=this._isServer?`client`:`server`;if(!this._inflate){let e=`${a}_max_window_bits`,t=typeof this.params[e]==`number`?this.params[e]:r.Z_DEFAULT_WINDOWBITS;this._inflate=r.createInflateRaw({...this._options.zlibInflateOptions,windowBits:t}),this._inflate[l]=this,this._inflate[u]=0,this._inflate[f]=[],this._inflate.on(`error`,_),this._inflate.on(`data`,g)}this._inflate[d]=n,this._inflate.write(e),t&&this._inflate.write(c),this._inflate.flush(()=>{let e=this._inflate[p];if(e){this._inflate.close(),this._inflate=null,n(e);return}let r=i.concat(this._inflate[f],this._inflate[u]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[u]=0,this._inflate[f]=[],t&&this.params[`${a}_no_context_takeover`]&&this._inflate.reset()),n(null,r)})}_compress(e,t,n){let a=this._isServer?`server`:`client`;if(!this._deflate){let e=`${a}_max_window_bits`,t=typeof this.params[e]==`number`?this.params[e]:r.Z_DEFAULT_WINDOWBITS;this._deflate=r.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:t}),this._deflate[u]=0,this._deflate[f]=[],this._deflate.on(`data`,h)}this._deflate[d]=n,this._deflate.write(e),this._deflate.flush(r.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let e=i.concat(this._deflate[f],this._deflate[u]);t&&(e=new s(e.buffer,e.byteOffset,e.length-4)),this._deflate[d]=null,this._deflate[u]=0,this._deflate[f]=[],t&&this.params[`${a}_no_context_takeover`]&&this._deflate.reset(),n(null,e)})}};function h(e){this[f].push(e),this[u]+=e.length}function g(e){if(this[u]+=e.length,this[l]._maxPayload<1||this[u]<=this[l]._maxPayload){this[f].push(e);return}this[p]=RangeError(`Max payload size exceeded`),this[p].code=`WS_ERR_UNSUPPORTED_MESSAGE_LENGTH`,this[p][o]=1009,this.removeListener(`data`,g),this.reset()}function _(e){if(this[l]._inflate=null,this[p]){this[d](this[p]);return}e[o]=1007,this[d](e)}})),p5=i(((e,n)=>{let{isUtf8:r}=t(`buffer`),{hasBlob:i}=u5(),a=[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 o(e){return e>=1e3&&e<=1014&&e!==1004&&e!==1005&&e!==1006||e>=3e3&&e<=4999}function s(e){let t=e.length,n=0;for(;n<t;)if(!(e[n]&128))n++;else if((e[n]&224)==192){if(n+1===t||(e[n+1]&192)!=128||(e[n]&254)==192)return!1;n+=2}else if((e[n]&240)==224){if(n+2>=t||(e[n+1]&192)!=128||(e[n+2]&192)!=128||e[n]===224&&(e[n+1]&224)==128||e[n]===237&&(e[n+1]&224)==160)return!1;n+=3}else if((e[n]&248)==240){if(n+3>=t||(e[n+1]&192)!=128||(e[n+2]&192)!=128||(e[n+3]&192)!=128||e[n]===240&&(e[n+1]&240)==128||e[n]===244&&e[n+1]>143||e[n]>244)return!1;n+=4}else return!1;return!0}function c(e){return i&&typeof e==`object`&&typeof e.arrayBuffer==`function`&&typeof e.type==`string`&&typeof e.stream==`function`&&(e[Symbol.toStringTag]===`Blob`||e[Symbol.toStringTag]===`File`)}if(n.exports={isBlob:c,isValidStatusCode:o,isValidUTF8:s,tokenChars:a},r)n.exports.isValidUTF8=function(e){return e.length<24?s(e):r(e)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let e=t(`utf-8-validate`);n.exports.isValidUTF8=function(t){return t.length<32?s(t):e(t)}}catch{}})),m5=i(((e,n)=>{let{Writable:r}=t(`stream`),i=f5(),{BINARY_TYPES:a,EMPTY_BUFFER:o,kStatusCode:s,kWebSocket:c}=u5(),{concat:l,toArrayBuffer:u,unmask:d}=d5(),{isValidStatusCode:f,isValidUTF8:p}=p5(),m=Buffer[Symbol.species];n.exports=class extends r{constructor(e={}){super(),this._allowSynchronousEvents=e.allowSynchronousEvents===void 0?!0:e.allowSynchronousEvents,this._binaryType=e.binaryType||a[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxBufferedChunks=e.maxBufferedChunks|0,this._maxFragments=e.maxFragments|0,this._maxPayload=e.maxPayload|0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[c]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=0}_write(e,t,n){if(this._opcode===8&&this._state==0)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+=e.length,this._buffers.push(e),this.startLoop(n)}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){let t=this._buffers[0];return this._buffers[0]=new m(t.buffer,t.byteOffset+e,t.length-e),new m(t.buffer,t.byteOffset,e)}let t=Buffer.allocUnsafe(e);do{let n=this._buffers[0],r=t.length-e;e>=n.length?t.set(this._buffers.shift(),r):(t.set(new Uint8Array(n.buffer,n.byteOffset,e),r),this._buffers[0]=new m(n.buffer,n.byteOffset+e,n.length-e)),e-=n.length}while(e>0);return t}startLoop(e){this._loop=!0;do switch(this._state){case 0:this.getInfo(e);break;case 1:this.getPayloadLength16(e);break;case 2:this.getPayloadLength64(e);break;case 3:this.getMask();break;case 4:this.getData(e);break;case 5:case 6:this._loop=!1;return}while(this._loop);this._errored||e()}getInfo(e){if(this._bufferedBytes<2){this._loop=!1;return}let t=this.consume(2);if(t[0]&48){e(this.createError(RangeError,`RSV2 and RSV3 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_2_3`));return}let n=(t[0]&64)==64;if(n&&!this._extensions[i.extensionName]){e(this.createError(RangeError,`RSV1 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_1`));return}if(this._fin=(t[0]&128)==128,this._opcode=t[0]&15,this._payloadLength=t[1]&127,this._opcode===0){if(n){e(this.createError(RangeError,`RSV1 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_1`));return}if(!this._fragmented){e(this.createError(RangeError,`invalid opcode 0`,!0,1002,`WS_ERR_INVALID_OPCODE`));return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){e(this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,`WS_ERR_INVALID_OPCODE`));return}this._compressed=n}else if(this._opcode>7&&this._opcode<11){if(!this._fin){e(this.createError(RangeError,`FIN must be set`,!0,1002,`WS_ERR_EXPECTED_FIN`));return}if(n){e(this.createError(RangeError,`RSV1 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_1`));return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){e(this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,`WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH`));return}}else{e(this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,`WS_ERR_INVALID_OPCODE`));return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(t[1]&128)==128,this._isServer){if(!this._masked){e(this.createError(RangeError,`MASK must be set`,!0,1002,`WS_ERR_EXPECTED_MASK`));return}}else if(this._masked){e(this.createError(RangeError,`MASK must be clear`,!0,1002,`WS_ERR_UNEXPECTED_MASK`));return}this._payloadLength===126?this._state=1:this._payloadLength===127?this._state=2:this.haveLength(e)}getPayloadLength16(e){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(e)}getPayloadLength64(e){if(this._bufferedBytes<8){this._loop=!1;return}let t=this.consume(8),n=t.readUInt32BE(0);if(n>2**21-1){e(this.createError(RangeError,`Unsupported WebSocket frame: payload length > 2^53 - 1`,!1,1009,`WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH`));return}this._payloadLength=n*2**32+t.readUInt32BE(4),this.haveLength(e)}haveLength(e){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)){e(this.createError(RangeError,`Max payload size exceeded`,!1,1009,`WS_ERR_UNSUPPORTED_MESSAGE_LENGTH`));return}this._masked?this._state=3:this._state=4}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=4}getData(e){let t=o;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}t=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0&&d(t,this._mask)}if(this._opcode>7){this.controlMessage(t,e);return}if(this._compressed){this._state=5,this.decompress(t,e);return}if(t.length){if(this._maxFragments>0&&this._fragments.length>=this._maxFragments){e(this.createError(RangeError,`Too many message fragments`,!1,1008,`WS_ERR_TOO_MANY_BUFFERED_PARTS`));return}this._messageLength=this._totalPayloadLength,this._fragments.push(t)}this.dataMessage(e)}decompress(e,t){this._extensions[i.extensionName].decompress(e,this._fin,(e,n)=>{if(e)return t(e);if(n.length){if(this._messageLength+=n.length,this._messageLength>this._maxPayload&&this._maxPayload>0){t(this.createError(RangeError,`Max payload size exceeded`,!1,1009,`WS_ERR_UNSUPPORTED_MESSAGE_LENGTH`));return}if(this._maxFragments>0&&this._fragments.length>=this._maxFragments){t(this.createError(RangeError,`Too many message fragments`,!1,1008,`WS_ERR_TOO_MANY_BUFFERED_PARTS`));return}this._fragments.push(n)}this.dataMessage(t),this._state===0&&this.startLoop(t)})}dataMessage(e){if(!this._fin){this._state=0;return}let t=this._messageLength,n=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let r;r=this._binaryType===`nodebuffer`?l(n,t):this._binaryType===`arraybuffer`?u(l(n,t)):this._binaryType===`blob`?new Blob(n):n,this._allowSynchronousEvents?(this.emit(`message`,r,!0),this._state=0):(this._state=6,setImmediate(()=>{this.emit(`message`,r,!0),this._state=0,this.startLoop(e)}))}else{let r=l(n,t);if(!this._skipUTF8Validation&&!p(r)){e(this.createError(Error,`invalid UTF-8 sequence`,!0,1007,`WS_ERR_INVALID_UTF8`));return}this._state===5||this._allowSynchronousEvents?(this.emit(`message`,r,!1),this._state=0):(this._state=6,setImmediate(()=>{this.emit(`message`,r,!1),this._state=0,this.startLoop(e)}))}}controlMessage(e,t){if(this._opcode===8){if(e.length===0)this._loop=!1,this.emit(`conclude`,1005,o),this.end();else{let n=e.readUInt16BE(0);if(!f(n)){t(this.createError(RangeError,`invalid status code ${n}`,!0,1002,`WS_ERR_INVALID_CLOSE_CODE`));return}let r=new m(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!p(r)){t(this.createError(Error,`invalid UTF-8 sequence`,!0,1007,`WS_ERR_INVALID_UTF8`));return}this._loop=!1,this.emit(`conclude`,n,r),this.end()}this._state=0;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?`ping`:`pong`,e),this._state=0):(this._state=6,setImmediate(()=>{this.emit(this._opcode===9?`ping`:`pong`,e),this._state=0,this.startLoop(t)}))}createError(e,t,n,r,i){this._loop=!1,this._errored=!0;let a=new e(n?`Invalid WebSocket frame: ${t}`:t);return Error.captureStackTrace(a,this.createError),a.code=i,a[s]=r,a}}})),h5=i(((e,n)=>{let{Duplex:r}=t(`stream`),{randomFillSync:i}=t(`crypto`),{types:{isUint8Array:a}}=t(`util`),o=f5(),{EMPTY_BUFFER:s,kWebSocket:c,NOOP:l}=u5(),{isBlob:u,isValidStatusCode:d}=p5(),{mask:f,toBuffer:p}=d5(),m=Symbol(`kByteLength`),h=Buffer.alloc(4),g=8*1024,_,v=g;n.exports=class e{constructor(e,t,n){this._extensions=t||{},n&&(this._generateMask=n,this._maskBuffer=Buffer.alloc(4)),this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=0,this.onerror=l,this[c]=void 0}static frame(e,t){let n,r=!1,a=2,o=!1;t.mask&&(n=t.maskBuffer||h,t.generateMask?t.generateMask(n):(v===g&&(_===void 0&&(_=Buffer.alloc(g)),i(_,0,g),v=0),n[0]=_[v++],n[1]=_[v++],n[2]=_[v++],n[3]=_[v++]),o=(n[0]|n[1]|n[2]|n[3])===0,a=6);let s;typeof e==`string`?(!t.mask||o)&&t[m]!==void 0?s=t[m]:(e=Buffer.from(e),s=e.length):(s=e.length,r=t.mask&&t.readOnly&&!o);let c=s;s>=65536?(a+=8,c=127):s>125&&(a+=2,c=126);let l=Buffer.allocUnsafe(r?s+a:a);return l[0]=t.fin?t.opcode|128:t.opcode,t.rsv1&&(l[0]|=64),l[1]=c,c===126?l.writeUInt16BE(s,2):c===127&&(l[2]=l[3]=0,l.writeUIntBE(s,4,6)),!t.mask||(l[1]|=128,l[a-4]=n[0],l[a-3]=n[1],l[a-2]=n[2],l[a-1]=n[3],o)?[l,e]:r?(f(e,n,l,a,s),[l]):(f(e,n,e,0,s),[l,e])}close(t,n,r,i){let o;if(t===void 0)o=s;else if(typeof t!=`number`||!d(t))throw TypeError(`First argument must be a valid error code number`);else if(n===void 0||!n.length)o=Buffer.allocUnsafe(2),o.writeUInt16BE(t,0);else{let e=Buffer.byteLength(n);if(e>123)throw RangeError(`The message must not be greater than 123 bytes`);if(o=Buffer.allocUnsafe(2+e),o.writeUInt16BE(t,0),typeof n==`string`)o.write(n,2);else if(a(n))o.set(n,2);else throw TypeError(`Second argument must be a string or a Uint8Array`)}let c={[m]:o.length,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state===0?this.sendFrame(e.frame(o,c),i):this.enqueue([this.dispatch,o,!1,c,i])}ping(t,n,r){let i,a;if(typeof t==`string`?(i=Buffer.byteLength(t),a=!1):u(t)?(i=t.size,a=!1):(t=p(t),i=t.length,a=p.readOnly),i>125)throw RangeError(`The data size must not be greater than 125 bytes`);let o={[m]:i,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:9,readOnly:a,rsv1:!1};u(t)?this._state===0?this.getBlobData(t,!1,o,r):this.enqueue([this.getBlobData,t,!1,o,r]):this._state===0?this.sendFrame(e.frame(t,o),r):this.enqueue([this.dispatch,t,!1,o,r])}pong(t,n,r){let i,a;if(typeof t==`string`?(i=Buffer.byteLength(t),a=!1):u(t)?(i=t.size,a=!1):(t=p(t),i=t.length,a=p.readOnly),i>125)throw RangeError(`The data size must not be greater than 125 bytes`);let o={[m]:i,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:10,readOnly:a,rsv1:!1};u(t)?this._state===0?this.getBlobData(t,!1,o,r):this.enqueue([this.getBlobData,t,!1,o,r]):this._state===0?this.sendFrame(e.frame(t,o),r):this.enqueue([this.dispatch,t,!1,o,r])}send(e,t,n){let r=this._extensions[o.extensionName],i=t.binary?2:1,a=t.compress,s,c;typeof e==`string`?(s=Buffer.byteLength(e),c=!1):u(e)?(s=e.size,c=!1):(e=p(e),s=e.length,c=p.readOnly),this._firstFragment?(this._firstFragment=!1,a&&r&&r.params[r._isServer?`server_no_context_takeover`:`client_no_context_takeover`]&&(a=s>=r._threshold),this._compress=a):(a=!1,i=0),t.fin&&(this._firstFragment=!0);let l={[m]:s,fin:t.fin,generateMask:this._generateMask,mask:t.mask,maskBuffer:this._maskBuffer,opcode:i,readOnly:c,rsv1:a};u(e)?this._state===0?this.getBlobData(e,this._compress,l,n):this.enqueue([this.getBlobData,e,this._compress,l,n]):this._state===0?this.dispatch(e,this._compress,l,n):this.enqueue([this.dispatch,e,this._compress,l,n])}getBlobData(t,n,r,i){this._bufferedBytes+=r[m],this._state=2,t.arrayBuffer().then(t=>{if(this._socket.destroyed){let e=Error(`The socket was closed while the blob was being read`);process.nextTick(y,this,e,i);return}this._bufferedBytes-=r[m];let a=p(t);n?this.dispatch(a,n,r,i):(this._state=0,this.sendFrame(e.frame(a,r),i),this.dequeue())}).catch(e=>{process.nextTick(b,this,e,i)})}dispatch(t,n,r,i){if(!n){this.sendFrame(e.frame(t,r),i);return}let a=this._extensions[o.extensionName];this._bufferedBytes+=r[m],this._state=1,a.compress(t,r.fin,(t,n)=>{if(this._socket.destroyed){let e=Error(`The socket was closed while data was being compressed`);y(this,e,i);return}this._bufferedBytes-=r[m],this._state=0,r.readOnly=!1,this.sendFrame(e.frame(n,r),i),this.dequeue()})}dequeue(){for(;this._state===0&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[3][m],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][m],this._queue.push(e)}sendFrame(e,t){e.length===2?(this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],t),this._socket.uncork()):this._socket.write(e[0],t)}};function y(e,t,n){typeof n==`function`&&n(t);for(let n=0;n<e._queue.length;n++){let r=e._queue[n],i=r[r.length-1];typeof i==`function`&&i(t)}}function b(e,t,n){y(e,t,n),e.onerror(t)}})),Hye=i(((e,t)=>{let{kForOnEventAttribute:n,kListener:r}=u5(),i=Symbol(`kCode`),a=Symbol(`kData`),o=Symbol(`kError`),s=Symbol(`kMessage`),c=Symbol(`kReason`),l=Symbol(`kTarget`),u=Symbol(`kType`),d=Symbol(`kWasClean`);var f=class{constructor(e){this[l]=null,this[u]=e}get target(){return this[l]}get type(){return this[u]}};Object.defineProperty(f.prototype,`target`,{enumerable:!0}),Object.defineProperty(f.prototype,`type`,{enumerable:!0});var p=class extends f{constructor(e,t={}){super(e),this[i]=t.code===void 0?0:t.code,this[c]=t.reason===void 0?``:t.reason,this[d]=t.wasClean===void 0?!1:t.wasClean}get code(){return this[i]}get reason(){return this[c]}get wasClean(){return this[d]}};Object.defineProperty(p.prototype,`code`,{enumerable:!0}),Object.defineProperty(p.prototype,`reason`,{enumerable:!0}),Object.defineProperty(p.prototype,`wasClean`,{enumerable:!0});var m=class extends f{constructor(e,t={}){super(e),this[o]=t.error===void 0?null:t.error,this[s]=t.message===void 0?``:t.message}get error(){return this[o]}get message(){return this[s]}};Object.defineProperty(m.prototype,`error`,{enumerable:!0}),Object.defineProperty(m.prototype,`message`,{enumerable:!0});var h=class extends f{constructor(e,t={}){super(e),this[a]=t.data===void 0?null:t.data}get data(){return this[a]}};Object.defineProperty(h.prototype,`data`,{enumerable:!0}),t.exports={CloseEvent:p,ErrorEvent:m,Event:f,EventTarget:{addEventListener(e,t,i={}){for(let a of this.listeners(e))if(!i[n]&&a[r]===t&&!a[n])return;let a;if(e===`message`)a=function(e,n){let r=new h(`message`,{data:n?e:e.toString()});r[l]=this,g(t,this,r)};else if(e===`close`)a=function(e,n){let r=new p(`close`,{code:e,reason:n.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});r[l]=this,g(t,this,r)};else if(e===`error`)a=function(e){let n=new m(`error`,{error:e,message:e.message});n[l]=this,g(t,this,n)};else if(e===`open`)a=function(){let e=new f(`open`);e[l]=this,g(t,this,e)};else return;a[n]=!!i[n],a[r]=t,i.once?this.once(e,a):this.on(e,a)},removeEventListener(e,t){for(let i of this.listeners(e))if(i[r]===t&&!i[n]){this.removeListener(e,i);break}}},MessageEvent:h};function g(e,t,n){typeof e==`object`&&e.handleEvent?e.handleEvent.call(e,n):e.call(t,n)}})),g5=i(((e,t)=>{let{tokenChars:n}=p5();function r(e,t,n){e[t]===void 0?e[t]=[n]:e[t].push(n)}function i(e){let t=Object.create(null),i=Object.create(null),a=!1,o=!1,s=!1,c,l,u=-1,d=-1,f=-1,p=0;for(;p<e.length;p++)if(d=e.charCodeAt(p),c===void 0)if(f===-1&&n[d]===1)u===-1&&(u=p);else if(p!==0&&(d===32||d===9))f===-1&&u!==-1&&(f=p);else if(d===59||d===44){if(u===-1)throw SyntaxError(`Unexpected character at index ${p}`);f===-1&&(f=p);let n=e.slice(u,f);d===44?(r(t,n,i),i=Object.create(null)):c=n,u=f=-1}else throw SyntaxError(`Unexpected character at index ${p}`);else if(l===void 0)if(f===-1&&n[d]===1)u===-1&&(u=p);else if(d===32||d===9)f===-1&&u!==-1&&(f=p);else if(d===59||d===44){if(u===-1)throw SyntaxError(`Unexpected character at index ${p}`);f===-1&&(f=p),r(i,e.slice(u,f),!0),d===44&&(r(t,c,i),i=Object.create(null),c=void 0),u=f=-1}else if(d===61&&u!==-1&&f===-1)l=e.slice(u,p),u=f=-1;else throw SyntaxError(`Unexpected character at index ${p}`);else if(o){if(n[d]!==1)throw SyntaxError(`Unexpected character at index ${p}`);u===-1?u=p:a||=!0,o=!1}else if(s)if(n[d]===1)u===-1&&(u=p);else if(d===34&&u!==-1)s=!1,f=p;else if(d===92)o=!0;else throw SyntaxError(`Unexpected character at index ${p}`);else if(d===34&&e.charCodeAt(p-1)===61)s=!0;else if(f===-1&&n[d]===1)u===-1&&(u=p);else if(u!==-1&&(d===32||d===9))f===-1&&(f=p);else if(d===59||d===44){if(u===-1)throw SyntaxError(`Unexpected character at index ${p}`);f===-1&&(f=p);let n=e.slice(u,f);a&&=(n=n.replace(/\\/g,``),!1),r(i,l,n),d===44&&(r(t,c,i),i=Object.create(null),c=void 0),l=void 0,u=f=-1}else throw SyntaxError(`Unexpected character at index ${p}`);if(u===-1||s||d===32||d===9)throw SyntaxError(`Unexpected end of input`);f===-1&&(f=p);let m=e.slice(u,f);return c===void 0?r(t,m,i):(l===void 0?r(i,m,!0):a?r(i,l,m.replace(/\\/g,``)):r(i,l,m),r(t,c,i)),t}function a(e){return Object.keys(e).map(t=>{let n=e[t];return Array.isArray(n)||(n=[n]),n.map(e=>[t].concat(Object.keys(e).map(t=>{let n=e[t];return Array.isArray(n)||(n=[n]),n.map(e=>e===!0?t:`${t}=${e}`).join(`; `)})).join(`; `)).join(`, `)}).join(`, `)}t.exports={format:a,parse:i}})),_5=i(((e,n)=>{let r=t(`events`),i=t(`https`),a=t(`http`),o=t(`net`),s=t(`tls`),{randomBytes:c,createHash:l}=t(`crypto`),{Duplex:u,Readable:d}=t(`stream`),{URL:f}=t(`url`),p=f5(),m=m5(),h=h5(),{isBlob:g}=p5(),{BINARY_TYPES:_,CLOSE_TIMEOUT:v,EMPTY_BUFFER:y,GUID:b,kForOnEventAttribute:x,kListener:S,kStatusCode:C,kWebSocket:w,NOOP:T}=u5(),{EventTarget:{addEventListener:E,removeEventListener:D}}=Hye(),{format:ee,parse:te}=g5(),{toBuffer:ne}=d5(),re=Symbol(`kAborted`),ie=[8,13],ae=[`CONNECTING`,`OPEN`,`CLOSING`,`CLOSED`],oe=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;var se=class e extends r{constructor(t,n,r){super(),this._binaryType=_[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=y,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._autoPong=r.autoPong,this._closeTimeout=r.closeTimeout,this._isServer=!0):(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,n===void 0?n=[]:Array.isArray(n)||(typeof n==`object`&&n?(r=n,n=[]):n=[n]),ce(this,t,n,r))}get binaryType(){return this._binaryType}set binaryType(e){_.includes(e)&&(this._binaryType=e,this._receiver&&(this._receiver._binaryType=e))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(t,n,r){let i=new m({allowSynchronousEvents:r.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxBufferedChunks:r.maxBufferedChunks,maxFragments:r.maxFragments,maxPayload:r.maxPayload,skipUTF8Validation:r.skipUTF8Validation}),a=new h(t,this._extensions,r.generateMask);this._receiver=i,this._sender=a,this._socket=t,i[w]=this,a[w]=this,t[w]=this,i.on(`conclude`,A),i.on(`drain`,fe),i.on(`error`,pe),i.on(`message`,he),i.on(`ping`,j),i.on(`pong`,M),a.onerror=_e,t.setTimeout&&t.setTimeout(0),t.setNoDelay&&t.setNoDelay(),n.length>0&&t.unshift(n),t.on(`close`,ye),t.on(`data`,be),t.on(`end`,xe),t.on(`error`,Se),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[p.extensionName]&&this._extensions[p.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=e.CLOSED,this.emit(`close`,this._closeCode,this._closeMessage)}close(t,n){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){de(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,n,!this._isServer,e=>{e||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),ve(this)}}pause(){this.readyState===e.CONNECTING||this.readyState===e.CLOSED||(this._paused=!0,this._socket.pause())}ping(t,n,r){if(this.readyState===e.CONNECTING)throw Error(`WebSocket is not open: readyState 0 (CONNECTING)`);if(typeof t==`function`?(r=t,t=n=void 0):typeof n==`function`&&(r=n,n=void 0),typeof t==`number`&&(t=t.toString()),this.readyState!==e.OPEN){k(this,t,r);return}n===void 0&&(n=!this._isServer),this._sender.ping(t||y,n,r)}pong(t,n,r){if(this.readyState===e.CONNECTING)throw Error(`WebSocket is not open: readyState 0 (CONNECTING)`);if(typeof t==`function`?(r=t,t=n=void 0):typeof n==`function`&&(r=n,n=void 0),typeof t==`number`&&(t=t.toString()),this.readyState!==e.OPEN){k(this,t,r);return}n===void 0&&(n=!this._isServer),this._sender.pong(t||y,n,r)}resume(){this.readyState===e.CONNECTING||this.readyState===e.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(t,n,r){if(this.readyState===e.CONNECTING)throw Error(`WebSocket is not open: readyState 0 (CONNECTING)`);if(typeof n==`function`&&(r=n,n={}),typeof t==`number`&&(t=t.toString()),this.readyState!==e.OPEN){k(this,t,r);return}let i={binary:typeof t!=`string`,mask:!this._isServer,compress:!0,fin:!0,...n};this._extensions[p.extensionName]||(i.compress=!1),this._sender.send(t||y,i,r)}terminate(){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){de(this,this._req,`WebSocket was closed before the connection was established`);return}this._socket&&(this._readyState=e.CLOSING,this._socket.destroy())}}};Object.defineProperty(se,`CONNECTING`,{enumerable:!0,value:ae.indexOf(`CONNECTING`)}),Object.defineProperty(se.prototype,`CONNECTING`,{enumerable:!0,value:ae.indexOf(`CONNECTING`)}),Object.defineProperty(se,`OPEN`,{enumerable:!0,value:ae.indexOf(`OPEN`)}),Object.defineProperty(se.prototype,`OPEN`,{enumerable:!0,value:ae.indexOf(`OPEN`)}),Object.defineProperty(se,`CLOSING`,{enumerable:!0,value:ae.indexOf(`CLOSING`)}),Object.defineProperty(se.prototype,`CLOSING`,{enumerable:!0,value:ae.indexOf(`CLOSING`)}),Object.defineProperty(se,`CLOSED`,{enumerable:!0,value:ae.indexOf(`CLOSED`)}),Object.defineProperty(se.prototype,`CLOSED`,{enumerable:!0,value:ae.indexOf(`CLOSED`)}),[`binaryType`,`bufferedAmount`,`extensions`,`isPaused`,`protocol`,`readyState`,`url`].forEach(e=>{Object.defineProperty(se.prototype,e,{enumerable:!0})}),[`open`,`error`,`close`,`message`].forEach(e=>{Object.defineProperty(se.prototype,`on${e}`,{enumerable:!0,get(){for(let t of this.listeners(e))if(t[x])return t[S];return null},set(t){for(let t of this.listeners(e))if(t[x]){this.removeListener(e,t);break}typeof t==`function`&&this.addEventListener(e,t,{[x]:!0})}})}),se.prototype.addEventListener=E,se.prototype.removeEventListener=D,n.exports=se;function ce(e,t,n,r){let o={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:v,protocolVersion:ie[1],maxBufferedChunks:1024*1024,maxFragments:128*1024,maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...r,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,!ie.includes(o.protocolVersion))throw RangeError(`Unsupported protocol version: ${o.protocolVersion} (supported versions: ${ie.join(`, `)})`);let s;if(t instanceof f)s=t;else try{s=new f(t)}catch{throw SyntaxError(`Invalid URL: ${t}`)}s.protocol===`http:`?s.protocol=`ws:`:s.protocol===`https:`&&(s.protocol=`wss:`),e._url=s.href;let u=s.protocol===`wss:`,d=s.protocol===`ws+unix:`,m;if(s.protocol!==`ws:`&&!u&&!d?m=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:d&&!s.pathname?m=`The URL's pathname is empty`:s.hash&&(m=`The URL contains a fragment identifier`),m){let t=SyntaxError(m);if(e._redirects===0)throw t;O(e,t);return}let h=u?443:80,g=c(16).toString(`base64`),_=u?i.request:a.request,y=new Set,x;if(o.createConnection=o.createConnection||(u?ue:le),o.defaultPort=o.defaultPort||h,o.port=s.port||h,o.host=s.hostname.startsWith(`[`)?s.hostname.slice(1,-1):s.hostname,o.headers={...o.headers,"Sec-WebSocket-Version":o.protocolVersion,"Sec-WebSocket-Key":g,Connection:`Upgrade`,Upgrade:`websocket`},o.path=s.pathname+s.search,o.timeout=o.handshakeTimeout,o.perMessageDeflate&&(x=new p({...o.perMessageDeflate,isServer:!1,maxPayload:o.maxPayload}),o.headers[`Sec-WebSocket-Extensions`]=ee({[p.extensionName]:x.offer()})),n.length){for(let e of n){if(typeof e!=`string`||!oe.test(e)||y.has(e))throw SyntaxError(`An invalid or duplicated subprotocol was specified`);y.add(e)}o.headers[`Sec-WebSocket-Protocol`]=n.join(`,`)}if(o.origin&&(o.protocolVersion<13?o.headers[`Sec-WebSocket-Origin`]=o.origin:o.headers.Origin=o.origin),(s.username||s.password)&&(o.auth=`${s.username}:${s.password}`),d){let e=o.path.split(`:`);o.socketPath=e[0],o.path=e[1]}let S;if(o.followRedirects){if(e._redirects===0){e._originalIpc=d,e._originalSecure=u,e._originalHostOrSocketPath=d?o.socketPath:s.host;let t=r&&r.headers;if(r={...r,headers:{}},t)for(let[e,n]of Object.entries(t))r.headers[e.toLowerCase()]=n}else if(e.listenerCount(`redirect`)===0){let t=d?e._originalIpc?o.socketPath===e._originalHostOrSocketPath:!1:e._originalIpc?!1:s.host===e._originalHostOrSocketPath;(!t||e._originalSecure&&!u)&&(delete o.headers.authorization,delete o.headers.cookie,t||delete o.headers.host,o.auth=void 0)}o.auth&&!r.headers.authorization&&(r.headers.authorization=`Basic `+Buffer.from(o.auth).toString(`base64`)),S=e._req=_(o),e._redirects&&e.emit(`redirect`,e.url,S)}else S=e._req=_(o);o.timeout&&S.on(`timeout`,()=>{de(e,S,`Opening handshake has timed out`)}),S.on(`error`,t=>{S===null||S[re]||(S=e._req=null,O(e,t))}),S.on(`response`,i=>{let a=i.headers.location,s=i.statusCode;if(a&&o.followRedirects&&s>=300&&s<400){if(++e._redirects>o.maxRedirects){de(e,S,`Maximum redirects exceeded`);return}S.abort();let i;try{i=new f(a,t)}catch{O(e,SyntaxError(`Invalid URL: ${a}`));return}ce(e,i,n,r)}else e.emit(`unexpected-response`,S,i)||de(e,S,`Unexpected server response: ${i.statusCode}`)}),S.on(`upgrade`,(t,n,r)=>{if(e.emit(`upgrade`,t),e.readyState!==se.CONNECTING)return;S=e._req=null;let i=t.headers.upgrade;if(i===void 0||i.toLowerCase()!==`websocket`){de(e,n,`Invalid Upgrade header`);return}let a=l(`sha1`).update(g+b).digest(`base64`);if(t.headers[`sec-websocket-accept`]!==a){de(e,n,`Invalid Sec-WebSocket-Accept header`);return}let s=t.headers[`sec-websocket-protocol`],c;if(s===void 0?y.size&&(c=`Server sent no subprotocol`):y.size?y.has(s)||(c=`Server sent an invalid subprotocol`):c=`Server sent a subprotocol but none was requested`,c){de(e,n,c);return}s&&(e._protocol=s);let u=t.headers[`sec-websocket-extensions`];if(u!==void 0){if(!x){de(e,n,`Server sent a Sec-WebSocket-Extensions header but no extension was requested`);return}let t;try{t=te(u)}catch{de(e,n,`Invalid Sec-WebSocket-Extensions header`);return}let r=Object.keys(t);if(r.length!==1||r[0]!==p.extensionName){de(e,n,`Server indicated an extension that was not requested`);return}try{x.accept(t[p.extensionName])}catch{de(e,n,`Invalid Sec-WebSocket-Extensions header`);return}e._extensions[p.extensionName]=x}e.setSocket(n,r,{allowSynchronousEvents:o.allowSynchronousEvents,generateMask:o.generateMask,maxBufferedChunks:o.maxBufferedChunks,maxFragments:o.maxFragments,maxPayload:o.maxPayload,skipUTF8Validation:o.skipUTF8Validation})}),o.finishRequest?o.finishRequest(S,e):S.end()}function O(e,t){e._readyState=se.CLOSING,e._errorEmitted=!0,e.emit(`error`,t),e.emitClose()}function le(e){return e.path=e.socketPath,o.connect(e)}function ue(e){return e.path=void 0,!e.servername&&e.servername!==``&&(e.servername=o.isIP(e.host)?``:e.host),s.connect(e)}function de(e,t,n){e._readyState=se.CLOSING;let r=Error(n);Error.captureStackTrace(r,de),t.setHeader?(t[re]=!0,t.abort(),t.socket&&!t.socket.destroyed&&t.socket.destroy(),process.nextTick(O,e,r)):(t.destroy(r),t.once(`error`,e.emit.bind(e,`error`)),t.once(`close`,e.emitClose.bind(e)))}function k(e,t,n){if(t){let n=g(t)?t.size:ne(t).length;e._socket?e._sender._bufferedBytes+=n:e._bufferedAmount+=n}if(n){let t=Error(`WebSocket is not open: readyState ${e.readyState} (${ae[e.readyState]})`);process.nextTick(n,t)}}function A(e,t){let n=this[w];n._closeFrameReceived=!0,n._closeMessage=t,n._closeCode=e,n._socket[w]!==void 0&&(n._socket.removeListener(`data`,be),process.nextTick(ge,n._socket),e===1005?n.close():n.close(e,t))}function fe(){let e=this[w];e.isPaused||e._socket.resume()}function pe(e){let t=this[w];t._socket[w]!==void 0&&(t._socket.removeListener(`data`,be),process.nextTick(ge,t._socket),t.close(e[C])),t._errorEmitted||(t._errorEmitted=!0,t.emit(`error`,e))}function me(){this[w].emitClose()}function he(e,t){this[w].emit(`message`,e,t)}function j(e){let t=this[w];t._autoPong&&t.pong(e,!this._isServer,T),t.emit(`ping`,e)}function M(e){this[w].emit(`pong`,e)}function ge(e){e.resume()}function _e(e){let t=this[w];t.readyState!==se.CLOSED&&(t.readyState===se.OPEN&&(t._readyState=se.CLOSING,ve(t)),this._socket.end(),t._errorEmitted||(t._errorEmitted=!0,t.emit(`error`,e)))}function ve(e){e._closeTimer=setTimeout(e._socket.destroy.bind(e._socket),e._closeTimeout)}function ye(){let e=this[w];if(this.removeListener(`close`,ye),this.removeListener(`data`,be),this.removeListener(`end`,xe),e._readyState=se.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[w]=void 0,clearTimeout(e._closeTimer),e._receiver._writableState.finished||e._receiver._writableState.errorEmitted?e.emitClose():(e._receiver.on(`error`,me),e._receiver.on(`finish`,me))}function be(e){this[w]._receiver.write(e)||this.pause()}function xe(){let e=this[w];e._readyState=se.CLOSING,e._receiver.end(),this.end()}function Se(){let e=this[w];this.removeListener(`error`,Se),this.on(`error`,T),e&&(e._readyState=se.CLOSING,this.destroy())}})),Uye=i(((e,n)=>{_5();let{Duplex:r}=t(`stream`);function i(e){e.emit(`close`)}function a(){!this.destroyed&&this._writableState.finished&&this.destroy()}function o(e){this.removeListener(`error`,o),this.destroy(),this.listenerCount(`error`)===0&&this.emit(`error`,e)}function s(e,t){let n=!0,s=new r({...t,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return e.on(`message`,function(t,n){let r=!n&&s._readableState.objectMode?t.toString():t;s.push(r)||e.pause()}),e.once(`error`,function(e){s.destroyed||(n=!1,s.destroy(e))}),e.once(`close`,function(){s.destroyed||s.push(null)}),s._destroy=function(t,r){if(e.readyState===e.CLOSED){r(t),process.nextTick(i,s);return}let a=!1;e.once(`error`,function(e){a=!0,r(e)}),e.once(`close`,function(){a||r(t),process.nextTick(i,s)}),n&&e.terminate()},s._final=function(t){if(e.readyState===e.CONNECTING){e.once(`open`,function(){s._final(t)});return}e._socket!==null&&(e._socket._writableState.finished?(t(),s._readableState.endEmitted&&s.destroy()):(e._socket.once(`finish`,function(){t()}),e.close()))},s._read=function(){e.isPaused&&e.resume()},s._write=function(t,n,r){if(e.readyState===e.CONNECTING){e.once(`open`,function(){s._write(t,n,r)});return}e.send(t,r)},s.on(`end`,a),s.on(`error`,o),s}n.exports=s})),v5=i(((e,t)=>{let{tokenChars:n}=p5();function r(e){let t=new Set,r=-1,i=-1,a=0;for(;a<e.length;a++){let o=e.charCodeAt(a);if(i===-1&&n[o]===1)r===-1&&(r=a);else if(a!==0&&(o===32||o===9))i===-1&&r!==-1&&(i=a);else if(o===44){if(r===-1)throw SyntaxError(`Unexpected character at index ${a}`);i===-1&&(i=a);let n=e.slice(r,i);if(t.has(n))throw SyntaxError(`The "${n}" subprotocol is duplicated`);t.add(n),r=i=-1}else throw SyntaxError(`Unexpected character at index ${a}`)}if(r===-1||i!==-1)throw SyntaxError(`Unexpected end of input`);let o=e.slice(r,a);if(t.has(o))throw SyntaxError(`The "${o}" subprotocol is duplicated`);return t.add(o),t}t.exports={parse:r}})),Wye=i(((e,n)=>{let r=t(`events`),i=t(`http`),{Duplex:a}=t(`stream`),{createHash:o}=t(`crypto`),s=g5(),c=f5(),l=v5(),u=_5(),{CLOSE_TIMEOUT:d,GUID:f,kWebSocket:p}=u5(),m=/^[+/0-9A-Za-z]{22}==$/;n.exports=class extends r{constructor(e,t){if(super(),e={allowSynchronousEvents:!0,autoPong:!0,maxBufferedChunks:1024*1024,maxFragments:128*1024,maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:d,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:u,...e},e.port==null&&!e.server&&!e.noServer||e.port!=null&&(e.server||e.noServer)||e.server&&e.noServer)throw TypeError(`One and only one of the "port", "server", or "noServer" options must be specified`);if(e.port==null?e.server&&(this._server=e.server):(this._server=i.createServer((e,t)=>{let n=i.STATUS_CODES[426];t.writeHead(426,{"Content-Length":n.length,"Content-Type":`text/plain`}),t.end(n)}),this._server.listen(e.port,e.host,e.backlog,t)),this._server){let e=this.emit.bind(this,`connection`);this._removeListeners=h(this._server,{listening:this.emit.bind(this,`listening`),error:this.emit.bind(this,`error`),upgrade:(t,n,r)=>{this.handleUpgrade(t,n,r,e)}})}e.perMessageDeflate===!0&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=0}address(){if(this.options.noServer)throw Error(`The server is operating in "noServer" mode`);return this._server?this._server.address():null}close(e){if(this._state===2){e&&this.once(`close`,()=>{e(Error(`The server is not running`))}),process.nextTick(g,this);return}if(e&&this.once(`close`,e),this._state!==1)if(this._state=1,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(g,this);else{let e=this._server;this._removeListeners(),this._removeListeners=this._server=null,e.close(()=>{g(this)})}}shouldHandle(e){if(this.options.path){let t=e.url.indexOf(`?`);if((t===-1?e.url:e.url.slice(0,t))!==this.options.path)return!1}return!0}handleUpgrade(e,t,n,r){t.on(`error`,_);let i=e.headers[`sec-websocket-key`],a=e.headers.upgrade,o=+e.headers[`sec-websocket-version`];if(e.method!==`GET`){y(this,e,t,405,`Invalid HTTP method`);return}if(a===void 0||a.toLowerCase()!==`websocket`){y(this,e,t,400,`Invalid Upgrade header`);return}if(i===void 0||!m.test(i)){y(this,e,t,400,`Missing or invalid Sec-WebSocket-Key header`);return}if(o!==13&&o!==8){y(this,e,t,400,`Missing or invalid Sec-WebSocket-Version header`,{"Sec-WebSocket-Version":`13, 8`});return}if(!this.shouldHandle(e)){v(t,400);return}let u=e.headers[`sec-websocket-protocol`],d=new Set;if(u!==void 0)try{d=l.parse(u)}catch{y(this,e,t,400,`Invalid Sec-WebSocket-Protocol header`);return}let f=e.headers[`sec-websocket-extensions`],p={};if(this.options.perMessageDeflate&&f!==void 0){let n=new c({...this.options.perMessageDeflate,isServer:!0,maxPayload:this.options.maxPayload});try{let e=s.parse(f);e[c.extensionName]&&(n.accept(e[c.extensionName]),p[c.extensionName]=n)}catch{y(this,e,t,400,`Invalid or unacceptable Sec-WebSocket-Extensions header`);return}}if(this.options.verifyClient){let a={origin:e.headers[`${o===8?`sec-websocket-origin`:`origin`}`],secure:!!(e.socket.authorized||e.socket.encrypted),req:e};if(this.options.verifyClient.length===2){this.options.verifyClient(a,(a,o,s,c)=>{if(!a)return v(t,o||401,s,c);this.completeUpgrade(p,i,d,e,t,n,r)});return}if(!this.options.verifyClient(a))return v(t,401)}this.completeUpgrade(p,i,d,e,t,n,r)}completeUpgrade(e,t,n,r,i,a,l){if(!i.readable||!i.writable)return i.destroy();if(i[p])throw Error(`server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration`);if(this._state>0)return v(i,503);let u=[`HTTP/1.1 101 Switching Protocols`,`Upgrade: websocket`,`Connection: Upgrade`,`Sec-WebSocket-Accept: ${o(`sha1`).update(t+f).digest(`base64`)}`],d=new this.options.WebSocket(null,void 0,this.options);if(n.size){let e=this.options.handleProtocols?this.options.handleProtocols(n,r):n.values().next().value;e&&(u.push(`Sec-WebSocket-Protocol: ${e}`),d._protocol=e)}if(e[c.extensionName]){let t=e[c.extensionName].params,n=s.format({[c.extensionName]:[t]});u.push(`Sec-WebSocket-Extensions: ${n}`),d._extensions=e}this.emit(`headers`,u,r),i.write(u.concat(`\r
819
819
  `).join(`\r
820
820
  `)),i.removeListener(`error`,_),d.setSocket(i,a,{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(d),d.on(`close`,()=>{this.clients.delete(d),this._shouldEmitClose&&!this.clients.size&&process.nextTick(g,this)})),l(d,r)}};function h(e,t){for(let n of Object.keys(t))e.on(n,t[n]);return function(){for(let n of Object.keys(t))e.removeListener(n,t[n])}}function g(e){e._state=2,e.emit(`close`)}function _(){this.destroy()}function v(e,t,n,r){n||=i.STATUS_CODES[t],r={Connection:`close`,"Content-Type":`text/html`,"Content-Length":Buffer.byteLength(n),...r},e.once(`finish`,e.destroy),e.end(`HTTP/1.1 ${t} ${i.STATUS_CODES[t]}\r\n`+Object.keys(r).map(e=>`${e}: ${r[e]}`).join(`\r
821
821
  `)+`\r
822
822
  \r
823
- `+n)}function y(e,t,n,r,i,a){if(e.listenerCount(`wsClientError`)){let r=Error(i);Error.captureStackTrace(r,y),e.emit(`wsClientError`,r,n,t)}else v(n,r,i,a)}}));Hye(),g5(),f5(),m5(),h5(),v5(),_5(),Uye();let y5,b5,x5,S5,C5=!0;typeof process<`u`&&({FORCE_COLOR:y5,NODE_DISABLE_COLORS:b5,NO_COLOR:x5,TERM:S5}=process.env||{},C5=process.stdout&&process.stdout.isTTY);const w5={enabled:!b5&&x5==null&&S5!==`dumb`&&(y5!=null&&y5!==`0`||C5),reset:E5(0,0),bold:E5(1,22),dim:E5(2,22),italic:E5(3,23),underline:E5(4,24),inverse:E5(7,27),hidden:E5(8,28),strikethrough:E5(9,29),black:E5(30,39),red:E5(31,39),green:E5(32,39),yellow:E5(33,39),blue:E5(34,39),magenta:E5(35,39),cyan:E5(36,39),white:E5(37,39),gray:E5(90,39),grey:E5(90,39),bgBlack:E5(40,49),bgRed:E5(41,49),bgGreen:E5(42,49),bgYellow:E5(43,49),bgBlue:E5(44,49),bgMagenta:E5(45,49),bgCyan:E5(46,49),bgWhite:E5(47,49)};function T5(e,t){let n=0,r,i=``,a=``;for(;n<e.length;n++)r=e[n],i+=r.open,a+=r.close,~t.indexOf(r.close)&&(t=t.replace(r.rgx,r.close+r.open));return i+t+a}function Wye(e,t){let n={has:e,keys:t};return n.reset=w5.reset.bind(n),n.bold=w5.bold.bind(n),n.dim=w5.dim.bind(n),n.italic=w5.italic.bind(n),n.underline=w5.underline.bind(n),n.inverse=w5.inverse.bind(n),n.hidden=w5.hidden.bind(n),n.strikethrough=w5.strikethrough.bind(n),n.black=w5.black.bind(n),n.red=w5.red.bind(n),n.green=w5.green.bind(n),n.yellow=w5.yellow.bind(n),n.blue=w5.blue.bind(n),n.magenta=w5.magenta.bind(n),n.cyan=w5.cyan.bind(n),n.white=w5.white.bind(n),n.gray=w5.gray.bind(n),n.grey=w5.grey.bind(n),n.bgBlack=w5.bgBlack.bind(n),n.bgRed=w5.bgRed.bind(n),n.bgGreen=w5.bgGreen.bind(n),n.bgYellow=w5.bgYellow.bind(n),n.bgBlue=w5.bgBlue.bind(n),n.bgMagenta=w5.bgMagenta.bind(n),n.bgCyan=w5.bgCyan.bind(n),n.bgWhite=w5.bgWhite.bind(n),n}function E5(e,t){let n={open:`\x1b[${e}m`,close:`\x1b[${t}m`,rgx:RegExp(`\\x1b\\[${t}m`,`g`)};return function(t){return this!==void 0&&this.has!==void 0?(~this.has.indexOf(e)||(this.has.push(e),this.keys.push(n)),t===void 0?this:w5.enabled?T5(this.keys,t+``):t+``):t===void 0?Wye([e],[n]):w5.enabled?T5([n],t+``):t+``}}Number.isNaN,Number.isInteger,Number.isNaN,Number.parseInt,Array.from,Array.isArray;const Gye=String.fromCharCode;String.fromCodePoint,Gye(65535);const D5=typeof TextEncoder<`u`?new TextEncoder:null;let O5=typeof TextDecoder>`u`?null:new TextDecoder(`utf-8`,{fatal:!0,ignoreBOM:!0});O5&&O5.decode(new Uint8Array).length===1&&(O5=null);const k5=e=>Error(e);new Uint8Array(3e4).length/3,D5&&D5.encodeInto,k5(`Unexpected end of array`),k5(`Integer out of Range`),Date.now;var A5=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),j5=o(import.meta.url),M5=A5(((e,t)=>{let n=[`nodebuffer`,`arraybuffer`,`fragments`],r=typeof Blob<`u`;r&&n.push(`blob`),t.exports={BINARY_TYPES:n,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:`258EAFA5-E914-47DA-95CA-C5AB0DC85B11`,hasBlob:r,kForOnEventAttribute:Symbol(`kIsForOnEventAttribute`),kListener:Symbol(`kListener`),kStatusCode:Symbol(`status-code`),kWebSocket:Symbol(`websocket`),NOOP:()=>{}}})),N5=A5(((e,t)=>{let{EMPTY_BUFFER:n}=M5(),r=Buffer[Symbol.species];function i(e,t){if(e.length===0)return n;if(e.length===1)return e[0];let i=Buffer.allocUnsafe(t),a=0;for(let t=0;t<e.length;t++){let n=e[t];i.set(n,a),a+=n.length}return a<t?new r(i.buffer,i.byteOffset,a):i}function a(e,t,n,r,i){for(let a=0;a<i;a++)n[r+a]=e[a]^t[a&3]}function o(e,t){for(let n=0;n<e.length;n++)e[n]^=t[n&3]}function s(e){return e.length===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.length)}function c(e){if(c.readOnly=!0,Buffer.isBuffer(e))return e;let t;return e instanceof ArrayBuffer?t=new r(e):ArrayBuffer.isView(e)?t=new r(e.buffer,e.byteOffset,e.byteLength):(t=Buffer.from(e),c.readOnly=!1),t}if(t.exports={concat:i,mask:a,toArrayBuffer:s,toBuffer:c,unmask:o},!process.env.WS_NO_BUFFER_UTIL)try{let e=j5(`bufferutil`);t.exports.mask=function(t,n,r,i,o){o<48?a(t,n,r,i,o):e.mask(t,n,r,i,o)},t.exports.unmask=function(t,n){t.length<32?o(t,n):e.unmask(t,n)}}catch{}})),Kye=A5(((e,t)=>{let n=Symbol(`kDone`),r=Symbol(`kRun`);t.exports=class{constructor(e){this[n]=()=>{this.pending--,this[r]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[r]()}[r](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[n])}}}})),P5=A5(((e,t)=>{let n=j5(`zlib`),r=N5(),i=Kye(),{kStatusCode:a}=M5(),o=Buffer[Symbol.species],s=Buffer.from([0,0,255,255]),c=Symbol(`permessage-deflate`),l=Symbol(`total-length`),u=Symbol(`callback`),d=Symbol(`buffers`),f=Symbol(`error`),p;t.exports=class{constructor(e,t,n){this._maxPayload=n|0,this._options=e||{},this._threshold=this._options.threshold===void 0?1024:this._options.threshold,this._isServer=!!t,this._deflate=null,this._inflate=null,this.params=null,p||=new i(this._options.concurrencyLimit===void 0?10:this._options.concurrencyLimit)}static get extensionName(){return`permessage-deflate`}offer(){let e={};return this._options.serverNoContextTakeover&&(e.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(e.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(e.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?e.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits??(e.client_max_window_bits=!0),e}accept(e){return e=this.normalizeParams(e),this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e),this.params}cleanup(){if(this._inflate&&=(this._inflate.close(),null),this._deflate){let e=this._deflate[u];this._deflate.close(),this._deflate=null,e&&e(Error(`The deflate stream was closed while data was being processed`))}}acceptAsServer(e){let t=this._options,n=e.find(e=>!(t.serverNoContextTakeover===!1&&e.server_no_context_takeover||e.server_max_window_bits&&(t.serverMaxWindowBits===!1||typeof t.serverMaxWindowBits==`number`&&t.serverMaxWindowBits>e.server_max_window_bits)||typeof t.clientMaxWindowBits==`number`&&!e.client_max_window_bits));if(!n)throw Error(`None of the extension offers can be accepted`);return t.serverNoContextTakeover&&(n.server_no_context_takeover=!0),t.clientNoContextTakeover&&(n.client_no_context_takeover=!0),typeof t.serverMaxWindowBits==`number`&&(n.server_max_window_bits=t.serverMaxWindowBits),typeof t.clientMaxWindowBits==`number`?n.client_max_window_bits=t.clientMaxWindowBits:(n.client_max_window_bits===!0||t.clientMaxWindowBits===!1)&&delete n.client_max_window_bits,n}acceptAsClient(e){let t=e[0];if(this._options.clientNoContextTakeover===!1&&t.client_no_context_takeover)throw Error(`Unexpected parameter "client_no_context_takeover"`);if(!t.client_max_window_bits)typeof this._options.clientMaxWindowBits==`number`&&(t.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits==`number`&&t.client_max_window_bits>this._options.clientMaxWindowBits)throw Error(`Unexpected or invalid parameter "client_max_window_bits"`);return t}normalizeParams(e){return e.forEach(e=>{Object.keys(e).forEach(t=>{let n=e[t];if(n.length>1)throw Error(`Parameter "${t}" must have only a single value`);if(n=n[0],t===`client_max_window_bits`){if(n!==!0){let e=+n;if(!Number.isInteger(e)||e<8||e>15)throw TypeError(`Invalid value for parameter "${t}": ${n}`);n=e}else if(!this._isServer)throw TypeError(`Invalid value for parameter "${t}": ${n}`)}else if(t===`server_max_window_bits`){let e=+n;if(!Number.isInteger(e)||e<8||e>15)throw TypeError(`Invalid value for parameter "${t}": ${n}`);n=e}else if(t===`client_no_context_takeover`||t===`server_no_context_takeover`){if(n!==!0)throw TypeError(`Invalid value for parameter "${t}": ${n}`)}else throw Error(`Unknown parameter "${t}"`);e[t]=n})}),e}decompress(e,t,n){p.add(r=>{this._decompress(e,t,(e,t)=>{r(),n(e,t)})})}compress(e,t,n){p.add(r=>{this._compress(e,t,(e,t)=>{r(),n(e,t)})})}_decompress(e,t,i){let a=this._isServer?`client`:`server`;if(!this._inflate){let e=`${a}_max_window_bits`,t=typeof this.params[e]==`number`?this.params[e]:n.Z_DEFAULT_WINDOWBITS;this._inflate=n.createInflateRaw({...this._options.zlibInflateOptions,windowBits:t}),this._inflate[c]=this,this._inflate[l]=0,this._inflate[d]=[],this._inflate.on(`error`,g),this._inflate.on(`data`,h)}this._inflate[u]=i,this._inflate.write(e),t&&this._inflate.write(s),this._inflate.flush(()=>{let e=this._inflate[f];if(e){this._inflate.close(),this._inflate=null,i(e);return}let n=r.concat(this._inflate[d],this._inflate[l]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[l]=0,this._inflate[d]=[],t&&this.params[`${a}_no_context_takeover`]&&this._inflate.reset()),i(null,n)})}_compress(e,t,i){let a=this._isServer?`server`:`client`;if(!this._deflate){let e=`${a}_max_window_bits`,t=typeof this.params[e]==`number`?this.params[e]:n.Z_DEFAULT_WINDOWBITS;this._deflate=n.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:t}),this._deflate[l]=0,this._deflate[d]=[],this._deflate.on(`data`,m)}this._deflate[u]=i,this._deflate.write(e),this._deflate.flush(n.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let e=r.concat(this._deflate[d],this._deflate[l]);t&&(e=new o(e.buffer,e.byteOffset,e.length-4)),this._deflate[u]=null,this._deflate[l]=0,this._deflate[d]=[],t&&this.params[`${a}_no_context_takeover`]&&this._deflate.reset(),i(null,e)})}};function m(e){this[d].push(e),this[l]+=e.length}function h(e){if(this[l]+=e.length,this[c]._maxPayload<1||this[l]<=this[c]._maxPayload){this[d].push(e);return}this[f]=RangeError(`Max payload size exceeded`),this[f].code=`WS_ERR_UNSUPPORTED_MESSAGE_LENGTH`,this[f][a]=1009,this.removeListener(`data`,h),this.reset()}function g(e){if(this[c]._inflate=null,this[f]){this[u](this[f]);return}e[a]=1007,this[u](e)}})),F5=A5(((e,t)=>{let{isUtf8:n}=j5(`buffer`),{hasBlob:r}=M5(),i=[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 a(e){return e>=1e3&&e<=1014&&e!==1004&&e!==1005&&e!==1006||e>=3e3&&e<=4999}function o(e){let t=e.length,n=0;for(;n<t;)if(!(e[n]&128))n++;else if((e[n]&224)==192){if(n+1===t||(e[n+1]&192)!=128||(e[n]&254)==192)return!1;n+=2}else if((e[n]&240)==224){if(n+2>=t||(e[n+1]&192)!=128||(e[n+2]&192)!=128||e[n]===224&&(e[n+1]&224)==128||e[n]===237&&(e[n+1]&224)==160)return!1;n+=3}else if((e[n]&248)==240){if(n+3>=t||(e[n+1]&192)!=128||(e[n+2]&192)!=128||(e[n+3]&192)!=128||e[n]===240&&(e[n+1]&240)==128||e[n]===244&&e[n+1]>143||e[n]>244)return!1;n+=4}else return!1;return!0}function s(e){return r&&typeof e==`object`&&typeof e.arrayBuffer==`function`&&typeof e.type==`string`&&typeof e.stream==`function`&&(e[Symbol.toStringTag]===`Blob`||e[Symbol.toStringTag]===`File`)}if(t.exports={isBlob:s,isValidStatusCode:a,isValidUTF8:o,tokenChars:i},n)t.exports.isValidUTF8=function(e){return e.length<24?o(e):n(e)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let e=j5(`utf-8-validate`);t.exports.isValidUTF8=function(t){return t.length<32?o(t):e(t)}}catch{}})),I5=A5(((e,t)=>{let{Writable:n}=j5(`stream`),r=P5(),{BINARY_TYPES:i,EMPTY_BUFFER:a,kStatusCode:o,kWebSocket:s}=M5(),{concat:c,toArrayBuffer:l,unmask:u}=N5(),{isValidStatusCode:d,isValidUTF8:f}=F5(),p=Buffer[Symbol.species];t.exports=class extends n{constructor(e={}){super(),this._allowSynchronousEvents=e.allowSynchronousEvents===void 0?!0:e.allowSynchronousEvents,this._binaryType=e.binaryType||i[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxPayload=e.maxPayload|0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[s]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=0}_write(e,t,n){if(this._opcode===8&&this._state==0)return n();this._bufferedBytes+=e.length,this._buffers.push(e),this.startLoop(n)}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){let t=this._buffers[0];return this._buffers[0]=new p(t.buffer,t.byteOffset+e,t.length-e),new p(t.buffer,t.byteOffset,e)}let t=Buffer.allocUnsafe(e);do{let n=this._buffers[0],r=t.length-e;e>=n.length?t.set(this._buffers.shift(),r):(t.set(new Uint8Array(n.buffer,n.byteOffset,e),r),this._buffers[0]=new p(n.buffer,n.byteOffset+e,n.length-e)),e-=n.length}while(e>0);return t}startLoop(e){this._loop=!0;do switch(this._state){case 0:this.getInfo(e);break;case 1:this.getPayloadLength16(e);break;case 2:this.getPayloadLength64(e);break;case 3:this.getMask();break;case 4:this.getData(e);break;case 5:case 6:this._loop=!1;return}while(this._loop);this._errored||e()}getInfo(e){if(this._bufferedBytes<2){this._loop=!1;return}let t=this.consume(2);if(t[0]&48){e(this.createError(RangeError,`RSV2 and RSV3 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_2_3`));return}let n=(t[0]&64)==64;if(n&&!this._extensions[r.extensionName]){e(this.createError(RangeError,`RSV1 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_1`));return}if(this._fin=(t[0]&128)==128,this._opcode=t[0]&15,this._payloadLength=t[1]&127,this._opcode===0){if(n){e(this.createError(RangeError,`RSV1 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_1`));return}if(!this._fragmented){e(this.createError(RangeError,`invalid opcode 0`,!0,1002,`WS_ERR_INVALID_OPCODE`));return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){e(this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,`WS_ERR_INVALID_OPCODE`));return}this._compressed=n}else if(this._opcode>7&&this._opcode<11){if(!this._fin){e(this.createError(RangeError,`FIN must be set`,!0,1002,`WS_ERR_EXPECTED_FIN`));return}if(n){e(this.createError(RangeError,`RSV1 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_1`));return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){e(this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,`WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH`));return}}else{e(this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,`WS_ERR_INVALID_OPCODE`));return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(t[1]&128)==128,this._isServer){if(!this._masked){e(this.createError(RangeError,`MASK must be set`,!0,1002,`WS_ERR_EXPECTED_MASK`));return}}else if(this._masked){e(this.createError(RangeError,`MASK must be clear`,!0,1002,`WS_ERR_UNEXPECTED_MASK`));return}this._payloadLength===126?this._state=1:this._payloadLength===127?this._state=2:this.haveLength(e)}getPayloadLength16(e){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(e)}getPayloadLength64(e){if(this._bufferedBytes<8){this._loop=!1;return}let t=this.consume(8),n=t.readUInt32BE(0);if(n>2**21-1){e(this.createError(RangeError,`Unsupported WebSocket frame: payload length > 2^53 - 1`,!1,1009,`WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH`));return}this._payloadLength=n*2**32+t.readUInt32BE(4),this.haveLength(e)}haveLength(e){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)){e(this.createError(RangeError,`Max payload size exceeded`,!1,1009,`WS_ERR_UNSUPPORTED_MESSAGE_LENGTH`));return}this._masked?this._state=3:this._state=4}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=4}getData(e){let t=a;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}t=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0&&u(t,this._mask)}if(this._opcode>7){this.controlMessage(t,e);return}if(this._compressed){this._state=5,this.decompress(t,e);return}t.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(t)),this.dataMessage(e)}decompress(e,t){this._extensions[r.extensionName].decompress(e,this._fin,(e,n)=>{if(e)return t(e);if(n.length){if(this._messageLength+=n.length,this._messageLength>this._maxPayload&&this._maxPayload>0){t(this.createError(RangeError,`Max payload size exceeded`,!1,1009,`WS_ERR_UNSUPPORTED_MESSAGE_LENGTH`));return}this._fragments.push(n)}this.dataMessage(t),this._state===0&&this.startLoop(t)})}dataMessage(e){if(!this._fin){this._state=0;return}let t=this._messageLength,n=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let r;r=this._binaryType===`nodebuffer`?c(n,t):this._binaryType===`arraybuffer`?l(c(n,t)):this._binaryType===`blob`?new Blob(n):n,this._allowSynchronousEvents?(this.emit(`message`,r,!0),this._state=0):(this._state=6,setImmediate(()=>{this.emit(`message`,r,!0),this._state=0,this.startLoop(e)}))}else{let r=c(n,t);if(!this._skipUTF8Validation&&!f(r)){e(this.createError(Error,`invalid UTF-8 sequence`,!0,1007,`WS_ERR_INVALID_UTF8`));return}this._state===5||this._allowSynchronousEvents?(this.emit(`message`,r,!1),this._state=0):(this._state=6,setImmediate(()=>{this.emit(`message`,r,!1),this._state=0,this.startLoop(e)}))}}controlMessage(e,t){if(this._opcode===8){if(e.length===0)this._loop=!1,this.emit(`conclude`,1005,a),this.end();else{let n=e.readUInt16BE(0);if(!d(n)){t(this.createError(RangeError,`invalid status code ${n}`,!0,1002,`WS_ERR_INVALID_CLOSE_CODE`));return}let r=new p(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!f(r)){t(this.createError(Error,`invalid UTF-8 sequence`,!0,1007,`WS_ERR_INVALID_UTF8`));return}this._loop=!1,this.emit(`conclude`,n,r),this.end()}this._state=0;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?`ping`:`pong`,e),this._state=0):(this._state=6,setImmediate(()=>{this.emit(this._opcode===9?`ping`:`pong`,e),this._state=0,this.startLoop(t)}))}createError(e,t,n,r,i){this._loop=!1,this._errored=!0;let a=new e(n?`Invalid WebSocket frame: ${t}`:t);return Error.captureStackTrace(a,this.createError),a.code=i,a[o]=r,a}}})),L5=A5(((e,t)=>{let{Duplex:n}=j5(`stream`),{randomFillSync:r}=j5(`crypto`),i=P5(),{EMPTY_BUFFER:a,kWebSocket:o,NOOP:s}=M5(),{isBlob:c,isValidStatusCode:l}=F5(),{mask:u,toBuffer:d}=N5(),f=Symbol(`kByteLength`),p=Buffer.alloc(4),m=8*1024,h,g=m;t.exports=class e{constructor(e,t,n){this._extensions=t||{},n&&(this._generateMask=n,this._maskBuffer=Buffer.alloc(4)),this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=0,this.onerror=s,this[o]=void 0}static frame(e,t){let n,i=!1,a=2,o=!1;t.mask&&(n=t.maskBuffer||p,t.generateMask?t.generateMask(n):(g===m&&(h===void 0&&(h=Buffer.alloc(m)),r(h,0,m),g=0),n[0]=h[g++],n[1]=h[g++],n[2]=h[g++],n[3]=h[g++]),o=(n[0]|n[1]|n[2]|n[3])===0,a=6);let s;typeof e==`string`?(!t.mask||o)&&t[f]!==void 0?s=t[f]:(e=Buffer.from(e),s=e.length):(s=e.length,i=t.mask&&t.readOnly&&!o);let c=s;s>=65536?(a+=8,c=127):s>125&&(a+=2,c=126);let l=Buffer.allocUnsafe(i?s+a:a);return l[0]=t.fin?t.opcode|128:t.opcode,t.rsv1&&(l[0]|=64),l[1]=c,c===126?l.writeUInt16BE(s,2):c===127&&(l[2]=l[3]=0,l.writeUIntBE(s,4,6)),!t.mask||(l[1]|=128,l[a-4]=n[0],l[a-3]=n[1],l[a-2]=n[2],l[a-1]=n[3],o)?[l,e]:i?(u(e,n,l,a,s),[l]):(u(e,n,e,0,s),[l,e])}close(t,n,r,i){let o;if(t===void 0)o=a;else if(typeof t!=`number`||!l(t))throw TypeError(`First argument must be a valid error code number`);else if(n===void 0||!n.length)o=Buffer.allocUnsafe(2),o.writeUInt16BE(t,0);else{let e=Buffer.byteLength(n);if(e>123)throw RangeError(`The message must not be greater than 123 bytes`);o=Buffer.allocUnsafe(2+e),o.writeUInt16BE(t,0),typeof n==`string`?o.write(n,2):o.set(n,2)}let s={[f]:o.length,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state===0?this.sendFrame(e.frame(o,s),i):this.enqueue([this.dispatch,o,!1,s,i])}ping(t,n,r){let i,a;if(typeof t==`string`?(i=Buffer.byteLength(t),a=!1):c(t)?(i=t.size,a=!1):(t=d(t),i=t.length,a=d.readOnly),i>125)throw RangeError(`The data size must not be greater than 125 bytes`);let o={[f]:i,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:9,readOnly:a,rsv1:!1};c(t)?this._state===0?this.getBlobData(t,!1,o,r):this.enqueue([this.getBlobData,t,!1,o,r]):this._state===0?this.sendFrame(e.frame(t,o),r):this.enqueue([this.dispatch,t,!1,o,r])}pong(t,n,r){let i,a;if(typeof t==`string`?(i=Buffer.byteLength(t),a=!1):c(t)?(i=t.size,a=!1):(t=d(t),i=t.length,a=d.readOnly),i>125)throw RangeError(`The data size must not be greater than 125 bytes`);let o={[f]:i,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:10,readOnly:a,rsv1:!1};c(t)?this._state===0?this.getBlobData(t,!1,o,r):this.enqueue([this.getBlobData,t,!1,o,r]):this._state===0?this.sendFrame(e.frame(t,o),r):this.enqueue([this.dispatch,t,!1,o,r])}send(e,t,n){let r=this._extensions[i.extensionName],a=t.binary?2:1,o=t.compress,s,l;typeof e==`string`?(s=Buffer.byteLength(e),l=!1):c(e)?(s=e.size,l=!1):(e=d(e),s=e.length,l=d.readOnly),this._firstFragment?(this._firstFragment=!1,o&&r&&r.params[r._isServer?`server_no_context_takeover`:`client_no_context_takeover`]&&(o=s>=r._threshold),this._compress=o):(o=!1,a=0),t.fin&&(this._firstFragment=!0);let u={[f]:s,fin:t.fin,generateMask:this._generateMask,mask:t.mask,maskBuffer:this._maskBuffer,opcode:a,readOnly:l,rsv1:o};c(e)?this._state===0?this.getBlobData(e,this._compress,u,n):this.enqueue([this.getBlobData,e,this._compress,u,n]):this._state===0?this.dispatch(e,this._compress,u,n):this.enqueue([this.dispatch,e,this._compress,u,n])}getBlobData(t,n,r,i){this._bufferedBytes+=r[f],this._state=2,t.arrayBuffer().then(t=>{if(this._socket.destroyed){let e=Error(`The socket was closed while the blob was being read`);process.nextTick(_,this,e,i);return}this._bufferedBytes-=r[f];let a=d(t);n?this.dispatch(a,n,r,i):(this._state=0,this.sendFrame(e.frame(a,r),i),this.dequeue())}).catch(e=>{process.nextTick(v,this,e,i)})}dispatch(t,n,r,a){if(!n){this.sendFrame(e.frame(t,r),a);return}let o=this._extensions[i.extensionName];this._bufferedBytes+=r[f],this._state=1,o.compress(t,r.fin,(t,n)=>{if(this._socket.destroyed){_(this,Error(`The socket was closed while data was being compressed`),a);return}this._bufferedBytes-=r[f],this._state=0,r.readOnly=!1,this.sendFrame(e.frame(n,r),a),this.dequeue()})}dequeue(){for(;this._state===0&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[3][f],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][f],this._queue.push(e)}sendFrame(e,t){e.length===2?(this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],t),this._socket.uncork()):this._socket.write(e[0],t)}};function _(e,t,n){typeof n==`function`&&n(t);for(let n=0;n<e._queue.length;n++){let r=e._queue[n],i=r[r.length-1];typeof i==`function`&&i(t)}}function v(e,t,n){_(e,t,n),e.onerror(t)}})),qye=A5(((e,t)=>{let{kForOnEventAttribute:n,kListener:r}=M5(),i=Symbol(`kCode`),a=Symbol(`kData`),o=Symbol(`kError`),s=Symbol(`kMessage`),c=Symbol(`kReason`),l=Symbol(`kTarget`),u=Symbol(`kType`),d=Symbol(`kWasClean`);var f=class{constructor(e){this[l]=null,this[u]=e}get target(){return this[l]}get type(){return this[u]}};Object.defineProperty(f.prototype,`target`,{enumerable:!0}),Object.defineProperty(f.prototype,`type`,{enumerable:!0});var p=class extends f{constructor(e,t={}){super(e),this[i]=t.code===void 0?0:t.code,this[c]=t.reason===void 0?``:t.reason,this[d]=t.wasClean===void 0?!1:t.wasClean}get code(){return this[i]}get reason(){return this[c]}get wasClean(){return this[d]}};Object.defineProperty(p.prototype,`code`,{enumerable:!0}),Object.defineProperty(p.prototype,`reason`,{enumerable:!0}),Object.defineProperty(p.prototype,`wasClean`,{enumerable:!0});var m=class extends f{constructor(e,t={}){super(e),this[o]=t.error===void 0?null:t.error,this[s]=t.message===void 0?``:t.message}get error(){return this[o]}get message(){return this[s]}};Object.defineProperty(m.prototype,`error`,{enumerable:!0}),Object.defineProperty(m.prototype,`message`,{enumerable:!0});var h=class extends f{constructor(e,t={}){super(e),this[a]=t.data===void 0?null:t.data}get data(){return this[a]}};Object.defineProperty(h.prototype,`data`,{enumerable:!0}),t.exports={CloseEvent:p,ErrorEvent:m,Event:f,EventTarget:{addEventListener(e,t,i={}){for(let a of this.listeners(e))if(!i[n]&&a[r]===t&&!a[n])return;let a;if(e===`message`)a=function(e,n){let r=new h(`message`,{data:n?e:e.toString()});r[l]=this,g(t,this,r)};else if(e===`close`)a=function(e,n){let r=new p(`close`,{code:e,reason:n.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});r[l]=this,g(t,this,r)};else if(e===`error`)a=function(e){let n=new m(`error`,{error:e,message:e.message});n[l]=this,g(t,this,n)};else if(e===`open`)a=function(){let e=new f(`open`);e[l]=this,g(t,this,e)};else return;a[n]=!!i[n],a[r]=t,i.once?this.once(e,a):this.on(e,a)},removeEventListener(e,t){for(let i of this.listeners(e))if(i[r]===t&&!i[n]){this.removeListener(e,i);break}}},MessageEvent:h};function g(e,t,n){typeof e==`object`&&e.handleEvent?e.handleEvent.call(e,n):e.call(t,n)}})),R5=A5(((e,t)=>{let{tokenChars:n}=F5();function r(e,t,n){e[t]===void 0?e[t]=[n]:e[t].push(n)}function i(e){let t=Object.create(null),i=Object.create(null),a=!1,o=!1,s=!1,c,l,u=-1,d=-1,f=-1,p=0;for(;p<e.length;p++)if(d=e.charCodeAt(p),c===void 0)if(f===-1&&n[d]===1)u===-1&&(u=p);else if(p!==0&&(d===32||d===9))f===-1&&u!==-1&&(f=p);else if(d===59||d===44){if(u===-1)throw SyntaxError(`Unexpected character at index ${p}`);f===-1&&(f=p);let n=e.slice(u,f);d===44?(r(t,n,i),i=Object.create(null)):c=n,u=f=-1}else throw SyntaxError(`Unexpected character at index ${p}`);else if(l===void 0)if(f===-1&&n[d]===1)u===-1&&(u=p);else if(d===32||d===9)f===-1&&u!==-1&&(f=p);else if(d===59||d===44){if(u===-1)throw SyntaxError(`Unexpected character at index ${p}`);f===-1&&(f=p),r(i,e.slice(u,f),!0),d===44&&(r(t,c,i),i=Object.create(null),c=void 0),u=f=-1}else if(d===61&&u!==-1&&f===-1)l=e.slice(u,p),u=f=-1;else throw SyntaxError(`Unexpected character at index ${p}`);else if(o){if(n[d]!==1)throw SyntaxError(`Unexpected character at index ${p}`);u===-1?u=p:a||=!0,o=!1}else if(s)if(n[d]===1)u===-1&&(u=p);else if(d===34&&u!==-1)s=!1,f=p;else if(d===92)o=!0;else throw SyntaxError(`Unexpected character at index ${p}`);else if(d===34&&e.charCodeAt(p-1)===61)s=!0;else if(f===-1&&n[d]===1)u===-1&&(u=p);else if(u!==-1&&(d===32||d===9))f===-1&&(f=p);else if(d===59||d===44){if(u===-1)throw SyntaxError(`Unexpected character at index ${p}`);f===-1&&(f=p);let n=e.slice(u,f);a&&=(n=n.replace(/\\/g,``),!1),r(i,l,n),d===44&&(r(t,c,i),i=Object.create(null),c=void 0),l=void 0,u=f=-1}else throw SyntaxError(`Unexpected character at index ${p}`);if(u===-1||s||d===32||d===9)throw SyntaxError(`Unexpected end of input`);f===-1&&(f=p);let m=e.slice(u,f);return c===void 0?r(t,m,i):(l===void 0?r(i,m,!0):a?r(i,l,m.replace(/\\/g,``)):r(i,l,m),r(t,c,i)),t}function a(e){return Object.keys(e).map(t=>{let n=e[t];return Array.isArray(n)||(n=[n]),n.map(e=>[t].concat(Object.keys(e).map(t=>{let n=e[t];return Array.isArray(n)||(n=[n]),n.map(e=>e===!0?t:`${t}=${e}`).join(`; `)})).join(`; `)).join(`, `)}).join(`, `)}t.exports={format:a,parse:i}})),z5=A5(((e,t)=>{let n=j5(`events`),r=j5(`https`),i=j5(`http`),a=j5(`net`),o=j5(`tls`),{randomBytes:s,createHash:c}=j5(`crypto`),{Duplex:l,Readable:u}=j5(`stream`),{URL:d}=j5(`url`),f=P5(),p=I5(),m=L5(),{isBlob:h}=F5(),{BINARY_TYPES:g,CLOSE_TIMEOUT:_,EMPTY_BUFFER:v,GUID:y,kForOnEventAttribute:b,kListener:x,kStatusCode:S,kWebSocket:C,NOOP:w}=M5(),{EventTarget:{addEventListener:T,removeEventListener:E}}=qye(),{format:D,parse:ee}=R5(),{toBuffer:te}=N5(),ne=Symbol(`kAborted`),re=[8,13],ie=[`CONNECTING`,`OPEN`,`CLOSING`,`CLOSED`],ae=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;var oe=class e extends n{constructor(t,n,r){super(),this._binaryType=g[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=v,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._autoPong=r.autoPong,this._closeTimeout=r.closeTimeout,this._isServer=!0):(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,n===void 0?n=[]:Array.isArray(n)||(typeof n==`object`&&n?(r=n,n=[]):n=[n]),se(this,t,n,r))}get binaryType(){return this._binaryType}set binaryType(e){g.includes(e)&&(this._binaryType=e,this._receiver&&(this._receiver._binaryType=e))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(t,n,r){let i=new p({allowSynchronousEvents:r.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:r.maxPayload,skipUTF8Validation:r.skipUTF8Validation}),a=new m(t,this._extensions,r.generateMask);this._receiver=i,this._sender=a,this._socket=t,i[C]=this,a[C]=this,t[C]=this,i.on(`conclude`,k),i.on(`drain`,A),i.on(`error`,fe),i.on(`message`,me),i.on(`ping`,he),i.on(`pong`,j),a.onerror=ge,t.setTimeout&&t.setTimeout(0),t.setNoDelay&&t.setNoDelay(),n.length>0&&t.unshift(n),t.on(`close`,ve),t.on(`data`,ye),t.on(`end`,be),t.on(`error`,xe),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[f.extensionName]&&this._extensions[f.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=e.CLOSED,this.emit(`close`,this._closeCode,this._closeMessage)}close(t,n){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){ue(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,n,!this._isServer,e=>{e||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),_e(this)}}pause(){this.readyState===e.CONNECTING||this.readyState===e.CLOSED||(this._paused=!0,this._socket.pause())}ping(t,n,r){if(this.readyState===e.CONNECTING)throw Error(`WebSocket is not open: readyState 0 (CONNECTING)`);if(typeof t==`function`?(r=t,t=n=void 0):typeof n==`function`&&(r=n,n=void 0),typeof t==`number`&&(t=t.toString()),this.readyState!==e.OPEN){de(this,t,r);return}n===void 0&&(n=!this._isServer),this._sender.ping(t||v,n,r)}pong(t,n,r){if(this.readyState===e.CONNECTING)throw Error(`WebSocket is not open: readyState 0 (CONNECTING)`);if(typeof t==`function`?(r=t,t=n=void 0):typeof n==`function`&&(r=n,n=void 0),typeof t==`number`&&(t=t.toString()),this.readyState!==e.OPEN){de(this,t,r);return}n===void 0&&(n=!this._isServer),this._sender.pong(t||v,n,r)}resume(){this.readyState===e.CONNECTING||this.readyState===e.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(t,n,r){if(this.readyState===e.CONNECTING)throw Error(`WebSocket is not open: readyState 0 (CONNECTING)`);if(typeof n==`function`&&(r=n,n={}),typeof t==`number`&&(t=t.toString()),this.readyState!==e.OPEN){de(this,t,r);return}let i={binary:typeof t!=`string`,mask:!this._isServer,compress:!0,fin:!0,...n};this._extensions[f.extensionName]||(i.compress=!1),this._sender.send(t||v,i,r)}terminate(){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){ue(this,this._req,`WebSocket was closed before the connection was established`);return}this._socket&&(this._readyState=e.CLOSING,this._socket.destroy())}}};Object.defineProperty(oe,`CONNECTING`,{enumerable:!0,value:ie.indexOf(`CONNECTING`)}),Object.defineProperty(oe.prototype,`CONNECTING`,{enumerable:!0,value:ie.indexOf(`CONNECTING`)}),Object.defineProperty(oe,`OPEN`,{enumerable:!0,value:ie.indexOf(`OPEN`)}),Object.defineProperty(oe.prototype,`OPEN`,{enumerable:!0,value:ie.indexOf(`OPEN`)}),Object.defineProperty(oe,`CLOSING`,{enumerable:!0,value:ie.indexOf(`CLOSING`)}),Object.defineProperty(oe.prototype,`CLOSING`,{enumerable:!0,value:ie.indexOf(`CLOSING`)}),Object.defineProperty(oe,`CLOSED`,{enumerable:!0,value:ie.indexOf(`CLOSED`)}),Object.defineProperty(oe.prototype,`CLOSED`,{enumerable:!0,value:ie.indexOf(`CLOSED`)}),[`binaryType`,`bufferedAmount`,`extensions`,`isPaused`,`protocol`,`readyState`,`url`].forEach(e=>{Object.defineProperty(oe.prototype,e,{enumerable:!0})}),[`open`,`error`,`close`,`message`].forEach(e=>{Object.defineProperty(oe.prototype,`on${e}`,{enumerable:!0,get(){for(let t of this.listeners(e))if(t[b])return t[x];return null},set(t){for(let t of this.listeners(e))if(t[b]){this.removeListener(e,t);break}typeof t==`function`&&this.addEventListener(e,t,{[b]:!0})}})}),oe.prototype.addEventListener=T,oe.prototype.removeEventListener=E,t.exports=oe;function se(e,t,n,a){let o={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:_,protocolVersion:re[1],maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...a,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:`GET`,host:void 0,path:void 0,port:void 0};if(e._autoPong=o.autoPong,e._closeTimeout=o.closeTimeout,!re.includes(o.protocolVersion))throw RangeError(`Unsupported protocol version: ${o.protocolVersion} (supported versions: ${re.join(`, `)})`);let l;if(t instanceof d)l=t;else try{l=new d(t)}catch{throw SyntaxError(`Invalid URL: ${t}`)}l.protocol===`http:`?l.protocol=`ws:`:l.protocol===`https:`&&(l.protocol=`wss:`),e._url=l.href;let u=l.protocol===`wss:`,p=l.protocol===`ws+unix:`,m;if(l.protocol!==`ws:`&&!u&&!p?m=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:p&&!l.pathname?m=`The URL's pathname is empty`:l.hash&&(m=`The URL contains a fragment identifier`),m){let t=SyntaxError(m);if(e._redirects===0)throw t;ce(e,t);return}let h=u?443:80,g=s(16).toString(`base64`),v=u?r.request:i.request,b=new Set,x;if(o.createConnection=o.createConnection||(u?le:O),o.defaultPort=o.defaultPort||h,o.port=l.port||h,o.host=l.hostname.startsWith(`[`)?l.hostname.slice(1,-1):l.hostname,o.headers={...o.headers,"Sec-WebSocket-Version":o.protocolVersion,"Sec-WebSocket-Key":g,Connection:`Upgrade`,Upgrade:`websocket`},o.path=l.pathname+l.search,o.timeout=o.handshakeTimeout,o.perMessageDeflate&&(x=new f(o.perMessageDeflate===!0?{}:o.perMessageDeflate,!1,o.maxPayload),o.headers[`Sec-WebSocket-Extensions`]=D({[f.extensionName]:x.offer()})),n.length){for(let e of n){if(typeof e!=`string`||!ae.test(e)||b.has(e))throw SyntaxError(`An invalid or duplicated subprotocol was specified`);b.add(e)}o.headers[`Sec-WebSocket-Protocol`]=n.join(`,`)}if(o.origin&&(o.protocolVersion<13?o.headers[`Sec-WebSocket-Origin`]=o.origin:o.headers.Origin=o.origin),(l.username||l.password)&&(o.auth=`${l.username}:${l.password}`),p){let e=o.path.split(`:`);o.socketPath=e[0],o.path=e[1]}let S;if(o.followRedirects){if(e._redirects===0){e._originalIpc=p,e._originalSecure=u,e._originalHostOrSocketPath=p?o.socketPath:l.host;let t=a&&a.headers;if(a={...a,headers:{}},t)for(let[e,n]of Object.entries(t))a.headers[e.toLowerCase()]=n}else if(e.listenerCount(`redirect`)===0){let t=p?e._originalIpc?o.socketPath===e._originalHostOrSocketPath:!1:e._originalIpc?!1:l.host===e._originalHostOrSocketPath;(!t||e._originalSecure&&!u)&&(delete o.headers.authorization,delete o.headers.cookie,t||delete o.headers.host,o.auth=void 0)}o.auth&&!a.headers.authorization&&(a.headers.authorization=`Basic `+Buffer.from(o.auth).toString(`base64`)),S=e._req=v(o),e._redirects&&e.emit(`redirect`,e.url,S)}else S=e._req=v(o);o.timeout&&S.on(`timeout`,()=>{ue(e,S,`Opening handshake has timed out`)}),S.on(`error`,t=>{S===null||S[ne]||(S=e._req=null,ce(e,t))}),S.on(`response`,r=>{let i=r.headers.location,s=r.statusCode;if(i&&o.followRedirects&&s>=300&&s<400){if(++e._redirects>o.maxRedirects){ue(e,S,`Maximum redirects exceeded`);return}S.abort();let r;try{r=new d(i,t)}catch{ce(e,SyntaxError(`Invalid URL: ${i}`));return}se(e,r,n,a)}else e.emit(`unexpected-response`,S,r)||ue(e,S,`Unexpected server response: ${r.statusCode}`)}),S.on(`upgrade`,(t,n,r)=>{if(e.emit(`upgrade`,t),e.readyState!==oe.CONNECTING)return;S=e._req=null;let i=t.headers.upgrade;if(i===void 0||i.toLowerCase()!==`websocket`){ue(e,n,`Invalid Upgrade header`);return}let a=c(`sha1`).update(g+y).digest(`base64`);if(t.headers[`sec-websocket-accept`]!==a){ue(e,n,`Invalid Sec-WebSocket-Accept header`);return}let s=t.headers[`sec-websocket-protocol`],l;if(s===void 0?b.size&&(l=`Server sent no subprotocol`):b.size?b.has(s)||(l=`Server sent an invalid subprotocol`):l=`Server sent a subprotocol but none was requested`,l){ue(e,n,l);return}s&&(e._protocol=s);let u=t.headers[`sec-websocket-extensions`];if(u!==void 0){if(!x){ue(e,n,`Server sent a Sec-WebSocket-Extensions header but no extension was requested`);return}let t;try{t=ee(u)}catch{ue(e,n,`Invalid Sec-WebSocket-Extensions header`);return}let r=Object.keys(t);if(r.length!==1||r[0]!==f.extensionName){ue(e,n,`Server indicated an extension that was not requested`);return}try{x.accept(t[f.extensionName])}catch{ue(e,n,`Invalid Sec-WebSocket-Extensions header`);return}e._extensions[f.extensionName]=x}e.setSocket(n,r,{allowSynchronousEvents:o.allowSynchronousEvents,generateMask:o.generateMask,maxPayload:o.maxPayload,skipUTF8Validation:o.skipUTF8Validation})}),o.finishRequest?o.finishRequest(S,e):S.end()}function ce(e,t){e._readyState=oe.CLOSING,e._errorEmitted=!0,e.emit(`error`,t),e.emitClose()}function O(e){return e.path=e.socketPath,a.connect(e)}function le(e){return e.path=void 0,!e.servername&&e.servername!==``&&(e.servername=a.isIP(e.host)?``:e.host),o.connect(e)}function ue(e,t,n){e._readyState=oe.CLOSING;let r=Error(n);Error.captureStackTrace(r,ue),t.setHeader?(t[ne]=!0,t.abort(),t.socket&&!t.socket.destroyed&&t.socket.destroy(),process.nextTick(ce,e,r)):(t.destroy(r),t.once(`error`,e.emit.bind(e,`error`)),t.once(`close`,e.emitClose.bind(e)))}function de(e,t,n){if(t){let n=h(t)?t.size:te(t).length;e._socket?e._sender._bufferedBytes+=n:e._bufferedAmount+=n}if(n){let t=Error(`WebSocket is not open: readyState ${e.readyState} (${ie[e.readyState]})`);process.nextTick(n,t)}}function k(e,t){let n=this[C];n._closeFrameReceived=!0,n._closeMessage=t,n._closeCode=e,n._socket[C]!==void 0&&(n._socket.removeListener(`data`,ye),process.nextTick(M,n._socket),e===1005?n.close():n.close(e,t))}function A(){let e=this[C];e.isPaused||e._socket.resume()}function fe(e){let t=this[C];t._socket[C]!==void 0&&(t._socket.removeListener(`data`,ye),process.nextTick(M,t._socket),t.close(e[S])),t._errorEmitted||(t._errorEmitted=!0,t.emit(`error`,e))}function pe(){this[C].emitClose()}function me(e,t){this[C].emit(`message`,e,t)}function he(e){let t=this[C];t._autoPong&&t.pong(e,!this._isServer,w),t.emit(`ping`,e)}function j(e){this[C].emit(`pong`,e)}function M(e){e.resume()}function ge(e){let t=this[C];t.readyState!==oe.CLOSED&&(t.readyState===oe.OPEN&&(t._readyState=oe.CLOSING,_e(t)),this._socket.end(),t._errorEmitted||(t._errorEmitted=!0,t.emit(`error`,e)))}function _e(e){e._closeTimer=setTimeout(e._socket.destroy.bind(e._socket),e._closeTimeout)}function ve(){let e=this[C];if(this.removeListener(`close`,ve),this.removeListener(`data`,ye),this.removeListener(`end`,be),e._readyState=oe.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[C]=void 0,clearTimeout(e._closeTimer),e._receiver._writableState.finished||e._receiver._writableState.errorEmitted?e.emitClose():(e._receiver.on(`error`,pe),e._receiver.on(`finish`,pe))}function ye(e){this[C]._receiver.write(e)||this.pause()}function be(){let e=this[C];e._readyState=oe.CLOSING,e._receiver.end(),this.end()}function xe(){let e=this[C];this.removeListener(`error`,xe),this.on(`error`,w),e&&(e._readyState=oe.CLOSING,this.destroy())}})),Jye=A5(((e,t)=>{z5();let{Duplex:n}=j5(`stream`);function r(e){e.emit(`close`)}function i(){!this.destroyed&&this._writableState.finished&&this.destroy()}function a(e){this.removeListener(`error`,a),this.destroy(),this.listenerCount(`error`)===0&&this.emit(`error`,e)}function o(e,t){let o=!0,s=new n({...t,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return e.on(`message`,function(t,n){let r=!n&&s._readableState.objectMode?t.toString():t;s.push(r)||e.pause()}),e.once(`error`,function(e){s.destroyed||(o=!1,s.destroy(e))}),e.once(`close`,function(){s.destroyed||s.push(null)}),s._destroy=function(t,n){if(e.readyState===e.CLOSED){n(t),process.nextTick(r,s);return}let i=!1;e.once(`error`,function(e){i=!0,n(e)}),e.once(`close`,function(){i||n(t),process.nextTick(r,s)}),o&&e.terminate()},s._final=function(t){if(e.readyState===e.CONNECTING){e.once(`open`,function(){s._final(t)});return}e._socket!==null&&(e._socket._writableState.finished?(t(),s._readableState.endEmitted&&s.destroy()):(e._socket.once(`finish`,function(){t()}),e.close()))},s._read=function(){e.isPaused&&e.resume()},s._write=function(t,n,r){if(e.readyState===e.CONNECTING){e.once(`open`,function(){s._write(t,n,r)});return}e.send(t,r)},s.on(`end`,i),s.on(`error`,a),s}t.exports=o})),Yye=A5(((e,t)=>{let{tokenChars:n}=F5();function r(e){let t=new Set,r=-1,i=-1,a=0;for(;a<e.length;a++){let o=e.charCodeAt(a);if(i===-1&&n[o]===1)r===-1&&(r=a);else if(a!==0&&(o===32||o===9))i===-1&&r!==-1&&(i=a);else if(o===44){if(r===-1)throw SyntaxError(`Unexpected character at index ${a}`);i===-1&&(i=a);let n=e.slice(r,i);if(t.has(n))throw SyntaxError(`The "${n}" subprotocol is duplicated`);t.add(n),r=i=-1}else throw SyntaxError(`Unexpected character at index ${a}`)}if(r===-1||i!==-1)throw SyntaxError(`Unexpected end of input`);let o=e.slice(r,a);if(t.has(o))throw SyntaxError(`The "${o}" subprotocol is duplicated`);return t.add(o),t}t.exports={parse:r}})),Xye=A5(((e,t)=>{let n=j5(`events`),r=j5(`http`),{Duplex:i}=j5(`stream`),{createHash:a}=j5(`crypto`),o=R5(),s=P5(),c=Yye(),l=z5(),{CLOSE_TIMEOUT:u,GUID:d,kWebSocket:f}=M5(),p=/^[+/0-9A-Za-z]{22}==$/;t.exports=class extends n{constructor(e,t){if(super(),e={allowSynchronousEvents:!0,autoPong:!0,maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:u,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:l,...e},e.port==null&&!e.server&&!e.noServer||e.port!=null&&(e.server||e.noServer)||e.server&&e.noServer)throw TypeError(`One and only one of the "port", "server", or "noServer" options must be specified`);if(e.port==null?e.server&&(this._server=e.server):(this._server=r.createServer((e,t)=>{let n=r.STATUS_CODES[426];t.writeHead(426,{"Content-Length":n.length,"Content-Type":`text/plain`}),t.end(n)}),this._server.listen(e.port,e.host,e.backlog,t)),this._server){let e=this.emit.bind(this,`connection`);this._removeListeners=m(this._server,{listening:this.emit.bind(this,`listening`),error:this.emit.bind(this,`error`),upgrade:(t,n,r)=>{this.handleUpgrade(t,n,r,e)}})}e.perMessageDeflate===!0&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=0}address(){if(this.options.noServer)throw Error(`The server is operating in "noServer" mode`);return this._server?this._server.address():null}close(e){if(this._state===2){e&&this.once(`close`,()=>{e(Error(`The server is not running`))}),process.nextTick(h,this);return}if(e&&this.once(`close`,e),this._state!==1)if(this._state=1,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(h,this);else{let e=this._server;this._removeListeners(),this._removeListeners=this._server=null,e.close(()=>{h(this)})}}shouldHandle(e){if(this.options.path){let t=e.url.indexOf(`?`);if((t===-1?e.url:e.url.slice(0,t))!==this.options.path)return!1}return!0}handleUpgrade(e,t,n,r){t.on(`error`,g);let i=e.headers[`sec-websocket-key`],a=e.headers.upgrade,l=+e.headers[`sec-websocket-version`];if(e.method!==`GET`){v(this,e,t,405,`Invalid HTTP method`);return}if(a===void 0||a.toLowerCase()!==`websocket`){v(this,e,t,400,`Invalid Upgrade header`);return}if(i===void 0||!p.test(i)){v(this,e,t,400,`Missing or invalid Sec-WebSocket-Key header`);return}if(l!==13&&l!==8){v(this,e,t,400,`Missing or invalid Sec-WebSocket-Version header`,{"Sec-WebSocket-Version":`13, 8`});return}if(!this.shouldHandle(e)){_(t,400);return}let u=e.headers[`sec-websocket-protocol`],d=new Set;if(u!==void 0)try{d=c.parse(u)}catch{v(this,e,t,400,`Invalid Sec-WebSocket-Protocol header`);return}let f=e.headers[`sec-websocket-extensions`],m={};if(this.options.perMessageDeflate&&f!==void 0){let n=new s(this.options.perMessageDeflate,!0,this.options.maxPayload);try{let e=o.parse(f);e[s.extensionName]&&(n.accept(e[s.extensionName]),m[s.extensionName]=n)}catch{v(this,e,t,400,`Invalid or unacceptable Sec-WebSocket-Extensions header`);return}}if(this.options.verifyClient){let a={origin:e.headers[`${l===8?`sec-websocket-origin`:`origin`}`],secure:!!(e.socket.authorized||e.socket.encrypted),req:e};if(this.options.verifyClient.length===2){this.options.verifyClient(a,(a,o,s,c)=>{if(!a)return _(t,o||401,s,c);this.completeUpgrade(m,i,d,e,t,n,r)});return}if(!this.options.verifyClient(a))return _(t,401)}this.completeUpgrade(m,i,d,e,t,n,r)}completeUpgrade(e,t,n,r,i,c,l){if(!i.readable||!i.writable)return i.destroy();if(i[f])throw Error(`server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration`);if(this._state>0)return _(i,503);let u=[`HTTP/1.1 101 Switching Protocols`,`Upgrade: websocket`,`Connection: Upgrade`,`Sec-WebSocket-Accept: ${a(`sha1`).update(t+d).digest(`base64`)}`],p=new this.options.WebSocket(null,void 0,this.options);if(n.size){let e=this.options.handleProtocols?this.options.handleProtocols(n,r):n.values().next().value;e&&(u.push(`Sec-WebSocket-Protocol: ${e}`),p._protocol=e)}if(e[s.extensionName]){let t=e[s.extensionName].params,n=o.format({[s.extensionName]:[t]});u.push(`Sec-WebSocket-Extensions: ${n}`),p._extensions=e}this.emit(`headers`,u,r),i.write(u.concat(`\r
823
+ `+n)}function y(e,t,n,r,i,a){if(e.listenerCount(`wsClientError`)){let r=Error(i);Error.captureStackTrace(r,y),e.emit(`wsClientError`,r,n,t)}else v(n,r,i,a)}}));Uye(),g5(),f5(),m5(),h5(),v5(),_5(),Wye();let y5,b5,x5,S5,C5=!0;typeof process<`u`&&({FORCE_COLOR:y5,NODE_DISABLE_COLORS:b5,NO_COLOR:x5,TERM:S5}=process.env||{},C5=process.stdout&&process.stdout.isTTY);const w5={enabled:!b5&&x5==null&&S5!==`dumb`&&(y5!=null&&y5!==`0`||C5),reset:E5(0,0),bold:E5(1,22),dim:E5(2,22),italic:E5(3,23),underline:E5(4,24),inverse:E5(7,27),hidden:E5(8,28),strikethrough:E5(9,29),black:E5(30,39),red:E5(31,39),green:E5(32,39),yellow:E5(33,39),blue:E5(34,39),magenta:E5(35,39),cyan:E5(36,39),white:E5(37,39),gray:E5(90,39),grey:E5(90,39),bgBlack:E5(40,49),bgRed:E5(41,49),bgGreen:E5(42,49),bgYellow:E5(43,49),bgBlue:E5(44,49),bgMagenta:E5(45,49),bgCyan:E5(46,49),bgWhite:E5(47,49)};function T5(e,t){let n=0,r,i=``,a=``;for(;n<e.length;n++)r=e[n],i+=r.open,a+=r.close,~t.indexOf(r.close)&&(t=t.replace(r.rgx,r.close+r.open));return i+t+a}function Gye(e,t){let n={has:e,keys:t};return n.reset=w5.reset.bind(n),n.bold=w5.bold.bind(n),n.dim=w5.dim.bind(n),n.italic=w5.italic.bind(n),n.underline=w5.underline.bind(n),n.inverse=w5.inverse.bind(n),n.hidden=w5.hidden.bind(n),n.strikethrough=w5.strikethrough.bind(n),n.black=w5.black.bind(n),n.red=w5.red.bind(n),n.green=w5.green.bind(n),n.yellow=w5.yellow.bind(n),n.blue=w5.blue.bind(n),n.magenta=w5.magenta.bind(n),n.cyan=w5.cyan.bind(n),n.white=w5.white.bind(n),n.gray=w5.gray.bind(n),n.grey=w5.grey.bind(n),n.bgBlack=w5.bgBlack.bind(n),n.bgRed=w5.bgRed.bind(n),n.bgGreen=w5.bgGreen.bind(n),n.bgYellow=w5.bgYellow.bind(n),n.bgBlue=w5.bgBlue.bind(n),n.bgMagenta=w5.bgMagenta.bind(n),n.bgCyan=w5.bgCyan.bind(n),n.bgWhite=w5.bgWhite.bind(n),n}function E5(e,t){let n={open:`\x1b[${e}m`,close:`\x1b[${t}m`,rgx:RegExp(`\\x1b\\[${t}m`,`g`)};return function(t){return this!==void 0&&this.has!==void 0?(~this.has.indexOf(e)||(this.has.push(e),this.keys.push(n)),t===void 0?this:w5.enabled?T5(this.keys,t+``):t+``):t===void 0?Gye([e],[n]):w5.enabled?T5([n],t+``):t+``}}Number.isNaN,Number.isInteger,Number.isNaN,Number.parseInt,Array.from,Array.isArray;const Kye=String.fromCharCode;String.fromCodePoint,Kye(65535);const D5=typeof TextEncoder<`u`?new TextEncoder:null;let O5=typeof TextDecoder>`u`?null:new TextDecoder(`utf-8`,{fatal:!0,ignoreBOM:!0});O5&&O5.decode(new Uint8Array).length===1&&(O5=null);const k5=e=>Error(e);new Uint8Array(3e4).length/3,D5&&D5.encodeInto,k5(`Unexpected end of array`),k5(`Integer out of Range`),Date.now;var A5=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),j5=o(import.meta.url),M5=A5(((e,t)=>{let n=[`nodebuffer`,`arraybuffer`,`fragments`],r=typeof Blob<`u`;r&&n.push(`blob`),t.exports={BINARY_TYPES:n,CLOSE_TIMEOUT:3e4,EMPTY_BUFFER:Buffer.alloc(0),GUID:`258EAFA5-E914-47DA-95CA-C5AB0DC85B11`,hasBlob:r,kForOnEventAttribute:Symbol(`kIsForOnEventAttribute`),kListener:Symbol(`kListener`),kStatusCode:Symbol(`status-code`),kWebSocket:Symbol(`websocket`),NOOP:()=>{}}})),N5=A5(((e,t)=>{let{EMPTY_BUFFER:n}=M5(),r=Buffer[Symbol.species];function i(e,t){if(e.length===0)return n;if(e.length===1)return e[0];let i=Buffer.allocUnsafe(t),a=0;for(let t=0;t<e.length;t++){let n=e[t];i.set(n,a),a+=n.length}return a<t?new r(i.buffer,i.byteOffset,a):i}function a(e,t,n,r,i){for(let a=0;a<i;a++)n[r+a]=e[a]^t[a&3]}function o(e,t){for(let n=0;n<e.length;n++)e[n]^=t[n&3]}function s(e){return e.length===e.buffer.byteLength?e.buffer:e.buffer.slice(e.byteOffset,e.byteOffset+e.length)}function c(e){if(c.readOnly=!0,Buffer.isBuffer(e))return e;let t;return e instanceof ArrayBuffer?t=new r(e):ArrayBuffer.isView(e)?t=new r(e.buffer,e.byteOffset,e.byteLength):(t=Buffer.from(e),c.readOnly=!1),t}if(t.exports={concat:i,mask:a,toArrayBuffer:s,toBuffer:c,unmask:o},!process.env.WS_NO_BUFFER_UTIL)try{let e=j5(`bufferutil`);t.exports.mask=function(t,n,r,i,o){o<48?a(t,n,r,i,o):e.mask(t,n,r,i,o)},t.exports.unmask=function(t,n){t.length<32?o(t,n):e.unmask(t,n)}}catch{}})),qye=A5(((e,t)=>{let n=Symbol(`kDone`),r=Symbol(`kRun`);t.exports=class{constructor(e){this[n]=()=>{this.pending--,this[r]()},this.concurrency=e||1/0,this.jobs=[],this.pending=0}add(e){this.jobs.push(e),this[r]()}[r](){if(this.pending!==this.concurrency&&this.jobs.length){let e=this.jobs.shift();this.pending++,e(this[n])}}}})),P5=A5(((e,t)=>{let n=j5(`zlib`),r=N5(),i=qye(),{kStatusCode:a}=M5(),o=Buffer[Symbol.species],s=Buffer.from([0,0,255,255]),c=Symbol(`permessage-deflate`),l=Symbol(`total-length`),u=Symbol(`callback`),d=Symbol(`buffers`),f=Symbol(`error`),p;t.exports=class{constructor(e,t,n){this._maxPayload=n|0,this._options=e||{},this._threshold=this._options.threshold===void 0?1024:this._options.threshold,this._isServer=!!t,this._deflate=null,this._inflate=null,this.params=null,p||=new i(this._options.concurrencyLimit===void 0?10:this._options.concurrencyLimit)}static get extensionName(){return`permessage-deflate`}offer(){let e={};return this._options.serverNoContextTakeover&&(e.server_no_context_takeover=!0),this._options.clientNoContextTakeover&&(e.client_no_context_takeover=!0),this._options.serverMaxWindowBits&&(e.server_max_window_bits=this._options.serverMaxWindowBits),this._options.clientMaxWindowBits?e.client_max_window_bits=this._options.clientMaxWindowBits:this._options.clientMaxWindowBits??(e.client_max_window_bits=!0),e}accept(e){return e=this.normalizeParams(e),this.params=this._isServer?this.acceptAsServer(e):this.acceptAsClient(e),this.params}cleanup(){if(this._inflate&&=(this._inflate.close(),null),this._deflate){let e=this._deflate[u];this._deflate.close(),this._deflate=null,e&&e(Error(`The deflate stream was closed while data was being processed`))}}acceptAsServer(e){let t=this._options,n=e.find(e=>!(t.serverNoContextTakeover===!1&&e.server_no_context_takeover||e.server_max_window_bits&&(t.serverMaxWindowBits===!1||typeof t.serverMaxWindowBits==`number`&&t.serverMaxWindowBits>e.server_max_window_bits)||typeof t.clientMaxWindowBits==`number`&&!e.client_max_window_bits));if(!n)throw Error(`None of the extension offers can be accepted`);return t.serverNoContextTakeover&&(n.server_no_context_takeover=!0),t.clientNoContextTakeover&&(n.client_no_context_takeover=!0),typeof t.serverMaxWindowBits==`number`&&(n.server_max_window_bits=t.serverMaxWindowBits),typeof t.clientMaxWindowBits==`number`?n.client_max_window_bits=t.clientMaxWindowBits:(n.client_max_window_bits===!0||t.clientMaxWindowBits===!1)&&delete n.client_max_window_bits,n}acceptAsClient(e){let t=e[0];if(this._options.clientNoContextTakeover===!1&&t.client_no_context_takeover)throw Error(`Unexpected parameter "client_no_context_takeover"`);if(!t.client_max_window_bits)typeof this._options.clientMaxWindowBits==`number`&&(t.client_max_window_bits=this._options.clientMaxWindowBits);else if(this._options.clientMaxWindowBits===!1||typeof this._options.clientMaxWindowBits==`number`&&t.client_max_window_bits>this._options.clientMaxWindowBits)throw Error(`Unexpected or invalid parameter "client_max_window_bits"`);return t}normalizeParams(e){return e.forEach(e=>{Object.keys(e).forEach(t=>{let n=e[t];if(n.length>1)throw Error(`Parameter "${t}" must have only a single value`);if(n=n[0],t===`client_max_window_bits`){if(n!==!0){let e=+n;if(!Number.isInteger(e)||e<8||e>15)throw TypeError(`Invalid value for parameter "${t}": ${n}`);n=e}else if(!this._isServer)throw TypeError(`Invalid value for parameter "${t}": ${n}`)}else if(t===`server_max_window_bits`){let e=+n;if(!Number.isInteger(e)||e<8||e>15)throw TypeError(`Invalid value for parameter "${t}": ${n}`);n=e}else if(t===`client_no_context_takeover`||t===`server_no_context_takeover`){if(n!==!0)throw TypeError(`Invalid value for parameter "${t}": ${n}`)}else throw Error(`Unknown parameter "${t}"`);e[t]=n})}),e}decompress(e,t,n){p.add(r=>{this._decompress(e,t,(e,t)=>{r(),n(e,t)})})}compress(e,t,n){p.add(r=>{this._compress(e,t,(e,t)=>{r(),n(e,t)})})}_decompress(e,t,i){let a=this._isServer?`client`:`server`;if(!this._inflate){let e=`${a}_max_window_bits`,t=typeof this.params[e]==`number`?this.params[e]:n.Z_DEFAULT_WINDOWBITS;this._inflate=n.createInflateRaw({...this._options.zlibInflateOptions,windowBits:t}),this._inflate[c]=this,this._inflate[l]=0,this._inflate[d]=[],this._inflate.on(`error`,g),this._inflate.on(`data`,h)}this._inflate[u]=i,this._inflate.write(e),t&&this._inflate.write(s),this._inflate.flush(()=>{let e=this._inflate[f];if(e){this._inflate.close(),this._inflate=null,i(e);return}let n=r.concat(this._inflate[d],this._inflate[l]);this._inflate._readableState.endEmitted?(this._inflate.close(),this._inflate=null):(this._inflate[l]=0,this._inflate[d]=[],t&&this.params[`${a}_no_context_takeover`]&&this._inflate.reset()),i(null,n)})}_compress(e,t,i){let a=this._isServer?`server`:`client`;if(!this._deflate){let e=`${a}_max_window_bits`,t=typeof this.params[e]==`number`?this.params[e]:n.Z_DEFAULT_WINDOWBITS;this._deflate=n.createDeflateRaw({...this._options.zlibDeflateOptions,windowBits:t}),this._deflate[l]=0,this._deflate[d]=[],this._deflate.on(`data`,m)}this._deflate[u]=i,this._deflate.write(e),this._deflate.flush(n.Z_SYNC_FLUSH,()=>{if(!this._deflate)return;let e=r.concat(this._deflate[d],this._deflate[l]);t&&(e=new o(e.buffer,e.byteOffset,e.length-4)),this._deflate[u]=null,this._deflate[l]=0,this._deflate[d]=[],t&&this.params[`${a}_no_context_takeover`]&&this._deflate.reset(),i(null,e)})}};function m(e){this[d].push(e),this[l]+=e.length}function h(e){if(this[l]+=e.length,this[c]._maxPayload<1||this[l]<=this[c]._maxPayload){this[d].push(e);return}this[f]=RangeError(`Max payload size exceeded`),this[f].code=`WS_ERR_UNSUPPORTED_MESSAGE_LENGTH`,this[f][a]=1009,this.removeListener(`data`,h),this.reset()}function g(e){if(this[c]._inflate=null,this[f]){this[u](this[f]);return}e[a]=1007,this[u](e)}})),F5=A5(((e,t)=>{let{isUtf8:n}=j5(`buffer`),{hasBlob:r}=M5(),i=[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 a(e){return e>=1e3&&e<=1014&&e!==1004&&e!==1005&&e!==1006||e>=3e3&&e<=4999}function o(e){let t=e.length,n=0;for(;n<t;)if(!(e[n]&128))n++;else if((e[n]&224)==192){if(n+1===t||(e[n+1]&192)!=128||(e[n]&254)==192)return!1;n+=2}else if((e[n]&240)==224){if(n+2>=t||(e[n+1]&192)!=128||(e[n+2]&192)!=128||e[n]===224&&(e[n+1]&224)==128||e[n]===237&&(e[n+1]&224)==160)return!1;n+=3}else if((e[n]&248)==240){if(n+3>=t||(e[n+1]&192)!=128||(e[n+2]&192)!=128||(e[n+3]&192)!=128||e[n]===240&&(e[n+1]&240)==128||e[n]===244&&e[n+1]>143||e[n]>244)return!1;n+=4}else return!1;return!0}function s(e){return r&&typeof e==`object`&&typeof e.arrayBuffer==`function`&&typeof e.type==`string`&&typeof e.stream==`function`&&(e[Symbol.toStringTag]===`Blob`||e[Symbol.toStringTag]===`File`)}if(t.exports={isBlob:s,isValidStatusCode:a,isValidUTF8:o,tokenChars:i},n)t.exports.isValidUTF8=function(e){return e.length<24?o(e):n(e)};else if(!process.env.WS_NO_UTF_8_VALIDATE)try{let e=j5(`utf-8-validate`);t.exports.isValidUTF8=function(t){return t.length<32?o(t):e(t)}}catch{}})),I5=A5(((e,t)=>{let{Writable:n}=j5(`stream`),r=P5(),{BINARY_TYPES:i,EMPTY_BUFFER:a,kStatusCode:o,kWebSocket:s}=M5(),{concat:c,toArrayBuffer:l,unmask:u}=N5(),{isValidStatusCode:d,isValidUTF8:f}=F5(),p=Buffer[Symbol.species];t.exports=class extends n{constructor(e={}){super(),this._allowSynchronousEvents=e.allowSynchronousEvents===void 0?!0:e.allowSynchronousEvents,this._binaryType=e.binaryType||i[0],this._extensions=e.extensions||{},this._isServer=!!e.isServer,this._maxPayload=e.maxPayload|0,this._skipUTF8Validation=!!e.skipUTF8Validation,this[s]=void 0,this._bufferedBytes=0,this._buffers=[],this._compressed=!1,this._payloadLength=0,this._mask=void 0,this._fragmented=0,this._masked=!1,this._fin=!1,this._opcode=0,this._totalPayloadLength=0,this._messageLength=0,this._fragments=[],this._errored=!1,this._loop=!1,this._state=0}_write(e,t,n){if(this._opcode===8&&this._state==0)return n();this._bufferedBytes+=e.length,this._buffers.push(e),this.startLoop(n)}consume(e){if(this._bufferedBytes-=e,e===this._buffers[0].length)return this._buffers.shift();if(e<this._buffers[0].length){let t=this._buffers[0];return this._buffers[0]=new p(t.buffer,t.byteOffset+e,t.length-e),new p(t.buffer,t.byteOffset,e)}let t=Buffer.allocUnsafe(e);do{let n=this._buffers[0],r=t.length-e;e>=n.length?t.set(this._buffers.shift(),r):(t.set(new Uint8Array(n.buffer,n.byteOffset,e),r),this._buffers[0]=new p(n.buffer,n.byteOffset+e,n.length-e)),e-=n.length}while(e>0);return t}startLoop(e){this._loop=!0;do switch(this._state){case 0:this.getInfo(e);break;case 1:this.getPayloadLength16(e);break;case 2:this.getPayloadLength64(e);break;case 3:this.getMask();break;case 4:this.getData(e);break;case 5:case 6:this._loop=!1;return}while(this._loop);this._errored||e()}getInfo(e){if(this._bufferedBytes<2){this._loop=!1;return}let t=this.consume(2);if(t[0]&48){e(this.createError(RangeError,`RSV2 and RSV3 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_2_3`));return}let n=(t[0]&64)==64;if(n&&!this._extensions[r.extensionName]){e(this.createError(RangeError,`RSV1 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_1`));return}if(this._fin=(t[0]&128)==128,this._opcode=t[0]&15,this._payloadLength=t[1]&127,this._opcode===0){if(n){e(this.createError(RangeError,`RSV1 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_1`));return}if(!this._fragmented){e(this.createError(RangeError,`invalid opcode 0`,!0,1002,`WS_ERR_INVALID_OPCODE`));return}this._opcode=this._fragmented}else if(this._opcode===1||this._opcode===2){if(this._fragmented){e(this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,`WS_ERR_INVALID_OPCODE`));return}this._compressed=n}else if(this._opcode>7&&this._opcode<11){if(!this._fin){e(this.createError(RangeError,`FIN must be set`,!0,1002,`WS_ERR_EXPECTED_FIN`));return}if(n){e(this.createError(RangeError,`RSV1 must be clear`,!0,1002,`WS_ERR_UNEXPECTED_RSV_1`));return}if(this._payloadLength>125||this._opcode===8&&this._payloadLength===1){e(this.createError(RangeError,`invalid payload length ${this._payloadLength}`,!0,1002,`WS_ERR_INVALID_CONTROL_PAYLOAD_LENGTH`));return}}else{e(this.createError(RangeError,`invalid opcode ${this._opcode}`,!0,1002,`WS_ERR_INVALID_OPCODE`));return}if(!this._fin&&!this._fragmented&&(this._fragmented=this._opcode),this._masked=(t[1]&128)==128,this._isServer){if(!this._masked){e(this.createError(RangeError,`MASK must be set`,!0,1002,`WS_ERR_EXPECTED_MASK`));return}}else if(this._masked){e(this.createError(RangeError,`MASK must be clear`,!0,1002,`WS_ERR_UNEXPECTED_MASK`));return}this._payloadLength===126?this._state=1:this._payloadLength===127?this._state=2:this.haveLength(e)}getPayloadLength16(e){if(this._bufferedBytes<2){this._loop=!1;return}this._payloadLength=this.consume(2).readUInt16BE(0),this.haveLength(e)}getPayloadLength64(e){if(this._bufferedBytes<8){this._loop=!1;return}let t=this.consume(8),n=t.readUInt32BE(0);if(n>2**21-1){e(this.createError(RangeError,`Unsupported WebSocket frame: payload length > 2^53 - 1`,!1,1009,`WS_ERR_UNSUPPORTED_DATA_PAYLOAD_LENGTH`));return}this._payloadLength=n*2**32+t.readUInt32BE(4),this.haveLength(e)}haveLength(e){if(this._payloadLength&&this._opcode<8&&(this._totalPayloadLength+=this._payloadLength,this._totalPayloadLength>this._maxPayload&&this._maxPayload>0)){e(this.createError(RangeError,`Max payload size exceeded`,!1,1009,`WS_ERR_UNSUPPORTED_MESSAGE_LENGTH`));return}this._masked?this._state=3:this._state=4}getMask(){if(this._bufferedBytes<4){this._loop=!1;return}this._mask=this.consume(4),this._state=4}getData(e){let t=a;if(this._payloadLength){if(this._bufferedBytes<this._payloadLength){this._loop=!1;return}t=this.consume(this._payloadLength),this._masked&&(this._mask[0]|this._mask[1]|this._mask[2]|this._mask[3])!==0&&u(t,this._mask)}if(this._opcode>7){this.controlMessage(t,e);return}if(this._compressed){this._state=5,this.decompress(t,e);return}t.length&&(this._messageLength=this._totalPayloadLength,this._fragments.push(t)),this.dataMessage(e)}decompress(e,t){this._extensions[r.extensionName].decompress(e,this._fin,(e,n)=>{if(e)return t(e);if(n.length){if(this._messageLength+=n.length,this._messageLength>this._maxPayload&&this._maxPayload>0){t(this.createError(RangeError,`Max payload size exceeded`,!1,1009,`WS_ERR_UNSUPPORTED_MESSAGE_LENGTH`));return}this._fragments.push(n)}this.dataMessage(t),this._state===0&&this.startLoop(t)})}dataMessage(e){if(!this._fin){this._state=0;return}let t=this._messageLength,n=this._fragments;if(this._totalPayloadLength=0,this._messageLength=0,this._fragmented=0,this._fragments=[],this._opcode===2){let r;r=this._binaryType===`nodebuffer`?c(n,t):this._binaryType===`arraybuffer`?l(c(n,t)):this._binaryType===`blob`?new Blob(n):n,this._allowSynchronousEvents?(this.emit(`message`,r,!0),this._state=0):(this._state=6,setImmediate(()=>{this.emit(`message`,r,!0),this._state=0,this.startLoop(e)}))}else{let r=c(n,t);if(!this._skipUTF8Validation&&!f(r)){e(this.createError(Error,`invalid UTF-8 sequence`,!0,1007,`WS_ERR_INVALID_UTF8`));return}this._state===5||this._allowSynchronousEvents?(this.emit(`message`,r,!1),this._state=0):(this._state=6,setImmediate(()=>{this.emit(`message`,r,!1),this._state=0,this.startLoop(e)}))}}controlMessage(e,t){if(this._opcode===8){if(e.length===0)this._loop=!1,this.emit(`conclude`,1005,a),this.end();else{let n=e.readUInt16BE(0);if(!d(n)){t(this.createError(RangeError,`invalid status code ${n}`,!0,1002,`WS_ERR_INVALID_CLOSE_CODE`));return}let r=new p(e.buffer,e.byteOffset+2,e.length-2);if(!this._skipUTF8Validation&&!f(r)){t(this.createError(Error,`invalid UTF-8 sequence`,!0,1007,`WS_ERR_INVALID_UTF8`));return}this._loop=!1,this.emit(`conclude`,n,r),this.end()}this._state=0;return}this._allowSynchronousEvents?(this.emit(this._opcode===9?`ping`:`pong`,e),this._state=0):(this._state=6,setImmediate(()=>{this.emit(this._opcode===9?`ping`:`pong`,e),this._state=0,this.startLoop(t)}))}createError(e,t,n,r,i){this._loop=!1,this._errored=!0;let a=new e(n?`Invalid WebSocket frame: ${t}`:t);return Error.captureStackTrace(a,this.createError),a.code=i,a[o]=r,a}}})),L5=A5(((e,t)=>{let{Duplex:n}=j5(`stream`),{randomFillSync:r}=j5(`crypto`),i=P5(),{EMPTY_BUFFER:a,kWebSocket:o,NOOP:s}=M5(),{isBlob:c,isValidStatusCode:l}=F5(),{mask:u,toBuffer:d}=N5(),f=Symbol(`kByteLength`),p=Buffer.alloc(4),m=8*1024,h,g=m;t.exports=class e{constructor(e,t,n){this._extensions=t||{},n&&(this._generateMask=n,this._maskBuffer=Buffer.alloc(4)),this._socket=e,this._firstFragment=!0,this._compress=!1,this._bufferedBytes=0,this._queue=[],this._state=0,this.onerror=s,this[o]=void 0}static frame(e,t){let n,i=!1,a=2,o=!1;t.mask&&(n=t.maskBuffer||p,t.generateMask?t.generateMask(n):(g===m&&(h===void 0&&(h=Buffer.alloc(m)),r(h,0,m),g=0),n[0]=h[g++],n[1]=h[g++],n[2]=h[g++],n[3]=h[g++]),o=(n[0]|n[1]|n[2]|n[3])===0,a=6);let s;typeof e==`string`?(!t.mask||o)&&t[f]!==void 0?s=t[f]:(e=Buffer.from(e),s=e.length):(s=e.length,i=t.mask&&t.readOnly&&!o);let c=s;s>=65536?(a+=8,c=127):s>125&&(a+=2,c=126);let l=Buffer.allocUnsafe(i?s+a:a);return l[0]=t.fin?t.opcode|128:t.opcode,t.rsv1&&(l[0]|=64),l[1]=c,c===126?l.writeUInt16BE(s,2):c===127&&(l[2]=l[3]=0,l.writeUIntBE(s,4,6)),!t.mask||(l[1]|=128,l[a-4]=n[0],l[a-3]=n[1],l[a-2]=n[2],l[a-1]=n[3],o)?[l,e]:i?(u(e,n,l,a,s),[l]):(u(e,n,e,0,s),[l,e])}close(t,n,r,i){let o;if(t===void 0)o=a;else if(typeof t!=`number`||!l(t))throw TypeError(`First argument must be a valid error code number`);else if(n===void 0||!n.length)o=Buffer.allocUnsafe(2),o.writeUInt16BE(t,0);else{let e=Buffer.byteLength(n);if(e>123)throw RangeError(`The message must not be greater than 123 bytes`);o=Buffer.allocUnsafe(2+e),o.writeUInt16BE(t,0),typeof n==`string`?o.write(n,2):o.set(n,2)}let s={[f]:o.length,fin:!0,generateMask:this._generateMask,mask:r,maskBuffer:this._maskBuffer,opcode:8,readOnly:!1,rsv1:!1};this._state===0?this.sendFrame(e.frame(o,s),i):this.enqueue([this.dispatch,o,!1,s,i])}ping(t,n,r){let i,a;if(typeof t==`string`?(i=Buffer.byteLength(t),a=!1):c(t)?(i=t.size,a=!1):(t=d(t),i=t.length,a=d.readOnly),i>125)throw RangeError(`The data size must not be greater than 125 bytes`);let o={[f]:i,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:9,readOnly:a,rsv1:!1};c(t)?this._state===0?this.getBlobData(t,!1,o,r):this.enqueue([this.getBlobData,t,!1,o,r]):this._state===0?this.sendFrame(e.frame(t,o),r):this.enqueue([this.dispatch,t,!1,o,r])}pong(t,n,r){let i,a;if(typeof t==`string`?(i=Buffer.byteLength(t),a=!1):c(t)?(i=t.size,a=!1):(t=d(t),i=t.length,a=d.readOnly),i>125)throw RangeError(`The data size must not be greater than 125 bytes`);let o={[f]:i,fin:!0,generateMask:this._generateMask,mask:n,maskBuffer:this._maskBuffer,opcode:10,readOnly:a,rsv1:!1};c(t)?this._state===0?this.getBlobData(t,!1,o,r):this.enqueue([this.getBlobData,t,!1,o,r]):this._state===0?this.sendFrame(e.frame(t,o),r):this.enqueue([this.dispatch,t,!1,o,r])}send(e,t,n){let r=this._extensions[i.extensionName],a=t.binary?2:1,o=t.compress,s,l;typeof e==`string`?(s=Buffer.byteLength(e),l=!1):c(e)?(s=e.size,l=!1):(e=d(e),s=e.length,l=d.readOnly),this._firstFragment?(this._firstFragment=!1,o&&r&&r.params[r._isServer?`server_no_context_takeover`:`client_no_context_takeover`]&&(o=s>=r._threshold),this._compress=o):(o=!1,a=0),t.fin&&(this._firstFragment=!0);let u={[f]:s,fin:t.fin,generateMask:this._generateMask,mask:t.mask,maskBuffer:this._maskBuffer,opcode:a,readOnly:l,rsv1:o};c(e)?this._state===0?this.getBlobData(e,this._compress,u,n):this.enqueue([this.getBlobData,e,this._compress,u,n]):this._state===0?this.dispatch(e,this._compress,u,n):this.enqueue([this.dispatch,e,this._compress,u,n])}getBlobData(t,n,r,i){this._bufferedBytes+=r[f],this._state=2,t.arrayBuffer().then(t=>{if(this._socket.destroyed){let e=Error(`The socket was closed while the blob was being read`);process.nextTick(_,this,e,i);return}this._bufferedBytes-=r[f];let a=d(t);n?this.dispatch(a,n,r,i):(this._state=0,this.sendFrame(e.frame(a,r),i),this.dequeue())}).catch(e=>{process.nextTick(v,this,e,i)})}dispatch(t,n,r,a){if(!n){this.sendFrame(e.frame(t,r),a);return}let o=this._extensions[i.extensionName];this._bufferedBytes+=r[f],this._state=1,o.compress(t,r.fin,(t,n)=>{if(this._socket.destroyed){_(this,Error(`The socket was closed while data was being compressed`),a);return}this._bufferedBytes-=r[f],this._state=0,r.readOnly=!1,this.sendFrame(e.frame(n,r),a),this.dequeue()})}dequeue(){for(;this._state===0&&this._queue.length;){let e=this._queue.shift();this._bufferedBytes-=e[3][f],Reflect.apply(e[0],this,e.slice(1))}}enqueue(e){this._bufferedBytes+=e[3][f],this._queue.push(e)}sendFrame(e,t){e.length===2?(this._socket.cork(),this._socket.write(e[0]),this._socket.write(e[1],t),this._socket.uncork()):this._socket.write(e[0],t)}};function _(e,t,n){typeof n==`function`&&n(t);for(let n=0;n<e._queue.length;n++){let r=e._queue[n],i=r[r.length-1];typeof i==`function`&&i(t)}}function v(e,t,n){_(e,t,n),e.onerror(t)}})),Jye=A5(((e,t)=>{let{kForOnEventAttribute:n,kListener:r}=M5(),i=Symbol(`kCode`),a=Symbol(`kData`),o=Symbol(`kError`),s=Symbol(`kMessage`),c=Symbol(`kReason`),l=Symbol(`kTarget`),u=Symbol(`kType`),d=Symbol(`kWasClean`);var f=class{constructor(e){this[l]=null,this[u]=e}get target(){return this[l]}get type(){return this[u]}};Object.defineProperty(f.prototype,`target`,{enumerable:!0}),Object.defineProperty(f.prototype,`type`,{enumerable:!0});var p=class extends f{constructor(e,t={}){super(e),this[i]=t.code===void 0?0:t.code,this[c]=t.reason===void 0?``:t.reason,this[d]=t.wasClean===void 0?!1:t.wasClean}get code(){return this[i]}get reason(){return this[c]}get wasClean(){return this[d]}};Object.defineProperty(p.prototype,`code`,{enumerable:!0}),Object.defineProperty(p.prototype,`reason`,{enumerable:!0}),Object.defineProperty(p.prototype,`wasClean`,{enumerable:!0});var m=class extends f{constructor(e,t={}){super(e),this[o]=t.error===void 0?null:t.error,this[s]=t.message===void 0?``:t.message}get error(){return this[o]}get message(){return this[s]}};Object.defineProperty(m.prototype,`error`,{enumerable:!0}),Object.defineProperty(m.prototype,`message`,{enumerable:!0});var h=class extends f{constructor(e,t={}){super(e),this[a]=t.data===void 0?null:t.data}get data(){return this[a]}};Object.defineProperty(h.prototype,`data`,{enumerable:!0}),t.exports={CloseEvent:p,ErrorEvent:m,Event:f,EventTarget:{addEventListener(e,t,i={}){for(let a of this.listeners(e))if(!i[n]&&a[r]===t&&!a[n])return;let a;if(e===`message`)a=function(e,n){let r=new h(`message`,{data:n?e:e.toString()});r[l]=this,g(t,this,r)};else if(e===`close`)a=function(e,n){let r=new p(`close`,{code:e,reason:n.toString(),wasClean:this._closeFrameReceived&&this._closeFrameSent});r[l]=this,g(t,this,r)};else if(e===`error`)a=function(e){let n=new m(`error`,{error:e,message:e.message});n[l]=this,g(t,this,n)};else if(e===`open`)a=function(){let e=new f(`open`);e[l]=this,g(t,this,e)};else return;a[n]=!!i[n],a[r]=t,i.once?this.once(e,a):this.on(e,a)},removeEventListener(e,t){for(let i of this.listeners(e))if(i[r]===t&&!i[n]){this.removeListener(e,i);break}}},MessageEvent:h};function g(e,t,n){typeof e==`object`&&e.handleEvent?e.handleEvent.call(e,n):e.call(t,n)}})),R5=A5(((e,t)=>{let{tokenChars:n}=F5();function r(e,t,n){e[t]===void 0?e[t]=[n]:e[t].push(n)}function i(e){let t=Object.create(null),i=Object.create(null),a=!1,o=!1,s=!1,c,l,u=-1,d=-1,f=-1,p=0;for(;p<e.length;p++)if(d=e.charCodeAt(p),c===void 0)if(f===-1&&n[d]===1)u===-1&&(u=p);else if(p!==0&&(d===32||d===9))f===-1&&u!==-1&&(f=p);else if(d===59||d===44){if(u===-1)throw SyntaxError(`Unexpected character at index ${p}`);f===-1&&(f=p);let n=e.slice(u,f);d===44?(r(t,n,i),i=Object.create(null)):c=n,u=f=-1}else throw SyntaxError(`Unexpected character at index ${p}`);else if(l===void 0)if(f===-1&&n[d]===1)u===-1&&(u=p);else if(d===32||d===9)f===-1&&u!==-1&&(f=p);else if(d===59||d===44){if(u===-1)throw SyntaxError(`Unexpected character at index ${p}`);f===-1&&(f=p),r(i,e.slice(u,f),!0),d===44&&(r(t,c,i),i=Object.create(null),c=void 0),u=f=-1}else if(d===61&&u!==-1&&f===-1)l=e.slice(u,p),u=f=-1;else throw SyntaxError(`Unexpected character at index ${p}`);else if(o){if(n[d]!==1)throw SyntaxError(`Unexpected character at index ${p}`);u===-1?u=p:a||=!0,o=!1}else if(s)if(n[d]===1)u===-1&&(u=p);else if(d===34&&u!==-1)s=!1,f=p;else if(d===92)o=!0;else throw SyntaxError(`Unexpected character at index ${p}`);else if(d===34&&e.charCodeAt(p-1)===61)s=!0;else if(f===-1&&n[d]===1)u===-1&&(u=p);else if(u!==-1&&(d===32||d===9))f===-1&&(f=p);else if(d===59||d===44){if(u===-1)throw SyntaxError(`Unexpected character at index ${p}`);f===-1&&(f=p);let n=e.slice(u,f);a&&=(n=n.replace(/\\/g,``),!1),r(i,l,n),d===44&&(r(t,c,i),i=Object.create(null),c=void 0),l=void 0,u=f=-1}else throw SyntaxError(`Unexpected character at index ${p}`);if(u===-1||s||d===32||d===9)throw SyntaxError(`Unexpected end of input`);f===-1&&(f=p);let m=e.slice(u,f);return c===void 0?r(t,m,i):(l===void 0?r(i,m,!0):a?r(i,l,m.replace(/\\/g,``)):r(i,l,m),r(t,c,i)),t}function a(e){return Object.keys(e).map(t=>{let n=e[t];return Array.isArray(n)||(n=[n]),n.map(e=>[t].concat(Object.keys(e).map(t=>{let n=e[t];return Array.isArray(n)||(n=[n]),n.map(e=>e===!0?t:`${t}=${e}`).join(`; `)})).join(`; `)).join(`, `)}).join(`, `)}t.exports={format:a,parse:i}})),z5=A5(((e,t)=>{let n=j5(`events`),r=j5(`https`),i=j5(`http`),a=j5(`net`),o=j5(`tls`),{randomBytes:s,createHash:c}=j5(`crypto`),{Duplex:l,Readable:u}=j5(`stream`),{URL:d}=j5(`url`),f=P5(),p=I5(),m=L5(),{isBlob:h}=F5(),{BINARY_TYPES:g,CLOSE_TIMEOUT:_,EMPTY_BUFFER:v,GUID:y,kForOnEventAttribute:b,kListener:x,kStatusCode:S,kWebSocket:C,NOOP:w}=M5(),{EventTarget:{addEventListener:T,removeEventListener:E}}=Jye(),{format:D,parse:ee}=R5(),{toBuffer:te}=N5(),ne=Symbol(`kAborted`),re=[8,13],ie=[`CONNECTING`,`OPEN`,`CLOSING`,`CLOSED`],ae=/^[!#$%&'*+\-.0-9A-Z^_`|a-z~]+$/;var oe=class e extends n{constructor(t,n,r){super(),this._binaryType=g[0],this._closeCode=1006,this._closeFrameReceived=!1,this._closeFrameSent=!1,this._closeMessage=v,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._autoPong=r.autoPong,this._closeTimeout=r.closeTimeout,this._isServer=!0):(this._bufferedAmount=0,this._isServer=!1,this._redirects=0,n===void 0?n=[]:Array.isArray(n)||(typeof n==`object`&&n?(r=n,n=[]):n=[n]),se(this,t,n,r))}get binaryType(){return this._binaryType}set binaryType(e){g.includes(e)&&(this._binaryType=e,this._receiver&&(this._receiver._binaryType=e))}get bufferedAmount(){return this._socket?this._socket._writableState.length+this._sender._bufferedBytes:this._bufferedAmount}get extensions(){return Object.keys(this._extensions).join()}get isPaused(){return this._paused}get onclose(){return null}get onerror(){return null}get onopen(){return null}get onmessage(){return null}get protocol(){return this._protocol}get readyState(){return this._readyState}get url(){return this._url}setSocket(t,n,r){let i=new p({allowSynchronousEvents:r.allowSynchronousEvents,binaryType:this.binaryType,extensions:this._extensions,isServer:this._isServer,maxPayload:r.maxPayload,skipUTF8Validation:r.skipUTF8Validation}),a=new m(t,this._extensions,r.generateMask);this._receiver=i,this._sender=a,this._socket=t,i[C]=this,a[C]=this,t[C]=this,i.on(`conclude`,k),i.on(`drain`,A),i.on(`error`,fe),i.on(`message`,me),i.on(`ping`,he),i.on(`pong`,j),a.onerror=ge,t.setTimeout&&t.setTimeout(0),t.setNoDelay&&t.setNoDelay(),n.length>0&&t.unshift(n),t.on(`close`,ve),t.on(`data`,ye),t.on(`end`,be),t.on(`error`,xe),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[f.extensionName]&&this._extensions[f.extensionName].cleanup(),this._receiver.removeAllListeners(),this._readyState=e.CLOSED,this.emit(`close`,this._closeCode,this._closeMessage)}close(t,n){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){ue(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,n,!this._isServer,e=>{e||(this._closeFrameSent=!0,(this._closeFrameReceived||this._receiver._writableState.errorEmitted)&&this._socket.end())}),_e(this)}}pause(){this.readyState===e.CONNECTING||this.readyState===e.CLOSED||(this._paused=!0,this._socket.pause())}ping(t,n,r){if(this.readyState===e.CONNECTING)throw Error(`WebSocket is not open: readyState 0 (CONNECTING)`);if(typeof t==`function`?(r=t,t=n=void 0):typeof n==`function`&&(r=n,n=void 0),typeof t==`number`&&(t=t.toString()),this.readyState!==e.OPEN){de(this,t,r);return}n===void 0&&(n=!this._isServer),this._sender.ping(t||v,n,r)}pong(t,n,r){if(this.readyState===e.CONNECTING)throw Error(`WebSocket is not open: readyState 0 (CONNECTING)`);if(typeof t==`function`?(r=t,t=n=void 0):typeof n==`function`&&(r=n,n=void 0),typeof t==`number`&&(t=t.toString()),this.readyState!==e.OPEN){de(this,t,r);return}n===void 0&&(n=!this._isServer),this._sender.pong(t||v,n,r)}resume(){this.readyState===e.CONNECTING||this.readyState===e.CLOSED||(this._paused=!1,this._receiver._writableState.needDrain||this._socket.resume())}send(t,n,r){if(this.readyState===e.CONNECTING)throw Error(`WebSocket is not open: readyState 0 (CONNECTING)`);if(typeof n==`function`&&(r=n,n={}),typeof t==`number`&&(t=t.toString()),this.readyState!==e.OPEN){de(this,t,r);return}let i={binary:typeof t!=`string`,mask:!this._isServer,compress:!0,fin:!0,...n};this._extensions[f.extensionName]||(i.compress=!1),this._sender.send(t||v,i,r)}terminate(){if(this.readyState!==e.CLOSED){if(this.readyState===e.CONNECTING){ue(this,this._req,`WebSocket was closed before the connection was established`);return}this._socket&&(this._readyState=e.CLOSING,this._socket.destroy())}}};Object.defineProperty(oe,`CONNECTING`,{enumerable:!0,value:ie.indexOf(`CONNECTING`)}),Object.defineProperty(oe.prototype,`CONNECTING`,{enumerable:!0,value:ie.indexOf(`CONNECTING`)}),Object.defineProperty(oe,`OPEN`,{enumerable:!0,value:ie.indexOf(`OPEN`)}),Object.defineProperty(oe.prototype,`OPEN`,{enumerable:!0,value:ie.indexOf(`OPEN`)}),Object.defineProperty(oe,`CLOSING`,{enumerable:!0,value:ie.indexOf(`CLOSING`)}),Object.defineProperty(oe.prototype,`CLOSING`,{enumerable:!0,value:ie.indexOf(`CLOSING`)}),Object.defineProperty(oe,`CLOSED`,{enumerable:!0,value:ie.indexOf(`CLOSED`)}),Object.defineProperty(oe.prototype,`CLOSED`,{enumerable:!0,value:ie.indexOf(`CLOSED`)}),[`binaryType`,`bufferedAmount`,`extensions`,`isPaused`,`protocol`,`readyState`,`url`].forEach(e=>{Object.defineProperty(oe.prototype,e,{enumerable:!0})}),[`open`,`error`,`close`,`message`].forEach(e=>{Object.defineProperty(oe.prototype,`on${e}`,{enumerable:!0,get(){for(let t of this.listeners(e))if(t[b])return t[x];return null},set(t){for(let t of this.listeners(e))if(t[b]){this.removeListener(e,t);break}typeof t==`function`&&this.addEventListener(e,t,{[b]:!0})}})}),oe.prototype.addEventListener=T,oe.prototype.removeEventListener=E,t.exports=oe;function se(e,t,n,a){let o={allowSynchronousEvents:!0,autoPong:!0,closeTimeout:_,protocolVersion:re[1],maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!0,followRedirects:!1,maxRedirects:10,...a,socketPath:void 0,hostname:void 0,protocol:void 0,timeout:void 0,method:`GET`,host:void 0,path:void 0,port:void 0};if(e._autoPong=o.autoPong,e._closeTimeout=o.closeTimeout,!re.includes(o.protocolVersion))throw RangeError(`Unsupported protocol version: ${o.protocolVersion} (supported versions: ${re.join(`, `)})`);let l;if(t instanceof d)l=t;else try{l=new d(t)}catch{throw SyntaxError(`Invalid URL: ${t}`)}l.protocol===`http:`?l.protocol=`ws:`:l.protocol===`https:`&&(l.protocol=`wss:`),e._url=l.href;let u=l.protocol===`wss:`,p=l.protocol===`ws+unix:`,m;if(l.protocol!==`ws:`&&!u&&!p?m=`The URL's protocol must be one of "ws:", "wss:", "http:", "https:", or "ws+unix:"`:p&&!l.pathname?m=`The URL's pathname is empty`:l.hash&&(m=`The URL contains a fragment identifier`),m){let t=SyntaxError(m);if(e._redirects===0)throw t;ce(e,t);return}let h=u?443:80,g=s(16).toString(`base64`),v=u?r.request:i.request,b=new Set,x;if(o.createConnection=o.createConnection||(u?le:O),o.defaultPort=o.defaultPort||h,o.port=l.port||h,o.host=l.hostname.startsWith(`[`)?l.hostname.slice(1,-1):l.hostname,o.headers={...o.headers,"Sec-WebSocket-Version":o.protocolVersion,"Sec-WebSocket-Key":g,Connection:`Upgrade`,Upgrade:`websocket`},o.path=l.pathname+l.search,o.timeout=o.handshakeTimeout,o.perMessageDeflate&&(x=new f(o.perMessageDeflate===!0?{}:o.perMessageDeflate,!1,o.maxPayload),o.headers[`Sec-WebSocket-Extensions`]=D({[f.extensionName]:x.offer()})),n.length){for(let e of n){if(typeof e!=`string`||!ae.test(e)||b.has(e))throw SyntaxError(`An invalid or duplicated subprotocol was specified`);b.add(e)}o.headers[`Sec-WebSocket-Protocol`]=n.join(`,`)}if(o.origin&&(o.protocolVersion<13?o.headers[`Sec-WebSocket-Origin`]=o.origin:o.headers.Origin=o.origin),(l.username||l.password)&&(o.auth=`${l.username}:${l.password}`),p){let e=o.path.split(`:`);o.socketPath=e[0],o.path=e[1]}let S;if(o.followRedirects){if(e._redirects===0){e._originalIpc=p,e._originalSecure=u,e._originalHostOrSocketPath=p?o.socketPath:l.host;let t=a&&a.headers;if(a={...a,headers:{}},t)for(let[e,n]of Object.entries(t))a.headers[e.toLowerCase()]=n}else if(e.listenerCount(`redirect`)===0){let t=p?e._originalIpc?o.socketPath===e._originalHostOrSocketPath:!1:e._originalIpc?!1:l.host===e._originalHostOrSocketPath;(!t||e._originalSecure&&!u)&&(delete o.headers.authorization,delete o.headers.cookie,t||delete o.headers.host,o.auth=void 0)}o.auth&&!a.headers.authorization&&(a.headers.authorization=`Basic `+Buffer.from(o.auth).toString(`base64`)),S=e._req=v(o),e._redirects&&e.emit(`redirect`,e.url,S)}else S=e._req=v(o);o.timeout&&S.on(`timeout`,()=>{ue(e,S,`Opening handshake has timed out`)}),S.on(`error`,t=>{S===null||S[ne]||(S=e._req=null,ce(e,t))}),S.on(`response`,r=>{let i=r.headers.location,s=r.statusCode;if(i&&o.followRedirects&&s>=300&&s<400){if(++e._redirects>o.maxRedirects){ue(e,S,`Maximum redirects exceeded`);return}S.abort();let r;try{r=new d(i,t)}catch{ce(e,SyntaxError(`Invalid URL: ${i}`));return}se(e,r,n,a)}else e.emit(`unexpected-response`,S,r)||ue(e,S,`Unexpected server response: ${r.statusCode}`)}),S.on(`upgrade`,(t,n,r)=>{if(e.emit(`upgrade`,t),e.readyState!==oe.CONNECTING)return;S=e._req=null;let i=t.headers.upgrade;if(i===void 0||i.toLowerCase()!==`websocket`){ue(e,n,`Invalid Upgrade header`);return}let a=c(`sha1`).update(g+y).digest(`base64`);if(t.headers[`sec-websocket-accept`]!==a){ue(e,n,`Invalid Sec-WebSocket-Accept header`);return}let s=t.headers[`sec-websocket-protocol`],l;if(s===void 0?b.size&&(l=`Server sent no subprotocol`):b.size?b.has(s)||(l=`Server sent an invalid subprotocol`):l=`Server sent a subprotocol but none was requested`,l){ue(e,n,l);return}s&&(e._protocol=s);let u=t.headers[`sec-websocket-extensions`];if(u!==void 0){if(!x){ue(e,n,`Server sent a Sec-WebSocket-Extensions header but no extension was requested`);return}let t;try{t=ee(u)}catch{ue(e,n,`Invalid Sec-WebSocket-Extensions header`);return}let r=Object.keys(t);if(r.length!==1||r[0]!==f.extensionName){ue(e,n,`Server indicated an extension that was not requested`);return}try{x.accept(t[f.extensionName])}catch{ue(e,n,`Invalid Sec-WebSocket-Extensions header`);return}e._extensions[f.extensionName]=x}e.setSocket(n,r,{allowSynchronousEvents:o.allowSynchronousEvents,generateMask:o.generateMask,maxPayload:o.maxPayload,skipUTF8Validation:o.skipUTF8Validation})}),o.finishRequest?o.finishRequest(S,e):S.end()}function ce(e,t){e._readyState=oe.CLOSING,e._errorEmitted=!0,e.emit(`error`,t),e.emitClose()}function O(e){return e.path=e.socketPath,a.connect(e)}function le(e){return e.path=void 0,!e.servername&&e.servername!==``&&(e.servername=a.isIP(e.host)?``:e.host),o.connect(e)}function ue(e,t,n){e._readyState=oe.CLOSING;let r=Error(n);Error.captureStackTrace(r,ue),t.setHeader?(t[ne]=!0,t.abort(),t.socket&&!t.socket.destroyed&&t.socket.destroy(),process.nextTick(ce,e,r)):(t.destroy(r),t.once(`error`,e.emit.bind(e,`error`)),t.once(`close`,e.emitClose.bind(e)))}function de(e,t,n){if(t){let n=h(t)?t.size:te(t).length;e._socket?e._sender._bufferedBytes+=n:e._bufferedAmount+=n}if(n){let t=Error(`WebSocket is not open: readyState ${e.readyState} (${ie[e.readyState]})`);process.nextTick(n,t)}}function k(e,t){let n=this[C];n._closeFrameReceived=!0,n._closeMessage=t,n._closeCode=e,n._socket[C]!==void 0&&(n._socket.removeListener(`data`,ye),process.nextTick(M,n._socket),e===1005?n.close():n.close(e,t))}function A(){let e=this[C];e.isPaused||e._socket.resume()}function fe(e){let t=this[C];t._socket[C]!==void 0&&(t._socket.removeListener(`data`,ye),process.nextTick(M,t._socket),t.close(e[S])),t._errorEmitted||(t._errorEmitted=!0,t.emit(`error`,e))}function pe(){this[C].emitClose()}function me(e,t){this[C].emit(`message`,e,t)}function he(e){let t=this[C];t._autoPong&&t.pong(e,!this._isServer,w),t.emit(`ping`,e)}function j(e){this[C].emit(`pong`,e)}function M(e){e.resume()}function ge(e){let t=this[C];t.readyState!==oe.CLOSED&&(t.readyState===oe.OPEN&&(t._readyState=oe.CLOSING,_e(t)),this._socket.end(),t._errorEmitted||(t._errorEmitted=!0,t.emit(`error`,e)))}function _e(e){e._closeTimer=setTimeout(e._socket.destroy.bind(e._socket),e._closeTimeout)}function ve(){let e=this[C];if(this.removeListener(`close`,ve),this.removeListener(`data`,ye),this.removeListener(`end`,be),e._readyState=oe.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[C]=void 0,clearTimeout(e._closeTimer),e._receiver._writableState.finished||e._receiver._writableState.errorEmitted?e.emitClose():(e._receiver.on(`error`,pe),e._receiver.on(`finish`,pe))}function ye(e){this[C]._receiver.write(e)||this.pause()}function be(){let e=this[C];e._readyState=oe.CLOSING,e._receiver.end(),this.end()}function xe(){let e=this[C];this.removeListener(`error`,xe),this.on(`error`,w),e&&(e._readyState=oe.CLOSING,this.destroy())}})),Yye=A5(((e,t)=>{z5();let{Duplex:n}=j5(`stream`);function r(e){e.emit(`close`)}function i(){!this.destroyed&&this._writableState.finished&&this.destroy()}function a(e){this.removeListener(`error`,a),this.destroy(),this.listenerCount(`error`)===0&&this.emit(`error`,e)}function o(e,t){let o=!0,s=new n({...t,autoDestroy:!1,emitClose:!1,objectMode:!1,writableObjectMode:!1});return e.on(`message`,function(t,n){let r=!n&&s._readableState.objectMode?t.toString():t;s.push(r)||e.pause()}),e.once(`error`,function(e){s.destroyed||(o=!1,s.destroy(e))}),e.once(`close`,function(){s.destroyed||s.push(null)}),s._destroy=function(t,n){if(e.readyState===e.CLOSED){n(t),process.nextTick(r,s);return}let i=!1;e.once(`error`,function(e){i=!0,n(e)}),e.once(`close`,function(){i||n(t),process.nextTick(r,s)}),o&&e.terminate()},s._final=function(t){if(e.readyState===e.CONNECTING){e.once(`open`,function(){s._final(t)});return}e._socket!==null&&(e._socket._writableState.finished?(t(),s._readableState.endEmitted&&s.destroy()):(e._socket.once(`finish`,function(){t()}),e.close()))},s._read=function(){e.isPaused&&e.resume()},s._write=function(t,n,r){if(e.readyState===e.CONNECTING){e.once(`open`,function(){s._write(t,n,r)});return}e.send(t,r)},s.on(`end`,i),s.on(`error`,a),s}t.exports=o})),Xye=A5(((e,t)=>{let{tokenChars:n}=F5();function r(e){let t=new Set,r=-1,i=-1,a=0;for(;a<e.length;a++){let o=e.charCodeAt(a);if(i===-1&&n[o]===1)r===-1&&(r=a);else if(a!==0&&(o===32||o===9))i===-1&&r!==-1&&(i=a);else if(o===44){if(r===-1)throw SyntaxError(`Unexpected character at index ${a}`);i===-1&&(i=a);let n=e.slice(r,i);if(t.has(n))throw SyntaxError(`The "${n}" subprotocol is duplicated`);t.add(n),r=i=-1}else throw SyntaxError(`Unexpected character at index ${a}`)}if(r===-1||i!==-1)throw SyntaxError(`Unexpected end of input`);let o=e.slice(r,a);if(t.has(o))throw SyntaxError(`The "${o}" subprotocol is duplicated`);return t.add(o),t}t.exports={parse:r}})),Zye=A5(((e,t)=>{let n=j5(`events`),r=j5(`http`),{Duplex:i}=j5(`stream`),{createHash:a}=j5(`crypto`),o=R5(),s=P5(),c=Xye(),l=z5(),{CLOSE_TIMEOUT:u,GUID:d,kWebSocket:f}=M5(),p=/^[+/0-9A-Za-z]{22}==$/;t.exports=class extends n{constructor(e,t){if(super(),e={allowSynchronousEvents:!0,autoPong:!0,maxPayload:100*1024*1024,skipUTF8Validation:!1,perMessageDeflate:!1,handleProtocols:null,clientTracking:!0,closeTimeout:u,verifyClient:null,noServer:!1,backlog:null,server:null,host:null,path:null,port:null,WebSocket:l,...e},e.port==null&&!e.server&&!e.noServer||e.port!=null&&(e.server||e.noServer)||e.server&&e.noServer)throw TypeError(`One and only one of the "port", "server", or "noServer" options must be specified`);if(e.port==null?e.server&&(this._server=e.server):(this._server=r.createServer((e,t)=>{let n=r.STATUS_CODES[426];t.writeHead(426,{"Content-Length":n.length,"Content-Type":`text/plain`}),t.end(n)}),this._server.listen(e.port,e.host,e.backlog,t)),this._server){let e=this.emit.bind(this,`connection`);this._removeListeners=m(this._server,{listening:this.emit.bind(this,`listening`),error:this.emit.bind(this,`error`),upgrade:(t,n,r)=>{this.handleUpgrade(t,n,r,e)}})}e.perMessageDeflate===!0&&(e.perMessageDeflate={}),e.clientTracking&&(this.clients=new Set,this._shouldEmitClose=!1),this.options=e,this._state=0}address(){if(this.options.noServer)throw Error(`The server is operating in "noServer" mode`);return this._server?this._server.address():null}close(e){if(this._state===2){e&&this.once(`close`,()=>{e(Error(`The server is not running`))}),process.nextTick(h,this);return}if(e&&this.once(`close`,e),this._state!==1)if(this._state=1,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(h,this);else{let e=this._server;this._removeListeners(),this._removeListeners=this._server=null,e.close(()=>{h(this)})}}shouldHandle(e){if(this.options.path){let t=e.url.indexOf(`?`);if((t===-1?e.url:e.url.slice(0,t))!==this.options.path)return!1}return!0}handleUpgrade(e,t,n,r){t.on(`error`,g);let i=e.headers[`sec-websocket-key`],a=e.headers.upgrade,l=+e.headers[`sec-websocket-version`];if(e.method!==`GET`){v(this,e,t,405,`Invalid HTTP method`);return}if(a===void 0||a.toLowerCase()!==`websocket`){v(this,e,t,400,`Invalid Upgrade header`);return}if(i===void 0||!p.test(i)){v(this,e,t,400,`Missing or invalid Sec-WebSocket-Key header`);return}if(l!==13&&l!==8){v(this,e,t,400,`Missing or invalid Sec-WebSocket-Version header`,{"Sec-WebSocket-Version":`13, 8`});return}if(!this.shouldHandle(e)){_(t,400);return}let u=e.headers[`sec-websocket-protocol`],d=new Set;if(u!==void 0)try{d=c.parse(u)}catch{v(this,e,t,400,`Invalid Sec-WebSocket-Protocol header`);return}let f=e.headers[`sec-websocket-extensions`],m={};if(this.options.perMessageDeflate&&f!==void 0){let n=new s(this.options.perMessageDeflate,!0,this.options.maxPayload);try{let e=o.parse(f);e[s.extensionName]&&(n.accept(e[s.extensionName]),m[s.extensionName]=n)}catch{v(this,e,t,400,`Invalid or unacceptable Sec-WebSocket-Extensions header`);return}}if(this.options.verifyClient){let a={origin:e.headers[`${l===8?`sec-websocket-origin`:`origin`}`],secure:!!(e.socket.authorized||e.socket.encrypted),req:e};if(this.options.verifyClient.length===2){this.options.verifyClient(a,(a,o,s,c)=>{if(!a)return _(t,o||401,s,c);this.completeUpgrade(m,i,d,e,t,n,r)});return}if(!this.options.verifyClient(a))return _(t,401)}this.completeUpgrade(m,i,d,e,t,n,r)}completeUpgrade(e,t,n,r,i,c,l){if(!i.readable||!i.writable)return i.destroy();if(i[f])throw Error(`server.handleUpgrade() was called more than once with the same socket, possibly due to a misconfiguration`);if(this._state>0)return _(i,503);let u=[`HTTP/1.1 101 Switching Protocols`,`Upgrade: websocket`,`Connection: Upgrade`,`Sec-WebSocket-Accept: ${a(`sha1`).update(t+d).digest(`base64`)}`],p=new this.options.WebSocket(null,void 0,this.options);if(n.size){let e=this.options.handleProtocols?this.options.handleProtocols(n,r):n.values().next().value;e&&(u.push(`Sec-WebSocket-Protocol: ${e}`),p._protocol=e)}if(e[s.extensionName]){let t=e[s.extensionName].params,n=o.format({[s.extensionName]:[t]});u.push(`Sec-WebSocket-Extensions: ${n}`),p._extensions=e}this.emit(`headers`,u,r),i.write(u.concat(`\r
824
824
  `).join(`\r
825
825
  `)),i.removeListener(`error`,g),p.setSocket(i,c,{allowSynchronousEvents:this.options.allowSynchronousEvents,maxPayload:this.options.maxPayload,skipUTF8Validation:this.options.skipUTF8Validation}),this.clients&&(this.clients.add(p),p.on(`close`,()=>{this.clients.delete(p),this._shouldEmitClose&&!this.clients.size&&process.nextTick(h,this)})),l(p,r)}};function m(e,t){for(let n of Object.keys(t))e.on(n,t[n]);return function(){for(let n of Object.keys(t))e.removeListener(n,t[n])}}function h(e){e._state=2,e.emit(`close`)}function g(){this.destroy()}function _(e,t,n,i){n||=r.STATUS_CODES[t],i={Connection:`close`,"Content-Type":`text/html`,"Content-Length":Buffer.byteLength(n),...i},e.once(`finish`,e.destroy),e.end(`HTTP/1.1 ${t} ${r.STATUS_CODES[t]}\r\n`+Object.keys(i).map(e=>`${e}: ${i[e]}`).join(`\r
826
826
  `)+`\r
827
827
  \r
828
- `+n)}function v(e,t,n,r,i,a){if(e.listenerCount(`wsClientError`)){let r=Error(i);Error.captureStackTrace(r,v),e.emit(`wsClientError`,r,n,t)}else _(n,r,i,a)}}));Jye(),I5(),L5(),z5(),Xye(),o1(`config-persistence`),o1(`head-watcher`),o1(`shadow-gc`),o1(`shadow-maintenance`),(()=>{let e=process.env.OK_SHADOW_MAINTENANCE_DEAD_CHAIN_THRESHOLD;if(!e)return 5;let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:5})(),(()=>{let e=process.env.OK_SHADOW_MAINTENANCE_CONSOLIDATION_SPACING_MS;if(!e)return 600*1e3;let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:600*1e3})(),o1(`mermaid-persistence`),o1(`persistence`),o1(`persistence-staleness`),o1(`removed-docs-journal`),o1(`server-observers`),o1(`github-permissions`),o1(`sync-engine`),Ie(s),(()=>{let e=Object.freeze({origin:`park-snapshot`,paired:!0});return Object.freeze({source:`local`,skipStoreHooks:!1,context:e})})();let B5=null;s1(()=>{B5?.disable(),B5=null}),o1(`skill-migrate`);function V5(e){return[{host:`agents`,root:`.agents/skills`},...Object.entries(e).filter(e=>e[1]!==null).map(([e,t])=>({host:e,root:t}))].sort((e,t)=>{let n=D3.indexOf(e.host),r=D3.indexOf(t.host);return(n===-1?D3.length:n)-(r===-1?D3.length:r)||e.host.localeCompare(t.host)})}V5(Sl),V5(Cl),o1(`skill-reconcile`),[...wl],Number(process.env.OK_DESTROY_STEP_TIMEOUT_MS);const Zye=Ts;M(se(),`.ok`,`logs`),Ie(s),o1(`project-git`),o1(`project-skill-git`),Tl.map(e=>e.replace(/\/$/,``));const H5=bl,U5=xl,W5=El,G5=`node`,K5={MCP_DEBUG:`1`,OK_LOG_FILE:`/tmp/ok-mcp.log`},q5=`# ok-mcp-v2
828
+ `+n)}function v(e,t,n,r,i,a){if(e.listenerCount(`wsClientError`)){let r=Error(i);Error.captureStackTrace(r,v),e.emit(`wsClientError`,r,n,t)}else _(n,r,i,a)}}));Yye(),I5(),L5(),z5(),Zye(),o1(`config-persistence`),o1(`head-watcher`),o1(`shadow-gc`),o1(`shadow-maintenance`),(()=>{let e=process.env.OK_SHADOW_MAINTENANCE_DEAD_CHAIN_THRESHOLD;if(!e)return 5;let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:5})(),(()=>{let e=process.env.OK_SHADOW_MAINTENANCE_CONSOLIDATION_SPACING_MS;if(!e)return 600*1e3;let t=Number.parseInt(e,10);return Number.isFinite(t)&&t>0?t:600*1e3})(),o1(`mermaid-persistence`),o1(`persistence`),o1(`persistence-staleness`),o1(`removed-docs-journal`),o1(`server-observers`),o1(`github-permissions`),o1(`sync-engine`),Ie(s),(()=>{let e=Object.freeze({origin:`park-snapshot`,paired:!0});return Object.freeze({source:`local`,skipStoreHooks:!1,context:e})})();let B5=null;s1(()=>{B5?.disable(),B5=null}),o1(`skill-migrate`);function V5(e){return[{host:`agents`,root:`.agents/skills`},...Object.entries(e).filter(e=>e[1]!==null).map(([e,t])=>({host:e,root:t}))].sort((e,t)=>{let n=D3.indexOf(e.host),r=D3.indexOf(t.host);return(n===-1?D3.length:n)-(r===-1?D3.length:r)||e.host.localeCompare(t.host)})}V5(Sl),V5(Cl),o1(`skill-reconcile`),[...wl],Number(process.env.OK_DESTROY_STEP_TIMEOUT_MS);const Qye=Ts;M(se(),`.ok`,`logs`),Ie(s),o1(`project-git`),o1(`project-skill-git`),Tl.map(e=>e.replace(/\/$/,``));const H5=bl,U5=xl,W5=El,G5=`node`,K5={MCP_DEBUG:`1`,OK_LOG_FILE:`/tmp/ok-mcp.log`},q5=`# ok-mcp-v2
829
829
  USER_BUNDLE="$HOME/Applications/OpenKnowledge.app/Contents/Resources/cli/bin/ok.sh"
830
830
  [ -f "$USER_BUNDLE" ] && [ -x "$USER_BUNDLE" ] && exec "$USER_BUNDLE" mcp
831
831
  BUNDLE="/Applications/OpenKnowledge.app/Contents/Resources/cli/bin/ok.sh"
@@ -861,7 +861,7 @@ foreach ($d in $dirs) {
861
861
  if (Test-Path -LiteralPath $probe -PathType Leaf) { & $probe -y '@inkeep/open-knowledge@latest' mcp; exit $LASTEXITCODE }
862
862
  }
863
863
  [Console]::Error.WriteLine('OpenKnowledge: install Node.js 24+ (npm i -g @inkeep/open-knowledge), then restart your editor')
864
- exit 127`,Y5=`// ok-pi-bridge`,X5=`${Y5}-v1`;function Z5(e){if(typeof e!=`object`||!e)return!1;let t=e;if(t.command===`/bin/sh`){if(!Array.isArray(t.args)||t.args[0]!==`-l`||t.args[1]!==`-c`)return!1;let e=t.args[2];return typeof e==`string`&&e.includes(`# ok-mcp-v2`)}if(t.command===`powershell`){if(!Array.isArray(t.args)||t.args[0]!==`-NoProfile`||t.args[1]!==`-NonInteractive`||t.args[2]!==`-Command`)return!1;let e=t.args[3];return typeof e==`string`&&e.includes(`# ok-mcp-win-v1`)}if(t.type===`local`&&Array.isArray(t.command)){if(t.command[0]===`/bin/sh`){if(t.command[1]!==`-l`||t.command[2]!==`-c`)return!1;let e=t.command[3];return typeof e==`string`&&e.includes(`# ok-mcp-v2`)}if(t.command[0]===`powershell`){if(t.command[1]!==`-NoProfile`||t.command[2]!==`-NonInteractive`||t.command[3]!==`-Command`)return!1;let e=t.command[4];return typeof e==`string`&&e.includes(`# ok-mcp-win-v1`)}return!1}if(t.command===`ok-pi-managed-extension`){if(!Array.isArray(t.args))return!1;let e=t.args[0];return typeof e==`string`&&e.startsWith(X5)}return!1}function Q5(e=process.argv[1]){if(!e)throw Error(`Cannot infer the local CLI entry for --dev-mcp because process.argv[1] is empty.`);let t=ye(e);if(pe(t)===`cli.mjs`&&pe(me(t))===`dist`)return t;let n=t.split(be),r=n.lastIndexOf(`packages`);if(r===-1||n[r+1]!==`cli`)throw Error(`Cannot infer the repo root for --dev-mcp from ${t}. Run the local CLI from this repo so the built dist path can be derived.`);let i=n.slice(0,r);return M(i.length===0?be:i.join(be),`packages`,`cli`,`dist`,`cli.mjs`)}function $5(e={}){return e.mode===`dev`?{command:G5,args:[Q5(),`mcp`],env:{...K5}}:(e.platformName??process.platform)===`win32`?{command:`powershell`,args:[`-NoProfile`,`-NonInteractive`,`-Command`,J5]}:{command:`/bin/sh`,args:[`-l`,`-c`,q5]}}function Qye(e={}){return e.mode===`dev`?{type:`local`,enabled:!0,command:[G5,Q5(),`mcp`],environment:{...K5}}:(e.platformName??process.platform)===`win32`?{type:`local`,enabled:!0,command:[`powershell`,`-NoProfile`,`-NonInteractive`,`-Command`,J5]}:{type:`local`,enabled:!0,command:[`/bin/sh`,`-l`,`-c`,q5]}}function e7(e){if(typeof e!=`object`||!e)return!1;let t=e;return t7(t,$5({mode:`published`,platformName:`darwin`}))||t7(t,$5({mode:`published`,platformName:`win32`}))}function t7(e,t){return Object.keys(e).length===Object.keys(t).length?$ye(e,t):!1}function $ye(e,t){if(e.command!==t.command)return!1;let n=t.args;return!Array.isArray(n)||!Array.isArray(e.args)||e.args.length!==n.length?!1:e.args.every((e,t)=>e===n[t])}function n7(e,t){let n=e=>typeof e==`string`&&e.includes(`# ok-mcp`);return t===`/bin/sh`?e[0]===`-l`&&e[1]===`-c`&&n(e[2]):t===`powershell`?e[0]===`-NoProfile`&&e[1]===`-NonInteractive`&&e[2]===`-Command`&&n(e[3]):!1}function ebe(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.enabled===!1||typeof t.command!=`string`||!Array.isArray(t.args)?!1:n7(t.args,t.command)}function tbe(e){if(typeof e!=`object`||!e)return!1;let t=e;if(t.type!==`local`||t.enabled===!1||!Array.isArray(t.command))return!1;let[n,...r]=t.command;return typeof n==`string`&&n7(r,n)}function r7(e){return e===`win32`?xe:_e}function nbe(e={}){let t=e.platformName??process.platform,n=e.home??se();return r7(t).join(n,`.claude.json`)}function i7(e={}){let t=e.platformName??process.platform,n=e.home??se(),r=e.env??process.env;if(t===`darwin`)return _e.join(n,`Library`,`Application Support`,`Claude`,`claude_desktop_config.json`);if(t===`win32`){let e=r.APPDATA??xe.join(n,`AppData`,`Roaming`);return xe.join(e,`Claude`,`claude_desktop_config.json`)}throw Error(`Claude Desktop is not available on ${t}. Supported: macOS, Windows.`)}function a7(e={}){let t=e.platformName??process.platform,n=e.home??se();return r7(t).join(n,`.cursor`,`mcp.json`)}function rbe(e={}){let t=e.platformName??process.platform,n=e.home??se();return(e.env??process.env).CODEX_HOME??r7(t).join(n,`.codex`)}function o7(e={}){return r7(e.platformName??process.platform).join(rbe(e),`config.toml`)}function s7(e={}){let t=e.platformName??process.platform,n=e.home??se(),r=(e.env??process.env).COPILOT_HOME??r7(t).join(n,`.copilot`);return r7(t).join(r,`mcp-config.json`)}function ibe(e={}){let t=e.platformName??process.platform,n=e.home??se(),r=e.env??process.env,i=r7(t);if(t===`win32`){let e=r.APPDATA??i.join(n,`AppData`,`Roaming`);return i.join(e,`opencode`)}let a=r.XDG_CONFIG_HOME??i.join(n,`.config`);return i.join(a,`opencode`)}function c7(e={}){return r7(e.platformName??process.platform).join(ibe(e),`opencode.json`)}function abe(e={}){let t=e.platformName??process.platform,n=e.home??se();return r7(t).join(n,`.openclaw`,`openclaw.json`)}function obe(e={}){let t=e.platformName??process.platform,n=e.home??se();return r7(t).join(n,`.hermes`,`config.yaml`)}function sbe(e={}){let t=e.platformName??process.platform,n=e.home??se();return(e.env??process.env).PI_CODING_AGENT_DIR??r7(t).join(n,`.pi`,`agent`)}function cbe(e={}){let t=e.platformName??process.platform,n=e.home??se();return r7(t).join(n,`.gemini`,`config`,`mcp_config.json`)}function lbe(e,t){let n=r7(t),r=n.join(e,`.lmstudio`,`mcp.json`),i=n.join(e,`.cache`,`lm-studio`,`mcp.json`);return t===`darwin`?[i,r]:[r,i]}function l7(e={}){let t=e.platformName??process.platform,n=lbe(e.home??se(),t);return n.find(e=>g(e))||n.find(e=>g(me(e)))||n[0]}function ube(e){let t=e.serverName(``);return e.format===`toml`?`[${e.topLevelKey}.${t}]`:[e.topLevelKey,e.serverMapSubKey,t].filter(Boolean).join(`.`)}function dbe(e,t){let n;try{n=e.configPath(``,t)}catch{return null}return n.startsWith(`${t}/`)?`~${n.slice(t.length)}`:n}const u7={claude:{id:`claude`,label:U5.claude,configPath:(e,t)=>nbe({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>Al,buildEntry:(e,t)=>$5(t),scope:`global`,detectPath:(e,t)=>M(t??se(),`.claude`),projectConfigPath:e=>M(e,`.mcp.json`),projectSkillPath:e=>M(e,`.claude`,`skills`,`open-knowledge`,`SKILL.md`)},"claude-desktop":{id:`claude-desktop`,label:U5[`claude-desktop`],configPath:(e,t)=>i7({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>Al,buildEntry:(e,t)=>$5(t),scope:`global`,detectPath:(e,t)=>me(i7({home:t}))},cursor:{id:`cursor`,label:U5.cursor,configPath:(e,t)=>a7({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>Al,buildEntry:(e,t)=>$5(t),scope:`global`,detectPath:(e,t)=>me(a7({home:t})),projectConfigPath:e=>M(e,`.cursor`,`mcp.json`),projectSkillPath:e=>M(e,`.cursor`,`skills`,`open-knowledge`,`SKILL.md`)},codex:{id:`codex`,label:U5.codex,configPath:(e,t)=>o7({home:t}),format:`toml`,topLevelKey:`mcp_servers`,serverName:()=>Al,buildEntry:(e,t)=>$5(t),scope:`global`,detectPath:(e,t)=>me(o7({home:t})),projectConfigPath:e=>M(e,`.codex`,`config.toml`),projectSkillPath:e=>M(e,`.codex`,`skills`,`open-knowledge`,`SKILL.md`)},copilot:{id:`copilot`,label:U5.copilot,configPath:(e,t)=>s7({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>Al,buildEntry:(e,t)=>$5(t),scope:`global`,detectPath:(e,t)=>me(s7({home:t})),projectSkillPath:e=>M(e,`.github`,`skills`,`open-knowledge`,`SKILL.md`)},opencode:{id:`opencode`,label:U5.opencode,configPath:(e,t)=>c7({home:t}),format:`json`,topLevelKey:`mcp`,serverName:()=>Al,buildEntry:(e,t)=>Qye(t),scope:`global`,detectPath:(e,t)=>me(c7({home:t})),projectConfigPath:e=>M(e,`opencode.json`),projectSkillPath:e=>M(e,`.opencode`,`skills`,`open-knowledge`,`SKILL.md`)},openclaw:{id:`openclaw`,label:U5.openclaw,configPath:(e,t)=>abe({home:t}),format:`json`,topLevelKey:`mcp`,serverMapSubKey:`servers`,serverName:()=>Al,buildEntry:(e,t)=>$5(t),scope:`global`,detectPath:(e,t)=>M(t??se(),`.openclaw`),offerOnlyWhenDetected:!0},pi:{id:`pi`,label:U5.pi,configPath:()=>{throw Error("Pi has no user-global MCP config; OK's integration is the project-scoped bridge extension at .pi/extensions/open-knowledge.ts (run `ok init` in the project).")},format:`file`,topLevelKey:`mcpServers`,serverName:()=>Al,buildEntry:()=>{throw Error(`Pi has no MCP entry shape; the managed bridge file is built by buildPiExtensionSource (integrations/pi-extension.ts).`)},scope:`project`,detectPath:(e,t)=>sbe({home:t}),projectConfigPath:e=>M(e,`.pi`,`extensions`,`open-knowledge.ts`),projectSkillPath:e=>M(e,`.pi`,`skills`,`open-knowledge`,`SKILL.md`)},antigravity:{id:`antigravity`,label:U5.antigravity,configPath:(e,t)=>cbe({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>Al,buildEntry:(e,t)=>$5(t),scope:`global`,detectPath:(e,t)=>M(t??se(),`.gemini`),offerOnlyWhenDetected:!0},"lm-studio":{id:`lm-studio`,label:U5[`lm-studio`],configPath:(e,t)=>l7({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>Al,buildEntry:(e,t)=>$5(t),scope:`global`,detectPath:(e,t)=>me(l7({home:t})),offerOnlyWhenDetected:!0},hermes:{id:`hermes`,label:U5.hermes,configPath:(e,t)=>obe({home:t}),format:`yaml`,topLevelKey:`mcp_servers`,serverName:()=>Al,buildEntry:(e,t)=>$5(t),scope:`global`,detectPath:(e,t)=>M(t??se(),`.hermes`),offerOnlyWhenDetected:!0}};function fbe(e){let t=e.filter(e=>!Object.hasOwn(u7,e));if(t.length>0)throw Error(`Unknown editor(s): ${t.join(`, `)}. Valid options: ${H5.join(`, `)}`);return e.map(e=>u7[e])}var d7=i((e=>{var t=class extends Error{constructor(e,t,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},n=class extends t{constructor(e){super(1,`commander.invalidArgument`,e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};e.CommanderError=t,e.InvalidArgumentError=n})),f7=i((e=>{let{InvalidArgumentError:t}=d7();var n=class{constructor(e,t){switch(this.description=t||``,this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case`<`:this.required=!0,this._name=e.slice(1,-1);break;case`[`:this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.endsWith(`...`)&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(e,n)=>{if(!this.argChoices.includes(e))throw new t(`Allowed choices are ${this.argChoices.join(`, `)}.`);return this.variadic?this._collectValue(e,n):e},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function r(e){let t=e.name()+(e.variadic===!0?`...`:``);return e.required?`<`+t+`>`:`[`+t+`]`}e.Argument=n,e.humanReadableArgName=r})),p7=i((e=>{let{humanReadableArgName:t}=f7();var n=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let t=e.commands.filter(e=>!e._hidden),n=e._getHelpCommand();return n&&!n._hidden&&t.push(n),this.sortSubcommands&&t.sort((e,t)=>e.name().localeCompare(t.name())),t}compareOptions(e,t){let n=e=>e.short?e.short.replace(/^-/,``):e.long.replace(/^--/,``);return n(e).localeCompare(n(t))}visibleOptions(e){let t=e.options.filter(e=>!e.hidden),n=e._getHelpOption();if(n&&!n.hidden){let r=n.short&&e._findOption(n.short),i=n.long&&e._findOption(n.long);!r&&!i?t.push(n):n.long&&!i?t.push(e.createOption(n.long,n.description)):n.short&&!r&&t.push(e.createOption(n.short,n.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let n=e.parent;n;n=n.parent){let e=n.options.filter(e=>!e.hidden);t.push(...e)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||``}),e.registeredArguments.find(e=>e.description)?e.registeredArguments:[]}subcommandTerm(e){let n=e.registeredArguments.map(e=>t(e)).join(` `);return e._name+(e._aliases[0]?`|`+e._aliases[0]:``)+(e.options.length?` [options]`:``)+(n?` `+n:``)}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleSubcommandTerm(t.subcommandTerm(n)))),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleArgumentTerm(t.argumentTerm(n)))),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+`|`+e._aliases[0]);let n=``;for(let t=e.parent;t;t=t.parent)n=t.name()+` `+n;return n+t+` `+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(`, `)}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue==`boolean`)&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0){let n=`(${t.join(`, `)})`;return e.description?`${e.description} ${n}`:n}return e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(`, `)}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let n=`(${t.join(`, `)})`;return e.description?`${e.description} ${n}`:n}return e.description}formatItemList(e,t,n){return t.length===0?[]:[n.styleTitle(e),...t,``]}groupItems(e,t,n){let r=new Map;return e.forEach(e=>{let t=n(e);r.has(t)||r.set(t,[])}),t.forEach(e=>{let t=n(e);r.has(t)||r.set(t,[]),r.get(t).push(e)}),r}formatHelp(e,t){let n=t.padWidth(e,t),r=t.helpWidth??80;function i(e,r){return t.formatItem(e,n,r,t)}let a=[`${t.styleTitle(`Usage:`)} ${t.styleUsage(t.commandUsage(e))}`,``],o=t.commandDescription(e);o.length>0&&(a=a.concat([t.boxWrap(t.styleCommandDescription(o),r),``]));let s=t.visibleArguments(e).map(e=>i(t.styleArgumentTerm(t.argumentTerm(e)),t.styleArgumentDescription(t.argumentDescription(e))));if(a=a.concat(this.formatItemList(`Arguments:`,s,t)),this.groupItems(e.options,t.visibleOptions(e),e=>e.helpGroupHeading??`Options:`).forEach((e,n)=>{let r=e.map(e=>i(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e))));a=a.concat(this.formatItemList(n,r,t))}),t.showGlobalOptions){let n=t.visibleGlobalOptions(e).map(e=>i(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e))));a=a.concat(this.formatItemList(`Global Options:`,n,t))}return this.groupItems(e.commands,t.visibleCommands(e),e=>e.helpGroup()||`Commands:`).forEach((e,n)=>{let r=e.map(e=>i(t.styleSubcommandTerm(t.subcommandTerm(e)),t.styleSubcommandDescription(t.subcommandDescription(e))));a=a.concat(this.formatItemList(n,r,t))}),a.join(`
864
+ exit 127`,Y5=`// ok-pi-bridge`,X5=`${Y5}-v1`;function Z5(e){if(typeof e!=`object`||!e)return!1;let t=e;if(t.command===`/bin/sh`){if(!Array.isArray(t.args)||t.args[0]!==`-l`||t.args[1]!==`-c`)return!1;let e=t.args[2];return typeof e==`string`&&e.includes(`# ok-mcp-v2`)}if(t.command===`powershell`){if(!Array.isArray(t.args)||t.args[0]!==`-NoProfile`||t.args[1]!==`-NonInteractive`||t.args[2]!==`-Command`)return!1;let e=t.args[3];return typeof e==`string`&&e.includes(`# ok-mcp-win-v1`)}if(t.type===`local`&&Array.isArray(t.command)){if(t.command[0]===`/bin/sh`){if(t.command[1]!==`-l`||t.command[2]!==`-c`)return!1;let e=t.command[3];return typeof e==`string`&&e.includes(`# ok-mcp-v2`)}if(t.command[0]===`powershell`){if(t.command[1]!==`-NoProfile`||t.command[2]!==`-NonInteractive`||t.command[3]!==`-Command`)return!1;let e=t.command[4];return typeof e==`string`&&e.includes(`# ok-mcp-win-v1`)}return!1}if(t.command===`ok-pi-managed-extension`){if(!Array.isArray(t.args))return!1;let e=t.args[0];return typeof e==`string`&&e.startsWith(X5)}return!1}function Q5(e=process.argv[1]){if(!e)throw Error(`Cannot infer the local CLI entry for --dev-mcp because process.argv[1] is empty.`);let t=ye(e);if(pe(t)===`cli.mjs`&&pe(me(t))===`dist`)return t;let n=t.split(be),r=n.lastIndexOf(`packages`);if(r===-1||n[r+1]!==`cli`)throw Error(`Cannot infer the repo root for --dev-mcp from ${t}. Run the local CLI from this repo so the built dist path can be derived.`);let i=n.slice(0,r);return M(i.length===0?be:i.join(be),`packages`,`cli`,`dist`,`cli.mjs`)}function $5(e={}){return e.mode===`dev`?{command:G5,args:[Q5(),`mcp`],env:{...K5}}:(e.platformName??process.platform)===`win32`?{command:`powershell`,args:[`-NoProfile`,`-NonInteractive`,`-Command`,J5]}:{command:`/bin/sh`,args:[`-l`,`-c`,q5]}}function $ye(e={}){return e.mode===`dev`?{type:`local`,enabled:!0,command:[G5,Q5(),`mcp`],environment:{...K5}}:(e.platformName??process.platform)===`win32`?{type:`local`,enabled:!0,command:[`powershell`,`-NoProfile`,`-NonInteractive`,`-Command`,J5]}:{type:`local`,enabled:!0,command:[`/bin/sh`,`-l`,`-c`,q5]}}function e7(e){if(typeof e!=`object`||!e)return!1;let t=e;return t7(t,$5({mode:`published`,platformName:`darwin`}))||t7(t,$5({mode:`published`,platformName:`win32`}))}function t7(e,t){return Object.keys(e).length===Object.keys(t).length?ebe(e,t):!1}function ebe(e,t){if(e.command!==t.command)return!1;let n=t.args;return!Array.isArray(n)||!Array.isArray(e.args)||e.args.length!==n.length?!1:e.args.every((e,t)=>e===n[t])}function n7(e,t){let n=e=>typeof e==`string`&&e.includes(`# ok-mcp`);return t===`/bin/sh`?e[0]===`-l`&&e[1]===`-c`&&n(e[2]):t===`powershell`?e[0]===`-NoProfile`&&e[1]===`-NonInteractive`&&e[2]===`-Command`&&n(e[3]):!1}function tbe(e){if(typeof e!=`object`||!e)return!1;let t=e;return t.enabled===!1||typeof t.command!=`string`||!Array.isArray(t.args)?!1:n7(t.args,t.command)}function nbe(e){if(typeof e!=`object`||!e)return!1;let t=e;if(t.type!==`local`||t.enabled===!1||!Array.isArray(t.command))return!1;let[n,...r]=t.command;return typeof n==`string`&&n7(r,n)}function r7(e){return e===`win32`?xe:_e}function rbe(e={}){let t=e.platformName??process.platform,n=e.home??se();return r7(t).join(n,`.claude.json`)}function i7(e={}){let t=e.platformName??process.platform,n=e.home??se(),r=e.env??process.env;if(t===`darwin`)return _e.join(n,`Library`,`Application Support`,`Claude`,`claude_desktop_config.json`);if(t===`win32`){let e=r.APPDATA??xe.join(n,`AppData`,`Roaming`);return xe.join(e,`Claude`,`claude_desktop_config.json`)}throw Error(`Claude Desktop is not available on ${t}. Supported: macOS, Windows.`)}function a7(e={}){let t=e.platformName??process.platform,n=e.home??se();return r7(t).join(n,`.cursor`,`mcp.json`)}function ibe(e={}){let t=e.platformName??process.platform,n=e.home??se();return(e.env??process.env).CODEX_HOME??r7(t).join(n,`.codex`)}function o7(e={}){return r7(e.platformName??process.platform).join(ibe(e),`config.toml`)}function s7(e={}){let t=e.platformName??process.platform,n=e.home??se(),r=(e.env??process.env).COPILOT_HOME??r7(t).join(n,`.copilot`);return r7(t).join(r,`mcp-config.json`)}function abe(e={}){let t=e.platformName??process.platform,n=e.home??se(),r=e.env??process.env,i=r7(t);if(t===`win32`){let e=r.APPDATA??i.join(n,`AppData`,`Roaming`);return i.join(e,`opencode`)}let a=r.XDG_CONFIG_HOME??i.join(n,`.config`);return i.join(a,`opencode`)}function c7(e={}){return r7(e.platformName??process.platform).join(abe(e),`opencode.json`)}function obe(e={}){let t=e.platformName??process.platform,n=e.home??se();return r7(t).join(n,`.openclaw`,`openclaw.json`)}function sbe(e={}){let t=e.platformName??process.platform,n=e.home??se();return r7(t).join(n,`.hermes`,`config.yaml`)}function cbe(e={}){let t=e.platformName??process.platform,n=e.home??se();return(e.env??process.env).PI_CODING_AGENT_DIR??r7(t).join(n,`.pi`,`agent`)}function lbe(e={}){let t=e.platformName??process.platform,n=e.home??se();return r7(t).join(n,`.gemini`,`config`,`mcp_config.json`)}function ube(e,t){let n=r7(t),r=n.join(e,`.lmstudio`,`mcp.json`),i=n.join(e,`.cache`,`lm-studio`,`mcp.json`);return t===`darwin`?[i,r]:[r,i]}function l7(e={}){let t=e.platformName??process.platform,n=ube(e.home??se(),t);return n.find(e=>g(e))||n.find(e=>g(me(e)))||n[0]}function dbe(e){let t=e.serverName(``);return e.format===`toml`?`[${e.topLevelKey}.${t}]`:[e.topLevelKey,e.serverMapSubKey,t].filter(Boolean).join(`.`)}function fbe(e,t){let n;try{n=e.configPath(``,t)}catch{return null}return n.startsWith(`${t}/`)?`~${n.slice(t.length)}`:n}const u7={claude:{id:`claude`,label:U5.claude,configPath:(e,t)=>rbe({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>Al,buildEntry:(e,t)=>$5(t),scope:`global`,detectPath:(e,t)=>M(t??se(),`.claude`),projectConfigPath:e=>M(e,`.mcp.json`),projectSkillPath:e=>M(e,`.claude`,`skills`,`open-knowledge`,`SKILL.md`)},"claude-desktop":{id:`claude-desktop`,label:U5[`claude-desktop`],configPath:(e,t)=>i7({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>Al,buildEntry:(e,t)=>$5(t),scope:`global`,detectPath:(e,t)=>me(i7({home:t}))},cursor:{id:`cursor`,label:U5.cursor,configPath:(e,t)=>a7({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>Al,buildEntry:(e,t)=>$5(t),scope:`global`,detectPath:(e,t)=>me(a7({home:t})),projectConfigPath:e=>M(e,`.cursor`,`mcp.json`),projectSkillPath:e=>M(e,`.cursor`,`skills`,`open-knowledge`,`SKILL.md`)},codex:{id:`codex`,label:U5.codex,configPath:(e,t)=>o7({home:t}),format:`toml`,topLevelKey:`mcp_servers`,serverName:()=>Al,buildEntry:(e,t)=>$5(t),scope:`global`,detectPath:(e,t)=>me(o7({home:t})),projectConfigPath:e=>M(e,`.codex`,`config.toml`),projectSkillPath:e=>M(e,`.codex`,`skills`,`open-knowledge`,`SKILL.md`)},copilot:{id:`copilot`,label:U5.copilot,configPath:(e,t)=>s7({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>Al,buildEntry:(e,t)=>$5(t),scope:`global`,detectPath:(e,t)=>me(s7({home:t})),projectSkillPath:e=>M(e,`.github`,`skills`,`open-knowledge`,`SKILL.md`)},opencode:{id:`opencode`,label:U5.opencode,configPath:(e,t)=>c7({home:t}),format:`json`,topLevelKey:`mcp`,serverName:()=>Al,buildEntry:(e,t)=>$ye(t),scope:`global`,detectPath:(e,t)=>me(c7({home:t})),projectConfigPath:e=>M(e,`opencode.json`),projectSkillPath:e=>M(e,`.opencode`,`skills`,`open-knowledge`,`SKILL.md`)},openclaw:{id:`openclaw`,label:U5.openclaw,configPath:(e,t)=>obe({home:t}),format:`json`,topLevelKey:`mcp`,serverMapSubKey:`servers`,serverName:()=>Al,buildEntry:(e,t)=>$5(t),scope:`global`,detectPath:(e,t)=>M(t??se(),`.openclaw`),offerOnlyWhenDetected:!0},pi:{id:`pi`,label:U5.pi,configPath:()=>{throw Error("Pi has no user-global MCP config; OK's integration is the project-scoped bridge extension at .pi/extensions/open-knowledge.ts (run `ok init` in the project).")},format:`file`,topLevelKey:`mcpServers`,serverName:()=>Al,buildEntry:()=>{throw Error(`Pi has no MCP entry shape; the managed bridge file is built by buildPiExtensionSource (integrations/pi-extension.ts).`)},scope:`project`,detectPath:(e,t)=>cbe({home:t}),projectConfigPath:e=>M(e,`.pi`,`extensions`,`open-knowledge.ts`),projectSkillPath:e=>M(e,`.pi`,`skills`,`open-knowledge`,`SKILL.md`)},antigravity:{id:`antigravity`,label:U5.antigravity,configPath:(e,t)=>lbe({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>Al,buildEntry:(e,t)=>$5(t),scope:`global`,detectPath:(e,t)=>M(t??se(),`.gemini`),offerOnlyWhenDetected:!0},"lm-studio":{id:`lm-studio`,label:U5[`lm-studio`],configPath:(e,t)=>l7({home:t}),format:`json`,topLevelKey:`mcpServers`,serverName:()=>Al,buildEntry:(e,t)=>$5(t),scope:`global`,detectPath:(e,t)=>me(l7({home:t})),offerOnlyWhenDetected:!0},hermes:{id:`hermes`,label:U5.hermes,configPath:(e,t)=>sbe({home:t}),format:`yaml`,topLevelKey:`mcp_servers`,serverName:()=>Al,buildEntry:(e,t)=>$5(t),scope:`global`,detectPath:(e,t)=>M(t??se(),`.hermes`),offerOnlyWhenDetected:!0}};function pbe(e){let t=e.filter(e=>!Object.hasOwn(u7,e));if(t.length>0)throw Error(`Unknown editor(s): ${t.join(`, `)}. Valid options: ${H5.join(`, `)}`);return e.map(e=>u7[e])}var d7=i((e=>{var t=class extends Error{constructor(e,t,n){super(n),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name,this.code=t,this.exitCode=e,this.nestedError=void 0}},n=class extends t{constructor(e){super(1,`commander.invalidArgument`,e),Error.captureStackTrace(this,this.constructor),this.name=this.constructor.name}};e.CommanderError=t,e.InvalidArgumentError=n})),f7=i((e=>{let{InvalidArgumentError:t}=d7();var n=class{constructor(e,t){switch(this.description=t||``,this.variadic=!1,this.parseArg=void 0,this.defaultValue=void 0,this.defaultValueDescription=void 0,this.argChoices=void 0,e[0]){case`<`:this.required=!0,this._name=e.slice(1,-1);break;case`[`:this.required=!1,this._name=e.slice(1,-1);break;default:this.required=!0,this._name=e;break}this._name.endsWith(`...`)&&(this.variadic=!0,this._name=this._name.slice(0,-3))}name(){return this._name}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}argParser(e){return this.parseArg=e,this}choices(e){return this.argChoices=e.slice(),this.parseArg=(e,n)=>{if(!this.argChoices.includes(e))throw new t(`Allowed choices are ${this.argChoices.join(`, `)}.`);return this.variadic?this._collectValue(e,n):e},this}argRequired(){return this.required=!0,this}argOptional(){return this.required=!1,this}};function r(e){let t=e.name()+(e.variadic===!0?`...`:``);return e.required?`<`+t+`>`:`[`+t+`]`}e.Argument=n,e.humanReadableArgName=r})),p7=i((e=>{let{humanReadableArgName:t}=f7();var n=class{constructor(){this.helpWidth=void 0,this.minWidthToWrap=40,this.sortSubcommands=!1,this.sortOptions=!1,this.showGlobalOptions=!1}prepareContext(e){this.helpWidth=this.helpWidth??e.helpWidth??80}visibleCommands(e){let t=e.commands.filter(e=>!e._hidden),n=e._getHelpCommand();return n&&!n._hidden&&t.push(n),this.sortSubcommands&&t.sort((e,t)=>e.name().localeCompare(t.name())),t}compareOptions(e,t){let n=e=>e.short?e.short.replace(/^-/,``):e.long.replace(/^--/,``);return n(e).localeCompare(n(t))}visibleOptions(e){let t=e.options.filter(e=>!e.hidden),n=e._getHelpOption();if(n&&!n.hidden){let r=n.short&&e._findOption(n.short),i=n.long&&e._findOption(n.long);!r&&!i?t.push(n):n.long&&!i?t.push(e.createOption(n.long,n.description)):n.short&&!r&&t.push(e.createOption(n.short,n.description))}return this.sortOptions&&t.sort(this.compareOptions),t}visibleGlobalOptions(e){if(!this.showGlobalOptions)return[];let t=[];for(let n=e.parent;n;n=n.parent){let e=n.options.filter(e=>!e.hidden);t.push(...e)}return this.sortOptions&&t.sort(this.compareOptions),t}visibleArguments(e){return e._argsDescription&&e.registeredArguments.forEach(t=>{t.description=t.description||e._argsDescription[t.name()]||``}),e.registeredArguments.find(e=>e.description)?e.registeredArguments:[]}subcommandTerm(e){let n=e.registeredArguments.map(e=>t(e)).join(` `);return e._name+(e._aliases[0]?`|`+e._aliases[0]:``)+(e.options.length?` [options]`:``)+(n?` `+n:``)}optionTerm(e){return e.flags}argumentTerm(e){return e.name()}longestSubcommandTermLength(e,t){return t.visibleCommands(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleSubcommandTerm(t.subcommandTerm(n)))),0)}longestOptionTermLength(e,t){return t.visibleOptions(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestGlobalOptionTermLength(e,t){return t.visibleGlobalOptions(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleOptionTerm(t.optionTerm(n)))),0)}longestArgumentTermLength(e,t){return t.visibleArguments(e).reduce((e,n)=>Math.max(e,this.displayWidth(t.styleArgumentTerm(t.argumentTerm(n)))),0)}commandUsage(e){let t=e._name;e._aliases[0]&&(t=t+`|`+e._aliases[0]);let n=``;for(let t=e.parent;t;t=t.parent)n=t.name()+` `+n;return n+t+` `+e.usage()}commandDescription(e){return e.description()}subcommandDescription(e){return e.summary()||e.description()}optionDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(`, `)}`),e.defaultValue!==void 0&&(e.required||e.optional||e.isBoolean()&&typeof e.defaultValue==`boolean`)&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),e.presetArg!==void 0&&e.optional&&t.push(`preset: ${JSON.stringify(e.presetArg)}`),e.envVar!==void 0&&t.push(`env: ${e.envVar}`),t.length>0){let n=`(${t.join(`, `)})`;return e.description?`${e.description} ${n}`:n}return e.description}argumentDescription(e){let t=[];if(e.argChoices&&t.push(`choices: ${e.argChoices.map(e=>JSON.stringify(e)).join(`, `)}`),e.defaultValue!==void 0&&t.push(`default: ${e.defaultValueDescription||JSON.stringify(e.defaultValue)}`),t.length>0){let n=`(${t.join(`, `)})`;return e.description?`${e.description} ${n}`:n}return e.description}formatItemList(e,t,n){return t.length===0?[]:[n.styleTitle(e),...t,``]}groupItems(e,t,n){let r=new Map;return e.forEach(e=>{let t=n(e);r.has(t)||r.set(t,[])}),t.forEach(e=>{let t=n(e);r.has(t)||r.set(t,[]),r.get(t).push(e)}),r}formatHelp(e,t){let n=t.padWidth(e,t),r=t.helpWidth??80;function i(e,r){return t.formatItem(e,n,r,t)}let a=[`${t.styleTitle(`Usage:`)} ${t.styleUsage(t.commandUsage(e))}`,``],o=t.commandDescription(e);o.length>0&&(a=a.concat([t.boxWrap(t.styleCommandDescription(o),r),``]));let s=t.visibleArguments(e).map(e=>i(t.styleArgumentTerm(t.argumentTerm(e)),t.styleArgumentDescription(t.argumentDescription(e))));if(a=a.concat(this.formatItemList(`Arguments:`,s,t)),this.groupItems(e.options,t.visibleOptions(e),e=>e.helpGroupHeading??`Options:`).forEach((e,n)=>{let r=e.map(e=>i(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e))));a=a.concat(this.formatItemList(n,r,t))}),t.showGlobalOptions){let n=t.visibleGlobalOptions(e).map(e=>i(t.styleOptionTerm(t.optionTerm(e)),t.styleOptionDescription(t.optionDescription(e))));a=a.concat(this.formatItemList(`Global Options:`,n,t))}return this.groupItems(e.commands,t.visibleCommands(e),e=>e.helpGroup()||`Commands:`).forEach((e,n)=>{let r=e.map(e=>i(t.styleSubcommandTerm(t.subcommandTerm(e)),t.styleSubcommandDescription(t.subcommandDescription(e))));a=a.concat(this.formatItemList(n,r,t))}),a.join(`
865
865
  `)}displayWidth(e){return r(e).length}styleTitle(e){return e}styleUsage(e){return e.split(` `).map(e=>e===`[options]`?this.styleOptionText(e):e===`[command]`?this.styleSubcommandText(e):e[0]===`[`||e[0]===`<`?this.styleArgumentText(e):this.styleCommandText(e)).join(` `)}styleCommandDescription(e){return this.styleDescriptionText(e)}styleOptionDescription(e){return this.styleDescriptionText(e)}styleSubcommandDescription(e){return this.styleDescriptionText(e)}styleArgumentDescription(e){return this.styleDescriptionText(e)}styleDescriptionText(e){return e}styleOptionTerm(e){return this.styleOptionText(e)}styleSubcommandTerm(e){return e.split(` `).map(e=>e===`[options]`?this.styleOptionText(e):e[0]===`[`||e[0]===`<`?this.styleArgumentText(e):this.styleSubcommandText(e)).join(` `)}styleArgumentTerm(e){return this.styleArgumentText(e)}styleOptionText(e){return e}styleArgumentText(e){return e}styleSubcommandText(e){return e}styleCommandText(e){return e}padWidth(e,t){return Math.max(t.longestOptionTermLength(e,t),t.longestGlobalOptionTermLength(e,t),t.longestSubcommandTermLength(e,t),t.longestArgumentTermLength(e,t))}preformatted(e){return/\n[^\S\r\n]/.test(e)}formatItem(e,t,n,r){let i=` `.repeat(2);if(!n)return i+e;let a=e.padEnd(t+e.length-r.displayWidth(e)),o=(this.helpWidth??80)-t-2-2,s;return s=o<this.minWidthToWrap||r.preformatted(n)?n:r.boxWrap(n,o).replace(/\n/g,`
866
866
  `+` `.repeat(t+2)),i+a+` `.repeat(2)+s.replace(/\n/g,`\n${i}`)}boxWrap(e,t){if(t<this.minWidthToWrap)return e;let n=e.split(/\r\n|\n/),r=/[\s]*[^\s]+/g,i=[];return n.forEach(e=>{let n=e.match(r);if(n===null){i.push(``);return}let a=[n.shift()],o=this.displayWidth(a[0]);n.forEach(e=>{let n=this.displayWidth(e);if(o+n<=t){a.push(e),o+=n;return}i.push(a.join(``));let r=e.trimStart();a=[r],o=this.displayWidth(r)}),i.push(a.join(``))}),i.join(`
867
867
  `)}};function r(e){return e.replace(/\x1b\[\d*(;\d*)*m/g,``)}e.Help=n,e.stripColor=r})),m7=i((e=>{let{InvalidArgumentError:t}=d7();var n=class{constructor(e,t){this.flags=e,this.description=t||``,this.required=e.includes(`<`),this.optional=e.includes(`[`),this.variadic=/\w\.\.\.[>\]]$/.test(e),this.mandatory=!1;let n=a(e);this.short=n.shortFlag,this.long=n.longFlag,this.negate=!1,this.long&&(this.negate=this.long.startsWith(`--no-`)),this.defaultValue=void 0,this.defaultValueDescription=void 0,this.presetArg=void 0,this.envVar=void 0,this.parseArg=void 0,this.hidden=!1,this.argChoices=void 0,this.conflictsWith=[],this.implied=void 0,this.helpGroupHeading=void 0}default(e,t){return this.defaultValue=e,this.defaultValueDescription=t,this}preset(e){return this.presetArg=e,this}conflicts(e){return this.conflictsWith=this.conflictsWith.concat(e),this}implies(e){let t=e;return typeof e==`string`&&(t={[e]:!0}),this.implied=Object.assign(this.implied||{},t),this}env(e){return this.envVar=e,this}argParser(e){return this.parseArg=e,this}makeOptionMandatory(e=!0){return this.mandatory=!!e,this}hideHelp(e=!0){return this.hidden=!!e,this}_collectValue(e,t){return t===this.defaultValue||!Array.isArray(t)?[e]:(t.push(e),t)}choices(e){return this.argChoices=e.slice(),this.parseArg=(e,n)=>{if(!this.argChoices.includes(e))throw new t(`Allowed choices are ${this.argChoices.join(`, `)}.`);return this.variadic?this._collectValue(e,n):e},this}name(){return this.long?this.long.replace(/^--/,``):this.short.replace(/^-/,``)}attributeName(){return this.negate?i(this.name().replace(/^no-/,``)):i(this.name())}helpGroup(e){return this.helpGroupHeading=e,this}is(e){return this.short===e||this.long===e}isBoolean(){return!this.required&&!this.optional&&!this.negate}},r=class{constructor(e){this.positiveOptions=new Map,this.negativeOptions=new Map,this.dualOptions=new Set,e.forEach(e=>{e.negate?this.negativeOptions.set(e.attributeName(),e):this.positiveOptions.set(e.attributeName(),e)}),this.negativeOptions.forEach((e,t)=>{this.positiveOptions.has(t)&&this.dualOptions.add(t)})}valueFromOption(e,t){let n=t.attributeName();if(!this.dualOptions.has(n))return!0;let r=this.negativeOptions.get(n).presetArg,i=r===void 0?!1:r;return t.negate===(i===e)}};function i(e){return e.split(`-`).reduce((e,t)=>e+t[0].toUpperCase()+t.slice(1))}function a(e){let t,n,r=/^-[^-]$/,i=/^--[^-]/,a=e.split(/[ |,]+/).concat(`guard`);if(r.test(a[0])&&(t=a.shift()),i.test(a[0])&&(n=a.shift()),!t&&r.test(a[0])&&(t=a.shift()),!t&&i.test(a[0])&&(t=n,n=a.shift()),a[0].startsWith(`-`)){let t=a[0],n=`option creation failed due to '${t}' in option flags '${e}'`;throw/^-[^-][^-]/.test(t)?Error(`${n}
@@ -870,7 +870,7 @@ exit 127`,Y5=`// ok-pi-bridge`,X5=`${Y5}-v1`;function Z5(e){if(typeof e!=`object
870
870
  - or use a double dash for a long option (and can have two, like '--ws, --workspace')`):r.test(t)?Error(`${n}
871
871
  - too many short flags`):i.test(t)?Error(`${n}
872
872
  - too many long flags`):Error(`${n}
873
- - unrecognised flag format`)}if(t===void 0&&n===void 0)throw Error(`option creation failed due to no flags found in '${e}'.`);return{shortFlag:t,longFlag:n}}e.Option=n,e.DualOptions=r})),pbe=i((e=>{function t(e,t){if(Math.abs(e.length-t.length)>3)return Math.max(e.length,t.length);let n=[];for(let t=0;t<=e.length;t++)n[t]=[t];for(let e=0;e<=t.length;e++)n[0][e]=e;for(let r=1;r<=t.length;r++)for(let i=1;i<=e.length;i++){let a=1;a=e[i-1]===t[r-1]?0:1,n[i][r]=Math.min(n[i-1][r]+1,n[i][r-1]+1,n[i-1][r-1]+a),i>1&&r>1&&e[i-1]===t[r-2]&&e[i-2]===t[r-1]&&(n[i][r]=Math.min(n[i][r],n[i-2][r-2]+1))}return n[e.length][t.length]}function n(e,n){if(!n||n.length===0)return``;n=Array.from(new Set(n));let r=e.startsWith(`--`);r&&(e=e.slice(2),n=n.map(e=>e.slice(2)));let i=[],a=3;return n.forEach(n=>{if(n.length<=1)return;let r=t(e,n),o=Math.max(e.length,n.length);(o-r)/o>.4&&(r<a?(a=r,i=[n]):r===a&&i.push(n))}),i.sort((e,t)=>e.localeCompare(t)),r&&(i=i.map(e=>`--${e}`)),i.length>1?`\n(Did you mean one of ${i.join(`, `)}?)`:i.length===1?`\n(Did you mean ${i[0]}?)`:``}e.suggestSimilar=n})),mbe=i((e=>{let n=t(`node:events`).EventEmitter,r=t(`node:child_process`),i=t(`node:path`),a=t(`node:fs`),o=t(`node:process`),{Argument:s,humanReadableArgName:c}=f7(),{CommanderError:l}=d7(),{Help:u,stripColor:d}=p7(),{Option:f,DualOptions:p}=m7(),{suggestSimilar:m}=pbe();var h=class e extends n{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=e||``,this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description=``,this._summary=``,this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._savedState=null,this._outputConfiguration={writeOut:e=>o.stdout.write(e),writeErr:e=>o.stderr.write(e),outputError:(e,t)=>t(e),getOutHelpWidth:()=>o.stdout.isTTY?o.stdout.columns:void 0,getErrHelpWidth:()=>o.stderr.isTTY?o.stderr.columns:void 0,getOutHasColors:()=>_()??(o.stdout.isTTY&&o.stdout.hasColors?.()),getErrHasColors:()=>_()??(o.stderr.isTTY&&o.stderr.hasColors?.()),stripColor:e=>d(e)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={},this._helpGroupHeading=void 0,this._defaultCommandGroup=void 0,this._defaultOptionGroup=void 0}copyInheritedSettings(e){return this._outputConfiguration=e._outputConfiguration,this._helpOption=e._helpOption,this._helpCommand=e._helpCommand,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}_getCommandAndAncestors(){let e=[];for(let t=this;t;t=t.parent)e.push(t);return e}command(e,t,n){let r=t,i=n;typeof r==`object`&&r&&(i=r,r=null),i||={};let[,a,o]=e.match(/([^ ]+) *(.*)/),s=this.createCommand(a);return r&&(s.description(r),s._executableHandler=!0),i.isDefault&&(this._defaultCommandName=s._name),s._hidden=!!(i.noHelp||i.hidden),s._executableFile=i.executableFile||null,o&&s.arguments(o),this._registerCommand(s),s.parent=this,s.copyInheritedSettings(this),r?this:s}createCommand(t){return new e(t)}createHelp(){return Object.assign(new u,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(this._outputConfiguration={...this._outputConfiguration,...e},this)}showHelpAfterError(e=!0){return typeof e!=`string`&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,t){if(!e._name)throw Error(`Command passed to .addCommand() must have a name
873
+ - unrecognised flag format`)}if(t===void 0&&n===void 0)throw Error(`option creation failed due to no flags found in '${e}'.`);return{shortFlag:t,longFlag:n}}e.Option=n,e.DualOptions=r})),mbe=i((e=>{function t(e,t){if(Math.abs(e.length-t.length)>3)return Math.max(e.length,t.length);let n=[];for(let t=0;t<=e.length;t++)n[t]=[t];for(let e=0;e<=t.length;e++)n[0][e]=e;for(let r=1;r<=t.length;r++)for(let i=1;i<=e.length;i++){let a=1;a=e[i-1]===t[r-1]?0:1,n[i][r]=Math.min(n[i-1][r]+1,n[i][r-1]+1,n[i-1][r-1]+a),i>1&&r>1&&e[i-1]===t[r-2]&&e[i-2]===t[r-1]&&(n[i][r]=Math.min(n[i][r],n[i-2][r-2]+1))}return n[e.length][t.length]}function n(e,n){if(!n||n.length===0)return``;n=Array.from(new Set(n));let r=e.startsWith(`--`);r&&(e=e.slice(2),n=n.map(e=>e.slice(2)));let i=[],a=3;return n.forEach(n=>{if(n.length<=1)return;let r=t(e,n),o=Math.max(e.length,n.length);(o-r)/o>.4&&(r<a?(a=r,i=[n]):r===a&&i.push(n))}),i.sort((e,t)=>e.localeCompare(t)),r&&(i=i.map(e=>`--${e}`)),i.length>1?`\n(Did you mean one of ${i.join(`, `)}?)`:i.length===1?`\n(Did you mean ${i[0]}?)`:``}e.suggestSimilar=n})),hbe=i((e=>{let n=t(`node:events`).EventEmitter,r=t(`node:child_process`),i=t(`node:path`),a=t(`node:fs`),o=t(`node:process`),{Argument:s,humanReadableArgName:c}=f7(),{CommanderError:l}=d7(),{Help:u,stripColor:d}=p7(),{Option:f,DualOptions:p}=m7(),{suggestSimilar:m}=mbe();var h=class e extends n{constructor(e){super(),this.commands=[],this.options=[],this.parent=null,this._allowUnknownOption=!1,this._allowExcessArguments=!1,this.registeredArguments=[],this._args=this.registeredArguments,this.args=[],this.rawArgs=[],this.processedArgs=[],this._scriptPath=null,this._name=e||``,this._optionValues={},this._optionValueSources={},this._storeOptionsAsProperties=!1,this._actionHandler=null,this._executableHandler=!1,this._executableFile=null,this._executableDir=null,this._defaultCommandName=null,this._exitCallback=null,this._aliases=[],this._combineFlagAndOptionalValue=!0,this._description=``,this._summary=``,this._argsDescription=void 0,this._enablePositionalOptions=!1,this._passThroughOptions=!1,this._lifeCycleHooks={},this._showHelpAfterError=!1,this._showSuggestionAfterError=!0,this._savedState=null,this._outputConfiguration={writeOut:e=>o.stdout.write(e),writeErr:e=>o.stderr.write(e),outputError:(e,t)=>t(e),getOutHelpWidth:()=>o.stdout.isTTY?o.stdout.columns:void 0,getErrHelpWidth:()=>o.stderr.isTTY?o.stderr.columns:void 0,getOutHasColors:()=>_()??(o.stdout.isTTY&&o.stdout.hasColors?.()),getErrHasColors:()=>_()??(o.stderr.isTTY&&o.stderr.hasColors?.()),stripColor:e=>d(e)},this._hidden=!1,this._helpOption=void 0,this._addImplicitHelpCommand=void 0,this._helpCommand=void 0,this._helpConfiguration={},this._helpGroupHeading=void 0,this._defaultCommandGroup=void 0,this._defaultOptionGroup=void 0}copyInheritedSettings(e){return this._outputConfiguration=e._outputConfiguration,this._helpOption=e._helpOption,this._helpCommand=e._helpCommand,this._helpConfiguration=e._helpConfiguration,this._exitCallback=e._exitCallback,this._storeOptionsAsProperties=e._storeOptionsAsProperties,this._combineFlagAndOptionalValue=e._combineFlagAndOptionalValue,this._allowExcessArguments=e._allowExcessArguments,this._enablePositionalOptions=e._enablePositionalOptions,this._showHelpAfterError=e._showHelpAfterError,this._showSuggestionAfterError=e._showSuggestionAfterError,this}_getCommandAndAncestors(){let e=[];for(let t=this;t;t=t.parent)e.push(t);return e}command(e,t,n){let r=t,i=n;typeof r==`object`&&r&&(i=r,r=null),i||={};let[,a,o]=e.match(/([^ ]+) *(.*)/),s=this.createCommand(a);return r&&(s.description(r),s._executableHandler=!0),i.isDefault&&(this._defaultCommandName=s._name),s._hidden=!!(i.noHelp||i.hidden),s._executableFile=i.executableFile||null,o&&s.arguments(o),this._registerCommand(s),s.parent=this,s.copyInheritedSettings(this),r?this:s}createCommand(t){return new e(t)}createHelp(){return Object.assign(new u,this.configureHelp())}configureHelp(e){return e===void 0?this._helpConfiguration:(this._helpConfiguration=e,this)}configureOutput(e){return e===void 0?this._outputConfiguration:(this._outputConfiguration={...this._outputConfiguration,...e},this)}showHelpAfterError(e=!0){return typeof e!=`string`&&(e=!!e),this._showHelpAfterError=e,this}showSuggestionAfterError(e=!0){return this._showSuggestionAfterError=!!e,this}addCommand(e,t){if(!e._name)throw Error(`Command passed to .addCommand() must have a name
874
874
  - specify the name in Command constructor or using .name()`);return t||={},t.isDefault&&(this._defaultCommandName=e._name),(t.noHelp||t.hidden)&&(e._hidden=!0),this._registerCommand(e),e.parent=this,e._checkForBrokenPassThrough(),this}createArgument(e,t){return new s(e,t)}argument(e,t,n,r){let i=this.createArgument(e,t);return typeof n==`function`?i.default(r).argParser(n):i.default(n),this.addArgument(i),this}arguments(e){return e.trim().split(/ +/).forEach(e=>{this.argument(e)}),this}addArgument(e){let t=this.registeredArguments.slice(-1)[0];if(t?.variadic)throw Error(`only the last argument can be variadic '${t.name()}'`);if(e.required&&e.defaultValue!==void 0&&e.parseArg===void 0)throw Error(`a default value for a required argument is never used: '${e.name()}'`);return this.registeredArguments.push(e),this}helpCommand(e,t){if(typeof e==`boolean`)return this._addImplicitHelpCommand=e,e&&this._defaultCommandGroup&&this._initCommandGroup(this._getHelpCommand()),this;let[,n,r]=(e??`help [command]`).match(/([^ ]+) *(.*)/),i=t??`display help for command`,a=this.createCommand(n);return a.helpOption(!1),r&&a.arguments(r),i&&a.description(i),this._addImplicitHelpCommand=!0,this._helpCommand=a,(e||t)&&this._initCommandGroup(a),this}addHelpCommand(e,t){return typeof e==`object`?(this._addImplicitHelpCommand=!0,this._helpCommand=e,this._initCommandGroup(e),this):(this.helpCommand(e,t),this)}_getHelpCommand(){return this._addImplicitHelpCommand??(this.commands.length&&!this._actionHandler&&!this._findCommand(`help`))?(this._helpCommand===void 0&&this.helpCommand(void 0,void 0),this._helpCommand):null}hook(e,t){let n=[`preSubcommand`,`preAction`,`postAction`];if(!n.includes(e))throw Error(`Unexpected value for event passed to hook : '${e}'.
875
875
  Expecting one of '${n.join(`', '`)}'`);return this._lifeCycleHooks[e]?this._lifeCycleHooks[e].push(t):this._lifeCycleHooks[e]=[t],this}exitOverride(e){return e?this._exitCallback=e:this._exitCallback=e=>{if(e.code!==`commander.executeSubCommandAsync`)throw e},this}_exit(e,t,n){this._exitCallback&&this._exitCallback(new l(e,t,n)),o.exit(e)}action(e){let t=t=>{let n=this.registeredArguments.length,r=t.slice(0,n);return this._storeOptionsAsProperties?r[n]=this:r[n]=this.opts(),r.push(this),e.apply(this,r)};return this._actionHandler=t,this}createOption(e,t){return new f(e,t)}_callParseArg(e,t,n,r){try{return e.parseArg(t,n)}catch(e){if(e.code===`commander.invalidArgument`){let t=`${r} ${e.message}`;this.error(t,{exitCode:e.exitCode,code:e.code})}throw e}}_registerOption(e){let t=e.short&&this._findOption(e.short)||e.long&&this._findOption(e.long);if(t){let n=e.long&&this._findOption(e.long)?e.long:e.short;throw Error(`Cannot add option '${e.flags}'${this._name&&` to command '${this._name}'`} due to conflicting flag '${n}'
876
876
  - already used by option '${t.flags}'`)}this._initOptionGroup(e),this.options.push(e)}_registerCommand(e){let t=e=>[e.name()].concat(e.aliases()),n=t(e).find(e=>this._findCommand(e));if(n){let r=t(this._findCommand(n)).join(`|`),i=t(e).join(`|`);throw Error(`cannot add command '${i}' as already have command '${r}'`)}this._initCommandGroup(e),this.commands.push(e)}addOption(e){this._registerOption(e);let t=e.name(),n=e.attributeName();if(e.negate){let t=e.long.replace(/^--no-/,`--`);this._findOption(t)||this.setOptionValueWithSource(n,e.defaultValue===void 0?!0:e.defaultValue,`default`)}else e.defaultValue!==void 0&&this.setOptionValueWithSource(n,e.defaultValue,`default`);let r=(t,r,i)=>{t==null&&e.presetArg!==void 0&&(t=e.presetArg);let a=this.getOptionValue(n);t!==null&&e.parseArg?t=this._callParseArg(e,t,a,r):t!==null&&e.variadic&&(t=e._collectValue(t,a)),t??=e.negate?!1:e.isBoolean()||e.optional?!0:``,this.setOptionValueWithSource(n,t,i)};return this.on(`option:`+t,t=>{r(t,`error: option '${e.flags}' argument '${t}' is invalid.`,`cli`)}),e.envVar&&this.on(`optionEnv:`+t,t=>{r(t,`error: option '${e.flags}' value '${t}' from env '${e.envVar}' is invalid.`,`env`)}),this}_optionEx(e,t,n,r,i){if(typeof t==`object`&&t instanceof f)throw Error(`To add an Option object use addOption() instead of option() or requiredOption()`);let a=this.createOption(t,n);if(a.makeOptionMandatory(!!e.mandatory),typeof r==`function`)a.default(i).argParser(r);else if(r instanceof RegExp){let e=r;r=(t,n)=>{let r=e.exec(t);return r?r[0]:n},a.default(i).argParser(r)}else a.default(r);return this.addOption(a)}option(e,t,n,r){return this._optionEx({},e,t,n,r)}requiredOption(e,t,n,r){return this._optionEx({mandatory:!0},e,t,n,r)}combineFlagAndOptionalValue(e=!0){return this._combineFlagAndOptionalValue=!!e,this}allowUnknownOption(e=!0){return this._allowUnknownOption=!!e,this}allowExcessArguments(e=!0){return this._allowExcessArguments=!!e,this}enablePositionalOptions(e=!0){return this._enablePositionalOptions=!!e,this}passThroughOptions(e=!0){return this._passThroughOptions=!!e,this._checkForBrokenPassThrough(),this}_checkForBrokenPassThrough(){if(this.parent&&this._passThroughOptions&&!this.parent._enablePositionalOptions)throw Error(`passThroughOptions cannot be used for '${this._name}' without turning on enablePositionalOptions for parent command(s)`)}storeOptionsAsProperties(e=!0){if(this.options.length)throw Error(`call .storeOptionsAsProperties() before adding options`);if(Object.keys(this._optionValues).length)throw Error(`call .storeOptionsAsProperties() before setting option values`);return this._storeOptionsAsProperties=!!e,this}getOptionValue(e){return this._storeOptionsAsProperties?this[e]:this._optionValues[e]}setOptionValue(e,t){return this.setOptionValueWithSource(e,t,void 0)}setOptionValueWithSource(e,t,n){return this._storeOptionsAsProperties?this[e]=t:this._optionValues[e]=t,this._optionValueSources[e]=n,this}getOptionValueSource(e){return this._optionValueSources[e]}getOptionValueSourceWithGlobals(e){let t;return this._getCommandAndAncestors().forEach(n=>{n.getOptionValueSource(e)!==void 0&&(t=n.getOptionValueSource(e))}),t}_prepareUserArgs(e,t){if(e!==void 0&&!Array.isArray(e))throw Error(`first parameter to parse must be array or undefined`);if(t||={},e===void 0&&t.from===void 0){o.versions?.electron&&(t.from=`electron`);let e=o.execArgv??[];(e.includes(`-e`)||e.includes(`--eval`)||e.includes(`-p`)||e.includes(`--print`))&&(t.from=`eval`)}e===void 0&&(e=o.argv),this.rawArgs=e.slice();let n;switch(t.from){case void 0:case`node`:this._scriptPath=e[1],n=e.slice(2);break;case`electron`:o.defaultApp?(this._scriptPath=e[1],n=e.slice(2)):n=e.slice(1);break;case`user`:n=e.slice(0);break;case`eval`:n=e.slice(1);break;default:throw Error(`unexpected parse option { from: '${t.from}' }`)}return!this._name&&this._scriptPath&&this.nameFromFilename(this._scriptPath),this._name=this._name||`program`,n}parse(e,t){this._prepareForParse();let n=this._prepareUserArgs(e,t);return this._parseCommand([],n),this}async parseAsync(e,t){this._prepareForParse();let n=this._prepareUserArgs(e,t);return await this._parseCommand([],n),this}_prepareForParse(){this._savedState===null?this.saveStateBeforeParse():this.restoreStateBeforeParse()}saveStateBeforeParse(){this._savedState={_name:this._name,_optionValues:{...this._optionValues},_optionValueSources:{...this._optionValueSources}}}restoreStateBeforeParse(){if(this._storeOptionsAsProperties)throw Error(`Can not call parse again when storeOptionsAsProperties is true.
@@ -879,7 +879,7 @@ Expecting one of '${n.join(`', '`)}'`);return this._lifeCycleHooks[e]?this._life
879
879
  - if the default executable name is not suitable, use the executableFile option to supply a custom name or path
880
880
  - ${t?`searched for local subcommand relative to directory '${t}'`:`no directory for search for local subcommand, use .executableDir() to supply a custom directory`}`;throw Error(r)}_executeSubCommand(e,t){t=t.slice();let n=!1,s=[`.js`,`.ts`,`.tsx`,`.mjs`,`.cjs`];function c(e,t){let n=i.resolve(e,t);if(a.existsSync(n))return n;if(s.includes(i.extname(t)))return;let r=s.find(e=>a.existsSync(`${n}${e}`));if(r)return`${n}${r}`}this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let u=e._executableFile||`${this._name}-${e._name}`,d=this._executableDir||``;if(this._scriptPath){let e;try{e=a.realpathSync(this._scriptPath)}catch{e=this._scriptPath}d=i.resolve(i.dirname(e),d)}if(d){let t=c(d,u);if(!t&&!e._executableFile&&this._scriptPath){let n=i.basename(this._scriptPath,i.extname(this._scriptPath));n!==this._name&&(t=c(d,`${n}-${e._name}`))}u=t||u}n=s.includes(i.extname(u));let f;o.platform===`win32`?(this._checkForMissingExecutable(u,d,e._name),t.unshift(u),t=g(o.execArgv).concat(t),f=r.spawn(o.execPath,t,{stdio:`inherit`})):n?(t.unshift(u),t=g(o.execArgv).concat(t),f=r.spawn(o.argv[0],t,{stdio:`inherit`})):f=r.spawn(u,t,{stdio:`inherit`}),f.killed||[`SIGUSR1`,`SIGUSR2`,`SIGTERM`,`SIGINT`,`SIGHUP`].forEach(e=>{o.on(e,()=>{f.killed===!1&&f.exitCode===null&&f.kill(e)})});let p=this._exitCallback;f.on(`close`,e=>{e??=1,p?p(new l(e,`commander.executeSubCommandAsync`,`(close)`)):o.exit(e)}),f.on(`error`,t=>{if(t.code===`ENOENT`)this._checkForMissingExecutable(u,d,e._name);else if(t.code===`EACCES`)throw Error(`'${u}' not executable`);if(!p)o.exit(1);else{let e=new l(1,`commander.executeSubCommandAsync`,`(error)`);e.nestedError=t,p(e)}}),this.runningCommand=f}_dispatchSubcommand(e,t,n){let r=this._findCommand(e);r||this.help({error:!0}),r._prepareForParse();let i;return i=this._chainOrCallSubCommandHook(i,r,`preSubcommand`),i=this._chainOrCall(i,()=>{if(r._executableHandler)this._executeSubCommand(r,t.concat(n));else return r._parseCommand(t,n)}),i}_dispatchHelpCommand(e){e||this.help();let t=this._findCommand(e);return t&&!t._executableHandler&&t.help(),this._dispatchSubcommand(e,[],[this._getHelpOption()?.long??this._getHelpOption()?.short??`--help`])}_checkNumberOfArguments(){this.registeredArguments.forEach((e,t)=>{e.required&&this.args[t]==null&&this.missingArgument(e.name())}),!(this.registeredArguments.length>0&&this.registeredArguments[this.registeredArguments.length-1].variadic)&&this.args.length>this.registeredArguments.length&&this._excessArguments(this.args)}_processArguments(){let e=(e,t,n)=>{let r=t;if(t!==null&&e.parseArg){let i=`error: command-argument value '${t}' is invalid for argument '${e.name()}'.`;r=this._callParseArg(e,t,n,i)}return r};this._checkNumberOfArguments();let t=[];this.registeredArguments.forEach((n,r)=>{let i=n.defaultValue;n.variadic?r<this.args.length?(i=this.args.slice(r),n.parseArg&&(i=i.reduce((t,r)=>e(n,r,t),n.defaultValue))):i===void 0&&(i=[]):r<this.args.length&&(i=this.args[r],n.parseArg&&(i=e(n,i,n.defaultValue))),t[r]=i}),this.processedArgs=t}_chainOrCall(e,t){return e?.then&&typeof e.then==`function`?e.then(()=>t()):t()}_chainOrCallHooks(e,t){let n=e,r=[];return this._getCommandAndAncestors().reverse().filter(e=>e._lifeCycleHooks[t]!==void 0).forEach(e=>{e._lifeCycleHooks[t].forEach(t=>{r.push({hookedCommand:e,callback:t})})}),t===`postAction`&&r.reverse(),r.forEach(e=>{n=this._chainOrCall(n,()=>e.callback(e.hookedCommand,this))}),n}_chainOrCallSubCommandHook(e,t,n){let r=e;return this._lifeCycleHooks[n]!==void 0&&this._lifeCycleHooks[n].forEach(e=>{r=this._chainOrCall(r,()=>e(this,t))}),r}_parseCommand(e,t){let n=this.parseOptions(t);if(this._parseOptionsEnv(),this._parseOptionsImplied(),e=e.concat(n.operands),t=n.unknown,this.args=e.concat(t),e&&this._findCommand(e[0]))return this._dispatchSubcommand(e[0],e.slice(1),t);if(this._getHelpCommand()&&e[0]===this._getHelpCommand().name())return this._dispatchHelpCommand(e[1]);if(this._defaultCommandName)return this._outputHelpIfRequested(t),this._dispatchSubcommand(this._defaultCommandName,e,t);this.commands.length&&this.args.length===0&&!this._actionHandler&&!this._defaultCommandName&&this.help({error:!0}),this._outputHelpIfRequested(n.unknown),this._checkForMissingMandatoryOptions(),this._checkForConflictingOptions();let r=()=>{n.unknown.length>0&&this.unknownOption(n.unknown[0])},i=`command:${this.name()}`;if(this._actionHandler){r(),this._processArguments();let n;return n=this._chainOrCallHooks(n,`preAction`),n=this._chainOrCall(n,()=>this._actionHandler(this.processedArgs)),this.parent&&(n=this._chainOrCall(n,()=>{this.parent.emit(i,e,t)})),n=this._chainOrCallHooks(n,`postAction`),n}if(this.parent?.listenerCount(i))r(),this._processArguments(),this.parent.emit(i,e,t);else if(e.length){if(this._findCommand(`*`))return this._dispatchSubcommand(`*`,e,t);this.listenerCount(`command:*`)?this.emit(`command:*`,e,t):this.commands.length?this.unknownCommand():(r(),this._processArguments())}else this.commands.length?(r(),this.help({error:!0})):(r(),this._processArguments())}_findCommand(e){if(e)return this.commands.find(t=>t._name===e||t._aliases.includes(e))}_findOption(e){return this.options.find(t=>t.is(e))}_checkForMissingMandatoryOptions(){this._getCommandAndAncestors().forEach(e=>{e.options.forEach(t=>{t.mandatory&&e.getOptionValue(t.attributeName())===void 0&&e.missingMandatoryOptionValue(t)})})}_checkForConflictingLocalOptions(){let e=this.options.filter(e=>{let t=e.attributeName();return this.getOptionValue(t)===void 0?!1:this.getOptionValueSource(t)!==`default`});e.filter(e=>e.conflictsWith.length>0).forEach(t=>{let n=e.find(e=>t.conflictsWith.includes(e.attributeName()));n&&this._conflictingOption(t,n)})}_checkForConflictingOptions(){this._getCommandAndAncestors().forEach(e=>{e._checkForConflictingLocalOptions()})}parseOptions(e){let t=[],n=[],r=t;function i(e){return e.length>1&&e[0]===`-`}let a=e=>/^-(\d+|\d*\.\d+)(e[+-]?\d+)?$/.test(e)?!this._getCommandAndAncestors().some(e=>e.options.map(e=>e.short).some(e=>/^-\d$/.test(e))):!1,o=null,s=null,c=0;for(;c<e.length||s;){let l=s??e[c++];if(s=null,l===`--`){r===n&&r.push(l),r.push(...e.slice(c));break}if(o&&(!i(l)||a(l))){this.emit(`option:${o.name()}`,l);continue}if(o=null,i(l)){let t=this._findOption(l);if(t){if(t.required){let n=e[c++];n===void 0&&this.optionMissingArgument(t),this.emit(`option:${t.name()}`,n)}else if(t.optional){let n=null;c<e.length&&(!i(e[c])||a(e[c]))&&(n=e[c++]),this.emit(`option:${t.name()}`,n)}else this.emit(`option:${t.name()}`);o=t.variadic?t:null;continue}}if(l.length>2&&l[0]===`-`&&l[1]!==`-`){let e=this._findOption(`-${l[1]}`);if(e){e.required||e.optional&&this._combineFlagAndOptionalValue?this.emit(`option:${e.name()}`,l.slice(2)):(this.emit(`option:${e.name()}`),s=`-${l.slice(2)}`);continue}}if(/^--[^=]+=/.test(l)){let e=l.indexOf(`=`),t=this._findOption(l.slice(0,e));if(t&&(t.required||t.optional)){this.emit(`option:${t.name()}`,l.slice(e+1));continue}}if(r===t&&i(l)&&!(this.commands.length===0&&a(l))&&(r=n),(this._enablePositionalOptions||this._passThroughOptions)&&t.length===0&&n.length===0){if(this._findCommand(l)){t.push(l),n.push(...e.slice(c));break}else if(this._getHelpCommand()&&l===this._getHelpCommand().name()){t.push(l,...e.slice(c));break}else if(this._defaultCommandName){n.push(l,...e.slice(c));break}}if(this._passThroughOptions){r.push(l,...e.slice(c));break}r.push(l)}return{operands:t,unknown:n}}opts(){if(this._storeOptionsAsProperties){let e={},t=this.options.length;for(let n=0;n<t;n++){let t=this.options[n].attributeName();e[t]=t===this._versionOptionName?this._version:this[t]}return e}return this._optionValues}optsWithGlobals(){return this._getCommandAndAncestors().reduce((e,t)=>Object.assign(e,t.opts()),{})}error(e,t){this._outputConfiguration.outputError(`${e}\n`,this._outputConfiguration.writeErr),typeof this._showHelpAfterError==`string`?this._outputConfiguration.writeErr(`${this._showHelpAfterError}\n`):this._showHelpAfterError&&(this._outputConfiguration.writeErr(`
881
881
  `),this.outputHelp({error:!0}));let n=t||{},r=n.exitCode||1,i=n.code||`commander.error`;this._exit(r,i,e)}_parseOptionsEnv(){this.options.forEach(e=>{if(e.envVar&&e.envVar in o.env){let t=e.attributeName();(this.getOptionValue(t)===void 0||[`default`,`config`,`env`].includes(this.getOptionValueSource(t)))&&(e.required||e.optional?this.emit(`optionEnv:${e.name()}`,o.env[e.envVar]):this.emit(`optionEnv:${e.name()}`))}})}_parseOptionsImplied(){let e=new p(this.options),t=e=>this.getOptionValue(e)!==void 0&&![`default`,`implied`].includes(this.getOptionValueSource(e));this.options.filter(n=>n.implied!==void 0&&t(n.attributeName())&&e.valueFromOption(this.getOptionValue(n.attributeName()),n)).forEach(e=>{Object.keys(e.implied).filter(e=>!t(e)).forEach(t=>{this.setOptionValueWithSource(t,e.implied[t],`implied`)})})}missingArgument(e){let t=`error: missing required argument '${e}'`;this.error(t,{code:`commander.missingArgument`})}optionMissingArgument(e){let t=`error: option '${e.flags}' argument missing`;this.error(t,{code:`commander.optionMissingArgument`})}missingMandatoryOptionValue(e){let t=`error: required option '${e.flags}' not specified`;this.error(t,{code:`commander.missingMandatoryOptionValue`})}_conflictingOption(e,t){let n=e=>{let t=e.attributeName(),n=this.getOptionValue(t),r=this.options.find(e=>e.negate&&t===e.attributeName()),i=this.options.find(e=>!e.negate&&t===e.attributeName());return r&&(r.presetArg===void 0&&n===!1||r.presetArg!==void 0&&n===r.presetArg)?r:i||e},r=e=>{let t=n(e),r=t.attributeName();return this.getOptionValueSource(r)===`env`?`environment variable '${t.envVar}'`:`option '${t.flags}'`},i=`error: ${r(e)} cannot be used with ${r(t)}`;this.error(i,{code:`commander.conflictingOption`})}unknownOption(e){if(this._allowUnknownOption)return;let t=``;if(e.startsWith(`--`)&&this._showSuggestionAfterError){let n=[],r=this;do{let e=r.createHelp().visibleOptions(r).filter(e=>e.long).map(e=>e.long);n=n.concat(e),r=r.parent}while(r&&!r._enablePositionalOptions);t=m(e,n)}let n=`error: unknown option '${e}'${t}`;this.error(n,{code:`commander.unknownOption`})}_excessArguments(e){if(this._allowExcessArguments)return;let t=this.registeredArguments.length,n=t===1?``:`s`,r=`error: too many arguments${this.parent?` for '${this.name()}'`:``}. Expected ${t} argument${n} but got ${e.length}.`;this.error(r,{code:`commander.excessArguments`})}unknownCommand(){let e=this.args[0],t=``;if(this._showSuggestionAfterError){let n=[];this.createHelp().visibleCommands(this).forEach(e=>{n.push(e.name()),e.alias()&&n.push(e.alias())}),t=m(e,n)}let n=`error: unknown command '${e}'${t}`;this.error(n,{code:`commander.unknownCommand`})}version(e,t,n){if(e===void 0)return this._version;this._version=e,t||=`-V, --version`,n||=`output the version number`;let r=this.createOption(t,n);return this._versionOptionName=r.attributeName(),this._registerOption(r),this.on(`option:`+r.name(),()=>{this._outputConfiguration.writeOut(`${e}\n`),this._exit(0,`commander.version`,e)}),this}description(e,t){return e===void 0&&t===void 0?this._description:(this._description=e,t&&(this._argsDescription=t),this)}summary(e){return e===void 0?this._summary:(this._summary=e,this)}alias(e){if(e===void 0)return this._aliases[0];let t=this;if(this.commands.length!==0&&this.commands[this.commands.length-1]._executableHandler&&(t=this.commands[this.commands.length-1]),e===t._name)throw Error(`Command alias can't be the same as its name`);let n=this.parent?._findCommand(e);if(n){let t=[n.name()].concat(n.aliases()).join(`|`);throw Error(`cannot add alias '${e}' to command '${this.name()}' as already have command '${t}'`)}return t._aliases.push(e),this}aliases(e){return e===void 0?this._aliases:(e.forEach(e=>this.alias(e)),this)}usage(e){if(e===void 0){if(this._usage)return this._usage;let e=this.registeredArguments.map(e=>c(e));return[].concat(this.options.length||this._helpOption!==null?`[options]`:[],this.commands.length?`[command]`:[],this.registeredArguments.length?e:[]).join(` `)}return this._usage=e,this}name(e){return e===void 0?this._name:(this._name=e,this)}helpGroup(e){return e===void 0?this._helpGroupHeading??``:(this._helpGroupHeading=e,this)}commandsGroup(e){return e===void 0?this._defaultCommandGroup??``:(this._defaultCommandGroup=e,this)}optionsGroup(e){return e===void 0?this._defaultOptionGroup??``:(this._defaultOptionGroup=e,this)}_initOptionGroup(e){this._defaultOptionGroup&&!e.helpGroupHeading&&e.helpGroup(this._defaultOptionGroup)}_initCommandGroup(e){this._defaultCommandGroup&&!e.helpGroup()&&e.helpGroup(this._defaultCommandGroup)}nameFromFilename(e){return this._name=i.basename(e,i.extname(e)),this}executableDir(e){return e===void 0?this._executableDir:(this._executableDir=e,this)}helpInformation(e){let t=this.createHelp(),n=this._getOutputContext(e);t.prepareContext({error:n.error,helpWidth:n.helpWidth,outputHasColors:n.hasColors});let r=t.formatHelp(this,t);return n.hasColors?r:this._outputConfiguration.stripColor(r)}_getOutputContext(e){e||={};let t=!!e.error,n,r,i;return t?(n=e=>this._outputConfiguration.writeErr(e),r=this._outputConfiguration.getErrHasColors(),i=this._outputConfiguration.getErrHelpWidth()):(n=e=>this._outputConfiguration.writeOut(e),r=this._outputConfiguration.getOutHasColors(),i=this._outputConfiguration.getOutHelpWidth()),{error:t,write:e=>(r||(e=this._outputConfiguration.stripColor(e)),n(e)),hasColors:r,helpWidth:i}}outputHelp(e){let t;typeof e==`function`&&(t=e,e=void 0);let n=this._getOutputContext(e),r={error:n.error,write:n.write,command:this};this._getCommandAndAncestors().reverse().forEach(e=>e.emit(`beforeAllHelp`,r)),this.emit(`beforeHelp`,r);let i=this.helpInformation({error:n.error});if(t&&(i=t(i),typeof i!=`string`&&!Buffer.isBuffer(i)))throw Error(`outputHelp callback must return a string or a Buffer`);n.write(i),this._getHelpOption()?.long&&this.emit(this._getHelpOption().long),this.emit(`afterHelp`,r),this._getCommandAndAncestors().forEach(e=>e.emit(`afterAllHelp`,r))}helpOption(e,t){return typeof e==`boolean`?(e?(this._helpOption===null&&(this._helpOption=void 0),this._defaultOptionGroup&&this._initOptionGroup(this._getHelpOption())):this._helpOption=null,this):(this._helpOption=this.createOption(e??`-h, --help`,t??`display help for command`),(e||t)&&this._initOptionGroup(this._helpOption),this)}_getHelpOption(){return this._helpOption===void 0&&this.helpOption(void 0,void 0),this._helpOption}addHelpOption(e){return this._helpOption=e,this._initOptionGroup(e),this}help(e){this.outputHelp(e);let t=Number(o.exitCode??0);t===0&&e&&typeof e!=`function`&&e.error&&(t=1),this._exit(t,`commander.help`,`(outputHelp)`)}addHelpText(e,t){let n=[`beforeAll`,`before`,`after`,`afterAll`];if(!n.includes(e))throw Error(`Unexpected value for position to addHelpText.
882
- Expecting one of '${n.join(`', '`)}'`);let r=`${e}Help`;return this.on(r,e=>{let n;n=typeof t==`function`?t({error:e.error,command:e.command}):t,n&&e.write(`${n}\n`)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(e=>t.is(e))&&(this.outputHelp(),this._exit(0,`commander.helpDisplayed`,`(outputHelp)`))}};function g(e){return e.map(e=>{if(!e.startsWith(`--inspect`))return e;let t,n=`127.0.0.1`,r=`9229`,i;return(i=e.match(/^(--inspect(-brk)?)$/))===null?(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))===null?(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=i[1],n=i[3],r=i[4]):(t=i[1],/^\d+$/.test(i[3])?r=i[3]:n=i[3]):t=i[1],t&&r!==`0`?`${t}=${n}:${parseInt(r)+1}`:e})}function _(){if(o.env.NO_COLOR||o.env.FORCE_COLOR===`0`||o.env.FORCE_COLOR===`false`)return!1;if(o.env.FORCE_COLOR||o.env.CLICOLOR_FORCE!==void 0)return!0}e.Command=h,e.useColor=_}));const{program:hbe,createCommand:gbe,createArgument:_be,createOption:vbe,CommanderError:ybe,InvalidArgumentError:bbe,InvalidOptionArgumentError:xbe,Command:Sbe,Argument:Cbe,Option:wbe,Help:Tbe}=e(i((e=>{let{Argument:t}=f7(),{Command:n}=mbe(),{CommanderError:r,InvalidArgumentError:i}=d7(),{Help:a}=p7(),{Option:o}=m7();e.program=new n,e.createCommand=e=>new n(e),e.createOption=(e,t)=>new o(e,t),e.createArgument=(e,n)=>new t(e,n),e.Command=n,e.Option=o,e.Argument=t,e.Help=a,e.CommanderError=r,e.InvalidArgumentError=i,e.InvalidOptionArgumentError=i}))(),1).default;
882
+ Expecting one of '${n.join(`', '`)}'`);let r=`${e}Help`;return this.on(r,e=>{let n;n=typeof t==`function`?t({error:e.error,command:e.command}):t,n&&e.write(`${n}\n`)}),this}_outputHelpIfRequested(e){let t=this._getHelpOption();t&&e.find(e=>t.is(e))&&(this.outputHelp(),this._exit(0,`commander.helpDisplayed`,`(outputHelp)`))}};function g(e){return e.map(e=>{if(!e.startsWith(`--inspect`))return e;let t,n=`127.0.0.1`,r=`9229`,i;return(i=e.match(/^(--inspect(-brk)?)$/))===null?(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+)$/))===null?(i=e.match(/^(--inspect(-brk|-port)?)=([^:]+):(\d+)$/))!==null&&(t=i[1],n=i[3],r=i[4]):(t=i[1],/^\d+$/.test(i[3])?r=i[3]:n=i[3]):t=i[1],t&&r!==`0`?`${t}=${n}:${parseInt(r)+1}`:e})}function _(){if(o.env.NO_COLOR||o.env.FORCE_COLOR===`0`||o.env.FORCE_COLOR===`false`)return!1;if(o.env.FORCE_COLOR||o.env.CLICOLOR_FORCE!==void 0)return!0}e.Command=h,e.useColor=_}));const{program:gbe,createCommand:_be,createArgument:vbe,createOption:ybe,CommanderError:bbe,InvalidArgumentError:xbe,InvalidOptionArgumentError:Sbe,Command:Cbe,Argument:wbe,Option:Tbe,Help:Ebe}=e(i((e=>{let{Argument:t}=f7(),{Command:n}=hbe(),{CommanderError:r,InvalidArgumentError:i}=d7(),{Help:a}=p7(),{Option:o}=m7();e.program=new n,e.createCommand=e=>new n(e),e.createOption=(e,t)=>new o(e,t),e.createArgument=(e,n)=>new t(e,n),e.Command=n,e.Option=o,e.Argument=t,e.Help=a,e.CommanderError=r,e.InvalidArgumentError=i,e.InvalidOptionArgumentError=i}))(),1).default;
883
883
  /*!
884
884
  * Copyright (c) Squirrel Chat et al., All rights reserved.
885
885
  * SPDX-License-Identifier: BSD-3-Clause
@@ -907,7 +907,7 @@ Expecting one of '${n.join(`', '`)}'`);let r=`${e}Help`;return this.on(r,e=>{let
907
907
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
908
908
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
909
909
  */
910
- let Ebe=/^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i;var Dbe=class e extends Date{#e=!1;#t=!1;#n=null;constructor(e){let t=!0,n=!0,r=`Z`;if(typeof e==`string`){let i=e.match(Ebe);i?(i[1]||(t=!1,e=`0000-01-01T${e}`),n=!!i[2],n&&e[10]===` `&&(e=e.replace(` `,`T`)),i[2]&&+i[2]>23?e=``:(r=i[3]||null,e=e.toUpperCase(),!r&&n&&(e+=`Z`))):e=``}super(e),isNaN(this.getTime())||(this.#e=t,this.#t=n,this.#n=r)}isDateTime(){return this.#e&&this.#t}isLocal(){return!this.#e||!this.#t||!this.#n}isDate(){return this.#e&&!this.#t}isTime(){return this.#t&&!this.#e}isValid(){return this.#e||this.#t}toISOString(){let e=super.toISOString();if(this.isDate())return e.slice(0,10);if(this.isTime())return e.slice(11,23);if(this.#n===null)return e.slice(0,-1);if(this.#n===`Z`)return e;let t=this.#n.slice(1,3)*60+ +this.#n.slice(4,6);return t=this.#n[0]===`-`?t:-t,new Date(this.getTime()-t*6e4).toISOString().slice(0,-1)+this.#n}static wrapAsOffsetDateTime(t,n=`Z`){let r=new e(t);return r.#n=n,r}static wrapAsLocalDateTime(t){let n=new e(t);return n.#n=null,n}static wrapAsLocalDate(t){let n=new e(t);return n.#t=!1,n.#n=null,n}static wrapAsLocalTime(t){let n=new e(t);return n.#e=!1,n.#n=null,n}};
910
+ let Dbe=/^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+]\d{2}:\d{2})?$/i;var Obe=class e extends Date{#e=!1;#t=!1;#n=null;constructor(e){let t=!0,n=!0,r=`Z`;if(typeof e==`string`){let i=e.match(Dbe);i?(i[1]||(t=!1,e=`0000-01-01T${e}`),n=!!i[2],n&&e[10]===` `&&(e=e.replace(` `,`T`)),i[2]&&+i[2]>23?e=``:(r=i[3]||null,e=e.toUpperCase(),!r&&n&&(e+=`Z`))):e=``}super(e),isNaN(this.getTime())||(this.#e=t,this.#t=n,this.#n=r)}isDateTime(){return this.#e&&this.#t}isLocal(){return!this.#e||!this.#t||!this.#n}isDate(){return this.#e&&!this.#t}isTime(){return this.#t&&!this.#e}isValid(){return this.#e||this.#t}toISOString(){let e=super.toISOString();if(this.isDate())return e.slice(0,10);if(this.isTime())return e.slice(11,23);if(this.#n===null)return e.slice(0,-1);if(this.#n===`Z`)return e;let t=this.#n.slice(1,3)*60+ +this.#n.slice(4,6);return t=this.#n[0]===`-`?t:-t,new Date(this.getTime()-t*6e4).toISOString().slice(0,-1)+this.#n}static wrapAsOffsetDateTime(t,n=`Z`){let r=new e(t);return r.#n=n,r}static wrapAsLocalDateTime(t){let n=new e(t);return n.#n=null,n}static wrapAsLocalDate(t){let n=new e(t);return n.#t=!1,n.#n=null,n}static wrapAsLocalTime(t){let n=new e(t);return n.#e=!1,n.#n=null,n}};
911
911
  /*!
912
912
  * Copyright (c) Squirrel Chat et al., All rights reserved.
913
913
  * SPDX-License-Identifier: BSD-3-Clause
@@ -935,9 +935,9 @@ let Ebe=/^(\d{4}-\d{2}-\d{2})?[T ]?(?:(\d{2}):\d{2}(?::\d{2}(?:\.\d+)?)?)?(Z|[-+
935
935
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
936
936
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
937
937
  */
938
- function Obe(e,t){let n=e.slice(0,t).split(/\r\n|\n|\r/g);return[n.length,n.pop().length+1]}function kbe(e,t,n){let r=e.split(/\r\n|\n|\r/g),i=``,a=(Math.log10(t+1)|0)+1;for(let e=t-1;e<=t+1;e++){let o=r[e-1];o&&(i+=e.toString().padEnd(a,` `),i+=`: `,i+=o,i+=`
938
+ function kbe(e,t){let n=e.slice(0,t).split(/\r\n|\n|\r/g);return[n.length,n.pop().length+1]}function Abe(e,t,n){let r=e.split(/\r\n|\n|\r/g),i=``,a=(Math.log10(t+1)|0)+1;for(let e=t-1;e<=t+1;e++){let o=r[e-1];o&&(i+=e.toString().padEnd(a,` `),i+=`: `,i+=o,i+=`
939
939
  `,e===t&&(i+=` `.repeat(a+n+2),i+=`^
940
- `))}return i}var h7=class extends Error{line;column;codeblock;constructor(e,t){let[n,r]=Obe(t.toml,t.ptr),i=kbe(t.toml,n,r);super(`Invalid TOML document: ${e}\n\n${i}`,t),this.line=n,this.column=r,this.codeblock=i}};
940
+ `))}return i}var h7=class extends Error{line;column;codeblock;constructor(e,t){let[n,r]=kbe(t.toml,t.ptr),i=Abe(t.toml,n,r);super(`Invalid TOML document: ${e}\n\n${i}`,t),this.line=n,this.column=r,this.codeblock=i}};
941
941
  /*!
942
942
  * Copyright (c) Squirrel Chat et al., All rights reserved.
943
943
  * SPDX-License-Identifier: BSD-3-Clause
@@ -965,12 +965,12 @@ function Obe(e,t){let n=e.slice(0,t).split(/\r\n|\n|\r/g);return[n.length,n.pop(
965
965
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
966
966
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
967
967
  */
968
- let Abe=/^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/,jbe=/^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/,Mbe=/^[+-]?0[0-9_]/;function g7(e,t){let n=e[t++],r=n,i=n===`'`,a=n===e[t]&&n===e[t+1];a&&(e[t+=2]===`
968
+ let jbe=/^((0x[0-9a-fA-F](_?[0-9a-fA-F])*)|(([+-]|0[ob])?\d(_?\d)*))$/,Mbe=/^[+-]?\d(_?\d)*(\.\d(_?\d)*)?([eE][+-]?\d(_?\d)*)?$/,Nbe=/^[+-]?0[0-9_]/;function g7(e,t){let n=e[t++],r=n,i=n===`'`,a=n===e[t]&&n===e[t+1];a&&(e[t+=2]===`
969
969
  `?t++:e[t]===`\r`&&e[t+1]===`
970
970
  `&&(t+=2));let o=``,s=t,c=0;for(let l=t;l<e.length;l++)if(n=e[l],a&&(n===`
971
971
  `||n===`\r`&&e[l+1]===`
972
972
  `))c&&=3;else if(n<` `&&n!==` `||n===``)throw new h7(`control characters are not allowed in strings`,{toml:e,ptr:l});else if((!c||c===3)&&n===r&&(!a||e[l+1]===r&&e[l+2]===r))return a&&(e[l+3]===r&&l++,e[l+3]===r&&l++),[c?o:o+e.slice(s,l),l+(a?3:1)];else if(!c)!i&&n===`\\`&&(o+=e.slice(s,s=l),c=1);else if(c===1)if(n===`x`||n===`u`||n===`U`){let t=0,r=n===`x`?2:n===`u`?4:8;for(let n=0;n<r;n++,l++){let n=e.charCodeAt(l+1),r=n>=48&&n<=57?n-48:n>=65&&n<=70?n-65+10:n>=97&&n<=102?n-97+10:-1;if(r<0)throw new h7(`invalid non-hex character in unicode escape`,{toml:e,ptr:l+1});t=t<<4|r}if(t<0||t>1114111||t>=55296&&t<=57343)throw new h7(`invalid unicode escape`,{toml:e,ptr:l});o+=String.fromCodePoint(t),s=l+1,c=0}else if(n===` `||n===` `)c=2;else{if(n===`b`)o+=`\b`;else if(n===`t`)o+=` `;else if(n===`n`)o+=`
973
- `;else if(n===`f`)o+=`\f`;else if(n===`r`)o+=`\r`;else if(n===`e`)o+=`\x1B`;else if(n===`"`)o+=`"`;else if(n===`\\`)o+=`\\`;else throw new h7(`unrecognized escape sequence`,{toml:e,ptr:l});s=l+1,c=0}else if(n!==` `&&n!==` `){if(c===2)throw new h7(`invalid escape: only line-ending whitespace may be escaped`,{toml:e,ptr:s});c=+(!i&&n===`\\`),s=l}throw new h7(`unfinished string`,{toml:e,ptr:t})}function Nbe(e,t,n,r){if(e===`true`)return!0;if(e===`false`)return!1;if(e===`-inf`)return-1/0;if(e===`inf`||e===`+inf`)return 1/0;if(e===`nan`||e===`+nan`||e===`-nan`)return NaN;if(e===`-0`)return r?0n:0;let i=Abe.test(e);if(i||jbe.test(e)){if(Mbe.test(e))throw new h7(`leading zeroes are not allowed`,{toml:t,ptr:n});e=e.replace(/_/g,``);let a=+e;if(isNaN(a))throw new h7(`invalid number`,{toml:t,ptr:n});if(i){if((i=!Number.isSafeInteger(a))&&!r)throw new h7(`integer value cannot be represented losslessly`,{toml:t,ptr:n});(i||r===!0)&&(a=BigInt(e))}return a}let a=new Dbe(e);if(!a.isValid())throw new h7(`invalid value`,{toml:t,ptr:n});return a}
973
+ `;else if(n===`f`)o+=`\f`;else if(n===`r`)o+=`\r`;else if(n===`e`)o+=`\x1B`;else if(n===`"`)o+=`"`;else if(n===`\\`)o+=`\\`;else throw new h7(`unrecognized escape sequence`,{toml:e,ptr:l});s=l+1,c=0}else if(n!==` `&&n!==` `){if(c===2)throw new h7(`invalid escape: only line-ending whitespace may be escaped`,{toml:e,ptr:s});c=+(!i&&n===`\\`),s=l}throw new h7(`unfinished string`,{toml:e,ptr:t})}function Pbe(e,t,n,r){if(e===`true`)return!0;if(e===`false`)return!1;if(e===`-inf`)return-1/0;if(e===`inf`||e===`+inf`)return 1/0;if(e===`nan`||e===`+nan`||e===`-nan`)return NaN;if(e===`-0`)return r?0n:0;let i=jbe.test(e);if(i||Mbe.test(e)){if(Nbe.test(e))throw new h7(`leading zeroes are not allowed`,{toml:t,ptr:n});e=e.replace(/_/g,``);let a=+e;if(isNaN(a))throw new h7(`invalid number`,{toml:t,ptr:n});if(i){if((i=!Number.isSafeInteger(a))&&!r)throw new h7(`integer value cannot be represented losslessly`,{toml:t,ptr:n});(i||r===!0)&&(a=BigInt(e))}return a}let a=new Obe(e);if(!a.isValid())throw new h7(`invalid value`,{toml:t,ptr:n});return a}
974
974
  /*!
975
975
  * Copyright (c) Squirrel Chat et al., All rights reserved.
976
976
  * SPDX-License-Identifier: BSD-3-Clause
@@ -1003,7 +1003,7 @@ function _7(e,t=0,n=e.length){let r=e.indexOf(`
1003
1003
  `)return n;if(r===`\r`&&e[n+1]===`
1004
1004
  `)return n+1;if(r<` `&&r!==` `||r===``)throw new h7(`control characters are not allowed in comments`,{toml:e,ptr:t})}return e.length}function y7(e,t,n,r){let i;for(;;){for(;(i=e[t])===` `||i===` `||!n&&(i===`
1005
1005
  `||i===`\r`&&e[t+1]===`
1006
- `);)t++;if(r||i!==`#`)break;t=v7(e,t)}return t}function Pbe(e,t,n,r,i=!1){if(!r)return t=_7(e,t),t<0?e.length:t;for(let a=t;a<e.length;a++){let t=e[a];if(t===`#`)a=_7(e,a);else if(t===n)return a+1;else if(t===r||i&&(t===`
1006
+ `);)t++;if(r||i!==`#`)break;t=v7(e,t)}return t}function Fbe(e,t,n,r,i=!1){if(!r)return t=_7(e,t),t<0?e.length:t;for(let a=t;a<e.length;a++){let t=e[a];if(t===`#`)a=_7(e,a);else if(t===n)return a+1;else if(t===r||i&&(t===`
1007
1007
  `||t===`\r`&&e[a+1]===`
1008
1008
  `))return a}throw new h7(`cannot find end of structure`,{toml:e,ptr:t})}
1009
1009
  /*!
@@ -1033,8 +1033,8 @@ function _7(e,t=0,n=e.length){let r=e.indexOf(`
1033
1033
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1034
1034
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1035
1035
  */
1036
- function Fbe(e,t,n){let r=e.slice(t,n),i=r.indexOf(`#`);return i>-1&&(v7(e,i),r=r.slice(0,i)),[r.trimEnd(),i]}function b7(e,t,n,r,i){if(r===0)throw new h7(`document contains excessively nested structures. aborting.`,{toml:e,ptr:t});let a=e[t];if(a===`[`||a===`{`){let[o,s]=a===`[`?Rbe(e,t,r,i):Lbe(e,t,r,i);if(n){if(s=y7(e,s),e[s]===`,`)s++;else if(e[s]!==n)throw new h7(`expected comma or end of structure`,{toml:e,ptr:s})}return[o,s]}if(a===`"`||a===`'`){let[r,i]=g7(e,t);if(n){if(i=y7(e,i),e[i]&&e[i]!==`,`&&e[i]!==n&&e[i]!==`
1037
- `&&e[i]!==`\r`)throw new h7(`unexpected character encountered`,{toml:e,ptr:i});e[i]===`,`&&i++}return[r,i]}let o=Pbe(e,t,`,`,n),s=Fbe(e,t,o-+(e[o-1]===`,`));if(!s[0])throw new h7(`incomplete key-value declaration: no value specified`,{toml:e,ptr:t});return n&&s[1]>-1&&(o=y7(e,t+s[1]),e[o]===`,`&&o++),[Nbe(s[0],e,t,i),o]}
1036
+ function Ibe(e,t,n){let r=e.slice(t,n),i=r.indexOf(`#`);return i>-1&&(v7(e,i),r=r.slice(0,i)),[r.trimEnd(),i]}function b7(e,t,n,r,i){if(r===0)throw new h7(`document contains excessively nested structures. aborting.`,{toml:e,ptr:t});let a=e[t];if(a===`[`||a===`{`){let[o,s]=a===`[`?zbe(e,t,r,i):Rbe(e,t,r,i);if(n){if(s=y7(e,s),e[s]===`,`)s++;else if(e[s]!==n)throw new h7(`expected comma or end of structure`,{toml:e,ptr:s})}return[o,s]}if(a===`"`||a===`'`){let[r,i]=g7(e,t);if(n){if(i=y7(e,i),e[i]&&e[i]!==`,`&&e[i]!==n&&e[i]!==`
1037
+ `&&e[i]!==`\r`)throw new h7(`unexpected character encountered`,{toml:e,ptr:i});e[i]===`,`&&i++}return[r,i]}let o=Fbe(e,t,`,`,n),s=Ibe(e,t,o-+(e[o-1]===`,`));if(!s[0])throw new h7(`incomplete key-value declaration: no value specified`,{toml:e,ptr:t});return n&&s[1]>-1&&(o=y7(e,t+s[1]),e[o]===`,`&&o++),[Pbe(s[0],e,t,i),o]}
1038
1038
  /*!
1039
1039
  * Copyright (c) Squirrel Chat et al., All rights reserved.
1040
1040
  * SPDX-License-Identifier: BSD-3-Clause
@@ -1062,8 +1062,8 @@ function Fbe(e,t,n){let r=e.slice(t,n),i=r.indexOf(`#`);return i>-1&&(v7(e,i),r=
1062
1062
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1063
1063
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1064
1064
  */
1065
- let Ibe=/^[a-zA-Z0-9-_]+[ \t]*$/;function x7(e,t,n=`=`){let r=t-1,i=[],a=e.indexOf(n,t);if(a<0)throw new h7(`incomplete key-value: cannot find end of key`,{toml:e,ptr:t});do{let o=e[t=++r];if(o!==` `&&o!==` `)if(o===`"`||o===`'`){if(o===e[t+1]&&o===e[t+2])throw new h7(`multiline strings are not allowed in keys`,{toml:e,ptr:t});let[s,c]=g7(e,t);r=e.indexOf(`.`,c);let l=e.slice(c,r<0||r>a?a:r),u=_7(l);if(u>-1)throw new h7(`newlines are not allowed in keys`,{toml:e,ptr:t+r+u});if(l.trimStart())throw new h7(`found extra tokens after the string part`,{toml:e,ptr:c});if(a<c&&(a=e.indexOf(n,c),a<0))throw new h7(`incomplete key-value: cannot find end of key`,{toml:e,ptr:t});i.push(s)}else{r=e.indexOf(`.`,t);let n=e.slice(t,r<0||r>a?a:r);if(!Ibe.test(n))throw new h7(`only letter, numbers, dashes and underscores are allowed in keys`,{toml:e,ptr:t});i.push(n.trimEnd())}}while(r+1&&r<a);return[i,y7(e,a+1,!0,!0)]}function Lbe(e,t,n,r){let i={},a=new Set,o;for(t++;(o=e[t++])!==`}`&&o;)if(o===`,`)throw new h7(`expected value, found comma`,{toml:e,ptr:t-1});else if(o===`#`)t=v7(e,t);else if(o!==` `&&o!==` `&&o!==`
1066
- `&&o!==`\r`){let o,s=i,c=!1,[l,u]=x7(e,t-1);for(let n=0;n<l.length;n++){if(n&&(s=c?s[o]:s[o]={}),o=l[n],(c=Object.hasOwn(s,o))&&(typeof s[o]!=`object`||a.has(s[o])))throw new h7(`trying to redefine an already defined value`,{toml:e,ptr:t});!c&&o===`__proto__`&&Object.defineProperty(s,o,{enumerable:!0,configurable:!0,writable:!0})}if(c)throw new h7(`trying to redefine an already defined value`,{toml:e,ptr:t});let[d,f]=b7(e,u,`}`,n-1,r);a.add(d),s[o]=d,t=f}if(!o)throw new h7(`unfinished table encountered`,{toml:e,ptr:t});return[i,t]}function Rbe(e,t,n,r){let i=[],a;for(t++;(a=e[t++])!==`]`&&a;)if(a===`,`)throw new h7(`expected value, found comma`,{toml:e,ptr:t-1});else if(a===`#`)t=v7(e,t);else if(a!==` `&&a!==` `&&a!==`
1065
+ let Lbe=/^[a-zA-Z0-9-_]+[ \t]*$/;function x7(e,t,n=`=`){let r=t-1,i=[],a=e.indexOf(n,t);if(a<0)throw new h7(`incomplete key-value: cannot find end of key`,{toml:e,ptr:t});do{let o=e[t=++r];if(o!==` `&&o!==` `)if(o===`"`||o===`'`){if(o===e[t+1]&&o===e[t+2])throw new h7(`multiline strings are not allowed in keys`,{toml:e,ptr:t});let[s,c]=g7(e,t);r=e.indexOf(`.`,c);let l=e.slice(c,r<0||r>a?a:r),u=_7(l);if(u>-1)throw new h7(`newlines are not allowed in keys`,{toml:e,ptr:t+r+u});if(l.trimStart())throw new h7(`found extra tokens after the string part`,{toml:e,ptr:c});if(a<c&&(a=e.indexOf(n,c),a<0))throw new h7(`incomplete key-value: cannot find end of key`,{toml:e,ptr:t});i.push(s)}else{r=e.indexOf(`.`,t);let n=e.slice(t,r<0||r>a?a:r);if(!Lbe.test(n))throw new h7(`only letter, numbers, dashes and underscores are allowed in keys`,{toml:e,ptr:t});i.push(n.trimEnd())}}while(r+1&&r<a);return[i,y7(e,a+1,!0,!0)]}function Rbe(e,t,n,r){let i={},a=new Set,o;for(t++;(o=e[t++])!==`}`&&o;)if(o===`,`)throw new h7(`expected value, found comma`,{toml:e,ptr:t-1});else if(o===`#`)t=v7(e,t);else if(o!==` `&&o!==` `&&o!==`
1066
+ `&&o!==`\r`){let o,s=i,c=!1,[l,u]=x7(e,t-1);for(let n=0;n<l.length;n++){if(n&&(s=c?s[o]:s[o]={}),o=l[n],(c=Object.hasOwn(s,o))&&(typeof s[o]!=`object`||a.has(s[o])))throw new h7(`trying to redefine an already defined value`,{toml:e,ptr:t});!c&&o===`__proto__`&&Object.defineProperty(s,o,{enumerable:!0,configurable:!0,writable:!0})}if(c)throw new h7(`trying to redefine an already defined value`,{toml:e,ptr:t});let[d,f]=b7(e,u,`}`,n-1,r);a.add(d),s[o]=d,t=f}if(!o)throw new h7(`unfinished table encountered`,{toml:e,ptr:t});return[i,t]}function zbe(e,t,n,r){let i=[],a;for(t++;(a=e[t++])!==`]`&&a;)if(a===`,`)throw new h7(`expected value, found comma`,{toml:e,ptr:t-1});else if(a===`#`)t=v7(e,t);else if(a!==` `&&a!==` `&&a!==`
1067
1067
  `&&a!==`\r`){let a=b7(e,t-1,`]`,n-1,r);i.push(a[0]),t=a[1]}if(!a)throw new h7(`unfinished array encountered`,{toml:e,ptr:t});return[i,t]}
1068
1068
  /*!
1069
1069
  * Copyright (c) Squirrel Chat et al., All rights reserved.
@@ -1092,7 +1092,7 @@ let Ibe=/^[a-zA-Z0-9-_]+[ \t]*$/;function x7(e,t,n=`=`){let r=t-1,i=[],a=e.index
1092
1092
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1093
1093
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1094
1094
  */
1095
- function S7(e,t,n,r){let i=t,a=n,o,s=!1,c;for(let t=0;t<e.length;t++){if(t){if(i=s?i[o]:i[o]={},a=(c=a[o]).c,r===0&&(c.t===1||c.t===2))return null;if(c.t===2){let e=i.length-1;i=i[e],a=a[e].c}}if(o=e[t],(s=Object.hasOwn(i,o))&&a[o]?.t===0&&a[o]?.d)return null;s||(o===`__proto__`&&(Object.defineProperty(i,o,{enumerable:!0,configurable:!0,writable:!0}),Object.defineProperty(a,o,{enumerable:!0,configurable:!0,writable:!0})),a[o]={t:t<e.length-1&&r===2?3:r,d:!1,i:0,c:{}})}if(c=a[o],c.t!==r&&!(r===1&&c.t===3)||(r===2&&(c.d||(c.d=!0,i[o]=[]),i[o].push(i={}),c.c[c.i++]=c={t:1,d:!1,i:0,c:{}}),c.d))return null;if(c.d=!0,r===1)i=s?i[o]:i[o]={};else if(r===0&&s)return null;return[o,i,c.c]}function zbe(e,{maxDepth:t=1e3,integersAsBigInt:n}={}){let r={},i={},a=r,o=i;for(let s=y7(e,0);s<e.length;){if(e[s]===`[`){let t=e[++s]===`[`,n=x7(e,s+=+t,`]`);if(t){if(e[n[1]-1]!==`]`)throw new h7(`expected end of table declaration`,{toml:e,ptr:n[1]-1});n[1]++}let c=S7(n[0],r,i,t?2:1);if(!c)throw new h7(`trying to redefine an already defined table or value`,{toml:e,ptr:s});o=c[2],a=c[1],s=n[1]}else{let r=x7(e,s),i=S7(r[0],a,o,0);if(!i)throw new h7(`trying to redefine an already defined table or value`,{toml:e,ptr:s});let c=b7(e,r[1],void 0,t,n);i[1][i[0]]=c[0],s=c[1]}if(s=y7(e,s,!0),e[s]&&e[s]!==`
1095
+ function S7(e,t,n,r){let i=t,a=n,o,s=!1,c;for(let t=0;t<e.length;t++){if(t){if(i=s?i[o]:i[o]={},a=(c=a[o]).c,r===0&&(c.t===1||c.t===2))return null;if(c.t===2){let e=i.length-1;i=i[e],a=a[e].c}}if(o=e[t],(s=Object.hasOwn(i,o))&&a[o]?.t===0&&a[o]?.d)return null;s||(o===`__proto__`&&(Object.defineProperty(i,o,{enumerable:!0,configurable:!0,writable:!0}),Object.defineProperty(a,o,{enumerable:!0,configurable:!0,writable:!0})),a[o]={t:t<e.length-1&&r===2?3:r,d:!1,i:0,c:{}})}if(c=a[o],c.t!==r&&!(r===1&&c.t===3)||(r===2&&(c.d||(c.d=!0,i[o]=[]),i[o].push(i={}),c.c[c.i++]=c={t:1,d:!1,i:0,c:{}}),c.d))return null;if(c.d=!0,r===1)i=s?i[o]:i[o]={};else if(r===0&&s)return null;return[o,i,c.c]}function Bbe(e,{maxDepth:t=1e3,integersAsBigInt:n}={}){let r={},i={},a=r,o=i;for(let s=y7(e,0);s<e.length;){if(e[s]===`[`){let t=e[++s]===`[`,n=x7(e,s+=+t,`]`);if(t){if(e[n[1]-1]!==`]`)throw new h7(`expected end of table declaration`,{toml:e,ptr:n[1]-1});n[1]++}let c=S7(n[0],r,i,t?2:1);if(!c)throw new h7(`trying to redefine an already defined table or value`,{toml:e,ptr:s});o=c[2],a=c[1],s=n[1]}else{let r=x7(e,s),i=S7(r[0],a,o,0);if(!i)throw new h7(`trying to redefine an already defined table or value`,{toml:e,ptr:s});let c=b7(e,r[1],void 0,t,n);i[1][i[0]]=c[0],s=c[1]}if(s=y7(e,s,!0),e[s]&&e[s]!==`
1096
1096
  `&&e[s]!==`\r`)throw new h7(`each key-value declaration must be followed by an end-of-line`,{toml:e,ptr:s});s=y7(e,s)}return r}
1097
1097
  /*!
1098
1098
  * Copyright (c) Squirrel Chat et al., All rights reserved.
@@ -1121,13 +1121,13 @@ function S7(e,t,n,r){let i=t,a=n,o,s=!1,c;for(let t=0;t<e.length;t++){if(t){if(i
1121
1121
  * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
1122
1122
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
1123
1123
  */
1124
- let C7=/^[a-z0-9-_]+$/i;function w7(e){let t=typeof e;if(t===`object`){if(Array.isArray(e))return`array`;if(e instanceof Date)return`date`}return t}function Bbe(e){for(let t=0;t<e.length;t++)if(w7(e[t])!==`object`)return!1;return e.length!=0}function T7(e){return JSON.stringify(e).replace(/\x7f/g,`\\u007f`)}function E7(e,t,n,r){if(n===0)throw Error(`Could not stringify the object: maximum object depth exceeded`);if(t===`number`)return isNaN(e)?`nan`:e===1/0?`inf`:e===-1/0?`-inf`:Number.isInteger(e)&&(r||!Number.isSafeInteger(e))?e.toFixed(1):e.toString();if(t===`bigint`||t===`boolean`)return e.toString();if(t===`string`)return T7(e);if(t===`date`){if(isNaN(e.getTime()))throw TypeError(`cannot serialize invalid date`);return e.toISOString()}if(t===`object`)return Vbe(e,n,r);if(t===`array`)return Hbe(e,n,r)}function Vbe(e,t,n){let r=Object.keys(e);if(r.length===0)return`{}`;let i=`{ `;for(let a=0;a<r.length;a++){let o=r[a];a&&(i+=`, `),i+=C7.test(o)?o:T7(o),i+=` = `,i+=E7(e[o],w7(e[o]),t-1,n)}return i+` }`}function Hbe(e,t,n){if(e.length===0)return`[]`;let r=`[ `;for(let i=0;i<e.length;i++){if(i&&(r+=`, `),e[i]===null||e[i]===void 0)throw TypeError(`arrays cannot contain null or undefined values`);r+=E7(e[i],w7(e[i]),t-1,n)}return r+` ]`}function Ube(e,t,n,r){if(n===0)throw Error(`Could not stringify the object: maximum object depth exceeded`);let i=``;for(let a=0;a<e.length;a++)i+=`${i&&`
1125
- `}[[${t}]]\n`,i+=D7(0,e[a],t,n,r);return i}function D7(e,t,n,r,i){if(r===0)throw Error(`Could not stringify the object: maximum object depth exceeded`);let a=``,o=``,s=Object.keys(t);for(let e=0;e<s.length;e++){let c=s[e];if(t[c]!==null&&t[c]!==void 0){let e=w7(t[c]);if(e===`symbol`||e===`function`)throw TypeError(`cannot serialize values of type '${e}'`);let s=C7.test(c)?c:T7(c);if(e===`array`&&Bbe(t[c]))o+=(o&&`
1126
- `)+Ube(t[c],n?`${n}.${s}`:s,r-1,i);else if(e===`object`){let e=n?`${n}.${s}`:s;o+=(o&&`
1124
+ let C7=/^[a-z0-9-_]+$/i;function w7(e){let t=typeof e;if(t===`object`){if(Array.isArray(e))return`array`;if(e instanceof Date)return`date`}return t}function Vbe(e){for(let t=0;t<e.length;t++)if(w7(e[t])!==`object`)return!1;return e.length!=0}function T7(e){return JSON.stringify(e).replace(/\x7f/g,`\\u007f`)}function E7(e,t,n,r){if(n===0)throw Error(`Could not stringify the object: maximum object depth exceeded`);if(t===`number`)return isNaN(e)?`nan`:e===1/0?`inf`:e===-1/0?`-inf`:Number.isInteger(e)&&(r||!Number.isSafeInteger(e))?e.toFixed(1):e.toString();if(t===`bigint`||t===`boolean`)return e.toString();if(t===`string`)return T7(e);if(t===`date`){if(isNaN(e.getTime()))throw TypeError(`cannot serialize invalid date`);return e.toISOString()}if(t===`object`)return Hbe(e,n,r);if(t===`array`)return Ube(e,n,r)}function Hbe(e,t,n){let r=Object.keys(e);if(r.length===0)return`{}`;let i=`{ `;for(let a=0;a<r.length;a++){let o=r[a];a&&(i+=`, `),i+=C7.test(o)?o:T7(o),i+=` = `,i+=E7(e[o],w7(e[o]),t-1,n)}return i+` }`}function Ube(e,t,n){if(e.length===0)return`[]`;let r=`[ `;for(let i=0;i<e.length;i++){if(i&&(r+=`, `),e[i]===null||e[i]===void 0)throw TypeError(`arrays cannot contain null or undefined values`);r+=E7(e[i],w7(e[i]),t-1,n)}return r+` ]`}function Wbe(e,t,n,r){if(n===0)throw Error(`Could not stringify the object: maximum object depth exceeded`);let i=``;for(let a=0;a<e.length;a++)i+=`${i&&`
1125
+ `}[[${t}]]\n`,i+=D7(0,e[a],t,n,r);return i}function D7(e,t,n,r,i){if(r===0)throw Error(`Could not stringify the object: maximum object depth exceeded`);let a=``,o=``,s=Object.keys(t);for(let e=0;e<s.length;e++){let c=s[e];if(t[c]!==null&&t[c]!==void 0){let e=w7(t[c]);if(e===`symbol`||e===`function`)throw TypeError(`cannot serialize values of type '${e}'`);let s=C7.test(c)?c:T7(c);if(e===`array`&&Vbe(t[c]))o+=(o&&`
1126
+ `)+Wbe(t[c],n?`${n}.${s}`:s,r-1,i);else if(e===`object`){let e=n?`${n}.${s}`:s;o+=(o&&`
1127
1127
  `)+D7(e,t[c],e,r-1,i)}else a+=s,a+=` = `,a+=E7(t[c],e,r,i),a+=`
1128
- `}}return e&&(a||!o)&&(a=a?`[${e}]\n${a}`:`[${e}]`),a&&o?`${a}\n${o}`:a||o}function Wbe(e,{maxDepth:t=1e3,numbersAsFloat:n=!1}={}){if(w7(e)!==`object`)throw TypeError(`stringify can only be called with an object`);let r=D7(0,e,``,t,n);return r[r.length-1]===`
1128
+ `}}return e&&(a||!o)&&(a=a?`[${e}]\n${a}`:`[${e}]`),a&&o?`${a}\n${o}`:a||o}function Gbe(e,{maxDepth:t=1e3,numbersAsFloat:n=!1}={}){if(w7(e)!==`object`)throw TypeError(`stringify can only be called with an object`);let r=D7(0,e,``,t,n);return r[r.length-1]===`
1129
1129
  `?r:r+`
1130
- `}function Gbe(e){let{projectDir:t,contentDir:n,sampleCap:r=5}=e,i=[],a=[];try{_(n)}catch(e){return{totalCount:0,sample:[],contentDir:n,warnings:[`cannot access content directory ${n}: ${e instanceof Error?e.message:String(e)}`]}}let o;try{o=a_e({projectDir:t,contentDir:n})}catch(e){return{totalCount:0,sample:[],contentDir:n,warnings:[e instanceof Error?e.message:String(e)]}}function s(e){let t;try{t=C(e,{withFileTypes:!0})}catch(t){let r=t instanceof Error?t.message:String(t);i.push(`could not read directory ${ve(n,e)||`.`}: ${r}`);return}for(let r of t){let t=M(e,r.name);if(r.isSymbolicLink()){let e;try{e=T(t)}catch(e){let r=e.code;r===`ENOENT`||r===`ELOOP`?i.push(`broken or cyclic symlink: ${ve(n,t)}`):i.push(`cannot resolve symlink ${ve(n,t)}: ${r??`unknown error`}`);continue}let r;try{r=ee(e)}catch{continue}if(r.isDirectory()){let e=ve(n,t);if(o.isDirExcluded(e))continue;s(t)}else if(r.isFile()){let e=ve(n,t);if(o.isExcluded(e))continue;a.push(e)}}else if(r.isDirectory()){let e=ve(n,t);if(o.isDirExcluded(e))continue;s(t)}else if(r.isFile()){let e=ve(n,t);if(o.isExcluded(e))continue;a.push(e)}}}return s(n),{totalCount:a.length,sample:a.slice(0,r),contentDir:n,warnings:i}}const Kbe=`${Y5}-dev`;function qbe(e){return e.startsWith(Y5)}function Jbe(e){if(typeof e!=`object`||!e)return!1;let t=e;if(t.command!==`ok-pi-managed-extension`||!Array.isArray(t.args))return!1;let n=t.args[0];return typeof n==`string`&&qbe(n)}function Ybe(e){return{command:`ok-pi-managed-extension`,args:[e]}}function Xbe(e={}){let t=e.mode===`dev`?Kbe:X5,n={unix:$5({...e,platformName:`darwin`}),win32:$5({...e,platformName:`win32`})};return`${t}
1130
+ `}function Kbe(e){let{projectDir:t,contentDir:n,sampleCap:r=5}=e,i=[],a=[];try{_(n)}catch(e){return{totalCount:0,sample:[],contentDir:n,warnings:[`cannot access content directory ${n}: ${e instanceof Error?e.message:String(e)}`]}}let o;try{o=o_e({projectDir:t,contentDir:n})}catch(e){return{totalCount:0,sample:[],contentDir:n,warnings:[e instanceof Error?e.message:String(e)]}}function s(e){let t;try{t=C(e,{withFileTypes:!0})}catch(t){let r=t instanceof Error?t.message:String(t);i.push(`could not read directory ${ve(n,e)||`.`}: ${r}`);return}for(let r of t){let t=M(e,r.name);if(r.isSymbolicLink()){let e;try{e=T(t)}catch(e){let r=e.code;r===`ENOENT`||r===`ELOOP`?i.push(`broken or cyclic symlink: ${ve(n,t)}`):i.push(`cannot resolve symlink ${ve(n,t)}: ${r??`unknown error`}`);continue}let r;try{r=ee(e)}catch{continue}if(r.isDirectory()){let e=ve(n,t);if(o.isDirExcluded(e))continue;s(t)}else if(r.isFile()){let e=ve(n,t);if(o.isExcluded(e))continue;a.push(e)}}else if(r.isDirectory()){let e=ve(n,t);if(o.isDirExcluded(e))continue;s(t)}else if(r.isFile()){let e=ve(n,t);if(o.isExcluded(e))continue;a.push(e)}}}return s(n),{totalCount:a.length,sample:a.slice(0,r),contentDir:n,warnings:i}}const qbe=`${Y5}-dev`;function Jbe(e){return e.startsWith(Y5)}function Ybe(e){if(typeof e!=`object`||!e)return!1;let t=e;if(t.command!==`ok-pi-managed-extension`||!Array.isArray(t.args))return!1;let n=t.args[0];return typeof n==`string`&&Jbe(n)}function Xbe(e){return{command:`ok-pi-managed-extension`,args:[e]}}function Zbe(e={}){let t=e.mode===`dev`?qbe:X5,n={unix:$5({...e,platformName:`darwin`}),win32:$5({...e,platformName:`win32`})};return`${t}
1131
1131
  /**
1132
1132
  * Open Knowledge bridge for Pi — MANAGED FILE, written by \`ok init\`.
1133
1133
  * Hand edits are overwritten whenever OK re-syncs this project; remove it
@@ -1470,52 +1470,52 @@ export default function okBridge(pi: {
1470
1470
  }
1471
1471
  });
1472
1472
  }
1473
- `}function O7(e){try{return T.native(e)}catch{return e}}function Zbe(e,t){let n=ve(O7(t),O7(e));return n.length>0&&!n.startsWith(`..`)&&!j(n)}const Qbe=e=>{try{let t=c(`git`,[`rev-parse`,`--show-toplevel`],L3({cwd:e,encoding:`utf8`,stdio:[`ignore`,`pipe`,`ignore`]})).trim();return t.length>0?t:null}catch{return null}};function $be(e,t={}){let n=t.homeDir??se(),r=t.gitTopLevel??Qbe,i=ye(e),a;try{a=T(i)}catch{a=i}let o=a,s=0;for(;s<30&&!(o===n||o===`/`||o===``);){if(O_e(o))return{projectRoot:o,defaultContentDir:`.`,ancestorPromoted:o!==a,gitRootPromoted:!1};let e=me(o);if(e===o)break;o=e,s+=1}let c=r(a);return c!==null&&Zbe(c,n)?c===a?{projectRoot:i,defaultContentDir:`.`,ancestorPromoted:!1,gitRootPromoted:!1}:{projectRoot:c,defaultContentDir:`.`,ancestorPromoted:!1,gitRootPromoted:!0}:{projectRoot:i,defaultContentDir:`.`,ancestorPromoted:!1,gitRootPromoted:!1}}function k7(e,t){let n;try{n=_(e)}catch(e){if(e.code!==`ENOENT`)throw e}if(n?.isSymbolicLink())throw Error(`Refusing to write through a symbolic link at ${e}. Remove the symlink and re-run project setup.`);A7(e,t)}function exe(e,t){A7(e,t)}function A7(e,t){let n;try{n=T(t)}catch{n=ye(t)}let r=me(e);for(;r.length>1&&r!==be;){let t;try{t=T(r)}catch(e){if(e.code===`ENOENT`){r=me(r);continue}throw e}let i=ve(n,t);if(i===``||!i.startsWith(`..`)&&!j(i))return;throw Error(`Refusing to write at ${e}: ancestor ${r} resolves to ${t}, which is outside the project directory ${n}. A symbolic link in the path likely escapes the project. Remove the symlink and re-run project setup.`)}}function j7(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function txe(e,t,n){try{if(ee(n).size>10485760)return!1}catch{return!1}let r;try{r=S(n,`utf-8`)}catch{return!1}let i=[],a=g_e(r.charCodeAt(0)===65279?r.slice(1):r,i,{allowTrailingComma:!0,disallowComments:!1});if(i.length>0||!j7(a))return!1;let o=a[e.topLevelKey];if(!j7(o))return!1;let s=e.serverMapSubKey?o[e.serverMapSubKey]:o;return j7(s)?j7(s[e.serverName(t)]):!1}function nxe(e,t,n={}){if(e.id!==`copilot`)return!0;try{return txe(e,t,e.configPath(t,n.home))}catch{return!1}}function M7(e,t,n={}){let r=e.projectSkillPath?.(t);if(!r)return{editorId:e.id,label:e.label,action:`skipped-unsupported`,path:``};if(!nxe(e,t,n))return{editorId:e.id,label:e.label,action:`skipped-prerequisite`,path:r};try{let n=D_e(`project`,{checkDesktop:!0}),i=me(r);k7(i,t);let a=g(r)?`overwritten`:`written`;return D(i,{recursive:!0,force:!0}),v(me(i),{recursive:!0}),m(n,i,{recursive:!0}),{editorId:e.id,label:e.label,action:a,path:r}}catch(t){return{editorId:e.id,label:e.label,action:`failed`,path:r,error:t instanceof Error?t.message:String(t)}}}function rxe(e,t){let n=e.projectSkillPath?.(t);if(!n)return{editorId:e.id,label:e.label,action:`skipped-unsupported`,path:``};try{let r=me(n);return g(n)?(exe(r,t),D(r,{recursive:!0,force:!0}),{editorId:e.id,label:e.label,action:`removed`,path:n}):{editorId:e.id,label:e.label,action:`not-present`,path:n}}catch(t){return{editorId:e.id,label:e.label,action:`failed`,path:n,error:t instanceof Error?t.message:String(t)}}}function N7(e){let t=e&&typeof e==`object`&&`code`in e?e.code:void 0;return t===`MODULE_NOT_FOUND`||t===`ERR_MODULE_NOT_FOUND`}function P7(e,t){if(!process.env.OK_DEBUG_NATIVE)return;let n=t instanceof Error?t.message:String(t);process.stderr.write(`[ok] native-config ${e}: ${n}\n`)}const ixe=[`native`,`index.js`];function F7(e={}){let t=e.moduleUrl??import.meta.url,n=e.requireModule??o(t);try{return n(M(me(Ce(t)),...ixe))}catch(e){N7(e)||P7(`bundled loader failed to load`,e)}try{return n(`@inkeep/open-knowledge-native-config`)}catch(e){return N7(e)||P7(`workspace addon failed to load`,e),null}}function axe(){let e=F7();return e&&typeof e.resolveSymlinkWritePath==`function`?e:null}function oxe(e){let t=e,n=new Set;for(;;){let r;try{r=_(t).isSymbolicLink()}catch(n){return n.code===`ENOENT`?{readPath:t,writePath:t}:{readPath:null,writePath:e}}if(!r)return{readPath:t,writePath:t};if(n.has(t))return{readPath:null,writePath:e};n.add(t);let i;try{i=w(t)}catch(t){return P7(`readlinkSync threw during symlink walk`,t),{readPath:null,writePath:e}}t=j(i)?i:M(me(t),i)}}let I7;function sxe(){return I7===void 0&&(I7=axe()),I7}function cxe(e,t=sxe){let n=t();if(n)try{let t=n.resolveSymlinkWritePath(e);return{readPath:t.readPath??null,writePath:t.writePath}}catch(e){P7(`resolveSymlinkWritePath threw`,e)}return oxe(e)}function L7(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function lxe(){let e=F7();return e&&typeof e.parseTomlToJson==`function`?e:null}function uxe(e){try{let t=e.parseTomlToJson(`probe = 1`);return typeof t==`string`&&t.includes(`probe`)}catch(e){return P7(`addon loaded but probe failed`,e),!1}}function R7(e){if(!L7(e))throw Error(`TOML root is not a table`);return e}function dxe(e){return{backend:`native`,parseToObject(t){return R7(JSON.parse(e.parseTomlToJson(t)))},upsertEntry(t,n,r){let i=e.upsertMcpServer(t,n,JSON.stringify(r));return{text:i.text,existed:i.existed}},removeEntry(t,n){let r=e.removeMcpServer(t,n);return{text:r.text,existed:r.existed}}}}function fxe(){return{backend:`fallback`,parseToObject(e){return R7(zbe(e))}}}function pxe(e=lxe){let t=e();return t&&uxe(t)?dxe(t):fxe()}let z7=null;function B7(){return z7===null&&(z7=pxe()),z7}const V7=`.ok/`,H7=`**/.ok/*`,U7=`!**/${vl}/`;function W7(e){let t=[`.ok/`,`.okignore`];for(let n of H5){let r=u7[n];r.projectConfigPath&&t.push(bxe(r.projectConfigPath(e),e))}t.push(`.claude/launch.json`);let n=M(e,...cY);if(g(n))try{let e=fY(S(n,`utf-8`));if(e){for(let[n,r]of Object.entries(e.skills))if(n!==`open-knowledge`)for(let e of r.hosts){let r=Sl[e];r&&t.push(`${r}/${n}/`)}}}catch{}return Array.from(new Set(t))}function mxe(e,t){let n=G7(e,t).tracked;if(n.length>0)return{kind:`refused-tracked`,tracked:n,remediation:K7(n)};let r=q7(e);if(r.kind!==`ok`)return r.result;let i=g(r.path)?S(r.path,`utf-8`):``,a=X7(i),o=[],s=[];for(let e of t)Y7(a,e)?s.push(e):o.push(e);if(o.length===0)return{kind:`updated`,appended:o,alreadyPresent:s,removed:[]};let c=i.length===0||i.endsWith(`
1473
+ `}function O7(e){try{return T.native(e)}catch{return e}}function Qbe(e,t){let n=ve(O7(t),O7(e));return n.length>0&&!n.startsWith(`..`)&&!j(n)}const $be=e=>{try{let t=c(`git`,[`rev-parse`,`--show-toplevel`],L3({cwd:e,encoding:`utf8`,stdio:[`ignore`,`pipe`,`ignore`]})).trim();return t.length>0?t:null}catch{return null}};function exe(e,t={}){let n=t.homeDir??se(),r=t.gitTopLevel??$be,i=ye(e),a;try{a=T(i)}catch{a=i}let o=a,s=0;for(;s<30&&!(o===n||o===`/`||o===``);){if(k_e(o))return{projectRoot:o,defaultContentDir:`.`,ancestorPromoted:o!==a,gitRootPromoted:!1};let e=me(o);if(e===o)break;o=e,s+=1}let c=r(a);return c!==null&&Qbe(c,n)?c===a?{projectRoot:i,defaultContentDir:`.`,ancestorPromoted:!1,gitRootPromoted:!1}:{projectRoot:c,defaultContentDir:`.`,ancestorPromoted:!1,gitRootPromoted:!0}:{projectRoot:i,defaultContentDir:`.`,ancestorPromoted:!1,gitRootPromoted:!1}}function k7(e,t){let n;try{n=_(e)}catch(e){if(e.code!==`ENOENT`)throw e}if(n?.isSymbolicLink())throw Error(`Refusing to write through a symbolic link at ${e}. Remove the symlink and re-run project setup.`);A7(e,t)}function txe(e,t){A7(e,t)}function A7(e,t){let n;try{n=T(t)}catch{n=ye(t)}let r=me(e);for(;r.length>1&&r!==be;){let t;try{t=T(r)}catch(e){if(e.code===`ENOENT`){r=me(r);continue}throw e}let i=ve(n,t);if(i===``||!i.startsWith(`..`)&&!j(i))return;throw Error(`Refusing to write at ${e}: ancestor ${r} resolves to ${t}, which is outside the project directory ${n}. A symbolic link in the path likely escapes the project. Remove the symlink and re-run project setup.`)}}function j7(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function nxe(e,t,n){try{if(ee(n).size>10485760)return!1}catch{return!1}let r;try{r=S(n,`utf-8`)}catch{return!1}let i=[],a=__e(r.charCodeAt(0)===65279?r.slice(1):r,i,{allowTrailingComma:!0,disallowComments:!1});if(i.length>0||!j7(a))return!1;let o=a[e.topLevelKey];if(!j7(o))return!1;let s=e.serverMapSubKey?o[e.serverMapSubKey]:o;return j7(s)?j7(s[e.serverName(t)]):!1}function rxe(e,t,n={}){if(e.id!==`copilot`)return!0;try{return nxe(e,t,e.configPath(t,n.home))}catch{return!1}}function M7(e,t,n={}){let r=e.projectSkillPath?.(t);if(!r)return{editorId:e.id,label:e.label,action:`skipped-unsupported`,path:``};if(!rxe(e,t,n))return{editorId:e.id,label:e.label,action:`skipped-prerequisite`,path:r};try{let n=O_e(`project`,{checkDesktop:!0}),i=me(r);k7(i,t);let a=g(r)?`overwritten`:`written`;return D(i,{recursive:!0,force:!0}),v(me(i),{recursive:!0}),m(n,i,{recursive:!0}),{editorId:e.id,label:e.label,action:a,path:r}}catch(t){return{editorId:e.id,label:e.label,action:`failed`,path:r,error:t instanceof Error?t.message:String(t)}}}function ixe(e,t){let n=e.projectSkillPath?.(t);if(!n)return{editorId:e.id,label:e.label,action:`skipped-unsupported`,path:``};try{let r=me(n);return g(n)?(txe(r,t),D(r,{recursive:!0,force:!0}),{editorId:e.id,label:e.label,action:`removed`,path:n}):{editorId:e.id,label:e.label,action:`not-present`,path:n}}catch(t){return{editorId:e.id,label:e.label,action:`failed`,path:n,error:t instanceof Error?t.message:String(t)}}}function N7(e){let t=e&&typeof e==`object`&&`code`in e?e.code:void 0;return t===`MODULE_NOT_FOUND`||t===`ERR_MODULE_NOT_FOUND`}function P7(e,t){if(!process.env.OK_DEBUG_NATIVE)return;let n=t instanceof Error?t.message:String(t);process.stderr.write(`[ok] native-config ${e}: ${n}\n`)}const axe=[`native`,`index.js`];function F7(e={}){let t=e.moduleUrl??import.meta.url,n=e.requireModule??o(t);try{return n(M(me(Ce(t)),...axe))}catch(e){N7(e)||P7(`bundled loader failed to load`,e)}try{return n(`@inkeep/open-knowledge-native-config`)}catch(e){return N7(e)||P7(`workspace addon failed to load`,e),null}}function oxe(){let e=F7();return e&&typeof e.resolveSymlinkWritePath==`function`?e:null}function sxe(e){let t=e,n=new Set;for(;;){let r;try{r=_(t).isSymbolicLink()}catch(n){return n.code===`ENOENT`?{readPath:t,writePath:t}:{readPath:null,writePath:e}}if(!r)return{readPath:t,writePath:t};if(n.has(t))return{readPath:null,writePath:e};n.add(t);let i;try{i=w(t)}catch(t){return P7(`readlinkSync threw during symlink walk`,t),{readPath:null,writePath:e}}t=j(i)?i:M(me(t),i)}}let I7;function cxe(){return I7===void 0&&(I7=oxe()),I7}function lxe(e,t=cxe){let n=t();if(n)try{let t=n.resolveSymlinkWritePath(e);return{readPath:t.readPath??null,writePath:t.writePath}}catch(e){P7(`resolveSymlinkWritePath threw`,e)}return sxe(e)}function L7(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function uxe(){let e=F7();return e&&typeof e.parseTomlToJson==`function`?e:null}function dxe(e){try{let t=e.parseTomlToJson(`probe = 1`);return typeof t==`string`&&t.includes(`probe`)}catch(e){return P7(`addon loaded but probe failed`,e),!1}}function R7(e){if(!L7(e))throw Error(`TOML root is not a table`);return e}function fxe(e){return{backend:`native`,parseToObject(t){return R7(JSON.parse(e.parseTomlToJson(t)))},upsertEntry(t,n,r){let i=e.upsertMcpServer(t,n,JSON.stringify(r));return{text:i.text,existed:i.existed}},removeEntry(t,n){let r=e.removeMcpServer(t,n);return{text:r.text,existed:r.existed}}}}function pxe(){return{backend:`fallback`,parseToObject(e){return R7(Bbe(e))}}}function mxe(e=uxe){let t=e();return t&&dxe(t)?fxe(t):pxe()}let z7=null;function B7(){return z7===null&&(z7=mxe()),z7}const V7=`.ok/`,H7=`**/.ok/*`,U7=`!**/${vl}/`;function W7(e){let t=[`.ok/`,`.okignore`];for(let n of H5){let r=u7[n];r.projectConfigPath&&t.push(xxe(r.projectConfigPath(e),e))}t.push(`.claude/launch.json`);let n=M(e,...cY);if(g(n))try{let e=fY(S(n,`utf-8`));if(e){for(let[n,r]of Object.entries(e.skills))if(n!==`open-knowledge`)for(let e of r.hosts){let r=Sl[e];r&&t.push(`${r}/${n}/`)}}}catch{}return Array.from(new Set(t))}function hxe(e,t){let n=G7(e,t).tracked;if(n.length>0)return{kind:`refused-tracked`,tracked:n,remediation:K7(n)};let r=q7(e);if(r.kind!==`ok`)return r.result;let i=g(r.path)?S(r.path,`utf-8`):``,a=X7(i),o=[],s=[];for(let e of t)Y7(a,e)?s.push(e):o.push(e);if(o.length===0)return{kind:`updated`,appended:o,alreadyPresent:s,removed:[]};let c=i.length===0||i.endsWith(`
1474
1474
  `)?``:`
1475
1475
  `,l=`${o.join(`
1476
- `)}\n`;try{ne(r.path,`${i}${c}${l}`,`utf-8`)}catch{return{kind:`no-exclude`,reason:`inaccessible`}}return{kind:`updated`,appended:o,alreadyPresent:s,removed:[]}}function hxe(e,t){let n=q7(e);if(n.kind!==`ok`)return n.result;if(!g(n.path))return{kind:`updated`,appended:[],alreadyPresent:[],removed:[]};let r=t.map(e=>J7(e)),i=new Set;for(let e of r)for(let t of e)i.add(t);i.add(H7),i.add(U7);let a;try{a=S(n.path,`utf-8`)}catch{return{kind:`no-exclude`,reason:`inaccessible`}}let o=a.split(`
1476
+ `)}\n`;try{ne(r.path,`${i}${c}${l}`,`utf-8`)}catch{return{kind:`no-exclude`,reason:`inaccessible`}}return{kind:`updated`,appended:o,alreadyPresent:s,removed:[]}}function gxe(e,t){let n=q7(e);if(n.kind!==`ok`)return n.result;if(!g(n.path))return{kind:`updated`,appended:[],alreadyPresent:[],removed:[]};let r=t.map(e=>J7(e)),i=new Set;for(let e of r)for(let t of e)i.add(t);i.add(H7),i.add(U7);let a;try{a=S(n.path,`utf-8`)}catch{return{kind:`no-exclude`,reason:`inaccessible`}}let o=a.split(`
1477
1477
  `),s=new Set,c=[];for(let e of o){let t=e.trim();if(i.has(t)){s.add(t);continue}c.push(e)}let l=t.filter(e=>{for(let t of J7(e))if(s.has(t))return!0;return!1});if(s.size===0)return{kind:`updated`,appended:[],alreadyPresent:[],removed:[]};let u=c.join(`
1478
- `);if(u!==a)try{ne(n.path,u,`utf-8`)}catch{return{kind:`no-exclude`,reason:`inaccessible`}}return{kind:`updated`,appended:[],alreadyPresent:[],removed:l}}function gxe(e){let t=q7(e);if(t.kind!==`ok`)return t.result.reason===`no-git`||t.result.reason===`malformed-pointer`||t.result.reason===`inaccessible`?`no-git`:`shared`;if(!g(t.path))return`shared`;let n;try{n=S(t.path,`utf-8`)}catch{return`shared`}let r=X7(n),i=W7(e);for(let e of i)if(Y7(r,e))return`local-only`;return r.has(H7)?`local-only`:`shared`}function _xe(e){let t=q7(e);if(t.kind!==`ok`||!g(t.path))return[];let n;try{n=S(t.path,`utf-8`)}catch{return[]}let r=X7(n);return W7(e).filter(e=>Y7(r,e))}function vxe(e){let t=q7(e);if(t.kind!==`ok`||!g(t.path))return!1;let n;try{n=S(t.path,`utf-8`)}catch{return!1}let r=X7(n);return r.has(H7)&&r.has(U7)}function yxe(e,t){let n=q7(e);if(n.kind!==`ok`)return n.result;let r=``;if(g(n.path))try{r=S(n.path,`utf-8`)}catch{return{kind:`no-exclude`,reason:`inaccessible`}}let i=new Set([...J7(V7),H7,U7]),a=r.split(`
1478
+ `);if(u!==a)try{ne(n.path,u,`utf-8`)}catch{return{kind:`no-exclude`,reason:`inaccessible`}}return{kind:`updated`,appended:[],alreadyPresent:[],removed:l}}function _xe(e){let t=q7(e);if(t.kind!==`ok`)return t.result.reason===`no-git`||t.result.reason===`malformed-pointer`||t.result.reason===`inaccessible`?`no-git`:`shared`;if(!g(t.path))return`shared`;let n;try{n=S(t.path,`utf-8`)}catch{return`shared`}let r=X7(n),i=W7(e);for(let e of i)if(Y7(r,e))return`local-only`;return r.has(H7)?`local-only`:`shared`}function vxe(e){let t=q7(e);if(t.kind!==`ok`||!g(t.path))return[];let n;try{n=S(t.path,`utf-8`)}catch{return[]}let r=X7(n);return W7(e).filter(e=>Y7(r,e))}function yxe(e){let t=q7(e);if(t.kind!==`ok`||!g(t.path))return!1;let n;try{n=S(t.path,`utf-8`)}catch{return!1}let r=X7(n);return r.has(H7)&&r.has(U7)}function bxe(e,t){let n=q7(e);if(n.kind!==`ok`)return n.result;let r=``;if(g(n.path))try{r=S(n.path,`utf-8`)}catch{return{kind:`no-exclude`,reason:`inaccessible`}}let i=new Set([...J7(V7),H7,U7]),a=r.split(`
1479
1479
  `).filter(e=>!i.has(e.trim())),o=t?[H7,U7]:[V7],s=a.join(`
1480
1480
  `),c=`${s}${s.length===0||s.endsWith(`
1481
1481
  `)?``:`
1482
1482
  `}${o.join(`
1483
1483
  `)}\n`;try{ne(n.path,c,`utf-8`)}catch{return{kind:`no-exclude`,reason:`inaccessible`}}return{kind:`updated`,appended:o,alreadyPresent:[],removed:[]}}function G7(e,t){let n=[];for(let r of t)if(g(ye(e,r)))try{c(`git`,[`ls-files`,`--error-unmatch`,`--`,r],L3({cwd:e,stdio:[`ignore`,`ignore`,`ignore`]})),n.push(r)}catch{}return{tracked:n}}function K7(e){let t=[];t.push(`Cannot switch OpenKnowledge to local-only — these OK files are tracked upstream:`),t.push(``);for(let n of e)t.push(` ${n}`);t.push(``),t.push(`.git/info/exclude only hides files that git isn't already tracking. To proceed, untrack them first:`),t.push(``);for(let n of e){let e=n.replace(/\/$/,``),r=n.endsWith(`/`)?`-r `:``;t.push(` git rm --cached ${r}${e}`)}return t.push(``),t.push("Then re-run the command. Note: `git rm --cached` removes the files from the index — your teammates will see a deletion on their next pull. If you don't want that, leave sharing mode set to 'shared'."),t.join(`
1484
- `)}function q7(e){let t=OY(e);switch(t.kind){case`repository`:{let e=t.repository.readCommonDir();if(e.kind===`unreadable`)return{kind:`no-exclude`,result:{kind:`no-exclude`,reason:`inaccessible`}};let n=M(e.path,`info`);return g(n)?{kind:`ok`,path:M(n,`exclude`)}:{kind:`no-exclude`,result:{kind:`no-exclude`,reason:`no-info-dir`}}}case`absent`:return{kind:`no-exclude`,result:{kind:`no-exclude`,reason:`no-git`}};case`malformed-pointer`:return{kind:`no-exclude`,result:{kind:`no-exclude`,reason:`malformed-pointer`}};case`inaccessible`:return{kind:`no-exclude`,result:{kind:`no-exclude`,reason:`inaccessible`}}}}function J7(e){let t=e.replace(/\/$/,``);return new Set([e,t,`/${e}`,`/${t}`])}function Y7(e,t){for(let n of J7(t))if(e.has(n))return!0;return!1}function X7(e){let t=new Set;for(let n of e.split(`
1485
- `)){let e=n.trim();e.length!==0&&t.add(e)}return t}function bxe(e,t){return xxe(ve(t,e))}function xxe(e){return be===`/`?e:e.split(be).join(`/`)}function Sxe(e){for(let t of e.split(`
1486
- `)){let e=t.trimStart();if(!(e.length===0||e.length===t.length))return t.charCodeAt(0)===9?{insertSpaces:!1,tabSize:1}:{insertSpaces:!0,tabSize:t.length-e.length}}return{insertSpaces:!0,tabSize:2}}function Z7(e){let t=(e.match(/\r\n/g)??[]).length;return t===0?!1:t>=(e.match(/\n/g)??[]).length-t}function Q7(e){try{return ee(e).mode&511}catch{return}}function Cxe(e,t){let n=e.charCodeAt(0)===65279,r=n?e.slice(1):e,i=r.includes(`\r
1484
+ `)}function q7(e){let t=kY(e);switch(t.kind){case`repository`:{let e=t.repository.readCommonDir();if(e.kind===`unreadable`)return{kind:`no-exclude`,result:{kind:`no-exclude`,reason:`inaccessible`}};let n=M(e.path,`info`);return g(n)?{kind:`ok`,path:M(n,`exclude`)}:{kind:`no-exclude`,result:{kind:`no-exclude`,reason:`no-info-dir`}}}case`absent`:return{kind:`no-exclude`,result:{kind:`no-exclude`,reason:`no-git`}};case`malformed-pointer`:return{kind:`no-exclude`,result:{kind:`no-exclude`,reason:`malformed-pointer`}};case`inaccessible`:return{kind:`no-exclude`,result:{kind:`no-exclude`,reason:`inaccessible`}}}}function J7(e){let t=e.replace(/\/$/,``);return new Set([e,t,`/${e}`,`/${t}`])}function Y7(e,t){for(let n of J7(t))if(e.has(n))return!0;return!1}function X7(e){let t=new Set;for(let n of e.split(`
1485
+ `)){let e=n.trim();e.length!==0&&t.add(e)}return t}function xxe(e,t){return Sxe(ve(t,e))}function Sxe(e){return be===`/`?e:e.split(be).join(`/`)}function Cxe(e){for(let t of e.split(`
1486
+ `)){let e=t.trimStart();if(!(e.length===0||e.length===t.length))return t.charCodeAt(0)===9?{insertSpaces:!1,tabSize:1}:{insertSpaces:!0,tabSize:t.length-e.length}}return{insertSpaces:!0,tabSize:2}}function Z7(e){let t=(e.match(/\r\n/g)??[]).length;return t===0?!1:t>=(e.match(/\n/g)??[]).length-t}function Q7(e){try{return ee(e).mode&511}catch{return}}function wxe(e,t){let n=e.charCodeAt(0)===65279,r=n?e.slice(1):e,i=r.includes(`\r
1487
1487
  `)?`\r
1488
1488
  `:`
1489
- `,a=_6(r,t,void 0,{formattingOptions:{...Sxe(r),eol:i}});if(a.length===0)return{text:e,changed:!1};let o=`${n?``:``}${v6(r,a)}`;return{text:o,changed:o!==e}}const wxe={allowTrailingComma:!0,disallowComments:!1};function Txe(e,t){return e.error===1&&e.offset===0&&t.charCodeAt(0)===65279}function $7(e){let t=[],n=__e(e,t,wxe);return t.some(t=>!Txe(t,e))||!n||n.type!==`object`?null:n}function e9(e,t){let n=0;for(let r of e.children??[]){let e=r.children?.[0];e!==void 0&&g6(e)===t&&(n+=1)}return n}function t9(e,t){u$(e,`${JSON.stringify(t,null,2)}\n`)}function Exe(e,t){let n=Wbe(t);u$(e,n.endsWith(`
1490
- `)?n:`${n}\n`)}function Dxe(e,t){let n=(0,Zt.stringify)(t);u$(e,n.endsWith(`
1491
- `)?n:`${n}\n`)}const n9=10*1024*1024;function r9(e,t){if(e===t)return!0;if(Array.isArray(e)||Array.isArray(t))return!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length?!1:e.every((e,n)=>r9(e,t[n]));if(L7(e)&&L7(t)){let n=Object.keys(e);return n.length===Object.keys(t).length?n.every(n=>Object.hasOwn(t,n)&&r9(e[n],t[n])):!1}return!1}function Oxe(e){for(let t of e.split(`
1492
- `)){let e=t.trimStart();if(!(e.length===0||e.length===t.length))return t.charCodeAt(0)===9?{insertSpaces:!1,tabSize:1}:{insertSpaces:!0,tabSize:t.length-e.length}}return{insertSpaces:!0,tabSize:2}}function i9(e,t,n){return t===void 0?[e,n]:[e,t,n]}function a9(e,t,n,r){let i={[n]:r};return{[e]:t===void 0?i:{[t]:i}}}function o9(e,t,n){let r=e[t];return n===void 0?r:L7(r)?r[n]:void 0}function kxe(e,t,n,r,i){if(!g(e))return t9(e,a9(t,i,n,r)),{kind:`written`};let a;try{a=S(e,`utf-8`)}catch(e){return P7(`json config read failed`,e),{kind:`declined`,reason:`unparseable`}}if(a.trim()===``)return t9(e,a9(t,i,n,r)),{kind:`written`};if(Buffer.byteLength(a,`utf-8`)>n9)return{kind:`declined`,reason:`oversize`};let o=$7(a);if(!o)return{kind:`declined`,reason:`unparseable`};if(e9(o,t)>1)return{kind:`declined`,reason:`duplicate-container`};let s=o9(g6(o),t,i),c=L7(s)?s[n]:void 0,l=c!==void 0;if(l&&r9(c,r))return{kind:`overwritten`};let u=a.charCodeAt(0)===65279,d=u?a.slice(1):a,f=d.includes(`\r
1489
+ `,a=_6(r,t,void 0,{formattingOptions:{...Cxe(r),eol:i}});if(a.length===0)return{text:e,changed:!1};let o=`${n?``:``}${v6(r,a)}`;return{text:o,changed:o!==e}}const Txe={allowTrailingComma:!0,disallowComments:!1};function Exe(e,t){return e.error===1&&e.offset===0&&t.charCodeAt(0)===65279}function $7(e){let t=[],n=v_e(e,t,Txe);return t.some(t=>!Exe(t,e))||!n||n.type!==`object`?null:n}function e9(e,t){let n=0;for(let r of e.children??[]){let e=r.children?.[0];e!==void 0&&g6(e)===t&&(n+=1)}return n}function t9(e,t){u$(e,`${JSON.stringify(t,null,2)}\n`)}function Dxe(e,t){let n=Gbe(t);u$(e,n.endsWith(`
1490
+ `)?n:`${n}\n`)}function Oxe(e,t){let n=(0,Zt.stringify)(t);u$(e,n.endsWith(`
1491
+ `)?n:`${n}\n`)}const n9=10*1024*1024;function r9(e,t){if(e===t)return!0;if(Array.isArray(e)||Array.isArray(t))return!Array.isArray(e)||!Array.isArray(t)||e.length!==t.length?!1:e.every((e,n)=>r9(e,t[n]));if(L7(e)&&L7(t)){let n=Object.keys(e);return n.length===Object.keys(t).length?n.every(n=>Object.hasOwn(t,n)&&r9(e[n],t[n])):!1}return!1}function kxe(e){for(let t of e.split(`
1492
+ `)){let e=t.trimStart();if(!(e.length===0||e.length===t.length))return t.charCodeAt(0)===9?{insertSpaces:!1,tabSize:1}:{insertSpaces:!0,tabSize:t.length-e.length}}return{insertSpaces:!0,tabSize:2}}function i9(e,t,n){return t===void 0?[e,n]:[e,t,n]}function a9(e,t,n,r){let i={[n]:r};return{[e]:t===void 0?i:{[t]:i}}}function o9(e,t,n){let r=e[t];return n===void 0?r:L7(r)?r[n]:void 0}function Axe(e,t,n,r,i){if(!g(e))return t9(e,a9(t,i,n,r)),{kind:`written`};let a;try{a=S(e,`utf-8`)}catch(e){return P7(`json config read failed`,e),{kind:`declined`,reason:`unparseable`}}if(a.trim()===``)return t9(e,a9(t,i,n,r)),{kind:`written`};if(Buffer.byteLength(a,`utf-8`)>n9)return{kind:`declined`,reason:`oversize`};let o=$7(a);if(!o)return{kind:`declined`,reason:`unparseable`};if(e9(o,t)>1)return{kind:`declined`,reason:`duplicate-container`};let s=o9(g6(o),t,i),c=L7(s)?s[n]:void 0,l=c!==void 0;if(l&&r9(c,r))return{kind:`overwritten`};let u=a.charCodeAt(0)===65279,d=u?a.slice(1):a,f=d.includes(`\r
1493
1493
  `)?`\r
1494
1494
  `:`
1495
- `,p=_6(d,i9(t,i,n),r,{formattingOptions:{...Oxe(d),eol:f}}),m=`${u?``:``}${v6(d,p)}`;return m!==a&&u$(e,m,{mode:Q7(e)}),{kind:l?`overwritten`:`written`}}function Axe(e,t,n,r,i){let a=``;if(g(t))try{a=S(t,`utf-8`)}catch(e){return P7(`toml config read failed`,e),{kind:`declined`,reason:`unparseable`}}let o=a.trim()===``;if(e.backend===`fallback`)return o?(Exe(t,{[n]:{[r]:i}}),{kind:`written`}):{kind:`declined`,reason:`no-native-writer`};let s=a.charCodeAt(0)===65279,c=s?a.slice(1):a,l=Z7(c),u=o||c.endsWith(`
1495
+ `,p=_6(d,i9(t,i,n),r,{formattingOptions:{...kxe(d),eol:f}}),m=`${u?``:``}${v6(d,p)}`;return m!==a&&u$(e,m,{mode:Q7(e)}),{kind:l?`overwritten`:`written`}}function jxe(e,t,n,r,i){let a=``;if(g(t))try{a=S(t,`utf-8`)}catch(e){return P7(`toml config read failed`,e),{kind:`declined`,reason:`unparseable`}}let o=a.trim()===``;if(e.backend===`fallback`)return o?(Dxe(t,{[n]:{[r]:i}}),{kind:`written`}):{kind:`declined`,reason:`no-native-writer`};let s=a.charCodeAt(0)===65279,c=s?a.slice(1):a,l=Z7(c),u=o||c.endsWith(`
1496
1496
  `),d;try{d=e.upsertEntry(c,r,i)}catch(e){return P7(`upsertEntry failed`,e),{kind:`declined`,reason:`unparseable`}}let f=d.text;u?f.endsWith(`
1497
1497
  `)||(f=`${f}\n`):f=f.replace(/\n+$/,``),l&&(f=f.replace(/\r\n/g,`
1498
1498
  `).replace(/\n/g,`\r
1499
- `));let p=`${s?``:``}${f}`;return p!==a&&u$(t,p,{mode:Q7(t)}),{kind:d.existed?`overwritten`:`written`}}function jxe(e,t,n,r){let i=``;if(g(e))try{i=S(e,`utf-8`)}catch(e){return P7(`yaml config read failed`,e),{kind:`declined`,reason:`unparseable`}}if(i.trim()===``)return Dxe(e,{[t]:{[n]:r}}),{kind:`written`};if(Buffer.byteLength(i,`utf-8`)>n9)return{kind:`declined`,reason:`oversize`};let a=i.charCodeAt(0)===65279,o=a?i.slice(1):i,s=(0,Zt.parseDocument)(o);if(s.errors.length>0)return{kind:`declined`,reason:`unparseable`};let c=[t,n],l=s.hasIn(c);s.hasIn([t])&&!(0,Zt.isCollection)(s.getIn([t],!0))&&s.deleteIn([t]),s.setIn(c,s.createNode(r));let u=s.toString(),d=Z7(o);o.endsWith(`
1499
+ `));let p=`${s?``:``}${f}`;return p!==a&&u$(t,p,{mode:Q7(t)}),{kind:d.existed?`overwritten`:`written`}}function Mxe(e,t,n,r){let i=``;if(g(e))try{i=S(e,`utf-8`)}catch(e){return P7(`yaml config read failed`,e),{kind:`declined`,reason:`unparseable`}}if(i.trim()===``)return Oxe(e,{[t]:{[n]:r}}),{kind:`written`};if(Buffer.byteLength(i,`utf-8`)>n9)return{kind:`declined`,reason:`oversize`};let a=i.charCodeAt(0)===65279,o=a?i.slice(1):i,s=(0,Zt.parseDocument)(o);if(s.errors.length>0)return{kind:`declined`,reason:`unparseable`};let c=[t,n],l=s.hasIn(c);s.hasIn([t])&&!(0,Zt.isCollection)(s.getIn([t],!0))&&s.deleteIn([t]),s.setIn(c,s.createNode(r));let u=s.toString(),d=Z7(o);o.endsWith(`
1500
1500
  `)?u.endsWith(`
1501
1501
  `)||(u=`${u}\n`):u=u.replace(/\n+$/,``),d&&(u=u.replace(/\r\n/g,`
1502
1502
  `).replace(/\n/g,`\r
1503
- `));let f=`${a?``:``}${u}`;return f!==i&&u$(e,f,{mode:Q7(e)}),{kind:l?`overwritten`:`written`}}const Mxe=`open-knowledge-ui`;function s9(e,t,n){try{return g(e.detectPath?.(t,n)??me(e.configPath(t,n)))}catch{return!1}}function c9(e,t,n,r,i){let a=e.serverName(t),o;try{o=i??e.configPath(t,r)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:``,serverName:a,error:t instanceof Error?t.message:String(t)}}let s=!n.skipAvailabilityCheck||e.offerOnlyWhenDetected===!0;if(!i&&s&&!s9(e,t,r))return{editorId:e.id,label:e.label,action:`skipped-missing`,configPath:o,serverName:a};if(i!==void 0)try{k7(o,t)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t),configScope:`project`}}if(e.format===`file`)return Pxe(e,o,a,n,{isProjectScope:i!==void 0});let c;try{c=e.buildEntry(t,n)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t),...i===void 0?{}:{configScope:`project`}}}try{v(me(o),{recursive:!0})}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t),...i===void 0?{}:{configScope:`project`}}}let l={action:`written`},u;try{d$(`${o}.lock`,()=>{let t=cxe(o).writePath;if(v(me(t),{recursive:!0}),e.format===`toml`){let n=Axe(B7(),t,e.topLevelKey,a,c);l.action=n.kind,n.kind===`declined`&&(l.declineReason=n.reason);return}if(e.format===`yaml`){let n=jxe(t,e.topLevelKey,a,c);l.action=n.kind,n.kind===`declined`&&(l.declineReason=n.reason);return}let n=kxe(t,e.topLevelKey,a,c,e.serverMapSubKey);l.action=n.kind,n.kind===`declined`&&(l.declineReason=n.reason)},{onWarn:(e,t)=>process.stderr.write(`[ok] ${e} ${JSON.stringify(t)}\n`)})}catch(e){u=e instanceof Error?e:Error(String(e))}return u?{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:u.message,...i===void 0?{}:{configScope:`project`}}:l.action===`declined`?{editorId:e.id,label:e.label,action:`declined`,configPath:o,serverName:a,declineReason:l.declineReason,...i===void 0?{}:{configScope:`project`}}:{editorId:e.id,label:e.label,action:l.action,configPath:o,serverName:a,...i===void 0?{}:{configScope:`project`}}}const Nxe={pi:Xbe};function Pxe(e,t,n,r,i){let a=i.isProjectScope?{configScope:`project`}:{},o=r=>({editorId:e.id,label:e.label,action:`failed`,configPath:t,serverName:n,error:r instanceof Error?r.message:String(r),...a}),s=Nxe[e.id];if(!s)return o(Error(`No managed-file builder registered for editor "${e.id}" (format: 'file' targets need a MANAGED_FILE_BUILDERS entry).`));let c;try{c=s(r)}catch(e){return o(e)}try{v(me(t),{recursive:!0})}catch(e){return o(e)}let l={action:`written`};try{d$(`${t}.lock`,()=>{let e=null;try{e=S(t,`utf-8`)}catch{e=null}if(e===c){l.action=`overwritten`;return}u$(t,c,e===null?void 0:{mode:Q7(t)}),l.action=e===null?`written`:`overwritten`},{onWarn:(e,t)=>process.stderr.write(`[ok] ${e} ${JSON.stringify(t)}\n`)})}catch(e){return o(e)}return{editorId:e.id,label:e.label,action:l.action,configPath:t,serverName:n,...a}}async function Fxe(e){let t=fbe(e.editors).filter(e=>e.scope===`global`),n={mode:`published`,skipAvailabilityCheck:!0};return t.map(t=>c9(t,``,n,e.home))}function l9(e,t,n,r){let i=d9(e,t,n,r);return i.kind===`present`?i.entry:null}function u9(e,t,n,r){let i=o9(e,t,r);if(!L7(i))return{kind:`no-entry`};let a=i[n];return L7(a)?{kind:`present`,entry:a}:{kind:`no-entry`}}function d9(e,t,n,r){let i;try{i=r??e.configPath(t,n)}catch{return{kind:`absent`}}if(!g(i))return{kind:`absent`};try{if(ee(i).size>n9)return{kind:`decline`,reason:`oversize`}}catch{return{kind:`decline`,reason:`unparseable`}}let a;try{a=S(i,`utf-8`)}catch{return{kind:`decline`,reason:`unparseable`}}if(a.trim()===``)return{kind:`absent`};if(e.format===`file`)return{kind:`present`,entry:Ybe(a)};let o=e.serverName(t);if(e.format===`toml`){let t;try{t=B7().parseToObject(a)}catch{return{kind:`decline`,reason:`unparseable`}}return u9(t,e.topLevelKey,o,e.serverMapSubKey)}if(e.format===`yaml`){let t=(0,Zt.parseDocument)(a.charCodeAt(0)===65279?a.slice(1):a);return t.errors.length>0?{kind:`decline`,reason:`unparseable`}:u9(t.toJS()??{},e.topLevelKey,o,e.serverMapSubKey)}let s=$7(a);return s?e9(s,e.topLevelKey)>1?{kind:`decline`,reason:`duplicate-container`}:u9(g6(s),e.topLevelKey,o,e.serverMapSubKey):{kind:`decline`,reason:`unparseable`}}function Ixe(e,t){let n=[];for(let r of H5)s9(u7[r],e,t)&&n.push(r);return n}function Lxe(e,t,n){let r=u7[e],i=e===`opencode`?tbe:ebe,a=[],o=r.projectConfigPath?.(t);o!==void 0&&a.push({scope:`project`,configPath:o});try{a.push({scope:`user`,configPath:r.configPath(t,n)})}catch{}for(let o of a){let a=l9(r,t,n,o.configPath);if(a!==null&&i(a))return{editorId:e,scope:o.scope,configPath:o.configPath}}return null}function f9(){return M(se(),`.ok`,`bug-reports`)}function Rxe(e=new Date){let t=e.toISOString().replace(/[:.]/g,`-`),n=f9(),r=`${t}-bugreport`,i=M(n,`${r}.zip`);for(let e=2;g(i);e+=1)i=M(n,`${r}-${e}.zip`);return i}function p9(e,t){let n=M(e,`.ok`,`config.yml`);if(g(n))try{let e=S(n,`utf8`).match(/^\s*name:\s*['"]?(.+?)['"]?\s*$/m);if(e?.[1])return e[1]}catch(e){t?.warn({configPath:n,err:e},`bug-report: failed to read .ok/config.yml for project slug; using path-hash fallback`)}return g(M(e,`.ok`))?je(`sha256`).update(ye(e)).digest(`hex`).slice(0,12):null}function zxe(){let e={timestamp:new Date().toISOString(),platform:O(),osType:k(),osRelease:le(),hostname:`[redacted]`,uptime:A(),freeMem:oe(),totalMem:de(),nodeVersion:process.version,bunVersion:process.versions.bun??null,v8Version:process.versions.v8??null,pid:process.pid};try{e.macosVersion=l(`sw_vers -productVersion 2>/dev/null`,L3({encoding:`utf8`})).trim()}catch{}try{let t=M(__dirname,`..`,`..`,`package.json`);g(t)&&(e.okVersion=JSON.parse(S(t,`utf8`)).version)}catch{}return e}const Bxe=[{prefix:`cli`,projectTagged:!0},{prefix:`desktop`,projectTagged:!1},{prefix:`mcp`,projectTagged:!1}];function m9(e){let t=pe(e);return Bxe.some(e=>e.projectTagged&&t.startsWith(`${e.prefix}.`))}function Vxe(e,t){return g9(e,t).files}const Hxe=[`ShipIt_stderr.log`,`ShipIt_stdout.log`];function h9(e,t=`com.inkeep.open-knowledge`){let n=M(e,`${t}.ShipIt`);return g(n)?Hxe.map(e=>M(n,e)).filter(e=>g(e)):[]}function g9(e,t){if(!g(t))return{files:[],excludedByProjectSlug:0};let n=C(t).filter(e=>e.endsWith(`.log`)||/\.log\.\d+$/.test(e)).map(e=>M(t,e));if(!e)return{files:n,excludedByProjectSlug:0};let r=n.filter(m9),i=[],a=r.filter(t=>{try{return S(t,`utf8`).includes(`"project":"${e}"`)}catch{return i.push(t),!1}});if(a.length===0)return{files:n,excludedByProjectSlug:0};let o=new Set([...a,...i]);return{files:n.filter(e=>!m9(e)||o.has(e)),excludedByProjectSlug:r.length-o.size}}function Uxe(e){let t=M(e,`.ok`,`local`);return g(t)?{files:[`server.lock`,`last-spawn-error.log`,sY].map(e=>M(t,e)).filter(e=>g(e))}:{files:[]}}function Wxe(e){let t=M(e,`.ok`,`local`,`logs`);return g(t)?{files:[`server-current.jsonl`,`server-prev.jsonl`].map(e=>M(t,e)).filter(e=>g(e))}:{files:[]}}function _9(e){if(e.redact){let{redacted:t,patterns:n,lineCount:r}=zo(e.content);e.zipfile.addBuffer(Buffer.from(t,`utf8`),e.name),e.bundleFiles.push(e.name),n.length>0&&e.redactions.push({file:e.name,lineCount:r,patterns:n})}else e.zipfile.addBuffer(Buffer.from(e.content,`utf8`),e.name),e.bundleFiles.push(e.name)}function v9(e){for(let t of e.files)try{_9({zipfile:e.zipfile,name:`${e.prefix}/${pe(t)}`,content:S(t,`utf8`),redact:e.redact,bundleFiles:e.bundleFiles,redactions:e.redactions})}catch(n){e.logger?.warn({file:t,prefix:e.prefix,err:n},`bug-report: skipped unreadable file`)}}async function Gxe(t){let{redact:n,outputPath:r,logger:i}=t,a=t.userLogsDir??M(se(),`.ok`,`logs`),o=t.projectDir?p9(t.projectDir,i):null;v(me(r),{recursive:!0}),i?.info({projectSlug:o},`gathering diagnostic data`);let s=zxe();s.desktop=t.desktop??null;let{files:c,excludedByProjectSlug:l}=g9(o,a),{files:u}=t.projectDir?Uxe(t.projectDir):{files:[]},{files:d}=t.projectDir?Wxe(t.projectDir):{files:[]},f=t.shipItLogFiles??[];i?.info({logFileCount:c.length,logFilesExcludedByProjectSlug:l,lockFileCount:u.length,localSinkFileCount:d.length,shipItLogFileCount:f.length},`files collected`);let p=[],m=[],{ZipFile:g}=await import(`./yazl-BlMyAOcT.mjs`).then(t=>e(t.t(),1)),_=new g;v9({zipfile:_,files:[...c,...f],prefix:`logs`,redact:n,bundleFiles:m,redactions:p,logger:i}),v9({zipfile:_,files:u,prefix:`lockdir`,redact:n,bundleFiles:m,redactions:p,logger:i}),v9({zipfile:_,files:d,prefix:`local-logs`,redact:n,bundleFiles:m,redactions:p,logger:i});for(let e of t.extraFiles??[])try{let t=S(e.sourcePath),n=`extra/${e.zipName??pe(e.sourcePath)}`;_.addBuffer(t,n),m.push(n)}catch(t){i?.warn({sourcePath:e.sourcePath,err:t},`extra file unreadable; omitted from bundle`)}t.note&&_9({zipfile:_,name:`note.txt`,content:t.note,redact:n,bundleFiles:m,redactions:p});let y=JSON.stringify(s,null,2);_.addBuffer(Buffer.from(y,`utf8`),`sysinfo.json`),m.push(`sysinfo.json`);let b={generatedAt:new Date().toISOString(),disciplineVersion:`1.0.0`,projectSlug:o,files:m,redactions:p,sysinfo:s};_.addBuffer(Buffer.from(JSON.stringify(b,null,2),`utf8`),`MANIFEST.json`);let x=p.reduce((e,t)=>e+t.lineCount,0),C=new Set(f.map(e=>`logs/${pe(e)}`)),w=m.filter(e=>C.has(e)),T=o?m.filter(e=>e.startsWith(`logs/`)&&!m9(e)&&!C.has(e)):[],E=[`# Bug Report Bundle`,``,`Generated: ${b.generatedAt}`,`Project: ${o??`(unscoped)`}`,`Discipline version: ${b.disciplineVersion}`,``,`## Contents`,``,...m.map(e=>`- ${e}`),``,`## Privacy`,``,...T.length>0?[`Scope: some collected logs are user-wide rather than project-scoped.`,`These are written once per machine per day and can contain activity`,`from other projects open on this machine, including captured console`,`output:`,...T.map(e=>`- ${e}`),``]:[],...w.length>0?[`Installer logs: written by the macOS update helper rather than by`,`OpenKnowledge itself, and machine-wide rather than scoped to any one`,`project. They record the install and update history of this app on`,`this machine. Only this app is collected, never other applications`,`that use the same update mechanism:`,...w.map(e=>`- ${e}`),``]:[],...n?[`This bundle was auto-redacted before packaging.`,`Patterns checked: ${One.join(`, `)}`,x>0?`${x} line(s) were scrubbed across ${p.length} file(s).`:`No redactions were needed.`,`See MANIFEST.json for the full redaction audit report.`,``,`This bundle is safe to attach to a GitHub issue.`]:[`Redaction was disabled for this bundle; file contents are unmodified.`]].join(`
1504
- `);_.addBuffer(Buffer.from(E,`utf8`),`README.md`),_.end();let D=h(r);return _.outputStream.pipe(D),await new Promise((e,t)=>{D.on(`close`,e),D.on(`error`,t)}),i?.info({bundlePath:r,fileCount:m.length,redactionCount:x},`bundle written`),{zipPath:r,summary:{projectSlug:o,files:m,redactions:p,redactedLineCount:x,generatedAt:b.generatedAt}}}function Kxe(e){return Z5(e)||e7(e)||Jbe(e)}const y9=10*1024*1024;function qxe(e,t,n,r){let i=d9(e,t,n,r);if(i.kind===`absent`||i.kind===`no-entry`)return{kind:`not-present`};if(i.kind===`decline`)return{kind:`declined`,reason:i.reason};if(!Kxe(i.entry))return{kind:`left-foreign`};let a;try{a=r??e.configPath(t,n)}catch{return{kind:`not-present`}}let o=e.serverName(t);return e.format===`file`?(D(a,{force:!0}),{kind:`removed`}):e.format===`toml`?Xxe(a,o):e.format===`yaml`?Yxe(a,e.topLevelKey,o):Jxe(a,e.topLevelKey,e.serverMapSubKey,o)}function Jxe(e,t,n,r){let i;try{i=S(e,`utf-8`)}catch{return{kind:`declined`,reason:`unparseable`}}if(Buffer.byteLength(i,`utf-8`)>y9)return{kind:`declined`,reason:`oversize`};let{text:a,changed:o}=Cxe(i,i9(t,n,r));return o?(u$(e,a,{mode:Q7(e)}),{kind:`removed`}):{kind:`not-present`}}function Yxe(e,t,n){let r;try{r=S(e,`utf-8`)}catch{return{kind:`declined`,reason:`unparseable`}}if(Buffer.byteLength(r,`utf-8`)>y9)return{kind:`declined`,reason:`oversize`};let i=r.charCodeAt(0)===65279,a=i?r.slice(1):r,o=(0,Zt.parseDocument)(a);if(o.errors.length>0)return{kind:`declined`,reason:`unparseable`};let s=[t,n];if(!o.hasIn(s))return{kind:`not-present`};o.deleteIn(s);let c=o.toString(),l=Z7(a);a.trim()===``||a.endsWith(`
1503
+ `));let f=`${a?``:``}${u}`;return f!==i&&u$(e,f,{mode:Q7(e)}),{kind:l?`overwritten`:`written`}}const Nxe=`open-knowledge-ui`;function s9(e,t,n){try{return g(e.detectPath?.(t,n)??me(e.configPath(t,n)))}catch{return!1}}function c9(e,t,n,r,i){let a=e.serverName(t),o;try{o=i??e.configPath(t,r)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:``,serverName:a,error:t instanceof Error?t.message:String(t)}}let s=!n.skipAvailabilityCheck||e.offerOnlyWhenDetected===!0;if(!i&&s&&!s9(e,t,r))return{editorId:e.id,label:e.label,action:`skipped-missing`,configPath:o,serverName:a};if(i!==void 0)try{k7(o,t)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t),configScope:`project`}}if(e.format===`file`)return Fxe(e,o,a,n,{isProjectScope:i!==void 0});let c;try{c=e.buildEntry(t,n)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t),...i===void 0?{}:{configScope:`project`}}}try{v(me(o),{recursive:!0})}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t),...i===void 0?{}:{configScope:`project`}}}let l={action:`written`},u;try{d$(`${o}.lock`,()=>{let t=lxe(o).writePath;if(v(me(t),{recursive:!0}),e.format===`toml`){let n=jxe(B7(),t,e.topLevelKey,a,c);l.action=n.kind,n.kind===`declined`&&(l.declineReason=n.reason);return}if(e.format===`yaml`){let n=Mxe(t,e.topLevelKey,a,c);l.action=n.kind,n.kind===`declined`&&(l.declineReason=n.reason);return}let n=Axe(t,e.topLevelKey,a,c,e.serverMapSubKey);l.action=n.kind,n.kind===`declined`&&(l.declineReason=n.reason)},{onWarn:(e,t)=>process.stderr.write(`[ok] ${e} ${JSON.stringify(t)}\n`)})}catch(e){u=e instanceof Error?e:Error(String(e))}return u?{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:u.message,...i===void 0?{}:{configScope:`project`}}:l.action===`declined`?{editorId:e.id,label:e.label,action:`declined`,configPath:o,serverName:a,declineReason:l.declineReason,...i===void 0?{}:{configScope:`project`}}:{editorId:e.id,label:e.label,action:l.action,configPath:o,serverName:a,...i===void 0?{}:{configScope:`project`}}}const Pxe={pi:Zbe};function Fxe(e,t,n,r,i){let a=i.isProjectScope?{configScope:`project`}:{},o=r=>({editorId:e.id,label:e.label,action:`failed`,configPath:t,serverName:n,error:r instanceof Error?r.message:String(r),...a}),s=Pxe[e.id];if(!s)return o(Error(`No managed-file builder registered for editor "${e.id}" (format: 'file' targets need a MANAGED_FILE_BUILDERS entry).`));let c;try{c=s(r)}catch(e){return o(e)}try{v(me(t),{recursive:!0})}catch(e){return o(e)}let l={action:`written`};try{d$(`${t}.lock`,()=>{let e=null;try{e=S(t,`utf-8`)}catch{e=null}if(e===c){l.action=`overwritten`;return}u$(t,c,e===null?void 0:{mode:Q7(t)}),l.action=e===null?`written`:`overwritten`},{onWarn:(e,t)=>process.stderr.write(`[ok] ${e} ${JSON.stringify(t)}\n`)})}catch(e){return o(e)}return{editorId:e.id,label:e.label,action:l.action,configPath:t,serverName:n,...a}}async function Ixe(e){let t=pbe(e.editors).filter(e=>e.scope===`global`),n={mode:`published`,skipAvailabilityCheck:!0};return t.map(t=>c9(t,``,n,e.home))}function l9(e,t,n,r){let i=d9(e,t,n,r);return i.kind===`present`?i.entry:null}function u9(e,t,n,r){let i=o9(e,t,r);if(!L7(i))return{kind:`no-entry`};let a=i[n];return L7(a)?{kind:`present`,entry:a}:{kind:`no-entry`}}function d9(e,t,n,r){let i;try{i=r??e.configPath(t,n)}catch{return{kind:`absent`}}if(!g(i))return{kind:`absent`};try{if(ee(i).size>n9)return{kind:`decline`,reason:`oversize`}}catch{return{kind:`decline`,reason:`unparseable`}}let a;try{a=S(i,`utf-8`)}catch{return{kind:`decline`,reason:`unparseable`}}if(a.trim()===``)return{kind:`absent`};if(e.format===`file`)return{kind:`present`,entry:Xbe(a)};let o=e.serverName(t);if(e.format===`toml`){let t;try{t=B7().parseToObject(a)}catch{return{kind:`decline`,reason:`unparseable`}}return u9(t,e.topLevelKey,o,e.serverMapSubKey)}if(e.format===`yaml`){let t=(0,Zt.parseDocument)(a.charCodeAt(0)===65279?a.slice(1):a);return t.errors.length>0?{kind:`decline`,reason:`unparseable`}:u9(t.toJS()??{},e.topLevelKey,o,e.serverMapSubKey)}let s=$7(a);return s?e9(s,e.topLevelKey)>1?{kind:`decline`,reason:`duplicate-container`}:u9(g6(s),e.topLevelKey,o,e.serverMapSubKey):{kind:`decline`,reason:`unparseable`}}function Lxe(e,t){let n=[];for(let r of H5)s9(u7[r],e,t)&&n.push(r);return n}function Rxe(e,t,n){let r=u7[e],i=e===`opencode`?nbe:tbe,a=[],o=r.projectConfigPath?.(t);o!==void 0&&a.push({scope:`project`,configPath:o});try{a.push({scope:`user`,configPath:r.configPath(t,n)})}catch{}for(let o of a){let a=l9(r,t,n,o.configPath);if(a!==null&&i(a))return{editorId:e,scope:o.scope,configPath:o.configPath}}return null}function f9(){return M(se(),`.ok`,`bug-reports`)}function zxe(e=new Date){let t=e.toISOString().replace(/[:.]/g,`-`),n=f9(),r=`${t}-bugreport`,i=M(n,`${r}.zip`);for(let e=2;g(i);e+=1)i=M(n,`${r}-${e}.zip`);return i}function p9(e,t){let n=M(e,`.ok`,`config.yml`);if(g(n))try{let e=S(n,`utf8`).match(/^\s*name:\s*['"]?(.+?)['"]?\s*$/m);if(e?.[1])return e[1]}catch(e){t?.warn({configPath:n,err:e},`bug-report: failed to read .ok/config.yml for project slug; using path-hash fallback`)}return g(M(e,`.ok`))?je(`sha256`).update(ye(e)).digest(`hex`).slice(0,12):null}function Bxe(){let e={timestamp:new Date().toISOString(),platform:O(),osType:k(),osRelease:le(),hostname:`[redacted]`,uptime:A(),freeMem:oe(),totalMem:de(),nodeVersion:process.version,bunVersion:process.versions.bun??null,v8Version:process.versions.v8??null,pid:process.pid};try{e.macosVersion=l(`sw_vers -productVersion 2>/dev/null`,L3({encoding:`utf8`})).trim()}catch{}try{let t=M(__dirname,`..`,`..`,`package.json`);g(t)&&(e.okVersion=JSON.parse(S(t,`utf8`)).version)}catch{}return e}const Vxe=[{prefix:`cli`,projectTagged:!0},{prefix:`desktop`,projectTagged:!1},{prefix:`mcp`,projectTagged:!1}];function m9(e){let t=pe(e);return Vxe.some(e=>e.projectTagged&&t.startsWith(`${e.prefix}.`))}function Hxe(e,t){return g9(e,t).files}const Uxe=[`ShipIt_stderr.log`,`ShipIt_stdout.log`];function h9(e,t=`com.inkeep.open-knowledge`){let n=M(e,`${t}.ShipIt`);return g(n)?Uxe.map(e=>M(n,e)).filter(e=>g(e)):[]}function g9(e,t){if(!g(t))return{files:[],excludedByProjectSlug:0};let n=C(t).filter(e=>e.endsWith(`.log`)||/\.log\.\d+$/.test(e)).map(e=>M(t,e));if(!e)return{files:n,excludedByProjectSlug:0};let r=n.filter(m9),i=[],a=r.filter(t=>{try{return S(t,`utf8`).includes(`"project":"${e}"`)}catch{return i.push(t),!1}});if(a.length===0)return{files:n,excludedByProjectSlug:0};let o=new Set([...a,...i]);return{files:n.filter(e=>!m9(e)||o.has(e)),excludedByProjectSlug:r.length-o.size}}function Wxe(e){let t=M(e,`.ok`,`local`);return g(t)?{files:[`server.lock`,`last-spawn-error.log`,sY].map(e=>M(t,e)).filter(e=>g(e))}:{files:[]}}function Gxe(e){let t=M(e,`.ok`,`local`,`logs`);return g(t)?{files:[`server-current.jsonl`,`server-prev.jsonl`].map(e=>M(t,e)).filter(e=>g(e))}:{files:[]}}function _9(e){if(e.redact){let{redacted:t,patterns:n,lineCount:r}=zo(e.content);e.zipfile.addBuffer(Buffer.from(t,`utf8`),e.name),e.bundleFiles.push(e.name),n.length>0&&e.redactions.push({file:e.name,lineCount:r,patterns:n})}else e.zipfile.addBuffer(Buffer.from(e.content,`utf8`),e.name),e.bundleFiles.push(e.name)}function v9(e){for(let t of e.files)try{_9({zipfile:e.zipfile,name:`${e.prefix}/${pe(t)}`,content:S(t,`utf8`),redact:e.redact,bundleFiles:e.bundleFiles,redactions:e.redactions})}catch(n){e.logger?.warn({file:t,prefix:e.prefix,err:n},`bug-report: skipped unreadable file`)}}async function Kxe(t){let{redact:n,outputPath:r,logger:i}=t,a=t.userLogsDir??M(se(),`.ok`,`logs`),o=t.projectDir?p9(t.projectDir,i):null;v(me(r),{recursive:!0}),i?.info({projectSlug:o},`gathering diagnostic data`);let s=Bxe();s.desktop=t.desktop??null;let{files:c,excludedByProjectSlug:l}=g9(o,a),{files:u}=t.projectDir?Wxe(t.projectDir):{files:[]},{files:d}=t.projectDir?Gxe(t.projectDir):{files:[]},f=t.shipItLogFiles??[];i?.info({logFileCount:c.length,logFilesExcludedByProjectSlug:l,lockFileCount:u.length,localSinkFileCount:d.length,shipItLogFileCount:f.length},`files collected`);let p=[],m=[],{ZipFile:g}=await import(`./yazl-BlMyAOcT.mjs`).then(t=>e(t.t(),1)),_=new g;v9({zipfile:_,files:[...c,...f],prefix:`logs`,redact:n,bundleFiles:m,redactions:p,logger:i}),v9({zipfile:_,files:u,prefix:`lockdir`,redact:n,bundleFiles:m,redactions:p,logger:i}),v9({zipfile:_,files:d,prefix:`local-logs`,redact:n,bundleFiles:m,redactions:p,logger:i});for(let e of t.extraFiles??[])try{let t=S(e.sourcePath),n=`extra/${e.zipName??pe(e.sourcePath)}`;_.addBuffer(t,n),m.push(n)}catch(t){i?.warn({sourcePath:e.sourcePath,err:t},`extra file unreadable; omitted from bundle`)}t.note&&_9({zipfile:_,name:`note.txt`,content:t.note,redact:n,bundleFiles:m,redactions:p});let y=JSON.stringify(s,null,2);_.addBuffer(Buffer.from(y,`utf8`),`sysinfo.json`),m.push(`sysinfo.json`);let b={generatedAt:new Date().toISOString(),disciplineVersion:`1.0.0`,projectSlug:o,files:m,redactions:p,sysinfo:s};_.addBuffer(Buffer.from(JSON.stringify(b,null,2),`utf8`),`MANIFEST.json`);let x=p.reduce((e,t)=>e+t.lineCount,0),C=new Set(f.map(e=>`logs/${pe(e)}`)),w=m.filter(e=>C.has(e)),T=o?m.filter(e=>e.startsWith(`logs/`)&&!m9(e)&&!C.has(e)):[],E=[`# Bug Report Bundle`,``,`Generated: ${b.generatedAt}`,`Project: ${o??`(unscoped)`}`,`Discipline version: ${b.disciplineVersion}`,``,`## Contents`,``,...m.map(e=>`- ${e}`),``,`## Privacy`,``,...T.length>0?[`Scope: some collected logs are user-wide rather than project-scoped.`,`These are written once per machine per day and can contain activity`,`from other projects open on this machine, including captured console`,`output:`,...T.map(e=>`- ${e}`),``]:[],...w.length>0?[`Installer logs: written by the macOS update helper rather than by`,`OpenKnowledge itself, and machine-wide rather than scoped to any one`,`project. They record the install and update history of this app on`,`this machine. Only this app is collected, never other applications`,`that use the same update mechanism:`,...w.map(e=>`- ${e}`),``]:[],...n?[`This bundle was auto-redacted before packaging.`,`Patterns checked: ${One.join(`, `)}`,x>0?`${x} line(s) were scrubbed across ${p.length} file(s).`:`No redactions were needed.`,`See MANIFEST.json for the full redaction audit report.`,``,`This bundle is safe to attach to a GitHub issue.`]:[`Redaction was disabled for this bundle; file contents are unmodified.`]].join(`
1504
+ `);_.addBuffer(Buffer.from(E,`utf8`),`README.md`),_.end();let D=h(r);return _.outputStream.pipe(D),await new Promise((e,t)=>{D.on(`close`,e),D.on(`error`,t)}),i?.info({bundlePath:r,fileCount:m.length,redactionCount:x},`bundle written`),{zipPath:r,summary:{projectSlug:o,files:m,redactions:p,redactedLineCount:x,generatedAt:b.generatedAt}}}function qxe(e){return Z5(e)||e7(e)||Ybe(e)}const y9=10*1024*1024;function Jxe(e,t,n,r){let i=d9(e,t,n,r);if(i.kind===`absent`||i.kind===`no-entry`)return{kind:`not-present`};if(i.kind===`decline`)return{kind:`declined`,reason:i.reason};if(!qxe(i.entry))return{kind:`left-foreign`};let a;try{a=r??e.configPath(t,n)}catch{return{kind:`not-present`}}let o=e.serverName(t);return e.format===`file`?(D(a,{force:!0}),{kind:`removed`}):e.format===`toml`?Zxe(a,o):e.format===`yaml`?Xxe(a,e.topLevelKey,o):Yxe(a,e.topLevelKey,e.serverMapSubKey,o)}function Yxe(e,t,n,r){let i;try{i=S(e,`utf-8`)}catch{return{kind:`declined`,reason:`unparseable`}}if(Buffer.byteLength(i,`utf-8`)>y9)return{kind:`declined`,reason:`oversize`};let{text:a,changed:o}=wxe(i,i9(t,n,r));return o?(u$(e,a,{mode:Q7(e)}),{kind:`removed`}):{kind:`not-present`}}function Xxe(e,t,n){let r;try{r=S(e,`utf-8`)}catch{return{kind:`declined`,reason:`unparseable`}}if(Buffer.byteLength(r,`utf-8`)>y9)return{kind:`declined`,reason:`oversize`};let i=r.charCodeAt(0)===65279,a=i?r.slice(1):r,o=(0,Zt.parseDocument)(a);if(o.errors.length>0)return{kind:`declined`,reason:`unparseable`};let s=[t,n];if(!o.hasIn(s))return{kind:`not-present`};o.deleteIn(s);let c=o.toString(),l=Z7(a);a.trim()===``||a.endsWith(`
1505
1505
  `)?c.endsWith(`
1506
1506
  `)||(c=`${c}\n`):c=c.replace(/\n+$/,``),l&&(c=c.replace(/\r\n/g,`
1507
1507
  `).replace(/\n/g,`\r
1508
- `));let u=`${i?``:``}${c}`;return u!==r&&u$(e,u,{mode:Q7(e)}),{kind:`removed`}}function Xxe(e,t){let n=B7();if(n.backend===`fallback`)return{kind:`declined`,reason:`no-native-writer`};let r;try{r=S(e,`utf-8`)}catch{return{kind:`declined`,reason:`unparseable`}}let i=r.charCodeAt(0)===65279,a=i?r.slice(1):r,o=Z7(a),s=a.trim()===``||a.endsWith(`
1508
+ `));let u=`${i?``:``}${c}`;return u!==r&&u$(e,u,{mode:Q7(e)}),{kind:`removed`}}function Zxe(e,t){let n=B7();if(n.backend===`fallback`)return{kind:`declined`,reason:`no-native-writer`};let r;try{r=S(e,`utf-8`)}catch{return{kind:`declined`,reason:`unparseable`}}let i=r.charCodeAt(0)===65279,a=i?r.slice(1):r,o=Z7(a),s=a.trim()===``||a.endsWith(`
1509
1509
  `),c;try{c=n.removeEntry(a,t)}catch{return{kind:`declined`,reason:`unparseable`}}if(!c.existed)return{kind:`not-present`};let l=c.text;s?l.endsWith(`
1510
1510
  `)||(l=`${l}\n`):l=l.replace(/\n+$/,``),o&&(l=l.replace(/\r\n/g,`
1511
1511
  `).replace(/\n/g,`\r
1512
- `));let u=`${i?``:``}${l}`;return u!==r&&u$(e,u,{mode:Q7(e)}),{kind:`removed`}}function Zxe(e){return{event:`mcp-config-decline`,scope:e.scope,surface:e.surface,editorId:e.editorId,reason:e.reason}}function Qxe(e){let{priorCommand:t,priorArgs:n}=b9(e.priorEntry);return{event:`mcp-config-migrate`,scope:e.scope,surface:e.surface,editorId:e.editorId,configPath:e.configPath,priorCommand:t,priorArgs:n}}function b9(e){return{priorCommand:typeof e.command==`string`?e.command.slice(0,200):null,priorArgs:Array.isArray(e.args)?e.args.slice(0,10).map(e=>typeof e==`string`?e.slice(0,200):e):null}}function $xe(e,t,n={}){let r=C_e(e,t);if(!g(r))return{status:`missing`,lockPath:r};let i;try{i=JSON.parse(S(r,`utf-8`))}catch{return{status:`corrupt`,lockPath:r}}if(!i||typeof i!=`object`||!xge(i.pid))return{status:`corrupt`,lockPath:r};let a=i;if(!(n.isAlive??T3)(a.pid))return{status:`dead-pid`,lockPath:r,lock:a};if(typeof a.machineId==`string`)return a.machineId===(n.machineId??x_e())?{status:`alive`,lockPath:r,lock:a}:{status:`foreign-host`,lockPath:r,lock:a};let o=n.host??ce();return a.hostname===o?{status:`alive`,lockPath:r,lock:a}:{status:`foreign-host`,lockPath:r,lock:a}}function eSe(e,t,n={}){let r=n.isAlive??T3,i=[];for(let[n,a]of[[`server`,e],[`ui`,t]])(a.status===`alive`||a.status===`foreign-host`&&r(a.lock.pid))&&i.push({name:n,pid:a.lock.pid,port:a.lock.port});return{targets:i}}function tSe(e){let t=e.inspect??(t=>$xe(e.lockDir,t)),n=e.kill??((e,t)=>process.kill(e,t)),r=e.log??(e=>console.log(e)),i=e.error??(e=>console.error(e)),a=eSe(t(`server`),t(`ui`),{isAlive:e.isAlive});if(a.targets.length===0)return r(`No running open-knowledge processes.`),{stopped:[],failed:[],hadTargets:!1};let o=[],s=[];for(let e of a.targets)try{n(e.pid,`SIGTERM`),o.push(e)}catch(t){s.push({target:e,error:t instanceof Error?t.message:String(t)})}return o.length>0&&r(`Stopped: ${o.map(e=>`${e.name} (pid=${e.pid}, port=${e.port})`).join(`, `)}`),s.length>0&&i(`Failed to stop: ${s.map(({target:e,error:t})=>`${e.name} (pid=${e.pid}): ${t}`).join(`; `)}`),{stopped:o,failed:s,hadTargets:!0}}function x9(e,t){let n={...e};for(let r of Object.keys(t)){let i=e[r],a=t[r];L7(a)&&L7(i)?n[r]=x9(i,a):a!==void 0&&(n[r]=a)}return n}function nSe(e){if(!g(e))return{value:null,path:e,source:null,doc:null};let t;try{t=S(e,`utf-8`)}catch(t){let n=t instanceof Error?t.message:String(t);return console.warn(`[config] Failed to read ${e}: ${n}`),{value:null,path:e,source:null,doc:null,diagnostic:{code:`UNREADABLE`,detail:`${e}: ${n}`}}}let n=(0,Zt.parseDocument)(t);if(n.errors.length>0){let r=n.errors.map(e=>e.message).join(`; `);return console.warn(`[config] Failed to parse ${e}: ${r}`),{value:null,path:e,source:t,doc:null,diagnostic:{code:`YAML_PARSE`,detail:`${e}: ${r}`}}}let r=n.toJSON();return L7(r)?{value:r,path:e,source:t,doc:n}:{value:null,path:e,source:t,doc:n}}function rSe(e,t){return e.map(e=>{let n=e.path.map(e=>typeof e==`symbol`?String(e):e),r={path:n,message:e.message,issueCode:e.code};if(t.doc!==null&&t.source!==null){let e=sl({file:t.path,source:t.source,doc:t.doc,path:n});if(e!==void 0)return{...r,source:e}}return r})}function iSe(e){let t=e??process.cwd(),n=[],r=[],i=[],a=p$(`user`,t),o=Nfe({absPath:a});r.push(...o.diagnostics),!o.valid&&o.sidelinedTo!==void 0&&i.push({from:a,to:o.sidelinedTo});let s={};o.valid&&o.source!==void 0?(s=x9(s,o.value),n.push(a)):o.valid;let c=ye(t,`.ok`,`config.yml`),l=nSe(c);if(l.diagnostic!==void 0&&r.push(l.diagnostic),l.value!==null){let e=fl({value:l.value,file:l.path,source:l.source,doc:l.doc});r.push(...e);let t=e.length>0?ml(l.value):l.value;s=x9(s,t),n.push(c)}let u=Zye.safeParse(s);if(!u.success){let e={code:`SCHEMA_INVALID`,issues:rSe(u.error.issues,l)};throw Error(rl(e))}return{config:u.data,sources:n,diagnostics:r,sidelined:i}}function S9(e){return e.replace(/:\d+$/,``)}function C9(e){let t=e.trim();if(!t)return null;{let e=/^https?:\/\/([^/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`https`,hostname:S9(e[1]),owner:e[2],name:e[3]}}{let e=/^ssh:\/\/(?:[\w.-]+@)?([^/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`ssh`,hostname:S9(e[1]),owner:e[2],name:e[3]}}{let e=/^git:\/\/([^/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`git`,hostname:S9(e[1]),owner:e[2],name:e[3]}}{let e=/^(?:[\w.-]+@)?([\w.-]+):([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?$/.exec(t);if(e?.[1].includes(`.`)||e&&t.startsWith(`git@`))return{protocol:`ssh`,hostname:e[1],owner:e[2],name:e[3]}}{let e=/^git:([\w.-]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`git`,hostname:e[1],owner:e[2],name:e[3]}}if(!t.includes(`://`)&&!t.includes(`@`)&&!t.startsWith(`/`)){let e=/^([\w.-]+)\/([\w.\-~%]+?)(?:\.git)?$/.exec(t);if(e)return{protocol:`https`,hostname:`github.com`,owner:e[1],name:e[2]}}return null}function w9(e){let t;try{t=new URL(e)}catch{return null}if(t.protocol!==`https:`)return null;let n=kl(t.hostname);if(n===null)return null;let r=t.pathname.split(`/`).filter(e=>e.length>0);if(r.length<5||r[2]!==`blob`)return null;let i,a,o,s;try{i=decodeURIComponent(r[0]),a=decodeURIComponent(r[1]),o=decodeURIComponent(r[3]),s=r.slice(4).map(e=>decodeURIComponent(e))}catch{return null}return!i||!a||!o||s.length===0||s.some(e=>e.length===0)?null:{host:n,owner:i,repo:a,branch:o,path:s.join(`/`)}}function T9(e){let t;try{t=new URL(e)}catch{return null}if(t.protocol!==`https:`)return null;let n=kl(t.hostname);if(n===null)return null;let r=t.pathname.split(`/`);if(r.length<5||r[0]!==``||r[3]!==`tree`)return null;let i=r.slice(5);i.length===1&&i[0]===``&&i.pop();let a,o,s,c;try{a=decodeURIComponent(r[1]),o=decodeURIComponent(r[2]),s=decodeURIComponent(r[4]),c=i.map(e=>decodeURIComponent(e))}catch{return null}return!a||!o||!s||c.some(e=>e.length===0)?null:{host:n,owner:a,repo:o,branch:s,path:c.join(`/`)}}function aSe(e){let t=w9(e);if(t)return{kind:`doc`,...t};let n=T9(e);return n?{kind:`folder`,...n}:null}async function oSe(e,t){let n,r;try{n=await Ee(ye(e)),r=await Ee(ye(me(e)))}catch{return{kind:`not-git`}}if(!E9(n,r))return{kind:`symlink-escape`};let i=M(n,`.git`),a;try{a=ee(i)}catch{return{kind:`not-git`}}if(a.isDirectory()){let e;try{e=await Ee(i)}catch{return{kind:`not-git`}}if(!E9(e,n))return{kind:`symlink-escape`}}else if(!a.isFile())return{kind:`not-git`};let o=DY(n);if(o.kind!==`repository`)return{kind:`not-git`};let s=o.repository.readRemoteUrl(`origin`);if(s.kind===`unreadable`)return{kind:`not-git`};if(s.kind===`absent`)return s.reason===`config-missing`?{kind:`not-git`}:{kind:`no-origin`};let c=s.url,l=C9(c);if(l===null)return{kind:`non-github`};let u=kl(l.hostname);if(u===null)return{kind:`non-github`};let d=u===t.host.toLowerCase(),f=l.owner.toLowerCase()===t.owner.toLowerCase(),p=l.name.toLowerCase()===t.repo.toLowerCase();return!d&&f&&p?{kind:`wrong-host`,actualHost:u}:!d||!f||!p?{kind:`wrong-repo`,actualOwner:l.owner,actualRepo:l.name}:{kind:`ok`,gitRemoteUrl:`https://${u}/${l.owner}/${l.name}.git`}}function E9(e,t){if(e===t)return!0;let n=ve(t,e);return n.length>0&&!n.startsWith(`..`)&&!j(n)}const sSe=`# >>> open-knowledge cli >>>`,cSe=`# <<< open-knowledge cli <<<`,lSe=/^# >>> open-knowledge cli >>>\n[\s\S]*?^# <<< open-knowledge cli <<<\n?/m;function uSe(e){return M(e,`Library`,`Application Support`,`OpenKnowledge`,`path-install.json`)}[...x6.map(e=>b6[e])];function dSe(e){if(!j(e))throw Error(`skill cleanup requires an absolute home directory; got ${JSON.stringify(e)}`);let t=ye(e);if(t===be||me(t)===t)throw Error(`skill cleanup refuses to operate on the filesystem root (${t})`);return t}function D9(e){let t=dSe(e),n=[];for(let e of x6){let r=b6[e];n.push({path:M(t,`.agents`,`skills`,r),bundleId:e,scope:`central`});for(let i of W5)n.push({path:M(t,i.hostDir,`skills`,r),bundleId:e,scope:`host`,hostDir:i.hostDir})}return n}function fSe(e,t){let n=[];for(let r of D9(e))if(r.bundleId===t)try{D(r.path,{recursive:!0,force:!0})}catch(e){n.push(e instanceof Error?e:Error(String(e)))}if(n.length>0)throw AggregateError(n,`Failed to remove ${n.length} path(s) for ${t}`)}const pSe=[{id:`mcp-config`,write(e,t,n){let r=e.projectConfigPath?.(t);if(!r)return{integration:`mcp-config`,editorId:e.id,action:`skipped-unsupported`};try{let i=c9(e,t,n,void 0,r);return i.action===`written`||i.action===`overwritten`?{integration:`mcp-config`,editorId:e.id,action:i.action,path:i.configPath}:i.action===`failed`?{integration:`mcp-config`,editorId:e.id,action:`failed`,path:i.configPath,error:i.error??`unknown failure`}:i.action===`declined`?{integration:`mcp-config`,editorId:e.id,action:`declined`,path:i.configPath,...i.declineReason===void 0?{}:{reason:i.declineReason}}:{integration:`mcp-config`,editorId:e.id,action:`failed`,path:i.configPath,error:`unexpected project-scope action: ${i.action}`}}catch(t){return{integration:`mcp-config`,editorId:e.id,action:`failed`,path:r,error:t instanceof Error?t.message:String(t)}}}},{id:`project-skill`,write(e,t,n){try{let r=M7(e,t,{home:n.home});return{integration:`project-skill`,editorId:e.id,action:r.action,...r.path?{path:r.path}:{},...r.error?{error:r.error}:{}}}catch(t){return{integration:`project-skill`,editorId:e.id,action:`failed`,error:t instanceof Error?t.message:String(t)}}}}];function mSe(e,t,n={},r=pSe){let i=[];for(let a of t){let t=u7[a];for(let a of r)i.push(a.write(t,e,n))}return i}function hSe(e,t,n={}){return{integrations:mSe(e,t,n)}}function O9(e,t){return t.length===0||!e.includes(t)?e:e.split(t).join(`<CONTENT_DIR>`)}function gSe(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function k9(e,t){if(typeof e==`string`)return O9(e,t.contentDir);if(Array.isArray(e))return e.map(e=>k9(e,t));if(!gSe(e))return e;let n={};for(let[r,i]of Object.entries(e))n[r]=k9(i,t);return n}function A9(e,t){let n=S(e,`utf-8`);if(n.length===0)return;let r=n.endsWith(`
1512
+ `));let u=`${i?``:``}${l}`;return u!==r&&u$(e,u,{mode:Q7(e)}),{kind:`removed`}}function Qxe(e){return{event:`mcp-config-decline`,scope:e.scope,surface:e.surface,editorId:e.editorId,reason:e.reason}}function $xe(e){let{priorCommand:t,priorArgs:n}=b9(e.priorEntry);return{event:`mcp-config-migrate`,scope:e.scope,surface:e.surface,editorId:e.editorId,configPath:e.configPath,priorCommand:t,priorArgs:n}}function b9(e){return{priorCommand:typeof e.command==`string`?e.command.slice(0,200):null,priorArgs:Array.isArray(e.args)?e.args.slice(0,10).map(e=>typeof e==`string`?e.slice(0,200):e):null}}function eSe(e,t,n={}){let r=w_e(e,t);if(!g(r))return{status:`missing`,lockPath:r};let i;try{i=JSON.parse(S(r,`utf-8`))}catch{return{status:`corrupt`,lockPath:r}}if(!i||typeof i!=`object`||!Sge(i.pid))return{status:`corrupt`,lockPath:r};let a=i;if(!(n.isAlive??T3)(a.pid))return{status:`dead-pid`,lockPath:r,lock:a};if(typeof a.machineId==`string`)return a.machineId===(n.machineId??S_e())?{status:`alive`,lockPath:r,lock:a}:{status:`foreign-host`,lockPath:r,lock:a};let o=n.host??ce();return a.hostname===o?{status:`alive`,lockPath:r,lock:a}:{status:`foreign-host`,lockPath:r,lock:a}}function tSe(e,t,n={}){let r=n.isAlive??T3,i=[];for(let[n,a]of[[`server`,e],[`ui`,t]])(a.status===`alive`||a.status===`foreign-host`&&r(a.lock.pid))&&i.push({name:n,pid:a.lock.pid,port:a.lock.port});return{targets:i}}function nSe(e){let t=e.inspect??(t=>eSe(e.lockDir,t)),n=e.kill??((e,t)=>process.kill(e,t)),r=e.log??(e=>console.log(e)),i=e.error??(e=>console.error(e)),a=tSe(t(`server`),t(`ui`),{isAlive:e.isAlive});if(a.targets.length===0)return r(`No running open-knowledge processes.`),{stopped:[],failed:[],hadTargets:!1};let o=[],s=[];for(let e of a.targets)try{n(e.pid,`SIGTERM`),o.push(e)}catch(t){s.push({target:e,error:t instanceof Error?t.message:String(t)})}return o.length>0&&r(`Stopped: ${o.map(e=>`${e.name} (pid=${e.pid}, port=${e.port})`).join(`, `)}`),s.length>0&&i(`Failed to stop: ${s.map(({target:e,error:t})=>`${e.name} (pid=${e.pid}): ${t}`).join(`; `)}`),{stopped:o,failed:s,hadTargets:!0}}function x9(e,t){let n={...e};for(let r of Object.keys(t)){let i=e[r],a=t[r];L7(a)&&L7(i)?n[r]=x9(i,a):a!==void 0&&(n[r]=a)}return n}function rSe(e){if(!g(e))return{value:null,path:e,source:null,doc:null};let t;try{t=S(e,`utf-8`)}catch(t){let n=t instanceof Error?t.message:String(t);return console.warn(`[config] Failed to read ${e}: ${n}`),{value:null,path:e,source:null,doc:null,diagnostic:{code:`UNREADABLE`,detail:`${e}: ${n}`}}}let n=(0,Zt.parseDocument)(t);if(n.errors.length>0){let r=n.errors.map(e=>e.message).join(`; `);return console.warn(`[config] Failed to parse ${e}: ${r}`),{value:null,path:e,source:t,doc:null,diagnostic:{code:`YAML_PARSE`,detail:`${e}: ${r}`}}}let r=n.toJSON();return L7(r)?{value:r,path:e,source:t,doc:n}:{value:null,path:e,source:t,doc:n}}function iSe(e,t){return e.map(e=>{let n=e.path.map(e=>typeof e==`symbol`?String(e):e),r={path:n,message:e.message,issueCode:e.code};if(t.doc!==null&&t.source!==null){let e=sl({file:t.path,source:t.source,doc:t.doc,path:n});if(e!==void 0)return{...r,source:e}}return r})}function aSe(e){let t=e??process.cwd(),n=[],r=[],i=[],a=p$(`user`,t),o=Pfe({absPath:a});r.push(...o.diagnostics),!o.valid&&o.sidelinedTo!==void 0&&i.push({from:a,to:o.sidelinedTo});let s={};o.valid&&o.source!==void 0?(s=x9(s,o.value),n.push(a)):o.valid;let c=ye(t,`.ok`,`config.yml`),l=rSe(c);if(l.diagnostic!==void 0&&r.push(l.diagnostic),l.value!==null){let e=fl({value:l.value,file:l.path,source:l.source,doc:l.doc});r.push(...e);let t=e.length>0?ml(l.value):l.value;s=x9(s,t),n.push(c)}let u=Qye.safeParse(s);if(!u.success){let e={code:`SCHEMA_INVALID`,issues:iSe(u.error.issues,l)};throw Error(rl(e))}return{config:u.data,sources:n,diagnostics:r,sidelined:i}}function S9(e){return e.replace(/:\d+$/,``)}function C9(e){let t=e.trim();if(!t)return null;{let e=/^https?:\/\/([^/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`https`,hostname:S9(e[1]),owner:e[2],name:e[3]}}{let e=/^ssh:\/\/(?:[\w.-]+@)?([^/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`ssh`,hostname:S9(e[1]),owner:e[2],name:e[3]}}{let e=/^git:\/\/([^/?#]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`git`,hostname:S9(e[1]),owner:e[2],name:e[3]}}{let e=/^(?:[\w.-]+@)?([\w.-]+):([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?$/.exec(t);if(e?.[1].includes(`.`)||e&&t.startsWith(`git@`))return{protocol:`ssh`,hostname:e[1],owner:e[2],name:e[3]}}{let e=/^git:([\w.-]+)\/([\w.\-~%]+)\/([\w.\-~%]+?)(?:\.git)?\/?$/.exec(t);if(e)return{protocol:`git`,hostname:e[1],owner:e[2],name:e[3]}}if(!t.includes(`://`)&&!t.includes(`@`)&&!t.startsWith(`/`)){let e=/^([\w.-]+)\/([\w.\-~%]+?)(?:\.git)?$/.exec(t);if(e)return{protocol:`https`,hostname:`github.com`,owner:e[1],name:e[2]}}return null}function w9(e){let t;try{t=new URL(e)}catch{return null}if(t.protocol!==`https:`)return null;let n=kl(t.hostname);if(n===null)return null;let r=t.pathname.split(`/`).filter(e=>e.length>0);if(r.length<5||r[2]!==`blob`)return null;let i,a,o,s;try{i=decodeURIComponent(r[0]),a=decodeURIComponent(r[1]),o=decodeURIComponent(r[3]),s=r.slice(4).map(e=>decodeURIComponent(e))}catch{return null}return!i||!a||!o||s.length===0||s.some(e=>e.length===0)?null:{host:n,owner:i,repo:a,branch:o,path:s.join(`/`)}}function T9(e){let t;try{t=new URL(e)}catch{return null}if(t.protocol!==`https:`)return null;let n=kl(t.hostname);if(n===null)return null;let r=t.pathname.split(`/`);if(r.length<5||r[0]!==``||r[3]!==`tree`)return null;let i=r.slice(5);i.length===1&&i[0]===``&&i.pop();let a,o,s,c;try{a=decodeURIComponent(r[1]),o=decodeURIComponent(r[2]),s=decodeURIComponent(r[4]),c=i.map(e=>decodeURIComponent(e))}catch{return null}return!a||!o||!s||c.some(e=>e.length===0)?null:{host:n,owner:a,repo:o,branch:s,path:c.join(`/`)}}function oSe(e){let t=w9(e);if(t)return{kind:`doc`,...t};let n=T9(e);return n?{kind:`folder`,...n}:null}async function sSe(e,t){let n,r;try{n=await Ee(ye(e)),r=await Ee(ye(me(e)))}catch{return{kind:`not-git`}}if(!E9(n,r))return{kind:`symlink-escape`};let i=M(n,`.git`),a;try{a=ee(i)}catch{return{kind:`not-git`}}if(a.isDirectory()){let e;try{e=await Ee(i)}catch{return{kind:`not-git`}}if(!E9(e,n))return{kind:`symlink-escape`}}else if(!a.isFile())return{kind:`not-git`};let o=OY(n);if(o.kind!==`repository`)return{kind:`not-git`};let s=o.repository.readRemoteUrl(`origin`);if(s.kind===`unreadable`)return{kind:`not-git`};if(s.kind===`absent`)return s.reason===`config-missing`?{kind:`not-git`}:{kind:`no-origin`};let c=s.url,l=C9(c);if(l===null)return{kind:`non-github`};let u=kl(l.hostname);if(u===null)return{kind:`non-github`};let d=u===t.host.toLowerCase(),f=l.owner.toLowerCase()===t.owner.toLowerCase(),p=l.name.toLowerCase()===t.repo.toLowerCase();return!d&&f&&p?{kind:`wrong-host`,actualHost:u}:!d||!f||!p?{kind:`wrong-repo`,actualOwner:l.owner,actualRepo:l.name}:{kind:`ok`,gitRemoteUrl:`https://${u}/${l.owner}/${l.name}.git`}}function E9(e,t){if(e===t)return!0;let n=ve(t,e);return n.length>0&&!n.startsWith(`..`)&&!j(n)}const cSe=`# >>> open-knowledge cli >>>`,lSe=`# <<< open-knowledge cli <<<`,uSe=/^# >>> open-knowledge cli >>>\n[\s\S]*?^# <<< open-knowledge cli <<<\n?/m;function dSe(e){return M(e,`Library`,`Application Support`,`OpenKnowledge`,`path-install.json`)}[...x6.map(e=>b6[e])];function fSe(e){if(!j(e))throw Error(`skill cleanup requires an absolute home directory; got ${JSON.stringify(e)}`);let t=ye(e);if(t===be||me(t)===t)throw Error(`skill cleanup refuses to operate on the filesystem root (${t})`);return t}function D9(e){let t=fSe(e),n=[];for(let e of x6){let r=b6[e];n.push({path:M(t,`.agents`,`skills`,r),bundleId:e,scope:`central`});for(let i of W5)n.push({path:M(t,i.hostDir,`skills`,r),bundleId:e,scope:`host`,hostDir:i.hostDir})}return n}function pSe(e,t){let n=[];for(let r of D9(e))if(r.bundleId===t)try{D(r.path,{recursive:!0,force:!0})}catch(e){n.push(e instanceof Error?e:Error(String(e)))}if(n.length>0)throw AggregateError(n,`Failed to remove ${n.length} path(s) for ${t}`)}const mSe=[{id:`mcp-config`,write(e,t,n){let r=e.projectConfigPath?.(t);if(!r)return{integration:`mcp-config`,editorId:e.id,action:`skipped-unsupported`};try{let i=c9(e,t,n,void 0,r);return i.action===`written`||i.action===`overwritten`?{integration:`mcp-config`,editorId:e.id,action:i.action,path:i.configPath}:i.action===`failed`?{integration:`mcp-config`,editorId:e.id,action:`failed`,path:i.configPath,error:i.error??`unknown failure`}:i.action===`declined`?{integration:`mcp-config`,editorId:e.id,action:`declined`,path:i.configPath,...i.declineReason===void 0?{}:{reason:i.declineReason}}:{integration:`mcp-config`,editorId:e.id,action:`failed`,path:i.configPath,error:`unexpected project-scope action: ${i.action}`}}catch(t){return{integration:`mcp-config`,editorId:e.id,action:`failed`,path:r,error:t instanceof Error?t.message:String(t)}}}},{id:`project-skill`,write(e,t,n){try{let r=M7(e,t,{home:n.home});return{integration:`project-skill`,editorId:e.id,action:r.action,...r.path?{path:r.path}:{},...r.error?{error:r.error}:{}}}catch(t){return{integration:`project-skill`,editorId:e.id,action:`failed`,error:t instanceof Error?t.message:String(t)}}}}];function hSe(e,t,n={},r=mSe){let i=[];for(let a of t){let t=u7[a];for(let a of r)i.push(a.write(t,e,n))}return i}function gSe(e,t,n={}){return{integrations:hSe(e,t,n)}}function O9(e,t){return t.length===0||!e.includes(t)?e:e.split(t).join(`<CONTENT_DIR>`)}function _Se(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function k9(e,t){if(typeof e==`string`)return O9(e,t.contentDir);if(Array.isArray(e))return e.map(e=>k9(e,t));if(!_Se(e))return e;let n={};for(let[r,i]of Object.entries(e))n[r]=k9(i,t);return n}function A9(e,t){let n=S(e,`utf-8`);if(n.length===0)return;let r=n.endsWith(`
1513
1513
  `),i=n.split(`
1514
1514
  `),a=[];for(let e=0;e<i.length;e++){let n=i[e]??``;if(!(e===i.length-1&&n===``)){if(n.length===0){a.push(``);continue}try{let e=k9(JSON.parse(n),t);a.push(JSON.stringify(e))}catch{a.push(n)}}}ne(e,r?`${a.join(`
1515
1515
  `)}\n`:a.join(`
1516
1516
  `))}function j9(e,t){let n=S(e,`utf-8`);if(n.trim().length!==0)try{let r=k9(JSON.parse(n),t),i=n.endsWith(`
1517
1517
  `)?`
1518
- `:``;ne(e,`${JSON.stringify(r,null,2)}${i}`)}catch{let r=O9(n,t.contentDir);r!==n&&ne(e,r)}}function M9(e,t){let n=S(e,`utf-8`),r=O9(n,t.contentDir);r!==n&&ne(e,r)}function N9(e){try{return C(e,{withFileTypes:!0}).filter(e=>e.isFile()).map(t=>M(e,t.name))}catch{return[]}}const _Se=new Set([`agent-presence.json`,`agent-effects.json`,`runtime.json`]);function P9(e){return/\.log\.\d+$/.test(e)}function vSe(e){return e.endsWith(`.jsonl`)||e.endsWith(`.log`)||P9(e)}function ySe(e){let t={contentDir:e.contentDir};for(let n of[`telemetry`,`logs`,`process`])for(let r of N9(M(e.stagingDir,n)))vSe(r)?A9(r,t):r.endsWith(`.json`)?j9(r,t):M9(r,t);for(let n of N9(M(e.stagingDir,`state`))){let e=pe(n);n.endsWith(`.jsonl`)?A9(n,t):_Se.has(e)?j9(n,t):M9(n,t)}}const F9=[`.ok`,`local`,`telemetry`],I9=[`.ok`,`local`,`logs`],L9=[`.ok`,`local`,`loss-capture`],R9=`spans-current.jsonl`,z9=`spans-prev.jsonl`,B9=`server-current.jsonl`,V9=`server-prev.jsonl`,H9=`loss-current.jsonl`,U9=`loss-prev.jsonl`;function bSe(e){return M(e,...F9,R9)}function xSe(e){return M(e,...F9,z9)}function SSe(e){return M(e,...I9,B9)}function CSe(e){return M(e,...I9,V9)}function wSe(e){return M(e,...L9,H9)}function TSe(e){return M(e,...L9,U9)}const W9=1e3;async function ESe(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/agent-presence`,{signal:AbortSignal.timeout(W9)});return t.ok?await t.text():null}catch{return null}}async function DSe(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/agent-effects`,{signal:AbortSignal.timeout(W9)});return t.ok?await t.text():null}catch{return null}}async function OSe(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/watcher-recent`,{signal:AbortSignal.timeout(W9)});return t.ok?await t.text():null}catch{return null}}function kSe(e){try{let t=JSON.parse(e);if(typeof t!=`object`||!t)return null;let n=t.decisions;return Array.isArray(n)?n.length===0?``:`${n.map(e=>JSON.stringify(e)).join(`
1519
- `)}\n`:null}catch{return null}}function ASe(e){let t=M(e,`.git`,`ok`);if(!g(t))return null;let n=u(`git`,[`-C`,t,`log`,`--oneline`,`-50`],L3({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function jSe(e){let t=M(e,`.git`,`ok`);if(!g(t))return null;let n=u(`git`,[`-C`,t,`for-each-ref`,`--sort=-creatordate`,`--count=50`,`--format=%(refname)%09%(creatordate:iso-strict)%09%(contents:subject)`,`refs/checkpoints/`],L3({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function G9(){let e=process.env.OK_DESKTOP_VERSION,t=process.env.OK_DESKTOP_PACKAGED,n=process.env.OK_DESKTOP_CHANNEL;return e===void 0||t===void 0||n===void 0?null:{electronVersion:e,packaged:t===`1`||t.toLowerCase()===`true`,channel:n}}function MSe(){return{nodeVersion:process.version,platform:O(),arch:ie()}}function NSe(){return process.env.OTEL_SDK_DISABLED===`false`}function K9(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function q9(e){if(!g(e))return{};let t;try{t=(0,Zt.parse)(S(e,`utf-8`))}catch(t){return console.warn(`[ok diagnose bundle] failed to parse ${e} for manifest config; manifest will report schema defaults. Reason: ${t instanceof Error?t.message:String(t)}`),{}}if(!K9(t))return{};let n=t.telemetry;if(!K9(n))return{};let r=n.localSink;return K9(r)?r:{}}function J9(e){return typeof e==`boolean`?e:void 0}function PSe(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:void 0}function Y9(e){if(K9(e))return PSe(e.maxBytes)}function FSe(e){let t=q9(p$(`project`,e)),n=q9(p$(`project-local`,e));return{enabled:J9(n.enabled)??J9(t.enabled)??!0,spansMaxBytes:Y9(n.spans)??Y9(t.spans)??52428800,logsMaxBytes:Y9(n.logs)??Y9(t.logs)??26214400}}function ISe(e){return je(`sha256`).update(e).digest(`hex`)}function LSe(e){let t=S(e),n=0;for(let e=0;e<t.length;e++)t[e]===10&&n++;return n}function RSe(e){let t=S(e,`utf-8`),n=`"doc.name"`,r=0,i=t.indexOf(n);for(;i!==-1;)r++,i=t.indexOf(n,i+10);return r}function X9(e,t){if(!g(e))return!1;try{return v(me(t),{recursive:!0}),m(e,t),!0}catch{return!1}}function Z9(e){let t=[],n=e=>{let r=C(e,{withFileTypes:!0});for(let i of r){let r=M(e,i.name);i.isDirectory()?n(r):i.isFile()&&t.push(r)}};return n(e),t.sort()}const zSe=new Set([`.jsonl`]);function Q9(e){let t=e.lastIndexOf(`.`);return t===-1?!1:zSe.has(e.slice(t))}const BSe=new Set([`.jsonl`,`.json`,`.txt`,`.log`,`.lock`]);function VSe(e){if(P9(e))return!0;let t=e.lastIndexOf(`.`);return t===-1?!1:BSe.has(e.slice(t))}function HSe(e){let t=[];for(let n of Z9(e)){let r=$9(e,n);if(!VSe(r))continue;let{redacted:i,patterns:a,lineCount:o}=zo(S(n,`utf-8`));a.length!==0&&(ne(n,i),t.push({file:r,lineCount:o,patterns:a}))}return{redactions:t,redactedLineCount:t.reduce((e,t)=>e+t.lineCount,0)}}function $9(e,t){return ve(e,t).split(be).join(`/`)}async function USe(e){let t=ye(e.contentDir),n=ye(e.projectDir??e.contentDir),r=e.deps??{},i=r.fetchAgentPresence??ESe,a=r.fetchAgentEffects??DSe,o=r.fetchWatcherRecent??OSe,s=r.readShadowHead??ASe,c=r.readCheckpointRefs??jSe,l=r.now??(()=>new Date),u=r.okVersion??(()=>`0.50.0-beta.5`),d=r.readDesktopEnv??G9,f=r.readRuntime??MSe,p=r.isOtlpPushEnabled??NSe,h=y(M(ue(),`ok-bundle-`));try{v(M(h,`telemetry`),{recursive:!0}),v(M(h,`logs`),{recursive:!0}),v(M(h,`state`),{recursive:!0}),X9(bSe(n),M(h,`telemetry`,R9)),X9(xSe(n),M(h,`telemetry`,z9)),X9(SSe(n),M(h,`logs`,B9)),X9(CSe(n),M(h,`logs`,V9));for(let t of e.userLogFiles??[])X9(t,M(h,`logs`,pe(t)));let _=M(n,`.ok`,`local`),y=M(_,`server.lock`),b=`not-running`,x=`no server.lock`,C=null;if(g(y)){X9(y,M(h,`state`,`server.lock`));try{let e=S(y,`utf-8`),t=JSON.parse(e);typeof t.port==`number`?C=t.port:x=`lock present but no port`}catch{x=`lock present but unparseable`}}if(C!==null){let e=await i(C);e===null?x=`agent-presence endpoint at :${C} unreachable`:(ne(M(h,`state`,`agent-presence.json`),e),b=`running`,x=``);let t=await a(C);t!==null&&ne(M(h,`state`,`agent-effects.json`),t);let n=await o(C);if(n!==null){let e=kSe(n);e!==null&&ne(M(h,`state`,`watcher-recent.jsonl`),e)}}let w=s(t);w!==null&&ne(M(h,`state`,`shadow-head.txt`),w);let T=c(t);T!==null&&ne(M(h,`state`,`checkpoint-refs.txt`),T),X9(wSe(n),M(h,`state`,H9)),X9(TSe(n),M(h,`state`,U9)),X9(M(_,`last-spawn-error.log`),M(h,`state`,`last-spawn-error.log`)),X9(M(_,oY),M(h,`state`,oY)),X9(M(_,sY),M(h,`state`,sY));let E=f(),te=d(),re={ok:{version:u(),nodeVersion:E.nodeVersion,platform:E.platform,arch:E.arch},host:{desktop:te}};ne(M(h,`state`,`runtime.json`),`${JSON.stringify(re,null,2)}\n`);let ie=b===`running`?`running
1520
- `:`not-running (${x})\n`;if(ne(M(h,`state`,`server-status.txt`),ie),e.processDir&&g(e.processDir)){let t=M(h,`process`);v(t,{recursive:!0}),m(e.processDir,t,{recursive:!0})}let ae=e.redact===!0;ae&&ySe({stagingDir:h,contentDir:t}),e.note&&ne(M(h,`note.txt`),e.note);let oe=null;e.scrubSecrets===!0&&(oe=HSe(h));for(let t of e.extraFiles??[])X9(t.sourcePath,M(h,`extra`,t.zipName??pe(t.sourcePath)))||r.logger?.warn({sourcePath:t.sourcePath},`extra file missing; omitted from bundle`);let se=FSe(n),ce=Z9(h),O=[],le=0,ue=0;for(let e of ce){let t=$9(h,e),n=ee(e).size,r=Q9(t)?LSe(e):0;O.push({path:t,bytes:n,lines:r}),le+=n,t.startsWith(`telemetry/`)&&Q9(t)&&(ue+=RSe(e))}let de={applied:ae};oe!==null&&(de.secretScrub=oe);let k={schemaVersion:2,createdAt:l().toISOString(),ok:{version:u(),nodeVersion:E.nodeVersion,platform:E.platform,arch:E.arch},host:{desktop:te},contentDir:{pathSha256:ISe(t),absolutePath:ae?`<CONTENT_DIR>`:t},telemetry:{localSink:se,otlpPushEnabled:p()},redaction:de,serverStatus:b,files:O};ne(M(h,`manifest.json`),`${JSON.stringify(k,null,2)}\n`);let A=ce.some(e=>{try{return S(e,`utf-8`).includes(t)}catch{return!1}}),fe={totalBytes:le,fileCount:O.length,docNameCount:ue,contentDirVisible:A,redacted:ae},me=!1;return{stagingDir:h,manifest:k,summary:fe,cleanup:()=>{me||(me=!0,D(h,{recursive:!0,force:!0}))}}}catch(e){throw D(h,{recursive:!0,force:!0}),e}}async function WSe(e){let{collected:t,outputPath:n}=e,r=me(n);if(!g(r))throw Error(`ok diagnose bundle: parent directory does not exist: ${r}. Create it or pass --out with an existing parent.`);let i=new E_e.ZipFile,a=Z9(t.stagingDir);for(let e of a){let n=$9(t.stagingDir,e);i.addFile(e,n)}i.end();let o=h(n);return i.outputStream.pipe(o),await new Promise((e,t)=>{o.on(`close`,e),o.on(`error`,t),i.outputStream.on(`error`,t)}),n}function GSe(e,t){let n=M(e,`.ok`,`config.yml`);if(g(n))try{let t=(0,Zt.parse)(S(n,`utf-8`)),r=L7(t)?t.content:void 0,i=L7(r)?r.dir:void 0;if(typeof i==`string`&&i.length>0)return ye(e,i)}catch(e){t?.warn({configPath:n,err:e},`bug-report: failed to read .ok/config.yml; falling back to project root as content dir`)}return ye(e)}async function KSe(e,t,n){let r=p9(t,e.logger),i=await USe({contentDir:GSe(t,e.logger),projectDir:t,redact:e.redact,scrubSecrets:e.redact,note:e.note,extraFiles:e.extraFiles,userLogFiles:[...Vxe(r,e.userLogsDir??M(se(),`.ok`,`logs`)),...h9(e.cachesDir??M(se(),`Library`,`Caches`))],deps:{readDesktopEnv:n,logger:e.logger}});try{v(me(e.outputPath),{recursive:!0}),await WSe({collected:i,outputPath:e.outputPath});let t=i.manifest.redaction.secretScrub;return{zipPath:e.outputPath,summary:{level:`full`,systemWide:!1,projectSlug:r,files:i.manifest.files.map(e=>e.path),redactions:t?.redactions??[],redactedLineCount:t?.redactedLineCount??0,generatedAt:i.manifest.createdAt}}}finally{i.cleanup()}}async function qSe(e){let{projectDir:t}=e,n=e.readDesktopEnv??G9;if(e.level===`full`&&t!==void 0)return KSe(e,t,n);let{zipPath:r,summary:i}=await Gxe({projectDir:t,redact:e.redact,outputPath:e.outputPath,userLogsDir:e.userLogsDir,shipItLogFiles:h9(e.cachesDir??M(se(),`Library`,`Caches`)),logger:e.logger,note:e.note,extraFiles:e.extraFiles,desktop:n()});return{zipPath:r,summary:{level:e.level,systemWide:t===void 0,projectSlug:i.projectSlug,files:i.files,redactions:i.redactions,redactedLineCount:i.redactedLineCount,generatedAt:i.generatedAt}}}export{H5 as ALL_EDITOR_IDS,U5 as EDITOR_LABELS,u7 as EDITOR_TARGETS,W5 as HOSTS_WITH_USER_SKILL_DIR,Mxe as LAUNCH_CONFIG_NAME,sSe as PATH_SHIM_BEGIN,lSe as PATH_SHIM_BLOCK_RE,cSe as PATH_SHIM_END,mxe as addOkPathsToGitExclude,k7 as assertProjectPathSafe,$5 as buildManagedServerEntry,Zxe as buildMcpConfigDeclineEvent,Qxe as buildMcpConfigMigrateEvent,d9 as classifyExistingMcpEntry,qSe as collectReportBundle,tn as createTokenStore,Rxe as defaultBugReportZipPath,Ve as detectGh,Ixe as detectInstalledEditors,dbe as editorConfigPathDisplay,ube as editorEntryLocator,K7 as formatTrackedRemediation,_xe as getExcludedOkPaths,W7 as getOkArtifactPaths,Z5 as isEntryUpToDate,e7 as isOwnManagedEntry,iSe as loadConfig,dee as makeLazyProbeTokenStore,f9 as okBugReportsDir,w9 as parseGitHubBlobUrl,aSe as parseGitHubShareUrl,T9 as parseGitHubTreeUrl,C9 as parseGitUrl,uSe as pathInstallMarkerPath,Gbe as previewContent,Lxe as probeOwnManagedEditorMcpEntry,G7 as probeTrackedOkPaths,l9 as readExistingMcpEntry,gxe as readSharingMode,vxe as readSkillsShared,zo as redactContent,hxe as removeOkPathsFromGitExclude,qxe as removeOwnMcpEntry,rxe as removeProjectSkill,fSe as removeUserGlobalSkillBundle,$be as resolveProjectRoot,tSe as runStop,yxe as setSkillsShared,b9 as truncatePriorEntry,D9 as userGlobalSkillBundleTargets,oSe as validateLocalFolderForShare,c9 as writeEditorMcpConfig,hSe as writeProjectAiIntegrations,M7 as writeProjectSkill,Fxe as writeUserMcpConfigs};
1518
+ `:``;ne(e,`${JSON.stringify(r,null,2)}${i}`)}catch{let r=O9(n,t.contentDir);r!==n&&ne(e,r)}}function M9(e,t){let n=S(e,`utf-8`),r=O9(n,t.contentDir);r!==n&&ne(e,r)}function N9(e){try{return C(e,{withFileTypes:!0}).filter(e=>e.isFile()).map(t=>M(e,t.name))}catch{return[]}}const vSe=new Set([`agent-presence.json`,`agent-effects.json`,`runtime.json`]);function P9(e){return/\.log\.\d+$/.test(e)}function ySe(e){return e.endsWith(`.jsonl`)||e.endsWith(`.log`)||P9(e)}function bSe(e){let t={contentDir:e.contentDir};for(let n of[`telemetry`,`logs`,`process`])for(let r of N9(M(e.stagingDir,n)))ySe(r)?A9(r,t):r.endsWith(`.json`)?j9(r,t):M9(r,t);for(let n of N9(M(e.stagingDir,`state`))){let e=pe(n);n.endsWith(`.jsonl`)?A9(n,t):vSe.has(e)?j9(n,t):M9(n,t)}}const F9=[`.ok`,`local`,`telemetry`],I9=[`.ok`,`local`,`logs`],L9=[`.ok`,`local`,`loss-capture`],R9=`spans-current.jsonl`,z9=`spans-prev.jsonl`,B9=`server-current.jsonl`,V9=`server-prev.jsonl`,H9=`loss-current.jsonl`,U9=`loss-prev.jsonl`;function xSe(e){return M(e,...F9,R9)}function SSe(e){return M(e,...F9,z9)}function CSe(e){return M(e,...I9,B9)}function wSe(e){return M(e,...I9,V9)}function TSe(e){return M(e,...L9,H9)}function ESe(e){return M(e,...L9,U9)}const W9=1e3;async function DSe(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/agent-presence`,{signal:AbortSignal.timeout(W9)});return t.ok?await t.text():null}catch{return null}}async function OSe(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/agent-effects`,{signal:AbortSignal.timeout(W9)});return t.ok?await t.text():null}catch{return null}}async function kSe(e){try{let t=await fetch(`http://127.0.0.1:${e}/api/metrics/watcher-recent`,{signal:AbortSignal.timeout(W9)});return t.ok?await t.text():null}catch{return null}}function ASe(e){try{let t=JSON.parse(e);if(typeof t!=`object`||!t)return null;let n=t.decisions;return Array.isArray(n)?n.length===0?``:`${n.map(e=>JSON.stringify(e)).join(`
1519
+ `)}\n`:null}catch{return null}}function jSe(e){let t=M(e,`.git`,`ok`);if(!g(t))return null;let n=u(`git`,[`-C`,t,`log`,`--oneline`,`-50`],L3({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function MSe(e){let t=M(e,`.git`,`ok`);if(!g(t))return null;let n=u(`git`,[`-C`,t,`for-each-ref`,`--sort=-creatordate`,`--count=50`,`--format=%(refname)%09%(creatordate:iso-strict)%09%(contents:subject)`,`refs/checkpoints/`],L3({encoding:`utf-8`,timeout:2e3}));return n.error||n.status!==0?null:n.stdout??``}function G9(){let e=process.env.OK_DESKTOP_VERSION,t=process.env.OK_DESKTOP_PACKAGED,n=process.env.OK_DESKTOP_CHANNEL;return e===void 0||t===void 0||n===void 0?null:{electronVersion:e,packaged:t===`1`||t.toLowerCase()===`true`,channel:n}}function NSe(){return{nodeVersion:process.version,platform:O(),arch:ie()}}function PSe(){return process.env.OTEL_SDK_DISABLED===`false`}function K9(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function q9(e){if(!g(e))return{};let t;try{t=(0,Zt.parse)(S(e,`utf-8`))}catch(t){return console.warn(`[ok diagnose bundle] failed to parse ${e} for manifest config; manifest will report schema defaults. Reason: ${t instanceof Error?t.message:String(t)}`),{}}if(!K9(t))return{};let n=t.telemetry;if(!K9(n))return{};let r=n.localSink;return K9(r)?r:{}}function J9(e){return typeof e==`boolean`?e:void 0}function FSe(e){return typeof e==`number`&&Number.isFinite(e)&&e>0?e:void 0}function Y9(e){if(K9(e))return FSe(e.maxBytes)}function ISe(e){let t=q9(p$(`project`,e)),n=q9(p$(`project-local`,e));return{enabled:J9(n.enabled)??J9(t.enabled)??!0,spansMaxBytes:Y9(n.spans)??Y9(t.spans)??52428800,logsMaxBytes:Y9(n.logs)??Y9(t.logs)??26214400}}function LSe(e){return je(`sha256`).update(e).digest(`hex`)}function RSe(e){let t=S(e),n=0;for(let e=0;e<t.length;e++)t[e]===10&&n++;return n}function zSe(e){let t=S(e,`utf-8`),n=`"doc.name"`,r=0,i=t.indexOf(n);for(;i!==-1;)r++,i=t.indexOf(n,i+10);return r}function X9(e,t){if(!g(e))return!1;try{return v(me(t),{recursive:!0}),m(e,t),!0}catch{return!1}}function Z9(e){let t=[],n=e=>{let r=C(e,{withFileTypes:!0});for(let i of r){let r=M(e,i.name);i.isDirectory()?n(r):i.isFile()&&t.push(r)}};return n(e),t.sort()}const BSe=new Set([`.jsonl`]);function Q9(e){let t=e.lastIndexOf(`.`);return t===-1?!1:BSe.has(e.slice(t))}const VSe=new Set([`.jsonl`,`.json`,`.txt`,`.log`,`.lock`]);function HSe(e){if(P9(e))return!0;let t=e.lastIndexOf(`.`);return t===-1?!1:VSe.has(e.slice(t))}function USe(e){let t=[];for(let n of Z9(e)){let r=$9(e,n);if(!HSe(r))continue;let{redacted:i,patterns:a,lineCount:o}=zo(S(n,`utf-8`));a.length!==0&&(ne(n,i),t.push({file:r,lineCount:o,patterns:a}))}return{redactions:t,redactedLineCount:t.reduce((e,t)=>e+t.lineCount,0)}}function $9(e,t){return ve(e,t).split(be).join(`/`)}async function WSe(e){let t=ye(e.contentDir),n=ye(e.projectDir??e.contentDir),r=e.deps??{},i=r.fetchAgentPresence??DSe,a=r.fetchAgentEffects??OSe,o=r.fetchWatcherRecent??kSe,s=r.readShadowHead??jSe,c=r.readCheckpointRefs??MSe,l=r.now??(()=>new Date),u=r.okVersion??(()=>`0.50.0-beta.6`),d=r.readDesktopEnv??G9,f=r.readRuntime??NSe,p=r.isOtlpPushEnabled??PSe,h=y(M(ue(),`ok-bundle-`));try{v(M(h,`telemetry`),{recursive:!0}),v(M(h,`logs`),{recursive:!0}),v(M(h,`state`),{recursive:!0}),X9(xSe(n),M(h,`telemetry`,R9)),X9(SSe(n),M(h,`telemetry`,z9)),X9(CSe(n),M(h,`logs`,B9)),X9(wSe(n),M(h,`logs`,V9));for(let t of e.userLogFiles??[])X9(t,M(h,`logs`,pe(t)));let _=M(n,`.ok`,`local`),y=M(_,`server.lock`),b=`not-running`,x=`no server.lock`,C=null;if(g(y)){X9(y,M(h,`state`,`server.lock`));try{let e=S(y,`utf-8`),t=JSON.parse(e);typeof t.port==`number`?C=t.port:x=`lock present but no port`}catch{x=`lock present but unparseable`}}if(C!==null){let e=await i(C);e===null?x=`agent-presence endpoint at :${C} unreachable`:(ne(M(h,`state`,`agent-presence.json`),e),b=`running`,x=``);let t=await a(C);t!==null&&ne(M(h,`state`,`agent-effects.json`),t);let n=await o(C);if(n!==null){let e=ASe(n);e!==null&&ne(M(h,`state`,`watcher-recent.jsonl`),e)}}let w=s(t);w!==null&&ne(M(h,`state`,`shadow-head.txt`),w);let T=c(t);T!==null&&ne(M(h,`state`,`checkpoint-refs.txt`),T),X9(TSe(n),M(h,`state`,H9)),X9(ESe(n),M(h,`state`,U9)),X9(M(_,`last-spawn-error.log`),M(h,`state`,`last-spawn-error.log`)),X9(M(_,oY),M(h,`state`,oY)),X9(M(_,sY),M(h,`state`,sY));let E=f(),te=d(),re={ok:{version:u(),nodeVersion:E.nodeVersion,platform:E.platform,arch:E.arch},host:{desktop:te}};ne(M(h,`state`,`runtime.json`),`${JSON.stringify(re,null,2)}\n`);let ie=b===`running`?`running
1520
+ `:`not-running (${x})\n`;if(ne(M(h,`state`,`server-status.txt`),ie),e.processDir&&g(e.processDir)){let t=M(h,`process`);v(t,{recursive:!0}),m(e.processDir,t,{recursive:!0})}let ae=e.redact===!0;ae&&bSe({stagingDir:h,contentDir:t}),e.note&&ne(M(h,`note.txt`),e.note);let oe=null;e.scrubSecrets===!0&&(oe=USe(h));for(let t of e.extraFiles??[])X9(t.sourcePath,M(h,`extra`,t.zipName??pe(t.sourcePath)))||r.logger?.warn({sourcePath:t.sourcePath},`extra file missing; omitted from bundle`);let se=ISe(n),ce=Z9(h),O=[],le=0,ue=0;for(let e of ce){let t=$9(h,e),n=ee(e).size,r=Q9(t)?RSe(e):0;O.push({path:t,bytes:n,lines:r}),le+=n,t.startsWith(`telemetry/`)&&Q9(t)&&(ue+=zSe(e))}let de={applied:ae};oe!==null&&(de.secretScrub=oe);let k={schemaVersion:2,createdAt:l().toISOString(),ok:{version:u(),nodeVersion:E.nodeVersion,platform:E.platform,arch:E.arch},host:{desktop:te},contentDir:{pathSha256:LSe(t),absolutePath:ae?`<CONTENT_DIR>`:t},telemetry:{localSink:se,otlpPushEnabled:p()},redaction:de,serverStatus:b,files:O};ne(M(h,`manifest.json`),`${JSON.stringify(k,null,2)}\n`);let A=ce.some(e=>{try{return S(e,`utf-8`).includes(t)}catch{return!1}}),fe={totalBytes:le,fileCount:O.length,docNameCount:ue,contentDirVisible:A,redacted:ae},me=!1;return{stagingDir:h,manifest:k,summary:fe,cleanup:()=>{me||(me=!0,D(h,{recursive:!0,force:!0}))}}}catch(e){throw D(h,{recursive:!0,force:!0}),e}}async function GSe(e){let{collected:t,outputPath:n}=e,r=me(n);if(!g(r))throw Error(`ok diagnose bundle: parent directory does not exist: ${r}. Create it or pass --out with an existing parent.`);let i=new D_e.ZipFile,a=Z9(t.stagingDir);for(let e of a){let n=$9(t.stagingDir,e);i.addFile(e,n)}i.end();let o=h(n);return i.outputStream.pipe(o),await new Promise((e,t)=>{o.on(`close`,e),o.on(`error`,t),i.outputStream.on(`error`,t)}),n}function KSe(e,t){let n=M(e,`.ok`,`config.yml`);if(g(n))try{let t=(0,Zt.parse)(S(n,`utf-8`)),r=L7(t)?t.content:void 0,i=L7(r)?r.dir:void 0;if(typeof i==`string`&&i.length>0)return ye(e,i)}catch(e){t?.warn({configPath:n,err:e},`bug-report: failed to read .ok/config.yml; falling back to project root as content dir`)}return ye(e)}async function qSe(e,t,n){let r=p9(t,e.logger),i=await WSe({contentDir:KSe(t,e.logger),projectDir:t,redact:e.redact,scrubSecrets:e.redact,note:e.note,extraFiles:e.extraFiles,userLogFiles:[...Hxe(r,e.userLogsDir??M(se(),`.ok`,`logs`)),...h9(e.cachesDir??M(se(),`Library`,`Caches`))],deps:{readDesktopEnv:n,logger:e.logger}});try{v(me(e.outputPath),{recursive:!0}),await GSe({collected:i,outputPath:e.outputPath});let t=i.manifest.redaction.secretScrub;return{zipPath:e.outputPath,summary:{level:`full`,systemWide:!1,projectSlug:r,files:i.manifest.files.map(e=>e.path),redactions:t?.redactions??[],redactedLineCount:t?.redactedLineCount??0,generatedAt:i.manifest.createdAt}}}finally{i.cleanup()}}async function JSe(e){let{projectDir:t}=e,n=e.readDesktopEnv??G9;if(e.level===`full`&&t!==void 0)return qSe(e,t,n);let{zipPath:r,summary:i}=await Kxe({projectDir:t,redact:e.redact,outputPath:e.outputPath,userLogsDir:e.userLogsDir,shipItLogFiles:h9(e.cachesDir??M(se(),`Library`,`Caches`)),logger:e.logger,note:e.note,extraFiles:e.extraFiles,desktop:n()});return{zipPath:r,summary:{level:e.level,systemWide:t===void 0,projectSlug:i.projectSlug,files:i.files,redactions:i.redactions,redactedLineCount:i.redactedLineCount,generatedAt:i.generatedAt}}}export{H5 as ALL_EDITOR_IDS,U5 as EDITOR_LABELS,u7 as EDITOR_TARGETS,W5 as HOSTS_WITH_USER_SKILL_DIR,Nxe as LAUNCH_CONFIG_NAME,cSe as PATH_SHIM_BEGIN,uSe as PATH_SHIM_BLOCK_RE,lSe as PATH_SHIM_END,hxe as addOkPathsToGitExclude,k7 as assertProjectPathSafe,$5 as buildManagedServerEntry,Qxe as buildMcpConfigDeclineEvent,$xe as buildMcpConfigMigrateEvent,d9 as classifyExistingMcpEntry,JSe as collectReportBundle,tn as createTokenStore,zxe as defaultBugReportZipPath,Ve as detectGh,Lxe as detectInstalledEditors,fbe as editorConfigPathDisplay,dbe as editorEntryLocator,K7 as formatTrackedRemediation,vxe as getExcludedOkPaths,W7 as getOkArtifactPaths,Z5 as isEntryUpToDate,e7 as isOwnManagedEntry,aSe as loadConfig,dee as makeLazyProbeTokenStore,f9 as okBugReportsDir,w9 as parseGitHubBlobUrl,oSe as parseGitHubShareUrl,T9 as parseGitHubTreeUrl,C9 as parseGitUrl,dSe as pathInstallMarkerPath,Kbe as previewContent,Rxe as probeOwnManagedEditorMcpEntry,G7 as probeTrackedOkPaths,l9 as readExistingMcpEntry,_xe as readSharingMode,yxe as readSkillsShared,zo as redactContent,gxe as removeOkPathsFromGitExclude,Jxe as removeOwnMcpEntry,ixe as removeProjectSkill,pSe as removeUserGlobalSkillBundle,exe as resolveProjectRoot,nSe as runStop,bxe as setSkillsShared,b9 as truncatePriorEntry,D9 as userGlobalSkillBundleTargets,sSe as validateLocalFolderForShare,c9 as writeEditorMcpConfig,gSe as writeProjectAiIntegrations,M7 as writeProjectSkill,Ixe as writeUserMcpConfigs};
1521
1521
  //# sourceMappingURL=index.mjs.map